Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   pmda    ( 3 )

введение в библиотеку поддержки агента домена Performance Metrics (introduction to the Performance Metrics Domain Agent support library)

METRIC DESCRIPTIONS

Each metric requires a description (pmDesc), which contains its
       Performance Metric Identifier (PMID), data type specification,
       instance domain, semantics and units (see pmLookupDesc(3)).  A
       handle is also provided for application specific information in
       the pmdaMetric structure:

/* * Metric description: handle for extending description, * and the description. */

typedef struct { void* m_user; /* for users external use */ pmDesc m_desc; /* metric description */ } pmdaMetric;

The simple PMDA defines the metrics as:

static pmdaMetric metrictab[] = { /* numfetch */ { (void *)0, { PMDA_PMID(0,0), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_INSTANT, { 0,0,0,0,0,0} }, }, /* color */ { (void *)0, { PMDA_PMID(0,1), PM_TYPE_32, COLOR_INDOM, PM_SEM_INSTANT, { 0,0,0,0,0,0} }, }, /* time.user */ { (void*)0, { PMDA_PMID(1,2), PM_TYPE_DOUBLE, PM_INDOM_NULL, PM_SEM_COUNTER, { 0, 1, 0, 0, PM_TIME_SEC, 0 } }, }, /* time.sys */ { (void*)0, { PMDA_PMID(1,3), PM_TYPE_DOUBLE, PM_INDOM_NULL, PM_SEM_COUNTER, { 0, 1, 0, 0, PM_TIME_SEC, 0 } }, }, /* now */ { NULL, { PMDA_PMID(2,4), PM_TYPE_U32, NOW_INDOM, PM_SEM_INSTANT, { 0,0,0,0,0,0 } }, }, };

The macro PMDA_PMID (defined in /usr/include/pcp/pmda.h) is used to specify each metric's cluster and item fields of the associated pmID. As with instance domains, the domain field is set by pmdaInit(3) at run-time, however, the default domain is assumed to be defined by the PMDA in the macro MYDOMAIN.

The metric table shown above which is usually passed to pmdaInit(3) does not need to be created if one wants to write one's own Fetch and Descriptor functions. See pmdaInit(3) for more details.