Cloudflared Grafana Dashboard

I'm trying to setup the cloudflare tunnels dashboard in grafana. I've got a prometheus server that works for other stuff I have dashboards for, but for some reason for my cloudflared server I get "context deadline exceeded" even though I can view the metrics in a web browser. I've tried changing the scrape interval and scrape timeout to no avail. Does anybody have any suggestions on what I can do to get prometheus to scrape my cloudflared server?
4 Replies
Cyb3r-Jak3
Cyb3r-Jak35mo ago
Have you configured the tunnel to have a set port for metrics? By default cloudflared uses a random port
ISD94TechDir
ISD94TechDir5mo ago
I edited the config using systemctl edit --full cloudflared.service and added the IP and port for metrics. In a web browser I can go to [IP ADDRESS]:[PORT]/metrics and get all of the metrics, but for some reason my Prometheus server can't. I have verified connectivity between the two servers so they can communicate with each other
Cyb3r-Jak3
Cyb3r-Jak35mo ago
Like you can curl the metrics endpoint from the Prometheus server?
ISD94TechDir
ISD94TechDir5mo ago
I figured it out. My cloudflared server sits in the DMZ and I have very specific firewall rules letting thoughts through to it. I had allowed the Prometheus server to be able to talk to the cloudflared server on that specific port (and ping). I could ping prometheus from cloudflared just fine, but I couldn't test it back because I couldn't login as root. I guess I had to also put the docker host IP as allowed to get to the cloudflared server. As soon as I added the docker host IP, it worked perfectly.