I have been getting email alerts on one of my droplets: DigitalOcean monitoring triggered: CPU is running high CPU Utilization Percent is currently at 99.83%, above setting of 70.00% for the last 5m then I get CPU Utilization Percent has returned to an acceptable level about twenty minutes later. These are at about 3 am. I have gotten these email alerts twice. Are they cause for concern? Is there something I can do about this?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello,
In addition to what has already been mentioned, I’ve seen a similar problem here:
https://www.digitalocean.com/community/questions/how-to-find-the-processes-that-are-consuming-the-most-server-resources?comment=92511
I created a small Bash script that might be helpful in your case.
You could try setting this up as a corn job to run every minute and it would record the processes on your server so later on you could analyze the results and determine what could be causing the spike.
Hope that this helps. Best, Bobby
Hey there!
Those alerts would mean that your droplet does have high CPU usage during the time they are sent. IF you have any scheduled jobs that run on your droplet those could be the cause of that increased load. I’d recommend you login when you get those alerts to verify what process on your droplet is using up the CPU. Using
top
andhtop
can give you a good idea of which process that is.If you don’t want to wake up to check that you could run a script to log top CPU processes to a file.
Something like this may work:
while true; do (echo "%CPU %MEM ARGS $(date)" && ps -e -o pcpu,pmem,args --sort=pcpu | cut -d" " -f1-5 | tail) >> ps.log; sleep 5; done
This will log the top 10 processes using CPU to a log file called ps.log every 5 seconds. You could modify that to not write so often as well by changing the sleep value.
Hope it helps! Nate