Skip to content

Instantly share code, notes, and snippets.

@bing0o
Created January 9, 2019 12:57
Show Gist options
  • Select an option

  • Save bing0o/51c179844eb4e5a1e1236660f41ff6d6 to your computer and use it in GitHub Desktop.

Select an option

Save bing0o/51c179844eb4e5a1e1236660f41ff6d6 to your computer and use it in GitHub Desktop.
#!/bin/bash
mem=$(free -m | awk 'NR==2{print $3*100/$2}' | awk -F. '{print $1}')
disk=$(df -h | awk '$NF=="/"{print $5}' | awk -F% '{print $1}')
cpu=$(top -bn1 | grep load | awk '{print $(NF-2)}' | awk -F. '{print $1}')
if [ "$cpu" -ge "80" ]
then
notify-send -u critical "The CPU Almost Filled: $cpu"
fi
if [ "$disk" -ge "80" ]
then
notify-send -u critical "The DISC Almost Filled: $disk"
fi
if [ "$mem" -ge "80" ]
then
notify-send -u critical "The MEMORY Almost Filled: $mem"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment