summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-05-28 22:02:18 +0300
committerPaul Buetow <paul@buetow.org>2025-05-28 22:02:18 +0300
commit00d8b2eec47830423cc39c0b2dc403ecd1b1273b (patch)
tree07a6c08324aa8d5783933e12716214b1adad711e /internal
parent7bc06643e310d52c22c5ad757c8c5c6ae0422ebe (diff)
fix unknown handling
Diffstat (limited to 'internal')
-rw-r--r--internal/check.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/check.go b/internal/check.go
index d762b66..189f417 100644
--- a/internal/check.go
+++ b/internal/check.go
@@ -43,7 +43,13 @@ func (c check) run(ctx context.Context, name string) checkResult {
parts := strings.Split(bytes.String(), "|")
output := strings.TrimSpace(parts[0])
- return checkResult{name, output, nagiosCode(cmd.ProcessState.ExitCode())}
+ ec := cmd.ProcessState.ExitCode()
+ if ec < int(nagiosOk) || ec > int(nagiosUnknown) {
+ // If the exit code is not in the range of known Nagios codes, treat it as unknown
+ ec = int(nagiosUnknown)
+ }
+
+ return checkResult{name, output, nagiosCode(ec)}
}
func (c check) skip(name, output string) checkResult {