@cryptotaxi247 / netdata-1 / commits / 086b5b909

Adds xfs filesystem monitoring to eBPF (#11238)

thiagoftsm committed Jun 14, 2021 at 11:44 UTC 086b5b9090f46bff80534119c793f0cd2d423834
6 files changed +33 -8
collectors/ebpf.plugin/README.md
+1
@@ -325,6 +325,7 @@ filesystems are monitored.
325 ```conf
326 [filesystem]
327 ext4dist = yes
328 + xfsdist = yes
329 ```
330
331 ## Troubleshooting
collectors/ebpf.plugin/ebpf.d/filesystem.conf
+1
@@ -14,3 +14,4 @@
14 # All filesystems are named as 'NAMEdist' where NAME is the filesystem name while 'dist' is a reference for distribution.
15 [filesystem]
16 ext4dist = yes
17 + xfsdist = yes
collectors/ebpf.plugin/ebpf_filesystem.c
+11 -4
@@ -16,6 +16,13 @@ ebpf_filesystem_partitions_t localfs[] =
16 .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION,
17 .enabled = CONFIG_BOOLEAN_YES,
18 .addresses = {.function = NULL, .addr = 0}},
19 + {.filesystem = "xfs",
20 + .family = "XFS",
21 + .objects = NULL,
22 + .probe_links = NULL,
23 + .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION,
24 + .enabled = CONFIG_BOOLEAN_YES,
25 + .addresses = {.function = NULL, .addr = 0}},
26 {.filesystem = NULL,
27 .family = NULL,
28 .objects = NULL,
@@ -317,9 +324,6 @@ void ebpf_filesystem_cleanup_ebpf_data()
324 j++;
325 }
326 bpf_object__close(efp->objects);
320 -
321 - ebpf_histogram_dimension_cleanup(dimensions, NETDATA_FILESYSTEM_MAX_BINS);
322 - freez(filesystem_hash_values);
327 }
328 }
329 }
@@ -347,6 +351,8 @@ static void ebpf_filesystem_cleanup(void *ptr)
351 ebpf_cleanup_publish_syscall(filesystem_publish_aggregated);
352
353 ebpf_filesystem_cleanup_ebpf_data();
354 + ebpf_histogram_dimension_cleanup(dimensions, NETDATA_FILESYSTEM_MAX_BINS);
355 + freez(filesystem_hash_values);
356 }
357
358 /*****************************************************************
@@ -507,9 +513,10 @@ static void write_histogram_chart(char *family, char *name, const netdata_idx_t
513 static void ebpf_histogram_send_data()
514 {
515 uint32_t i;
516 + uint32_t test = NETDATA_FILESYSTEM_FLAG_HAS_PARTITION | NETDATA_FILESYSTEM_REMOVE_CHARTS;
517 for (i = 0; localfs[i].filesystem; i++) {
518 ebpf_filesystem_partitions_t *efp = &localfs[i];
512 - if (efp->flags & NETDATA_FILESYSTEM_FLAG_HAS_PARTITION) {
519 + if ((efp->flags & test) == NETDATA_FILESYSTEM_FLAG_HAS_PARTITION) {
520 write_histogram_chart(NETDATA_FILESYSTEM_FAMILY, efp->hread.name,
521 efp->hread.histogram, NETDATA_FILESYSTEM_MAX_BINS);
522
packaging/ebpf.checksums
+3 -3
@@ -1,3 +1,3 @@
1 -30f6be9ac8d62d1fe1e39e8af9a9298ecc72194605be2748be513467ee057cd1 netdata-kernel-collector-glibc-v0.6.9.tar.xz
2 -c856c7d48a7bb07f9ab3ea2a4bff06742049f106de8b950ce45019d970393fa1 netdata-kernel-collector-musl-v0.6.9.tar.xz
3 -4aeb5fcf0dde077691a6377bf824cc830d18dd8efbc06842ad47721c380cc211 netdata-kernel-collector-static-v0.6.9.tar.xz
1 +eb017acc8d05047190c385412b2e17b63d7ea07d7521ac043d32d14802a9c185 netdata-kernel-collector-glibc-v0.7.0.1.tar.xz
2 +72bbcb55342a162ab3eab27034e52820dd2a4e5d77dd8b1317f6a6b26904ecb8 netdata-kernel-collector-musl-v0.7.0.1.tar.xz
3 +d70fc36d09b0e49f4db1c8e328a4b516f21f353eb3bfdd190beae5e403f81aa2 netdata-kernel-collector-static-v0.7.0.1.tar.xz
packaging/ebpf.version
+1 -1
@@ -1 +1 @@
1 -v0.6.9
1 +v0.7.0.1
web/gui/dashboard_info.js
+16
@@ -3476,6 +3476,22 @@ netdataDashboard.context = {
3476 info: 'Latency is the time it takes for an event to be completed. Netdata is attaching a kprobe for when the function <code>ext4_sync_file</code> is called and another for when it finishes the execution. We calculate the difference between the calling and return times, we get the logarithmic for the final result and we sum one value to the respective bin. Based on the eBPF <a href="http://www.brendangregg.com/blog/2016-10-06/linux-bcc-ext4dist-ext4slower.html" target="_blank">ext4dist</a> from BCC tools.'
3477 },
3478
3479 + 'filesystem.xfs_read_latency': {
3480 + info: 'Latency is the time it takes for an event to be completed. Netdata is attaching a kprobe for when the function <code>xfs_file_read_iter</code> is called and another for when it finishes the execution. We calculate the difference between the calling and return times, we get the logarithmic for the final result and we sum one value to the respective bin. Based on the eBPF <a href="https://github.com/iovisor/bcc/blob/master/tools/xfsdist_example.txt" target="_blank">xfsdist</a> from BCC tools.'
3481 + },
3482 +
3483 + 'filesystem.xfs_write_latency': {
3484 + info: 'Latency is the time it takes for an event to be completed. Netdata is attaching a kprobe for when the function <code>xfs_file_write_iter</code> is called and another for when it finishes the execution. We calculate the difference between the calling and return times, we get the logarithmic for the final result and we sum one value to the respective bin. Based on the eBPF <a href="https://github.com/iovisor/bcc/blob/master/tools/xfsdist_example.txt" target="_blank">xfsdist</a> from BCC tools.'
3485 + },
3486 +
3487 + 'filesystem.xfs_open_latency': {
3488 + info: 'Latency is the time it takes for an event to be completed. Netdata is attaching a kprobe for when the function <code>xfs_file_open</code> is called and another for when it finishes the execution. We calculate the difference between the calling and return times, we get the logarithmic for the final result and we sum one value to the respective bin. Based on the eBPF <a href="https://github.com/iovisor/bcc/blob/master/tools/xfsdist_example.txt" target="_blank">xfsdist</a> from BCC tools.'
3489 + },
3490 +
3491 + 'filesystem.xfs_sync_latency': {
3492 + info: 'Latency is the time it takes for an event to be completed. Netdata is attaching a kprobe for when the function <code>xfs_file_sync</code> is called and another for when it finishes the execution. We calculate the difference between the calling and return times, we get the logarithmic for the final result and we sum one value to the respective bin. Based on the eBPF <a href="https://github.com/iovisor/bcc/blob/master/tools/xfsdist_example.txt" target="_blank">xfsdist</a> from BCC tools.'
3493 + },
3494 +
3495 // ------------------------------------------------------------------------
3496 // eBPF
3497