NRPE haven’t got its own log file and writes its events in /var/log/messages. I will say yes why not but it will be a good idea to create a logfile for NRPE. In this post we’ll see how to create a specific log file for NRPE.

In a first time we’ll configure NRPE and in a second time we’ll configure Rsyslog configuration. It’s quite simple because NRPE have syslog facility.

Well stop the theory and let’s go !

NRPE configuration

You need to add the following lines in your NRPE configuration file. I my case the configuration file is /etc/nagios/nrpe.cfg :

1
2
log_facility=local1
debug=0
Note: It’s strongly recommended to enable debug just during debug session and not in normal mode.

Congrats you have configured your NRPE server, you could go to the next step.

Rsyslog configuration

To allow Rsyslog or its equivalents to manage your log files correctly, you need update your configuration to log NRPE messages in a specific file.

So you need to add the following lines in your rsyslog configuration file. Im my case the configuration file is /etc/rsyslog.conf.

1
local1.*                                          /var/log/nrpe
Note: You could add this line at the end of the file.

That’s all for Rsyslog.

After you have made modifications, a restart of nrpe and rsyslog is needed. You need to run the following commands to restart them.

1
2
/etc/init.d/rsyslog restart
/etc/init.d/nrpe restart

Okay, you could check /var/log/nrpe to see NRPE logs. If you don’t see anything in this file a restart of nrpe could be performed to create events in log.

I was difficult ? Have fun with your NRPE log file. ;–)

comments powered by Disqus