Categories: Linux

Install Nagios di Centos 7

Salah satu software monitoring yang sering dipakai adalah nagios. Hal ini dikarenakan fitur dan plugin dari nagios sendiri yang cukup banyak, sehingga mencukupi kebutuhan pengguna.

Untuk instalasinya cukup mudah. Silahkan baca script di bawah ini. Jika ada pertanyaan, silahkan langsung tulis di komentar.

# http://www.unixmen.com/install-configure-nagios-4-centos-7/
#!/bin/sh
yum install gd gd-devel gcc glibc glibc-common wget
useradd -m nagios
passwd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache
wget -c https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz
wget -c http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz
tar xzf nagios-4.1.1.tar.gz
cd nagios-4.1.1
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
systemctl restart httpd
cd ..
tar xzf nagios-plugins-2.1.1.tar.gz
cd nagios-plugins-2.1.1
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
nano /usr/local/nagios/etc/objects/contacts.cfg
# ganti email default dengan email pribadi
systemctl restart httpd
systemctl start nagios
chkconfig --add nagios
chkconfig nagios on
echo "SELINUX=permissive" > /etc/selinux/config

# add centos monitoring target 
yum install nrpe nagios-plugins-all openssl
nano /etc/nagios/nrpe.cfg
# search for allowed_hosts and add nagios server ip behind the line
# ex: allowed_hosts=127.0.0.1 192.168.1.150
systemctl start nrpe
chkconfig nrpe on

# add ubuntu monitoring target 
apt-get install nagios-nrpe-server nagios-plugins
nano /etc/nagios/nrpe.cfg
# search for allowed_hosts and add nagios server ip behind the line
# ex: allowed_hosts=127.0.0.1 192.168.1.150
/etc/init.d/nagios-nrpe-server restart

# add target to nagios server
nano /usr/local/nagios/etc/nagios.cfg
# uncomment cfg_dir=/usr/local/nagios/etc/servers
mkdir /usr/local/nagios/etc/servers

# adding client config to nagios server
echo "define host{" >> /usr/local/nagios/etc/servers/ip-server.cfg
echo "use                             linux-server" >> /usr/local/nagios/etc/servers/ip-server.cfg
echo "host_name                       ip-server" >> /usr/local/nagios/etc/servers/ip-server.cfg
echo "alias                           ip-server" >> /usr/local/nagios/etc/servers/ip-server.cfg
echo "address                         ip-server" >> /usr/local/nagios/etc/servers/ip-server.cfg
echo "max_check_attempts              5" >> /usr/local/nagios/etc/servers/ip-server.cfg
echo "check_period                    24x7" >> /usr/local/nagios/etc/servers/ip-server.cfg
echo "notification_interval           30" >> /usr/local/nagios/etc/servers/ip-server.cfg
echo "notification_period             24x7" >> /usr/local/nagios/etc/servers/ip-server.cfg
echo "}" >> /usr/local/nagios/etc/servers/ip-server.cfg

systemctl restart nagios

Setelah instalasi di atas selesai, masuk ke http://ip-server/nagios dan masukkan
username: nagiosadmin
password: password yang dimasukkan setelah perintah htpasswd.

Untuk tampilan nagios dapat dilihat di bawah ini.

 

Tactical Monitoring Overview
Hosts
Map
Hosts Group Summary

 

Source: http://www.unixmen.com/install-configure-nagios-4-centos-7/

Akhmad Fakhoni Listiyan Dede

Share
Published by
Akhmad Fakhoni Listiyan Dede

Recent Posts

Mengimplementasikan AI untuk Melakukan Review pada Pull Request Github

Halo semua Github memiliki fitur terkait Pull Request yang cukup luar biasa, yaitu dapat melakukan…

6 months ago

Install kubernetes cluster using kubeadm

Hello everyone! 👋 Welcome to our step-by-step guide on using kubeadm to install Kubernetes. It's…

1 year ago

Meningkatkan Efisiensi Memory Proxmox Lebih dari 20%

Proxmox adalah hypervisor yang populer digunakan karena penggunaannya yang cukup simpel jika dibandingkan dengan hypervisor…

4 years ago

Longhorn Failed Upgrade from v0.8.1 to v1.0.0 caused by pv created before v0.6.2

This post is mirror of https://forums.rancher.com/t/failed-upgrade-from-v0-8-1-to-v1-0-0-caused-by-pv-created-before-v0-6-2/17586 I scale down all pods that has vpc to…

4 years ago

Cara Setup Network Ubuntu Server 18.04 pada Proxmox

Ubuntu Konfigurasi network pada Ubuntu Server 18.04 berbeda dengan ubuntu versi sebelumnya. Versi sebelumnya menggunakan…

5 years ago

VSCode Terminal Font Fix on MacOS

For detailed problems, see https://notulensiku.com/2019/02/fix-integrated-terminal-font-vscode/ To solve on mac, you need to install powerline fonts…

5 years ago