#!/usr/bin/env bash # # Copyright 2021 Vallum Software, LLC. MIT license. # # # Send an alert when network traffic allocation exceeds 900 GiB # webhook_url='' while [ true ] do traffic=$(vnstat --oneline | awk -F ";" '{print $11}') if [[ "${traffic}" == "GiB" ]] then if [ $(echo "$(echo "${traffic}" | sed 's/ GiB//g') > 900" | bc) -eq 1 ] then curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"Traffic level ${traffic}\"}" ${webhook_url} fi fi sleep 600 done exit 0