The default Nagios menu allows you to view network outage, host based problems, or service based problems, but only one of these types of problems at a time. The Tactical Overview screen will display the numbers of all three types of problems in a summary format, but not the actual problems within each type. To view the problems, you are still required to click on network outages, hosts or services to see the actual list of problems. To present a list of all problems, I wrote SMWW - Show Me What's Wrong.
SMWW is a user interface screen that uses the standard Nagios modules to query Nagios about any current problems, and then display the 3 problem types on the same screen.
The left hand side of the screen displays the standard Nagios menu bar. The right side of the screen is used to display any problems detected.
At the top of the problem display area, the network problems (if any) are displayed.
Below the network problems, hosts that are down are displayed if they are not located in a network path that is blocked by an outage shown in the network problems section.
Beneath the host problem section, SMWW displays the services that are down, as long as the host they are located on is not listed in the hosts section above, or the host is not located in a network path that is blocked by an outage shown in the network problems section.
The resulting display shows the current problems in a hierarchical manner, assuming that the proper network configuration has been entered into the Nagios configuration files. Even if the network data is missing, the host and services status areas will still continue to display the correct data.
The code the SMWW is comprised of 2 small files: smww.php and smww.cgi.
#!/bin/sh ### ### SMWW - Show Me Whats Wrong Ver 1.2 ### by John Tysko, firstname.lastname@example.org ### update 2014/06/05 servicestatustypes changed from 16 to 28 ### ### uses standad nagios interface to display 3 sections - ### network problems ### host problems ### services problems (not on a host that is down) ### BINDIR=`dirname $0` REQUEST_METHOD="GET" export REQUEST_METHOD $BINDIR/outages.cgi | sed -e '1,$s/Network Outages/SMWW/' QUERY_STRING='hostgroup=all&style=hostdetail&hoststatustypes=4&hostprops=42&noheader' export QUERY_STRING $BINDIR/status.cgi | grep -v '^Cache-Control:' | grep -v '^Pragma: no-cache' | \ grep -v '^Refresh: ' | grep -v '^Last-Modified' | grep -v '^Expires:' | grep -v '^Content-type:' QUERY_STRING='host=all&type=detail&servicestatustypes=28&hoststatustypes=3&serviceprops=42&noheader' export QUERY_STRING $BINDIR/status.cgi | grep -v '^Cache-Control:' | grep -v '^Pragma: no-cache' | grep -v '^Refresh: ' | \ grep -v '^Last-Modified' | grep -v '^Expires:' | grep -v '^Content-type:'
The installation of SMWW is trivial. You can cut and paste the code shown above, or right click on the download links here for smww.php and smww.cgi. Place the smww.php that into the nagios/share directory, and the smww.cgi file into the nagios/sbin directory. Remember to make the cgi file executable.
You can point your browser at
http//MY.SERVER/nagios/smww.php to display the screen
with frames, but your could also use
http//MY.SERVER/nagios/cgi-bin/smww.cgi for browsers that do not use frames.
If you want to use point and click on the left menu bar of Nagios to access SMWW, one logical place to link it in is the "Problems" header line. Currently, this just displays the same information as the host selection, so changing it will not delete any functionality.
Edit the side.php file in nagios/share directory (after making a backup copy, of course) and change
the part of the Problems line that looks like: