Gets used, free, available and total amount of bytes on the given mounted filesystem.
+These values can also be expressed in percentages with the percentage_used,
+percentage_free, percentage_avail and percentage_used_of_avail formats.
+
*Example order*: +disk /mnt/usbstick+
*Example format*: +%free (%avail)/ %total+
+*Example format*: +%percentage_used used, %percentage_free free, %percentage_avail avail+
+
=== Run-watch
Expands the given path to a pidfile and checks if the process ID found inside
outwalk += print_bytes_human(outwalk, (uint64_t)buf.f_bsize * (uint64_t)buf.f_bavail);
walk += strlen("avail");
}
-
- if (BEGINS_WITH(walk+1, "percentage")) {
- outwalk += sprintf(outwalk, "%.01f%%", 100.0 - 100.0 * (double)buf.f_bavail / (double)buf.f_blocks);
- walk += strlen("percentage");
+
+ if (BEGINS_WITH(walk+1, "percentage_free")) {
+ outwalk += sprintf(outwalk, "%.01f%%", 100.0 * (double)buf.f_bfree / (double)buf.f_blocks);
+ walk += strlen("percentage_free");
+ }
+
+ if (BEGINS_WITH(walk+1, "percentage_used_of_avail")) {
+ outwalk += sprintf(outwalk, "%.01f%%", 100.0 * (double)(buf.f_blocks - buf.f_bavail) / (double)buf.f_blocks);
+ walk += strlen("percentage_used_of_avail");
+ }
+
+ if (BEGINS_WITH(walk+1, "percentage_used")) {
+ outwalk += sprintf(outwalk, "%.01f%%", 100.0 * (double)(buf.f_blocks - buf.f_bfree) / (double)buf.f_blocks);
+ walk += strlen("percentage_used");
+ }
+
+ if (BEGINS_WITH(walk+1, "percentage_avail")) {
+ outwalk += sprintf(outwalk, "%.01f%%", 100.0 * (double)buf.f_bavail / (double)buf.f_blocks);
+ walk += strlen("percentage_avail");
}
}