X-Git-Url: https://git.xandkar.net/?p=khatus.git;a=blobdiff_plain;f=x4%2Fbin%2Fkhatus_x4_sensor_disk;fp=x4%2Fbin%2Fkhatus_x4_sensor_disk;h=7beebd3d006af42c772c229aca332aec670c745a;hp=0000000000000000000000000000000000000000;hb=8c587a0277216e4af9865dedfca249044c1ed875;hpb=5bbff27d4c4195e47400c42f5c324632e7f4936a diff --git a/x4/bin/khatus_x4_sensor_disk b/x4/bin/khatus_x4_sensor_disk new file mode 100755 index 0000000..7beebd3 --- /dev/null +++ b/x4/bin/khatus_x4_sensor_disk @@ -0,0 +1,37 @@ +#! /bin/sh + +set -e + +bin_dir="$(dirname $(realpath $0))" + +. "$bin_dir/khatus_x4_lib_common_sensor.sh" + +while : +do + case "$1" + in '') + break + ;; -f|--file) + case "$2" + in '') + printf "Option $1 requires and argument\n" >&2 + exit 1 + ;; *) + file="$2" + shift 2 + esac + ;; *) + shift 1 + esac +done + +sensor() { + df --output=pcent "$file" | awk ' + NR == 2 { + sub("%$", "", $1) + print("disk_usage_percentage", $1) + } + ' +} + +run_as_poller