Nagios 2.5 patch for variables to work with icon_image

Larry Low llow at infotelis.com
Wed Sep 6 17:44:29 CEST 2006


Modified below, had an extra %s in one of the printf's.

-----
Larry Low
infotelis

-----Original Message-----
From: Larry Low 
Sent: Thursday, August 31, 2006 2:16 PM
To: 'nagios-devel at lists.sourceforge.net'
Subject: Nagios 2.5 patch for variables to work with icon_image

statusmap.c probably also needs modified but haven't bothered with that
yet.




*** nagios-2.5/cgi/extinfo.c    2006-03-21 16:31:46.000000000 -0500
--- nagios-2.5.new/cgi/extinfo.c        2006-08-31 14:10:10.000000000
-0400
***************
*** 355,362 ****
                        if(display_type==DISPLAY_SERVICE_INFO){
 
temp_serviceextinfo=find_serviceextinfo(host_name,service_desc);
                                if(temp_serviceextinfo!=NULL){
!
if(temp_serviceextinfo->icon_image!=NULL)
!                                               printf("<img src='%s%s'
border=0 alt='%s' title='%s'><BR CLEAR=ALL>",ur
l_logo_images_path,temp_serviceextinfo->icon_image,(temp_serviceextinfo-
>icon_image_alt==NULL)?"":temp_serviceextinfo->
icon_image_alt,(temp_serviceextinfo->icon_image_alt==NULL)?"":temp_servi
ceextinfo->icon_image_alt);
 
if(temp_serviceextinfo->icon_image_alt!=NULL)
                                                printf("<font
size=-1><i>( %s )</i><font>\n",temp_serviceextinfo->icon_
image_alt);
 
if(temp_serviceextinfo->notes!=NULL)
--- 355,365 ----
                        if(display_type==DISPLAY_SERVICE_INFO){
 
temp_serviceextinfo=find_serviceextinfo(host_name,service_desc);
                                if(temp_serviceextinfo!=NULL){
!
if(temp_serviceextinfo->icon_image!=NULL) {
!                                               printf("<img
src='%s",url_logo_images_path);
!
print_extra_service_url(temp_serviceextinfo->host_name,temp_serviceexti
nfo->description,temp_serviceextinfo->icon_image);
!                                               printf("' border=0
alt='%s' title='%s'><BR CLEAR=ALL>",(temp_serviceext
info->icon_image_alt==NULL)?"":temp_serviceextinfo->icon_image_alt,(temp
_serviceextinfo->icon_image_alt==NULL)?"":temp_
serviceextinfo->icon_image_alt);
!                                       }
 
if(temp_serviceextinfo->icon_image_alt!=NULL)
                                                printf("<font
size=-1><i>( %s )</i><font>\n",temp_serviceextinfo->icon_
image_alt);
 
if(temp_serviceextinfo->notes!=NULL)
***************
*** 367,374 ****
                        if(display_type==DISPLAY_HOST_INFO){
 
temp_hostextinfo=find_hostextinfo(host_name);
                                if(temp_hostextinfo!=NULL){
!
if(temp_hostextinfo->icon_image!=NULL)
!                                               printf("<img src='%s%s'
border=0 alt='%s' title='%s'><BR CLEAR=ALL>",ur
l_logo_images_path,temp_hostextinfo->icon_image,(temp_hostextinfo->icon_
image_alt==NULL)?"":temp_hostextinfo->icon_imag
e_alt,(temp_hostextinfo->icon_image_alt==NULL)?"":temp_hostextinfo->icon
_image_alt);
 
if(temp_hostextinfo->icon_image_alt!=NULL)
                                                printf("<font
size=-1><i>( %s )</i><font>\n",temp_hostextinfo->icon_ima
ge_alt);
 
if(temp_hostextinfo->notes!=NULL)
--- 370,380 ----
                        if(display_type==DISPLAY_HOST_INFO){
 
temp_hostextinfo=find_hostextinfo(host_name);
                                if(temp_hostextinfo!=NULL){
!
if(temp_hostextinfo->icon_image!=NULL) {
!                                               printf("<img
src='%s",url_logo_images_path);
!
print_extra_host_url(temp_hostextinfo->host_name,temp_hostextinfo->icon
_image);
!                                               printf("' border=0
alt='%s' title='%s'><BR CLEAR=ALL>",(temp_hostextinf
o->icon_image_alt==NULL)?"":temp_hostextinfo->icon_image_alt,(temp_hoste
xtinfo->icon_image_alt==NULL)?"":temp_hostextin
fo->icon_image_alt);
!                                       }
 
if(temp_hostextinfo->icon_image_alt!=NULL)
                                                printf("<font
size=-1><i>( %s )</i><font>\n",temp_hostextinfo->icon_ima
ge_alt);
 
if(temp_hostextinfo->notes!=NULL)


*** nagios-2.5/cgi/status.c     2006-04-26 11:33:59.000000000 -0400
--- nagios-2.5.new/cgi/status.c 2006-08-25 11:29:01.000000000 -0400
***************
*** 1598,1604 ****
 
if(temp_hostextinfo->icon_image!=NULL){
                                                printf("<TD align=center
valign=center>");
                                                printf("<A
HREF='%s?type=%d&host=%s'>",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(tem
p_status->host_name));
!                                               printf("<IMG SRC='%s%s'
BORDER=0 WIDTH=%d HEIGHT=%d ALT='%s'
TITLE='%s'>",url_logo_images_path,temp_hostextinfo->icon_image,STATUS_IC
ON_WIDTH,STATUS_ICON_HEIGHT,(temp_hostextinfo->icon_image_alt==NULL)?"":
temp_hostextinfo->icon_image_alt,(temp_hostextinfo->icon_image_alt==NULL
)?"":temp_hostextinfo->icon_image_alt);
                                                printf("</A>");
                                                printf("</TD>\n");
                                                }
--- 1598,1606 ----
 
if(temp_hostextinfo->icon_image!=NULL){
                                                printf("<TD align=center
valign=center>");
                                                printf("<A
HREF='%s?type=%d&host=%s'>",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(tem
p_status->host_name));
!                                               printf("<IMG
SRC='%s",url_logo_images_path);
!
print_extra_host_url(temp_hostextinfo->host_name,temp_hostextinfo->icon_
image);
!                                               printf("' BORDER=0
WIDTH=%d HEIGHT=%d ALT='%s'
TITLE='%s'>",STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,(temp_hostextinfo->ico
n_image_alt==NULL)?"":temp_hostextinfo->icon_image_alt,(temp_hostextinfo
->icon_image_alt==NULL)?"":temp_hostextinfo->icon_image_alt);
                                                printf("</A>");
                                                printf("</TD>\n");
                                                }
***************
*** 1681,1687 ****
                                        printf("<TD ALIGN=center
valign=center>");
                                        printf("<A
HREF='%s?type=%d&host=%s",EXTINFO_CGI,DISPLAY_SERVICE_INFO,url_encode(te
mp_service->host_name));
 
printf("&service=%s'>",url_encode(temp_service->description));
!                                       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,STATUS_ICON_HEIGHT,(temp_serviceextinfo->icon_image_alt==NUL
L)?"":temp_serviceextinfo->icon_image_alt,(temp_serviceextinfo->icon_ima
ge_alt==NULL)?"":temp_serviceextinfo->icon_image_alt);
                                        printf("</A>");
                                        printf("</TD>\n");
                                        }
--- 1683,1691 ----
                                        printf("<TD ALIGN=center
valign=center>");
                                        printf("<A
HREF='%s?type=%d&host=%s",EXTINFO_CGI,DISPLAY_SERVICE_INFO,url_encode(te
mp_service->host_name));
 
printf("&service=%s'>",url_encode(temp_service->description));
!                                       printf("<IMG
SRC='%s",url_logo_images_path);
!
print_extra_service_url(temp_service->host_name,temp_service->descriptio
n,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_servi
ceextinfo->icon_image_alt==NULL)?"":temp_serviceextinfo->icon_image_alt)
;
                                        printf("</A>");
                                        printf("</TD>\n");
                                        }
***************
*** 2061,2067 ****
                                if(temp_hostextinfo->icon_image!=NULL){
                                        printf("<TD align=center
valign=center>");
                                        printf("<A
HREF='%s?type=%d&host=%s'>",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(tem
p_status->host_name));
!                                       printf("<IMG SRC='%s%s' BORDER=0
WIDTH=%d HEIGHT=%d ALT='%s'
TITLE='%s'>",url_logo_images_path,temp_hostextinfo->icon_image,STATUS_IC
ON_WIDTH,STATUS_ICON_HEIGHT,(temp_hostextinfo->icon_image_alt==NULL)?"":
temp_hostextinfo->icon_image_alt,(temp_hostextinfo->icon_image_alt==NULL
)?"":temp_hostextinfo->icon_image_alt);
                                        printf("</A>");
                                        printf("</TD>\n");
                                        }
--- 2065,2073 ----
                                if(temp_hostextinfo->icon_image!=NULL){
                                        printf("<TD align=center
valign=center>");
                                        printf("<A
HREF='%s?type=%d&host=%s'>",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(tem
p_status->host_name));
!                                       printf("<IMG
SRC='%s",url_logo_images_path);
!
print_extra_host_url(temp_hostextinfo->host_name,temp_hostextinfo->icon_
image);
!                                       printf("' BORDER=0 WIDTH=%d
HEIGHT=%d ALT='%s'
TITLE='%s'>",STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,(temp_hostextinfo->ico
n_image_alt==NULL)?"":temp_hostextinfo->icon_image_alt,(temp_hostextinfo
->icon_image_alt==NULL)?"":temp_hostextinfo->icon_image_alt);
                                        printf("</A>");
                                        printf("</TD>\n");
                                        }
***************
*** 2817,2823 ****
                        if(temp_hostextinfo->icon_image!=NULL){
                                printf("<TD align=center
valign=center>");
                                printf("<A
HREF='%s?type=%d&host=%s'>\n",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(t
emp_host->name));
!                               printf("<IMG SRC='%s%s' BORDER=0
WIDTH=%d HEIGHT=%d ALT='%s'
TITLE='%s'>",url_logo_images_path,temp_hostextinfo->icon_image,STATUS_IC
ON_WIDTH,STATUS_ICON_HEIGHT,(temp_hostextinfo->icon_image_alt==NULL)?"":
temp_hostextinfo->icon_image_alt,(temp_hostextinfo->icon_image_alt==NULL
)?"":temp_hostextinfo->icon_image_alt);
                                printf("</A>");
                                printf("<TD>\n");
                                }
--- 2823,2831 ----
                        if(temp_hostextinfo->icon_image!=NULL){
                                printf("<TD align=center
valign=center>");
                                printf("<A
HREF='%s?type=%d&host=%s'>\n",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(t
emp_host->name));
!                               printf("<IMG
SRC='%s",url_logo_images_path);
!
print_extra_host_url(temp_hostextinfo->host_name,temp_hostextinfo->icon_
image);
!                               printf("' BORDER=0 WIDTH=%d HEIGHT=%d
ALT='%s'
TITLE='%s'>",STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,(temp_hostextinfo->ico
n_image_alt==NULL)?"":temp_hostextinfo->icon_image_alt,(temp_hostextinfo
->icon_image_alt==NULL)?"":temp_hostextinfo->icon_image_alt);
                                printf("</A>");
                                printf("<TD>\n");
                                }
***************
*** 3154,3160 ****
                        printf("<TD CLASS='status%s'
WIDTH=5></TD>\n",status_bg_class);
                        printf("<TD CLASS='status%s'
ALIGN=right>",status_bg_class);
                        printf("<a
href='%s?type=%d&host=%s'>",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(hst
status->host_name));
!                       printf("<IMG SRC='%s%s' BORDER=0 WIDTH=%d
HEIGHT=%d ALT='%s'
TITLE='%s'>",url_logo_images_path,temp_hostextinfo->icon_image,STATUS_IC
ON_WIDTH,STATUS_ICON_HEIGHT,(temp_hostextinfo->icon_image_alt==NULL)?"":
temp_hostextinfo->icon_image_alt,(temp_hostextinfo->icon_image_alt==NULL
)?"":temp_hostextinfo->icon_image_alt);
                        printf("</A>");
                        printf("</TD>\n");
                        }
--- 3162,3170 ----
                        printf("<TD CLASS='status%s'
WIDTH=5></TD>\n",status_bg_class);
                        printf("<TD CLASS='status%s'
ALIGN=right>",status_bg_class);
                        printf("<a
href='%s?type=%d&host=%s'>",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(hst
status->host_name));
!                       printf("<IMG SRC='%s",url_logo_images_path);
!
print_extra_host_url(temp_hostextinfo->host_name,temp_hostextinfo->icon_
image);
!                       printf("' BORDER=0 WIDTH=%d HEIGHT=%d ALT='%s'
TITLE='%s'>",STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,(temp_hostextinfo->ico
n_image_alt==NULL)?"":temp_hostextinfo->icon_image_alt,(temp_hostextinfo
->icon_image_alt==NULL)?"":temp_hostextinfo->icon_image_alt);
                        printf("</A>");
                        printf("</TD>\n");
                        }
***************
*** 3754,3760 ****
                        if(temp_hostextinfo->icon_image!=NULL){
                                printf("<TD align=center
valign=center>");
                                printf("<A
HREF='%s?type=%d&host=%s'>\n",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(t
emp_host->name));
!                               printf("<IMG SRC='%s%s' BORDER=0
WIDTH=%d HEIGHT=%d ALT='%s'
TITLE='%s'>",url_logo_images_path,temp_hostextinfo->icon_image,STATUS_IC
ON_WIDTH,STATUS_ICON_HEIGHT,(temp_hostextinfo->icon_image_alt==NULL)?"":
temp_hostextinfo->icon_image_alt,(temp_hostextinfo->icon_image_alt==NULL
)?"":temp_hostextinfo->icon_image_alt);
                                printf("</A>");
                                printf("<TD>\n");
                                }
--- 3764,3772 ----
                        if(temp_hostextinfo->icon_image!=NULL){
                                printf("<TD align=center
valign=center>");
                                printf("<A
HREF='%s?type=%d&host=%s'>\n",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(t
emp_host->name));
!                               printf("<IMG
SRC='%s",url_logo_images_path);
!
print_extra_host_url(temp_hostextinfo->host_name,temp_hostextinfo->icon_
image);
!                               printf("' BORDER=0 WIDTH=%d HEIGHT=%d
ALT='%s'
TITLE='%s'>",STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,(temp_hostextinfo->ico
n_image_alt==NULL)?"":temp_hostextinfo->icon_image_alt,(temp_hostextinfo
->icon_image_alt==NULL)?"":temp_hostextinfo->icon_image_alt);
                                printf("</A>");
                                printf("<TD>\n");
                                }

-----
Larry Low
infotelis


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Developers mailing list