Using cadvisor to get a peek to Docker

  • Post Author:
  • Post Category:IT
  • Post Comments:0 Comments

You may use the Docker stats API to get some basic information from docker. Try the following to get a json output: curl -s --unix-socket /var/run/docker.sock http://localhost/containers/json | python -m json.tool To get data for a single container: curl -s --unix-socket /var/run/docker.sock http://localhost/containers/c101546a3690/json | python -m json.tool Pros: simple Cons: no aggregation, no visualization. To take it to the next level, give cAdvisor a shot: it taps the Docker API, and gives you a visual and historical data what's going on inside Docker. cAdvisor runs as a docker container: docker run \ --volume=/:/rootfs:ro \ --volume=/var/run:/var/run:rw \ --volume=/sys:/sys:ro \ --volume=/var/lib/docker/:/var/lib/docker:ro \ --publish=8080:8080 \ --detach=true \ --name=cadvisor \ google/cadvisor:latest Then simply visit http://127.0.0.1:8080 Pros: visual Cons: limited timeframe, limited metrics You may also want to put these data to a time series database, eg. InfluxDB or similar, and visualize it with Grafana providing even better visuality and better history. Or you may give chance to sysdig to provide much more. See https://dzone.com/storage/assets/9981079-dzone-refcard236-dockermonitoring.pdf for more on the topic.

Continue Reading Using cadvisor to get a peek to Docker