Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Advertise on LowEndTalk.com
Nagios Core 4.0.1 installation on Ubuntu 12.04
New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

Nagios Core 4.0.1 installation on Ubuntu 12.04

nagios 4

This is a guide on installing the latest Nagios Core (4.0.1) on Ubuntu 12.04. Nagios is an open source computer system monitoring, network monitoring and infrastructure monitoring software application. Nagios offers monitoring and alerting services for servers, switches, applications, and services. It alerts the users when things go wrong and alerts them a second time when the problem has been resolved. The version in the Ubuntu repositories is quite old, it is still the in the 3 branch. This guide helps to fix that by using the latest Nagios version.

This tutorial was written and testen on a DigitalOcean VPS. If you use this link you get $10 credit free and you sponsor me ass well

You can find more information about Nagios on the official website: http://www.nagios.org/projects/nagioscore.

The description of Nagios Core from their website:

Nagios Core is the monitoring and alerting engine that serves as the primary application around which hundreds of Nagios projects are built. It serves as the basic event scheduler, event processor, and alert manager for elements that are monitored. It features several APIs that are used to extend its capabilities to perform additional tasks, is implemented as a daemon written in C for performance reasons, and is designed to run natively on Linux/*nix systems.

Contents

We are going to do the following:

  • Install required packages
  • Create the Nagios user
  • Download and Compile Nagios Core
  • Download and Compile the Nagios Plugins
  • Download and Compile NRPE
  • Setup the upstart script
  • Set up Apache

At the end of this tutorial you will have a fully up to date Nagios Core installation, with the latest plugins, the latest NRPE and the webinterface set up with authentication and ssl.

This was written and tested on Ubuntu 12.04, both 32 and 64 bit.

Note about currently installed Nagios versions

Make sure you remove all currently installed Nagios versions and packages. Better yet, start on a new empty server/vm.

Note about the plugins and NRPE

We are compiling the latest version of the plugins and NRPE on the Nagios Server. On the Nagios clients, you do not have to do this. The version of NRPE in the Ubuntu repositories works with this newer Nagios version. The same goes for the plugins.

Install required packages

Install the packages required for compilation, apache and mail functionality:

apt-get install apache2 libapache2-mod-php5 build-essential libgd2-xpm-dev libssl-dev sendmail-bin sendmail heirloom-mailx wget curl daemon apt-file libnet-snmp-perl libperl5.14 libpq5 libradius1 libsensors4 libsnmp-base libsnmp15 libtalloc2 libtdb1 libwbclient0 samba-common samba-common-bin smbclient snmp whois libmysqlclient15-dev

Create the Nagios user

Nagios runs as its own user and has its own groups. We need to create this user and groups. We also make sure the user Apache runs as can access the Nagios files by adding the www-data user to the nagios groups.

groupadd -g 3000 nagios
groupadd -g 3001 nagcmd
useradd -u 3000 -g nagios -G nagcmd -d /usr/local/nagios -c 'Nagios Admin' nagios
adduser www-data nagcmd

Download and Compile Nagios Core

If necessary, create /usr/local/src/nagios4:

mkdir -p /usr/local/src/nagios4

cd into /usr/local/src/nagios4:

cd /usr/local/src/nagios4

(I like to keep my source code and compilation files in one place).

Use wget to download the latest Nagios Core from sourceforge:

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.1.tar.gz

Extract it:

tar xf nagios-4.0.1.tar.gz
cd nagios-4.0.1

Create a few folders:

mkdir -p /usr/local/nagios/share/{stylesheets,images}

Now start the compilation process. First configure:

./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-user=nagios --with-command-group=nagcmd

Output should look like this:

 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.d
             Mail program:  /usr/bin/mail
                  Host OS:  linux-gnu

 Web Interface Options:
 ------------------------
                 HTML URL:  http://localhost/nagios/
                  CGI URL:  http://localhost/nagios/cgi-bin/
 Traceroute (used by WAP):  /usr/sbin/traceroute


Review the options above for accuracy.  If they look okay,
type 'make all' to compile the main program and CGIs.

Then the make process:

make all

Then the make install, for all the parts:

# This installs the main program, CGIs, and HTML files
make install

# This installs the init script in /etc/init.d
make install-init

# This installs *SAMPLE* config files in /usr/local/nagios/etc
make install-config

#This installs and configures permissions on the directory for holding the external command file
make install-commandmode

# This installs the Apache config file for the Nagios web interface
make install-webconf

# This installs the Exfoliation theme for the Nagios web interface
make install-exfoliation

If this all goes well, we can continue to the next part.

Read on over at Raymii.org: https://raymii.org/s/tutorials/Nagios_Core_4_Installation_on_Ubuntu_12.04.html

Quis custodiet ipsos custodes?
https://raymii.org - https://cipherli.st

Comments

  • said: ass well

    Ooooh, you said ass!

    But, a nice tutorial though :) Going to use this

  • 'Sponsor me ass', lol!

    C, Bash, Perl, Python, PHP, and JS hobbyist. VPS collector. Blog

  • @joelgm nice server status page you have. What kind of script is it?

    Quis custodiet ipsos custodes?
    https://raymii.org - https://cipherli.st
  • DroidzoneDroidzone Member
    edited November 2013

    @Raymii said:
    joelgm nice server status page you have. What kind of script is it?

    Custom project, based on a frontend using php/ajax, a backend using perl and sequential text files, and ssh key based monitoring of remote servers, along with netcat.

    C, Bash, Perl, Python, PHP, and JS hobbyist. VPS collector. Blog

  • @joelgm Are you planning on releasing it under a free/open source license?

    Quis custodiet ipsos custodes?
    https://raymii.org - https://cipherli.st
  • @Raymii said:
    joelgm Are you planning on releasing it under a free/open source license?

    It's already been released under a Creative Commons license.

    C, Bash, Perl, Python, PHP, and JS hobbyist. VPS collector. Blog

  • @joelgm said:
    It's already been released under a Creative Commons license.

    I somehow missed the huge Download link on the page.

    Quis custodiet ipsos custodes?
    https://raymii.org - https://cipherli.st
  • Thanks for the tutorial!

    Did they actually change something in this Nagios release?

    I recommend Prometeus, the best provider ever!

  • @mpkossen said:

    Thanks for the tutorial!

    Did they actually change something in this Nagios release?

    Whats new in Nagios Core 4?

    Major performance increaces:

    • Core Workers - Core workers are lightweight processes whose only job is to perform checks. Because they are smaller they spawn much more quickly than the the old process which forked the full Nagios Core. In addition, they communicate with the main Nagios Core process using in-memory techniques, eliminating the disk I/O latencies that could previously slow things down, especially in large installations.
    • Configuration Verification - Configuration verification has been improved so that each configuration item is verified only once. Previously configuration verification was an O(n2) operation.
    • Event Queue - The event queue now uses a data structure that has O(log n) insertion times versus the O(n) insertion time previously. This means that inserting events into the queue uses much less CPU than in Nagios Core 3.

    Other nice changes:
    - The host address attribute is now optional. The address attribute is set to the host name when it is absent. Most configurations set the host name attribute to the DNS host name making the address attribute redundant.
    - Both hosts and services now support an hourly value attribute. The hourly value attribute is intended to represent the value of a host or service to an organization and is used by the new minimum value contact attribute.
    - Services now support a parents attribute. A service parent performs a function similar to host parents and can be used in place of service dependencies in simple circumstances.

    No more embedded perl:
    - Embedded Perl - Embedded Perl has historically been the least tested and the most problem prone part of Nagios Core. A significant part of the issue is that there are so many versions of Perl available. The performance enhancements provided by the new worker process architecture make up for any performance loss due to the removal of embeddd Perl. In addition, the worker process architecture makes possible the implementation of a special purpose worker to persistently load and run Perl plugins. The following configuration variables that were related to embedded Perl have been obsoleted: use_embedded_perl_implicitly, enable_embedded_perl, p1_file.
    - This means my ESXi checks do not work anymore...

    See this page for the full listing of new stuff in Nagios 4: http://nagios.sourceforge.net/docs/nagioscore/4/en/whatsnew.html

    Quis custodiet ipsos custodes?
    https://raymii.org - https://cipherli.st
Sign In or Register to comment.