diff options
| author | Paul Buetow <paul@buetow.org> | 2025-05-28 22:46:27 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-05-28 22:46:27 +0300 |
| commit | 8b43dff3070d869fbb28c50d8c24d608c608d629 (patch) | |
| tree | 6f6a3fca361d4808fea32b327272f4861d0c1d14 /internal/check.go | |
| parent | 952cbe5d486926821c9e507bf833268eda70a299 (diff) | |
add epoch to check status
Diffstat (limited to 'internal/check.go')
| -rw-r--r-- | internal/check.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/internal/check.go b/internal/check.go index 189f417..55b740a 100644 --- a/internal/check.go +++ b/internal/check.go @@ -5,6 +5,7 @@ import ( "context" "os/exec" "strings" + "time" ) type check struct { @@ -23,6 +24,7 @@ type namedCheck struct { type checkResult struct { name string output string + epoch int64 status nagiosCode } @@ -35,7 +37,7 @@ func (c check) run(ctx context.Context, name string) checkResult { if err := cmd.Run(); err != nil { if ctx.Err() == context.DeadlineExceeded { - return checkResult{name, "Check command timed out", nagiosCritical} + return checkResult{name, "Check command timed out", time.Now().Unix(), nagiosCritical} } } @@ -49,11 +51,11 @@ func (c check) run(ctx context.Context, name string) checkResult { ec = int(nagiosUnknown) } - return checkResult{name, output, nagiosCode(ec)} + return checkResult{name, output, time.Now().Unix(), nagiosCode(ec)} } func (c check) skip(name, output string) checkResult { - return checkResult{name, output, nagiosUnknown} + return checkResult{name, output, time.Now().Unix(), nagiosUnknown} } func (c namedCheck) run(ctx context.Context) checkResult { |
