
(on rajoute des accents partout :) darcs-hash:20081004175702-bd074-cf32f0e641d84d78ea6a7a8d3a2ed5902ca514b4.gz
30 lines
706 B
Python
Executable file
30 lines
706 B
Python
Executable file
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*
|
|
|
|
import sys, os
|
|
sys.path.append("/usr/scripts/gestion")
|
|
|
|
import hptools
|
|
|
|
|
|
if len(sys.argv) > 1:
|
|
arg = sys.argv[1]
|
|
else:
|
|
arg = ''
|
|
|
|
if arg == "config":
|
|
# Ecrit sur la sortie standard la configuration
|
|
print u'host_name laserjet'
|
|
print u"graph_category État"
|
|
print u"graph_title Pages imprimées"
|
|
print u"graph_vlabel nb"
|
|
print u"total.label Total"
|
|
else:
|
|
# Ecrit les valeurs actuelles sur la sortie standard
|
|
oid = "1.3.6.1.2.1.43.10.2.1.4.1.1"
|
|
try :
|
|
comm = hptools.snmp(host="laserjet.adm.crans.org", version="1", community="public")
|
|
print "total.value %s" % comm.get(oid)
|
|
except :
|
|
print ""
|
|
|