-
Can you allow the ability to overide the server 1: metric.test=1 to allow prometheus to map both servers using the same metric name. This is to mimic the default behavior of node exporter allowing the user to select a query in grafana, |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 3 replies
-
Not sure I understand your question completely. Have you read the section about the job and the instance labels? If you configure your Prometheus server to scrape the Pushgateway with |
Beta Was this translation helpful? Give feedback.
-
@beorn7 i think this is exactly what i need.... would that allow me to send in metrics on the same name but with different instance tags so I can query a single metric in grafana and see all of the "instances" reporting that metric?. Also how do I set this flag when i start the docker container? I dont see it in the doc Thanks |
Beta Was this translation helpful? Give feedback.
-
I'll convert this to a discussion in the "Q&A" section, because that's a better fit. (It's not a feature request, after all…) See you on the other side! |
Beta Was this translation helpful? Give feedback.
-
The The scrape config should look similar to this: scrape_configs:
- job_name: 'pushgateway'
honor_labels: true
static_configs:
- targets: ['pushgateway.example.org:9091'] |
Beta Was this translation helpful? Give feedback.
-
Hmmmm, so it looks like the problem still remains. Maybe this is something Im doing wrong @beorn7 . Check this out.... My prometheus .yml config looks like this:
project=test What is happening is, instead of adding both labels to the metrics sent, prometheus gateway just overwrites the existing values from server1 with server2's metrics. Essentially, I would expect to see 2 entries here 1 from |
Beta Was this translation helpful? Give feedback.
-
@beorn7 Never mind I got it working.. the mistake was I set the honor_labels under |
Beta Was this translation helpful? Give feedback.
-
NVM @beorn7 I spoke too soon. It looked like it was working before but now that I'm testing it out again it isn't working. I think the first one showed up earlier because I pushed the metrics up (which accepted the results from server 1) prometheus scraped it. Then i fixed the config and pushed the second one up. After trying this again with more metrics, prometheus push gateway is back to overwriting metrics sent with non-unique metric names with one another. IE: example_metric_count {instance=server1} 0 which results in |
Beta Was this translation helpful? Give feedback.
-
EUREKA!!!! Ok now I understand what was wrong. It might be a good idea to make the documentation a little more clearer for idiots like me. The problem I was having is that I was not separating the The WRONG WAY:
CORRECT WAY:
This allows you to send the same metric name but have different instances/servers reporting the metric!! HUZZAH!! Thanks @beorn7 for your patience and guidance on For anyone seeing this, to be clear my problem was NOT about Thanks |
Beta Was this translation helpful? Give feedback.
The
honor_labels: true
is not a command line flag, but part of your scrape config. And it's the recommended way of scraping a Pushgateway anyway.The scrape config should look similar to this: