Merge remote branch 'ddiss/master_pmda_and_client_timeouts'
[sahlberg/ctdb.git] / utils / pmda / README
1 CTDB PMDA
2 ===========
3
4 This PMDA extracts metrics from the locally running ctdbd daemon for
5 export to PMCD.
6
7 Note:
8         This PMDA may be remade from source and hence requires IDO (or
9         more specifically a C compiler) to be installed.
10
11         Uses of make(1) may fail (without removing or clobbering files)
12         if the C compiler cannot be found.  This is most likely to
13         happen when running the PMDA ./Install script.
14
15         The only remedial action is to install the C compiler, or
16         hand-craft changes to the Makefile.
17
18 Metrics
19 =======
20
21 The file ./help contains descriptions for all of the metrics exported
22 by this PMDA.
23
24 Once the PMDA has been installed, the following command will list all
25 the available metrics and their explanatory "help" text:
26
27         $ pminfo -fT ctdb
28
29 Installation
30 ============
31
32  +  # cd $PCP_PMDAS_DIR/ctdb
33
34  +  Check that there is no clash in the Performance Metrics Domain
35     defined in ./domain.h and the other PMDAs currently in use (see
36     $PCP_PMCDCONF_PATH).  If there is, edit ./domain.h to choose another
37     domain number.
38
39  +  Then simply use
40
41         # ./Install
42
43     and choose both the "collector" and "monitor" installation
44     configuration options.
45
46     You will be prompted to choose either a daemon implementation
47     or a DSO implementation of the PMDA, and in the case of the daemon
48     variant to select an IPC method -- everything else is automated
49
50 De-installation
51 ===============
52
53  +  Simply use
54
55         # cd $PCP_PMDAS_DIR/ctdb
56         # ./Remove
57
58 Troubleshooting
59 ===============
60
61  +  After installing or restarting the agent, the PMCD log file
62     ($PCP_LOG_DIR/pmcd/pmcd.log) and the PMDA log file
63     ($PCP_LOG_DIR/pmcd/pmda_ctdb.log) should be checked for any warnings
64     or errors.
65
66
67 Adding a New Metric
68 ===================
69
70 This section walks through the development task of adding a new metric to the
71 CTDB PMDA.
72
73   + Define the metric in the pmns file with a unique metric id. See the pmns(4)
74     man page for details.
75
76   + Add a description of the metric to the help file.
77
78   + Taking note of the previously assigned metric id, add a new entry to the
79     metrictab structure in pmda_ctdb.c. See the pmdaInit(3) man page for
80     details.
81
82   + Ensure the counter is already a member of the ctdb_statistics structure.
83     Finally, add code to pmda_ctdb_fetch_cb() to handle fetch requests for the
84     newly defined metric.