How I added Grafana+Collectd monitoring to this blog

Ever wondered what goes on under the hood of your server while its dealing with requests and carrying out processing. Find out how and why Grafana+collectd are your friends.

The plan

I require the ability to view what is actually happening on my box at any given time without having to SSH onto the box.

Problems off the bat:

My AWS EC2 instance is not just using an old architecture (its 32-bit) but its also using a Linux OS which is 3.5 years old (Ubuntu 12.04).
With more up-to-date OS it is a lot easier to setup Grafana+Collectd system. Essentially its just a couple of ‘apt-get installs’.

Dependencies:

The packages I require are:
- Graphite (front-end, interacts with carbon)
- Carbon (backend db for stats)
- Whisper (backend lib for db)
- Collectd (watches system and sends data to carbon)
- Grafana 2.0 (front-end, sits in front of graphite)

Guide:

Install/setup Whisper, Carbon and Graphite from this gist
Its useful to send some test data to Graphite to check it works with

echo "test.stats 42 `date +%s`" | nc localhost 2003

Install/setup Collectd from here.
The config for collectd will need to be configured to set stats to Graphite and what stats. An example can be found here.
Download the 32-bit Grafana 2 RPM from here
Convert it to .deb (using alien) and install it.

Why Graphana 2.0 is important:

Grafana 1 uses Elasticsearch to store its dashboards. Elastcisearch requires the JVM and at least 256MB of memory assigned to it. This is quite un-necessary for something which will only be storing a couple of KB workth of data.
Grafana 2.0 is considerable better, it comes with its own sqlite3 store which it can install itself.

What do I use it for?

Viewing CPU and memory usage over long periods of time, combined with Load averages.
Can monitor how many connections are currently open for the internal applications like MySql, Varnish, Apache and Node.
This all helps me profile how the box acts when its dealing with requests. Which could point out any issues or performance bottle-necks.

Final product

Graphs, beautiful graphs.
Grafana+collectd dashboard

1 thoughts on "How I added Grafana+Collectd monitoring to this blog"

rahul kumar sharma

i want to monitor apache and tomcat through grafana. please suggest.

Leave a Reply