>>> On 11/19/2009 at 6:32 AM, in message
<75fb37ae0911190532t17685eb0uc1db8390546b4...@mail.gmail.com>, Sylvester Steele
<sylvesterste...@gmail.com> wrote:
>>  Take a look at the pyth_metric_init() function in the mod_python.c module.  
> At the end of the function, mod_python takes all of the metric definitions 
> and pushes them into an APR array.  Then it sets the metric_info field of the 
> module structure with the metric_info->elts value.
>>
>>    python_module.metrics_info = (Ganglia_25metric *)metric_info->elts;
>>
>> Basically it is just a matter of calling the APR function 
> apr_array_push(metric_info); for each metric definition and then filling in 
> the structure that is returned.
>>
>> Brad
>>
> 
> Thanks Brad,
> 
> I went through that function you mentioned- if I understood it right-
> that function adds different metadata for different metrics. So for
> example:
> 
> {0, "cpu_num",    1200, GANGLIA_VALUE_UNSIGNED_SHORT, "CPUs", "zero",
> "%hu",  UDP_HEADER_SIZE+8, "Total number of CPUs"},
>    {0, "cpu_speed",  1200, GANGLIA_VALUE_UNSIGNED_INT,   "MHz",  "zero",
> "%u",  UDP_HEADER_SIZE+8, "CPU Speed in terms of MHz"},
> 
> I guess this adds more metadata to say the cpu_speed metric. I don't
> want to do that, All my metrics will have the same meta-data- its just
> that I don't know how many metrics I will have at compile time. The
> number of metrics will be determined at runtime by reading a file.
> 
> I was wondering if I could just run a loop and put in the metadata this way:
> 
> static Ganglia_25metric *mem_metric_info;
> 
> mem_metric_info= new Ganglia_25metric[num_of_metrics];
> 
> for (i=0 to <num_of_metrics){
> mem_metric_info[i]=  {0, some name,    1200,
> GANGLIA_VALUE_UNSIGNED_SHORT, "CPUs", "zero", "%hu", DP_HEADER_SIZE+8,
> "Total number of CPUs"},
> }
> 


I'm not sure what you are looking for.  The purpose of the code that I referred 
to was to show how a module would generate the metric definitions during the 
initialization phase of gmond.  Basically what happens is that when gmond is 
started it loads each module and calls the metric_init function for each 
module.  At that point each module has the opportunity to tell gmond what 
metrics it supports by passing back an array of metric definitions.  That is 
how gmond determines which module supports which metrics.  The contents of the 
metric definition array is completely up to the module itself.  However once 
the module returns the list of metric definitions, that list can not be changed 
until the next time that gmond stops and restarts.  There is no way to alter 
the list of metrics that gmond is monitoring on the fly during normal gmond 
operation.  If the latter is what you are looking for, gmond does not support 
on-the-fly functionality yet.

Brad



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ganglia-developers mailing list
Ganglia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to