[munin/innd_*] Ajout a hosts_plugins, cache complet pour innd_total, infos
darcs-hash:20090330143102-ddb99-747f65d6fa315e209ff9977dc7c3bfa00d6ad1b1.gz
This commit is contained in:
parent
ff5dd90c65
commit
af958a23d6
4 changed files with 22 additions and 17 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
}
|
||||
}
|
||||
|
||||
####
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue