diff options
Diffstat (limited to 'statuspage/checks/hw.sh')
| -rwxr-xr-x | statuspage/checks/hw.sh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/statuspage/checks/hw.sh b/statuspage/checks/hw.sh index 259234d..54c4718 100755 --- a/statuspage/checks/hw.sh +++ b/statuspage/checks/hw.sh @@ -10,8 +10,12 @@ DIR=$(dirname "$0") LOAD=$(sysctl -n vm.loadavg | tr -d '{}' | sed 's/^ *//;s/ *$//') json_line "hardware" "load avg" "$LOAD" "ok" -UPTIME=$(uptime | sed 's/.*up //;s/,.*load.*//') -json_line "hardware" "uptime" "$UPTIME" "ok" +BOOT=$(sysctl -n kern.boottime | sed -n 's/{ sec = \([0-9]*\).*/\1/p') +SECS=$(($(date +%s) - BOOT)) +UP_D=$((SECS / 86400)) +UP_H=$(((SECS % 86400) / 3600)) +UP_M=$(((SECS % 3600) / 60)) +json_line "hardware" "uptime" "${UP_D}d ${UP_H}h ${UP_M}m" "ok" MEM_FREE=$(sysctl -n vm.stats.vm.v_free_count) MEM_PAGE=$(sysctl -n hw.pagesize) |
