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

in #blog16 days 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.28
TRX 0.11
JST 0.030
BTC 67646.69
ETH 3790.48
USDT 1.00
SBD 3.50