graphite
is the user that runs all graphite related services.
Graphite
NGiNX listens on TCP port 80
- NGiNX conf:
/etc/nginx/sites-enabled/graphite
- init script:
/etc/init/graphite-uwsgi.conf
The graphite stats backend consists of many components to shard, aggregate and relay. For now we only need carbon-cache to receive, and selectively store.
Config files of interest:
/opt/graphite/conf/storage-schemas.conf
for retention of datapoints/opt/graphite/conf/storage-aggregation.conf
for aggregating mins, maxes and averages
Graphite assumes a keyspace seperated by .
. Graphite makes it easy to
collect different datasets with regex patterns
# storage-aggregation.conf
[signups]
pattern = \.signup$
aggregationMethod = sum
Graphite has its own storage engine that uses a filesystem hierarchy to store data. Simply remove files or folders to reset or remove useless data.
Location: /opt/graphite/storage/whisper
To get data to the server from other servers we use a program called statsite. It is interface between other servers and clients to Graphite.
statsite listens on UDP port 8126. There are many server implimentations of statsite, all of them made to work with Graphite. The first one was from Etsy written in node.js. I went for a <www.github.com/kiip/statsite>, a well written Python server. It is not super fast, but will do for now. It has been superceded by a C implimentation of it which I had trouble compiling on Ubuntu but that’ll be the go to solution if we hit scaling troubles with statsite.
See init script /etc/init/statsite.conf
statsite and Graphite support three different datatypes: counters, gauges and timers. Example client code:
# install with pip install statsd
import statsd
c = statsd.StatsClient('graphite') # graphite is the host
c.incr('bar') # Increment counter 'bar'
To use timers and gauges with python-statsd: http://python-statsd.readthedocs.org/en/latest/usage.html
Setup Graphine dashboard interface.