Web Interface

Apache VirtualHost Configuration

mkdir -p /var/websites/nagios/htdocs
mkdir -p /var/websites/nagios/logs

Add the following to /usr/local/apache2/conf/extra/http-vhost.conf:

# nagios Virtual Host Webinterface
<VirtualHost *:80>
  ServerAdmin admin@yourdomain.com
  DocumentRoot /var/websites/nagios/htdocs

  ServerName nagios.yourdomain.com

  ErrorLog /var/websites/nagios/logs/nagios-error.log
  CustomLog /var/websites/nagios/logs/nagios-access.log combined

  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>
</VirtualHost>

Lighttpd Configuration
If you are using Lighttpd instead of Apache, you'll need to make some modifications to your lighttpd.conf file.
Firstly, you'll need to ensure you have the required modules loaded. At a minimum, you will need:

server.modules = (
"mod_cgi",
"mod_auth",
"mod_alias",
)
<code>
alias.url =     (
                "/nagios/cgi-bin" => "/usr/local/nagios/sbin",
                "/nagios" => "/usr/local/nagios/share"
                )

$HTTP["url"] =~ "^/nagios/cgi-bin" {
        cgi.assign = ( "" => "" )
}

Add the Authentication configuration:

$HTTP["url"] =~ "^/nagios/cgi-bin" {
        auth.backend = "htpasswd"
        auth.backend.htpasswd.userfile = "/usr/local/nagios/etc/htpasswd.users"
        auth.require = ( "" => (
                "method" => "basic",
                "realm" => "Nagios Access",
                "require" => "user=nagiosadmin"
                )
        )
}

$HTTP["url"] =~ "^/nagios" {
        auth.backend = "htpasswd"
        auth.backend.htpasswd.userfile = "/usr/local/nagios/etc/htpasswd.users"
        auth.require = ( "" => (
                "method" => "basic",
                "realm" => "Nagios Access",
                "require" => "user=nagiosadmin"
                )
        )
}

The Lighttpd wiki also has a Nagios installation tutorial.
Password Security

Create the password file and an admin user:

/usr/local/apache2/bin/htpasswd \
  -c /usr/local/nagios/etc/htpasswd.users <username>

If you don't have the htpasswd program, you can always use one of the web-based programs to create entries for the /usr/local/nagios/etc/htpasswd.users file.

Want to be able to execute commands from the web interface? You'll need to edit /usr/local/nagios/etc/nagios.cfg to enable external commands:

check_external_commands=1

Recent Updates

  • 10 months 1 day ago
    1.27.2 update
  • 10 months 1 week ago
    Drupal 10/11 config
  • 10 months 2 weeks ago
  • PHP
    10 months 2 weeks ago
    PHP 8.3.11 and AlmaLinux
  • 10 months 2 weeks ago
    New version of Pound
Error | Production Monkeys

Error

The website encountered an unexpected error. Please try again later.