Monitor Cache read hits

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
jeswanth
Posts: 10
Joined: Wed Apr 20, 2016 12:57 am

Monitor Cache read hits

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

Re: Monitor Cache read hits

Post by lmiltchev »

I'm trying to deploy a plugin using doc - https://assets.nagios.com/downloads/nag ... ios-XI.pdf
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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
jeswanth
Posts: 10
Joined: Wed Apr 20, 2016 12:57 am

Re: Monitor Cache read hits

Post 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.
You do not have the required permissions to view the files attached to this post.
jeswanth
Posts: 10
Joined: Wed Apr 20, 2016 12:57 am

Re: Monitor Cache read hits

Post by jeswanth »

Attaching the screenshot of the script output.

Thanks in advance!!
You do not have the required permissions to view the files attached to this post.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Monitor Cache read hits

Post 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.
Former Nagios Employee
jeswanth
Posts: 10
Joined: Wed Apr 20, 2016 12:57 am

Re: Monitor Cache read hits

Post 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'.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Monitor Cache read hits

Post 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.
Former Nagios Employee
jeswanth
Posts: 10
Joined: Wed Apr 20, 2016 12:57 am

Re: Monitor Cache read hits

Post 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
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Monitor Cache read hits

Post 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:

Code: Select all

ps -C xinetd
ps -C nrpe
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jeswanth
Posts: 10
Joined: Wed Apr 20, 2016 12:57 am

Re: Monitor Cache read hits

Post 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
Locked