hetzner-storagebox-exporter/check-storage.sh

21 lines
708 B
Bash
Raw Normal View History

2022-10-06 20:43:36 +00:00
#! /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
2023-03-23 23:51:53 +00:00
echo "# HELP hetzner_storage_available Available storage in kilobytes"
echo "# TYPE hetzner_storage_available gauge"
2022-10-06 20:43:36 +00:00
echo "hetzner_storage_available{host=\"${HOST}\"} $AVAIL"
2023-03-23 23:51:53 +00:00
echo "# HELP hetzner_storage_used Used storage in kilobytes"
echo "# TYPE hetzner_storage_used gauge"
2022-10-06 20:43:36 +00:00
echo "hetzner_storage_used{host=\"${HOST}\"} $USED"
2023-03-23 23:51:53 +00:00
echo "# HELP hetzner_storage_total Total storage in kilobytes"
echo "# TYPE hetzner_storage_total gauge"
2022-10-06 20:43:36 +00:00
echo "hetzner_storage_total{host=\"${HOST}\"} $TOTAL"
done