Cannot write to pidfile

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.
sirampadu
Posts: 14
Joined: Tue Jul 25, 2017 9:27 am

Cannot write to pidfile

Post 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.
bolson

Re: Cannot write to pidfile

Post by bolson »

Hello sirampadu,

How did you install NRPE? It would appear to be xinetd... How are you restarting nrpe?
sirampadu
Posts: 14
Joined: Tue Jul 25, 2017 9:27 am

Re: Cannot write to pidfile

Post by sirampadu »

systemctl restart nrpe
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Cannot write to pidfile

Post 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...
Former Nagios employee
sirampadu
Posts: 14
Joined: Tue Jul 25, 2017 9:27 am

Re: Cannot write to pidfile

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

Re: Cannot write to pidfile

Post 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.
sirampadu
Posts: 14
Joined: Tue Jul 25, 2017 9:27 am

Re: Cannot write to pidfile

Post 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?
bolson

Re: Cannot write to pidfile

Post by bolson »

You can run the following command to confirm that nrpe is running:

Code: Select all

telnet localhost 5666
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.
sirampadu
Posts: 14
Joined: Tue Jul 25, 2017 9:27 am

Re: Cannot write to pidfile

Post 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
Last edited by sirampadu on Tue Jul 25, 2017 11:46 am, edited 1 time in total.
bolson

Re: Cannot write to pidfile

Post by bolson »

NRPE is not running. Please copy and paste the contents of /etc/xinetd.d/nrpe

Thank you.
Locked