diff --git a/munin/innd_connects b/munin/innd_connects index e88ab69c..5cbe32ff 100755 --- a/munin/innd_connects +++ b/munin/innd_connects @@ -29,6 +29,7 @@ if [ "$1" = "config" ]; then echo "graph_vlabel connexions" echo "graph_period minute" echo "graph_category News" + echo "graph_info Affiche le nombre de connexions par minute à InnD." echo "connects.label connexions" echo "connects.type DERIVE" exit 0 diff --git a/munin/innd_last b/munin/innd_last index 6615fd26..d00b9c93 100755 --- a/munin/innd_last +++ b/munin/innd_last @@ -28,6 +28,7 @@ if [ "$1" = "config" ]; then echo "graph_args --base 1000 --lower-limit 0" echo "graph_vlabel posts" echo "graph_category News" + echo "graph_info Affiche le nombre de posts de moins de 24h." echo "posts.label posts" exit 0 fi diff --git a/munin/innd_total b/munin/innd_total index 491e9e8b..7873288a 100755 --- a/munin/innd_total +++ b/munin/innd_total @@ -65,6 +65,18 @@ for l in recvlines(s)[1:]: if val > 5: newsgroups.append((name, cname, val)) +## On garde un cache si jamais le serveur nous bounce +if len(newsgroups) > 0: + f = open(cache_file, 'w') + for ngdata in newsgroups: + f.write('%s,%s,%d\n' % ngdata) + f.close() +else: + try: + for line in open(cache_file, 'r'): + newsgroups.append(line.strip().split(',')) + except: + pass ## Sortie if len(sys.argv) > 1 and sys.argv[1] == 'config': @@ -74,7 +86,7 @@ if len(sys.argv) > 1 and sys.argv[1] == 'config': print 'graph_args --base 1000 --lower-limit 0' print 'graph_vlabel posts' print 'graph_category News' - print 'graph_description Nombre de posts pour chaque newsgroup' + print 'graph_info Nombre de posts pour chaque newsgroup' (ng0, cng0, val0) = newsgroups[0] print '%s.label %s' % (cng0, ng0) print '%s.draw AREA' % cng0 @@ -88,19 +100,5 @@ else: total = 0 for (ng, cng, val) in newsgroups: total += val - lines.append('%s.value %d' % (cng, val)) - lines.append('total.value %d' % total) - - if total == 0: - # On a sûrement eu un problème de récupération - try: - for line in open(cache_file, 'r'): - print line.strip('\n') - except: - for line in lines: - print line - else: - f = open(cache_file, 'w') - for line in lines: - print line - f.write(line + '\n') + print '%s.value %d' % (cng, val) + print 'total.value %d' % total diff --git a/munin/scripts/hosts_plugins.py b/munin/scripts/hosts_plugins.py index 55fe8a81..619e7856 100755 --- a/munin/scripts/hosts_plugins.py +++ b/munin/scripts/hosts_plugins.py @@ -81,6 +81,11 @@ hosts_plugins = { "stats-ip": "stats-ip", # La suite plus bas... }, + "news": { + "innd_total": "innd_total", + "innd_last": "innd_last", + "innd_connects": "innd_connects", + } } ####