summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/monit/monit.chart.py
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/python.d.plugin/monit/monit.chart.py')
-rw-r--r--collectors/python.d.plugin/monit/monit.chart.py28
1 files changed, 22 insertions, 6 deletions
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)