{"id":28439,"date":"2015-11-19T17:39:45","date_gmt":"2015-11-19T12:09:45","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=28439"},"modified":"2022-01-11T14:04:15","modified_gmt":"2022-01-11T08:34:15","slug":"devops-docker-monitoring-sysdig-cloud","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/devops-docker-monitoring-sysdig-cloud\/","title":{"rendered":"Docker monitoring using Sysdig Cloud"},"content":{"rendered":"<p>Sysdig has been one of the most advanced cloud-based tools for monitoring your infrastructure. So, talking about Docker monitoring, Sysdig gives us a lot of insights about our containers, few of which we will be talking about in this blog. Docker is the most widely used and trending tool when it comes to <a href=\"http:\/\/www.tothenew.com\/devops-automation-consulting\">DevOps<\/a>.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-28453\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/download.jpg\" alt=\"download\" width=\"1869\" height=\"258\" \/><\/p>\n<h3>USE-CASE<\/h3>\n<p>In this use-case we had to monitor Docker containers for an e-commerce web application. We had to find the tool which gives us\u00a0all insights of the\u00a0Docker containers. Sysdig was the next tool in our <a href=\"http:\/\/www.tothenew.com\/devops-chef-puppet-docker\">list of tools and technologies<\/a> that we are using at TO THE NEW Digital. I have a container running on my host machine and apache2 service running inside it. Let&#8217;s monitor this container.<\/p>\n<h3>INSTALLATION STEPS:<\/h3>\n<p>Create a Sysdig\u00a0account from this URL: <a href=\"https:\/\/sysdig.com\/docker-monitoring\/\">https:\/\/sysdig.com\/docker-monitoring\/<\/a> . You will get a confirmation mail from Sysdig. Click on the activate button, this will redirect you to the Sysdig page where you can further complete your registration.\u00a0After that click on next, which will take you to the below page:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28441\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Sysdig-Cloud1.png\" alt=\"Sysdig Cloud1\" width=\"880\" height=\"557\" \/><\/p>\n<p>Select Docker Container here which will open a page where installation steps will be mentioned:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28442\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Sysdig-Cloud2.png\" alt=\"Sysdig Cloud2\" width=\"878\" height=\"506\" \/><\/p>\n<p>Above commands can be run on your host machine. It is account dependent so the ACCESS_KEY will be different. You can replace [TAGS] option as specified in the above image. I have run the second command on my host machine using <strong>-itd<\/strong> switch. Else the container will run interactively and will print all lines on the terminal. Also, I have not used the TAGS switch. The command will now look like:<\/p>\n<p>[js]<\/p>\n<p>docker run -itd &#8211;name sysdig-agent &#8211;privileged &#8211;net host &#8211;pid host -e ACCESS_KEY=8dd53112-d004-4bdc-90a8-bde9f26825a3 -v \/var\/run\/docker.sock:\/host\/var\/run\/docker.sock -v \/dev:\/host\/dev -v \/proc:\/host\/proc:ro -v \/boot:\/host\/boot:ro -v \/lib\/modules:\/host\/lib\/modules:ro -v \/usr:\/host\/usr:ro sysdig\/agent<\/p>\n<p>[\/js]<\/p>\n<p>After this it should say:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28444\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Screenshot-from-2015-10-18-134730.png\" alt=\"Screenshot from 2015-10-18 13:47:30\" width=\"881\" height=\"507\" \/><\/p>\n<p>Just click on Next and it should take you to the <strong>Integrate with AWS<\/strong> page:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28445\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Sysdig-Cloud12.png\" alt=\"Sysdig Cloud12\" width=\"1351\" height=\"883\" \/><\/p>\n<p>If you want any <a href=\"http:\/\/www.tothenew.com\/devops-aws\">integration with AWS account <\/a>go ahead and give read access to Sysdig. You can create an IAM user, attach a READ ONLY policy to the user and enter the credentials here.\u00a0Since, I am just concerned about the Docker monitoring, so will skip this step clicking on <strong>SKIP<\/strong>.<\/p>\n<p>After this is should say:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28446\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Screenshot-from-2015-10-18-134939.png\" alt=\"Screenshot from 2015-10-18 13:49:39\" width=\"877\" height=\"200\" \/><\/p>\n<h3>MONITORING<\/h3>\n<p>Let&#8217;s Head onto the Console to see what we have got.<br \/>\nSelect Explore and it will show you the following options as in the image below:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28451\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Sysdig-Cloud123.png\" alt=\"Sysdig Cloud123\" width=\"1351\" height=\"933\" \/><\/p>\n<p>It will show you the host machine with a &#8220;+&#8221; sign before it. If you select the host machine, it will give you insights of the host machine. I have selected System -&gt; Top Processes and it is showing me all the top processes running on my host machine. You can select any other option from the left hand-side. An important phase of any <a href=\"http:\/\/www.tothenew.com\/devops-automation-consulting\">Devops project is\u00a0Docker monitoring<\/a>. For that just click on the &#8220;+&#8221; sign adjacent to the host machine&#8217;s hostname. It should show something like below:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28457\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Screenshot-from-2015-10-18-151348.png\" alt=\"Screenshot from 2015-10-18 15:13:48\" width=\"1123\" height=\"188\" \/><br \/>\nSo, it has listed both the Docker containers as in the above image. One of them is the sysdig-agent container which is giving us all the insights. Now, we shall select the apachecon container and see what insights we have. Also, in the bottom left I have selected Container Overview and it will give you an overall view of metrics related to the container:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-28462\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Sysdig-Cloud4.png\" alt=\"Sysdig Cloud4\" width=\"656\" height=\"676\" \/><\/p>\n<p>You can select Top Processes to see the top processes running inside your Docker container. Also, you can then search by process name if there are a lot of processes running.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28468\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Sysdig-Cloud5.png\" alt=\"Sysdig Cloud5\" width=\"1340\" height=\"353\" \/><\/p>\n<h3>\u00a0ALERTING<\/h3>\n<h4>Let&#8217;s see what type of alerts can we put.<\/h4>\n<p>What we are looking for is monitoring of Docker related things. Select on alert icon there &#8220;Add Alert&#8221;:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28472\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Screenshot-from-2015-10-18-152610.png\" alt=\"Screenshot from 2015-10-18 15:26:10\" width=\"1120\" height=\"456\" \/><\/p>\n<p>After clicking on the above it should open something like:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28476\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Sysdig-Cloud6.png\" alt=\"Sysdig Cloud6\" width=\"766\" height=\"541\" \/><\/p>\n<p>It gives you 4 main topics inside which you can choose some options. Two of them are in the above image. Choosing the metrics depends on the use-case. \u00a0You can choose metrics like cpu,\u00a0memory etc. \u00a0We would be interested in the Docker part of the alerting.One of the options which is <strong>Entity is Down <\/strong>can be put to containers too and other such metric that Sysdig gives us is <strong>Container Count.\u00a0<\/strong><\/p>\n<p>[js]container.count<br \/>\nCount of the number of containers. [\/js]<\/p>\n<p>After choosing container.count we have some more options to choose from like:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28487\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Sysdig-Cloud71.png\" alt=\"Sysdig Cloud7\" width=\"762\" height=\"577\" \/><\/p>\n<p>I have added the container IDs in the scope as well using the &#8220;<strong>+<\/strong>&#8221; sign in the scope. Now, I have selected the condition if Average count &lt;= 2 i.e. average count of containers on my host machine don&#8217;t fall in this condition it should alert me. I have selected 2 here because I have only 2 containers running on my host machine. I want to be alerted if the containers count reduces. The next two options Topics are as below and are easy to understand:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-28481\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Screenshot-from-2015-10-18-155000.png\" alt=\"Screenshot from 2015-10-18 15:50:00\" width=\"628\" height=\"339\" \/><br \/>\nAfter you are done just select on CREATE as shown in an earlier image.<\/p>\n<h4>Now, you can put on individual containers.<\/h4>\n<p>Select the container this time and click on the Add Alert button as we did in the previous step. It will again open something like this:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28489\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Sysdig-Cloud8.png\" alt=\"Sysdig Cloud8\" width=\"767\" height=\"545\" \/><\/p>\n<p>It will already have the container ID in the scope. Now, I can monitor if my Docker container is down. I can go go ahead and choose <strong>Entity is Down\u00a0<\/strong>and set an alert for that. If containers within the scope are down I will be alerted. Also, I can now get all insights of my Docker containers.<\/p>\n<p>I personally found Sysdig a good way to monitor my Docker containers. I will be working with more Docker tools. Stay tuned for my new blogs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sysdig has been one of the most advanced cloud-based tools for monitoring your infrastructure. So, talking about Docker monitoring, Sysdig gives us a lot of insights about our containers, few of which we will be talking about in this blog. Docker is the most widely used and trending tool when it comes to DevOps. USE-CASE [&hellip;]<\/p>\n","protected":false},"author":174,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":1},"categories":[1174,2348],"tags":[248,2414,1892,2774,2776,2777,2775,1883,2653,2780,2758,2779,2778,2781,2772,2412,2773,2729,2368,2558,1499,1718,2770,2771],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/28439"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/174"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=28439"}],"version-history":[{"count":1,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/28439\/revisions"}],"predecessor-version":[{"id":54557,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/28439\/revisions\/54557"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=28439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=28439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=28439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}