Skip to content

Export node total CPUs, total memory. And node name as metric label #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

trublast
Copy link

@trublast trublast commented Jun 5, 2022

No description provided.

@AlexZzz
Copy link
Contributor

AlexZzz commented Jun 19, 2022

Hi, thanks for your PR!
As I can see from libvirt documentation:

Use of this API is strongly discouraged as the information provided is not guaranteed to be accurate on all hardware platforms.

As I assume, for x86-64 this info should be OK for most users. But I would recommend using node-exporter to get information about the hypervisor node itself.

GetHostname probably requires qemu quest-agent to be installed. I've never used it in public clouds. If libvirt can't find a hostname it raises an error. We shouldn't fail metric collection if we cannot get guest hostname. We also don't need label with empty value. Maybe adding this metric to libvirt_domain_info_meta if it exists is enough?

if err != nil {
return err
}
autostart_int := 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's convert it to float64 here, there's no need in double conversion.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello.
GetHostname in this case returns hypervisor name (see here). I agree with you, it's enough to store data in the libvirt info_meta, but it's hard to use in alerts or dashboards with grouping or searching by hypervisor name. For most cases this is the same as instance, but human readable.
About NodeGetInfo. The number of hypervisor CPUs and total memory are the minimum information to generate "oversell" alerts. I dont't want to install node-exporter on each hypervisor only for it. It seemed like a good idea to pass this information from the libvirt-exporter
And of course I want to say that I am not a Go programmer. I just wanted to add functionality to monitoring my servers. My code was written with Ctrl+C/Ctrl+V.

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants