master
md 207 lines 7.22 KB
Rendered Raw
1 <!--startmeta
2 custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/ebpf.plugin/integrations/ebpf_processes.md"
3 meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/ebpf.plugin/metadata.yaml"
4 sidebar_label: "eBPF Processes"
5 learn_status: "Published"
6 learn_rel_path: "Collecting Metrics/Collectors/Operating Systems"
7 keywords: ['thread', 'fork', 'process', 'eBPF']
8 message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE"
9 endmeta-->
10
11 # eBPF Processes
12
13
14 <img src="https://netdata.cloud/img/ebpf.jpg" width="150"/>
15
16
17 Plugin: ebpf.plugin
18 Module: processes
19
20 <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
21
22 ## Overview
23
24 Monitor calls for function creating tasks (threads and processes) inside Linux kernel.
25
26 Attach tracing (kprobe or tracepoint, and trampoline) to internal kernel functions.
27
28 This collector is only supported on the following platforms:
29
30 - Linux
31
32 This collector supports collecting metrics from multiple instances of this integration, including remote instances.
33
34 The plugin needs setuid because it loads data inside kernel. Netada sets necessary permission during installation time.
35
36 eBPF Processes can be monitored further using the following other integrations:
37
38 - [Applications](/src/collectors/apps.plugin/integrations/applications.md)
39 - [Containers](/src/collectors/cgroups.plugin/integrations/containers.md)
40
41 ### Default Behavior
42
43 #### Auto-Detection
44
45 The plugin checks kernel compilation flags (CONFIG_KPROBES, CONFIG_BPF, CONFIG_BPF_SYSCALL, CONFIG_BPF_JIT), files inside debugfs, and presence of BTF files to decide which eBPF program will be attached.
46
47 #### Limits
48
49 The default configuration for this integration does not impose any limits on data collection.
50
51 #### Performance Impact
52
53 This thread will add overhead every time that an internal kernel function monitored by this thread is called.
54
55 ## Setup
56
57
58 ### Prerequisites
59
60 #### Compile kernel
61
62 Check if your kernel was compiled with necessary options (CONFIG_KPROBES, CONFIG_BPF, CONFIG_BPF_SYSCALL, CONFIG_BPF_JIT) in `/proc/config.gz` or inside /boot/config file. Some cited names can be different accoring preferences of Linux distributions.
63 When you do not have options set, it is necessary to get the kernel source code from https://kernel.org or a kernel package from your distribution, this last is preferred. The kernel compilation has a well definedd pattern, but distributions can deliver their configuration files
64 with different names.
65
66 Now follow steps:
67 1. Copy the configuration file to /usr/src/linux/.config.
68 2. Select the necessary options: make oldconfig
69 3. Compile your kernel image: make bzImage
70 4. Compile your modules: make modules
71 5. Copy your new kernel image for boot loader directory
72 6. Install the new modules: make modules_install
73 7. Generate an initial ramdisk image (`initrd`) if it is necessary.
74 8. Update your boot loader
75
76
77 #### Debug Filesystem
78
79 This thread needs to attach a tracepoint to monitor when a process schedule an exit event. To allow this specific feaure, it is necessary to mount `debugfs` (`mount -t debugfs none /sys/kernel/debug/`).
80
81
82
83 ### Configuration
84
85 #### Options
86
87 All options are defined inside section `[global]`.
88
89
90 <details open><summary>Config options</summary>
91
92
93
94 | Option | Description | Default | Required |
95 |:-----|:------------|:--------|:---------:|
96 | update every | Data collection frequency. | 10 | no |
97 | ebpf load mode | Define whether plugin will monitor the call (`entry`) for the functions or it will also monitor the return (`return`). | entry | no |
98 | apps | Enable or disable integration with apps.plugin | no | no |
99 | cgroups | Enable or disable integration with cgroup.plugin | no | no |
100 | pid table size | Number of elements stored inside hash tables used to monitor calls per PID. | 32768 | no |
101 | ebpf type format | Define the file type to load an eBPF program. Three options are available: `legacy` (Attach only `kprobe`), `co-re` (Plugin tries to use `trampoline` when available), and `auto` (plugin check OS configuration before to load). | auto | no |
102 | ebpf co-re tracing | Select the attach method used by plugin when `co-re` is defined in previous option. Two options are available: `trampoline` (Option with lowest overhead), and `probe` (the same of legacy code). This plugin will always try to attach a tracepoint, so option here will impact only function used to monitor task (thread and process) creation. | trampoline | no |
103 | maps per core | Define how plugin will load their hash maps. When enabled (`yes`) plugin will load one hash table per core, instead to have centralized information. | yes | no |
104 | lifetime | Set default lifetime for thread when enabled by cloud. | 300 | no |
105
106
107 </details>
108
109
110
111 #### via File
112
113 The configuration file name for this integration is `ebpf.d/process.conf`.
114
115 The file format is a modified INI syntax. The general structure is:
116
117 ```ini
118 [section1]
119 option1 = some value
120 option2 = some other value
121
122 [section2]
123 option3 = some third value
124 ```
125 You can edit the configuration file using the [`edit-config`](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#edit-configuration-files) script from the
126 Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#locate-your-config-directory).
127
128 ```bash
129 cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
130 sudo ./edit-config ebpf.d/process.conf
131 ```
132
133 ##### Examples
134 There are no configuration examples.
135
136
137
138 ## Alerts
139
140 There are no alerts configured by default for this integration.
141
142
143 ## Metrics
144
145 Metrics grouped by *scope*.
146
147 The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.
148
149
150
151 ### Per eBPF Processes instance
152
153 These metrics show total number of calls to functions inside kernel.
154
155 This scope has no labels.
156
157 Metrics:
158
159 | Metric | Dimensions | Unit |
160 |:------|:----------|:----|
161 | system.process_thread | process | calls/s |
162 | system.process_status | process, zombie | difference |
163 | system.exit | process | calls/s |
164 | system.task_error | task | calls/s |
165
166 ### Per apps
167
168 These Metrics show grouped information per apps group.
169
170 Labels:
171
172 | Label | Description |
173 |:-----------|:----------------|
174 | app_group | The name of the group defined in the configuration. |
175
176 Metrics:
177
178 | Metric | Dimensions | Unit |
179 |:------|:----------|:----|
180 | app.process_create | calls | calls/s |
181 | app.thread_create | call | calls/s |
182 | app.task_exit | call | calls/s |
183 | app.task_close | call | calls/s |
184 | app.task_error | app | calls/s |
185
186 ### Per cgroup
187
188 These Metrics show grouped information per cgroup/service.
189
190 This scope has no labels.
191
192 Metrics:
193
194 | Metric | Dimensions | Unit |
195 |:------|:----------|:----|
196 | cgroup.process_create | process | calls/s |
197 | cgroup.thread_create | thread | calls/s |
198 | cgroup.task_exit | exit | calls/s |
199 | cgroup.task_close | process | calls/s |
200 | cgroup.task_error | process | calls/s |
201 | services.process_create | a dimension per systemd service | calls/s |
202 | services.thread_create | a dimension per systemd service | calls/s |
203 | services.task_close | a dimension per systemd service | calls/s |
204 | services.task_exit | a dimension per systemd service | calls/s |
205 | services.task_error | a dimension per systemd service | calls/s |
206
207