Even though Graphite does very decent job in displaying individual metrics graphs, its dashboards support is quite limited. Of cause, we could take its powerful Render URL API and build anything we like in good old HTML, but on the other hand, there’s Grafana.
Grafana is metric visualization suite. Like collectd focuses at collecting data, and Graphite at storing that data and building graphs, Grafana focuses solely at visuals and dashboards, and does it insanely well. People often need to change graph display period? No problem, let’s put date range selector with reasonable defaults to the most noticeable place. What? Those dashboards will go to big screens and projectors? No problem. Let’s pay close attention to fonts and colors and dynamically switch between dashboards and date ranges. And yes, if somebody asks, here’re text panels to put some description to of what exactly we display.
Installers exist for everything, including Windows. But by far the easiest way to give it a try on local machine is through Docker. There’s official Docker image and
docker run -d -p3000:3000 grafana/grafana will launch Grafana fully configured at port 3000.
However, without any data source, staring at Grafana’s dark background might be depressing. So, unless you installed collectd and Graphite locally, the best way to start with Grafana is through live demo site. It has some features, like data sources editing, unavailable, but it’s still colorful and clickable enough for demo purposes.
As Grafana focuses at UI only, it needs some external data sources to display data from. It comes with support of sources like Graphite, InfluxDB and Prometheus, but can support many more through plugins.
Assume you started Grafana in Docker container and coincidently there’s running
graphite container nearby with Graphite-web at port 80 inside. If that ever happens to you, this is what might bring those two together and allow you yo build some dashboards:
Grafana’s dashboards can access data source directly from the browser (“direct”), or let the web server to be a proxy to it (“proxy”). As I don’t believe in cross-domain requests, my “Access” setting is always “proxy”.
After you have configured source of data, it’s time to build some dashboards. Dashboard is set of rows, each containing one or more panels.
There’re all sorts of panels: graphs, tables, single stat boxes, lists of alerts, and with help of plugins – pie charts, heat maps and lots of others. You can add any combination of those using built in WYSIWYG editor.
Panel’s edit form (click on panel’s title, then ‘edit’) controls both data source and visual styles.
Except for nice looking dashboards there’re some other features that make dashboards really powerful.
Playlists. It’s possible to create a playlist of dashboards, configure refresh interval and then put it onto big screen. That’s really convenient, as many of dashboards in our office, including the one I built, actually iterate through several slides with graphs and numbers.
Date selectors. Obvious feature, but still extremely useful one. There’s ‘zoom out’ button to increase selected time range, mouse selection on the graph to narrow it down, and a drop down list with custom ranges.
Templating and variables. That’s a huge one. We can declare, e.g.
$cpuNumber variable that will hold one of 4 values: 0, 1, 2, 3. After it appears in the top bar as drop down list, we could start using it all over the panels configuration. E.g. put it into data query
collectd.hostname.cpu-$cpuNumber.cpu-user and then whole CPU dashboard could be switched to from
cpu-1 through drop down list. Variables can also hold data series, date ranges, and so forth. Need to switch between data series from two different hosts? Just put their names into a template variable.
Plugins. Whatever is not implemented by Grafana itself can be added via plugins. Data sources, panels, or whole dashboards – you name it.
Alerting. That’s relatively new feature that will send you an email, chat message or HTTP request whenever certain conditions met. E.g. customers spent enough cash on your site for you to retire.
HTTP API. Very same API that drives the UI is available for the end user.
Grafana is a nice suit for visualizing monitoring data and building dashboards. Attention to style is probably its best selling feature. But in my case I don’t think it would add me fundamentally more than I already have with Graphite. Server graph indicating low memory condition does its job well no matter how beautiful its font is. Interestingly enough, the amount of time I spent playing with Grafana’s look an feel is about the same as I spent on building whole dashboard in Graphite from scratch.
However, if style is important for you, requirements to dashboards are high and you have more than one data source, definitely give it a try.