mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Adds feature to customize label for checks
This commit is contained in:
parent
ec65665c25
commit
b6da72b2b4
3 changed files with 9 additions and 1 deletions
|
|
@ -18,6 +18,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
||||||
* [#198](https://github.com/Icinga/icinga-powershell-framework/pull/198) Adds support to flush the content of the Icinga Agent API directory with a single Cmdlet `Clear-IcingaAgentApiDirectory`
|
* [#198](https://github.com/Icinga/icinga-powershell-framework/pull/198) Adds support to flush the content of the Icinga Agent API directory with a single Cmdlet `Clear-IcingaAgentApiDirectory`
|
||||||
* [#203](https://github.com/Icinga/icinga-powershell-framework/pull/203) Removes experimental state of the Icinga PowerShell Framework code caching and adds docs on how to use the feature
|
* [#203](https://github.com/Icinga/icinga-powershell-framework/pull/203) Removes experimental state of the Icinga PowerShell Framework code caching and adds docs on how to use the feature
|
||||||
* [#205](https://github.com/Icinga/icinga-powershell-framework/pull/205) Ensure Icinga for Windows configuration file is opened as read-only for every single task besides actually modifying configuration content
|
* [#205](https://github.com/Icinga/icinga-powershell-framework/pull/205) Ensure Icinga for Windows configuration file is opened as read-only for every single task besides actually modifying configuration content
|
||||||
|
* [#207](https://github.com/Icinga/icinga-powershell-framework/pull/207) Adds new Argument `-LabelName` to `New-IcingaCheck`, allowing the developer to provide custom label names for checks and override the default based on the check name.
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,14 @@ For performance metrics you can provide a `Unit` to ensure your graphing is disp
|
||||||
| Maximum | String | | The maximum value which is displayed on your graphs |
|
| Maximum | String | | The maximum value which is displayed on your graphs |
|
||||||
| ObjectExists | Bool | | If you are using values coming from objects, like Services, you can use this argument to determin if the object itself exist or not. In case it doesn't, you will receive a proper output on the check result |
|
| ObjectExists | Bool | | If you are using values coming from objects, like Services, you can use this argument to determin if the object itself exist or not. In case it doesn't, you will receive a proper output on the check result |
|
||||||
| Translation | Hashtable | | In case you want to map values to certain descriptions, you can place a hashtable at this argument which will then map the value to the description on the check result. For example this would apply to service running states |
|
| Translation | Hashtable | | In case you want to map values to certain descriptions, you can place a hashtable at this argument which will then map the value to the description on the check result. For example this would apply to service running states |
|
||||||
|
| LabelName | String | | Allows to override the default label name generated based on the `-Name` argument to a custom name. Please ensure to remove any special characters manually, as the name set here is the exact name for the label |
|
||||||
| NoPerfData | Switch | | Disables Performance Data output for this check object |
|
| NoPerfData | Switch | | Disables Performance Data output for this check object |
|
||||||
|
|
||||||
## Units
|
## Units
|
||||||
|
|
||||||
| Unit | Name | Description |
|
| Unit | Name | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| % | Percentage | The input value is a percentual value |
|
| % | Percentage | The input value is a percentage value |
|
||||||
| s | Seconds | The input is indicated as time seconds |
|
| s | Seconds | The input is indicated as time seconds |
|
||||||
| ms | Milliseconds | The input is indicated as time in milliseconds |
|
| ms | Milliseconds | The input is indicated as time in milliseconds |
|
||||||
| us | Microseconds | The input is indicated as time in microseconds |
|
| us | Microseconds | The input is indicated as time in microseconds |
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ function New-IcingaCheck()
|
||||||
[string]$Maximum = '',
|
[string]$Maximum = '',
|
||||||
$ObjectExists = -1,
|
$ObjectExists = -1,
|
||||||
$Translation = $null,
|
$Translation = $null,
|
||||||
|
[string]$LabelName = $null,
|
||||||
[switch]$NoPerfData
|
[switch]$NoPerfData
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -38,6 +39,7 @@ function New-IcingaCheck()
|
||||||
$Check | Add-Member -MemberType NoteProperty -Name 'maximum' -Value $Maximum;
|
$Check | Add-Member -MemberType NoteProperty -Name 'maximum' -Value $Maximum;
|
||||||
$Check | Add-Member -MemberType NoteProperty -Name 'objectexists' -Value $ObjectExists;
|
$Check | Add-Member -MemberType NoteProperty -Name 'objectexists' -Value $ObjectExists;
|
||||||
$Check | Add-Member -MemberType NoteProperty -Name 'translation' -Value $Translation;
|
$Check | Add-Member -MemberType NoteProperty -Name 'translation' -Value $Translation;
|
||||||
|
$Check | Add-Member -MemberType NoteProperty -Name 'labelname' -Value $LabelName;
|
||||||
$Check | Add-Member -MemberType NoteProperty -Name 'checks' -Value $null;
|
$Check | Add-Member -MemberType NoteProperty -Name 'checks' -Value $null;
|
||||||
$Check | Add-Member -MemberType NoteProperty -Name 'completed' -Value $FALSE;
|
$Check | Add-Member -MemberType NoteProperty -Name 'completed' -Value $FALSE;
|
||||||
$Check | Add-Member -MemberType NoteProperty -Name 'checkcommand' -Value '';
|
$Check | Add-Member -MemberType NoteProperty -Name 'checkcommand' -Value '';
|
||||||
|
|
@ -803,6 +805,10 @@ function New-IcingaCheck()
|
||||||
$warning = ConvertTo-Integer -Value $this.warning -NullAsEmpty;
|
$warning = ConvertTo-Integer -Value $this.warning -NullAsEmpty;
|
||||||
$critical = ConvertTo-Integer -Value $this.critical -NullAsEmpty;
|
$critical = ConvertTo-Integer -Value $this.critical -NullAsEmpty;
|
||||||
|
|
||||||
|
if ([string]::IsNullOrEmpty($this.labelname) -eq $FALSE) {
|
||||||
|
$LabelName = $this.labelname;
|
||||||
|
}
|
||||||
|
|
||||||
$perfdata = @{
|
$perfdata = @{
|
||||||
'label' = $LabelName;
|
'label' = $LabelName;
|
||||||
'perfdata' = '';
|
'perfdata' = '';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue