here are some patches (all rolled together unfortunately) that provide the
following changes:
cleans up graph layout with multi-parent objects. the original code
created multiple upstream spots and propogated that throught the rest of
the graph.
adds some extra coloring for hosts that are sick (up but have some
fail/warning services), or waiting (up but have uknown/pending services).
the names and colors are certainly open to critique. i like to be able to
look at the statusmap and have things not be green if there is something
to look at.
adds a sort_order tag to let you control how things sort for display.
currently only hosts have it, but it would be trivial to add to services
as well if wanted. basically the sort number is the primary key and
hostname is the secondary key. if you don't specifiy a sort order it is
the same as before. i just use simple numbers like:
10 switches
20 routers
30 term servers
100 servers
200 clients
feedback or inclusion in cvs would be great.
diff -u -r nagios-2.0b1/cgi/statusmap.c nagios-2.0b1.spire/cgi/statusmap.c
--- nagios-2.0b1/cgi/statusmap.c 2004-11-05 21:44:12.000000000 -0800
+++ nagios-2.0b1.spire/cgi/statusmap.c 2005-01-08 17:39:05.000000000 -0800
@@ -165,6 +165,7 @@
int color_green=0;
int color_lightgreen=0;
int color_blue=0;
+int color_lightblue=0;
int color_yellow=0;
int color_orange=0;
int color_grey=0;
@@ -1934,8 +1935,18 @@
status_color=color_red;
}
else if(temp_hoststatus->status==HOST_UP){
- strncpy(temp_buffer,"Up",sizeof(temp_buffer));
- status_color=color_green;
+ if (get_servicestatus_count(name,SERVICE_CRITICAL) > 0 || get_servicestatus_count(name, SERVICE_WARNING) > 0) {
+ strncpy(temp_buffer, "Sick", sizeof(temp_buffer));
+ status_color=color_orange;
+ }
+ else if(get_servicestatus_count(name,SERVICE_PENDING) > 0 || get_servicestatus_count(name, SERVICE_UNKNOWN) > 0) {
+ strncpy(temp_buffer, "Waiting", sizeof(temp_buffer));
+ status_color=color_orange;
+ }
+ else {
+ strncpy(temp_buffer,"Up",sizeof(temp_buffer));
+ status_color=color_green;
+ }
}
else if(temp_hoststatus->status==HOST_PENDING){
strncpy(temp_buffer,"Pending",sizeof(temp_buffer));
@@ -2168,6 +2179,7 @@
color_green=gdImageColorAllocate(map_image,0,175,0);
color_lightgreen=gdImageColorAllocate(map_image,210,255,215);
color_blue=gdImageColorAllocate(map_image,0,0,255);
+ color_lightblue=gdImageColorAllocate(map_image,210,210,255);
color_yellow=gdImageColorAllocate(map_image,255,255,0);
color_orange=gdImageColorAllocate(map_image,255,100,25);
@@ -2544,7 +2556,7 @@
for(temp_host=host_list;temp_host!=NULL;temp_host=temp_host->next){
- if(is_host_immediate_child_of_host(parent,temp_host)==TRUE)
+ if(is_host_primary_immediate_child_of_host(parent,temp_host)==TRUE)
child_width+=max_child_host_drawing_width(temp_host);
}
@@ -2693,7 +2705,7 @@
/* get the total number of immediate children to this host */
- immediate_children=number_of_immediate_child_hosts(parent);
+ immediate_children=number_of_primary_immediate_child_hosts(parent);
/* bail out if we're done */
if(immediate_children==0)
@@ -2716,7 +2728,7 @@
if(temp_hostextinfo==NULL)
continue;
- if(is_host_immediate_child_of_host(parent,temp_host)==TRUE){
+ if(is_host_primary_immediate_child_of_host(parent,temp_host)==TRUE){
/* get drawing width of child host */
this_drawing_width=max_child_host_drawing_width(temp_host);
@@ -2796,7 +2808,7 @@
int translated_y=0;
/* get the total number of immediate children to this host */
- immediate_children=number_of_immediate_child_hosts(parent);
+ immediate_children=number_of_primary_immediate_child_hosts(parent);
/* bail out if we're done */
if(immediate_children==0)
@@ -2818,7 +2830,7 @@
if(temp_hostextinfo==NULL)
continue;
- if(is_host_immediate_child_of_host(parent,temp_host)==TRUE){
+ if(is_host_primary_immediate_child_of_host(parent,temp_host)==TRUE){
/* get drawing width of child host */
this_drawing_width=max_child_host_drawing_width(temp_host);
@@ -2884,7 +2896,12 @@
else if(temp_hoststatus->status==HOST_DOWN || temp_hoststatus->status==HOST_UNREAC
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: joey@clean.q7.com