LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   check_nrpe command giving wrong value (http://www.linuxquestions.org/questions/linux-server-73/check_nrpe-command-giving-wrong-value-4175437766/)

call_krushna 11-19-2012 04:57 AM

check_nrpe command giving wrong value
 
Hi team,

I have written a small plugin to check vidispine realm authorisation using the wget command as follows .

#!/bin/sh
WGET=/usr/bin/wget
URL=http://localhost:8080/API/version
$WGET --user=admin --password=admin123 $URL 2> /dev/null
if [ $? = "0" ]; then
rm -rf version; echo "Vidispine realm ok" ; exit 0
else
rm -rf version; echo "Vidispine realm not working" ;exit 1
fi

if I run this script in remote server(192.168.0.237 ), working fine

#/usr/local/nagios/libexec/check_vidispinerealm
Vidispine realm ok

but when I am trying the same script using check nrpe from nagios server ,it is giving wrong value

Nagios-server#/usr/local/nagios/libexec/check_nrpe -H 192.168.0.237 -c check_vidispinerealm
Vidispine realm not working

Note :On 192.168.0.237 ,I have copied to script to /usr/local/nagios/libexec folder ,given execute permission to nagios user and added the entry in nrpe.cfg


Any help will be highly appreciable .
Thanks in advance

sag47 11-19-2012 11:58 PM

What does the entry in your nrpe.cfg look like? Also please use [CODE] tags when you're displaying code.

Curl might be a better option for what you're attempting than wget.
Code:

curl --user name:password http://www.example.com
Have you tried executing the script as the nagios user?
Code:

# su - nagios
$ /usr/local/nagios/libexec/check_vidispinerealm


call_krushna 11-20-2012 12:43 AM

Quote:

Originally Posted by sag47 (Post 4832997)
What does the entry in your nrpe.cfg look like? Also please use [CODE] tags when you're displaying code.

Curl might be a better option for what you're attempting than wget.
Code:

curl --user name:password http://www.example.com
Have you tried executing the script as the nagios user?
Code:

# su - nagios
$ /usr/local/nagios/libexec/check_vidispinerealm


Thanks for reply . I will try with curl and get back you . To fix immediately , I have used check_http -a .

call_krushna 11-20-2012 02:39 AM

Quote:

Originally Posted by call_krushna (Post 4833010)
Thanks for reply . I will try with curl and get back you . To fix immediately , I have used check_http -a .

Hi sag47,

Thanks a ton for reply .The problem was , while using wget ,it used to download one file called version .Since no permission was set to the existing folder ,it was giving wrong output .In my plugin script , I have added extra line i.e.

cd /usr/local/nagios

Now it is working fine .Thanks for pointing out this .


All times are GMT -5. The time now is 04:39 PM.