コード例 #1
0
    def process_zabbix(target):
        """Process a Zabbix target

        Args:
            target: the config file portion for this specific target.

        Returns: None
        """

        mm = MetricManager(target['path'])
        zbxapi = SimpleZabbix(
            url=target['api_url'],
            user=target['api_user'],
            password=target['api_password'],
        )

        zbxsender = ZabbixSender(target['trapper_server'],
                                 target['trapper_port'])

        hostname = socket.gethostname()
        zmp = ZabbixMetricProcessor(mm,
                                    zbxapi,
                                    zbxsender,
                                    hostname,
                                    verbose=True)
        return zmp.process_zbx_metrics()
コード例 #2
0
    def process_zabbix(target):
        """Process a Zabbix target

        Args:
            target: the config file portion for this specific target.

        Returns: None
        """

        mm = MetricManager(target['path'])
        zbxapi = SimpleZabbix(
            url=target['api_url'],
            user=target['api_user'],
            password=target['api_password'],
        )

        zbxsender = ZabbixSender(target['trapper_server'], target['trapper_port'])

        zmp = ZabbixMetricProcessor(mm, zbxapi, zbxsender)
        zmp.process_metrics()
コード例 #3
0
    def process_heartbeats(target):
        """Send heartbeats to the target

        Args:
            target: the config file portion for this specific target.

        Returns: None
        """

        mm = MetricManager(target['path'])
        zbxapi = SimpleZabbix(
            url=target['api_url'],
            user=target['api_user'],
            password=target['api_password'],
        )

        zbxsender = ZabbixSender(target['trapper_server'], target['trapper_port'])

        hostname = socket.gethostname()
        zmp = ZabbixMetricProcessor(mm, zbxapi, zbxsender, hostname, verbose=True)
        return zmp.process_hb_metrics()
コード例 #4
0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
#

#This is not a module, but pylint thinks it is.  This is a command.
#pylint: disable=invalid-name

"""This is a script the processes zagg metrics.
"""

from openshift_tools.monitoring.metricmanager import MetricManager
from openshift_tools.monitoring.zabbix_metric_processor import ZabbixSender, ZabbixMetricProcessor
from openshift_tools.ansible.simplezabbix import SimpleZabbix

if __name__ == "__main__":
    mm = MetricManager('/tmp/metrics')
    zbxapi = SimpleZabbix(
        url='http://localhost/zabbix/api_jsonrpc.php',
        user='******',
        password='******',
    )

    zbxsender = ZabbixSender('localhost', 10051)

    mp = ZabbixMetricProcessor(mm, zbxapi, zbxsender)
    mp.process_metrics()