Skip to content

Commit

Permalink
Merge branch 'master' of github.com:performancecopilot/pcp
Browse files Browse the repository at this point in the history
  • Loading branch information
natoscott committed May 13, 2019
2 parents 164bb31 + 87583f3 commit e86f3a2
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 44 deletions.
2 changes: 0 additions & 2 deletions build/rpm/fedora.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2698,8 +2698,6 @@ pmieconf -c enable dmthin
systemctl restart pmie >/dev/null 2>&1
systemctl enable pmcd >/dev/null 2>&1
systemctl enable pmlogger >/dev/null 2>&1
systemctl enable pmlogger_daily_report >/dev/null 2>&1
systemctl enable pmlogger_daily_report-poll >/dev/null 2>&1
systemctl enable pmie >/dev/null 2>&1
%else
/sbin/chkconfig --add pmcd >/dev/null 2>&1
Expand Down
2 changes: 0 additions & 2 deletions build/rpm/pcp.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -2780,8 +2780,6 @@ pmieconf -c enable dmthin
systemctl restart pmie >/dev/null 2>&1
systemctl enable pmcd >/dev/null 2>&1
systemctl enable pmlogger >/dev/null 2>&1
systemctl enable pmlogger_daily_report >/dev/null 2>&1
systemctl enable pmlogger_daily_report-poll >/dev/null 2>&1
systemctl enable pmie >/dev/null 2>&1
%else
/sbin/chkconfig --add pmcd >/dev/null 2>&1
Expand Down
31 changes: 9 additions & 22 deletions man/man1/pmlogger_daily_report.1
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@
.SH DESCRIPTION
.B pmlogger_daily_report
and the associated
.BR crontab (5)
entry (depending on local platform, either
.I $PCP_ETC_DIR/cron.d/pcp-pmlogger-daily-report
or
.IR $PCP_SYSCONF_DIR/pmlogger/crontab-daily-report )
.BR systemd (1)
services
write daily performance summary reports, much like those produced by
.BR sadc (1)
and the
Expand All @@ -43,10 +40,11 @@ utility.
.PP
All of the command line arguments are optional and intended to be self
explanatory.
If no arguments are specified,
The service is not enabled by default.
If the service is enabled and no arguments are specified,
.B pmlogger_daily_report
will be run by
.BR cron (8)
.BR systemd
at 2am each morning and write a performance summary report named
.BI sar XX
(where
Expand All @@ -64,11 +62,6 @@ directory by default, but this may be changed with the
.B \-o
option to a different
.IR directory .
Note the default
.BR crontab (5)
entry currently specifies
.B $PCP_LOG_DIR/sa
as the output directory; this may be changed in the future.
.PP
If the
.B \-a
Expand Down Expand Up @@ -101,9 +94,6 @@ Note that there are suffciently flexible command line options for
to be used to read any
.B archivefile
and write the report to any output directory.
As such, this tool can be configured by editing the crontab entry,
.B $PCP_ETC_DIR/cron.d/pcp-pmlogger-daily-report
and adding whatever command line options are required.
.PP
If the
.B \-p
Expand Down Expand Up @@ -157,8 +147,8 @@ capture the required archives needed by
.BR pmlogger_daily_report .
.PP
In order to ensure that mail is not unintentionally sent when this
script is run from
.BR cron (8)
script is run by
.BR systemd (1),
diagnostics are always sent to a log file.
By default, this file is
.B $PCP_LOG_DIR/pmlogger/pmlogger_daily_report.log
Expand All @@ -171,9 +161,7 @@ renamed with a
suffix (overwriting any log file saved earlier) before diagnostics
are generated to the log file.
.PP
The output from the
.BR cron (8)
execution of the script may be extended using the
The output from the execution of the script may be extended using the
.B \-V
option which enables verbose tracing of activity.
By default the script generates no log output unless some error or
Expand All @@ -198,7 +186,6 @@ as described in
.BR pmlogger (1),
.BR pmrep (1),
.BR sadc (1),
.BR crontab (5),
.BR sa2 (8)
and
.BR cron (8).
.BR systemd (1).
57 changes: 39 additions & 18 deletions src/pmdas/bcc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,59 +8,76 @@ eBPF was [described by Ingo Molnár](https://lkml.org/lkml/2015/4/14/232) as:

> One of the more interesting features in this cycle is the ability to attach
> eBPF programs (user-defined, sandboxed bytecode executed by the kernel) to
> kprobes. This allows user-defined instrumentation on a live kernel image that
> can never crash, hang or interfere with the kernel negatively.
> kprobes. This allows user-defined instrumentation on a live kernel image
> that can never crash, hang or interfere with the kernel negatively.
[BCC](https://github.com/iovisor/bcc) has made creating new eBPF programs
easier, and the BCC project offers a wide variety of such tools
(https://github.com/iovisor/bcc/tree/master/tools). However, basically all these
programs are individual, disjoint utilities that are mostly meant for
interactive use. This is not a suitable approach to collect, monitor and analyze
performance data in larger environments where there are hundreds, if not
thousands, installations and where human intervention is unfeasible at best.

This PMDA loads and acts as a bridge for any number of configured, separate BCC
PMDA Python modules running eBPF programs. Each module consists of an eBPF
(https://github.com/iovisor/bcc/tree/master/tools). However, basically all
these programs are individual, disjoint utilities that are mostly meant for
interactive use. This is not a suitable approach to collect, monitor and
analyze performance data in larger environments where there are hundreds, if
not thousands, installations and where human intervention is unfeasible at
best.

This PMDA loads and acts as a bridge for any number of configured, separate
BCC PMDA Python modules running eBPF programs. Each module consists of an eBPF
program (e.g. [sysfork.bpf](modules/sysfork.bpf)) and a corresponding Python
file (e.g. [sysfork.python](modules/sysfork.python)).

# Requirements
* A linux kernel with eBPF support (RHEL 7.6+ or Kernel 4.7+)

* A Linux kernel with eBPF support (RHEL 7.6+ or kernel 4.7+)
* BCC (https://github.com/iovisor/bcc) and BCC Python module (0.5+)

# Configuration

There are several modules available to trace system and application behavior
from different angles, including number of (failed) system calls (per pid),
any available kernel tracepoints, USDT/dtrace/stap probes, uprobes, kprobes,
and application internals (like new threads, objects, method calls).

Modules can be enabled and configured in the [bcc.conf](bcc.conf) file. The
`modules` setting of the `[pmda]` section lists the enabled modules:
```
[pmda]
modules = runqlat,tcplife
```

Each module has their own section with individual module-related configuration,
for example the `tcplife` module:
Each module has their own section with individual module-related
configuration, for example the `tcplife` module:
```
[tcplife]
module = tcplife
cluster = 3
dport = 80,443
```

In this case the tcplife module traces only TCP sessions with a remote port
of 80 or 443.
In this case the tcplife module traces only TCP sessions with a remote port of
80 or 443.

For many modules process(es) to monitor can be defined as a list of names,
PIDs, or regular expressions. PMDA-wide parameter `process_refresh` can be
used to monitor newly created processes matching the list of processes.

# Installation

```
yum install pcp pcp-pmda-bcc
systemctl enable --now pmcd
cd $PCP_PMDAS_DIR/bcc
./Install
```

On many systems `$PCP_PMDAS_DIR` is `/var/lib/pcp/pmdas`.

# Uninstalling the PMDA

```
cd $PCP_PMDAS_DIR/bcc
./Remove
```

# Frontend

## CLI
Expand All @@ -86,23 +103,27 @@ Most of the BCC PMDA Modules have a corresponding Vector widget
for example:

### tcplife

Shows information about recently closed TCP sessions:

![vector_tcplife](https://user-images.githubusercontent.com/538011/41207752-4e216ca2-6d1b-11e8-89c6-c34a42c62351.png)

### profile
Records stack traces at a specific interval, which will be rendered as a flamegraph in Vector:

![profile](https://user-images.githubusercontent.com/538011/42831897-de7c8fca-89ef-11e8-9d35-59a89248d83c.png)
Records stack traces at a specific interval, which will be rendered as a
flamegraph in Vector:

![profile](https://user-images.githubusercontent.com/538011/42831897-de7c8fca-89ef-11e8-9d35-59a89248d83c.png)

# Troubleshooting

* Check logfile for errors: `$PCP_LOG_DIR/pmcd/bcc.log`
* Check if the bcc Python module is installed: `/usr/bin/pcp python -c 'import bcc'`
* Check if BCC PMDA metrics are registered: `pminfo | grep bcc`
* Check if BCC PMDA metrics contain data: `pminfo -f bcc.proc.sysfork` (if the `sysfork` module is enabled)
* Check if BCC is working on this system: `yum install bcc-tools && /usr/share/bcc/tools/runqlat`
* Check if BCC is working on the system: `yum install bcc-tools && /usr/share/bcc/tools/runqlat`

# License

* PMDA: [GPLv2](https://github.com/performancecopilot/pcp/blob/master/COPYING)
* eBPF/BCC programs: [Apache License 2.0](https://github.com/iovisor/bcc/blob/master/LICENSE.txt)

0 comments on commit e86f3a2

Please sign in to comment.