I have Nagios under Fedora Linux and a Java process under RedHat.
I need to check from time to time if a specific Java process ended up successfully and collected about itself statistics. I have a Perl script for that case.
When I remotely run my Perl script from Fedore using ‘rsh’, I can access the process and get the results, but I am asked to type password.
rsh mesmes -l user123 ‘perl /staging/monitorW.pl’
If I try to run the same under Nagios automatically, I am getting "permission denied’.
I have a number of similar processes to monitor on an AIX Unix host.
I set up config files the same way between Fedora & AIX Unix machines, I do not have this problem there. So what it could be a problem between RedHat & Fedora?
1).On both of the hosts there is the same user ‘user123’ defined
2) The file /etc/hosts:
The .rhosts file resides in a user’s home directory and specifies the remote machines and remote user names that the user may use to remotely log in to the local machine.
cat .rhosts
mesmes user_name
nagios user_name
After these changes done, I restarted the ‘rsh’ service
keep in mind that the version of check_nrpe that runs on the nagios server has to be the same as the verison of nrpe the runs on the remote host you are monitoring or it won’t work
Thanks for the advice.
I installed nrpe and configured it, but I still cannot run not only my PERL script, but even other Nagious plug-ins like check_local_load or any others from the command line in Linux. Both of the hosts are configured under nagios, and nagios shows on the Web interface all the statistics about the host, where I try to run through nrpe my script.
I am getting
CHECK_NRPE: Error receiving data from daemon.
when I try to run my command:
./check_nrpe -n -H 10.10.21.159 -p 5666 -c “/usr/bin/perl /data/ntsr/SPMF/monitorSpMF.pl”
The latest version of Nagios installed under Fedora. The process I am trying to monitor is under RedHat
Getting a “Error receiving data from daemon.” may mean that the allowed_hosts property in the nrpe.cfg of the remote host you are monitoring does not include the IP address of your nagios server.
It also may mean that the version of check_nrpe on your nagios server is not the same version as nrpe on the remote host you are monitoring.
One other thing to note, the -c qualifier for check_nrpe (defined on the nagios server) has to match the command pneumonic which is specified in nrpe.cfg on the remote host you are monitoring.
i.e. if you are trying check_nrpe from the nagios server manually, -c needs to match the string specified in the command…] declaration in nrpe.cfg on the remote host you are monitoring.
I mention this because you have specified it as a statement executed on the command line, and that should be in the nrpe.cfg instead.
If this doesn’t help, maybe if you post the relevant service and check command definitions on your nagios server and the command definition on the remote host, that may help clear things up.
I checked the configuration on both of the machines:
Configuring on the Remote Host with the ‘nrpe’ daemon
Getting “Error receiving data from daemon.” may mean that the allowed_hosts property in the nrpe.cfg of the remote host you are monitoring does not include the IP address of your nagios server.
The nagios server included into the mesmes nrpe.cfg:
allowed_hosts=127.0.0.1, 12.12.2.181
It also may mean that the version of check_nrpe on your nagios server is not the same version as nrpe on the remote host you are monitoring.
The same version of nrpe installed on both machines:
on mesmes nrpe : Version: 2.5.1
on nagios nrpe: Version: 2.5.1
One other thing to note, the -c qualifier for check_nrpe (defined on the nagios server) has to match the command pneumonic which is specified in nrpe.cfg on the remote host you are monitoring.
i.e. if you are trying check_nrpe from the nagios server manually, -c needs to match the string specified in the command…] declaration in nrpe.cfg on the remote host you are monitoring.
I mention this because you have specified it as a statement executed on the command line, and that should be in the nrpe.cfg instead.
In the nrpe.cfg on the nrpe daemon host the command is defined the following way:
[root@mesmes etc]# vi /etc/xinetd.d/nrpe
service nrpe
{
flags = REUSE
disable = no
port = 5666
socket_type = stream
wait = no
user = root
server = /usr/local/nagios/bin/nrpe
server_args = -n -d -c /user/local/nagios/etc/nrpe.cfg
log_on_failure += USERID
only_from = 12.12.2.181
}
File /etc/services:
nrpe 5666/tcp # Nagios – nrpe
[root@mesmes etc]# /etc/rc.d/init.d/xinetd restart
Stopping xinetd: OK ]
Starting xinetd: OK ]
[root@mesmes etc]# /etc/rc.d/init.d/xinetd status
xinetd (pid 13888) is running…
[root@mesmes etc]# netstat -pta
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 *:nrpe : LISTEN 13888/xinetd
hosts.allow This file describes the names of the hosts which are
I do not even defined a nagios service, because I am still getting the same error, when I try to run it from the nagios machine from the command line:
CHECK_NRPE: Error receiving data from daemon.
you may need to put the IP address of your nagios server in /etc/hosts.allow on mesmes; it is possible that mesmes is blocking the requests from your nagios server
log in as the user that runs nrpe on mesmes and try executing the command: /usr/bin/perl /data/ntsr/SPMF/monitorSpMF.pl
this will determine if the user running nrpe has appropriate permissions to run this perl script. Post the output and the value of echo $? to see if the return code is ok
…I’m running out of ideas here, so maybe someone else can think of something.
the /etc/hosts.allow on mesmes (not the nagios server) has to have the IP address of the nagios server or it won’t work; you gave the /etc/hosts.allow on the nagios server, not on mesmes
the version of ./libexec/check_nrpe on the nagios server has to be the same version of nrpe on mesmes; can you double check this?
are you running nrpe as root on mesmes? If not, then that might be part of the problem
one other thing that may be a longshot is that you are using the -n qualifier in check_nrpe which indicates to not use SSL; you might try it without this qualifier
…just as a tip, until you can sort this out, continue testing it by manually running ./libexec/check_nrpe from the command line on the nagios server, this way you eliminate the nagios configs as a potential cause of the problem