Netdata
First of all you need a running netdata deamon, netdata comes with statsd out of the box. Get it here.
Netdata + statsd documentation can be found at: https://docs.netdata.cloud/collectors/statsd.plugin/
If you don't have a running netdata instance you can follow the next section.
Install netdata using Docker
Netdata has a docker hub repository available for you: https://hub.docker.com/r/netdata/netdata/.
However, we are starting from zero, so we have a custom Dockerfile which copies the ./netdata.conf to the netdata's configuration path, in order to allow netdata statsd to accept UDP packets from the host machine.
[statsd]
...
default port = 8125
bind to = udp:*
See the ./Dockerfile for more details.
Build
$ docker build --tag=netdata-statsd .
Run
$ docker run --rm -it -p 8125:8125/udp -p 19999:19999 netdata-statsd
Execute the command below to start netdata when inside the container:
$ netdata
Running the example
Now, it's time to run our Go + StatsD example, just execute go run main.go.
- The example Go web server runs on
http://localhost:8080
- The netdata's web UI is located at
http://localhost:19999.
- The netdata StatsD plugin listens on
UDP:8125 via the docker container as well.
Do some requests and view the results on the netdata's web UI.
Example screenshot of a "hub." prefix multi-metrics:
