Display hosts with WARNING/CRITICAL services in another color

Andreas Husch mail at andreashusch.de
Mon Oct 4 21:36:52 CEST 2004


Hi,
I wrote a simple two line patch for statusmap.cgi to display hosts with
services wich are in a warning or critical state in another color.

We use this for a central network monitoring display, so the admins can see
if a service on a host goes down too and not just if the physical machine
fails as in the "normal" statusmap.cgi.

Furthermore I changed the "HOST_UP" an "HOST_DOWN" colors (from lightred to
red, and from lightgreen to green) because of the higher conrasts on the
display.

I'll be happy if this could be useful for somebody else, but don't be to
hard to me, my C skills are as bad as my english knowledge ;)

Regards
Andreas

Diff to Nagios 1.2 statusmap.c file:

@@ -2889,9 +2889,21 @@ void draw_circular_layer_markup(host *pa
                        if(temp_hoststatus==NULL)
                                bgcolor=color_lightgrey;
                        else if(temp_hoststatus->status==HOST_DOWN ||
temp_hoststatus->status==HOST_UNREACHABLE)
-                               bgcolor=color_lightred;
+
+                               /* Ha, Original: bgcolor=color_lightred;*/
+                               bgcolor=color_red;
+
+                       /*Ha, Paint yellow background if one ore more
services on that host are CRITICAL */
+                       else if
(get_servicestatus_count(temp_host->name,SERVICE_CRITICAL)>0)
+                               bgcolor=color_yellow;
+
+                       /*Ha, Paint orange background if one ore more
services on that host are WARNING */
+                       else if
(get_servicestatus_count(temp_host->name,SERVICE_WARNING)>0)
+                               bgcolor=color_orange;
+
                        else
-                               bgcolor=color_lightgreen;
+                               /* Ha, Original: bgcolor=color_lightgreen;*/
+                               bgcolor=color_green;

                        /* fill slice with background color */
                        /* the fill function only works with coordinates
that are in bounds of the actual image */




BITBURGER BRAUEREI TH. SIMON GmbH
KIS/Systeme und Kommunikation, Service und Support/Andreas Husch
Römermauer 3, 54634 Bitburg
Tel. 06561 14-3540  Fax: 06561 14-83540
E-Mail: Andreas.Husch at bitburger.de
Besuchen Sie uns im Internet: <http://www.bitburger.de>





-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl




More information about the Developers mailing list