Merge "Don't send http_check_check metric"
diff --git a/collectd/files/plugin/collectd_base.py b/collectd/files/plugin/collectd_base.py
index 7923274..ebf3120 100644
--- a/collectd/files/plugin/collectd_base.py
+++ b/collectd/files/plugin/collectd_base.py
@@ -49,7 +49,8 @@
MAX_IDENTIFIER_LENGTH = 63
- def __init__(self, collectd, service_name=None, local_check=True):
+ def __init__(self, collectd, service_name=None, local_check=True,
+ disable_check_metric=False):
self.debug = False
self.timeout = 5
self.max_retries = 3
@@ -63,11 +64,12 @@
self.service_name = service_name
self.local_check = local_check
+ self.disable_check_metric = disable_check_metric
def config_callback(self, conf):
for node in conf.children:
if node.key == "Debug":
- if node.values[0] in ['True', 'true']:
+ if node.values[0].lower() == 'true':
self.debug = True
elif node.key == "Timeout":
self.timeout = int(node.values[0])
@@ -75,6 +77,9 @@
self.max_retries = int(node.values[0])
elif node.key == 'DependsOnResource':
self.depends_on_resource = node.values[0]
+ elif node.key == 'DisableCheckMetric':
+ if node.values[0].lower() == 'true':
+ self.disable_check_metric = True
@read_callback_wrapper
def conditional_read_callback(self):
@@ -95,11 +100,16 @@
else:
self.dispatch_check_metric(self.OK)
- def dispatch_check_metric(self, check, failure=None):
+ def dispatch_check_metric(self, value, failure=None):
+ """Send a check metric reporting whether or not the plugin succeeded
+ """
+ if self.disable_check_metric:
+ return
+
metric = {
'meta': {'service_check': self.service_name or self.plugin,
'local_check': self.local_check},
- 'values': check,
+ 'values': value,
}
if failure is not None:
diff --git a/collectd/files/plugin/http_check.py b/collectd/files/plugin/http_check.py
index d84899a..82c85b2 100644
--- a/collectd/files/plugin/http_check.py
+++ b/collectd/files/plugin/http_check.py
@@ -71,7 +71,8 @@
"Got response from {}: '{}'".format(url, r.text))
yield {'type_instance': name, 'values': self.OK}
-plugin = HTTPCheckPlugin(collectd)
+
+plugin = HTTPCheckPlugin(collectd, disable_check_metric=True)
def config_callback(conf):