Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Perl SNMP Printer check
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
Based upon a shell script that does snmp printer checks (see http://exchange.nagios.org/directory/Plugins/Hardware/Printers/SNMP-Printer-Check/details), I decided the performance would much better if it was written in perl. So I converted the script to perl, and added an option to check all paper trays at once (except the bypass trays).
Usage:
Required Arguments:
-H, --host=HOST
The name or address of the host running SNMP.
--messages
Print the messages of the printer
--model
Prints the model of the printer
--pagecount
Prints the number of pages printed
--tray=i
Checks tray number for paper status, use 0 for all trays
--consum="ALL"|"TEST"|
Check consumable containing for status,
use "TEST" to get a list of all consumables
use "ALL" to get the status of all consumables
Optional Arguments:
-P, --community=STRING
The community string of the SNMP agent. Default: public
-S, --snmpver=STRING
The version of snmp to use. 1 and 2 are supported. Default: 1
-t, --timeout=INTEGER
Number of seconds to wait for a response.
--exact
Search for exact consumable string, not just substring comparison
Usage:
Required Arguments:
-H, --host=HOST
The name or address of the host running SNMP.
--messages
Print the messages of the printer
--model
Prints the model of the printer
--pagecount
Prints the number of pages printed
--tray=i
Checks tray number for paper status, use 0 for all trays
--consum="ALL"|"TEST"|
Check consumable containing
use "TEST" to get a list of all consumables
use "ALL" to get the status of all consumables
Optional Arguments:
-P, --community=STRING
The community string of the SNMP agent. Default: public
-S, --snmpver=STRING
The version of snmp to use. 1 and 2 are supported. Default: 1
-t, --timeout=INTEGER
Number of seconds to wait for a response.
--exact
Search for exact consumable string, not just substring comparison
Reviews (3)
byKomcsi, January 24, 2013
I have the same problem! If I use this check in the command line its working fine but the Nagios with the same command arent working properly. Nagios returned value is "null"... Any experience about this problem?
Hello,
I wanted to try your snmp_printer plugin but I'm a bit lost. I don't know how to describe the plugin in the commands.cfg and in my printer.cfg
Actually I have something like that :
In commands.cfg
# 'check_snmp_printer.pl' command definition
define command{
command_name check_snmp_printer
command_line $USER1$/check_snmp_printer.pl -H $HOSTADDRESS$ $ARG1$ -P -S -t $ARG2$
And in printer.cfg
define service{
use generic-service
host_name Printer1
service_description Toner Supply
check_command check_snmp_printer!public!"CONSUM Toners"!20!10
}
define service{
use generic-service
host_name Printer1
service_description Printer Model
check_command check_snmp_printer!public!"MODEL"
}
Thanks for your help.
I wanted to try your snmp_printer plugin but I'm a bit lost. I don't know how to describe the plugin in the commands.cfg and in my printer.cfg
Actually I have something like that :
In commands.cfg
# 'check_snmp_printer.pl' command definition
define command{
command_name check_snmp_printer
command_line $USER1$/check_snmp_printer.pl -H $HOSTADDRESS$ $ARG1$ -P -S -t $ARG2$
And in printer.cfg
define service{
use generic-service
host_name Printer1
service_description Toner Supply
check_command check_snmp_printer!public!"CONSUM Toners"!20!10
}
define service{
use generic-service
host_name Printer1
service_description Printer Model
check_command check_snmp_printer!public!"MODEL"
}
Thanks for your help.
byICTAS_HAL, December 16, 2011
But I am having issues in nagios on top of FreeBSD. In nagios as I play with the cfg it either exits with null or program did not exit properly. I am wondering if anyone has a printer cfg they could share.