Compile and Install Nagios

  • Once each has completed downloading we will first extract Nagios Core
  • $ tar zxvf nagios-3.1.2.tar.gz
  • Move into the newly created directory when the extraction completes
  • $ cd nagios-3.1.2/
  • Now we can finally get to the cool stuff, run the configure script passing the name of the group we created earlier.
  • $ sudo ./configure --with-command-group=nagcmd
  • Output text from the configure command
  • *** Configuration summary for nagios 3.1.2 06-23-2009 ***
     
    General Options:
    -------------------------
    Nagios executable:  nagios
    Nagios user/group:  nagios,nagios
    Command user/group:  nagios,nagcmd
    Embedded Perl:  no
    Event Broker:  yes
    Install ${prefix}:  /usr/local/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:  /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):
     
    Review the options above for accuracy.  If they look okay,
    type 'make all' to compile the main program and CGIs.
  • If everything checks out ok, we’ll compile the nagios source now. This may take a few minutes depending on the speed of your computer.
  • $ sudo make all
  • The next step will be to install the binaries.
  • $ sudo make install
  • Output should resemble the text below
  • *** Main program, CGIs and HTML files installed ***You can continue with installing Nagios as follows (type 'make'
    without any arguments for a list of all possible options):
     
    make install-init
    - This installs the init script in /etc/init.d
     
    make install-commandmode
    - This installs and configures permissions on the
    directory for holding the external command file
     
    make install-config
    - This installs sample config files in /usr/local/nagios/etc
     
    make[1]: Leaving directory `/home/user/download/nagios-3.1.2'
  • Next we install the init script.
  • $ sudo make install-init
  • Output from the install-init command
  • /usr/bin/install -c -m 755 -d -o root -g root /etc/init.d
    /usr/bin/install -c -m 755 -o root -g root daemon-init /etc/init.d/nagios
     
    *** Init script installed ***
  • Next install is our sample configs.
  • $ sudo make install-config
  • Output from the install-config command
  • /usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc
    /usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc/objects
    /usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/nagios.cfg /usr/local/nagios/etc/nagios.cfg
    /usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/cgi.cfg /usr/local/nagios/etc/cgi.cfg
    /usr/bin/install -c -b -m 660 -o nagios -g nagios sample-config/resource.cfg /usr/local/nagios/etc/resource.cfg
    /usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/templates.cfg /usr/local/nagios/etc/objects/templates.cfg
    /usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/commands.cfg /usr/local/nagios/etc/objects/commands.cfg
    /usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/contacts.cfg /usr/local/nagios/etc/objects/contacts.cfg
    /usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/timeperiods.cfg /usr/local/nagios/etc/objects/timeperiods.cfg
    /usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/localhost.cfg /usr/local/nagios/etc/objects/localhost.cfg
    /usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/windows.cfg /usr/local/nagios/etc/objects/windows.cfg
    /usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/printer.cfg /usr/local/nagios/etc/objects/printer.cfg
    /usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/switch.cfg /usr/local/nagios/etc/objects/switch.cfg
     
    *** Config files installed ***
     
    Remember, these are *SAMPLE* config files.  You'll need to read
    the documentation for more information on how to actually define
    services, hosts, etc. to fit your particular needs.
  • Next install and set permissions on the external cmd directory.
  • $ sudo make install-commandmode
  • Output from the install-commandmode command
  • /usr/bin/install -c -m 775 -o nagios -g nagcmd -d /usr/local/nagios/var/rw
    chmod g+s /usr/local/nagios/var/rw
     
    *** External command directory configured ***
  • Now, we could run Nagios now.  However don’t run it just yet as we need to configure a couple things in the sample configuration files the install provided for us.

Pages: 1 2 3 4 5 6

Tags: