From: robk-tahoe Date: Fri, 1 Feb 2008 04:04:23 +0000 (-0700) Subject: munin stats: suppress output of data more that 5min old X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/%22doc.html?a=commitdiff_plain;h=b80cfeb186860ab6bd247d484b60dde1fd0c0322;p=tahoe-lafs%2Ftahoe-lafs.git munin stats: suppress output of data more that 5min old if a node fails to report stats, the natural thing to do in re munin is to supress the data for that data series. the previous tahoe-stats would output whatever data was present in the stats_gatherer's stats.pickle, regardless of how old. this change means that if the gatherer hasn't received data within the last 5 min, then no data is reported to munin for that node. --- diff --git a/misc/munin/tahoe-stats.py b/misc/munin/tahoe-stats.py index 766f2246..c2609d3e 100644 --- a/misc/munin/tahoe-stats.py +++ b/misc/munin/tahoe-stats.py @@ -4,6 +4,9 @@ import os import pickle import re import sys +import time + +STAT_VALIDITY = 300 # 5min limit on reporting stats PLUGINS = { 'tahoe_storage_consumed': @@ -122,8 +125,11 @@ def main(argv): stats = open_stats(stats_file) + now = time.time() def output_nodes(output_section): for tubid, nodestats in stats.items(): + if (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']) category = plugin_conf['category']