On Thu, 2012-11-01 at 20:20 +1100, Chandana De Silva wrote:
> ...
> The second issue is that I seem to have made an error in the mysql pmda.
> PCP now thinks this is a Gigabyte value.
> pminfo -d -t mysql.slave_status.seconds_behind_master
>
> mysql.slave_status.seconds_behind_master []
> Data Type: 32-bit unsigned int InDom: PM_INDOM_NULL 0xffffffff
> Semantics: instant Units: Gbyte
>
> This came from:
>
> $pmda->add_metric(pmda_pmid(3,3), PM_TYPE_U32, PM_INDOM_NULL,
> PM_SEM_INSTANT, pmda_units(1,0,0,PM_TIME_SEC,0,0),
> 'mysql.slave_status.seconds_behind_master', '', '');
>
> I think the above should be:
>
> $pmda->add_metric(pmda_pmid(3,3), PM_TYPE_U32, PM_INDOM_NULL,
> PM_SEM_INSTANT, pmda_units(0, 1, 0, 0, PM_TIME_SEC, 0),
> 'mysql.slave_status.seconds_behind_master', '', '');
>
> Is this clearly explained somewhere ?. I am not sure if I am reading the
> correct document at
> http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=0650&db=bks&srch=&fname=/SGI_Developer/PCP_PG/sgi_html/ch02.html#id5189820
The tech pubs manual remains remarkably correct after all these years,
but the only hint therein that would have helped here is
units A description of the value's units based on dimension and
scale in the three orthogonal dimensions of space, time, and
count (or events)
The perl pmda_units() function is defined as
pmda_units(dim_space,dim_time,dim_count,scale_space,scale_time,scale_count) and
is functionally equivalent to the C initializer macro PMDA_PMUNITS() which has
the unhelpful definition of #define PMDA_PMUNITS(a,b,c,d,e,f)
In both cases the six-tuplet of parameters sets the fields of a pmUnits
structure as described in the pmLookupDesc(3) man page, namely the
dimension in time, the dimension in space and the dimension in
"count" (messages, ops, events, ...) followed by the scale in time, the
scale in space and the scale in "count" ... the scale values only make
sense when the dimension in the corresponding domain are non-zero.
So, pmda_units(1,0,0,PM_TIME_SEC,0,0) specifies a metric that has a
space dimension of 1 and a space scale of 3 (PM_TIME_SEC, which is wrong
in this context, but PM_SPACE_GBYTE is also defined as 3) ... hence the
units become "Gbyte".
The corrected version of pmda_units(0, 1, 0, 0, PM_TIME_SEC, 0)
specifies a metric that has a time dimension of 1 and a time scale of
3 ... and the units are "seconds".
As Nathan suggests, "copy by example" is a good plan here ... 8^)>
|