13 lines
493 B
Bash
Executable File
13 lines
493 B
Bash
Executable File
#!/bin/bash
|
|
# Opus 19avr: disk usage monitoring
|
|
PCT=$(df / --output=pcent | tail -1 | tr -d ' %')
|
|
USED=$(df -h / --output=used | tail -1 | tr -d ' ')
|
|
AVAIL=$(df -h / --output=avail | tail -1 | tr -d ' ')
|
|
SIZE=$(df -h / --output=size | tail -1 | tr -d ' ')
|
|
STATUS="OK"
|
|
[ "$PCT" -gt 80 ] && STATUS="WARNING"
|
|
[ "$PCT" -gt 90 ] && STATUS="CRITICAL"
|
|
cat <<EOF
|
|
{"used":"$USED","available":"$AVAIL","size":"$SIZE","percent":$PCT,"status":"$STATUS","threshold":80,"timestamp":"$(date -Iseconds)"}
|
|
EOF
|