Nagios on Debian 6

Instalasi Nagios 3.5.0 On Debian 6

Install dahulu repository debiannya
#pico /etc/apt/source.list

deb http://repo.ugm.ac.id/debian squeeze main non-free contrib

Lalu ketikkan perintah dibawah ini agar repository nya terupgrade

#apt-get update -y
#apt-get upgrade -y

Install paket yang dibutuhkan

#aptitude install apache2 build-essential libgd2-xpm-dev libperl-dev openssl gcc make autoconf automake mailutils libssl-dev libmysqld-dev libmysqlclient-dev libldap2-dev libradiusclient-ng-dev libapache2-mod-php5 libsnmp-perl nfs-common nfs-kernel-server libnet-dns-perl libnet-snmp-perl libdbi-perl libapache2-request-perl libdbd-mysql-perl libcrypt-ssleay-perl mysql-client libnet-tftp-perl snmp php5 -y

#groupadd -g 9000 nagios && groupadd -g 9001 nagcmd && useradd -u 9000 -g nagios -G nagcmd -d /usr/local/nagios -c “Nagios User” nagios

Download nagios nya dan plugin nagios nya
#wget -c http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios-3.5.0/nagios-3.5.0.tar.gz
#wget http://fossies.org/linux/misc/nagios-plugins-1.4.16.tar.bz2

Kemudian extrack downloadan nya

#tar xfvz nagios-3.5.0.tar.gz
#tar -xjvf nagios-plugins-1.4.16.tar.bz2

Setelah di extrack download an nagios dan pluginnya kemudian hapus file downloadannya

#rm -rf nagios-3.5.0.tar.gz
#rm -rf nagios-plugins-1.4.16.tar.bz2

Masuk ke direktori nagios yang telah di extract tadi
#cd nagios

./configure –enable-nanosleep –enable-embedded-perl –with-command-group=nagcmd –with-gd-lib=/usr/lib –with-gd-inc=/usr/include

#make all
#make install
#make install-init
#make install-config
#make install-commandmode
#make install-webconf

Setelah selsesai , lalu keluar dari folder nagios tersebut
#cd ..

Lalu masuk ke Direktori nagios pluginnya
#cd nagios-plugins-1.4.16

./configure –with-nagios-user=nagios –with-nagios-group=nagios
make
make install
#cd ..


Tambahkan nagiosadmin untuk user apache nya

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

#/etc/init.d/apache2 restart
#service nagios start
#service nagios restart

Add www-data user to nagcmd group

#usermod -a -G nagcmd www-data

Download nrpe untuk nagios nya.
#wget -c http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.14/nrpe-2.14.tar.gz
#tar xfvz nrpe-2.14.tar.gz
#rm -rf nrpe-2.14.tar.gz
#cd nrpe-2.14

./configure –enable-command-args
make all
make install
cp init-script.debian /etc/init.d/nrpe-server
chmod 755 /etc/init.d/nrpe-server

Copy nrpe.cfgnya ke direktori nagios etc
#cp -a sample-config/nrpe.cfg /usr/local/nagios/etc/

Start services
#/etc/init.d/nagios start
#/etc/init.d/nrpe-server start

Tambahan untuk images di object nagios nanti. Seperti router,switch,etc
#aptitude install nagios-images
#cp -r /usr/share/nagios/htdocs/images/logos/ /usr/local/nagios/share/images/

#cd /usr/local/nagios/etc
ls

Konfigurasi file objects agar nanti pas kita ketikkan halaman nagios kita di web address tidak muncul hanya object localhost nya
#cd /usr/local/nagios/etc/objects
#pico templates.cfg

TAMBAHIN OBJECT CYBER AGAR MUNCUL DI WEB INTERFACE

define host{
name generic-cyber ; The name of this host template
use CORE-EZ ; Inherit default values from the gen
check_period 24×7 ; By default, switches are monit
check_interval 5 ; Switches are checked every 5 m
retry_interval 1 ; Schedule host check retries at
max_check_attempts 10 ; Check each switch 10 times (ma
check_command check-host-alive ; Default command to che
notification_period 24×7 ; Send notifications at any time
notification_interval 30 ; Resend notifications every 30
notification_options d,r ; Only send notifications for sp
contact_groups admins ; Notifications get sent to the
register 0 ; DONT REGISTER THIS – ITS JUST
icon_image cook/router.jpg
statusmap_image cook/router.jpg
}

Buat object cyber.cfg nya agar kita konfigurasi object
#pico /usr/local/nagios/etc/objects/cyber.cfg

define hostgroup{
hostgroup_name cyber ; The name of the hostgroup
alias Cyber Connection ; Long name of the group
}

define host{
use generic-cyber ; Inherit default values from a
host_name CORE-EZ ; The name we’re giving to this
alias ROUTER 7200 ; A longer name associated with
address 192.168.1.1 ; IP address of the switch
hostgroups cyber ; Host groups this switch is as
}

Di nagios.cfg nya kita tambahkan cfg filenya si cyber.cfg tadi
#pico /usr/local/nagios/etc nagios.cfg
tambahin cfg file nya
cfg_file=/usr/local/nagios/etc/objects/cyber.cfg

Configure apache nya agar nanti jika diketikkan di webaddress langsung muncul nagios, tidak pakai http://localhost/nagios
#pico /etc/apache2/httpd.conf

ServerAdmin nagios@localhost
ServerName nagios.ez.net.id
ServerAlias http://www.nagios.ez.net.id
DocumentRoot /usr/local/nagios/share
ScriptAlias /cgi-bin/nagios /usr/local/nagios/sbin
ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin

# Where the stylesheets (config files) reside
#Alias /nagios/stylesheets /usr/local/nagios/share
# Where the HTML pages live
Alias /nagios /usr/local/nagios/share

Options FollowSymLinks
DirectoryIndex index.php
AllowOverride AuthConfig
Order Allow,Deny
Allow From All

AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
require valid-user

#pico /etc/apache2/conf.d/nagios.conf

ScriptAlias /nagios/cgi-bin “/usr/local/nagios/sbin”

# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user

Alias /nagios “/usr/local/nagios/share”

# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user

Gue pernah ngalamin dibawah ini setelah habis install , jadi di object nya itu selalu down. seperti indikator dibawah ini
return code of 127 is out of bounds – plugin may be missing nagios

Ketikkan ulang perintah dibawah ini.

#cd
#cd nagios-plugins-1.4.16
./configure –with-nagios-user=nagios –with-nagios-group=nagios
#cd ..

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s