--- nagios-2.8.orig/include/statusdata.h 2005-11-25 19:52:07.000000000 -0800 +++ nagios-2.8/include/statusdata.h 2007-03-28 15:09:57.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.8.orig/include/config.h.in 2006-05-17 10:35:30.000000000 -0700 +++ nagios-2.8/include/config.h.in 2007-03-28 15:09:57.000000000 -0700 @@ -290,6 +290,7 @@ #endif #endif +#define SUPPORT_DISABLE_STATUS /***** MARO DEFINITIONS *****/ --- nagios-2.8.orig/common/statusdata.c 2005-11-16 00:49:35.000000000 -0800 +++ nagios-2.8/common/statusdata.c 2007-03-28 15:09:57.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.8.orig/cgi/status.c 2007-01-02 18:50:42.000000000 -0800 +++ nagios-2.8/cgi/status.c 2007-03-28 15:09:57.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; @@ -750,6 +759,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; @@ -793,6 +805,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) @@ -803,9 +819,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"); @@ -874,6 +892,20 @@ printf("&hoststatustypes=%d'>",host_status_types); printf("Pending\n"); +#ifdef SUPPORT_DISABLE_STATUS + printf("\n"); +#endif // SUPPORT_DISABLE_STATUS + printf("\n"); printf("\n"); @@ -894,6 +926,9 @@ /* total services in pending state */ printf("\n",(total_pending>0)?"PENDING":"",total_pending); +#ifdef SUPPORT_DISABLE_STATUS + printf("\n",total_disabled); +#endif // SUPPORT_DISABLE_STATUS printf("\n"); printf("
"); + printf("",host_status_types); + printf("Disabled
%d%d
\n"); @@ -955,6 +990,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; @@ -1011,6 +1049,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++; } @@ -1100,6 +1142,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"); @@ -1117,6 +1179,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"); @@ -1479,11 +1545,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"; @@ -1975,6 +2048,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"; @@ -2496,6 +2576,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; @@ -2531,6 +2615,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++; @@ -2547,10 +2635,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; @@ -2566,6 +2661,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; @@ -2615,6 +2713,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++; } @@ -2632,10 +2734,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; @@ -3148,6 +3257,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'; @@ -3221,6 +3337,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; @@ -3245,7 +3364,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)) @@ -3265,10 +3384,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"); @@ -3289,10 +3412,18 @@ printf("\n",STATUS_CGI,temp_buffer,SERVICE_CRITICAL,host_status_types,service_properties,host_properties,total_critical); if(total_pending>0) printf("\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("\n",STATUS_CGI,temp_buffer,SERVICE_DISABLED,host_status_types,service_properties,host_properties,total_disabled); +#endif // SUPPORT_DISABLE_STATUS printf("
%d CRITICAL
%d PENDING
%d DISABLED
\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; @@ -3450,6 +3581,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; @@ -3480,6 +3614,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++; } @@ -3494,10 +3632,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; @@ -3512,6 +3657,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; @@ -3560,6 +3708,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++; } @@ -3577,10 +3729,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;