26 lines
841 B
Python
Executable file
26 lines
841 B
Python
Executable file
#!/usr/bin/env python
|
|
# -*- coding: iso-8859-15 -*-
|
|
|
|
import sys
|
|
sys.path.append("/usr/scripts/gestion")
|
|
|
|
import hptools
|
|
|
|
def etat():
|
|
""" Renvoie une liste des differents ecrans actuels du display de l'imprimante """
|
|
liste_oid = ["mib-2.43.16.5.1.2.1.1","mib-2.43.16.5.1.2.1.2","mib-2.43.16.5.1.2.1.3","mib-2.43.16.5.1.2.1.4","mib-2.43.16.5.1.2.1.5"]
|
|
try:
|
|
comm = hptools.snmp(host="laserjet.adm.crans.org",version="1",community="public")
|
|
liste_mssg = []
|
|
for oid in liste_oid:
|
|
liste_mssg += [comm.get_string(oid)]
|
|
except Exception,err:
|
|
liste_mssg = [unicode(err)]*len(liste_oid)
|
|
return liste_mssg
|
|
|
|
def enregistre(filename="/usr/script/impression/imprimante.etat"):
|
|
l = etat()
|
|
fichier = open(filename,'w')
|
|
for x in l:
|
|
fichier.write(x+"\n")
|
|
fichier.close()
|