Docker Monitoring Using New Relic

30 / Dec / 2015 by Ranvijay Jamwal 1 comments

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 Relic.


How to go about starting the New Relic monitoring for Docker:


1. Firstly you would need to update your apt sources list which can be done by using the following command:

echo deb newrelic non-free >> /etc/apt/sources.list.d/newrelic.list

2. Next, is putting the authentication key for the source.list:

wget -O- | apt-key add -

3. Now, just run the next two commands to install the New Relic agent.

apt-get update

apt-get install newrelic-sysmond 

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:
Docker Image inspector for ip 172 31 51 213   New Relic
There on the right-hand side you will find the License key:
Account settings  TO THE NEW_3   New Relic
After you have your license, run the following command:

nrsysmond-config --set license_key=ddbf346exxxxxxxxxxxxxx47b1790c1cb96ed

4. The New Relic agent can now be started by using the command:

/etc/init.d/newrelic-sysmond start

5. One last thing that’s left is 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:

groupadd -r docker

usermod -a -G docker newrelic

service docker restart && /etc/init.d/newrelic-sysmond restart

6. Also, I have run a simple ubuntu container in my host machine using the following command:
Screenshot from 2015-10-18 12:36:21
Then 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:
Screenshot from 2015-10-18 12:41:35

Let’s head on to the New Relic Console to see what insights we have now:

When you open the New Relic console, simply click on the Servers option as shown in the below image:
Account settings  TO THE NEW_3   New Relic1

This will take you to the servers page where all your servers on which New Relic agent is running will be shown:
All servers   New Relic1

I will click on the server apachecon. This is the server inside which our container is working. After clicking on this, it will open this specific server’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.

The overview gives you a brief of everything like in the image below which is self-descriptive:
Screenshot from 2015-10-22 13:50:36

Now, Click on Processes and it will show you processes based on memory usage:
Screenshot from 2015-10-22 13:52:09

If you wish to list processes based on CPU:
Screenshot from 2015-10-22 13:52:27

Let’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:
Screenshot from 2015-10-22 13:56:27

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  you click on the image name:
Docker Image inspector for ip 172 31 51 213   New Relic

It shows you:
Screenshot from 2015-10-22 14:00:55

The above is again very simple to understand. That is all this Docker option here gives us. The 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:
Docker Image inspector for ip 172 31 51 213   dsdsNew Relic

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.
Screenshot from 2015-10-22 14:02:12

You can select any plugin:
Plugin Central   New Relic

It will show you all the steps on how to go about it:
Screenshot from 2015-10-22 14:03:49

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.


comments (1 “Docker Monitoring Using New Relic”)

Leave a comment -