Remote Monitoring Not Working On Add On Script

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
theangryheretic
Posts: 15
Joined: Fri Feb 24, 2012 4:51 pm

Remote Monitoring Not Working On Add On Script

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Remote Monitoring Not Working On Add On Script

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
theangryheretic
Posts: 15
Joined: Fri Feb 24, 2012 4:51 pm

Re: Remote Monitoring Not Working On Add On Script

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Remote Monitoring Not Working On Add On Script

Post 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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
theangryheretic
Posts: 15
Joined: Fri Feb 24, 2012 4:51 pm

Re: Remote Monitoring Not Working On Add On Script

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Remote Monitoring Not Working On Add On Script

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
theangryheretic
Posts: 15
Joined: Fri Feb 24, 2012 4:51 pm

Re: Remote Monitoring Not Working On Add On Script

Post 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?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Remote Monitoring Not Working On Add On Script

Post by abrist »

Try it both ways as I don't have a usage case to test this with.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
theangryheretic
Posts: 15
Joined: Fri Feb 24, 2012 4:51 pm

Re: Remote Monitoring Not Working On Add On Script

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Remote Monitoring Not Working On Add On Script

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked