mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 15:19:58 -05:00
Added further options in ProcessCount-Check
This commit is contained in:
parent
5b10b2c647
commit
b2f6f254ec
1 changed files with 11 additions and 4 deletions
|
|
@ -15,13 +15,20 @@ function Invoke-IcingaCheckProcessCount()
|
|||
|
||||
$ProcessPackage = New-icingaCheckPackage -Name "Process Check" -OperatorAnd -Verbose $Verbose -NoPerfData $NoPerfData;
|
||||
|
||||
foreach ($proc in $process) {
|
||||
$ProcessCount = $ProcessInformation."Processes".$proc.processlist.Count;
|
||||
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Process Count "{0}"', $proc)) -Value $ProcessCount;
|
||||
if ($Process.Count -eq 0) {
|
||||
$ProcessCount = $ProcessInformation['Process Count'];
|
||||
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Process Count')) -Value $ProcessCount;
|
||||
$IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Critical) | Out-Null;
|
||||
$ProcessPackage.AddCheck($IcingaCheck);
|
||||
} else {
|
||||
foreach ($proc in $process) {
|
||||
$ProcessCount = $ProcessInformation."Processes".$proc.processlist.Count;
|
||||
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Process Count "{0}"', $proc)) -Value $ProcessCount;
|
||||
$IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Critical) | Out-Null;
|
||||
$ProcessPackage.AddCheck($IcingaCheck);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
exit (New-IcingaCheckResult -Check $ProcessPackage -NoPerfData $TRUE -Compile);
|
||||
exit (New-IcingaCheckResult -Check $ProcessPackage -NoPerfData $NoPerfData -Compile);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue