Nagios Service

Overview

Nagios is installed as a service.

The service file is located under:

/lib/systemd/system/nagios.service

It has the contents below:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
   [Unit]
   Description=Nagios Core 4.4.5
   Documentation=https://www.nagios.org/documentation
   After=network.target local-fs.target

   [Service]
   Type=forking
   ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
   ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
   ExecStop=/bin/kill -s TERM ${MAINPID}
   ExecStopPost=/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd
   ExecReload=/bin/kill -s HUP ${MAINPID}

   [Install]
   WantedBy=multi-user.target

Start and Stop

The Nagios service can be started and stopped via the module or via command line.

To start and stop via the module, go to Servers > Nagios and click the Start or Stop button:

../../_images/nagios-service.png

To start and stop via command line, as root, issue:

service nagios stop | start