How to write script monitoring cpu and memory usage then prints a warning when usage is 70% (red warning)?
EDIT:
cpuUsage=$(top -bn1 | awk '/Cpu/ { print $2}')
memUsage=$(free -m | awk '/Mem/{print $3}')
echo "CPU Usage: $cpuUsage%"
echo "Memory Usage: $memUsage%"
if [ "$cpuUsage" -ge 70]; then
echo -e "The system is not utilizing"
It keeps giving me 0% usage of CPU and message isn't printed