⛅️ Prometheus metrics exporter for Cloudflare Analytics

cloudflare_exporter

Prometheus metrics exporter for Cloudflare Analytics

Description

Prometheus metrics exporter for Cloudflare Analytics.

This piece of software has one mission: gather Cloudflare Site analytics from the Cloudflare API, and present them in Prometheus' Exposition format, for Prometheus to scrape.

Usage

Considerations

  • Tune your configuration. All configuration is done through environment variables:
    • CLOUDFLARE_EMAIL: (optional) email used for Cloudflare API email authentication
    • CLOUDFLARE_KEY: (optional) key used for Cloudflare API email authentication
    • CLOUDFLARE_TOKEN: (optional) token used for Cloudflare API token authentication
    • CLOUDFLARE_USER_SERVICE_KEY: (optional) key used for Cloudflare API user service key authentication
    • CLOUDFLARE_ZONES: (required) comma-separated list of zone names to scrape for metrics (e.g. example.com,example.org)
    • CLOUDFLARE_ACCOUNTS: (optional) comma-separated list of Access account IDs to scrape for metrics
    • CLOUDFLARE_SCRAPE_ANALYTICS_SINCE: (defaults to 24h) since parameter of calls to the Cloudflare Analytics API
    • EXPORTER_LISTEN_ADDR: (defaults to 127.0.0.1:9199) address for the exporter to bind to

Note: beware of rate limiting! Cloudflare's API has a base limit of 1200 requests every 5 minutes. I recommend configuring your Prometheis to scrape cloudflare_exporter once every 1-5 minutes.

With the prebuilt container image

Available on Docker Hub as docker.io/ricardbejarano/cloudflare_exporter:

Also available on Quay as quay.io/ricardbejarano/cloudflare_exporter:

Any of both registries will do, example:

docker run -it -p 9199:9199 -e CLOUDFLARE_TOKEN="***" -e CLOUDFLARE_ZONES="example.com,example.org" quay.io/ricardbejarano/cloudflare_exporter

Building the container image from source

First clone the repository, and cd into it:

docker build -t cloudflare_exporter .

Now run it:

docker run -it -p 9199:9199 -e CLOUDFLARE_TOKEN="***" -e CLOUDFLARE_ZONES="example.com,example.org" cloudflare_exporter

Building the binary from source

First clone the repository, and cd into it.

make

Now run it:

export CLOUDFLARE_TOKEN="***"  # WARNING: remember to erase this from your Bash history
export CLOUDFLARE_ZONES="example.com,example.org"
./bin/cloudflare_exporter

FAQs

