Skip to content

Instantly share code, notes, and snippets.

@rodrigo-galba
Created June 7, 2021 01:30
Show Gist options
  • Save rodrigo-galba/d8a873b8329be9cdaf8a96494ea60c25 to your computer and use it in GitHub Desktop.
Save rodrigo-galba/d8a873b8329be9cdaf8a96494ea60c25 to your computer and use it in GitHub Desktop.
Docker cAdvisor with Prometheus

Docker cAdvisor with Prometheus

docker run -d --restart always --name cadvisor -p 8080:8080 -v "/:/rootfs:ro" -v "/var/run:/var/run:rw" -v "/sys:/sys:ro" -v "/var/lib/docker/:/var/lib/docker:ro" google/cadvisor:latest
curl localhost:8080/metrics
ssh cloud_user@<PROMETHEUS_SERVER_PUBLIC_IP>
sudo vi /etc/prometheus/prometheus.yml
- job_name: 'Docker Containers'
  static_configs:
  - targets: ['limedrop-docker:8080']
sudo systemctl restart prometheus

Now query this on prometheus container_memory_usage_bytes{name=~"web."}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment