diff options
Diffstat (limited to 'collectors/ebpf.plugin/ebpf.c')
-rw-r--r-- | collectors/ebpf.plugin/ebpf.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/collectors/ebpf.plugin/ebpf.c b/collectors/ebpf.plugin/ebpf.c index d419861904..9807cda2a2 100644 --- a/collectors/ebpf.plugin/ebpf.c +++ b/collectors/ebpf.plugin/ebpf.c @@ -115,6 +115,11 @@ ebpf_module_t ebpf_modules[] = { .optional = 0, .apps_routine = NULL, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &fs_config, .config_file = NETDATA_SYNC_CONFIG_FILE}, + { .thread_name = "disk", .config_name = "disk", .enabled = 0, .start_routine = ebpf_disk_thread, + .update_time = 1, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, + .optional = 0, .apps_routine = NULL, .maps = NULL, + .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &disk_config, + .config_file = NETDATA_SYNC_CONFIG_FILE}, { .thread_name = NULL, .enabled = 0, .start_routine = NULL, .update_time = 1, .global_charts = 0, .apps_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = NULL, .maps = NULL, .pid_map_size = 0, .names = NULL, @@ -509,6 +514,31 @@ void ebpf_create_charts_on_apps(char *id, char *title, char *units, char *family } } +/** + * Call the necessary functions to create a name. + * + * @param family family name + * @param name chart name + * @param hist0 histogram values + * @param dimensions dimension values. + * @param end number of bins that will be sent to Netdata. + * + * @return It returns a variable tha maps the charts that did not have zero values. + */ +void write_histogram_chart(char *family, char *name, const netdata_idx_t *hist, char **dimensions, uint32_t end) +{ + write_begin_chart(family, name); + + uint32_t i; + for (i = 0; i < end; i++) { + write_chart_dimension(dimensions[i], (long long) hist[i]); + } + + write_end_chart(); + + fflush(stdout); +} + /***************************************************************** * * FUNCTIONS TO DEFINE OPTIONS @@ -658,6 +688,8 @@ void ebpf_print_help() "\n" " --dcstat or -d Enable charts related to directory cache.\n" "\n" + " --disk or -k Enable charts related to disk monitoring.\n" + "\n" " --filesystem or -i Enable chart related to filesystem run time.\n" "\n" " --net or -n Enable network viewer charts.\n" @@ -982,6 +1014,13 @@ static void read_collector_values(int *disable_apps) started++; } + enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "disk", + CONFIG_BOOLEAN_NO); + if (enabled) { + ebpf_enable_chart(EBPF_MODULE_DISK_IDX, *disable_apps); + started++; + } + if (!started){ ebpf_enable_all_charts(*disable_apps); // Read network viewer section @@ -1066,6 +1105,7 @@ static void parse_args(int argc, char **argv) {"all", no_argument, 0, 'a' }, {"cachestat", no_argument, 0, 'c' }, {"dcstat", no_argument, 0, 'd' }, + {"disk", no_argument, 0, 'k' }, {"filesystem", no_argument, 0, 'i' }, {"net", no_argument, 0, 'n' }, {"process", no_argument, 0, 'p' }, @@ -1142,6 +1182,14 @@ static void parse_args(int argc, char **argv) #endif break; } + case 'k': { + enabled = 1; + ebpf_enable_chart(EBPF_MODULE_DISK_IDX, disable_apps); +#ifdef NETDATA_INTERNAL_CHECKS + info("EBPF enabling \"disk\" chart, because it was started with the option \"--disk\" or \"-k\"."); +#endif + break; + } case 'n': { enabled = 1; ebpf_enable_chart(EBPF_MODULE_SOCKET_IDX, disable_apps); @@ -1464,6 +1512,8 @@ int main(int argc, char **argv) NULL, NULL, ebpf_modules[EBPF_MODULE_VFS_IDX].start_routine}, {"EBPF FILESYSTEM" , NULL, NULL, 1, NULL, NULL, ebpf_modules[EBPF_MODULE_FILESYSTEM_IDX].start_routine}, + {"EBPF DISK" , NULL, NULL, 1, + NULL, NULL, ebpf_modules[EBPF_MODULE_DISK_IDX].start_routine}, {NULL , NULL, NULL, 0, NULL, NULL, NULL} }; |