Nagios is the most popular, open source, powerful monitoring system for any kind of infrastructure. It enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes. Nagios has capability of monitoring application, services, entire IT infrastructure.

This article will help you to Nagios Monitoring on 14.10, 14.04 LTS and 12.04 LTS and Debian systems. After completed this article, you will like to follow below article.

Required Packages and Dependencies

We assume that you have fresh installed Ubuntu/Debian systems, So our first requirement is to install and PHP first. Use the following commands to complete it.

Install Required Packages:

$ sudo apt-get install wget apache2 apache2-utils php5 libapache2-mod-php5 build-essential libgd2-xpm-dev

Start Services:

$ service apache2 start

Setup User Account for Nagios

Now create a new nagios user account and setup a to this account

$ sudo useradd nagios
$ sudo passwd nagios

Now create a groud for nagios setup “nagcmd” and add nagios user to this group. Also add nagios user in apache group.

$ sudo groupadd nagcmd
$ sudo usermod -a -G nagcmd nagios
$ sudo usermod -a -G nagcmd www-data

Installing Nagios Core Service

After installing required dependencies and adding user accounts. Lets start with Nagios core installation. latest nagios core service from official site.

$ cd /opt/
$ wget
$ tar xzf nagios-4.0.8.tar.gz
$ cd nagios-4.0.8
$ sudo ./configure --with--group=nagcmd
$ sudo make all
$ sudo make install
$ sudo make install-init
$ sudo make install-config
$ sudo make install-commandmode

Now create nagios apache2 configuration file.

$ sudo  /etc/apache2/sites-enabled/nagios.conf
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"

<Directory "/usr/local/nagios/sbin">
   Options ExecCGI
   AllowOverride None
   Order allow,deny
   Allow from all
   AuthName "Restricted Area"
   AuthType Basic
   AuthUserFile /usr/local/nagios/etc/htpasswd.users
   Require valid-user

Alias /nagios "/usr/local/nagios/"

<Directory "/usr/local/nagios/">
   Options None
   AllowOverride None
   Order allow,deny
   Allow from all
   AuthName "Restricted Area"
   AuthType Basic
   AuthUserFile /usr/local/nagios/etc/htpasswd.users
   Require valid-user

Configuring Apache Authentication

We need to setup apache authentication for user nagiosadmin. Untill more specific reason use this user name as “nagiosadmin” else you would required more changes in configuration.

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

Now restart Apache service to make the new settings take effect.

$ service apache2 restart

Installing Nagios Plugins

After installing and configuring Nagios core service, Download latest nagios-plugins source and install using following commands.

$ cd /opt
$ wget
$ tar xzf nagios-plugins-2.0.3.tar.gz
$ cd nagios-plugins-2.0.3

Now compile and install nagios plugins

$ sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
$ sudo make
$ sudo make install

Verify Configuration and Start Nagios

Use the following commands to verify Nagios install and start Nagios core service.

$ /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
$ service nagios start

Also configure Nagios to auto start on system boot.

$ ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

Access Nagios Web Interface

Access your nagios setup by access nagios server using hostname or address followed by /nagios.
[change domain name with your domain or ip]

Prompting for Apache Authentication Password –

Nagios After login screen –

Now you have successfully installed and configured Nagios Monitoring Server core service in your system.

Print Friendly



Bài viết liên quan