title: Disk usage shown by cAdvisor
body: <p>Following <a href="https://stefanprodan.com/2016/a-monitoring-solution-for-docker-hosts-containers-and-containerized-services/" rel="nofollow noreferrer">this</a> guide I have setup cadvisor to monitor the local docker containers. Prometheus is scraping cAdvisor for data which is visualized in Grafana.</p>
  
  <p>I am trying to get disk usage of all the docker containers running on the host. I want to get an output similar to the one shown after running</p>
  
  <pre><code>docker system df
  TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
  Images              21                  10                  1.18GB              489.9MB (41%)
  Containers          10                  8                   27B                 0B (0%)
  Local Volumes       16                  5                   2.369GB             1.615GB (68%)
  Build Cache         0                   0                   0B                  0B
  </code></pre>
  
  <p>Grafana is used to visualize the data. In order to get disk usage I am running the following query to fetch data from Prometheus. </p>
  
  <pre><code>sum(container_fs_usage_bytes)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/TFP8E.png" rel="nofollow noreferrer">Grafana screenshot</a></p>
  
  <p>The problem is that the value I am getting is the entire value of the overlay filesystem (82GB).</p>
  
  <p>The following rows regarding filesystem usage are shown in cAdvisor (127.0.0.1/metrics)</p>
  
  <pre><code>  # TYPE container_fs_usage_bytes gauge
    container_fs_usage_bytes{container_label_com_docker_compose_config_hash="",container_label_com_docker_compose_container_number="",container_label_com_docker_compose_oneoff="",container_label_com_docker_compose_project="",container_label_com_docker_compose_service="",container_label_com_docker_compose_version="",container_label_maintainer="",container_label_org_label_schema_group="",device="/dev/sda2",id="/",image="",name=""} 4.4317888512e+10
    container_fs_usage_bytes{container_label_com_docker_compose_config_hash="",container_label_com_docker_compose_container_number="",container_label_com_docker_compose_oneoff="",container_label_com_docker_compose_project="",container_label_com_docker_compose_service="",container_label_com_docker_compose_version="",container_label_maintainer="",container_label_org_label_schema_group="",device="overlay",id="/",image="",name=""} 4.4317888512e+10
    container_fs_usage_bytes{container_label_com_docker_compose_config_hash="",container_label_com_docker_compose_container_number="",container_label_com_docker_compose_oneoff="",container_label_com_docker_compose_project="",container_label_com_docker_compose_service="",container_label_com_docker_compose_version="",container_label_maintainer="",container_label_org_label_schema_group="",device="shm",id="/",image="",name=""} 0
    container_fs_usage_bytes{container_label_com_docker_compose_config_hash="",container_label_com_docker_compose_container_number="",container_label_com_docker_compose_oneoff="",container_label_com_docker_compose_project="",container_label_com_docker_compose_service="",container_label_com_docker_compose_version="",container_label_maintainer="",container_label_org_label_schema_group="",device="tmpfs",id="/",image="",name=""} 0
    container_fs_usage_bytes{container_label_com_docker_compose_config_hash="0616b7e25768c2764fd083b53a061c53c6a2ffea9f8d5e74f6ec61fbc03aeeba",container_label_com_docker_compose_container_number="1",container_label_com_docker_compose_oneoff="False",container_label_com_docker_compose_project="dockprom",container_label_com_docker_compose_service="prometheus",container_label_com_docker_compose_version="1.17.1",container_label_maintainer="The Prometheus Authors &lt;prometheus-developers@googlegroups.com&gt;",container_label_org_label_schema_group="monitoring",device="/dev/sda2",id="/docker/6fbef095b2cf0c3f65e906d4ddca4102cd0646590c4003e50186af40f02ef805",image="prom/prometheus:v2.4.2",name="prometheus"} 409600
    container_fs_usage_bytes{container_label_com_docker_compose_config_hash="19747419ff433903067d8681ee6149861347fcf65e7db246f4b56301feb53b78",container_label_com_docker_compose_container_number="1",container_label_com_docker_compose_oneoff="False",container_label_com_docker_compose_project="dockprom",container_label_com_docker_compose_service="caddy",container_label_com_docker_compose_version="1.17.1",container_label_maintainer="",container_label_org_label_schema_group="monitoring",device="/dev/sda2",id="/docker/611fe3e5812d9c3a3abc9dab27fd8a91f68c2e3acc3257b5926eae0cbf8914cf",image="stefanprodan/caddy",name="caddy"} 53248
    container_fs_usage_bytes{container_label_com_docker_compose_config_hash="38ec70818559317528d83c7c8d889ab9ff2dcd78637a3e9cae71083014abc281",container_label_com_docker_compose_container_number="1",container_label_com_docker_compose_oneoff="False",container_label_com_docker_compose_project="dockprom",container_label_com_docker_compose_service="grafana",container_label_com_docker_compose_version="1.17.1",container_label_maintainer="",container_label_org_label_schema_group="monitoring",device="/dev/sda2",id="/docker/70cdb5ec332973c7a70cf339f5abc48afa5d8f6e6ff5ba0216031ff1c86aa2c5",image="grafana/grafana:5.2.4",name="grafana"} 204800
    container_fs_usage_bytes{container_label_com_docker_compose_config_hash="42eb1e0967f80c097581f64bace779010aac94368f2fd366215b2a2506340a60",container_label_com_docker_compose_container_number="1",container_label_com_docker_compose_oneoff="False",container_label_com_docker_compose_project="dockprom",container_label_com_docker_compose_service="pushgateway",container_label_com_docker_compose_version="1.17.1",container_label_maintainer="The Prometheus Authors &lt;prometheus-developers@googlegroups.com&gt;",container_label_org_label_schema_group="monitoring",device="/dev/sda2",id="/docker/39049775176f8315f4ee3acf8167a6986ee1ce4fe89cebc20061accec8cdb5cf",image="prom/pushgateway",name="pushgateway"} 69632
    container_fs_usage_bytes{container_label_com_docker_compose_config_hash="58ee943e7e48ae304fa7040d44ebeeb440627d311716a70665f4c43f16e6ad54",container_label_com_docker_compose_container_number="1",container_label_com_docker_compose_oneoff="False",container_label_com_docker_compose_project="dockprom",container_label_com_docker_compose_service="nodeexporter",container_label_com_docker_compose_version="1.17.1",container_label_maintainer="",container_label_org_label_schema_group="monitoring",device="/dev/sda2",id="/docker/6f4c169111b89ea2bb857fbd0cf52c1c729b17dbdd8e7a8e011a1f9ba7128e90",image="prom/node-exporter:v0.16.0",name="nodeexporter"} 184320
    container_fs_usage_bytes{container_label_com_docker_compose_config_hash="db9a938539bf7f1b610cda7420e62088d2bd27c50f52b2510b3bfc9d6c099744",container_label_com_docker_compose_container_number="1",container_label_com_docker_compose_oneoff="False",container_label_com_docker_compose_project="dockprom",container_label_com_docker_compose_service="cadvisor",container_label_com_docker_compose_version="1.17.1",container_label_maintainer="",container_label_org_label_schema_group="monitoring",device="/dev/sda2",id="/docker/2d9fee9bd94d9d627259f04e17468840700a78267a894f3fbedda0d375c5e985",image="google/cadvisor:v0.31.0",name="cadvisor"} 86016
    container_fs_usage_bytes{container_label_com_docker_compose_config_hash="fdcc8c8d658803bc1254fab7a308bc999f76e777a0f414d2f6c58024530cdfa8",container_label_com_docker_compose_container_number="1",container_label_com_docker_compose_oneoff="False",container_label_com_docker_compose_project="dockprom",container_label_com_docker_compose_service="alertmanager",container_label_com_docker_compose_version="1.17.1",container_label_maintainer="",container_label_org_label_schema_group="monitoring",device="/dev/sda2",id="/docker/c6f72c08c11cfd862fa565bfd190744555ff2d345dfce553b8839a4d13c0d0d2",image="prom/alertmanager:v0.15.2",name="alertmanager"} 73728
  </code></pre>
  
  <p>Here is the output of <strong>df -h</strong> on the host</p>
  
  <pre><code>overlay         228G   39G  178G  18% /var/lib/docker/overlay2/d3de4ea22cdec9aac513d0799b43b0c7fefdb7b75391b6c7b4bc35f46eec817c/merged
  </code></pre>
  
  <p>How can I get the same values in Grafana from cAdvisor as the ones returned by <strong>docker system df</strong>  ?</p>