Installing Nagios3 on Debian Lenny/Stable
Some of you might know Nagios, some of you might not. Nagios is a network and server monitoring system. It’s open source and widely used (at least that’s my impression). I now use Nagios to monitor all of my network, and my server it self.
It’s my impression that most people install Nagios by downloading af tarball and do: `./configure && make && make install`. However, I might be wrong. Unless it the only option, I think that it is a bad way to install software. Why, you think? Because software should be installed via the package management syste, so that it can easy be updated or removed.
So I installed Nagios (and the dependencies) like this: `apt-get install nagios3`. I already had Apache2 up and running, as I host a webpage on the system. Nagios run as a service, that checks up on hosts, services, network devices and so on. The monitoring it self can be watched via a website. The default address is: http://host/nagios3/ . Be aware that the default settings allows everyone to watch the website, where some settings can be modified. All initial configuration of Nagios is done via config files. There exist some projects that will allow you to configure Nagios via a webinterface, but I wont write more on that at this time.
You should know the following paths when you configure Nagios: /etc/nagios3 and /usr/lib/nagios/plugins. The first one is where the configuration files are. The second is where the plugins lives. The plugins are the active parts of Nagios that is used to monitor services, hosts and so on. When you are working in this folder, you can manually check the same things that Nagios would do, like this (one example of many): `./check_http -H ip-address`.
Nagios work with the following terms: hosts, hostgroups and services. Services can be assigned to hosts and/or hostgroups. Hostgroups are groups of hosts (as you probably guesses already). Hostgroups is probably most useful in large environments. In my own environment I currently only have 4 hosts. None of the are monitored in the same way – so currently I dont use hostgroups my self. But if your environment are larger than mine, you might benefit from using hostgroups, if you have similar hosts. A host can be a member of any number of hostgroups. Only the imagination limits the combination possibilities.
To add a layer of security, run the following command:
cd /etc/nagios3; htpasswd -c htpasswd.users nagiosadmin
This will configure Apache to ask for username and password when opening the Nagios webinterface. Nagiosadmin is just a username, and can be changed if you like.
Configurating Nagios is a chapter of it’s own. I might write an article on the subject some time. Lastly I have a small tip: The default Nagios webinterface looks old and ugly IMHO. The good thing about that is that it can be skinned. I like the skin called Nuvola style. When I downloaded the files from the site they were corrupted – so might want to find it somewhere else. Hint: the config.js file has to be editted for this skin to work propperly.
Skinning is done by replacing the files used to generate the webinterface (remeber to backup the folders before updating the files!):
As allways – feel free to drop a line or two with comments and/or questions