Monday, August 15, 2016

Install Nagios Remote Plugin Executor di ubuntu server 14.04

Bismillah...

NRPE atau Nagios Remote Plugin Executor  adalah  tools yang di gunakan untuk mengeksekusi nagios plugin di remote client system  , dengan tools ini dan nagios plugin kita bisa mengetahui free disk , system load , total process dari server yang kita monitor  contoh diagram cara kerja NRPE  nrpe

berikut langkah memasang NRPE dengan beberapa plugin nagios di ubuntu 14.04 Lts,

Install NRPE dan Nagios Plugin
root@ubuntu:/etc# apt-get install nagios-nrpe-server nagios-plugins
The following extra packages will be installed:
libarchive13 libgmp10 libgssglue1 libldb1 liblzo2-2 libnet-snmp-perl
libnettle4 libperl5.18 libsensors4 libsmbclient libsnmp-base libsnmp30
libtalloc2 libtdb1 libtevent0 libtirpc1 libwbclient0 nagios-plugins-basic
nagios-plugins-common nagios-plugins-standard python-crypto python-ldb
python-samba python-talloc python-tdb rpcbind samba-common samba-common-bin
samba-libs smbclient snmp whois
Suggested packages:
lrzip libcrypt-des-perl libdigest-hmac-perl libio-socket-inet6-perl
lm-sensors snmp-mibs-downloader nagios3 icinga nagios-plugins-contrib
postfix sendmail-bin exim4-daemon-heavy exim4-daemon-light python-crypto-dbg
python-crypto-doc heimdal-clients cifs-utils
The following NEW packages will be installed:
libarchive13 libgmp10 libgssglue1 libldb1 liblzo2-2 libnet-snmp-perl
libnettle4 libperl5.18 libsensors4 libsmbclient libsnmp-base libsnmp30
libtalloc2 libtdb1 libtevent0 libtirpc1 libwbclient0 nagios-nrpe-server
nagios-plugins nagios-plugins-basic nagios-plugins-common
nagios-plugins-standard python-crypto python-ldb python-samba python-talloc
python-tdb rpcbind samba-common samba-common-bin samba-libs smbclient snmp
whois
0 upgraded, 34 newly installed, 0 to remove and 132 not upgraded.
Need to get 10.2 MB of archives.
After this operation, 47.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Konfigurasi NRPE

edit file nrpe.cfg
root@ubuntu:/etc# pico /etc/nagios/nrpe.cfg

search dengan menggunakan Ctrl+W  " allowed_hosts= " , kemudian tambahkan ip server nagios nya

nrpe

kemudian check command dari nrpe nya , sesuaikan dengan server yang akan di monitor,misal pada disk kita bisa chek dengan fdisk -l , kemudian tentukan partisi mana yang akan di monitor
root@ubuntu:/etc# fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006c35e
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 23437311 11717632 82 Linux swap / Solaris
/dev/sda2 23439358 209713151 93136897 5 Extended
/dev/sda5 23439360 29296639 2928640 83 Linux
/dev/sda6 29298688 209713151 90207232 83 Linux


root@ubuntu:/etc# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 85G 77G 4,1G 95% /
none 4,0K 0 4,0K 0% /sys/fs/cgroup
udev 3,0G 4,0K 3,0G 1% /dev
tmpfs 597M 500K 597M 1% /run
none 5,0M 0 5,0M 0% /run/lock
none 3,0G 0 3,0G 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/sda5 2,7G 754M 1,8G 30% /boot
root@ubuntu:/etc#

nrpe-1

misal jika ingin monitor partisi swap tinggal tambahkan baris berikut,
command[check_swap]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda1

Start/Restart NRPE
root@ubuntu:/etc# service nagios-nrpe-server restart 
* Stopping nagios-nrpe nagios-nrpe [ OK ]
* Starting nagios-nrpe nagios-nrpe [ OK ]
root@ubuntu:/etc#

Konfigurasi Server Nagios

tambahkan commad check_nrpe di command.cfg nagios (di kasus saya, saya mengunakan nagios core Version 4.0.8 ) ,
root@serveraldy:~# pico /usr/local/nagios/etc/objects/commands.cfg
kemudian tambahkan baris berikut
define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
}
terakhir tambahkan service yang akan di monitor
# OPen Library #
###############################################################
define host{
use linux-server
host_name openlibrary.assyifa
alias openlibrary.assyifa
address 192.168.223.10
contacts nagiosadmin
contact_groups admins
max_check_attempts 5
check_period 24x7
notification_interval 15
first_notification_delay 0
notification_period 24x7
notification_options d,u,r,f,s
notifications_enabled 1
check_interval 5
icon_image
icon_image_alt
vrml_image
}
define service{
use local-service
host_name openlibrary.assyifa
service_description PING
contact_groups admins
check_command check_ping!100.0,20%!500.0,60%
notifications_enabled 1
}
define service{
use local-service
host_name openlibrary.assyifa
service_description SSH
#max_check_attempts 5
#check_interval 1
#retry_interval 1
#contacts nagiosadmin
#contact_groups admins
notifications_enabled 1
check_command check_ssh
}
define service{
use local-service
host_name openlibrary.assyifa
service_description HTTP
contact_groups admins
check_command check_http
notifications_enabled 1
}
define service{
use local-service
host_name openlibrary.assyifa
service_description Root Partition
contact_groups admins
check_command check_nrpe!check_hda1
}
define service{
use local-service
host_name openlibrary.assyifa
service_description Total Processes
contact_groups admins
check_command check_nrpe!check_total_procs
}
define service{
use generic-service
host_name openlibrary.assyifa
service_description Current Load
contact_groups admins
check_command check_nrpe!check_load
}
define service{
use local-service
host_name openlibrary.assyifa
service_description Swap Usage
contact_groups admins
check_command check_nrpe!check_swap
}
define service{
use generic-service
host_name openlibrary.assyifa
service_description Zombie
contact_groups admins
check_command check_nrpe!check_zombie_procs
}

restart service nagios
root@serveraldy:~# service nagios restart
Running configuration check...
Stopping nagios:. done.
Starting nagios: done.
root@serveraldy:~#

berikut tampilan hasil nya

Selection_137

semoga bermanfaat , selamat mencoba :)

referensi :

http://tecadmin.net/install-nrpe-on-ubuntu/#

 

No comments:

Post a Comment