Running Nagios

When we compiled and installed Nagios by hand, we used the install-init make target to install initialization scripts into our /etc/init.d directory. As root, we can run the /etc/init.d/nagios script to start and stop Nagios. Let’s start Nagios now using this script.

localhost: /etc/init.d # ./nagios start
Starting network monitor: nagios

If you want Nagios to start automatically when your server starts, then you’ll need to create the appropriate symbolic links. For example:

localhost:~ # ln –s /etc/init.d/nagios /etc/init.d/rc3.d/S99nagios
localhost:~ # ln –s /etc/init.d/nagios /etc/init.d/rc3.d/K99nagios

The above command will have Nagios start automatically when the system enters run level 3 (which is multiuser mode).

Once Nagios is up and running, you can verify its operation by using the web interface. However, before using the web interface, some configuration changes need to be made to Apache, and Nagios’s CGI behavior needs to be defined in its CGI configuration file.

Get Network Monitoring with Nagios now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.