Jan 152008
 

If you have jumped into this post directly then it is worth having a look at first three parts of this installation procedure from the following links

1. Install and configure the pre-requisites

2. Install Nagios Binaries & CGI

3. Install Nagios Plugins

The final part of this four part installation procedure for Nagios installation covers the setup of webinterface for nagios, setup CGI authentication and user authentication using htpasswd for nagios website.

Create a new website on Apache

debian4r2# vi /etc/apache2/sites-available/Nagios

Add the following

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>

Enable the site on Apache

debian4r2:/etc/apache2/sites-available# a2ensite Nagios

Reload the config file for Apache to make the nagios site active

debian4r2:/etc/apache2/sites-available# /etc/init.d/apache2 reload
Reloading web server config…3638

Create and add the first Nagios user for the web interface

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

NOTE: The "-c" in the above command creates the htpasswd.users file and add nagiosadmin as a user.
Any new user should be added with the above command without the "-c"

Add more users

htpasswd /usr/local/nagios/etc/htpasswd.users nagios

Set the CGI Authentication in the Nagios CGI.cfg file

debian4r2# vi /usr/local/nagios/etc/cgi.cfg

Set the following value

use_authentication=1

Thats done and we are ready to go.

Access your Nagios website

http://<hostname>/nagios/

Enter the username and password and off you go. From here on, you need to add contacts, contact groups, hosts,hostgroups,services…to get going with monitoring your network, hosts, services.

  6 Responses to “Configure Nagios web interface CGI and User Authentication”

  1. Thanks a lot. I’ve done all and successfully installed Nagios on my systems. Thanks again :”>

  2. Thanks a lot for

  3. Hey thanks for the useful howto, the information you provide us really makes the installation simple.

    Keep it up like this.

  4. That’s great mate!!! Thanks a lot!! Succesfully installed Nagios 3.2.1 with plugins 1.4.14 on Debian 5

  5. WONDERFUL !!! THANK YOU SO MUCH. IT WORKS !

  6. Is there any way we can authenticate to nagios in backend ??

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)