Based on: https://github.com/hopsoft/docker-graphite-statsd many thanks!
Graphite & Statsd & Grafana can be complex to setup. This image will have you running & collecting stats in just a few minutes.
sudo docker build -t graphite .
sudo docker run -d --name graphite --net host graphiteThis starts a Docker container named: graphite
That's it, you're done ... almost.
- Nginx - reverse proxies the grafana & graphite dashboards
- Grafana - nicer graphing dashboard
- Graphite - graphite native dashboard
- Carbon - graphite back-end
- Statsd - UDP based back-end proxy
| Host | Container | Service |
|---|---|---|
| 80 | 80 | nginx/grafana |
| 81 | 81 | nginx/graphite |
| 2003 | 2003 | carbon |
| 8125 | 8125 | statsd |
grafana/dashboards:/opt/grafana/app/dashboards
graphite/config:/opt/graphite/conf
graphite/storage:/opt/graphite/storage
logs:/var/log
Built using Phusion's base image.
- All Graphite related processes are run as daemons & monitored with runit.
- Includes additional services such as logrotate.
Let's fake some stats with a random counter to prove things are working.
while true
do
echo -n "example.statsd.counter.changed:$(((RANDOM % 10) + 1))|c" | nc -w 1 -u localhost 8125
done
<CTL-C>Open Grafana in a browser at http://localhost. Open Graphite in a browser at http://localhost:81.
Elastic search is not installed in this image, hence the dashboards are to be created or updated, then exported as JSON files. Base on the default dashboard http://localhost/#/dashboard/file/default.json for example, add/update the graphs, then export to mydashboard.json for instance, save it in the directory which is mounted to /opt/grafana/app/dashboards in the container. Open http://localhost/#/dashboard/file/mydashboard.json in a browser to view the new dashboard.
Update the default Django admin user account. The default is insecure.
- username: root
- password: root
- email: admin@admin.com
First login at: http://localhost/account/login Then update the root user's profile at: http://localhost/admin/auth/user/1/
Read up on Graphite's post-install tasks. Focus on the storage-schemas.conf
- Stop the container
docker stop graphite. - Find the configuration files on the host by inspecting the container
docker inspect graphite. - Update the desired config files.
- Restart the container
docker start graphite.
Note: If you change settings in /opt/graphite/conf/storage-schemas.conf
be sure to delete the old whisper files under /opt/graphite/storage/whisper/.
Important: Ensure your Statsd flush interval is at least as long as the highest-resolution retention.
For example, if /opt/statsd/config.js looks like this.
flushInterval: 10000
Ensure that storage-schemas.conf retentions are no finer grained than 10 seconds.
[all]
pattern = .*
retentions = 5s:12h # WRONG
retentions = 10s:12h # OK
retentions = 60s:12h # OK
If running this image on cloud infrastructure such as AWS,
you should consider mounting /opt/graphite/storage & /var/log on a larger volume.
-
Configure the host to mount a large EBS volume.
-
Specify the volume mounts when starting the container.
sudo docker run -d \ --name graphite \ --net host -v /path/to/ebs/graphite:/opt/graphite/storage \ -v /path/to/ebs/log:/var/log \ docker-graphite-statsd