# This file is managed by Puppet. Local changes will be clobbered.

server {
  server_name nagios nagios.*;

  listen                    443 ssl;
  ssl_certificate           /etc/nginx/ssl/nagios.crt;
  ssl_certificate_key       /etc/nginx/ssl/nagios.key;
  include                   /etc/nginx/ssl.conf;

  index index.html;
  root /usr/share/icinga/htdocs;

  access_log /var/log/nginx/nagios-access.log timed_combined;
  access_log /var/log/nginx/nagios-json.event.access.log json_event;
  error_log /var/log/nginx/nagios-error.log;
<%- if @protect_monitoring -%>
  auth_basic "Nagios Restricted Access";
  auth_basic_user_file /etc/govuk.htpasswd;
<%- end -%>
  location /stylesheets {
    alias /etc/icinga/stylesheets;
  }

  location ~ \.cgi$ {
    root /usr/lib/cgi-bin/icinga;
    rewrite ^/cgi-bin/icinga/(.*)$ /$1;

    include /etc/nginx/fastcgi_params;

    fastcgi_param AUTH_USER $remote_user;
    fastcgi_param REMOTE_USER $remote_user;
    fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/icinga$fastcgi_script_name;

    fastcgi_pass fcgiwrap;
  }

}

# This file is managed by Puppet. Local changes will be clobbered.

server {
  server_name nagios nagios.* icinga icinga.* alert alert.*;

  listen                    443 ssl;
  ssl_certificate           /etc/nginx/ssl/nagios.crt;
  ssl_certificate_key       /etc/nginx/ssl/nagios.key;
  include                   /etc/nginx/ssl.conf;

  index index.html;
  root /usr/share/icinga/htdocs;

  access_log /var/log/nginx/nagios-access.log timed_combined;
  access_log /var/log/nginx/nagios-json.event.access.log json_event;
  error_log /var/log/nginx/nagios-error.log;
<%- if @protect_monitoring -%>
  auth_basic "Nagios Restricted Access";
  auth_basic_user_file /etc/govuk.htpasswd;
<%- end -%>
  location /stylesheets {
    alias /etc/icinga/stylesheets;
  }

  location ~ \.cgi$ {
    root /usr/lib/cgi-bin/icinga;
    rewrite ^/cgi-bin/icinga/(.*)$ /$1;

    include /etc/nginx/fastcgi_params;

    fastcgi_param AUTH_USER $remote_user;
    fastcgi_param REMOTE_USER $remote_user;
    fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/icinga$fastcgi_script_name;

    fastcgi_pass fcgiwrap;
  }

}

Add "icinga" and "alert" hostnames for monitoring
Add "icinga" and "alert" hostnames for monitoring

We don't use Nagios anymore, so using it as the hostname when we
view alerts isn't correct. Add "icinga", which we do use, and
"alert" because it's generic.
