Browse Source

Adds xfs filesystem monitoring to eBPF (#11238)

thiagoftsm 3 years ago
parent
commit
086b5b9090

+ 1 - 0
collectors/ebpf.plugin/README.md

@@ -325,6 +325,7 @@ filesystems are monitored.
 ```conf
 [filesystem]
     ext4dist = yes
+    xfsdist = yes
 ```
 
 ## Troubleshooting

+ 1 - 0
collectors/ebpf.plugin/ebpf.d/filesystem.conf

@@ -14,3 +14,4 @@
 # All filesystems are named as 'NAMEdist' where NAME is the filesystem name while 'dist' is a reference for distribution.
 [filesystem]
     ext4dist = yes
+    xfsdist = yes

+ 11 - 4
collectors/ebpf.plugin/ebpf_filesystem.c

@@ -16,6 +16,13 @@ ebpf_filesystem_partitions_t localfs[] =
       .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION,
       .enabled = CONFIG_BOOLEAN_YES,
       .addresses = {.function = NULL, .addr = 0}},
+     {.filesystem = "xfs",
+      .family = "XFS",
+      .objects = NULL,
+      .probe_links = NULL,
+      .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION,
+      .enabled = CONFIG_BOOLEAN_YES,
+      .addresses = {.function = NULL, .addr = 0}},
      {.filesystem = NULL,
       .family = NULL,
       .objects = NULL,
@@ -317,9 +324,6 @@ void ebpf_filesystem_cleanup_ebpf_data()
                 j++;
             }
             bpf_object__close(efp->objects);
-
-            ebpf_histogram_dimension_cleanup(dimensions, NETDATA_FILESYSTEM_MAX_BINS);
-            freez(filesystem_hash_values);
         }
     }
 }
@@ -347,6 +351,8 @@ static void ebpf_filesystem_cleanup(void *ptr)
     ebpf_cleanup_publish_syscall(filesystem_publish_aggregated);
 
     ebpf_filesystem_cleanup_ebpf_data();
+    ebpf_histogram_dimension_cleanup(dimensions, NETDATA_FILESYSTEM_MAX_BINS);
+    freez(filesystem_hash_values);
 }
 
 /*****************************************************************
@@ -507,9 +513,10 @@ static void write_histogram_chart(char *family, char *name, const netdata_idx_t
 static void ebpf_histogram_send_data()
 {
     uint32_t i;
+    uint32_t test = NETDATA_FILESYSTEM_FLAG_HAS_PARTITION | NETDATA_FILESYSTEM_REMOVE_CHARTS;
     for (i = 0; localfs[i].filesystem; i++) {
         ebpf_filesystem_partitions_t *efp = &localfs[i];
-        if (efp->flags & NETDATA_FILESYSTEM_FLAG_HAS_PARTITION) {
+        if ((efp->flags & test) == NETDATA_FILESYSTEM_FLAG_HAS_PARTITION) {
             write_histogram_chart(NETDATA_FILESYSTEM_FAMILY, efp->hread.name,
                                   efp->hread.histogram, NETDATA_FILESYSTEM_MAX_BINS);
 

+ 3 - 3
packaging/ebpf.checksums

@@ -1,3 +1,3 @@
-30f6be9ac8d62d1fe1e39e8af9a9298ecc72194605be2748be513467ee057cd1  netdata-kernel-collector-glibc-v0.6.9.tar.xz
-c856c7d48a7bb07f9ab3ea2a4bff06742049f106de8b950ce45019d970393fa1  netdata-kernel-collector-musl-v0.6.9.tar.xz
-4aeb5fcf0dde077691a6377bf824cc830d18dd8efbc06842ad47721c380cc211  netdata-kernel-collector-static-v0.6.9.tar.xz
+eb017acc8d05047190c385412b2e17b63d7ea07d7521ac043d32d14802a9c185  netdata-kernel-collector-glibc-v0.7.0.1.tar.xz
+72bbcb55342a162ab3eab27034e52820dd2a4e5d77dd8b1317f6a6b26904ecb8  netdata-kernel-collector-musl-v0.7.0.1.tar.xz
+d70fc36d09b0e49f4db1c8e328a4b516f21f353eb3bfdd190beae5e403f81aa2  netdata-kernel-collector-static-v0.7.0.1.tar.xz

+ 1 - 1
packaging/ebpf.version

@@ -1 +1 @@
-v0.6.9
+v0.7.0.1

+ 16 - 0
web/gui/dashboard_info.js

@@ -3476,6 +3476,22 @@ netdataDashboard.context = {
         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.'
     },
 
+    'filesystem.xfs_read_latency': {
+        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.'
+    },
+
+    'filesystem.xfs_write_latency': {
+        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.'
+    },
+
+    'filesystem.xfs_open_latency': {
+        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.'
+    },
+
+    'filesystem.xfs_sync_latency': {
+        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.'
+    },
+
     // ------------------------------------------------------------------------
     // eBPF