@cryptotaxi247 / netdata-1 / commits / 75d4b66b6

eBPF keep values from `ebpf.d.conf` (#11253)

thiagoftsm committed Jun 16, 2021 at 12:37 UTC 75d4b66b6d69d3b0b36d15bbacd3d48efbb1bf60
7 files changed +39 -38
collectors/ebpf.plugin/ebpf.c
+13 -18
@@ -76,47 +76,47 @@ pthread_cond_t collect_data_cond_var;
76
77 ebpf_module_t ebpf_modules[] = {
78 { .thread_name = "process", .config_name = "process", .enabled = 0, .start_routine = ebpf_process_thread,
79 - .update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY,
79 + .update_time = 1, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY,
80 .optional = 0, .apps_routine = ebpf_process_create_apps_charts, .maps = NULL,
81 .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &process_config,
82 .config_file = NETDATA_PROCESS_CONFIG_FILE},
83 { .thread_name = "socket", .config_name = "socket", .enabled = 0, .start_routine = ebpf_socket_thread,
84 - .update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY,
84 + .update_time = 1, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY,
85 .optional = 0, .apps_routine = ebpf_socket_create_apps_charts, .maps = NULL,
86 .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &socket_config,
87 .config_file = NETDATA_NETWORK_CONFIG_FILE},
88 { .thread_name = "cachestat", .config_name = "cachestat", .enabled = 0, .start_routine = ebpf_cachestat_thread,
89 - .update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY,
89 + .update_time = 1, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY,
90 .optional = 0, .apps_routine = ebpf_cachestat_create_apps_charts, .maps = NULL,
91 .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &cachestat_config,
92 .config_file = NETDATA_CACHESTAT_CONFIG_FILE},
93 { .thread_name = "sync", .config_name = "sync", .enabled = 0, .start_routine = ebpf_sync_thread,
94 - .update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY,
94 + .update_time = 1, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY,
95 .optional = 0, .apps_routine = NULL, .maps = NULL,
96 .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &sync_config,
97 .config_file = NETDATA_SYNC_CONFIG_FILE},
98 { .thread_name = "dc", .config_name = "dc", .enabled = 0, .start_routine = ebpf_dcstat_thread,
99 - .update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY,
99 + .update_time = 1, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY,
100 .optional = 0, .apps_routine = ebpf_dcstat_create_apps_charts, .maps = NULL,
101 .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &dcstat_config,
102 .config_file = NETDATA_DIRECTORY_DCSTAT_CONFIG_FILE},
103 { .thread_name = "swap", .config_name = "swap", .enabled = 0, .start_routine = ebpf_swap_thread,
104 - .update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY,
104 + .update_time = 1, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY,
105 .optional = 0, .apps_routine = ebpf_swap_create_apps_charts, .maps = NULL,
106 .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &swap_config,
107 .config_file = NETDATA_DIRECTORY_SWAP_CONFIG_FILE},
108 { .thread_name = "vfs", .config_name = "swap", .enabled = 0, .start_routine = ebpf_vfs_thread,
109 - .update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY,
109 + .update_time = 1, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY,
110 .optional = 0, .apps_routine = ebpf_vfs_create_apps_charts, .maps = NULL,
111 .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &vfs_config,
112 .config_file = NETDATA_DIRECTORY_VFS_CONFIG_FILE },
113 { .thread_name = "filesystem", .config_name = "filesystem", .enabled = 0, .start_routine = ebpf_filesystem_thread,
114 - .update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY,
114 + .update_time = 1, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY,
115 .optional = 0, .apps_routine = NULL, .maps = NULL,
116 .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &fs_config,
117 .config_file = NETDATA_SYNC_CONFIG_FILE},
118 { .thread_name = NULL, .enabled = 0, .start_routine = NULL, .update_time = 1,
119 - .global_charts = 0, .apps_charts = 1, .mode = MODE_ENTRY,
119 + .global_charts = 0, .apps_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY,
120 .optional = 0, .apps_routine = NULL, .maps = NULL, .pid_map_size = 0, .names = NULL,
121 .cfg = NULL, .config_name = NULL},
122 };
@@ -1220,20 +1220,15 @@ static void parse_args(int argc, char **argv)
1220 #endif
1221 }
1222
1223 - if (disable_apps)
1224 - return;
1225 -
1223 // Load apps_groups.conf
1224 if (ebpf_read_apps_groups_conf(
1225 &apps_groups_default_target, &apps_groups_root_target, ebpf_user_config_dir, "groups")) {
1229 - info(
1230 - "Cannot read process groups configuration file '%s/apps_groups.conf'. Will try '%s/apps_groups.conf'",
1231 - ebpf_user_config_dir, ebpf_stock_config_dir);
1226 + info("Cannot read process groups configuration file '%s/apps_groups.conf'. Will try '%s/apps_groups.conf'",
1227 + ebpf_user_config_dir, ebpf_stock_config_dir);
1228 if (ebpf_read_apps_groups_conf(
1229 &apps_groups_default_target, &apps_groups_root_target, ebpf_stock_config_dir, "groups")) {
1234 - error(
1235 - "Cannot read process groups '%s/apps_groups.conf'. There are no internal defaults. Failing.",
1236 - ebpf_stock_config_dir);
1230 + error("Cannot read process groups '%s/apps_groups.conf'. There are no internal defaults. Failing.",
1231 + ebpf_stock_config_dir);
1232 thread_finished++;
1233 ebpf_exit(1);
1234 }
collectors/ebpf.plugin/ebpf.d/cachestat.conf
+5 -4
@@ -8,9 +8,10 @@
8 # 'no'.
9 #
10 # The `pid table size` defines the maximum number of PIDs stored inside the application hash table.
11 -#
11 +#
12 +# Uncomment lines to define specific options for thread.
13 [global]
13 - ebpf load mode = entry
14 - apps = yes
14 +# ebpf load mode = entry
15 +# apps = yes
16 update every = 2
16 - pid table size = 32768
17 +# pid table size = 32768
collectors/ebpf.plugin/ebpf.d/dcstat.conf
+4 -2
@@ -7,7 +7,9 @@
7 # If you want to disable the integration with `apps.plugin` along with the above charts, change the setting `apps` to
8 # 'no'.
9 #
10 +# Uncomment lines to define specific options for thread.
11 [global]
11 - ebpf load mode = entry
12 - apps = yes
12 +# ebpf load mode = entry
13 +# apps = yes
14 update every = 2
15 +# pid table size = 32768
collectors/ebpf.plugin/ebpf.d/process.conf
+5 -4
@@ -8,9 +8,10 @@
8 # 'no'.
9 #
10 # The `pid table size` defines the maximum number of PIDs stored inside the hash table.
11 -#
11 +#
12 +# Uncomment lines to define specific options for thread.
13 [global]
13 - ebpf load mode = entry
14 - apps = yes
14 +# ebpf load mode = entry
15 +# apps = yes
16 update every = 1
16 - pid table size = 32768
17 +# pid table size = 32768
collectors/ebpf.plugin/ebpf.d/swap.conf
+4 -4
@@ -7,9 +7,9 @@
7 # If you want to disable the integration with `apps.plugin` along with the above charts, change the setting `apps` to
8 # 'no'.
9 #
10 -#
10 +# Uncomment lines to define specific options for thread.
11 [global]
12 - ebpf load mode = entry
13 - apps = yes
12 +# ebpf load mode = entry
13 +# apps = yes
14 update every = 2
15 - pid table size = 32768
15 +# pid table size = 32768
collectors/ebpf.plugin/ebpf.d/vfs.conf
+5 -4
@@ -6,9 +6,10 @@
6 # The eBPF collector also creates charts for each running application through an integration with the `apps plugin`.
7 # If you want to disable the integration with `apps.plugin` along with the above charts, change the setting `apps` to
8 # 'no'.
9 -#
9 +#
10 +# Uncomment lines to define specific options for thread.
11 [global]
11 - ebpf load mode = entry
12 - apps = yes
12 +# ebpf load mode = entry
13 +# apps = yes
14 update every = 1
14 - pid table size = 32768
15 +# pid table size = 32768
libnetdata/ebpf/ebpf.c
+3 -2
@@ -488,10 +488,11 @@ void ebpf_update_module_using_config(ebpf_module_t *modules)
488 char *mode = appconfig_get(modules->cfg, EBPF_GLOBAL_SECTION, EBPF_CFG_LOAD_MODE, EBPF_CFG_LOAD_MODE_DEFAULT);
489 modules->mode = ebpf_select_mode(mode);
490
491 - modules->update_time = (int)appconfig_get_number(modules->cfg, EBPF_GLOBAL_SECTION, EBPF_CFG_UPDATE_EVERY, 1);
491 + modules->update_time = (int)appconfig_get_number(modules->cfg, EBPF_GLOBAL_SECTION,
492 + EBPF_CFG_UPDATE_EVERY, modules->update_time);
493
494 modules->apps_charts = appconfig_get_boolean(modules->cfg, EBPF_GLOBAL_SECTION, EBPF_CFG_APPLICATION,
494 - CONFIG_BOOLEAN_YES);
495 + modules->apps_charts);
496
497 modules->pid_map_size = (uint32_t)appconfig_get_number(modules->cfg, EBPF_GLOBAL_SECTION, EBPF_CFG_PID_SIZE,
498 modules->pid_map_size);