>>> On 10/20/2008 at 11:19 PM, in message
<[EMAIL PROTECTED]>, "utopia zh"
<[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I'm recently working on the gmond python mode. I found that for some
> metrics, it will be beneficial if we can return multiple metric values in
> the single callback.
> 
> For example, if we want to get usage information about disks (total, used,
> free),  we can get these values via a single statvfs call, but in order to
> send these metrics out using python module, we need to call statvfs for 3
> times.
> 
> There maybe some more time-consuming examples. For example, we may need to
> parse a xml to get some values, it would save a lot of efforts if we can
> fill the value of multiple metric at the same time.
> 
> I thought that maybe OK for python module if we just return
> Value1:Values2:Value3, but in that case, we will not be able to get pictures
> from ganglia/rrdtools.
> 

The way to do this is to spawn a thread in your python module that gathers all 
of the metrics at once and then just caches them.  Then when each of your 
metric handlers are called, they each simply return the cached value.  Take a 
look at the tcpconn.py module.  This is the way that it works.  It calls 
netstat once to gather all of the various values.  Then the different metric 
handler just read the current values from the cache.

> Another question about python module is that: for some dynamically changed
> metrics (e.g. we may need to handle adding/removing storage devices), could
> we add/remove metric entry in pyconf on the fly? I noticed that using "gmond
> -m" will be able to get all entries of metrics according to metric_init,  is
> there any way to let gmond collect metrics according to metric entries given
> by metric_init of python script (instead of from conf.d/*.pyconf)?  Or we
> can go still further to let gmond call metric_init every period of time?
> 
> Any comments? Thanks.
> 

This is an issue that I have looked into a few times but haven't been able to 
come up with a solution without re-architecting the way that gmond creates its 
internal list of metrics.  This would be a nice feature to have.  The spoofing 
feature for module metrics has a dynamic element to it so there may be 
something that we can do to extend that functionality for general metrics.  But 
we need to get the spoofing feature backported to 3.1.1 first which is still 
waiting for review and approval.

Brad

 
> 
> Regards,
> 
> Hang




-------------------------------------------------------------------------
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-general mailing list
Ganglia-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-general

Reply via email to