Files
Malio-ops/check_storage.sh

17 lines
738 B
Bash

#!/bin/bash
limit=1
WEBHOOK_URL="https://discord.com/api/webhooks/1479061246903845048/oInyHOf1l7t-jbu9c1lvQDBUxT7m96sUpoDak-V_wjR4IRFi2zz9prC20IKq6cLHF8FO"
usage=$(df -h / | awk 'NR==2 {gsub(/%/,"",$5); print $5}')
free=$((100 - usage))
if [ "$usage" -ge "$limit" ]; then
msgLimit="@here\n**CHECK STOCKAGE :red_circle:**\nLimite autorisé : ${limit}% \nUtilisation actuelle: ${usage}%\nEspace restant: ${free}%\nHeure: $(date)"
curl -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json; charset=utf-8" \
-d "{\"content\":\"$msgLimit\"}" \
"$WEBHOOK_URL"
echo "ALERTE >> ${usage}% d'utilisation, check fait le $(date)"
echo "------------------------------------------------------------"
fi