Correction d'un bug. Les variables ne peuvent pas contenir de "-" pour
munin darcs-hash:20070901164445-72cb0-21ce20a2e5f4e28af50449141f541be6451f1b54.gz
This commit is contained in:
parent
ab6cc70394
commit
d20649afd4
1 changed files with 42 additions and 8 deletions
|
@ -58,10 +58,32 @@ dico_courbes_gen = {
|
||||||
'warning' : "500:",
|
'warning' : "500:",
|
||||||
'critical' : "100:",
|
'critical' : "100:",
|
||||||
'dico' : {
|
'dico' : {
|
||||||
'tray1' : ("1.3.6.1.2.1.43.8.2.1.10.1.1","Transparents"),
|
'tray6' : ("1.3.6.1.2.1.43.8.2.1.10.1.6","Feuilles A4","0000ff"),
|
||||||
'tray2' : ("1.3.6.1.2.1.43.8.2.1.10.1.2","Cartonnés"),
|
'tray6_max' : ("1.3.6.1.2.1.43.8.2.1.9.1.6","Feuilles A4 (max)","0000aa"),
|
||||||
'tray3' : ("1.3.6.1.2.1.43.8.2.1.10.1.3","Feuilles A3"),
|
'tray3' : ("1.3.6.1.2.1.43.8.2.1.10.1.3","Feuilles A3","00ff00"),
|
||||||
'tray6' : ("1.3.6.1.2.1.43.8.2.1.10.1.6","Feuilles A4"),
|
'tray3_max' : ("1.3.6.1.2.1.43.8.2.1.9.1.3","Feuilles A3 (max)","00aa00"),
|
||||||
|
'tray2' : ("1.3.6.1.2.1.43.8.2.1.10.1.2","Cartons","ff0000"),
|
||||||
|
'tray2_max' : ("1.3.6.1.2.1.43.8.2.1.9.1.2","Cartons (max)","aa0000"),
|
||||||
|
'tray1' : ("1.3.6.1.2.1.43.8.2.1.10.1.1","Transparents","00ffff"),
|
||||||
|
'tray1_max' : ("1.3.6.1.2.1.43.8.2.1.9.1.1","Transparents (max)","00aaaa"),
|
||||||
|
}},
|
||||||
|
'stock-papier-p' : {'titre' : "Stock papier",
|
||||||
|
'vlabel' : "nb de pages restantes",
|
||||||
|
'lower-limit' : 0,
|
||||||
|
'upper-limit' : 100,
|
||||||
|
'warning' : "20:",
|
||||||
|
'critical' : "5:",
|
||||||
|
'dico' : {
|
||||||
|
'tray6' : ("1.3.6.1.2.1.43.8.2.1.10.1.6","Feuilles A4","0000ff"),
|
||||||
|
'tray3' : ("1.3.6.1.2.1.43.8.2.1.10.1.3","Feuilles A3","00ff00"),
|
||||||
|
'tray2' : ("1.3.6.1.2.1.43.8.2.1.10.1.2","Cartons","ff0000"),
|
||||||
|
'tray1' : ("1.3.6.1.2.1.43.8.2.1.10.1.1","Transparents","00ffff"),
|
||||||
|
},
|
||||||
|
'max' : {
|
||||||
|
'tray6' : "1.3.6.1.2.1.43.8.2.1.9.1.6",
|
||||||
|
'tray3' : "1.3.6.1.2.1.43.8.2.1.9.1.3",
|
||||||
|
'tray2' : "1.3.6.1.2.1.43.8.2.1.9.1.2",
|
||||||
|
'tray1' : "1.3.6.1.2.1.43.8.2.1.9.1.1",
|
||||||
}},
|
}},
|
||||||
'kit' : {'titre' : "Etat des kits images",
|
'kit' : {'titre' : "Etat des kits images",
|
||||||
'vlabel' : "nb de pages restantes",
|
'vlabel' : "nb de pages restantes",
|
||||||
|
@ -86,6 +108,11 @@ upper_limit = dico_courbes_gen[arg]['upper-limit']
|
||||||
warning = dico_courbes_gen[arg].get("warning")
|
warning = dico_courbes_gen[arg].get("warning")
|
||||||
critical = dico_courbes_gen[arg].get("critical")
|
critical = dico_courbes_gen[arg].get("critical")
|
||||||
#########
|
#########
|
||||||
|
try :
|
||||||
|
max_courbes = dico_courbes_gen[arg]['max']
|
||||||
|
except :
|
||||||
|
max_courbes = []
|
||||||
|
|
||||||
|
|
||||||
try :
|
try :
|
||||||
arg = sys.argv[1]
|
arg = sys.argv[1]
|
||||||
|
@ -98,8 +125,9 @@ if arg == "config" :
|
||||||
print "graph_args --lower-limit %i --upper-limit %i" % (lower_limit,upper_limit)
|
print "graph_args --lower-limit %i --upper-limit %i" % (lower_limit,upper_limit)
|
||||||
print 'graph_title %s' % titre
|
print 'graph_title %s' % titre
|
||||||
print "graph_vlabel %s" % vlabel
|
print "graph_vlabel %s" % vlabel
|
||||||
for fieldname in dico_courbes.keys():
|
keys = dico_courbes.keys()
|
||||||
#print "%s.draw LINE2" % fieldname
|
keys.sort()
|
||||||
|
for fieldname in keys:
|
||||||
print "%s.label %s" % (fieldname,dico_courbes[fieldname][1])
|
print "%s.label %s" % (fieldname,dico_courbes[fieldname][1])
|
||||||
if warning:
|
if warning:
|
||||||
print "%s.warning %s" % (fieldname, warning)
|
print "%s.warning %s" % (fieldname, warning)
|
||||||
|
@ -107,6 +135,8 @@ if arg == "config" :
|
||||||
print "%s.critical %s" % (fieldname, critical)
|
print "%s.critical %s" % (fieldname, critical)
|
||||||
if len(dico_courbes[fieldname]) == 3 :
|
if len(dico_courbes[fieldname]) == 3 :
|
||||||
print "%s.colour %s" % (fieldname,dico_courbes[fieldname][2])
|
print "%s.colour %s" % (fieldname,dico_courbes[fieldname][2])
|
||||||
|
if len(dico_courbes[fieldname]) == 4 :
|
||||||
|
print "%s.draw %s" % (fieldname,dico_courbes[fieldname][3])
|
||||||
else:
|
else:
|
||||||
#Ecrit les valeurs actuelles sur la sortie standard
|
#Ecrit les valeurs actuelles sur la sortie standard
|
||||||
try:
|
try:
|
||||||
|
@ -116,7 +146,11 @@ else:
|
||||||
|
|
||||||
for fieldname in dico_courbes.keys():
|
for fieldname in dico_courbes.keys():
|
||||||
try:
|
try:
|
||||||
value = comm.get(dico_courbes[fieldname][0])
|
if max_courbes :
|
||||||
|
max_val = int(comm.get(max_courbes[fieldname]))
|
||||||
|
value = 100*int(comm.get(dico_courbes[fieldname][0]))/max_val
|
||||||
|
else :
|
||||||
|
value = comm.get(dico_courbes[fieldname][0])
|
||||||
except Exception,err:
|
except Exception,err:
|
||||||
value = 0
|
value = 0
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue