From 4d614cacfaa3a6ffb3d5257119286be0de1f054a Mon Sep 17 00:00:00 2001 From: Alexander Stoll Date: Tue, 29 Oct 2019 11:34:59 +0100 Subject: [PATCH] Documentation skeletons and actual documentation --- lib/core/tools/ConvertTo-ByteUnit.psm1 | 96 +++++++++++++++++++ lib/core/tools/ConvertTo-Seconds.psm1 | 23 ++++- lib/core/tools/Set-NumericNegative.psm1 | 16 ++++ lib/core/tools/Test-Numeric.psm1 | 14 +++ lib/plugins/Invoke-IcingaCheckEventlog.psm1 | 56 +++++++++++ .../Invoke-IcingaCheckPerfcounter.psm1 | 34 +++++++ 6 files changed, 238 insertions(+), 1 deletion(-) diff --git a/lib/core/tools/ConvertTo-ByteUnit.psm1 b/lib/core/tools/ConvertTo-ByteUnit.psm1 index ee132a0..67c8c33 100644 --- a/lib/core/tools/ConvertTo-ByteUnit.psm1 +++ b/lib/core/tools/ConvertTo-ByteUnit.psm1 @@ -1,3 +1,19 @@ +<# +.SYNOPSIS + Converts unit sizes to byte. +.DESCRIPTION + This module converts a given unit size to byte. + e.g Kilobyte to Byte. + + More Information on https://github.com/LordHepipud/icinga-module-windows +.EXAMPLE + PS> ConvertTo-Byte -Unit TB 200 + 200000000000000 +.LINK + https://github.com/LordHepipud/icinga-module-windows +.NOTES +#> + function ConvertTo-Byte() { param( @@ -22,6 +38,22 @@ function ConvertTo-Byte() return $result; } +<# +.SYNOPSIS + Converts unit sizes to kilobyte. +.DESCRIPTION + This module converts a given unit size to kilobyte. + e.g byte to kilobyte. + + More Information on https://github.com/LordHepipud/icinga-module-windows +.EXAMPLE + PS> ConvertTo-KiloByte -Unit TB 200 + 200000000000 +.LINK + https://github.com/LordHepipud/icinga-module-windows +.NOTES +#> + function ConvertTo-KiloByte() { param( @@ -46,6 +78,22 @@ function ConvertTo-KiloByte() return $result; } +<# +.SYNOPSIS + Converts unit sizes to megabyte. +.DESCRIPTION + This module converts a given unit size to megabyte. + e.g byte to megabyte. + + More Information on https://github.com/LordHepipud/icinga-module-windows +.EXAMPLE + PS> ConvertTo-KiloByte -Unit TB 200 + 200000000 +.LINK + https://github.com/LordHepipud/icinga-module-windows +.NOTES +#> + function ConvertTo-MegaByte() { param( @@ -70,6 +118,22 @@ function ConvertTo-MegaByte() return $result; } +<# +.SYNOPSIS + Converts unit sizes to gigabyte. +.DESCRIPTION + This module converts a given unit size to gigabyte. + e.g byte to gigabyte. + + More Information on https://github.com/LordHepipud/icinga-module-windows +.EXAMPLE + PS> ConvertTo-GigaByte -Unit TB 200 + 200000 +.LINK + https://github.com/LordHepipud/icinga-module-windows +.NOTES +#> + function ConvertTo-GigaByte() { param( @@ -94,6 +158,22 @@ function ConvertTo-GigaByte() return $result; } +<# +.SYNOPSIS + Converts unit sizes to terabyte. +.DESCRIPTION + This module converts a given unit size to terabyte. + e.g byte to terabyte. + + More Information on https://github.com/LordHepipud/icinga-module-windows +.EXAMPLE + PS> ConvertTo-TeraByte -Unit GB 2000000 + 2000 +.LINK + https://github.com/LordHepipud/icinga-module-windows +.NOTES +#> + function ConvertTo-TeraByte() { param( @@ -118,6 +198,22 @@ function ConvertTo-TeraByte() return $result; } +<# +.SYNOPSIS + Converts unit sizes to petabyte. +.DESCRIPTION + This module converts a given unit size to petabyte. + e.g byte to petabyte. + + More Information on https://github.com/LordHepipud/icinga-module-windows +.EXAMPLE + PS> ConvertTo-PetaByte -Unit GB 2000000 + 2 +.LINK + https://github.com/LordHepipud/icinga-module-windows +.NOTES +#> + function ConvertTo-PetaByte() { param( diff --git a/lib/core/tools/ConvertTo-Seconds.psm1 b/lib/core/tools/ConvertTo-Seconds.psm1 index 194f3ed..7553361 100644 --- a/lib/core/tools/ConvertTo-Seconds.psm1 +++ b/lib/core/tools/ConvertTo-Seconds.psm1 @@ -1,5 +1,26 @@ Import-IcingaLib core\tools; -# year month week days hours minutes seconds milliseconds + +<# +.SYNOPSIS + Converts unit to seconds. +.DESCRIPTION + This module converts a given time unit to seconds. + e.g hours to seconds. + + More Information on https://github.com/LordHepipud/icinga-module-windows + +.PARAMETER Value + Specify unit to be converted to seconds. Allowed units: ms, s, m, h, d, w, M, y + ms = miliseconds; s = seconds; m = minutes; h = hours; d = days; w = weeks; M = months; y = years; + + Like 20d for 20 days. +.EXAMPLE + PS> ConvertTo-Seconds 30d + 2592000 +.LINK + https://github.com/LordHepipud/icinga-module-windows +.NOTES +#> function ConvertTo-Seconds() { diff --git a/lib/core/tools/Set-NumericNegative.psm1 b/lib/core/tools/Set-NumericNegative.psm1 index 394d72a..2ae24d9 100644 --- a/lib/core/tools/Set-NumericNegative.psm1 +++ b/lib/core/tools/Set-NumericNegative.psm1 @@ -1,3 +1,19 @@ +<# +.SYNOPSIS + Sets nummeric values to be negative +.DESCRIPTION + This module sets a numeric value to be negative. + e.g 12 to -12 + + More Information on https://github.com/LordHepipud/icinga-module-windows +.EXAMPLE + PS> Set-NumericNegative 32 + -32 +.LINK + https://github.com/LordHepipud/icinga-module-windows +.NOTES +#> + function Set-NumericNegative() { diff --git a/lib/core/tools/Test-Numeric.psm1 b/lib/core/tools/Test-Numeric.psm1 index 8d3fca9..ad67b36 100644 --- a/lib/core/tools/Test-Numeric.psm1 +++ b/lib/core/tools/Test-Numeric.psm1 @@ -1,3 +1,17 @@ +<# +.SYNOPSIS + Tests whether a value is numeric +.DESCRIPTION + This module tests whether a value is numeric + + More Information on https://github.com/LordHepipud/icinga-module-windows +.EXAMPLE + PS> Test-Numeric 32 + True +.LINK + https://github.com/LordHepipud/icinga-module-windows +.NOTES +#> function Test-Numeric ($number) { return $number -Match "^[\d\.]+$"; } diff --git a/lib/plugins/Invoke-IcingaCheckEventlog.psm1 b/lib/plugins/Invoke-IcingaCheckEventlog.psm1 index 4e92802..353a21a 100644 --- a/lib/plugins/Invoke-IcingaCheckEventlog.psm1 +++ b/lib/plugins/Invoke-IcingaCheckEventlog.psm1 @@ -1,5 +1,61 @@ Import-IcingaLib icinga\plugin; +<# +.SYNOPSIS + ??? +.DESCRIPTION + ??? + e.g + + More Information on https://github.com/LordHepipud/icinga-module-windows +.FUNCTIONALITY + ??? + Based on the thresholds set the status will change between 'OK', 'WARNING' or 'CRITICAL'. The function will return one of these given codes. +.EXAMPLE + PS> +.EXAMPLE + PS> +.EXAMPLE + PS> +.EXAMPLE + PS> +.PARAMETER Warning + Used to specify a Warning threshold. In this case an ??? value. +.PARAMETER Critical + Used to specify a Critical threshold. In this case an ??? value. +.PARAMETER LogName + Used to specify a certain log. +.PARAMETER IncludeEventId + Used to specify an array of events identified by their id to be included. +.PARAMETER ExcludeEventId + Used to specify an array of events identified by their id to be excluded. +.PARAMETER IncludeUsername + Used to specify an array of usernames within the eventlog to be included. +.PARAMETER ExcludeUsername + Used to specify an array of usernames within the eventlog to be excluded. +.PARAMETER IncludeEntryType + Used to specify an array of entry types within the eventlog to be included. +.PARAMETER ExcludeEntryType + Used to specify an array of entry types within the eventlog to be excluded. +.PARAMETER IncludeMessage + Used to specify an array of messages within the eventlog to be included. +.PARAMETER ExcludeMessage + Used to specify an array of messages within the eventlog to be excluded. +.PARAMETER After + ??? +.PARAMETER Before + ??? +.PARAMETER DisableTimeCache + Switch to disable the time cache on a check. If this parameter is set the time cache is disabled. +.INPUTS + System.String +.OUTPUTS + System.String +.LINK + https://github.com/LordHepipud/icinga-module-windows +.NOTES +#> + function Invoke-IcingaCheckEventlog() { param( diff --git a/lib/plugins/Invoke-IcingaCheckPerfcounter.psm1 b/lib/plugins/Invoke-IcingaCheckPerfcounter.psm1 index c9b0588..e771716 100644 --- a/lib/plugins/Invoke-IcingaCheckPerfcounter.psm1 +++ b/lib/plugins/Invoke-IcingaCheckPerfcounter.psm1 @@ -1,5 +1,39 @@ Import-IcingaLib icinga\plugin; +<# +.SYNOPSIS + Performs checks on various performance counter +.DESCRIPTION + Invoke-IcingaCheckDirectory returns either 'OK', 'WARNING' or 'CRITICAL', based on the thresholds set. + e.g + + More Information on https://github.com/LordHepipud/icinga-module-windows +.FUNCTIONALITY + This module is intended to be used to perform checks on different performance counter. + Based on the thresholds set the status will change between 'OK', 'WARNING' or 'CRITICAL'. The function will return one of these given codes. +.EXAMPLE + PS> +.EXAMPLE + PS> +.EXAMPLE + PS> +.EXAMPLE + PS> +.PARAMETER Warning + Used to specify a Warning threshold. In this case an ??? value. +.PARAMETER Critical + Used to specify a Critical threshold. In this case an ??? value. +.PARAMETER PerfCounter + Used to specify an array of performance counter to check against. +.INPUTS + System.String +.OUTPUTS + System.String +.LINK + https://github.com/LordHepipud/icinga-module-windows +.NOTES +#> + function Invoke-IcingaCheckPerfcounter() { param(