Scrape data from Prometheus
The following configuration example shows how you configure a Collector instance to scrape data from an existing Prometheus setup and import it as OTLP request into Dynatrace.
1receivers:2 prometheus:3 config:4 scrape_configs:5 - job_name: 'node-exporter'6 scrape_interval: 60s7 static_configs:8 - targets: ['prometheus-prometheus-node-exporter:9100']9 - job_name: opentelemetry-collector10 scrape_interval: 60s11 static_configs:12 - targets:13 - 127.0.0.1:88881415processors:16 cumulativetodelta:1718exporters:19 otlphttp:20 endpoint: $DT_ENDPOINT/api/v2/otlp21 headers:22 Authorization: "Api-Token $DT_API_TOKEN"2324service:25 pipelines:26 metrics:27 receivers: [prometheus]28 processors: [cumulativetodelta]29 exporters: [otlphttp]
For our configuration, we configure the following components.
receivers, we specify the
prometheus receiver as active receiver component for our Collector instance. We configure the receiver with the two jobs
scrape_configs, to fetch data from the specified hosts once a minute (
For a full list of configuration parameters, see the Prometheus documentation.
exporters, we specify the default
otlphttp exporter and configure it with our Dynatrace API URL and the required authentication token.
For this purpose, we set the following two environment variables and reference them in the configuration values for
service, we assemble our receiver, processor, and exporter objects into a metrics pipeline, which will execute the Prometheus jobs, convert their metrics to delta values, and ingest the data into Dynatrace.