Page 1 of 1

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

Posted: Wed May 13, 2009 8:06 am
by Guest
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
>
> Reply-To: Nagios Developers List
> To: Nagios Developers List
> 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("Host\n");
printf("%s\n",temp_host->alias);
printf("(%s)\n",temp_host->name);
+
+ if (temp_host->parent_hosts != NULL) {
+ /* print all parent hosts */
+ printf("Parents:\n");
+ for(temp_parenthost=temp_host->parent_hosts;temp_parenthost!=NULL;temp_parenthost=temp_parenthost->next)
+ printf("%s\n",STATUS_CGI, url_encode(temp_parenthost->host_name),temp_parenthost->host_name);
+ printf("");
+ }
+
printf("Member of");
for(temp_hostgroup=hostgroup_list;temp_hostgroup!=NULL;temp_hostgroup=temp_hostgroup->next){
if(is_host_member_of_hostgroup(temp_hostgroup,temp_host)==TRUE){







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