Hi, I have configured grafana-agent
for my k8s cluster. Cluster data are working great. Now I want agent to scrape a custom prometheus endpoint for my application. The discovery_relabel
works great, now I need to rewrite the scrape endpoint port. From documentation it seems I need to set a block relabel_configs
, but I receive an error “unrecognized block name”, I guess I put the block in the bad context: someone could tell me where to put my block? Thank you. Here my current snippet:
discovery.relabel "cultsprod_front_puma_pods" {
targets = discovery.kubernetes.pods.targets // Gets all pods
rule {
source_labels = ["__meta_kubernetes_pod_name"]
regex = "cultsprod-front"
action = "keep"
}
}
prometheus.scrape "cultsprod_front" {
targets = discovery.relabel.cultsprod_front_puma_pods.output
forward_to = [prometheus.remote_write.metrics_service.receiver]
scrape_configs {
relabel_configs {
source_labels = ["__address__"]
action = "replace"
regex = "([^:]+):.*"
replacement = "$1:9393"
target_label = "__address__"
}
}
}
To be more precise, if I remove the scrape_configs
block, it’s correctly parsed.
Thanks again.