Advertisements

Nagex is a Nagios intranet dashboard project driven by event handlers which feeds data to a MySQL database. The PHP script pulls the data for your internal/external company users to view infrastructure status information without giving them access to the CGI interface. This project can be easily integrated inside of your existing intranet using a PHP include or iframe for a custom look and feel since it does not have navigation or links. It utilizes the $HOSTALIAS$ so users do not see internal server names. If you want to display information about every host/service checked by Nagios, simply define the event_handler in your host and service templates instead of individual host and service definitions.

 

Nagex was my November 2011 project and is a modified version of another project called Nagdash, which was originally developed by John Kenyon. His website is no longer functional and hasn’t responded to my emails. Hope he’s ok. I found the original project on the Nagios Exchange. Feel free to modify Nagex however you want, or leave a comment below ^_^

GNU General Public License – Version 3, 29 June 2007
http://www.gnu.org

nagex

The prerequisites are a Linux box running MySQL, PHP, Nagios and a web server like Apache (LAMP). The only downside to Nagex is the fact that it relies on Nagios host and service state changes before it writes values to the mysql database since it does not pull information directly from the cgi’s. 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 or whatever interval you have your host/service checks configured. If you can’t do this because you’re working in a production environment, then you can pre-populate the database by manually inserting data into the tables. My event handler shell script will update the data if it already exists instead of inserting new entries. Here is a great MySQL reference site: http://www.pantz.org/software/mysql/mysqlcommands.html

Advertisements

Iconsmind-Outline-Linux Download Nagex

Mirror 0 – Nagios Exchange
Mirror 1 – Sourceforge
Mirror 2 – Direct Link

Untar this project

[sourcecode language=”bash”]tar -xzvf nagex.tar.gz[/sourcecode]

Create a web-accessible directory

[sourcecode language=”bash”]mkdir /var/www/nagex[/sourcecode]

Directory placement

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

Create the database

[sourcecode language=”bash”]mysql -u root -ppassword
mysql> create database nagex;[/sourcecode]

Create the database user

[sourcecode language=”bash”]mysql> use mysql;
mysql> grant all privileges on nagex.* to [email protected]’localhost’ identified by ‘secret’;
mysql> flush privileges;
mysql> exit[/sourcecode]

Import the SQL schema dump

[sourcecode language=”bash”]mysql -u root -ppassword nagex < nagex_structure.sql[/sourcecode]

Copy the event handlers

[sourcecode language=”bash”]mkdir /usr/local/nagios/libexec/eventhandlers
cp ~/nagex/update-nagex /usr/local/nagios/libexec/eventhandlers/
cp ~/nagex/update-nagex-host /usr/local/nagios/libexec/eventhandlers/[/sourcecode]

Set permissions

[sourcecode language=”bash”]chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
chmod 755 /usr/local/nagios/libexec/eventhandlers/*[/sourcecode]

Add commands into commands.cfg

[sourcecode language=”bash”]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$"
}[/sourcecode]

Update service/host definitions with event_handler

[sourcecode language=”bash”]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
}[/sourcecode]

Modify nagex.php

Line 18, enter the password you’ve use to create the mysql user.

[sourcecode language=”bash”]$DBpassword = "secret";[/sourcecode]

Test out the web front end

http://yourhost/nagex/nagex.php

Still doesn’t work?

Contact me or leave a comment and I’ll do my best to help you

Advertisements
Page generated in 0.5953 seconds.
Advertisment ad adsense adlogger