Panamax Docker Application Template with cAdvisor, ElasticSearch, Grafana, and InfluxDB

Panamax just released from Lucas Carlson and his team at CenturyLink Labs. They’ve created a contest for putting together the best Panamax templates, with various categories being judged. They’re giving over $100,000 worth of prizes. Definitely check it out when you have a chance! Today is the last day to submit!

I had recently talked about using cAdvisor to monitor Docker containers. But as I mentioned, running cAdvisor provides ephemeral data for your containers. For this data to be truly valuable, it needs to be logged in a database. And once we have that data logged in a database, wouldn’t it be nice to view it in a nicely charted graph? My thoughts exactly 🙂

The power of Panamax comes from application templates. Templates are similar to fig files, but once you define your application template it can be shared with anyone. You can even search the database to find publicly available templates built by others. Now all of your hard work configuring and tweaking each of your images won’t be in vain. You just have to get it working once, and now you can reproduce the exact same technology stack on demand.

cAdvisor doesn’t record data historically. We modified it so that when it’s first launched with a Docker link it will automatically connect to InfluxDB and use it as its datastore backend.

Our modified version of cAdvisor saves the step of having to normally pass flags from cAdvisor to InfluxDB to connect the two.

Why use Grafana? Doesn’t InfluxDB have an interface? Grafana let’s us store our searches, and display the results in pretty looking graphs.

So the first step is to fire up Panamax. You can find the install directions here.

Get started with:

panamax init

Once it has successfully launched, a new browser window will be automatically opened to:

localhost:8888

Panamax Dashboard

Now we need to load the proper source repositories. Just click on the Manage tab and type in the repository name.

We’ll be adding:

kickingthetv/panamax-contest-templates

Panamax Sources

Next we’re going to set up our ports. We’ll be forwarding our virtual box ports to match the ports ElasticSearch, Grafana, and InfluxDB listen on.

I’ll launch virtualbox by just typing in the terminal: virtualbox

VirtualBox Dashoard We’ll head over to panamax-vm and click Settings then Network then Port Forwarding.
Panamax VM

From there click on the little green + icon and we’ll be adding in three port mappings:

ElasticSearch: 9200:9200

Grafana: 80:80

InfluxDB: 8086:8086

Once you’re done it should look like this:

VirtualBox Port Forwarding

Now that we’re all setup, we’ll head back over to our browser where we have Panamax running. Now we have to search and find the template that I created. It’s called cAdvisor Suite.

Panamax Search

Go ahead and click on Run Template

You’ll be taken to the Application Services Dashboard. Another neat aspect of Panamax is the ability to drag and drop services into different categories that you can custom name.

I went ahead and assigned InfluxDB to Database, cAdvisor to Application, ElasticSearch to Analytics and Grafana to Frontend.

Panamax cAdvisor

We’re going to mouse over Grafana and click on the little magnifying glass on the right-hand side.

Panamax Grafana Info

From here we can see which port our service is listening on.

Panamax Grafana Ports

Scrolling down on the right hand side, we can see all of the passwords for each of our services. Make sure to take note of the Grafana username and password.

Panamax Grafana Password

Next we’re going to access Grafana. Go to your web browser and type in: localhost:80

You’ll be prompted for your Grafana username and password. Once you successfully login you’ll be brought to Grafana’s Dashboard. The dashboard may not initially show up and the screen will remain blank. If this happens just hit refresh on your browser and it should pop right up.

Grafana Docker

Let’s test to see if Grafana is collecting data. Click on the name of the graph, it should be Graphite test, and from the dropdown select Edit.

Click on the Series field and select stats, click on (value) and choose which data you’d like to view. Soon enough your graph will become populated with the data cAdvisor is collecting.

Docker Grafana Graph

I hope you found this helpful! If you have any questions make sure to check out the readme file, and feel free to ask me any questions here!

Tagged with: , , , , , , , , ,
Posted in Tutorial, Uncategorized
11 comments on “Panamax Docker Application Template with cAdvisor, ElasticSearch, Grafana, and InfluxDB
  1. […] wrote another article on how to use cAdvisor with Elasticsearch, Grafana and InfluxDB as part of a Panamax Application Template. This allows you to log and display the metrics cAdvisor […]

  2. Vishnu Kannan says:

    Here is another example of using cAdvisor in a cluster with InfluxDB: https://github.com/GoogleCloudPlatform/heapster

  3. Frank says:

    How do you deal with cpu data? It’s a cumulative number so with mean(cpu_cumulative_usage) you will get a growing slope 😕

  4. david says:

    I have the same issue as Frank’s. How to properly query the CPU from Grafana?

  5. Stefan says:

    @Frank or @David, have you figured it out maybe? I have the same problem.

  6. Do you know how to get %cpu per core using grafana or influxdb? thanks

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories
%d bloggers like this: