1PMLOADDERIVEDCONFIG(3) Library Functions Manual PMLOADDERIVEDCONFIG(3)
2
3
4
6 pmLoadDerivedConfig - load derived metric definitions from files
7
9 #include <pcp/pmapi.h>
10
11 int pmLoadDerivedConfig(char *path);
12
13 cc ... -lpcp
14
16 Derived metrics may be used to extend the available metrics with new
17 (derived) metrics using simple arithmetic expressions. The definitions
18 of these metrics can be persisted and loaded programatically by monitor
19 tools using pmLoadDerivedConfig.
20
21 The path parameter defines a colon separated list of files and/or
22 directories (the syntax is the same as for the $PATH variable for
23 sh(1)), from which derived metric specifications are to be sourced.
24 The path components are expanded into a list of files as follows: if a
25 component is a file, then that file is added to the list, else if a
26 component is a directory then recursive descent is used to enumerate
27 all files below that directory and these are added to the list. Each
28 file in the resulting list is parsed in order, and according to the
29 derived metrics syntax described below.
30
31 Each line of the file(s) identified by path is either a comment line
32 (with a ``#'' in the first position of the line) or the declaration of
33 a derived performance metric, specified as:
34
35 * the name of the derived metric, using the same ``dot notation'' syn‐
36 tax that is used for PCP performance metrics, see PCPIntro(1) and
37 pmns(5).
38
39 * an equals sign (``='')
40
41 * a valid expression for a derived metric, as described in pmRegister‐
42 Derived(3).
43
44 White space is ignored in the lines.
45
46 For each line containing a derived metric definition, pmRegister‐
47 Derived(3) is called to register the new derived metric.
48
49 The result from pmLoadDerivedConfig will be the number of derived met‐
50 rics loaded from files on the given path, else a value less than zero
51 in the case of an error.
52
54 # sample derived metric definitions
55 bad_in_pkts = network.interface.in.errors + network.interface.in.drops
56 # note the following would need to be on a single line ...
57 disk.dev.read_pct = 100 * delta(disk.dev.read) /
58 (delta(disk.dev.read) + delta(disk.dev.write))
59
61 sh(1), PCPIntro(1), PMAPI(3), pmRegisterDerived(3) and pmns(5).
62
63
64
65Performance Co-Pilot PMLOADDERIVEDCONFIG(3)