Nagios FreeBSD

From Teknologisk videncenter
Revision as of 08:18, 6 November 2009 by Heth (talk | contribs) (Step 4: Apache configuration)
Jump to: navigation, search

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>
        Options None
        AllowOverride None
        Order allow,deny
        Allow from all
        AuthName "Nagios Access"
        Authtype Basic
        AuthUserFile /usr/local/etc/nagios/htpasswd.users
        Require valid-user
</Directory>

<Directory /usr/local/www/nagios/cgi-bin>
        Options ExecCGI
        AllowOverride None
        Order allow,deny
        Allow from all
        AuthName "Nagios Access"
        Authtype Basic
        AuthUserFile /usr/local/etc/nagios/htpasswd.users
        Require valid-user
</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