Nagios from sources debian 7

From VoIPmonitor.org
Revision as of 14:04, 23 October 2014 by Petr.halounek (talk | contribs)
Jump to navigation Jump to search

steps for debian-wheezy

Download and compile latest nagios from http://sourceforge.net/projects/nagios/files/:

cd /usr/src
wget http://sourceforge.net/projects/nagios/files/nagios-4.x/nagios-4.0.8/nagios-4.0.8.tar.gz/download -O nagios-4.0.8.tar.gz
tar -xzf nagios-4.0.8.tar.gz
apt-get install -y apache2 libapache2-mod-php5 build-essential libgd2-xpm-dev libssl-dev
cd nagios-4.0.8
./configure --exec-prefix=/usr/local/nagios/ --prefix=/usr/local/nagios/ --with-nagios-user=nagios --with-nagios-group=nagios --with-command-user=nagios --with-command-group=nagcmd

groupadd -g 9000 nagios
groupadd -g 9001 nagcmd
useradd -u 9000 -g nagios -G nagcmd -d /usr/local/nagios -c 'Nagios Admin' nagios
adduser www-data 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


Download and compile latest nagios plugins from: http://www.nagios.org/download/plugins

cd /usr/src
wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
tar -xzf nagios-plugins-2.0.3.tar.gz
cd nagios-plugins-2.0.3/
./configure --with-nagios-user=nagios --with-nagios-group=nagios  --with-openssl=/usr/bin/openssl --enable-perl-modules --enable-libtap
make
make install

Change startup options for nagios vim /etc/init.d/nagios //add following lines after # Short-Description ... line

# Default-start: 2 3 4 5
# Default-Stop:

Change nagios setting for voipmonitor

vim /usr/local/nagios/etc/nagios.cfg

Add this line:

cfg_file=/usr/local/nagios/etc/objects/vm.cfg

/etc/init.d/nagios restart

Run commands

chmod +x /etc/init.d/nagios
update-rc.d nagios defaults

Install nagios dependences

apt-get install -y nagios-nrpe-plugin

To create privileges for www-data to restart nagios (to reload config from voipmonitor gui)////

chown www-data -R /var/lib/nagios3/spool/checkresults
chown -R nagios:www-data /usr/local/nagios/bin/nagios
chown -R www-data /usr/local/nagios/var/spool/checkresults
chown www-data:nagioscmd /usr/local/nagios/var/rw/nagios.cmd
apt-get install sudo

vim /etc/sudoers //add line www-data after root .. line

root    ALL=(ALL:ALL) ALL
www-data ALL=(ALL) NOPASSWD: /usr/bin/killall, /usr/local/nagios/bin/nagios
...

in GUI Settings->Systemconfiguration->:

Enable nagios: TRUE
Nagios user: nagios
Path to nagios binary: /usr/local/nagios/bin/nagios
Path to nagios.cfg: /usr/local/nagios/etc/objects/nagios.cfg
Path to vm.cfg: /usr/local/nagios/etc/objects/vm.cfg 
Path to status.dat: /var/cache/nagios3/status.dat
Command which reload config: /usr/bin/killall -HUP nagios
run sudo before reload command: TRUE


source: http://midactstech.blogspot.cz/2013/09/how-to-install-nagios-on-debian-wheezy.html