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:
- Get the information directly from the printer via an API
- Use a HP utility as a proxy to call the (private?) API
- Use a man-in-the-middle type program to intercept the call from myPrintMileage to the HP website
- Write a screen scraper to grab whatever data is available on the final page
- Manually record the information that is available on the final web page (yuk)
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:
- Is there a way to discover how the myPrintMileage program interfaces with the printer so I can make the call directly?
- Are there existing utilities that would allow me to get the printer stats directly from the printer? Am I reinventing the wheel?
- Is it feasible to attempt to intercept the POST call? (I believe this approach would require some manual intervention.)
- What other approaches should I consider?
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.
|Replies are listed 'Best First'.|
Re: Getting statistics from an attached device (printer)
by Corion (Patriarch) on Dec 23, 2009 at 12:26 UTC
by bobf (Monsignor) on Dec 23, 2009 at 16:28 UTC
by eye (Chaplain) on Dec 24, 2009 at 07:09 UTC
by bobf (Monsignor) on Dec 24, 2009 at 16:55 UTC