konfigurasi Nagios
pada tulisan kali ini akan dibahas mengenai konfigurasi nagios supaya dapat berjalan, (konfigurasi minimal supaya dapat berjalan). tulisan ini merupakan lanjutan dari tulisan saya di blog ini mengenai instalasi nagios
beberapa file yang harus dikonfigurasi (dalam hal ini konfigurasi minimal) adalah nagios.cfg dan minimal.cfg
Pada saat konfigurasi file nagios.cfg yang perlu dilakukan adalah memberi komentar pada baris yang seperti ini:
#cfg_file=/usr/local/etc/nagios/checkcommands.cfg
#cfg_file=/usr/local/etc/nagios/misccommands.cfg
Berikutnya yang dikonfigurasi yaitu file minimal.cfg. Hal yang dilakukan adalah(hal yang dirubah dari setting sample dicetak tebal, file ini hanya contoh saja):
define timeperiod{
timeperiod_name 24x7
alias 24 Hours A Day, 7 Days A Week
sunday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
}
define command{
command_name notify-by-email
command_line /usr/bin/printf "%b" "***** Nagios @VERSION@ *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$OUTPUT$" | @MAIL_PROG@ -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
define command{
command_name host-notify-by-email
command_line /usr/bin/printf "%b" "***** Nagios @VERSION@ *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $OUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | @MAIL_PROG@ -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
}
define command{
command_name check-host-alive
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 99,99% -c 100,100% -p 1
}
define command{
command_name check_ping
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
}
define command{
command_name check_local_disk
command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
}
define command{
command_name check_local_users
command_line $USER1$/check_users -w $ARG1$ -c $ARG2$
}
define command{
command_name check_local_procs
command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$
}
define command{
command_name check_local_load
command_line $USER1$/check_load -w $ARG1$ -c $ARG2$
}
define contact{
contact_name crescent
alias Crescent Hikari
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email fiqri@arc.itb.ac.id
}
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members crescent
}
define host{
name generic-host ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
define host{
use generic-host ; Name of host template to use
host_name localhost
alias localhost
address 127.0.0.1
check_command check-host-alive
max_check_attempts 10
notification_interval 120
notification_period 24x7
notification_options d,r
contact_groups admins
}
define host{
use generic-host ; Name of host template to use
host_name crescent.arc.itb.ac.id
alias crescent
address 167.205.3.26
check_command check-host-alive
max_check_attempts 10
notification_interval 120
notification_period 24x7
notification_options d,r
contact_groups admins
}
define hostgroup{
hostgroup_name test
alias Test Servers
members localhost,crescent.arc.itb.ac.id
}
define service{
name generic-service ; The 'name' of this service template
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service 1 ; We should obsess over this service (if necessary)
check_freshness 0 ; Default is to NOT check service 'freshness'
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}
define service{
use generic-service ; Name of service template to use
host_name localhost, crescent.arc.itb.ac.id
service_description PING
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 960
notification_period 24x7
check_command check_ping!100.0,20%!500.0,60%
}
define service{
use generic-service ; Name of service template to use
host_name localhost
service_description Root Partition
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 960
notification_period 24x7
check_command check_local_disk!20%!10%!/
}
define service{
use generic-service ; Name of service template to use
host_name localhost
service_description Current Users
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 960
notification_period 24x7
check_command check_local_users!20!50
}
define service{
use generic-service ; Name of service template to use
host_name localhost
service_description Total Processes
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 960
notification_period 24x7
check_command check_local_procs!250!400
}
define service{
use generic-service ; Name of service template to use
host_name localhost
service_description Current Load
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 960
notification_period 24x7
check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
}
Setelah kedua file tersebut dikonfigurasi lakukan pengecekan sebelum nagios dijalankan terhadap keduanya dengan menggunakan perintah :
# /usr/local/bin/nagios -v /usr/local/etc/nagios/nagios.cfg
Apabila tidak terdapat pesan error, maka kita dapat menjalankan nagios dengan perintah :
/usr/local/bin/nagios –d /usr/local/etc/nagios/nagios.cfg &
Untuk mengetahui adanya pesan error pada nagios pada saat berjalan kita dapat melihat pada log nagios dengan mengetikkan perintah :
tail -f /var/spool/nagios/nagios.log
demikian cara konfigurasi nagios secara minimal. untuk konfigurasi yang lebih, masih dalam tahap percobaan. jika sudah selesai insyaAllah akan segera di-publish


5 Comments
Jump to comment form | comments rss [?] | trackback uri [?]