Created
June 28, 2020 15:42
-
-
Save niels-s/008e316fca8e4b2e2092d88800a022fc to your computer and use it in GitHub Desktop.
Example Grafonnet dashboard for Cloudflare Exporter metrics by https://github.com/wehkamp/docker-prometheus-cloudflare-exporter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local basic = import 'basic.libsonnet'; | |
local grafana = import 'grafonnet/grafana.libsonnet'; | |
local template = grafana.template; | |
local pieChartPanel = grafana.pieChartPanel; | |
local layout = import 'layout.libsonnet'; | |
local promQuery = import 'prom_query.libsonnet'; | |
basic.dashboard( | |
'Cloudflare PoP statistics', | |
'A9497F55-AE98-4EC5-819D-D41243D8C9E3', | |
tags=['cloudflare'], | |
description='Global anycast network point of presence overview - 5 minutes delayed', | |
) | |
.addTemplate( | |
template.new( | |
'zone', | |
'$PROMETHEUS_DS', | |
'label_values(cloudflare_pop_bandwidth_bytes, zone)', | |
refresh=1, | |
label='Zone', | |
includeAll=true, | |
multi=true, | |
sort=1, | |
) | |
) | |
.addPanels( | |
layout.grid([ | |
basic.multiTimeseries( | |
title = 'Requests', | |
queries = [{ query:'sum(cloudflare_pop_received_requests{zone=~"$zone"}) by (type)', legendFormat: '{{type}}'}], | |
decimals = null, | |
fill = 1 | |
), | |
basic.multiTimeseries( | |
title = 'Bandwidth', | |
queries = [{ query: 'sum(cloudflare_pop_bandwidth_bytes{zone=~"$zone"}) by(type)', legendFormat: '{{type}}'}], | |
format = 'bytes', | |
decimals = null, | |
fill = 1 | |
), | |
], cols=2, rowHeight=12, startRow=1), | |
) | |
.addPanels( | |
layout.grid([ | |
basic.multiTimeseries( | |
title = 'Total requests per PoP', | |
queries = [{ query:'sum(cloudflare_pop_received_requests{zone=~"$zone"}) by (colo_id) > 0', legendFormat: '{{colo_id}}'}], | |
decimals = null, | |
), | |
basic.multiTimeseries( | |
title = 'HTTP Responses Returned', | |
queries = [{ query: 'sum(cloudflare_pop_http_responses_sent{zone=~"$zone"}) by (http_status)', legendFormat: '{{http_status}}'}], | |
decimals = null | |
), | |
], cols=2, rowHeight=12, startRow=2), | |
) | |
.addPanels( | |
layout.grid([ | |
pieChartPanel.new( | |
'Threats Seen', | |
datasource='$PROMETHEUS_DS', | |
span=6, | |
showLegendPercentage=false, | |
height='250px', | |
).addTarget( | |
promQuery.target( | |
'cloudflare_pop_threat_types{zone=~"$zone"}', | |
legendFormat = '{{colo_id}} - {{threat_type}}', | |
interval = '1m', | |
intervalFactor = 1 | |
) | |
), | |
pieChartPanel.new( | |
'Attacking Countries', | |
datasource='$PROMETHEUS_DS', | |
span=6, | |
showLegendPercentage=false, | |
height='250px', | |
).addTarget( | |
promQuery.target( | |
'topk(5, sum(cloudflare_pop_threat_countries{zone=~"$zone"}) by (threat_country))', | |
legendFormat = '{{threat_country}}', | |
interval = '1m', | |
intervalFactor = 1 | |
) | |
), | |
], cols=2, rowHeight=12, startRow=3), | |
) | |
.trailer() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment