prometheus-pve-exporter icon indicating copy to clipboard operation
prometheus-pve-exporter copied to clipboard

gettting metrics from ALL guest instead of the selected instance

Open tibz7 opened this issue 1 year ago • 7 comments

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

tibz7 avatar Nov 30 '23 17:11 tibz7

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.

znerol avatar Nov 30 '23 17:11 znerol

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

tibz7 avatar Dec 01 '23 08:12 tibz7

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.

znerol avatar Dec 01 '23 10:12 znerol

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 avatar Dec 04 '23 12:12 tibz7

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

tibz7 avatar Dec 04 '23 12:12 tibz7

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)

spearcrow avatar Dec 26 '23 04:12 spearcrow

That was the trick thanks!!!

On Tue, Dec 26, 2023, 05:27 Agnesius Santo Naibaho @.***> wrote:

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)

— Reply to this email directly, view it on GitHub https://github.com/prometheus-pve/prometheus-pve-exporter/issues/204#issuecomment-1869244520, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJCUT2GFMIHZKSY2EUKE43YLJGZ5AVCNFSM6AAAAABABRJVBGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRZGI2DINJSGA . You are receiving this because you authored the thread.Message ID: @.***>

tibz7 avatar Dec 30 '23 16:12 tibz7