service_description Current Users check_command check_nrpecheck_users
}
define
service {
use generic-service host_name webserver
service_description Root Partition check_command check_nrpecheck_sda1
}
define
service {
use generic-service host_name webserver
service_description Zombie Proc check_command check_nrpecheck_zombie_procs
}
define
service {
use generic-service host_name webserver
service_description Total Process check_command check_nrpecheck_total_procs
}
4.4.2.1.2 Konfigurasi File Nagios.cfg
Setelah melakukan pembuatan file windows-server.cfg dan linux- server.cfg, langkah selanjutnya adalah mendeFINisikan file tersebut di dalam
Nagios.cfg yang terletak pada etcNagios. Langkah ini dimaksudkan agar server windows dan linux dapat ditampilkan pada web interface. Hal ini dapat
dilakukan dengan cara penambahan baris path file windows-server.cfg dan linux-server.cfg pada Nagios.cfg. Berikut adalah isi dari file konfigurasi
Nagios.cfg
NAGIOS.CFG - Sample Main Config File for Nagios 3.0.6 Read the documentation for more information on this configuration
file. Ive provided some comments here, but things may not be so clear without further explanation.
Last Modified: 10-15-2008 LOG FILE
This is the main log file where service and host events are logged for historical purposes. This should be the fiRST option specified
in the config file log
_file=varlogNagiosNagios.log OBJECT CONFIGURATION FILES
These are the object configuration files in which you deFINe hosts, host groups, contacts, contact groups, services, etc.
You can split your object deFINitions across several config files if you wish as shown below, or keep them all in a single config file.
You can specify individual object config files as shown below: cfg_file=etcNagiosobjectscommands.cfg
cfg_file=etcNagiosobjectscontacts.cfg cfg_file=etcNagiosobjectstimeperiods.cfg
cfg_file=etcNagiosobjectstemplates.cfg DeFINitions for monitoring the local Linux host
cfg_file=etcNagiosobjectslocalhost.cfg DeFINitions for monitoring a Windows machine
cfg_file=etcNagiosobjectswindows.cfg cfg_file=etcNagiosobjectswindows-server.cfg
cfg_file=etcNagiosobjectslinux-server.cfg
4.4.2.1.3 Konfigurasi Commands.cfg
Setelah host yang akan dimonitor sudah ditambahkan dan dideFINisikan, maka langkah selanjutnya adalah mengkonfigurasi file
commands.cfg yang terletak di etcNagiosobjects. File commands.cfg ini diperlukan untuk mendefinisikan perintah-perintah pengecekan service dan
resource yang sudah dicantumkan pada file windows-server.cfg dan linux-
server.cfg. Pendefinisian perintah ini hanya sekali dilakukan dan dapat digunakan oleh host lainnya.
Sebelumnya penulis harus menambahkan baris check_nrpe pada commands.cfg karena penulis menggunakan perintah check_nrpe untuk
melakukan pengecekan. Berikut ini adalah baris perintah untuk check_nrpe, nrpe.cfg, windows-server.cfg dan linux-server.cfg.
Check_nrpe
Windows-server.cfg check_nrpe
define
command{ command_name
check_nrpe command_line USER1check_nrpe -H HOSTADDRESS -c
ARG1 }
deFINe command{ command_name checkCPU
command_line USER1check_nrpe -H HOSTADDRESS -c -a check_nrpe
define
command{ command_name
check_nrpe command_line USER1check_nrpe –H HOSTADDRESS -c
ARG1 }
warn=80 crit=90 time=5m time=1m time=30s }
define
command{ command_name CheckDriveSize
command_line USER1check_nrpe -H HOSTADDRESS -c -a MinWarn=ARG1 MinCrit=ARG2 CheckAll FilterType=FIXED
}
define
command { command_name CheckMEM
command_line check_nrpe -H HOSTADDRESS -p 5666 -c CheckMEM -a MaxWarn=ARG1 MaxCrit=ARG2 ShowAll type=page
}
define
command { command_name CheckUpTime
command_line check_nrpe -H HOSTADDRESS -p 5666 -c CheckUpTime -a MinWarn=ARG1 MinCrit=ARG2
}
define
command { command_name CheckServiceState
command_line check_nrpe -H HOSTADDRESS -p 5666 -c CheckServiceState -a CheckAll exclude=ARG1 exclude=ARG2
}
define
command { command_name CheckProcState
command_line check_nrpe -H HOSTADDRESS -p 5666 -c CheckProcState -a ARG1=started ARG2=started}
Linux-server.cfg
define
command { command_name check_load
command_line check_nrpe -H HOSTADDRESS -p 5666 -c check_load }
define
command { command_name check_users
command_line check_nrpe -H HOSTADDRESS -p 5666 -c check_users
}
define
command { command_name check_sda1
command_line check_nrpe -H HOSTADDRESS -p 5666 -c check_sda1
}
define
command { command_name check_zombie_procs
command_line check_nrpe -H HOSTADDRESS -p 5666 -c check_procs
}
define
command { command_name check_total_procs
command_line check_nrpe -H HOSTADDRESS -p 5666 -c check_procs
}
4.4.2.1.4 Konfigurasi NRPE.cfg