> 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"},
}

Thanks again,
Sylvester

------------------------------------------------------------------------------
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