{"id":28423,"date":"2015-12-30T09:07:01","date_gmt":"2015-12-30T03:37:01","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=28423"},"modified":"2022-01-11T14:18:42","modified_gmt":"2022-01-11T08:48:42","slug":"docker-monitoring-using-new-relic","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/docker-monitoring-using-new-relic\/","title":{"rendered":"Docker Monitoring Using New Relic"},"content":{"rendered":"<p>In my last couple of blogs, I talked about Docker monitoring, why I would need Docker monitoring and how I can monitor Docker containers using <a href=\"http:\/\/www.tothenew.com\/blog\/monitoring-docker-container-status-using-aws-cloudwatch\/\">AWS<\/a>, <a href=\"http:\/\/www.tothenew.com\/blog\/docker-monitoring-using-ruxit\/\">Ruxit<\/a> and <a href=\"http:\/\/www.tothenew.com\/blog\/devops-docker-monitoring-sysdig-cloud\/\">Sysdig<\/a>. Today, we are going to talk about another such tool which most of us already know about which also provides <a title=\"Docker DevOps\" href=\"http:\/\/www.tothenew.com\/devops-chef-puppet-docker\">Docker<\/a> monitoring. The tool is New Relic.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"\/blog\/wp-ttn-blog\/uploads\/2022\/01\/68-scaled.jpg\" alt=\"\"  \/><\/p>\n<p>&nbsp;<\/p>\n<p>How to go about starting the New Relic monitoring for Docker:<\/p>\n<h3><span style=\"text-decoration: underline;\"><strong>Steps<\/strong><\/span><\/h3>\n<p>1. Firstly you would need to update your apt sources list which can be done by using the following command:<\/p>\n<p>[js]echo deb  newrelic non-free &gt;&gt; \/etc\/apt\/sources.list.d\/newrelic.list[\/js]<\/p>\n<p>2. Next, is putting the authentication key for the source.list:<\/p>\n<p>[js]wget -O- https:\/\/download.newrelic.com\/548C16BF.gpg | apt-key add -[\/js]<\/p>\n<p>3. Now, just run the next two commands to install the New Relic agent.<\/p>\n<p>[js]apt-get update<\/p>\n<p>apt-get install newrelic-sysmond\u00a0[\/js]<\/p>\n<p>4. After this, you need to specify the license key. You can find it in account settings which you can find from the drop-down on the right top corner:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28427\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Docker-Image-inspector-for-ip-172-31-51-213-New-Relic.png\" alt=\"Docker Image inspector for ip 172 31 51 213   New Relic\" width=\"280\" height=\"401\" \/><br \/>\nThere on the right-hand side you will find the License key:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28428\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Account-settings-TO-THE-NEW_3-New-Relic.png\" alt=\"Account settings  TO THE NEW_3   New Relic\" width=\"327\" height=\"64\" \/><br \/>\nAfter you have your license, run the following command:<\/p>\n<p>[js]nrsysmond-config &#8211;set license_key=ddbf346exxxxxxxxxxxxxx47b1790c1cb96ed[\/js]<\/p>\n<p>4. The New Relic agent can now be started by using the command:<\/p>\n<p>[js]\/etc\/init.d\/newrelic-sysmond start[\/js]<\/p>\n<p>5. One last thing that&#8217;s\u00a0left\u00a0is creating a docker group if it does not exist already, adding the newrelic user to that group and then restarting the Docker service and New Relic agent which can be done by the following commands in sequence:<\/p>\n<p>[js]groupadd -r docker<\/p>\n<p>usermod -a -G docker newrelic<\/p>\n<p>service docker restart &amp;&amp; \/etc\/init.d\/newrelic-sysmond restart[\/js]<\/p>\n<p>6. Also, I have run a simple ubuntu container in my host machine using the following command:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28434\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Screenshot-from-2015-10-18-123621.png\" alt=\"Screenshot from 2015-10-18 12:36:21\" width=\"787\" height=\"33\" \/><br \/>\nThen I have gone ahead and installed apache2 inside my container. The port mapping 80:80 maps the 80 port of my container with the port 80 of the host machine. What this means is any hit on the port 80 of the host machine will land on the port 80 of the container which should show the apache2 start page:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28435\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Screenshot-from-2015-10-18-124135.png\" alt=\"Screenshot from 2015-10-18 12:41:35\" width=\"809\" height=\"291\" \/><\/p>\n<h3>Let&#8217;s head on to the <strong>New Relic Console<\/strong> to see what insights we have now:<\/h3>\n<p>When you open the New Relic console, simply click on the <strong>Servers\u00a0<\/strong>option as shown in the below image:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28431\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Account-settings-TO-THE-NEW_3-New-Relic1.png\" alt=\"Account settings  TO THE NEW_3   New Relic1\" width=\"1075\" height=\"46\" \/><\/p>\n<p>This will take you to the servers page where all your servers on which New Relic agent is running will be shown:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28436\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/All-servers-New-Relic1.png\" alt=\"All servers   New Relic1\" width=\"1019\" height=\"344\" \/><\/p>\n<p>I will click on the server <strong>apachecon<\/strong>. This is the server inside which our container is working. After clicking on this, it will open this specific server&#8217;s monitoring. In there we can see options like Overview, Processes and Docker. We are interested in these 3 options. We will go through them one by one.<\/p>\n<p>The overview gives you a brief of everything like in the image below which is self-descriptive:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28763\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Screenshot-from-2015-10-22-135036.png\" alt=\"Screenshot from 2015-10-22 13:50:36\" width=\"1348\" height=\"563\" \/><\/p>\n<p>Now, Click on Processes and it will show you processes based on memory usage:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28764\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Screenshot-from-2015-10-22-135209.png\" alt=\"Screenshot from 2015-10-22 13:52:09\" width=\"1346\" height=\"564\" \/><\/p>\n<p>If you wish to list processes based on CPU:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28765\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Screenshot-from-2015-10-22-135227.png\" alt=\"Screenshot from 2015-10-22 13:52:27\" width=\"267\" height=\"89\" \/><\/p>\n<p>Let&#8217;s now, head on to the Docker option and see what New Relic has for us. If you simple click on Docker it gives you a combined graph of all the containers:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28766\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Screenshot-from-2015-10-22-135627.png\" alt=\"Screenshot from 2015-10-22 13:56:27\" width=\"1346\" height=\"545\" \/><\/p>\n<p>New Relic shows containers as a part of the image they were run. You can also view this as a table. So, it wont show you the container name here, rather show you the image name and now, if \u00a0you click on the image name:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28767\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Docker-Image-inspector-for-ip-172-31-51-213-New-Relic1.png\" alt=\"Docker Image inspector for ip 172 31 51 213   New Relic\" width=\"391\" height=\"181\" \/><\/p>\n<p>It shows you:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28768\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Screenshot-from-2015-10-22-140055.png\" alt=\"Screenshot from 2015-10-22 14:00:55\" width=\"1325\" height=\"551\" \/><\/p>\n<p>The above is again very simple to understand. That is all this Docker option here gives us.\u00a0The information they provide on the containers is simply the cpu and memory. It is trivial to determine exactly what the container might be doing, like any regular server, it could be running anything. For example: If an image runs an application, you may want to run one of their APM agents for better insight. So, you could simply head on to plugins:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28769\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Docker-Image-inspector-for-ip-172-31-51-213-dsdsNew-Relic.png\" alt=\"Docker Image inspector for ip 172 31 51 213   dsdsNew Relic\" width=\"1074\" height=\"136\" \/><\/p>\n<p>It has almost every plugin available for you. You can use the search bar to search what you are looking for depending on what is running inside you container. You will need to install New Relic agent inside the container like we did on the host machine earlier and then integrate a plugin with it to see insights in the APM menu where data will be segregated according to server then container ID.<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28770\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Screenshot-from-2015-10-22-140212.png\" alt=\"Screenshot from 2015-10-22 14:02:12\" width=\"1345\" height=\"654\" \/><\/p>\n<p>You can select any plugin:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-28771\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Plugin-Central-New-Relic.png\" alt=\"Plugin Central   New Relic\" width=\"1002\" height=\"428\" \/><\/p>\n<p>It will show you all the steps on how to go about it:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-28772\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/10\/Screenshot-from-2015-10-22-140349.png\" alt=\"Screenshot from 2015-10-22 14:03:49\" width=\"647\" height=\"431\" \/><\/p>\n<p>So, New Relic can help you monitor your Docker container and give you insights in depth. A lot of features are yet to be integrated with New Relic specific to Docker. That should be happening anytime soon.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my last couple of blogs, I talked about Docker monitoring, why I would need Docker monitoring and how I can monitor Docker containers using AWS, Ruxit and Sysdig. Today, we are going to talk about another such tool which most of us already know about which also provides Docker monitoring. The tool is New [&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":5},"categories":[1174,1],"tags":[248,1916,2918,1891,1883,2920,2594,2911,2412,2891,2917,2919],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/28423"}],"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=28423"}],"version-history":[{"count":2,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/28423\/revisions"}],"predecessor-version":[{"id":54560,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/28423\/revisions\/54560"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=28423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=28423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=28423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}