Index: /pykota/trunk/setup.py
===================================================================
--- /pykota/trunk/setup.py (revision 1345)
+++ /pykota/trunk/setup.py (revision 1360)
@@ -24,4 +24,7 @@
 #
 # $Log$
+# Revision 1.36  2004/02/25 15:10:38  jalet
+# Preliminary snmpprinterstatus command added.
+#
 # Revision 1.35  2004/02/12 22:43:58  jalet
 # Better integration in Debian and more LSB compliance, thanks to
@@ -393,5 +396,5 @@
       url = "http://www.librelogiciel.com/software/",
       packages = [ "pykota", "pykota.storages", "pykota.requesters", "pykota.loggers", "pykota.accounters", "pykota.reporters" ],
-      scripts = [ "bin/edpykota", "bin/repykota", "bin/warnpykota", "bin/pykotme", "bin/pkprinters", "bin/pkhint" ],
+      scripts = [ "bin/snmpprinterstatus", "bin/edpykota", "bin/repykota", "bin/warnpykota", "bin/pykotme", "bin/pkprinters", "bin/pkhint" ],
       data_files = data_files)
 
Index: /pykota/trunk/pykota/version.py
===================================================================
--- /pykota/trunk/pykota/version.py (revision 1358)
+++ /pykota/trunk/pykota/version.py (revision 1360)
@@ -22,5 +22,5 @@
 #
 
-__version__ = "1.18alpha8_unofficial"
+__version__ = "1.18alpha9_unofficial"
 
 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""
Index: /pykota/trunk/bin/snmpprinterstatus
===================================================================
--- /pykota/trunk/bin/snmpprinterstatus (revision 1360)
+++ /pykota/trunk/bin/snmpprinterstatus (revision 1360)
@@ -0,0 +1,53 @@
+#! /usr/bin/env python
+# -*- coding: ISO-8859-15 -*-
+#
+# PyKota
+#
+# PyKota : Print Quotas for CUPS and LPRng
+#
+# (c) 2003-2004 Jerome Alet <alet@librelogiciel.com>
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id$
+#
+#
+
+import sys
+import os
+import time
+
+OIDS = ["hrPrinterDetectedErrorState", "hrPrinterStatus", "hrDeviceStatus"]
+SNMPCOMMAND = "snmpget -v1 -c public -Ov %(printer)s HOST-RESOURCES-MIB::%(oid)s.1" 
+
+def main() :
+    if len(sys.argv) != 2 :
+        sys.stderr.write("usage : snmpprinterstatus yourprinter.example.com\n")
+    else :    
+        printer = sys.argv[1]
+        while 1 :
+            try :
+                for oid in OIDS :    
+                    command = SNMPCOMMAND % locals()
+                    output = os.popen(command)
+                    result = output.read().strip()
+                    status = output.close()
+                    print oid, "===>", result
+            except KeyboardInterrupt :        
+                break
+            time.sleep(0.5)
+
+if __name__ == "__main__" :
+    sys.exit(main())
+
Index: /pykota/trunk/MANIFEST.in
===================================================================
--- /pykota/trunk/MANIFEST.in (revision 1338)
+++ /pykota/trunk/MANIFEST.in (revision 1360)
@@ -1,3 +1,3 @@
-include README FAQ COPYING LICENSE TODO NEWS CREDITS SECURITY MANIFEST.in clean.sh bin/cupspykota bin/pykota bin/edpykota bin/warnpykota bin/repykota bin/pykotme bin/pkprinters bin/pkhint bin/waitprinter.sh bin/papwaitprinter.sh bin/mailandpopup.sh bin/README
+include README FAQ COPYING LICENSE TODO NEWS CREDITS SECURITY MANIFEST.in clean.sh bin/cupspykota bin/pykota bin/edpykota bin/warnpykota bin/repykota bin/pykotme bin/pkprinters bin/pkhint bin/snmpprinterstatus bin/waitprinter.sh bin/papwaitprinter.sh bin/mailandpopup.sh bin/README
 recursive-include po README *.po *.mo *.pot
 recursive-include man README *.sh *.1
Index: /pykota/trunk/NEWS
===================================================================
--- /pykota/trunk/NEWS (revision 1358)
+++ /pykota/trunk/NEWS (revision 1360)
@@ -22,4 +22,8 @@
 PyKota NEWS :
 
+    - 1.18alpha9 :
+    
+        - Preliminary version of the snmpprinterstatus command added.
+        
     - 1.18alpha8 :
     
