1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-11-30 09:16:58 +02:00

add statsd

This commit is contained in:
kev 2017-06-28 18:03:57 +08:00
parent 2deb96b171
commit 072b6eb9e1
6 changed files with 102 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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

23
statsd/Dockerfile Normal file
View File

@ -0,0 +1,23 @@
#
# Dockerfile for statsd
#
FROM alpine
MAINTAINER kev <noreply@easypi.pro>
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"]

48
statsd/READMD.md Normal file
View File

@ -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/

20
statsd/docker-compose.yml Normal file
View File

@ -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