May 22, 2015
We've all been exploring Docker lately, and back in March, we published Monitoring Docker with docker-scout with how to get started with Scout and Docker.
Today, we are excited to announce that we updated this container to include StatsD. Just like in our previous post, Rails App Monitoring (APM) with StatsD, we've made StatsD ridiculously easy to setup. Simply add the
scout-docker container to your existing infrastructure and quickly start working with StatsD across all your containers. Here's how it works:
1Create a configuration file
Create a file called
scoutd.yml (or copy our template). Your account_key is required, all other values are optional.
2Run the docker image
Run the scout image, mounting the
scoutd.yml file. Running the image will first download the image, if it is not already locally available. Run the following command in the directory containing your
docker run -d --name scout-agent \ -v /proc:/host/proc:ro \ -v /etc/mtab:/host/etc/mtab:ro \ -v /var/run/docker.sock:/host/var/run/docker.sock:ro \ -v `pwd`/scoutd.yml:/etc/scout/scoutd.yml \ --net=host --privileged scoutapp/docker-scout
Full docker-scout docs are on our help site.
First, log into the scout-agent container via this command:
docker exec -it scout-agent /bin/bash
Next, let's send some
foo to our StatsD instance.
echo "foo:1|c" | nc -u -w0 172.17.42.1 8125
Repeat that command a few times, just to make sure we're reporting lots of
foo. Jump over to your Scout account and you'll see
foo as a custom metric in your docker host server page.
Sending metrics from inside the
scout-docker container proves basic functionality - but the rubber really hits the road when we can start sending StatsD metrics from other containers.
We're going to take advantage of the IP address that Docker uses internally to communication between containers. The default
scoutd.yaml file is already setup to handle this.
Next, log into one of your other containers, and send this command a few times:
echo "bar:1|c" | nc -u -w0 172.17.42.1 8125
Give it a minute or so and there's our
bar metric ready for action!
Note: For any existing containers that are already using StatsD, you'll have to update their StatsD IP address to point to the scoutd aggregator at 172.17.42.1.
As with any metric in Scout, you can now setup triggers (to generate alerts) on these new custom metrics. Our previous post had a great example if you need a quick refresher.
As you can tell, we think StatsD is awesome! We're having a lot of fun seeing where it can be used and how we can provide more value to our customers.
With one simple
docker run command, and minimal configuration, we've been able to add powerful, customizable metrics to any existing Docker infrastructure.
Questions? Shoot us an email at firstname.lastname@example.org or open an issue. Full help documentation is available on our help site.
Keep up with future posts by following us on Twitter.