prometheus-pve/prometheus-pve-exporter

gettting metrics from ALL guest instead of the selected instance

tibz7 opened this issue · 7 comments

tibz7 commented

I'm having the exporter installed on prometheus host.
I using the prometheus config provided in the doc. I can collect the metrics and render them on the dashboard provided as a link.
In the target I put the IP of ONE proxmox host I want to get the metrics from ( 1 out of 24)
But for some magic reason, I'm getting ALL guests metrics, including the ones that are NOT on that proxmox host!
And filtering does not work of course

znerol commented

Thanks for the report.

What you are observing is the intended behavior. Prometheus PVE exporter collects metrics by scraping resources via the PVE cluster API.

tibz7 commented

Ok thank you!
So it is not possible to the guest by their host?

znerol commented

The node label is on the pve_guest_info metric. In order to make that available on any other metric, it is necessary to join it to pve_guest_info. E.g.:

pve_up * on(id) group_left(node) pve_guest_info

More examples in #54 and detailed explanation of joins in the robust perception blog.

tibz7 commented

So the solution was for me to make this

pve_cpu_usage_ratio /pve_cpu_usage_limit and on(id) pve_node_info{name="HOST"}
tibz7 commented

by the way I did not find a way to get the cpu usage ratio for the whole cluster... I tried to sum all the pve_cpu_usage_ratio but that does not really work in the gauge, it gives a gigantic percentage

by the way I did not find a way to get the cpu usage ratio for the whole cluster... I tried to sum all the pve_cpu_usage_ratio but that does not really work in the gauge, it gives a gigantic percentage

For whole cluster, maybe you can try to using this

avg(pve_cpu_usage_ratio * on (id) group_left (name) pve_node_info)