Pada perkuliahan kali ini, saya akan menjelaskan secara singkat tentang cara penginstallan nagios dan bagaimana contoh pengaplikasiannya. Tetapi sebelum itu, baiknya kita mengetahui apa itu nagios dan apa saja kegunaannya.
Nagios merupakan sebuah sistem dan aplikasi monitoring jaringan yang diciptakan olehEthan Galstad (http://nagios.org). Nagios mengawasi host-host dan servis yang telah ditetapkan, memberi peringatan jika keadaan memburuk, dan memberi tahu kapan keadaan tersebut membaik. Nagios dijalankan dalam Linux. Nagios juga memiliki keunggulan atau keistimewaan seperti:
Memonitoring servis jaringan (SMTP, POP3, HTTP, NNTP, PING, dsb)\
Servis cek yang paralel
Mendukung implementasi monitoring dengan host yang berle
Web interface yang fakultatip untuk melihat status network, urutan masalah dan pemberitahuan, log file, dsb).
Memonitoring sumber- sumber host (load prosesor, penggunaan disk, dsb)
Desain plugin yang serderhana, yang mengijinkan pengguna untuk lebih mudah menggunakan pemeriksaan terhadap servisnya
Kemampuan untuk mendefinisikan kejadian yang ditangani selama servis atau host berlangsung untuk mempermudah pemecahan masalah perputaran file log yang otomatis
Nagios merupakan sebuah sistem dan aplikasi monitoring jaringan yang diciptakan olehEthan Galstad (http://nagios.org). Nagios mengawasi host-host dan servis yang telah ditetapkan, memberi peringatan jika keadaan memburuk, dan memberi tahu kapan keadaan tersebut membaik. Nagios dijalankan dalam Linux. Nagios juga memiliki keunggulan atau keistimewaan seperti:
Berikut adalah cara penginstallan dan pengaplikasiannya secara singkat:
1. Masuk pada ubuntu dengan 'sudo su' seperti baisa dan masukkan password sesuai dengan komputer anda masing-masing.
2. Kemudian lakukan pengecekan paket yang kita butuh kan untuk penginstallan nagios, dengan cara:
dpkg -l |grep <jenis paket yang akan dicek>
dikarenakan kita membutuhkan apache dan nagios pada percobaan ini maka lakukan pengecekan apache dan nagios dengan cara berikut ini:
dpkg -l |grep apache2 >> untuk mengecek paket apache2
dpkg -l |grep nagios3 >> untuk mengecek paket nagios3
Hal ini dialukan agar tidak terjadi penimpaan data yang akan ingin baru kita buat dengan data yang sudah lama yang ada dikomputer anda. Setelah pengecekan tadi kita akan mengetahui apakah apache dan nagios sudah terinstall apa belum dikomputer anda. Jika sudah ada maka anda harus melalukan peremovean trelebih dahulu dan melalakukan penginstallan ulang kembali agar tidak ada penimpaan data tersebut. Adapun caranya adalah sebagai berikut:
#apt-get remove apache2 >> untuk meremove paket apache2
#apt-get remove nagios3 >> untuk meremove paket nagios3
dan
#apt-get install nagios3
#apt-get install apache2
Kadang ada pula yang meminta password baru untuk nagios anda. Maka anda lakukan pengisian password untu nagios tersebut.
3. Setelah semua telah dilakukan kemudian kita akan melakukan konfigurasi pada nagiosnyanya dengan cara:
#nano /etc/nagios3/conf.d/localhost_nagios3.cfg
Ini merupakan perintah untuk konfigurasi pada local hostnya. Pada Konfigurasi ini, saya akan memonitoring 3 jaringan tetangga, yaitu misra (jartel2), ihsan (jartel3), dan agung (jartel4).
Ini adalah perintah konfigurasi pada localhost. Pada konfigurasi ini saya akan melakukan monitoring 3 jaringan teman saya dalam 1 jaringan, yaitu riyan (jartel1), nia (jartel2), fajri (jartel3), fajar (jartel4).
Adapun konfigurasinya dapat dilakukan seperti dibawah ini:
# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#
define host{
use generic-host ; Name of host template$
host_name jartel1
alias riyan
address 172.16.30.16
}
define host{
use generic-host ; Name of host template$
host_name jartel2
alias nia
address 172.16.30.34
}
define host{
use generic-host ; Name of host template$
host_name jartel3
alias fajri
address 172.16.30.32
}
define host{
use generic-host ; Name of host template$
host_name jartel4
alias fajar
address 172.16.30.2
}
# Define a service to check the disk space of the root partition
# on the local machine. Warning if < 20% free, critical if
# < 10% free space on partition.
define service{
use generic-service ; Name of servi$
host_name jartel1
service_description Disk Space
check_command check_all_disks!20%!10%
}
define service{
use generic-service ; Name of servi$
host_name jartel2
service_description Disk Space
check_command check_all_disks!20%!10%
}
define service{
use generic-service ; Name of servi$
host_name jartel3
service_description Disk Space
check_command check_all_disks!20%!10%
}
define service{
use generic-service ; Name of servi$
host_name jartel4
service_description Disk Space
check_command check_all_disks!20%!10%
}
# Define a service to check the number of currently logged in
# users on the local machine. Warning if > 20 users, critical
# if > 50 users.
define service{
use generic-service ; Name of servi$
host_name jartel1
service_description Current Users
check_command check_users!20!50
}
define service{
use generic-service ; Name of servi$
host_name jartel2
service_description Current Users
check_command check_users!20!50
}
define service{
use generic-service ; Name of servi$
host_name jartel3
service_description Current Users
check_command check_users!20!50
}
define service{
use generic-service ; Name of servi$
host_name jartel4
service_description Current Users
check_command check_users!20!50
}
# Define a service to check the number of currently running procs
# on the local machine. Warning if > 250 processes, critical if
# > 400 processes.
define service{
use generic-service ; Name of servi$
host_name jartel1
service_description Total Processes
check_command check_procs!250!400
}
define service{
use generic-service ; Name of servi$
host_name jartel2
service_description Total Processes
check_command check_procs!250!400
}
define service{
use generic-service ; Name of servi$
host_name jartel3
service_description Total Processes
check_command check_procs!250!400
}
define service{
use generic-service ; Name of servi$
host_name jartel4
service_description Total Processes
check_command check_procs!250!400
}
# Define a service to check the load on the local machine.
define service{
use generic-service ; Name of service template to use
host_name jartel1
service_description Current Load
check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0
}
define service{
use generic-service ; Name of servi$
host_name jartel2
service_description Current Load
check_command check_load!5.0!4.0!3.0!10.0!6.0$
}
define service{
use generic-service ; Name of servi$
host_name jartel3
service_description Current Load
check_command check_load!5.0!4.0!3.0!10.0!6.0$
}
define service{
use generic-service ; Name of servi$
host_name jartel4
service_description Current Load
check_command check_load!5.0!4.0!3.0!10.0!6.0$
}
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#
define host{
use generic-host ; Name of host template$
host_name jartel1
alias riyan
address 172.16.30.16
}
define host{
use generic-host ; Name of host template$
host_name jartel2
alias nia
address 172.16.30.34
}
define host{
use generic-host ; Name of host template$
host_name jartel3
alias fajri
address 172.16.30.32
}
define host{
use generic-host ; Name of host template$
host_name jartel4
alias fajar
address 172.16.30.2
}
# Define a service to check the disk space of the root partition
# on the local machine. Warning if < 20% free, critical if
# < 10% free space on partition.
define service{
use generic-service ; Name of servi$
host_name jartel1
service_description Disk Space
check_command check_all_disks!20%!10%
}
define service{
use generic-service ; Name of servi$
host_name jartel2
service_description Disk Space
check_command check_all_disks!20%!10%
}
define service{
use generic-service ; Name of servi$
host_name jartel3
service_description Disk Space
check_command check_all_disks!20%!10%
}
define service{
use generic-service ; Name of servi$
host_name jartel4
service_description Disk Space
check_command check_all_disks!20%!10%
}
# Define a service to check the number of currently logged in
# users on the local machine. Warning if > 20 users, critical
# if > 50 users.
define service{
use generic-service ; Name of servi$
host_name jartel1
service_description Current Users
check_command check_users!20!50
}
define service{
use generic-service ; Name of servi$
host_name jartel2
service_description Current Users
check_command check_users!20!50
}
define service{
use generic-service ; Name of servi$
host_name jartel3
service_description Current Users
check_command check_users!20!50
}
define service{
use generic-service ; Name of servi$
host_name jartel4
service_description Current Users
check_command check_users!20!50
}
# Define a service to check the number of currently running procs
# on the local machine. Warning if > 250 processes, critical if
# > 400 processes.
define service{
use generic-service ; Name of servi$
host_name jartel1
service_description Total Processes
check_command check_procs!250!400
}
define service{
use generic-service ; Name of servi$
host_name jartel2
service_description Total Processes
check_command check_procs!250!400
}
define service{
use generic-service ; Name of servi$
host_name jartel3
service_description Total Processes
check_command check_procs!250!400
}
define service{
use generic-service ; Name of servi$
host_name jartel4
service_description Total Processes
check_command check_procs!250!400
}
# Define a service to check the load on the local machine.
define service{
use generic-service ; Name of service template to use
host_name jartel1
service_description Current Load
check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0
}
define service{
use generic-service ; Name of servi$
host_name jartel2
service_description Current Load
check_command check_load!5.0!4.0!3.0!10.0!6.0$
}
define service{
use generic-service ; Name of servi$
host_name jartel3
service_description Current Load
check_command check_load!5.0!4.0!3.0!10.0!6.0$
}
define service{
use generic-service ; Name of servi$
host_name jartel4
service_description Current Load
check_command check_load!5.0!4.0!3.0!10.0!6.0$
}
4. Setelah itu, lakukan konfigurasi untuk hostgrupnya. Denagn perintah:
#nano /etc/nagios3/conf.d/hostgroups_nagios2.cfg
Adapun contohnya seperti dibawah ini:
# Some generic hostgroup definitions
# A simple wildcard hostgroup
define hostgroup {
hostgroup_name all
alias All Servers
members jartel1,jartel2,jartel3,jartel4
}
# A list of your Debian GNU/Linux servers
define hostgroup {
hostgroup_name debian-servers
alias Debian GNU/Linux Servers
members jartel1,jartel2,jartel3,jartel4
}
# A list of your web servers
define hostgroup {
hostgroup_name http-servers
alias HTTP servers
members jartel1,jartel2,jartel3,jartel4
}
# A list of your ssh-accessible servers
define hostgroup {
hostgroup_name ssh-servers
alias SSH servers
members jartel1,jartel2,jartel3,jartel4
}
#A list of your ping-accessible servers
define hostgroup {
hostgroup_name ping-servers
alias ping servers
members jartel1,jartel2,jartel3,jartel4
}
# A simple wildcard hostgroup
define hostgroup {
hostgroup_name all
alias All Servers
members jartel1,jartel2,jartel3,jartel4
}
# A list of your Debian GNU/Linux servers
define hostgroup {
hostgroup_name debian-servers
alias Debian GNU/Linux Servers
members jartel1,jartel2,jartel3,jartel4
}
# A list of your web servers
define hostgroup {
hostgroup_name http-servers
alias HTTP servers
members jartel1,jartel2,jartel3,jartel4
}
# A list of your ssh-accessible servers
define hostgroup {
hostgroup_name ssh-servers
alias SSH servers
members jartel1,jartel2,jartel3,jartel4
}
#A list of your ping-accessible servers
define hostgroup {
hostgroup_name ping-servers
alias ping servers
members jartel1,jartel2,jartel3,jartel4
}
5. Kemudian lakukan konfigurasi untuk servicenya dengan perintah:
#nano /etc/nagios3/conf.d/services_nagios2.cfg
dengan contoh:
define service {
hostgroup_name http-servers
service_description HTTP
check_command check_http
use generic-service
notification_interval 0 ; set > 0 if you want to be renotified
}
# check that ssh services are running
define service {
hostgroup_name ssh-servers
service_description SSH
check_command check_ssh
use generic-service
notification_interval 0 ; set > 0 if you want to be renotified
}
# check that ping services are running
define service {
hostgroup_name ping-servers
service_description ping
check_command check_ping
use generic-service
notification_interval 0 ; set > 0 if you want to be renotified
}
hostgroup_name http-servers
service_description HTTP
check_command check_http
use generic-service
notification_interval 0 ; set > 0 if you want to be renotified
}
# check that ssh services are running
define service {
hostgroup_name ssh-servers
service_description SSH
check_command check_ssh
use generic-service
notification_interval 0 ; set > 0 if you want to be renotified
}
# check that ping services are running
define service {
hostgroup_name ping-servers
service_description ping
check_command check_ping
use generic-service
notification_interval 0 ; set > 0 if you want to be renotified
}
6. Setelah konfigurasi localhost, hostgroup, dan servicenya. Maka lakukan pe-restart-an ulang dengan perintah seperti berikut ini:
/etc/init.d/nagios3 restart
jika berhasil maka tampilan nya seperti ini:
7. Kemudian buka web browser dan ketikkan perintah berikut pada URL nya:
http:/localhost/nagios3
Kemudian akan muncul tampilan seperti dibawah ini. Anda dapat memasukkan password sesuai yang anda buat pada saat penginstallan nagios tadi. DAn masukkan usernamenya dengan nama 'nagiosadmin'
Setelah login maka akan muncul tampilan seperti berikut ini:
Kemudian jika muncul tampilan seperti ini maka anda sudah bisa memonitoring teman anda. Saya melakukan monitoring terhadap teman sekelas saya pada 1 jaringan LAN yang sama.
Kemudian jika jaringannya masih down tunggu beberapa saat hingga up. dan anda dapat melakukan monitoring. Adapun pemonitoringan yang saya lakukan seperti dibawah ini, kita bisa melihat secara service maupun secara group nya.
Ini adalah tampilan ketika jaringannya sudah up:
Dibawah ini adalah tampilan pada saat monitoring secara grup
Demikianlah monitoring yang saya lakukan pada teman sekelas saya. Semoga penginstallan dan pengaplikasian yang saya buat bermanfaat bagi pembaca. Mohon kritik dan saran dari pembaca untuk blog saya kedepannya. Terimakasih...
note: untuk monitoring ini dilakukannya pemonitoringan minimal 4 tetangga atau jumlah teman.
Comments
Post a Comment