1PMIADDMETRIC(3)            Library Functions Manual            PMIADDMETRIC(3)
2
3
4

NAME

6       pmiAddMetric - add a new metric definition to a LOGIMPORT context
7

C SYNOPSIS

9       #include <pcp/pmapi.h>
10       #include <pcp/import.h>
11
12       int pmiAddMetric(const char *name, pmID pmid, int type, pmInDom indom,
13               int sem, pmUnits units);
14
15       cc ... -lpcp_import -lpcp
16

Perl SYNOPSIS

18       use PCP::LogImport;
19
20       pmiAddMetric($name, $pmid, $type, $indom, $sem, $units);
21

DESCRIPTION

23       As part of the Performance Co-Pilot Log Import API (see  LOGIMPORT(3)),
24       pmiAddMetric  is  used  to define a new metric.  The metric's name must
25       follow the naming conventions described in PCPIntro(1)  and  should  be
26       unique for each LOGIMPORT context.
27
28       The  other  arguments  are  in effect the fields of a pmDesc structure.
29       Refer to pmLookupDesc(3) for a complete description of the  values  and
30       semantics  of the components of this structure, and hence the valid ar‐
31       gument values for pmiAddMetrics.
32
33       The internal identifier for the metric may be given using the pmid  ar‐
34       gument  and  must  be unique for each LOGIMPORT context.  The value for
35       pmid which would typically be constructed using the  pmID_build  macro,
36       e.g.  pmID_build(PMI_DOMAIN,  0,  3)  for  the  fourth  metric in first
37       ``cluster'' of metrics in the  Performance  Metrics  Domain  PMI_DOMAIN
38       (which  is  the  default for all meta data created by the LOGIMPORT li‐
39       brary).  Alternatively, pmid may be PM_IN_NULL  and  pmiAddMetric  will
40       assign  a  unique pmid (although this means the pmid remains opaque and
41       the application must use  pmiPutValue(3)  or  pmiPutValueHandle(3)  and
42       cannot use pmiPutResult(3) to add data values to the PCP archive).
43
44       type  defines  the  data  type  of  the  metric  and must be one of the
45       PM_TYPE_...  values defined in <pcp/import.h>.
46
47       The instance domain for the metric is  defined  by  indom  and  may  be
48       PM_INDOM_NULL  for  a  metric with a singular value, else the value for
49       indom would normally be constructed using the pmInDom_build macro, e.g.
50       pmInDom_build(LOGIMPORT,0) for the first instance domain in the Perfor‐
51       mance Metrics Domain LOGIMPORT (which is the default for all meta  data
52       created by the LOGIMPORT library).  Multiple metrics can share the same
53       instance domain if they have values for a  similar  (or  more  usually,
54       identical) set of instances.
55
56       The  semantics  of  the  metric (counter, instantaneous value, etc.) is
57       specified by the sem argument which would normally be the result  of  a
58       call to the convenience constructor method pmiUnits(3).
59

DIAGNOSTICS

61       pmiAddMetric  returns zero on success else a negative value that can be
62       turned into an error message by calling pmiErrStr(3).
63

SEE ALSO

65       PCPIntro(1), LOGIMPORT(3),  pmiErrStr(3),  pmiPutResult(3),  pmiPutVal‐
66       ue(3), pmiPutValueHandle(3), pmiUnits(3) and pmLookupDesc(3).
67
68
69
70Performance Co-Pilot                                           PMIADDMETRIC(3)
Impressum