Skip to content

Instantly share code, notes, and snippets.

@Steffen-MLR
Created June 7, 2022 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Steffen-MLR/bf8952910ca8b6245f4ec25d49b78788 to your computer and use it in GitHub Desktop.
Save Steffen-MLR/bf8952910ca8b6245f4ec25d49b78788 to your computer and use it in GitHub Desktop.
checkmk localcheck for CPU Utilization including VMs for Hyper-V Hosts
# Get CPU % including Virtual Machines local check
$cpucounter = (Get-Counter -Counter "\Prozessorinformationen(_total)\Privilegierte Auslastung").CounterSamples[0]
$value = $cpucounter.CookedValue.toString().Replace(',','.') -as [double]
$output = "P 'CPU Utilization (with VMs)' All=$value"
Write-Host $output "Total CPU (with VMs):" ([math]::Round($value,2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment