diff options
| author | Paul Buetow <paul@buetow.org> | 2025-11-22 09:32:52 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-11-22 09:32:52 +0200 |
| commit | 5fa8012c6b085c8d4244d3b4f9c99c1937fb65a2 (patch) | |
| tree | 6d166352229d903aeb52ca06c66cdc26f54147b9 /internal/state.go | |
| parent | 1cde39e35c0329b4783f188b050b78b520e43470 (diff) | |
more on federation
Diffstat (limited to 'internal/state.go')
| -rw-r--r-- | internal/state.go | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/internal/state.go b/internal/state.go index dceb108..d1225f0 100644 --- a/internal/state.go +++ b/internal/state.go @@ -12,11 +12,15 @@ import ( ) type checkState struct { - Status nagiosCode - PrevStatus nagiosCode - Epoch int64 `json:"Epoch,omitempty"` - output string - federated bool + Status nagiosCode + PrevStatus nagiosCode + Epoch int64 `json:"Epoch,omitempty"` + output string + federatedFrom string +} + +func (cs checkState) federated() bool { + return cs.federatedFrom != "" } func (cs checkState) changed() bool { @@ -78,7 +82,7 @@ func (s state) update(result checkResult) { prevStatus = prevState.Status } - cs := checkState{result.status, prevStatus, result.epoch, result.output, result.federated} + cs := checkState{result.status, prevStatus, result.epoch, result.output, result.federatedFrom} s.checks[result.name] = cs log.Println(result.name, cs) } @@ -237,8 +241,10 @@ func (s state) reportBy(sb *strings.Builder, showStatusChange, isStaleReport boo sb.WriteString(name) sb.WriteString(": ") sb.WriteString(cs.output) - if cs.federated { - sb.WriteString(" [federated]") + if cs.federated() { + sb.WriteString(" [federated from ") + sb.WriteString(cs.federatedFrom) + sb.WriteString("]") } if isStaleReport { @@ -262,4 +268,4 @@ func (s state) countBy(filter func(cs checkState) bool) (count int) { } } return -}
\ No newline at end of file +} |
