Skip to content

Commit c0babf9

Browse files
committed
ver. 0.9.2
1 parent de2e6da commit c0babf9

18 files changed

+273
-428
lines changed

LICENSE

Lines changed: 0 additions & 339 deletions
This file was deleted.

PSScriptAnalyzerSettings.psd1

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
@{
2+
Severity = @(
3+
'Error',
4+
'Warning',
5+
'Information'
6+
);
7+
IncludeRules = @(
8+
'PSAvoidUsingPositionalParameters',
9+
'PSAvoidUsingInternalURLs',
10+
'PSAvoidUninitializedVariable',
11+
'PSUseApprovedVerbs',
12+
'PSAvoidUsingCmdletAliases',
13+
'PSAvoidUsingPlainTextForPassword',
14+
'PSMissingModuleManifestField',
15+
'PSUseDeclaredVarsMoreThanAssignments',
16+
'PSAvoidTrailingWhitespace',
17+
'PSAvoidUsingDeprecatedManifestFields',
18+
'PSUseToExportFieldsInManifest',
19+
'PSUseProcessBlockForPipelineCommand',
20+
'PSUseConsistentIndentation',
21+
'PSUseCompatibleCmdlets',
22+
'PSUseConsistentWhitespace',
23+
'PSAlignAssignmentStatement',
24+
'PSUseCorrectCasing'
25+
);
26+
ExcludeRules = @(
27+
'PSAvoidGlobalVars',
28+
'PSUseSingularNouns',
29+
'PSAvoidUsingWriteHost'
30+
)
31+
Rules = @{
32+
PSUseCompatibleCmdlets = @{
33+
Compatibility = @("4.0")
34+
};
35+
PSPlaceOpenBrace = @{
36+
Enable = $true
37+
OnSameLine = $false
38+
NewLineAfter = $true
39+
IgnoreOneLineBlock = $true
40+
};
41+
PSPlaceCloseBrace = @{
42+
Enable = $true
43+
NewLineAfter = $true
44+
IgnoreOneLineBlock = $true
45+
NoEmptyLineBefore = $true
46+
};
47+
PSUseConsistentIndentation = @{
48+
Enable = $true
49+
Kind = 'space'
50+
IndentationSize = 4
51+
PipelineIndentation = 'IncreaseIndentationForFirstPipeline'
52+
};
53+
PSUseConsistentWhitespace = @{
54+
Enable = $true
55+
CheckOpenBrace = $false
56+
CheckOpenParen = $true
57+
CheckOperator = $false
58+
CheckSeparator = $true
59+
};
60+
PSAlignAssignmentStatement = @{
61+
Enable = $true
62+
};
63+
PSUseCorrectCasing = @{
64+
Enable = $true
65+
};
66+
}
67+
}

README.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
# Icinga PowerShell Plugins
1+
# Icinga for Windows - psplugins
22

