Some days ago I wrote a similar post about nagios and lighty, now I decided to test Icinga on Debian Squeeze.
The installation was pretty easy:
1 2 | aptitude install lighttpd aptitude install icinga |
To use Icinga we need following modules:
- mod_cgi
- mod_auth
- mod_setenv
Just run lighttpd-enable-mod to enable available modules (you will see all available):
1 | lighttpd-enable-mod |
Enable modules:
1 2 3 | lighttpd-enable-mod cgi lighttpd-enable-mod auth lighttpd-enable-mod status |
Now we create our own Icinga module for lighttpd:
1 | vim /etc/lighttpd/conf-available/10-icinga.conf |
This is the content of it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Icinga mod alias.url = ( "/cgi-bin/icinga" => "/usr/lib/cgi-bin/icinga", "/icinga/cgi-bin" => "/usr/lib/cgi-bin/icinga", "/icinga/stylesheets" => "/etc/icinga/stylesheets", "/icinga" => "/usr/share/icinga/htdocs" ) $HTTP["url"] =~ "^/icinga/cgi-bin" { cgi.assign = ( "" => "" ) } $HTTP["url"] =~ "icinga" { auth.backend = "htpasswd" auth.backend.htpasswd.userfile = "/etc/icinga/htpasswd.users" auth.require = ( "" => ( "method" => "basic", "realm" => "icinga", "require" => "user=icingaadmin" ) ) setenv.add-environment = ( "REMOTE_USER" => "user" ) } |
Enable created module:
1 | lighttpd-enable-mod icinga |
If you have more than one user, use pipe symbols to create more restrictions:
1 | "require" => "user=icingaadmin|user=icingauser" |
Create “htpasswd.users”:
1 2 3 4 | root@server:~# htpasswd -n icingaadmin New password: root Re-type new password: root icingaadmin:8.vg9QPHv4qD6 |
Copy your output to the htpasswd.users:
1 | echo "icingaadmin:8.vg9QPHv4qD6" > /etc/icinga/htpasswd.users |
After restart, you should reach your Icinga service: “http://server/icinga/”
1 | /etc/init.d/lighttpd restart |
Thomas Krichel says
as soon as a add the auth.require part of the configuration, the server dies on after hittng the /insigna URL.
trabbi:/var/log# lighttpd -v
lighttpd/1.4.31 (ssl) – a light and fast webserver
Build-Date: Mar 15 2013 21:07:13
Andy says
Your blog post was very helpful. The configuration below was used for CentOS 6 (x86_64) running Icinga 1.5.1.
alias.url += (
“/cgi-bin/icinga” => “/usr/lib64/icinga/cgi”,
“/icinga/cgi-bin” => “/usr/lib64/icinga/cgi”,
“/icinga/stylesheets” => “/usr/share/icinga/stylesheets”,
“/icinga” => “/usr/share/icinga”
)
Also, note the alias.url += is used since our lighttpd configuration has additional alias settings.
Alan Buxton says
Thanks for this – worked a treat for me just that if you are building from source in 1.5.1 I had to have slightly different aliases:
alias.url = (
#”/cgi-bin/icinga” => “/usr/lib/cgi-bin/icinga”,
“/icinga/cgi-bin” => “/usr/local/icinga/sbin”,
# “/icinga/stylesheets” => “/etc/icinga/stylesheets”,
“/icinga” => “/usr/local/icinga/share”
)