Page 2 of 2

Re: Monitor Cache read hits

Posted: Thu Apr 21, 2016 4:54 pm
by lmiltchev
Ran /usr/local/nagios/libexec/check_FSCacheReadsv1.sh with user 'nagios'. The script doesn't work as expected.
Have you tried using "sudo" in front of the command?

Code: Select all

su nagios
sudo /usr/local/nagios/libexec/check_FSCacheReadsv1.sh
If this doesn't work you may need to add to sudoers something like this:

Code: Select all

Defaults:nagios !requiretty
nagios ALL=NOPASSWD: /path/to/fscli *

Re: Monitor Cache read hits

Posted: Sun Apr 24, 2016 4:08 am
by jeswanth
Thanks lmiltchev! Sorry for the delayed reply!

I've tried editing /etc/sudoers with the recommendations provided. Defaults:nagios !requiretty nagios ALL=NOPASSWD: /sbin/fscli *
But not sure what would be the default password for user 'nagios'. Ref: https://assets.nagios.com/downloads/nag ... _Notes.pdf

Code: Select all

root@v183:/sbin# su nagios
nagios@v183:/sbin$ sudo /usr/local/nagios/libexec/check_FSCacheReadsv1.sh
[sudo] password for nagios:
If we try creating a user 'nagios' on an RHEL machine, and add 'nagios ALL=(ALL:ALL) ALL', I was able to run fscli commands without issues. I'm using Ubuntu at the moment.

So, I tried installing Nagios agent linux-nrpe-agent on an RHEL machine Red Hat Enterprise Linux Server release 7.2 (Maipo) and got the below error:

Code: Select all

Failed to restart xinetd.service: Unit xinetd.service failed to load: No such file or directory.
Subcomponents installation failed - exiting
Installation log file attached..

Re: Monitor Cache read hits

Posted: Mon Apr 25, 2016 4:10 pm
by hsmith
What's the output of ls /etc/ | grep xinetd

Re: Monitor Cache read hits

Posted: Mon Apr 25, 2016 5:48 pm
by jeswanth
Here is the output -

Code: Select all

[root@v121 04:13:55 ~ ]# ls /etc/ | grep xinetd
xinetd.d

Code: Select all

[root@v121 04:15:56 ~ ]# ls /etc/xinetd.d/
nrpe  nsca

Code: Select all

[root@blrfsserv121 04:16:01 ~ ]# cat /etc/xinetd.d/nrpe
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
        flags           = REUSE
        socket_type     = stream
        port            = 5666
        wait            = no
        user            = nagios
        group           = nagios
        server          = /usr/local/nagios/bin/nrpe
        server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
        log_on_failure  += USERID
        disable         = no
        only_from       = 192.168.48.224
}
[root@v121 04:16:27 ~ ]# cat /etc/xinetd.d/nsca
# default: on
# description: NSCA (Nagios Service Check Acceptor)
service nsca
{
        flags           = REUSE
        socket_type     = stream
        wait            = no
        user            = nagios
        group           = nagios
        server          = /usr/local/nagios/bin/nsca
        server_args     = -c /usr/local/nagios/etc/nsca.cfg --inetd
        log_on_failure  += USERID
        disable         = no
        only_from       = 127.0.0.1
}

Re: Monitor Cache read hits

Posted: Mon Apr 25, 2016 8:32 pm
by rkennedy
What is the actual output when you run /usr/local/nagios/libexec/check_FSCacheReadsv1.sh as the nagios user? You mentioned it failed, but I didn't see an output.

This should point us to where the problem is.

Re: Monitor Cache read hits

Posted: Tue Apr 26, 2016 11:47 am
by jeswanth
Removed the password for user 'nagios' and added sudo infront of fscli command. I'm able to execute the command locally on the remote system.

Code: Select all

nagios@v183:/root$ /usr/local/nagios/libexec/check_FSCacheReadsv1.sh
Warning! Cache reads are (  % = 56 54 0 0 ) less than 80%
But if I execute the command from nagios server, it given an error 'NRPE: Unable to read 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: Tue Apr 26, 2016 5:00 pm
by Box293
Can you please post your sudoers file.

Re: Monitor Cache read hits

Posted: Tue Apr 26, 2016 5:48 pm
by jeswanth
Here we go -

Code: Select all

root@v183:~# cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

# NEEDED TO ALLOW NAGIOS TO CHECK SERVICE STATUS
#Defaults:nagios !requiretty
#nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_init_service

# ASTERISK-SPECIFIC CHECKS
# NOTE: You can uncomment the following line if you are monitoring Asterisk locally
#nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_asterisk_sip_peers.sh, /usr/local/nagios/libexec/nagisk.pl, /usr/sbin/asterisk

#nagios  ALL=(ALL:ALL) ALL


nagios    ALL = NOPASSWD: ALL

#nagios  ALL=(ALL)   NOPASSWD:/sbin/fscli, /usr/local/nagios/libexec/check_FSCacheReadsv1.sh

root@v183:~#

Re: Monitor Cache read hits

Posted: Wed Apr 27, 2016 9:27 am
by tgriep
If you edit your /etc/sudoers file and change the following lines from

Code: Select all

#Defaults:nagios !requiretty
#nagios  ALL=(ALL)   NOPASSWD:/sbin/fscli, /usr/local/nagios/libexec/check_FSCacheReadsv1.sh
to

Code: Select all

Defaults:nagios !requiretty
nagios  ALL=(ALL)   NOPASSWD:/sbin/fscli, /usr/local/nagios/libexec/check_FSCacheReadsv1.sh
That should fix it for you.