Skip to content

Commit 0995f6d

Browse files
committed
Extends directory check plugin functionality
1 parent 250ad59 commit 0995f6d

10 files changed

+456
-186
lines changed

config/director/Invoke-IcingaCheckDirectory.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

config/director/Plugins_Bundle.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

config/icinga/Invoke-IcingaCheckDirectory.conf

Lines changed: 95 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,73 @@ object CheckCommand "Invoke-IcingaCheckDirectory" {
22
import "PowerShell Base"
33

44
arguments += {
5-
"-Path" = {
6-
description = "Used to specify a path. e.g. 'C:\\Users\\Icinga\\Downloads'"
7-
value = "$IcingaCheckDirectory_String_Path$"
8-
order = 2
5+
"-CriticalLargestFile" = {
6+
description = "Checks the largest file size found for the given filters and input and returns critical for the provided threshold. Follows the Icinga plugin threshold guidelines."
7+
value = "$IcingaCheckDirectory_Object_CriticalLargestFile$"
8+
order = 11
9+
}
10+
"-FileSizeGreaterThan" = {
11+
description = "String that expects input format like '20MB', which translates to the filze size 20 MB. Allowed units: B, KB, MB, GB, TB. Thereby all files with a size of 20 MB or larger are considered within the check."
12+
value = "$IcingaCheckDirectory_String_FileSizeGreaterThan$"
13+
order = 20
14+
}
15+
"-C" = {
16+
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-IcingaCheckDirectory' "
17+
order = 0
18+
}
19+
"-WarningAverageFile" = {
20+
description = "Checks the resulting file count of the provided filters and input and returns warning for the provided threshold. Follows the Icinga plugin threshold guidelines."
21+
value = "$IcingaCheckDirectory_Object_WarningAverageFile$"
22+
order = 12
23+
}
24+
"-WarningLargestFile" = {
25+
description = "Checks the largest file size found for the given filters and input and returns warning for the provided threshold. Follows the Icinga plugin threshold guidelines."
26+
value = "$IcingaCheckDirectory_Object_WarningLargestFile$"
27+
order = 10
28+
}
29+
"-CreationYoungerThan" = {
30+
description = "String that expects input format like '20d', which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have a creation date younger then 20 days are considered within the check."
31+
value = "$IcingaCheckDirectory_String_CreationYoungerThan$"
32+
order = 19
33+
}
34+
"-Warning" = {
35+
description = "Checks the resulting file count of the provided filters and input and returns warning for the provided threshold. Follows the Icinga plugin threshold guidelines."
36+
value = "$IcingaCheckDirectory_Object_Warning$"
37+
order = 5
38+
}
39+
"-ThresholdInterval" = {
40+
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."
41+
value = "$IcingaCheckDirectory_String_ThresholdInterval$"
42+
order = 100
943
}
1044
"-Verbosity" = {
1145
description = "Changes the behavior of the plugin output which check states are printed: 0 (default): Only service checks/packages with state not OK will be printed 1: Only services with not OK will be printed including OK checks of affected check packages including Package config 2: Everything will be printed regardless of the check state 3: Identical to Verbose 2, but prints in addition the check package configuration e.g (All must be [OK])"
1246
value = "$IcingaCheckDirectory_Int32_Verbosity$"
47+
order = 22
48+
}
49+
"-ChangeTimeEqual" = {
50+
description = "String that expects input format like '20d', which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have been changed 20 days ago are considered within the check."
51+
value = "$IcingaCheckDirectory_String_ChangeTimeEqual$"
1352
order = 14
1453
}
15-
"-CreationOlderThan" = {
16-
description = "String that expects input format like '20d', which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have a creation date older then 20 days are considered within the check."
17-
value = "$IcingaCheckDirectory_String_CreationOlderThan$"
18-
order = 10
54+
"-CountFolderAsFile" = {
55+
set_if = "$IcingaCheckDirectory_Switchparameter_CountFolderAsFile$"
56+
order = 99
1957
}
20-
"-FileSizeGreaterThan" = {
21-
description = "String that expects input format like '20MB', which translates to the filze size 20 MB. Allowed units: B, KB, MB, GB, TB. Thereby all files with a size of 20 MB or larger are considered within the check."
22-
value = "$IcingaCheckDirectory_String_FileSizeGreaterThan$"
23-
order = 12
58+
"-WarningTotalSize" = {
59+
description = "Checks the total folder size of all files of the provided filters and input and returns warning for the provided threshold. Follows the Icinga plugin threshold guidelines."
60+
value = "$IcingaCheckDirectory_Object_WarningTotalSize$"
61+
order = 6
62+
}
63+
"-CriticalSmallestFile" = {
64+
description = "Checks the smallest file size found for the given filters and input and returns critical for the provided threshold. Follows the Icinga plugin threshold guidelines."
65+
value = "$IcingaCheckDirectory_Object_CriticalSmallestFile$"
66+
order = 9
67+
}
68+
"-Path" = {
69+
description = "Used to specify a path. e.g. 'C:\\Users\\Icinga\\Downloads'"
70+
value = "$IcingaCheckDirectory_String_Path$"
71+
order = 2
2472
}
2573
"-NoPerfData" = {
2674
set_if = "$IcingaCheckDirectory_Switchparameter_NoPerfData$"
@@ -29,36 +77,32 @@ object CheckCommand "Invoke-IcingaCheckDirectory" {
2977
"-ChangeOlderThan" = {
3078
description = "String that expects input format like '20d', which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have a change date older then 20 days are considered within the check."
3179
value = "$IcingaCheckDirectory_String_ChangeOlderThan$"
32-
order = 8
80+
order = 16
3381
}
34-
"-ChangeYoungerThan" = {
35-
description = "String that expects input format like '20d', which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have a change date younger then 20 days are considered within the check."
36-
value = "$IcingaCheckDirectory_String_ChangeYoungerThan$"
82+
"-CriticalTotalSize" = {
83+
description = "Checks the total folder size of all files of the provided filters and input and returns critical for the provided threshold. Follows the Icinga plugin threshold guidelines."
84+
value = "$IcingaCheckDirectory_Object_CriticalTotalSize$"
3785
order = 7
3886
}
87+
"-Critical" = {
88+
description = "Checks the resulting file count of the provided filters and input and returns critical for the provided threshold. Follows the Icinga plugin threshold guidelines."
89+
value = "$IcingaCheckDirectory_Object_Critical$"
90+
order = 4
91+
}
92+
"-CriticalAverageFile" = {
93+
description = "Checks the average file size found for the given filters and input and returns critical for the provided threshold. Follows the Icinga plugin threshold guidelines."
94+
value = "$IcingaCheckDirectory_Object_CriticalAverageFile$"
95+
order = 13
96+
}
3997
"-FileSizeSmallerThan" = {
4098
description = "String that expects input format like '5MB', which translates to the filze size 5 MB. Allowed units: B, KB, MB, GB, TB. Thereby all files with a size of 5 MB or less are considered within the check."
4199
value = "$IcingaCheckDirectory_String_FileSizeSmallerThan$"
42-
order = 13
43-
}
44-
"-C" = {
45-
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-IcingaCheckDirectory' "
46-
order = 0
47-
}
48-
"-ThresholdInterval" = {
49-
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."
50-
value = "$IcingaCheckDirectory_String_ThresholdInterval$"
51-
order = 100
100+
order = 21
52101
}
53102
"-CreationTimeEqual" = {
54103
description = "String that expects input format like '20d', which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have been created 20 days ago are considered within the check."
55104
value = "$IcingaCheckDirectory_String_CreationTimeEqual$"
56-
order = 9
57-
}
58-
"-ChangeTimeEqual" = {
59-
description = "String that expects input format like '20d', which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have been changed 20 days ago are considered within the check."
60-
value = "$IcingaCheckDirectory_String_ChangeTimeEqual$"
61-
order = 6
105+
order = 17
62106
}
63107
"-FileNames" = {
64108
description = "Used to specify an array of filenames or expressions to match against results to filter for specific files. e.g '*.txt', '*.sql', finds all files ending with .txt and .sql"
@@ -82,26 +126,32 @@ object CheckCommand "Invoke-IcingaCheckDirectory" {
82126
}}
83127
order = 3
84128
}
85-
"-Critical" = {
86-
description = "Used to specify a Critical threshold. Follows the Icinga plugin threshold"
87-
value = "$IcingaCheckDirectory_Object_Critical$"
88-
order = 4
129+
"-WarningSmallestFile" = {
130+
description = "Checks the smallest file size found for the given filters and input and returns warning for the provided threshold. Follows the Icinga plugin threshold guidelines."
131+
value = "$IcingaCheckDirectory_Object_WarningSmallestFile$"
132+
order = 8
89133
}
90-
"-CreationYoungerThan" = {
91-
description = "String that expects input format like '20d', which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have a creation date younger then 20 days are considered within the check."
92-
value = "$IcingaCheckDirectory_String_CreationYoungerThan$"
93-
order = 11
134+
"-CreationOlderThan" = {
135+
description = "String that expects input format like '20d', which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have a creation date older then 20 days are considered within the check."
136+
value = "$IcingaCheckDirectory_String_CreationOlderThan$"
137+
order = 18
138+
}
139+
"-ChangeYoungerThan" = {
140+
description = "String that expects input format like '20d', which translates to 20 days. Allowed units: ms, s, m, h, d, w, M, y. Thereby all files which have a change date younger then 20 days are considered within the check."
141+
value = "$IcingaCheckDirectory_String_ChangeYoungerThan$"
142+
order = 15
143+
}
144+
"-ShowFileList" = {
145+
set_if = "$IcingaCheckDirectory_Switchparameter_ShowFileList$"
146+
order = 99
94147
}
95148
"-Recurse" = {
96149
set_if = "$IcingaCheckDirectory_Switchparameter_Recurse$"
97150
order = 99
98151
}
99-
"-Warning" = {
100-
description = "Used to specify a Warning threshold. Follows the Icinga plugin threshold"
101-
value = "$IcingaCheckDirectory_Object_Warning$"
102-
order = 5
103-
}
104152
}
153+
vars.IcingaCheckDirectory_Switchparameter_CountFolderAsFile = false
105154
vars.IcingaCheckDirectory_Switchparameter_NoPerfData = false
106155
vars.IcingaCheckDirectory_Switchparameter_Recurse = false
156+
vars.IcingaCheckDirectory_Switchparameter_ShowFileList = false
107157
}

0 commit comments

Comments
 (0)