Commit | Line | Data |
---|---|---|
8c587a02 SK |
1 | #! /bin/sh |
2 | ||
3 | set -e | |
4 | ||
5 | bin_dir="$(dirname $(realpath $0))" | |
6 | ||
7 | . "$bin_dir/khatus_x4_lib_common_sensor.sh" | |
8 | ||
9 | while : | |
10 | do | |
11 | case "$1" | |
12 | in '') | |
13 | break | |
14 | ;; -f|--file) | |
15 | case "$2" | |
16 | in '') | |
17 | printf "Option $1 requires and argument\n" >&2 | |
18 | exit 1 | |
19 | ;; *) | |
20 | file="$2" | |
21 | shift 2 | |
22 | esac | |
23 | ;; *) | |
24 | shift 1 | |
25 | esac | |
26 | done | |
27 | ||
28 | sensor() { | |
29 | df --output=pcent "$file" | awk ' | |
30 | NR == 2 { | |
31 | sub("%$", "", $1) | |
32 | print("disk_usage_percentage", $1) | |
33 | } | |
34 | ' | |
35 | } | |
36 | ||
37 | run_as_poller |