>>> On 8/9/2008 at 2:22 PM, in message <[EMAIL PROTECTED]>, Carlo Marcelo Arenas Belon <[EMAIL PROTECTED]> wrote: > On Mon, Aug 04, 2008 at 08:40:43PM +0100, Kostas Georgiou wrote: >> >> I've noticed that the python scripts are always initialized even if they >> don't have any metrics collected. > > right, that is a bug as the only way to "disable" a python script currently > is > to rename it so it won't be found by gmond. > > this behaviour is also inconsistent with the "C" modules as for them to be > loaded there needs to be a configuration instructing gmond to do so, while > python modules will load automagically even if they have no configuration to > schedule them. > >> In most cases this isn't too bad >> (assuming module_init doesn't do anything too invasive) but for example >> tcpconn.py starts a thread running netstat that will keep running even >> if nobody cares about the data. > > this is difficult to solve as it will require a redesign for the python > metrics so they have 3 methods like the "C" modules have (init, run and > cleanup) instead of 2 as it has now, so the init method will report which > callback to use from gmond core to collect the metric data instead of doing > the initialization itself. > >> One solution is to rename the .py files but this will not play well for >> people using packages since they will be readded in the next package >> update. Having a different package per plugin so they can be >> removed/added individually is also an option if no other way to disable >> a plugin is available. > > both options are just workarounds IMHO, but as you mentioned the second one > might be the only one that is RPM friendly. >
Actually this issue really isn't that hard solve. The python capability is all implemented in the C module mod_python. When mod_python's init() function is called, it simply reads the python module directory from it's configuration and then starts a readdir() loop on that location. Anything that it finds in the python module directory that has an extension of .py, mod_python loads and calls the module's metric_init() function. This behavior could be changed by simply adding a "Disabled=yes" or "Status=disabled" type of directive to the module{} section for the python module in it's configuration. Since gmond has already read and parsed the entire gmond.conf including all 'included' .conf's, whether a python module is loaded or not should be a simple matter of looking for the module{} section for a specific module and checking to see if it is enabled or disabled. If mod_python finds a .py file for a module but can not find a corresponding module{} section in the configuration, the enabled status is assumed to be 'disabled' automatically. Otherwise the enabled state is assumed to be 'enabled' unless otherwise indicated. If a python module is determined to be disabled, mod_python would not load it and obviously the python module's metric_init() would never be called. Does that work? Brad ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Ganglia-developers mailing list Ganglia-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ganglia-developers