>>> On 11/16/2009 at 3:04 PM, in message <002c01ca6708$d7770020$866500...@com>,
"Sylvester Steele" <[email protected]> wrote:
> Kim,
>
> I got the tarball to which you'd put up the link earlier on in the mailing
> list. I got your module to work no problem there!
>
> But, I have a question:
>
> All the Ganglia modules have a metric array. The mod_cpu has this:
>
> static Ganglia_25metric cpu_metric_info[] =
> {
> {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"},
> {0, "cpu_user", 90, GANGLIA_VALUE_FLOAT, "%", "both",
> "%.1f", UDP_HEADER_SIZE+8, "Percentage of CPU utilization that occurred
> while executing at the user level"},
> {0, "cpu_nice", 90, GANGLIA_VALUE_FLOAT, "%", "both",
> "%.1f", UDP_HEADER_SIZE+8, "Percentage of CPU utilization that occurred
> while executing at the user level with nice priority"},
> {0, "cpu_system", 90, GANGLIA_VALUE_FLOAT, "%", "both",
> "%.1f", UDP_HEADER_SIZE+8, "Percentage of CPU utilization that occurred
> while executing at the system level"},
> {0, "cpu_idle", 90, GANGLIA_VALUE_FLOAT, "%", "both",
> "%.1f", UDP_HEADER_SIZE+8, "Percentage of time that the CPU or CPUs were
> idle and the system did not have an outstanding disk I/O request"},
> {0, "cpu_aidle", 3800, GANGLIA_VALUE_FLOAT, "%", "both",
> "%.1f", UDP_HEADER_SIZE+8, "Percent of time since boot idle CPU"},
> {0, "cpu_wio", 90, GANGLIA_VALUE_FLOAT, "%", "both",
> "%.1f", UDP_HEADER_SIZE+8, "Percentage of time that the CPU or CPUs were
> idle during which the system had an outstanding disk I/O request"},
> {0, "cpu_intr", 90, GANGLIA_VALUE_FLOAT, "%", "both",
> "%.1f", UDP_HEADER_SIZE+8, "cpu_intr"},
> {0, "cpu_sintr", 90, GANGLIA_VALUE_FLOAT, "%", "both",
> "%.1f", UDP_HEADER_SIZE+8, "cpu_sintr"},
> {0, NULL}
>
> };
>
>
> Now, what if the number of metrics that my module monitors changes? Ie If I
> want to monitor 5 metrics today but 10 tomorrow- Is it possible to
> dynamically initialize the metrics somehow?
>
> Will the following work:
>
>
> For (how many ever metrics)
> {
> cpu_metric_info[i]= appropriate string
> }
>
> And put this for loop in the metric_init function..
>
> Will that do the trick?
>
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
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-developers