Skip to content

Commit 38f0aa0

Browse files
authored
Merge pull request #263 from Icinga:feature/new_process_plugin
Feature: Adds new process check plugin Adds a new plugin to check Windows processes more detailed, by allowing CPU, Memory, PageFile, ThreadCount and Process Count usage. Allows single process monitoring and total monitoring of all processes with the same name. In addition, supports % values for memory and page file to check if a processes are exceeding the memory and pagefile usage in comparison with the available resources.
2 parents 68b507a + d95bd76 commit 38f0aa0

13 files changed

+698
-98
lines changed

config/director/Invoke-IcingaCheckProcess.json

Lines changed: 1 addition & 0 deletions
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.
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
object CheckCommand "Invoke-IcingaCheckProcess" {
2+
import "PowerShell Base"
3+
4+
arguments += {
5+
"-TotalThreadCountCritical" = {
6+
description = "Compares thread usage for all processes with the same name against the given threshold. Will throw critical if exceeded. Follows the Icinga Plugin threshold guidelines."
7+
value = "$IcingaCheckProcess_Object_TotalThreadCountCritical$"
8+
order = 17
9+
}
10+
"-NoPerfData" = {
11+
set_if = "$IcingaCheckProcess_Switchparameter_NoPerfData$"
12+
order = 99
13+
}
14+
"-Verbosity" = {
15+
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])"
16+
value = "$IcingaCheckProcess_Int32_Verbosity$"
17+
order = 21
18+
}
19+
"-TotalThreadCountWarning" = {
20+
description = "Compares thread usage for all processes with the same name against the given threshold. Will throw warning if exceeded. Follows the Icinga Plugin threshold guidelines."
21+
value = "$IcingaCheckProcess_Object_TotalThreadCountWarning$"
22+
order = 16
23+
}
24+
"-MemoryWarning" = {
25+
description = "Compares each single process memory usage against the given threshold. Will throw warning if exceeded. Supports % unit to compare the process memory usage for the entire memory space available. Follows the Icinga Plugin threshold guidelines."
26+
value = "$IcingaCheckProcess_Object_MemoryWarning$"
27+
order = 4
28+
}
29+
"-Process" = {
30+
description = "Allows to filter for a list of processes with a given name. Use the process name without file ending, like '.exe'."
31+
value = {{
32+
var arr = macro("$IcingaCheckProcess_Array_Process$");
33+
if (len(arr) == 0) {
34+
return "@()";
35+
}
36+
return arr.map(
37+
x => if (typeof(x) == String) {
38+
var argLen = len(x);
39+
if (argLen != 0 && x.substr(0,1) == "'" && x.substr(argLen - 1, argLen) == "'") {
40+
x;
41+
} else {
42+
"'" + x + "'";
43+
}
44+
} else {
45+
x;
46+
}
47+
).join(",");
48+
}}
49+
order = 20
50+
}
51+
"-TotalCPUWarning" = {
52+
description = "Compares cpu usage for all processes with the same name against the given threshold. Will throw warning if exceeded. Follows the Icinga Plugin threshold guidelines."
53+
value = "$IcingaCheckProcess_Object_TotalCPUWarning$"
54+
order = 14
55+
}
56+
"-TotalMemoryWarning" = {
57+
description = "Compares memory usage for all processes with the same name against the given threshold. Will throw warning if exceeded. Supports % unit to compare the total process memory usage for the entire memory space available. Follows the Icinga Plugin threshold guidelines."
58+
value = "$IcingaCheckProcess_Object_TotalMemoryWarning$"
59+
order = 12
60+
}
61+
"-C" = {
62+
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-IcingaCheckProcess' "
63+
order = 0
64+
}
65+
"-ThresholdInterval" = {
66+
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."
67+
value = "$IcingaCheckProcess_String_ThresholdInterval$"
68+
order = 100
69+
}
70+
"-PageFileCritical" = {
71+
description = "Compares each single process page file usage against the given threshold. Will throw critical if exceeded. Supports % unit to compare the process page file usage for the entire page file space available. Follows the Icinga Plugin threshold guidelines."
72+
value = "$IcingaCheckProcess_Object_PageFileCritical$"
73+
order = 3
74+
}
75+
"-CPUWarning" = {
76+
description = "Compares each single process cpu usage against the given threshold. Will throw warning if exceeded. Follows the Icinga Plugin threshold guidelines."
77+
value = "$IcingaCheckProcess_Object_CPUWarning$"
78+
order = 6
79+
}
80+
"-TotalPageFileWarning" = {
81+
description = "Compares page file usage for all processes with the same name against the given threshold. Will throw warning if exceeded. Supports % unit to compare the total process page file usage for the entire page file space available. Follows the Icinga Plugin threshold guidelines."
82+
value = "$IcingaCheckProcess_Object_TotalPageFileWarning$"
83+
order = 10
84+
}
85+
"-ThreadCountWarning" = {
86+
description = "Compares each single process thread usage against the given threshold. Will throw warning if exceeded. Follows the Icinga Plugin threshold guidelines."
87+
value = "$IcingaCheckProcess_Object_ThreadCountWarning$"
88+
order = 8
89+
}
90+
"-TotalProcessCountWarning" = {
91+
description = "Compares process count for all processes with the same name against the given threshold. Will throw warning if exceeded. Follows the Icinga Plugin threshold guidelines."
92+
value = "$IcingaCheckProcess_Object_TotalProcessCountWarning$"
93+
order = 18
94+
}
95+
"-CPUCritical" = {
96+
description = "Compares each single process cpu usage against the given threshold. Will throw critical if exceeded. Follows the Icinga Plugin threshold guidelines."
97+
value = "$IcingaCheckProcess_Object_CPUCritical$"
98+
order = 7
99+
}
100+
"-TotalCPUCritical" = {
101+
description = "Compares cpu usage for all processes with the same name against the given threshold. Will throw critical if exceeded. Follows the Icinga Plugin threshold guidelines."
102+
value = "$IcingaCheckProcess_Object_TotalCPUCritical$"
103+
order = 15
104+
}
105+
"-MemoryCritical" = {
106+
description = "Compares each single process memory usage against the given threshold. Will throw critical if exceeded. Supports % unit to compare the process memory usage for the entire memory space available. Follows the Icinga Plugin threshold guidelines."
107+
value = "$IcingaCheckProcess_Object_MemoryCritical$"
108+
order = 5
109+
}
110+
"-PageFileWarning" = {
111+
description = "Compares each single process page file usage against the given threshold. Will throw warning if exceeded. Supports % unit to compare the process page file usage for the entire page file space available. Follows the Icinga Plugin threshold guidelines."
112+
value = "$IcingaCheckProcess_Object_PageFileWarning$"
113+
order = 2
114+
}
115+
"-TotalProcessCountCritical" = {
116+
description = "Compares process count for all processes with the same name against the given threshold. Will throw critical if exceeded. Follows the Icinga Plugin threshold guidelines."
117+
value = "$IcingaCheckProcess_Object_TotalProcessCountCritical$"
118+
order = 19
119+
}
120+
"-TotalPageFileCritical" = {
121+
description = "Compares page file usage for all processes with the same name against the given threshold. Will throw critical if exceeded. Supports % unit to compare the total process page file usage for the entire page file space available. Follows the Icinga Plugin threshold guidelines."
122+
value = "$IcingaCheckProcess_Object_TotalPageFileCritical$"
123+
order = 11
124+
}
125+
"-TotalMemoryCritical" = {
126+
description = "Compares memory usage for all processes with the same name against the given threshold. Will throw critical if exceeded. Supports % unit to compare the total process memory usage for the entire memory space available. Follows the Icinga Plugin threshold guidelines."
127+
value = "$IcingaCheckProcess_Object_TotalMemoryCritical$"
128+
order = 13
129+
}
130+
"-ThreadCountCritical" = {
131+
description = "Compares each single process thread usage against the given threshold. Will throw critical if exceeded. Follows the Icinga Plugin threshold guidelines."
132+
value = "$IcingaCheckProcess_Object_ThreadCountCritical$"
133+
order = 9
134+
}
135+
}
136+
vars.IcingaCheckProcess_Switchparameter_NoPerfData = false
137+
}

0 commit comments

Comments
 (0)