XINETD/NRPE | Cannot Write to Pidfile

 Cannot write to pidfile ‘/var/run/nagios/nrpe.pid’ – check your privileges.

This error occurs when the “pidfile” cannot be rewritten. In most cases, this happens after a reboot and the file itself is read-only instead of read/write.

If that is the case, go ahead and restart the xinetd and nrpe services.

service xinetd restart
service nrpe restart

Next, check the status of xinetd and nrpe

servie xinetd status
service nrpe status

Your xinet daemon should stay active and show that it’s running. When you check NRPE, it will say failed and display the following.

 nrpe[1312]: Starting up daemon
 nrpe[1312]: Cannot write to pidfile '/var/run/nagios/nrpe.pid' - check your privileges.

to fix this, you will need to go to /var/run/xinetd.pid if you are using xinetd with nrpe.

check the permissions of the tile with ll or ls -l

-r--r----- 1 nagios nagios 6 Dec 4 10:12 xinetd.pid

In the output above, the file has only read access and cannot be written too. To fix this issue, first, change the ownership to nagios and then changed the permissions.

chown nagios:nagios /var/run/xinetd.pid

Next, change the permissions to Read, Write, No Execute

chmod 660 xinetd.pid

Once done, check the file with ll 

-rw-rw—- 1 nagios nagios 6 Dec 4 10:16 xinetd.pid

Restart the service

service nrpe restart

Check the status to see if the service is running.

service nrpe status
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s