Nagios 4 Setup

I’ve been busy attempting to install Nagios 4 on a fresh install of CentOS 7 on a Hyper V machine. I’ve tried this install now at least 6 times failing with different errors every single time and even resorted to Nagios for help.

Well I’ve finally have gotten Nagios 4 to work with the help of Nagios Support and these were the steps that I took to complete it.

The Orange text are commands to input into CentOS. I used a minimal install of CentOS.

The first problem I always ran into is that CentOS wasn’t online. I took these steps to resolve it  then I ran the commands below

yum install wget
yum install nano

Net tools isn’t required but I find it useful for troubleshooting network issues so I installed it anyways.

yum install net-tools

If installing on a Raspberry PI , I found I had to install these tools as well.

yum install wzip
yum install make

SELINUX:

setenforce 0
nano /etc/selinux/config

change enforcing -> disabled, save and close.

INSTALL PRE-REQS:

yum install httpd php php-cli gcc glibc glibc-common gd gd-devel net-snmp openssl-devel wget unzip -y
useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache

DOWNLOAD & INSTALL NAGIOS:

cd /tmp
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz
wget http://www.nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz
tar zxf nagios-4.1.1.tar.gz
tar zxf nagios-plugins-2.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
service httpd start
service nagios start

PLUGINS:

cd /tmp/nagios-plugins-2.1.1
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl
make all
make install
service nagios restart

POSSIBLE ERRORS:
Can’t access web page? Check firewalld and at port 80 through.
firewall-cmd –zone=public –add-port=80/tcp –permanent
firewall-cmd –reload

Still can’t access web page? Check IPV6 listening in the apache configuration.
modify /etc/httpd/conf/httpd.conf
Listen 0.0.0.0:80
service httpd restart

Leave a Reply

Your email address will not be published. Required fields are marked *