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.
Aug 29 14:43:16 nms nagios: Starting nagios:
Aug 29 14:43:16 nms nagios: Nagios Core 4.2.0
Aug 29 14:43:16 nms nagios: Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Aug 29 14:43:16 nms nagios: Copyright (c) 1999-2009 Ethan Galstad
Aug 29 14:43:16 nms nagios: Last Modified: 08-01-2016
Aug 29 14:43:16 nms nagios: License: GPL
Aug 29 14:43:16 nms nagios: Website: https://www.nagios.org
Aug 29 14:43:16 nms nagios: Reading configuration data...
Aug 29 14:43:16 nms nagios: Error in configuration file '/usr/local/nagios/etc/nagios.cfg' - Line 457 (Check result path '/usr/local/nagios/var/spool/checkresults' is not a valid directory)
Aug 29 14:43:16 nms nagios: Error processing main config file!
Aug 29 14:43:16 nms systemd: nagios.service: control process exited, code=exited status=8
Aug 29 14:43:16 nms systemd: Failed to start LSB: Starts and stops the Nagios monitoring server.
Aug 29 14:43:16 nms systemd: Unit nagios.service entered failed state.
Aug 29 14:43:16 nms systemd: nagios.service failed.
Ok, I did some additional testing....
1. Deleted /usr/local/nagios/var (what does it hurt since the contents were being deleted at reboot anyway?)
2. Reboot
3. Login and ll /usr/local/nagios and there is var back from the dead. Note time is the same as the reboot.
Recompiled nagios with --prefix=/opt/nagios/ and /opt/nagios/var/* are intact after reboots! So what part of the OS would be doing such a thing in /usr/local/nagios/var only?
Systemd will wipe out temporary files on exit. If you want the temporary file structure to be recreated on boot, then you need to have a configuration file in the /etc/tmpfiles.d directory. I created a nagios.service.conf file in this directory with the following contents:
d /usr/local/nagios/var/spool 0775 nagios nagios --
d /usr/local/nagios/var/spool/checkresults 0775 nagios nagios - -
d /usr/local/nagios/var/rw 0775 nagios nagios - -
The temporary file structure is recreated at boot. I even have re-enabled SELinux, and Nagios is having no problems.