Page MenuHomeDevCentral

Deploy StatsD and Graphite
Open, NormalPublic

Related Objects

StatusSubtypeAssignedTask
DuplicateNone
Opendereckson

Event Timeline

[ Those tasks have been identified as suitable for the next operations sprint. ]

dereckson renamed this task from Deploy graphite to Deploy StatsD and Graphite.Jul 26 2024, 19:13
dereckson claimed this task.
dereckson triaged this task as Normal priority.

The graphite Docker image provides both pieces of software.

Quick test on Dwellers:

Dwellers
$ docker run -d \
 --name graphite \
 --restart=always \
 -p 37180:80 \
 -p 2003-2004:2003-2004 \
 -p 2023-2024:2023-2024 \
 -p 8125:8125/udp \
 -p 8126:8126 \
 graphiteapp/graphite-statsd

$ docker stats graphite
CONTAINER ID   NAME       CPU %     MEM USAGE / LIMIT    MEM %     NET I/O          BLOCK I/O     PIDS
bf6c90268958   graphite   0.77%     215.4MiB / 31.1GiB   0.68%     242kB / 1.59MB   0B / 1.18GB   59

The deployment is clearly "let's use the container as a VM" with runit and 11 services:

Dwellers
$ docker exec -it graphite ps auxw
    1 root      0:00 {entrypoint} /bin/sh /entrypoint
   46 root      0:00 runsvdir -P /etc/service
   48 root      0:02 runsv brubeck
   49 root      0:00 runsv carbon
   50 root      0:00 runsv carbon-aggregator
   51 root      0:02 runsv carbon-relay
   52 root      0:02 runsv collectd
   53 root      0:00 runsv cron
   54 root      0:02 runsv go-carbon
   55 root      0:00 runsv graphite
   56 root      0:00 runsv nginx
   57 root      0:02 runsv redis
   58 root      0:00 runsv statsd
   60 root      0:00 /usr/sbin/crond -f
   62 root      0:00 tee -a /var/log/carbon.log
   63 root      0:00 tee -a /var/log/carbon-relay.log
   64 root      0:01 {gunicorn} /opt/graphite/bin/python3 /opt/graphite/bin/gunicorn wsgi --pythonpath=/opt/graphite/webapp/graphite --preload --threads=1 --worker-class=sync --workers=4 --limit-request-line=0 --max-requests=1000 --timeout=65 -
   65 root      0:09 /opt/graphite/bin/python3 /opt/graphite/bin/carbon-cache.py start --debug
   66 root      0:00 tee -a /var/log/carbon-aggregator.log
   68 root      0:01 python3 /opt/graphite/bin/carbon-aggregator.py start --debug
   73 root      0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
   74 root      0:00 tee -a /var/log/statsd.log
   77 root      0:00 statsd /opt/statsd/config/udp.js
   88 nginx     0:00 nginx: worker process
   89 nginx     0:00 nginx: worker process
   90 nginx     0:00 nginx: worker process
   91 nginx     0:00 nginx: worker process
  161 root      0:00 {gunicorn} /opt/graphite/bin/python3 /opt/graphite/bin/gunicorn wsgi --pythonpath=/opt/graphite/webapp/graphite --preload --threads=1 --worker-class=sync --workers=4 --limit-request-line=0 --max-requests=1000 --timeout=65 -
  162 root      0:01 {gunicorn} /opt/graphite/bin/python3 /opt/graphite/bin/gunicorn wsgi --pythonpath=/opt/graphite/webapp/graphite --preload --threads=1 --worker-class=sync --workers=4 --limit-request-line=0 --max-requests=1000 --timeout=65 -
  163 root      0:00 {gunicorn} /opt/graphite/bin/python3 /opt/graphite/bin/gunicorn wsgi --pythonpath=/opt/graphite/webapp/graphite --preload --threads=1 --worker-class=sync --workers=4 --limit-request-line=0 --max-requests=1000 --timeout=65 -
  164 root      0:00 {gunicorn} /opt/graphite/bin/python3 /opt/graphite/bin/gunicorn wsgi --pythonpath=/opt/graphite/webapp/graphite --preload --threads=1 --worker-class=sync --workers=4 --limit-request-line=0 --max-requests=1000 --timeout=65 -
13899 root      0:00 ps auxw

Not sure it's worthwile to spend time to split into different containers and services à la Sentry. Project ships a docker-compose with only that only image at https://github.com/graphite-project/docker-graphite-statsd/blob/master/docker-compose.yml.

To keep data, we need to check the volume configuration. So this instance is currently test only.

Most ports will can be bound to local IP.e

Port 37180 for Web UI has been chosen as this instance is devised for Notifications Center: as a PHP application, it can't easily maintain state, and so Prometheus-style format for metrics isn't the most convenient way. So StatsD.

To send a counter, send the metric to UDP port 8125:

echo "quux_reported:1|c" | nc -u -w0 172.27.27.4 8125

It seems the increment is of 0.1 instead of 1.

Grafana can easily show those metrics in explorer, ask graphite-dwellers at https://grafana.nasqueron.org/explore