Prometheus and OpenMetrics ingestion
You can configure the Collector to accept text-exposition payloads in either Prometheus or OpenMetrics formats.
To enable the Prometheus and OpenMetrics ingestion for the Collector, add
importPrometheus
and importOpenMetrics
under the push
YAML collection in the
Collector configuration:
push:
importPrometheus:
enabled: true
importOpenMetrics:
enabled: true
Traffic is served from /import/openmetrics
and /import/prometheus
from the
listenAddress
, which defaults to 0.0.0.0:3030
.
# Importing an untyped metric in OpenMetrics format.
curl -d $'test_metric_import 100\n# EOF' -X POST http://localhost:3030/import/openmetrics
# Same import, but in Prometheus format.
curl -d 'test_metric_import 100' -X POST http://localhost:3030/import/prometheus
Additional query parameters:
extra_label
: pass in repeated, default labels for all time series, formatted asname=value
.default_timestamp
: provide a default timestamp in Unix milliseconds for any time series that doesn't have one. Otherwise, the value defaults toNow()
on the Chronosphere backend.
The following command includes both of these additional query parameters:
curl -d 'test_metric_import 100' -X POST \
http://localhost:3030/import/prometheus?extra_label=svc%3Dauth&extra_label=team%3Dbar&default_timestamp=1669701600
Export Prometheus assets
You can use Chronoctl to convert Prometheus assets for import into Observability Platform.
For example, to retrieve, convert, and apply Prometheus alert rules to Observability Platform:
-
In your Prometheus installation, retrieve your Prometheus rules and pipe them into a
.yml
file:kubectl get prometheusrules -o yaml -A > alert_rules.yml
-
Convert the rules using Chronoctl:
chronoctl convert prometheus -p prometheus_rules.yml -a alertmanager.yml
-
Apply the rules to Observability Platform:
chronoctl apply -f alerts.yml