May 10, 2015

Ubuntu Server - Nagios Core

Assuming the server already pre-installed with the following :-

  • Ubuntu Server 14.04.1 LTS x64.
  • OpenSSH
  • Hostname : SVR01
  • Username : master

Follow these steps-by-steps :-

  1. sudo apt-get update
  2. sudo apt-get upgrade
  3. sudo /etc/network/interfaces
    • static
    • address 192.168.4.248
    • netmask 255.255.255.0
    • gateway 192.168.4.1
    • network 192.168.4.0
    • broadcast 192.168.4.255
    • dns-nameservers 202.188.0.133 202.188.1.5
  4. sudo apt-get install \
    • wget \
    • build-essential \
    • apache2 \
    • apache2-utils \
    • libapache2-mod-php5 \
    • php5-gd \
    • libgd2-xpm-dev \
    • postfix
  5. When prompted for email address and SMTP server, just use the desired email address (preferably an IT Admin email) and the SMTP server address.
  6. sudo useradd --system --home /usr/local/nagios -M nagios
  7. sudo groupadd --system nagcmd
  8. sudo usermod -a -G nagcmd nagios
  9. sudo usermod -a -G nagcmd www-data
  10. cd /tmp
  11. sudo wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.8.tar.gz (a newer version maybe available during this post, please check Nagios website).
  12. sudo wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz (a newer version of plugins maybe available during this post, please check Nagios website).
  13. tar -xzvf nagios-4.0.8.tar.gz
  14. tar -xzvf nagios-plugins-2.0.3.tar.gz
  15. cd nagios-4.0.8
  16. sudo ./configure \
    • --with-nagios-group=nagios\
    • --with-command-group nagcmd \
    • --with-mail=/usr/sbin/sendmail \
    • --with-httpd_conf=/etc/apache2/conf-available
  17. sudo make all
  18. sudo make install
  19. sudo make install-init
  20. sudo make install-config
  21. sudo make install-commandmode
  22. sudo make install-webconf
  23. sudo cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
  24. sudo chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
  25. sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (verify Nagios configuration is correct or not).
  26. sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
  27. cd ..
  28. cd nagios-plugins-2.0.3
  29. sudo ./configure \
    • --with-nagios-user=nagios \
    • --with-nagios-group=nagios \
    • --enable-perl-modules \
    • --enable-extra-opts
  30. sudo make
  31. sudo make install
  32. sudo a2enmod cgi
  33. sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin (when prompted for password, key-in your preferred password, this will be use during login to the Web GUI).
  34. sudo nano /etc/apache2/sites-enabled/000-default.conf
    • Type --> Include conf-available/nagios.conf
  35. sudo nano /etc/apache2/conf-available/fqdn.conf
    • Type --> SVR01 localhost
  36. sudo a2enconf fqdn
  37. sudo nano /usr/local/nagios/etc/objects/contacts.cfg
  38. sudo service apache2 restart
  39. sudo service nagios start
Now from another PC with Windows, open Internet Explorer :-
URL = http://192.168.4.248/nagios

When prompted for username and password :-
Username = master
Password = [the password you have specified earlier]

No comments:

Post a Comment