|P is for Practical|
Getting statistics from an attached device (printer)by bobf (Monsignor)
|on Dec 23, 2009 at 07:01 UTC||Need Help??|
bobf has asked for the
wisdom of the Perl Monks concerning the following question:
Prelude: While this question is quite specific, I am also interested in how possible solutions could be generalized to other types of devices.
I have a HP Officejet Pro L7580 printer. One of the functions in the HP Solution Center software (that came with the printer) is an ability to get printer usage statistics. This is done by using the Solution Center GUI to select "myPrintMileage", which opens a web page that displays the printer usage stats in a graphical format.
The problem is that the graphics (bar charts, pie charts) are not very precise and none of the data is available for download. I would like to find an automated way of obtaining the information (using Perl, of course) so I can track it over time.
Possible approaches include:
I have done quite a bit of searching to avoid reinventing the wheel. Unfortunately, I have not found any indication that the printer has a public API or that an HP client can be used as a proxy to interface with the printer. The few HP tools that I found (other than printer drivers) are targeted to the management of multiple printers and do not appear to meet my needs.
Since my initial attempt at finding a fully-automated approach failed, I looked behind door #2. Using Firefox's Live HTTP Headers extension I discovered that the myPrintMileage program makes a POST call to the HP website. The printer statistics are passed as an XML string (URL-encoded, of course). The data in the XML is much more precise and includes more information than what is displayed on the web page shown to the user.
Therefore, I beseech my fellow monks to meditate on the following:
I could write an XML parser for the POST content or a screen-scraper, but before I settle for a solution that is not fully automated I would like to get input from those wiser than I.
Update: I suspect, but do not fully grok, how SNMP and/or MIB might apply.