diff --git a/monitor-core/gmond/gmond.c b/monitor-core/gmond/gmond.c index 9d92f5824..212987694 100644 --- a/monitor-core/gmond/gmond.c +++ b/monitor-core/gmond/gmond.c @@ -1641,22 +1641,30 @@ main ( int argc, char *argv[] ) /* Create the host hash table */ hosts = apr_hash_make( global_context ); - next_collection =0; - last_cleanup =0; + /* Initialize time variables */ + last_cleanup = next_collection = now = apr_time_now(); + + /* Loop */ for(;;) { + if(!deaf) + { + /* Pull in incoming data */ + poll_listen_channels(next_collection - now, now); + } + else + { + /* Sleep until next collection */ + apr_sleep( next_collection - now ); + } + + /* only continue if it's time to process our collection groups */ now = apr_time_now(); + if(now < next_collection) + continue; - /* Read data until we need to collect/write data */ if(!deaf) { - /* collect data from listen channels */ - for(; mute || now < next_collection;) - { - poll_listen_channels(mute? 60 * APR_USEC_PER_SEC: next_collection - now, now); - now = apr_time_now(); - } - /* cleanup the data if the cleanup threshold has been met */ if( (now - last_cleanup) > cleanup_threshold ) { @@ -1670,6 +1678,11 @@ main ( int argc, char *argv[] ) /* collect data from collection_groups */ next_collection = process_collection_groups( now ); } + else + { + /* we're mute. nothing to collect and send. */ + next_collection = now + 60 * APR_USEC_PER_SEC; + } } return 0; diff --git a/monitor-core/lib/ganglia.h b/monitor-core/lib/ganglia.h index 962e8a48f..450715bff 100644 --- a/monitor-core/lib/ganglia.h +++ b/monitor-core/lib/ganglia.h @@ -61,6 +61,8 @@ int Ganglia_gmetric_set( Ganglia_gmetric gmetric, char *name, char *value, char int Ganglia_gmetric_send( Ganglia_gmetric gmetric, Ganglia_udp_send_channels send_channels ); void Ganglia_gmetric_destroy( Ganglia_gmetric gmetric ); +void build_default_gmond_configuration(Ganglia_pool context); + extern int gexec_errno; diff --git a/monitor-core/lib/libgmond.c b/monitor-core/lib/libgmond.c index 227d53724..ca60dde9c 100644 --- a/monitor-core/lib/libgmond.c +++ b/monitor-core/lib/libgmond.c @@ -206,7 +206,7 @@ collection_group { \n\ } \n\ } \n\ \n\ -/* This collection group will collect the CPU and load status info every 20 secs. \n\ +/* This collection group will collect the CPU status info every 20 secs. \n\ The time threshold is set to 90 seconds. In honesty, this time_threshold could be \n\ set significantly higher to reduce unneccessary network chatter. */ \n\ collection_group { \n\ @@ -245,6 +245,11 @@ collection_group { \n\ name = \"cpu_sintr\" \n\ value_threshold = \"1.0\" \n\ } \n\ +} \n\ +\n\ +collection_group { \n\ + collect_every = 20 \n\ + time_threshold = 90 \n\ /* Load Averages */ \n\ metric { \n\ name = \"load_one\" \n\