Jump to content
Sign in to follow this  
Strabo

Nagios/Nagat Network Monitoring

Recommended Posts

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.

 

tar -zxvf nagios-1.2.tar.gz

 

Make a directory to install Nagios in

 

mkdir /usr/local/nagios

 

You need to add the user and group for nagios.

 

groupadd nagios

useradd -g nagios nagios

 

Now lets configure the application for installation.

 

./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:

 

*** 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:  http://localhost/nagios//

                  CGI URL:  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.

 

make all

make install

make install-init

make install-commandmode

make install-config

 

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

/usr/local/nagios/etc

 

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

 

cd /usr/local/nagios

chmod 777 etc -R (this is so nagat can write the config files)

 

Now you need to edit Apache.

 

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

 

Now insert the following under ScriptAlias.

 

#for nagios

ScriptAlias /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.

 

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

 

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.

 

vi /usr/local/nagios/share/.htaccess

vi /usr/local/nagios/sbin/.htaccess

 

Enter in this in the .htaccess file.

 

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"

 

tar -zxvf nagios-plugins-1.4.0alpha1.tar

 

Now lets compile the plugin.

 

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

 

make

make install

 

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

 

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

 

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

 

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

 

tar
  • Like 1

Share this post


Link to post
Share on other sites
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...