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.
sachinmw
Posts: 3 Joined: Tue Aug 30, 2016 2:29 am
Post
by sachinmw » Tue Aug 30, 2016 2:39 am
output from local host
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.15
Code: Select all
/usr/local/nagios/libexec/check_init_service sshd openssh-daemon (pid 5643) is running...
output from nagios server
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 172.166.255.30
NRPE v2.15
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 172.166.255.30 -c check_init_service -a sshd
NRPE: Unable to read output
contents of /etc/xinted.d/nrpe
Code: Select all
# 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 = Server.IP 127.0.0.1
}
I have tried all solutions I could find about this issue
any ideas what I am missing?
tgriep
Madmin
Posts: 9190 Joined: Thu Oct 30, 2014 9:02 am
Post
by tgriep » Tue Aug 30, 2016 1:11 pm
The error you are receiving usually comes from either the plugin is not installed on the remote system or that the command settings in the nrpe.cfg is not setup correctly.
Make sure that the plugin is installed on the remote system and that the path for the command is defined correctly.
Also, that plugin's owner and group is the nagios user and that the nagios user can run it.
You also need to add the following in the /etc/sudoers file.
Code: Select all
nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_init_service
Try that and let us know if this fixes the issue.
Be sure to check out our
Knowledgebase for helpful articles and solutions!
sachinmw
Posts: 3 Joined: Tue Aug 30, 2016 2:29 am
Post
by sachinmw » Tue Aug 30, 2016 6:40 pm
nagios is installed
Code: Select all
#find / -name nrpe
/usr/local/nagios/bin/nrpe
/usr/local/nagios/etc/nrpe
/etc/xinetd.d/nrpe
netstat
Code: Select all
#netstat -at | grep nrpe
tcp 0 0 *:nrpe *:* LISTEN
since nrpe is running via xinetd
/usr/local/nagios/etc/nrpe/common.cfg file
/usr/local/nagios/etc/nrpe.cfg file
permissions and ownership
Code: Select all
ls -l /usr/local/nagios/libexec/check_init_service
-rwxr-xr-x 1 nagios nagios 748 Feb 9 2016 /usr/local/nagios/libexec/check_init_service
sudoers file
Code: Select all
# grep nagios /etc/sudoers
User_Alias NAGIOS_USERS = %nagios
User_Alias NAGIOSXI_USERS=nagios
Cmnd_Alias NAGIOS_CMDS = /usr/local/nagios/libexec/check_init_service, /usr/local/nagios/libexec/check_mountpoints.sh
Cmnd_Alias NAGIOSXI_CMDS = /etc/init.d/nagios *, /etc/init.d/ndo2db *, /etc/init.d/npcd *, /usr/bin/php /usr/local/nagiosxi/html/includes/components/autodiscovery/scripts/autodiscover_new.php *, /usr/local/nagiosxi/html/includes/components/profile/getprofile.sh, /usr/local/nagiosxi/scripts/upgrade_to_latest.sh, /usr/local/nagiosxi/scripts/change_timezone.sh, /usr/local/nagiosxi/scripts/manage_services.sh *, /usr/local/nagiosxi/scripts/reset_config_perms.sh
Cmnd_Alias NAGIOSXIWEB_CMDS = /usr/bin/tail -100 /var/log/messages, /usr/bin/tail -100 /var/log/httpd/error_log, /usr/bin/tail -100 /var/log/mysqld.log, /usr/bin/php /usr/local/nagiosxi/html/includes/components/autodiscovery/scripts/autodiscover_new.php *, /usr/local/nagiosxi/html/includes/components/profile/getprofile.sh, /etc/init.d/snmptt restart, /usr/local/nagiosxi/scripts/repair_databases.sh, /usr/local/nagiosxi/scripts/manage_services.sh *
Defaults:nagios !requiretty
Code: Select all
# grep NAGIOS_CMDS /etc/sudoers
Cmnd_Alias NAGIOS_CMDS = /usr/local/nagios/libexec/check_init_service, /usr/local/nagios/libexec/check_mountpoints.sh
NAGIOS_USERS ALL=NOPASSWD: NAGIOS_CMDS
tgriep
Madmin
Posts: 9190 Joined: Thu Oct 30, 2014 9:02 am
Post
by tgriep » Wed Aug 31, 2016 10:47 am
Can you login to the remote server as the nagios user and run the command?
Run the following and post the output.
Code: Select all
chage -l nagios
su nagios
/usr/local/nagios/libexec/check_init_service sshd
sudo /usr/local/nagios/libexec/check_init_service sshd
Be sure to check out our
Knowledgebase for helpful articles and solutions!
sachinmw
Posts: 3 Joined: Tue Aug 30, 2016 2:29 am
Post
by sachinmw » Tue Sep 06, 2016 6:39 pm
Code: Select all
[[email protected] ~]# chage -l nagios
Last password change : Feb 02, 2016
Password expires : May 02, 2016
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 90
Number of days of warning before password expires : 5
[[email protected] ~]# su nagios
[[email protected] root]$ /usr/local/nagios/libexec/check_init_service sshd
openssh-daemon (pid 5643) is running...
[[email protected] root]$ sudo /usr/local/nagios/libexec/check_init_service sshd
openssh-daemon (pid 5643) is running...
tgriep
Madmin
Posts: 9190 Joined: Thu Oct 30, 2014 9:02 am
Post
by tgriep » Wed Sep 07, 2016 10:04 am
Edit the common.cfg file and change this line from
Code: Select all
command[check_init_service]=sudo /usr/local/nagios/libexec/check_init_service $ARG1$
to
Code: Select all
command[check_init_service]=/usr/local/nagios/libexec/check_init_service $ARG1$
Let us know if this works for you.
Be sure to check out our
Knowledgebase for helpful articles and solutions!