Nagios setup & systemd

Hi All,

Trying to setup nagios to monitor my network, I have everything installed from YaST, and have edited the config files as needed.

I have enabled the service with systemctl enable nagios
However when I attempt to start nagios with systemctl start nagios and then check it’s status with systemctl status it seems to shutdown immediately :frowning:

type ○ nagios.service - Network Monitor Nagios
     Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; preset: d>
     Active: inactive (dead) since Mon 2024-08-05 19:08:57 BST; 2s ago
   Duration: 26ms
 Invocation: f9e2def99a5d4b42b2f7dbf5522e5b78
    Process: 24288 ExecStartPre=/usr/sbin/nagios -v /etc/nagios/nagios.cfg (cod>
    Process: 24290 ExecStart=/usr/sbin/nagios -d /etc/nagios/nagios.cfg (code=e>
    Process: 24322 ExecStopPost=/usr/bin/rm -f /var/spool/nagios/nagios.cmd (co>
   Main PID: 24290 (code=exited, status=0/SUCCESS)
        CPU: 129ms

Aug 05 19:08:57 capella nagios[24294]: wproc: Registry request: name=Core Worke>
Aug 05 19:08:57 capella nagios[24294]: wproc: Registry request: name=Core Worke>
Aug 05 19:08:57 capella nagios[24294]: wproc: Registry request: name=Core Worke>
Aug 05 19:08:57 capella nagios[24294]: wproc: Registry request: name=Core Worke>
Aug 05 19:08:57 capella nagios[24294]: wproc: Registry request: name=Core Worke>
Aug 05 19:08:57 capella nagios[24294]: wproc: Registry request: name=Core Worke>
Aug 05 19:08:57 capella nagios[24294]: wproc: Registry request: name=Core Worke>
Aug 05 19:08:57 capella nagios[24294]: Successfully launched command file worke>
Aug 05 19:08:57 capella nagios[24294]: Successfully shutdown... (PID=24294)
Aug 05 19:08:57 capella systemd[1]: nagios.service: Deactivated successfully.or paste code here

This leads to the web interface not working correctly.
running the ExecPre command (/usr/sbin/nagios -v /etc/nagios/nagios.cfg) reports no warnings or errors.

Manually running the ExecStart (/usr/sbin/nagios -d /etc/nagios/nagios.cfg) results in several nagios processes being launched and the web interface works.
So it seems there is a problem with the systemd file.

Does anyone have any idea how I may fix this?
Note: other than enabling it, I’ve not touched the systemd unit file.

Cheers.

Phill.

Can you also check the Nagios Core logs located at /usr/local/nagios/var/nagios.log?

No file there, I installed from Yast, not from source. Log file seems to be at :
/var/log/nagios/nagios.log

And after attempting to start and shutting down it’s empty. (Having first cleared it so as to only capture start / shutdown messages).

Cheers.

Phill.

After compairing the unit file to one on a Rocky 9 system at work, I have found that adding :

Type=forking

To the systemd unit file and doing a systemctl daemon-reload fixed the problem.

Cheers.

Phill.

1 Like

Nice. Thanks for sharing the solution!

If you use openSUSE package from the default repositories, you should open bug report.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.