Page 1 of 1

[Nagios-devel] Patch: enable truecolor in statusmap.cgi and

Posted: Mon Feb 16, 2009 10:59 am
by Guest

--=-BquAfp688cfKMRNqtfie
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Example for cgi.cfg:

# STATUSMAP transparency index color.
# This r,g,b values sets the background color on the statusmap,
# so normal browsers that can't show real png transparency sets the
# desired color as background instead (to make it look pretty)
# default 255, 255, 255 (white)
#color_transparency_index_r=3D195
#color_transparency_index_g=3D215
#color_transparency_index_b=3D211




--=20
V=C3=A4nliga h=C3=A4lsningar / Best Regards
Mattias Ryrl=C3=A9n

__________________________
op5 AB
F=C3=B6rsta L=C3=A5nggatan 19
SE-413 27 G=C3=B6teborg
Mobil: +46 735-17 70 99
Support: +46 31-774 09 24
www.op5.com

--=-BquAfp688cfKMRNqtfie
Content-Disposition: attachment; filename="cgiutils.diff"
Content-Type: text/x-patch; name="cgiutils.diff"; charset="UTF-8"
Content-Transfer-Encoding: 7bit

--- tmp/nagios-3.0.5p1/cgi/cgiutils.c 2008-11-07 13:01:03.000000000 +0100
+++ nagios-3.0.5p1/cgi/cgiutils.c 2009-02-16 11:51:53.000000000 +0100
@@ -111,6 +111,10 @@
int default_statusmap_layout_method=0;
int default_statuswrl_layout_method=0;

+int color_transparency_index_r=255;
+int color_transparency_index_g=255;
+int color_transparency_index_b=255;
+
extern hostgroup *hostgroup_list;
extern contactgroup *contactgroup_list;
extern command *command_list;
@@ -189,6 +193,9 @@
normal_sound=NULL;

statusmap_background_image=NULL;
+ color_transparency_index_r=255;
+ color_transparency_index_g=255;
+ color_transparency_index_b=255;
statuswrl_include=NULL;

ping_syntax=NULL;
@@ -373,6 +380,15 @@
else if(!strcmp(var,"statusmap_background_image"))
statusmap_background_image=strdup(val);

+ else if(!strcmp(var,"color_transparency_index_r"))
+ color_transparency_index_r=atoi(val);
+
+ else if(!strcmp(var,"color_transparency_index_g"))
+ color_transparency_index_g=atoi(val);
+
+ else if(!strcmp(var,"color_transparency_index_b"))
+ color_transparency_index_b=atoi(val);
+
else if(!strcmp(var,"default_statusmap_layout"))
default_statusmap_layout_method=atoi(val);


--=-BquAfp688cfKMRNqtfie
Content-Disposition: attachment; filename="statusmap.diff"
Content-Type: text/x-patch; name="statusmap.diff"; charset="UTF-8"
Content-Transfer-Encoding: 7bit

--- tmp/nagios-3.0.5p1/cgi/statusmap.c 2008-11-07 13:01:03.000000000 +0100
+++ nagios-3.0.5p1/cgi/statusmap.c 2009-02-16 10:43:24.000000000 +0100
@@ -169,6 +169,10 @@
int color_orange=0;
int color_grey=0;
int color_lightgrey=0;
+int color_transparency_index=0;
+extern int color_transparency_index_r;
+extern int color_transparency_index_g;
+extern int color_transparency_index_b;

int show_all_hosts=TRUE;
char *host_name="all";
@@ -2104,7 +2108,7 @@
return ERROR;

/* allocate buffer for storing image */
- map_image=gdImageCreate(canvas_width,canvas_height);
+ map_image=gdImageCreateTrueColor(canvas_width,canvas_height);
if(map_image==NULL)
return ERROR;

@@ -2120,9 +2124,13 @@
color_blue=gdImageColorAllocate(map_image,0,0,255);
color_yellow=gdImageColorAllocate(map_image,255,255,0);
color_orange=gdImageColorAllocate(map_image,255,100,25);
+ color_transparency_index=gdImageColorAllocate(map_image,color_transparency_index_r,color_transparency_index_g,color_transparency_index_b);

/* set transparency index */
- gdImageColorTransparent(map_image,color_white);
+ gdImageColorTransparent(map_image,color_transparency_index);
+
+ /* set background */
+ gdImageFill(map_image, 0, 0, color_transparency_index);

/* make sure the graphic is interlaced */
gdImageInterlace(map_image,1);

--=-BquAfp688cfKMRNqtfie--






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]