[icinga-checkins] icinga.org: icinga-core/mfriedrich/core: classic-ui: fixed wrong color in histogram and trends for unknown/unreachable #2042

git at icinga.org git at icinga.org
Tue Nov 15 18:58:54 CET 2011


Module: icinga-core
Branch: mfriedrich/core
Commit: a29d240677173b042ee9095785af38becb9dd676
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=a29d240677173b042ee9095785af38becb9dd676

Author: Ricardo Bartels <ricardo at bitchbrothers.com>
Date:   Thu Oct 27 00:16:13 2011 +0200

classic-ui: fixed wrong color in histogram and trends for unknown/unreachable #2042

refs: #2024

* color change to pink
* also fixed the image for service trends (rectangle ecloses all bars)

---

 Changelog                 |    1 +
 cgi/histogram.c           |   15 +++++++--------
 cgi/trends.c              |   20 ++++++++++----------
 html/images/trendssvc.png |  Bin 15354 -> 12683 bytes
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/Changelog b/Changelog
index 2458a5f..688d4d0 100644
--- a/Changelog
+++ b/Changelog
@@ -39,6 +39,7 @@ FIXES
 * core: plug memory leak in downtimes comment add (Dorian Guillois) #1979
 
 * classic ui: fix for Classic-UI displays bad timeperiods #1989
+* classic ui: fixed wrong color in histogram and trends for unknown/unreachable #2042
 
 * idoutils: host state change last_hard_state overrides last_state, last_hard_state always -1 #1932
 
diff --git a/cgi/histogram.c b/cgi/histogram.c
index c670b23..1ff071c 100644
--- a/cgi/histogram.c
+++ b/cgi/histogram.c
@@ -187,10 +187,10 @@ gdImagePtr histogram_image = 0;
 int color_white = 0;
 int color_black = 0;
 int color_red = 0;
-int color_darkred = 0;
 int color_green = 0;
 int color_yellow = 0;
-int color_orange = 0;
+int color_pink = 0;
+int color_darkpink = 0;
 int color_lightgray = 0;
 FILE *image_file = NULL;
 
@@ -625,11 +625,10 @@ int main(int argc, char **argv) {
 			color_white = gdImageColorAllocate(histogram_image, 255, 255, 255);
 			color_black = gdImageColorAllocate(histogram_image, 0, 0, 0);
 			color_red = gdImageColorAllocate(histogram_image, 255, 0, 0);
-			color_darkred = gdImageColorAllocate(histogram_image, 128, 0, 0);
 			color_green = gdImageColorAllocate(histogram_image, 0, 128, 0);
 			color_yellow = gdImageColorAllocate(histogram_image, 176, 178, 20);
-			color_orange = gdImageColorAllocate(histogram_image, 255, 100, 25);
-			color_lightgray = gdImageColorAllocate(histogram_image, 192, 192, 192);
+			color_pink = gdImageColorAllocate(histogram_image, 224, 102, 255);
+			color_darkpink = gdImageColorAllocate(histogram_image, 166, 75, 189);
 
 			/* set transparency index */
 			gdImageColorTransparent(histogram_image, color_white);
@@ -1731,7 +1730,7 @@ void graph_all_histogram_data(void) {
 				pixel_y = (int)(tsdata[actual_bucket].host_unreachable * y_scaling_factor);
 
 				if (current_bucket > 0 && !(last_pixel_y == 0 && pixel_y == 0))
-					draw_line(DRAWING_X_OFFSET + pixel_x - (int)x_scaling_factor, DRAWING_Y_OFFSET - last_pixel_y, DRAWING_X_OFFSET + pixel_x, DRAWING_Y_OFFSET - pixel_y, color_darkred);
+					draw_line(DRAWING_X_OFFSET + pixel_x - (int)x_scaling_factor, DRAWING_Y_OFFSET - last_pixel_y, DRAWING_X_OFFSET + pixel_x, DRAWING_Y_OFFSET - pixel_y, color_pink);
 
 				last_pixel_y = pixel_y;
 
@@ -1830,7 +1829,7 @@ void graph_all_histogram_data(void) {
 				pixel_y = (int)(tsdata[actual_bucket].service_unknown * y_scaling_factor);
 
 				if (current_bucket > 0 && !(last_pixel_y == 0 && pixel_y == 0))
-					draw_line(DRAWING_X_OFFSET + pixel_x - (int)x_scaling_factor, DRAWING_Y_OFFSET - last_pixel_y, DRAWING_X_OFFSET + pixel_x, DRAWING_Y_OFFSET - pixel_y, color_orange);
+					draw_line(DRAWING_X_OFFSET + pixel_x - (int)x_scaling_factor, DRAWING_Y_OFFSET - last_pixel_y, DRAWING_X_OFFSET + pixel_x, DRAWING_Y_OFFSET - pixel_y, color_pink);
 
 				last_pixel_y = pixel_y;
 
@@ -1925,7 +1924,7 @@ void graph_all_histogram_data(void) {
 	snprintf(temp_buffer, sizeof(temp_buffer) - 1, "%s:", (display_type == DISPLAY_SERVICE_HISTOGRAM) ? "Unknown" : "Unreachable");
 	temp_buffer[sizeof(temp_buffer)-1] = '\x0';
 	string_width = gdFontSmall->w * strlen(temp_buffer);
-	gdImageString(histogram_image, gdFontSmall, DRAWING_X_OFFSET + DRAWING_WIDTH + 15, DRAWING_Y_OFFSET - DRAWING_HEIGHT + ((string_height + 5) * 3), (unsigned char *)temp_buffer, (display_type == DISPLAY_SERVICE_HISTOGRAM) ? color_orange : color_darkred);
+	gdImageString(histogram_image, gdFontSmall, DRAWING_X_OFFSET + DRAWING_WIDTH + 15, DRAWING_Y_OFFSET - DRAWING_HEIGHT + ((string_height + 5) * 3), (unsigned char *)temp_buffer, color_darkpink);
 
 	state3_avg = (double)((double)state3_sum / (double)total_buckets);
 	snprintf(temp_buffer, sizeof(temp_buffer) - 1, "%5lu %5lu %5lu   %.2f", state3_min, state3_max, state3_sum, state3_avg);
diff --git a/cgi/trends.c b/cgi/trends.c
index 6d2019e..4614714 100644
--- a/cgi/trends.c
+++ b/cgi/trends.c
@@ -163,11 +163,11 @@ gdImagePtr trends_image = 0;
 int color_white = 0;
 int color_black = 0;
 int color_red = 0;
-int color_darkred = 0;
 int color_green = 0;
 int color_darkgreen = 0;
 int color_yellow = 0;
-int color_orange = 0;
+int color_pink = 0;
+int color_darkpink = 0;
 FILE *image_file = NULL;
 
 int image_width = 900;
@@ -750,11 +750,11 @@ int main(int argc, char **argv) {
 		color_white = gdImageColorAllocate(trends_image, 255, 255, 255);
 		color_black = gdImageColorAllocate(trends_image, 0, 0, 0);
 		color_red = gdImageColorAllocate(trends_image, 255, 0, 0);
-		color_darkred = gdImageColorAllocate(trends_image, 128, 0, 0);
 		color_green = gdImageColorAllocate(trends_image, 0, 210, 0);
 		color_darkgreen = gdImageColorAllocate(trends_image, 0, 128, 0);
 		color_yellow = gdImageColorAllocate(trends_image, 176, 178, 20);
-		color_orange = gdImageColorAllocate(trends_image, 255, 100, 25);
+		color_pink = gdImageColorAllocate(trends_image, 224, 102, 255);
+		color_darkpink = gdImageColorAllocate(trends_image, 166, 75, 189);
 
 		/* set transparency index */
 		gdImageColorTransparent(trends_image, color_white);
@@ -2090,7 +2090,7 @@ void graph_trend_data(int first_state, int last_state, time_t real_start_time, t
 			height = 40;
 			break;
 		case AS_HOST_UNREACHABLE:
-			color_to_use = color_darkred;
+			color_to_use = color_pink;
 			height = 20;
 			break;
 		case AS_SVC_OK:
@@ -2102,7 +2102,7 @@ void graph_trend_data(int first_state, int last_state, time_t real_start_time, t
 			height = 60;
 			break;
 		case AS_SVC_UNKNOWN:
-			color_to_use = color_orange;
+			color_to_use = color_pink;
 			height = 40;
 			break;
 		case AS_SVC_CRITICAL:
@@ -2686,8 +2686,8 @@ void draw_time_breakdowns(void) {
 		gdImageString(trends_image, gdFontSmall, drawing_x_offset - 10 - (gdFontSmall->w * 4), drawing_y_offset + 25, (unsigned char *)"Down", color_red);
 
 		get_time_breakdown_string(total_time, time_unreachable, "Unreachable", &temp_buffer[0], sizeof(temp_buffer));
-		gdImageString(trends_image, gdFontSmall, drawing_x_offset + drawing_width + 20, drawing_y_offset + 45, (unsigned char *)temp_buffer, color_darkred);
-		gdImageString(trends_image, gdFontSmall, drawing_x_offset - 10 - (gdFontSmall->w * 11), drawing_y_offset + 45, (unsigned char *)"Unreachable", color_darkred);
+		gdImageString(trends_image, gdFontSmall, drawing_x_offset + drawing_width + 20, drawing_y_offset + 45, (unsigned char *)temp_buffer, color_darkpink);
+		gdImageString(trends_image, gdFontSmall, drawing_x_offset - 10 - (gdFontSmall->w * 11), drawing_y_offset + 45, (unsigned char *)"Unreachable", color_darkpink);
 
 		get_time_breakdown_string(total_time, time_indeterminate, "Indeterminate", &temp_buffer[0], sizeof(temp_buffer));
 		gdImageString(trends_image, gdFontSmall, drawing_x_offset + drawing_width + 20, drawing_y_offset + 65, (unsigned char *)temp_buffer, color_black);
@@ -2702,8 +2702,8 @@ void draw_time_breakdowns(void) {
 		gdImageString(trends_image, gdFontSmall, drawing_x_offset - 10 - (gdFontSmall->w * 7), drawing_y_offset + 25, (unsigned char *)"Warning", color_yellow);
 
 		get_time_breakdown_string(total_time, time_unknown, "Unknown", &temp_buffer[0], sizeof(temp_buffer));
-		gdImageString(trends_image, gdFontSmall, drawing_x_offset + drawing_width + 20, drawing_y_offset + 45, (unsigned char *)temp_buffer, color_orange);
-		gdImageString(trends_image, gdFontSmall, drawing_x_offset - 10 - (gdFontSmall->w * 7), drawing_y_offset + 45, (unsigned char *)"Unknown", color_orange);
+		gdImageString(trends_image, gdFontSmall, drawing_x_offset + drawing_width + 20, drawing_y_offset + 45, (unsigned char *)temp_buffer, color_darkpink);
+		gdImageString(trends_image, gdFontSmall, drawing_x_offset - 10 - (gdFontSmall->w * 7), drawing_y_offset + 45, (unsigned char *)"Unknown", color_darkpink);
 
 		get_time_breakdown_string(total_time, time_critical, "Critical", &temp_buffer[0], sizeof(temp_buffer));
 		gdImageString(trends_image, gdFontSmall, drawing_x_offset + drawing_width + 20, drawing_y_offset + 65, (unsigned char *)temp_buffer, color_red);
diff --git a/html/images/trendssvc.png b/html/images/trendssvc.png
index aca0c7a..867b8aa 100644
Binary files a/html/images/trendssvc.png and b/html/images/trendssvc.png differ





More information about the icinga-checkins mailing list