diff --git a/README.md b/README.md index ceeaed8..4771090 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ A collection of delicious docker recipes. - [x] samba :+1: - [x] samba-arm :+1: - [x] scrapyd :+1: +- [x] statsd - [x] swarm-arm - [x] taskd - [x] telegraf diff --git a/graphite/README.md b/graphite/README.md index 3bcdb46..377ebda 100644 --- a/graphite/README.md +++ b/graphite/README.md @@ -13,11 +13,11 @@ graphite graphite: image: vimagick/graphite ports: - - 2003:2003 - - 2004:2004 - - 7002:7002 - - 8080:8080 - - 9001:9001 + - "2003:2003" + - "2004:2004" + - "7002:7002" + - "8080:8080" + - "9001:9001" volumes: - ./data:/opt/graphite/storage restart: always diff --git a/graphite/docker-compose.yml b/graphite/docker-compose.yml index 30b5f98..d8154cc 100644 --- a/graphite/docker-compose.yml +++ b/graphite/docker-compose.yml @@ -1,11 +1,11 @@ graphite: image: vimagick/graphite ports: - - 2003:2003 - - 2004:2004 - - 7002:7002 - - 8080:8080 - - 9001:9001 + - "2003:2003" + - "2004:2004" + - "7002:7002" + - "8080:8080" + - "9001:9001" volumes: - ./data:/opt/graphite/storage restart: always diff --git a/statsd/Dockerfile b/statsd/Dockerfile new file mode 100644 index 0000000..8d07d4a --- /dev/null +++ b/statsd/Dockerfile @@ -0,0 +1,23 @@ +# +# Dockerfile for statsd +# + +FROM alpine +MAINTAINER kev + +ENV STATSD_VERSION 0.8.0 +ENV STATSD_URL https://github.com/etsy/statsd/archive/v$STATSD_VERSION.tar.gz + +WORKDIR /app + +RUN set -xe \ + && apk add --no-cache ca-certificates curl nodejs nodejs-npm tar \ + && curl -sSL $STATSD_URL | tar xz --strip 1 \ + && npm install --production \ + && sed 's/graphite.example.com/graphite/' exampleConfig.js > config.js \ + && apk del curl tar + +EXPOSE 8125/udp +EXPOSE 8126/tcp + +CMD ["node", "stats.js", "config.js"] diff --git a/statsd/READMD.md b/statsd/READMD.md new file mode 100644 index 0000000..06c38dd --- /dev/null +++ b/statsd/READMD.md @@ -0,0 +1,48 @@ +statsd +====== + +[StatsD][1] is a network daemon that runs on the Node.js platform and listens for +statistics, like counters and timers, sent over UDP or TCP and sends aggregates +to one or more pluggable backend services (e.g., [Graphite][2]). + +## docker-compose.yml + +```yaml +statsd: + image: vimagick/statsd + ports: + - "8125:8125/udp" + - "8126:8126/tcp" + links: + - graphite + restart: always + +graphite: + image: vimagick/graphite + ports: + - "2003:2003" + - "2004:2004" + - "7002:7002" + - "8080:8080" + - "9001:9001" + volumes: + - ./data:/opt/graphite/storage + restart: always +``` + +## python client + +```bash +$ pip install statsd +``` + +```python +import statsd +c = statsd.StatsClient('localhost', 8125) +c.incr('foo') # Increment the 'foo' counter. +c.timing('stats.timed', 320) # Record a 320ms 'stats.timed'. +``` + +[1]: https://github.com/etsy/statsd +[2]: http://graphite.readthedocs.org/ +[3]: http://statsd.readthedocs.io/ diff --git a/statsd/docker-compose.yml b/statsd/docker-compose.yml new file mode 100644 index 0000000..5aea8c2 --- /dev/null +++ b/statsd/docker-compose.yml @@ -0,0 +1,20 @@ +statsd: + image: vimagick/statsd + ports: + - "8125:8125/udp" + - "8126:8126/tcp" + links: + - graphite + restart: always + +graphite: + image: vimagick/graphite + ports: + - "2003:2003" + - "2004:2004" + - "7002:7002" + - "8080:8080" + - "9001:9001" + volumes: + - ./data:/opt/graphite/storage + restart: always