Skip to content

Commit 648b973

Browse files
authored
Merge pull request #439 from Icinga:feature/adds_support_for_diskhealth_filter_friendlyname
Feature: Adds support for Invoke-IcingaCheckDiskHealth to filter for disk friendly name Adds support for `Invoke-IcingaCheckDiskHealth` to filter disks by their friendly name
2 parents 0eb03f2 + 0980dcc commit 648b973

8 files changed

+182
-58
lines changed

config/director/Invoke-IcingaCheckDiskHealth.json

+1-1
Large diffs are not rendered by default.

config/director/Plugins_Bundle.json

+1-1
Large diffs are not rendered by default.

config/icinga/Invoke-IcingaCheckDiskHealth.conf

+73-21
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ object CheckCommand "Invoke-IcingaCheckDiskHealth" {
55
"-DiskReadByteSecWarning" = {
66
description = "Warning threshold for disk Read Bytes/sec is the rate at which bytes are transferred from the disk during read operations."
77
value = "$IcingaCheckDiskHealth_Object_DiskReadByteSecWarning$"
8-
order = 14
8+
order = 16
99
}
1010
"-DiskWriteByteSecWarning" = {
1111
description = "Warning threshold for disk Write Bytes/sec is rate at which bytes are transferred to the disk during write operations."
1212
value = "$IcingaCheckDiskHealth_Object_DiskWriteByteSecWarning$"
13-
order = 16
13+
order = 18
1414
}
1515
"-NoPerfData" = {
1616
set_if = "$IcingaCheckDiskHealth_Switchparameter_NoPerfData$"
@@ -87,12 +87,12 @@ object CheckCommand "Invoke-IcingaCheckDiskHealth" {
8787
"-DiskQueueAvgLenCritical" = {
8888
description = "Critical threshold for Avg. Disk Queue Length is the average number of both read and write requests that were queued for the selected disk during the sample interval."
8989
value = "$IcingaCheckDiskHealth_Object_DiskQueueAvgLenCritical$"
90-
order = 13
90+
order = 15
9191
}
9292
"-DiskQueueLenWarning" = {
9393
description = "Warning threshold for current Disk Queue Length is the number of requests outstanding on the disk at the time the performance data is collected. It also includes requests in service at the time of the collection. This is a instantaneous snapshot, not an average over the time interval. Multi-spindle disk devices can have multiple requests that are active at one time, but other concurrent requests are awaiting service. This counter might reflect a transitory high or low queue length, but if there is a sustained load on the disk drive, it is likely that this will be consistently high. Requests experience delays proportional to the length of this queue minus the number of spindles on the disks. For good performance, this difference should average less than two."
9494
value = "$IcingaCheckDiskHealth_Object_DiskQueueLenWarning$"
95-
order = 10
95+
order = 12
9696
}
9797
"-IncludePartition" = {
9898
description = "Specify the partition drive letters for disks to include for checks. Example C:, D:"
@@ -120,47 +120,93 @@ object CheckCommand "Invoke-IcingaCheckDiskHealth" {
120120
"-DiskAvgReadSecCritical" = {
121121
description = "Critical threshold for avg. Disk sec/Read is the average time, in seconds, of a read of data from the disk. If the threshold values are not in seconds, please enter a unit such as (ms, s, m, h, ...)"
122122
value = "$IcingaCheckDiskHealth_Object_DiskAvgReadSecCritical$"
123-
order = 21
123+
order = 23
124124
}
125125
"-DiskWriteSecCritical" = {
126126
description = "Critical threshold for disk Writes/sec is the rate of write operations on the disk."
127127
value = "$IcingaCheckDiskHealth_Object_DiskWriteSecCritical$"
128-
order = 9
128+
order = 11
129129
}
130130
"-DiskQueueAvgLenWarning" = {
131131
description = "Warning threshold for Avg. Disk Queue Length is the average number of both read and write requests that were queued for the selected disk during the sample interval."
132132
value = "$IcingaCheckDiskHealth_Object_DiskQueueAvgLenWarning$"
133-
order = 12
133+
order = 14
134+
}
135+
"-ExcludeFriendlyName" = {
136+
description = "Specify the friendly name of disks you want to exclude from checks. Example 'Samsung SSD 970 EVO Plus 1TB'"
137+
value = {{
138+
var arr = macro("$IcingaCheckDiskHealth_Array_ExcludeFriendlyName$");
139+
if (len(arr) == 0) {
140+
return "@()";
141+
}
142+
var psarr = arr.map(
143+
x => if (typeof(x) == String) {
144+
var argLen = len(x);
145+
if (argLen != 0 && x.substr(0,1) == "'" && x.substr(argLen - 1, argLen) == "'") {
146+
x;
147+
} else {
148+
"'" + x + "'";
149+
}
150+
} else {
151+
x;
152+
}
153+
).join(",");
154+
return "@(" + psarr + ")";
155+
}}
156+
order = 7
134157
}
135158
"-DiskAvgReadSecWarning" = {
136159
description = "Warning threshold for avg. Disk sec/Read is the average time, in seconds, of a read of data from the disk. If the threshold values are not in seconds, please enter a unit such as (ms, s, m, h, ...)"
137160
value = "$IcingaCheckDiskHealth_Object_DiskAvgReadSecWarning$"
138-
order = 20
161+
order = 22
139162
}
140163
"-DiskWriteByteSecCritical" = {
141164
description = "Critical threshold for disk Write Bytes/sec is rate at which bytes are transferred to the disk during write operations."
142165
value = "$IcingaCheckDiskHealth_Object_DiskWriteByteSecCritical$"
143-
order = 17
166+
order = 19
144167
}
145168
"-DiskAvgTransSecWarning" = {
146169
description = "Warning threshold for avg. Disk sec/Transfer is the time, in seconds, of the average disk transfer. If the threshold values are not in seconds, please enter a unit such as (ms, s, m, h, ...)"
147170
value = "$IcingaCheckDiskHealth_Object_DiskAvgTransSecWarning$"
148-
order = 18
171+
order = 20
172+
}
173+
"-IncludeFriendlyName" = {
174+
description = "Specify the friendly name of disks you want to include for checks. Example 'Samsung SSD 970 EVO Plus 1TB'"
175+
value = {{
176+
var arr = macro("$IcingaCheckDiskHealth_Array_IncludeFriendlyName$");
177+
if (len(arr) == 0) {
178+
return "@()";
179+
}
180+
var psarr = arr.map(
181+
x => if (typeof(x) == String) {
182+
var argLen = len(x);
183+
if (argLen != 0 && x.substr(0,1) == "'" && x.substr(argLen - 1, argLen) == "'") {
184+
x;
185+
} else {
186+
"'" + x + "'";
187+
}
188+
} else {
189+
x;
190+
}
191+
).join(",");
192+
return "@(" + psarr + ")";
193+
}}
194+
order = 6
149195
}
150196
"-DiskAvgWriteSecWarning" = {
151197
description = "Warning threshold for Avg. Disk sec/Write is the average time, in seconds, of a write of data to the disk. If the threshold values are not in seconds, please enter a unit such as (ms, s, m, h, ...)"
152198
value = "$IcingaCheckDiskHealth_Object_DiskAvgWriteSecWarning$"
153-
order = 22
199+
order = 24
154200
}
155201
"-Verbosity" = {
156202
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])"
157203
value = "$IcingaCheckDiskHealth_Int32_Verbosity$"
158-
order = 24
204+
order = 26
159205
}
160206
"-DiskReadSecWarning" = {
161207
description = "Warning threshold for disk Reads/sec is the rate of read operations on the disk."
162208
value = "$IcingaCheckDiskHealth_Object_DiskReadSecWarning$"
163-
order = 6
209+
order = 8
164210
}
165211
"-ExcludePartition" = {
166212
description = "Specify the partition drive letters for disks to exclude from checks. Example C:, D:"
@@ -188,7 +234,7 @@ object CheckCommand "Invoke-IcingaCheckDiskHealth" {
188234
"-DiskReadSecCritical" = {
189235
description = "Critical threshold for disk Reads/sec is the rate of read operations on the disk."
190236
value = "$IcingaCheckDiskHealth_Object_DiskReadSecCritical$"
191-
order = 7
237+
order = 9
192238
}
193239
"-CheckLogicalOnly" = {
194240
set_if = "$IcingaCheckDiskHealth_Switchparameter_CheckLogicalOnly$"
@@ -197,12 +243,12 @@ object CheckCommand "Invoke-IcingaCheckDiskHealth" {
197243
"-DiskReadByteSecCritical" = {
198244
description = "Critical threshold for disk Read Bytes/sec is the rate at which bytes are transferred from the disk during read operations."
199245
value = "$IcingaCheckDiskHealth_Object_DiskReadByteSecCritical$"
200-
order = 15
246+
order = 17
201247
}
202248
"-DiskAvgWriteSecCritical" = {
203249
description = "Critical threshold for Avg. Disk sec/Write is the average time, in seconds, of a write of data to the disk. If the threshold values are not in seconds, please enter a unit such as (ms, s, m, h, ...)"
204250
value = "$IcingaCheckDiskHealth_Object_DiskAvgWriteSecCritical$"
205-
order = 23
251+
order = 25
206252
}
207253
"-IgnoreOfflineDisks" = {
208254
set_if = "$IcingaCheckDiskHealth_Switchparameter_IgnoreOfflineDisks$"
@@ -211,21 +257,24 @@ object CheckCommand "Invoke-IcingaCheckDiskHealth" {
211257
"-DiskWriteSecWarning" = {
212258
description = "Warning threshold for disk Writes/sec is the rate of write operations on the disk."
213259
value = "$IcingaCheckDiskHealth_Object_DiskWriteSecWarning$"
214-
order = 8
260+
order = 10
215261
}
216262
"-DiskQueueLenCritical" = {
217263
description = "Critical threshold for current Disk Queue Length is the number of requests outstanding on the disk at the time the performance data is collected. It also includes requests in service at the time of the collection. This is a instantaneous snapshot, not an average over the time interval. Multi-spindle disk devices can have multiple requests that are active at one time, but other concurrent requests are awaiting service. This counter might reflect a transitory high or low queue length, but if there is a sustained load on the disk drive, it is likely that this will be consistently high. Requests experience delays proportional to the length of this queue minus the number of spindles on the disks. For good performance, this difference should average less than two."
218264
value = "$IcingaCheckDiskHealth_Object_DiskQueueLenCritical$"
219-
order = 11
265+
order = 13
220266
}
221267
"-DiskAvgTransSecCritical" = {
222268
description = "Critical threshold for avg. Disk sec/Transfer is the time, in seconds, of the average disk transfer. If the threshold values are not in seconds, please enter a unit such as (ms, s, m, h, ...)"
223269
value = "$IcingaCheckDiskHealth_Object_DiskAvgTransSecCritical$"
224-
order = 19
270+
order = 21
225271
}
226272
}
227273
vars.IcingaCheckDiskHealth_Switchparameter_NoPerfData = false
228274
vars.ifw_api_arguments = {
275+
"DiskReadByteSecCritical" = {
276+
value = "$IcingaCheckDiskHealth_Object_DiskReadByteSecCritical$"
277+
}
229278
"NoPerfData" = {
230279
set_if = "$IcingaCheckDiskHealth_Switchparameter_NoPerfData$"
231280
}
@@ -241,6 +290,9 @@ object CheckCommand "Invoke-IcingaCheckDiskHealth" {
241290
"DiskReadByteSecWarning" = {
242291
value = "$IcingaCheckDiskHealth_Object_DiskReadByteSecWarning$"
243292
}
293+
"ExcludeFriendlyName" = {
294+
value = "$IcingaCheckDiskHealth_Array_ExcludeFriendlyName$"
295+
}
244296
"IgnoreReadOnlyDisks" = {
245297
set_if = "$IcingaCheckDiskHealth_Switchparameter_IgnoreReadOnlyDisks$"
246298
}
@@ -259,8 +311,8 @@ object CheckCommand "Invoke-IcingaCheckDiskHealth" {
259311
"DiskAvgTransSecWarning" = {
260312
value = "$IcingaCheckDiskHealth_Object_DiskAvgTransSecWarning$"
261313
}
262-
"DiskReadByteSecCritical" = {
263-
value = "$IcingaCheckDiskHealth_Object_DiskReadByteSecCritical$"
314+
"IncludeFriendlyName" = {
315+
value = "$IcingaCheckDiskHealth_Array_IncludeFriendlyName$"
264316
}
265317
"DiskAvgReadSecCritical" = {
266318
value = "$IcingaCheckDiskHealth_Object_DiskAvgReadSecCritical$"

0 commit comments

Comments
 (0)