Minor update on this: It appears that libconfuse is completely unable to handle missing/default values for configuration options[1]. So adding an 'alias' option to gmond will mean that every gmond.conf file has to be updated to include an "alias=" line.
The libconfuse documentation is...limited. Could someone more familiar with it than I am offer suggestions as to how to set a default value and handle the case where the "alias=" line is not present? [1] This is a really stupid design decision, IMO. :-( On Thu, Oct 1, 2009 at 22:08, Jesse Becker <haw...@gmail.com> wrote: > 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 > -- Jesse Becker ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) 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/devconference _______________________________________________ Ganglia-developers mailing list Ganglia-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ganglia-developers