Graphite - mwicat/personal GitHub Wiki

Send test metric to graphite

echo "local.random.diceroll 4 $(date +%s)" | nc server 2003

Send test metric to graphite via local statsd

echo "deploys.test.myservice:1|c" | nc -w 1 -u localhost 8125

Dump metric data in whisper

whisper-dump.py /opt/graphite/storage/whisper/mymetric/counters/nginx/response/200/count.wsp

Grep metric for values

wget -q -O- 'http://myhost/render/?target=mymetric.count&format=csv'  | egrep ',1000.0'

Show last 10 values for metric in console

curl 'http://myhost/render/?target=mymetric.counters.nginx.response.200.count&format=csv' -s | tail -10

Remove metric

rm -rf /opt/graphite/storage/whisper/mymetric

If you want to get rid of metric, stop service e.g. diamon from pushing it and also remember to restart statsd because it will keep pushing empty values and thus recreating metric in whisper!

Find metric

curl 'http://yourhost/metrics/find?query=yourpath.*' | jq -r '.[] | .text'

Watch logs

find /opt/graphite -name '*.log' | xargs tail -F

Sniff what is being sent to graphite

tcpdump -s0 -w- tcp dst port 2003 | strings

Sniff what is being sent to statsd

tcpdump -s0 -w- udp dst port 8125 | strings