We’ve seen how to monitor IIS using VBScript and the ability of Monitis to easily add custom monitors to the Monitis dashboard. In this article, we’ll use a similar technique to track printer status and performance by adding a new page to the Monitis dashboard and create a custom monitor for each printer.
The Printer Monitor is useful if you have a print server with multiple printers attached and want to keep track of each printer’s usage, status and performance, but can of course also be used to monitor a single printer. The Printer Monitor detects every printer attached to the computer automatically and creates a custom monitor for each printer on the Printers dashboard page.
This monitor tracks printer status real-time and creates a new data entry on the Monitis dashboard every time a print job occurs or the status of a printer changes. If there is no change to a printer’s status, or no print jobs are handled, no data will be pushed to the Printer Monitor. Of course if the VBScript for this monitor is not running, no status information or performance data is recorded.
The information that is shown for each printer includes; Printer Status, Error State, number of ‘Printer Not Ready’ errors, number of ‘Out Of Paper’ errors, number of Pages Printed, and number Print Jobs.
The possible values for the ‘Status’ and ‘Detected Error’ columns are:
Downloading and installing the Printer Monitor
The open source scripts for this monitor are available free for download on GitHub at : https://github.com/monitisexchange/Windows-Monitoring-Scripts/tree/master/vbscript/Printer. Download both scripts and save them on your local computer somewhere.
To start monitoring your printer(s) you must first run the script AddCustomPrinterMonitor.vbs. Open a command window and change directory to the folder where you have saved the scripts that you downloaded earlier. Now simply enter the command ‘cscript AddCustomPrinterMonitor.vbs’ . This will create a new page to your dashboard containing a monitor for each printer .Once the script has finished running, log on to your dashboard (or refresh the web page if you’re already logged on) and you’ll see a new tab named ‘Printers’.
Now you should execute the second script; PushDataPrinterMonitor.vbs. This script actively monitors your printers and records the change events on your dashboard page. It remains running until you press Ctrl-Break or Ctrl-C.
So what if you add a new printer to a monitored computer or remove an existing printer? Adding a new printer can be easily accomplished by running the initial script to create the monitors on the dashboard again. This will re-detect all printers and create a new monitor for any new printers not yet on the dashboard.
Removing an existing printer can be easily accomplished from the dashboard itself using the Manage Monitors option.
Getting Notified About Printer Errors
Now that your printer monitor is operational, you can setup notifications to let you know when your printer(s) require attention. To setup a notification, click on the small pencil-like icon located at the top right corner of each printer monitor. Click on the ‘Add Notification’ button to specify the notification rules.
If, for example, you want to be notified when a printer is out of paper, you can create a notification rule that uses the Event Parameter ‘Detected Error’ and set the value equal to ‘No Paper’.