<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mertcan Simsek on Medium]]></title>
        <description><![CDATA[Stories by Mertcan Simsek on Medium]]></description>
        <link>https://medium.com/@mertcan.simsek276?source=rss-5896c906e547------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*0vKVM8BYbHcTJSsZ.jpg</url>
            <title>Stories by Mertcan Simsek on Medium</title>
            <link>https://medium.com/@mertcan.simsek276?source=rss-5896c906e547------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 05:56:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mertcan.simsek276/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Docker Monitoring with cAdvisor, Prometheus and Grafana]]></title>
            <link>https://medium.com/@mertcan.simsek276/docker-monitoring-with-cadvisor-prometheus-and-grafana-adefe1202bf8?source=rss-5896c906e547------2</link>
            <guid isPermaLink="false">https://medium.com/p/adefe1202bf8</guid>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[cadvisor]]></category>
            <category><![CDATA[grafana]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Mertcan Simsek]]></dc:creator>
            <pubDate>Mon, 16 Dec 2019 08:53:23 GMT</pubDate>
            <atom:updated>2019-12-16T08:53:23.202Z</atom:updated>
            <content:encoded><![CDATA[<p>Docker is the open-source tool, which works like a virtual machine. However, it doesn’t create whole operating system, it has just minimum set of operating system for running application. Docker allows you to get more apps running on the server and also makes it very easy to package and ship programs.</p><p>While we have more running application, it is very important to monitor these containers performances, resource usage, etc. A container monitoring system collects metrics to ensure application running on containers are performing properly. Metrics are tracked and analyzed in real time to determine if an application is meeting expected goals.</p><p>In this article, we will cover docker monitoring by using cAdvisor, Prometheus and Grafana. These three tools are open source and easy to setup. Moreover, they can be integrated smoothly. We will setup grafana and cAdvisor using Docker container. Prometheus will run on the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U7TAoX0ud3NcU-I08jkTcA.png" /></figure><h4>Step-1 Install cAdvisor</h4><p>cAdvisor (Container Advisor) collects, aggregates, processes and exports information about running containers. For installing cAdvisor with docker;</p><pre>sudo docker run \<br>  --volume=/:/rootfs:ro \<br>  --volume=/var/run:/var/run:ro \<br>  --volume=/sys:/sys:ro \<br>  --volume=/var/lib/docker/:/var/lib/docker:ro \<br>  --volume=/dev/disk/:/dev/disk:ro \<br>  --publish=8080:8080 \<br>  --detach=true \<br>  --name=cadvisor \<br>  gcr.io/google-containers/cadvisor:latest </pre><p>cAdvisor is now running on <a href="http://localhost:8080/">http://localhost:8080</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z9_zDS5BLHRSdchmwDivow.png" /><figcaption>Usage Overview</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lt2RnIC9VZHLlpEeiSWAmg.png" /><figcaption>CPU Usage of Containers</figcaption></figure><h4>Step-2 Install Prometheus</h4><p>Prometheus is an open-source system monitoring and alerting toolkit. Prometheus is very easy to setup. <strong><em>Firstly</em></strong>, we need to download the latest release of prometheus from <a href="https://prometheus.io/download/">https://prometheus.io/download/</a> .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AUAQ_coCcdiEbr5SNn52cg.png" /><figcaption>Prometheus Download Page</figcaption></figure><p>Extract the downloaded file and set it as working directory.</p><pre>tar xvfz prometheus-*.tar.gz<br>cd prometheus-*</pre><p><strong><em>Secondly</em></strong>, we need to configure prometheus.ymlbefore starting prometheus.</p><pre># global config<br>global:<br>  scrape_interval:     15s<br>  evaluation_interval: 15s<br><br>rule_files:<br>  # - &quot;first_rules.yml&quot;<br>  # - &quot;second_rules.yml&quot;</pre><pre># A scrape configuration containing exactly one endpoint to scrape:<br># Here it&#39;s Prometheus itself.</pre><pre>scrape_configs:<br>  - job_name: &#39;prometheus&#39;<br>    static_configs:<br>      - targets: [&#39;localhost:9090&#39;]</pre><pre>  - job_name: &#39;cadvisor&#39;<br>    scrape_interval: 10s <br>    metrics_path: &#39;/metrics&#39;<br>    static_configs:<br>      - targets: [&#39;localhost:8080&#39;]<br>        labels:<br>          group: &#39;cadvisor&#39;</pre><p>Now, we are ready to start prometheus</p><pre>./prometheus --config.file=prometheus.yml</pre><p>Prometheus will start in 30 seconds. We can access prometheus main page from <a href="http://localhost:9090/metrics">http://localhost:9090/metrics</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BmGWA201EBse-OBU94mUcw.png" /><figcaption>Prometheus Main Page</figcaption></figure><p>For checking configuration on prometheus, we should follow the path: <strong><em>status </em>→ <em>Targets</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PEs1WocS63mPmQaf1DdN0Q.png" /><figcaption>cAdvisor</figcaption></figure><p>Configuration is done. We are ready to visualize the metrics.</p><h4>Step-3 Install Grafana</h4><p>Grafana is an open source metric analytics &amp; visualization suite. It is used for visualizing time series data for infrastructure and application analytics. Grafana installation is very laborless, and we will run it using the official Docker container.</p><pre>$ docker run -d -p 3000:3000 grafana/grafana</pre><p>Grafana is running on port 3000 so, we will use <a href="http://localhost:3000/">http://localhost:3000</a> for going main page of grafana.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6CYZRq320TeusqHEnigawQ.png" /><figcaption>Main Page of Grafana</figcaption></figure><p><strong><em>Firstly, </em></strong>we need to add data source. Click on <strong>create your first data source </strong>button. Prometheus is default <em>time series database</em> of grafana thus, we don’t need any data source plugin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Le_3QpTLfuVHv1SKEBBn6g.png" /><figcaption>Data Source Page</figcaption></figure><p>Write your prometheus URL.</p><p><strong><em>Then</em></strong>, we can create our dashboard after adding data source. There are different kinds of dashboards with different data sources at grafana dashboard home page <a href="https://grafana.com/grafana/dashboards">https://grafana.com/grafana/dashboards</a>. At this page, we will search <em>docker monitoring</em> for <em>prometheus </em>data source. This page has so many docker monitoring dashboards, but in this tutorial, we will use <em>docker monitoring by philicious </em><a href="https://grafana.com/grafana/dashboards/193">https://grafana.com/grafana/dashboards/193</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UiFT087iaJQbMw1Fg-JVHg.png" /><figcaption>Grafana Dashboard</figcaption></figure><p>We will download this dashboard as json format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*49gs9sBVyPo6GzTtMNpcvQ.png" /><figcaption>Grafana Home Page</figcaption></figure><p>At the main page of grafana; if we click on <strong>Home</strong> at left-top of the page, <strong>import dashboard</strong> option will become visible. Upload the downloaded json file from this page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vtc6LHgDuWzdJL-gyPkKKw.png" /><figcaption>Import Dashboard</figcaption></figure><p>Name of dashboard will come automatically, but we have to select prometheus option. Then, importing is ready.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OH1hTQ6JrGuUbdVse7Iutg.png" /><figcaption>Docker Monitoring Dashboard-1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5yPCSmcOc0gfEZFGC1xTlQ.png" /><figcaption>Docker Monitoring Dashboard-2</figcaption></figure><p>This dashboard shows us running containers, total memory usage, total cpu usage etc. As we can see there are 3 running containers which are cAdvisor, jenkins and grafana. If we want to evaluate our docker container usages, cAdvisor is using the highest CPU but jenkins has the highest memory usage.</p><p>I hope this article help you to monitor your docker containers. If you think there are questionable or missing parts, you can contact me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=adefe1202bf8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>