Page 1 of 2
Monitor Cache read hits
Posted: Wed Apr 20, 2016 2:09 am
by jeswanth
Hello,
I'm trying to deploy a plugin using doc -
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
and getting error: NRPE: Command 'check_FSCacheReadsv1' not defined
define service {
host_name 10.242.48.183
service_description check_FSCacheReadsv1
display_name check_FSCacheReadsv1
check_command check_FSCacheReadsv1!!!!!!!!
max_check_attempts 2
check_interval 5
retry_interval 5
active_checks_enabled 1
passive_checks_enabled 0
check_period 24x7
event_handler check_none
event_handler_enabled 0
notification_period 24x7
register 1
}
Could you please help me with this?
Re: Monitor Cache read hits
Posted: Wed Apr 20, 2016 8:39 am
by lmiltchev
What is the plugin that you are trying to deploy? Can you provide us with a URL link to it?
In the "check_FSCacheReadsv1" service definition, you have:
check_command check_FSCacheReadsv1
Can you show us the command definition of "check_FSCacheReadsv1"?
In addition to this, show us the actual check run from the command line, along with the output of it.
Re: Monitor Cache read hits
Posted: Wed Apr 20, 2016 9:21 am
by jeswanth
Thanks for the reply lmiltchev!!
I wrote a shell script and trying to deploy as a plugin. I've attached the script to the email
Client machine is Ubuntu server 14.04.
Re: Monitor Cache read hits
Posted: Wed Apr 20, 2016 9:30 am
by jeswanth
Attaching the screenshot of the script output.
Thanks in advance!!
Re: Monitor Cache read hits
Posted: Wed Apr 20, 2016 11:35 am
by rkennedy
You need to add a line to your /usr/local/nagios/etc/nrpe.cfg so that NRPE has a definition for the command. -
Code: Select all
command[check_FSCacheReadsv1]=/usr/local/nagios/libexec/check_FSCacheReadsv1.sh
Then, restart NRPE (either service xinetd restart or service nrpe restart). Once this is done, you should be able to run your command through NRPE from the Nagios machine.
Re: Monitor Cache read hits
Posted: Wed Apr 20, 2016 2:14 pm
by jeswanth
Thanks for the reply Kennedy!
I've defined the command earlier from GUI (Core config manager -> Commands -> $USER1$/check_FSCacheReadsv1.sh and $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_FSCacheReadsv1) and applied the changes. However that doesn't reflect in nrpe.cfg.
I've added the command at the client side nrpe.cfg and restarted xinetd service as suggested. Then, I see an error message : NRPE: Unable to read output
It appeared to be a permissions issue as per few google results. so I added the line 'nagios ALL=(ALL) NOPASSWD:/usr/sbin/lsof,/usr/local/nagios/libexec/check_FSCacheReadsv1.sh' at /etc/sudoers on client machine and restarted xinetd service. But it doesn't solve the problem or change the error message from 'NRPE: Unable to read output'.
Re: Monitor Cache read hits
Posted: Wed Apr 20, 2016 5:14 pm
by rkennedy
What are the permissions of /usr/local/nagios/libexec/check_FSCacheReadsv1.sh?
From the remote machine, can you execute the command as the nagios user? (not through NRPE) Both your screenshots are only as the root user.
Re: Monitor Cache read hits
Posted: Wed Apr 20, 2016 9:11 pm
by jeswanth
I've changed the file ownership to 'nagios' user.
Output -
Code: Select all
root@v183:~# ls -l /usr/local/nagios/libexec/check_FSCacheReadsv1.sh
-rwxr-xr-x 1 nagios nagios 601 Apr 20 09:13 /usr/local/nagios/libexec/check_FSCacheReadsv1.sh
and then tried executing a command from nagios server. Here is the output -
Code: Select all
[root@localhost libexec]# ./check_nrpe -H 192.168.48.183 -c check_FSCacheReadsv1
NRPE: Unable to read output
Re: Monitor Cache read hits
Posted: Wed Apr 20, 2016 10:32 pm
by Box293
On the remote system, can you run the script as the nagios user:
Code: Select all
su nagios
/usr/local/nagios/libexec/check_FSCacheReadsv1.sh
Can you please run these commands on the remote system and show us the output:
Re: Monitor Cache read hits
Posted: Thu Apr 21, 2016 3:46 am
by jeswanth
Thanks for the inputs Box293!
Ran
/usr/local/nagios/libexec/check_FSCacheReadsv1.sh with user 'nagios'. The script doesn't work as expected.
I'm using fscli commands in the script and that needs root privileges. So, I added
nagios ALL=(ALL) ALL in
/etc/sudoers on the client system. However, that doesn't allow me to run fscli commands.
Output for fscli
Code: Select all
nagios@v183:/root$ fscli
fscli command requires superuser (root) privileges.
Output for
ps -C xinetd
Code: Select all
root@v183:~# ps -C xinetd
PID TTY TIME CMD
1848 ? 00:00:00 xinetd