arachnys / cabot

Self-hosted, easily-deployable monitoring and alerts service - like a lightweight PagerDuty
MIT License
5.59k stars 594 forks source link

how to connect the cabot to graphite running in docker #618

Closed stephen1706 closed 6 years ago

stephen1706 commented 6 years ago

hi, I'm trying to connect the cabot to fetch the metrics from graphite which is running in docker localhost. but i'm not sure on which port the cabot should connect to the graphite. i try 80, 2003, 8125, 8126 all not working. how do i connect it?

In the check it shows error like this: Error getting data from Graphite: HTTPConnectionPool(host='localhost', port=8126): Max retries exceeded with url: /render?from=-2minute&target=api-hit&format=json (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',))

how i install my graphite: 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

dbuxton commented 6 years ago

I don't think this sounds like a Cabot issue so will close.

First you need to work out if you can access the Graphite instance just from the command line of your host (e.g. curl http://localhost:8126/...). I'm not a Docker expert but on most environments, localhost won't work. (Docker for Mac does though).

Second, you need to connect Cabot (you don't say whether you are running Cabot via Docker or outside of a container, but I'm guessing probably the former?) to the container. This can be pretty simple or pretty complex: https://docs.docker.com/network/bridge/

stephen1706 commented 6 years ago

@dbuxton I can connect my grafana into my graphite. i try to to access the graphite api from my browser/postman and curl as well. i'm using docker on mac to run the cabot. i don't have any authorization username/password to access the graphite tho, so i'm not sure what to fill on production.env for GRAPHITE_USER and GRAPHITE_PASS, i just leave it empty. http check from my cabot to google.com is passing, but when i try to connect to localhost it always fail

stephen1706 commented 6 years ago

@dbuxton oh i think i know the problem, because i start grafana with docker start grafana, seems it doesn't create a new container therefore grafana can connect to my localhost. however, for running this cabot i have to use docker-compose command which will create a new container is it? therefore this container cannot access my localhost. i've seen the link u gave, but i don't really understand how to bridge it. i'm totally new on this docker stuff

stephen1706 commented 6 years ago

oh i can access it by setting the url as docker.for.mac.localhost thanks!