I have a CentOS server running on a VPS via Virtuozoo containers.
I feel like there are high CPU usage spikes. Is there a way I can log every time CPU usage goes beyond a certain limit lets say 50%.
Thanks
Monit can do that:
check system localhost.localdomain.tld
if loadavg (1min) > 5 for 6 cycles then alert
if loadavg (5min) > 2 for 3 cycles then alert
if loadavg (15min) > 2 for 2 cycles then alert
if memory usage > 90% for 6 cycles then alert
if cpu usage (user) > 75% for 6 cycles then alert
if cpu usage (system) > 75% for 6 cycles then alert
if cpu usage (wait) > 75% for 6 cycles then alert
Look into munin and graphite, both are excellent and free tools for system management.