From ed8e3cd98f2d60616acca571541e8b204d22481a Mon Sep 17 00:00:00 2001 From: Terry Hardie Date: Thu, 15 Dec 2016 13:33:52 -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(-) mode change 100644 => 100755 src/collectors/bind/bind.py diff --git a/docs/collectors/BindCollector.md b/docs/collectors/BindCollector.md index 377e3e943..e768e6ef2 100644 --- a/docs/collectors/BindCollector.md +++ b/docs/collectors/BindCollector.md @@ -32,6 +32,7 @@ publish | resolver, server, zonemgmt, sockets, memory, | Available stats:
| list publish_view_bind | False | | bool publish_view_meta | False | | bool +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 old mode 100644 new mode 100755 index fa033ec35..0d9ef6c58 --- 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 @@ -35,6 +36,7 @@ def get_default_config_help(self): " - memory (Global memory usage)\n", 'publish_view_bind': "", 'publish_view_meta': "", + 'derivative': "", }) return config_help @@ -63,13 +65,15 @@ def get_default_config(self): # By default we don't publish these special views 'publish_view_bind': False, 'publish_view_meta': False, + '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):