--- nagios-2.5.orig/include/statusdata.h 2005-11-25 19:52:07.000000000 -0800
+++ nagios-2.5/include/statusdata.h 2006-10-24 19:39:56.000000000 -0700
@@ -152,7 +152,9 @@
#define SERVICE_UNKNOWN 8
#define SERVICE_CRITICAL 16
-
+#ifdef SUPPORT_DISABLE_STATUS
+#define SERVICE_DISABLED 128
+#endif /* SUPPORT_DISABLE_STATUS */
/**************************** HOST STATES ****************************/
@@ -161,6 +163,9 @@
#define HOST_DOWN 4
#define HOST_UNREACHABLE 8
+#ifdef SUPPORT_DISABLE_STATUS
+#define HOST_DISABLED 128
+#endif /* SUPPORT_DISABLE_STATUS */
/**************************** FUNCTIONS ******************************/
--- nagios-2.5.orig/include/config.h.in 2006-05-17 10:35:30.000000000 -0700
+++ nagios-2.5/include/config.h.in 2006-10-24 19:40:11.000000000 -0700
@@ -290,6 +290,7 @@
#endif
#endif
+#define SUPPORT_DISABLE_STATUS
/***** MARO DEFINITIONS *****/
--- nagios-2.5.orig/common/statusdata.c 2005-11-16 00:49:35.000000000 -0800
+++ nagios-2.5/common/statusdata.c 2006-10-24 19:38:31.000000000 -0700
@@ -323,7 +323,7 @@
default:
new_hoststatus->status=HOST_UP;
break;
- }
+ }
if(new_hoststatus->has_been_checked==FALSE){
new_hoststatus->status=HOST_PENDING;
free(new_hoststatus->plugin_output);
@@ -338,6 +338,12 @@
}
}
+#ifdef SUPPORT_DISABLE_STATUS
+ if (new_hoststatus->checks_enabled==FALSE) {
+ new_hoststatus->status=SERVICE_DISABLED;
+ }
+#endif // SUPPORT_DISABLE_STATUS
+
new_hoststatus->next=NULL;
new_hoststatus->nexthash=NULL;
@@ -389,7 +395,7 @@
default:
new_svcstatus->status=SERVICE_OK;
break;
- }
+ }
if(new_svcstatus->has_been_checked==FALSE){
new_svcstatus->status=SERVICE_PENDING;
free(new_svcstatus->plugin_output);
@@ -404,6 +410,12 @@
}
}
+#ifdef SUPPORT_DISABLE_STATUS
+ if (new_svcstatus->checks_enabled==FALSE) {
+ new_svcstatus->status=SERVICE_DISABLED;
+ }
+#endif // SUPPORT_DISABLE_STATUS
+
new_svcstatus->next=NULL;
new_svcstatus->nexthash=NULL;
--- nagios-2.5.orig/cgi/status.c 2006-04-26 08:33:59.000000000 -0700
+++ nagios-2.5/cgi/status.c 2006-10-24 19:38:31.000000000 -0700
@@ -145,12 +145,21 @@
int group_style_type=STYLE_OVERVIEW;
int navbar_search=FALSE;
+#ifndef SUPPORT_DISABLE_STATUS
int service_status_types=SERVICE_PENDING|SERVICE_OK|SERVICE_UNKNOWN|SERVICE_WARNING|SERVICE_CRITICAL;
int all_service_status_types=SERVICE_PENDING|SERVICE_OK|SERVICE_UNKNOWN|SERVICE_WARNING|SERVICE_CRITICAL;
int host_status_types=HOST_PENDING|HOST_UP|HOST_DOWN|HOST_UNREACHABLE;
int all_host_status_types=HOST_PENDING|HOST_UP|HOST_DOWN|HOST_UNREACHABLE;
+#else // SUPPORT_DISABLE_STATUS
+int service_status_types=SERVICE_PENDING|SERVICE_OK|SERVICE_UNKNOWN|SERVICE_WARNING|SERVICE_CRITICAL|SERVICE_DISABLED;
+int all_service_status_types=SERVICE_PENDING|SERVICE_OK|SERVICE_UNKNOWN|SERVICE_WARNING|SERVICE_CRITICAL|SERVICE_DISABLED;
+
+int host_status_types=HOST_PENDING|HOST_UP|HOST_DOWN|HOST_UNREACHABLE|HOST_DISABLED;
+int all_host_status_types=HOST_PENDING|HOST_UP|HOST_DOWN|HOST_UNREACHABLE|HOST_DISABLED;
+#endif // SUPPORT_DISABLE_STATUS
+
int all_service_problems=SERVICE_UNKNOWN|SERVICE_WARNING|SERVICE_CRITICAL;
int all_host_problems=HOST_DOWN|HOST_UNREACHABLE;
@@ -745,6 +754,9 @@
int total_pending=0;
int total_services=0;
int total_problems=0;
+#ifdef SUPPORT_DISABLE_STATUS
+ int total_disabled=0;
+#endif
servicestatus *temp_servicestatus;
service *temp_service;
host *temp_host;
@@ -788,6 +800,10 @@
if(temp_servicestatus->problem_has_been_acknowledged==FALSE && temp_servicestatus->checks_enabled==TRUE && temp_servicestatus->notifications_enabled==TRUE && temp_servicestatus->scheduled_downtime_depth==0)
problem_services_unknown++;
}
+#ifdef SUPPORT_DISABLE_STATUS
+ else if(temp_servicestatus->status==SERVICE_DISABLED)
+ total_disabled++;
+#endif // SUPPORT_DISABLE_STATUS
else if(temp_servicestatus->status==SERVICE_OK)
total_ok++;
else if(temp_servicestatus->status==SERVICE_PENDING)
@@ -798,9 +814,11 @@
}
total_services=total_ok+total_unknown+total_warning+total_critical+total_pending;
+#ifdef SUPPORT_DISABLE_STATUS
+ total_services+=total_disabled;
+#endif // SUPPORT_DISABLE_STATUS
total_problems=total_unknown+total_warning+total_critical;
-
printf("
Service Status Totals
\n");
printf("\n");
@@ -869,6 +887,20 @@
printf("&hoststatustypes=%d'>",host_status_types);
printf("Pending\n");
+#ifdef SUPPORT_DISABLE_STATUS
+ printf("");
+ printf("",host_status_types);
+ printf("Disabled | \n");
+#endif // SUPPORT_DISABLE_STATUS
+
printf("\n");
printf("\n");
@@ -889,6 +921,9 @@
/* total services in pending state */
printf("%d | \n",(total_pending>0)?"PENDING":"",total_pending);
+#ifdef SUPPORT_DISABLE_STATUS
+ printf("%d | \n",total_disabled);
+#endif // SUPPORT_DISABLE_STATUS
printf("
\n");
printf("
\n");
@@ -950,6 +985,9 @@
int total_pending=0;
int total_hosts=0;
int total_problems=0;
+#ifdef SUPPORT_DISABLE_STATUS
+ int total_disabled=0;
+#endif // SUPPORT_DISABLE_STATUS
hoststatus *temp_hoststatus;
host *temp_host;
servicestatus *temp_servicestatus;
@@ -1006,6 +1044,10 @@
else if(temp_hoststatus->status==HOST_PENDING)
total_pending++;
+#ifdef SUPPORT_DISABLE_STATUS
+ else if(temp_hoststatus->status==HOST_DISABLED)
+ total_disabled++;
+#endif // SUPPORT_DISABLE_STATUS
else
total_up++;
}
@@ -1095,6 +1137,26 @@
printf("&hoststatustypes=%d'>",HOST_PENDING);
printf("Pending\n");
+#ifdef SUPPORT_DISABLE_STATUS
+ printf("");
+ printf("",HOST_DISABLED);
+ printf("Disabled | \n");
+#endif // SUPPORT_DISABLE_STATUS
+
printf("\n");
@@ -1112,6 +1174,10 @@
/* total hosts pending */
printf("%d | \n",(total_pending>0)?"PENDING":"",total_pending);
+#ifdef SUPPORT_DISABLE_STATUS
+ printf("%d | \n",total_disabled);
+#endif // SUPPORT_DISABLE_STATUS
+
printf("\n");
printf("\n");
@@ -1474,11 +1540,18 @@
if((unsigned long)temp_status->last_check==0L)
strcpy(date_time,"N/A");
+#ifdef SUPPORT_DISABLE_STATUS
+ if(temp_status->status==SERVICE_DISABLED){
+ strncpy(status,"DISABLED",sizeof(status));
+ status_class="PENDING";
+ status_bg_class=(odd)?"Even":"Odd";
+ }
+#endif // SUPPORT_DISABLE_STATUS
if(temp_status->status==SERVICE_PENDING){
strncpy(status,"PENDING",sizeof(status));
status_class="PENDING";
status_bg_class=(odd)?"Even":"Odd";
- }
+ }
else if(temp_status->status==SERVICE_OK){
strncpy(status,"OK",sizeof(status));
status_class="OK";
@@ -1966,6 +2039,13 @@
if((unsigned long)temp_status->last_check==0L)
strcpy(date_time,"N/A");
+#ifdef SUPPORT_DISABLE_STATUS
+ if(temp_status->status==HOST_DISABLED){
+ strncpy(status,"DISABLED",sizeof(status));
+ status_class="PENDING";
+ status_bg_class=(odd)?"Even":"Odd";
+ }
+#endif // SUPPORT_DISABLE_STATUS
if(temp_status->status==HOST_PENDING){
strncpy(status,"PENDING",sizeof(status));
status_class="PENDING";
@@ -2485,6 +2565,10 @@
int total_down=0;
int total_unreachable=0;
int total_pending=0;
+#ifdef SUPPORT_DISABLE_STATUS
+ int total_disabled=0;
+#endif // SUPPORT_DISABLE_STATUS
+
hoststatus *temp_hoststatus;
host *temp_host;
host *last_host;
@@ -2520,6 +2604,10 @@
total_down++;
else if(temp_hoststatus->status==HOST_UNREACHABLE)
total_unreachable++;
+#ifdef SUPPORT_DISABLE_STATUS
+ else if(temp_hoststatus->status==HOST_DISABLED)
+ total_disabled++;
+#endif // SUPPORT_DISABLE_STATUS
else
total_pending++;
@@ -2536,10 +2624,17 @@
printf("%d UNREACHABLE |
\n",STATUS_CGI,url_encode(temp_servicegroup->group_name),HOST_UNREACHABLE,host_properties,total_unreachable);
if(total_pending>0)
printf("%d PENDING |
\n",STATUS_CGI,url_encode(temp_servicegroup->group_name),HOST_PENDING,host_properties,total_pending);
-
+#ifdef SUPPORT_DISABLE_STATUS
+ if(total_disabled>0)
+ printf("%d DISABLED |
\n",STATUS_CGI,url_encode(temp_servicegroup->group_name),HOST_DISABLED,host_properties,total_disabled);
+#endif // SUPPORT_DISABLE_STATUS
printf("\n");
- if((total_up + total_down + total_unreachable + total_pending)==0)
+#ifdef SUPPORT_DISABLE_STATUS
+ if((total_up + total_down + total_unreachable + total_pending + total_disabled)==0)
+#else // SUPPORT_DISABLE_STATUS
+ if((total_up + total_down + total_unreachable + total_pending)==0
+#endif // SUPPORT_DISABLE_STATUS
printf("No matching hosts");
return;
@@ -2555,6 +2650,9 @@
int total_unknown=0;
int total_critical=0;
int total_pending=0;
+#ifdef SUPPORT_DISABLE_STATUS
+ int total_disabled=0;
+#endif // SUPPORT_DISABLE_STATUS
servicestatus *temp_servicestatus;
service *temp_service;
hoststatus *temp_hoststatus;
@@ -2604,6 +2702,10 @@
total_ok++;
else if(temp_servicestatus->status==SERVICE_PENDING)
total_pending++;
+#ifdef SUPPORT_DISABLE_STATUS
+ else if(temp_servicestatus->status==SERVICE_PENDING)
+ total_disabled++;
+#endif // SUPPORT_DISABLE_STATUS
else
total_ok++;
}
@@ -2621,10 +2723,17 @@
printf("%d CRITICAL |
\n",STATUS_CGI,url_encode(temp_servicegroup->group_name),SERVICE_CRITICAL,host_status_types,service_properties,host_properties,total_critical);
if(total_pending>0)
printf("%d PENDING |
\n",STATUS_CGI,url_encode(temp_servicegroup->group_name),SERVICE_PENDING,host_status_types,service_properties,host_properties,total_pending);
-
+#ifdef SUPPORT_DISABLE_STATUS
+ if(total_pending>0)
+ printf("%d PENDING |
\n",STATUS_CGI,url_encode(temp_servicegroup->group_name),SERVICE_DISABLED,host_status_types,service_properties,host_properties,total_disabled);
+#endif // SUPPORT_DISABLE_STATUS
printf("\n");
+#ifdef SUPPORT_DISABLE_STATUS
+ if((total_ok + total_warning + total_unknown + total_critical + total_pending + total_disabled)==0)
+#else // SUPPORT_DISABLE_STATUS
if((total_ok + total_warning + total_unknown + total_critical + total_pending)==0)
+#endif // SUPPORT_DISABLE_STATUS
printf("No matching services");
return;
@@ -3135,6 +3244,13 @@
status_class="HOSTUNREACHABLE";
status_bg_class="HOSTUNREACHABLE";
}
+#ifdef SUPPORT_DISABLE_STATUS
+ else if(hststatus->status==HOST_DISABLED){
+ strncpy(status,"DISABLED",sizeof(status));
+ status_class="HOSTPENDING";
+ status_bg_class=(odd)?"Even":"Odd";
+ }
+#endif // SUPPORT_DISABLE_STATUS
status[sizeof(status)-1]='\x0';
@@ -3206,6 +3322,9 @@
int total_unknown=0;
int total_critical=0;
int total_pending=0;
+#ifdef SUPPORT_DISABLE_STATUS
+ int total_disabled=0;
+#endif
servicestatus *temp_servicestatus;
service *temp_service;
servicegroup *temp_servicegroup=NULL;
@@ -3230,7 +3349,7 @@
/* is this service a member of the servicegroup? */
if(is_service_member_of_servicegroup(temp_servicegroup,temp_service)==FALSE)
continue;
- }
+ }
/* make sure we only display services of the specified status levels */
if(!(service_status_types & temp_servicestatus->status))
@@ -3250,10 +3369,14 @@
total_ok++;
else if(temp_servicestatus->status==SERVICE_PENDING)
total_pending++;
+#ifdef SUPPORT_DISABLE_STATUS
+ else if(temp_servicestatus->status==SERVICE_DISABLED)
+ total_disabled++;
+#endif // SUPPORT_DISABLE_STATUS
else
total_ok++;
}
- }
+ }
printf("\n");
@@ -3274,10 +3397,18 @@
printf("%d CRITICAL |
\n",STATUS_CGI,temp_buffer,SERVICE_CRITICAL,host_status_types,service_properties,host_properties,total_critical);
if(total_pending>0)
printf("%d PENDING |
\n",STATUS_CGI,temp_buffer,SERVICE_PENDING,host_status_types,service_properties,host_properties,total_pending);
+#ifdef SUPPORT_DISABLE_STATUS
+ if(total_pending>0)
+ printf("%d DISABLED |
\n",STATUS_CGI,temp_buffer,SERVICE_DISABLED,host_status_types,service_properties,host_properties,total_disabled);
+#endif // SUPPORT_DISABLE_STATUS
printf("
\n");
+#ifdef SUPPORT_DISABLE_STATUS
+ if((total_ok + total_warning + total_unknown + total_critical + total_pending + total_disabled)==0)
+#else
if((total_ok + total_warning + total_unknown + total_critical + total_pending)==0)
+#endif // SUPPORT_DISABLE_STATUS
printf("No matching services");
return;
@@ -3435,6 +3566,9 @@
int total_down=0;
int total_unreachable=0;
int total_pending=0;
+#ifdef SUPPORT_DISABLE_STATUS
+ int total_disabled=0;
+#endif // SUPPORT_DISABLE_STATUS
hoststatus *temp_hoststatus;
host *temp_host;
@@ -3465,6 +3599,10 @@
total_down++;
else if(temp_hoststatus->status==HOST_UNREACHABLE)
total_unreachable++;
+#ifdef SUPPORT_DISABLE_STATUS
+ else if(temp_hoststatus->status==HOST_DISABLED)
+ total_disabled++;
+#endif // SUPPORT_DISABLE_STATUS
else
total_pending++;
}
@@ -3479,10 +3617,17 @@
printf("%d UNREACHABLE |
\n",STATUS_CGI,url_encode(temp_hostgroup->group_name),HOST_UNREACHABLE,host_properties,total_unreachable);
if(total_pending>0)
printf("%d PENDING |
\n",STATUS_CGI,url_encode(temp_hostgroup->group_name),HOST_PENDING,host_properties,total_pending);
-
+#ifdef SUPPORT_DISABLE_STATUS
+ if(total_disabled>0)
+ printf("%d DISABLED |
\n",STATUS_CGI,url_encode(temp_hostgroup->group_name),HOST_DISABLED,host_properties,total_disabled);
+#endif // SUPPORT_DISABLE_STATUS
printf("\n");
- if((total_up + total_down + total_unreachable + total_pending)==0)
+#ifdef SUPPORT_DISABLE_STATUS
+ if((total_up + total_down + total_unreachable + total_pending + total_disabled)==0)
+#else // SUPPORT_DISABLE_STATUS
+ if((total_up + total_down + total_unreachable + total_pending)==0
+#endif // SUPPORT_DISABLE_STATUS
printf("No matching hosts");
return;
@@ -3497,6 +3642,9 @@
int total_unknown=0;
int total_critical=0;
int total_pending=0;
+#ifdef SUPPORT_DISABLE_STATUS
+ int total_disabled=0;
+#endif // SUPPORT_DISABLE_STATUS
servicestatus *temp_servicestatus;
hoststatus *temp_hoststatus;
host *temp_host;
@@ -3545,6 +3693,10 @@
total_ok++;
else if(temp_servicestatus->status==SERVICE_PENDING)
total_pending++;
+#ifdef SUPPORT_DISABLE_STATUS
+ else if(temp_servicestatus->status==SERVICE_DISABLED)
+ total_disabled++;
+#endif // SUPPORT_DISABLE_STATUS
else
total_ok++;
}
@@ -3562,10 +3714,17 @@
printf("%d CRITICAL |
\n",STATUS_CGI,url_encode(temp_hostgroup->group_name),SERVICE_CRITICAL,host_status_types,service_properties,host_properties,total_critical);
if(total_pending>0)
printf("%d PENDING |
\n",STATUS_CGI,url_encode(temp_hostgroup->group_name),SERVICE_PENDING,host_status_types,service_properties,host_properties,total_pending);
-
+#ifdef SUPPORT_DISABLE_STATUS
+ if(total_disabled>0)
+ printf("%d DISABLED |
\n",STATUS_CGI,url_encode(temp_hostgroup->group_name),SERVICE_DISABLED,host_status_types,service_properties,host_properties,total_disabled);
+#endif // SUPPORT_DISABLE_STATUS
printf("\n");
+#ifdef SUPPORT_DISABLE_STATUS
+ if((total_ok + total_warning + total_unknown + total_critical + total_pending + total_disabled)==0)
+#else
if((total_ok + total_warning + total_unknown + total_critical + total_pending)==0)
+#endif
printf("No matching services");
return;