TOTKat - TOT: The One True (prefixing a name),
			coined by The Gotdammerell for TOTKat, originally to distinguish herself from Kat Knight.
 

TOTKat: (hand coded) online journal of a girl geek since April 1999.
WARNING: contains personal opinions. A sense of perspective is required when reading.

     
   
   
   
   
   
   
   
   
   
     
   
   
   
   
   
   
   
   
   
   
   
     
   
   
   
   
   
   
   
   
   
   
   
   
   
   
 
  

Installing and configuring Nagios

This is specifically for a Solaris install (I've installed on Solaris 8, 9 and 10 now), but will probably work for most unixes.
Errors, omissions or questions, please mail to documentation@totkat.org.

|  [Preparation]  |  [Configure apache]  |
|  [Install Nagios]  |
|  [Configure host groups]  |  [Configure hosts]  |  [Configure contacts]  |
|  [Configure contact groups]  |  [Configure commands]  |  [Configure times]  |
|  [Configure dependencies]  |  [Configure escalations]  |  [Configure resources]  |
|   [Configure services]   |   [Configure mail alerts]  |   [Configure nagios]  |
|  [Status map]  |
|  [Testing]  |   [Troubleshooting]  |

Introduction

Nagios is the new name for NetSaint, a network/service monitoring tool. It was designed for Linux, but can be compiled and run perfectly well under any UNIX variant as far as I am aware. The monitoring daemon runs intermittent checks on hosts and services you specify. These check are performed by using external commands, "plugins", which return status information to Nagios. When problems are encountered, Nagios can send notifications out to administrative contacts in a variety of different ways (email, instant message, SMS, etc.). Current status information, historical logs, and reports can all be accessed via a web browser.

This installation method assumes an existing, working installation of apache. The guidelines are presented in the order in which it is logical, and sometimes essential, to proceed with the installation and configuration.

Preparation

Choose whether you want to use Nagios v1.3 or v2.0. There are pros and cons of both, but I would recommend v2.0(stable) as it is more mature, fixes some of the problems I had in 1.3, supports service groups as well as host groups and builds in a more forgiving way if you are missing pre-requisites for certain optional components.

Be root! Make sure anything you'd normally need for compiling and installing stuff is in the PATH and LD_LIBRARY_PATH variables. Plan where you want to install Nagios ($NAGIOSHOME) and make a map of your servers and services. Download this little lot and unzip them somewhere sensible, in my case /export/stage. You may already have some of these installed, but some will need (re-)configuring.

  • Boutell gd library
  • png library
  • jpeg library
  • zlib
  • Nagios core - v1.3
  • Nagios core - v2.0(stable)
  • Nagios plugins
  • basic icons
  • [There are some lovely extras you can try out, like graphing of historical data, but I've not had a chance to document any of them yet. Take a look here.]

    If you do not already have the gd, jpeg and png libraries installed, unpack them and install them. Most of those require a simple ./configure and then make and make install. They all contain basic instructions in the tarballs and are very simple to install. Just don't forget the make install-lib and make install-headers with the jpeg libraries, otherwise you'll just get cross when gd refuses to see the jpeg libraries.

    As with all guidelines, your mileage may vary. Use common sense, but if you do hit a wall there are resources on the web if you Google for "installing Nagios", or you could drop me an email: documentation@totkat.org and I may be able to help.

    [top]

    Configure apache

    The first thing, before installing Nagios, is to ensure that it is locked down to unwanted viewers and that apache knows where it is going to be installed. So, we need to edit apache's configuration, $APACHEHOME/conf/httpd.conf as follows. We need to add in the script directory for Nagios, making sure that it comes before your usual cgi-bin definition in the httpd.conf:-

       ScriptAlias /nagios/cgi-bin/ "$NAGIOSHOME/sbin/"
    
    Then specify the Nagios base directory after the ScriptAlias definition:-
       Alias /nagios/ "$NAGIOSHOME/share/"
    
    Finally, we protect the Nagios install by setting authorisation requirements in the httpd.conf:-
        <Directory "$NAGIOSHOME/sbin">
            AllowOverride AuthConfig
            order allow,deny
            allow from all
            Options ExecCGI
        </Directory>
    
        <Directory "$NAGIOSHOME/share">
            AllowOverride AuthConfig
            order allow,deny
            allow from all
            Options ExecCGI
        </Directory>
    
    and setting a username and password for those directories. Firstly create the .htaccess file in both $NAGIOSHOME/sbin and $NAGIOSHOME/share:-
       AuthName "Nagios Access"
       AuthType Basic
       AuthUserFile $NAGIOSHOME/etc/htpasswd.users
       require valid-user
    
    then run:-
       $APACHEHOME/bin/htpasswd -c $NAGIOSHOME/etc/htpasswd.users nagiosadmin 
    
    where nagiosadmin will be the username given access to Nagios. You will be asked for a password for that user.

    You can now restart apache for those changes to take effect.

    [top]

    Install Nagios

    Before installing Nagios, we need to create a user and group for the application:-

       groupadd nagios
       useradd -d $NAGIOSHOME -g nagios -s /bin/false -m nagios
    
    This will create the group and user "nagios", add the user to the group, create the home directory and Nagios base install directory and make sure that the user "nagios" cannot log in.

    From your staging directory, if you are sure that the jpeg, png and gd libraries are installed, linked and visible, you first need to configure the Nagios install. Now, to be absolutely certain that it knows where the gd libraries are, you will need to specify their location in the options.
      ./configure --prefix=$NAGIOSHOME --with-nagios-user=nagios --with-nagios-grp=nagios\
      --with-perlcache --enable-embedded-perl --with-gd-inc=/usr/local/include\
      --with-gd-lib=/usr/local/lib
    
    This should result in no errors, assuming that you have all of the pre-requisites fulfilled. So, now we can install Nagios from the staging area:-
      make all
      make install
      make install-config
      make install-init
    
    This makes the binaries, installs them, installs sample config files and init scripts into /etc/init.d Nagios now needs some check plugins installed, because as it stands and unconfigured, it isn't awfully useful yet. Head back to your staging directory, untar the plugins tarball and configure them:-
      ./configure --prefix=$NAGIOSHOME [--with-mysql=<mysql path>*] [--with-pgsql=<postgres path>**]
      make
      make install
      cd $NAGIOSHOME
      chown -R nagios:nagios libexec
      chown -R nagios:nagios share
    
    * - path to your local mysql if you want to use mysql checking from the Nagios host rather than using nrpe.
    ** - path to your local postgres if you want to use postgres checking from the Nagios host rather than using nrpe.

    [top]

    Configure Nagios

    You now need to configure Nagios before running it.

    Start her up and see what happens!

      $NAGIOSHOME/bin/nagios -v $NAGIOSHOME/etc/nagios.cfg
    

    ...to check that the .cfg files are good. Then
      $NAGIOSHOME/bin/nagios -d $NAGIOSHOME/etc/nagios.cfg
    

    to start and daemonise the process.

    Then point your browser at: http://yourserver/nagios/ and attempt to log in.

    [top]


    Mailto:webmaster@totkat.org

    Site statistics