statusmap patch reflects service status

Dan Barber danb at mojolin.com
Tue Sep 23 19:04:03 CEST 2003


Hello all,

Here is a patch to statusmap.c which will refelect the status of services
in the background color.  IE, the background color will change to yellow
if there are any service warnings.  The word "Up" will remain green as
long as connectivity is still good.

Here's the patch... should be a simple:
copy patch to cgi dir in your nagios source directory:  nagios-1.1/cgi
patch -p0 < patch_file.diff
recompile and reinstall or just copy the new statusmap.cgi to your working
cgi-bin

Thanks go to Jason Woodward (http://jaos.org) for the coding.

The patch (patch_file.diff):

--- statusmap.c 2002-10-25 04:58:17.000000000 +0000
+++ modified_statusmap.c  2003-09-23 10:54:06.000000000 +0000
@@ -2882,8 +2882,23 @@
      temp_hoststatus=find_hoststatus(temp_host->name);
      if(temp_hoststatus==NULL)
        bgcolor=color_lightgrey;
-     else if(temp_hoststatus->status==HOST_DOWN ||
temp_hoststatus->status==HOST_UNREACHABLE)
+     else if(temp_hoststatus->status==HOST_DOWN ||
temp_hoststatus->status==HOST_UNREACHABLE ||
+       (
+         (
+           get_servicestatus_count(temp_host->name,SERVICE_CRITICAL)
+           + get_servicestatus_count(temp_host->name,SERVICE_UNREACHABLE)
+           + get_servicestatus_count(temp_host->name,SERVICE_HOST_DOWN)
+         ) > 0
+       )
+     )
        bgcolor=color_lightred;
+     else if(
+       (
+         get_servicestatus_count(temp_host->name,SERVICE_WARNING)
+         + get_servicestatus_count(temp_host->name,SERVICE_UNKNOWN)
+       ) > 0
+     )
+       bgcolor=color_yellow;
      else
        bgcolor=color_lightgreen;


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list