File: INSTALL.md

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (485 lines) | stat: -rw-r--r-- 16,170 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
# INSTALL

- Packages
  1. Linux Installation (rpm, deb, containers)
  2. MacOS Installation (brew+dmg)
  3. AIX Installation
  4. Solaris Installation
  5. Windows Installation
- Building from source
- Post-install steps
- Non-default build, install and run

This document describes how to configure and build the open source
PCP package from source, and how to install and finally run it.

### 1. Linux Installation

If you are using Debian, or a Debian-based distribution like Ubuntu,
PCP is included in the distribution (as of late 2008).  Run:
```
$ sudo apt-get install pcp
```

If you are using a RPM based distribution and have the binary rpm:
```
$ sudo rpm -Uvh pcp-*.rpm
```
... and skip to the final section (below) - "Post-install steps".

If you are using a container based distribution, latest builds can
be installed using the instructions for your runtime listed here:
https://quay.io/repository/performancecopilot/archive-analysis

*Special note for Ubuntu 8.04, 8.10, 9.04, 9.10 and 10.04*

I've had to make the changes below to /usr/bin/dpkg-buildpackage.
Without these two changes, my pcp builds produce bad binaries with a
bizarre array of failure modes!
```
my $default_flags = defined $build_opts->{noopt} ? "-g -O0" : "-g
-O2";
my $default_flags = defined $build_opts->{noopt} ? "-g -O0" : "-g -O0";
my %flags = ( CPPFLAGS => '',
              CFLAGS   => $default_flags,
              CXXFLAGS => $default_flags,
              FFLAGS   => $default_flags,
              #kenj# LDFLAGS  => '-Wl,-Bsymbolic-functions',
              LDFLAGS  => '',
    );
```
Without these changes, we see QA failures for 039, 061, 072, 091, 135,
147 and 151 ... and the QA 166 goes into a loop until it fills up the
root filesystem.

*-- Ken*

### 2. MacOS Installation

Installing PCP on MacOS is done using the downloaded PCP .dmg file.
From a Terminal run:
```
$ open pcp-X.Y.Z-N.dmg
```

### 3. AIX Installation

At this stage, noone is making available pre-built AIX packages.
A port to AIX has been done, and merged, however - building from
the source is currently the only option.  The packaging work is also
begun on this platform (see the build/aix/ directory in the sources).

### 4. Solaris Installation

Prebuild Solaris packages are available from the PCP download site.

At this stage the package are distributed as SVR4 package datastream
and are built on Open Solaris.

You can install the package using 'pkgadd' command, e.g.:
```
	# pkgadd -d pcp-X.Y.Z
```

During the installation the following three services are registered
with the Solaris' service management facility:
```
	# svccfg list \*/pcp/\*
	application/pcp/pmcd
	application/pcp/pmlogger
	application/pcp/pmie
	application/pcp/pmproxy
```

On the new installation all services are disabled, during the upgrade
from the previous version of PCP the state of the services is
preserved.

Use of 'svcadm' command to enable or disable is preferred over explicit
invocation of the pmcd start script.

Use 'svcs' command to check the state of the services, e.g.:
```
	# svcs -l application/pcp/pcp
	fmri         svc:/application/pcp/pcp:default
	name         Performance Co-Pilot Collector Daemon
	enabled      false
	state        disabled
	next_state   none
	state_time   20 March 2012 11:33:27 AM EST
	restarter    svc:/system/svc/restarter:default
	dependency   require_all/none svc:/system/filesystem/local:default (online) svc:/milestone/network:default (online)
```

### 5. Windows Installation

The only way to get PCP working on Windows is to build from source.

Set up PCP build environment manually. For that you can:

