diff --git a/munin/innd_total b/munin/innd_total index 228a6296..491e9e8b 100755 --- a/munin/innd_total +++ b/munin/innd_total @@ -22,6 +22,10 @@ ## Importations import socket, sys, time +## Configuration +cache_file = "/tmp/munin_innd_total_cache" + + def recvlines(sock): buff = sock.recv(4096) while buff[-3] != '.': @@ -80,8 +84,23 @@ if len(sys.argv) > 1 and sys.argv[1] == 'config': print 'total.label Total' else: # Envoi des valeurs + lines = [] total = 0 for (ng, cng, val) in newsgroups: total += val - print '%s.value %d' % (cng, val) - print 'total.value %d' % total + 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')