Can you show the results separately of these two queries? (a few lines of each):
up{job="Hyper-v nodes"}
windows_cs_hostname
My guess is that your "instance" labels don't match up, maybe because one or the other includes port numbers. To solve this, change your instance labels so they don't include the port number:
With some rewriting tricks, you can use an arbitrary label like SRV-HOST01 directly for the "instance" label while still using 192.168.1.12 for the scrape __address__. This example is for Linux node_exporter but you can adapt it for Windows targets:
- job_name: node
file_sd_configs:
- files:
- /etc/prometheus/targets.d/node_targets.yml
metrics_path: /metrics
relabel_configs:
- source_labels: [__address__]
regex: '([^/]+)' # name or address only
target_label: instance
- source_labels: [__address__]
regex: '(.+)/(.+)' # name/address
target_label: instance
replacement: '${1}'
- source_labels: [__address__]
regex: '(.+)/(.+)' # name/address
target_label: __address__
replacement: '${2}'
- source_labels: [__address__]
target_label: __address__
replacement: '${1}:9100'
This lets you create a targets file like this:
- targets:
and then you'll get
metric{instance="SRV-HOST01",...} but the scrape target will be
192.168.1.12:9100. The advantage here is that the instance label is meaningful by itself, and you don't need to do the join to pick up the hostname.