Skip to content

Commit

Permalink
Adds new perf data multi label handling
Browse files Browse the repository at this point in the history
  • Loading branch information
LordHepipud committed Aug 26, 2022
1 parent 1d5ac30 commit 468138b
Show file tree
Hide file tree
Showing 9 changed files with 3,078 additions and 20 deletions.
2,313 changes: 2,313 additions & 0 deletions config/grafana/dashboards/hyperv-base.json

Large diffs are not rendered by default.

654 changes: 654 additions & 0 deletions config/grafana/dashboards/windows-hyperv-web.json

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions config/grafana/icingaweb2-grafana/graphs.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[Invoke-IcingaCheckHyperVHealth]
dashboard = "windows-hyperv-web"
panelId = "1"
orgId = ""
repeatable = "no"
dashboarduid = "7XuID0WVz"

[Invoke-IcingaCheckHyperVOverCommitment]
dashboard = "windows-hyperv-web"
panelId = "2"
orgId = ""
repeatable = "no"
dashboarduid = "7XuID0WVz"

[Invoke-IcingaCheckHyperVSnapshot]
dashboard = "windows-hyperv-web"
panelId = "3"
orgId = ""
repeatable = "no"
dashboarduid = "7XuID0WVz"

[Invoke-IcingaCheckHyperVVMHealth]
dashboard = "windows-hyperv-web"
panelId = "4"
orgId = ""
repeatable = "no"
dashboarduid = "7XuID0WVz"

[Invoke-IcingaCheckHyperVVirtualSwitches]
dashboard = "windows-hyperv-web"
panelId = "5"
orgId = ""
repeatable = "no"
dashboarduid = "7XuID0WVz"
18 changes: 17 additions & 1 deletion doc/31-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,29 @@ documentation before upgrading to a new release.

