Skip to content

InnovaLangues/docker-graphite-statsd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Hub Gratipay

Docker Image for Graphite & Statsd

Get Graphite & Statsd running instantly

Graphite & Statsd can be complex to setup. This image will have you running & collecting stats in just a few minutes.

Quick Start

docker run -d --name graphite --restart=always hopsoft/graphite-statsd

This starts a Docker container named: graphite

That's it, you're done ... almost.

Includes the following components

  • Nginx - reverse proxies the graphite dashboard
  • Graphite - front-end dashboard
  • Carbon - back-end
  • Statsd - UDP based back-end proxy

Mapped Ports

Host Container Service
80 80 nginx
2003 2003 carbon
2004 2004 carbon aggregator
2023 2023 carbon pickle
2024 2024 carbon aggregator pickle
8125 8125 statsd
8126 8126 statsd admin

Note: You can override the default port mappings by specifying them when starting the container.

docker run -d\
 --name graphite\
 --restart=always\
 -p 80:80\
 -p 2003-2004:2003-2004\
 -p 2023-2024:2023-2024\
 -p 8125:8125/udp\
 -p 8126:8126\
 hopsoft/graphite-statsd

Mounted Volumes

Host Container Notes
DOCKER ASSIGNED /opt/graphite graphite config & stats storage
DOCKER ASSIGNED /etc/nginx nginx config
DOCKER ASSIGNED /opt/statsd statsd config
DOCKER ASSIGNED /etc/logrotate.d logrotate config
DOCKER ASSIGNED /var/log log files

Base Image

Built using Phusion's base image.

  • All Graphite related processes are run as daemons & monitored with runit.
  • Includes additional services such as logrotate.

Start Using Graphite & Statsd

Send Some Stats

Let's fake some stats with a random counter to prove things are working.

while true; do echo -n "example:$((RANDOM % 100))|c" | nc -w 1 -u localhost 8125; done

Visualize the Data

Open Graphite in a browser.

Secure the Django Admin

Update the default Django admin user account. The default is insecure.

First login at: http://localhost/account/login Then update the root user's profile at: http://localhost/admin/auth/user/1/

Change the Configuration

Read up on Graphite's post-install tasks. Focus on the storage-schemas.conf.

  1. Stop the container docker stop graphite.
  2. Find the configuration files on the host by inspecting the container docker inspect graphite.
  3. Update the desired config files.
  4. 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

Statsd Admin Management Interface

A management interface (default on port 8126) allows you to manage statsd & retrieve stats.

# show all current counters
echo counters | nc localhost 8126

More info & additional commands.

A Note on Disk Space

If running this image on cloud infrastructure such as AWS, you should consider mounting /opt/graphite & /var/log on a larger volume.

  1. Configure the host to mount a large EBS volume.

  2. Specify the volume mounts when starting the container.

    docker run -d\
     --name graphite\
     --restart=always\
     -v /path/to/ebs/graphite:/opt/graphite\
     -v /path/to/ebs/log:/var/log\
     hopsoft/graphite-statsd
    

Additional Reading

Contributors

Build the image yourself.

  1. git clone https://github.com/hopsoft/docker-graphite-statsd.git
  2. docker build -t hopsoft/graphite-statsd .

About

Docker image for Graphite & Statsd

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 80.2%
  • Nginx 14.4%
  • Shell 4.5%
  • JavaScript 0.9%