visualblind - 2012-06-13

Nagex Installation Guide
06.07.12

Travis Runyard
travisrunyard@gmail.com

Prerequisites:

-MySQL
-PHP 4.x+
-Nagios 3.x+ (enable event handlers in nagios.cfg)
-A web server/Apache

1) Create web-accessible directory
mkdir /var/www/nagex

2) Untar this project
tar -xzvf nagex.tar.gz

3) Put nagex.php and images folder in /var/www/nagex

4) Create the database

mysql -u root -ppassword

mysql> create database nagex;

5) Create the database user
mysql> use mysql;
mysql> grant all privileges on nagex.* to nagex@'localhost' identified by 'secret';
mysql> flush privileges;
mysql> exit

6) Import the SQL tables

mysql -u root -ppassword nagex < nagex_structure.sql

7) Copy the event handlers

mkdir /usr/local/nagios/libexec/eventhandlers

cp ~/update-nagex /usr/local/nagios/libexec/eventhandlers/

cp ~/update-nagex-host /usr/local/nagios/libexec/eventhandlers/

8) Set the permissions

chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

chmod 755 /usr/local/nagios/libexec/eventhandlers/*

9) Add the commands into commands.cfg

# 'update-nagex' service update command deinition
    define command{
    command_name    update-nagex
    command_line    /usr/local/nagios/libexec/eventhandlers/update-nagex $HOSTNAME$ "$HOSTALIAS$" "$SERVICEDISPLAYNAME$" $SERVICESTATE$ "$LONGDATETIME$"
    }

    # 'update-nagex-host' host update command deinition
    define command{
    command_name    update-nagex-host
    command_line    /usr/local/nagios/libexec/eventhandlers/update-nagex-host $HOSTNAME$ "$HOSTALIAS$" $HOSTSTATE$ "$LONGDATETIME$"
    }

10) Update service/host definitions with event_handler

        define service{
    host_name           somehost
    check_command       check_nrpe!CheckServiceState -a service
    service_description Some Service
    max_check_attempts  4
    event_handler       update-nagex
    }

define host{
    use             windows-server
    host_name       EXCH1
    alias           Exchange Server
    address         100.10.111.222
    event_handler   update-nagex-host
    }

If you have any trouble configuring Nagios with event handlers, I suggest you familiarize yourself with the documentation
http://nagios.sourceforge.net/docs/nagioscore/3/en/toc.html

11) Navigate to the frontend webpage
http://somehost/nagex/nagex.php
In order for data to populate, the event_handler needs to be executed which means hosts/services need to change states into soft or hard.
A quick and easy way is to disconnect the network connection on your nagios box and wait 15 minutes. If you don't want to do that then
you can manually insert data into the tables, so here's some commands http://www.pantz.org/software/mysql/mysqlcommands.html

 

Last edit: visualblind 2012-06-13