From e445af8de0e89f7c59617b981dc3ca644519f65b Mon Sep 17 00:00:00 2001 From: Terry Hardie Date: Thu, 15 Dec 2016 13:24:37 -0800 Subject: [PATCH] Adding an option to turn of derivatives of values. This means you can use graphite derivative or perSecond functions to get more accurate values over time --- docs/collectors/BindCollector.md | 1 + src/collectors/bind/bind.py | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/collectors/BindCollector.md b/docs/collectors/BindCollector.md index 8744f7b9a..79cc890a6 100755 --- a/docs/collectors/BindCollector.md +++ b/docs/collectors/BindCollector.md @@ -37,6 +37,7 @@ data_format | xml_v2 | Bind stats version:
- xml_v3 (New xml version)
- json_v1 (JSON replacement for XML)
| str + derivative | True | Report derived stats or raw (always incrementing | bool #### Example Output diff --git a/src/collectors/bind/bind.py b/src/collectors/bind/bind.py index 220e292b5..324b5efea 100755 --- a/src/collectors/bind/bind.py +++ b/src/collectors/bind/bind.py @@ -13,6 +13,7 @@ import diamond.collector import sys import urllib2 +from diamond.collector import str_to_bool if sys.version_info >= (2, 5): import xml.etree.cElementTree as ElementTree @@ -39,6 +40,7 @@ def get_default_config_help(self): " - xml_v2 (Original bind stats version from 9.5)\n" + " - xml_v3 (New xml version)\n" + " - json_v1 (JSON replacement for XML)\n", + 'derivative': "", }) return config_help @@ -68,13 +70,15 @@ def get_default_config(self): 'publish_view_bind': False, 'publish_view_meta': False, 'data_format': 'xml_v2', + 'derivative': True, }) return config def clean_counter(self, name, value): - value = self.derivative(name, value) - if value < 0: - value = 0 + if str_to_bool(self.config['derivative']): + value = self.derivative(name, value) + if value < 0: + value = 0 self.publish(name, value) def collect(self):