Monitoring Task: High CPU or Memory Usage¶
Description¶
Detect and respond to spikes in resource consumption that can degrade performance or cause crashes.
Detection Methods¶
- Prometheus alert rules
top
,htop
, orps
output- Grafana dashboard visualization
Triage Steps¶
- Identify top consumers:
or with more detail:
top -o %CPU top -o %MEM
ps aux --sort=-%mem | head
-
Check container stats if Docker is in use:
docker stats
-
Kill or restart offending process if required:
kill -9 <pid>
Preventive Actions¶
- Set resource limits (cgroups, containers)
- Use swap and memory thresholds
- Scale vertically or horizontally
Tools & Commands¶
top
,htop
,ps
,docker stats
, Prometheus + Grafana