BAB IV HASIL DAN PEMBAHASAN
4.1.3 Analisis Permasalahan
4.1.3.1 Instalasi Nagios
Sebelum memulai instalasi siapkan paket nagios dan plugin terbaru dan paling stabil (nagios-3.2.3.tar.gz dan plugin nagios-plugins-1.4.15.tar.gz). Kemudian install terlebih dahulu aplikasi Apache HTTP server dan GD
library serta library lainnya yang dibutuhkan saat instalasi dan saat nagios dijalankan nantinya. Berikut ini instruksi-instruksi instalasi nagios (instalasi CentOS terdapat dalam lampiran)
Instalasi Apache HTTP dengan perintah yum cara yum install httpd.
Membuat user dan group nagios, sebagai berikut :
[root@localhost~]# useradd -s /bin/false -d /usr/lib/nagios nagios
Membuat grup baru dengan nama nagcmd untuk memungkinkan external command di-submit melalui web interface. Tambahkan user nagios dan
user apache ke group nagcmd.
[root@localhost~]# groupadd nagcmd
[root@localhost~]# usermod -G nagcmd nagios [root@localhost~]# usermod -G nagcmd apache
Kemudian ekstrak nagios sebagai berikut (diasumsikan nagios hasil
download terletak di /root/Desktop).
[root@localhost~]# tar -xzvf /root/Desktop/nagios-3.2.3.tar.gz
Selanjutnya mengkompilasi nagios sebagai berikut, [root@localhost~]# cd nagios-3.2.3
[root@localhost nagios-3.2.3]# ./configure
--prefix=/usr/lib/nagios --with-command-group=nagcmd [root@localhost nagios-3.2.3]# make all
Instalasi binaries, init script, contoh konfigurasi dan men-setting
permissions pada direktori external command, sebagi berikut: [root@localhost nagios-3.2.3]# make install
[root@localhost nagios-3.2.3]# make install-init [root@localhost nagios-3.2.3]# make install-config [root@localhost nagios-3.2.3]# make install-commandmode
Pada saat instalasi diatas, semua sampel file konfigurasi nagios dikopikan
ke direktori /usr/lib/nagios/etc. Dengan sampel file konfigurasi ini seharusnya nagios sudah dapat berjalan, tetapi harus disesuaikan dengan kebutuhan. File konfigurasi yang perlu disesuaikan yaitu file
/usr/lib/nagios/etc/objects/contacts.cfg. Definisikan contact dan
contactgroup seperti berikut :
Konfigurasi web interface. Menginstal file konfigurasi web nagios ke
dalam /etc/httpd.conf.d dengan cara sebagai berikut:
[root@localhost nagios-3.2.3]# make install-webconf
Membuat user account nagiosadmin untuk dapat login ke web interface
nagios
[root@localhost nagios-3.2.3]# htpasswd -c
/usr/lib/nagios/etc/htpasswd.users \ nagiosadmin
Kemudian restart service apache http server agar membaca konfigurasi terbaru
[root@localhost nagios-3.2.3]# service httpd restart
Kompilasi dan Instalasi Nagios Plugin
Ekstrak nagios plugin sebagai berikut ( diasumsikan nagios plugin hasil
download ada di /root/Desktop)
[root@localhost~]# tar -xzvf /root/Desktop/nagios-plugins-1.4.15.tar.gz
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 ohayodinda@yahoo.com; <<** isi dengan email Anda
}
define contactgroup{
contactgroup_name admins
alias Nagios Administrators members nagiosadmin
Selanjutnya mengkompilasi dan menginstal nagios sebagai berikut [root@localhost ~]# cd nagios-plugins-1.4.15
[root@localhost nagios-plugins-1.4.15]#./configure – prefix=/usr/lib/nagios \--with-nagios-user=nagios –with-nagios-group=nagios
[root@localhost nagios-plugins-1.4.15]# make
[root@localhost nagios-plugins-1.4.15]# make install
Mengaktifkan Nagios
Tambahkan atau daftarkan Nagios ke dalam system service dan setting Nagios agar diaktifkan secara otomatis saat booting
[root@localhost ~]# chkconfig --add nagios [root@localhost ~]# chkconfig nagios on
Verifikasi atau periksa file konfigurasi
[root@localhost ~]# /usr/lib/nagios/bin/nagios -v /usr/lib/nagios/etc/nagios.cfg
Jika dari verifikasi tidak ada pesan error , selanjutnya aktifkan nagios [root@localhost ~]# service nagios start
Selanjutnya web interface nagios dapat diakses melalui url http://localhost/nagios/. Jika konfigurasi nagios sudah benar kemudian login dengan username dan password yang sebelumnya telah dibuat, maka akan terlihat seperti gambar berikut.
Gambar 4.3 Nagios Interface Menambah host yang akan dimonitoring
Pada konfigurasi default, nagios hanya memonitor sebuah host yaitu
localhost. Untuk dapat memonitor LDAP master perlu dilakukan penambahan host dengan cara membuat file konfigurasi monitoring host tersebut. Caranya sebagai berikut:
Salinlah file konfigurasi untuk memonitoring host localhost.cfg, beri nama
sesuai ldapmaster.cfg. [root@localhost~]#cp
/usr/lib/nagios/etc/objects/localhost.cfg \ /usr/lib/nagios/etc/objects/ldapmaster.cfg
Kemudian ubah dan sesuaikan konfigurasi untuk ldapmaster. Misalkan
service yang diinginkan adalah ping, http, ssh, dll. [root@localhost~]#vi
usr/lib/nagios/etc/objects/ldapmaster.cfg Sesuaikan isi file ldapmaster.cfg seperti berikut :
Kemudian dengan skenario bahwa ldapmaster adalah masuk dalam hostgr
oup linuxservers, maka perlu diedit bagian definisi hostgroup yang ada pada localhost.cfg dengan menambahkan ldapmaster sebagai member dari hostgroup linux-server, sebagai berikut :
[root@labtop1~]#vi /usr/lib/nagios/etc/objects/localhost.cfg define hostgroup{
hostgroup_name linux-servers ; The name of the hostgroup
alias Linux Servers ; Long name of the group
members localhost, ldapmaster ; Comma
separated list of hosts that belong to this group }
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 ldapmaster
alias ldapmaster
address 202.46.240.78 } define service{
use local-service ; Name of service template to use host_name ldapmaster service_description PING check_command check_ping!100.0,20%!500.0,60% } define service{
use local-service ; Name of
service template to use
host_name ldapmaster
service_description SSH
check_command check_ssh notifications_enabled 0 } define service{
use local-service ; Name of
service template to use
host_name ldapmaster
service_description HTTP
check_command check_http notifications_enabled 0 }
Selanjutnya edit file /usr/lib/nagios/etc/nagios.cfg, untuk menambahkan
direktori tempat ldapmaster berada dibawah baris cfg_file=/usr/lib/nagios/etc/objects/localhost.cfg, sehingga menjadi sebagai berikut:
# Definitions for monitoring the local (Linux) host cfg_file=/usr/lib/nagios/etc/objects/localhost.cfg cfg_file=/usr/lib/nagios/etc/objects/ldapmaster.cfg
Selanjutnya, verifikasi apakah konfigurasi yang dilakukan sudah benar
dengan cara sebagai berikut:
[root@labtop1~]# /usr/lib/nagios/bin/nagios -v usr/lib/nagios/etc/nagios.cfg
Setelah diinstal dan dilakukan penambahan host LDAP master akan didapatkan sebuah laporan mengenai availabilityhost tersebut.
Berdasarkan analisis menggunakan Nagios sejak tanggal 11 Juli 2011 sampai dengan 12 Agustus 2011, LDAP server memiliki tingkat
availability sebesar 93 %.