about summary refs log tree commit diff
path: root/filesystem.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2024-06-10 19:47:11 +0200
committerLeah Neukirchen <leah@vuxu.org>2024-06-10 19:47:11 +0200
commit5d807dc6d07dc3f0ee2a8415c1d3032ef97c6742 (patch)
tree90699d130aee48f63262c7f87f181ca3c57be70b /filesystem.c
parent55362bf81505371c7faeb14c11ffa822ff8cfb25 (diff)
downloadnano-exporter-5d807dc6d07dc3f0ee2a8415c1d3032ef97c6742.tar.gz
nano-exporter-5d807dc6d07dc3f0ee2a8415c1d3032ef97c6742.tar.xz
nano-exporter-5d807dc6d07dc3f0ee2a8415c1d3032ef97c6742.zip
filesystem: export failed statvfs calls as node_filesystem_device_error
Diffstat (limited to 'filesystem.c')
-rw-r--r--filesystem.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/filesystem.c b/filesystem.c
index ec34bc3..06a1519 100644
--- a/filesystem.c
+++ b/filesystem.c
@@ -16,6 +16,7 @@
 
 #define _POSIX_C_SOURCE 200809L
 
+#include <errno.h>
 #include <string.h>
 #include <sys/statvfs.h>
 
@@ -144,8 +145,11 @@ static void filesystem_collect(scrape_req *req, void *ctx_ptr) {
 
     // report metrics from statfs
 
-    if (ctx->statvfs_func(*mount, &fs) != 0)
+    if (ctx->statvfs_func(*mount, &fs) != 0) {
+      if (errno != EACCES)
+        scrape_write(req, "node_filesystem_device_error", labels, errno);
       continue;
+    }
 
     double bs = fs.f_frsize;
     scrape_write(req, "node_filesystem_avail_bytes", labels, fs.f_bavail * bs);