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.

 

 

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

Leave A Comment