From a8220ab2d293bb7f4b014b79d16b2fb05090fa93 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Feb 2021 12:45:55 +0100 Subject: Adding upstream version 1.29.0. Signed-off-by: Daniel Baumann --- collectors/python.d.plugin/monit/README.md | 18 ++++++++++++++-- collectors/python.d.plugin/monit/monit.chart.py | 28 +++++++++++++++++++------ 2 files changed, 38 insertions(+), 8 deletions(-) (limited to 'collectors/python.d.plugin/monit') diff --git a/collectors/python.d.plugin/monit/README.md b/collectors/python.d.plugin/monit/README.md index a54b9d67f..fe1389687 100644 --- a/collectors/python.d.plugin/monit/README.md +++ b/collectors/python.d.plugin/monit/README.md @@ -1,4 +1,10 @@ -# monit + + +# Monit monitoring with Netdata Monit monitoring module. Data is grabbed from stats XML interface (exists for a long time, but not mentioned in official documentation). Mostly this plugin shows statuses of monit targets, i.e. [statuses of specified checks](https://mmonit.com/monit/documentation/monit.html#Service-checks). @@ -19,7 +25,15 @@ Monit monitoring module. Data is grabbed from stats XML interface (exists for a - Hosts (+latency) - Network interfaces -## configuration +## Configuration + +Edit the `python.d/monit.conf` configuration file using `edit-config` from the Netdata [config +directory](/docs/configure/nodes.md), which is typically at `/etc/netdata`. + +```bash +cd /etc/netdata # Replace this path with your Netdata config directory, if different +sudo ./edit-config python.d/monit.conf +``` Sample: diff --git a/collectors/python.d.plugin/monit/monit.chart.py b/collectors/python.d.plugin/monit/monit.chart.py index 9f3270572..bfc182349 100644 --- a/collectors/python.d.plugin/monit/monit.chart.py +++ b/collectors/python.d.plugin/monit/monit.chart.py @@ -4,12 +4,10 @@ # SPDX-License-Identifier: GPL-3.0-or-later import xml.etree.ElementTree as ET - from collections import namedtuple from bases.FrameworkServices.UrlService import UrlService - MonitType = namedtuple('MonitType', ('index', 'name')) # see enum Service_Type from monit.h (https://bitbucket.org/tildeslash/monit/src/master/src/monit.h) @@ -122,7 +120,7 @@ CHARTS = { class BaseMonitService(object): - def __init__(self, typ, name, status, monitor): + def __init__(self, typ, name, status, monitor): self.type = typ self.name = name self.status = status @@ -153,12 +151,21 @@ class BaseMonitService(object): class ProcessMonitService(BaseMonitService): - def __init__(self, typ, name, status, monitor): + def __init__(self, typ, name, status, monitor): super(ProcessMonitService, self).__init__(typ, name, status, monitor) self.uptime = None self.threads = None self.children = None + def __eq__(self, other): + return super(ProcessMonitService, self).__eq__(other) + + def __ne__(self, other): + return super(ProcessMonitService, self).__ne__(other) + + def __hash__(self): + return super(ProcessMonitService, self).__hash__() + def uptime_key(self): return 'process_uptime_{0}'.format(self.name) @@ -183,16 +190,25 @@ class ProcessMonitService(BaseMonitService): class HostMonitService(BaseMonitService): - def __init__(self, typ, name, status, monitor): + def __init__(self, typ, name, status, monitor): super(HostMonitService, self).__init__(typ, name, status, monitor) self.latency = None + def __eq__(self, other): + return super(HostMonitService, self).__eq__(other) + + def __ne__(self, other): + return super(HostMonitService, self).__ne__(other) + + def __hash__(self): + return super(HostMonitService, self).__hash__() + def latency_key(self): return 'host_latency_{0}'.format(self.name) def data(self): base_data = super(HostMonitService, self).data() - latency = float(self.latency) * 1000000 if self.latency else None + latency = float(self.latency) * 1000000 if self.latency else None data = {self.latency_key(): latency} data.update(base_data) -- cgit v1.2.3