lablabs / cloudflare-exporter

Prometheus CloudFlare Exporter
Apache License 2.0
313 stars 104 forks source link

No CF Metrics after setup #66

Closed caesartcs closed 1 year ago

caesartcs commented 2 years ago

Hi, thank you for this tool but I am having a problem

Free Plan only CF Token is Read only to Zone analytics, also tried a Read Only to ALL Resources I am using docker-compose to run the image, Prometheus and Grafana also on docker-compose too.

cloudflare-exporter:
    image: lablabs/cloudflare_exporter
    container_name: cloudflare-exporter
    environment:
      - CF_API_TOKEN=*****
      - CF_ZONES=***.com,***.org
      - listen=:9102
      - free_tier=true
      - CF_API_KEY=*****
      - CF_API_EMAIL=***
    restart: unless-stopped
    ports:
      - "9102:8080"

Everything starts up fine and there is metrics showing at dockerhost:9102/metrics, and Prometheus is successfully scraping the job. However the metrics shown are only some system metrics and NO cloudflare metrics at all. Please see below:

...
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes -1
# HELP promhttp_metric_handler_requests_in_flight Current number of scrapes being served.
# TYPE promhttp_metric_handler_requests_in_flight gauge
promhttp_metric_handler_requests_in_flight 1
# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.
# TYPE promhttp_metric_handler_requests_total counter
promhttp_metric_handler_requests_total{code="200"} 57
promhttp_metric_handler_requests_total{code="500"} 0
promhttp_metric_handler_requests_total{code="503"} 0

That's it

I've tried with both Token only and with API Key and Email. Again, everything seems to work, but I am just not getting any cloudflare metrics to show up. Any idea?

coryschwartz commented 2 years ago

Same issue. I'll leave a comment if I figure anything out.

coryschwartz commented 2 years ago

@caesartcs It seems like hardly any metrics are available for the free plan These functions just return if it's a free plan.

https://github.com/lablabs/cloudflare-exporter/blob/1df59e2815a23d44bd7a13edad3215adcfd95178/prometheus.go#L228

That's pretty unfortunate. They should print a log message or something to indicate what is going on. Obviously if someone is installing this, they are expecing to see at least some metrics.

onedr0p commented 2 years ago

I ran into the same issue, maybe the docs should be clear on what metrics are supported under the free tier? It seems like there are none.

skaldenhoven commented 1 year ago

I ran into the same issue, maybe the docs should be clear on what metrics are supported under the free tier? It seems like there are none.

Shouldn't be the case according to this page from Cloudflare. Free accounts have access to all but limited in history and # of requests. So I guess it is more of another kind of issue.

https://developers.cloudflare.com/analytics/graphql-api/features/discovery/settings/

caesartcs commented 1 year ago

I will close this as not planned. If anyone comes across a similar experience in their own setup, please link this issue.