Sebastian Mogilowskis Blog

Just another blog about administration, linux and other stuff

Language: German English

Nagios 3 with Nginx on Ubuntu Server

1. Installation von Nagios 3

aptitude install nagios3

2. Testen der Nagios Installation

Öffne “http://SERVER/nagios3″ in einem Browser. Anmeldung mit “nagiosadmin” und dem Passwort, dass während der Installation festgelegt wurde.

3. Wechseln von Apache zu Nginx

Mit der Nagios Installation wurde Apache automatisch mit installiert. Nun wird er durch Nginx ersetzt.

3.1 Installation von Nginx und libfcgi (Perl)
aptitude install nginx libfcgi-perl
3.2 Fastcgi konfigurieren

Herrunterladen des fastcgi-wrapper und init Skripts: perl-fastcgi (1.64 kB)

wget http://www.mogilowski.net/wp-content/uploads/perl-fastcgi.tar.gz
tar vfx perl-fastcgi.tar.gz
mv fcgi/fastcgi-wrapper /usr/bin/fastcgi-wrapper.pl
mv fcgi/perl-fastcgi /etc/init.d/perl-fastcgi
rmdir fcgi
chmod +x /usr/bin/fastcgi-wrapper.pl
chmod +x /etc/init.d/perl-fastcgi
update-rc.d perl-fastcgi defaults
/etc/init.d/perl-fastcgi start
3.3 Nginx konfigurieren
vim /etc/nginx/sites-available/nagios
server {
	listen   80;
	server_name  servername.com;

	access_log  /var/log/nginx/access.log;

	auth_basic            "Restricted Nagios Area!";
  	auth_basic_user_file  /etc/nagios3/htpasswd.users;	

	location / {
		root /usr/share/nagios3/htdocs;
		index index.html;

		rewrite ^/nagios3/(.*)$ /$1 break;
	}

	location /nagios3/stylesheets {
                alias /etc/nagios3/stylesheets;
        }

	location ~ \.cgi$ {
		root /usr/lib/cgi-bin/nagios3;
		include /etc/nginx/fastcgi_params;

		rewrite ^/cgi-bin/nagios3/(.*)$ /$1;

		fastcgi_pass 127.0.0.1:8999;
		fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/nagios3$fastcgi_script_name;
		fastcgi_param AUTH_USER       $remote_user;
		fastcgi_param REMOTE_USER     $remote_user;
	}

}
ln -s /etc/nginx/sites-available/nagios /etc/nginx/sites-enabled/nagios
/etc/init.d/nginx restart
3.4 Apache entfernen

Nun kann man alle Apache Pakete entfernen mit Ausnahme von “apache2-utils” welches von Nagios benötigt wird.

4. Testen mit Nginx

Öffne “http://SERVER/nagios3″ in einem Browser. Anmeldung mit “nagiosadmin” und dem Passwort, dass während der Installation festgelegt wurde.

5. Links

* http://inode.co.nz/running-nagios3-under-nginx-fastcgi

* http://library.linode.com/web-servers/nginx/perl-fastcgi/ubuntu-10.04-lucid

* http://wiki.linuxwall.info/doku.php/fr:ressources:dossiers:supervision:nagios3

* http://wiki.nginx.org/Main

* http://www.nagios.org

, ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

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=""> <strike> <strong>

eMail-Benachrichtigung bei weiteren Kommentaren.
Auch möglich: Abo ohne Kommentar.