Getting Invalid Output On Nagios
Getting Invalid Output On Nagios
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.
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.
- Attachments
-
- tplugin.txt
- (174 Bytes) Downloaded 310 times
Re: Getting Invalid Output On Nagios
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?
Also, did you configure NRPE to allow arbitrary plugin arguments?
Former Nagios employee
Re: Getting Invalid Output On Nagios
I have allow the arguments in nrpe.cfg
Kindly check the attachment plugin i have edit exit code as per your direction.
Kindly check the attachment plugin i have edit exit code as per your direction.
- Attachments
-
- tplugin.txt
- (763 Bytes) Downloaded 298 times
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Getting Invalid Output On Nagios
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?
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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Getting Invalid Output On Nagios
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
#/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
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Getting Invalid Output On Nagios
A couple of things here.
If you did want to send them, then you would need:
NOTE: To send arguments you must use the -a flag.
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
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:rlinux57 wrote:nrpe.cfg command definition on remote host:
command[check_testaccounts]=/usr/lib/nagios/plugins/check_testaccounts -w 1 -c 2
Code: Select all
/usr/local/nagios/libexec/check_nrpe -c check_testaccounts -H spelljob.com
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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Getting Invalid Output On Nagios
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
[root@monitors ~]# /usr/local/nagios/libexec/check_nrpe -c check_testaccounts -H spelljob.com -a 1 2
NRPE: Unable to read output
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Getting Invalid Output On Nagios
To remove dns as an issue, instead of using spelljob.com, use the IP Address.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Getting Invalid Output On Nagios
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$
}
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$
}
-
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Getting Invalid Output On Nagios
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.rlinux57 wrote:On remote host working fine:
#/usr/lib/nagios/plugins/check_testaccounts -w 1 -c 2
WARNING