Time Serie - Graphite (Storage and Visualization)

> (Data|State) Management and Processing > (Data Type|Data Structure) > Time > Time Series

1 - About

Graphite does two things:

  • Store numeric time-series data
  • Render graphs of this data on demand

The inherent scheme of organization in graphite is tree-like and hence the searches do-not/ can-not yield results from a different subtree. This makes it not-so-suitable for cross-dimensional searches.

Advertising

3 - Tools

4 - Docker

 docker run -d --name=graphite -p 80:80 -p 2003:2003 -p 2004:2004 -p 7002:7002 nickstenning/graphite

where:

  • 80: the graphite web interface
  • 2003: the carbon-cache line receiver (the standard graphite protocol)
  • 2004: the carbon-cache pickle receiver
  • 7002: the carbon-cache query port (used by the web interface)

Then:

  • Login to the graphite-web (a Django application) to http://dockerhost:80 with the username admin and password admin
  • Graphite HOME is: /var/lib/graphite

5 - Graphite Message Format

Graphite understands messages with this format:

metric_path value timestamp\n

where:

  • metric_path is the metric namespace that you want to populate.
  • value is the value that you want to assign to the metric at this time.
  • timestamp is the unix epoch time in second !
Advertising

6 - Data

  • Adding a metric
echo ${METRIC_NAME} ${METRIC_NUMBER} ${TIMESTAMP} | nc ${CARBON_HOST} ${CARBON_PORT}
 
# Example
echo "foo.bar 1 `date +%s`" | nc localhost 2003

where:

  • foo.bar is the qualified named metric. bar is the name and foo its namespace. Graphite uses a dot-delimited namespace structure for metrics, graphs, and even dashboards
  • nc: nc localhost 2003 creates a TCP connection to the port 2003 on the localhost. The standard input (ie foo.bar 1 1482334814) is sent to the host, and anything that comes back across the connection is sent to the standard output.

This metric would be stored in a Whisper database (wsp) at <prefix>/storage/whisper/foo/bar.wsp (Graphite prefix default to /opt/graphite).

7 - Rendering

8 - Start

Carbon can be started with the carbon-cache.py script:

GRAPHITE_HOME/bin/carbon-cache.py start

This starts the main Carbon daemon in the background.

9 - Log

Logs are located in GRAPHITE_HOME/storage/log/carbon-cache/ for any errors.

Advertising