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
This commit is contained in:
Lord Hepipud 2024-03-13 17:39:17 +01:00 committed by GitHub
commit c10b8f69bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 40 additions and 25 deletions

View file

@ -28,6 +28,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#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 * [#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
* [#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 * [#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
* [#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 * [#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
* [#694](https://github.com/Icinga/icinga-powershell-framework/pull/694) Adds support for check objects not being added to summary header
## 1.11.2 (tbd) ## 1.11.2 (tbd)

View file

@ -1,19 +1,20 @@
function New-IcingaCheck() function New-IcingaCheck()
{ {
param( param(
[string]$Name = '', [string]$Name = '',
$Value = $null, $Value = $null,
$BaseValue = $null, $BaseValue = $null,
$Unit = '', $Unit = '',
$MetricIndex = 'default', $MetricIndex = 'default',
$MetricName = '', $MetricName = '',
$MetricTemplate = '', $MetricTemplate = '',
[string]$Minimum = '', [string]$Minimum = '',
[string]$Maximum = '', [string]$Maximum = '',
$ObjectExists = -1, $ObjectExists = -1,
$Translation = $null, $Translation = $null,
[string]$LabelName = $null, [string]$LabelName = $null,
[switch]$NoPerfData = $FALSE [switch]$NoPerfData = $FALSE,
[switch]$NoHeaderReport = $FALSE
); );
$IcingaCheck = New-IcingaCheckBaseObject; $IcingaCheck = New-IcingaCheckBaseObject;
@ -45,6 +46,8 @@ function New-IcingaCheck()
$IcingaCheck | Add-Member -MemberType NoteProperty -Name '__ThresholdObject' -Value $null; $IcingaCheck | Add-Member -MemberType NoteProperty -Name '__ThresholdObject' -Value $null;
$IcingaCheck | Add-Member -MemberType NoteProperty -Name '__TimeInterval' -Value $null; $IcingaCheck | Add-Member -MemberType NoteProperty -Name '__TimeInterval' -Value $null;
$IcingaCheck.__SetNoHeaderReport($NoHeaderReport);
$IcingaCheck | Add-Member -MemberType ScriptMethod -Force -Name 'Compile' -Value { $IcingaCheck | Add-Member -MemberType ScriptMethod -Force -Name 'Compile' -Value {
$this.__ValidateThresholdInput(); $this.__ValidateThresholdInput();
if ($null -eq $this.__ThresholdObject) { if ($null -eq $this.__ThresholdObject) {

View file

@ -2,17 +2,18 @@ function New-IcingaCheckBaseObject()
{ {
$IcingaCheckBaseObject = New-Object -TypeName PSObject; $IcingaCheckBaseObject = New-Object -TypeName PSObject;
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name 'Name' -Value ''; $IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name 'Name' -Value '';
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name 'Verbose' -Value 0; $IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name 'Verbose' -Value 0;
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckPerfData' -Value @{ }; $IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckPerfData' -Value @{ };
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__Hidden' -Value $FALSE; $IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__Hidden' -Value $FALSE;
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__Parent' -Value $IcingaCheckBaseObject; $IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__SkipSummary' -Value $FALSE;
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__Indention' -Value 0; $IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__Parent' -Value $IcingaCheckBaseObject;
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__ErrorMessage' -Value ''; $IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__Indention' -Value 0;
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckState' -Value $IcingaEnums.IcingaExitCode.Ok; $IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__ErrorMessage' -Value '';
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckCommand' -Value ''; $IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckState' -Value $IcingaEnums.IcingaExitCode.Ok;
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckOutput' -Value $null; $IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckCommand' -Value '';
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__ObjectType' -Value 'IcingaCheckBaseObject'; $IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__CheckOutput' -Value $null;
$IcingaCheckBaseObject | Add-Member -MemberType NoteProperty -Name '__ObjectType' -Value 'IcingaCheckBaseObject';
$IcingaCheckBaseObject | Add-Member -MemberType ScriptMethod -Name '__SetCheckCommand' -Value { $IcingaCheckBaseObject | Add-Member -MemberType ScriptMethod -Name '__SetCheckCommand' -Value {
$CallStack = Get-PSCallStack; $CallStack = Get-PSCallStack;
@ -65,6 +66,16 @@ function New-IcingaCheckBaseObject()
$this.__Hidden = $Hidden; $this.__Hidden = $Hidden;
} }
$IcingaCheckBaseObject | Add-Member -MemberType ScriptMethod -Name '__NoHeaderReport' -Value {
return $this.__SkipSummary;
}
$IcingaCheckBaseObject | Add-Member -MemberType ScriptMethod -Name '__SetNoHeaderReport' -Value {
param ([bool]$SkipSummary);
$this.__SkipSummary = $SkipSummary;
}
$IcingaCheckBaseObject | Add-Member -MemberType ScriptMethod -Name '__GetName' -Value { $IcingaCheckBaseObject | Add-Member -MemberType ScriptMethod -Name '__GetName' -Value {
return $this.Name; return $this.Name;
} }

View file

@ -179,7 +179,7 @@ function New-IcingaCheckPackage()
$check.Compile(); $check.Compile();
if ($check.__IsHidden()) { if ($check.__IsHidden() -Or $check.__NoHeaderReport()) {
continue; continue;
} }