Skip to content

Instantly share code, notes, and snippets.

@oprietop
Last active April 1, 2022 08:59
Show Gist options
  • Save oprietop/bbb7028dee378fb18452d8c78fffecb8 to your computer and use it in GitHub Desktop.
Save oprietop/bbb7028dee378fb18452d8c78fffecb8 to your computer and use it in GitHub Desktop.
Compose file to run and test graphiteapp/graphite-statsd
# Links:
# https://hub.docker.com/r/graphiteapp/graphite-statsd/
# https://github.com/kiwigrid/helm-charts/blob/master/charts/graphite/values.yaml
# https://github.com/grobian/carbon-c-relay/blob/master/Dockerfile
#
# Usage:
# git clone https://github.com/grobian/carbon-c-relay.git
# docker-compose up -d
#
# Test:
# navigate to http://X.X.X.Xii:8081/?target=test.graphite*.random.diceroll&from=-2minutes
#
# List of possible default ports for graphite-statsd:
# ports:
# - 80:80
# - 8080:8080
# - 2003-2004:2003-2004
# - 2013-2014:2013-2014
# - 2023-2024:2023-2024
# - 8125-8126:8125-8126
# - 8125:8125/udp
version: "3.5"
services:
dummydata:
image: graphiteapp/graphite-statsd:latest
restart: always
environment:
TZ: /usr/share/zoneinfo/Europe/Madrid
entrypoint:
- /bin/sh
- -c
- |
while true
do
sleep 1
echo "test.graphite1.random.diceroll $${RANDOM} `date +%s`" | nc -v -w0 relay 2003
echo "test.graphite2.random.diceroll $${RANDOM} `date +%s`" | nc -v -w0 relay 2003
echo "test.graphite3.random.diceroll $${RANDOM} `date +%s`" | nc -v -w0 relay 2003
done
relay:
build: carbon-c-relay/.
restart: always
environment:
TZ: /usr/share/zoneinfo/Europe/Madrid
entrypoint:
- /bin/sh
- -c
- |
cat << EOF > /etc/carbon-c-relay/carbon-c-relay.conf
# Clusters
cluster g1 forward graphite1;
cluster g2 forward graphite2;
cluster g3 forward graphite3;
# Matches
match ^test\.graphite1\. send to g1 stop;
match ^test\.graphite2\. send to g2 stop;
match ^test\.graphite3\. send to g3 stop;
EOF
/usr/bin/carbon-c-relay -f /etc/carbon-c-relay/carbon-c-relay.conf
graphite1:
image: graphiteapp/graphite-statsd:latest
restart: always
environment:
TZ: /usr/share/zoneinfo/Europe/Madrid
GRAPHITE_CLUSTER_SERVERS: graphite1:80,graphite2:80,graphite3:80
ports:
- 8081:80
volumes:
- ./graphite1/configs:/opt/graphite/conf
- ./graphite1/data:/opt/graphite/storage
- ./graphite1/log:/var/log
- ./graphite1/statsd_config:/opt/statsd/config
graphite2:
image: graphiteapp/graphite-statsd:latest
restart: always
environment:
TZ: /usr/share/zoneinfo/Europe/Madrid
GRAPHITE_CLUSTER_SERVERS: graphite1:80,graphite2:80,graphite3:80
ports:
- 8082:80
volumes:
- ./graphite2/configs:/opt/graphite/conf
- ./graphite2/data:/opt/graphite/storage
- ./graphite2/log:/var/log
- ./graphite2/statsd_config:/opt/statsd/config
graphite3:
image: graphiteapp/graphite-statsd:latest
restart: always
environment:
TZ: /usr/share/zoneinfo/Europe/Madrid
GRAPHITE_CLUSTER_SERVERS: graphite1:80,graphite2:80,graphite3:80
ports:
- 8083:80
volumes:
- ./graphite3/configs:/opt/graphite/conf
- ./graphite3/data:/opt/graphite/storage
- ./graphite3/log:/var/log
- ./graphite3/statsd_config:/opt/statsd/config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment