>>> On 10/5/2009 at 9:54 PM, in message
<[email protected]>, David Birdsong
<[email protected]> wrote:
> say this is my *.pyconf
> 
> i'd like to be able to send a list through the config file to the
> paramateres that are passed at init time for my python gmond module.
> is there a syntax for allowing a list to be specified...something
> like:
> 
> modules {
>   module {
>     name = "lb-monitor"
>     language = "python"
>     param server_pools {
>       value = static-uploads,
>       value = app-server
>     }
> 
>   }
> 
> and then in my python module:
> 
> def metric_init(params):
>   try:
>     server_pools = params['lb-monitor']
>   except KeyError:
>     return []
> 

A param block can not take more than one value parameter.  However you can do 
what you are looking for by using the string "params" directive instead.  For 
example:

 modules {
   module {
     name = "lb-monitor"
     language = "python"
     params = "server_pools=static-uploads,app-server 
server_foo=item1,item2,item3" 
    }
}

In other words, if you use the "params" directive you can pass in a raw string 
into the module.  You have the freedom to format this string in anyway that you 
want as long as your module knows how to parse the string.  In this case your 
python module will get one string parameter that contains the raw string that 
you defined in your configuration file.  The only thing left to do is parse the 
string and create your list.

Brad




------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; 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&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ganglia-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-general

Reply via email to