O'Reilly logo

Network Monitoring with Nagios by Taylor Dondich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring the Web Interface

When we compiled and installed Nagios, all the files required to interact with Nagios with a web browser were installed under /usr/local/nagios. However, before we can access Nagios through our web browser, we must configure it to provide access to these resources. The web server we’re using for our installation is Apache. A sample configuration snippet is created in the sample-config/ subdirectory in the directory you extracted Nagios originally. You could copy the contents of the httpd.conf file in this directory into your Apache’s main configuration file or follow the steps below to do it manually.

If you used the default settings when running Nagios’s configure script, the following snippet will work. This snippet of code must be put in your Apache’s configuration file.

ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin

<Directory "/usr/local/nagios/sbin">
    Options ExecCGI
    AllowOverride None
    Order allow,deny
    Allow from all
    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /usr/local/nagios/etc/htpasswd.users
    Require valid-user
</Directory>

Alias /nagios /usr/local/nagios/share

<Directory "/usr/local/nagios/share">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /usr/local/nagios/etc/htpasswd.users
    Require valid-user
</Directory>

This configuration snippet does a few things to Apache. First, it creates a ScriptAlias that will take any script references from the URL /nagios/cgi-bin ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required