Icinga (Monitoring Solution) Installation And Configuration On CentOS - Page 2

Installation of Nagios plugins for monitoring

1. Download the Nagios plugin and compile the same:

[root@sunil software]# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
[root@sunil software]# tar -zxvf nagios-plugins-1.4.15.tar.gz
[root@sunil software]# cd nagios-plugins-1.4.15
[root@sunil nagios-plugins-1.4.15]# ./configure --prefix=/opt/icinga/ --with-nagios-user=daemon --with-nagios-group=daemon
[root@sunil nagios-plugins-1.4.15]# make && make install

 

Cutomization of Icinga

Mail alert configuration:

[root@sunil /]# cd /opt/icinga/etc/
[root@suniletc]# vi objects/contacts.cfg

define contact{
contact_nameicingaadmin             ; Short name of user
use     generic-contact         ; Inherit default values from generic-contact template (defined above)
alias Icinga Admin            ; Full name of user
emaildaemon@localhost        ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }

Change the email address from daemon@localhost to your email address test@sunil.cc.

Make sure you had configured smarthost in the CentOS server.

 

To configure smart host in CentOS

[root@suniletc]# rpm -qa|grepsendmail

sendmail-8.13.8-2.el5

[root@suniletc]# vim /etc/mail/sendmail.mc

Disable the following line:

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
dnl#DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

Enable the following line:

dnl define(`SMART_HOST', `smtp.your.provider')dnl

Give your smtp address here - in this case sunil.cc:

define(`SMART_HOST', `smtp.sunil.cc')dnl 

[root@sunil /]#m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
[root@sunil /]#/etc/init.d/sendmail restart

 

Installing Nagios Plugin and nrpe in Ubuntu 192.168.1.40

1. For Ubuntu to be monitored by the Icinga server we need to install Nagios plugin and nrpe:

root@ubuntu10:~# apt-get install gcc*

root@ubuntu10:~#wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz

root@ubuntu10:~# tar -zxvf nagios-plugins-1.4.15.tar.gz

2. Compiling Nagios plugin:

root@ubuntu10:~# cd nagios-plugins-1.4.15/
root@ubuntu10:~/nagios-plugins-1.4.15# ./configure --with-nagios-user=daemon --with-nagios-group=daemon
root@ubuntu10:~/nagios-plugins-1.4.15# make && make install
root@ubuntu10:~/nagios-plugins-1.4.15# chown -R daemon:daemon /usr/local/nagios/

 

Installation of NRPE (Nagios Remote Plugin Executor)

1. Download and compile NRPE:

root@ubuntu10:~# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz

root@ubuntu10:~# tar -zxvf nrpe-2.12.tar.gz
root@ubuntu10:~# cd nrpe-2.12/
root@ubuntu10:~/nrpe-2.12# apt-get install openssllibssl-dev
root@ubuntu10:~# make all
root@ubuntu10:~# make install-plugin
root@ubuntu10:~# make install-daemon
root@ubuntu10:~# make install-daemon-config
root@ubuntu10:~/nrpe-2.12# apt-get installxinetd
root@ubuntu10:~# make install-xinetd

2. We need to configure the nrpe as a xinetd service:

root@ubuntu10:~/nrpe-2.12# vim /etc/xinetd.d/nrpe

servicenrpe
{
flags           = REUSE
socket_type     = stream
port            = 5666
wait            = no
user            = daemon
group           = daemon
server          = /usr/local/nagios/bin/nrpe
server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
log_on_failure  += USERID
disable         = no
only_from       = 127.0.0.1
}

3. Edit by adding the Icinga server IP in only_from:

servicenrpe
{
flags           = REUSE
socket_type     = stream
port            = 5666
wait            = no
user            = daemon
group           = daemon
server          = /usr/local/nagios/bin/nrpe
server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
log_on_failure  += USERID
disable         = no
only_from       = 127.0.0.1 192.168.1.20
}

4. Now we need to run it as a service by adding the following line:

root@ubuntu10:~# vim /etc/services

nrpe 5666/tcp

5. Restart the xinetd service:

root@ubuntu10:~# /etc/init.d/xinetd restart

6. Check whether nrpe has started:

root@ubuntu10:~# netstat -a |grep nrpe

To check whether Ubuntu is able to communicate with the Icinga server:

root@ubuntu10:~# /usr/local/nagios/libexec/check_nrpe -H localhost

NRPE v2.12

You should be able to get this output.

Share this page:

6 Comment(s)

Add comment

Comments

From: Berry Sizemore at: 2012-11-15 23:46:55

I successfully got Icinga up and running, and I am very pleased to say that this tutorial is pretty much how I did it.   When it came to nrpe, it required a slightly different configure command formation.  I also skipped the sendmail section in favor of Postfix, because it was already configured.  I also used more recent versions of the software used without penalty.  Sometimes things can get crazy if you stray to newer versions, but not in this case at this time.

Thanks for the great work!

From: konsultor at: 2012-12-10 20:00:55

...but the image of the browser is too small to make out the URL that is supposed to reach icinga. A line of text would be enlightening and helpful.

From: Anonymous at: 2013-01-04 07:15:03

Hi, I got stuck at step 5. I guess it is because I am using the latest packages. Xampp 1.8.1 & Icinga 1.8.3. There muct be something I am missing that I can perform anything beyond step 5. Please help.

From: David Downing at: 2014-11-07 20:34:34

Try this article: https://www.rosehosting.com/blog/how-to-install-icinga-network-monitoring-system-on-a-centos-7-vps/, i followed it and installed Icinga successfully.

From: Terver at: 2013-06-13 14:24:37

Hello, Nice and detailed piece of note. I need help ASAP.

 I successfully installed and configured icinga to "step11. Login to check whether Icinga website opens:" and i was unable to open ther website, it gives me the error below. Kindly assist as all other procedures i followed worked fine. Thank you 

 

Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.

Error 500

172.17.15.30
Thu 13 Jun 2013 03:01:58 PM WAT
Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1

 

From: marco at: 2011-01-24 08:28:45

My best compliment for this article, very useful.

I have some questions:

1) Why do you prefer to use daemon user instead nagios?

2) Why do you preferer to use nsclient instead of nrpe_nt on Windows?

3)  What GUI do you suggest?

4) Could you add some info about how to use mysql (to store events) and how to generate graphs?

 Regards