<?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 phfilly on Medium]]></title>
        <description><![CDATA[Stories by phfilly on Medium]]></description>
        <link>https://medium.com/@phfilly?source=rss-c0a84ce5b3e7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*aqroaBhdcYtaoX8k64edhw.jpeg</url>
            <title>Stories by phfilly on Medium</title>
            <link>https://medium.com/@phfilly?source=rss-c0a84ce5b3e7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 02:01:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@phfilly/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[You DOCKer my world]]></title>
            <link>https://medium.com/@phfilly/you-docker-my-world-c21ea1b77eed?source=rss-c0a84ce5b3e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/c21ea1b77eed</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[flask]]></category>
            <category><![CDATA[monitor]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[phfilly]]></dc:creator>
            <pubDate>Wed, 07 Mar 2018 19:36:06 GMT</pubDate>
            <atom:updated>2018-07-07T07:16:00.536Z</atom:updated>
            <content:encoded><![CDATA[<p>You DOCKer my world</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yZgdzRqq6GwjPNOVfCox4A.png" /></figure><p>So, I tried to create an AWS Cloudwatch &amp; Docker container monitor tool in Python(Flask). To give some context and why, we have a bunch of servers that all run docker containers. A lot. These containers constantly scrape brand data from the three big social networks, where we store them in our graph database. We’re using the open source database — OrientDB.</p><p>As you might know, tracking your resources and monitoring up-time are essential if you want everything to run smoothly. Especially, if a container dies that might be reading to a database container or a scraper times out.</p><p>We are also trying to incorporate into our billing module how much resources a scraper is using. We track over a period of time the total memory usage of a scraper and see how much it’s utilizing of the server. There is much more too it, but in short that is the idea.</p><p>On each server I installed a lightweight-python script(<a href="https://github.com/phfilly/aws-docker-script">https://github.com/phfilly/aws-docker-scrip)</a>, which basically runs docker stats container-id --no-stream — this will send back the most recent data of memory usage of all the containers running. I then send this data to CloudWatch Logs and -Metrics, where Insave the server name, container status, ram usage and timestamp.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*h_lvhlmTmGWl04MQOaCU8A.png" /><figcaption>JSON string in CloudWatch Logs</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xD5b4vBzcxchx4auOI7uTA.png" /><figcaption>CloudWatch Metrics</figcaption></figure><p>Now we can start to track individual container behaviour and how much resources it is using. All this made it possible to use theboto3 python libary to pull the data into our own monitor tool.</p><p>I also installed this script(<a href="https://github.com/issuu/aws-scripts-mon">https://github.com/issuu/aws-scripts-mon</a>) to send memory usage for every server. If you did not know, Amazon does not provide memory usage metrics for servers. The only useful metric for us was CPU utilization. Below you can see the average memory used and a pulse to indicate if the server is up and running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*x68PRHJDc9m0qPqFguh6dg.png" /><figcaption>Small victory #1</figcaption></figure><p>Back to the docker containers. Below you can see an example of the output we are after. Yes, the server name is The Pitt. Mortal Kombat &amp; Lord of The Rings is a theme in the office.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pdHinKjMCNgEPvWA5XFmow.png" /><figcaption>All you need in order to see the status and if it is failing, on which server.</figcaption></figure><p>On each container you can view the over time usage of memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*eNzwhFa2G1as4FJtCXV_jQ.png" /><figcaption>Test data</figcaption></figure><p>The monitor tool code can be found here: <a href="https://github.com/phfilly/server-monitor-tool">https://github.com/phfilly/server-monitor-tool</a>. Feel free to contribute.</p><p>The dashboard can now be quickly viewed without you needing all your AWS credentials and project managers can quickly get an overview if data is <em>off</em>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c21ea1b77eed" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>