Hub v0.149.0: a box the household switched off is not an outage for 14 days (R-998)
gates / gates (push) Successful in 6m40s
gates / gates (push) Successful in 6m40s
hosts.deliberate_off_at follows the agent's deliberate_off field (set, then cleared by the first report of a new boot; one info event each way). While held, every silence alarm is held: host and node staleness, the 05:00 backup deadlines, off-site and restore-test freshness, the OS alarms and the kernel notice. After 14 days the usual alarms fire once, naming the power-off. Pages show KIKAPCSOLVA and the time. Consequence tests with controls; each guard red-proofed.
This commit is contained in:
1 parent
ed59bf3cbd
commit
50e47e29af
24 files changed
+638
-17
No files matched your search
@@ -44,6 +44,26 @@ func (s *Server) hostStatus(lastReport *time.Time) string {
|
||||
}
|
||||
}
|
||||
|
||||
// hostDisplayStatus is hostStatus for the PAGES (R-998): a silent host the household switched off on purpose, inside
|
||||
// the 14-day hold, reads "off" — not stale/down — exactly while the checkers hold its alarms (the same
|
||||
// store.DeliberateOffHeld). Delete logic keeps reading hostStatus. Pinned by deliberate_off_view_test.go.
|
||||
func (s *Server) hostDisplayStatus(h *store.Host) string {
|
||||
st := s.hostStatus(h.LastReportAt)
|
||||
if (st == "stale" || st == "down") && store.DeliberateOffHeld(h.DeliberateOffAt, time.Now()) {
|
||||
return "off"
|
||||
}
|
||||
return st
|
||||
}
|
||||
|
||||
// deliberateOffLine is the operator line for a household power-off ("" when none is held).
|
||||
func deliberateOffLine(h *store.Host) string {
|
||||
if h == nil || !store.DeliberateOffHeld(h.DeliberateOffAt, time.Now()) {
|
||||
return ""
|
||||
}
|
||||
return "Kikapcsolva a háztartás által, " + h.DeliberateOffAt.UTC().Format("2006-01-02 15:04") + " UTC — riasztás szünetel eddig: " +
|
||||
h.DeliberateOffAt.Add(store.DeliberateOffHold).UTC().Format("2006-01-02 15:04") + " UTC"
|
||||
}
|
||||
|
||||
// hostStatusClass maps the internal status to the existing status-badge-* CSS class.
|
||||
// "stale" reuses the amber -warn class (there is no dedicated -stale class), keeping the
|
||||
// styling consistent with the rest of the console.
|
||||
@@ -55,6 +75,8 @@ func hostStatusClass(status string) string {
|
||||
return "status-badge-warn"
|
||||
case "down":
|
||||
return "status-badge-down"
|
||||
case "off":
|
||||
return "status-badge-pending" // grey: deliberate, not an incident (R-998)
|
||||
default:
|
||||
return "status-badge-pending"
|
||||
}
|
||||
@@ -69,6 +91,8 @@ func hostStatusLabel(status string) string {
|
||||
return "STALE"
|
||||
case "down":
|
||||
return "DOWN"
|
||||
case "off":
|
||||
return "KIKAPCSOLVA" // R-998: switched off by the household
|
||||
default:
|
||||
return "NO REPORT"
|
||||
}
|
||||
@@ -511,8 +535,9 @@ type hostListRow struct {
|
||||
CustomerID string
|
||||
CustomerName string
|
||||
AgentVersion string
|
||||
Status string // ok | stale | down | pending
|
||||
Status string // ok | stale | down | pending | off (R-998)
|
||||
StatusLabel string
|
||||
OffLine string // R-998: the household power-off line while the hold lasts
|
||||
StatusClass string
|
||||
LastReportAt *time.Time
|
||||
HasReport bool
|
||||
@@ -563,8 +588,9 @@ func (s *Server) handleHostsList(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
rows := make([]hostListRow, 0, len(hosts))
|
||||
for _, h := range hosts {
|
||||
status := s.hostStatus(h.LastReportAt)
|
||||
status := s.hostDisplayStatus(&h)
|
||||
row := hostListRow{
|
||||
OffLine: deliberateOffLine(&h),
|
||||
HostID: h.HostID,
|
||||
CustomerID: h.CustomerID,
|
||||
CustomerName: s.customerName(h.CustomerID),
|
||||
@@ -826,8 +852,9 @@ func (s *Server) hostDetailData(host *store.Host, r *http.Request) map[string]in
|
||||
"AgentVersion": host.AgentVersion,
|
||||
"CreatedAt": host.CreatedAt,
|
||||
"Status": status,
|
||||
"StatusLabel": hostStatusLabel(status),
|
||||
"StatusClass": hostStatusClass(status),
|
||||
"StatusLabel": hostStatusLabel(s.hostDisplayStatus(host)),
|
||||
"StatusClass": hostStatusClass(s.hostDisplayStatus(host)),
|
||||
"OffLine": deliberateOffLine(host),
|
||||
"LastReportAt": host.LastReportAt,
|
||||
"HasReport": host.LastReportAt != nil,
|
||||
"RecoveryMode": host.InRecoveryMode(time.Now()),
|
||||
|
||||
Reference in new issue
Block a user