Home Directory Plugins Hardware Printers SNMP Printer Check

Search Exchange

Search All Sites

Nagios Log Server Now Available - Download Now

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com


Remember Me

SNMP Printer Check Popular

Bookmark and Share

44 votes
Current Version
Last Release Date
Compatible With
  • Nagios 3.x
check_snmp_printerVersion 3.141592 Script
check_snmp_printer_versions.txtVersion History
SNMP Printer Check
Universal printer check. Check for specific consumables or report on all. Query model/serial #, event messages, tray status and much more!

Originally based on Monitoring Solutions' check_snmp_printer, this provides friendly output, quick execution and thorough pre-flight checking.

I liked the original plugin but wanted to be able to report the status of all consumables. For some devices this output can get huge. When only 1 component is empty, it becomes a challenge to find what needs to be replaced in the output. So this script was born.

I added checks for user input and better feedback for improper parameters. The same goes for SNMP status - before any code is executed, this is tested.

Usage is as follows:
check_snmp_printer -H {HOSTADDRESS} -C {COMMUNITY} -x "{CHECK}" -w {WARNING} -c {CRITICAL} -S {separator string} | -V | -h

{CHECK} can be one of the following:
CONSUM {"string" | TEST | ALL}
TRAY {number(s) | TEST | ALL}

If you want the output for consumables to contain multiple lines, pass the following argument:
-S "n"

Then you need to edit your service notifications. Just after the $SERVICEOUTPUT$ macro, you will need to add "n$LONGSERVICEOUTPUT$". E-mails will finally contain lines 2 and up of the output.

The CONSUM option gives results for all consumable names that match the string passed. For instance, you can pass "CONSUM Toner" and see all toner levels (no staple cartridges or imaging units). Similarly, "CONSUM Black" will show you the Black imaging unit and Black toner levels all at once. The ALL option gives all consumable status at once, and TEST will show you which CONSUMABLES can be monitored.

CONSUMX reports on consumables that match the eXact string passed to it. This helps alleviate problems when a "unique" string is not possible. For example, "CONSUMX Black Toner" would give an error unless the FULL description of the consumable (from a CONSUM TEST) is "Black Toner". Any consumable named "Black Toner1" or "Black Toner Cartridge" would be overlooked.

TRAY can be passed a number or list of numbers (comma-separated) as a parameter. The ALL parameter reports all tray statuses and TEST lets you know which trays the device has. In addition to generic status, the tray function tries to calculate paper remaining as a % of capacity (if possible), although this only works as good as the sensors on the device (and often only returns values at fixed intervals, such as 25%, 50%, 75%, etc.)

DEVICE, DISPLAY, MESSAGES, MODEL and STATUS report information about the printer's hardware devices, physical display, event log messages, model/serial or overall status (respectively).

If looking to add this to a new configuration, your command descriptions should look something like the following:

