Query total page count via SNMP HP Laserjet

Posted by Tim on Server Fault See other posts from Server Fault or by Tim
Published on 2010-06-08T13:56:08Z Indexed on 2010/06/08 14:02 UTC
Read the original article Hit count: 1297

I was asked to get hold of the total pages counts for the 100+ printers we have at work. All of them are HP Laser or Business Jets of some description and the vast majority are connected via some form of HP JetDirect network card/switch. After many hours of typing in IP addresses and copying and pasting the relevant figure in to Excel I have now been asked to do this on a weekly basis. This led me to think there must be an easier way, as an IT professional I can surely work out some time saving method to solve this issue.

Suffice it to say I do not feel very professional now after a day or so of trying to make SNMP work for me!

From what I understand the first thing is to enable SNMP on the printer. Done. Next I would need something to query the SNMP bit. I decided to go open source and free and someone here recommended net-snmp as a decent tool (I would like to have just added the printers as nodes in SolarWinds but we are somewhat tight on licences apparently). Next I need the name of the MIB. For this I believe the HP-LASERJET-COMMON-MIB has the correct information in it. Downloaded this and added to net-snmp. Now I need the OID which I believe after much scouring is printed-media-simplex-count (we have no duplex printers, that we are interested in at least). Running the following command yields the following demoralising output:

snmpget -v 2c -c public 10.168.5.1 HP-LASERJET-COMMON-MIB:.1.3.6.1.2.1.1.16.1.1.1

(the OID was derived from running:

snmptranslate -IR -On printed-media-simplex-count  
Unlinked OID in HP-LASERJET-COMMON-MIB: hp ::= { enterprises 11 }  
Undefined identifier: enterprises near line 3 of C:/usr/share/snmp/mibs/HP-LASER  
JET-COMMON-MIB..txt  
.1.3.6.1.2.1.1.16.1.1.1  )  


Unlinked OID in HP-LASERJET-COMMON-MIB: hp ::= { enterprises 11 }  
Undefined identifier: enterprises near line 3 of C:/usr/share/snmp/mibs/HP-LASER  
JET-COMMON-MIB..txt  
HP-LASERJET-COMMON-MIB:.1.3.6.1.2.1.1.16.1.1.1:  

Am I barking up the wrong tree completely with this? My aim was to script it all to output to a file for all the IP addresses of the printers and then plonk that in Excel for my lords and masters to digest at their leisure. I have a feeling I am using either the wrong MIB or the wrong OID from said MIB (or both). Does anyone have any pointers on this for me? Or should I give up and go back to navigationg each printers web page individually (hoping not).

© Server Fault or respective owner

Related posts about snmp

Related posts about network-printer