Page 1 of 3
Cannot write to pidfile
Posted: Tue Jul 25, 2017 9:55 am
by sirampadu
I've been battling with setting up Nagios on my RHEL 7 environment for some time now but no luck. My current issue is, when i restart NRPE, in # journalctl -n i get Cannot write to pidfile /var/run/nrpe/nrpe.pid - check your privileges
when i run # grep pid /etc/nagios/nrpe.cfg
output is pid_file=/var/run/nrpe/nrpe.pid
I proceed to see what in that directory but there is no nrpe in /var/run, which means nrpe is not created in /var/run.
Find -name nrpe.pid returns nothing.
ls -la /etc/xinetd.d/nrpe returns
-rw-r--r-- 1 root root 429 Jul 25 14:50 /etc/xinetd.d/nrpe
to check what type of nrpe i configured
All helps are definitely welcomed.
Re: Cannot write to pidfile
Posted: Tue Jul 25, 2017 10:08 am
by bolson
Hello sirampadu,
How did you install NRPE? It would appear to be xinetd... How are you restarting nrpe?
Re: Cannot write to pidfile
Posted: Tue Jul 25, 2017 10:14 am
by sirampadu
systemctl restart nrpe
Re: Cannot write to pidfile
Posted: Tue Jul 25, 2017 10:20 am
by tmcdonald
Please answer all of our questions so we can better assist you:
bolson wrote:How did you install NRPE? It would appear to be xinetd...
Re: Cannot write to pidfile
Posted: Tue Jul 25, 2017 10:21 am
by sirampadu
I downloaded the nrpe-3.2.0. tar.gz , then i extracted it with tar -xzf. Proceeded nrpe-3.2.0 then ran the installation from there. I'm restarting nrpe with "
systemctl restart nrpe"
Yes it is with xinetd
Re: Cannot write to pidfile
Posted: Tue Jul 25, 2017 10:41 am
by bolson
the proper way to start/restart your version of nrpe is by starting or restarting the xinetd service. Ie: systemctl start xinetd
Let me know if this resolves your issue.
Re: Cannot write to pidfile
Posted: Tue Jul 25, 2017 11:11 am
by sirampadu
Status on Xinetd is active. Should status on nrpe be active or inactive since Xinetd is running?
i ran this command to see if there is communication between client and host
#/usr/local/nagios//libexec/check_nrpe -H hostname -t 30 -c check_users -a '-w 5 -c 10'
is that a correct command to use since I'm using xinetd?
Re: Cannot write to pidfile
Posted: Tue Jul 25, 2017 11:29 am
by bolson
You can run the following command to confirm that nrpe is running:
If it's running, execute the following from the cli on your Nagios Core server:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H ip_addr_of_host_to_monitor -c check_mem '-a -w 20 -c 10'
Let me know if you have additional questions.
Re: Cannot write to pidfile
Posted: Tue Jul 25, 2017 11:39 am
by sirampadu
telnet localhost 5666
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
/usr/local/nagios/libexec/check_nrpe -H host_name -c check_mem '-a -w 20 -c 10'
CHECK_NRPE: Error - Could not connect to host_name: Connection reset by peer
Re: Cannot write to pidfile
Posted: Tue Jul 25, 2017 11:46 am
by bolson
NRPE is not running. Please copy and paste the contents of /etc/xinetd.d/nrpe
Thank you.