From 3641b7924b9a2b7becad8292939d6e6cbf396ecc Mon Sep 17 00:00:00 2001
From: robk-tahoe <robk-tahoe@allmydata.com>
Date: Fri, 1 Feb 2008 18:44:57 -0700
Subject: [PATCH] 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
---
 misc/munin/tahoe-stats.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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)
-- 
2.45.2