From: <kn...@us...> - 2006-05-22 22:57:28
|
Revision: 652 Author: knobi1 Date: 2006-05-22 15:57:18 -0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/ganglia/?rev=652&view=rev Log Message: ----------- MKN: Test. Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2006-04-24 14:43:12 UTC (rev 651) +++ trunk/monitor-core/gmond/gmond.c 2006-05-22 22:57:18 UTC (rev 652) @@ -191,6 +191,7 @@ cleanup_threshold = cfg_getint( tmp, "cleanup_threshold"); } + static void daemonize_if_necessary( char *argv[] ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kn...@us...> - 2006-06-07 04:58:17
|
Revision: 655 Author: knobi1 Date: 2006-06-06 21:58:10 -0700 (Tue, 06 Jun 2006) ViewCVS: http://svn.sourceforge.net/ganglia/?rev=655&view=rev Log Message: ----------- MKN: Testing SVN. Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2006-05-22 23:15:15 UTC (rev 654) +++ trunk/monitor-core/gmond/gmond.c 2006-06-07 04:58:10 UTC (rev 655) @@ -191,7 +191,6 @@ cleanup_threshold = cfg_getint( tmp, "cleanup_threshold"); } - static void daemonize_if_necessary( char *argv[] ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kn...@us...> - 2006-08-28 14:01:40
|
Revision: 676 Author: knobi1 Date: 2006-08-28 07:01:34 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/ganglia/?rev=676&view=rev Log Message: ----------- MKN: Changes for the host-spoofing patch (bz #99) by <ye...@sl...> Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2006-08-28 14:01:05 UTC (rev 675) +++ trunk/monitor-core/gmond/gmond.c 2006-08-28 14:01:34 UTC (rev 676) @@ -578,19 +578,29 @@ } } } - +// Yemi static Ganglia_host * -Ganglia_host_get( char *remoteip, apr_sockaddr_t *sa, Ganglia_message *fullmsg) +Ganglia_host_get( char *remIP, apr_sockaddr_t *sa, Ganglia_message *fullmsg) { apr_status_t status; apr_pool_t *pool; Ganglia_host *hostdata; char *hostname = NULL; - + char *remoteip = remIP; + if(!remoteip || !sa || !fullmsg) { return NULL; } + + if(fullmsg->id == spoof_metric){ + hostname = fullmsg->Ganglia_message_u.spmetric.spheader.spoofName; + remoteip = fullmsg->Ganglia_message_u.spmetric.spheader.spoofIP; + } + if(fullmsg->id == spoof_heartbeat){ + hostname = fullmsg->Ganglia_message_u.spheader.spoofName; + remoteip = fullmsg->Ganglia_message_u.spheader.spoofIP; + } hostdata = (Ganglia_host *)apr_hash_get( hosts, remoteip, APR_HASH_KEY_STRING ); if(!hostdata) @@ -689,6 +699,13 @@ /* Processing is finished */ return NULL; } + if(fullmsg->id == spoof_heartbeat) + { + /* nothing more needs to be done. we handled the timestamps above. */ + debug_msg("Got a spoof heartbeat message %d\n", hostdata->gmond_started); + /* Processing is finished */ + return NULL; + } return hostdata; } @@ -739,6 +756,15 @@ message->Ganglia_message_u.gmetric.name, APR_HASH_KEY_STRING); } +// Yemi +static Ganglia_metric * +Ganglia_message_find_spmetric( Ganglia_host *host, Ganglia_message *message) +{ + /* Keyed on the name element of the gmetric sent */ + return (Ganglia_metric *)apr_hash_get( host->gmetrics, + message->Ganglia_message_u.spmetric.gmetric.name, + APR_HASH_KEY_STRING); +} static Ganglia_metric * Ganglia_message_find_metric( Ganglia_host *host, Ganglia_message *message) @@ -753,7 +779,7 @@ Ganglia_message_save( Ganglia_host *host, Ganglia_message *message ) { Ganglia_metric *metric = NULL; - + if(!host || !message) return; @@ -762,6 +788,11 @@ { metric = Ganglia_message_find_gmetric( host, message); } + // Yemi + else if(message->id == spoof_metric) + { + metric = Ganglia_message_find_spmetric( host, message); + } else { metric = Ganglia_message_find_metric( host, message); @@ -785,6 +816,11 @@ { metric->name = apr_pstrdup( metric->pool, message->Ganglia_message_u.gmetric.name ); } + // Yemi + if(message->id == spoof_metric) + { + metric->name = apr_pstrdup( metric->pool, message->Ganglia_message_u.spmetric.gmetric.name ); + } } else { @@ -793,9 +829,19 @@ } /* Copy in the data */ - memcpy(&(metric->message), message, sizeof(Ganglia_message)); + // Yemi + if(message->id == spoof_metric){ + // Store data as regular gmetric in hash table!! - if(message->id == metric_user_defined) + metric->message.id = metric_user_defined; + metric->message.Ganglia_message_u.gmetric = message->Ganglia_message_u.spmetric.gmetric; + + + }else{ + memcpy(&(metric->message), message, sizeof(Ganglia_message)); + } + + if(message->id == metric_user_defined || message->id == spoof_metric) { /* Save the gmetric */ apr_hash_set( host->gmetrics, metric->name, APR_HASH_KEY_STRING, metric); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2007-04-02 22:12:56
|
Revision: 750 http://svn.sourceforge.net/ganglia/?rev=750&view=rev Author: bnicholes Date: 2007-04-02 15:12:58 -0700 (Mon, 02 Apr 2007) Log Message: ----------- Modify the -m parameter to also list the loaded modular metrics Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2007-04-02 22:04:13 UTC (rev 749) +++ trunk/monitor-core/gmond/gmond.c 2007-04-02 22:12:58 UTC (rev 750) @@ -1937,16 +1937,17 @@ exit(0); } + process_configuration_file(); + if(args_info.metrics_flag) { + load_metric_modules(); setup_metric_callbacks(); print_metric_list(); fflush( stdout ); exit(0); } - process_configuration_file(); - if(args_info.bandwidth_flag) { double bytes_per_sec; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2007-06-14 22:30:20
|
Revision: 792 http://svn.sourceforge.net/ganglia/?rev=792&view=rev Author: bnicholes Date: 2007-06-14 15:30:22 -0700 (Thu, 14 Jun 2007) Log Message: ----------- explicitly handle the sigint signal Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2007-06-14 17:11:01 UTC (rev 791) +++ trunk/monitor-core/gmond/gmond.c 2007-06-14 22:30:22 UTC (rev 792) @@ -2031,6 +2031,12 @@ apr_pool_clear( pool ); } +int done = 0; +void sig_handler(int i) +{ + done = 1; +} + int main ( int argc, char *argv[] ) { @@ -2101,6 +2107,7 @@ apr_gethostname( myname, APRMAXHOSTLEN+1, global_context); apr_signal( SIGPIPE, SIG_IGN ); + apr_signal( SIGINT, sig_handler ); /* This must occur before we setuid_if_necessary() particularly on freebsd * where we need to be root to access /dev/mem to initialize metric collection */ @@ -2139,7 +2146,7 @@ last_cleanup = next_collection = now = apr_time_now(); /* Loop */ - for(;;) + for(;!done;) { /* Make sure we never wait for negative seconds (shouldn't happen) */ apr_interval_time_t wait = next_collection >= now ? next_collection - now : 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2007-10-09 19:06:25
|
Revision: 850 http://ganglia.svn.sourceforge.net/ganglia/?rev=850&view=rev Author: bnicholes Date: 2007-10-09 12:06:29 -0700 (Tue, 09 Oct 2007) Log Message: ----------- Move the metric init call after gmond as been daemonized. Also enable sending err_msg's to syslog Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2007-10-09 15:55:42 UTC (rev 849) +++ trunk/monitor-core/gmond/gmond.c 2007-10-09 19:06:29 UTC (rev 850) @@ -5,6 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <syslog.h> #include <apr.h> #include <apr_strings.h> @@ -185,6 +186,7 @@ apr_array_header_t *collection_groups = NULL; mmodule *metric_modules = NULL; +extern int daemon_proc; /* defined in error.c */ /* this is just a temporary function */ void @@ -230,7 +232,16 @@ /* Daemonize if needed */ if(!args_info.foreground_flag && should_daemonize && !debug_level) { + apr_status_t ret; + char *cwd; + + apr_filepath_get(&cwd, 0, global_context); apr_proc_detach(1); + apr_filepath_set(cwd, global_context); + + /* enable errmsg logging to syslog */ + daemon_proc = 1; /* for our err_XXX() functions */ + openlog ("GMOND", LOG_PID, LOG_DAEMON); } } @@ -1506,14 +1517,6 @@ continue; } - if (modp->init && modp->init(global_context)) { - fprintf (stderr, "Module %s failed to initialize.\n", modName); - } - - apr_pool_cleanup_register(global_context, modp, - modular_metric_cleanup, - apr_pool_cleanup_null); - if (metric_modules != NULL) { modp->next = metric_modules; } @@ -1536,9 +1539,18 @@ metric_callbacks = apr_hash_make( global_context ); while (modp) { - const Ganglia_25metric* metric_info = modp->metrics_info; + Ganglia_25metric* metric_info; int i; + if (modp->init && modp->init(global_context)) { + err_msg("Module %s failed to initialize.\n", modp->module_name); + } + + apr_pool_cleanup_register(global_context, modp, + modular_metric_cleanup, + apr_pool_cleanup_null); + + metric_info = modp->metrics_info; for (i = 0; metric_info[i].name != NULL; i++) { Ganglia_metric_cb_define(metric_info[i].name, modp->handler, i, modp); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2007-10-19 18:27:20
|
Revision: 857 http://ganglia.svn.sourceforge.net/ganglia/?rev=857&view=rev Author: bnicholes Date: 2007-10-19 11:27:24 -0700 (Fri, 19 Oct 2007) Log Message: ----------- Allow all critical error messages to be written to the syslog if not in debug mode Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2007-10-19 18:11:09 UTC (rev 856) +++ trunk/monitor-core/gmond/gmond.c 2007-10-19 18:27:24 UTC (rev 857) @@ -26,6 +26,7 @@ #include "libmetrics.h"/* libmetrics header in ./libmetrics */ #include "apr_net.h" /* our private network functions based on apr */ #include "debug_msg.h" +#include "error.h" #include "protocol.h" /* generated header from ./lib/protocol.x xdr definition file */ #include "dtd.h" /* the DTD definition for our XML */ #include "g25_config.h" /* for converting old file formats to new */ @@ -232,7 +233,6 @@ /* Daemonize if needed */ if(!args_info.foreground_flag && should_daemonize && !debug_level) { - apr_status_t ret; char *cwd; apr_filepath_get(&cwd, 0, global_context); @@ -273,7 +273,7 @@ mute = cfg_getbool( tmp, "mute"); if(deaf && mute) { - fprintf(stderr,"Configured to run both deaf and mute. Nothing to do. Exiting.\n"); + err_msg("Configured to run both deaf and mute. Nothing to do. Exiting.\n"); exit(1); } } @@ -311,7 +311,7 @@ acl = apr_pcalloc( pool, sizeof(Ganglia_acl)); if(!acl) { - fprintf(stderr,"Unable to allocate memory for ACL. Exiting.\n"); + err_msg("Unable to allocate memory for ACL. Exiting.\n"); exit(1); } @@ -326,7 +326,7 @@ } else { - fprintf(stderr,"Invalid default ACL '%s'. Exiting.\n", default_action); + err_msg("Invalid default ACL '%s'. Exiting.\n", default_action); exit(1); } @@ -334,7 +334,7 @@ acl->access_array = apr_array_make( pool, num_access, sizeof(Ganglia_acl *)); if(!acl->access_array) { - fprintf(stderr,"Unable to malloc access array. Exiting.\n"); + err_msg("Unable to malloc access array. Exiting.\n"); exit(1); } for(i=0; i< num_access; i++) @@ -347,7 +347,7 @@ { /* This shouldn't happen unless maybe acl is empty and * the safest thing to do it exit */ - fprintf(stderr,"Unable to process ACLs. Exiting.\n"); + err_msg("Unable to process ACLs. Exiting.\n"); exit(1); } @@ -356,7 +356,7 @@ action = cfg_getstr( access_config, "action"); if(!ip && !mask && !action) { - fprintf(stderr,"An access record requires an ip, mask and action. Exiting.\n"); + err_msg("An access record requires an ip, mask and action. Exiting.\n"); exit(1); } @@ -371,7 +371,7 @@ } else { - fprintf(stderr,"ACL access entry has action '%s'. Must be deny|allow. Exiting.\n", action); + err_msg("ACL access entry has action '%s'. Must be deny|allow. Exiting.\n", action); exit(1); } @@ -380,7 +380,7 @@ status = apr_ipsubnet_create( &(access->ipsub), ip, mask, pool); if(status != APR_SUCCESS) { - fprintf(stderr,"ACL access entry has invalid ip('%s')/mask('%s'). Exiting.\n", ip, mask); + err_msg("ACL access entry has invalid ip('%s')/mask('%s'). Exiting.\n", ip, mask); exit(1); } @@ -432,12 +432,12 @@ #if APR_INET6 return APR_INET6; #else - fprintf(stderr,"IPv6 is not supported on this host. Exiting.\n"); + err_msg("IPv6 is not supported on this host. Exiting.\n"); exit(1); #endif } - fprintf(stderr,"Unknown family '%s'. Try inet4|inet6. Exiting.\n", family); + err_msg("Unknown family '%s'. Try inet4|inet6. Exiting.\n", family); exit(1); /* shouldn't get here */ return APR_UNSPEC; @@ -490,7 +490,7 @@ socket = create_mcast_server(pool, sock_family, mcast_join, port, bindaddr, mcast_if ); if(!socket) { - fprintf(stderr,"Error creating multicast server mcast_join=%s port=%d mcast_if=%s family='%s'. Exiting.\n", + err_msg("Error creating multicast server mcast_join=%s port=%d mcast_if=%s family='%s'. Exiting.\n", mcast_join? mcast_join: "NULL", port, mcast_if? mcast_if:"NULL",family); exit(1); } @@ -501,7 +501,7 @@ socket = create_udp_server( pool, sock_family, port, bindaddr ); if(!socket) { - fprintf(stderr,"Error creating UDP server on port %d bind=%s. Exiting.\n", + err_msg("Error creating UDP server on port %d bind=%s. Exiting.\n", port, bindaddr? bindaddr: "unspecified"); exit(1); } @@ -515,7 +515,7 @@ channel = apr_pcalloc( pool, sizeof(Ganglia_channel)); if(!channel) { - fprintf(stderr,"Unable to malloc memory for channel. Exiting. \n"); + err_msg("Unable to malloc memory for channel. Exiting. \n"); exit(1); } @@ -536,7 +536,7 @@ status = apr_pollset_add(listen_channels, &socket_pollfd); if(status != APR_SUCCESS) { - fprintf(stderr,"Failed to add socket to pollset. Exiting.\n"); + err_msg("Failed to add socket to pollset. Exiting.\n"); exit(1); } } @@ -571,7 +571,7 @@ interface, 1);// blocking w/timeout if(!socket) { - fprintf(stderr,"Unable to create tcp_accept_channel. Exiting.\n"); + err_msg("Unable to create tcp_accept_channel. Exiting.\n"); exit(1); } @@ -583,7 +583,7 @@ channel = apr_pcalloc( pool, sizeof(Ganglia_channel)); if(!channel) { - fprintf(stderr,"Unable to malloc data for channel. Exiting.\n"); + err_msg("Unable to malloc data for channel. Exiting.\n"); exit(1); } @@ -602,7 +602,7 @@ status = apr_pollset_add(listen_channels, &socket_pollfd); if(status != APR_SUCCESS) { - fprintf(stderr,"Failed to add socket to pollset. Exiting.\n"); + err_msg("Failed to add socket to pollset. Exiting.\n"); exit(1); } } @@ -1486,7 +1486,7 @@ if (apr_dso_load(&modHandle, modPath, global_context) != APR_SUCCESS) { char my_error[256]; - fprintf (stderr, "Cannot load %s metric module: %s\n", modPath, + err_msg("Cannot load %s metric module: %s\n", modPath, apr_dso_error(modHandle, my_error, sizeof(my_error))); continue; } @@ -1498,7 +1498,7 @@ if (apr_dso_sym(&modSym, modHandle, modName) != APR_SUCCESS) { char my_error[256]; - fprintf (stderr, "Cannot locate internal module structure '%s' in file %s: %s\n", + err_msg("Cannot locate internal module structure '%s' in file %s: %s\n", modName, modPath, apr_dso_error(modHandle, my_error, sizeof(my_error))); continue; } @@ -1514,7 +1514,7 @@ * */ if (modp->magic != MMODULE_MAGIC_COOKIE) { - fprintf (stderr, "Internal module structure '%s' in file %s is not compatible -" + err_msg("Internal module structure '%s' in file %s is not compatible -" "perhaps this is not a metric module.\n", modName, modPath); continue; @@ -1642,7 +1642,7 @@ sizeof(Ganglia_collection_group)); if(!group) { - fprintf(stderr,"Unable to malloc memory for collection group. Exiting.\n"); + err_msg("Unable to malloc memory for collection group. Exiting.\n"); exit(1); } @@ -1679,7 +1679,7 @@ if(!metric_cb) { - fprintf(stderr,"Unable to collect metric '%s' on this platform. Exiting.\n", name); + err_msg("Unable to collect metric '%s' on this platform. Exiting.\n", name); exit(1); } @@ -1704,7 +1704,7 @@ } else { - fprintf(stderr,"Unable to send metric '%s' (not in protocol.x). Exiting.\n", name); + err_msg("Unable to send metric '%s' (not in protocol.x). Exiting.\n", name); exit(1); } } @@ -1874,14 +1874,14 @@ cb->info->tmax, 0); if (errors) { - fprintf(stderr,"Error %d setting the modular data for %s\n", errors, cb->name); + err_msg("Error %d setting the modular data for %s\n", errors, cb->name); } else { errors = Ganglia_gmetric_send(gmetric, udp_send_channels); if (errors) { - fprintf(stderr,"Error %d sending the modular data for %s\n", errors, cb->name); + err_msg("Error %d sending the modular data for %s\n", errors, cb->name); debug_msg("\tsent message '%s' with %d errors", cb->name, errors); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2007-11-27 18:57:48
|
Revision: 885 http://ganglia.svn.sourceforge.net/ganglia/?rev=885&view=rev Author: bnicholes Date: 2007-11-27 10:57:53 -0800 (Tue, 27 Nov 2007) Log Message: ----------- Don't report heartbeat or location as standard metrics Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2007-11-27 10:10:28 UTC (rev 884) +++ trunk/monitor-core/gmond/gmond.c 2007-11-27 18:57:53 UTC (rev 885) @@ -1307,6 +1307,10 @@ if (!data || !val) return APR_SUCCESS; + if (!strcasecmp(data->name, "heartbeat") || !strcasecmp(data->name, "location")) + { + return APR_SUCCESS; + } len = apr_snprintf(metricxml, 1024, "<METRIC NAME=\"%s\" VAL=\"%s\" TYPE=\"%s\" UNITS=\"%s\" TN=\"%d\" TMAX=\"%d\" DMAX=\"0\" SLOPE=\"%s\" SOURCE=\"gmond\">\n", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2007-11-27 20:38:14
|
Revision: 888 http://ganglia.svn.sourceforge.net/ganglia/?rev=888&view=rev Author: bnicholes Date: 2007-11-27 12:38:15 -0800 (Tue, 27 Nov 2007) Log Message: ----------- Don't exit gmond if on an invalid spoof message. Just report the error can keep going Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2007-11-27 20:21:03 UTC (rev 887) +++ trunk/monitor-core/gmond/gmond.c 2007-11-27 20:38:15 UTC (rev 888) @@ -646,13 +646,15 @@ spoofIP = buff; if( !(spoofName = strchr(buff+1,':')) ){ err_msg("Incorrect format for spoof argument. exiting.\n"); - exit(1); + if (buff) free(buff); + return NULL; } *spoofName = 0; spoofName++; if(!(*spoofName)){ err_msg("Incorrect format for spoof argument. exiting.\n"); - exit(1); + if (buff) free(buff); + return NULL; } debug_msg(" spoofName: %s spoofIP: %s \n",spoofName,spoofIP); @@ -1045,8 +1047,15 @@ switch (id) { case gmetadata_request: - xdr_Ganglia_metadata_msg(&x, &fmsg); - hostdata = Ganglia_host_get(remoteip, remotesa, &(fmsg.Ganglia_metadata_msg_u.grequest.metric_id)); + ret = xdr_Ganglia_metadata_msg(&x, &fmsg); + if (ret) + hostdata = Ganglia_host_get(remoteip, remotesa, &(fmsg.Ganglia_metadata_msg_u.grequest.metric_id)); + if(!ret || !hostdata) + { + /* Processing of this message is finished ... */ + xdr_free((xdrproc_t)xdr_Ganglia_metadata_msg, (char *)&fmsg); + break; + } debug_msg("Processing a metric metadata request message from %s", hostdata->hostname); Ganglia_metadata_request(hostdata, &fmsg); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2007-12-09 00:02:28
|
Revision: 904 http://ganglia.svn.sourceforge.net/ganglia/?rev=904&view=rev Author: carenas Date: 2007-12-08 16:02:34 -0800 (Sat, 08 Dec 2007) Log Message: ----------- not defined if --enable-static-build Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2007-12-08 16:55:47 UTC (rev 903) +++ trunk/monitor-core/gmond/gmond.c 2007-12-09 00:02:34 UTC (rev 904) @@ -1102,7 +1102,9 @@ debug_msg("Processing a metric value message from %s", hostdata->hostname); Ganglia_value_save(hostdata, &vmsg); Ganglia_update_vidals(hostdata, &vmsg); +#ifdef USING_APR_12 Ganglia_metadata_check( p, hostdata, &vmsg); +#endif break; default: ganglia_scoreboard_inc(PKTS_RECVD_IGNORED); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2007-12-31 18:12:39
|
Revision: 916 http://ganglia.svn.sourceforge.net/ganglia/?rev=916&view=rev Author: bnicholes Date: 2007-12-31 10:12:40 -0800 (Mon, 31 Dec 2007) Log Message: ----------- re-enable Ganglia_metadata_check() function since the memory pool is no longer needed by the function Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2007-12-18 21:43:33 UTC (rev 915) +++ trunk/monitor-core/gmond/gmond.c 2007-12-31 18:12:40 UTC (rev 916) @@ -782,7 +782,7 @@ } static void -Ganglia_metadata_check( apr_pool_t *p, Ganglia_host *host, Ganglia_value_msg *vmsg ) +Ganglia_metadata_check(Ganglia_host *host, Ganglia_value_msg *vmsg ) { char *metric_name = vmsg->Ganglia_value_msg_u.gstr.metric_id.name; Ganglia_metadata *metric = @@ -1102,9 +1102,7 @@ debug_msg("Processing a metric value message from %s", hostdata->hostname); Ganglia_value_save(hostdata, &vmsg); Ganglia_update_vidals(hostdata, &vmsg); -#ifdef USING_APR_12 - Ganglia_metadata_check( p, hostdata, &vmsg); -#endif + Ganglia_metadata_check(hostdata, &vmsg); break; default: ganglia_scoreboard_inc(PKTS_RECVD_IGNORED); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2008-01-24 20:20:35
|
Revision: 931 http://ganglia.svn.sourceforge.net/ganglia/?rev=931&view=rev Author: bnicholes Date: 2008-01-24 12:20:13 -0800 (Thu, 24 Jan 2008) Log Message: ----------- Don't reset the time comparison variable during the metric send loop. Use the time value that was set during the main() loop so that the metric expirations are handled at the same time. Submitted by: Matthias Blankenhaus <matthias sgi com> Reviewed by: Brad Nicholes <bnicholes novell com> Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2008-01-24 16:21:11 UTC (rev 930) +++ trunk/monitor-core/gmond/gmond.c 2008-01-24 20:20:13 UTC (rev 931) @@ -1769,6 +1769,7 @@ if (strcasecmp(name, mi[k].name) == 0) { memcpy (metric_info, &(mi[k]), sizeof(Ganglia_25metric)); + break; } } @@ -1959,7 +1960,6 @@ int len, errors; char metricmsg[max_udp_message_len]; Ganglia_metric_callback *cb = ((Ganglia_metric_callback **)(group->metric_array->elts))[i]; - apr_time_t now = apr_time_now(); /* Build the message */ switch(cb->info->type) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2008-02-05 00:28:33
|
Revision: 935 http://ganglia.svn.sourceforge.net/ganglia/?rev=935&view=rev Author: bnicholes Date: 2008-02-04 16:28:38 -0800 (Mon, 04 Feb 2008) Log Message: ----------- Perform a deep copy of the XDR data when storing the metadata and value packets. Then free the xdr data structure. This fixes a memory leak due to orphaned xdr data packets. Also convert the clean up time to apr_time so that the comparison is evaluated correctly. This avoids clean up being called on every iteration. Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2008-02-05 00:23:43 UTC (rev 934) +++ trunk/monitor-core/gmond/gmond.c 2008-02-05 00:28:38 UTC (rev 935) @@ -818,34 +818,6 @@ return; } -static Ganglia_metadata * -Ganglia_metadata_create( apr_pool_t *p ) -{ - apr_status_t status; - Ganglia_metadata *metric = NULL; - apr_pool_t *pool = NULL; - - if(!p) - return NULL; - - /* Create the context for this metric */ - status = apr_pool_create( &pool, p); - if(status != APR_SUCCESS) - return NULL; - - /* Allocate a new metric from this context */ - metric = apr_pcalloc( pool, sizeof(Ganglia_metadata)); - if(!metric) - { - /* out of mem... kill context.. return null */ - apr_pool_destroy(pool); - return NULL; - } - - metric->pool = pool; - return metric; -} - #if 0 static void Ganglia_metadata_free( Ganglia_metadata *metric ) @@ -856,80 +828,89 @@ } #endif -static Ganglia_metadata * -Ganglia_message_find_value(Ganglia_host *host, Ganglia_value_msg *message) -{ - Ganglia_metadata *metric = - (Ganglia_metadata *)apr_hash_get( host->gmetrics, - message->Ganglia_value_msg_u.gstr.metric_id.name, - APR_HASH_KEY_STRING); - if(!metric) - { - /* This is a new metric sent from this host... allocate space for this data */ - metric = Ganglia_metadata_create( host->pool ); - if(!metric) - { - /* no memory */ - return NULL; - } - - /* NOTE: In order for gmetric messages to be properly saved to the hash table - * based on the name of the gmetric sent...we need to strdup() the name - * since the xdr_free below will blast the value later (along with the other - * allocated structure elements). This is only performed once at gmetric creation */ - metric->name = apr_pstrdup( metric->pool, message->Ganglia_value_msg_u.gstr.metric_id.name ); - } - return metric; -} - - -static Ganglia_metadata * -Ganglia_message_find_metadata( Ganglia_host *host, Ganglia_metadata_msg *message) -{ - Ganglia_metadata *metric = - (Ganglia_metadata *)apr_hash_get( host->metrics, - message->Ganglia_metadata_msg_u.gfull.metric_id.name, - APR_HASH_KEY_STRING); - if(!metric) - { - /* This is a new metric sent from this host... allocate space for this data */ - metric = Ganglia_metadata_create( host->pool ); - if(!metric) - { - /* no memory */ - return NULL; - } - - /* NOTE: In order for gmetric messages to be properly saved to the hash table - * based on the name of the gmetric sent...we need to strdup() the name - * since the xdr_free below will blast the value later (along with the other - * allocated structure elements). This is only performed once at gmetric creation */ - metric->name = apr_pstrdup( metric->pool, message->Ganglia_metadata_msg_u.gfull.metric_id.name ); - } - return metric; -} - static void Ganglia_metadata_save( Ganglia_host *host, Ganglia_metadata_msg *message ) { - Ganglia_metadata *metric = NULL; - - if(!host || !message) - return; + /* Search for the Ganglia_metadata in the Ganglia_host */ + Ganglia_metadata *metric = + (Ganglia_metadata *)apr_hash_get(host->metrics, + message->Ganglia_metadata_msg_u.gfull.metric_id.name, + APR_HASH_KEY_STRING); + if(!host || !message) + return; + + if(metric) + { + apr_pool_clear(metric->pool); + } + else + { + apr_status_t status; - /* Search for the Ganglia_metadata in the Ganglia_host */ - metric = Ganglia_message_find_metadata(host, message); + /* This is a new metric sent from this host... allocate space for this data */ + + /* Allocate a new metric from this context */ + metric = apr_pcalloc(host->pool, sizeof(Ganglia_metadata)); + if(!metric) + return; - if(metric) - { - memcpy(&(metric->message_u.f_message), message, sizeof(Ganglia_metadata_msg)); - metric->last_heard_from = apr_time_now(); + /* Create the context for this metric */ + status = apr_pool_create(&(metric->pool), host->pool); + if(status != APR_SUCCESS) + return; - /* Save the full metric */ - apr_hash_set(host->metrics, metric->name, APR_HASH_KEY_STRING, metric); - debug_msg("saving metadata for metric: %s host: %s", metric->name, host->hostname); + /* NOTE: In order for gmetric messages to be properly saved to the hash table + * based on the name of the gmetric sent...we need to strdup() the name + * since the xdr_free below will blast the value later (along with the other + * allocated structure elements). This is only performed once at gmetric creation */ + metric->name = apr_pstrdup(host->pool, message->Ganglia_metadata_msg_u.gfull.metric_id.name); + debug_msg("***Allocating metadata packet for host--%s-- and metric --%s-- ****\n", host->hostname, metric->name); } - xdr_free((xdrproc_t)xdr_Ganglia_metadata_msg, (char *)&(message)); + + if(metric) + { + Ganglia_metadata_msg *fmessage = &(metric->message_u.f_message); + u_int i,mlen = message->Ganglia_metadata_msg_u.gfull.metric.metadata.metadata_len; + + fmessage->id = message->id; + fmessage->Ganglia_metadata_msg_u.gfull.metric_id.host = + apr_pstrdup(metric->pool, message->Ganglia_metadata_msg_u.gfull.metric_id.host); + fmessage->Ganglia_metadata_msg_u.gfull.metric_id.name = + apr_pstrdup(metric->pool, message->Ganglia_metadata_msg_u.gfull.metric_id.name); + fmessage->Ganglia_metadata_msg_u.gfull.metric_id.spoof = + message->Ganglia_metadata_msg_u.gfull.metric_id.spoof; + fmessage->Ganglia_metadata_msg_u.gfull.metric.type = + apr_pstrdup(metric->pool, message->Ganglia_metadata_msg_u.gfull.metric.type); + fmessage->Ganglia_metadata_msg_u.gfull.metric.name = + apr_pstrdup(metric->pool, message->Ganglia_metadata_msg_u.gfull.metric.name); + fmessage->Ganglia_metadata_msg_u.gfull.metric.units = + apr_pstrdup(metric->pool, message->Ganglia_metadata_msg_u.gfull.metric.units); + fmessage->Ganglia_metadata_msg_u.gfull.metric.slope = + message->Ganglia_metadata_msg_u.gfull.metric.slope; + fmessage->Ganglia_metadata_msg_u.gfull.metric.tmax = + message->Ganglia_metadata_msg_u.gfull.metric.tmax; + fmessage->Ganglia_metadata_msg_u.gfull.metric.dmax = + message->Ganglia_metadata_msg_u.gfull.metric.dmax; + fmessage->Ganglia_metadata_msg_u.gfull.metric.metadata.metadata_len = mlen; + + fmessage->Ganglia_metadata_msg_u.gfull.metric.metadata.metadata_val = + apr_pcalloc(metric->pool, sizeof(Ganglia_extra_data)*mlen); + for (i = 0; i < mlen; i++) + { + fmessage->Ganglia_metadata_msg_u.gfull.metric.metadata.metadata_val[i].name = + apr_pstrdup(metric->pool, + message->Ganglia_metadata_msg_u.gfull.metric.metadata.metadata_val[i].name); + fmessage->Ganglia_metadata_msg_u.gfull.metric.metadata.metadata_val[i].data = + apr_pstrdup(metric->pool, + message->Ganglia_metadata_msg_u.gfull.metric.metadata.metadata_val[i].data); + } + + metric->last_heard_from = apr_time_now(); + + /* Save the full metric */ + apr_hash_set(host->metrics, metric->name, APR_HASH_KEY_STRING, metric); + debug_msg("saving metadata for metric: %s host: %s", metric->name, host->hostname); + } } static void @@ -945,31 +926,104 @@ if (metric_cb) metric_cb->metadata_last_sent = 0; debug_msg("setting metadata request flag for metric: %s host: %s", name, host->hostname); - - xdr_free((xdrproc_t)xdr_Ganglia_metadata_msg, (char *)&(message)); } static void Ganglia_value_save( Ganglia_host *host, Ganglia_value_msg *message ) { - Ganglia_metadata *metric = NULL; - + /* Search for the Ganglia_metric in the Ganglia_host */ + Ganglia_metadata *metric = + (Ganglia_metadata *)apr_hash_get( host->gmetrics, + message->Ganglia_value_msg_u.gstr.metric_id.name, + APR_HASH_KEY_STRING); if(!host || !message) return; - /* Search for the Ganglia_metric in the Ganglia_host */ - metric = Ganglia_message_find_value(host, message); + if(metric) + { + apr_pool_clear(metric->pool); + } + else + { + apr_status_t status; + /* This is a new metric sent from this host... allocate space for this data */ + + /* Allocate a new metric from this context */ + metric = apr_pcalloc(host->pool, sizeof(Ganglia_metadata)); + if(!metric) + { + /* no memory */ + return; + } + + /* Create the context for this metric */ + status = apr_pool_create(&(metric->pool), host->pool); + if(status != APR_SUCCESS) + return; + + /* NOTE: In order for gmetric messages to be properly saved to the hash table + * based on the name of the gmetric sent...we need to strdup() the name + * since the xdr_free below will blast the value later (along with the other + * allocated structure elements). This is only performed once at gmetric creation */ + metric->name = apr_pstrdup(host->pool, message->Ganglia_value_msg_u.gstr.metric_id.name ); + debug_msg("***Allocating value packet for host--%s-- and metric --%s-- ****\n", host->hostname, metric->name); + } + + if(metric) { - memcpy(&(metric->message_u.v_message), message, sizeof(Ganglia_value_msg)); + Ganglia_value_msg *vmessage = &(metric->message_u.v_message); + + vmessage->id = message->id; + vmessage->Ganglia_value_msg_u.gstr.metric_id.host = + apr_pstrdup(metric->pool, message->Ganglia_value_msg_u.gstr.metric_id.host); + vmessage->Ganglia_value_msg_u.gstr.metric_id.name = + apr_pstrdup(metric->pool, message->Ganglia_value_msg_u.gstr.metric_id.name); + vmessage->Ganglia_value_msg_u.gstr.metric_id.spoof = + message->Ganglia_value_msg_u.gstr.metric_id.spoof; + vmessage->Ganglia_value_msg_u.gstr.fmt = + apr_pstrdup(metric->pool, message->Ganglia_value_msg_u.gstr.fmt); + + switch(message->id) + { + case gmetric_string: + vmessage->Ganglia_value_msg_u.gstr.str = + apr_pstrdup(metric->pool, message->Ganglia_value_msg_u.gstr.str); + break; + case gmetric_ushort: + vmessage->Ganglia_value_msg_u.gu_short.u_short = + message->Ganglia_value_msg_u.gu_short.u_short; + break; + case gmetric_short: + vmessage->Ganglia_value_msg_u.gs_short.s_short = + message->Ganglia_value_msg_u.gs_short.s_short; + break; + case gmetric_uint: + vmessage->Ganglia_value_msg_u.gu_int.u_int = + message->Ganglia_value_msg_u.gu_int.u_int; + break; + case gmetric_int: + vmessage->Ganglia_value_msg_u.gs_int.s_int = + message->Ganglia_value_msg_u.gs_int.s_int; + break; + case gmetric_float: + vmessage->Ganglia_value_msg_u.gf.f = + message->Ganglia_value_msg_u.gf.f; + break; + case gmetric_double: + vmessage->Ganglia_value_msg_u.gd.d = + message->Ganglia_value_msg_u.gd.d; + break; + default: + break; + } + metric->last_heard_from = apr_time_now(); /* Save the last update metric */ apr_hash_set(host->gmetrics, metric->name, APR_HASH_KEY_STRING, metric); } - - xdr_free((xdrproc_t)xdr_Ganglia_value_msg, (char *)&(message)); } @@ -1065,6 +1119,7 @@ } debug_msg("Processing a metric metadata request message from %s", hostdata->hostname); Ganglia_metadata_request(hostdata, &fmsg); + xdr_free((xdrproc_t)xdr_Ganglia_metadata_msg, (char *)&fmsg); break; case gmetadata_full: ganglia_scoreboard_inc(PKTS_RECVD_METADATA); @@ -1080,6 +1135,7 @@ } debug_msg("Processing a metric metadata message from %s", hostdata->hostname); Ganglia_metadata_save( hostdata, &fmsg ); + xdr_free((xdrproc_t)xdr_Ganglia_metadata_msg, (char *)&fmsg); break; case gmetric_ushort: case gmetric_short: @@ -1096,13 +1152,14 @@ { ganglia_scoreboard_inc(PKTS_RECVD_FAILED); /* Processing of this message is finished ... */ - xdr_free((xdrproc_t)xdr_Ganglia_metadata_msg, (char *)&fmsg); + xdr_free((xdrproc_t)xdr_Ganglia_value_msg, (char *)&vmsg); break; } debug_msg("Processing a metric value message from %s", hostdata->hostname); Ganglia_value_save(hostdata, &vmsg); Ganglia_update_vidals(hostdata, &vmsg); Ganglia_metadata_check(hostdata, &vmsg); + xdr_free((xdrproc_t)xdr_Ganglia_value_msg, (char *)&vmsg); break; default: ganglia_scoreboard_inc(PKTS_RECVD_IGNORED); @@ -2343,17 +2400,18 @@ setup_listen_channels_pollset(); } + /* even if mute, a send channel may be needed to send a request for metadata */ + udp_send_channels = Ganglia_udp_send_channels_create( global_context, config_file ); + if(!udp_send_channels) + { + /* if there are no send channels defined, we are equivalent to mute */ + mute = 1; + } if(!mute) { setup_collection_groups(); - udp_send_channels = Ganglia_udp_send_channels_create( global_context, config_file ); } - if(!udp_send_channels) - { - /* if there are no send channels defined, we are equivalent to mute */ - mute = 1; - } if(!listen_channels) { /* if there are no listen channels defined, we are equivalent to deaf */ @@ -2390,7 +2448,7 @@ if(!deaf) { /* cleanup the data if the cleanup threshold has been met */ - if( (now - last_cleanup) > cleanup_threshold ) + if( (now - last_cleanup) > apr_time_make(cleanup_threshold,0)) { cleanup_data( cleanup_context, now ); last_cleanup = now; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kn...@us...> - 2008-02-23 10:26:41
|
Revision: 993 http://ganglia.svn.sourceforge.net/ganglia/?rev=993&view=rev Author: knobi1 Date: 2008-02-23 02:26:32 -0800 (Sat, 23 Feb 2008) Log Message: ----------- MKN: Make use of real process name for syslog, in case more than one gmond executable is running Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2008-02-23 09:36:46 UTC (rev 992) +++ trunk/monitor-core/gmond/gmond.c 2008-02-23 10:26:32 UTC (rev 993) @@ -251,7 +251,7 @@ /* enable errmsg logging to syslog */ daemon_proc = 1; - openlog ("GMOND", LOG_PID, LOG_DAEMON); + openlog (argv[0], LOG_PID, LOG_DAEMON); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-03-03 10:13:41
|
Revision: 1024 http://ganglia.svn.sourceforge.net/ganglia/?rev=1024&view=rev Author: carenas Date: 2008-03-03 02:13:05 -0800 (Mon, 03 Mar 2008) Log Message: ----------- gmond: avoid buffer overflow using snprintf instead of sprintf Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2008-03-03 09:54:34 UTC (rev 1023) +++ trunk/monitor-core/gmond/gmond.c 2008-03-03 10:13:05 UTC (rev 1024) @@ -2216,7 +2216,9 @@ { if (strcasecmp(cb->name, metric_info[i].name) == 0) { - sprintf (modular_desc, "%s (module %s)", metric_info[i].desc, cb->modp->module_name); + snprintf (modular_desc, sizeof(modular_desc), + "%s (module %s)", + metric_info[i].desc, cb->modp->module_name); desc = (char*)modular_desc; break; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-03-03 10:24:28
|
Revision: 1025 http://ganglia.svn.sourceforge.net/ganglia/?rev=1025&view=rev Author: carenas Date: 2008-03-03 02:22:42 -0800 (Mon, 03 Mar 2008) Log Message: ----------- gmond: use strncpy instead of strcpy to avoid heap overflow Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2008-03-03 10:13:05 UTC (rev 1024) +++ trunk/monitor-core/gmond/gmond.c 2008-03-03 10:22:42 UTC (rev 1025) @@ -643,7 +643,8 @@ spoof_info_len = strlen(metric_id->host); buff = malloc(spoof_info_len+1); - strcpy(buff,metric_id->host); + strncpy(buff, metric_id->host, spoof_info_len); + buff[spoof_info_len + 1] = '\0'; spoofIP = buff; if( !(spoofName = strchr(buff+1,':')) ){ err_msg("Incorrect format for spoof argument. exiting.\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-03-13 06:49:24
|
Revision: 1052 http://ganglia.svn.sourceforge.net/ganglia/?rev=1052&view=rev Author: carenas Date: 2008-03-12 23:49:29 -0700 (Wed, 12 Mar 2008) Log Message: ----------- cygwin: ifdef user variable for cygwin becoming another user is not supported in cygwin with setuid being a NOOP leaving the user variable unused : gmond.c: In function 'setuid_if_necessary': gmond.c: 263: warning: unused variable 'user' Signed-off-by: Carlo Marcelo Arenas Belon <ca...@sa...> Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2008-03-13 03:33:57 UTC (rev 1051) +++ trunk/monitor-core/gmond/gmond.c 2008-03-13 06:49:29 UTC (rev 1052) @@ -260,7 +260,9 @@ { cfg_t *tmp; int setuid; +#ifndef CYGWIN char *user; +#endif tmp = cfg_getsec( config_file, "globals"); setuid = cfg_getbool( tmp, "setuid" ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-03-17 13:19:24
|
Revision: 1074 http://ganglia.svn.sourceforge.net/ganglia/?rev=1074&view=rev Author: carenas Date: 2008-03-17 06:19:30 -0700 (Mon, 17 Mar 2008) Log Message: ----------- cygwin: remove duplicated include for protocol.h protocol.h is also included as part of metric.h and cygwin doesn't add #defines around it to protect it from multiple includes Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2008-03-17 13:18:16 UTC (rev 1073) +++ trunk/monitor-core/gmond/gmond.c 2008-03-17 13:19:30 UTC (rev 1074) @@ -27,7 +27,6 @@ #include "apr_net.h" /* our private network functions based on apr */ #include "debug_msg.h" #include "error.h" -#include "protocol.h" /* generated header from ./lib/protocol.x xdr definition file */ #include "dtd.h" /* the DTD definition for our XML */ #include "g25_config.h" /* for converting old file formats to new */ #include "daemon_init.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-03-30 06:34:57
|
Revision: 1159 http://ganglia.svn.sourceforge.net/ganglia/?rev=1159&view=rev Author: carenas Date: 2008-03-29 23:35:02 -0700 (Sat, 29 Mar 2008) Log Message: ----------- build: define build_default_gmond_configuration for gmond gmond.c: In function 'main': gmond.c:2326: warning: implicit declaration of function 'build_default_gmond_configuration' Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2008-03-30 06:01:03 UTC (rev 1158) +++ trunk/monitor-core/gmond/gmond.c 2008-03-30 06:35:02 UTC (rev 1159) @@ -29,8 +29,8 @@ #include "g25_config.h" /* for converting old file formats to new */ #include "daemon_init.h" #include "scoreboard.h" +#include "ganglia_priv.h" - /* Specifies a single value metric callback */ #define CB_NOINDEX -1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2008-04-18 19:56:17
|
Revision: 1255 http://ganglia.svn.sourceforge.net/ganglia/?rev=1255&view=rev Author: bnicholes Date: 2008-04-18 12:51:37 -0700 (Fri, 18 Apr 2008) Log Message: ----------- Add a check for the module magic number that coresponds to whether the module interface of gmond is compatible with the module being loaded Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2008-04-18 16:51:22 UTC (rev 1254) +++ trunk/monitor-core/gmond/gmond.c 2008-04-18 19:51:37 UTC (rev 1255) @@ -1700,6 +1700,14 @@ continue; } + /* Validate that the module was built against a compatible module interface API. */ + if (modp->version != MMODULE_MAGIC_NUMBER_MAJOR) { + err_msg("Module \"%s\" is not compatible with this " + "version of Gmond (found %d, need %d).", + modName, modp->version, MMODULE_MAGIC_NUMBER_MAJOR); + continue; + } + if (metric_modules != NULL) { modp->next = metric_modules; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-04-22 04:03:14
|
Revision: 1275 http://ganglia.svn.sourceforge.net/ganglia/?rev=1275&view=rev Author: carenas Date: 2008-04-21 21:02:44 -0700 (Mon, 21 Apr 2008) Log Message: ----------- gmond: use fabs[f] values for floating metrics absolute calculation preventing the threshold detection in metrics using floating values (like load_one) Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2008-04-21 21:11:18 UTC (rev 1274) +++ trunk/monitor-core/gmond/gmond.c 2008-04-22 04:02:44 UTC (rev 1275) @@ -8,6 +8,7 @@ #include <stdlib.h> #include <unistd.h> #include <syslog.h> +#include <math.h> #include <apr.h> #include <apr_strings.h> @@ -1976,11 +1977,11 @@ group->next_send = 0; /* send immediately */ break; case GANGLIA_VALUE_FLOAT: - if( abs( cb->last.f - cb->now.f ) >= cb->value_threshold ) + if( fabsf( cb->last.f - cb->now.f ) >= cb->value_threshold ) group->next_send = 0; /* send immediately */ break; case GANGLIA_VALUE_DOUBLE: - if( abs( cb->last.d - cb->now.d ) >= cb->value_threshold ) + if( fabs( cb->last.d - cb->now.d ) >= cb->value_threshold ) group->next_send = 0; /* send immediately */ break; default: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Brad N. <BNI...@no...> - 2008-04-22 16:39:56
|
Carlo, I went ahead and added a backport proposal into the 3.1 STATUS file for this one, but I didn't vote on it yet because I haven't had a chance to test it. There are probably some other similar bug fixes that have already been committed to trunk but should be proposed for backport to the 3.1 branch for stabilization. Those with commit rights on the SVN repository can test and vote on any backport proposal in the STATUS file. Those without commit rights, please test anyway and give us your feedback on the devel list. Brad >>> On 4/21/2008 at 10:02 PM, in message <E1J...@sc...>, <ca...@us...> wrote: > Revision: 1275 > http://ganglia.svn.sourceforge.net/ganglia/?rev=1275&view=rev > Author: carenas > Date: 2008-04-21 21:02:44 -0700 (Mon, 21 Apr 2008) > > Log Message: > ----------- > gmond: use fabs[f] values for floating metrics absolute calculation > > preventing the threshold detection in metrics using floating values > (like load_one) > > Modified Paths: > -------------- > trunk/monitor-core/gmond/gmond.c > > Modified: trunk/monitor-core/gmond/gmond.c > =================================================================== > --- trunk/monitor-core/gmond/gmond.c 2008-04-21 21:11:18 UTC (rev 1274) > +++ trunk/monitor-core/gmond/gmond.c 2008-04-22 04:02:44 UTC (rev 1275) > @@ -8,6 +8,7 @@ > #include <stdlib.h> > #include <unistd.h> > #include <syslog.h> > +#include <math.h> > > #include <apr.h> > #include <apr_strings.h> > @@ -1976,11 +1977,11 @@ > group->next_send = 0; /* send immediately */ > break; > case GANGLIA_VALUE_FLOAT: > - if( abs( cb->last.f - cb->now.f ) >= cb->value_threshold ) > + if( fabsf( cb->last.f - cb->now.f ) >= cb->value_threshold ) > group->next_send = 0; /* send immediately */ > break; > case GANGLIA_VALUE_DOUBLE: > - if( abs( cb->last.d - cb->now.d ) >= cb->value_threshold ) > + if( fabs( cb->last.d - cb->now.d ) >= cb->value_threshold ) > group->next_send = 0; /* send immediately */ > break; > default: > > |
From: <bni...@us...> - 2008-05-30 18:16:41
|
Revision: 1369 http://ganglia.svn.sourceforge.net/ganglia/?rev=1369&view=rev Author: bnicholes Date: 2008-05-30 11:16:36 -0700 (Fri, 30 May 2008) Log Message: ----------- Use the lastheardfrom timestamp from the value packet rather than the metadata packet to calculate the time offset for the metric. We are more interested in the last value we got rather than the last time the metadata was received. Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2008-05-30 08:59:46 UTC (rev 1368) +++ trunk/monitor-core/gmond/gmond.c 2008-05-30 18:16:36 UTC (rev 1369) @@ -1379,7 +1379,7 @@ gmetric_value_to_str(&(val->message_u.v_message)), data->message_u.f_message.Ganglia_metadata_msg_u.gfull.metric.type, data->message_u.f_message.Ganglia_metadata_msg_u.gfull.metric.units, - (int)((now - data->last_heard_from) / APR_USEC_PER_SEC), + (int)((now - val->last_heard_from) / APR_USEC_PER_SEC), data->message_u.f_message.Ganglia_metadata_msg_u.gfull.metric.tmax, slope_to_cstr(data->message_u.f_message.Ganglia_metadata_msg_u.gfull.metric.slope)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2008-06-06 21:30:10
|
Revision: 1389 http://ganglia.svn.sourceforge.net/ganglia/?rev=1389&view=rev Author: bnicholes Date: 2008-06-06 14:30:07 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Associate the metric callback structure with the metric definition early so that we can avoid another lookup Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2008-06-06 17:38:13 UTC (rev 1388) +++ trunk/monitor-core/gmond/gmond.c 2008-06-06 21:30:07 UTC (rev 1389) @@ -190,7 +190,7 @@ apr_array_header_t *collection_groups = NULL; mmodule *metric_modules = NULL; -extern int daemon_proc; /* defined in error.c */ +extern int daemon_proc; /* defined in error.c */ /* this is just a temporary function */ void @@ -1781,6 +1781,7 @@ setup_metric_callbacks( void ) { mmodule *modp = metric_modules; + Ganglia_metric_callback *metric_cb; /* Create the metric_callbacks hash */ metric_callbacks = apr_hash_make( global_context ); @@ -1800,7 +1801,9 @@ metric_info = modp->metrics_info; for (i = 0; metric_info[i].name != NULL; i++) { - Ganglia_metric_cb_define(metric_info[i].name, modp->handler, i, modp); + metric_cb = Ganglia_metric_cb_define(metric_info[i].name, modp->handler, i, modp); + if (metric_cb) + metric_cb->info = (Ganglia_25metric*)&(metric_info[i]); } modp = modp->next; } @@ -1814,30 +1817,12 @@ float value_threshold = cfg_getfloat( metric_cfg, "value_threshold"); Ganglia_25metric *metric_info = NULL; - if (metric_cb->modp) + if (metric_cb->info) { - const Ganglia_25metric *mi = metric_cb->modp->metrics_info; - int k, klen = strlen(name); - - /*XXX Store the metric info in a hash_table so that this - lookup can be done faster. */ - - for (k = 0; mi[k].name != NULL; k++) - { - if ((is_dynamic && !strncasecmp(name, mi[k].name, klen)) || !strcasecmp(name, mi[k].name)) - { - metric_info = apr_pcalloc( global_context, sizeof(Ganglia_25metric)); - memcpy (metric_info, &(mi[k]), sizeof(Ganglia_25metric)); - metric_info->key = modular_metric; - break; - } - } + metric_info = apr_pcalloc( global_context, sizeof(Ganglia_25metric)); + memcpy (metric_info, metric_cb->info, sizeof(Ganglia_25metric)); + metric_info->key = modular_metric; } - else - { - err_msg("Unable to send metric '%s' (not in gm_protocol.x). Exiting.\n", name); - exit(1); - } if(metric_info) { @@ -1900,7 +1885,7 @@ val = apr_table_get((apr_table_t *)metric_info->metadata, SPOOF_NAME); if (val) { - char *spoofedname = apr_pstrcat(global_context, val, ":", name); + char *spoofedname = apr_pstrcat(global_context, val, ":", name, NULL); metric_cb->msg.Ganglia_value_msg_u.gstr.metric_id.name = spoofedname; metric_cb->msg.Ganglia_value_msg_u.gstr.metric_id.spoof = TRUE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-06-16 08:55:04
|
Revision: 1420 http://ganglia.svn.sourceforge.net/ganglia/?rev=1420&view=rev Author: carenas Date: 2008-06-16 01:55:00 -0700 (Mon, 16 Jun 2008) Log Message: ----------- gmond: remove redundant code "gmond.c", line 1408: warning: statement not reached Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2008-06-16 08:40:16 UTC (rev 1419) +++ trunk/monitor-core/gmond/gmond.c 2008-06-16 08:55:00 UTC (rev 1420) @@ -1401,8 +1401,6 @@ case gmetric_double: apr_snprintf(value, 1024, message->Ganglia_value_msg_u.gd.fmt, message->Ganglia_value_msg_u.gd.d); return value; - default: - return "unknown"; } return "unknown"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |