Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hyper-V VM Memory metrics #971

Merged
merged 7 commits into from
May 12, 2022
Merged

Add Hyper-V VM Memory metrics #971

merged 7 commits into from
May 12, 2022

Conversation

andbanman
Copy link

Add Win32_PerfRawData_BalancerStats_HyperVDynamicMemoryVM WMI class to monitor VM memory. The class shows metrics for VMs with and without dynamic memory enabled.

This partially addresses #574 #517

Example output:

# HELP windows_hyperv_vm_memory_add_operations                                                                                                                                                                                                                                
# TYPE windows_hyperv_vm_memory_add_operations counter                                                                                                                                                                                                                        
windows_hyperv_vm_memory_add_operations{vm="myvm"} 0                                                                                                                                                                                                                          
# HELP windows_hyperv_vm_memory_added                                                                                                                                                                                                                                         
# TYPE windows_hyperv_vm_memory_added counter                                                                                                                                                                                                                                 
windows_hyperv_vm_memory_added{vm="myvm"} 0                                                                                                                                                                                                                                   
# HELP windows_hyperv_vm_memory_physical_guest_visible 'This counter represents the amount of memory visible in the VM.'                                                                                                                                                      
# TYPE windows_hyperv_vm_memory_physical_guest_visible counter                                                                                                                                                                                                                
windows_hyperv_vm_memory_physical_guest_visible{vm="myvm"} 4000                                                                                                                                                                                                               
# HELP windows_hyperv_vm_memory_physical_memory This counter represents the current amount of memory in the VM.                                                                                                                                                               
# TYPE windows_hyperv_vm_memory_physical_memory counter                                                                                                                                                                                                                       
windows_hyperv_vm_memory_physical_memory{vm="myvm"} 4000                                                                                                                                                                                                                      
# HELP windows_hyperv_vm_memory_pressure_average This counter represents the average pressure in the VM.                                                                                                                                                                      
# TYPE windows_hyperv_vm_memory_pressure_average counter                                                                                                                                                                                                                      
windows_hyperv_vm_memory_pressure_average{vm="myvm"} 161                                                                                                                                                                                                                      
# HELP windows_hyperv_vm_memory_pressure_current This counter represents the current pressure in the VM.                                                                                                                                                                      
# TYPE windows_hyperv_vm_memory_pressure_current counter                                                                                                                                                                                                                      
windows_hyperv_vm_memory_pressure_current{vm="myvm"} 161                                                                                                                                                                                                                      
# HELP windows_hyperv_vm_memory_pressure_maximum This counter represents the maximum pressure band in the VM.                                                                                                                                                                 
# TYPE windows_hyperv_vm_memory_pressure_maximum counter                                                                                                                                                                                                                      
windows_hyperv_vm_memory_pressure_maximum{vm="myvm"} 164                                                                                                                                                                                                                      
# HELP windows_hyperv_vm_memory_pressure_minimum This counter represents the minmum pressure band in the VM.                                                                                                                                                                  
# TYPE windows_hyperv_vm_memory_pressure_minimum counter                                                                                                                                                                                                                      
windows_hyperv_vm_memory_pressure_minimum{vm="myvm"} 159                                                                                                                                                                                                                      
# HELP windows_hyperv_vm_memory_remove_operations                                                                                                                                                                                                                             
# TYPE windows_hyperv_vm_memory_remove_operations counter                                                                                                                                                                                                                     
windows_hyperv_vm_memory_remove_operations{vm="myvm"} 0                                                                                                                                                                                                                       
# HELP windows_hyperv_vm_memory_removed                                                                                                                                                                                                                                       
# TYPE windows_hyperv_vm_memory_removed counter                                                                                                                                                                                                                               
windows_hyperv_vm_memory_removed{vm="myvm"} 0

@andbanman andbanman requested a review from a team as a code owner April 8, 2022 16:12
Copy link
Contributor

@breed808 breed808 left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this! There's some changes required for the metric names & descriptions, but overall this is looking good 👍

collector/hyperv.go Outdated Show resolved Hide resolved
collector/hyperv.go Outdated Show resolved Hide resolved
@breed808
Copy link
Contributor

Aside from the review comments, you'll also need to sign off on the commit (see the link next to the failed action for info).

It'd be a good idea to rebase your feature branch to pick up recent CI fixes too.

Andrew Banman added 5 commits May 12, 2022 09:49
Signed-off-by: Andrew Banman <abanman@pnri.org>
Signed-off-by: Andrew Banman <abanman@pnri.org>
Signed-off-by: Andrew Banman <abanman@pnri.org>
Remove "memory", which is redundant with the module and breaks symmetry
with vm_memory_physical_guest_visible.

Signed-off-by: Andrew Banman <abanman@pnri.org>
Signed-off-by: Andrew Banman <abanman@pnri.org>
@andbanman andbanman requested a review from breed808 May 12, 2022 17:04
Andrew Banman and others added 2 commits May 12, 2022 13:26
Signed-off-by: Andrew Banman <abanman@pnri.org>
Signed-off-by: Ben Reedy <breed808@breed808.com>
Copy link
Contributor

@breed808 breed808 left a comment

Choose a reason for hiding this comment

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

Thanks, this is looking good. I've added initial documentation entries for the memory metrics as well.

@breed808 breed808 merged commit 21f4757 into prometheus-community:master May 12, 2022
@andbanman
Copy link
Author

Thank you for taking the time to review and for the helpful suggestions. I'm working on relevant alerts and a Grafana dashboard that I plan to share soon.

anubhavg-icpl pushed a commit to anubhavg-icpl/windows_exporter that referenced this pull request Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants