Installing prerequisites :
apt-get install gcc make binutils cpp libpq-dev libmysqlclient-dev libssl1.0.0 libssl-dev pkg-config libgd2-xpm-dev libgd-tools perl libperl-dev libnet-snmp-perl snmp apache2 libapache2-mod-php5 unzip
Obtaining Nagios Core & Nagios Plugins :
Last version is available here https://www.nagios.org/downloads
cd /usr/local/src/
wget -c nagios-downoad-url
wget -c nagios-plugings-url
Extracting the Nagios Core and Plugins source :
mkdir /usr/src/nagios4
cd /usr/src/nagios4/
tar -xzf /usr/local/src/nagios-4.1.1.tar.gz
tar -xzf /usr/local/src/nagios-plugins-2.1.1.tar.gz
Setting up users and Groups:
groupadd nagios
groupadd nagioscmd
useradd -g nagios -G nagioscmd -d /opt/nagios nagios
usermod -G nagioscmd www-data
Compiling and Installing Nagios Core 4 :
mkdir -p /opt/nagios /etc/nagios/ /var/nagios/
chown nagios:nagios /opt/nagios/ /etc/nagios/ /var/nagios/
cd nagios-4.1.1/
/configure --prefix=/opt/nagios --sysconfdir=/etc/nagios --localstatedir=/var/nagios --libexecdir=/opt/nagios/plugins --with-command-group=nagioscmd
make all
make install
make install-commandmode
make install-config
Compiling and Installing nagios plugins :
cd /usr/src/nagios4/nagios-plugins-2.1.1/
./configure --prefix=/opt/nagios --sysconfdir=/etc/nagios/ --localstatedir=/var/nagios/ --libexecdir=/opt/nagios/plugins/
make all
make install
Checking the Installation :
su -c '/opt/nagios/bin/nagios /etc/nagios/nagios.cfg' nagios
Nagios init script for Debian 8 'Jessie' :
cp /etc/init.d/skeleton /etc/init.d/nagios
vim /etc/init.d/nagios
"Add the following entries in the file "
DESC="Nagios"
NAME=nagios
DAEMON=/opt/nagios/bin/$NAME
DAEMON_ARGS="-d /etc/nagios/nagios.cfg"
PIDFILE=/var/nagios/$NAME.lock
Staring Nagios service and make it auto startup after booting :
chmod +x /etc/init.d/nagios
/etc/init.d/nagios start
insserv nagios
Installing web panel :
Installing web panel :
/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-enabled/nagios.conf
Enabling apache rewrite and cgi module :
sudo a2enmod rewrite
sudo a2enmod cgi
sudo service apache2 restart
/etc/init.d/nagios restart
/etc/init.d/apache2 restart
Set Nagios admin password :
htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
Access Nagios dashboard:
http://SERVER_IP_ADDRESS/nagios
Nice
ReplyDelete