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 [email protected].

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:

0 Comment(s)