Skip to content

Commit 801029e

Browse files
authored
Merge pull request #142 from fatihusta/cf4
Refactored with cloudflare v4 library and also added some features and some code cleanup
2 parents b8cbf88 + 2b80fc2 commit 801029e

9 files changed

Lines changed: 531 additions & 739 deletions

File tree

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Required authentication scopes:
3434
Workers included in authentication scope)
3535
- `Zone/Firewall Services:Read` is required to fetch zone rule name for `cloudflare_zone_firewall_events_count` metric
3636
- `Account/Account Rulesets:Read` is required to fetch account rule name for `cloudflare_zone_firewall_events_count` metric
37+
- `Account:Load Balancing: Monitors and Pools:Read` is required to fetch pools origin health status `cloudflare_pool_origin_health_status` metric
3738

3839
To authenticate this way, only set `CF_API_TOKEN` (omit `CF_API_EMAIL` and `CF_API_KEY`)
3940

@@ -57,15 +58,16 @@ The exporter can be configured using env variables or command flags.
5758
| `CF_API_TOKEN` | API authentication token (recommended before API key + email. Version 0.0.5+. see <https://developers.cloudflare.com/analytics/graphql-api/getting-started/authentication/api-token-auth>) |
5859
| `CF_ZONES` | (Optional) cloudflare zones to export, comma delimited list of zone ids. If not set, all zones from account are exported |
5960
| `CF_EXCLUDE_ZONES` | (Optional) cloudflare zones to exclude, comma delimited list of zone ids. If not set, no zones from account are excluded |
61+
| `CF_TIMEOUT` | Set cloudflare request timeout. Default 10 seconds |
6062
| `FREE_TIER` | (Optional) scrape only metrics included in free plan. Accepts `true` or `false`, default `false`. |
6163
| `LISTEN` | listen on addr:port (default `:8080`), omit addr to listen on all interfaces |
6264
| `METRICS_PATH` | path for metrics, default `/metrics` |
6365
| `SCRAPE_DELAY` | scrape delay in seconds, default `300` |
6466
| `SCRAPE_INTERVAL` | scrape interval in seconds (will query cloudflare every SCRAPE_INTERVAL seconds), default `60` |
65-
| `CF_BATCH_SIZE` | cloudflare request zones batch size (1 - 10), default `10` |
6667
| `METRICS_DENYLIST` | (Optional) cloudflare-exporter metrics to not export, comma delimited list of cloudflare-exporter metrics. If not set, all metrics are exported |
6768
| `ENABLE_PPROF` | (Optional) enable pprof profiling endpoints at `/debug/pprof/`. Accepts `true` or `false`, default `false`. **Warning**: Only enable in development/debugging environments |
6869
| `ZONE_<NAME>` | `DEPRECATED since 0.0.5` (optional) Zone ID. Add zones you want to scrape by adding env vars in this format. You can find the zone ids in Cloudflare dashboards. |
70+
| `LOG_LEVEL` | Set loglevel. Options are error, warn, info, debug. default `error` |
6971

7072
Corresponding flags:
7173

@@ -75,14 +77,15 @@ Corresponding flags:
7577
-cf_api_token="": cloudflare api token (version 0.0.5+, preferred)
7678
-cf_zones="": cloudflare zones to export, comma delimited list
7779
-cf_exclude_zones="": cloudflare zones to exclude, comma delimited list
80+
-cf_timeout="10s": cloudflare request timeout, default 10 seconds
7881
-free_tier=false: scrape only metrics included in free plan, default false
7982
-listen=":8080": listen on addr:port ( default :8080), omit addr to listen on all interfaces
8083
-metrics_path="/metrics": path for metrics, default /metrics
8184
-scrape_delay=300: scrape delay in seconds, defaults to 300
8285
-scrape_interval=60: scrape interval in seconds, defaults to 60
83-
-cf_batch_size=10: cloudflare zones batch size (1-10)
8486
-metrics_denylist="": cloudflare-exporter metrics to not export, comma delimited list
8587
-enable_pprof=false: enable pprof profiling endpoints at /debug/pprof/
88+
-log_level="error": log level(error,warn,info,debug)
8689
```
8790

8891
Note: `ZONE_<name>` configuration is not supported as flag.

0 commit comments

Comments
 (0)