Dive Into Graphite And Grafana

Denis Trifonov, 2GIS

Dive Into Graphite
And Grafana

Denis Trifonov

2GIS Logo

About me

QA engineer at load testing team

About organization

Services

Load Testing

Previously we generated load by Yandex.Tank. Also we used it's console output and built-in reports for analysis.

Problems

Effects

“We need tools for organizing
load testing, automation and
integration with CI/CD”

Graphite

Yandex.Tank and Graphite

Graphite — enterprise-scale monitoring tool for metrics store and graphs rendering. Yandex.Tank has a built-in Graphite support.

Graphite Components

Carbon

Carbon is receiving metrics over the network, caching them in memory for “hot queries” from the Graphite-Web application, and persisting them to disk using the Whisper or Ceres time-series library

Carbon Pipeline

Whisper

Whisper is a fixed-size database, similar in design and purpose to RRD (round-robin-database). It provides fast, reliable storage of numeric data over time. Whisper allows for higher resolution (seconds per point) of recent data to degrade into lower resolutions for long-term retention of historical data.

Whisper

Ceres

Ceres is a time-series database format intended to replace Whisper as the default storage format for Graphite. In contrast with Whisper, Ceres is not a fixed-size database and is designed to better support sparse data of arbitrary fixed-size resolutions. This allows Graphite to distribute individual time-series across multiple servers or mounts.

Supports in megacarbon Carbon git branch.

Ceres

Graphite-Web

A Django webapp that renders graphs on-demand using Cairo. As you send datapoints to Carbon, they become immediately available for graphing in the webapp. The webapp offers several ways to create and display graphs including a simple URL API for rendering that makes it easy to embed graphs in other webpages.

Graphite components

Image from github.com/graphite-project/graphite-web/blob/77889afaa9adca7d77dc90ab64af3810374498cd/README.md

Setup

Ansible roles will be in public (on GitHub) later.

Default Configuration

# daemon.conf
PIPELINE = write

# db.conf
DATABASE = ceres
LOCAL_DATA_DIR = /opt/graphite/storage/ceres/

Default Configuration

# listeners.conf
[plaintext-receiver]
port = 2003
type = plaintext-receiver
[pickle-receiver]
port = 2004
type = pickle-receiver

Default Configuration

# storage-rules.conf
[defaults]
match-all = true
retention = 1m:30d
aggregation-method = average

Default Configuration

# writer.conf
CACHE_QUERY_PORT = 7002

# When using Ceres you should set this to a much higher
# value like 1000, if using Whisper - set this value low
# (like at 50)
MAX_CREATES_PER_MINUTE = 1000

Default Configuration

# local_settings.py
STORAGE_FINDERS = ('graphite.finders.ceres.CeresFinder',)
# CLUSTER_SERVERS = []
CARBONLINK_HOSTS = ['127.0.0.1:7002:cache0']
		

Using (Live Demo)

Scaling

You may add more Carbon cache daemons for full utilization of CPU resources and disk IO on same node, add new Graphite nodes to cluster and top-level Carbon relay daemons (or aggregation layer), setup replication and other. It's up on you.

Graphite cluster with two nodes

Image from www.slideshare.net/AnatolijDobrosynets/graphite-cluster-setup-blueprint

Graphite cluster with three nodes

Image from www.slideshare.net/AnatolijDobrosynets/graphite-cluster-setup-blueprint

Graphite cluster with three nodes and aggregation layer

Image from www.ericholzbach.net/blog/creating-a-scalable-graphite-cluster.html

Summary

Grafana

Graphite-Web UI Alternatives

See all on graphite.readthedocs.org/en/latest/tools.html#visualization

Grafana

An open source, feature rich metrics dashboard and graph editor for Graphite, InfluxDB & OpenTSDB

Feature Highlights

Rich Graphing

Live demo play.grafana.org/#/dashboard/db/graph-styles

Dashboards

Live demo play.grafana.org/#/dashboard/db/templated-graphs-nested

Scripted Dashboards

dashboard.rows.push({
	panels: [{
		targets: [{
			'target': 'test.app.some.metrics'
		}]
	}]
});

URL: http://grafana_url/#/dashboard/script/scripted.js?foo=bar

Graphite Query Editor

Live demo play.grafana.org/#/dashboard/db/graphite-carbon-metrics

Annotations

Live demo play.grafana.org/#/dashboard/db/annotations

Summary

Graphite + Grafana
=
Graphitafana

Links

Denis Trifonov

de.trifonov@2gis.ru
dentrifonov.github.io

Thanks!

2GIS Logo