Sign inSign up

danjellz/graphite-statsd-esxi

By danjellz

•Updated over 10 years ago

Graphite and Statsd with integrated counters for VMware ESXi

Image
1

695

danjellz/graphite-statsd-esxi repository overview

⁠Docker Image for Graphite & Statsd for VMware ESXi

This was based from an existing project created by Nathan Hopkins. Please find his work here: https://github.com/hopsoft/docker-graphite-statsd⁠

GitHub: https://github.com/danjellesma/docker-graphite-statsd-esxi⁠

The ESXi metrics configuration was added from this project: https://github.com/syepes/VSphere2Metrics/wiki/Graphitepr⁠

⁠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.

⁠Todo

  • Split out image into multiple containers and orchestrate through Docker Compose
  • Proxy Graphite's Django admin behind Nginx

⁠Quick Start

docker run -d --name graphite --restart=always danjellz/graphite-statsd-esxi

This starts a Docker container named: graphite

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

⁠Includes the following components
⁠Mapped Ports
HostContainerService
8080nginx⁠
20032003carbon⁠
20042004carbon aggregator⁠
20232023carbon pickle⁠
20242024carbon aggregator pickle⁠
81258125statsd⁠
81268126statsd 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\
 danjellz/graphite-statsd-esxi
⁠Mounted Volumes
HostContainerNotes
DOCKER ASSIGNED/opt/graphite/confgraphite config
DOCKER ASSIGNED/opt/graphite/storagegraphite stats storage
DOCKER ASSIGNED/etc/nginxnginx config
DOCKER ASSIGNED/opt/statsdstatsd config
DOCKER ASSIGNED/etc/logrotate.dlogrotate config
DOCKER ASSIGNED/var/loglog 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 Volumes

You may find it useful to mount explicit volumes so configs & data can be managed from a known location on the host.

Simply specify the desired volumes when starting the container.

docker run -d\
 --name graphite\
 --restart=always\
 -v /path/to/graphite/configs:/opt/graphite/conf\
 -v /path/to/graphite/data:/opt/graphite/storage\
 -v /path/to/statsd:/opt/statsd\
 danjellz/graphite-statsd-esxi

Note: The container will initialize properly if you mount empty volumes at /opt/graphite, /opt/graphite/conf, /opt/graphite/storage, or /opt/statsd

⁠Additional Reading

⁠Contributors

Build the image yourself.

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

Tag summary

Content type

Image

Digest

Size

302.7 MB

Last updated

over 10 years ago

docker pull danjellz/graphite-statsd-esxi