New Relic could be considered the granddaddy of SaaS monitoring tools, chances are that if you are a developer you will have heard of New Relic. It has been around for a while and it is the standard to which other SaaS tools compare themselves.
New Relic has grown into several products over the year, currently, they offer:
Rather than looking at all of these offerings that give us an insight into what is happening with our Docker-based code, as that's probably a whole module on its own, we are going to take a look at the server product.
The server monitoring service offered by New Relic is available free of charge, you just need an active New Relic account, you can sign up for an account at https://newrelic.com/signup/ details on New Relics pricing can be found at their homepage at http://newrelic.com/.
Like the other SaaS offerings we have looked at in this chapter, New Relic Servers has a host-based client, which needs to be able to access the Docker binary. To install this on a CentOS machine, run the following:
yum install http://download.newrelic.com/pub/newrelic/el5/i386/newrelic-repo-5-3.noarch.rpm yum install newrelic-sysmond
For Ubuntu, run the following command:
echo 'deb http://apt.newrelic.com/debian/ newrelic non-free' | sudo tee /etc/apt/sources.list.d/newrelic.list wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add - apt-get update apt-get install newrelic-sysmond
Now that you have the agent installed, you need to configure the agent with your license key. You can do this with the following command and make sure that you add your license, which can be found in your settings page:
nrsysmond-config --set license_key= wn5AYlhjRhgn3shcjW14y3yOT09WsF7d
Now that the agent is configured, we need to add the newrelic
user to the docker
group so that the agent has access to our container information:
usermod -a -G docker newrelic
Finally, we need to start the New Relic Server agent and restart Docker:
/etc/init.d/newrelic-sysmond restart /etc/init.d/docker restart
You should see your server appear on your New Relic control panel after a few minutes.
Once you have the New Relic server agent installed, configured, and running on your host machine, you will see something similar to the following screenshot when clicking on Servers in the top menu:
Selecting the server will allow you to start exploring the various metrics that the agent is recording:
From here, you have the option to drill down further:
As you may have guessed, we are going to be looking at the Docker item next, click on it and you will see a list of your active images:
You may have noticed a difference between New Relic and the other services, as you can see New Relic does not show you the running containers, instead it shows you the utilization by Docker image.
In the preceding screenshot, I have four containers active and running the WordPress installation we have used elsewhere in the module. If I wanted a breakdown per container, then I would be out of luck, as demonstrated by the following screen:
It's a pretty dull screen, but it gives you an idea about what you will see if you are running multiple containers that have been launched using the same image. So how is this useful? Well, coupled with the other services offered by New Relic, it can give you an indication of what your containers were up to when a problem occurred within your application. If you remember the Pets versus Cattle versus Chickens analogy from Chapter 1, Introduction to Docker Monitoring, we don't necessarily care which container did what; we just want to see the impact it had during the issue we are looking into.
Due to the amount of products it offers, New Relic can be a little daunting at first, but if you work with a development team that actively uses New Relic within their day-to-day workflow, then having all of the information about your infrastructure alongside this data can be both valuable and necessary, especially during an issue: