Skip to content

Commit df54214

Browse files
committed
Update file: Last errors logs.ps1
1 parent 7e77de8 commit df54214

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

scripts_staging/Checks/Last errors logs.ps1

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,17 @@ elseif ($count -ge $warnThreshold) {
150150
}
151151
exit $warnExitCode
152152
}
153-
else {
154-
if ($count -eq 0) { Write-Output "INFO: No error events in last $evaluationWindowHours hours." }
155-
else {
156-
Write-Output "INFO: $count error event(s) in last $evaluationWindowHours hours (below warning threshold: $warnThreshold)."
157-
$errorsInEvaluationWindow | ForEach-Object {
158-
Write-Output "TimeCreated: $($_.TimeCreated)"
159-
Write-Output "Event ID: $($_.Id)"
160-
Write-Output "Message: $($_.Message)"
161-
Write-Output "----------------------------------------"
162-
}
153+
elseif ($count -ge $infoThreshold) {
154+
Write-Output "INFO: $count error event(s) in last $evaluationWindowHours hours (below warning threshold: $warnThreshold)."
155+
$errorsInEvaluationWindow | ForEach-Object {
156+
Write-Output "TimeCreated: $($_.TimeCreated)"
157+
Write-Output "Event ID: $($_.Id)"
158+
Write-Output "Message: $($_.Message)"
159+
Write-Output "----------------------------------------"
163160
}
164161
exit $infoExitCode
162+
}
163+
else {
164+
Write-Output "OK: $count error events in last $evaluationWindowHours hours (below all thresholds)."
165+
exit 0
165166
}

0 commit comments

Comments
 (0)