What are the differences with wehkamp/docker-prometheus-cloudflare-exporter?

  • cloudflare_exporter scrapes metrics from the Analytics Dashboard API, available to all Cloudflare customers for free
  • cloudflare_exporter is not strictly tied to Docker (there's a Docker image, though, see Usage)
  • cloudflare_exporter is written in Go, instead of Python

What are the differences with criteo/cloudflare-exporter?

  • cloudflare_exporter scrapes metrics from the Analytics Dashboard API, available to all Cloudflare customers for free
  • cloudflare_exporter is written in Go, instead of Python

But does it support pulling analytics by colocation like the others?

Not at the moment, as I require an Enterprise account for development and I don't have one. Feel free to contribute that feature!

Does it support Cloudflare Web Analytics?

I finished writing cloudflare_exporter exactly 1 day before Cloudflare announced their Web Analytics service is now available for free.

That said, I'd love to include support for that. Once the API and the Go API client library support it, I will integrate that into cloudflare_exporter. Last I checked (Dec 9th, 2020) neither support Web Analytics yet.

What will happen when Cloudflare deprecates their Analytics REST API on March 1st, 2021?

I expect Cloudflare to update their official Go API client library to support the new Analytics GraphQL API before deprecation on March 1st, 2020. I also expect the Go API client library not to change its interface in the process, but I will fix whatever incompatibilities surge during the transition, if any.

What features are coming for cloudflare_exporter?

At this stage, development for cloudflare_exporter is paused with the following exceptions:

  • Bugs in functionality (raise a GitHub Issue)
  • Security vulnerabilities (raise a GitHub Issue asking for a GPG public key)
  • Third-party contributions (make a pull request)

What features would cloudflare_exporter be open to merge?

Basically, any usage analytics data that Cloudflare offers over their APIs, including:

What features won't cloudflare_exporter implement?

For now, these are the features that have been decided not to be implemented, and the reasoning behind those decisions:

  • Pseudo-metrics about site configuration, to monitor changes to Cloudflare Site configuration. Why? This feature is out of scope (aggregated, usage-derived analytics) for this project.
  • Preventive rate limiting, to avoid Cloudflare-side rate limiting. Why? There's already one mechanism available to avoid getting rate limited at the Cloudflare level: increasing scrape_interval in Prometheus for cloudflare_exporter.

License

MIT licensed, see LICENSE for more details.

Similar Resources

Prometheus exporter for ping metrics such as RTT, packet loss, and jitter to any number of hosts.

ping_exporter Command ping_exporter provides a Prometheus exporter for ping metrics such as RTT, packet loss, and jitter to any number of hosts. Usage

Sep 24, 2022

A Prometheus exporter which scrapes metrics from CloudLinux LVE Stats 2

A Prometheus exporter which scrapes metrics from CloudLinux LVE Stats 2

CloudLinux LVE Exporter for Prometheus LVE Exporter - A Prometheus exporter which scrapes metrics from CloudLinux LVE Stats 2 Help on flags: -h, --h

Nov 2, 2021

A Prometheus metrics exporter for AWS that fills in gaps CloudWatch doesn't cover

YAAE (Yet Another AWS Exporter) A Prometheus metrics exporter for AWS that fills in gaps CloudWatch doesn't cover About This exporter is meant to expo

Dec 10, 2022

Prometheus metrics exporter for libvirt.

Libvirt exporter Prometheus exporter for vm metrics written in Go with pluggable metric collectors. Installation and Usage If you are new to Prometheu

Jul 4, 2022

Prometheus Exporter for Kvrocks Metrics

Prometheus Exporter for Kvrocks Metrics

Prometheus Kvrocks Metrics Exporter This is a fork of oliver006/redis_exporter to export the kvrocks metrics. Building and running the exporter Build

Sep 7, 2022

A prometheus exporter which reports metrics about your Gmail inbox.

prometheus-gmail-exporter-go A prometheus exporter for gmail. Heavily inspired by https://github.com/jamesread/prometheus-gmail-exporter, but written

Nov 15, 2022

LLS-Exporter exports fuel level sensor data (rs-485 lls protocol) as prometheus metrics

LLS Exporter LLS Exporter reads rs485/rs232 data from serial port, decodes lls protocol and exports fuel level sensor data as prometheus metrics. Lice

Dec 14, 2021

Openshift's hpessa-exporter allows users to export SMART information of local storage devices as Prometheus metrics, by using HPE Smart Storage Administrator tool

hpessa-exporter Overview Openshift's hpessa-exporter allows users to export SMART information of local storage devices as Prometheus metrics, by using

Jan 17, 2022

Exporter your cypress.io dashboard into prometheus Metrics

Cypress.io dashboard Prometheus exporter Prometheus exporter for a project from Cypress.io dashboards, giving the ability to alert, make special opera

Feb 8, 2022

Github exporter for Prometheus metrics. Written in Go, with love ❤️

Github exporter for Prometheus This is a Github exporter for Prometheus metrics exposed by Github API. Written in Go with pluggable metrics collectors

Oct 5, 2022

Kepler (Kubernetes-based Efficient Power Level Exporter) uses eBPF to probe energy related system stats and exports as Prometheus metrics

Kepler (Kubernetes-based Efficient Power Level Exporter) uses eBPF to probe energy related system stats and exports as Prometheus metrics

kepler Kepler (Kubernetes Efficient Power Level Exporter) uses eBPF to probe energy related system stats and exports as Prometheus metrics Architectur

Dec 26, 2022

Sensu-go-postgres-metrics - The sensu-go-postgres-metrics is a sensu check that collects PostgreSQL metrics

sensu-go-postgres-metrics Table of Contents Overview Known issues Usage examples

Jan 12, 2022

The metrics-agent collects allocation metrics from a Kubernetes cluster system and sends the metrics to cloudability

metrics-agent The metrics-agent collects allocation metrics from a Kubernetes cluster system and sends the metrics to cloudability to help you gain vi

Jan 14, 2022

Prometheus Common Data Exporter can parse JSON, XML, yaml or other format data from various sources (such as HTTP response message, local file, TCP response message and UDP response message) into Prometheus metric data.

Prometheus Common Data Exporter can parse JSON, XML, yaml or other format data from various sources (such as HTTP response message, local file, TCP response message and UDP response message) into Prometheus metric data.

Prometheus Common Data Exporter Prometheus Common Data Exporter 用于将多种来源(如http响应报文、本地文件、TCP响应报文、UDP响应报文)的Json、xml、yaml或其它格式的数据,解析为Prometheus metric数据。

May 18, 2022

Prometheus metrics for Go database/sql via VictoriaMetrics/metrics

sqlmetrics Prometheus metrics for Go database/sql via VictoriaMetrics/metrics Features Simple API. Easy to integrate. Install Go version 1.16+ go get

Dec 16, 2022

Export Prometheus metrics from journald events using Prometheus Go client library

journald parser and Prometheus exporter Export Prometheus metrics from journald events using Prometheus Go client library. For demonstration purposes,

Jan 3, 2022

Scalable datastore for metrics, events, and real-time analytics

InfluxDB InfluxDB is an open source time series platform. This includes APIs for storing and querying data, processing it in the background for ETL or

Jan 5, 2023

Scalable datastore for metrics, events, and real-time analytics

InfluxDB InfluxDB is an open source time series platform. This includes APIs for storing and querying data, processing it in the background for ETL or

Jan 4, 2023

Github billing exporter - Billing exporter for GitHub organizations

GitHub billing exporter Forked From: https://github.com/borisputerka/github_bill

Nov 2, 2022
Json-log-exporter - A Nginx log parser exporter for prometheus metrics

json-log-exporter A Nginx log parser exporter for prometheus metrics. Installati

Jan 5, 2022
Cloudflare-operator - Manage Cloudflare DNS records with Kubernetes objects

cloudflare-operator Documentation The goal of cloudflare-operator is to manage C

Nov 16, 2022
Openvpn exporter - Prometheus OpenVPN exporter For golang

Prometheus OpenVPN exporter Please note: This repository is currently unmaintain

Jan 2, 2022
Amplitude-exporter - Amplitude charts to prometheus exporter PoC

Amplitude exporter Amplitude charts to prometheus exporter PoC. Work in progress

May 26, 2022
Vulnerability-exporter - A Prometheus Exporter for managing vulnerabilities in kubernetes by using trivy
Vulnerability-exporter - A Prometheus Exporter for managing vulnerabilities in kubernetes by using trivy

Kubernetes Vulnerability Exporter A Prometheus Exporter for managing vulnerabili

Dec 4, 2022
Netstat exporter - Prometheus exporter for exposing reserved ports and it's mapped process

Netstat exporter Prometheus exporter for exposing reserved ports and it's mapped

Feb 3, 2022
🦈 Prometheus exporter for pcap metrics

pcap-exporter ?? Prometheus exporter for pcap metrics Usage

Jun 5, 2022
📡 Prometheus exporter that exposes metrics from SpaceX Starlink Dish
📡  Prometheus exporter that exposes metrics from SpaceX Starlink Dish

Starlink Prometheus Exporter A Starlink exporter for Prometheus. Not affiliated with or acting on behalf of Starlink(™) ?? Starlink Monitoring System

Dec 19, 2022
Prometheus exporter for Chia node metrics

chia_exporter Prometheus metric collector for Chia nodes, using the local RPC API Building and Running With the Go compiler tools installed: go build

Sep 19, 2022
NVIDIA GPU metrics exporter for Prometheus leveraging DCGM

DCGM-Exporter This repository contains the DCGM-Exporter project. It exposes GPU metrics exporter for Prometheus leveraging NVIDIA DCGM. Documentation

Dec 27, 2022