{"id":17626675,"url":"https://github.com/chitoku-k/cloudflare-exporter","last_synced_at":"2026-03-07T09:13:19.084Z","repository":{"id":38082561,"uuid":"315003134","full_name":"chitoku-k/cloudflare-exporter","owner":"chitoku-k","description":"A Prometheus exporter for Cloudflare Load Balancers","archived":false,"fork":false,"pushed_at":"2024-10-25T18:37:10.000Z","size":375,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-30T00:50:33.253Z","etag":null,"topics":["cloudflare","prometheus-exporter"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chitoku-k.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-22T09:39:41.000Z","updated_at":"2024-10-25T18:37:03.000Z","dependencies_parsed_at":"2022-07-29T08:49:54.662Z","dependency_job_id":"9bbabb86-a83a-4574-a553-0159579b19f2","html_url":"https://github.com/chitoku-k/cloudflare-exporter","commit_stats":{"total_commits":260,"total_committers":4,"mean_commits":65.0,"dds":0.1923076923076923,"last_synced_commit":"07f4a122d7c3368dbaa542fac34d14fc85a015e6"},"previous_names":[],"tags_count":151,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chitoku-k%2Fcloudflare-exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chitoku-k%2Fcloudflare-exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chitoku-k%2Fcloudflare-exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chitoku-k%2Fcloudflare-exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chitoku-k","download_url":"https://codeload.github.com/chitoku-k/cloudflare-exporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242750508,"owners_count":20179249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudflare","prometheus-exporter"],"created_at":"2024-10-22T23:24:25.847Z","updated_at":"2026-02-14T00:14:07.144Z","avatar_url":"https://github.com/chitoku-k.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"cloudflare-exporter\n===================\n\n[![][workflow-badge]][workflow-link]\n\nA Prometheus exporter for Cloudflare /cdn-cgi/trace endpoint and Load Balancers\n\n## Requirements\n\n- Cloudflare Load Balancing subscription\n\n## API Access\n\nFor Cloudflare API, it is strongly recommended to create a dedicated Account API token or User API token.\nEnsure the following permission is granted to the token:\n\n- Account - Load Balancing: Monitors And Pools (Read)\n\n## Production\n\n### Container images\n\n- [ghcr.io/chitoku-k/cloudflare-exporter](https://github.com/chitoku-k/cloudflare-exporter/pkgs/container/cloudflare-exporter)\n\n```console\n$ docker buildx bake\n```\n\n### Executables\n\n- [GitHub Releases](https://github.com/chitoku-k/cloudflare-exporter/releases)\n\n## Configurations\n\n### Linux\n\n```sh\n# Port number (required)\nexport PORT=8080\n\n# TLS certificate and private key (optional; if not specified, exporter is served over HTTP)\nexport TLS_CERT=/path/to/tls/cert\nexport TLS_KEY=/path/to/tls/key\n\n# Cloudflare API Token (recommended, optional; either CF_API_TOKEN, or the combination of CF_API_KEY and CF_API_EMAIL is required)\nexport CF_API_TOKEN=\n\n# Cloudflare API Key and API email (optional; either CF_API_TOKEN, or the combination of CF_API_KEY and CF_API_EMAIL is required)\nexport CF_API_KEY=\nexport CF_API_EMAIL=\n\n# Cloudflare Account ID (optional)\nexport CF_ACCOUNT_ID=\n```\n\n### Windows\n\n```powershell\n# Port number (required)\n$Env:PORT = 8080\n\n# TLS certificate and private key (optional; if not specified, exporter is served over HTTP)\n$Env:TLS_CERT = \"\\path\\to\\tls\\cert\"\n$Env:TLS_KEY = \"\\path\\to\\tls\\key\"\n\n# Cloudflare API Token (recommended, optional; either CF_API_TOKEN, or the combination of CF_API_KEY and CF_API_EMAIL is required)\n$Env:CF_API_TOKEN = \"\"\n\n# Cloudflare API Key and API email (optional; either CF_API_TOKEN, or the combination of CF_API_KEY and CF_API_EMAIL is required)\n$Env:CF_API_KEY = \"\"\n$Env:CF_API_EMAIL = \"\"\n\n# Cloudflare Account ID (optional)\n$Env:CF_ACCOUNT_ID = \"\"\n```\n\n## Prometheus Configuration\n\n### /cdn-cgi/ endpoint\n\nThe cloudflare exporter needs the URL of /cdn-cgi/ endpoint to be passed which\ncan be configured by relabelling in a similar way to the blackbox exporter.\n\nExample config:\n\n```yaml\nscrape_configs:\n  - job_name: cloudflare-cdn-cgi\n    metrics_path: /probe\n    static_configs:\n      - targets:\n        - https://one.one.one.one # The base URL of the /cdn-cgi/ endpoint to check for.\n    relabel_configs:\n      - source_labels: [__address__]\n        target_label: __param_target\n      - source_labels: [__param_target]\n        target_label: instance\n      - target_label: __address__\n        replacement: 127.0.0.1:8080 # The cloudflare exporter's real hostname:port.\n```\n\nExample result:\n\n```\n# HELP cloudflare_trace_info Result of /cdn-cgi/trace endpoint\n# TYPE cloudflare_trace_info gauge\ncloudflare_trace_info{colo=\"NRT\",h=\"one.one.one.one\"} 1\n# HELP cloudflare_trace_timestamp Timestamp of /cdn-cgi/trace endpoint\n# TYPE cloudflare_trace_timestamp gauge\ncloudflare_trace_timestamp{colo=\"NRT\",h=\"one.one.one.one\"} 1.756297842e+09\n```\n\n### Load Balancers\n\nThe Cloudflare exporter needs the name of pools to be passed which can be\nconfigured by relabelling in a similar way to the blackbox exporter.\n\nExample config:\n\n```yaml\nscrape_configs:\n  - job_name: cloudflare-loadbalancers\n    static_configs:\n      - targets:\n        - pool01 # Name of Cloudflare pool to check for.\n    relabel_configs:\n      - source_labels: [__address__]\n        target_label: __param_target\n      - source_labels: [__param_target]\n        target_label: instance\n      - target_label: __address__\n        replacement: 127.0.0.1:8080 # The cloudflare exporter's real hostname:port.\n```\n\nExample result:\n\n```\n# HELP cloudflare_origin_health Result of health check\n# TYPE cloudflare_origin_health gauge\ncloudflare_origin_health{code=\"200\",health_region=\"NEAS\",origin_address=\"www01.example.com\",pool_name=\"pool01\"} 1\ncloudflare_origin_health{code=\"503\",health_region=\"NEAS\",origin_address=\"www02.example.com\",pool_name=\"pool01\"} 0\n# HELP cloudflare_origin_rtt_seconds RTT to the pool origin\n# TYPE cloudflare_origin_rtt_seconds gauge\ncloudflare_origin_rtt_seconds{code=\"200\",health_region=\"NEAS\",origin_address=\"www01.example.com\",pool_name=\"pool01\"} 0.0653\ncloudflare_origin_rtt_seconds{code=\"503\",health_region=\"NEAS\",origin_address=\"www02.example.com\",pool_name=\"pool01\"} 0\n```\n\n### Spec\n\n| Status | Condition                                |\n|--------|------------------------------------------|\n| 200    | Success.                                 |\n| 400    | Target is not specified.                 |\n| 500    | Unexpected error calling Cloudflare API. |\n\n[workflow-link]:    https://github.com/chitoku-k/cloudflare-exporter/actions?query=branch:master\n[workflow-badge]:   https://img.shields.io/github/actions/workflow/status/chitoku-k/cloudflare-exporter/publish-image.yml?branch=master\u0026style=flat-square\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchitoku-k%2Fcloudflare-exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchitoku-k%2Fcloudflare-exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchitoku-k%2Fcloudflare-exporter/lists"}