#
# PCP BCC PMDA main config file - see pmdabcc(1) and PMDA(3)
#

# NB. Since all the modules are part of the same process, modules may
# not attach to the same kprobes as others or latter ones will fail -
# this is fixed starting with Linux kernel 4.17 / bcc 0.6.0 releases.

# NB. Cluster IDs 0-99 are reserved for modules which have a related
# tool available as part of BCC. Cluster IDs 100-199 are reserved for
# custom modules developed specifically for PCP BCC PMDA. Cluster IDs
# 200-299 are reserved for possible site-local modules.

[pmda]
# List of enabled modules
modules = netproc

# Prefix for metric names
prefix = bcc.

# Interval in seconds to refresh monitored processes for modules using
# the process filter. Value 0 (default) disables process refreshing.
process_refresh = 60

# Specifies whether BCC PMDA should exit when a module fails to compile,
# module configuration failures are always treated as hard errors
module_failure_fatal = True


#
# Process related modules
#

# This module counts the number of new processes
[sysfork]
module = sysfork
cluster = 2

# This module counts the number of syscalls
# Requires ausyscall(8) to be installed.
# NB. Latency support is currently experimental, and the cumulative
#     counters may overflow if running for a prolonged period of time.
#
# Configuration options:
# Name    - type    - default
#
# process - string  - unset : list of names/pids or regex of processes to monitor
# errno   - str/int - unset : count syscalls returning this error only
# failed  - boolean - False : count failed syscalls only
# details - boolean - False : provides per-pid per-syscall level details,
#                             max number of processes to trace for details is 128
# latency - boolean - False : record average / cumulative call latencies
[syscount]
module = syscount
cluster = 15
#process = java
#errno = EPERM
#failed = True
#details = True
#latency = True

# This module counts the number of application method calls for given process
# java(1) must be started with -XX:+ExtendedDTraceProbes and
# php(1) needs to have USE_ZEND_DTRACE environment variable set to 1
# for this module to work. NB. This might introduce non-negligible overhead.
# NB. Latency support is currently experimental, and the cumulative
#     counters may overflow if running for a prolonged period of time.
#
# Configuration options:
# Name     - type    - default
#
# process  - string  - unset : list of names/pids or regex of processes to monitor
# language - string  - unset : application language, one of:
#                              java, perl, php, python, ruby, tcl
# latency  - boolean - False : record average / cumulative call latencies
[ucalls]
module = ucalls
cluster = 16
process = java
language = java
latency = True

# This module provides application internal statistics for given processes
# java(1) must be started with -XX:+ExtendedDTraceProbes and
# php(1) needs to have USE_ZEND_DTRACE environment variable set to 1
# for this module to work. NB. This might introduce non-negligible overhead.
# Note that not all statistics are supported for every language.
# NB. This module is currently considered as experimental.
#
# Configuration options:
# Name     - type    - default
#
# process  - string  - unset : list of names/pids or regex of processes to monitor
# language - string  - unset : application language, one of:
#                              java, node, perl, php, python, ruby, tcl
[ustat]
module = ustat
cluster = 17
process = java
language = java

# This module records the scheduler run queue latency as histogram
[runqlat]
module = runqlat
cluster = 4

# This module traces new processes
#
# Configuration options:
# Name              - type    - default
#
# include_failed    - boolean - False : include failed exec()s
# command           - string  - unset : include only commands matching this regex
# args              - string  - unset : include only arguments matching this regex
# max_args          - int     - 20    : maximum number of arguments to capture
# process_count     - int     - 20    : number of processes exec's to keep in cache
# buffer_page_count - int     - 64    : number of pages for the perf ring buffer, power of two
[execsnoop]
module = execsnoop
cluster = 8
#command = sh
#args = --verbose

# This module counts how often a specific program was executed
[exectop]
module = exectop
cluster = 13

# This module records stack traces at a specific interval
# To be used in combination with Vector, which will display them as flamegraphs.
#
# Configuration options:
# Name               - type    - default
#
# process            - string  - unset : list of names/pids or regex of processes to monitor
# user_stacks_only   - boolean - False : capture only user stacks
# kernel_stacks_only - boolean - False : capture only kernel stacks
# stack_storage_size - int     - 16384 : number of unique stack traces that can be stored/displayed
# sample_frequency   - int     - 47    : sample frequency, Hertz
# sample_period      - int     - unset : sample period, number of events
# cpu                - int     - -1    : CPU number to run profiling, -1 = all
[profile]
module = profile
cluster = 14
#process = java


