Categories: Linux Monitoring

Nagex - Nagios Intranet Dashboard

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

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

 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 nagex@'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

Share
Disqus Comments Loading...

Recent Posts

VMWare vSphere 6.7 ESXTOP Output Garbled

If your VMWare vSphere 6.x environment command output of esxtop looks like a bunch of garbled gibberish (it's actually CSV… Read More

February 28, 2019 7:39 pm 19:39

How To Run RoboCopy Backup in Parallel

From time to time Windows Admins will surprise you with band-aid and bubble gum scripts, that's entirely expected I think.… Read More

February 28, 2019 12:20 pm 12:20

Windows 10 GodMode - The Ultimate Administrator Shortcut

Have you ever wondered what life might be like if the Windows 10 OS somehow had a single folder that… Read More

February 28, 2019 7:58 am 07:58

Samsung Galaxy S9 G960/G965 Stock ROM Firmware Download

There could be any number of reasons for needing to flash manufacturer stock OEM firmware on a Samsung Galaxy S9… Read More

January 24, 2019 7:42 am 07:42

Output IP Address with ipconfig Findstr Ethernet Adapter

How many times have you entered  ipconfig /all at the command line to return a single IP address, then have to strain… Read More

January 20, 2019 12:39 am 00:39

AWS SES Assistance in Enterprise Market - A Must Read

Designing e-mail solutions on a large scale can be a complex and costly challenge for a business: you need to… Read More

December 25, 2018 4:01 pm 16:01