Nagios Installation and Configuration: Part Two

NagiosIn the previous article, we introduced Nagios and began covering installation. In this article, we will continue our look at Nagios, covering configuration and installation of plugins.

Nagios Configuration

Now that Nagios has been installed, it’s time to configure it. Sample configuration files have been installed in the /usr/local/nagios/etc directory. For the most part, the settings in the sample files should work fine for getting started with Nagios. You should, however change the e-mail address associated with the nagiosadmin contact definition to the address you’d like to use for receiving alerts. To do so, you change the email field in /usr/local/nagios/etc/objects/contacts.cfg with your favorite editor.

Next, install the Nagios web config file in the Apache conf.d directory:

make install-webconf

Create a nagionsadmin account for logging into the Nagios web interface. Remember the password you assign to this account.

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Now restart Apache to make the new settings take effect.

/etc/init.d/apache2 reload


Next, extract the Nagios plugins source code tarball:

tar xzf nagios-plugins-2.0.3.tar.gz

cd nagios-plugins-2.0.3

Compile and install the plugins:

./configure –with-nagios-user=nagios –with-nagios-group=nagios

make

make install

Now configure nagios to automatically start when the system boots:

ln -s /etc/init.d/nagios /etc/rc5.d/599nagios

Verify the sample Nagios configuration files:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If there are no errors, start Nagios:

/etc/init.d/nagios start

You should now be able to access the Nagios web interface at the URL below. You’ll be promoted for the username (nagiosadmin) and password you specified earlier:

http://localhost/nagios/

Click on the “Service Detail” navbar link to see details of what’s being monitored on your local machine. It will take a few minutes for Nagios to check all the services associated with your machine, as the checks are spread out over time.

If you want to receive e-mail notifications for Nagios alerts, you need to install the mailx (Postfix) package:

sudo apt-get install mailx

sudo apt-get install postfix

You’ll have to edit the Nagios e-mail notification commands found in /usr/local/nagios/etc/objects/commands.cfg and change and /bin/mail references to /usr/bin/mail. Once you do that, you’ll need to restart Nagios to make the configuration changes live:

sudo /etc/init.d/nagios restart

In the next article, we’ll access Nagios via the web interface and configure it to work with pfSense.


External Links:

The official Nagios site

Nagios on Wikipedia

Be Sociable, Share!

Speak Your Mind

*

© 2013 David Zientara. All rights reserved. Privacy Policy