Difference between revisions of "Nagios FreeBSD"

From Teknologisk videncenter
Jump to: navigation, search
m (Step 5: Sample configuration)
m (Step 2: Install)
Line 79: Line 79:
 
You need a "nagios" user.
 
You need a "nagios" user.
 
Would you like me to create it [YES]? <input>YES</input>
 
Would you like me to create it [YES]? <input>YES</input>
 +
 
<notice> ..... Output omitted ..... </notice>
 
<notice> ..... Output omitted ..... </notice>
**********************************************************************
 
 
Enable Nagios in /etc/rc.conf with the following line:
 
 
  nagios_enable="YES"
 
 
Configuration templates are available in /usr/local/etc/nagios as
 
*.cfg-sample files.  Copy them to *.cfg files where required and
 
edit to suit your needs.  Documentation is available in HTML form
 
in /usr/local/www/nagios/docs.
 
 
If you don't already have a web server running, you will need to
 
install and configure one to finish off your Nagios installation.
 
When used with Apache, the following should be sufficient to publish
 
the web component of Nagios (modify the allow list to suit):
 
 
  <Directory /usr/local/www/nagios>
 
    Order deny,allow
 
    <notice>Deny</notice> from all
 
    Allow from 127.0.0.1
 
  </Directory>
 
 
  <Directory /usr/local/www/nagios/cgi-bin>
 
    Options ExecCGI
 
  </Directory>
 
 
  ScriptAlias /nagios/cgi-bin/ /usr/local/www/nagios/cgi-bin/
 
  Alias /nagios/ /usr/local/www/nagios/
 
  
**********************************************************************
 
 
===> Installing rc.d startup script(s)
 
===> Installing rc.d startup script(s)
 
===>  Registering installation for nagios-3.0.6
 
===>  Registering installation for nagios-3.0.6

Revision as of 08:17, 6 November 2009

Installation

Step 1: prepare

[root@sun ~]# <input>cd /usr/ports/net-mgmt/nagios</input>
[root@sun /usr/ports/net-mgmt/nagios]# <input>make</input>
===>  Vulnerability check disabled, database not found
===>  Found saved configuration for nagios-3.0.6
=> nagios-3.0.6.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch from http://nchc.dl.sourceforge.net/sourceforge/nagios/.
fetch: http://nchc.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.6.tar.gz: Moved Temporarily
<notice> ..... Output omitted ..... </notice>
*** Compile finished ***

If the main program and CGIs compiled without any errors, you
can continue with installing Nagios as follows (type 'make'
without any arguments for a list of all possible options):

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

  make install-init
     - This installs the init script in /usr/local/etc/rc.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/etc/nagios
       You'll have to modify these sample files before you can
       use Nagios.  Read the HTML documentation for more info
       on doing this.  Pay particular attention to the docs on
       object configuration files, as they determine what/how
       things get monitored!

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


*** Support Notes *******************************************

If you have questions about configuring or running Nagios,
please make sure that you:

     - Look at the sample config files
     - Read the HTML documentation
     - Read the FAQs online at http://www.nagios.org/faqs

before you post a question to one of the mailing lists.
Also make sure to include pertinent information that could
help others help you.  This might include:

     - What version of Nagios you are using
     - What version of the plugins you are using
     - Relevant snippets from your config files
     - Relevant error messages from the Nagios log file

For more information on obtaining support for Nagios, visit:

       http://www.nagios.org/support/

*************************************************************

Enjoy.

Step 2: Install

[root@sun /usr/ports/net-mgmt/nagios]# <input>make install</input>
===>  Installing for nagios-3.0.6
===>   nagios-3.0.6 depends on file: /usr/local/libexec/nagios/check_nagios - not found
<notice> ..... Output omitted ..... </notice>
===>   nagios-3.0.6 depends on shared library: ltdl.4 - found
pw: unknown group `nagios'
You need a "nagios" group.
Would you like me to create it [YES]? <input>YES</input>
Done.
pw: no such user `nagios'
You need a "nagios" user.
Would you like me to create it [YES]? <input>YES</input>

<notice> ..... Output omitted ..... </notice>

===> Installing rc.d startup script(s)
===>   Registering installation for nagios-3.0.6

Step 3: nagios daemon config

[root@sun /etc]# <input>echo 'nagios_enable="YES"' >> /etc/rc.conf</input>

Step 4: Apache configuration

[root@sun /etc]# <input>echo '   <Directory /usr/local/www/nagios>
     Order deny,allow
     <notice>Allow</notice> from all
     Allow from 127.0.0.1
   </Directory>

   <Directory /usr/local/www/nagios/cgi-bin>
     Options ExecCGI
   </Directory>

   ScriptAlias /nagios/cgi-bin/ /usr/local/www/nagios/cgi-bin/
   Alias /nagios/ /usr/local/www/nagios/
' >> /usr/local/etc/apache/httpd.conf</input>
[root@sun /etc]# <input>/usr/local/etc/rc.d/apache restart</input>
Stopping apache.
Waiting for PIDS: 969, 969, 969, 969.
Starting apache.

Step 5: Sample configuration

[root@sun ~]# <input>cd /usr/local/etc/nagios</input>
[root@sun /usr/local/etc/nagios]# <input>cp nagios.cfg-sample nagios.cfg</input>
[root@sun /usr/local/etc/nagios]# <input>cp resource.cfg-sample resource.cfg</input>
[root@sun /usr/local/etc/nagios]# <input>cp cgi.cfg-sample cgi.cfg</input>
[root@sun /usr/local/etc/nagios]# <input>cd objects</input>
[root@sun /usr/local/etc/nagios/objects]# <input>cp commands.cfg-sample commands.cfg</input>
[root@sun /usr/local/etc/nagios/objects]# <input>cp contacts.cfg-sample contacts.cfg</input>
[root@sun /usr/local/etc/nagios/objects]# <input>cp localhost.cfg-sample localhost.cfg</input>
[root@sun /usr/local/etc/nagios/objects]# <input>cp templates.cfg-sample templates.cfg</input>
[root@sun /usr/local/etc/nagios/objects]# <input>cp timeperiods.cfg-sample timeperiods.cfg</input>
[root@sun /usr/local/etc/nagios/objects]# <input>/usr/local/etc/rc.d/nagios start</input>
Performing sanity check of nagios configuration: OK
Starting nagios.

Step 6: First view in browser