Sabtu, 18 Oktober 2008

Instalasi NAGIOS di Centos





untuk mendapatkan file Nagios bisa diDownload di
http://www.nagios.org/
atau coba unduh di mirrornya... SINI hehehehe
nagios plugins nya ---->>>> over here

langkah-langkah awal instalasi Nagios :

login sebagai root
buat dahulu user nagios
[root@servertest ~]# /usr/sbin/useradd -m nagios
[root@servertest ~]# passwd nagios
lalu buat groupnya nagios
[root@servertest ~]# /usr/sbin/groupadd nagcmd
[root@servertest ~]# /usr/sbin/usermod -G nagcmd nagios
[root@servertest ~]# /usr/sbin/usermod -G nagcmd apache


masuk kedalam directori dimana file Nagios terdapat, lalu extract file nagios
[root@servertest ~]# tar zxvf nagios-3.0.3.tar.gz
[root@servertest ~]# cd nagios-3.0.3

jalankan perintah untuk mengcompile file nagios
[root@servertest nagios-3.0.3]# ./configure
[root@servertest nagios-3.0.3]# make all
[root@servertest nagios-3.0.3]# make install
[root@servertest nagios-3.0.3]# make install-init
[root@servertest nagios-3.0.3]# make install-config
[root@servertest nagios-3.0.3]# make install-commandmode

jangan menjalankan dulu service nagios karena masih ada yg perlu dilakukan loh...

rubahlah file yg berada di dalam /usr/local/nagios/etc/objects/contacts.cfg untuk merubah alamat email address admin..

[root@servertest nagios-3.0.3]#vi /usr/local/nagios/etc/object/contacts.cfg

contoh :
###############################################################################
###############################################################################
#
# CONTACTS
#
###############################################################################
###############################################################################

# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the 'generic-contact'
# template which is defined elsewhere.

define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user

email penchot@servertest.co.id ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}

###############################################################################
###############################################################################
#

setelah edit file tersebut simpanlah dengan perintah :wq

jalankan perintah untuk mengkonfigurasi web interfacesnya

[root@servertest nagios-3.0.3]# make install-webconf

setelah selesai lakukan pembuatan user untuk nagiosadmin nya..
[root@servertest nagios-3.0.3]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

lakukan restart pada service http
[root@servertest nagios-3.0.3]# service nagios restart

lakukan instalasi plugins nagios
[root@servertest nagios-3.0.3]#tar zxvf nagios-plugins-xx.x.x.tar.gz
[root@servertest nagios-3.0.3]#cd nagios-plugins-xx.x.x
[root@servertest nagios-plugins-xx.x.x]#

lakukan compile filenya...
[root@servertest nagios-plugins-xx.x.x]#
./configure --with-nagios-user=nagios --with-nagios-group=nagios
[root@servertest nagios-plugins-xx.x.x]# make
[root@servertest nagios-plugins-xx.x.x]# make install

setelah selesai, maka masukkan nagios dalam list service
[root@servertest nagios-plugins-xx.x.x]# chkconfig --add nagios
[root@servertest nagios-plugins-xx.x.x]# chkconfig nagios on

untuk mengecek apakah masih ada yg error maka lakukan perintah :

[root@servertest nagios-plugins-xx.x.x]#
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

bila tidak ada yg error maka lakukan start pada nagios

service nagios start



MENAMBAH HOST YG AKAN DOMONITORING

salinlah file konfigurasi host localhost sebagai berikut :

cp /usr/local/nagios/etc/object/localhost.cfg /usr/local/nagios/etc/object/client1.cfg

* kemudian edit file yg baru dibuat sesuai yang anda inginkan :
vi /usr/local/nagios/etc/object/client1.cfg

ct :
###############################################################################
###############################################################################
#
# HOST DEFINITION
#
###############################################################################
###############################################################################

# Define a host for the local machine

define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name edpadm
alias edpadm
address 172.16.4.38
}

###############################################################################
###############################################################################
#
# HOST GROUP DEFINITION
#
###############################################################################
###############################################################################

# Define an optional hostgroup for Linux machines

define hostgroup{
hostgroup_name linux ; The name of the hostgroup
alias Linux Servers ; Long name of the group
members localhost ; Comma separated list of hosts that belong to this group
}

# Define a service to "ping" the local machine

define service{ use local-service ; Name of service template to use
host_name edpadm
service_description PING
check_command check_ping!100.0,20%!500.0,60%

# Define a service to check SSH on the local machine.# Disable notifications for this service by default, as not all users may have SSH enabled.
define service{ use local-service ; Name of service template to use
host_name edpadm
service_description SSH
check_command check_ssh
notifications_enabled 0
}

# Define a service to check HTTP on the local machine.# Disable notifications for this service by default, as not all users may have HTTP enabled.

define service{ use local-service ; Name of service template to use
host_name edpadm
service_description HTTP check_command check_http
notifications_enabled 0



* kemudian buatlah skenario bahwa client1 masuk dalam hostgroup linux server,
maka editlah file localhostnya :
vi /usr/local/nagios/etc/object/localhost.cfg

# Define an optional hostgroup for Linux machines

define hostgroup{
hostgroup_name linux-servers ; The name of the hostgroup
alias Linux Servers ; Long name of the group
members localhost, client1 ; Comma separated list of hosts that belong to this group
}

tambahkan member client1 dalam hostgroup, lalu editlah file didalam /usr/local/nagios/etc/nagios.cfg

vi /usr/local/nagios/etc/nagios.cfg

tambahkan entri client1 kedalam konfigurasi tersebut seperti dibawah :

# Definitions for monitoring the local (Linux) host
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
cfg_file=/usr/local/nagios/etc/objects/edpadm.cfg

setelah itu, verifikasikan konfigurasi tsb apakah sudah benar.

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

bila sudah benar, maka akan terlihat seperti ini :

Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check

selanjutnya restart service nagios
service nagios restart



====END====
============&&&&&&&&=============







Tidak ada komentar: