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

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

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

Post by Guest »


--=-6+CSmgmB4liNkuZGG+XH
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

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




--=-6+CSmgmB4liNkuZGG+XH
Content-Disposition: attachment; filename=display_parents.patch
Content-Type: text/x-patch; name=display_parents.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit

--- cgi/extinfo.c 2008-01-24 03:51:30.000000000 +0100
+++ /tmp/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){

--=-6+CSmgmB4liNkuZGG+XH--






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