Warning: Division by zero in /var/www/sysinfo.io/wp-content/plugins/accelerated-mobile-pages/includes/vendor/amp/includes/sanitizers/class-amp-img-sanitizer.php on line 146
Nagex – Nagios Intranet Dashboard
Categories: LinuxMonitoring

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

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$"

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
event_handler update-nagex-host

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


Still doesn’t work?

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

Disqus Comments Loading...

Recent Posts

Bittorrent IP Blocklists

In addition to using a VPN service, as an extra precaution I've been using the blocklist feature of my bittorrent… Read More

October 26, 2019 3:31 pm

FreeNAS Error Creating Pool

command '('gpart', 'create', '-s', 'gpt', '/dev/da8')' returned non-zero exit status 1. If you get this error while trying to create… Read More

June 7, 2019 3:44 pm

Change Grub Default Boot Entry on Linux Mint

I'm dual booting Windows and Linux Mint on my laptop. The grub default is to boot into Linux Mint, however… Read More

April 23, 2019 7:45 pm

How to Reset Secure Channel On Active Directory Domain Controller

When you're a little too careless about virtualizing your domain controllers, cloning, migrating, backing up and restoring, returning from vacation… Read More

April 21, 2019 8:14 am

Run Systemd Script Before System Shutdown

I tried to retain the NGINX FastCGI cache and have it persist across system reboots instead of being ephemeral by… Read More

April 20, 2019 10:14 am

Learn Systemctl Usage to Manage Systemd Service in Linux

Systemd is new service manager for Linux. It's a replacement for all previous init systems (SysV/SysVinit & Ubuntu's Upstart) and… Read More

April 20, 2019 7:55 am