[Fwd: Patch to display parent hosts in extinfo.cgi]

matthias eble matthias.eble at mailing.kaufland-informationssysteme.com
Wed May 13 11:06:40 CEST 2009


Hi Andreas, hi Ton,

so I'll try the proof of concept and re-submit this patch as I think
this is quite neat (it still applies to latest version).

BTW: What you think about introducing a counterpart of the parents
directive to be able to define child hosts also.
This would make it easily possible to display hosts' children in the
cgis which is a good thing also IMO.
But on the other hand NDO/Merlin/whatever's data models would also be
affected, wouldn't they?.

I know the CGIs will probably not last so long any more, but maybe you
could give us a peek on your plans for their future. 

Thanks in advance and good luck in your new roles. 
Matthias


-------- Forwarded Message --------
> From: matthias eble
> <matthias.eble at mailing.kaufland-informationssysteme.com>
> Reply-To: Nagios Developers List <nagios-devel at lists.sourceforge.net>
> To: Nagios Developers List <nagios-devel at lists.sourceforge.net>
> Subject: [Nagios-devel] Patch to display parent hosts in extinfo.cgi
> Date: Mon, 07 Jul 2008 13:27:42 +0200
> 
> Hi all,
> 
> here's a small patch to display parent hosts in extinfo.cgi.
> I think it's pretty useful because I couldn't find a possibility to
> display a hosts parents (beside the statusmap).
> 
> Maybe someone likes it...
> 
> Matthias

--- nagios-3.0.3.old/cgi/extinfo.c	2008-01-24 03:51:30.000000000 +0100
+++ nagios-3.0.3/cgi/extinfo.c	2008-07-07 13:08:39.078559000 +0200
@@ -136,6 +136,7 @@
 	char temp_buffer[MAX_INPUT_BUFFER]="";
 	char *processed_string=NULL;
 	host *temp_host=NULL;
+	hostsmember *temp_parenthost=NULL;
 	hostgroup *temp_hostgroup=NULL;
 	service *temp_service=NULL;
 	servicegroup *temp_servicegroup=NULL;
@@ -325,6 +326,15 @@
 				printf("<DIV CLASS='data'>Host</DIV>\n");
 				printf("<DIV CLASS='dataTitle'>%s</DIV>\n",temp_host->alias);
 				printf("<DIV CLASS='dataTitle'>(%s)</DIV><BR>\n",temp_host->name);
+
+				if (temp_host->parent_hosts != NULL) {
+					/* print all parent hosts */
+					printf("<DIV CLASS='data'>Parents:</DIV>\n");
+					for(temp_parenthost=temp_host->parent_hosts;temp_parenthost!=NULL;temp_parenthost=temp_parenthost->next)
+						printf("<DIV CLASS='dataTitle'><A HREF='%s?host=%s'>%s</A></DIV>\n",STATUS_CGI, url_encode(temp_parenthost->host_name),temp_parenthost->host_name);
+					printf("<BR>");
+				}
+
 				printf("<DIV CLASS='data'>Member of</DIV><DIV CLASS='dataTitle'>");
 				for(temp_hostgroup=hostgroup_list;temp_hostgroup!=NULL;temp_hostgroup=temp_hostgroup->next){
 					if(is_host_member_of_hostgroup(temp_hostgroup,temp_host)==TRUE){



------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com




More information about the Developers mailing list