Showing contactgroups and notification period in execinfo.cgi

Markus.Almroth at teliasonera.com Markus.Almroth at teliasonera.com
Tue Jan 13 15:06:50 CET 2009


> Yes, most certainly.

So be it.

I'm starting to get the hang of Nagios data strucures :-)

/Markus
--------------------------

--- extinfo.c   2009-01-13 10:01:00.000000000 +0100
+++ ../extinfo.c        2009-01-13 10:29:11.000000000 +0100
@@ -139,6 +139,9 @@
        hostgroup *temp_hostgroup=NULL;
        service *temp_service=NULL;
        servicegroup *temp_servicegroup=NULL;
+
+       contactgroupsmember *temp_contactgroups=NULL;
+
 
 
        /* get the arguments passed in the URL */
@@ -338,8 +341,24 @@
                                if(found==FALSE)
                                        printf("No hostgroups");
                                printf("</DIV><BR>\n");
+
+                               /* *********************** List contact
groups **********/+                               printf("<BR><DIV
CLASS='data'>Contactgroups</DIV><DIV CLASS='dataTitle'>");+
for(temp_contactgroups=temp_host->contact_groups;temp_contactgroups!=NUL
L;temp_contactgroups=temp_contactgroups->next){
+
printf("%s",temp_contactgroups->group_name);
+                                       if(temp_contactgroups ->next){
+                                               printf(", ");
+                                       }
+                               }
+
+                               printf("</DIV><BR>\n");
++                               printf("<DIV CLASS='data'>Notification
Period</DIV><DIV CLASS='dataTitle'>");
+                               printf("%s",
temp_host->notification_period);
+                               printf("</DIV><BR>\n");
                                printf("<DIV
CLASS='data'>%s</DIV>\n",temp_host->address);
-                               }
+                       }
+                               
 
                        if(display_type==DISPLAY_SERVICE_INFO){
printf("<DIV CLASS='data'>Service</DIV><DIV
CLASS='dataTitle'>%s</DIV><DIV CLASS='data'>On
Host</DIV>\n",service_desc);
@@ -359,7 +378,22 @@
                                        printf("No servicegroups.");
                                 printf("</DIV><BR>\n");
 
+
+                               /* *********************** List contact
groups **********/+                               printf("<BR><DIV
CLASS='data'>Contactgroups</DIV><DIV CLASS='dataTitle'>");+
for(temp_contactgroups=temp_service->contact_groups;temp_contactgroups!=
NULL;temp_contactgroups=temp_contactgroups->next){
+
printf("%s",temp_contactgroups->group_name);
+                                       if(temp_contactgroups ->next){
+                                               printf(", ");
+                                       }
+                               }
+
+                               printf("</DIV><BR>\n");+
printf("<DIV CLASS='data'>Notification Period</DIV><DIV
CLASS='dataTitle'>");
+                               printf("%s",
temp_service->notification_period);
+                               printf("</DIV><BR>\n");
                                printf("<DIV
CLASS='data'>%s</DIV>\n",temp_host->address);
+
                                }
                        if(display_type==DISPLAY_HOSTGROUP_INFO){
                                printf("<DIV
CLASS='data'>Hostgroup</DIV>\n");

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword




More information about the Developers mailing list