hetzner-storagebox-exporter/check-storage.sh
Varakh f4b0c1d36a
All checks were successful
continuous-integration/drone/push Build is passing
Initial adapted version
2023-03-24 00:51:53 +01:00

20 lines
708 B
Bash
Executable file

#! /bin/sh
set -eu
PORT=${PORT:-23}
HOST=${HOST:-$USERNAME.your-storagebox.de}
ssh -p${PORT} ${USERNAME}@${HOST} df -k | tail -n +2 | while read FS TOTAL USED AVAIL PERCENT MOUNT; do
echo "# HELP hetzner_storage_available Available storage in kilobytes"
echo "# TYPE hetzner_storage_available gauge"
echo "hetzner_storage_available{host=\"${HOST}\"} $AVAIL"
echo "# HELP hetzner_storage_used Used storage in kilobytes"
echo "# TYPE hetzner_storage_used gauge"
echo "hetzner_storage_used{host=\"${HOST}\"} $USED"
echo "# HELP hetzner_storage_total Total storage in kilobytes"
echo "# TYPE hetzner_storage_total gauge"
echo "hetzner_storage_total{host=\"${HOST}\"} $TOTAL"
done