0

I originally asked this over in the default Stack Overflow and was suggested I ask the question here instead:

This is my first foray in to both Docker & Graphite so I'm not entirely sure if this is a docker issue or a graphite one (I'm guessing Docker.)

I installed Graphite following the docker install instructions with the command

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\
 graphiteapp/graphite-statsd

I can access https://localhost:80 and see the general graphite login page but I've got absolutely no idea where to go from here. The install page shows that things should be stored in /opt/graphite however because I'm installing it via Docker there's obviously nothing in my opt directory.

Has anyone been able to find a good tutorial or have any suggestions on where to go from here?

Eabryt
  • 101
  • 4

2 Answers2

0

I ended up solving this for myself, but it was difficult for my to find, so in case anyone else is looking for the solution. To find the location of your docker files you can follow these steps.

1. docker stop graphite
2. docker inspect graphite

Graphite stores the rrd graphs (and all other graphs) in /opt/graphite/storage

In the inspect statement look for the section that may look similar to this:

"Type": "volume",
"Name": "d78f944122a005cae1539d82a86fb93b6352371c3e0ca8a180ce0375da7f5310",
"Source": "/var/lib/docker/volumes/d78f944122a005cae1539d82a86fb93b6352371c3e0ca8a180ce0375da7f5310/_data",
"Destination": "/opt/graphite/storage",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""

This tells me that if I want that if I go to /var/lib/docker/volumes/d78f944122a005cae1539d82a86fb93b6352371c3e0ca8a180ce0375da7f5310/_data I will find where it's pulling the graph data from.

Sure enough that directory looks like: carbon-aggregator-a.pid carbon-cache-a.pid graphite.db index lists log rrd whisper

I then simply need to put my .rrd files in the rrd directory and I can use them with Graphite. One solution for keeping them up to date is to symlink your rrd directory with wherever your rrd files are normally stored.

Don't forget to start your graphite container again after.

docker start graphite

Eabryt
  • 101
  • 4
  • You could also mount a volume, or host folder into the container using the `-mount` [option](https://docs.docker.com/engine/reference/commandline/run/#add-bind-mounts-or-volumes-using-the-mount-flag) to make it more portable, and easier to manage. – GregL Mar 12 '18 at 15:11
0

For people who want something like a symlink to their rrd files, the problem is that Docker seems to not support symlink but instead you can use a bind volume:

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\
 --mount type=bind,source=/var/lib/collectd,target=/opt/graphite/storage/rrd/collectd \
 graphiteapp/graphite-statsd

Thanks to this command we mount our host /var/lib/collectd to Docker /opt/graphite/storage/rrd/collectd and we keep our graphs up to date.

kenlukas
  • 3,101
  • 2
  • 16
  • 26