2017/11/08

How to Install Nagios 4 on CentOS 6.x

[Install Package]
yum update
yum install  -y nano openssl-devel git
yum install -y httpd php
yum install -y gcc glibc glibc-common
yum install -y gd gd-devel

[Create User and Group]
useradd nagios
passwd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache

[Download and Install Nagios]
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.2.4.tar.gz
tar xzvf nagios-4.2.4.tar.gz
cd nagios-4.2.4
./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
service httpd restart
chkconfig --add httpd
chkconfig httpd on
cd ..

[Download and Install Nagios Plugins]
wget http://www.nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
tar xzvf nagios-plugins-2.2.1.tar.gz
cd nagios-plugins-2.2.1
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios restart
chkconfig --add nagios
chkconfig nagios on
cd..

[Download and Install NRPE]
wget --no-check-certificate http://sourceforge.net/projects/nagios/files/nrpe-3.x/nrpe-3.2.1/nrpe-3.2.1.tar.gz
tar xzvf nrpe-3.2.1.tar.gz
cd nrpe-3.2.1
./configure --enable-command-args
make all
make install
make install-config
make install-plugin
make install-daemon

echo >> /etc/services
echo '# Nagios services' >> /etc/services
echo 'nrpe    5666/tcp' >> /etc/services
make install-init

nano /usr/local/nagios/etc/nrpe.cfg
allowed_hosts=127.0.0.1,192.168.xx.xx
start nrpe
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1

nano /etc/sysconfig/selinux
SELINUX=disabled

沒有留言:

張貼留言