Page 1 of 2
Getting Invalid Output On Nagios
Posted: Tue May 12, 2015 7:38 am
by rlinux57
I have created my own plugin to check the number of testing email accounts on linux server.
It gives valid output on remote host:
#/usr/lib/nagios/plugins/check_testaccounts -w 1 -c 2
1
When i have run that plugin on nagios server it gives an invalid output:
#/usr/local/nagios/libexec/check_nrpe -c check_testaccounts -H spelljob.com 1 2
Please find the attachment plugin.
Re: Getting Invalid Output On Nagios
Posted: Tue May 12, 2015 9:14 am
by tmcdonald
Plugins need to have a valid exit code of 0 for OK, 1 for Warning, 2 for Critical, or 3 for Unknown. Simply outputting the results of the check will not suffice.
Also, did you configure NRPE to allow arbitrary plugin arguments?
Re: Getting Invalid Output On Nagios
Posted: Wed May 13, 2015 12:31 am
by rlinux57
I have allow the arguments in nrpe.cfg
Kindly check the attachment plugin i have edit exit code as per your direction.
Re: Getting Invalid Output On Nagios
Posted: Wed May 13, 2015 2:06 am
by Box293
Please show us the nrpe command definition for this on the remote host.
Also, did you test this on the remote host as the user nagios?
Code: Select all
su nagios
/usr/lib/nagios/plugins/check_testaccounts -w 1 -c 2
Re: Getting Invalid Output On Nagios
Posted: Wed May 13, 2015 2:32 am
by rlinux57
On remote host working fine:
#/usr/lib/nagios/plugins/check_testaccounts -w 1 -c 2
WARNING
nrpe.cfg command definition on remote host:
command[check_testaccounts]=/usr/lib/nagios/plugins/check_testaccounts -w 1 -c 2
Re: Getting Invalid Output On Nagios
Posted: Wed May 13, 2015 2:40 am
by Box293
A couple of things here.
rlinux57 wrote:When i have run that plugin on nagios server it gives an invalid output:
#/usr/local/nagios/libexec/check_nrpe -c check_testaccounts -H spelljob.com 1 2
rlinux57 wrote:nrpe.cfg command definition on remote host:
command[check_testaccounts]=/usr/lib/nagios/plugins/check_testaccounts -w 1 -c 2
So in your nrpe command definition you have defined the warning and critical thresholds, so you don't need to use them in your nrpe command:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -c check_testaccounts -H spelljob.com
If you did want to send them, then you would need:
Code: Select all
command[check_testaccounts]=/usr/lib/nagios/plugins/check_testaccounts -w $ARG1$ -c $ARG2$
Code: Select all
/usr/local/nagios/libexec/check_nrpe -c check_testaccounts -H spelljob.com -a 1 2
NOTE: To send arguments you must use the -a flag.
Re: Getting Invalid Output On Nagios
Posted: Wed May 13, 2015 2:46 am
by rlinux57
Still it shows on nagios server:
[root@monitors ~]# /usr/local/nagios/libexec/check_nrpe -c check_testaccounts -H spelljob.com -a 1 2
NRPE: Unable to read output
Re: Getting Invalid Output On Nagios
Posted: Wed May 13, 2015 2:52 am
by Box293
To remove dns as an issue, instead of using spelljob.com, use the IP Address.
Re: Getting Invalid Output On Nagios
Posted: Wed May 13, 2015 2:58 am
by rlinux57
Still getting error.
I have define command in nagios server as:
define command{
command_name check_testaccounts
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_testaccounts $ARG1$ $ARG2$
}
Re: Getting Invalid Output On Nagios
Posted: Wed May 13, 2015 9:31 am
by jdalrymple
rlinux57 wrote:On remote host working fine:
#/usr/lib/nagios/plugins/check_testaccounts -w 1 -c 2
WARNING
It looks like you're running it as root when you test it. When nrpe runs the test script it runs as user nagios. Can you test as user nagios and see if it works. If it does then we will look elsewhere. If it doesn't, you need to resolve that.