Page 1 of 1

Unable to configure Printer in Nagios.

Posted: Fri Aug 14, 2015 7:11 pm
by xavmit
Hi ,

I am unable to configure check_snmp_printer in my nagios server running NagiosĀ® Coreā„¢ 4.0.8. i am running CentOS release 6.6 (Final).

While executing manually command ./check_snmp_printer -H x.x.x.x -C public -x STATUS -w 20 -c 10. i am getting the result. but not through printer.cfg
.

below is the entry of command.cfg file.

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

and here goes the printer.cfg file entry.

define service{
use generic-service
host_name My Printer
service_description Model
check_command check_snmp_printer!public!"MODEL"
normal_check_interval 10
retry_check_interval 1
}

getting error

Error: Service check command 'check_snmp_printer!public!"MODEL"' specified in service 'MODEL' for host 'MY Printer' not defined anywhere!

Please help on this.

Re: Unable to configure Printer in Nagios.

Posted: Sun Aug 16, 2015 8:24 pm
by Box293
First thing is that your command line test is for STATUS yet you are trying to define a MODEL check in your service.

Also, both STATUS and MODEL check do not require a warning and critical argument so I would define the command slightly different.

This is missing the trailing $ sign for $ARG2$ and completely missing $ARG4$ (I think it was a copy and paste error):
xavmit wrote:

Code: Select all

define command{
command_name check_printers
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -x $ARG2 -w $ARG3$ -c
}
I would define it as follows:

Code: Select all

define command{
command_name check_printers
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -x $ARG2$ $ARG3$
}
You're not referencing the correct command_name in your service, it should be:

Code: Select all

define service{
use generic-service
host_name My Printer
service_description Model
check_command check_printers!public!"MODEL"
normal_check_interval 10
retry_check_interval 1
}
Here is the STATUS check:

Code: Select all

define service{
use generic-service
host_name My Printer
service_description Status
check_command check_printers!public!"STATUS"
normal_check_interval 10
retry_check_interval 1
}

Finally, if you later need to use a check that has warning and critical, put it all in $ARG3$, like:

Code: Select all

check_command check_printers!public!"CONSUM Toners"!-w 20 -c 10
Does this help?

Re: Unable to configure Printer in Nagios.

Posted: Sun Aug 16, 2015 8:54 pm
by xavmit
Thanks buddy,

I run the same command.

but now getting error

(No output on stdout) stderr: execvp(/usr/lib64/nagios/plugins/check_snmp_printer, ...) failed. errno is 2: No such file or directory

Below is the status of Service

define service{
use generic-service
host_name MY Printer
service_description Model
check_command check_printers!public!"MODEL"
normal_check_interval 10
retry_check_interval 1
}

define command{
command_name check_printers
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -x $ARG2$ $ARG3$
}

Re: Unable to configure Printer in Nagios.

Posted: Mon Aug 17, 2015 12:12 am
by Box293
What happens when you test this at the command line?

Code: Select all

su nagios
/usr/lib64/nagios/plugins/check_snmp_printer -H xxx.xxx.xxx.xxx -C public -x "MODEL"
Is /usr/lib64/nagios/plugins/ where the check_snmp_printer plugin is located?

Re: Unable to configure Printer in Nagios.

Posted: Mon Aug 17, 2015 2:08 am
by xavmit
Thanks Box293,

You saved my life. thanks a lot

i rechecked check_snmp_printer plugin location and fixed the issue.

Re: Unable to configure Printer in Nagios.

Posted: Mon Aug 17, 2015 9:40 am
by hsmith
xavmit wrote:Thanks Box293,

You saved my life. thanks a lot

i rechecked check_snmp_printer plugin location and fixed the issue.
Glad to hear that this is working!

I am going to close this thread. Please feel free to let us know if you have any more issues.