Sponsored Link

Nagios® Core™ is an Open Source system and network monitoring application. It watches hosts and services that you specify, alerting you when things go bad and when they get better.Nagios Core was originally designed to run under Linux, although it should work under most other unices as well.Some of the many features of Nagios Core include:

Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)

Monitoring of host resources (processor load, disk usage, etc.)

Simple plugin design that allows users to easily develop their own service checks

Parallelized service checks

Ability to define network host hierarchy using "parent" hosts, allowing detection of and distinction between hosts that are down and those that are unreachable

Contact notifications when service or host problems occur and get resolved (via email, pager, or user-defined method)

Ability to define event handlers to be run during service or host events for proactive problem resolution

Automatic log file rotation

Support for implementing redundant monitoring hosts

Optional web interface for viewing current network status, notification and problem history, log file, etc.

Preparing your system

We have already discussed how to install ubuntu 13.10 LAMP server and now you need to install the following extra packages

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

Now you need to download nagios core and plugins from here

Adding the Nagios User and Group

Next add the appropriate user and group for the Nagios process to run

sudo useradd nagios sudo groupadd nagcmd sudo usermod -a -G nagcmd nagios

Now you need to install nagios core installation

You need to login as root and run the following commands

Extract the downloaded files (Nagios core and Plugins)

tar zxvf nagios-4.0.1.tar.gz tar zxvf nagios-plugins-1.5.tar.gz

Change to the new Nagios directory and install the packages

cd nagios-4.0.1/ ./configure --with-nagios-group=nagios --with-command-group=nagcmd -–with-mail=/usr/bin/sendmail make all make install make install-init make install-config make install-commandmode

When you run the following command

make install-webconf

You might see the following error

/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf

/usr/bin/install: cannot create regular file â/etc/httpd/conf.d/nagios.confâ: No such file or directory

make: *** [install-webconf] Error 1

As per the error message it's clear that nagios is trying to create the nagios.conf file inside the /etc/httpd.conf file to fix the problem try the following

mkdir /etc/httpd mkdir /etc/httpd/conf.d mkdir /etc/httpd/conf.d/nagios.conf

and Finally run the following command

sudo make install-webconf

You should see similar to the following output

/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf

*** Nagios/Apache conf file installed ***

Now following the next steps for nagions installation

cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/ chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg /etc/init.d/nagios start

When i try to start nagios i got the following error

[email protected]:/# /etc/init.d/nagios start

/etc/init.d/nagios: 20: .: Can't open /etc/rc.d/init.d/functions

To fix the above error try the following commands to fix the problem try the following solution

Solution

wget https://raw.github.com/nicolargo/nagiosautoinstall/master/hack4nagiosstart.sh chmod a+x ./hack4nagiosstart.sh ./hack4nagiosstart.sh

Now your nagios should start without any problem

Create a Default User for Web Access.

Add a default user for Web Interface Access:

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

Nagios Plugin installation

cd nagios-plugins-1.5 ./configure --with-nagios-user=nagios --with-nagios-group=nagios make make install

Nagios Service Setup

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

Login Nagios Web Interface

After correctly following the procedures you should now be able to access your Nagios Core installation from a web browser.

Simply use the following:

http:// /nagios

And log in with the credentials you chose when adding the nagiosadmin user to the htpasswd.users file



Sponsored Link













Related posts