Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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).

share|improve this question

2 Answers 2

up vote 6 down vote accepted

Well this is fairly odd-I thought that information was exposed via SNMP. However a quick snmpwalk of one of our P4515s revealed only the number of pages printed with the currently installed fuser. To look at all the info exposed via snmp I did the following:

snmpwalk -Cc -v 1 -c public ipaddress

If the OID for the printed pages on the currently installed fuser is any use it is:

2.43.10.2.1.4.1.1
share|improve this answer
    
Thanks for this. On our printers that OID is the correct page count and thanks for the pointer to the snmpwalk command. –  Tim Alexander Jun 9 '10 at 8:48

I can't help with the MIB I'm afraid but you could use PowerShell to take the grind out of grabbing the values from the web page on the printer. It should be possible to modify the example below to do what you need:

http://blogs.technet.com/b/otto/archive/2007/08/23/quick-and-dirty-web-site-monitoring-with-powershell.aspx

Perl/Python also have Web scraping modules if that's an option.

share|improve this answer
    
+1. I would have voted this up as well but dont have the rep as yet. Think this will be useful for countless other projects I have in the pipeline. Thanks for taking the time. –  Tim Alexander Jun 9 '10 at 8:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.