[Solved] How to alert on toner level?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

[Solved] How to alert on toner level?

Post by jbruyet »

Hey all, I found the OIDs for the toner levels in several of my printers and I'd like to have Nagios send me an alert when they get down to 5%. I did find a couple of complicated check files on the Nagios Exchange but I just need to see how to alert when a number gets down to a certain value.

Thanks,

Joe B
Last edited by jbruyet on Mon May 05, 2014 2:51 pm, edited 1 time in total.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: How to alert on toner level?

Post by sreinhardt »

What plugin are you going to use to check them? Most checks will have a -w and -c for warning and critical, but they can have different notation for usage.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

Re: How to alert on toner level?

Post by jbruyet »

I wasn't sure which plugin to use because every one I've seen so far alerts on incrementing values and I want it to alert on decrementing values; to send an alert when the value drops to 5(%).

Thanks,

Joe B
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: How to alert on toner level?

Post by sreinhardt »

Could you show us a result of an snmpwalk on that printer, and identify the oid you are looking to use?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

Re: How to alert on toner level?

Post by jbruyet »

Hi sreinhardt, here are the four OIDs I'm looking at:

Code: Select all

SNMPv2-SMI::mib-2.43.11.1.1.9.1.1 = INTEGER: 0
SNMPv2-SMI::mib-2.43.11.1.1.9.1.2 = INTEGER: 68
SNMPv2-SMI::mib-2.43.11.1.1.9.1.3 = INTEGER: 47
SNMPv2-SMI::mib-2.43.11.1.1.9.1.4 = INTEGER: 80
The first one is a zero because it's an empty black toner cartridge. This printer sits in dispatch and needs to be available all the time. Another time I caught the low toner in Finance just before I would have been injured -- we're in the middle of an audit.

On an unrelated note, why do some Nagios files look fine in Notepad (yeah, I know) and others need something like Wordpad to display correctly?

Thanks,

Joe B
Attachments
Disp400.txt
(58.23 KiB) Downloaded 680 times
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: How to alert on toner level?

Post by sreinhardt »

On an unrelated note, why do some Nagios files look fine in Notepad (yeah, I know) and others need something like Wordpad to display correctly?
I got a chuckle out of that one. This is just because of differing line endings. All nagios configs should have unix line endings, which notepad does not respect, but wordpad or notepad++(highly suggested) do.

As for tests on those OIDs, try something like:

Code: Select all

./check_snmp -H [Printer IP] -o SNMPv2-SMI::mib-2.43.11.1.1.9.1.2 -v 2c -C [community string] -w 25: -c 10: -l "[Color] Toner Level" -u "%"
This should result in checking the second OID you listed, using version 2c, with a warning for anything less than 25 and critical for anything less than 10. It will also label the performance data with "[Color name] Toner Level" and use a unit of %. If I were to do this same thing in a command for nagios I would probably do something like:

Code: Select all

$USER1$/check_snmp -H $HOSTADDRESS$ -o SNMPv2-SMI::mib-2.43.11.1.1.9.1.$ARG1$ -v 2c -C [community string] -w 25: -c 10: -l "$ARG2$ Toner Level" -u "%"

$ARG1 = OID index for specific toner cartridge
$ARG2$ = Color name for label
You could also do community string and warning\criticals if they are going to change printer to printer, but I didn't want to make it overly complex. I should also note that check_snmp may need you to use the full numeric oid instead of mixed shortname and oid extension, but give it a shot as is first.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

Re: How to alert on toner level?

Post by jbruyet »

Thanks sreinhardt, I did the command but I'm getting the critical warning and the toner cartridge is at 66% capacity:

Code: Select all

root@FreeNag:/usr/home/jobee/SNMP # /usr/local/libexec/nagios/check_snmp -H 192.168.2.78 -o 1.3.6.1.2.1.43.11.1.1.9.1.2 -v 1 -C public -w 25: -c 1
/usr/local/bin/snmpget -t 1 -r 5 -m '' -v 1 [authpriv] 192.168.2.78:161 1.3.6.1.2.1.43.11.1.1.9.1.2
iso.3.6.1.2.1.43.11.1.1.9.1.2 = INTEGER: 66
SNMP CRITICAL - *66* | iso.3.6.1.2.1.43.11.1.1.9.1.2=66
root@FreeNag:/usr/home/jobee/SNMP #
Is there an additional command for decrementing values as opposed to incrementing values? Also, you may notice that I had to drop it back to snmp version v1. Thank you Hewlett-Packard.

Thanks,

Joe B
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: How to alert on toner level?

Post by abrist »

You need to change the critical threshold value in your check. Currently it will alert critical for any value over 1. Place a colon after the critical threshold to force it to only trip when under the threshold:

Code: Select all

/usr/local/libexec/nagios/check_snmp -H 192.168.2.78 -o 1.3.6.1.2.1.43.11.1.1.9.1.2 -v 1 -C public -w 25: -c 1:
Though, you may want to change it to '2' so you are warned (with a critical notification) when 1% is left instead of 0%:

Code: Select all

/usr/local/libexec/nagios/check_snmp -H 192.168.2.78 -o 1.3.6.1.2.1.43.11.1.1.9.1.2 -v 1 -C public -w 25: -c 2:
See the following doc for more details:
https://nagios-plugins.org/doc/guidelines.html
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

Re: How to alert on toner level?

Post by jbruyet »

Thank you very much sreinhardt and abrist! I just ran the check from the command line (after correcting my colon typo error) and it worked spectacularly. FWIW, I ran the test on another similar printer and saw that it's down to 5% on one of the toner cartridges.

Thanks again,

Joe B
Locked