4 1. Linux Installation (rpm, deb)
5 2. Mac OS X Installation (dmg)
7 4. Solaris Installation
8 5. Windows Installation
11 - Non-default build, install and run
13 This document describes how to configure and build the open source
14 PCP package from source, and how to install and finally run it.
16 ### 1. Linux Installation
18 If you are using Debian, or a Debian-based distribution like Ubuntu,
19 PCP is included in the distribution (as of late 2008). Run:
24 If you are using a RPM based distribution and have the binary rpm:
28 ... and skip to the final section (below) - "Post-install steps".
30 *Special note for Ubuntu 8.04, 8.10, 9.04, 9.10 and 10.04*
32 I've had to make the changes below to /usr/bin/dpkg-buildpackage.
33 Without these two changes, my pcp builds produce bad binaries with a
34 bizarre array of failure modes!
36 my $default_flags = defined $build_opts->{noopt} ? "-g -O0" : "-g
38 my $default_flags = defined $build_opts->{noopt} ? "-g -O0" : "-g -O0";
39 my %flags = ( CPPFLAGS => '',
40 CFLAGS => $default_flags,
41 CXXFLAGS => $default_flags,
42 FFLAGS => $default_flags,
43 #kenj# LDFLAGS => '-Wl,-Bsymbolic-functions',
47 Without these changes, we see QA failures for 039, 061, 072, 091, 135,
48 147 and 151 ... and the QA 166 goes into a loop until it fills up the
53 ### 2. Mac OS X Installation
55 Installing PCP from the DMG file is as simple as clicking on the icon
56 in a Finder window, and following the prompts from the installer.
58 ### 3. AIX Installation
60 At this stage, noone is making available pre-built AIX packages.
61 A port to AIX has been done, and merged, however - building from
62 the source is currently the only option. The packaging work is also
63 begun on this platform (see the build/aix/ directory in the sources).
65 ### 4. Solaris Installation
67 Prebuild Solaris packages are available from the PCP download site.
69 At this stage the package are distributed as SVR4 package datastream
70 and are built on Open Solaris.
72 You can install the package using 'pkgadd' command, e.g.:
77 During the installation the following three services are registered
78 with the Solaris' service management facility:
80 # svccfg list \*/pcp/\*
82 application/pcp/pmlogger
84 application/pcp/pmproxy
87 On the new installation all services are disabled, during the upgrade
88 from the previous version of PCP the state of the services is
91 Use of 'svcadm' command to enable or disable is preferred over explicit
92 invocation of the pmcd start script.
94 Use 'svcs' command to check the state of the services, e.g.:
96 # svcs -l application/pcp/pcp
97 fmri svc:/application/pcp/pcp:default
98 name Performance Co-Pilot Collector Daemon
102 state_time 20 March 2012 11:33:27 AM EST
103 restarter svc:/system/svc/restarter:default
104 dependency require_all/none svc:/system/filesystem/local:default (online) svc:/milestone/network:default (online)
107 ### 5. Windows Installation
109 Download the native Windows version of PCP from bintray.com/pcp
110 which provides a .msi - the system-wide %PATH setting must be
111 manually setup to point to the installation location (C:\Glider
114 ## Building from source
118 The PCP code base is targeted for many different operating
119 systems and many different combinations of related packages,
120 so a little planning is needed before launching into a build
123 Package dependencies come in several flavours:
125 - hard build dependencies - without these PCP cannot be
126 build from source, and the build will fail in various
127 ways at the compilation or packaging stages, e.g. gmake,
128 autoconf, flex, bison, ...;
130 - optional build dependences - if these components are not
131 installed the build will work, but the resultant packages
132 may be missing some features or entire applications, e.g.
133 extended authentication, secure connections, service
134 discovery, pmwebd, ...;
136 - QA dependencies - you can ignore these unless you want to
137 run the (extensive) PCP QA suite.
139 It is strongly recommended that you run the script:
143 and review the output before commencing a build.
145 ### 1. Configure, build and install the package
147 The pcp package uses autoconf/configure and expects a GNU build
148 environment (your platform must at least have gmake).
150 If you just want to build a .RPM, .DEB, .DMG, .MSI[*] and/or tar
151 file, use the "Makepkgs" script in the top level directory.
152 This will configure and build the package for your platform and
153 leave binary and src packages in the build/<pkg-type> directory.
154 It will also leave binary and source tar file in the build/tar
157 $ ./Makepkgs --verbose
158 $ ./Makepkgs --verbose --target mingw64
161 [*] Windows builds require https://fedoraproject.org/wiki/MinGW
162 cross-compilation. Currently packaging is no longer performed,
163 although previously MSI builds were possible. Work on tackling
164 this short-coming would be most welcome.
166 ### 2. Account creation
168 If you want to build the package and install it manually you will
169 first need to ensure the "user" pcp is created so that key parts
170 of the PCP installation can run as a user other than root.
171 For Debian this means the following (equivalent commands are
172 available on all distributions):
176 # useradd -c "Performance Co-Pilot" -g pcp -d /var/lib/pcp -M -r -s /usr/sbin/nologin pcp
179 Then use the following steps (use configure options to suit your
180 preferences, refer to the qa/admin/myconfigure script for some
181 guidance and see also section D below for additional details):
183 $ ./configure --prefix=/usr --libexecdir=/usr/lib --sysconfdir=/etc \
184 --localstatedir=/var --with-rcdir=/etc/init.d
190 Note 0: PCP services run as non-root by default. Create unprivileged
191 users "pcp" with home directory /var/lib/pcp, and "pcpqa" with home
192 directory such as /var/lib/pcp/testsuite, or as appropriate, or
193 designate other userids in the pcp.conf file.
195 Note 1: that there are so many "install" variants out there that we
196 wrote our own script (see "install-sh" in the top level directory),
197 which works on every platform supported by PCP.
199 Note 2: the Windows build is particularly involved to setup, this
200 is primarily due to build tools not being available by default on
201 that platform. See the PCP Glider scripts and notes in the pcpweb
202 tree to configure your environment before attempting to build from
205 ## Post-install steps
207 You will need to start the PCP Collection Daemon (PMCD), as root:
211 # service pmcd start (or...)
212 # /etc/init.d/pmcd start (or...)
213 # /etc/rc.d/init.d/pmcd start
217 # /Library/StartupItems/pcp/pmcd start
221 $PCP_DIR/etc/pmcd start
225 # svcadm enable application/pcp/pmcd
227 Once you have started the PMCD daemon, you can list all performance
228 metrics using the pminfo(1) command, E.g.
230 # pminfo -fmdt (you don't have to be root for this, but you may need to
231 type rehash so your shell finds the pminfo command).
233 If you are writing scripts, you may find the output from pmprobe(1)
234 easier to parse than that for pminfo(1). There are numerous other
235 PCP client tools included.
237 PCP can be configured to automatically log certain performance metrics
238 for one or more hosts. The scripts to do this are documented in
239 pmlogger_check(1). By default this facility is not enabled. If you want
240 to use it, you need to
242 - determine which metrics to log and how often you need them
243 - edit $PCP_SYSCONF_DIR/pmlogger/control
244 - edit $PCP_SYSCONF_DIR/pmlogger/config.default
245 - (and any others in same dir)
246 - as root, "crontab -e" and add something like:
248 # -- typical PCP log management crontab entries
249 # daily processing of pmlogger archives and pmie logs
250 10 0 * * * $PCP_BINADM_DIR/pmlogger_daily
251 15 0 * * * $PCP_BINADM_DIR/pmie_daily
253 # every 30 minutes, check pmlogger and pmie instances are running
254 25,40 * * * * $PCP_BINADM_DIR/pmlogger_check
255 5,55 * * * * $PCP_BINADM_DIR/pmie_check
257 The pmie (Performance Metrics Inference Engine) daemon is _not_
258 configured to start by default. To enable it, you may want to (on
259 Linux platforms with chkconfig).
263 # edit the pmie control file (usually below $PCP_SYSCONF_DIR/pmie)
264 # edit the config file (usually $PCP_SYSCONF_DIR/pmie/config.default)
265 # set up cron scripts similar to those for pmlogger (see above)
268 #### Configure some optional Performance Metrics Domain Agents (PMDAs)
270 The default installation gives you the metrics for cpu, per-process,
271 file system, swap, network, disk, memory, interrupts, nfs/rpc and
272 others. These metrics are handled using the platform PMDA - namely
273 pmda_linux.so (Linux), pmda_darwin.dylib (Mac), or pmda_windows.dll
274 (Windows). It also gives you the PMCD PMDA, which contains metrics
275 that monitor PCP itself.
277 There are many other optional PMDAs that you can configure, depending
278 on which performance metrics you need to monitor, as follows:
279 Note: $PCP_PMDAS_DIR is normally /var/pcp/pmdas, see pcp.conf(5).
284 # cd $PCP_PMDAS_DIR/apache (i.e. cd /var/pcp/pmdas/apache)
286 # Check everything is working OK
287 # pminfo -fmdt apache
290 Other PMDAs in the pcp package include:
292 - apache - monitor apache web server stats
293 - cisco - monitor Cisco router stats
294 - dbping - query any database, extract response times
295 - elasticsearch - monitor an elasticsearch cluster
296 - kvm - monitor kernel-based virtual machine stats
297 - mailq - monitor the mail queue
298 - memcache - monitor memcache server stats
299 - mmv - export memory-mapped value stats from an application
300 - mounts - keep track of mounted file systems
301 - mysql - monitor MySQL relational databases
302 - oracle - monitor Oracle relational databases
303 - postgres - monitor PostGreSQL relational databases
304 - process - keep an eye on critical processes/daemons
305 - roomtemp - monitor room temp (needs suitable probe)
306 - rsyslog - monitor the reliable system log daemon
307 - sendmail - monitor sendmail statistics
308 - shping - ping critical system services, extract response times
309 - trace - for instrumenting arbitrary applications, see pmtrace(1)
310 - txmon - transaction and QOS monitoring
312 - sample - for testing
313 - simple - example src code if you want to write a new PMDA
314 - trivial - even easier src code for a new PMDA.
316 The procedure for configuring all of these is to change to the
317 directory for the PMDA (usually below /var/lib/pcp/pmdas), and then
318 run the ./Install script found therein. None of these PMDAs are
319 configured by default - you choose the PMDAs you need and run the
320 Install script. Installation can be automated (defaults chosen) by
321 touching .NeedInstall in the appropriate pmdas directory and then
322 restarting the pmcd service via its startup script.
324 ## Non-default build, install and run
326 To run build and run a version of PCP that is installed in a private
327 location (and does not require root privileges), first create the
328 pcp "user" as described in section B.2 above), then
330 $ ./configure --prefix=/some/path
332 This will populate /some/path with a full PCP installation. To use this
333 ensure the following are set in the environment:
335 $ export PCP_DIR=/some/path
337 Amend your shell's $PATH to include the PCP directories, found as follows:
340 $ xtra=`grep '^PCP_BIN' etc/pcp.conf | sed -e 's/.*=//' | paste -s -d :`
343 Ensure the new libraries can be found:
345 $ export LD_LIBRARY_PATH=`grep '^PCP_LIB' etc/pcp.conf \
346 | sed -e 's/.*=//' | uniq | paste -s -d :`
348 Tell Perl where to find loadable modules:
350 $ export PERL5LIB=$PCP_DIR/usr/lib/perl5:$PCP_DIR/usr/share/perl5
352 Allow man(1) to find the PCP manual pages:
354 $ export MANPATH=`manpath`:$PCP_DIR/usr/share/man
356 If your version is co-exiting with a running PCP in a default
357 install, then alternative port numbers in your environment for pmcd
358 ($PMCD_PORT), pmlogger ($PMLOGGER_PORT) and pmproxy ($PMPROXY_PORT)