diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2021-07-08 17:50:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 17:50:29 +0000 |
commit | ea9721f83c8ecd7d501efa505a95a5cb6557ec33 (patch) | |
tree | c2ac3416cc79413e79d2bcf7b39b45452a9ea3ac /collectors | |
parent | 3aa7be1f7859d715171bc81401c73abfe61a6fdf (diff) |
eBPF NFS monitoring (#11313)
Add new filesystem monitoring.
Diffstat (limited to 'collectors')
-rw-r--r-- | collectors/ebpf.plugin/README.md | 3 | ||||
-rw-r--r-- | collectors/ebpf.plugin/ebpf.d/filesystem.conf | 1 | ||||
-rw-r--r-- | collectors/ebpf.plugin/ebpf_filesystem.c | 46 | ||||
-rw-r--r-- | collectors/ebpf.plugin/ebpf_filesystem.h | 6 |
4 files changed, 36 insertions, 20 deletions
diff --git a/collectors/ebpf.plugin/README.md b/collectors/ebpf.plugin/README.md index 3ab1a8ea17..1c8037476d 100644 --- a/collectors/ebpf.plugin/README.md +++ b/collectors/ebpf.plugin/README.md @@ -327,9 +327,12 @@ filesystems are monitored. ```conf [filesystem] ext4dist = yes + nfsdist = yes xfsdist = yes ``` +The ebpf program `nfsdist` monitors only `nfs` mount points. + ## Troubleshooting If the eBPF collector does not work, you can troubleshoot it by running the `ebpf.plugin` command and investigating its diff --git a/collectors/ebpf.plugin/ebpf.d/filesystem.conf b/collectors/ebpf.plugin/ebpf.d/filesystem.conf index 38b6de30d4..b6038e0d55 100644 --- a/collectors/ebpf.plugin/ebpf.d/filesystem.conf +++ b/collectors/ebpf.plugin/ebpf.d/filesystem.conf @@ -14,4 +14,5 @@ # All filesystems are named as 'NAMEdist' where NAME is the filesystem name while 'dist' is a reference for distribution. [filesystem] ext4dist = yes + nfsdist = yes xfsdist = yes diff --git a/collectors/ebpf.plugin/ebpf_filesystem.c b/collectors/ebpf.plugin/ebpf_filesystem.c index 7d28c96a72..7d81a6ec91 100644 --- a/collectors/ebpf.plugin/ebpf_filesystem.c +++ b/collectors/ebpf.plugin/ebpf_filesystem.c @@ -10,6 +10,7 @@ struct config fs_config = { .first_section = NULL, ebpf_filesystem_partitions_t localfs[] = {{.filesystem = "ext4", + .optional_filesystem = NULL, .family = "EXT4", .objects = NULL, .probe_links = NULL, @@ -17,13 +18,23 @@ ebpf_filesystem_partitions_t localfs[] = .enabled = CONFIG_BOOLEAN_YES, .addresses = {.function = NULL, .addr = 0}}, {.filesystem = "xfs", + .optional_filesystem = NULL, .family = "XFS", .objects = NULL, .probe_links = NULL, .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION, .enabled = CONFIG_BOOLEAN_YES, .addresses = {.function = NULL, .addr = 0}}, + {.filesystem = "nfs", + .optional_filesystem = "nfs4", + .family = "NFS", + .objects = NULL, + .probe_links = NULL, + .flags = NETDATA_FILESYSTEM_ATTR_CHARTS, + .enabled = CONFIG_BOOLEAN_YES, + .addresses = {.function = NULL, .addr = 0}}, {.filesystem = NULL, + .optional_filesystem = NULL, .family = NULL, .objects = NULL, .probe_links = NULL, @@ -73,15 +84,13 @@ static void ebpf_obsolete_fs_charts() EBPF_COMMON_DIMENSION_CALL, efp->family_name, NULL, NETDATA_EBPF_CHART_TYPE_STACKED, efp->hwrite.order); - ebpf_write_chart_obsolete(NETDATA_FILESYSTEM_FAMILY, efp->hopen.name, - efp->hopen.title, + ebpf_write_chart_obsolete(NETDATA_FILESYSTEM_FAMILY, efp->hopen.name, efp->hopen.title, EBPF_COMMON_DIMENSION_CALL, efp->family_name, NULL, NETDATA_EBPF_CHART_TYPE_STACKED, efp->hopen.order); - ebpf_write_chart_obsolete(NETDATA_FILESYSTEM_FAMILY, efp->hsync.name, - efp->hsync.title, + ebpf_write_chart_obsolete(NETDATA_FILESYSTEM_FAMILY, efp->hadditional.name, efp->hadditional.title, EBPF_COMMON_DIMENSION_CALL, efp->family_name, - NULL, NETDATA_EBPF_CHART_TYPE_STACKED, efp->hsync.order); + NULL, NETDATA_EBPF_CHART_TYPE_STACKED, efp->hadditional.order); } efp->flags = flags; } @@ -141,13 +150,13 @@ static void ebpf_create_fs_charts() filesystem_publish_aggregated, NETDATA_EBPF_HIST_MAX_BINS); order++; - snprintfz(title, 255, "%s latency for each sync request.", efp->filesystem); - snprintfz(chart_name, 63, "%s_sync_latency", efp->filesystem); - efp->hsync.name = strdupz(chart_name); - efp->hsync.title = strdupz(title); - efp->hsync.order = order; - ebpf_create_chart(NETDATA_FILESYSTEM_FAMILY, efp->hsync.name, - title, + char *type = (efp->flags & NETDATA_FILESYSTEM_ATTR_CHARTS) ? "attribute" : "sync"; + snprintfz(title, 255, "%s latency for each %s request.", efp->filesystem, type); + snprintfz(chart_name, 63, "%s_%s_latency", efp->filesystem, type); + efp->hadditional.name = strdupz(chart_name); + efp->hadditional.title = strdupz(title); + efp->hadditional.order = order; + ebpf_create_chart(NETDATA_FILESYSTEM_FAMILY, efp->hadditional.name, title, EBPF_COMMON_DIMENSION_CALL, family, NULL, NETDATA_EBPF_CHART_TYPE_STACKED, order, ebpf_create_global_dimension, filesystem_publish_aggregated, NETDATA_EBPF_HIST_MAX_BINS); @@ -244,7 +253,8 @@ static int ebpf_read_local_partitions() for (i = 0; localfs[i].filesystem; i++) { ebpf_filesystem_partitions_t *w = &localfs[i]; - if (w->enabled && !strcmp(fs, w->filesystem)) { + if (w->enabled && (!strcmp(fs, w->filesystem) || + (w->optional_filesystem && !strcmp(fs, w->optional_filesystem)))) { localfs[i].flags |= NETDATA_FILESYSTEM_LOAD_EBPF_PROGRAM; localfs[i].flags &= ~NETDATA_FILESYSTEM_REMOVE_CHARTS; count++; @@ -313,8 +323,8 @@ void ebpf_filesystem_cleanup_ebpf_data() freez(efp->hopen.name); freez(efp->hopen.title); - freez(efp->hsync.name); - freez(efp->hsync.title); + freez(efp->hadditional.name); + freez(efp->hadditional.title); struct bpf_link **probe_links = efp->probe_links; size_t j = 0 ; @@ -385,7 +395,7 @@ static inline netdata_ebpf_histogram_t *select_hist(ebpf_filesystem_partitions_t return &efp->hopen; } else if (id < NETDATA_KEY_CALLS_SYNC ){ *idx = id - NETDATA_KEY_CALLS_OPEN; - return &efp->hsync; + return &efp->hadditional; } return NULL; @@ -503,8 +513,8 @@ static void ebpf_histogram_send_data() write_histogram_chart(NETDATA_FILESYSTEM_FAMILY, efp->hopen.name, efp->hopen.histogram, dimensions, NETDATA_EBPF_HIST_MAX_BINS); - write_histogram_chart(NETDATA_FILESYSTEM_FAMILY, efp->hsync.name, - efp->hsync.histogram, dimensions, NETDATA_EBPF_HIST_MAX_BINS); + write_histogram_chart(NETDATA_FILESYSTEM_FAMILY, efp->hadditional.name, + efp->hadditional.histogram, dimensions, NETDATA_EBPF_HIST_MAX_BINS); } } } diff --git a/collectors/ebpf.plugin/ebpf_filesystem.h b/collectors/ebpf.plugin/ebpf_filesystem.h index c7f621fd07..57ae45d035 100644 --- a/collectors/ebpf.plugin/ebpf_filesystem.h +++ b/collectors/ebpf.plugin/ebpf_filesystem.h @@ -28,7 +28,8 @@ enum netdata_filesystem_flags { NETDATA_FILESYSTEM_FLAG_HAS_PARTITION = 2, NETDATA_FILESYSTEM_FLAG_CHART_CREATED = 4, NETDATA_FILESYSTEM_FILL_ADDRESS_TABLE = 8, - NETDATA_FILESYSTEM_REMOVE_CHARTS = 16 + NETDATA_FILESYSTEM_REMOVE_CHARTS = 16, + NETDATA_FILESYSTEM_ATTR_CHARTS = 32 }; enum netdata_filesystem_table { @@ -38,6 +39,7 @@ enum netdata_filesystem_table { typedef struct ebpf_filesystem_partitions { char *filesystem; + char *optional_filesystem; char *family; char *family_name; struct bpf_object *objects; @@ -46,7 +48,7 @@ typedef struct ebpf_filesystem_partitions { netdata_ebpf_histogram_t hread; netdata_ebpf_histogram_t hwrite; netdata_ebpf_histogram_t hopen; - netdata_ebpf_histogram_t hsync; + netdata_ebpf_histogram_t hadditional; uint32_t flags; uint32_t enabled; |