- download Git for Windows SDK (https://github.com/git-for-windows/build-extra/releases)
- build and install PCP from source (see below)
- set PCP_DIR to C:\git-sdk-64\mingw64
- add to the system PATH:
..1. "C:\git-sdk-64\mingw64\bin"
..2. "C:\git-sdk-64\mingw64\lib"
..3. "C:\git-sdk-64\mingw64\libexec\pcp\bin"
- start pmcd
```
$PCP_DIR\libexec\pcp\bin\pmcd.exe
```

## Building from source

### 0. Preliminaries

The PCP code base is targeted for many different operating
systems and many different combinations of related packages,
so a little planning is needed before launching into a build
from source.

Package dependencies come in several flavours:

- hard build dependencies - without these PCP cannot be
  build from source, and the build will fail in various
  ways at the compilation or packaging stages, e.g. gmake,
  autoconf, flex, bison, ...;

- optional build dependences - if these components are not
  installed the build will work, but the resultant packages
  may be missing some features or entire applications, e.g.
  extended authentication, secure connections, service
  discovery, REST API, ...;

- QA dependencies - you can ignore these unless you want to
  run the (extensive) PCP QA suite.

It is strongly recommended that you run the script:
```
$ qa/admin/check-vm
```
and review the output before commencing a build.

To identify any missing packages, check-vm uses another
PCP script list-packages, as in:
```
$ qa/admin/list-packages -m
```

If list-packages complains that no matching file is found in
```
.../qa/admin/package-lists/<distro>+<version>+<arch>
```
then PCP has never been built for your combination of distribution,
version and architecture.  You'll need to explore the
```
qa/admin/package-lists
```
directory and find the closest match, then copy that file to an
appropriate name in the same directory, or try to autogenerate
one as in:
```
$ cd qa/admin/package-lists
$ ./new
```

Once you have a list of missing packages, the simplest approach is
to install all of them with your platform's package installation
tool
(excluding the ones marked **cpan** or **pip3** which need to
be installed with cpan(1) or pip3(1) respectively).

If you want to be more targeted, then for each missing package
find the entry for your packaging system (dpkg, rpm, pkgin, etc)
in the file
```
qa/admin/other-packages/manifest
```
and it is is generally
safe to ignore packages marked as "N/A" (not available), "build
optional" or "QA optional".

### 1. Configure, build and install the package

The pcp package uses autoconf/configure and expects a GNU build
environment (your platform must at least have gmake).

#### macOS-specific pre-requisites 
```
# use Homebrew and ensure the following packages are installed 
brew install gnu-tar pkg-config python3 python-setuptools autoconf
```

To build from source using isolated VMs, see [MACOS_DEVELOPMENT.md](build/mac/MACOS_DEVELOPMENT.md).

---

### 2. Building PCP binaries
If you just want to build a .rpm, .deb, .dmg, .msi[*] and/or
tar file, use the "Makepkgs" script in the top level directory.
This will configure and build the package for your platform and leave
binary and src packages in either the build/<pkg-type> directory
or the pcp-<version>/build/<pkg-type> directory.  It will also
leave a source tar file in either the build/tar directory or the
pcp-<version>/build/tar directory.
```
$ ./Makepkgs --verbose
$ ./Makepkgs --verbose --target mingw64
```
Once "Makepkgs" completes you will have package binaries that will
need to be installed.  The recipe depends on the packaging flavour,
but the following should provide guidance:

**Container builds**
- using a build tool with the provided Dockerfile(s) invokes the
Makepkgs script at the appropriate time, so instead:
```
podman build -t pcp -f build/containers/pcp/Dockerfile .
podman build -t archive-analysis -f build/containers/archive-analysis/Dockerfile .
```

**dpkg install** (Debian and derivative distributions)
```
$ cd build/deb
$ dpkg -i *.deb
```
**rpm install** (RedHat, SuSE and their derivative distributions)
```
$ cd pcp-<version>/build/rpm
$ sudo rpm -U `ls -1 *.rpm | sed -e '/\.src\.rpm$/d'`
```
**MacOS DMG install**
```
$ open pcp-<version>/build/mac/pcp-<version>.dmg

<A Finder window opens with the .pkg - double click it to run the installer>
```

**tarball install** (where we don't have native packaging working yet)
```
$ cd pcp-<version>/build/tar
$ here=`pwd`
$ tarball=$here/pcp-[0-9]*[0-9].tar.gz
$ sudo ./preinstall
$ cd /
$ sudo tar -zxpf $tarball
$ cd $here
$ sudo ./postinstall
```
[*] Windows builds require https://fedoraproject.org/wiki/MinGW
cross-compilation.  Currently packaging is no longer performed,
although previously MSI builds were possible.  Work on tackling
this short-coming would be most welcome.

Base package list needed for Fedora (39+) cross-compilation:
    mingw64-gcc
    mingw64-binutils
    mingw64-qt6-qttools
    mingw64-qt6-qtsvg
    mingw64-qt6-qt3d
    mingw64-pkg-config
    mingw64-readline
    mingw64-xz-libs
    mingw64-pdcurses
    mingw64-libgnurx
    mingw64-python3

### 2. Account creation

If you want to build the package and install it manually you will
first need to ensure the "user" pcp is created so that key parts
of the PCP installation can run as a user other than root.
For Debian this means the following (equivalent commands are
available on all distributions):
```
$ su root
# groupadd -r pcp
# useradd -c "Performance Co-Pilot" -g pcp -d /var/lib/pcp -M -r -s /usr/sbin/nologin pcp
```

Then use the following steps (use configure options to suit your
preferences, refer to the qa/admin/myconfigure script for some
guidance and see also section D below for additional details):
```
$ ./configure --prefix=/usr --libexecdir=/usr/lib --sysconfdir=/etc \
	     --localstatedir=/var --with-rcdir=/etc/init.d
$ make
$ su root
# make install
```

   Note 0: PCP services run as non-root by default.  Create unprivileged
   users "pcp" with home directory /var/lib/pcp, and "pcpqa" with home
   directory such as /var/lib/pcp/testsuite, or as appropriate, or
   designate other userids in the pcp.conf file.

   Note 1: that there are so many "install" variants out there that we
   wrote our own script (see "install-sh" in the top level directory),
   which works on every platform supported by PCP.

   Note 2: the Windows build is particularly involved to setup, this
   is primarily due to build tools not being available by default on
   that platform.  See the PCP Glider scripts and notes in the pcpweb
   tree to configure your environment before attempting to build from
   source under Win32.

## Post-install steps

You'll need to start the Performance Metrics Collection Daemon (PMCD)
as root (consider also pmlogger, pmie and pmproxy), if your packaging
system has not done so already:

Linux:
```
$ su root
# systemctl start pmcd  (or...)
# service pmcd start  (or...)
# /etc/init.d/pmcd start  (or...)
# /etc/rc.d/init.d/pmcd start
```
Mac OS:
```
$ sudo /etc/init.d/pmcd start
```
Windows:
```
$PCP_DIR/etc/pmcd start
```
Solaris:
```
# svcadm enable application/pcp/pmcd
```
Once you have started the PMCD daemon, you can list all performance
metrics using the pminfo(1) command, E.g.
```
$ pminfo -fmdt   (you don't have to be root for this, but you may need to
		  type rehash so your shell finds the pminfo command).
```
If you are writing scripts, you may find the output from pmprobe(1)
easier to parse than that for pminfo(1). There are numerous other
PCP client tools included.

PCP can be configured to automatically log certain performance metrics
for one or more hosts. The scripts to do this are documented in
pmlogger_check(1).  On some platforms (non-Linux), this facility is not
enabled by defaults. If you want to use it, you need to

- determine which metrics to log and how often you need them
- edit $PCP_SYSCONF_DIR/pmlogger/control
- edit $PCP_SYSCONF_DIR/pmlogger/config.default
- (and any others in same dir)
- as root, "crontab -e" and add something like:
```
# -- typical PCP log management crontab entries
# daily processing of pmlogger archives and pmie logs
10      0       *       *       *       $PCP_BINADM_DIR/pmlogger_daily
15      0       *       *       *       $PCP_BINADM_DIR/pmie_daily
#
# every 30 minutes, check pmlogger and pmie instances are running
25,40   *       *       *       *       $PCP_BINADM_DIR/pmlogger_check
5,55    *       *       *       *       $PCP_BINADM_DIR/pmie_check
```
The pmie (Performance Metrics Inference Engine) daemon is _not_
configured to start by default. To enable it, you may want to (on
Linux platforms with chkconfig).
```
$ su root
# chkconfig pmie on
# edit the pmie control file (usually below $PCP_SYSCONF_DIR/pmie)
# edit the config file (usually $PCP_SYSCONF_DIR/pmie/config.default)
# set up cron scripts similar to those for pmlogger (see above)
```

#### Configure some optional Performance Metrics Domain Agents (PMDAs)

The default installation gives you the metrics for cpu, per-process,
file system, swap, network, disk, memory, interrupts, nfs/rpc and
others. These metrics are handled using the platform PMDA - namely
pmda_linux.so (Linux), pmda_darwin.dylib (Mac), or pmda_windows.dll
(Windows). It also gives you the PMCD PMDA, which contains metrics
that monitor PCP itself.

There are many other optional PMDAs that you can configure, depending
on which performance metrics you need to monitor, as follows:
Note: $PCP_PMDAS_DIR is normally /var/pcp/pmdas, see pcp.conf(5).

Web Server metrics
```
$ su root
# cd $PCP_PMDAS_DIR/apache  (i.e. cd /var/pcp/pmdas/apache)
# ./Install
# Check everything is working OK
# pminfo -fmdt apache
```

Other PMDAs in the pcp package include:

- apache - monitor apache web server stats
- cisco - monitor Cisco router stats
- dbping - query any database, extract response times
- elasticsearch - monitor an elasticsearch cluster
- kvm - monitor kernel-based virtual machine stats
- mailq - monitor the mail queue
- memcache - monitor memcache server stats
- mmv - export memory-mapped value stats from an application
- mounts - keep track of mounted file systems
- mongodb - monitor MongoDB NoSQL databases
- mysql - monitor MySQL relational databases
- oracle - monitor Oracle relational databases
- postgres - monitor PostGreSQL relational databases
- process - keep an eye on critical processes/daemons
- redis - monitor Redis NoSQL databases
- rsyslog - monitor the reliable system log daemon
- sendmail - monitor sendmail statistics
- shping - ping critical system services, extract response times
- trace - for instrumenting arbitrary applications, see pmtrace(1)
- txmon - transaction and QOS monitoring
- statsd - StatsD protocol data collector

- sample - for testing
- simple - example src code if you want to write a new PMDA
- trivial - even easier src code for a new PMDA.

The procedure for configuring all of these is to change to the
directory for the PMDA (usually below /var/lib/pcp/pmdas), and then
run the ./Install script found therein. None of these PMDAs are
configured by default - you choose the PMDAs you need and run the
Install script.  Installation can be automated (defaults chosen) by
touching .NeedInstall in the appropriate pmdas directory and then
restarting the pmcd service via its startup script.

## Non-default build, install and run

To run build and run a version of PCP that is installed in a private
location (and does not require root privileges), first create the
pcp "user" as described in section B.2 above), then
```
$ ./configure --prefix=/some/path
```
This will populate /some/path with a full PCP installation.  To use this
ensure the following are set in the environment:
```
$ PCP_DIR=/some/path; export PCP_DIR
```
Amend your shell's $PATH to include the PCP directories, found as follows:
```
$ cd /some/path
$ xtra=`grep '^PCP_BIN' etc/pcp.conf | sed -e 's/.*=//' | paste -s -d :`
$ PATH=$xtra:$PATH
```
Ensure the new libraries can be found:
```
$ LD_LIBRARY_PATH=`grep '^PCP_LIB' etc/pcp.conf \
     | sed -e 's/.*=//' | uniq | paste -s -d :`; export LD_LIBRARY_PATH
```
Tell Perl where to find loadable modules:
```
$ PERL5LIB=$PCP_DIR/usr/lib/perl5:$PCP_DIR/usr/share/perl5; export PERL5LIB
```
Allow man(1) to find the PCP manual pages:
```
$ MANPATH=`manpath`; export MANPATH:$PCP_DIR/usr/share/man
```
If your version is co-exiting with a running PCP in a default
install, then alternative port numbers in your environment for pmcd
($PMCD_PORT), pmlogger ($PMLOGGER_PORT) and pmproxy ($PMPROXY_PORT)