define service{
use generic-service
service_description Toner Supply
check_command check_snmp_printer!public!"CONSUM Toners"!20!10

define service{
use generic-service
service_description Printer Model
check_command check_snmp_printer!public!"MODEL"


define command{
command_name check_printers
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS -C $ARG1$ -x $ARG2 -w $ARG3$ -c $ARG4$
Reviews (33)
I'm using FAN (Nagios Core 3.4.4)


define command{
command_name check_snmp_printer
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -x $ARG2 -w $ARG3$ -c $ARG4$


command[check_snmp_printer]=/usr/lib64/nagios/plugins/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -x $ARG2$ -w $ARG3$ -c $ARG4$


define service{
use generic-service
host_name Test-Printer
service_description Toner Supply
check_command check_snmp_printer!public!"CONSUM Toners"!20!10

When I run the command manually on the server it works fine

#./check_snmp_printer -H -C public -x "CONSUM ALL" -w 20 -c 10

Black Toner [K] Cartridge;SN1220AA80E00004A0 is at 99% - OK! Yellow Toner [Y] Cartridge;SN04156480E0000478 is at 89% - OK! Magenta Toner [M] Cartridge;SN11338080E0000479 is at 83% - OK! Cyan Toner [C] Cartridge;SN0F2DD980E000047A is at 82% - OK! Waste Toner Container is OK! Black Drum Cartridge is at 93% - OK! Yellow Drum Cartridge is at 72% - OK! Magenta Drum Cartridge is at 71% - OK! Cyan Drum Cartridge is at 72% - OK! | Black Toner [K] Cartridge;SN1220AA80E00004A0=99;20;10; Yellow Toner [Y] Cartridge;SN04156480E0000478=89;20;10; Magenta Toner [M] Cartridge;SN11338080E0000479=83;20;10; Cyan Toner [C] Cartridge;SN0F2DD980E000047A=82;20;10; Waste Toner Container=-3;20;10; Black Drum Cartridge=93;20;10; Yellow Drum Cartridge=72;20;10; Magenta Drum Cartridge=71;20;10; Cyan Drum Cartridge=72;20;10;

However it doesn't work through nagios
I get this (even when I use CONSUM TEST instead of CONSUM ALL)
UNKNOWN - OID not found! Your printer may not support checking this consumable. Use the CONSUM TEST option to determine which consumables may be monitored.

and I also got this error initially
No SNMP response from 192.168.x.x! Make sure host is up and SNMP is configured properly.
Once again works fine manually when using check_snmp_printer in a shell
byjat_nagiosexchange, February 2, 2015
I've modded this slightly to return a status of 'Unknown' rather than 'Warning' when the check gets no response from the printer. After line 860, I changed:

We have lots of printers, and end users often like to switch them off. With the above change, it makes it much easier to see actual warnings for low toners, etc. rather than them being lost amongst lots of 'No SNMP response' type messages.

In a school with lots of different types and ages of colour printers, this plugin is incredibly useful due to its versatility and ease of use. It saves a lot of leg work!!

While th eplugin works with my Xerox printers, i always receive:
WARNING: No SNMP response from! Make sure host is up and SNMP is configured properly.

from a Canon iR-ADV C5030. I have configured SNMP and the host is UP.
bymarcgpx, October 1, 2014
Saves me a lot of time! Great Work
byshiz0, September 24, 2014
Great script, all is working well, except for STATUS.
It kept returning WARNINGS:

# snmpget -v 1 x.x.x.x -c xxxx
HOST-RESOURCES-MIB::hrPrinterStatus.1 = INTEGER: idle(3)

# ./check_snmp_printer -H x.x.x.x -C xxxx -x "STATUS"
WARNING: Printer status is idle

It seems like the script didnt trigger the idle case (line 268),
but jumped stright to *) (line 277).

I'm not that familiar with bash scripting but I played around a bit when I changed line 268 from
it worked as expected and now I got:

# ./check_snmp_printer -H x.x.x.x -C xxxx -x "STATUS"
OK: Printer status is idle

I think maybe the output is different for different printers,
so I changed it again to
idle|3|"idle(3)") --> idle OR 3 OR idle(3)
and it still works like a charm (at least on our 3 DELL printers, tests on the big Xerox machine are up later).

Great script.

As a previous reviewer mentioned, the STATUS command is coming up as WARNING:Printer is Idle.

Any thoughts or solutions on this?
The script does very fine, I am very happy to use it. But there is still a little problem with Utax CD1120 printers (We got two in our enviroment).

The "Toner Container" is always 600 %. No percentage more or less.

But maybe this is not a script related problem because i did not found any toner capacity information on the web-gui too.
byfeltel, June 4, 2014
I´m using your plugin since some time to monitor consumables of our corporate printers. It works very well. We recently purchased an Brother HL-5350DN which seems to have some Bugs in its Firmware (shipped with latest available one, version 1.18; downgrade not available/possible). For the black toner cartridge (the only one in this printer) there are two states reported like this:

Black Toner Cartridge is OK! Black Toner Cartridge is at CRITICAL level! Drum Unit is at 99% - OK! | Black Toner Cartridge=-3;20;5; Black Toner Cartridge=0;20;5; Drum Unit=99;20;5;

Reason for this is, that the machine claims it has two cartridges:

~ snmpwalk -v1 -Ovq -c public MY-PRINTER-IP
"Black Toner Cartridge"
"Black Toner Cartridge"
"Drum Unit"

My question is if you could filter out duplicate consumables in some sort of way? This could work as some sort of work-around for this type of bugs.

Thanks alot.
One small issue I had is some Fuji Xerox printers return the serial number of the toner cartridge in the output, however they include a semi colon ";"

This completely breaks nagiosgraph's ability to graph them.

I added


to check_one_consumable to replace the all semi colons with spaces to correct this
@eby: You say you ran into the no xxd error and "I'm guessing this was the problem the one star reviewer encountered. bc is in portage and the pentoo overlay has xxd. Once I installed both of these the script ran fine."

Could you elaborate on how you installed xxd? I am getting the no xxd error but haven't the slightest idea how to install xxd as I am not remotely experienced with Linux.

byrendicott, April 12, 2013
1 of 1 people found this review helpful
Great script!

To avoid the "WARNING: No SNMP response from -C! Make sure host is up and SNMP is configured properly." message make sure that you add the additional $ after "$HOSTADDRESS" in the command definition. The OP was missing it and it fixed my problem.

The following line in the OP:
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS -C $ARG1$ -x $ARG2 -w $ARG3$ -c

Should be:
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -x $ARG2 -w $ARG3$ -c
byfibercool, March 12, 2013
Any idea why im getting the consumables names in HEX instead in ascii format, for example like this:

Consumables you may Monitor:
42 6C 61 63 6B 20 43 61 72 74 72 69 64 67 65 20
43 45 32 35 35 41 00

I'm getting same thing with different HP models.
bymilda, January 29, 2013
Printer Oki C5700 returns same names of consumables without colour:

SNMPv2-SMI::mib- = STRING: "Toner Cartridge OKI DATA CORP"
SNMPv2-SMI::mib- = STRING: "Toner Cartridge OKI DATA CORP"
SNMPv2-SMI::mib- = STRING: "Toner Cartridge OKI DATA CORP"
SNMPv2-SMI::mib- = STRING: "Toner Cartridge OKI DATA CORP"
SNMPv2-SMI::mib- = STRING: "Image Drum Unit OKI DATA CORP"
SNMPv2-SMI::mib- = STRING: "Image Drum Unit OKI DATA CORP"
SNMPv2-SMI::mib- = STRING: "Image Drum Unit OKI DATA CORP"
SNMPv2-SMI::mib- = STRING: "Image Drum Unit OKI DATA CORP"

Colours are named in MarkerColorantTable:
SNMPv2-SMI::mib- = STRING: "black"
SNMPv2-SMI::mib- = STRING: "cyan"
SNMPv2-SMI::mib- = STRING: "magenta"
SNMPv2-SMI::mib- = STRING: "yellow"
byrdc_scase, October 8, 2012
Thank you Jason for the plugin. It is making my job alot easier!
Great work on this. I'm having an issue monitoring a Xerox DocuColor 242 though. The reported toner levels fluctuate wildly every few minutes. Here is an example from CONSUM ALL:

Black Toner [K] Cartridge is at 253% - OK!
Black Drum Cartridge is at 55% - OK!
Black Toner [K1] Cartridge is at 1084% - OK!
Black Toner [K2] Cartridge is at 884% - OK!
| Black Toner [K] Cartridge=253;20;5; Black Drum Cartridge=55;20;5; Black Toner [K1] Cartridge=1084;20;5; Black Toner [K2] Cartridge=884;20;5;

Black Toner [K] Cartridge is at 15% - WARNING!
Black Drum Cartridge is at 17% - WARNING!
Black Toner [K1] Cartridge is at 1590% - OK!
Black Toner [K2] Cartridge is at 1071% - OK!
| Black Toner [K] Cartridge=15;20;5; Black Drum Cartridge=17;20;5; Black Toner [K1] Cartridge=1590;20;5; Black Toner [K2] Cartridge=1071;20;5;

This is for all consumables. Actual levels for K1 and K2 are 20% and 100%.

All other checks work. Tray levels look correct. Tray 5 says to refill it with .5 x .5 paper but it is set to 8.5x11.

byeby, September 23, 2012
Like the command layout of this one especially the custom warn/crit levels on the command line. Worked great with the lexmark printers we have. Haven't ran into any issues yet.

One thing that should be noted. On gentoo the bc and xxd binaries aren't present which this script uses. I'm guessing this was the problem the one star reviewer encountered. bc is in portage and the pentoo overlay has xxd. Once I installed both of these the script ran fine. Would be good to note some of the system binaries it uses in the description.
I wrote a little change in check_page_count function:

function check_page_count(){
PAGE_COUNT=$(snmpget -v1 -Ovq -c $COMMUNITY $HOST_NAME 2>/dev/null)

if [ "$PAGE_COUNT" -lt "$WARNING" ]; then
if [ "$PAGE_COUNT" -ge "$WARNING" ] && [ "$PAGE_COUNT" -lt "$CRITICAL" ]; then
if [ "$PAGE_COUNT" -ge "$CRITICAL" ]; then


So far so good. The only issue i'm running into is with the STATUS check. I setup services for three of my printers and i'm getting weird results. Nagios is giving me the following:

WARNING: Printer status is idle

When i do an SNMPwalk on 2 of that printer i get the following:

INTEGER: idle(3)

Looking at the script it appears i should be getting an OK: but i'm getting a WARNING: instead.

Here is my check command definition:

define command {
command_name check_snmp_printer
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -x $ARG2$ -w $ARG3$ -c $ARG4$

And my service command:

define service {
service_description Status
check_command check_snmp_printer!public!STATUS!!
host_name media-stats-printer
event_handler_enabled 0
use generic-service
contact_groups +admins

Any advice would be greatly appreciated.

I really like this plugin! But could you first check if the printer reports a maximum capacity before dividing through it? On our Sharp MX-2300N there is no such value, therefore the script tries to divide by 0 for a few times.
bygarazh317, December 19, 2011
Hi! I tried to use this plugin on freesd 7.4 but i have that error UNKNOWN: check_snmp_printer: No usable 'xxd' binary in '/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin'
Page 1 of 2