an ugly patch to allow macros in icon_image
Andreas Ericsson
ae at op5.se
Wed Dec 29 09:50:15 CET 2004
Mark D. Anderson wrote:
> This is an ugly fix to an ugly workaround, so I'm not
> submitting a real patch....
>
> nagios does not currently support extinfo icons that
> will appear in the status page and go somewhere arbitrary.
> Right now, they are just eye candy for a hard-coded
> link in status, and no link at all in extinfo.
>
> at least, that is the current design -- but an ugly workaround
> is to put something like this in the object definition:
>
> define serviceextinfo {
> service_description My Service
> host_name myhost
> icon_image invisible.gif' border="0"></a><a
> href="/nagiosgraph/show.cgi?host=myhost&service=My+Service"
> border="0"><img src='/nagios/images/logos/graph.gif
> }
>
> which takes advantage of knowing exactly how icon_image will be used,
> so that it can close off the already opened img tag with an invisible
> gif.
>
You still haven't told me what version of Nagios you're seeing this on.
It would help immensely.
> Now that gets ugly for multiple services, so then you
> want macros expanded in icon_image, and they aren't
> currently.
>
> So i wacked status.c and extinfo.c
>
Use the diff command to produce patches if you want them included in the
nagios code-base.
> status.c:
> /* was:
> printf("<IMG SRC='%s%s'
> BORDER=0 WIDTH=%d HEIGHT=%d
> ALT='%s'
> TITLE='%s'>",url_logo_images_path,temp_serviceextinfo->icon_image,STATUS_ICON_WIDTH,ST\
> ATUS_ICON_HEIGHT,(temp_serviceextinfo->icon_image_alt==NULL)?"":temp_serviceextinfo->icon_image_alt,(temp_serviceextinfo->icon_image_alt==NULL)?"":temp_serviceextinfo->icon_image_alt);
> */
> printf("<IMG SRC='%s",
> url_logo_images_path);
> print_extra_service_url(temp_service->host_name,
> temp_service->description,
> temp_serviceextinfo->icon_image);
> printf("' BORDER=0 WIDTH=%d
> HEIGHT=%d ALT='%s'
> TITLE='%s'>",STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,(temp_serviceextinfo->icon_image_alt==NULL)?"":temp_\
> serviceextinfo->icon_image_alt,(temp_serviceextinfo->icon_image_alt==NULL)?"":temp_serviceextinfo->icon_image_alt);
>
> extinfo.c:
>
> if(temp_serviceextinfo->icon_image!=NULL)
> {
> /* was:
> printf("<img src='%s%s'
> border=0 alt='%s'
> title='%s'><BR
> CLEAR=ALL>",url_logo_images_path,temp_serviceextinfo->icon_image,(temp_serviceextinfo->i\
> con_image_alt==NULL)?"":temp_serviceextinfo->icon_image_alt,(temp_serviceextinfo->icon_image_alt==NULL)?"":temp_serviceextinfo->icon_image_alt);
> */
> printf("<img
> src='%s",url_logo_images_path);
> print_extra_service_url(host_name,
> service_desc,
> temp_serviceextinfo->icon_image);
> printf("' border=0 alt='%s'
> title='%s'><BR
> CLEAR=ALL>",(temp_serviceextinfo->icon_image_alt==NULL)?"":temp_serviceextinfo->icon_image_alt,(temp_servi\
> ceextinfo->icon_image_alt==NULL)?"":temp_serviceextinfo->icon_image_alt);
> }
>
>
> I'm sure my mailer will mangle the above even worse;
> but it was ugly already....
>
> -mda
>
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Lead Developer
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
More information about the Developers
mailing list