From: robk-tahoe <robk-tahoe@allmydata.com>
Date: Sat, 2 Feb 2008 01:44:57 +0000 (-0700)
Subject: munin stats: don't suppress series with no current data
X-Git-Tag: allmydata-tahoe-0.8.0~160
X-Git-Url: https://git.rkrishnan.org/pf/install-details.html?a=commitdiff_plain;h=3641b7924b9a2b7becad8292939d6e6cbf396ecc;p=tahoe-lafs%2Ftahoe-lafs.git

munin stats: don't suppress series with no current data

having changed tahoe-stats to not report data series if there was no recent
data recorded for a node, I wound up making it hide the data series.  this
change causes it to report all data series for which stats exist in the
'config' phase, so that they show up, but only report actual data if the
stats are recent, so that they show up as missing if the node is not
reporting stats currently
---

diff --git a/misc/munin/tahoe-stats.py b/misc/munin/tahoe-stats.py
index c2609d3e..96274de7 100644
--- a/misc/munin/tahoe-stats.py
+++ b/misc/munin/tahoe-stats.py
@@ -126,9 +126,9 @@ def main(argv):
     stats = open_stats(stats_file)
 
     now = time.time()
-    def output_nodes(output_section):
+    def output_nodes(output_section, check_time):
         for tubid, nodestats in stats.items():
-            if (now - nodestats.get('timestamp', 0)) > STAT_VALIDITY:
+            if check_time and (now - nodestats.get('timestamp', 0)) > STAT_VALIDITY:
                 continue
             name = smash_name("%s_%s" % (nodestats['nickname'], tubid[:4]))
             #value = nodestats['stats'][plugin_conf['category']].get(plugin_conf['statid'])
@@ -142,10 +142,10 @@ def main(argv):
     if len(argv) > 1:
         if sys.argv[1] == 'config':
             print plugin_conf['configheader']
-            output_nodes('graph_config')
+            output_nodes('graph_config', False)
             sys.exit(0)
 
-    output_nodes('graph_render')
+    output_nodes('graph_render', True)
 
 if __name__ == '__main__':
     main(sys.argv)