I have prometheus server that is using self discovery for Azure VMs which are running WMI exporter. In Grafana I am using dashboard variables for filtering (see screenshot).
On the VMs I have created a custom exporter that outputs the metric with the value of 1 for each server and each server is sending the values to a single Pushgateway that is configured in etc/prometheus/prometheus.yaml
- job_name: 'push-gateway'
static_configs:
- targets: ['localhost:9091']
When I look at scraped metrics I always see the instance: localhost:9091 and job: push-gateway regardless of the server the metric came from. If I add those labels manually I see the "exported" prefix (see screenshot).
What I am confused about is, how can I ensure that the "job" and "instance" for the custom created metric have the same "job" and "instance" values that match the server that has generated the metrics so I can use dashboard variables to extract the correct data for the selected server?