La fonction etat() renvoit la liste des informations prsentes sur
l'afficheur de l'imprimante. darcs-hash:20060727070753-9e428-7d8ee5092fc8db03b493aa6669e8fbb1177f9173.gz
This commit is contained in:
parent
a9f8210dc0
commit
71ad2157bb
1 changed files with 26 additions and 0 deletions
26
impression/etat_imprimante.py
Executable file
26
impression/etat_imprimante.py
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
|
||||
import sys
|
||||
sys.path.append("/usr/script/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()
|
Loading…
Add table
Add a link
Reference in a new issue