about summary refs log tree commit diff
path: root/diskstats.c
diff options
context:
space:
mode:
authorHeikki Kallasjoki <fis@zem.fi>2018-12-07 01:48:33 +0000
committerHeikki Kallasjoki <fis+github@zem.fi>2018-12-07 01:52:49 +0000
commit16d61af28bcd07348117fd457b62ff39c1a0b45d (patch)
tree5e7ca99f70c488a4ca96d1407c795d312558553f /diskstats.c
parentf5c20e9c9b46ac6efe3c3948302e4e20718a5968 (diff)
downloadnano-exporter-16d61af28bcd07348117fd457b62ff39c1a0b45d.tar.gz
nano-exporter-16d61af28bcd07348117fd457b62ff39c1a0b45d.tar.xz
nano-exporter-16d61af28bcd07348117fd457b62ff39c1a0b45d.zip
Include newline as delimiter when splitting /proc/diskstats.
Fixes #5.

Splitting by space only caused the newline to end up as part of the last column, which was then ignored since the newline was considered trailing non-numeric data when parsing the value.
Diffstat (limited to 'diskstats.c')
-rw-r--r--diskstats.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/diskstats.c b/diskstats.c
index 873d939..e622fd3 100644
--- a/diskstats.c
+++ b/diskstats.c
@@ -143,7 +143,7 @@ static void diskstats_collect(scrape_req *req, void *ctx_ptr) {
     // emit metrics while known columns last
 
     for (size_t c = 0; c < NCOLUMNS; c++) {
-      char *v = strtok_r(0, " ", &p);
+      char *v = strtok_r(0, " \n", &p);
       if (!v || *v == '\0')
         break;