A few weeks ago, I talked about how Kinvey’s analytics help developers gain insight into their app’s usage. This insight is important, because it is a key factor in improving any product or service offering. Here, at Kinvey, we are committed to tracking every aspect of our service’s behavior in order to serve our customers better.
Visualizing your metrics is just as important as collecting them. We decided to use the awesome open source tool, graphite to help us visualize our application and system metrics. We also decided to leverage the fantastic work done by Etsy and use statsd, their simple node.js daemon that collects and aggregates metrics via UDP and flushes them to graphite.
The flexibility offered by open source tools is often counterbalanced by the difficulty involved in setting them up. I thought it might be useful to document and share my learnings around installing and configuring graphite and statsd on Ubuntu 12.04 LTS and hope that it may benefit others.
- The install process assumes that you are running statsd and carbon/graphite-web on the same server
- The installation configuration for graphite currently has hardcoded paths to /opt/graphite. It is possible to change this but would require modification to the graphite installation scripts.
The following gist has all the steps to install and configure graphite and statsd.
To test your installation, do the following:
cd /opt/graphite && sudo ./bin/carbon-cache.py –debug start
cd /opt/graphite && sudo ./bin/run-graphite-devel-server.py .
cd /opt/statsd && node ./stats.js ./localConfig.js
Run the example client (any one will suffice, python client shown here):
cd /opt/statsd/examples && python ./python_example.py
Point your web browser at to bring up the graphite webapp and start creating graphs!
We are using the development server that comes with Django to serve the graphite webapp. In production, you would likely replace it with a combination like Apache + mod_wsgi or nginx + gunicorn.