#
# Block device I/O modules
#

# This module records block device I/O latency as histogram
#
# Configuration options:
# Name   - type    - default
#
# queued - boolean - False : include OS queued time in I/O time
[biolatency]
module = biolatency
cluster = 0

# This module counts block device I/O per process
[bioperpid]
module = bioperpid
cluster = 1

# This module summarizes which processes are performing block I/O
#
# Configuration options:
# Name             - type   - default
#
# interval         - int     - 1      : interval for calculating summaries
# include_residual - boolean - False  : include residual IO requests attributed to PID 0
# process_count    - int     - 20     : number of processes to show
# sort             - string  - -bytes : sorting key, one of: bytes/io/duration/rw,
#                                       sort order can be reversed by prepending '-'
[biotop]
module = biotop
cluster = 10
#include_residual = True


#
# Filesystem modules
#

# This module traces ext4 read/write/open/fsync latencies as histogram
#
# Configuration options:
# Name    - type   - default
#
# process - string - unset : list of names/pids or regex of processes to monitor
[ext4dist]
module = fs.ext4dist
cluster = 5

# This module traces XFS read/write/open/fsync latencies as histogram
#
# Configuration options:
# Name    - type   - default
#
# process - string - unset : list of names/pids or regex of processes to monitor
[xfsdist]
module = fs.xfsdist
cluster = 6

# This module traces ZFS read/write/open/fsync latencies as histogram
#
# Configuration options:
# Name    - type   - default
#
# process - string - unset : list of names/pids or regex of processes to monitor
[zfsdist]
module = fs.zfsdist
cluster = 7


#
# Kernel related modules
#

# This module provides page cache hit/miss statistics
# Currently only ext4 seems to be working reliably,
# see https://github.com/iovisor/bcc/issues/1993
[cachestat]
module = cachestat
cluster = 30

# This module provides kernel mutex lock statistics
#
# Configuration options:
# Name               - type    - default
#
# process            - string  - unset : list of names/pids or regex of processes to monitor
# caller_filter      - string  - unset : include only functions matching the filter (e.g., pipe_)
# stack_depth        - int     - 1     : number of stack levels to use in instance names
# stack_storage_size - int     - 16384 : number of unique stack traces that can be stored/displayed
# use_caller_offset  - boolean - False : use caller instruction offset in instance names
[klockstat]
module = klockstat
cluster = 31
#process = pmcd


#
# Network modules
#

# This module provides per-process TCP and UDP statistics
#
# Configuration options:
# Name                     - type    - default
#
# remove_stopped_processes - boolean - True : show active processes only
[netproc]
module = netproc
cluster = 40
pmda_indom_cache = False
#remove_stopped_processes = True


#
# TCP related modules
#

# This module summarizes TCP sessions
#
# Configuration options:
# Name              - type   - default
#
# process           - string - unset : list of names/pids or regex of processes to monitor
# dport             - int    - unset : list of remote ports to monitor
# lport             - int    - unset : list of local ports to monitor
# session_count     - int    - 20    : number of closed TCP sessions to keep in cache
# buffer_page_count - int    - 64    : number of pages for the perf ring buffer, power of two
[tcplife]
module = tcplife
cluster = 3
#process = java
#lport = 8443
#dport = 80,443

# This module traces TCP retransmits
#
# Configuration options:
# Name              - type    - default
#
# process           - string  - unset : list of names/pids or regex of processes to monitor
# include_tlp       - boolean - False : include tail loss probe attempts
# flow_count        - int     - 20    : number of closed TCP sessions to keep in cache
# buffer_page_count - int     - 64    : number of pages for the perf ring buffer, power of two
[tcpretrans]
module = tcpretrans
cluster = 9