Released closed milestones can be found on [GitHub](https://github.com/Icinga/icinga-powershell-hyperv/milestones?state=closed).

## 1.2.0 (2022-08-09)
## 1.2.0 (2022-08-30)

[Issue and PRs](https://github.com/Icinga/icinga-powershell-hyperv/milestone/3?closed=1)

### Enhancements

* [#60](https://github.com/Icinga/icinga-powershell-hyperv/issues/60) Adds support for providing a different `Username` and `Password` for `Invoke-IcingaCheckHyperVVMM`, to run the check as different user
* [#63](https://github.com/Icinga/icinga-powershell-hyperv/pull/63) Updates performance metrics to Icinga for Windows v1.10.0 layout and provides default dashboards for Grafana and Icinga Web

### Grafana Dashboards

#### New Dashboards

* Hyper-V Base
* Windows-HyperV-Web

#### New Plugin Integrations

* Invoke-IcingaCheckHyperVHealth
* Invoke-IcingaCheckHyperVOverCommitment
* Invoke-IcingaCheckHyperVSnapshot
* Invoke-IcingaCheckHyperVVirtualSwitches
* Invoke-IcingaCheckHyperVVMHealth

## 1.1.0 (2022-05-03)

Expand Down
4 changes: 3 additions & 1 deletion plugins/Invoke-IcingaCheckHyperVHealth.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ function Invoke-IcingaCheckHyperVHealth()
$Check = New-IcingaCheck `
-Name ([string]::Format('{0} Status', $Service)) `
-Value $HypervService.configuration.Status.raw `
-Translation $ProviderEnums.ServiceStatusName;
-Translation $ProviderEnums.ServiceStatusName `
-MetricIndex $Service `
-MetricName 'state';

if (([string]::IsNullOrEmpty($HypervService.configuration.ExitCode) -eq $FALSE) -And ($HypervService.configuration.ExitCode -ne 0) -And ($HypervService.configuration.Status.raw -ne $ProviderEnums.ServiceStatus.Running)) {
$Check.CritIfNotMatch($ProviderEnums.ServiceStatus.Running) | Out-Null;
Expand Down
30 changes: 24 additions & 6 deletions plugins/Invoke-IcingaCheckHyperVOverCommitment.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ function Invoke-IcingaCheckHyperVOverCommitment()
-Value $StorageOverCommit.Bytes `
-Unit 'B' `
-Minimum 0 `
-Maximum $StorageOverCommit.Capacity
-Maximum $StorageOverCommit.Capacity `
-MetricIndex $storage `
-MetricName 'usedbytes' `
-MetricTemplate 'hypervovercommitstorage'
).WarnOutOfRange(
$StorageOCByteWarn
).CritOutOfRange(
Expand All @@ -139,7 +142,10 @@ function Invoke-IcingaCheckHyperVOverCommitment()
-Value $StorageOverCommit.Percent `
-Unit '%' `
-Minimum 0 `
-Maximum 100
-Maximum 100 `
-MetricIndex $storage `
-MetricName 'usedpercent' `
-MetricTemplate 'hypervovercommitstorage'
).WarnOutOfRange(
$StorageOCPercentWarn
).CritOutOfRange(
Expand Down Expand Up @@ -175,7 +181,10 @@ function Invoke-IcingaCheckHyperVOverCommitment()
-Value $HypervServer.Resources.RAMOverCommit.Bytes `
-Unit 'B' `
-Minimum 0 `
-Maximum $HypervServer.Resources.RAMOverCommit.Capacity
-Maximum $HypervServer.Resources.RAMOverCommit.Capacity `
-MetricIndex 'memory' `
-MetricName 'usedbytes' `
-MetricTemplate 'hypervovercommitmemory'
).WarnOutOfRange(
$RAMOCByteWarn
).CritOutOfRange(
Expand All @@ -191,7 +200,10 @@ function Invoke-IcingaCheckHyperVOverCommitment()
-Value $HypervServer.Resources.RAMOverCommit.Percent `
-Unit '%' `
-Minimum 0 `
-Maximum 100
-Maximum 100 `
-MetricIndex 'memory' `
-MetricName 'usedpercent' `
-MetricTemplate 'hypervovercommitmemory'
).WarnOutOfRange(
$RAMOCPercentWarn
).CritOutOfRange(
Expand All @@ -212,7 +224,10 @@ function Invoke-IcingaCheckHyperVOverCommitment()
-Value $HypervServer.Resources.CPUOverCommit.Cores `
-Unit 'c' `
-Minimum 0 `
-Maximum $HypervServer.Resources.CPUOverCommit.Available
-Maximum $HypervServer.Resources.CPUOverCommit.Available `
-MetricIndex 'cores' `
-MetricName 'usedcores' `
-MetricTemplate 'hypervovercommitcores'
).WarnOutOfRange(
$CPUCoreOCWarn
).CritOutOfRange(
Expand All @@ -228,7 +243,10 @@ function Invoke-IcingaCheckHyperVOverCommitment()
-Value $HypervServer.Resources.CPUOverCommit.Percent `
-Unit '%' `
-Minimum 0 `
-Maximum 100
-Maximum 100 `
-MetricIndex 'cores' `
-MetricName 'usedpercent' `
-MetricTemplate 'hypervovercommitcores'
).WarnOutOfRange(
$CPUOCPercentWarn
).CritOutOfRange(
Expand Down
27 changes: 20 additions & 7 deletions plugins/Invoke-IcingaCheckHyperVSnapshot.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ function Invoke-IcingaCheckHyperVSnapshot()
foreach ($snapshot in $virtualMachine.Snapshots.List) {
[string]$SnapshotName = $snapshot.ElementName;
$SnapshotName = $SnapshotName.Split(' ')[0];
$SnapshotCheckPackage = New-IcingaCheckPackage -Name ([string]::Format('{0} {1}', $SnapshotName, $snapshot.CreationTime)) -OperatorAnd -Verbose $Verbosity;
$SnapshotId = [string]::Format('{0} {1}', $SnapshotName, $snapshot.CreationTime);
$SnapshotCheckPackage = New-IcingaCheckPackage -Name $SnapshotId -OperatorAnd -Verbose $Verbosity;
$SnapshotCheckPackage.AddCheck(
(
New-IcingaCheck `
Expand Down Expand Up @@ -202,14 +203,17 @@ function Invoke-IcingaCheckHyperVSnapshot()
}

foreach ($part in $virtualMachine.Snapshots.Info.Keys) {
$Partition = $virtualMachine.Snapshots.Info[$part];
$SnapshotsCount = $virtualMachine.Snapshots.List.Length;
$Partition = $virtualMachine.Snapshots.Info[$part];
$SnapshotsCount = $virtualMachine.Snapshots.List.Length;
$SnapshotMainCheck.AddCheck(
(
New-IcingaCheck `
-Name ([string]::Format('{0} {1} Count', $virtualMachine.ElementName, $part)) `
-Value $SnapshotsCount `
-Unit 'c'
-Unit 'c' `
-MetricIndex $virtualMachine.ElementName `
-MetricName 'count' `
-MetricTemplate 'hypervsnapshotdata'
).WarnOutOfRange(
$CountSnapshotWarning
).CritOutOfRange(
Expand All @@ -223,7 +227,10 @@ function Invoke-IcingaCheckHyperVSnapshot()
-Name ([string]::Format('{0} {1} Total Snapshot Size', $virtualMachine.ElementName, $part)) `
-Value $Partition.TotalUsed `
-BaseValue $virtualMachine.CurrentUsage `
-Unit 'B'
-Unit 'B' `
-MetricIndex $virtualMachine.ElementName `
-MetricName 'summary' `
-MetricTemplate 'hypervsnapshotdata'
).WarnOutOfRange(
$TotalSnapshotSizeWarning
).CritOutOfRange(
Expand All @@ -239,7 +246,10 @@ function Invoke-IcingaCheckHyperVSnapshot()
New-IcingaCheck `
-Name ([string]::Format('{0} {1} Snapshot count prediction', $virtualMachine.ElementName, $part)) `
-Value $CalculateTotalSnapshots `
-Unit 'c'
-Unit 'c' `
-MetricIndex $virtualMachine.ElementName `
-MetricName 'prediction' `
-MetricTemplate 'hypervsnapshotdata'
).WarnOutOfRange(
$SnapshotSizePredictionWarning
).CritOutOfRange(
Expand All @@ -254,7 +264,10 @@ function Invoke-IcingaCheckHyperVSnapshot()
New-IcingaCheck `
-Name ([string]::Format('{0}: Latest Snapshot Creation Delta', $virtualMachine.ElementName)) `
-Value (Compare-IcingaUnixTimeWithDateTime -DateTime $virtualMachine.Snapshots.Latest.CreationTime) `
-Unit 's'
-Unit 's' `
-MetricIndex $virtualMachine.ElementName `
-MetricName 'created' `
-MetricTemplate 'hypervsnapshotvm'
).WarnOutOfRange(
$CreationTimeWarning
).CritOutOfRange(
Expand Down
14 changes: 10 additions & 4 deletions plugins/Invoke-IcingaCheckHyperVVMHealth.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ function Invoke-IcingaCheckHyperVVMHealth()
$HeartBeatCheck = New-IcingaCheck `
-Name ([string]::Format('{0} Heartbeat', $virtualComputer.ElementName)) `
-Value $virtualComputer.Heartbeat `
-Translation $HypervProviderEnums.VMHeartbeat;
-Translation $HypervProviderEnums.VMHeartbeat `
-MetricIndex $virtualComputer.ElementName `
-MetricName 'heartbeat';

if ($SkipVMHeartbeat -eq $FALSE) {
$HeartBeatCheck.WarnIfMatch(
Expand All @@ -139,7 +141,9 @@ function Invoke-IcingaCheckHyperVVMHealth()
$EnabledStateCheck = New-IcingaCheck `
-Name ([string]::Format('{0} State', $virtualComputer.ElementName)) `
-Value $virtualComputer.EnabledState `
-Translation $HypervProviderEnums.VMEnabledState;
-Translation $HypervProviderEnums.VMEnabledState `
-MetricIndex $virtualComputer.ElementName `
-MetricName 'state';

if ($NegateVMState) {
$EnabledStateCheck.CritIfNotMatch($HypervProviderEnums.VMEnabledStateName[[string]$VmEnabledState]) | Out-Null;
Expand All @@ -154,7 +158,9 @@ function Invoke-IcingaCheckHyperVVMHealth()
New-IcingaCheck `
-Name ([string]::Format('{0} HealthState', $virtualComputer.ElementName)) `
-Value $virtualComputer.HealthState `
-Translation $HypervProviderEnums.VMHealthState
-Translation $HypervProviderEnums.VMHealthState `
-MetricIndex $virtualComputer.ElementName `
-MetricName 'health'
).WarnIfNotMatch(
$HypervProviderEnums.VMHealthStateName.OK
)
Expand All @@ -172,7 +178,7 @@ function Invoke-IcingaCheckHyperVVMHealth()

$HiddenCheckPackage.AddCheck(
(
New-IcingaCheck -Name $item -Value ($VirtualComputers.Summary[$item])
New-IcingaCheck -Name $item -Value ($VirtualComputers.Summary[$item]) -MetricIndex 'summary' -MetricName $item
)
);
}
Expand Down
4 changes: 3 additions & 1 deletion plugins/Invoke-IcingaCheckHyperVVirtualSwitches.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ function Invoke-IcingaCheckHyperVVirtualSwitches()
New-IcingaCheck `
-Name ([string]::Format('{0} HealthState', $CheckPackageName)) `
-Value $VirtualSwitch.HealthState `
-Translation $HypervProviderEnums.VMHealthState
-Translation $HypervProviderEnums.VMHealthState `
-MetricIndex $CheckPackageName `
-MetricName 'health'
).CritIfNotMatch(
$HypervProviderEnums.VMHealthStateName.OK
)
Expand Down

0 comments on commit 468138b

Please sign in to comment.