Unable to configure Printer in Nagios.

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
xavmit
Posts: 5
Joined: Fri Aug 14, 2015 6:57 pm

Unable to configure Printer in Nagios.

Post 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.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Unable to configure Printer in Nagios.

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
xavmit
Posts: 5
Joined: Fri Aug 14, 2015 6:57 pm

Re: Unable to configure Printer in Nagios.

Post 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$
}
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Unable to configure Printer in Nagios.

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
xavmit
Posts: 5
Joined: Fri Aug 14, 2015 6:57 pm

Re: Unable to configure Printer in Nagios.

Post by xavmit »

Thanks Box293,

You saved my life. thanks a lot

i rechecked check_snmp_printer plugin location and fixed the issue.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Unable to configure Printer in Nagios.

Post 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.
Former Nagios Employee.
me.
Locked