mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Fixes perfdata not written for unprocessed checks
This commit is contained in:
parent
0a28e25ab0
commit
8c48ed570b
1 changed files with 11 additions and 7 deletions
|
|
@ -80,6 +80,12 @@ function New-IcingaCheck()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$IcingaCheck | Add-Member -MemberType ScriptMethod -Force -Name '__CreateDefaultThresholdObject' -Value {
|
||||||
|
[hashtable]$ThresholdArguments = $this.__GetBaseThresholdArguments();
|
||||||
|
$ThresholdObject = Compare-IcingaPluginThresholds @ThresholdArguments;
|
||||||
|
$this.__SetCheckState($ThresholdObject, $IcingaEnums.IcingaExitCode.Ok);
|
||||||
|
}
|
||||||
|
|
||||||
# Override shared function
|
# Override shared function
|
||||||
$IcingaCheck | Add-Member -MemberType ScriptMethod -Force -Name '__SetCheckOutput' -Value {
|
$IcingaCheck | Add-Member -MemberType ScriptMethod -Force -Name '__SetCheckOutput' -Value {
|
||||||
param ($PluginOutput);
|
param ($PluginOutput);
|
||||||
|
|
@ -88,15 +94,13 @@ function New-IcingaCheck()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($null -eq $this.__ThresholdObject) {
|
||||||
|
$this.__CreateDefaultThresholdObject();
|
||||||
|
}
|
||||||
|
|
||||||
$PluginThresholds = '';
|
$PluginThresholds = '';
|
||||||
$TimeSpan = '';
|
$TimeSpan = '';
|
||||||
|
$PluginThresholds = $this.__ThresholdObject.FullMessage;
|
||||||
if ($null -ne $this.__ThresholdObject) {
|
|
||||||
$PluginThresholds = $this.__ThresholdObject.FullMessage;
|
|
||||||
} elseif ($null -ne $this.Value) {
|
|
||||||
# In case we simply added a value to a check and not did anything with it, output the raw value properly formatted like anything else
|
|
||||||
$PluginThresholds = (ConvertTo-IcingaPluginOutputTranslation -Translation $this.Translation -Value (Convert-IcingaPluginValueToString -Unit $this.Unit -Value $this.Value));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($PluginOutput) -eq $FALSE) {
|
if ([string]::IsNullOrEmpty($PluginOutput) -eq $FALSE) {
|
||||||
$PluginThresholds = $PluginOutput;
|
$PluginThresholds = $PluginOutput;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue