Here's my poor attempt at a patch to add aliasing to gmond, in an effort to stimulate some discussion on the topic. The patch is against trunk. I've done some basic testing (e.g. no immediate core dumps), but that's it for the moment.
Comments? Improvements? Index: lib/libgmond.c =================================================================== --- lib/libgmond.c (revision 2093) +++ lib/libgmond.c (working copy) @@ -66,6 +66,7 @@ CFG_BOOL("gexec", 0, CFGF_NONE), CFG_INT("send_metadata_interval", 0, CFGF_NONE), CFG_STR("module_dir", NULL, CFGF_NONE), + CFG_STR("alias",NULL,CFGF_NONE), CFG_END() }; Index: gmond/gmond.c =================================================================== --- gmond/gmond.c (revision 2093) +++ gmond/gmond.c (working copy) @@ -301,6 +301,18 @@ } static void +handle_alias( void ) { + cfg_t *tmp = cfg_getsec( config_file, "globals"); + char *tmp_myname; + /* Allow for hostname aliases */ + tmp_myname = cfg_getstr(tmp, "alias"); + if (tmp_myname) { + strncpy(myname, tmp_myname, APRMAXHOSTLEN); + debug_msg("Aliasing hostname to [%s]", myname); + } +} + +static void daemonize_if_necessary( char *argv[] ) { int should_daemonize; @@ -2630,6 +2642,8 @@ gmond_argv = argv; + myname[0] = '\0'; + if (cmdline_parser (argc, argv, &args_info) != 0) exit(1) ; @@ -2658,6 +2672,7 @@ } process_configuration_file(); + handle_alias(); if(args_info.metrics_flag) { @@ -2686,7 +2701,8 @@ load_metric_modules(); /* Collect my hostname */ - apr_gethostname( myname, APRMAXHOSTLEN+1, global_context); + if (!*myname) + apr_gethostname( myname, APRMAXHOSTLEN+1, global_context); apr_signal( SIGPIPE, SIG_IGN ); apr_signal( SIGINT, sig_handler ); -- Jesse Becker ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Ganglia-developers mailing list Ganglia-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ganglia-developers