scripts/archive/munin/laserjet__pages
2015-09-29 18:48:48 +02:00

30 lines
704 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 "graph_title Pages imprimees"
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 ""