Skip to content

Commit c10b8f6

Browse files
authored
Merge pull request #694 from Icinga:feature/adds_support_for_checks_not_being_added_to_summary_header
Feature: Adds support for check objects not being added to summary header Adds support for check objects not being added to summary header
2 parents 4337081 + 0c83f7a commit c10b8f6

File tree

4 files changed

+40
-25
lines changed

4 files changed

+40
-25
lines changed

doc/100-General/10-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
2828
* [#690](https://github.com/Icinga/icinga-powershell-framework/pull/690) Adds automatic renewal of the `icingaforwindows.pfx` certificate for the REST-Api daemon in case the certificate is not yet present, valid or changed during the runtime of the daemon while also making the `icingaforwindows.pfx` mandatory for all installations, regardless of JEA being used or not
2929
* [#692](https://github.com/Icinga/icinga-powershell-framework/pull/692) Renames `Restart-IcingaWindowsService` to `Restart-IcingaForWindows` and adds alias for backwards compatibility to start unifying the Icinga for Windows cmdlets
3030
* [#693](https://github.com/Icinga/icinga-powershell-framework/pull/693) Adds new command `Restart-Icinga` to restart both, the Icinga Agent and Icinga for Windows
31+
* [#694](https://github.com/Icinga/icinga-powershell-framework/pull/694) Adds support for check objects not being added to summary header
3132

3233
## 1.11.2 (tbd)
3334

lib/icinga/plugin/New-IcingaCheck.psm1

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
function New-IcingaCheck()
22
{
33
param(
4-
[string]$Name = '',
5-
$Value = $null,
6-
$BaseValue = $null,
7-
$Unit = '',
8-
$MetricIndex = 'default',
9-
$MetricName = '',
10-
$MetricTemplate = '',
11-
[string]$Minimum = '',
12-
[string]$Maximum = '',
13-
$ObjectExists = -1,
14-
$Translation = $null,
15-
[string]$LabelName = $null,
16-
[switch]$NoPerfData = $FALSE
4+
[string]$Name = '',
5+
$Value = $null,
6+
$BaseValue = $null,
7+
$Unit = '',
8+
$MetricIndex = 'default',
9+
$MetricName = '',
10+
$MetricTemplate = '',
11+
[string]$Minimum = '',
12+
[string]$Maximum = '',
13+
$ObjectExists = -1,
14+
$Translation = $null,
15+
[string]$LabelName = $null,
16+
[switch]$NoPerfData = $FALSE,
17+
[switch]$NoHeaderReport = $FALSE
1718
);
1819

1920
$IcingaCheck = New-IcingaCheckBaseObject;
@@ -45,6 +46,8 @@ function New-IcingaCheck()
4546
$IcingaCheck | Add-Member -MemberType NoteProperty -Name '__ThresholdObject' -Value $null;
4647
$IcingaCheck | Add-Member -MemberType NoteProperty -Name '__TimeInterval' -Value $null;
4748

49+
$IcingaCheck.__SetNoHeaderReport($NoHeaderReport);
50+
4851
$IcingaCheck | Add-Member -MemberType ScriptMethod -Force -Name 'Compile' -Value {
4952
$this.__ValidateThresholdInput();
5053
if ($null -eq $this.__ThresholdObject) {

lib/icinga/plugin/New-IcingaCheckBaseObject.psm1

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ function New-IcingaCheckBaseObject()
22
{
33
$IcingaCheckBaseObject = New-Object -TypeName PSObject;
44

5-
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name 'Name' -Value '';
6-
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name 'Verbose' -Value 0;
7-
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckPerfData' -Value @{ };
8-
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__Hidden' -Value $FALSE;
9-
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__Parent' -Value $IcingaCheckBaseObject;
10-
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__Indention' -Value 0;
11-
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__ErrorMessage' -Value '';
12-
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckState' -Value $IcingaEnums.IcingaExitCode.Ok;
13-
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckCommand' -Value '';
14-
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckOutput' -Value $null;
15-
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__ObjectType' -Value 'IcingaCheckBaseObject';
5+
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name 'Name' -Value '';
6+
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name 'Verbose' -Value 0;
7+
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckPerfData' -Value @{ };
8+
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__Hidden' -Value $FALSE;
9+
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__SkipSummary' -Value $FALSE;
10+
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__Parent' -Value $IcingaCheckBaseObject;
11+
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__Indention' -Value 0;
12+
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__ErrorMessage' -Value '';
13+
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckState' -Value $IcingaEnums.IcingaExitCode.Ok;
14+
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckCommand' -Value '';
15+
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckOutput' -Value $null;
16+
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__ObjectType' -Value 'IcingaCheckBaseObject';
1617

1718
$IcingaCheckBaseObject | Add-Member -MemberType ScriptMethod -Name '__SetCheckCommand' -Value {
1819
$CallStack = Get-PSCallStack;
@@ -65,6 +66,16 @@ function New-IcingaCheckBaseObject()
6566
$this.__Hidden = $Hidden;
6667
}
6768

69+
$IcingaCheckBaseObject | Add-Member -MemberType ScriptMethod -Name '__NoHeaderReport' -Value {
70+
return $this.__SkipSummary;
71+
}
72+
73+
$IcingaCheckBaseObject | Add-Member -MemberType ScriptMethod -Name '__SetNoHeaderReport' -Value {
74+
param ([bool]$SkipSummary);
75+
76+
$this.__SkipSummary = $SkipSummary;
77+
}
78+
6879
$IcingaCheckBaseObject | Add-Member -MemberType ScriptMethod -Name '__GetName' -Value {
6980
return $this.Name;
7081
}

lib/icinga/plugin/New-IcingaCheckPackage.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ function New-IcingaCheckPackage()
179179

180180
$check.Compile();
181181

182-
if ($check.__IsHidden()) {
182+
if ($check.__IsHidden() -Or $check.__NoHeaderReport()) {
183183
continue;
184184
}
185185

0 commit comments

Comments
 (0)