diff -ur nagios-2.9.original/base/nagiostats.c nagios-2.9/base/nagiostats.c --- nagios-2.9.original/base/nagiostats.c 2007-04-10 15:08:32.000000000 +0000 +++ nagios-2.9/base/nagiostats.c 2007-09-26 20:20:18.000000000 +0000 @@ -76,6 +76,11 @@ double max_passive_service_state_change=0.0; int have_max_passive_service_state_change=FALSE; double average_passive_service_state_change=0.0; +double min_passive_service_latency=0.0; +int have_min_passive_service_latency=FALSE; +double max_passive_service_latency=0.0; +int have_max_passive_service_latency=FALSE; +double average_passive_service_latency=0.0; int have_min_host_state_change=FALSE; double min_host_state_change=0.0; @@ -102,6 +107,11 @@ double max_passive_host_state_change=0.0; int have_max_passive_host_state_change=FALSE; double average_passive_host_state_change=0.0; +int have_min_passive_host_latency=FALSE; +double min_passive_host_latency=0.0; +int have_max_passive_host_latency=FALSE; +double max_passive_host_latency=0.0; +double average_passive_host_latency=0.0; int passive_service_checks=0; int active_service_checks=0; @@ -298,11 +308,13 @@ printf(" xxxACTSVCLAT MIN/MAX/AVG active service check latency (ms).\n"); printf(" xxxACTSVCEXT MIN/MAX/AVG active service check execution time (ms).\n"); printf(" xxxACTSVCPSC MIN/MAX/AVG active service check %% state change.\n"); + printf(" xxxPSVSVCLAT MIN/MAX/AVG passive service check latency (ms).\n"); printf(" xxxPSVSVCPSC MIN/MAX/AVG passive service check %% state change.\n"); printf(" xxxSVCPSC MIN/MAX/AVG service check %% state change.\n"); printf(" xxxACTHSTLAT MIN/MAX/AVG active host check latency (ms).\n"); printf(" xxxACTHSTEXT MIN/MAX/AVG active host check execution time (ms).\n"); printf(" xxxACTHSTPSC MIN/MAX/AVG active host check %% state change.\n"); + printf(" xxxPSVHSTLAT MIN/MAX/AVG passive host check latency (ms).\n"); printf(" xxxPSVHSTPSC MIN/MAX/AVG passive host check %% state change.\n"); printf(" xxxHSTPSC MIN/MAX/AVG host check %% state change.\n"); printf(" NUMACTHSTCHKxM number of active host checks in last 1/5/15/60 minutes.\n"); @@ -425,6 +437,14 @@ else if(!strcmp(temp_ptr,"AVGACTSVCPSC")) printf("%d\n",(int)average_active_service_state_change); + /* passive service check latency */ + else if(!strcmp(temp_ptr,"MINPSVSVCLAT")) + printf("%d\n",(int)(min_passive_service_latency*1000)); + else if(!strcmp(temp_ptr,"MAXPSVSVCLAT")) + printf("%d\n",(int)(max_passive_service_latency*1000)); + else if(!strcmp(temp_ptr,"AVGPSVSVCLAT")) + printf("%d\n",(int)(average_passive_service_latency*1000)); + /* passive service check percent state change */ else if(!strcmp(temp_ptr,"MINPSVSVCPSC")) printf("%d\n",(int)min_passive_service_state_change); @@ -465,6 +485,14 @@ else if(!strcmp(temp_ptr,"AVGACTHSTPSC")) printf("%d\n",(int)average_active_host_state_change); + /* passive host check latency */ + else if(!strcmp(temp_ptr,"MINPSVHSTLAT")) + printf("%d\n",(int)(min_passive_host_latency*1000)); + else if(!strcmp(temp_ptr,"MAXPSVHSTLAT")) + printf("%d\n",(int)(max_passive_host_latency*1000)); + else if(!strcmp(temp_ptr,"AVGPSVHSTLAT")) + printf("%d\n",(int)(average_passive_host_latency*1000)); + /* passive host check percent state change */ else if(!strcmp(temp_ptr,"MINPSVHSTPSC")) printf("%d\n",(int)min_passive_host_state_change); @@ -606,6 +634,7 @@ printf("Active Service Execution Time: %.3f / %.3f / %.3f sec\n",min_active_service_execution_time,max_active_service_execution_time,average_active_service_execution_time); printf("Active Service State Change: %.3f / %.3f / %.3f %%\n",min_active_service_state_change,max_active_service_state_change,average_active_service_state_change); printf("Active Services Last 1/5/15/60 min: %d / %d / %d / %d\n",active_services_checked_last_1min,active_services_checked_last_5min,active_services_checked_last_15min,active_services_checked_last_1hour); + printf("Passive Service Latency: %.3f / %.3f / %.3f sec\n",min_passive_service_latency,max_passive_service_latency,average_passive_service_latency); printf("Passive Service State Change: %.3f / %.3f / %.3f %%\n",min_passive_service_state_change,max_passive_service_state_change,average_passive_service_state_change); printf("Passive Services Last 1/5/15/60 min: %d / %d / %d / %d\n",passive_services_checked_last_1min,passive_services_checked_last_5min,passive_services_checked_last_15min,passive_services_checked_last_1hour); printf("Services Ok/Warn/Unk/Crit: %d / %d / %d / %d\n",services_ok,services_warning,services_unknown,services_critical); @@ -622,6 +651,7 @@ printf("Active Host Execution Time: %.3f / %.3f / %.3f sec\n",min_active_host_execution_time,max_active_host_execution_time,average_active_host_execution_time); printf("Active Host State Change: %.3f / %.3f / %.3f %%\n",min_active_host_state_change,max_active_host_state_change,average_active_host_state_change); printf("Active Hosts Last 1/5/15/60 min: %d / %d / %d / %d\n",active_hosts_checked_last_1min,active_hosts_checked_last_5min,active_hosts_checked_last_15min,active_hosts_checked_last_1hour); + printf("Passive Host Latency: %.3f / %.3f / %.3f sec\n",min_passive_host_latency,max_passive_host_latency,average_passive_host_latency); printf("Passive Host State Change: %.3f / %.3f / %.3f %%\n",min_passive_host_state_change,max_passive_host_state_change,average_passive_host_state_change); printf("Passive Hosts Last 1/5/15/60 min: %d / %d / %d / %d\n",passive_hosts_checked_last_1min,passive_hosts_checked_last_5min,passive_hosts_checked_last_15min,passive_hosts_checked_last_1hour); printf("Hosts Up/Down/Unreach: %d / %d / %d\n",hosts_up,hosts_down,hosts_unreachable); @@ -793,6 +823,15 @@ } else{ passive_host_checks++; + average_passive_host_latency=(((average_passive_host_latency*((double)passive_host_checks-1.0))+latency)/(double)passive_host_checks); + if(have_min_passive_host_latency==FALSE || min_passive_host_latency>latency){ + have_min_passive_host_latency=TRUE; + min_passive_host_latency=latency; + } + if(have_max_passive_host_latency==FALSE || max_passive_host_latencystate_change){ have_min_passive_host_state_change=TRUE; @@ -886,6 +925,15 @@ } else{ passive_service_checks++; + average_passive_service_latency=(((average_passive_service_latency*((double)passive_service_checks-1.0))+latency)/(double)passive_service_checks); + if(have_min_passive_service_latency==FALSE || min_passive_service_latency>latency){ + have_min_passive_service_latency=TRUE; + min_passive_service_latency=latency; + } + if(have_max_passive_service_latency==FALSE || max_passive_service_latencystate_change){ have_min_passive_service_state_change=TRUE;