3-
This repository provides a collection of Windows check Plugins for the [Icinga PowerShell Framework](https://github.com/Icinga/icinga-powershell-framework)
3+
This is the auto generated readme for the Icinga for Windows Module `icinga-powershell-psplugins`
44

5-
## Documentation
5+
You can start to modify this readme including writing your PowerShell code. Use "Publish-IcingaForWindowsComponent" to generate Icinga 2/Icinga Director configuration files for plugins, auto-generate your configuration and update your module manifest to include all module files you created into the base module.
66

7-
Please take a look at the following content to get to know the extent of the module including examples on how to use it.
8-
9-
* [Introduction](doc/01-Introduction.md)
10-
* [Plugin Documentation](doc/10-Icinga-Plugins.md)
11-
12-
## Contributing
13-
14-
* Please check whether a related issue already exists on our [Issue Tracker](https://github.com/plsatin/icinga-powershell-psplugins/issues)
15-
* Send a [Pull Request](https://github.com/plsatin/icinga-powershell-psplugins/pulls)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"DataList":{"IcingaCheckDiskStatus Verbosity":{"list_name":"IcingaCheckDiskStatus Verbosity","originalId":"2","entries":[{"allowed_roles":null,"entry_value":"0","entry_name":"0","format":"string"},{"allowed_roles":null,"entry_value":"1","entry_name":"1","format":"string"},{"allowed_roles":null,"entry_value":"2","entry_name":"2","format":"string"},{"allowed_roles":null,"entry_value":"3","entry_name":"3","format":"string"}],"owner":"it4_adm"},"PowerShell ExecutionPolicies":{"list_name":"PowerShell ExecutionPolicies","originalId":"2","entries":[{"allowed_roles":null,"entry_value":"AllSigned","entry_name":"AllSigned","format":"string"},{"allowed_roles":null,"entry_value":"Bypass","entry_name":"Bypass","format":"string"},{"allowed_roles":null,"entry_value":"Default","entry_name":"Default","format":"string"},{"allowed_roles":null,"entry_value":"RemoteSigned","entry_name":"RemoteSigned","format":"string"},{"allowed_roles":null,"entry_value":"Restricted","entry_name":"Restricted","format":"string"},{"allowed_roles":null,"entry_value":"Undefined","entry_name":"Undefined","format":"string"},{"allowed_roles":null,"entry_value":"Unrestricted","entry_name":"Unrestricted","format":"string"}],"owner":"it4_adm"}},"Command":{"PowerShell Base":{"methods_execute":"PluginCheck","object_name":"PowerShell Base","vars":{"IcingaPowerShellBase_String_ExecutionPolicy":"ByPass"},"is_string":null,"command":"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe","zone":null,"disabled":false,"fields":[{"datafield_id":2,"is_required":"n","var_filter":null}],"arguments":{"-ExecutionPolicy":{"value":"$IcingaPowerShellBase_String_ExecutionPolicy$","order":"-1"},"-NoProfile":{"set_if":true,"order":"-3"},"-NoLogo":{"set_if":true,"order":"-2"}},"imports":[],"object_type":"object","timeout":"180"},"Invoke-IcingaCheckDiskStatus":{"fields":[{"datafield_id":4,"is_required":"n","var_filter":null},{"datafield_id":5,"is_required":"n","var_filter":null},{"datafield_id":6,"is_required":"n","var_filter":null}],"object_name":"Invoke-IcingaCheckDiskStatus","arguments":{"-C":{"value":"try { Use-Icinga -Minimal; } catch { Write-Output \u0027The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details\u0027; Write-Output \u0027Error:\u0027 $$($$_.Exception.Message)Components:`r`n$$( Get-Module -ListAvailable \u0027icinga-powershell-*\u0027 )`r`n\u0027Module-Path:\u0027`r`n$$($$Env:PSModulePath); exit 3; }; Exit-IcingaExecutePlugin -Command \u0027Invoke-IcingaCheckDiskStatus\u0027 ","order":"0"},"-ThresholdInterval":{"value":"$IcingaCheckDiskStatus_String_ThresholdInterval$","order":"100"},"-NoPerfData":{"set_if":"$IcingaCheckDiskStatus_Switchparameter_NoPerfData$","set_if_format":"string","order":"99"},"-Verbosity":{"value":"$IcingaCheckDiskStatus_Int32_Verbosity$","order":"2"}},"imports":["PowerShell Base"],"object_type":"object","vars":{"IcingaCheckDiskStatus_Switchparameter_NoPerfData":false}}},"Datafield":{"2":{"settings":{"datalist":"PowerShell ExecutionPolicies","behavior":"strict","data_type":"string"},"description":"Defines with which Execution Policy the PowerShell is started","caption":"PowerShell Execution Policy","datatype":"Icinga\\Module\\Director\\DataType\\DataTypeDatalist","originalId":"2","varname":"IcingaPowerShellBase_String_ExecutionPolicy","format":null},"6":{"settings":{"datalist":"IcingaCheckDiskStatus Verbosity","behavior":"strict","data_type":"string"},"description":null,"caption":"Verbosity","datatype":"Icinga\\Module\\Director\\DataType\\DataTypeDatalist","originalId":"6","varname":"IcingaCheckDiskStatus_Int32_Verbosity","format":null},"4":{"settings":{"visibility":"visible"},"description":"Change the value your defined threshold checks against from the current value to a collected time threshold of the Icinga for Windows daemon, as described here: https://icinga.com/docs/icinga-for-windows/latest/doc/service/10-Register-Service-Checks/ An example for this argument would be 1m or 15m which will use the average of 1m or 15m for monitoring.","caption":"ThresholdInterval","datatype":"Icinga\\Module\\Director\\DataType\\DataTypeString","originalId":"4","varname":"IcingaCheckDiskStatus_String_ThresholdInterval","format":null},"5":{"settings":{"visibility":"visible"},"description":null,"caption":"NoPerfData","datatype":"Icinga\\Module\\Director\\DataType\\DataTypeBoolean","originalId":"5","varname":"IcingaCheckDiskStatus_Switchparameter_NoPerfData","format":null}}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"DataList":{"IcingaCheckDiskStatus Verbosity":{"list_name":"IcingaCheckDiskStatus Verbosity","originalId":"2","entries":[{"allowed_roles":null,"entry_value":"0","entry_name":"0","format":"string"},{"allowed_roles":null,"entry_value":"1","entry_name":"1","format":"string"},{"allowed_roles":null,"entry_value":"2","entry_name":"2","format":"string"},{"allowed_roles":null,"entry_value":"3","entry_name":"3","format":"string"}],"owner":"it4_adm"},"PowerShell ExecutionPolicies":{"list_name":"PowerShell ExecutionPolicies","originalId":"2","entries":[{"allowed_roles":null,"entry_value":"AllSigned","entry_name":"AllSigned","format":"string"},{"allowed_roles":null,"entry_value":"Bypass","entry_name":"Bypass","format":"string"},{"allowed_roles":null,"entry_value":"Default","entry_name":"Default","format":"string"},{"allowed_roles":null,"entry_value":"RemoteSigned","entry_name":"RemoteSigned","format":"string"},{"allowed_roles":null,"entry_value":"Restricted","entry_name":"Restricted","format":"string"},{"allowed_roles":null,"entry_value":"Undefined","entry_name":"Undefined","format":"string"},{"allowed_roles":null,"entry_value":"Unrestricted","entry_name":"Unrestricted","format":"string"}],"owner":"it4_adm"}},"Command":{"PowerShell Base":{"methods_execute":"PluginCheck","object_name":"PowerShell Base","vars":{"IcingaPowerShellBase_String_ExecutionPolicy":"ByPass"},"is_string":null,"command":"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe","zone":null,"disabled":false,"fields":[{"datafield_id":2,"is_required":"n","var_filter":null}],"arguments":{"-ExecutionPolicy":{"value":"$IcingaPowerShellBase_String_ExecutionPolicy$","order":"-1"},"-NoProfile":{"set_if":true,"order":"-3"},"-NoLogo":{"set_if":true,"order":"-2"}},"imports":[],"object_type":"object","timeout":"180"},"Invoke-IcingaCheckDiskStatus":{"fields":[{"datafield_id":4,"is_required":"n","var_filter":null},{"datafield_id":5,"is_required":"n","var_filter":null},{"datafield_id":6,"is_required":"n","var_filter":null}],"object_name":"Invoke-IcingaCheckDiskStatus","arguments":{"-C":{"value":"try { Use-Icinga -Minimal; } catch { Write-Output \u0027The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details\u0027; Write-Output \u0027Error:\u0027 $$($$_.Exception.Message)Components:`r`n$$( Get-Module -ListAvailable \u0027icinga-powershell-*\u0027 )`r`n\u0027Module-Path:\u0027`r`n$$($$Env:PSModulePath); exit 3; }; Exit-IcingaExecutePlugin -Command \u0027Invoke-IcingaCheckDiskStatus\u0027 ","order":"0"},"-ThresholdInterval":{"value":"$IcingaCheckDiskStatus_String_ThresholdInterval$","order":"100"},"-NoPerfData":{"set_if":"$IcingaCheckDiskStatus_Switchparameter_NoPerfData$","set_if_format":"string","order":"99"},"-Verbosity":{"value":"$IcingaCheckDiskStatus_Int32_Verbosity$","order":"2"}},"imports":["PowerShell Base"],"object_type":"object","vars":{"IcingaCheckDiskStatus_Switchparameter_NoPerfData":false}}},"Datafield":{"2":{"settings":{"datalist":"PowerShell ExecutionPolicies","behavior":"strict","data_type":"string"},"description":"Defines with which Execution Policy the PowerShell is started","caption":"PowerShell Execution Policy","datatype":"Icinga\\Module\\Director\\DataType\\DataTypeDatalist","originalId":"2","varname":"IcingaPowerShellBase_String_ExecutionPolicy","format":null},"6":{"settings":{"datalist":"IcingaCheckDiskStatus Verbosity","behavior":"strict","data_type":"string"},"description":null,"caption":"Verbosity","datatype":"Icinga\\Module\\Director\\DataType\\DataTypeDatalist","originalId":"6","varname":"IcingaCheckDiskStatus_Int32_Verbosity","format":null},"4":{"settings":{"visibility":"visible"},"description":"Change the value your defined threshold checks against from the current value to a collected time threshold of the Icinga for Windows daemon, as described here: https://icinga.com/docs/icinga-for-windows/latest/doc/service/10-Register-Service-Checks/ An example for this argument would be 1m or 15m which will use the average of 1m or 15m for monitoring.","caption":"ThresholdInterval","datatype":"Icinga\\Module\\Director\\DataType\\DataTypeString","originalId":"4","varname":"IcingaCheckDiskStatus_String_ThresholdInterval","format":null},"5":{"settings":{"visibility":"visible"},"description":null,"caption":"NoPerfData","datatype":"Icinga\\Module\\Director\\DataType\\DataTypeBoolean","originalId":"5","varname":"IcingaCheckDiskStatus_Switchparameter_NoPerfData","format":null}}}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
object CheckCommand "Invoke-IcingaCheckDiskStatus" {
2+
import "PowerShell Base"
3+
4+
arguments += {
5+
"-C" = {
6+
value = "try { Use-Icinga -Minimal; } catch { Write-Output 'The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details'; Write-Output 'Error:' $$($$_.Exception.Message)Components:`r`n$$( Get-Module -ListAvailable 'icinga-powershell-*' )`r`n'Module-Path:'`r`n$$($$Env:PSModulePath); exit 3; }; Exit-IcingaExecutePlugin -Command 'Invoke-IcingaCheckDiskStatus' "
7+
order = 0
8+
}
9+
"-ThresholdInterval" = {
10+
description = "Change the value your defined threshold checks against from the current value to a collected time threshold of the Icinga for Windows daemon, as described here: https://icinga.com/docs/icinga-for-windows/latest/doc/service/10-Register-Service-Checks/ An example for this argument would be 1m or 15m which will use the average of 1m or 15m for monitoring."
11+
value = "$IcingaCheckDiskStatus_String_ThresholdInterval$"
12+
order = 100
13+
}
14+
"-NoPerfData" = {
15+
set_if = "$IcingaCheckDiskStatus_Switchparameter_NoPerfData$"
16+
order = 99
17+
}
18+
"-Verbosity" = {
19+
value = "$IcingaCheckDiskStatus_Int32_Verbosity$"
20+
order = 2
21+
}
22+
}
23+
vars.IcingaCheckDiskStatus_Switchparameter_NoPerfData = false
24+
}

config/icinga/PowerShell_Base.conf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
object CheckCommand "PowerShell Base" {
2+
import "plugin-check-command"
3+
command = [
4+
"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
5+
]
6+
timeout = 3m
7+
arguments += {
8+
"-ExecutionPolicy" = {
9+
order = -1
10+
value = "$IcingaPowerShellBase_String_ExecutionPolicy$"
11+
}
12+
"-NoLogo" = {
13+
order = -2
14+
set_if = "1"
15+
}
16+
"-NoProfile" = {
17+
order = -3
18+
set_if = "1"
19+
}
20+
}
21+
vars.IcingaPowerShellBase_String_ExecutionPolicy = "ByPass"
22+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
object CheckCommand "Invoke-IcingaCheckDiskStatus" {
2+
import "PowerShell Base"
3+
4+
arguments += {
5+
"-C" = {
6+
value = "try { Use-Icinga -Minimal; } catch { Write-Output 'The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details'; Write-Output 'Error:' $$($$_.Exception.Message)Components:`r`n$$( Get-Module -ListAvailable 'icinga-powershell-*' )`r`n'Module-Path:'`r`n$$($$Env:PSModulePath); exit 3; }; Exit-IcingaExecutePlugin -Command 'Invoke-IcingaCheckDiskStatus' "
7+
order = 0
8+
}
9+
"-ThresholdInterval" = {
10+
description = "Change the value your defined threshold checks against from the current value to a collected time threshold of the Icinga for Windows daemon, as described here: https://icinga.com/docs/icinga-for-windows/latest/doc/service/10-Register-Service-Checks/ An example for this argument would be 1m or 15m which will use the average of 1m or 15m for monitoring."
11+
value = "$IcingaCheckDiskStatus_String_ThresholdInterval$"
12+
order = 100
13+
}
14+
"-NoPerfData" = {
15+
set_if = "$IcingaCheckDiskStatus_Switchparameter_NoPerfData$"
16+
order = 99
17+
}
18+
"-Verbosity" = {
19+
value = "$IcingaCheckDiskStatus_Int32_Verbosity$"
20+
order = 2
21+
}
22+
}
23+
vars.IcingaCheckDiskStatus_Switchparameter_NoPerfData = false
24+
}

doc/10-Icinga-Plugins.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
# Icinga Plugins
22

3-
Below you will find a documentation for every single available plugin provided by this repository
3+
Below you will find a documentation for every single available plugin provided by this repository. Most of the plugins allow the usage of default Icinga threshold range handling, which is defined as follows:
44

5+
| Argument | Throws error on | Ok range |
6+
| --- | --- | --- |
7+
| 20 | < 0 or > 20 | 0 .. 20 |
8+
| 20: | < 20 | between 20 .. ∞ |
9+
| ~:20 | > 20 | between -∞ .. 20 |
10+
| 30:40 | < 30 or > 40 | between {30 .. 40} |
11+
| `@30:40 | ≥ 30 and ≤ 40 | outside -∞ .. 29 and 41 .. ∞ |
12+
13+
Please ensure that you will escape the `@` if you are configuring it on the Icinga side. To do so, you will simply have to write an *\`* before the `@` symbol: \``@`
14+
15+
To test thresholds with different input values, you can use the Framework Cmdlet `Get-IcingaHelpThresholds`.
16+
17+
Each plugin ships with a constant Framework argument `-ThresholdInterval`. This can be used to modify the value your thresholds are compared against from the current, fetched value to one collected over time by the Icinga for Windows daemon. In case you [registered service checks](https://icinga.com/docs/icinga-for-windows/latest/doc/service/10-Register-Service-Checks/) for specific time intervals, you can for example set the argument to `15m` to get the average value of 15m as base for your monitoring values. Please note that in this example, you will require to have collected the `15m` average for `Invoke-IcingaCheckCPU`.
18+
19+
```powershell
20+
icinga> icinga { Invoke-IcingaCheckCPU -Warning 20 -Critical 40 -Core _Total -ThresholdInterval 15m }
21+
22+
[WARNING] CPU Load: [WARNING] Core Total (29,14817700%)
23+
\_ [WARNING] Core Total: 29,14817700% is greater than threshold 20% (15m avg.)
24+
| 'core_total_1'=31.545677%;;;0;100 'core_total_15'=29.148177%;20;40;0;100 'core_total_5'=28.827410%;;;0;100 'core_total_20'=30.032942%;;;0;100 'core_total_3'=27.731669%;;;0;100 'core_total'=33.87817%;;;0;100
25+
```
526
* [Invoke-IcingaCheckDiskStatus](plugins/01-Invoke-IcingaCheckDiskStatus.md)
627
* [Invoke-IcingaSoftwareLicensingProduct](plugins/02-Invoke-IcingaSoftwareLicensingProduct.md)

doc/plugins/01-Invoke-IcingaCheckDiskStatus.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ Checks Disk Drive status
77

88
Invoke-IcingaCheckDiskStatus returns either 'OK', 'WARNING' or 'CRITICAL'
99

10+
## Permissions
11+
12+
No special permissions required.
13+
1014
## Arguments
1115

1216
| Argument | Type | Required | Default | Description |
1317
| --- | --- | --- | --- | --- |
1418
| NoPerfData | SwitchParameter | false | False | |
1519
| Verbosity | Int32 | false | 3 | |
20+
| ThresholdInterval | String | | | Change the value your defined threshold checks against from the current value to a collected time threshold of the Icinga for Windows daemon, as described [here](https://icinga.com/docs/icinga-for-windows/latest/doc/service/10-Register-Service-Checks/). An example for this argument would be 1m or 15m which will use the average of 1m or 15m for monitoring. |
1621

1722
## Examples
1823

0 commit comments

Comments
 (0)