I need a way to send alert email if the CPU usage is higher than 80% for more than 5 minute. Installing new software on the server not allowed for me. Is there any way to handle it through a shell script and a scheduled cron job?
1 Answer
You can use the load averages from uptime
to get the 1-, 5-, and 15-minute load averages, and have a cron job that runs every minute.
Note that a load average of 1
means that 1 full core (or work equivalent to 1 full core) is being used. That means that if you have 4 cores, the load average you're looking for is 3.20.