Edge Delta Prometheus Source
3 minute read
Overview
The Prometheus Scraper input node can scrape metrics from any target that supports the OpenMetrics format. The Prometheus Scraper input functions as a “drop-in” replacement, meaning you can migrate from Prometheus to the ED Agent using the same configuration.
- outgoing_data_types: metric
See Prepare to Ingest from Prometheus for information about how to configure the node.
Example Configuration 1
For Methods 1 and 2, the following node configuration is used:
Note: While this node is experimental, you can only add it using the YAML editor.

nodes:
- name: my_prometheus_input
type: prometheus_input
Example Configuration 2
For Method 3, the following node configuration is used:

nodes:
- name: my_prometheus_input
type: prometheus_input
should_only_leader_ingest: true
config: |
global:
scrape_interval: 30s
scrape_configs:
- job_name: "myapp"
scrape_interval: 10s
static_configs:
- targets: ["myapp-application-controller-metrics.myapp.svc.cluster.local:8082"]
metrics_path: "/metrics"
scheme: "http"
- job_name: serviceMonitor/myapp/myapp-application-controller/0
honor_timestamps: true
track_timestamps_staleness: false
scrape_interval: 30s
scrape_timeout: 10s
scrape_protocols:
- OpenMetricsText1.0.0
- OpenMetricsText0.0.1
- PrometheusText0.0.4
metrics_path: /metrics
scheme: http
enable_compression: true
follow_redirects: true
enable_http2: true
relabel_configs:
- source_labels: [job]
separator: ;
regex: (.*)
target_label: __tmp_prometheus_job_name
replacement: $1
action: replace
- source_labels: [__meta_kubernetes_service_label_app_kubernetes_io_component, __meta_kubernetes_service_labelpresent_app_kubernetes_io_component]
separator: ;
regex: (application-controller);true
replacement: $1
action: keep
- source_labels: [__meta_kubernetes_service_label_app_kubernetes_io_instance, __meta_kubernetes_service_labelpresent_app_kubernetes_io_instance]
separator: ;
regex: (myapp);true
replacement: $1
action: keep
- source_labels: [__meta_kubernetes_service_label_app_kubernetes_io_name, __meta_kubernetes_service_labelpresent_app_kubernetes_io_name]
separator: ;
regex: (myapp-metrics);true
replacement: $1
action: keep
- source_labels: [__meta_kubernetes_endpoint_port_name]
separator: ;
regex: http-metrics
replacement: $1
action: keep
- source_labels: [__meta_kubernetes_endpoint_address_target_kind, __meta_kubernetes_endpoint_address_target_name]
separator: ;
regex: Node;(.*)
target_label: node
replacement: ${1}
action: replace
- source_labels: [__meta_kubernetes_endpoint_address_target_kind, __meta_kubernetes_endpoint_address_target_name]
separator: ;
regex: Pod;(.*)
target_label: pod
replacement: ${1}
action: replace
- source_labels: [__meta_kubernetes_namespace]
separator: ;
regex: (.*)
target_label: namespace
replacement: $1
action: replace
- source_labels: [__meta_kubernetes_service_name]
separator: ;
regex: (.*)
target_label: service
replacement: $1
action: replace
- source_labels: [__meta_kubernetes_pod_name]
separator: ;
regex: (.*)
target_label: pod
replacement: $1
action: replace
- source_labels: [__meta_kubernetes_pod_container_name]
separator: ;
regex: (.*)
target_label: container
replacement: $1
action: replace
- source_labels: [__meta_kubernetes_pod_phase]
separator: ;
regex: (Failed|Succeeded)
replacement: $1
action: drop
- source_labels: [__meta_kubernetes_service_name]
separator: ;
regex: (.*)
target_label: job
replacement: ${1}
action: replace
- separator: ;
regex: (.*)
target_label: endpoint
replacement: http-metrics
action: replace
- source_labels: [__address__]
separator: ;
regex: (.*)
modulus: 1
target_label: __tmp_hash
replacement: $1
action: hashmod
- source_labels: [__tmp_hash]
separator: ;
regex: "0"
replacement: $1
action: keep
kubernetes_sd_configs:
- role: endpoints
kubeconfig_file: ""
follow_redirects: true
enable_http2: true
namespaces:
own_namespace: false
names:
- myapp
Required Parameters
name
A descriptive name for the node. This is the name that will appear in Visual Pipelines and you can reference this node in the YAML using the name. It must be unique across all nodes. It is a YAML list element so it begins with a -
and a space followed by the string. It is a required parameter for all nodes.
nodes:
- name: <node name>
type: <node type>
type: prometheus_input
The type
parameter specifies the type of node being configured. It is specified as a string from a closed list of node types. It is a required parameter.
nodes:
- name: <node name>
type: <node type>
Optional Parameters
should_only_leader_ingest
The should_only_leader_ingest parameter determines whether only the leader from the leader election process will scrape prometheus metrics. Only set the should_only_leader_ingest
parameter to true
if you are using Method 3: scraping metric sources without using a Target Allocator. See Prepare to Ingest from Prometheus. The should_only_leader_ingest
parameter prevents duplication of metrics but it is less performant than using a Target Allocator.
nodes:
- name: my_prometheus_input
type: prometheus_input
should_only_leader_ingest: true
config: |
<scraping configuration>
config
The config parameter contains the static Prometheus scrape configuration, which determines which metrics to scrape. Only ue the config parameter when you are using Method 3: scraping metric sources without using a Target Allocator. See Prepare to Ingest from Prometheus. With this method, should_only_leader_ingest: true
is required.
nodes:
- name: my_prometheus_input
type: prometheus_input
should_only_leader_ingest: true
config: |
<scraping configuration>