- Memonitor servis jaringan (SMTP, POP3, HTTP, PING, dsb)
- Memonitor resource dari host-host yang ingin dipantau (load prosessor, disk usage, dsb)
- Mendapat notifikasi apabila terjadi gangguan pada servis atau host yang sedang dipantau via email
1. Update Centos
# yum update
# vi /etc/sysconfig/selinux" and set "SELINUX=disabled"
# setenforce 0
# reboot
2. Install repositori EPEL
# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
3.Install Nagios
# yum install nagios nagios-plugins nagios-plugins-all nagios-plugins-nrpe php php-pear mod_ssl net-snmp net-snmp-utils sendmail
4. Create user default untuk login ke Nagios
# htpasswd /etc/nagios/passwd nagiosadmin
# nagios -v /etc/nagios/nagios.cfg
5. Setup service Nagios
# chkconfig nagios on
# /etc/init.d/nagios start
6. Setup service Apache
# chkconfig httpd on
# /etc/init.d/httpd restart
7. Setup service Sendmail
# chkconfig sendmail on
# /etc/init.d/sendmail restart
8. Konfigurasi host yang di monitoring
# cd /etc/nagios/
# cp objects/localhost.cfg objects/namaserver.cfg
# vi objects/namaserver.cfg
Isi file namaserver.cfg:
# 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 namaserver
alias namaserver
address xxx.xxx.xxx.xxx ; IP server
}
# Define an optional hostgroup for Linux machines
define hostgroup{
hostgroup_name namaserver-servers ; The name of the hostgroup
alias Linux Servers ; Long name of the group
members namaserver ; 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 namaserver
service_description PING
check_command check_ping!500.0,20%!1000.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 namaserver
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 namaserver
service_description HTTP
check_command check_http
notifications_enabled 0
}
9. Tambahkan konfigurasi di nagios.conf
# vim /etc/nagios/nagios.cfg
Cari dan tambahkan baris berikut:
cfg_file=/etc/nagios/objects/namaserver.cfg
10. Cek konfigurasi
# nagios -v /etc/nagios/nagios.cfg
Nagios Core 3.4.4
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 01-12-2013
License: GPL
.....
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
11. Restart service Nagios
# /etc/init.d/nagios restart
12. Testing di browser
Buka browser kemudia ketikkan: http://xxx.xxx.xxx.xxx/nagios
Ket: xxx.xxx.xxx.xxx = ip server atau localhost
13. Setup user lebih dari satu
# vim /etc/nagios/cgi.cfg
Ubah bagian ini:
authorized_for_system_information=*
authorized_for_all_services=*
authorized_for_all_hosts=*
# htpasswd /etc/nagios/passwd userbaru
14. Restart service Nagios
# /etc/init.d/nagios restart
0 comments:
Post a Comment