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/impl.h>
11       #include <pcp/import.h>
12
13       int pmiAddMetric(const char *name, pmID pmid, int type, pmInDom indom,
14               int sem, pmUnits units);
15
16       cc ... -lpcp_import -lpcp
17

Perl SYNOPSIS

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

DESCRIPTION

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

DIAGNOSTICS

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

SEE ALSO

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