Skip to main content

Prometheus

The Prometheus Check connects to the Prometheus host, performs the desired query, and displays the results.

prometheus-check.yml
apiVersion: canaries.flanksource.com/v1
kind: Topology
metadata:
name: prometheus-metrics
namespace: default
spec:
schedule: '@every 30s'
components:
- name: Prometheus
type: Table
icon: prometheus
lookup:
prometheus:
- connection: http://prometheus.monitoring:9090
query: sum(up) by (job)
display:
expr: |
results.map(target, {
'name': target.job,
'type': "Job",
}).toJSON()
FieldDescriptionSchemeRequired
displayTemplate to display the result inTemplate
hostAddress of the Prometheus serverstringYes
queryPromQL querystringYes

Results

The results variable in the template is a list of prometheus metrics.

FieldDescriptionScheme
resultsList of prometheus metrics[]map[string]any