Skip to content

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, or ps output
  • Grafana dashboard visualization

Triage Steps

  1. Identify top consumers:
    top -o %CPU
    top -o %MEM
    
    or with more detail:
    ps aux --sort=-%mem | head
    
  2. Check container stats if Docker is in use:

    docker stats
    

  3. 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