Logging When a Printer is Powered On

Some months after resolving a desire to log when computer systems powered on, a frivolous light bulb moment was how to log when the house network printer was powered on.

The HP 4200 LaserJet printer is connected to the house network with a 620n JetDirect network card.

To conserve energy usage the printer remains powered off until needed. Most printing is conducted from the office desktop a few feet away, but all Linux systems in the network are configured to use the printer.

Learning from the printer when last powered on is not immediately obvious.

Learning when the printer was last used is possible on each Linux system using the CUPS access_log and page_log logs. Those logs are local to each device, but centrally accessible through hourly network backups. Some basic grepping finds the last print time and date.

Sounds acceptable except there are no simple options with the vintage Windows systems in the house network. For several decades Windows has supported printer logs, but accessing those logs is not as straightforward as with text based logs and scripting in Linux. Especially with vintage systems. None of the house network Windows systems are used in any traditional production manner, but printing is configurable and possible.

Accessing the printer web page hinted at querying possibilities such as SNMP, remote logging, and telnet. The printer uptime is available through SNMP with sysUpTimeInstance. A challenge with these options is they require initiating access from a computer to pull the information, which means some method of continual querying.

Other than specific email alerts and remote logging, the printer does not seem to provide a way to send data to a computer. Long ago the printer was configured to sync the clock with the house network time server, but there is no way to monitor that query. Oddly, the clock time and uptime information are not available in any of the web pages.

Not a priority but none of these options help with a Windows system.

Those printer logs and hourly backups provide only an approximate idea when the printer was powered on. To throw sand in the gears, the printer could be powered on with the user later deciding not to print. The CUPS logs do not contain information about when the printer was powered on.

A ping test cron job every few minutes to the printer IP address would learn if the printer is powered on. This method seems inefficient in a simple house network considering the printer is powered on only a few times per month. Although clunky this method overcomes knowing when one of the vintage Windows system used the printer.

A shell script launched through cron can pull the uptime information using SNMP and update power on time stamps.

Probably good enough. This is little more than twisted fun. As of this writing, the printer was last powered on 12 days ago.

Posted: Category: Usability Tagged: General, Windows

Next: Wake-on-LAN with Windows

Previous: No Kernel Modules Found