Steps to configure Nagios 4 on Ubuntu 14.04 LTS
1. Go to Ubuntu
Home > Type Terminal in the search box > Open Terminal.
2. After opening
the Terminal type the following commands below:-
$ sudo apt-get
update
$ sudo apt-get
upgrade
$ sudo apt-get
install \
> wget \
>
build-essential \
> apache2 \
> apache2-utils
\
> php5-gd \
> libgd2-xpm-dev
\
>
libapache2-mod-php5 \
> postfix
$ sudo useradd
--system --home /usr/local/nagios -M nagios
$ sudo groupadd
--system nagcmd
$ sudo usermod -a
-G nagcmd nagios
$ sudo usermod -a
-G nagcmd www-data
$ cd /tmp
$ tar -xzvf
nagios-4.0.6.tar.gz
$ tar -xzvf
nagios-plugins-2.0.tar.gz
$ cd nagios-4.0.6/
$ sudo ./configure
\
>
--with-nagios-group=nagios \
>
--with-command-group=nagcmd \
>
--with-mail=/usr/sbin/sendmail \
>
--with-httpd_conf=/etc/apache2/conf-available
General
Options:
-------------------------
Nagios executable: nagios
Nagios user/group: nagios,nagios
Command user/group: nagios,nagcmd
Event Broker: yes
Install ${prefix}: /usr/local/nagios
Install ${includedir}: /usr/local/nagios/include/nagios
Lock file: ${prefix}/var/nagios.lock
Check result directory: ${prefix}/var/spool/checkresults
Init directory: /etc/init.d
Apache conf.d directory: /etc/apache2/conf-available
Mail program: /usr/sbin/sendmail
Host OS: linux-gnu
IOBroker Method: epoll
Web Interface Options:
------------------------
HTML URL: http://localhost/nagios/
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP):
Review the options above for accuracy
$ sudo make all
$ sudo make install
$ sudo make
install-init
$ sudo make
install-config
$ sudo make
install-commandmode
$ sudo make
install-webconf
$ sudo cp -R
contrib/eventhandlers/ /usr/local/nagios/libexec/
$ sudo chown -R
nagios:nagios /usr/local/nagios/libexec/eventhandlers
$ sudo
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
$ sudo ln -s
/etc/init.d/nagios /etc/rcS.d/S99nagios
$ cd ..
$ cd
nagios-plugins-2.0/
$ sudo ./configure
\
>
--with-nagios-user=nagios \
>
--with-nagios-group=nagios \
>
--enable-perl-modules \
>
--enable-extra-opts
$ sudo make
$ sudo make install
$ sudo a2enmod cgi
$ sudo htpasswd -c
/usr/local/nagios/etc/htpasswd.users nagiosadmin
$ sudo vi
/etc/apache2/sites-enabled/000-default.conf
After entering the VIM Editor the editing instructions are below:
press a Append text following current cursor position
press A Append text to the end of current line
press i Insert text before the current cursor position
press I Insert text at the beginning of the cursor line
press o Open up a new line following the current line and add text there
press O Open up a new line in front of the current line and add text there
press :wq to save & quit
press :q! to quit with out saving
Include conf-available/nagios.conf
Insert the above line into VIM Editor and quit with saving.
$ sudo service
apache2 restart
$ sudo service
nagios start