Saturday, July 27, 2019

Nagios Setup on centos

Prerequisites
yum install httpd php gcc glibc glibc-common gd gd-devel

Accounts:
/usr/sbin/useradd -m nagios
passwd nagios
/usr/sbin/groupadd nagcmd # Used for Web Interface
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache

Download source code
wget https://sourceforge.net/projects/nagios/files/nagios-4.x/nagios-4.1.1/nagios-4.1.1.tar.gz
wget http://www.nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz

Extract the Nagios source code tarball.
tar -xvzf nagios-4.1.1.tar.gz
cd nagios-4.1.1

Run the Nagios configure and compile source code
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode

vi /usr/local/nagios/etc/objects/contacts.cfg
Change email address assoicated with install

Nagios web config file

make install-webconf

nagiosadmin account for Nagios web interface

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

service httpd restart

Install the Nagios Plugins
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

Add Nagios services
chkconfig --add nagios
chkconfig nagios on

Verify the sample Nagios configuration files.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios start


Check SELinux
getenforce

Change to permissive mode.
setenforce 0

Modifiy /etc/selinux/config for system to remain in permission mode

OR  modifiy selinux permissions to allow nagios

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

Log into Nagios web interface
username: nagiosadmin
password: set with htpasswd util

http://localhost/nagios/

iptables
modify /etc/sysconfig/iptables to allow 80 & 443

No comments:

Post a Comment