18
char *ebpf_plugin_dir = PLUGINS_DIR;
19
static char *ebpf_configured_log_dir = LOG_DIR;
20
21
-char *ebpf_algorithms[] = { EBPF_CHART_ALGORITHM_ABSOLUTE, EBPF_CHART_ALGORITHM_INCREMENTAL};
21
+char *ebpf_algorithms[] = {EBPF_CHART_ALGORITHM_ABSOLUTE, EBPF_CHART_ALGORITHM_INCREMENTAL};
22
struct config collector_config = APPCONFIG_INITIALIZER;
23
24
int running_on_kernel = 0;
42
.enabled = 1,
43
.thread = NULL,
44
.init_routine = NULL,
45
- .start_routine = NULL
46
-};
45
+ .start_routine = NULL};
46
47
ebpf_module_t ebpf_modules[] = {
49
- { .info = {.thread_name = "process",
50
- .config_name = "process",
51
- .thread_description = NETDATA_EBPF_MODULE_PROCESS_DESC},
52
- .functions = {.start_routine = ebpf_process_thread,
53
- .apps_routine = ebpf_process_create_apps_charts,
54
- .fnct_routine = NULL},
55
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
56
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
57
- .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
58
- .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &process_config,
59
- .config_file = NETDATA_PROCESS_CONFIG_FILE,
60
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_10 |
61
- NETDATA_V5_14,
62
- .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL,
63
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0 },
64
- { .info = {.thread_name = "socket",
65
- .config_name = "socket",
66
- .thread_description = NETDATA_EBPF_SOCKET_MODULE_DESC},
67
- .functions = {.start_routine = ebpf_socket_thread,
68
- .apps_routine = ebpf_socket_create_apps_charts,
69
- .fnct_routine = ebpf_socket_read_open_connections,
70
- .fcnt_name = EBPF_FUNCTION_SOCKET,
71
- .fcnt_desc = EBPF_PLUGIN_SOCKET_FUNCTION_DESCRIPTION,
72
- .fcnt_thread_chart_name = NULL,
73
- .fcnt_thread_lifetime_name = NULL},
74
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
75
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
76
- .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
77
- .maps = NULL,
78
- .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &socket_config,
79
- .config_file = NETDATA_NETWORK_CONFIG_FILE,
80
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
81
- .load = EBPF_LOAD_LEGACY, .targets = socket_targets, .probe_links = NULL, .objects = NULL,
82
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
83
- { .info = {.thread_name = "cachestat", .config_name = "cachestat", .thread_description = NETDATA_EBPF_CACHESTAT_MODULE_DESC},
84
- .functions = {.start_routine = ebpf_cachestat_thread,
85
- .apps_routine = ebpf_cachestat_create_apps_charts,
86
- .fnct_routine = NULL},
87
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
88
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
89
- .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
90
- .maps = cachestat_maps, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &cachestat_config,
91
- .config_file = NETDATA_CACHESTAT_CONFIG_FILE,
92
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18|
93
- NETDATA_V5_4 | NETDATA_V5_14 | NETDATA_V5_15 | NETDATA_V5_16,
94
- .load = EBPF_LOAD_LEGACY, .targets = cachestat_targets, .probe_links = NULL, .objects = NULL,
95
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
96
- { .info = {.thread_name = "sync",
97
- .config_name = "sync",
98
- .thread_description = NETDATA_EBPF_SYNC_MODULE_DESC},
99
- .functions = {.start_routine = ebpf_sync_thread,
100
- .apps_routine = NULL,
101
- .fnct_routine = NULL},
102
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING, .maps = NULL,
103
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
104
- .apps_level = NETDATA_APPS_NOT_SET, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
105
- .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &sync_config,
106
- .config_file = NETDATA_SYNC_CONFIG_FILE,
107
- // All syscalls have the same kernels
108
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
109
- .load = EBPF_LOAD_LEGACY, .targets = sync_targets, .probe_links = NULL, .objects = NULL,
110
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
111
- { .info = {.thread_name = "dc",
112
- .config_name = "dc",
113
- .thread_description = NETDATA_EBPF_DC_MODULE_DESC},
114
- .functions = {.start_routine = ebpf_dcstat_thread,
115
- .apps_routine = ebpf_dcstat_create_apps_charts,
116
- .fnct_routine = NULL},
117
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
118
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
119
- .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
120
- .maps = dcstat_maps,
121
- .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &dcstat_config,
122
- .config_file = NETDATA_DIRECTORY_DCSTAT_CONFIG_FILE,
123
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
124
- .load = EBPF_LOAD_LEGACY, .targets = dc_targets, .probe_links = NULL, .objects = NULL,
125
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
126
- { .info = {.thread_name = "swap", .config_name = "swap", .thread_description = NETDATA_EBPF_SWAP_MODULE_DESC},
127
- .functions = {.start_routine = ebpf_swap_thread,
128
- .apps_routine = ebpf_swap_create_apps_charts,
129
- .fnct_routine = NULL},
130
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
131
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
132
- .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
133
- .maps = NULL,
134
- .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &swap_config,
135
- .config_file = NETDATA_DIRECTORY_SWAP_CONFIG_FILE,
136
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14 | NETDATA_V6_8,
137
- .load = EBPF_LOAD_LEGACY, .targets = swap_targets, .probe_links = NULL, .objects = NULL,
138
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
139
- { .info = {.thread_name = "vfs",
140
- .config_name = "vfs",
141
- .thread_description = NETDATA_EBPF_VFS_MODULE_DESC},
142
- .functions = {.start_routine = ebpf_vfs_thread,
143
- .apps_routine = ebpf_vfs_create_apps_charts,
144
- .fnct_routine = NULL},
145
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
146
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
147
- .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
148
- .maps = NULL,
149
- .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &vfs_config,
150
- .config_file = NETDATA_DIRECTORY_VFS_CONFIG_FILE,
151
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
152
- .load = EBPF_LOAD_LEGACY, .targets = vfs_targets, .probe_links = NULL, .objects = NULL,
153
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
154
- { .info = {.thread_name = "filesystem", .config_name = "filesystem", .thread_description = NETDATA_EBPF_FS_MODULE_DESC},
155
- .functions = {.start_routine = ebpf_filesystem_thread,
156
- .apps_routine = NULL,
157
- .fnct_routine = NULL},
158
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
159
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
160
- .apps_level = NETDATA_APPS_NOT_SET, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
161
- .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &fs_config,
162
- .config_file = NETDATA_FILESYSTEM_CONFIG_FILE,
163
- //We are setting kernels as zero, because we load eBPF programs according the kernel running.
164
- .kernels = 0, .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL,
165
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
166
- { .info = {.thread_name = "disk",
167
- .config_name = "disk",
168
- .thread_description = NETDATA_EBPF_DISK_MODULE_DESC},
169
- .functions = {.start_routine = ebpf_disk_thread,
170
- .apps_routine = NULL,
171
- .fnct_routine = NULL},
172
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
173
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
174
- .apps_level = NETDATA_APPS_NOT_SET, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
175
- .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &disk_config,
176
- .config_file = NETDATA_DISK_CONFIG_FILE,
177
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
178
- .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL,
179
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
180
- { .info = {.thread_name = "mount",
181
- .config_name = "mount",
182
- .thread_description = NETDATA_EBPF_MOUNT_MODULE_DESC},
183
- .functions = {.start_routine = ebpf_mount_thread,
184
- .apps_routine = NULL,
185
- .fnct_routine = NULL},
186
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
187
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
188
- .apps_level = NETDATA_APPS_NOT_SET, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
189
- .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &mount_config,
190
- .config_file = NETDATA_MOUNT_CONFIG_FILE,
191
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
192
- .load = EBPF_LOAD_LEGACY, .targets = mount_targets, .probe_links = NULL, .objects = NULL,
193
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
194
- { .info = { .thread_name = "fd",
195
- .config_name = "fd",
196
- .thread_description = NETDATA_EBPF_FD_MODULE_DESC},
197
- .functions = {.start_routine = ebpf_fd_thread,
198
- .apps_routine = ebpf_fd_create_apps_charts,
199
- .fnct_routine = NULL},
200
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
201
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
202
- .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
203
- .maps = NULL,
204
- .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &fd_config,
205
- .config_file = NETDATA_FD_CONFIG_FILE,
206
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_11 |
207
- NETDATA_V5_14,
208
- .load = EBPF_LOAD_LEGACY, .targets = fd_targets, .probe_links = NULL, .objects = NULL,
209
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
210
- { .info = { .thread_name = "hardirq",
211
- .config_name = "hardirq",
212
- .thread_description = NETDATA_EBPF_HARDIRQ_MODULE_DESC},
213
- .functions = {.start_routine = ebpf_hardirq_thread,
214
- .apps_routine = NULL,
215
- .fnct_routine = NULL},
216
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
217
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
218
- .apps_level = NETDATA_APPS_NOT_SET, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
219
- .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &hardirq_config,
220
- .config_file = NETDATA_HARDIRQ_CONFIG_FILE,
221
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
222
- .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL,
223
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
224
- { .info = { .thread_name = "softirq",
225
- .config_name = "softirq",
226
- .thread_description = NETDATA_EBPF_SOFTIRQ_MODULE_DESC},
227
- .functions = {.start_routine = ebpf_softirq_thread,
228
- .apps_routine = NULL,
229
- .fnct_routine = NULL },
230
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
231
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
232
- .apps_level = NETDATA_APPS_NOT_SET, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
233
- .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &softirq_config,
234
- .config_file = NETDATA_SOFTIRQ_CONFIG_FILE,
235
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
236
- .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL,
237
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
238
- { .info = {.thread_name = "oomkill",
239
- .config_name = "oomkill",
240
- .thread_description = NETDATA_EBPF_OOMKILL_MODULE_DESC},
241
- .functions = {.start_routine = ebpf_oomkill_thread,
242
- .apps_routine = ebpf_oomkill_create_apps_charts,
243
- .fnct_routine = NULL},.enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
244
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
245
- .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
246
- .maps = NULL,
247
- .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &oomkill_config,
248
- .config_file = NETDATA_OOMKILL_CONFIG_FILE,
249
- .kernels = NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
250
- .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL,
251
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
252
- { .info = {.thread_name = "shm",
253
- .config_name = "shm",
254
- .thread_description = NETDATA_EBPF_SHM_MODULE_DESC},
255
- .functions = {.start_routine = ebpf_shm_thread,
256
- .apps_routine = ebpf_shm_create_apps_charts,
257
- .fnct_routine = NULL},
258
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
259
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
260
- .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
261
- .maps = NULL,
262
- .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &shm_config,
263
- .config_file = NETDATA_DIRECTORY_SHM_CONFIG_FILE,
264
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
265
- .load = EBPF_LOAD_LEGACY, .targets = shm_targets, .probe_links = NULL, .objects = NULL,
266
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
267
- { .info = { .thread_name = "mdflush",
268
- .config_name = "mdflush",
269
- .thread_description = NETDATA_EBPF_MD_MODULE_DESC},
270
- .functions = {.start_routine = ebpf_mdflush_thread,
271
- .apps_routine = NULL,
272
- .fnct_routine = NULL},
273
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
274
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
275
- .apps_level = NETDATA_APPS_NOT_SET, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
276
- .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &mdflush_config,
277
- .config_file = NETDATA_DIRECTORY_MDFLUSH_CONFIG_FILE,
278
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
279
- .load = EBPF_LOAD_LEGACY, .targets = mdflush_targets, .probe_links = NULL, .objects = NULL,
280
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
281
- { .info = { .thread_name = "functions",
282
- .config_name = "functions",
283
- .thread_description = NETDATA_EBPF_FUNCTIONS_MODULE_DESC},
284
- .functions = {.start_routine = ebpf_function_thread,
285
- .apps_routine = NULL,
286
- .fnct_routine = NULL},
287
- .enabled = NETDATA_THREAD_EBPF_RUNNING,
288
- .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
289
- .apps_level = NETDATA_APPS_NOT_SET, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0,
290
- .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = NULL,
291
- .config_file = NETDATA_DIRECTORY_FUNCTIONS_CONFIG_FILE,
292
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
293
- .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL,
294
- .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES, .lifetime = EBPF_DEFAULT_LIFETIME, .running_time = 0},
295
- { .info = {.thread_name = NULL, .config_name = NULL},
296
- .functions = {.start_routine = NULL, .apps_routine = NULL, .fnct_routine = NULL},
297
- .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING, .update_every = EBPF_DEFAULT_UPDATE_EVERY,
298
- .global_charts = 0, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .apps_level = NETDATA_APPS_NOT_SET,
299
- .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .maps = NULL,
300
- .pid_map_size = 0, .names = NULL, .cfg = NULL, .kernels = 0, .load = EBPF_LOAD_LEGACY,
301
- .targets = NULL, .probe_links = NULL, .objects = NULL, .thread = NULL, .maps_per_core = CONFIG_BOOLEAN_YES},
48
+ {.info =
49
+ {.thread_name = "process", .config_name = "process", .thread_description = NETDATA_EBPF_MODULE_PROCESS_DESC},
50
+ .functions =
51
+ {.start_routine = ebpf_process_thread, .apps_routine = ebpf_process_create_apps_charts, .fnct_routine = NULL},
52
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
53
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
54
+ .global_charts = 1,
55
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
56
+ .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT,
57
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
58
+ .mode = MODE_ENTRY,
59
+ .optional = 0,
60
+ .maps = NULL,
61
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
62
+ .names = NULL,
63
+ .cfg = &process_config,
64
+ .config_file = NETDATA_PROCESS_CONFIG_FILE,
65
+ .kernels =
66
+ NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_10 | NETDATA_V5_14,
67
+ .load = EBPF_LOAD_LEGACY,
68
+ .targets = NULL,
69
+ .probe_links = NULL,
70
+ .objects = NULL,
71
+ .thread = NULL,
72
+ .maps_per_core = CONFIG_BOOLEAN_YES,
73
+ .lifetime = EBPF_DEFAULT_LIFETIME,
74
+ .running_time = 0},
75
+ {.info = {.thread_name = "socket", .config_name = "socket", .thread_description = NETDATA_EBPF_SOCKET_MODULE_DESC},
76
+ .functions =
77
+ {.start_routine = ebpf_socket_thread,
78
+ .apps_routine = ebpf_socket_create_apps_charts,
79
+ .fnct_routine = ebpf_socket_read_open_connections,
80
+ .fcnt_name = EBPF_FUNCTION_SOCKET,
81
+ .fcnt_desc = EBPF_PLUGIN_SOCKET_FUNCTION_DESCRIPTION,
82
+ .fcnt_thread_chart_name = NULL,
83
+ .fcnt_thread_lifetime_name = NULL},
84
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
85
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
86
+ .global_charts = 1,
87
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
88
+ .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT,
89
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
90
+ .mode = MODE_ENTRY,
91
+ .optional = 0,
92
+ .maps = NULL,
93
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
94
+ .names = NULL,
95
+ .cfg = &socket_config,
96
+ .config_file = NETDATA_NETWORK_CONFIG_FILE,
97
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
98
+ .load = EBPF_LOAD_LEGACY,
99
+ .targets = socket_targets,
100
+ .probe_links = NULL,
101
+ .objects = NULL,
102
+ .thread = NULL,
103
+ .maps_per_core = CONFIG_BOOLEAN_YES,
104
+ .lifetime = EBPF_DEFAULT_LIFETIME,
105
+ .running_time = 0},
106
+ {.info =
107
+ {.thread_name = "cachestat",
108
+ .config_name = "cachestat",
109
+ .thread_description = NETDATA_EBPF_CACHESTAT_MODULE_DESC},
110
+ .functions =
111
+ {.start_routine = ebpf_cachestat_thread,
112
+ .apps_routine = ebpf_cachestat_create_apps_charts,
113
+ .fnct_routine = NULL},
114
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
115
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
116
+ .global_charts = 1,
117
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
118
+ .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT,
119
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
120
+ .mode = MODE_ENTRY,
121
+ .optional = 0,
122
+ .maps = cachestat_maps,
123
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
124
+ .names = NULL,
125
+ .cfg = &cachestat_config,
126
+ .config_file = NETDATA_CACHESTAT_CONFIG_FILE,
127
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14 |
128
+ NETDATA_V5_15 | NETDATA_V5_16,
129
+ .load = EBPF_LOAD_LEGACY,
130
+ .targets = cachestat_targets,
131
+ .probe_links = NULL,
132
+ .objects = NULL,
133
+ .thread = NULL,
134
+ .maps_per_core = CONFIG_BOOLEAN_YES,
135
+ .lifetime = EBPF_DEFAULT_LIFETIME,
136
+ .running_time = 0},
137
+ {.info = {.thread_name = "sync", .config_name = "sync", .thread_description = NETDATA_EBPF_SYNC_MODULE_DESC},
138
+ .functions = {.start_routine = ebpf_sync_thread, .apps_routine = NULL, .fnct_routine = NULL},
139
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
140
+ .maps = NULL,
141
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
142
+ .global_charts = 1,
143
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
144
+ .apps_level = NETDATA_APPS_NOT_SET,
145
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
146
+ .mode = MODE_ENTRY,
147
+ .optional = 0,
148
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
149
+ .names = NULL,
150
+ .cfg = &sync_config,
151
+ .config_file = NETDATA_SYNC_CONFIG_FILE,
152
+ // All syscalls have the same kernels
153
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
154
+ .load = EBPF_LOAD_LEGACY,
155
+ .targets = sync_targets,
156
+ .probe_links = NULL,
157
+ .objects = NULL,
158
+ .thread = NULL,
159
+ .maps_per_core = CONFIG_BOOLEAN_YES,
160
+ .lifetime = EBPF_DEFAULT_LIFETIME,
161
+ .running_time = 0},
162
+ {.info = {.thread_name = "dc", .config_name = "dc", .thread_description = NETDATA_EBPF_DC_MODULE_DESC},
163
+ .functions =
164
+ {.start_routine = ebpf_dcstat_thread, .apps_routine = ebpf_dcstat_create_apps_charts, .fnct_routine = NULL},
165
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
166
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
167
+ .global_charts = 1,
168
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
169
+ .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT,
170
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
171
+ .mode = MODE_ENTRY,
172
+ .optional = 0,
173
+ .maps = dcstat_maps,
174
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
175
+ .names = NULL,
176
+ .cfg = &dcstat_config,
177
+ .config_file = NETDATA_DIRECTORY_DCSTAT_CONFIG_FILE,
178
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
179
+ .load = EBPF_LOAD_LEGACY,
180
+ .targets = dc_targets,
181
+ .probe_links = NULL,
182
+ .objects = NULL,
183
+ .thread = NULL,
184
+ .maps_per_core = CONFIG_BOOLEAN_YES,
185
+ .lifetime = EBPF_DEFAULT_LIFETIME,
186
+ .running_time = 0},
187
+ {.info = {.thread_name = "swap", .config_name = "swap", .thread_description = NETDATA_EBPF_SWAP_MODULE_DESC},
188
+ .functions =
189
+ {.start_routine = ebpf_swap_thread, .apps_routine = ebpf_swap_create_apps_charts, .fnct_routine = NULL},
190
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
191
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
192
+ .global_charts = 1,
193
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
194
+ .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT,
195
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
196
+ .mode = MODE_ENTRY,
197
+ .optional = 0,
198
+ .maps = NULL,
199
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
200
+ .names = NULL,
201
+ .cfg = &swap_config,
202
+ .config_file = NETDATA_DIRECTORY_SWAP_CONFIG_FILE,
203
+ .kernels =
204
+ NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14 | NETDATA_V6_8,
205
+ .load = EBPF_LOAD_LEGACY,
206
+ .targets = swap_targets,
207
+ .probe_links = NULL,
208
+ .objects = NULL,
209
+ .thread = NULL,
210
+ .maps_per_core = CONFIG_BOOLEAN_YES,
211
+ .lifetime = EBPF_DEFAULT_LIFETIME,
212
+ .running_time = 0},
213
+ {.info = {.thread_name = "vfs", .config_name = "vfs", .thread_description = NETDATA_EBPF_VFS_MODULE_DESC},
214
+ .functions = {.start_routine = ebpf_vfs_thread, .apps_routine = ebpf_vfs_create_apps_charts, .fnct_routine = NULL},
215
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
216
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
217
+ .global_charts = 1,
218
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
219
+ .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT,
220
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
221
+ .mode = MODE_ENTRY,
222
+ .optional = 0,
223
+ .maps = NULL,
224
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
225
+ .names = NULL,
226
+ .cfg = &vfs_config,
227
+ .config_file = NETDATA_DIRECTORY_VFS_CONFIG_FILE,
228
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
229
+ .load = EBPF_LOAD_LEGACY,
230
+ .targets = vfs_targets,
231
+ .probe_links = NULL,
232
+ .objects = NULL,
233
+ .thread = NULL,
234
+ .maps_per_core = CONFIG_BOOLEAN_YES,
235
+ .lifetime = EBPF_DEFAULT_LIFETIME,
236
+ .running_time = 0},
237
+ {.info =
238
+ {.thread_name = "filesystem", .config_name = "filesystem", .thread_description = NETDATA_EBPF_FS_MODULE_DESC},
239
+ .functions = {.start_routine = ebpf_filesystem_thread, .apps_routine = NULL, .fnct_routine = NULL},
240
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
241
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
242
+ .global_charts = 1,
243
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
244
+ .apps_level = NETDATA_APPS_NOT_SET,
245
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
246
+ .mode = MODE_ENTRY,
247
+ .optional = 0,
248
+ .maps = NULL,
249
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
250
+ .names = NULL,
251
+ .cfg = &fs_config,
252
+ .config_file = NETDATA_FILESYSTEM_CONFIG_FILE,
253
+ //We are setting kernels as zero, because we load eBPF programs according the kernel running.
254
+ .kernels = 0,
255
+ .load = EBPF_LOAD_LEGACY,
256
+ .targets = NULL,
257
+ .probe_links = NULL,
258
+ .objects = NULL,
259
+ .thread = NULL,
260
+ .maps_per_core = CONFIG_BOOLEAN_YES,
261
+ .lifetime = EBPF_DEFAULT_LIFETIME,
262
+ .running_time = 0},
263
+ {.info = {.thread_name = "disk", .config_name = "disk", .thread_description = NETDATA_EBPF_DISK_MODULE_DESC},
264
+ .functions = {.start_routine = ebpf_disk_thread, .apps_routine = NULL, .fnct_routine = NULL},
265
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
266
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
267
+ .global_charts = 1,
268
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
269
+ .apps_level = NETDATA_APPS_NOT_SET,
270
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
271
+ .mode = MODE_ENTRY,
272
+ .optional = 0,
273
+ .maps = NULL,
274
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
275
+ .names = NULL,
276
+ .cfg = &disk_config,
277
+ .config_file = NETDATA_DISK_CONFIG_FILE,
278
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
279
+ .load = EBPF_LOAD_LEGACY,
280
+ .targets = NULL,
281
+ .probe_links = NULL,
282
+ .objects = NULL,
283
+ .thread = NULL,
284
+ .maps_per_core = CONFIG_BOOLEAN_YES,
285
+ .lifetime = EBPF_DEFAULT_LIFETIME,
286
+ .running_time = 0},
287
+ {.info = {.thread_name = "mount", .config_name = "mount", .thread_description = NETDATA_EBPF_MOUNT_MODULE_DESC},
288
+ .functions = {.start_routine = ebpf_mount_thread, .apps_routine = NULL, .fnct_routine = NULL},
289
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
290
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
291
+ .global_charts = 1,
292
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
293
+ .apps_level = NETDATA_APPS_NOT_SET,
294
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
295
+ .mode = MODE_ENTRY,
296
+ .optional = 0,
297
+ .maps = NULL,
298
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
299
+ .names = NULL,
300
+ .cfg = &mount_config,
301
+ .config_file = NETDATA_MOUNT_CONFIG_FILE,
302
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
303
+ .load = EBPF_LOAD_LEGACY,
304
+ .targets = mount_targets,
305
+ .probe_links = NULL,
306
+ .objects = NULL,
307
+ .thread = NULL,
308
+ .maps_per_core = CONFIG_BOOLEAN_YES,
309
+ .lifetime = EBPF_DEFAULT_LIFETIME,
310
+ .running_time = 0},
311
+ {.info = {.thread_name = "fd", .config_name = "fd", .thread_description = NETDATA_EBPF_FD_MODULE_DESC},
312
+ .functions = {.start_routine = ebpf_fd_thread, .apps_routine = ebpf_fd_create_apps_charts, .fnct_routine = NULL},
313
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
314
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
315
+ .global_charts = 1,
316
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
317
+ .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT,
318
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
319
+ .mode = MODE_ENTRY,
320
+ .optional = 0,
321
+ .maps = NULL,
322
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
323
+ .names = NULL,
324
+ .cfg = &fd_config,
325
+ .config_file = NETDATA_FD_CONFIG_FILE,
326
+ .kernels =
327
+ NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_11 | NETDATA_V5_14,
328
+ .load = EBPF_LOAD_LEGACY,
329
+ .targets = fd_targets,
330
+ .probe_links = NULL,
331
+ .objects = NULL,
332
+ .thread = NULL,
333
+ .maps_per_core = CONFIG_BOOLEAN_YES,
334
+ .lifetime = EBPF_DEFAULT_LIFETIME,
335
+ .running_time = 0},
336
+ {.info =
337
+ {.thread_name = "hardirq", .config_name = "hardirq", .thread_description = NETDATA_EBPF_HARDIRQ_MODULE_DESC},
338
+ .functions = {.start_routine = ebpf_hardirq_thread, .apps_routine = NULL, .fnct_routine = NULL},
339
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
340
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
341
+ .global_charts = 1,
342
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
343
+ .apps_level = NETDATA_APPS_NOT_SET,
344
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
345
+ .mode = MODE_ENTRY,
346
+ .optional = 0,
347
+ .maps = NULL,
348
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
349
+ .names = NULL,
350
+ .cfg = &hardirq_config,
351
+ .config_file = NETDATA_HARDIRQ_CONFIG_FILE,
352
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
353
+ .load = EBPF_LOAD_LEGACY,
354
+ .targets = NULL,
355
+ .probe_links = NULL,
356
+ .objects = NULL,
357
+ .thread = NULL,
358
+ .maps_per_core = CONFIG_BOOLEAN_YES,
359
+ .lifetime = EBPF_DEFAULT_LIFETIME,
360
+ .running_time = 0},
361
+ {.info =
362
+ {.thread_name = "softirq", .config_name = "softirq", .thread_description = NETDATA_EBPF_SOFTIRQ_MODULE_DESC},
363
+ .functions = {.start_routine = ebpf_softirq_thread, .apps_routine = NULL, .fnct_routine = NULL},
364
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
365
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
366
+ .global_charts = 1,
367
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
368
+ .apps_level = NETDATA_APPS_NOT_SET,
369
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
370
+ .mode = MODE_ENTRY,
371
+ .optional = 0,
372
+ .maps = NULL,
373
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
374
+ .names = NULL,
375
+ .cfg = &softirq_config,
376
+ .config_file = NETDATA_SOFTIRQ_CONFIG_FILE,
377
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
378
+ .load = EBPF_LOAD_LEGACY,
379
+ .targets = NULL,
380
+ .probe_links = NULL,
381
+ .objects = NULL,
382
+ .thread = NULL,
383
+ .maps_per_core = CONFIG_BOOLEAN_YES,
384
+ .lifetime = EBPF_DEFAULT_LIFETIME,
385
+ .running_time = 0},
386
+ {.info =
387
+ {.thread_name = "oomkill", .config_name = "oomkill", .thread_description = NETDATA_EBPF_OOMKILL_MODULE_DESC},
388
+ .functions =
389
+ {.start_routine = ebpf_oomkill_thread, .apps_routine = ebpf_oomkill_create_apps_charts, .fnct_routine = NULL},
390
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
391
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
392
+ .global_charts = 1,
393
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
394
+ .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT,
395
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
396
+ .mode = MODE_ENTRY,
397
+ .optional = 0,
398
+ .maps = NULL,
399
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
400
+ .names = NULL,
401
+ .cfg = &oomkill_config,
402
+ .config_file = NETDATA_OOMKILL_CONFIG_FILE,
403
+ .kernels = NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
404
+ .load = EBPF_LOAD_LEGACY,
405
+ .targets = NULL,
406
+ .probe_links = NULL,
407
+ .objects = NULL,
408
+ .thread = NULL,
409
+ .maps_per_core = CONFIG_BOOLEAN_YES,
410
+ .lifetime = EBPF_DEFAULT_LIFETIME,
411
+ .running_time = 0},
412
+ {.info = {.thread_name = "shm", .config_name = "shm", .thread_description = NETDATA_EBPF_SHM_MODULE_DESC},
413
+ .functions = {.start_routine = ebpf_shm_thread, .apps_routine = ebpf_shm_create_apps_charts, .fnct_routine = NULL},
414
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
415
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
416
+ .global_charts = 1,
417
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
418
+ .apps_level = NETDATA_APPS_LEVEL_REAL_PARENT,
419
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
420
+ .mode = MODE_ENTRY,
421
+ .optional = 0,
422
+ .maps = NULL,
423
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
424
+ .names = NULL,
425
+ .cfg = &shm_config,
426
+ .config_file = NETDATA_DIRECTORY_SHM_CONFIG_FILE,
427
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
428
+ .load = EBPF_LOAD_LEGACY,
429
+ .targets = shm_targets,
430
+ .probe_links = NULL,
431
+ .objects = NULL,
432
+ .thread = NULL,
433
+ .maps_per_core = CONFIG_BOOLEAN_YES,
434
+ .lifetime = EBPF_DEFAULT_LIFETIME,
435
+ .running_time = 0},
436
+ {.info = {.thread_name = "mdflush", .config_name = "mdflush", .thread_description = NETDATA_EBPF_MD_MODULE_DESC},
437
+ .functions = {.start_routine = ebpf_mdflush_thread, .apps_routine = NULL, .fnct_routine = NULL},
438
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
439
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
440
+ .global_charts = 1,
441
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
442
+ .apps_level = NETDATA_APPS_NOT_SET,
443
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
444
+ .mode = MODE_ENTRY,
445
+ .optional = 0,
446
+ .maps = NULL,
447
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
448
+ .names = NULL,
449
+ .cfg = &mdflush_config,
450
+ .config_file = NETDATA_DIRECTORY_MDFLUSH_CONFIG_FILE,
451
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
452
+ .load = EBPF_LOAD_LEGACY,
453
+ .targets = mdflush_targets,
454
+ .probe_links = NULL,
455
+ .objects = NULL,
456
+ .thread = NULL,
457
+ .maps_per_core = CONFIG_BOOLEAN_YES,
458
+ .lifetime = EBPF_DEFAULT_LIFETIME,
459
+ .running_time = 0},
460
+ {.info =
461
+ {.thread_name = "functions",
462
+ .config_name = "functions",
463
+ .thread_description = NETDATA_EBPF_FUNCTIONS_MODULE_DESC},
464
+ .functions = {.start_routine = ebpf_function_thread, .apps_routine = NULL, .fnct_routine = NULL},
465
+ .enabled = NETDATA_THREAD_EBPF_RUNNING,
466
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
467
+ .global_charts = 1,
468
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
469
+ .apps_level = NETDATA_APPS_NOT_SET,
470
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
471
+ .mode = MODE_ENTRY,
472
+ .optional = 0,
473
+ .maps = NULL,
474
+ .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE,
475
+ .names = NULL,
476
+ .cfg = NULL,
477
+ .config_file = NETDATA_DIRECTORY_FUNCTIONS_CONFIG_FILE,
478
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
479
+ .load = EBPF_LOAD_LEGACY,
480
+ .targets = NULL,
481
+ .probe_links = NULL,
482
+ .objects = NULL,
483
+ .thread = NULL,
484
+ .maps_per_core = CONFIG_BOOLEAN_YES,
485
+ .lifetime = EBPF_DEFAULT_LIFETIME,
486
+ .running_time = 0},
487
+ {.info = {.thread_name = NULL, .config_name = NULL},
488
+ .functions = {.start_routine = NULL, .apps_routine = NULL, .fnct_routine = NULL},
489
+ .enabled = NETDATA_THREAD_EBPF_NOT_RUNNING,
490
+ .update_every = EBPF_DEFAULT_UPDATE_EVERY,
491
+ .global_charts = 0,
492
+ .apps_charts = NETDATA_EBPF_APPS_FLAG_NO,
493
+ .apps_level = NETDATA_APPS_NOT_SET,
494
+ .cgroup_charts = CONFIG_BOOLEAN_NO,
495
+ .mode = MODE_ENTRY,
496
+ .optional = 0,
497
+ .maps = NULL,
498
+ .pid_map_size = 0,
499
+ .names = NULL,
500
+ .cfg = NULL,
501
+ .kernels = 0,
502
+ .load = EBPF_LOAD_LEGACY,
503
+ .targets = NULL,
504
+ .probe_links = NULL,
505
+ .objects = NULL,
506
+ .thread = NULL,
507
+ .maps_per_core = CONFIG_BOOLEAN_YES},
508
};
509
510
struct netdata_static_thread ebpf_threads[] = {
305
- {
306
- .name = "EBPF PROCESS",
307
- .config_section = NULL,
308
- .config_name = NULL,
309
- .env_name = NULL,
310
- .enabled = 1,
311
- .thread = NULL,
312
- .init_routine = NULL,
313
- .start_routine = NULL
314
- },
315
- {
316
- .name = "EBPF SOCKET",
317
- .config_section = NULL,
318
- .config_name = NULL,
319
- .env_name = NULL,
320
- .enabled = 1,
321
- .thread = NULL,
322
- .init_routine = NULL,
323
- .start_routine = NULL
324
- },
325
- {
326
- .name = "EBPF CACHESTAT",
327
- .config_section = NULL,
328
- .config_name = NULL,
329
- .env_name = NULL,
330
- .enabled = 1,
331
- .thread = NULL,
332
- .init_routine = NULL,
333
- .start_routine = NULL
334
- },
335
- {
336
- .name = "EBPF SYNC",
337
- .config_section = NULL,
338
- .config_name = NULL,
339
- .env_name = NULL,
340
- .enabled = 1,
341
- .thread = NULL,
342
- .init_routine = NULL,
343
- .start_routine = NULL
344
- },
345
- {
346
- .name = "EBPF DCSTAT",
347
- .config_section = NULL,
348
- .config_name = NULL,
349
- .env_name = NULL,
350
- .enabled = 1,
351
- .thread = NULL,
352
- .init_routine = NULL,
353
- .start_routine = NULL
354
- },
355
- {
356
- .name = "EBPF SWAP",
357
- .config_section = NULL,
358
- .config_name = NULL,
359
- .env_name = NULL,
360
- .enabled = 1,
361
- .thread = NULL,
362
- .init_routine = NULL,
363
- .start_routine = NULL
364
- },
365
- {
366
- .name = "EBPF VFS",
367
- .config_section = NULL,
368
- .config_name = NULL,
369
- .env_name = NULL,
370
- .enabled = 1,
371
- .thread = NULL,
372
- .init_routine = NULL,
373
- .start_routine = NULL
374
- },
375
- {
376
- .name = "EBPF FILESYSTEM",
377
- .config_section = NULL,
378
- .config_name = NULL,
379
- .env_name = NULL,
380
- .enabled = 1,
381
- .thread = NULL,
382
- .init_routine = NULL,
383
- .start_routine = NULL
384
- },
385
- {
386
- .name = "EBPF DISK",
387
- .config_section = NULL,
388
- .config_name = NULL,
389
- .env_name = NULL,
390
- .enabled = 1,
391
- .thread = NULL,
392
- .init_routine = NULL,
393
- .start_routine = NULL
394
- },
395
- {
396
- .name = "EBPF MOUNT",
397
- .config_section = NULL,
398
- .config_name = NULL,
399
- .env_name = NULL,
400
- .enabled = 1,
401
- .thread = NULL,
402
- .init_routine = NULL,
403
- .start_routine = NULL
404
- },
405
- {
406
- .name = "EBPF FD",
407
- .config_section = NULL,
408
- .config_name = NULL,
409
- .env_name = NULL,
410
- .enabled = 1,
411
- .thread = NULL,
412
- .init_routine = NULL,
413
- .start_routine = NULL
414
- },
415
- {
416
- .name = "EBPF HARDIRQ",
417
- .config_section = NULL,
418
- .config_name = NULL,
419
- .env_name = NULL,
420
- .enabled = 1,
421
- .thread = NULL,
422
- .init_routine = NULL,
423
- .start_routine = NULL
424
- },
425
- {
426
- .name = "EBPF SOFTIRQ",
427
- .config_section = NULL,
428
- .config_name = NULL,
429
- .env_name = NULL,
430
- .enabled = 1,
431
- .thread = NULL,
432
- .init_routine = NULL,
433
- .start_routine = NULL
434
- },
435
- {
436
- .name = "EBPF OOMKILL",
437
- .config_section = NULL,
438
- .config_name = NULL,
439
- .env_name = NULL,
440
- .enabled = 1,
441
- .thread = NULL,
442
- .init_routine = NULL,
443
- .start_routine = NULL
444
- },
445
- {
446
- .name = "EBPF SHM",
447
- .config_section = NULL,
448
- .config_name = NULL,
449
- .env_name = NULL,
450
- .enabled = 1,
451
- .thread = NULL,
452
- .init_routine = NULL,
453
- .start_routine = NULL
454
- },
455
- {
456
- .name = "EBPF MDFLUSH",
457
- .config_section = NULL,
458
- .config_name = NULL,
459
- .env_name = NULL,
460
- .enabled = 1,
461
- .thread = NULL,
462
- .init_routine = NULL,
463
- .start_routine = NULL
464
- },
465
- {
466
- .name = "EBPF FUNCTIONS",
467
- .config_section = NULL,
468
- .config_name = NULL,
469
- .env_name = NULL,
511
+ {.name = "EBPF PROCESS",
512
+ .config_section = NULL,
513
+ .config_name = NULL,
514
+ .env_name = NULL,
515
+ .enabled = 1,
516
+ .thread = NULL,
517
+ .init_routine = NULL,
518
+ .start_routine = NULL},
519
+ {.name = "EBPF SOCKET",
520
+ .config_section = NULL,
521
+ .config_name = NULL,
522
+ .env_name = NULL,
523
+ .enabled = 1,
524
+ .thread = NULL,
525
+ .init_routine = NULL,
526
+ .start_routine = NULL},
527
+ {.name = "EBPF CACHESTAT",
528
+ .config_section = NULL,
529
+ .config_name = NULL,
530
+ .env_name = NULL,
531
+ .enabled = 1,
532
+ .thread = NULL,
533
+ .init_routine = NULL,
534
+ .start_routine = NULL},
535
+ {.name = "EBPF SYNC",
536
+ .config_section = NULL,
537
+ .config_name = NULL,
538
+ .env_name = NULL,
539
+ .enabled = 1,
540
+ .thread = NULL,
541
+ .init_routine = NULL,
542
+ .start_routine = NULL},
543
+ {.name = "EBPF DCSTAT",
544
+ .config_section = NULL,
545
+ .config_name = NULL,
546
+ .env_name = NULL,
547
+ .enabled = 1,
548
+ .thread = NULL,
549
+ .init_routine = NULL,
550
+ .start_routine = NULL},
551
+ {.name = "EBPF SWAP",
552
+ .config_section = NULL,
553
+ .config_name = NULL,
554
+ .env_name = NULL,
555
+ .enabled = 1,
556
+ .thread = NULL,
557
+ .init_routine = NULL,
558
+ .start_routine = NULL},
559
+ {.name = "EBPF VFS",
560
+ .config_section = NULL,
561
+ .config_name = NULL,
562
+ .env_name = NULL,
563
+ .enabled = 1,
564
+ .thread = NULL,
565
+ .init_routine = NULL,
566
+ .start_routine = NULL},
567
+ {.name = "EBPF FILESYSTEM",
568
+ .config_section = NULL,
569
+ .config_name = NULL,
570
+ .env_name = NULL,
571
+ .enabled = 1,
572
+ .thread = NULL,
573
+ .init_routine = NULL,
574
+ .start_routine = NULL},
575
+ {.name = "EBPF DISK",
576
+ .config_section = NULL,
577
+ .config_name = NULL,
578
+ .env_name = NULL,
579
+ .enabled = 1,
580
+ .thread = NULL,
581
+ .init_routine = NULL,
582
+ .start_routine = NULL},
583
+ {.name = "EBPF MOUNT",
584
+ .config_section = NULL,
585
+ .config_name = NULL,
586
+ .env_name = NULL,
587
+ .enabled = 1,
588
+ .thread = NULL,
589
+ .init_routine = NULL,
590
+ .start_routine = NULL},
591
+ {.name = "EBPF FD",
592
+ .config_section = NULL,
593
+ .config_name = NULL,
594
+ .env_name = NULL,
595
+ .enabled = 1,
596
+ .thread = NULL,
597
+ .init_routine = NULL,
598
+ .start_routine = NULL},
599
+ {.name = "EBPF HARDIRQ",
600
+ .config_section = NULL,
601
+ .config_name = NULL,
602
+ .env_name = NULL,
603
+ .enabled = 1,
604
+ .thread = NULL,
605
+ .init_routine = NULL,
606
+ .start_routine = NULL},
607
+ {.name = "EBPF SOFTIRQ",
608
+ .config_section = NULL,
609
+ .config_name = NULL,
610
+ .env_name = NULL,
611
+ .enabled = 1,
612
+ .thread = NULL,
613
+ .init_routine = NULL,
614
+ .start_routine = NULL},
615
+ {.name = "EBPF OOMKILL",
616
+ .config_section = NULL,
617
+ .config_name = NULL,
618
+ .env_name = NULL,
619
+ .enabled = 1,
620
+ .thread = NULL,
621
+ .init_routine = NULL,
622
+ .start_routine = NULL},
623
+ {.name = "EBPF SHM",
624
+ .config_section = NULL,
625
+ .config_name = NULL,
626
+ .env_name = NULL,
627
+ .enabled = 1,
628
+ .thread = NULL,
629
+ .init_routine = NULL,
630
+ .start_routine = NULL},
631
+ {.name = "EBPF MDFLUSH",
632
+ .config_section = NULL,
633
+ .config_name = NULL,
634
+ .env_name = NULL,
635
+ .enabled = 1,
636
+ .thread = NULL,
637
+ .init_routine = NULL,
638
+ .start_routine = NULL},
639
+ {.name = "EBPF FUNCTIONS",
640
+ .config_section = NULL,
641
+ .config_name = NULL,
642
+ .env_name = NULL,
643
#ifdef NETDATA_DEV_MODE
471
- .enabled = 1,
644
+ .enabled = 1,
645
#else
473
- .enabled = 0,
646
+ .enabled = 0,
647
#endif
475
- .thread = NULL,
476
- .init_routine = NULL,
477
- .start_routine = NULL
478
- },
479
- {
480
- .name = NULL,
481
- .config_section = NULL,
482
- .config_name = NULL,
483
- .env_name = NULL,
484
- .enabled = 0,
485
- .thread = NULL,
486
- .init_routine = NULL,
487
- .start_routine = NULL
488
- },
648
+ .thread = NULL,
649
+ .init_routine = NULL,
650
+ .start_routine = NULL},
651
+ {.name = NULL,
652
+ .config_section = NULL,
653
+ .config_name = NULL,
654
+ .env_name = NULL,
655
+ .enabled = 0,
656
+ .thread = NULL,
657
+ .init_routine = NULL,
658
+ .start_routine = NULL},
659
};
660
491
-ebpf_filesystem_partitions_t localfs[] =
492
- {{.filesystem = "ext4",
493
- .optional_filesystem = NULL,
494
- .family = "ext4",
495
- .objects = NULL,
496
- .probe_links = NULL,
497
- .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION,
498
- .enabled = CONFIG_BOOLEAN_YES,
499
- .addresses = {.function = NULL, .addr = 0},
500
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4,
501
- .fs_maps = NULL,
502
- .fs_obj = NULL,
503
- .functions = { "ext4_file_read_iter",
504
- "ext4_file_write_iter",
505
- "ext4_file_open",
506
- "ext4_sync_file",
507
- NULL }},
508
- {.filesystem = "xfs",
509
- .optional_filesystem = NULL,
510
- .family = "xfs",
511
- .objects = NULL,
512
- .probe_links = NULL,
513
- .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION,
514
- .enabled = CONFIG_BOOLEAN_YES,
515
- .addresses = {.function = NULL, .addr = 0},
516
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4,
517
- .fs_maps = NULL,
518
- .fs_obj = NULL,
519
- .functions = { "xfs_file_read_iter",
520
- "xfs_file_write_iter",
521
- "xfs_file_open",
522
- "xfs_file_fsync",
523
- NULL }},
524
- {.filesystem = "nfs",
525
- .optional_filesystem = "nfs4",
526
- .family = "nfs",
527
- .objects = NULL,
528
- .probe_links = NULL,
529
- .flags = NETDATA_FILESYSTEM_ATTR_CHARTS,
530
- .enabled = CONFIG_BOOLEAN_YES,
531
- .addresses = {.function = NULL, .addr = 0},
532
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4,
533
- .fs_maps = NULL,
534
- .fs_obj = NULL,
535
- .functions = { "nfs_file_read",
536
- "nfs_file_write",
537
- "nfs_open",
538
- "nfs_getattr",
539
- NULL }}, // // "nfs4_file_open" - not present on all kernels
540
- {.filesystem = "zfs",
541
- .optional_filesystem = NULL,
542
- .family = "zfs",
543
- .objects = NULL,
544
- .probe_links = NULL,
545
- .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION,
546
- .enabled = CONFIG_BOOLEAN_YES,
547
- .addresses = {.function = NULL, .addr = 0},
548
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4,
549
- .fs_maps = NULL,
550
- .fs_obj = NULL,
551
- .functions = { "zpl_iter_read",
552
- "zpl_iter_write",
553
- "zpl_open",
554
- "zpl_fsync",
555
- NULL }},
556
- {.filesystem = "btrfs",
557
- .optional_filesystem = NULL,
558
- .family = "btrfs",
559
- .objects = NULL,
560
- .probe_links = NULL,
561
- .flags = NETDATA_FILESYSTEM_FILL_ADDRESS_TABLE,
562
- .enabled = CONFIG_BOOLEAN_YES,
563
- .addresses = {.function = "btrfs_file_operations", .addr = 0},
564
- .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_10,
565
- .fs_maps = NULL,
566
- .fs_obj = NULL,
567
- .functions = { "btrfs_file_read_iter",
568
- "btrfs_file_write_iter",
569
- "btrfs_file_open",
570
- "btrfs_sync_file",
571
- NULL }},
572
- {.filesystem = NULL,
573
- .optional_filesystem = NULL,
574
- .family = NULL,
575
- .objects = NULL,
576
- .probe_links = NULL,
577
- .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION,
578
- .enabled = CONFIG_BOOLEAN_YES,
579
- .addresses = {.function = NULL, .addr = 0},
580
- .kernels = 0, .fs_maps = NULL, .fs_obj = NULL}};
661
+ebpf_filesystem_partitions_t localfs[] = {
662
+ {.filesystem = "ext4",
663
+ .optional_filesystem = NULL,
664
+ .family = "ext4",
665
+ .objects = NULL,
666
+ .probe_links = NULL,
667
+ .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION,
668
+ .enabled = CONFIG_BOOLEAN_YES,
669
+ .addresses = {.function = NULL, .addr = 0},
670
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4,
671
+ .fs_maps = NULL,
672
+ .fs_obj = NULL,
673
+ .functions = {"ext4_file_read_iter", "ext4_file_write_iter", "ext4_file_open", "ext4_sync_file", NULL}},
674
+ {.filesystem = "xfs",
675
+ .optional_filesystem = NULL,
676
+ .family = "xfs",
677
+ .objects = NULL,
678
+ .probe_links = NULL,
679
+ .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION,
680
+ .enabled = CONFIG_BOOLEAN_YES,
681
+ .addresses = {.function = NULL, .addr = 0},
682
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4,
683
+ .fs_maps = NULL,
684
+ .fs_obj = NULL,
685
+ .functions = {"xfs_file_read_iter", "xfs_file_write_iter", "xfs_file_open", "xfs_file_fsync", NULL}},
686
+ {.filesystem = "nfs",
687
+ .optional_filesystem = "nfs4",
688
+ .family = "nfs",
689
+ .objects = NULL,
690
+ .probe_links = NULL,
691
+ .flags = NETDATA_FILESYSTEM_ATTR_CHARTS,
692
+ .enabled = CONFIG_BOOLEAN_YES,
693
+ .addresses = {.function = NULL, .addr = 0},
694
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4,
695
+ .fs_maps = NULL,
696
+ .fs_obj = NULL,
697
+ .functions =
698
+ {"nfs_file_read",
699
+ "nfs_file_write",
700
+ "nfs_open",
701
+ "nfs_getattr",
702
+ NULL}}, // // "nfs4_file_open" - not present on all kernels
703
+ {.filesystem = "zfs",
704
+ .optional_filesystem = NULL,
705
+ .family = "zfs",
706
+ .objects = NULL,
707
+ .probe_links = NULL,
708
+ .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION,
709
+ .enabled = CONFIG_BOOLEAN_YES,
710
+ .addresses = {.function = NULL, .addr = 0},
711
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4,
712
+ .fs_maps = NULL,
713
+ .fs_obj = NULL,
714
+ .functions = {"zpl_iter_read", "zpl_iter_write", "zpl_open", "zpl_fsync", NULL}},
715
+ {.filesystem = "btrfs",
716
+ .optional_filesystem = NULL,
717
+ .family = "btrfs",
718
+ .objects = NULL,
719
+ .probe_links = NULL,
720
+ .flags = NETDATA_FILESYSTEM_FILL_ADDRESS_TABLE,
721
+ .enabled = CONFIG_BOOLEAN_YES,
722
+ .addresses = {.function = "btrfs_file_operations", .addr = 0},
723
+ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_10,
724
+ .fs_maps = NULL,
725
+ .fs_obj = NULL,
726
+ .functions = {"btrfs_file_read_iter", "btrfs_file_write_iter", "btrfs_file_open", "btrfs_sync_file", NULL}},
727
+ {.filesystem = NULL,
728
+ .optional_filesystem = NULL,
729
+ .family = NULL,
730
+ .objects = NULL,
731
+ .probe_links = NULL,
732
+ .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION,
733
+ .enabled = CONFIG_BOOLEAN_YES,
734
+ .addresses = {.function = NULL, .addr = 0},
735
+ .kernels = 0,
736
+ .fs_maps = NULL,
737
+ .fs_obj = NULL}};
738
739
ebpf_sync_syscalls_t local_syscalls[] = {
583
- {.syscall = NETDATA_SYSCALLS_SYNC, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL,
740
+ {.syscall = NETDATA_SYSCALLS_SYNC,
741
+ .enabled = CONFIG_BOOLEAN_YES,
742
+ .objects = NULL,
743
+ .probe_links = NULL,
744
#ifdef LIBBPF_MAJOR_VERSION
745
.sync_obj = NULL,
746
#endif
587
- .sync_maps = NULL
588
- },
589
- {.syscall = NETDATA_SYSCALLS_SYNCFS, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL,
747
+ .sync_maps = NULL},
748
+ {.syscall = NETDATA_SYSCALLS_SYNCFS,
749
+ .enabled = CONFIG_BOOLEAN_YES,
750
+ .objects = NULL,
751
+ .probe_links = NULL,
752
#ifdef LIBBPF_MAJOR_VERSION
753
.sync_obj = NULL,
754
#endif
593
- .sync_maps = NULL
594
- },
595
- {.syscall = NETDATA_SYSCALLS_MSYNC, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL,
755
+ .sync_maps = NULL},
756
+ {.syscall = NETDATA_SYSCALLS_MSYNC,
757
+ .enabled = CONFIG_BOOLEAN_YES,
758
+ .objects = NULL,
759
+ .probe_links = NULL,
760
#ifdef LIBBPF_MAJOR_VERSION
761
.sync_obj = NULL,
762
#endif
599
- .sync_maps = NULL
600
- },
601
- {.syscall = NETDATA_SYSCALLS_FSYNC, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL,
763
+ .sync_maps = NULL},
764
+ {.syscall = NETDATA_SYSCALLS_FSYNC,
765
+ .enabled = CONFIG_BOOLEAN_YES,
766
+ .objects = NULL,
767
+ .probe_links = NULL,
768
#ifdef LIBBPF_MAJOR_VERSION
769
.sync_obj = NULL,
770
#endif
605
- .sync_maps = NULL
606
- },
607
- {.syscall = NETDATA_SYSCALLS_FDATASYNC, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL,
771
+ .sync_maps = NULL},
772
+ {.syscall = NETDATA_SYSCALLS_FDATASYNC,
773
+ .enabled = CONFIG_BOOLEAN_YES,
774
+ .objects = NULL,
775
+ .probe_links = NULL,
776
#ifdef LIBBPF_MAJOR_VERSION
777
.sync_obj = NULL,
778
#endif
611
- .sync_maps = NULL
612
- },
613
- {.syscall = NETDATA_SYSCALLS_SYNC_FILE_RANGE, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL,
779
+ .sync_maps = NULL},
780
+ {.syscall = NETDATA_SYSCALLS_SYNC_FILE_RANGE,
781
+ .enabled = CONFIG_BOOLEAN_YES,
782
+ .objects = NULL,
783
+ .probe_links = NULL,
784
#ifdef LIBBPF_MAJOR_VERSION
785
.sync_obj = NULL,
786
#endif
617
- .sync_maps = NULL
618
- },
619
- {.syscall = NULL, .enabled = CONFIG_BOOLEAN_NO, .objects = NULL, .probe_links = NULL,
787
+ .sync_maps = NULL},
788
+ {.syscall = NULL,
789
+ .enabled = CONFIG_BOOLEAN_NO,
790
+ .objects = NULL,
791
+ .probe_links = NULL,
792
#ifdef LIBBPF_MAJOR_VERSION
793
.sync_obj = NULL,
794
#endif
623
- .sync_maps = NULL
624
- }
625
-};
626
-
795
+ .sync_maps = NULL}};
796
797
// Link with cgroup.plugin
798
netdata_ebpf_cgroup_shm_t shm_ebpf_cgroup = {NULL, NULL};
804
ebpf_network_viewer_options_t network_viewer_opt;
805
806
// Statistic
638
-ebpf_plugin_stats_t plugin_statistics = {.core = 0, .legacy = 0, .running = 0, .threads = 0, .tracepoints = 0,
639
- .probes = 0, .retprobes = 0, .trampolines = 0, .memlock_kern = 0,
640
- .hash_tables = 0};
807
+ebpf_plugin_stats_t plugin_statistics = {
808
+ .core = 0,
809
+ .legacy = 0,
810
+ .running = 0,
811
+ .threads = 0,
812
+ .tracepoints = 0,
813
+ .probes = 0,
814
+ .retprobes = 0,
815
+ .trampolines = 0,
816
+ .memlock_kern = 0,
817
+ .hash_tables = 0};
818
netdata_ebpf_judy_pid_t ebpf_judy_pid = {.pid_table = NULL, .index = {.JudyLArray = NULL}};
819
bool ebpf_plugin_exit = false;
820
857
JError_t J_Error;
858
Pvoid_t *idx = JudyLIns(arr, key, &J_Error);
859
if (unlikely(idx == PJERR)) {
683
- netdata_log_error("Cannot add PID to JudyL, JU_ERRNO_* == %u, ID == %d",
684
- JU_ERRNO(&J_Error), JU_ERRID(&J_Error));
860
+ netdata_log_error(
861
+ "Cannot add PID to JudyL, JU_ERRNO_* == %u, ID == %d", JU_ERRNO(&J_Error), JU_ERRID(&J_Error));
862
}
863
864
return idx;
911
{
912
static size_t max_elements = NETDATA_EBPF_ALLOC_MAX_PID;
913
if (max_elements < NETDATA_EBPF_ALLOC_MIN_ELEMENTS) {
737
- netdata_log_error("Number of elements given is too small, adjusting it for %d", NETDATA_EBPF_ALLOC_MIN_ELEMENTS);
914
+ netdata_log_error(
915
+ "Number of elements given is too small, adjusting it for %d", NETDATA_EBPF_ALLOC_MIN_ELEMENTS);
916
max_elements = NETDATA_EBPF_ALLOC_MIN_ELEMENTS;
917
}
918
741
- return aral_create(name, size,
742
- 0, 0,
743
- NULL, NULL, NULL,
744
- false, false, false);
919
+ return aral_create(name, size, 0, 0, NULL, NULL, NULL, false, false, false);
920
}
921
922
/*****************************************************************
998
return;
999
1000
struct bpf_program *prog;
826
- size_t j = 0 ;
827
- bpf_object__for_each_program(prog, objects) {
1001
+ size_t j = 0;
1002
+ bpf_object__for_each_program(prog, objects)
1003
+ {
1004
bpf_link__destroy(probe_links[j]);
1005
j++;
1006
}
1024
1025
if (ebpf_modules[i].enabled != NETDATA_THREAD_EBPF_STOPPED) {
1026
if (ebpf_modules[i].enabled != NETDATA_THREAD_EBPF_NOT_RUNNING)
851
- netdata_log_error("Cannot unload maps for thread %s, because it is not stopped.",
852
- ebpf_modules[i].info.thread_name);
1027
+ netdata_log_error(
1028
+ "Cannot unload maps for thread %s, because it is not stopped.", ebpf_modules[i].info.thread_name);
1029
1030
continue;
1031
}
1071
static void ebpf_unload_sync()
1072
{
1073
if (ebpf_modules[EBPF_MODULE_SYNC_IDX].enabled == NETDATA_THREAD_EBPF_NOT_RUNNING ||
898
- ebpf_modules[EBPF_MODULE_SYNC_IDX].enabled < NETDATA_THREAD_EBPF_STOPPING)
1074
+ ebpf_modules[EBPF_MODULE_SYNC_IDX].enabled < NETDATA_THREAD_EBPF_STOPPING)
1075
return;
1076
1077
int i;
1156
* @param em the module main structure.
1157
* @param root a pointer for the targets.
1158
*/
983
-static inline void ebpf_create_apps_for_module(ebpf_module_t *em, struct ebpf_target *root) {
1159
+static inline void ebpf_create_apps_for_module(ebpf_module_t *em, struct ebpf_target *root)
1160
+{
1161
if (em->enabled < NETDATA_THREAD_EBPF_STOPPING && em->apps_charts && em->functions.apps_routine)
1162
em->functions.apps_routine(em, root);
1163
}
1171
*/
1172
static void ebpf_create_apps_charts(struct ebpf_target *root)
1173
{
997
-// if (unlikely(!ebpf_pids))
998
-// return;
1174
+ // if (unlikely(!ebpf_pids))
1175
+ // return;
1176
1177
struct ebpf_target *w;
1178
int newly_added = 0;
1185
struct ebpf_pid_on_target *pid_on_target;
1186
1187
fprintf(
1011
- stderr, "ebpf.plugin: target '%s' has aggregated %u process%s:", w->name, w->processes,
1188
+ stderr,
1189
+ "ebpf.plugin: target '%s' has aggregated %u process%s:",
1190
+ w->name,
1191
+ w->processes,
1192
(w->processes == 1) ? "" : "es");
1193
1194
for (pid_on_target = w->root_pid; pid_on_target; pid_on_target = pid_on_target->next) {
1208
1209
if (newly_added) {
1210
int i;
1031
- for (i = 0; i < EBPF_MODULE_FUNCTION_IDX ; i++) {
1032
- if (!(collect_pids & (1<<i)))
1211
+ for (i = 0; i < EBPF_MODULE_FUNCTION_IDX; i++) {
1212
+ if (!(collect_pids & (1 << i)))
1213
continue;
1214
1215
ebpf_module_t *current = &ebpf_modules[i];
1351
* @param update_every update interval used by plugin
1352
* @param module chart module name, this is the eBPF thread.
1353
*/
1174
-void ebpf_write_chart_cmd(char *type, char *id, char *suffix, char *title, char *units, char *family,
1175
- char *charttype, char *context, int order, int update_every, char *module)
1354
+void ebpf_write_chart_cmd(
1355
+ char *type,
1356
+ char *id,
1357
+ char *suffix,
1358
+ char *title,
1359
+ char *units,
1360
+ char *family,
1361
+ char *charttype,
1362
+ char *context,
1363
+ int order,
1364
+ int update_every,
1365
+ char *module)
1366
{
1177
- printf("CHART %s.%s%s '' '%s' '%s' '%s' '%s' '%s' %d %d '' 'ebpf.plugin' '%s'\n",
1178
- type,
1179
- id,
1180
- suffix,
1181
- title,
1182
- units,
1183
- (family)?family:"",
1184
- (context)?context:"",
1185
- (charttype)?charttype:"",
1186
- order,
1187
- update_every,
1188
- module);
1367
+ printf(
1368
+ "CHART %s.%s%s '' '%s' '%s' '%s' '%s' '%s' %d %d '' 'ebpf.plugin' '%s'\n",
1369
+ type,
1370
+ id,
1371
+ suffix,
1372
+ title,
1373
+ units,
1374
+ (family) ? family : "",
1375
+ (context) ? context : "",
1376
+ (charttype) ? charttype : "",
1377
+ order,
1378
+ update_every,
1379
+ module);
1380
}
1381
1382
/**
1393
* @param order chart order
1394
* @param update_every value to overwrite the update frequency set by the server.
1395
*/
1205
-void ebpf_write_chart_obsolete(char *type, char *id, char *suffix, char *title, char *units, char *family,
1206
- char *charttype, char *context, int order, int update_every)
1396
+void ebpf_write_chart_obsolete(
1397
+ char *type,
1398
+ char *id,
1399
+ char *suffix,
1400
+ char *title,
1401
+ char *units,
1402
+ char *family,
1403
+ char *charttype,
1404
+ char *context,
1405
+ int order,
1406
+ int update_every)
1407
{
1208
- printf("CHART %s.%s%s '' '%s' '%s' '%s' '%s' '%s' %d %d 'obsolete'\n",
1209
- type,
1210
- id,
1211
- suffix,
1212
- title,
1213
- units,
1214
- (family)?family:"",
1215
- (context)?context:"",
1216
- (charttype)?charttype:"",
1217
- order,
1218
- update_every);
1408
+ printf(
1409
+ "CHART %s.%s%s '' '%s' '%s' '%s' '%s' '%s' %d %d 'obsolete'\n",
1410
+ type,
1411
+ id,
1412
+ suffix,
1413
+ title,
1414
+ units,
1415
+ (family) ? family : "",
1416
+ (context) ? context : "",
1417
+ (charttype) ? charttype : "",
1418
+ order,
1419
+ update_every);
1420
}
1421
1422
/**
1467
* @param update_every update interval used with chart.
1468
* @param module chart module name, this is the eBPF thread.
1469
*/
1269
-void ebpf_create_chart(char *type,
1270
- char *id,
1271
- char *title,
1272
- char *units,
1273
- char *family,
1274
- char *context,
1275
- char *charttype,
1276
- int order,
1277
- void (*ncd)(void *, int),
1278
- void *move,
1279
- int end,
1280
- int update_every,
1281
- char *module)
1470
+void ebpf_create_chart(
1471
+ char *type,
1472
+ char *id,
1473
+ char *title,
1474
+ char *units,
1475
+ char *family,
1476
+ char *context,
1477
+ char *charttype,
1478
+ int order,
1479
+ void (*ncd)(void *, int),
1480
+ void *move,
1481
+ int end,
1482
+ int update_every,
1483
+ char *module)
1484
{
1485
ebpf_write_chart_cmd(type, id, "", title, units, family, charttype, context, order, update_every, module);
1486
1506
1507
uint32_t i;
1508
for (i = 0; i < end; i++) {
1307
- write_chart_dimension(dimensions[i], (long long) hist[i]);
1509
+ write_chart_dimension(dimensions[i], (long long)hist[i]);
1510
}
1511
1512
ebpf_write_end_chart();
1526
int ebpf_statistic_create_aral_chart(char *name, ebpf_module_t *em)
1527
{
1528
static int priority = NETATA_EBPF_ORDER_STAT_ARAL_BEGIN;
1327
- char *mem = { NETDATA_EBPF_STAT_DIMENSION_MEMORY };
1328
- char *aral = { NETDATA_EBPF_STAT_DIMENSION_ARAL };
1329
-
1330
- snprintfz(em->memory_usage, NETDATA_EBPF_CHART_MEM_LENGTH -1, "aral_%s_size", name);
1331
- snprintfz(em->memory_allocations, NETDATA_EBPF_CHART_MEM_LENGTH -1, "aral_%s_alloc", name);
1332
-
1333
- ebpf_write_chart_cmd(NETDATA_MONITORING_FAMILY,
1334
- em->memory_usage,
1335
- "",
1336
- "Bytes allocated for ARAL.",
1337
- "bytes",
1338
- NETDATA_EBPF_FAMILY,
1339
- NETDATA_EBPF_CHART_TYPE_STACKED,
1340
- "netdata.ebpf_aral_stat_size",
1341
- priority++,
1342
- em->update_every,
1343
- NETDATA_EBPF_MODULE_NAME_PROCESS);
1344
-
1345
- ebpf_write_global_dimension(mem,
1346
- mem,
1347
- ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
1348
-
1349
- ebpf_write_chart_cmd(NETDATA_MONITORING_FAMILY,
1350
- em->memory_allocations,
1351
- "",
1352
- "Calls to allocate memory.",
1353
- "calls",
1354
- NETDATA_EBPF_FAMILY,
1355
- NETDATA_EBPF_CHART_TYPE_STACKED,
1356
- "netdata.ebpf_aral_stat_alloc",
1357
- priority++,
1358
- em->update_every,
1359
- NETDATA_EBPF_MODULE_NAME_PROCESS);
1360
-
1361
- ebpf_write_global_dimension(aral,
1362
- aral,
1363
- ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
1529
+ char *mem = {NETDATA_EBPF_STAT_DIMENSION_MEMORY};
1530
+ char *aral = {NETDATA_EBPF_STAT_DIMENSION_ARAL};
1531
+
1532
+ snprintfz(em->memory_usage, NETDATA_EBPF_CHART_MEM_LENGTH - 1, "aral_%s_size", name);
1533
+ snprintfz(em->memory_allocations, NETDATA_EBPF_CHART_MEM_LENGTH - 1, "aral_%s_alloc", name);
1534
+
1535
+ ebpf_write_chart_cmd(
1536
+ NETDATA_MONITORING_FAMILY,
1537
+ em->memory_usage,
1538
+ "",
1539
+ "Bytes allocated for ARAL.",
1540
+ "bytes",
1541
+ NETDATA_EBPF_FAMILY,
1542
+ NETDATA_EBPF_CHART_TYPE_STACKED,
1543
+ "netdata.ebpf_aral_stat_size",
1544
+ priority++,
1545
+ em->update_every,
1546
+ NETDATA_EBPF_MODULE_NAME_PROCESS);
1547
+
1548
+ ebpf_write_global_dimension(mem, mem, ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
1549
+
1550
+ ebpf_write_chart_cmd(
1551
+ NETDATA_MONITORING_FAMILY,
1552
+ em->memory_allocations,
1553
+ "",
1554
+ "Calls to allocate memory.",
1555
+ "calls",
1556
+ NETDATA_EBPF_FAMILY,
1557
+ NETDATA_EBPF_CHART_TYPE_STACKED,
1558
+ "netdata.ebpf_aral_stat_alloc",
1559
+ priority++,
1560
+ em->update_every,
1561
+ NETDATA_EBPF_MODULE_NAME_PROCESS);
1562
+
1563
+ ebpf_write_global_dimension(aral, aral, ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
1564
1565
return priority - 2;
1566
}
1576
*/
1577
void ebpf_statistic_obsolete_aral_chart(ebpf_module_t *em, int prio)
1578
{
1379
- ebpf_write_chart_obsolete(NETDATA_MONITORING_FAMILY,
1380
- em->memory_allocations,
1381
- "",
1382
- "Calls to allocate memory.",
1383
- "calls",
1384
- NETDATA_EBPF_FAMILY,
1385
- NETDATA_EBPF_CHART_TYPE_STACKED,
1386
- "netdata.ebpf_aral_stat_alloc",
1387
- prio++,
1388
- em->update_every);
1389
-
1390
- ebpf_write_chart_obsolete(NETDATA_MONITORING_FAMILY,
1391
- em->memory_allocations,
1392
- "",
1393
- "Calls to allocate memory.",
1394
- "calls",
1395
- NETDATA_EBPF_FAMILY,
1396
- NETDATA_EBPF_CHART_TYPE_STACKED,
1397
- "netdata.ebpf_aral_stat_alloc",
1398
- prio++,
1399
- em->update_every);
1579
+ ebpf_write_chart_obsolete(
1580
+ NETDATA_MONITORING_FAMILY,
1581
+ em->memory_allocations,
1582
+ "",
1583
+ "Calls to allocate memory.",
1584
+ "calls",
1585
+ NETDATA_EBPF_FAMILY,
1586
+ NETDATA_EBPF_CHART_TYPE_STACKED,
1587
+ "netdata.ebpf_aral_stat_alloc",
1588
+ prio++,
1589
+ em->update_every);
1590
+
1591
+ ebpf_write_chart_obsolete(
1592
+ NETDATA_MONITORING_FAMILY,
1593
+ em->memory_allocations,
1594
+ "",
1595
+ "Calls to allocate memory.",
1596
+ "calls",
1597
+ NETDATA_EBPF_FAMILY,
1598
+ NETDATA_EBPF_CHART_TYPE_STACKED,
1599
+ "netdata.ebpf_aral_stat_alloc",
1600
+ prio++,
1601
+ em->update_every);
1602
}
1603
1604
/**
1611
*/
1612
void ebpf_send_data_aral_chart(ARAL *memory, ebpf_module_t *em)
1613
{
1412
- char *mem = { NETDATA_EBPF_STAT_DIMENSION_MEMORY };
1413
- char *aral = { NETDATA_EBPF_STAT_DIMENSION_ARAL };
1614
+ char *mem = {NETDATA_EBPF_STAT_DIMENSION_MEMORY};
1615
+ char *aral = {NETDATA_EBPF_STAT_DIMENSION_ARAL};
1616
1617
struct aral_statistics *stats = aral_get_statistics(memory);
1618
1646
* @param begin initial value to query hash table
1647
* @param end last value that will not be used.
1648
*/
1447
-void ebpf_read_global_table_stats(netdata_idx_t *stats,
1448
- netdata_idx_t *values,
1449
- int map_fd,
1450
- int maps_per_core,
1451
- uint32_t begin,
1452
- uint32_t end)
1649
+void ebpf_read_global_table_stats(
1650
+ netdata_idx_t *stats,
1651
+ netdata_idx_t *values,
1652
+ int map_fd,
1653
+ int maps_per_core,
1654
+ uint32_t begin,
1655
+ uint32_t end)
1656
{
1657
uint32_t idx, order;
1658
1659
for (idx = begin, order = 0; idx < end; idx++, order++) {
1660
if (!bpf_map_lookup_elem(map_fd, &idx, values)) {
1661
int i;
1459
- int before = (maps_per_core) ? ebpf_nprocs: 1;
1662
+ int before = (maps_per_core) ? ebpf_nprocs : 1;
1663
netdata_idx_t total = 0;
1664
for (i = 0; i < before; i++)
1665
total += values[i];
1684
*
1685
* @return
1686
*/
1484
-static inline in_addr_t ebpf_netmask(int prefix) {
1485
-
1687
+static inline in_addr_t ebpf_netmask(int prefix)
1688
+{
1689
if (prefix == 0)
1487
- return (~((in_addr_t) - 1));
1690
+ return (~((in_addr_t)-1));
1691
else
1692
return (in_addr_t)(~((1 << (32 - prefix)) - 1));
1490
-
1693
}
1694
1695
/**
1731
*/
1732
static void get_ipv6_first_addr(union netdata_ip_t *out, union netdata_ip_t *in, uint64_t prefix)
1733
{
1532
- uint64_t mask,tmp;
1734
+ uint64_t mask, tmp;
1735
uint64_t ret[2];
1736
1737
memcpy(ret, in->addr32, sizeof(union netdata_ip_t));
1769
*/
1770
static void get_ipv6_last_addr(union netdata_ip_t *out, union netdata_ip_t *in, uint64_t prefix)
1771
{
1570
- uint64_t mask,tmp;
1772
+ uint64_t mask, tmp;
1773
uint64_t ret[2];
1774
memcpy(ret, in->addr32, sizeof(union netdata_ip_t));
1775
1870
ebpf_network_viewer_ip_list_t **list = (ebpf_network_viewer_ip_list_t **)out;
1871
1872
char *ipdup = strdupz(ip);
1671
- union netdata_ip_t first = { };
1672
- union netdata_ip_t last = { };
1873
+ union netdata_ip_t first = {};
1874
+ union netdata_ip_t last = {};
1875
const char *is_ipv6;
1674
- if (*ip == '*' && *(ip+1) == '\0') {
1876
+ if (*ip == '*' && *(ip + 1) == '\0') {
1877
memset(first.addr8, 0, sizeof(first.addr8));
1878
memset(last.addr8, 0xFF, sizeof(last.addr8));
1879
1886
char *enddup = strdupz(ip);
1887
char *end = enddup;
1888
// Move while I cannot find a separator
1687
- while (*end && *end != '/' && *end != '-') end++;
1889
+ while (*end && *end != '/' && *end != '-')
1890
+ end++;
1891
1892
// We will use only the classic IPV6 for while, but we could consider the base 85 in a near future
1893
// https://tools.ietf.org/html/rfc1924
1907
if (select)
1908
goto cleanipdup;
1909
1707
- select = (int) str2i(end);
1910
+ select = (int)str2i(end);
1911
if (select < NETDATA_MINIMUM_IPV4_CIDR || select > NETDATA_MAXIMUM_IPV4_CIDR) {
1912
netdata_log_info("The specified CIDR %s is not valid, the IP %s will be ignored.", end, ip);
1913
goto cleanipdup;
1924
struct in_addr ipv4_convert;
1925
ipv4_convert.s_addr = ipv4_test;
1926
char ipv4_msg[INET_ADDRSTRLEN];
1724
- if(inet_ntop(AF_INET, &ipv4_convert, ipv4_msg, INET_ADDRSTRLEN))
1927
+ if (inet_ntop(AF_INET, &ipv4_convert, ipv4_msg, INET_ADDRSTRLEN))
1928
netdata_log_info("The network value of CIDR %s was updated for %s .", ipdup, ipv4_msg);
1929
}
1930
} else { // Range
1938
}
1939
1940
if (htonl(first.addr32[0]) > htonl(last.addr32[0])) {
1738
- netdata_log_info("The specified range %s is invalid, the second address is smallest than the first, it will be ignored.",
1739
- ipdup);
1941
+ netdata_log_info(
1942
+ "The specified range %s is invalid, the second address is smallest than the first, it will be ignored.",
1943
+ ipdup);
1944
goto cleanipdup;
1945
}
1946
} else if (is_ipv6) { // IPV6
1743
- if (!*end) { // Unique
1947
+ if (!*end) { // Unique
1948
select = ebpf_ip2nl(first.addr8, ip, AF_INET6, ipdup);
1949
if (select)
1950
goto cleanipdup;
1953
} else if (*end == '-') {
1954
*end++ = 0x00;
1955
if (*end == '!') {
1752
- netdata_log_info("The exclusion cannot be in the second part of the range %s, it will be ignored.", ipdup);
1956
+ netdata_log_info(
1957
+ "The exclusion cannot be in the second part of the range %s, it will be ignored.", ipdup);
1958
goto cleanipdup;
1959
}
1960
1968
} else { // CIDR
1969
*end++ = 0x00;
1970
if (*end == '!') {
1766
- netdata_log_info("The exclusion cannot be in the second part of the range %s, it will be ignored.", ipdup);
1971
+ netdata_log_info(
1972
+ "The exclusion cannot be in the second part of the range %s, it will be ignored.", ipdup);
1973
goto cleanipdup;
1974
}
1975
1993
memcpy(first.addr8, ipv6_test.addr8, sizeof(union netdata_ip_t));
1994
1995
struct in6_addr ipv6_convert;
1790
- memcpy(ipv6_convert.s6_addr, ipv6_test.addr8, sizeof(union netdata_ip_t));
1996
+ memcpy(ipv6_convert.s6_addr, ipv6_test.addr8, sizeof(union netdata_ip_t));
1997
1998
char ipv6_msg[INET6_ADDRSTRLEN];
1793
- if(inet_ntop(AF_INET6, &ipv6_convert, ipv6_msg, INET6_ADDRSTRLEN))
1999
+ if (inet_ntop(AF_INET6, &ipv6_convert, ipv6_msg, INET6_ADDRSTRLEN))
2000
netdata_log_info("The network value of CIDR %s was updated for %s .", ipdup, ipv6_msg);
2001
}
2002
}
2003
2004
if ((be64toh(*(uint64_t *)&first.addr64[1]) > be64toh(*(uint64_t *)&last.addr64[1]) &&
2005
!memcmp(first.addr64, last.addr64, sizeof(uint64_t))) ||
1800
- (be64toh(*(uint64_t *)&first.addr64) > be64toh(*(uint64_t *)&last.addr64)) ) {
1801
- netdata_log_info("The specified range %s is invalid, the second address is smallest than the first, it will be ignored.",
1802
- ipdup);
2006
+ (be64toh(*(uint64_t *)&first.addr64) > be64toh(*(uint64_t *)&last.addr64))) {
2007
+ netdata_log_info(
2008
+ "The specified range %s is invalid, the second address is smallest than the first, it will be ignored.",
2009
+ ipdup);
2010
goto cleanipdup;
2011
}
2012
} else { // Unique ip
2023
store = callocz(1, sizeof(ebpf_network_viewer_ip_list_t));
2024
store->value = ipdup;
2025
store->hash = simple_hash(ipdup);
1819
- store->ver = (uint8_t)(!is_ipv6)?AF_INET:AF_INET6;
2026
+ store->ver = (uint8_t)(!is_ipv6) ? AF_INET : AF_INET6;
2027
memcpy(store->first.addr8, first.addr8, sizeof(first.addr8));
2028
memcpy(store->last.addr8, last.addr8, sizeof(last.addr8));
2029
2050
2051
while (likely(ptr)) {
2052
// Move forward until next valid character
1846
- while (isspace(*ptr)) ptr++;
2053
+ while (isspace(*ptr))
2054
+ ptr++;
2055
2056
// No valid value found
2057
if (unlikely(!*ptr))
2093
while (move) {
2094
uint16_t cmp_first = ntohs(move->first);
2095
uint16_t cmp_last = ntohs(move->last);
1888
- if (cmp_first <= first && first <= cmp_last &&
1889
- cmp_first <= last && last <= cmp_last ) {
1890
- netdata_log_info("The range/value (%u, %u) is inside the range/value (%u, %u) already inserted, it will be ignored.",
1891
- first, last, cmp_first, cmp_last);
2096
+ if (cmp_first <= first && first <= cmp_last && cmp_first <= last && last <= cmp_last) {
2097
+ netdata_log_info(
2098
+ "The range/value (%u, %u) is inside the range/value (%u, %u) already inserted, it will be ignored.",
2099
+ first,
2100
+ last,
2101
+ cmp_first,
2102
+ cmp_last);
2103
freez(in->value);
2104
freez(in);
2105
return;
1895
- } else if (first <= cmp_first && cmp_first <= last &&
1896
- first <= cmp_last && cmp_last <= last) {
1897
- netdata_log_info("The range (%u, %u) is bigger than previous range (%u, %u) already inserted, the previous will be ignored.",
1898
- first, last, cmp_first, cmp_last);
2106
+ } else if (first <= cmp_first && cmp_first <= last && first <= cmp_last && cmp_last <= last) {
2107
+ netdata_log_info(
2108
+ "The range (%u, %u) is bigger than previous range (%u, %u) already inserted, the previous will be ignored.",
2109
+ first,
2110
+ last,
2111
+ cmp_first,
2112
+ cmp_last);
2113
freez(move->value);
2114
move->value = in->value;
2115
move->first = in->first;
2128
}
2129
2130
#ifdef NETDATA_INTERNAL_CHECKS
1917
- netdata_log_info("Adding values %s( %u, %u) to %s port list used on network viewer",
1918
- in->value, in->first, in->last,
1919
- (*out == network_viewer_opt.included_port)?"included":"excluded");
2131
+ netdata_log_info(
2132
+ "Adding values %s( %u, %u) to %s port list used on network viewer",
2133
+ in->value,
2134
+ in->first,
2135
+ in->last,
2136
+ (*out == network_viewer_opt.included_port) ? "included" : "excluded");
2137
#endif
2138
}
2139
2172
* @param out a pointer to store the link list
2173
* @param range the informed range for the user.
2174
*/
1958
-static void ebpf_parse_port_list(void **out, const char *range_param) {
2175
+static void ebpf_parse_port_list(void **out, const char *range_param)
2176
+{
2177
char range[strlen(range_param) + 1];
2178
strncpyz(range, range_param, strlen(range_param));
2179
2181
ebpf_network_viewer_port_list_t **list = (ebpf_network_viewer_port_list_t **)out;
2182
2183
char *copied = strdupz(range);
1966
- if (*range == '*' && *(range+1) == '\0') {
2184
+ if (*range == '*' && *(range + 1) == '\0') {
2185
first = 1;
2186
last = 65535;
2187
2191
2192
char *end = range;
2193
//Move while I cannot find a separator
1976
- while (*end && *end != ':' && *end != '-') end++;
2194
+ while (*end && *end != ':' && *end != '-')
2195
+ end++;
2196
2197
//It has a range
2198
if (likely(*end)) {
2199
*end++ = '\0';
2200
if (*end == '!') {
1982
- netdata_log_info("The exclusion cannot be in the second part of the range, the range %s will be ignored.", copied);
2201
+ netdata_log_info(
2202
+ "The exclusion cannot be in the second part of the range, the range %s will be ignored.", copied);
2203
freez(copied);
2204
return;
2205
}
2219
last = first;
2220
2221
if (last < NETDATA_MINIMUM_PORT_VALUE || last > NETDATA_MAXIMUM_PORT_VALUE) {
2002
- netdata_log_info("The second port %d of the range \"%s\" is invalid and the whole range will be ignored!", last, copied);
2222
+ netdata_log_info(
2223
+ "The second port %d of the range \"%s\" is invalid and the whole range will be ignored!", last, copied);
2224
freez(copied);
2225
return;
2226
}
2227
2228
if (first > last) {
2008
- netdata_log_info("The specified order %s is wrong, the smallest value is always the first, it will be ignored!", copied);
2229
+ netdata_log_info(
2230
+ "The specified order %s is wrong, the smallest value is always the first, it will be ignored!", copied);
2231
freez(copied);
2232
return;
2233
}
2234
2235
ebpf_network_viewer_port_list_t *w;
2014
- fillenvpl:
2236
+fillenvpl:
2237
w = callocz(1, sizeof(ebpf_network_viewer_port_list_t));
2238
w->value = copied;
2239
w->hash = simple_hash(copied);
2260
2261
while (likely(ptr)) {
2262
// Move forward until next valid character
2041
- while (isspace(*ptr)) ptr++;
2263
+ while (isspace(*ptr))
2264
+ ptr++;
2265
2266
// No valid value found
2267
if (unlikely(!*ptr))
2310
* @param algorithm a vector with the algorithms used to make the charts
2311
* @param end the number of elements in the previous 4 arguments.
2312
*/
2090
-void ebpf_global_labels(netdata_syscall_stat_t *is, netdata_publish_syscall_t *pio, char **dim,
2091
- char **name, int *algorithm, int end)
2313
+void ebpf_global_labels(
2314
+ netdata_syscall_stat_t *is,
2315
+ netdata_publish_syscall_t *pio,
2316
+ char **dim,
2317
+ char **name,
2318
+ int *algorithm,
2319
+ int end)
2320
{
2321
int i;
2322
2430
*/
2431
void ebpf_print_help()
2432
{
2205
- fprintf(stderr,
2206
- "\n"
2207
- " Netdata ebpf.plugin %s\n"
2208
- " Copyright 2018-2025 Netdata Inc.\n"
2209
- " Released under GNU General Public License v3 or later.\n"
2210
- "\n"
2211
- " This eBPF.plugin is a data collector plugin for netdata.\n"
2212
- "\n"
2213
- " This plugin only accepts long options with one or two dashes. The available command line options are:\n"
2214
- "\n"
2215
- " SECONDS Set the data collection frequency.\n"
2216
- "\n"
2217
- " [-]-help Show this help.\n"
2218
- "\n"
2219
- " [-]-version Show software version.\n"
2220
- "\n"
2221
- " [-]-global Disable charts per application and cgroup.\n"
2222
- "\n"
2223
- " [-]-all Enable all chart groups (global, apps, and cgroup), unless -g is also given.\n"
2224
- "\n"
2225
- " [-]-cachestat Enable charts related to process run time.\n"
2226
- "\n"
2227
- " [-]-dcstat Enable charts related to directory cache.\n"
2228
- "\n"
2229
- " [-]-disk Enable charts related to disk monitoring.\n"
2230
- "\n"
2231
- " [-]-filesystem Enable chart related to filesystem run time.\n"
2232
- "\n"
2233
- " [-]-hardirq Enable chart related to hard IRQ latency.\n"
2234
- "\n"
2235
- " [-]-mdflush Enable charts related to multi-device flush.\n"
2236
- "\n"
2237
- " [-]-mount Enable charts related to mount monitoring.\n"
2238
- "\n"
2239
- " [-]-net Enable network viewer charts.\n"
2240
- "\n"
2241
- " [-]-oomkill Enable chart related to OOM kill tracking.\n"
2242
- "\n"
2243
- " [-]-process Enable charts related to process run time.\n"
2244
- "\n"
2245
- " [-]-return Run the collector in return mode.\n"
2246
- "\n"
2247
- " [-]-shm Enable chart related to shared memory tracking.\n"
2248
- "\n"
2249
- " [-]-softirq Enable chart related to soft IRQ latency.\n"
2250
- "\n"
2251
- " [-]-sync Enable chart related to sync run time.\n"
2252
- "\n"
2253
- " [-]-swap Enable chart related to swap run time.\n"
2254
- "\n"
2255
- " [-]-vfs Enable chart related to vfs run time.\n"
2256
- "\n"
2257
- " [-]-legacy Load legacy eBPF programs.\n"
2258
- "\n"
2259
- " [-]-core Use CO-RE when available(Working in progress).\n"
2260
- "\n",
2261
- NETDATA_VERSION);
2433
+ fprintf(
2434
+ stderr,
2435
+ "\n"
2436
+ " Netdata ebpf.plugin %s\n"
2437
+ " Copyright 2018-2025 Netdata Inc.\n"
2438
+ " Released under GNU General Public License v3 or later.\n"
2439
+ "\n"
2440
+ " This eBPF.plugin is a data collector plugin for netdata.\n"
2441
+ "\n"
2442
+ " This plugin only accepts long options with one or two dashes. The available command line options are:\n"
2443
+ "\n"
2444
+ " SECONDS Set the data collection frequency.\n"
2445
+ "\n"
2446
+ " [-]-help Show this help.\n"
2447
+ "\n"
2448
+ " [-]-version Show software version.\n"
2449
+ "\n"
2450
+ " [-]-global Disable charts per application and cgroup.\n"
2451
+ "\n"
2452
+ " [-]-all Enable all chart groups (global, apps, and cgroup), unless -g is also given.\n"
2453
+ "\n"
2454
+ " [-]-cachestat Enable charts related to process run time.\n"
2455
+ "\n"
2456
+ " [-]-dcstat Enable charts related to directory cache.\n"
2457
+ "\n"
2458
+ " [-]-disk Enable charts related to disk monitoring.\n"
2459
+ "\n"
2460
+ " [-]-filesystem Enable chart related to filesystem run time.\n"
2461
+ "\n"
2462
+ " [-]-hardirq Enable chart related to hard IRQ latency.\n"
2463
+ "\n"
2464
+ " [-]-mdflush Enable charts related to multi-device flush.\n"
2465
+ "\n"
2466
+ " [-]-mount Enable charts related to mount monitoring.\n"
2467
+ "\n"
2468
+ " [-]-net Enable network viewer charts.\n"
2469
+ "\n"
2470
+ " [-]-oomkill Enable chart related to OOM kill tracking.\n"
2471
+ "\n"
2472
+ " [-]-process Enable charts related to process run time.\n"
2473
+ "\n"
2474
+ " [-]-return Run the collector in return mode.\n"
2475
+ "\n"
2476
+ " [-]-shm Enable chart related to shared memory tracking.\n"
2477
+ "\n"
2478
+ " [-]-softirq Enable chart related to soft IRQ latency.\n"
2479
+ "\n"
2480
+ " [-]-sync Enable chart related to sync run time.\n"
2481
+ "\n"
2482
+ " [-]-swap Enable chart related to swap run time.\n"
2483
+ "\n"
2484
+ " [-]-vfs Enable chart related to vfs run time.\n"
2485
+ "\n"
2486
+ " [-]-legacy Load legacy eBPF programs.\n"
2487
+ "\n"
2488
+ " [-]-core Use CO-RE when available(Working in progress).\n"
2489
+ "\n",
2490
+ NETDATA_VERSION);
2491
}
2492
2493
/*****************************************************************
2562
for (int i = 0; tps[i].class != NULL; i++) {
2563
if (ebpf_enable_tracepoint(&tps[i]) == -1) {
2564
netdata_log_error("Failed to enable tracepoint %s:%s", tps[i].class, tps[i].event);
2336
- }
2337
- else {
2565
+ } else {
2566
cnt += 1;
2567
}
2568
}
2588
*
2589
* @return It returns 1 if the IP is inside the range and 0 otherwise
2590
*/
2363
-static int ebpf_is_ip_inside_range(union netdata_ip_t *rfirst, union netdata_ip_t *rlast,
2364
- union netdata_ip_t *cmpfirst, union netdata_ip_t *cmplast, int family)
2591
+static int ebpf_is_ip_inside_range(
2592
+ union netdata_ip_t *rfirst,
2593
+ union netdata_ip_t *rlast,
2594
+ union netdata_ip_t *cmpfirst,
2595
+ union netdata_ip_t *cmplast,
2596
+ int family)
2597
{
2598
if (family == AF_INET) {
2599
if ((rfirst->addr32[0] <= cmpfirst->addr32[0]) && (rlast->addr32[0] >= cmplast->addr32[0]))
2603
memcmp(rlast->addr8, cmplast->addr8, sizeof(union netdata_ip_t)) >= 0) {
2604
return 1;
2605
}
2374
-
2606
}
2607
return 0;
2608
}
2614
* @param in the structure that will be linked.
2615
* @param table the modified table.
2616
*/
2386
-void ebpf_fill_ip_list_unsafe(ebpf_network_viewer_ip_list_t **out, ebpf_network_viewer_ip_list_t *in,
2387
- char *table __maybe_unused)
2617
+void ebpf_fill_ip_list_unsafe(
2618
+ ebpf_network_viewer_ip_list_t **out,
2619
+ ebpf_network_viewer_ip_list_t *in,
2620
+ char *table __maybe_unused)
2621
{
2622
if (in->ver == AF_INET) { // It is simpler to compare using host order
2623
in->first.addr32[0] = ntohl(in->first.addr32[0]);
2629
if (in->ver == move->ver &&
2630
ebpf_is_ip_inside_range(&move->first, &move->last, &in->first, &in->last, in->ver)) {
2631
#ifdef NETDATA_DEV_MODE
2399
- netdata_log_info("The range/value (%s) is inside the range/value (%s) already inserted, it will be ignored.",
2400
- in->value, move->value);
2632
+ netdata_log_info(
2633
+ "The range/value (%s) is inside the range/value (%s) already inserted, it will be ignored.",
2634
+ in->value,
2635
+ move->value);
2636
#endif
2637
freez(in->value);
2638
freez(in);
2649
2650
#ifdef NETDATA_DEV_MODE
2651
char first[256], last[512];
2417
- if (in->ver == AF_INET) {
2418
- netdata_log_info("Adding values %s: (%u - %u) to %s IP list \"%s\" used on network viewer",
2419
- in->value, in->first.addr32[0], in->last.addr32[0],
2420
- (*out == network_viewer_opt.included_ips)?"included":"excluded",
2421
- table);
2422
- } else {
2423
- if (inet_ntop(AF_INET6, in->first.addr8, first, INET6_ADDRSTRLEN) &&
2424
- inet_ntop(AF_INET6, in->last.addr8, last, INET6_ADDRSTRLEN))
2425
- netdata_log_info("Adding values %s - %s to %s IP list \"%s\" used on network viewer",
2426
- first, last,
2427
- (*out == network_viewer_opt.included_ips)?"included":"excluded",
2428
- table);
2429
- }
2652
+ if (in->ver == AF_INET) {
2653
+ netdata_log_info(
2654
+ "Adding values %s: (%u - %u) to %s IP list \"%s\" used on network viewer",
2655
+ in->value,
2656
+ in->first.addr32[0],
2657
+ in->last.addr32[0],
2658
+ (*out == network_viewer_opt.included_ips) ? "included" : "excluded",
2659
+ table);
2660
+ } else {
2661
+ if (inet_ntop(AF_INET6, in->first.addr8, first, INET6_ADDRSTRLEN) &&
2662
+ inet_ntop(AF_INET6, in->last.addr8, last, INET6_ADDRSTRLEN))
2663
+ netdata_log_info(
2664
+ "Adding values %s - %s to %s IP list \"%s\" used on network viewer",
2665
+ first,
2666
+ last,
2667
+ (*out == network_viewer_opt.included_ips) ? "included" : "excluded",
2668
+ table);
2669
+ }
2670
#endif
2671
}
2672
2680
{
2681
if (likely(*out)) {
2682
ebpf_network_viewer_hostname_list_t *move = *out;
2443
- for (; move->next ; move = move->next ) {
2683
+ for (; move->next; move = move->next) {
2684
if (move->hash == in->hash && !strcmp(move->value, in->value)) {
2685
netdata_log_info("The hostname %s was already inserted, it will be ignored.", in->value);
2686
freez(in->value);
2695
*out = in;
2696
}
2697
#ifdef NETDATA_INTERNAL_CHECKS
2458
- netdata_log_info("Adding value %s to %s hostname list used on network viewer",
2459
- in->value,
2460
- (*out == network_viewer_opt.included_hostnames)?"included":"excluded");
2698
+ netdata_log_info(
2699
+ "Adding value %s to %s hostname list used on network viewer",
2700
+ in->value,
2701
+ (*out == network_viewer_opt.included_hostnames) ? "included" : "excluded");
2702
#endif
2703
}
2704
2719
2720
while (likely(parse)) {
2721
// Find the first valid value
2481
- while (isspace(*parse)) parse++;
2722
+ while (isspace(*parse))
2723
+ parse++;
2724
2725
// No valid value found
2726
if (unlikely(!*parse))
2738
parse++;
2739
}
2740
2499
- ebpf_network_viewer_hostname_list_t *hostname = callocz(1 , sizeof(ebpf_network_viewer_hostname_list_t));
2741
+ ebpf_network_viewer_hostname_list_t *hostname = callocz(1, sizeof(ebpf_network_viewer_hostname_list_t));
2742
hostname->value = strdupz(parse);
2743
hostname->hash = simple_hash(parse);
2744
hostname->value_pattern = simple_pattern_create(parse, NULL, SIMPLE_PATTERN_EXACT, true);
2745
2504
- ebpf_link_hostname((!neg) ? &network_viewer_opt.included_hostnames :
2505
- &network_viewer_opt.excluded_hostnames,
2506
- hostname);
2746
+ ebpf_link_hostname(
2747
+ (!neg) ? &network_viewer_opt.included_hostnames : &network_viewer_opt.excluded_hostnames, hostname);
2748
2749
parse = end;
2750
}
2757
*/
2758
void parse_network_viewer_section(struct config *cfg)
2759
{
2519
- network_viewer_opt.hostname_resolution_enabled = appconfig_get_boolean(cfg,
2520
- EBPF_NETWORK_VIEWER_SECTION,
2521
- EBPF_CONFIG_RESOLVE_HOSTNAME,
2522
- CONFIG_BOOLEAN_NO);
2760
+ network_viewer_opt.hostname_resolution_enabled =
2761
+ appconfig_get_boolean(cfg, EBPF_NETWORK_VIEWER_SECTION, EBPF_CONFIG_RESOLVE_HOSTNAME, CONFIG_BOOLEAN_NO);
2762
2524
- network_viewer_opt.service_resolution_enabled = appconfig_get_boolean(cfg,
2525
- EBPF_NETWORK_VIEWER_SECTION,
2526
- EBPF_CONFIG_RESOLVE_SERVICE,
2527
- CONFIG_BOOLEAN_YES);
2763
+ network_viewer_opt.service_resolution_enabled =
2764
+ appconfig_get_boolean(cfg, EBPF_NETWORK_VIEWER_SECTION, EBPF_CONFIG_RESOLVE_SERVICE, CONFIG_BOOLEAN_YES);
2765
2766
const char *value = appconfig_get(cfg, EBPF_NETWORK_VIEWER_SECTION, EBPF_CONFIG_PORTS, NULL);
2767
ebpf_parse_ports(value);
2773
netdata_log_info("Name resolution is disabled, collector will not parse \"hostnames\" list.");
2774
}
2775
2539
- value = appconfig_get(cfg,
2540
- EBPF_NETWORK_VIEWER_SECTION,
2541
- "ips",
2542
- NULL);
2543
- //"ips", "!127.0.0.1/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 fc00::/7 !::1/128");
2776
+ value = appconfig_get(cfg, EBPF_NETWORK_VIEWER_SECTION, "ips", NULL);
2777
+ //"ips", "!127.0.0.1/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 fc00::/7 !::1/128");
2778
ebpf_parse_ips_unsafe(value);
2779
}
2780
2798
2799
size_t lines = procfile_lines(ff), l;
2800
netdata_passive_connection_t values = {.counter = 0, .tgid = 0, .pid = 0};
2567
- for(l = 0; l < lines ;l++) {
2801
+ for (l = 0; l < lines; l++) {
2802
size_t words = procfile_linewords(ff, l);
2803
// This is header or end of file
2804
if (unlikely(words < 14))
2826
{
2827
struct ifaddrs *ifaddr, *ifa;
2828
if (getifaddrs(&ifaddr) == -1) {
2595
- netdata_log_error("Cannot get the local IP addresses, it is no possible to do separation between inbound and outbound connections");
2829
+ netdata_log_error(
2830
+ "Cannot get the local IP addresses, it is no possible to do separation between inbound and outbound connections");
2831
return;
2832
}
2833
2599
- char *notext = { "No text representation" };
2834
+ char *notext = {"No text representation"};
2835
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
2836
if (ifa->ifa_addr == NULL)
2837
continue;
2842
ebpf_network_viewer_ip_list_t *w = callocz(1, sizeof(ebpf_network_viewer_ip_list_t));
2843
2844
int family = ifa->ifa_addr->sa_family;
2610
- w->ver = (uint8_t) family;
2845
+ w->ver = (uint8_t)family;
2846
char text[INET6_ADDRSTRLEN];
2847
if (family == AF_INET) {
2613
- struct sockaddr_in *in = (struct sockaddr_in*) ifa->ifa_addr;
2848
+ struct sockaddr_in *in = (struct sockaddr_in *)ifa->ifa_addr;
2849
2850
w->first.addr32[0] = in->sin_addr.s_addr;
2851
w->last.addr32[0] = in->sin_addr.s_addr;
2858
w->hash = simple_hash(notext);
2859
}
2860
} else {
2626
- struct sockaddr_in6 *in6 = (struct sockaddr_in6*) ifa->ifa_addr;
2861
+ struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)ifa->ifa_addr;
2862
2863
memcpy(w->first.addr8, (void *)&in6->sin6_addr, sizeof(struct in6_addr));
2864
memcpy(w->last.addr8, (void *)&in6->sin6_addr, sizeof(struct in6_addr));
2898
*/
2899
static void ebpf_allocate_common_vectors()
2900
{
2666
- ebpf_judy_pid.pid_table = ebpf_allocate_pid_aral(NETDATA_EBPF_PID_SOCKET_ARAL_TABLE_NAME,
2667
- sizeof(netdata_ebpf_judy_pid_stats_t));
2668
-// ebpf_pids = callocz((size_t)pid_max, sizeof(ebpf_pid_data_t));
2901
+ ebpf_judy_pid.pid_table =
2902
+ ebpf_allocate_pid_aral(NETDATA_EBPF_PID_SOCKET_ARAL_TABLE_NAME, sizeof(netdata_ebpf_judy_pid_stats_t));
2903
+ // ebpf_pids = callocz((size_t)pid_max, sizeof(ebpf_pid_data_t));
2904
ebpf_aral_init();
2905
}
2906
2932
}
2933
}
2934
2700
-
2935
/**
2936
* Update interval
2937
*
2942
static void ebpf_update_interval(int update_every)
2943
{
2944
int i;
2711
- int value = (int) appconfig_get_number(&collector_config, EBPF_GLOBAL_SECTION, EBPF_CFG_UPDATE_EVERY,
2712
- update_every);
2945
+ int value = (int)appconfig_get_number(&collector_config, EBPF_GLOBAL_SECTION, EBPF_CFG_UPDATE_EVERY, update_every);
2946
for (i = 0; ebpf_modules[i].info.thread_name; i++) {
2947
ebpf_modules[i].update_every = value;
2948
}
2956
static void ebpf_update_table_size()
2957
{
2958
int i;
2726
- uint32_t value = (uint32_t) appconfig_get_number(&collector_config, EBPF_GLOBAL_SECTION,
2727
- EBPF_CFG_PID_SIZE, ND_EBPF_DEFAULT_PID_SIZE);
2959
+ uint32_t value = (uint32_t)appconfig_get_number(
2960
+ &collector_config, EBPF_GLOBAL_SECTION, EBPF_CFG_PID_SIZE, ND_EBPF_DEFAULT_PID_SIZE);
2961
for (i = 0; ebpf_modules[i].info.thread_name; i++) {
2962
ebpf_modules[i].pid_map_size = value;
2963
}
2971
static void ebpf_update_lifetime()
2972
{
2973
int i;
2741
- uint32_t value = (uint32_t) appconfig_get_number(&collector_config, EBPF_GLOBAL_SECTION,
2742
- EBPF_CFG_LIFETIME, EBPF_DEFAULT_LIFETIME);
2974
+ uint32_t value = (uint32_t)appconfig_get_number(
2975
+ &collector_config, EBPF_GLOBAL_SECTION, EBPF_CFG_LIFETIME, EBPF_DEFAULT_LIFETIME);
2976
for (i = 0; ebpf_modules[i].info.thread_name; i++) {
2977
ebpf_modules[i].lifetime = value;
2978
}
2988
int i;
2989
for (i = 0; ebpf_modules[i].info.thread_name; i++) {
2990
ebpf_modules[i].load &= ~NETDATA_EBPF_LOAD_METHODS;
2758
- ebpf_modules[i].load |= load | origin ;
2991
+ ebpf_modules[i].load |= load | origin;
2992
}
2993
}
2994
3013
static void ebpf_update_map_per_core()
3014
{
3015
int i;
2783
- int value = appconfig_get_boolean(&collector_config, EBPF_GLOBAL_SECTION,
2784
- EBPF_CFG_MAPS_PER_CORE, CONFIG_BOOLEAN_YES);
3016
+ int value =
3017
+ appconfig_get_boolean(&collector_config, EBPF_GLOBAL_SECTION, EBPF_CFG_MAPS_PER_CORE, CONFIG_BOOLEAN_YES);
3018
for (i = 0; ebpf_modules[i].info.thread_name; i++) {
3019
ebpf_modules[i].maps_per_core = value;
3020
}
3027
* @param update_every value to overwrite the update frequency set by the server.
3028
* @param origin specify the configuration file loaded
3029
*/
2797
-static void read_collector_values(int *disable_cgroups,
2798
- int update_every, netdata_ebpf_load_mode_t origin)
3030
+static void read_collector_values(int *disable_cgroups, int update_every, netdata_ebpf_load_mode_t origin)
3031
{
3032
// Read global section
3033
const char *value;
3034
if (appconfig_exists(&collector_config, EBPF_GLOBAL_SECTION, "load")) // Backward compatibility
2803
- value = appconfig_get(&collector_config, EBPF_GLOBAL_SECTION, "load",
2804
- EBPF_CFG_LOAD_MODE_DEFAULT);
3035
+ value = appconfig_get(&collector_config, EBPF_GLOBAL_SECTION, "load", EBPF_CFG_LOAD_MODE_DEFAULT);
3036
else
2806
- value = appconfig_get(&collector_config, EBPF_GLOBAL_SECTION, EBPF_CFG_LOAD_MODE,
2807
- EBPF_CFG_LOAD_MODE_DEFAULT);
3037
+ value = appconfig_get(&collector_config, EBPF_GLOBAL_SECTION, EBPF_CFG_LOAD_MODE, EBPF_CFG_LOAD_MODE_DEFAULT);
3038
3039
ebpf_how_to_load(value);
3040
2811
- btf_path = appconfig_get(&collector_config, EBPF_GLOBAL_SECTION, EBPF_CFG_PROGRAM_PATH,
2812
- EBPF_DEFAULT_BTF_PATH);
3041
+ btf_path = appconfig_get(&collector_config, EBPF_GLOBAL_SECTION, EBPF_CFG_PROGRAM_PATH, EBPF_DEFAULT_BTF_PATH);
3042
3043
#ifdef LIBBPF_MAJOR_VERSION
3044
default_btf = ebpf_load_btf_file(btf_path, EBPF_DEFAULT_BTF_FILE);
3055
ebpf_update_lifetime();
3056
3057
// This is kept to keep compatibility
2829
- uint32_t enabled = appconfig_get_boolean(&collector_config, EBPF_GLOBAL_SECTION, "disable apps",
2830
- CONFIG_BOOLEAN_NO);
3058
+ uint32_t enabled = appconfig_get_boolean(&collector_config, EBPF_GLOBAL_SECTION, "disable apps", CONFIG_BOOLEAN_NO);
3059
if (!enabled) {
3060
// Apps is a positive sentence, so we need to invert the values to disable apps.
2833
- enabled = appconfig_get_boolean(&collector_config, EBPF_GLOBAL_SECTION, EBPF_CFG_APPLICATION,
2834
- CONFIG_BOOLEAN_YES);
2835
- enabled = (enabled == CONFIG_BOOLEAN_NO)?CONFIG_BOOLEAN_YES:CONFIG_BOOLEAN_NO;
3061
+ enabled =
3062
+ appconfig_get_boolean(&collector_config, EBPF_GLOBAL_SECTION, EBPF_CFG_APPLICATION, CONFIG_BOOLEAN_YES);
3063
+ enabled = (enabled == CONFIG_BOOLEAN_NO) ? CONFIG_BOOLEAN_YES : CONFIG_BOOLEAN_NO;
3064
}
3065
3066
ebpf_set_apps_mode(!enabled);
3068
// Cgroup is a positive sentence, so we need to invert the values to disable apps.
3069
// We are using the same pattern for cgroup and apps
3070
enabled = appconfig_get_boolean(&collector_config, EBPF_GLOBAL_SECTION, EBPF_CFG_CGROUP, CONFIG_BOOLEAN_NO);
2843
- *disable_cgroups = (enabled == CONFIG_BOOLEAN_NO)?CONFIG_BOOLEAN_YES:CONFIG_BOOLEAN_NO;
3071
+ *disable_cgroups = (enabled == CONFIG_BOOLEAN_NO) ? CONFIG_BOOLEAN_YES : CONFIG_BOOLEAN_NO;
3072
3073
ebpf_update_map_per_core();
3074
3075
// Read ebpf programs section
2848
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION,
2849
- ebpf_modules[EBPF_MODULE_PROCESS_IDX].info.config_name, CONFIG_BOOLEAN_YES);
3076
+ enabled = appconfig_get_boolean(
3077
+ &collector_config,
3078
+ EBPF_PROGRAMS_SECTION,
3079
+ ebpf_modules[EBPF_MODULE_PROCESS_IDX].info.config_name,
3080
+ CONFIG_BOOLEAN_YES);
3081
if (enabled) {
3082
ebpf_enable_chart(EBPF_MODULE_PROCESS_IDX, *disable_cgroups);
3083
}
3084
3085
// This is kept to keep compatibility
2855
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "network viewer",
2856
- CONFIG_BOOLEAN_NO);
3086
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "network viewer", CONFIG_BOOLEAN_NO);
3087
if (!enabled)
2858
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION,
2859
- ebpf_modules[EBPF_MODULE_SOCKET_IDX].info.config_name,
2860
- CONFIG_BOOLEAN_NO);
3088
+ enabled = appconfig_get_boolean(
3089
+ &collector_config,
3090
+ EBPF_PROGRAMS_SECTION,
3091
+ ebpf_modules[EBPF_MODULE_SOCKET_IDX].info.config_name,
3092
+ CONFIG_BOOLEAN_NO);
3093
if (enabled) {
3094
ebpf_enable_chart(EBPF_MODULE_SOCKET_IDX, *disable_cgroups);
3095
}
3096
3097
// This is kept to keep compatibility
2866
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "network connection monitoring",
2867
- CONFIG_BOOLEAN_YES);
3098
+ enabled = appconfig_get_boolean(
3099
+ &collector_config, EBPF_PROGRAMS_SECTION, "network connection monitoring", CONFIG_BOOLEAN_YES);
3100
if (!enabled)
2869
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "network connections",
2870
- CONFIG_BOOLEAN_YES);
3101
+ enabled =
3102
+ appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "network connections", CONFIG_BOOLEAN_YES);
3103
3104
network_viewer_opt.enabled = enabled;
3105
if (enabled) {
3112
ebpf_parse_service_name_section(&collector_config);
3113
}
3114
2883
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "cachestat",
2884
- CONFIG_BOOLEAN_NO);
3115
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "cachestat", CONFIG_BOOLEAN_NO);
3116
3117
if (enabled) {
3118
ebpf_enable_chart(EBPF_MODULE_CACHESTAT_IDX, *disable_cgroups);
3119
}
3120
2890
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "sync",
2891
- CONFIG_BOOLEAN_YES);
3121
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "sync", CONFIG_BOOLEAN_YES);
3122
3123
if (enabled) {
3124
ebpf_enable_chart(EBPF_MODULE_SYNC_IDX, *disable_cgroups);
3125
}
3126
2897
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "dcstat",
2898
- CONFIG_BOOLEAN_NO);
3127
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "dcstat", CONFIG_BOOLEAN_NO);
3128
if (enabled) {
3129
ebpf_enable_chart(EBPF_MODULE_DCSTAT_IDX, *disable_cgroups);
3130
}
3131
2903
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "swap",
2904
- CONFIG_BOOLEAN_NO);
3132
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "swap", CONFIG_BOOLEAN_NO);
3133
if (enabled) {
3134
ebpf_enable_chart(EBPF_MODULE_SWAP_IDX, *disable_cgroups);
3135
}
3136
2909
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "vfs",
2910
- CONFIG_BOOLEAN_NO);
3137
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "vfs", CONFIG_BOOLEAN_NO);
3138
if (enabled) {
3139
ebpf_enable_chart(EBPF_MODULE_VFS_IDX, *disable_cgroups);
3140
}
3141
2915
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "filesystem",
2916
- CONFIG_BOOLEAN_NO);
3142
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "filesystem", CONFIG_BOOLEAN_NO);
3143
if (enabled) {
3144
ebpf_enable_chart(EBPF_MODULE_FILESYSTEM_IDX, *disable_cgroups);
3145
}
3146
2921
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "disk",
2922
- CONFIG_BOOLEAN_NO);
3147
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "disk", CONFIG_BOOLEAN_NO);
3148
if (enabled) {
3149
ebpf_enable_chart(EBPF_MODULE_DISK_IDX, *disable_cgroups);
3150
}
3151
2927
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "mount",
2928
- CONFIG_BOOLEAN_YES);
3152
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "mount", CONFIG_BOOLEAN_YES);
3153
if (enabled) {
3154
ebpf_enable_chart(EBPF_MODULE_MOUNT_IDX, *disable_cgroups);
3155
}
3156
2933
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "fd",
2934
- CONFIG_BOOLEAN_YES);
3157
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "fd", CONFIG_BOOLEAN_YES);
3158
if (enabled) {
3159
ebpf_enable_chart(EBPF_MODULE_FD_IDX, *disable_cgroups);
3160
}
3161
2939
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "hardirq",
2940
- CONFIG_BOOLEAN_YES);
3162
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "hardirq", CONFIG_BOOLEAN_YES);
3163
if (enabled) {
3164
ebpf_enable_chart(EBPF_MODULE_HARDIRQ_IDX, *disable_cgroups);
3165
}
3166
2945
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "softirq",
2946
- CONFIG_BOOLEAN_YES);
3167
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "softirq", CONFIG_BOOLEAN_YES);
3168
if (enabled) {
3169
ebpf_enable_chart(EBPF_MODULE_SOFTIRQ_IDX, *disable_cgroups);
3170
}
3171
2951
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "oomkill",
2952
- CONFIG_BOOLEAN_YES);
3172
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "oomkill", CONFIG_BOOLEAN_YES);
3173
if (enabled) {
3174
ebpf_enable_chart(EBPF_MODULE_OOMKILL_IDX, *disable_cgroups);
3175
}
3176
2957
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "shm",
2958
- CONFIG_BOOLEAN_YES);
3177
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "shm", CONFIG_BOOLEAN_YES);
3178
if (enabled) {
3179
ebpf_enable_chart(EBPF_MODULE_SHM_IDX, *disable_cgroups);
3180
}
3181
2963
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "mdflush",
2964
- CONFIG_BOOLEAN_NO);
3182
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "mdflush", CONFIG_BOOLEAN_NO);
3183
if (enabled) {
3184
ebpf_enable_chart(EBPF_MODULE_MDFLUSH_IDX, *disable_cgroups);
3185
}
3272
int option_index = 0;
3273
uint64_t select_threads = 0;
3274
static struct option long_options[] = {
3057
- {"process", no_argument, 0, 0 },
3058
- {"net", no_argument, 0, 0 },
3059
- {"cachestat", no_argument, 0, 0 },
3060
- {"sync", no_argument, 0, 0 },
3061
- {"dcstat", no_argument, 0, 0 },
3062
- {"swap", no_argument, 0, 0 },
3063
- {"vfs", no_argument, 0, 0 },
3064
- {"filesystem", no_argument, 0, 0 },
3065
- {"disk", no_argument, 0, 0 },
3066
- {"mount", no_argument, 0, 0 },
3067
- {"filedescriptor", no_argument, 0, 0 },
3068
- {"hardirq", no_argument, 0, 0 },
3069
- {"softirq", no_argument, 0, 0 },
3070
- {"oomkill", no_argument, 0, 0 },
3071
- {"shm", no_argument, 0, 0 },
3072
- {"mdflush", no_argument, 0, 0 },
3275
+ {"process", no_argument, 0, 0},
3276
+ {"net", no_argument, 0, 0},
3277
+ {"cachestat", no_argument, 0, 0},
3278
+ {"sync", no_argument, 0, 0},
3279
+ {"dcstat", no_argument, 0, 0},
3280
+ {"swap", no_argument, 0, 0},
3281
+ {"vfs", no_argument, 0, 0},
3282
+ {"filesystem", no_argument, 0, 0},
3283
+ {"disk", no_argument, 0, 0},
3284
+ {"mount", no_argument, 0, 0},
3285
+ {"filedescriptor", no_argument, 0, 0},
3286
+ {"hardirq", no_argument, 0, 0},
3287
+ {"softirq", no_argument, 0, 0},
3288
+ {"oomkill", no_argument, 0, 0},
3289
+ {"shm", no_argument, 0, 0},
3290
+ {"mdflush", no_argument, 0, 0},
3291
/* INSERT NEW THREADS BEFORE THIS COMMENT TO KEEP COMPATIBILITY WITH enum ebpf_module_indexes */
3074
- {"all", no_argument, 0, 0 },
3075
- {"version", no_argument, 0, 0 },
3076
- {"help", no_argument, 0, 0 },
3077
- {"global", no_argument, 0, 0 },
3078
- {"return", no_argument, 0, 0 },
3079
- {"legacy", no_argument, 0, 0 },
3080
- {"core", no_argument, 0, 0 },
3081
- {"unittest", no_argument, 0, 0 },
3082
- {0, 0, 0, 0}
3083
- };
3292
+ {"all", no_argument, 0, 0},
3293
+ {"version", no_argument, 0, 0},
3294
+ {"help", no_argument, 0, 0},
3295
+ {"global", no_argument, 0, 0},
3296
+ {"return", no_argument, 0, 0},
3297
+ {"legacy", no_argument, 0, 0},
3298
+ {"core", no_argument, 0, 0},
3299
+ {"unittest", no_argument, 0, 0},
3300
+ {0, 0, 0, 0}};
3301
3302
memset(&network_viewer_opt, 0, sizeof(network_viewer_opt));
3303
rw_spinlock_init(&network_viewer_opt.rw_spinlock);
3332
3333
switch (option_index) {
3334
case EBPF_MODULE_PROCESS_IDX: {
3118
- select_threads |= 1<<EBPF_MODULE_PROCESS_IDX;
3335
+ select_threads |= 1 << EBPF_MODULE_PROCESS_IDX;
3336
#ifdef NETDATA_INTERNAL_CHECKS
3120
- netdata_log_info("EBPF enabling \"PROCESS\" charts, because it was started with the option \"[-]-process\".");
3337
+ netdata_log_info(
3338
+ "EBPF enabling \"PROCESS\" charts, because it was started with the option \"[-]-process\".");
3339
#endif
3340
break;
3341
}
3342
case EBPF_MODULE_SOCKET_IDX: {
3125
- select_threads |= 1<<EBPF_MODULE_SOCKET_IDX;
3343
+ select_threads |= 1 << EBPF_MODULE_SOCKET_IDX;
3344
#ifdef NETDATA_INTERNAL_CHECKS
3345
netdata_log_info("EBPF enabling \"NET\" charts, because it was started with the option \"[-]-net\".");
3346
#endif
3347
break;
3348
}
3349
case EBPF_MODULE_CACHESTAT_IDX: {
3132
- select_threads |= 1<<EBPF_MODULE_CACHESTAT_IDX;
3350
+ select_threads |= 1 << EBPF_MODULE_CACHESTAT_IDX;
3351
#ifdef NETDATA_INTERNAL_CHECKS
3134
- netdata_log_info("EBPF enabling \"CACHESTAT\" charts, because it was started with the option \"[-]-cachestat\".");
3352
+ netdata_log_info(
3353
+ "EBPF enabling \"CACHESTAT\" charts, because it was started with the option \"[-]-cachestat\".");
3354
#endif
3355
break;
3356
}
3357
case EBPF_MODULE_SYNC_IDX: {
3139
- select_threads |= 1<<EBPF_MODULE_SYNC_IDX;
3358
+ select_threads |= 1 << EBPF_MODULE_SYNC_IDX;
3359
#ifdef NETDATA_INTERNAL_CHECKS
3360
netdata_log_info("EBPF enabling \"SYNC\" chart, because it was started with the option \"[-]-sync\".");
3361
#endif
3362
break;
3363
}
3364
case EBPF_MODULE_DCSTAT_IDX: {
3146
- select_threads |= 1<<EBPF_MODULE_DCSTAT_IDX;
3365
+ select_threads |= 1 << EBPF_MODULE_DCSTAT_IDX;
3366
#ifdef NETDATA_INTERNAL_CHECKS
3148
- netdata_log_info("EBPF enabling \"DCSTAT\" charts, because it was started with the option \"[-]-dcstat\".");
3367
+ netdata_log_info(
3368
+ "EBPF enabling \"DCSTAT\" charts, because it was started with the option \"[-]-dcstat\".");
3369
#endif
3370
break;
3371
}
3372
case EBPF_MODULE_SWAP_IDX: {
3153
- select_threads |= 1<<EBPF_MODULE_SWAP_IDX;
3373
+ select_threads |= 1 << EBPF_MODULE_SWAP_IDX;
3374
#ifdef NETDATA_INTERNAL_CHECKS
3375
netdata_log_info("EBPF enabling \"SWAP\" chart, because it was started with the option \"[-]-swap\".");
3376
#endif
3377
break;
3378
}
3379
case EBPF_MODULE_VFS_IDX: {
3160
- select_threads |= 1<<EBPF_MODULE_VFS_IDX;
3380
+ select_threads |= 1 << EBPF_MODULE_VFS_IDX;
3381
#ifdef NETDATA_INTERNAL_CHECKS
3382
netdata_log_info("EBPF enabling \"VFS\" chart, because it was started with the option \"[-]-vfs\".");
3383
#endif
3384
break;
3385
}
3386
case EBPF_MODULE_FILESYSTEM_IDX: {
3167
- select_threads |= 1<<EBPF_MODULE_FILESYSTEM_IDX;
3387
+ select_threads |= 1 << EBPF_MODULE_FILESYSTEM_IDX;
3388
#ifdef NETDATA_INTERNAL_CHECKS
3169
- netdata_log_info("EBPF enabling \"FILESYSTEM\" chart, because it was started with the option \"[-]-filesystem\".");
3389
+ netdata_log_info(
3390
+ "EBPF enabling \"FILESYSTEM\" chart, because it was started with the option \"[-]-filesystem\".");
3391
#endif
3392
break;
3393
}
3394
case EBPF_MODULE_DISK_IDX: {
3174
- select_threads |= 1<<EBPF_MODULE_DISK_IDX;
3395
+ select_threads |= 1 << EBPF_MODULE_DISK_IDX;
3396
#ifdef NETDATA_INTERNAL_CHECKS
3397
netdata_log_info("EBPF enabling \"DISK\" chart, because it was started with the option \"[-]-disk\".");
3398
#endif
3399
break;
3400
}
3401
case EBPF_MODULE_MOUNT_IDX: {
3181
- select_threads |= 1<<EBPF_MODULE_MOUNT_IDX;
3402
+ select_threads |= 1 << EBPF_MODULE_MOUNT_IDX;
3403
#ifdef NETDATA_INTERNAL_CHECKS
3183
- netdata_log_info("EBPF enabling \"MOUNT\" chart, because it was started with the option \"[-]-mount\".");
3404
+ netdata_log_info(
3405
+ "EBPF enabling \"MOUNT\" chart, because it was started with the option \"[-]-mount\".");
3406
#endif
3407
break;
3408
}
3409
case EBPF_MODULE_FD_IDX: {
3188
- select_threads |= 1<<EBPF_MODULE_FD_IDX;
3410
+ select_threads |= 1 << EBPF_MODULE_FD_IDX;
3411
#ifdef NETDATA_INTERNAL_CHECKS
3190
- netdata_log_info("EBPF enabling \"FILEDESCRIPTOR\" chart, because it was started with the option \"[-]-filedescriptor\".");
3412
+ netdata_log_info(
3413
+ "EBPF enabling \"FILEDESCRIPTOR\" chart, because it was started with the option \"[-]-filedescriptor\".");
3414
#endif
3415
break;
3416
}
3417
case EBPF_MODULE_HARDIRQ_IDX: {
3195
- select_threads |= 1<<EBPF_MODULE_HARDIRQ_IDX;
3418
+ select_threads |= 1 << EBPF_MODULE_HARDIRQ_IDX;
3419
#ifdef NETDATA_INTERNAL_CHECKS
3197
- netdata_log_info("EBPF enabling \"HARDIRQ\" chart, because it was started with the option \"[-]-hardirq\".");
3420
+ netdata_log_info(
3421
+ "EBPF enabling \"HARDIRQ\" chart, because it was started with the option \"[-]-hardirq\".");
3422
#endif
3423
break;
3424
}
3425
case EBPF_MODULE_SOFTIRQ_IDX: {
3202
- select_threads |= 1<<EBPF_MODULE_SOFTIRQ_IDX;
3426
+ select_threads |= 1 << EBPF_MODULE_SOFTIRQ_IDX;
3427
#ifdef NETDATA_INTERNAL_CHECKS
3204
- netdata_log_info("EBPF enabling \"SOFTIRQ\" chart, because it was started with the option \"[-]-softirq\".");
3428
+ netdata_log_info(
3429
+ "EBPF enabling \"SOFTIRQ\" chart, because it was started with the option \"[-]-softirq\".");
3430
#endif
3431
break;
3432
}
3433
case EBPF_MODULE_OOMKILL_IDX: {
3209
- select_threads |= 1<<EBPF_MODULE_OOMKILL_IDX;
3434
+ select_threads |= 1 << EBPF_MODULE_OOMKILL_IDX;
3435
#ifdef NETDATA_INTERNAL_CHECKS
3211
- netdata_log_info("EBPF enabling \"OOMKILL\" chart, because it was started with the option \"[-]-oomkill\".");
3436
+ netdata_log_info(
3437
+ "EBPF enabling \"OOMKILL\" chart, because it was started with the option \"[-]-oomkill\".");
3438
#endif
3439
break;
3440
}
3441
case EBPF_MODULE_SHM_IDX: {
3216
- select_threads |= 1<<EBPF_MODULE_SHM_IDX;
3442
+ select_threads |= 1 << EBPF_MODULE_SHM_IDX;
3443
#ifdef NETDATA_INTERNAL_CHECKS
3444
netdata_log_info("EBPF enabling \"SHM\" chart, because it was started with the option \"[-]-shm\".");
3445
#endif
3446
break;
3447
}
3448
case EBPF_MODULE_MDFLUSH_IDX: {
3223
- select_threads |= 1<<EBPF_MODULE_MDFLUSH_IDX;
3449
+ select_threads |= 1 << EBPF_MODULE_MDFLUSH_IDX;
3450
#ifdef NETDATA_INTERNAL_CHECKS
3225
- netdata_log_info("EBPF enabling \"MDFLUSH\" chart, because it was started with the option \"[-]-mdflush\".");
3451
+ netdata_log_info(
3452
+ "EBPF enabling \"MDFLUSH\" chart, because it was started with the option \"[-]-mdflush\".");
3453
#endif
3454
break;
3455
}
3457
ebpf_set_apps_mode(NETDATA_EBPF_APPS_FLAG_YES);
3458
disable_cgroups = 0;
3459
#ifdef NETDATA_INTERNAL_CHECKS
3233
- netdata_log_info("EBPF running with all chart groups, because it was started with the option \"[-]-all\".");
3460
+ netdata_log_info(
3461
+ "EBPF running with all chart groups, because it was started with the option \"[-]-all\".");
3462
#endif
3463
break;
3464
}
3473
case EBPF_OPTION_GLOBAL_CHART: {
3474
disable_cgroups = 1;
3475
#ifdef NETDATA_INTERNAL_CHECKS
3248
- netdata_log_info("EBPF running with global chart group, because it was started with the option \"[-]-global\".");
3476
+ netdata_log_info(
3477
+ "EBPF running with global chart group, because it was started with the option \"[-]-global\".");
3478
#endif
3479
break;
3480
}
3481
case EBPF_OPTION_RETURN_MODE: {
3482
ebpf_set_thread_mode(MODE_RETURN);
3483
#ifdef NETDATA_INTERNAL_CHECKS
3255
- netdata_log_info("EBPF running in \"RETURN\" mode, because it was started with the option \"[-]-return\".");
3484
+ netdata_log_info(
3485
+ "EBPF running in \"RETURN\" mode, because it was started with the option \"[-]-return\".");
3486
#endif
3487
break;
3488
}
3489
case EBPF_OPTION_LEGACY: {
3490
ebpf_set_load_mode(EBPF_LOAD_LEGACY, EBPF_LOADED_FROM_USER);
3491
#ifdef NETDATA_INTERNAL_CHECKS
3262
- netdata_log_info("EBPF running with \"LEGACY\" code, because it was started with the option \"[-]-legacy\".");
3492
+ netdata_log_info(
3493
+ "EBPF running with \"LEGACY\" code, because it was started with the option \"[-]-legacy\".");
3494
#endif
3495
break;
3496
}
3497
case EBPF_OPTION_CORE: {
3498
ebpf_set_load_mode(EBPF_LOAD_CORE, EBPF_LOADED_FROM_USER);
3499
#ifdef NETDATA_INTERNAL_CHECKS
3269
- netdata_log_info("EBPF running with \"CO-RE\" code, because it was started with the option \"[-]-core\".");
3500
+ netdata_log_info(
3501
+ "EBPF running with \"CO-RE\" code, because it was started with the option \"[-]-core\".");
3502
#endif
3503
break;
3504
}
3526
ebpf_ut_cleanup_memory();
3527
3528
exit_code = 0;
3297
-unittest:
3529
+ unittest:
3530
exit(exit_code);
3531
}
3532
default: {
3543
disable_all_global_charts();
3544
uint64_t idx;
3545
for (idx = 0; idx < EBPF_OPTION_ALL_CHARTS; idx++) {
3314
- if (select_threads & 1<<idx)
3546
+ if (select_threads & 1 << idx)
3547
ebpf_enable_specific_chart(&ebpf_modules[idx], disable_cgroups);
3548
}
3549
}
3551
// Load apps_groups.conf
3552
if (ebpf_read_apps_groups_conf(
3553
&apps_groups_default_target, &apps_groups_root_target, ebpf_user_config_dir, "groups")) {
3322
- netdata_log_info("Cannot read process groups configuration file '%s/apps_groups.conf'. Will try '%s/apps_groups.conf'",
3323
- ebpf_user_config_dir, ebpf_stock_config_dir);
3554
+ netdata_log_info(
3555
+ "Cannot read process groups configuration file '%s/apps_groups.conf'. Will try '%s/apps_groups.conf'",
3556
+ ebpf_user_config_dir,
3557
+ ebpf_stock_config_dir);
3558
if (ebpf_read_apps_groups_conf(
3559
&apps_groups_default_target, &apps_groups_root_target, ebpf_stock_config_dir, "groups")) {
3326
- netdata_log_error("Cannot read process groups '%s/apps_groups.conf'. There are no internal defaults. Failing.",
3327
- ebpf_stock_config_dir);
3560
+ netdata_log_error(
3561
+ "Cannot read process groups '%s/apps_groups.conf'. There are no internal defaults. Failing.",
3562
+ ebpf_stock_config_dir);
3563
ebpf_exit();
3564
}
3565
} else
3592
for (i = 0; i < EBPF_MODULE_FUNCTION_IDX; i++) {
3593
ebpf_module_t *wem = &ebpf_modules[i];
3594
if (wem->functions.apps_routine)
3360
- write_chart_dimension((char *)wem->info.thread_name,
3361
- (wem->enabled < NETDATA_THREAD_EBPF_STOPPING) ?
3362
- wem->hash_table_stats[idx]:
3363
- 0);
3595
+ write_chart_dimension(
3596
+ (char *)wem->info.thread_name,
3597
+ (wem->enabled < NETDATA_THREAD_EBPF_STOPPING) ? wem->hash_table_stats[idx] : 0);
3598
}
3599
ebpf_write_end_chart();
3600
}
3611
ebpf_write_begin_chart(NETDATA_MONITORING_FAMILY, NETDATA_EBPF_HASH_TABLES_GLOBAL_ELEMENTS, "");
3612
for (i = 0; i < EBPF_MODULE_FUNCTION_IDX; i++) {
3613
ebpf_module_t *wem = &ebpf_modules[i];
3380
- write_chart_dimension((char *)wem->info.thread_name,
3381
- (wem->enabled < NETDATA_THREAD_EBPF_STOPPING) ? NETDATA_CONTROLLER_END: 0);
3614
+ write_chart_dimension(
3615
+ (char *)wem->info.thread_name, (wem->enabled < NETDATA_THREAD_EBPF_STOPPING) ? NETDATA_CONTROLLER_END : 0);
3616
}
3617
ebpf_write_end_chart();
3618
}
3644
ebpf_write_end_chart();
3645
3646
ebpf_write_begin_chart(NETDATA_MONITORING_FAMILY, NETDATA_EBPF_LIFE_TIME, "");
3413
- for (i = 0; i < EBPF_MODULE_FUNCTION_IDX ; i++) {
3647
+ for (i = 0; i < EBPF_MODULE_FUNCTION_IDX; i++) {
3648
ebpf_module_t *wem = &ebpf_modules[i];
3649
// Threads like VFS is slow to load and this can create an invalid number, this is the motive
3650
// we are also testing wem->lifetime value.
3651
if (wem->functions.fnct_routine)
3652
continue;
3653
3420
- write_chart_dimension((char *)wem->info.thread_name,
3421
- (wem->lifetime && wem->enabled < NETDATA_THREAD_EBPF_STOPPING) ?
3422
- (long long) (wem->lifetime - wem->running_time):
3423
- 0) ;
3654
+ write_chart_dimension(
3655
+ (char *)wem->info.thread_name,
3656
+ (wem->lifetime && wem->enabled < NETDATA_THREAD_EBPF_STOPPING) ?
3657
+ (long long)(wem->lifetime - wem->running_time) :
3658
+ 0);
3659
}
3660
ebpf_write_end_chart();
3661
3679
3680
ebpf_send_global_hash_table_data();
3681
3447
- ebpf_send_hash_table_pid_data(NETDATA_EBPF_HASH_TABLES_INSERT_PID_ELEMENTS, NETDATA_EBPF_GLOBAL_TABLE_PID_TABLE_ADD);
3448
- ebpf_send_hash_table_pid_data(NETDATA_EBPF_HASH_TABLES_REMOVE_PID_ELEMENTS, NETDATA_EBPF_GLOBAL_TABLE_PID_TABLE_DEL);
3682
+ ebpf_send_hash_table_pid_data(
3683
+ NETDATA_EBPF_HASH_TABLES_INSERT_PID_ELEMENTS, NETDATA_EBPF_GLOBAL_TABLE_PID_TABLE_ADD);
3684
+ ebpf_send_hash_table_pid_data(
3685
+ NETDATA_EBPF_HASH_TABLES_REMOVE_PID_ELEMENTS, NETDATA_EBPF_GLOBAL_TABLE_PID_TABLE_DEL);
3686
3687
for (i = 0; i < EBPF_MODULE_FUNCTION_IDX; i++) {
3688
ebpf_module_t *wem = &ebpf_modules[i];
3694
ebpf_write_end_chart();
3695
3696
ebpf_write_begin_chart(NETDATA_MONITORING_FAMILY, (char *)wem->functions.fcnt_thread_lifetime_name, "");
3460
- write_chart_dimension((char *)wem->info.thread_name,
3461
- (wem->lifetime && wem->enabled < NETDATA_THREAD_EBPF_STOPPING) ?
3462
- (long long) (wem->lifetime - wem->running_time):
3463
- 0) ;
3697
+ write_chart_dimension(
3698
+ (char *)wem->info.thread_name,
3699
+ (wem->lifetime && wem->enabled < NETDATA_THREAD_EBPF_STOPPING) ?
3700
+ (long long)(wem->lifetime - wem->running_time) :
3701
+ 0);
3702
ebpf_write_end_chart();
3703
}
3704
}
3728
*/
3729
static void ebpf_create_pids_chart(int order, int update_every)
3730
{
3493
- ebpf_write_chart_cmd(NETDATA_MONITORING_FAMILY,
3494
- "monitoring_pid",
3495
- "",
3496
- "Total number of monitored PIDs",
3497
- "pids",
3498
- NETDATA_EBPF_FAMILY,
3499
- NETDATA_EBPF_CHART_TYPE_LINE,
3500
- "netdata.ebpf_pids",
3501
- order,
3502
- update_every,
3503
- "main");
3504
-
3505
- ebpf_write_global_dimension("user",
3506
- "user",
3507
- ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3508
-
3509
- ebpf_write_global_dimension("kernel",
3510
- "kernel",
3511
- ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3731
+ ebpf_write_chart_cmd(
3732
+ NETDATA_MONITORING_FAMILY,
3733
+ "monitoring_pid",
3734
+ "",
3735
+ "Total number of monitored PIDs",
3736
+ "pids",
3737
+ NETDATA_EBPF_FAMILY,
3738
+ NETDATA_EBPF_CHART_TYPE_LINE,
3739
+ "netdata.ebpf_pids",
3740
+ order,
3741
+ update_every,
3742
+ "main");
3743
+
3744
+ ebpf_write_global_dimension("user", "user", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3745
+
3746
+ ebpf_write_global_dimension("kernel", "kernel", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3747
}
3748
3749
/**
3758
* @param update_every time used to update charts
3759
* @param module a module to create a specific chart.
3760
*/
3526
-static void ebpf_create_thread_chart(char *name,
3527
- char *title,
3528
- char *units,
3529
- int order,
3530
- int update_every,
3531
- ebpf_module_t *module)
3761
+static void
3762
+ebpf_create_thread_chart(char *name, char *title, char *units, int order, int update_every, ebpf_module_t *module)
3763
{
3764
// common call for specific and all charts.
3534
- ebpf_write_chart_cmd(NETDATA_MONITORING_FAMILY,
3535
- name,
3536
- "",
3537
- title,
3538
- units,
3539
- NETDATA_EBPF_FAMILY,
3540
- NETDATA_EBPF_CHART_TYPE_LINE,
3541
- NULL,
3542
- order,
3543
- update_every,
3544
- "main");
3765
+ ebpf_write_chart_cmd(
3766
+ NETDATA_MONITORING_FAMILY,
3767
+ name,
3768
+ "",
3769
+ title,
3770
+ units,
3771
+ NETDATA_EBPF_FAMILY,
3772
+ NETDATA_EBPF_CHART_TYPE_LINE,
3773
+ NULL,
3774
+ order,
3775
+ update_every,
3776
+ "main");
3777
3778
if (module) {
3547
- ebpf_write_global_dimension((char *)module->info.thread_name,
3548
- (char *)module->info.thread_name,
3549
- ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3779
+ ebpf_write_global_dimension(
3780
+ (char *)module->info.thread_name,
3781
+ (char *)module->info.thread_name,
3782
+ ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3783
return;
3784
}
3785
3789
if (em->functions.fnct_routine)
3790
continue;
3791
3559
- ebpf_write_global_dimension((char *)em->info.thread_name,
3560
- (char *)em->info.thread_name,
3561
- ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3792
+ ebpf_write_global_dimension(
3793
+ (char *)em->info.thread_name, (char *)em->info.thread_name, ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3794
}
3563
- }
3795
+}
3796
3797
/**
3798
* Create chart for Load Thread
3803
*/
3804
static inline void ebpf_create_statistic_load_chart(int update_every)
3805
{
3574
- ebpf_write_chart_cmd(NETDATA_MONITORING_FAMILY,
3575
- NETDATA_EBPF_LOAD_METHOD,
3576
- "",
3577
- "Load info.",
3578
- "methods",
3579
- NETDATA_EBPF_FAMILY,
3580
- NETDATA_EBPF_CHART_TYPE_LINE,
3581
- NULL,
3582
- NETDATA_EBPF_ORDER_STAT_LOAD_METHOD,
3583
- update_every,
3584
- NETDATA_EBPF_MODULE_NAME_PROCESS);
3585
-
3586
- ebpf_write_global_dimension(load_event_stat[NETDATA_EBPF_LOAD_STAT_LEGACY],
3587
- load_event_stat[NETDATA_EBPF_LOAD_STAT_LEGACY],
3588
- ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3589
-
3590
- ebpf_write_global_dimension(load_event_stat[NETDATA_EBPF_LOAD_STAT_CORE],
3591
- load_event_stat[NETDATA_EBPF_LOAD_STAT_CORE],
3592
- ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3806
+ ebpf_write_chart_cmd(
3807
+ NETDATA_MONITORING_FAMILY,
3808
+ NETDATA_EBPF_LOAD_METHOD,
3809
+ "",
3810
+ "Load info.",
3811
+ "methods",
3812
+ NETDATA_EBPF_FAMILY,
3813
+ NETDATA_EBPF_CHART_TYPE_LINE,
3814
+ NULL,
3815
+ NETDATA_EBPF_ORDER_STAT_LOAD_METHOD,
3816
+ update_every,
3817
+ NETDATA_EBPF_MODULE_NAME_PROCESS);
3818
+
3819
+ ebpf_write_global_dimension(
3820
+ load_event_stat[NETDATA_EBPF_LOAD_STAT_LEGACY],
3821
+ load_event_stat[NETDATA_EBPF_LOAD_STAT_LEGACY],
3822
+ ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3823
+
3824
+ ebpf_write_global_dimension(
3825
+ load_event_stat[NETDATA_EBPF_LOAD_STAT_CORE],
3826
+ load_event_stat[NETDATA_EBPF_LOAD_STAT_CORE],
3827
+ ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3828
}
3829
3830
/**
3836
*/
3837
static inline void ebpf_create_statistic_kernel_memory(int update_every)
3838
{
3604
- ebpf_write_chart_cmd(NETDATA_MONITORING_FAMILY,
3605
- NETDATA_EBPF_KERNEL_MEMORY,
3606
- "",
3607
- "Memory allocated for hash tables.",
3608
- "bytes",
3609
- NETDATA_EBPF_FAMILY,
3610
- NETDATA_EBPF_CHART_TYPE_LINE,
3611
- NULL,
3612
- NETDATA_EBPF_ORDER_STAT_KERNEL_MEMORY,
3613
- update_every,
3614
- NETDATA_EBPF_MODULE_NAME_PROCESS);
3615
-
3616
- ebpf_write_global_dimension(memlock_stat,
3617
- memlock_stat,
3618
- ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3839
+ ebpf_write_chart_cmd(
3840
+ NETDATA_MONITORING_FAMILY,
3841
+ NETDATA_EBPF_KERNEL_MEMORY,
3842
+ "",
3843
+ "Memory allocated for hash tables.",
3844
+ "bytes",
3845
+ NETDATA_EBPF_FAMILY,
3846
+ NETDATA_EBPF_CHART_TYPE_LINE,
3847
+ NULL,
3848
+ NETDATA_EBPF_ORDER_STAT_KERNEL_MEMORY,
3849
+ update_every,
3850
+ NETDATA_EBPF_MODULE_NAME_PROCESS);
3851
+
3852
+ ebpf_write_global_dimension(memlock_stat, memlock_stat, ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3853
}
3854
3855
/**
3861
*/
3862
static inline void ebpf_create_statistic_hash_tables(int update_every)
3863
{
3630
- ebpf_write_chart_cmd(NETDATA_MONITORING_FAMILY,
3631
- NETDATA_EBPF_HASH_TABLES_LOADED,
3632
- "",
3633
- "Number of hash tables loaded.",
3634
- "hash tables",
3635
- NETDATA_EBPF_FAMILY,
3636
- NETDATA_EBPF_CHART_TYPE_LINE,
3637
- NULL,
3638
- NETDATA_EBPF_ORDER_STAT_HASH_TABLES,
3639
- update_every,
3640
- NETDATA_EBPF_MODULE_NAME_PROCESS);
3641
-
3642
- ebpf_write_global_dimension(hash_table_stat,
3643
- hash_table_stat,
3644
- ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3864
+ ebpf_write_chart_cmd(
3865
+ NETDATA_MONITORING_FAMILY,
3866
+ NETDATA_EBPF_HASH_TABLES_LOADED,
3867
+ "",
3868
+ "Number of hash tables loaded.",
3869
+ "hash tables",
3870
+ NETDATA_EBPF_FAMILY,
3871
+ NETDATA_EBPF_CHART_TYPE_LINE,
3872
+ NULL,
3873
+ NETDATA_EBPF_ORDER_STAT_HASH_TABLES,
3874
+ update_every,
3875
+ NETDATA_EBPF_MODULE_NAME_PROCESS);
3876
+
3877
+ ebpf_write_global_dimension(hash_table_stat, hash_table_stat, ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3878
}
3879
3880
/**
3886
*/
3887
static inline void ebpf_create_statistic_hash_per_core(int update_every)
3888
{
3656
- ebpf_write_chart_cmd(NETDATA_MONITORING_FAMILY,
3657
- NETDATA_EBPF_HASH_TABLES_PER_CORE,
3658
- "",
3659
- "How threads are loading hash/array tables.",
3660
- "threads",
3661
- NETDATA_EBPF_FAMILY,
3662
- NETDATA_EBPF_CHART_TYPE_LINE,
3663
- NULL,
3664
- NETDATA_EBPF_ORDER_STAT_HASH_CORE,
3665
- update_every,
3666
- NETDATA_EBPF_MODULE_NAME_PROCESS);
3667
-
3668
- ebpf_write_global_dimension(hash_table_core[NETDATA_EBPF_THREAD_PER_CORE],
3669
- hash_table_core[NETDATA_EBPF_THREAD_PER_CORE],
3670
- ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3671
-
3672
- ebpf_write_global_dimension(hash_table_core[NETDATA_EBPF_THREAD_UNIQUE],
3673
- hash_table_core[NETDATA_EBPF_THREAD_UNIQUE],
3674
- ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3889
+ ebpf_write_chart_cmd(
3890
+ NETDATA_MONITORING_FAMILY,
3891
+ NETDATA_EBPF_HASH_TABLES_PER_CORE,
3892
+ "",
3893
+ "How threads are loading hash/array tables.",
3894
+ "threads",
3895
+ NETDATA_EBPF_FAMILY,
3896
+ NETDATA_EBPF_CHART_TYPE_LINE,
3897
+ NULL,
3898
+ NETDATA_EBPF_ORDER_STAT_HASH_CORE,
3899
+ update_every,
3900
+ NETDATA_EBPF_MODULE_NAME_PROCESS);
3901
+
3902
+ ebpf_write_global_dimension(
3903
+ hash_table_core[NETDATA_EBPF_THREAD_PER_CORE],
3904
+ hash_table_core[NETDATA_EBPF_THREAD_PER_CORE],
3905
+ ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3906
+
3907
+ ebpf_write_global_dimension(
3908
+ hash_table_core[NETDATA_EBPF_THREAD_UNIQUE],
3909
+ hash_table_core[NETDATA_EBPF_THREAD_UNIQUE],
3910
+ ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3911
}
3912
3913
/**
3919
*/
3920
static void ebpf_create_statistic_hash_global_elements(int update_every)
3921
{
3686
- ebpf_write_chart_cmd(NETDATA_MONITORING_FAMILY,
3687
- NETDATA_EBPF_HASH_TABLES_GLOBAL_ELEMENTS,
3688
- "",
3689
- "Controllers inside global table",
3690
- "rows",
3691
- NETDATA_EBPF_FAMILY,
3692
- NETDATA_EBPF_CHART_TYPE_LINE,
3693
- NULL,
3694
- NETDATA_EBPF_ORDER_STAT_HASH_GLOBAL_TABLE_TOTAL,
3695
- update_every,
3696
- NETDATA_EBPF_MODULE_NAME_PROCESS);
3922
+ ebpf_write_chart_cmd(
3923
+ NETDATA_MONITORING_FAMILY,
3924
+ NETDATA_EBPF_HASH_TABLES_GLOBAL_ELEMENTS,
3925
+ "",
3926
+ "Controllers inside global table",
3927
+ "rows",
3928
+ NETDATA_EBPF_FAMILY,
3929
+ NETDATA_EBPF_CHART_TYPE_LINE,
3930
+ NULL,
3931
+ NETDATA_EBPF_ORDER_STAT_HASH_GLOBAL_TABLE_TOTAL,
3932
+ update_every,
3933
+ NETDATA_EBPF_MODULE_NAME_PROCESS);
3934
3935
int i;
3936
for (i = 0; i < EBPF_MODULE_FUNCTION_IDX; i++) {
3700
- ebpf_write_global_dimension((char *)ebpf_modules[i].info.thread_name,
3701
- (char *)ebpf_modules[i].info.thread_name,
3702
- ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3937
+ ebpf_write_global_dimension(
3938
+ (char *)ebpf_modules[i].info.thread_name,
3939
+ (char *)ebpf_modules[i].info.thread_name,
3940
+ ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
3941
}
3942
}
3943
3953
*/
3954
static void ebpf_create_statistic_hash_pid_table(int update_every, char *id, char *title, int order)
3955
{
3718
- ebpf_write_chart_cmd(NETDATA_MONITORING_FAMILY,
3719
- id,
3720
- "",
3721
- title,
3722
- "rows",
3723
- NETDATA_EBPF_FAMILY,
3724
- NETDATA_EBPF_CHART_TYPE_LINE,
3725
- NULL,
3726
- order,
3727
- update_every,
3728
- NETDATA_EBPF_MODULE_NAME_PROCESS);
3956
+ ebpf_write_chart_cmd(
3957
+ NETDATA_MONITORING_FAMILY,
3958
+ id,
3959
+ "",
3960
+ title,
3961
+ "rows",
3962
+ NETDATA_EBPF_FAMILY,
3963
+ NETDATA_EBPF_CHART_TYPE_LINE,
3964
+ NULL,
3965
+ order,
3966
+ update_every,
3967
+ NETDATA_EBPF_MODULE_NAME_PROCESS);
3968
3969
int i;
3970
for (i = 0; i < EBPF_MODULE_FUNCTION_IDX; i++) {
3971
ebpf_module_t *wem = &ebpf_modules[i];
3972
if (wem->functions.apps_routine)
3734
- ebpf_write_global_dimension((char *)wem->info.thread_name,
3735
- (char *)wem->info.thread_name,
3736
- ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX]);
3973
+ ebpf_write_global_dimension(
3974
+ (char *)wem->info.thread_name,
3975
+ (char *)wem->info.thread_name,
3976
+ ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX]);
3977
}
3978
}
3979
3996
3997
create_charts = 0;
3998
3759
- ebpf_create_thread_chart(NETDATA_EBPF_THREADS,
3760
- "Threads running.",
3761
- "boolean",
3762
- NETDATA_EBPF_ORDER_STAT_THREADS,
3763
- update_every,
3764
- NULL);
3999
+ ebpf_create_thread_chart(
4000
+ NETDATA_EBPF_THREADS, "Threads running.", "boolean", NETDATA_EBPF_ORDER_STAT_THREADS, update_every, NULL);
4001
4002
ebpf_create_pids_chart(NETDATA_EBPF_ORDER_PIDS, update_every);
4003
3768
- ebpf_create_thread_chart(NETDATA_EBPF_LIFE_TIME,
3769
- "Time remaining for thread.",
3770
- "seconds",
3771
- NETDATA_EBPF_ORDER_STAT_LIFE_TIME,
3772
- update_every,
3773
- NULL);
4004
+ ebpf_create_thread_chart(
4005
+ NETDATA_EBPF_LIFE_TIME,
4006
+ "Time remaining for thread.",
4007
+ "seconds",
4008
+ NETDATA_EBPF_ORDER_STAT_LIFE_TIME,
4009
+ update_every,
4010
+ NULL);
4011
3775
- int i,j;
4012
+ int i, j;
4013
char name[256];
4014
for (i = 0, j = NETDATA_EBPF_ORDER_FUNCTION_PER_THREAD; i < EBPF_MODULE_FUNCTION_IDX; i++) {
4015
ebpf_module_t *em = &ebpf_modules[i];
4019
em->functions.order_thread_chart = j;
4020
snprintfz(name, sizeof(name) - 1, "%s_%s", NETDATA_EBPF_THREADS, em->info.thread_name);
4021
em->functions.fcnt_thread_chart_name = strdupz(name);
3785
- ebpf_create_thread_chart(name,
3786
- "Threads running.",
3787
- "boolean",
3788
- j++,
3789
- update_every,
3790
- em);
4022
+ ebpf_create_thread_chart(name, "Threads running.", "boolean", j++, update_every, em);
4023
4024
em->functions.order_thread_lifetime = j;
4025
snprintfz(name, sizeof(name) - 1, "%s_%s", NETDATA_EBPF_LIFE_TIME, em->info.thread_name);
4026
em->functions.fcnt_thread_lifetime_name = strdupz(name);
3795
- ebpf_create_thread_chart(name,
3796
- "Time remaining for thread.",
3797
- "seconds",
3798
- j++,
3799
- update_every,
3800
- em);
4027
+ ebpf_create_thread_chart(name, "Time remaining for thread.", "seconds", j++, update_every, em);
4028
}
4029
4030
ebpf_create_statistic_load_chart(update_every);
4037
4038
ebpf_create_statistic_hash_global_elements(update_every);
4039
3813
- ebpf_create_statistic_hash_pid_table(update_every,
3814
- NETDATA_EBPF_HASH_TABLES_INSERT_PID_ELEMENTS,
3815
- "Elements inserted into PID table",
3816
- NETDATA_EBPF_ORDER_STAT_HASH_PID_TABLE_ADDED);
4040
+ ebpf_create_statistic_hash_pid_table(
4041
+ update_every,
4042
+ NETDATA_EBPF_HASH_TABLES_INSERT_PID_ELEMENTS,
4043
+ "Elements inserted into PID table",
4044
+ NETDATA_EBPF_ORDER_STAT_HASH_PID_TABLE_ADDED);
4045
3818
- ebpf_create_statistic_hash_pid_table(update_every,
3819
- NETDATA_EBPF_HASH_TABLES_REMOVE_PID_ELEMENTS,
3820
- "Elements removed from PID table",
3821
- NETDATA_EBPF_ORDER_STAT_HASH_PID_TABLE_REMOVED);
4046
+ ebpf_create_statistic_hash_pid_table(
4047
+ update_every,
4048
+ NETDATA_EBPF_HASH_TABLES_REMOVE_PID_ELEMENTS,
4049
+ "Elements removed from PID table",
4050
+ NETDATA_EBPF_ORDER_STAT_HASH_PID_TABLE_REMOVED);
4051
4052
fflush(stdout);
4053
}
4090
snprintfz(filename, FILENAME_MAX, "/proc/%d/status", pid);
4091
4092
procfile *ff = procfile_open(filename, " \t", PROCFILE_FLAG_DEFAULT);
3864
- if(unlikely(!ff)) {
4093
+ if (unlikely(!ff)) {
4094
netdata_log_error("Cannot open %s", filename);
4095
return name;
4096
}
4097
4098
ff = procfile_readall(ff);
3870
- if(unlikely(!ff))
4099
+ if (unlikely(!ff))
4100
return name;
4101
4102
unsigned long i, lines = procfile_lines(ff);
3874
- for(i = 0; i < lines ; i++) {
4103
+ for (i = 0; i < lines; i++) {
4104
char *cmp = procfile_lineword(ff, i, 0);
4105
if (!strcmp(cmp, "Name:")) {
4106
name = strdupz(procfile_lineword(ff, i, 1));
4134
length = 63;
4135
4136
buffer[length] = '\0';
3908
- old_pid = (pid_t) str2uint32_t(buffer, NULL);
4137
+ old_pid = (pid_t)str2uint32_t(buffer, NULL);
4138
}
4139
fclose(fp);
4140
4151
*/
4152
static void ebpf_kill_previous_process(char *filename, pid_t pid)
4153
{
3925
- pid_t old_pid = ebpf_read_previous_pid(filename);
4154
+ pid_t old_pid = ebpf_read_previous_pid(filename);
4155
if (!old_pid)
4156
return;
4157
4158
// Process is not running
3930
- char *prev_name = ebpf_get_process_name(old_pid);
4159
+ char *prev_name = ebpf_get_process_name(old_pid);
4160
if (!prev_name)
4161
return;
4162
3934
- char *current_name = ebpf_get_process_name(pid);
4163
+ char *current_name = ebpf_get_process_name(pid);
4164
4165
if (!strcmp(prev_name, current_name))
4166
kill(old_pid, SIGKILL);
4206
*
4207
* Set static routine before threads to be created.
4208
*/
3980
- static void ebpf_set_static_routine()
3981
- {
3982
- int i;
3983
- for (i = 0; ebpf_modules[i].info.thread_name; i++) {
3984
- ebpf_threads[i].start_routine = ebpf_modules[i].functions.start_routine;
3985
- }
3986
- }
4209
+static void ebpf_set_static_routine()
4210
+{
4211
+ int i;
4212
+ for (i = 0; ebpf_modules[i].info.thread_name; i++) {
4213
+ ebpf_threads[i].start_routine = ebpf_modules[i].functions.start_routine;
4214
+ }
4215
+}
4216
4217
/**
4218
* Entry point
4247
ebpf_start_pthread_variables();
4248
4249
netdata_configured_host_prefix = getenv("NETDATA_HOST_PREFIX");
4021
- if(verify_netdata_host_prefix(true) == -1)
4250
+ if (verify_netdata_host_prefix(true) == -1)
4251
ebpf_exit();
4252
4253
ebpf_allocate_common_vectors();
4270
4271
cgroup_integration_thread.start_routine = ebpf_cgroup_integration;
4272
4044
- cgroup_integration_thread.thread = nd_thread_create(
4045
- cgroup_integration_thread.name,
4046
- NETDATA_THREAD_OPTION_DEFAULT,
4047
- ebpf_cgroup_integration,
4048
- NULL);
4273
+ cgroup_integration_thread.thread =
4274
+ nd_thread_create(cgroup_integration_thread.name, NETDATA_THREAD_OPTION_DEFAULT, ebpf_cgroup_integration, NULL);
4275
4276
uint32_t i;
4277
for (i = 0; ebpf_threads[i].name != NULL; i++) {
4285
em->lifetime = EBPF_NON_FUNCTION_LIFE_TIME;
4286
4287
if (em->functions.apps_routine && (em->apps_charts || em->cgroup_charts)) {
4062
- collect_pids |= 1<<i;
4288
+ collect_pids |= 1 << i;
4289
}
4290
st->thread = nd_thread_create(st->name, NETDATA_THREAD_OPTION_JOINABLE, st->start_routine, em);
4291
} else {
4295
4296
heartbeat_t hb;
4297
heartbeat_init(&hb, USEC_PER_SEC);
4072
- int update_apps_every = (int) EBPF_CFG_UPDATE_APPS_EVERY_DEFAULT;
4298
+ int update_apps_every = (int)EBPF_CFG_UPDATE_APPS_EVERY_DEFAULT;
4299
int update_apps_list = update_apps_every - 1;
4300
int process_maps_per_core = ebpf_modules[EBPF_MODULE_PROCESS_IDX].maps_per_core;
4301
//Plugin will be killed when it receives a signal
4076
- for ( ; !ebpf_plugin_stop(); global_iterations_counter++) {
4302
+ for (; !ebpf_plugin_stop(); global_iterations_counter++) {
4303
(void)heartbeat_next(&hb);
4304
4305
if (global_iterations_counter % EBPF_DEFAULT_UPDATE_EVERY == 0) {
4317
if (collect_pids) {
4318
pthread_mutex_lock(&collect_data_mutex);
4319
ebpf_parse_proc_files();
4094
- if (collect_pids & (1<<EBPF_MODULE_PROCESS_IDX)) {
4320
+ if (collect_pids & (1 << EBPF_MODULE_PROCESS_IDX)) {
4321
collect_data_for_all_processes(process_pid_fd, process_maps_per_core);
4322
}
4323