Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add compose file and elaborate in README #86

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,57 @@ Usage of ./statsdaemon:
-tcpaddr="": TCP service address, if set
-version=false: print version string
```

Docker Compose Playground
=========================

To try out the daemon, one can start a backend and frontend as Docker Services. For it to work a Docker SWARM is needed.

```
$ docker swarm init
```

After the initialisation, just start the services using the docker-cli.

```
$ docker stack deploy -c docker-compose.yml $(basename ${PWD})
Creating service statsdaemon_frontend
Creating service statsdaemon_influxdb
```
After a couple of seconds grafana4 is available under [localhost:3000](http://localhost:3000) (admin/admin).

Now start the statsdaemon...

```
$ go build
$ ./statsdaemon -address 0.0.0.0:8125
2017/05/16 10:06:12 listening on 0.0.0.0:8125
```

...and begin to push metrics...

```
$ docker run -ti --rm --net=host -e HOST=192.168.1.11 qnib/plain-qframe-client delay.sh 10
> execute CMD 'delay.sh 10'
Send: delay:9000|ms to 192.168.1.11 && sleep 0.9000
Send: delay:7300|ms to 192.168.1.11 && sleep 0.7300
Send: delay:8100|ms to 192.168.1.11 && sleep 0.8100
Send: delay:2500|ms to 192.168.1.11 && sleep 0.2500
Send: delay:4100|ms to 192.168.1.11 && sleep 0.4100
Send: delay:6000|ms to 192.168.1.11 && sleep 0.6000
Send: delay:5200|ms to 192.168.1.11 && sleep 0.5200
Send: delay:6500|ms to 192.168.1.11 && sleep 0.6500
Send: delay:2800|ms to 192.168.1.11 && sleep 0.2800
Send: delay:5300|ms to 192.168.1.11 && sleep 0.5300
```

... the daemon will forward it.

```
2017/05/16 10:06:42 sent 1 stats to 127.0.0.1:2003
2017/05/16 10:06:52 sent 1 stats to 127.0.0.1:2003
2017/05/16 10:07:02 sent 1 stats to 127.0.0.1:2003
2017/05/16 10:07:12 sent 1 stats to 127.0.0.1:2003
```

![](pics/grafana_delay.png)
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3'
services:
influxdb:
image: qnib/plain-influxdb
environment:
- INFLUXDB_META_LOGGING=true
- INFLUXDB_GRAPHITE_ENABLED=true
volumes:
- /opt/influxdb/shared
ports:
- 2003:2003
- 8083:8083
- 8086:8086
frontend:
image: qnib/plain-grafana4
ports:
- 3000:3000
environment:
- INFLUXDB_HOST=statsdaemon_influxdb
- INFLUXDB_DB=graphite
Binary file added pics/grafana_delay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.