Nagios – system and network monitoring
“NagiosĀ® is an Open Source host, service and network monitoring program.” (from nagios.org)
Nagios has a lot of features, making it a very powerful monitoring tool. Some of the major features are listed below:
- Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)
- Monitoring of host resources (processor load, disk and memory usage, running processes, log files, etc.)
- Simple plugin design that allows users to easily develop their own host and service checks
- Ability to define network host hierarchy, allowing detection of and distinction between hosts that are down and those that are unreachable
- External command interface that allows on-the-fly modifications to be made to the monitoring and notification behavior through the use of event handlers, the web interface, and third-party applications
- Web interface for viewing current network status, notification and problem history, log file, etc.
Installing Nagios
In FreeBSD you can install from ports. (/usr/ports/net-mgmt/nagios*). Some Linux distributions also include Nagios.
If you monitoring server doesn’t include Nagios, or you want the latest release, you can download it from Nagios website. From there you must download the monitoring application (including the web interface) and the plugins, used for doing various checks.
First you will install the main Nagios application. Unpack the tar.gz file you downloaded.
tar xvzf nagios-3.x.x.tar.gz
By default, nagios is installed in /usr/local/nagios. If you want it in other place, you have to create de folder where you want it installed. You also have to create a user (and a group) that nagios will run as.
After that, run configure. For a list of all configuration options run configure –help.
Once configure completes, it will display a summary of all parameters that were used during the configuration. Make sure everything is OK, and run configure again with the correct options, if necessary. You may also see a warning about not being able to find the GD library. This is necessary for a few CGIs that create dynamic images from the service statistics.
Now it’s time to compile the application:
make all
This might take a while. When you get the “Compile finished” message, the software is ready to be installed.
make install
make install-init
make install-commandmode
make install-config
make install-init – This installs the init script in /etc/rc.d
make install-commandmode – This installs and configures permissions on the directory for holding the external command file
make install-config – This installs sample config files in /usr/local/nagios/etc
After this, in /usr/local/nagios you will see six folders: bin, etc, libexec, sbin, share and var
In bin there are only 2 files, nagios, the core of the system and nagiostats, an utility program showing various informations about the nagios process.
In etc are the configuration files.
libexec will contain the plugins necessary for monitoring.
In sbin are hold the CGI scripts necessary for the web interface, while in share are the HTML files and the documentation.
The var directory is where Nagios will store its information, once it starts running.
Now nagios is installed, but you have to install the plugins for being able to monitor anything.
Unpack the nagios-plugins file you downloaded and run the configuration script. If you changed the PREFIX for the application, you also will have to change it for the plugins. After the configuration is done, all you have to do is to compile and install the plugins.
make
sudo make install
You are almost done. The next thing is to configure http server for nagios. For my Apache 2 I created in /etc/apache/conf.d a file named nagios.conf.
ScriptAlias /nagios/cgi-bin/ /usr/local/nagios/sbin/
<Directory /usr/local/nagios/sbin/>
Options ExecCGI
order allow,deny
allow from all
AuthType Basic
AuthUserFile /srv/www/htdocs/nagios/.htpasswd
AuthName “pctips”
require valid-user
</Directory>Alias /nagios/ /usr/local/nagios/share/
<Directory /usr/local/nagios/share>
Options None
order allow,deny
allow from all
AuthType Basic
AuthUserFile /usr/local/nagios/share/.htpasswd
AuthName “pctips”
require valid-user
</Directory>
Now the basic configuration is done. You have to restart the http server and to start the nagios process.
With the configuration files installedby nagios you will be monitoring only the computer where nagios is installed.
In the next days I will post my configuration files for the network I monitor with nagios.
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.





Leave a Reply