cloudflare-exporter

command module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2021 License: MIT Imports: 8 Imported by: 0

README

cloudflare-exporter

A Prometheus exporter for Cloudflare Load Balancers

Requirements

  • Go
  • Cloudflare Load Balancing subscription

Installation

$ docker buildx build .
# Port number (required)
export PORT=8080

# Cloudflare API Key and API email (optional; either CF_API_TOKEN, or the combination of CF_API_KEY and CF_API_EMAIL is required)
export CF_API_KEY=
export CF_API_EMAIL=

# Cloudflare API Token (optional; either CF_API_TOKEN, or the combination of CF_API_KEY and CF_API_EMAIL is required)
export CF_API_TOKEN=

Usage

$ ./cloudflare-exporter

Prometheus Configuration

The Cloudflare exporter needs the name of pools to be passed which can be configured by relabelling in a similar way to the blackbox exporter.

Example config:

scrape_configs:
  - job_name: cloudflare
    static_configs:
      - targets:
        - pool01 # Name of Cloudflare pool to check for.
    relabel_configs:
        - source_labels: [__address__]
          target_label: __param_target
        - source_labels: [__param_target]
          target_label: instance
        - target_label: __address__
          replacement: 127.0.0.1:8080 # The cloudflare exporter's real hostname:port.

Example result:

# HELP cloudflare_origin_health Result of health check
# TYPE cloudflare_origin_health gauge
cloudflare_origin_health{code="200",health_region="NEAS",origin_address="www01.example.com",pool_name="pool01"} 1
cloudflare_origin_health{code="503",health_region="NEAS",origin_address="www02.example.com",pool_name="pool01"} 0
# HELP cloudflare_origin_rtt_seconds RTT to the pool origin
# TYPE cloudflare_origin_rtt_seconds gauge
cloudflare_origin_rtt_seconds{code="200",health_region="NEAS",origin_address="www01.example.com",pool_name="pool01"} 0.0653
cloudflare_origin_rtt_seconds{code="503",health_region="NEAS",origin_address="www02.example.com",pool_name="pool01"} 0
Spec
Status Condition
200 Success.
400 Target is not specified.
500 Unexpected error calling Cloudflare API.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
application
infrastructure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL