mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Added support to skip perfdata for single checks
This commit is contained in:
parent
1093cd17dc
commit
4392714da3
1 changed files with 8 additions and 7 deletions
|
|
@ -4,11 +4,12 @@ Import-IcingaLib core\tools;
|
|||
function New-IcingaCheck()
|
||||
{
|
||||
param(
|
||||
[string]$Name = '',
|
||||
$Value = $null,
|
||||
$Unit = $null,
|
||||
[string]$Minimum = '',
|
||||
[string]$Maximum = ''
|
||||
[string]$Name = '',
|
||||
$Value = $null,
|
||||
$Unit = $null,
|
||||
[string]$Minimum = '',
|
||||
[string]$Maximum = '',
|
||||
[switch]$NoPerfData
|
||||
);
|
||||
|
||||
$Check = New-Object -TypeName PSObject;
|
||||
|
|
@ -24,7 +25,7 @@ function New-IcingaCheck()
|
|||
$Check | Add-Member -membertype NoteProperty -name 'unit' -value $Unit;
|
||||
$Check | Add-Member -membertype NoteProperty -name 'spacing' -value 0;
|
||||
$Check | Add-Member -membertype NoteProperty -name 'compiled' -value $FALSE;
|
||||
$Check | Add-Member -membertype NoteProperty -name 'perfdata' -value $TRUE;
|
||||
$Check | Add-Member -membertype NoteProperty -name 'perfdata' -value (-Not $NoPerfData);
|
||||
$Check | Add-Member -membertype NoteProperty -name 'warning' -value '';
|
||||
$Check | Add-Member -membertype NoteProperty -name 'critical' -value '';
|
||||
$Check | Add-Member -membertype NoteProperty -name 'minimum' -value $Minimum;
|
||||
|
|
@ -580,7 +581,7 @@ function New-IcingaCheck()
|
|||
|
||||
$Check | Add-Member -membertype ScriptMethod -name 'GetPerfData' -value {
|
||||
|
||||
if ($this.completed) {
|
||||
if ($this.completed -Or -Not $this.perfdata) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue