This page describes how to install and configure Nagios 3 on Ubuntu 9.04.

This guide was done using Ubuntu 9.04. Appears to work ok with 9.10 and 10.04 LTS.

Introduction

Nagios is an open source host, service and network monitoring program. The official homepage is http://nagios.org/

Preparations

You will first manually install Nagios 3 from the Ubuntu main repositories.

sudo apt-get install -y nagios3

This will install and configure Nagios 3 along with all the required dependencies including Apache2, Postfix and others.

Postfix is used to send e-mail alerts. During the installation you will be prompted to select how you want to configure Postfix. For most setups you will select 'Internet Site' which is the default select. If you require other setup, please refer to the Postfix support page.

Once Nagios has been installed you will need to create user accounts so you can login to the Nagios monitoring site.

The site will be installed locally at http://localhost/nagios3

Create a 'nagiosadmin' user account so that you can login and administer the site. If you are running 10.04 LTS, you will be prompted for a password during install and can skip this section.

sudo htpasswd -c /etc/nagios3/htpasswd.users nagiosadmin

Enter a strong password when prompted.

You now have a very basic working installation of Nagios on your system (login at http://localhost/nagios3 with those credentials). It has been configured to monitor your local machine.

Post Install Tasks

Nagios 3's configuration files are located in /etc/nagios3

If you need to add new hosts or make changes to existing ones you can find them at: /etc/nagios3/conf.d

All the plugin's are located at: /etc/nagios-plugins/config

You might see a couple of errors which can be easily fixed.

The first might be an SSH critical error if you don't have an OpenSSH server running on your local machine. You can either install OpenSSH server or remove this error warning by editing the file in /etc/nagios3/conf.d/hostgroups_nagios2.cfg and removing the localhost from the member.

The second might be a hard disk check critical error related to the way Gnome is designed and how permissions are assigned to the .gvfs file in each users home directory, ex:

DISK CRITICAL - /home/rdp/.gvfs is not accessible: Permission denied

This is bug #615848. You can either give the nagios user permission to that file or just ignore the file during check. To ignore the file, edit the disk.cfg file located in /etc/nagios-plugins/config and add the arguments [-A -i '.gvfs'] at the end of the command line arguments for the command check_disk and check_all_disks.

Configuration Notes

When the package is installed, there are a few items to note about the configuration files. As noted above, the primary configuration is stored in /etc/nagios3. The main configuration file includes the files in /etc/nagios-plugins/. These files are important because this is where many of the nagios commands used to execute the plugins are defined. For example, the check_nrpe_1arg command is defined in nrpe.cfg. Not understanding these and just following examples of configuration for other distributions and installations can cost many hours!

Monitoring Windows Machines

I want to add that if you are installing on Ubuntu 10.04 LTS and using check_nt to check Windows server there a few changes you need to make to nt.cfg.

sudo nano /etc/nagios-plugins/config/nt.cfg

Remove the " ' " in the define commands so it looks like this:

define command {
        command_name    check_nt
        command_line    /usr/lib/nagios/plugins/check_nt -H $HOSTADDRESS$ -v $ARG1$
}

# 'check_nscp' command definition
define command {
        command_name    check_nscp
        command_line    /usr/lib/nagios/plugins/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$
}

You may need to add a $ARG2$, $ARG3$ ,etc.. depending on what you are checking. I also would recommend that you use check_nscp or add the port '-p 12489' to the check_nt command or you may receive 'Unable to connect' errors.

This info. was obtained from #nagios on freenod and hours of trying to get it to work.

Also be sure to check out: http://nagios.sourceforge.net/docs/3_0/monitoring-windows.html


CategoryInternet CategoryNetworking

Nagios3 (last edited 2012-05-03 03:14:56 by ndoc2)