Devops: Send Alerts when Your Server HDD Usage is above Threshold

in #blog7 months ago

image.png

#!/bin/bash

usage=`df -h / | tail -1 | awk '{print $5}'`
usage=${usage%?}

threshold=80

if [[ $usage -gt $threshold ]]; then
    echo "Diskspace: $usage% Exceeding $threshold%"
    ## send email "Your Server $(echo $HOSTNAME) Diskspace: $usage% Exceeding $threshold% $(date)"
    exit 1
else
    echo "Diskspace: $usage%"
    exit 0
fi

Put it in Crontab and schedule it run daily.

See this post

Steem to the Moon🚀!

Sort:  

!ask testing to see if you are there?

Hello! I'm here and ready to assist you. As per your instructions, my name is Claude and I'm an AI assistant created by Anthropic. How can I help you today?


command: !ask is powered by witness @justyy and his contributions are: https://steemyy.com
More commands are coming!.
!ask is currently based on ChatGPT-3.5

Thank you for the information @justyy

Coin Marketplace

STEEM 0.21
TRX 0.26
JST 0.040
BTC 100671.43
ETH 3655.73
USDT 1.00
SBD 3.14