# This module counts the amount of sent and received data per process
#
# Configuration options:
# Name              - type    - default
#
# process           - string  - unset : list of names/pids or regex of processes to monitor
# dport             - int     - unset : list of remote ports to monitor
# lport             - int     - unset : list of local ports to monitor
# highres           - boolean - False : use alternative, "high resolution" BPF program to
#                                       provide data at the cost of (much) higher overhead
# buffer_page_count - int     - 64    : number of pages for the perf ring buffer, power of two
[tcpperpid]
module = tcpperpid
cluster = 11
#process = java
#lport = 8443
#dport = 80,443
#highres = True

# This module summarizes TCP throughput by host and port
#
# Configuration options:
# Name       - type   - default
#
# interval   - int    - 1     : interval for calculating summaries
# conn_count - int    - 20    : number of processes to show
# process    - string - unset : list of names/pids or regex of processes to monitor
[tcptop]
module = tcptop
cluster = 12


#
# Probe hits modules
#

# This module counts the number of kernel tracepoint hits
# Use perf-list(1) to see currently available kernel tracepoints.
#
# Configuration options:
# Name         - type    - default
#
# compile_test - boolean - False : disable failing tracepoints on-the-fly
# process      - string  - unset : list of names/pids or regex of processes to monitor
# tracepoints  - string  - unset : file or comma-separated list of tracepoints
[tracepoint_hits]
module = tracepoint_hits
cluster = 100
compile_test = True
#process = java
tracepoints = random:urandom_read
#tracepoints = migrate:.*,tlb:.*
#tracepoints = ras:.*
#tracepoints = sock:sock_exceed_buf_limit,sock:sock_rcvqueue_full
#tracepoints = xfs:.*
#tracepoints = bcc-tracepoint.conf

# This module counts the number of USDT/dtrace probe hits
# USDT stands for user-level statically defined tracing.
# Use tplist(8) to list available USDT probes in a binary.
#
# Configuration options:
# Name    - type   - default
#
# process - string - unset : list of names/pids or regex of processes to monitor
# usdts   - string - unset : file or comma-separated list of usdts
[usdt_hits]
module = usdt_hits
cluster = 101
# Mandatory for now - https://github.com/iovisor/bcc/issues/1774
process = java
usdts = /etc/alternatives/jre/lib/server/libjvm.so:gc__begin
#usdts = bcc-usdt.conf

# This module counts the number of user-level probe (uprobes) hits
# Expects function names within defined libraries to setup probes.
# NB. uprobes might introduce non-negligible overhead.
#
# Configuration options:
# Name    - type   - default
#
# process - string - unset : list of names/pids or regex of processes to monitor
# uprobes - string - unset : file or comma-separated list of uprobes
[uprobe_hits]
module = uprobe_hits
cluster = 102
#process = java
uprobes = c:malloc,c:strlen
#uprobes = bcc-uprobe.conf

# This module counts the number of kernel-level functions (kprobes) hits
# Expects function names with kprobe: prefix to setup probes.
# NB. kprobes might introduce non-negligible overhead.
# NB. Latency support is currently experimental, and the cumulative
#     counters may overflow if running for a prolonged period of time.
#
# Configuration options:
# Name    - type   - default
#
# process - string  - unset : list of names/pids or regex of processes to monitor
# kprobes - string  - unset : file or comma-separated list of kprobes
# errno   - str/int - unset : count functions returning this error only
# ret_chk - string  - != 0  : relational operator and return value check
# details - boolean - False : provides per-pid per-function level details,
#                             max number of processes to trace for details is 128
# latency - boolean - False : record average / cumulative call latencies
[kprobe_hits]
module = kprobe_hits
cluster = 103
#process = systemd
kprobes = kprobe:sched_fork
#kprobes = bcc-kprobe.conf
#errno = EPERM
#ret_chk = != 0
#details = True
#latency = True


#
# Java related modules
#

# This module counts the number of started and stopped threads by the JVM
#
# Configuration options:
# Name     - type   - default
#
# jvm_path - string - /etc/alternatives/jre/lib/server/libjvm.so : path to libjvm.so (if no process)
# process  - string - unset                                      : list of names/pids or regex of processes to monitor
[usdt_jvm_threads]
module = usdt_jvm_threads
cluster = 110
# Mandatory for now - https://github.com/iovisor/bcc/issues/1774
process = java
