Page 1 of 1

Remote Monitoring Not Working On Add On Script

Posted: Mon Feb 04, 2013 9:19 am
by theangryheretic
I have a Nagios Core server that is up and running, with the NRPE client configured on the additional servers I want to monitor. Their nrpe checks are reporting back to the Nagios server just fine. I have a script that I pulled off the Nagios Exchange and when I log into the server that I want to monitor, run the script from the command line, it works.

When I add that check to my Nagios server and try to monitor it that way, the Nagios server reports that no RAID adapters were found. So I log into the Nagios server and run it via command line, and get the same results. It seems as if the script is not communicating with the remote server I want to monitor. When I run it from the command line, this is how I run the command.

/usr/lib64/nagios/plugins/chrck_nrpe -H 192.168.129.10 -c check_raid

I know the check_raid script works because I get the desired output on the remote server, but why the Nagios server can not send or receive the correct info, I am not certain.

I hope someone with more Nagios experience than I have can point me in the right direction if they recognize what is going on. If I need to provide more info, I can do that easily.

Thanks in advance for any assistance.

Re: Remote Monitoring Not Working On Add On Script

Posted: Mon Feb 04, 2013 10:46 am
by lmiltchev
What is the output of your command?

Code: Select all

/usr/lib64/nagios/plugins/chrck_nrpe -H 192.168.129.10 -c check_raid
What do you get when you run only this?

Code: Select all

/usr/lib64/nagios/plugins/chrck_nrpe -H 192.168.129.10

Re: Remote Monitoring Not Working On Add On Script

Posted: Mon Feb 04, 2013 11:56 am
by theangryheretic
lmiltchev wrote:What is the output of your command?

Code: Select all

/usr/lib64/nagios/plugins/chrck_nrpe -H 192.168.129.10 -c check_raid
When I run the above, I get the following.

WARNING: tw_cli:[No Adapters were found on this machine]

What do you get when you run only this?

Code: Select all

/usr/lib64/nagios/plugins/chrck_nrpe -H 192.168.129.10
When I only run this, I get the version of NRPE,

NRPE v2.13

Re: Remote Monitoring Not Working On Add On Script

Posted: Mon Feb 04, 2013 12:07 pm
by abrist
I use this check myself for my 3ware cards. This check requires root access. Could you post the permissions you have set on the check_raid file? What happens when you change user to nagios and try to run the plugin locally?

Re: Remote Monitoring Not Working On Add On Script

Posted: Mon Feb 04, 2013 12:41 pm
by theangryheretic
abrist wrote:I use this check myself for my 3ware cards. This check requires root access. Could you post the permissions you have set on the check_raid file? What happens when you change user to nagios and try to run the plugin locally?
-rwxr-xr-x 1 nagios nagios 71429 Jan 31 17:24 check_raid.pl

I tried to run it as the nagios user, and found out that the nagios user did not have permission to run the

/usr/sbin/tw_cli

command.

I set up a command alias and gave the nagios user access to the tw_cli command. Now the nagios user gets the same result as the root user, when I run the command locally on the server I want to monitor, but from the Nagios server's web interface, it's still not returning the right info.

Re: Remote Monitoring Not Working On Add On Script

Posted: Mon Feb 04, 2013 1:01 pm
by abrist
You may have to alter the /etc/sudoers file to give permission to the check:

Code: Select all

nagios ALL=(ALL) NOPASSWD:/usr/local/bin/check_raid
Then the problem is in the requiretty options in /etc/sudoers, enabled by default on CentOS. Simply comment it as follows only if you are running on centos:

Code: Select all

#Defaults requiretty

Re: Remote Monitoring Not Working On Add On Script

Posted: Mon Feb 04, 2013 4:36 pm
by theangryheretic
abrist wrote:You may have to alter the /etc/sudoers file to give permission to the check:

Code: Select all

nagios ALL=(ALL) NOPASSWD:/usr/local/bin/check_raid
The check was already owned by the nagios user. But I had to give the nagios user permissions to the /usr/sbin/tw_cli command through sudoers.

Then the problem is in the requiretty options in /etc/sudoers, enabled by default on CentOS. Simply comment it as follows only if you are running on centos:

Code: Select all

#Defaults requiretty
I'm running Red Hat Enterprise Linux 6.3, which I know is what CentOS is based on, so do you think it should still be commented out?

Re: Remote Monitoring Not Working On Add On Script

Posted: Mon Feb 04, 2013 4:48 pm
by abrist
Try it both ways as I don't have a usage case to test this with.

Re: Remote Monitoring Not Working On Add On Script

Posted: Mon Feb 04, 2013 5:18 pm
by theangryheretic
abrist wrote:Try it both ways as I don't have a usage case to test this with.
Either way does not seem to make a difference. But I have stumbled upon a little bit of progress. It looks like the /etc/nagios/nrpe.cfg file needs an argument flag on the line where I define the check_raid command. Which is a little odd since the script I am using never made mention of needing a flag. Or if it did make mention of that flag, I don't remember seeing it.

Re: Remote Monitoring Not Working On Add On Script

Posted: Mon Feb 04, 2013 5:30 pm
by abrist
Did it require an argument when run from the cli? You could always try setting the suid bit on the plugin:

Code: Select all

chmod u+s check_raid