Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Nagios/Nagat Network Monitoring
#1

We are going to install Nagios monitoring tool and Nagat for configuring the nagios sctuff. If you search Sourceforge you will see a few different nagat tools that users have written to do different stuff. I am also going to include the nrpe_nt executable, the wincheck_counter (this does command line perfmons on windows) and a vb script that does services up or down state. The great thing about Nagios is you can make your own Plugins for it etc...

 

This how-to requires apache and php to be installed and configured correctly!

 

Get nagios and decompress it.

 

Quote:tar -zxvf nagios-1.2.tar.gz
 

Make a directory to install Nagios in

 

Quote:mkdir /usr/local/nagios
 

You need to add the user and group for nagios.

 

Quote:groupadd nagiosuseradd -g nagios nagios
 

Now lets configure the application for installation.

 

Quote:./configure --prefix=/usr/local/nagios --with-cgiurl=/nagios/cgi-bin --with-htmurl=/nagios/ --with-nagios-user=nagios --with-nagios-grp=nagios
 

You should see this output:

 

Quote:*** Configuration summary for nagios 1.2 02-02-2004 ***: 

General Options:

-------------------------

        Nagios executable:  nagios

        Nagios user/group:  nagios,nagios

      Command user/group:  nagios,nagios

            Embedded Perl:  no

        Install ${prefix}:  /usr/local/nagios

                Lock file:  ${prefix}/var/nagios.lock

          Init directory:  /etc/rc.d/init.d

 

Web Interface Options:

------------------------

                HTML URL:  [/url]http://localhost/nagios//

                  CGI URL:  [url=http://localhost/nagios/cgi-bin/]http://localhost/nagios/cgi-bin/

Traceroute (used by WAP):  /bin/traceroute

 

External Data Routines:

------------------------

              Status data:  Default (text file)

              Object data:  Template-based (text file)

            Comment data:  Default (text file)

            Downtime data:  Default (text file)

          Retention data:  Default (text file)

          Peformance data:  Default (external commands)

      Extended info data:  Template-based (text file)

 

 

Review the options above for accuracy.  If they look okay,

type 'make all' to compile the main program and CGIs.

 

continue installation:

make all

make install

 

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/rc.d/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

      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!
 

Next you have to do the following as it states from the output above.

 

Quote:make allmake install

make install-init

make install-commandmode

make install-config
 

The command "make install-config" installs sample config scripts in

Quote:/usr/local/nagios/etc
 

You need to make the directory read write so you can edit the files with the Nagat configuratoin tool.

 

Quote:cd /usr/local/nagioschmod 777 etc -R (this is so nagat can write the config files)
 

Now you need to edit Apache.

 

Quote:vi /usr/local/apache/conf/httpd.conf
 

Now insert the following under ScriptAlias.

 

Quote:#for nagiosScriptAlias /nagios/cgi-bin/ /usr/local/nagios/sbin/

<Directory "/usr/local/nagios/sbin/">

    AllowOverride AuthConfig

    Options ExecCGI

    Order allow,deny

    Allow from all

</Directory>

                                                                           

Alias /nagios/ /usr/local/nagios/share/

<Directory "/usr/local/nagios/share">

    Options None

    AllowOverride AuthConfig

    Order allow,deny

    Allow from all

</Directory>

 

Alias /nagiosadmin/ /usr/local/apache/htdocs/nagat/

<Directory "/usr/local/apache/htdocs/nagat/">

    Options None

    AllowOverride AuthConfig

    Order allow,deny

    Allow from all

</Directory>
 

Now you can check the nagios config from the terminal. I like using the tool in Nagat that does the same thing so you can see it in a webpage.

 

Quote:/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
 

You can put security on each section of the reporting tool to limit access to it. This is stored in CFG.CGI file.

 

Quote:htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
 

Enter the password when asked. now lets put the .htaccess files in the directories for security.

 

Quote:vi /usr/local/nagios/share/.htaccessvi /usr/local/nagios/sbin/.htaccess
 

Enter in this in the .htaccess file.

 

Quote:AuthName "Nagios Access"AuthType Basic

AuthUserFile /usr/local/nagios/etc/htpasswd.users

require valid-user
 

Now it is time to install the nagios plugin so you can actually monitor stuff. These are some of the generic default monitoring scripts for like Oracle or cpu etc..

 

The app is "nagios-plugins-1.4.0alpha1.tar"

 

Quote:tar -zxvf nagios-plugins-1.4.0alpha1.tar
 

Now lets compile the plugin.

 

Quote:./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-cgiurl=/nagios/cgi-bin
 

OK you know the drill with make and make install.

 

Quote:makemake install
 

Now if you use Nagat you have to do chmod 777 on the directory with the executable.

 

Quote:chmod 777 /usr/local/nagios/var/rw/ -R
 

You need to do the same thing for hte nagios execuable too.

 

Quote:chmod 777 /usr/local/nagios/bin/ -R
 

Now lets install NRPE 2.0 so you can execute remote commands on another machine. nrpe-2.0.tar.gz

 

Quote:tar
Reply
#2
wow man nice write up, i been thinkin on install Nagios, Props to ya
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)