Remote Monitoring Not Working On Add On Script
-
theangryheretic
- Posts: 15
- Joined: Fri Feb 24, 2012 4:51 pm
Remote Monitoring Not Working On Add On Script
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.
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
What is the output of your command?
What do you get when you run only this?
Code: Select all
/usr/lib64/nagios/plugins/chrck_nrpe -H 192.168.129.10 -c check_raidCode: Select all
/usr/lib64/nagios/plugins/chrck_nrpe -H 192.168.129.10Be 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
When I only run this, I get the version of NRPE,lmiltchev wrote:What is the output of your command?
When I run the above, I get the following.Code: Select all
/usr/lib64/nagios/plugins/chrck_nrpe -H 192.168.129.10 -c check_raid
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
NRPE v2.13
Re: Remote Monitoring Not Working On Add On Script
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.
"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
-rwxr-xr-x 1 nagios nagios 71429 Jan 31 17:24 check_raid.plabrist 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?
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
You may have to alter the /etc/sudoers file to give permission to the check:
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
nagios ALL=(ALL) NOPASSWD:/usr/local/bin/check_raidCode: Select all
#Defaults requirettyFormer 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.
"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
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 wrote:You may have to alter the /etc/sudoers file to give permission to the check:
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.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
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.
"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
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 wrote: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
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_raidFormer 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.
"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.