Phase 2: Ceph health as tickets (shadow), and a Rules page #14

Merged
jared merged 1 commits from ceph-check into main 2026-11-27 12:29:21 -05:00
33 changed files with 1263 additions and 102 deletions

No files matched your search

+7
View File
@@ -75,4 +75,11 @@ Authorization: Bearer <your app's key>
| `host:<host>:fenced` | host lost its cluster link and was fenced | | `host:<host>:fenced` | host lost its cluster link and was fenced |
| `cluster:corosync:partition` | two or more nodes fenced or out of quorum | | `cluster:corosync:partition` | two or more nodes fenced or out of quorum |
| `cluster:reboots:<n>` | several hosts rebooted together with nothing else explaining it | | `cluster:reboots:<n>` | several hosts rebooted together with nothing else explaining it |
| `cluster:ceph:<CODE>` | a Ceph health code nothing higher explains, e.g. `cluster:ceph:RECENT_CRASH` (phase 2, thor#3) |
| `host:<host>:osd_down` | Ceph OSDs down on a host that is up, listed in one ticket |
| `cluster:ceph_flag:<flag>` | a cluster flag (`noout`, `pause`, ...) left set for 24 h |
| `cluster:ceph:forecast_nearfull` | the fullest OSD reaches nearfull within 60 days at the 14-day trend |
| `maintenance:gandalf:<id>` | a Gandalf maintenance (timeline only, never a ticket) | | `maintenance:gandalf:<id>` | a Gandalf maintenance (timeline only, never a ticket) |
Priorities and timing for each key are on Thor's Rules page (`/rules`), generated from the
same tables the checks use.
+43 -9
View File
@@ -1,13 +1,15 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
"""Record a replay fixture from the real Prometheus and Loki (read-only). """Record a replay fixture from the real Prometheus and Loki (read-only).
Usage: .venv/bin/python scripts/record_fixture.py t1 [t2 t3 t4 dimm] Usage: .venv/bin/python scripts/record_fixture.py [--ceph-only] t1 [t2 t3 t4 dimm]
Each fixture holds the raw series and log lines Thor's checks query, for the incident window Each fixture holds the raw series and log lines Thor's checks query, for the incident window
plus margin. Replays (tests/replay.py) slice them by time, so a check can change its windows plus margin. Replays (tests/replay.py) slice them by time, so a check can change its windows
without re-recording; a new query needs a re-record. Only what Thor parses is kept: stream without re-recording; a new query needs a re-record. Only what Thor parses is kept: stream
labels are cut to host/job/unit/transport, Ceph alert series that never switched on are labels are cut to host/job/unit/transport, Ceph alert series that never switched on are
dropped, and journal lines used only to see *when* a host last logged keep no text. dropped (as are OSDs that never went down), and journal lines used only to see *when* a host
last logged keep no text. Ceph flag history goes back a day (flags ticket after 24 h) and the
fullest-OSD fill two weeks at hourly steps (the nearfull forecast).
""" """
import json import json
import sys import sys
@@ -16,7 +18,7 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(ROOT)) sys.path.insert(0, str(ROOT))
from thor.checks import cluster, counter_rises, memory, reboots, symptoms # noqa: E402 from thor.checks import ceph, cluster, counter_rises, memory, reboots, symptoms # noqa: E402
from thor.clients.loki import LokiClient # noqa: E402 from thor.clients.loki import LokiClient # noqa: E402
from thor.clients.prometheus import PrometheusClient # noqa: E402 from thor.clients.prometheus import PrometheusClient # noqa: E402
from thor.hosts import HostRegistry # noqa: E402 from thor.hosts import HostRegistry # noqa: E402
@@ -62,12 +64,36 @@ SPECS = {
} }
def record(name: str) -> dict: def _range(name: str):
spec = SPECS[name] spec = SPECS[name]
return spec, spec['start'] - reboots.LOOKBACK_S - 600, spec['end'] + 600
def ceph_series(prom, name: str) -> dict:
"""The phase 2 Ceph check's queries (ceph_health_detail is recorded with the rest)."""
spec, start, end = _range(name)
out = {}
for expr in (ceph.OSD_UP_QUERY, ceph.QUORUM_QUERY, ceph.MONS_QUERY):
series = prom.query_range(expr, start, end, STEP)
if expr == ceph.OSD_UP_QUERY:
series = [s for s in series if any(v < 1 for _, v in s['values'])]
out[expr] = [{'metric': s['metric'], 'values': s['values']} for s in series]
down = {s['metric'].get('ceph_daemon') for s in out[ceph.OSD_UP_QUERY]}
out[ceph.OSD_HOST_QUERY] = [{'metric': s['metric'], 'values': s['values']}
for s in prom.query_range(ceph.OSD_HOST_QUERY, start - 3600, end, 600)
if s['metric'].get('ceph_daemon') in down]
# These look further back than the window: flags ticket after 24 h, the forecast uses 14 days.
for expr, a, step in ((ceph.FLAG_QUERY, spec['start'] - ceph.FLAG_TIMING.hold_s - 3600, ceph.FLAG_STEP_S),
(ceph.FILL_QUERY, spec['start'] - ceph.FORECAST_HISTORY_S - 3600, ceph.FORECAST_STEP_S)):
out[expr] = [{'metric': s['metric'], 'values': s['values']} for s in prom.query_range(expr, a, end, step)]
return out
def record(name: str) -> dict:
spec, start, end = _range(name)
hosts = HostRegistry() hosts = HostRegistry()
start, end = spec['start'] - reboots.LOOKBACK_S - 600, spec['end'] + 600
prom, loki = PrometheusClient(PROM, timeout=120), LokiClient(LOKI, timeout=120) prom, loki = PrometheusClient(PROM, timeout=120), LokiClient(LOKI, timeout=120)
exprs = [memory.COUNTER_QUERY, symptoms.CEPH_QUERY, reboots.boot_query(hosts)] exprs = [memory.COUNTER_QUERY, ceph.HEALTH_QUERY, reboots.boot_query(hosts)]
exprs += list(symptoms.ScrapeCheck().queries(hosts).values()) exprs += list(symptoms.ScrapeCheck().queries(hosts).values())
out = {'name': name, 'title': spec['title'], 'start': spec['start'], 'end': spec['end'], out = {'name': name, 'title': spec['title'], 'start': spec['start'], 'end': spec['end'],
'blind': spec.get('blind', {}), 'thor_down': spec.get('thor_down', []), 'blind': spec.get('blind', {}), 'thor_down': spec.get('thor_down', []),
@@ -75,9 +101,10 @@ def record(name: str) -> dict:
'prometheus': {}, 'loki': {}} 'prometheus': {}, 'loki': {}}
for expr in exprs: for expr in exprs:
series = prom.query_range(expr, start, end, STEP) series = prom.query_range(expr, start, end, STEP)
if expr == symptoms.CEPH_QUERY: if expr == ceph.HEALTH_QUERY:
series = [s for s in series if any(v >= 1 for _, v in s['values'])] series = [s for s in series if any(v >= 1 for _, v in s['values'])]
out['prometheus'][expr] = [{'metric': s['metric'], 'values': s['values']} for s in series] out['prometheus'][expr] = [{'metric': s['metric'], 'values': s['values']} for s in series]
out['prometheus'].update(ceph_series(prom, name))
def grab(q, a, b, keep_text=True): def grab(q, a, b, keep_text=True):
lines, t = [], a lines, t = [], a
@@ -108,9 +135,16 @@ def record(name: str) -> dict:
if __name__ == '__main__': if __name__ == '__main__':
for name in sys.argv[1:]: # --ceph-only adds the phase 2 Ceph series to an existing fixture and keeps everything else,
data = record(name) # for incidents older than Loki's retention.
ceph_only = '--ceph-only' in sys.argv
for name in [a for a in sys.argv[1:] if not a.startswith('--')]:
path = ROOT / 'tests' / 'fixtures' / f'{name}.json' path = ROOT / 'tests' / 'fixtures' / f'{name}.json'
if ceph_only:
data = json.loads(path.read_text())
data['prometheus'].update(ceph_series(PrometheusClient(PROM, timeout=120), name))
else:
data = record(name)
path.write_text(json.dumps(data, sort_keys=True, separators=(',', ':')) + '\n') path.write_text(json.dumps(data, sort_keys=True, separators=(',', ':')) + '\n')
n_series = sum(len(v) for v in data['prometheus'].values()) n_series = sum(len(v) for v in data['prometheus'].values())
n_lines = sum(len(v) for v in data['loki'].values()) n_lines = sum(len(v) for v in data['loki'].values())
+2
View File
@@ -16,7 +16,9 @@ PAGES = {
'incident-oom-t1': '/incident/host:compute-storage-01:oom', 'incident-oom-t1': '/incident/host:compute-storage-01:oom',
'incident-partition-t4': '/incident/cluster:corosync:partition', 'incident-partition-t4': '/incident/cluster:corosync:partition',
'incident-maintenance-t2': '/incident/maintenance:gandalf:2', 'incident-maintenance-t2': '/incident/maintenance:gandalf:2',
'incident-ceph-crash': '/incident/cluster:ceph:RECENT_CRASH',
'known-conditions': '/known', 'known-conditions': '/known',
'rules': '/rules',
} }
VIEWPORTS = {'desktop': {'width': 1440, 'height': 900}, 'mobile': {'width': 390, 'height': 844}} VIEWPORTS = {'desktop': {'width': 1440, 'height': 900}, 'mobile': {'width': 390, 'height': 844}}
# The design system follows the browser's preference; the terminal look is the dark one. # The design system follows the browser's preference; the terminal look is the dark one.
+20 -2
View File
@@ -4,7 +4,8 @@
Usage: .venv/bin/python scripts/ui_demo.py [port] (default 8811, binds 127.0.0.1) Usage: .venv/bin/python scripts/ui_demo.py [port] (default 8811, binds 127.0.0.1)
The store holds T1 stopped mid-incident (05:40, an open P1), the T2 maintenance timeline, The store holds T1 stopped mid-incident (05:40, an open P1), the T2 maintenance timeline,
the DIMM known-condition note, and the T4 partition, all from tests/fixtures. The clock is the DIMM known-condition note, and the T4 partition, all from tests/fixtures, plus the
standing Ceph problems that were on that night (phase 2, thor#3). The clock is
frozen at T1 05:40 so "ago" texts read as they would have that night. frozen at T1 05:40 so "ago" texts read as they would have that night.
""" """
import sys import sys
@@ -24,10 +25,13 @@ T1_0540 = 1795412400.0
def demo_store() -> FakeStore: def demo_store() -> FakeStore:
merged = FakeStore() merged = FakeStore()
runs = [Replay('t4').run(), Replay('dimm').run(), Replay('t2').run(), Replay('t1').run(until=T1_0540)] runs = [Replay('t4').run(), Replay('dimm').run(), Replay('t2').run(), Replay('t1').run(until=T1_0540)]
for r in runs: for i, r in enumerate(runs):
merged.incidents.update(r.store.incidents) merged.incidents.update(r.store.incidents)
offset = len(merged.actions) offset = len(merged.actions)
# Standing Ceph problems are on in every replay; keep only the last night's actions for them.
skip = r.standing() if i < len(runs) - 1 else set()
for a in r.store.actions: for a in r.store.actions:
if a['incident_key'] not in skip:
merged.actions.append(dict(a, id=a['id'] + offset)) merged.actions.append(dict(a, id=a['id'] + offset))
merged.observations.update(r.store.observations) merged.observations.update(r.store.observations)
t1 = runs[-1].store t1 = runs[-1].store
@@ -37,9 +41,23 @@ def demo_store() -> FakeStore:
# Show T2's maintenance as still active, as it was mid-window. # Show T2's maintenance as still active, as it was mid-window.
m = merged.incidents['maintenance:gandalf:2'] m = merged.incidents['maintenance:gandalf:2']
m.update(state='open', cleared_at=None, last_seen=T1_0540 - 600) m.update(state='open', cleared_at=None, last_seen=T1_0540 - 600)
# What Ceph said isn't in the replays (only Prometheus is recorded). These are the detail
# lines the Proxmox API returned on 2026-11-27, so the Ceph incident pages look as they will.
for key, lines in DEMO_CEPH_DETAIL.items():
if key in merged.incidents:
merged.incidents[key]['facts']['detail_lines'] = lines
return merged return merged
DEMO_CEPH_DETAIL = {
'cluster:ceph:RECENT_CRASH': [
'osd.29 crashed on host compute-storage-01 at 2026-11-15T22:21:06.997639Z',
'osd.7 crashed on host compute-storage-01 at 2026-11-15T22:21:07.236865Z'],
'cluster:ceph:BLUESTORE_SLOW_OP_ALERT': [
f'osd.{n} observed slow operation indications in BlueStore' for n in (0, 5, 7, 14, 21, 29)],
}
def build(): def build():
settings = Settings() settings = Settings()
settings.public_url = '' settings.public_url = ''
+2
View File
@@ -25,6 +25,8 @@ class FakeStore:
self.known: List[dict] = [ self.known: List[dict] = [
{'id': 1, 'kind': 'reboot', 'subject': 'compute-storage-02', 'ticket_id': '693930698', {'id': 1, 'kind': 'reboot', 'subject': 'compute-storage-02', 'ticket_id': '693930698',
'reason': 'compute-storage-02 reboots every 2 to 3 days from a failing DIMM.'}, 'reason': 'compute-storage-02 reboots every 2 to 3 days from a failing DIMM.'},
{'id': 2, 'kind': 'ceph_flag', 'subject': 'noout', 'ticket_id': '693930698',
'reason': 'noout is set on purpose while compute-storage-02 can drop at any time.'},
] ]
def _check(self, name): def _check(self, name):
+1 -1
View File
@@ -1 +1 @@
{"blind":{},"end":1795234200.0,"guests":[],"loki":{"{job=\"journal\", host=~\"compute\\\\-storage\\\\-02|large1\", unit=\"systemd-logind.service\"} |~ \"will (reboot|power off|halt|kexec) now\"":[],"{job=\"journal\", host=~\"compute\\\\-storage\\\\-02|large1\"}":[[1795231250.748729,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.748864,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.75181,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.75194,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.7520692,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.7521658,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.752228,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.75232,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.752386,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"init.scope"}],[1795231250.753731,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"init.scope"}],[1795231250.7792718,"",{"host":"compute-storage-02","job":"journal","transport":"kernel"}],[1795231250.7831838,"",{"host":"compute-storage-02","job":"journal","transport":"syslog","unit":"session.scope"}],[1795231250.783621,"",{"host":"compute-storage-02","job":"journal","transport":"syslog","unit":"session.scope"}],[1795231250.7841501,"",{"host":"compute-storage-02","job":"journal","transport":"syslog","unit":"ssh.service"}],[1795231250.786763,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"init.scope"}],[1795231250.788361,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"systemd-logind.service"}],[1795231250.789092,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"systemd-logind.service"}],[1795231260.934769,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"init.scope"}],[1795231260.935585,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.9358919,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.935981,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.936044,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.936102,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.936162,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.936321,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.936411,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.936505,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.9365828,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.9371772,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.937672,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.93778,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.938247,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.031942,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.0333838,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.0339048,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.0358589,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.035983,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.036078,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.036135,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.064689,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"systemd-logind.service"}],[1795231261.064944,"",{"host":"compute-storage-02","job":"journal","transport":"syslog","unit":"[email protected]"}],[1795231261.0662441,"",{"host":"computeLine truncated {"blind":{},"end":1795234200.0,"guests":[],"loki":{"{job=\"journal\", host=~\"compute\\\\-storage\\\\-02|large1\", unit=\"systemd-logind.service\"} |~ \"will (reboot|power off|halt|kexec) now\"":[],"{job=\"journal\", host=~\"compute\\\\-storage\\\\-02|large1\"}":[[1795231250.748729,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.748864,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.75181,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.75194,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.7520692,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.7521658,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.752228,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.75232,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231250.752386,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"init.scope"}],[1795231250.753731,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"init.scope"}],[1795231250.7792718,"",{"host":"compute-storage-02","job":"journal","transport":"kernel"}],[1795231250.7831838,"",{"host":"compute-storage-02","job":"journal","transport":"syslog","unit":"session.scope"}],[1795231250.783621,"",{"host":"compute-storage-02","job":"journal","transport":"syslog","unit":"session.scope"}],[1795231250.7841501,"",{"host":"compute-storage-02","job":"journal","transport":"syslog","unit":"ssh.service"}],[1795231250.786763,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"init.scope"}],[1795231250.788361,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"systemd-logind.service"}],[1795231250.789092,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"systemd-logind.service"}],[1795231260.934769,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"init.scope"}],[1795231260.935585,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.9358919,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.935981,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.936044,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.936102,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.936162,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.936321,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.936411,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.936505,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.9365828,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.9371772,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.937672,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.93778,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231260.938247,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.031942,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.0333838,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.0339048,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.0358589,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.035983,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.036078,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.036135,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"[email protected]"}],[1795231261.064689,"",{"host":"compute-storage-02","job":"journal","transport":"journal","unit":"systemd-logind.service"}],[1795231261.064944,"",{"host":"compute-storage-02","job":"journal","transport":"syslog","unit":"[email protected]"}],[1795231261.0662441,"",{"host":"computeLine truncated
+1 -1
View File
@@ -1 +1 @@
{"blind":{"loki":[[1795413600.0,1795413690.0]]},"end":1795416000.0,"guests":[{"name":"pelican-wings-02","type":"lxc","vmid":154}],"loki":{"{job=\"journal\", host=~\"compute\\\\-storage\\\\-01\", transport=\"kernel\"} |~ \"oom-kill:|Killed process\"":[[1795410668.4005592,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=pve-notify-worker.service,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-ace2d165b97ac5f32ed17893c09b34e65feffb8c5b6a7d9358f3c2c56cf667ff.scope,task=java,pid=696041,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795410668.400567,"Out of memory: Killed process 696041 (java) total-vm:295326748kB, anon-rss:2351856kB, file-rss:8kB, shmem-rss:16544832kB, UID:100999 pgtables:38172kB oom_score_adj:0",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795411244.775691,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=proxmox-firewall.service,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-977c24bd05410674a45f7827e36183fefd3abc2b5df9474298b576b5e4cc813f.scope,task=java,pid=708681,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795411244.775713,"Out of memory: Killed process 708681 (java) total-vm:298066028kB, anon-rss:2530692kB, file-rss:8kB, shmem-rss:15895468kB, UID:100999 pgtables:37648kB oom_score_adj:0",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795411494.072769,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=pvefw-logger.service,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-011fd117e72e8521a9eea629be64ebc4046472b861d5a85c961cc4f095df84cf.scope,task=java,pid=729248,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795411494.07343,"Out of memory: Killed process 729248 (java) total-vm:297958800kB, anon-rss:2721048kB, file-rss:8kB, shmem-rss:15978608kB, UID:100999 pgtables:38096kB oom_score_adj:0",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795411923.1473951,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=system-ceph\\x2dosd.slice,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-c4098fa59615b6ed28d08e6256310e6c3bb0e73ac0e80cb45371ff5c7b8e2fff.scope,task=java,pid=742863,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795411923.1474078,"Out of memory: Killed process 742863 (java) total-vm:297741680kB, anon-rss:2535512kB, file-rss:8kB, shmem-rss:15749868kB, UID:100999 pgtables:37340kB oom_score_adj:0",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412188.327113,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=system-ceph\\x2dmgr.slice,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-637ab05ddb5d0dc7fbbd582e9f4665eef8ff7f892db4d929f10a1c9d59fd8c04.scope,task=java,pid=762546,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412188.327141,"Out of memory: Killed process 762546 (java) total-vm:296196848kB, anon-rss:2335424kB, file-rss:8kB, shmem-rss:16577548kB, UID:100999 pgtables:38280kB oom_score_adj:0",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412416.4115489,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=system-ceph\\x2dosd.slice,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-42bfac31d5a419682daadeb2da471a1b1690dfe26c04b84f9b2f89c88abb641f.scope,task=java,pid=774578,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412416.4123409,"Out of memory: Killed process 774578 (java) total-vm:297969160kB, anon-rss:2657528kB, file-rss:8kB, shmem-rss:15937664kB, UID:100999 pgtables:37900kB oom_score_adj:0",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412704.707103,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=promtail.service,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-7e6d66ccd4b1953bc7468d51b4525793874330fd7bc4d791e417ae040768328c.scope,task=java,pid=787164,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412704.7080588,"Out of memory: Killed process 787164 (java) total-vm:297723376kB, anon-rss:2660168kB, file-rss:8kB, shmem-rss:15102696kB, UID:100999 pgtables:36236kB oom_score_adj:0",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412957.6594298,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=system-ceph\\x2dmds.slice,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-74a5a6bec042b9ce041438f588ab6f82a12e68e2e075d7448f0be94233c0ed94.scope,task=java,pid=802388,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412957.660201,"Out of memory: Killed process 802388 (java) total-vm:297168904kB, anon-rss:2365804kB, file-rss:8kB, shmem-rss:15696328kB, UID:100999 pgtables:36736kB oom_score_adj:0",{"host":"compute-Line truncated {"blind":{"loki":[[1795413600.0,1795413690.0]]},"end":1795416000.0,"guests":[{"name":"pelican-wings-02","type":"lxc","vmid":154}],"loki":{"{job=\"journal\", host=~\"compute\\\\-storage\\\\-01\", transport=\"kernel\"} |~ \"oom-kill:|Killed process\"":[[1795410668.4005592,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=pve-notify-worker.service,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-ace2d165b97ac5f32ed17893c09b34e65feffb8c5b6a7d9358f3c2c56cf667ff.scope,task=java,pid=696041,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795410668.400567,"Out of memory: Killed process 696041 (java) total-vm:295326748kB, anon-rss:2351856kB, file-rss:8kB, shmem-rss:16544832kB, UID:100999 pgtables:38172kB oom_score_adj:0",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795411244.775691,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=proxmox-firewall.service,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-977c24bd05410674a45f7827e36183fefd3abc2b5df9474298b576b5e4cc813f.scope,task=java,pid=708681,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795411244.775713,"Out of memory: Killed process 708681 (java) total-vm:298066028kB, anon-rss:2530692kB, file-rss:8kB, shmem-rss:15895468kB, UID:100999 pgtables:37648kB oom_score_adj:0",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795411494.072769,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=pvefw-logger.service,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-011fd117e72e8521a9eea629be64ebc4046472b861d5a85c961cc4f095df84cf.scope,task=java,pid=729248,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795411494.07343,"Out of memory: Killed process 729248 (java) total-vm:297958800kB, anon-rss:2721048kB, file-rss:8kB, shmem-rss:15978608kB, UID:100999 pgtables:38096kB oom_score_adj:0",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795411923.1473951,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=system-ceph\\x2dosd.slice,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-c4098fa59615b6ed28d08e6256310e6c3bb0e73ac0e80cb45371ff5c7b8e2fff.scope,task=java,pid=742863,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795411923.1474078,"Out of memory: Killed process 742863 (java) total-vm:297741680kB, anon-rss:2535512kB, file-rss:8kB, shmem-rss:15749868kB, UID:100999 pgtables:37340kB oom_score_adj:0",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412188.327113,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=system-ceph\\x2dmgr.slice,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-637ab05ddb5d0dc7fbbd582e9f4665eef8ff7f892db4d929f10a1c9d59fd8c04.scope,task=java,pid=762546,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412188.327141,"Out of memory: Killed process 762546 (java) total-vm:296196848kB, anon-rss:2335424kB, file-rss:8kB, shmem-rss:16577548kB, UID:100999 pgtables:38280kB oom_score_adj:0",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412416.4115489,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=system-ceph\\x2dosd.slice,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-42bfac31d5a419682daadeb2da471a1b1690dfe26c04b84f9b2f89c88abb641f.scope,task=java,pid=774578,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412416.4123409,"Out of memory: Killed process 774578 (java) total-vm:297969160kB, anon-rss:2657528kB, file-rss:8kB, shmem-rss:15937664kB, UID:100999 pgtables:37900kB oom_score_adj:0",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412704.707103,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=promtail.service,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-7e6d66ccd4b1953bc7468d51b4525793874330fd7bc4d791e417ae040768328c.scope,task=java,pid=787164,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412704.7080588,"Out of memory: Killed process 787164 (java) total-vm:297723376kB, anon-rss:2660168kB, file-rss:8kB, shmem-rss:15102696kB, UID:100999 pgtables:36236kB oom_score_adj:0",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412957.6594298,"oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=system-ceph\\x2dmds.slice,mems_allowed=0,global_oom,task_memcg=/lxc/154/ns/system.slice/docker-74a5a6bec042b9ce041438f588ab6f82a12e68e2e075d7448f0be94233c0ed94.scope,task=java,pid=802388,uid=100999",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1795412957.660201,"Out of memory: Killed process 802388 (java) total-vm:297168904kB, anon-rss:2365804kB, file-rss:8kB, shmem-rss:15696328kB, UID:100999 pgtables:36736kB oom_score_adj:0",{"host":"compute-Line truncated
+1 -1
View File
@@ -1 +1 @@
{"blind":{"gandalf":[[1795576590.0,1795577880.0]],"loki":[[1795576590.0,1795577880.0]],"prometheus":[[1795576590.0,1795577880.0]],"proxmox":[[1795576590.0,1795577880.0]]},"end":1795579800.0,"guests":[],"loki":{"{job=\"journal\", host=~\"compute\\\\-storage\\\\-01\", unit=\"systemd-logind.service\"} |~ \"will (reboot|power off|halt|kexec) now\"":[[1795576898.2785769,"The system will power off now!",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"systemd-logind.service"}]],"{job=\"journal\", host=~\"compute\\\\-storage\\\\-01\"}":[[1795576978.4488692,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-crm.service"}],[1795576980.187105,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795576985.1881752,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795576988.3714838,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.3719308,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.3719869,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372033,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372086,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372115,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372143,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.3721752,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372202,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.3722298,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372254,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372281,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372312,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372339,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372363,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372413,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372434,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.3724601,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372483,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.386993,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.387059,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.3873181,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.3873658,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576990.1893692,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795576995.1905038,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795577000.191815,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795577005.192954,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795577010.194064,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795577015.195106,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795577020.196154,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795577020.896232,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795577020.896553,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795577020.8965912,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795577020.896641,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795577020.896684,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795577025.19727,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795577030.19822,"Line truncated {"blind":{"gandalf":[[1795576590.0,1795577880.0]],"loki":[[1795576590.0,1795577880.0]],"prometheus":[[1795576590.0,1795577880.0]],"proxmox":[[1795576590.0,1795577880.0]]},"end":1795579800.0,"guests":[],"loki":{"{job=\"journal\", host=~\"compute\\\\-storage\\\\-01\", unit=\"systemd-logind.service\"} |~ \"will (reboot|power off|halt|kexec) now\"":[[1795576898.2785769,"The system will power off now!",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"systemd-logind.service"}]],"{job=\"journal\", host=~\"compute\\\\-storage\\\\-01\"}":[[1795576978.4488692,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-crm.service"}],[1795576980.187105,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795576985.1881752,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795576988.3714838,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.3719308,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.3719869,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372033,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372086,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372115,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372143,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.3721752,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372202,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.3722298,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372254,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372281,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372312,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372339,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372363,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372413,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372434,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.3724601,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.372483,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.386993,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.387059,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.3873181,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576988.3873658,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795576990.1893692,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795576995.1905038,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795577000.191815,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795577005.192954,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795577010.194064,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795577015.195106,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795577020.196154,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795577020.896232,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795577020.896553,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795577020.8965912,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795577020.896641,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795577020.896684,"",{"host":"compute-storage-01","job":"journal","transport":"journal","unit":"init.scope"}],[1795577025.19727,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1795577030.19822,"Line truncated
+1 -1
View File
@@ -1 +1 @@
{"blind":{},"end":1793132100.0,"guests":[],"loki":{"{job=\"journal\", host=~\"compute\\\\-storage\\\\-01\", unit=\"systemd-logind.service\"} |~ \"will (reboot|power off|halt|kexec) now\"":[],"{job=\"journal\", host=~\"compute\\\\-storage\\\\-01\"}":[[1793116205.479008,"",{"host":"compute-storage-01","job":"journal","unit":"init.scope"}],[1793116205.4805,"",{"host":"compute-storage-01","job":"journal","unit":"systemd-logind.service"}],[1793116209.589037,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116216.5482292,"",{"host":"compute-storage-01","job":"journal","unit":"[email protected]"}],[1793116219.252162,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116228.9796999,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116232.98267,"",{"host":"compute-storage-01","job":"journal","unit":"[email protected]"}],[1793116239.53916,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116245.087618,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.10053,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.10053,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.10053,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116248.821326,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116259.1866891,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116262.982234,"",{"host":"compute-storage-01","job":"journal","unit":"[email protected]"}],[1793116269.426559,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116279.5394938,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116288.367156,"",{"host":"compute-storage-01","job":"journal","unit":"[email protected]"}],[1793116289.139137,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116292.982028,"",{"host":"compute-storage-01","job":"journal","unit":"[email protected]"}],[1793116298.67665,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116309.6191082,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116318.707457,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116322.9827,"",{"host":"compute-storage-01","job":"journal","unit":"[email protected]"}],[1793116329.5877042,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116339.122698,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116341.760001,"",{"host":"compute-storage-01","job":"journal","unit":"ssh.service"}],[1793116341.761685,"",{"host":"compute-storage-01","job":"journal","unit":"ssh.service"}],[1793116341.765128,"",{"host":"compute-storage-01","job":"journal","unit":"systemd-logind.service"}],[1793116341.778694,"",{"host":"compute-storage-01","job":"journal","unit":"init.scope"}],[1793116341.886134,"",{"host":"compute-storage-01","job":"journal","unit":"session-32288.scope"}],[1793116341.887172,"",{"host":"compute-storage-01","job":"journal","unit":"session-32288.scope"}],[1793116341.887272,"",{"host":"compute-storage-01","job":"journal","unit":"ssh.service"}],[1793116341.889955,"",{"host":"compute-storage-01","job":"journal","unit":"systemd-logind.service"}],[1793116341.8907,"",{"host":"compute-storage-01","job":"journal","unit":"init.scope"}],[1793116341.891649,"",{"host":"compute-storage-01","job":"journal","unit":"systemd-logind.service"}],[1793116349.554751,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116352.9830248,"",{"host":"compute-storage-01","job":"journal","unit":"[email protected]"}],[1793116358.962752,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116369.523223,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.sLine truncated {"blind":{},"end":1793132100.0,"guests":[],"loki":{"{job=\"journal\", host=~\"compute\\\\-storage\\\\-01\", unit=\"systemd-logind.service\"} |~ \"will (reboot|power off|halt|kexec) now\"":[],"{job=\"journal\", host=~\"compute\\\\-storage\\\\-01\"}":[[1793116205.479008,"",{"host":"compute-storage-01","job":"journal","unit":"init.scope"}],[1793116205.4805,"",{"host":"compute-storage-01","job":"journal","unit":"systemd-logind.service"}],[1793116209.589037,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116216.5482292,"",{"host":"compute-storage-01","job":"journal","unit":"[email protected]"}],[1793116219.252162,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116228.9796999,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116232.98267,"",{"host":"compute-storage-01","job":"journal","unit":"[email protected]"}],[1793116239.53916,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116245.087618,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.10053,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.10053,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.10053,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116245.100698,"",{"host":"compute-storage-01","job":"journal","unit":"smartctl-exporter.service"}],[1793116248.821326,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116259.1866891,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116262.982234,"",{"host":"compute-storage-01","job":"journal","unit":"[email protected]"}],[1793116269.426559,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116279.5394938,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116288.367156,"",{"host":"compute-storage-01","job":"journal","unit":"[email protected]"}],[1793116289.139137,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116292.982028,"",{"host":"compute-storage-01","job":"journal","unit":"[email protected]"}],[1793116298.67665,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116309.6191082,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116318.707457,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116322.9827,"",{"host":"compute-storage-01","job":"journal","unit":"[email protected]"}],[1793116329.5877042,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116339.122698,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116341.760001,"",{"host":"compute-storage-01","job":"journal","unit":"ssh.service"}],[1793116341.761685,"",{"host":"compute-storage-01","job":"journal","unit":"ssh.service"}],[1793116341.765128,"",{"host":"compute-storage-01","job":"journal","unit":"systemd-logind.service"}],[1793116341.778694,"",{"host":"compute-storage-01","job":"journal","unit":"init.scope"}],[1793116341.886134,"",{"host":"compute-storage-01","job":"journal","unit":"session-32288.scope"}],[1793116341.887172,"",{"host":"compute-storage-01","job":"journal","unit":"session-32288.scope"}],[1793116341.887272,"",{"host":"compute-storage-01","job":"journal","unit":"ssh.service"}],[1793116341.889955,"",{"host":"compute-storage-01","job":"journal","unit":"systemd-logind.service"}],[1793116341.8907,"",{"host":"compute-storage-01","job":"journal","unit":"init.scope"}],[1793116341.891649,"",{"host":"compute-storage-01","job":"journal","unit":"systemd-logind.service"}],[1793116349.554751,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116352.9830248,"",{"host":"compute-storage-01","job":"journal","unit":"[email protected]"}],[1793116358.962752,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.service"}],[1793116369.523223,"",{"host":"compute-storage-01","job":"journal","unit":"pvestatd.sLine truncated
+1 -1
View File
@@ -1 +1 @@
{"blind":{},"end":1793832000.0,"guests":[],"loki":{"{job=\"journal\", host=~\"compute\\\\-storage\\\\-01\", unit=\"systemd-logind.service\"} |~ \"will (reboot|power off|halt|kexec) now\"":[],"{job=\"journal\", host=~\"compute\\\\-storage\\\\-01\"}":[[1793825464.821393,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825464.82141,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825464.8214242,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825464.821444,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825464.82146,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825464.821474,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825467.084974,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825481.92764,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825481.9276822,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825481.927799,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825481.927849,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825481.927886,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825481.92792,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825481.931382,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825481.934502,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825481.9345238,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825481.9390762,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825481.939105,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825482.220835,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825482.221645,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825482.2220109,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825482.230598,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1793825482.231528,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1793825482.242889,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-crm.service"}],[1793825483.951335,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pvestatd.service"}],[1793825484.0730371,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pvestatd.service"}],[1793825484.183027,"",{"host":"compute-storage-01","job":"journal","transport":"stdout","unit":"promtail.service"}],[1793825488.2244549,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825488.2248042,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825493.282784,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pvestatd.service"}],[1793825493.3943071,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pvestatd.service"}],[1793825495.082861,"",{"host":"compute-storage-01","job":"journal","transport":"stdout","unit":"promtail.service"}],[1793825500.012836,"",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1793825500.01323,"",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1793825502.767096,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pvestatd.service"}],[1793825502.79983,"",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1793825502.855337,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pvestatd.service"}],[1793825502.905832,"",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1793825502.9059,"",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1793825506.78284,"",{"host":"compute-storage-01","job":"journal","transport":"stdout","unit":"promtail.service"}],[1793825510.127275,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pvestatd.service"}],[1793825513.831062,"",{"host":"compute-storage-01","job":"journal","transport":"stdout"Line truncated {"blind":{},"end":1793832000.0,"guests":[],"loki":{"{job=\"journal\", host=~\"compute\\\\-storage\\\\-01\", unit=\"systemd-logind.service\"} |~ \"will (reboot|power off|halt|kexec) now\"":[],"{job=\"journal\", host=~\"compute\\\\-storage\\\\-01\"}":[[1793825464.821393,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825464.82141,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825464.8214242,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825464.821444,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825464.82146,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825464.821474,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825467.084974,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825481.92764,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825481.9276822,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825481.927799,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825481.927849,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825481.927886,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825481.92792,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"corosync.service"}],[1793825481.931382,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825481.934502,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825481.9345238,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825481.9390762,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825481.939105,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825482.220835,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825482.221645,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825482.2220109,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825482.230598,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1793825482.231528,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-lrm.service"}],[1793825482.242889,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-ha-crm.service"}],[1793825483.951335,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pvestatd.service"}],[1793825484.0730371,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pvestatd.service"}],[1793825484.183027,"",{"host":"compute-storage-01","job":"journal","transport":"stdout","unit":"promtail.service"}],[1793825488.2244549,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825488.2248042,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pve-cluster.service"}],[1793825493.282784,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pvestatd.service"}],[1793825493.3943071,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pvestatd.service"}],[1793825495.082861,"",{"host":"compute-storage-01","job":"journal","transport":"stdout","unit":"promtail.service"}],[1793825500.012836,"",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1793825500.01323,"",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1793825502.767096,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pvestatd.service"}],[1793825502.79983,"",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1793825502.855337,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pvestatd.service"}],[1793825502.905832,"",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1793825502.9059,"",{"host":"compute-storage-01","job":"journal","transport":"kernel"}],[1793825506.78284,"",{"host":"compute-storage-01","job":"journal","transport":"stdout","unit":"promtail.service"}],[1793825510.127275,"",{"host":"compute-storage-01","job":"journal","transport":"syslog","unit":"pvestatd.service"}],[1793825513.831062,"",{"host":"compute-storage-01","job":"journal","transport":"stdout"Line truncated
+26
View File
@@ -77,6 +77,15 @@ class ReplayProxmox(_Blindable):
self._guard() self._guard()
return [] return []
def ceph_status(self):
# What Ceph said at the time isn't recorded anywhere: summaries fall back to Thor's rules.
self._guard()
return {}
def ceph_flags(self):
self._guard()
return {}
class ReplayGandalf(_Blindable): class ReplayGandalf(_Blindable):
"""Suppressions as Gandalf would have shown them at the replay's current time.""" """Suppressions as Gandalf would have shown them at the replay's current time."""
@@ -127,3 +136,20 @@ class Replay:
def opened(self) -> List[dict]: def opened(self) -> List[dict]:
return self.actions('open') return self.actions('open')
# Ceph warnings already on before the incident began (BlueStore slow ops, an unarchived
# crash, noout, the nearfull trend) are standing problems with tickets of their own since
# phase 2 (thor#3). They are not part of the incident, so the incident's assertions leave
# them out and test_standing_ceph_* checks them instead.
def standing(self) -> set:
return {k for k, inc in self.store.incidents.items() if inc['first_seen'] < self.fixture['start']}
def incident_actions(self, kind: str = None) -> List[dict]:
standing = self.standing()
return [a for a in self.actions(kind) if a['incident_key'] not in standing]
def incident_opened(self) -> List[dict]:
return self.incident_actions('open')
def incidents(self) -> set:
return set(self.store.incidents) - self.standing()
+297
View File
@@ -0,0 +1,297 @@
"""The phase 2 Ceph check (thor#3) and the engine rules it relies on."""
import pytest
from thor.checks import NeedsSource
from thor.checks.ceph import (FILL_QUERY, FLAG_QUERY, HEALTH_QUERY, MONS_QUERY, OSD_HOST_QUERY, OSD_UP_QUERY,
QUORUM_QUERY, RULES, TIMING, CephCheck, forecast, rule_for, runs, timing_words)
from thor.clients import SourceError
from thor.config import Settings
from thor.engine import Engine
from thor.hosts import HostRegistry
from thor.model import CAUSE, CLEARED, LAYER_RESOURCE, OPEN, PENDING, Finding
from thor.monitor import CycleContext
T0 = 1_795_410_000.0
class Prom:
def __init__(self, series=None, fail=None):
self.series = series or {}
self.fail = fail
self.asked = []
def query_range(self, expr, start, end, step):
self.asked.append(expr)
if self.fail:
raise self.fail
return [{'metric': s['metric'], 'values': [(t, v) for t, v in s['values'] if start <= t <= end]}
for s in self.series.get(expr, [])]
class Px:
def __init__(self, status=None, flags=None, fail=False):
self.status, self.flags, self.fail = status or {}, flags or {}, fail
def ceph_status(self):
if self.fail:
raise SourceError('proxmox', 'down')
return self.status
def ceph_flags(self):
return self.flags
def ctx(prom, px=None, start=T0, end=T0 + 120, up=None):
return CycleContext(start, end, False, {'prometheus': prom, 'proxmox': px or Px()},
up or {'prometheus': True, 'proxmox': True}, HostRegistry())
def health(name, values, instance='10.10.10.11:9283', severity='HEALTH_WARN'):
return {'metric': {'name': name, 'instance': instance, 'severity': severity}, 'values': values}
def on(a, b, step=60, v=1):
return [(t, v) for t in range(int(a), int(b) + 1, step)]
# -- reading the series --------------------------------------------------------
def test_runs_only_end_on_an_explicit_zero():
points = {0: 1, 60: 1, 300: 1, 360: 0, 420: 1} # 60 to 300 has no samples: unknown, not off
assert runs(points) == [(0, 300), (420, 420)]
def test_the_active_mgr_moving_hosts_is_one_warning():
# T4: storage-01's exporter stopped at 20:51, compute-storage-01's started at 20:57.
series = {HEALTH_QUERY: [health('BLUESTORE_SLOW_OP_ALERT', on(T0 - 7200, T0 - 600)),
health('BLUESTORE_SLOW_OP_ALERT', on(T0 - 240, T0 + 120), instance='10.10.10.4:9283')]}
found = CephCheck().run(ctx(Prom(series)))
assert [f.key for f in found] == ['cluster:ceph:BLUESTORE_SLOW_OP_ALERT']
# The six-minute gap with no samples doesn't split it: one stretch since the first sample.
assert found[0].facts['run_start'] == T0 - 7200 and found[0].facts['run_start_open']
def test_rules_priorities_and_unknown_codes():
assert rule_for('PG_AVAILABILITY').priority == 1
assert rule_for('SLOW_OPS').priority == 2
assert rule_for('RECENT_CRASH').priority == 3
assert rule_for('MDS_SLOW_REQUEST').priority == 3
assert rule_for('OSD_SLOW_PING_TIME_BACK').priority == 3
assert rule_for('BLUESTORE_SLOW_OP_ALERT').priority == 4
assert rule_for('AUTH_INSECURE_SERVICE_TICKETS', 'HEALTH_ERR').priority == 4
assert rule_for('SOMETHING_NEW', 'HEALTH_ERR').priority == 2
assert rule_for('SOMETHING_NEW', 'HEALTH_WARN').priority == 3
assert rule_for('OSD_DOWN').handled_by and rule_for('OSDMAP_FLAGS').handled_by
assert len({r.code for r in RULES}) == len(RULES)
def test_health_finding_uses_what_ceph_says_and_its_timing():
series = {HEALTH_QUERY: [health('RECENT_CRASH', on(T0 - 3600, T0 + 120)),
health('OSDMAP_FLAGS', on(T0 - 3600, T0 + 120)), # handled per flag
health('OSD_DOWN', on(T0, T0 + 120))]} # handled per host
px = Px({'health': {'checks': {'RECENT_CRASH': {
'summary': {'message': '2 daemons have recently crashed'},
'detail': [{'message': 'osd.29 crashed on host compute-storage-01 at 2026-11-15T22:21:06Z'}]}}}})
found = CephCheck().run(ctx(Prom(series), px))
assert [f.key for f in found] == ['cluster:ceph:RECENT_CRASH']
f = found[0]
assert f.summary == 'Ceph RECENT_CRASH: 2 daemons have recently crashed'
assert f.facts['detail_lines'] == ['osd.29 crashed on host compute-storage-01 at 2026-11-15T22:21:06Z']
assert f.priority == 3 and f.hold_s == TIMING[3].hold_s and f.clear_s is None
assert not f.explains and not f.extends and f.cluster_effect
assert any('crash archive' in c for c in f.facts['checks'])
def test_without_proxmox_the_summary_comes_from_thors_rule():
series = {HEALTH_QUERY: [health('SLOW_OPS', on(T0, T0 + 120))]}
found = CephCheck().run(ctx(Prom(series), Px(fail=True)))
assert found[0].summary.startswith('Ceph SLOW_OPS: Client requests are blocked')
assert found[0].explains and found[0].extends and found[0].hold_s is None
def test_needs_prometheus():
with pytest.raises(NeedsSource):
CephCheck().run(ctx(Prom(), up={'prometheus': False}))
with pytest.raises(NeedsSource):
CephCheck().run(ctx(Prom(fail=SourceError('prometheus', 'x'))))
# -- OSDs, flags, quorum, forecast -----------------------------------------------
def test_down_osds_are_one_finding_per_host():
series = {
OSD_UP_QUERY: [{'metric': {'ceph_daemon': 'osd.12'}, 'values': [(T0, 1), (T0 + 60, 0), (T0 + 120, 0)]},
{'metric': {'ceph_daemon': 'osd.3'}, 'values': [(T0, 0), (T0 + 120, 0)]},
{'metric': {'ceph_daemon': 'osd.7'}, 'values': [(T0, 1), (T0 + 120, 1)]}],
OSD_HOST_QUERY: [{'metric': {'ceph_daemon': 'osd.12', 'hostname': 'large1'}, 'values': [(T0 - 600, 1)]},
{'metric': {'ceph_daemon': 'osd.3', 'hostname': 'compute-storage-02'},
'values': [(T0 - 600, 1)]}],
}
found = CephCheck().run(ctx(Prom(series)))
assert [f.key for f in found] == ['host:compute-storage-02:osd_down'] # large1 is its old name
f = found[0]
assert f.facts['osds'] == ['osd.3', 'osd.12'] and f.priority == 2 and f.subject == 'compute-storage-02'
assert f.summary == '2 Ceph OSDs down on compute-storage-02: osd.3, osd.12'
assert [e['text'] for e in f.events] == ['osd.3 down', 'osd.12 down']
def test_flags_from_history_and_from_proxmox():
series = {FLAG_QUERY: [{'metric': {'__name__': 'ceph_osd_flag_noout'}, 'values': on(T0 - 90000, T0 + 120, 300)},
{'metric': {'__name__': 'ceph_osd_flag_norecover'}, 'values': on(T0 - 600, T0 - 300, 300)
+ [(T0, 0)]}]}
found = CephCheck().run(ctx(Prom(series), Px(flags={'noout': True, 'pause': True})))
by_key = {f.key: f for f in found}
assert set(by_key) == {'cluster:ceph_flag:noout', 'cluster:ceph_flag:pause'}
noout = by_key['cluster:ceph_flag:noout']
assert noout.facts['known_as'] == 'noout' and noout.facts['run_start_open']
assert noout.hold_s == 24 * 3600 and noout.priority == 4
assert 'run_start' not in by_key['cluster:ceph_flag:pause'].facts # no history: engine's first sighting
def test_quorum_lost_when_half_or_fewer_mons_are_in():
series = {QUORUM_QUERY: [{'metric': {}, 'values': [(T0, 3), (T0 + 60, 1), (T0 + 120, 1)]}],
MONS_QUERY: [{'metric': {}, 'values': [(T0, 3)]}]}
found = CephCheck().run(ctx(Prom(series)))
assert [(f.key, f.priority) for f in found] == [('cluster:ceph:MON_QUORUM', 1)]
series[QUORUM_QUERY][0]['values'] = [(T0, 2), (T0 + 120, 2)]
assert CephCheck().run(ctx(Prom(series))) == []
def test_forecast_names_the_fullest_osd_and_runs_hourly():
hours = [T0 - 14 * 86400 + h * 3600 for h in range(14 * 24 + 1)]
fill = [{'metric': {'ceph_daemon': 'osd.5'}, 'values': [(t, 0.80 + 0.0001 * i) for i, t in enumerate(hours)]}]
f = forecast(fill, T0, 0.85)
assert f['osd'] == 'osd.5' and 0 < f['days'] <= 60
prom = Prom({FILL_QUERY: fill})
check = CephCheck()
found = check.run(ctx(prom, end=T0))
assert [x.key for x in found] == ['cluster:ceph:forecast_nearfull']
assert found[0].start == hours[0] and 'osd.5 reaches nearfull' in found[0].summary
check.run(ctx(prom, start=T0, end=T0 + 120))
assert prom.asked.count(FILL_QUERY) == 1 # once an hour
flat = [{'metric': {'ceph_daemon': 'osd.5'}, 'values': [(t, 0.6) for t in hours]}]
assert forecast(flat, T0, 0.85)['days'] is None
past = [{'metric': {'ceph_daemon': 'osd.5'}, 'values': [(t, 0.9) for t in hours]}]
assert CephCheck().run(ctx(Prom({FILL_QUERY: past}), end=T0)) == [] # OSD_NEARFULL owns it
def test_describe_lists_every_rule_with_words():
rows = CephCheck.describe()
codes = [r['code'] for r in rows]
assert 'BLUESTORE_SLOW_OP_ALERT' in codes and 'any other HEALTH_ERR' in codes
row = rows[codes.index('BLUESTORE_SLOW_OP_ALERT')]
assert (row['ticket_after'], row['cleared_after']) == ('2 h', '6 h quiet')
assert timing_words(None, hold=True).startswith('one held cycle')
flag = rows[codes.index('cluster:ceph_flag:<flag>')]
assert flag['ticket_after'] == '24 h' and flag['cleared_after'] == '15 min quiet'
# -- engine: timing, standing warnings, outlasting a cause ---------------------
def engine(mode='shadow'):
s = Settings()
s.checks = {'ceph': mode, 'memory': mode}
return Engine(s, HostRegistry(), {'ceph': CephCheck()}, lambda *a, **k: None)
def ceph(code, start, end, priority=4, run_start=None, **kw):
hold = TIMING[priority]
return Finding(kind='ceph_health', subject='cluster', role=CAUSE, layer=30, start=start, end=end,
key=f'cluster:ceph:{code}', summary=code, priority=priority, check='ceph', cluster_effect=True,
hold_s=hold.hold_s, clear_s=hold.clear_s, explains=priority <= 2, extends=priority <= 2,
facts={'run_start': run_start if run_start is not None else start, **kw})
def oom(at):
return Finding(kind='oom', subject='compute-storage-01', role=CAUSE, layer=LAYER_RESOURCE, start=at, end=at,
key='host:compute-storage-01:oom', summary='oom', check='memory', priority=3,
events=[{'id': str(at), 'at': at}])
def test_a_p4_waits_two_hours_and_a_flicker_is_dropped_without_a_ticket():
e = engine()
assert e.process([ceph('PG_NOT_SCRUBBED', T0, T0 + 600)], T0 + 600) == []
assert e.process([], T0 + 1200) == []
inc = e.incidents['cluster:ceph:PG_NOT_SCRUBBED']
assert inc.state == PENDING
e.process([], T0 + 600 + 6 * 3600) # quiet for its 6 h
assert inc.state == CLEARED and inc.facts['never_opened']
e2 = engine()
e2.process([ceph('PG_NOT_SCRUBBED', T0, T0 + 7300)], T0 + 7300)
acts = e2.process([ceph('PG_NOT_SCRUBBED', T0, T0 + 7420)], T0 + 7420)
assert [a.kind for a in acts] == ['open'] and acts[0].payload['priority'] == 4
def test_a_p4_clears_only_after_six_hours_quiet():
e = engine()
e.process([ceph('BLUESTORE_SLOW_OP_ALERT', T0 - 9000, T0)], T0)
e.process([], T0 + 120)
inc = e.incidents['cluster:ceph:BLUESTORE_SLOW_OP_ALERT']
assert inc.state == OPEN
e.process([], T0 + 3 * 3600)
assert inc.state == OPEN
acts = e.process([], T0 + 6 * 3600 + 60)
assert inc.state == CLEARED and [a.kind for a in acts] == ['cleared']
def test_a_standing_warning_explains_nothing_and_does_not_keep_a_cause_open():
e = engine()
e.process([ceph('BLUESTORE_SLOW_OP_ALERT', T0 - 9000, T0)], T0)
e.process([], T0 + 120)
e.process([oom(T0 + 200)], T0 + 200)
assert 'host:compute-storage-01:oom' in e.incidents # not swallowed by the P4
e.process([oom(T0 + 200), ceph('DB_DEVICE_STALLED_READ_ALERT', T0 + 300, T0 + 300, priority=3)], T0 + 320)
inc = e.incidents['host:compute-storage-01:oom']
assert 'cluster:ceph:DB_DEVICE_STALLED_READ_ALERT' in inc.symptoms # started during it: "Also seen"
for t in range(440, 1500, 120): # the warning carries on ...
e.process([ceph('DB_DEVICE_STALLED_READ_ALERT', T0 + 300, T0 + t, priority=3)], T0 + t)
assert inc.state == CLEARED # ... but the OOM still clears on time
def test_a_warning_that_outlasts_its_cause_is_timed_from_the_clear():
e = engine()
e.process([oom(T0)], T0)
e.process([oom(T0), ceph('DB_DEVICE_STALLED_READ_ALERT', T0 + 60, T0 + 60, priority=3)], T0 + 120)
t = 240
while e.incidents['host:compute-storage-01:oom'].state != CLEARED:
e.process([ceph('DB_DEVICE_STALLED_READ_ALERT', T0 + 60, T0 + t, priority=3)], T0 + t)
t += 120
cleared = e.incidents['host:compute-storage-01:oom'].cleared_at
e.process([ceph('DB_DEVICE_STALLED_READ_ALERT', T0 + 60, T0 + t, priority=3)], T0 + t)
own = e.incidents['cluster:ceph:DB_DEVICE_STALLED_READ_ALERT']
assert own.state == PENDING and own.facts['run_start'] == cleared and own.facts['outlasted'] == cleared
opened_at = None
while opened_at is None:
t += 120
acts = e.process([ceph('DB_DEVICE_STALLED_READ_ALERT', T0 + 60, T0 + t, priority=3)], T0 + t)
opened_at = next((a.created for a in acts if a.kind == 'open'), None)
assert 15 * 60 <= opened_at - cleared <= 15 * 60 + 240
def test_open_ended_runs_keep_their_earliest_start():
e = engine()
e.process([ceph('BLUESTORE_SLOW_OP_ALERT', T0 - 9000, T0, run_start_open=True)], T0)
e.process([ceph('BLUESTORE_SLOW_OP_ALERT', T0 - 8880, T0 + 120, run_start_open=True)], T0 + 120)
assert e.incidents['cluster:ceph:BLUESTORE_SLOW_OP_ALERT'].facts['run_start'] == T0 - 9000
def test_a_known_condition_matches_a_flag_by_its_name():
e = engine()
e.known = [{'kind': 'ceph_flag', 'subject': 'noout', 'ticket_id': 693930698, 'reason': 'cs-02'}]
f = Finding(kind='ceph_flag', subject='cluster', role=CAUSE, layer=30, start=T0 - 90000, end=T0,
key='cluster:ceph_flag:noout', summary='noout', check='ceph', priority=4, hold_s=86400,
facts={'known_as': 'noout', 'flag': 'noout', 'run_start': T0 - 90000})
e.process([f], T0)
acts = e.process([f], T0 + 120)
assert [(a.kind, a.payload.get('ticket_id')) for a in acts] == [('known_note', '693930698')]
assert e.incidents['cluster:ceph_flag:noout'].summary.startswith('Ceph flag noout set since ')
def test_ticket_text_says_when_the_start_is_only_a_lower_bound():
from thor import ticket_text
from thor.model import Incident
inc = Incident(key='cluster:ceph:BLUESTORE_SLOW_OP_ALERT', kind='ceph_health', subject='cluster', layer=30,
check='ceph', priority=4, first_seen=T0, last_seen=T0 + 60, summary='Ceph BLUESTORE_SLOW_OP_ALERT',
facts={'run_start_open': True, 'detail_lines': ['osd.0 observed slow operation indications'],
'rule': 'BLUESTORE_SLOW_OP_ALERT', 'why': 'Standing.'})
text = ticket_text.description(inc)
assert 'or earlier (already on when Thor first looked)' in text
assert '### What Ceph reports\n- osd.0 observed slow operation indications' in text
assert ticket_text.title(inc).startswith('[proxmox-cluster][auto][thor][ceph] ')
+3 -15
View File
@@ -2,7 +2,7 @@ import pytest
from thor.checks import NeedsSource, counter_rises, query_regex from thor.checks import NeedsSource, counter_rises, query_regex
from thor.checks.memory import MemoryCheck, kernel_query, parse_kills from thor.checks.memory import MemoryCheck, kernel_query, parse_kills
from thor.checks.symptoms import CephAlertCheck, PvestatdCheck, ScrapeCheck from thor.checks.symptoms import PvestatdCheck, ScrapeCheck
from thor.clients import SourceError from thor.clients import SourceError
from thor.hosts import HostRegistry from thor.hosts import HostRegistry
from thor.model import CAUSE, NOTE, Incident from thor.model import CAUSE, NOTE, Incident
@@ -151,23 +151,11 @@ def test_pvestatd_check_maps_old_host_names():
assert len(found) == 1 and found[0].subject == 'monitor-01' and '(2x)' in found[0].summary assert len(found) == 1 and found[0].subject == 'monitor-01' and '(2x)' in found[0].summary
def test_ceph_alert_check_only_alerts_that_switch_on():
series = {'ceph_health_detail': [
{'metric': {'name': 'BLUESTORE_SLOW_OP_ALERT'}, 'values': [(0, 1), (60, 1)]}, # standing
{'metric': {'name': 'OSD_SLOW_PING_TIME_BACK'}, 'values': [(0, 0), (60, 1), (90, 0)]},
]}
found = CephAlertCheck().run(ctx(FakeProm(series), start=30))
assert [f.key for f in found] == ['cluster:ceph_alert:OSD_SLOW_PING_TIME_BACK']
assert found[0].start == 60 and found[0].subject == 'cluster'
def test_symptom_checks_need_their_source(): def test_symptom_checks_need_their_source():
for check, up in ((ScrapeCheck(), {'prometheus': False}), (PvestatdCheck(), {'loki': False}), for check, up in ((ScrapeCheck(), {'prometheus': False}), (PvestatdCheck(), {'loki': False})):
(CephAlertCheck(), {'prometheus': False})):
with pytest.raises(NeedsSource): with pytest.raises(NeedsSource):
check.run(ctx(up=up)) check.run(ctx(up=up))
for check in (ScrapeCheck(), CephAlertCheck()):
with pytest.raises(NeedsSource): with pytest.raises(NeedsSource):
check.run(ctx(FakeProm(SourceError('prometheus', 'x')))) ScrapeCheck().run(ctx(FakeProm(SourceError('prometheus', 'x'))))
with pytest.raises(NeedsSource): with pytest.raises(NeedsSource):
PvestatdCheck().run(ctx(loki=FakeLoki(SourceError('loki', 'x')))) PvestatdCheck().run(ctx(loki=FakeLoki(SourceError('loki', 'x'))))
+39 -9
View File
@@ -1,8 +1,13 @@
"""T1, the reference incident (thor#1): 2026-11-23 OOM loop on compute-storage-01 (CT 154). """T1, the reference incident (thor#1): 2026-11-23 OOM loop on compute-storage-01 (CT 154).
Right outcome: exactly one ticket, for the out-of-memory host, naming CT 154; the Ceph alerts, Right outcome: one ticket for the out-of-memory host, naming CT 154; the Ceph warnings,
pvestatd timeouts and scrape timeouts on other hosts are "Also seen" on it, not tickets of pvestatd timeouts and scrape timeouts on other hosts are "Also seen" on it, not tickets of
their own (Gandalf's false P1 network ticket, Tinker 615797777, is what this replaces). their own (Gandalf's false P1 network ticket, Tinker 615797777, is what this replaces).
Since phase 2 (thor#3) Ceph warnings are tickets when nothing explains them. One that started
during the OOM (DB_DEVICE_STALLED_READ_ALERT, 05:50) and carried on after it cleared (06:18)
becomes its own P3 once it has outlasted the OOM by its 15 minutes. Warnings on before 05:00
are standing problems (test_standing_ceph_warnings_are_their_own_tickets).
""" """
from datetime import datetime, timezone from datetime import datetime, timezone
@@ -11,6 +16,7 @@ import pytest
from .replay import Replay from .replay import Replay
KEY = 'host:compute-storage-01:oom' KEY = 'host:compute-storage-01:oom'
STALLED = 'cluster:ceph:DB_DEVICE_STALLED_READ_ALERT'
def hm(ts: float) -> str: def hm(ts: float) -> str:
@@ -22,9 +28,9 @@ def t1():
return Replay('t1').run() return Replay('t1').run()
def test_exactly_one_ticket_for_the_oom_host(t1): def test_one_ticket_for_the_oom_host(t1):
opened = t1.opened() opened = t1.incident_opened()
assert len(opened) == 1, [a['payload']['title'] for a in opened] assert [a['incident_key'] for a in opened] == [KEY, STALLED], [a['payload']['title'] for a in opened]
a = opened[0] a = opened[0]
assert a['incident_key'] == KEY assert a['incident_key'] == KEY
assert a['mode'] == 'shadow' and a['status'] == 'shadow' # nothing is sent in phase 1 assert a['mode'] == 'shadow' and a['status'] == 'shadow' # nothing is sent in phase 1
@@ -37,8 +43,31 @@ def test_exactly_one_ticket_for_the_oom_host(t1):
def test_no_other_incident_becomes_a_ticket(t1): def test_no_other_incident_becomes_a_ticket(t1):
assert set(t1.store.incidents) == {KEY} assert t1.incidents() == {KEY, STALLED}
assert {a['incident_key'] for a in t1.actions()} == {KEY} assert {a['incident_key'] for a in t1.incident_actions()} == {KEY, STALLED}
def test_a_ceph_warning_that_outlasts_the_oom_gets_its_own_ticket(t1):
oom = t1.store.incidents[KEY]
assert STALLED in oom['symptoms'] # "Also seen" while the OOM lasted
inc = t1.store.incidents[STALLED]
assert inc['priority'] == 3 and inc['facts']['outlasted'] == oom['cleared_at']
opened = [a for a in t1.incident_opened() if a['incident_key'] == STALLED][0]
# 15 minutes after the OOM cleared at 06:18.
assert '06:33' <= hm(opened['created']) <= '06:36'
assert 'carried on after that one cleared' in opened['payload']['description']
def test_standing_ceph_warnings_are_their_own_tickets(t1):
assert t1.standing() == {'cluster:ceph:BLUESTORE_SLOW_OP_ALERT', 'cluster:ceph:RECENT_CRASH',
'cluster:ceph_flag:noout', 'cluster:ceph:forecast_nearfull'}
by_key = {a['incident_key']: a for a in t1.actions('open')}
assert by_key['cluster:ceph:BLUESTORE_SLOW_OP_ALERT']['payload']['priority'] == 4
assert by_key['cluster:ceph:RECENT_CRASH']['payload']['priority'] == 3
assert 'cluster:ceph_flag:noout' not in by_key # a note on its known ticket instead
assert [a['payload']['ticket_id'] for a in t1.actions('known_note')] == ['693930698']
# None of them is sent again while nothing changes.
assert not [a for a in t1.actions('refresh') if a['incident_key'] in t1.standing()]
def test_counts_all_eleven_kills_of_ct_154(t1): def test_counts_all_eleven_kills_of_ct_154(t1):
@@ -52,7 +81,7 @@ def test_opens_at_p1_because_the_cluster_stalled_with_the_first_kill(t1):
"""pvestatd timed out on three other hosts at 05:11:03 (never on normal days) as the first """pvestatd timed out on three other hosts at 05:11:03 (never on normal days) as the first
kill landed at 05:11:08: other hosts stalling means P1 from the start (operator decision, kill landed at 05:11:08: other hosts stalling means P1 from the start (operator decision,
2026-11-25; the thor#1 table had guessed P3 rising to P1 at 06:01).""" 2026-11-25; the thor#1 table had guessed P3 rising to P1 at 06:01)."""
opened = t1.opened()[0] opened = t1.incident_opened()[0]
assert opened['payload']['priority'] == 1 assert opened['payload']['priority'] == 1
assert 'pvestatd' in opened['payload']['description'] assert 'pvestatd' in opened['payload']['description']
assert not t1.actions('escalate') # nothing higher to go to assert not t1.actions('escalate') # nothing higher to go to
@@ -64,12 +93,13 @@ def test_symptoms_on_other_hosts_are_also_seen_not_tickets(t1):
assert ('scrape', 'compute-storage-02') in kinds assert ('scrape', 'compute-storage-02') in kinds
assert ('scrape', 'storage-01') in kinds assert ('scrape', 'storage-01') in kinds
assert ('pvestatd', 'monitor-01') in kinds assert ('pvestatd', 'monitor-01') in kinds
assert any(k == 'ceph_alert' for k, _ in kinds) assert ('ceph_health', 'cluster') in kinds
assert {'cluster:ceph:OSD_SLOW_PING_TIME_BACK', STALLED} <= set(symptoms)
assert t1.actions('also_seen'), 'symptoms after the ticket opened are added as comments' assert t1.actions('also_seen'), 'symptoms after the ticket opened are added as comments'
def test_clears_fifteen_minutes_after_the_last_kill(t1): def test_clears_fifteen_minutes_after_the_last_kill(t1):
cleared = t1.actions('cleared') cleared = t1.incident_actions('cleared')
assert len(cleared) == 1 assert len(cleared) == 1
# Last kill 06:01:27 (counter 06:02:00): cleared 15 minutes later, within a cycle or two. # Last kill 06:01:27 (counter 06:02:00): cleared 15 minutes later, within a cycle or two.
assert '06:16' <= hm(cleared[0]['created']) <= '06:21' assert '06:16' <= hm(cleared[0]['created']) <= '06:21'
+30 -12
View File
@@ -4,6 +4,9 @@
* T3, 2026-10-27: compute-storage-01 lost its only corosync link, was fenced, down 3.5 hours. One ticket. * T3, 2026-10-27: compute-storage-01 lost its only corosync link, was fenced, down 3.5 hours. One ticket.
* T4, 2026-11-04: corosync partition, three nodes fenced. One ticket. * T4, 2026-11-04: corosync partition, three nodes fenced. One ticket.
* DIMM, 2026-11-21: compute-storage-02's known failing DIMM. No ticket, one note on 693930698. * DIMM, 2026-11-21: compute-storage-02's known failing DIMM. No ticket, one note on 693930698.
Ceph warnings already on before each incident began are standing problems with tickets of
their own since phase 2 (thor#3); the assertions below are about the incident (see replay.py).
""" """
from datetime import datetime, timezone from datetime import datetime, timezone
@@ -38,7 +41,7 @@ def dimm():
# -- T2: planned maintenance ------------------------------------------------ # -- T2: planned maintenance ------------------------------------------------
def test_t2_planned_maintenance_opens_no_ticket(t2): def test_t2_planned_maintenance_opens_no_ticket(t2):
assert t2.actions() == [] assert t2.incident_actions() == []
def test_t2_everything_lands_on_the_maintenance_timeline(t2): def test_t2_everything_lands_on_the_maintenance_timeline(t2):
@@ -49,7 +52,8 @@ def test_t2_everything_lands_on_the_maintenance_timeline(t2):
# Every rack host and compute-storage-02 came back with a new boot time. # Every rack host and compute-storage-02 came back with a new boot time.
assert rebooted >= {'compute-storage-01', 'compute-storage-02', 'compute-storage-gpu-01', 'storage-01', assert rebooted >= {'compute-storage-01', 'compute-storage-02', 'compute-storage-gpu-01', 'storage-01',
'monitor-01', 'monitor-02'} 'monitor-01', 'monitor-02'}
assert set(t2.store.incidents) == {'maintenance:gandalf:2'} assert t2.incidents() == {'maintenance:gandalf:2'}
assert 'cluster:ceph:MON_CLOCK_SKEW' in inc['symptoms'] # 03:38, inside the maintenance
def test_t2_thor_was_dark_and_caught_up(t2): def test_t2_thor_was_dark_and_caught_up(t2):
@@ -60,7 +64,7 @@ def test_t2_thor_was_dark_and_caught_up(t2):
# -- T3: one host fenced ------------------------------------------------------ # -- T3: one host fenced ------------------------------------------------------
def test_t3_one_ticket_for_the_fenced_host(t3): def test_t3_one_ticket_for_the_fenced_host(t3):
opened = t3.opened() opened = t3.incident_opened()
assert len(opened) == 1 assert len(opened) == 1
p = opened[0]['payload'] p = opened[0]['payload']
assert opened[0]['incident_key'] == 'host:compute-storage-01:fenced' assert opened[0]['incident_key'] == 'host:compute-storage-01:fenced'
@@ -73,24 +77,26 @@ def test_t3_one_ticket_for_the_fenced_host(t3):
def test_t3_ceph_fallout_and_the_late_reboot_attach_to_it(t3): def test_t3_ceph_fallout_and_the_late_reboot_attach_to_it(t3):
inc = t3.store.incidents['host:compute-storage-01:fenced'] inc = t3.store.incidents['host:compute-storage-01:fenced']
kinds = {(s['kind'], s['subject']) for s in inc['symptoms'].values()} kinds = {(s['kind'], s['subject']) for s in inc['symptoms'].values()}
assert ('ceph_alert', 'cluster') in kinds assert ('ceph_health', 'cluster') in kinds
assert ('scrape', 'compute-storage-01') in kinds assert ('scrape', 'compute-storage-01') in kinds
names = {k.split(':')[-1] for k in inc['symptoms'] if k.startswith('cluster:ceph_alert:')} # hwmonDaemon opened about 12 tickets for this in one second: mons, host, one per OSD.
assert {'MON_DOWN', 'OSD_HOST_DOWN', 'OSD_DOWN'} <= names names = {k.split(':')[-1] for k in inc['symptoms'] if k.startswith('cluster:ceph:')}
assert {'MON_DOWN', 'PG_DEGRADED', 'PG_AVAILABILITY'} <= names
assert 'host:compute-storage-01:osd_down' in inc['symptoms']
# The host stayed down until 19:20; the incident stays open while it is down, then clears. # The host stayed down until 19:20; the incident stays open while it is down, then clears.
assert inc['state'] == 'cleared' assert inc['state'] == 'cleared'
assert set(t3.store.incidents) == {'host:compute-storage-01:fenced'} assert t3.incidents() == {'host:compute-storage-01:fenced'}
# -- T4: partition -------------------------------------------------------------- # -- T4: partition --------------------------------------------------------------
def test_t4_one_ticket_for_the_partition(t4): def test_t4_one_ticket_for_the_partition(t4):
opened = t4.opened() opened = t4.incident_opened()
assert len(opened) == 1 assert len(opened) == 1
assert opened[0]['incident_key'] == 'cluster:corosync:partition' assert opened[0]['incident_key'] == 'cluster:corosync:partition'
assert opened[0]['payload']['priority'] == 1 assert opened[0]['payload']['priority'] == 1
assert opened[0]['payload']['title'].startswith('[proxmox-cluster][auto][thor][software] Cluster partition: ') assert opened[0]['payload']['title'].startswith('[proxmox-cluster][auto][thor][software] Cluster partition: ')
assert '20:52' <= hm(opened[0]['created']) <= '20:56' assert '20:52' <= hm(opened[0]['created']) <= '20:56'
assert {a['incident_key'] for a in t4.actions()} == {'cluster:corosync:partition'} assert {a['incident_key'] for a in t4.incident_actions()} == {'cluster:corosync:partition'}
def test_t4_late_fence_and_reboots_fold_into_the_partition(t4): def test_t4_late_fence_and_reboots_fold_into_the_partition(t4):
@@ -98,14 +104,26 @@ def test_t4_late_fence_and_reboots_fold_into_the_partition(t4):
assert 'storage-01' in inc['summary'] # fenced at 20:54, seen later on its own assert 'storage-01' in inc['summary'] # fenced at 20:54, seen later on its own
assert 'host:storage-01:fenced' in inc['symptoms'] assert 'host:storage-01:fenced' in inc['symptoms']
assert {'host:compute-storage-01:reboot', 'host:compute-storage-gpu-01:reboot'} <= set(inc['symptoms']) assert {'host:compute-storage-01:reboot', 'host:compute-storage-gpu-01:reboot'} <= set(inc['symptoms'])
assert {'host:storage-01:osd_down', 'cluster:ceph:PG_AVAILABILITY', 'cluster:ceph:MON_DOWN'} <= set(inc['symptoms'])
assert inc['state'] == 'cleared' assert inc['state'] == 'cleared'
# -- DIMM: known condition ------------------------------------------------------ # -- DIMM: known condition ------------------------------------------------------
def test_dimm_reboot_is_a_note_on_its_known_ticket_not_a_new_ticket(dimm): def test_dimm_reboot_is_a_note_on_its_known_ticket_not_a_new_ticket(dimm):
assert dimm.opened() == [] assert dimm.incident_opened() == []
notes = dimm.actions('known_note') notes = dimm.incident_actions('known_note')
assert len(notes) == 1 assert len(notes) == 1
assert notes[0]['payload']['ticket_id'] == '693930698' assert notes[0]['payload']['ticket_id'] == '693930698'
assert 'compute-storage-02' in notes[0]['payload']['comment'] assert 'compute-storage-02' in notes[0]['payload']['comment']
assert dimm.store.incidents['host:compute-storage-02:reboot']['state'] == 'cleared' inc = dimm.store.incidents['host:compute-storage-02:reboot']
assert inc['state'] == 'cleared'
# Its OSDs going down and the PGs degrading for two minutes are part of the reboot.
assert {'host:compute-storage-02:osd_down', 'cluster:ceph:PG_DEGRADED'} <= set(inc['symptoms'])
@pytest.mark.parametrize('name', ['t2', 't3', 't4', 'dimm'])
def test_standing_ceph_warnings_are_only_ceph_and_never_resent(name, request):
r = request.getfixturevalue(name)
assert r.standing() and all(k.startswith(('cluster:ceph:', 'cluster:ceph_flag:')) for k in r.standing())
assert not [a for a in r.actions('refresh') if a['incident_key'] in r.standing()]
assert 'cluster:ceph_flag:noout' not in {a['incident_key'] for a in r.actions('open')}
+48
View File
@@ -112,6 +112,17 @@ def test_covering_known_condition_and_old_names(store):
assert body['known_conditions'][0]['kind'] == 'reboot' assert body['known_conditions'][0]['kind'] == 'reboot'
def test_standing_ceph_warnings_never_cover_another_apps_report(store):
store.incidents['cluster:ceph:BLUESTORE_SLOW_OP_ALERT'] = inc(
'cluster:ceph:BLUESTORE_SLOW_OP_ALERT', 'cluster', mode='live', kind='ceph_health', priority=4, explains=False)
store.add_action({'incident_key': 'cluster:ceph:BLUESTORE_SLOW_OP_ALERT', 'kind': 'open', 'created': T - 400,
'mode': 'live', 'payload': {'title': 't'}})
store.mark_action_sent(len(store.actions), '673679581', T - 399)
d = get(client(store), '/api/incidents/covering?host=monitor-02').get_json()
assert 'cluster:ceph:BLUESTORE_SLOW_OP_ALERT' not in [i['key'] for i in d['incidents']]
assert d['ticket_id'] != '673679581'
def test_covering_scopes_and_errors(store): def test_covering_scopes_and_errors(store):
c = client(store) c = client(store)
cluster = get(c, '/api/incidents/covering?scope=cluster').get_json() cluster = get(c, '/api/incidents/covering?scope=cluster').get_json()
@@ -159,6 +170,43 @@ def test_incident_and_known_pages(store):
assert '693930698' in known and 'compute-storage-02' in known assert '693930698' in known and 'compute-storage-02' in known
def test_rules_page_is_built_from_the_checks(store):
html = client(store, checks={'memory': 'live'}).get('/rules').get_data(as_text=True)
assert 'aria-current="page">Rules</a>' in html
# Ceph timing by priority, and one row per rule with its words.
assert 'Ceph timing by priority' in html and '6 h quiet' in html and '15 min' in html
assert '<code>BLUESTORE_SLOW_OP_ALERT</code>' in html and '<code>host:&lt;host&gt;:osd_down</code>' in html
assert 'see <code>host:&lt;host&gt;:osd_down</code>' in html # OSD_DOWN is handled per host
assert 'any other HEALTH_ERR' in html and '24 h' in html
# Every ticketing check, with its mode; symptom-only checks have no section.
for label in ('Maintenance (Gandalf)', 'Partitions and fencing', 'Reboots', 'Memory', 'Ceph health'):
assert label in html
assert 't-mode-live">live<' in html and 't-mode-shadow">shadow<' in html
assert 'id="check-scrapes"' not in html
def test_incident_page_shows_its_timing_and_what_ceph_reports(store):
store.incidents['cluster:ceph:RECENT_CRASH'] = inc(
'cluster:ceph:RECENT_CRASH', 'cluster', kind='ceph_health', priority=3, hold_s=900,
facts={'why': 'A Ceph daemon crashed recently.', 'detail_lines': ['osd.29 crashed on host compute-storage-01'],
'outlasted': T - 300})
c = client(store)
html = c.get('/incident/cluster:ceph:RECENT_CRASH').get_data(as_text=True)
assert 'ticket after 15 min; cleared after 15 min quiet' in html
assert 'A Ceph daemon crashed recently.' in html and 'What Ceph reports' in html
assert 'osd.29 crashed on host compute-storage-01' in html and 'carried on after it cleared' in html
oom = c.get('/incident/host:compute-storage-01:oom').get_data(as_text=True)
assert 'ticket after one held cycle (about 4 min); cleared after 15 min quiet' in oom
def test_incident_page_never_shows_an_attached_ticket_as_thors(store):
store.add_action({'incident_key': 'cluster:corosync:partition', 'kind': 'attach', 'created': T - 100,
'mode': 'live', 'payload': {'ticket_id': '615797777', 'comment': 'Root cause'}})
store.mark_action_sent(len(store.actions), '615797777', T - 99)
d = views.incident_detail(store, 'cluster:corosync:partition')
assert d['incident']['ticket_id'] == '987654321'
def test_user_shown_only_from_the_proxy(store): def test_user_shown_only_from_the_proxy(store):
c = client(store) c = client(store)
headers = {'Remote-User': 'jared', 'Remote-Name': 'Jared', 'Remote-Groups': 'admin,employee'} headers = {'Remote-User': 'jared', 'Remote-Name': 'Jared', 'Remote-Groups': 'admin,employee'}
+446
View File
@@ -0,0 +1,446 @@
"""Ceph health (thor#3, phase 2): one incident per Ceph health code, taking over from hwmonDaemon.
Decided with the operator on 2026-11-27 (thor#3 comment 7206). Everything the check decides
comes from the tables below, and the web UI's Rules page renders the same tables, so what
Thor does and what it says it does can't drift apart.
Evidence:
* Prometheus ``ceph_health_detail`` (one series per active health code, from whichever mgr
is active) for *when* each warning was on, with history;
* the Proxmox API ``/cluster/ceph/status`` for *what* Ceph says right now: the summary and
the detail lines (which OSDs have slow ops, which daemons crashed where);
* ``ceph_osd_up`` + ``ceph_osd_metadata`` for down OSDs per host, the ``ceph_osd_flag_*``
series and the Proxmox flags (which include ``pause``), mon quorum, and OSD fill for the
nearfull forecast.
A warning that switches on while a higher cause is active (an OOM on a Ceph host, a fenced
host, a partition, maintenance) is "Also seen" on that cause, through the engine. Warnings
already on before it started are standing problems of their own.
"""
import fnmatch
import re
from dataclasses import dataclass, field
from typing import Dict, List, Optional, Tuple
from ..clients import SourceError
from ..model import CAUSE, LAYER_CEPH, LAYER_CEPH_OSD, Finding, Incident
from . import NeedsSource
HEALTH_QUERY = 'ceph_health_detail'
OSD_UP_QUERY = 'max by (ceph_daemon) (ceph_osd_up)'
OSD_HOST_QUERY = 'max by (ceph_daemon, hostname) (ceph_osd_metadata)'
FLAG_QUERY = 'max by (__name__) ({__name__=~"ceph_osd_flag_(noout|nobackfill|norecover|norebalance)"})'
QUORUM_QUERY = 'sum(max by (ceph_daemon) (ceph_mon_quorum_status))'
MONS_QUERY = 'count(max by (ceph_daemon) (ceph_mon_metadata))'
# The fullest OSD at each step (which one can change as data moves).
FILL_QUERY = ('topk(1, max by (ceph_daemon) (ceph_osd_stat_bytes_used) '
'/ max by (ceph_daemon) (ceph_osd_stat_bytes))')
STEP_S = 60
HEALTH_LOOKBACK_S = 3 * 3600 # longer than the longest hold below
FLAG_STEP_S = 300
FORECAST_STEP_S = 3600
FORECAST_HISTORY_S = 14 * 86400
FORECAST_EVERY_S = 3600
FORECAST_HORIZON_DAYS = 60
NEARFULL_RATIO = 0.85 # Ceph's default mon_osd_nearfull_ratio
CYCLE = None # "one held cycle": the engine's default hold
# -- timing by priority (operator, 2026-11-27) --------------------------------------------
# (ticket after this much continuous time, cleared after this much quiet). None = one held
# cycle / the engine's 15 minutes.
@dataclass(frozen=True)
class Timing:
hold_s: Optional[float]
clear_s: Optional[float]
TIMING = {
1: Timing(CYCLE, None),
2: Timing(CYCLE, None),
3: Timing(15 * 60, None),
4: Timing(2 * 3600, 6 * 3600),
}
FLAG_TIMING = Timing(24 * 3600, None) # a flag left set for a day; cleared 15 min after unset
@dataclass(frozen=True)
class Rule:
code: str # a Ceph health code, or a glob like MDS_SLOW_*
priority: int
why: str
checks: Tuple[str, ...] = ()
# Represented some other way (per-host OSD tickets, per-flag tickets): no incident of its own.
handled_by: str = ''
timing: Optional[Timing] = None
@property
def explains(self) -> bool:
# P1/P2 warnings can stall the cluster (and so explain timeouts after them); standing
# P3/P4 warnings never explain anything else.
return self.priority <= 2
def hold_clear(self) -> Timing:
return self.timing or TIMING[self.priority]
RULES: List[Rule] = [
Rule('PG_AVAILABILITY', 1, 'PGs inactive or down: some data cannot be read or written.',
('`ceph health detail` lists the PGs; `ceph pg <pgid> query` shows what each is waiting for.',
'Which OSDs they map to: `ceph pg ls inactive` / `ceph pg ls down`.')),
Rule('MON_QUORUM', 1, 'Fewer than half the monitors are in quorum: the cluster stops serving.',
('`ceph mon stat` from a node that answers; `systemctl status ceph-mon@<host>` on the others.',)),
Rule('OSD_FULL', 1, 'An OSD is full: writes to its PGs stop.',
('`ceph osd df tree` for the full OSD; free space or add capacity before anything else.',)),
Rule('POOL_FULL', 1, 'A pool is full: writes to it stop.', ('`ceph df detail`',)),
Rule('PG_DEGRADED', 2, 'Some objects have fewer copies than they should: redundancy is reduced.',
('`ceph -s` for recovery progress; `ceph health detail` for the PGs.',)),
Rule('SLOW_OPS', 2, 'Client requests are blocked: guests on Ceph storage stall.',
('`ceph health detail` names the daemons; check their host\'s load, memory and disks.',)),
Rule('FS_DEGRADED', 2, 'A CephFS file system is degraded.', ('`ceph fs status`',)),
Rule('MON_DOWN', 2, 'A monitor is down; quorum still holds.',
('`ceph mon stat`; `systemctl status ceph-mon@<host>` on the down monitor\'s host.',)),
Rule('OSD_BACKFILLFULL', 2, 'An OSD is too full to take backfill: recovery onto it stops.',
('`ceph osd df tree`',)),
Rule('RECENT_CRASH', 3, 'A Ceph daemon crashed recently and the crash is not archived.',
('`ceph crash ls-new`, then `ceph crash info <id>` for each.',
'Once a crash is understood: `ceph crash archive <id>` (this warning clears when all are archived).')),
Rule('DB_DEVICE_STALLED_READ_ALERT', 3, 'An OSD saw stalled reads on its DB device (BlueFS).',
('Which OSDs: Thor lists them from `ceph health detail`.',
'SMART and kernel log for the OSD\'s DB device on its host.')),
Rule('OSD_NEARFULL', 3, 'An OSD is past the nearfull ratio.', ('`ceph osd df tree`',)),
Rule('POOL_NEARFULL', 3, 'A pool is nearly full.', ('`ceph df detail`',)),
Rule('MON_CLOCK_SKEW', 3, 'Monitor clocks disagree.', ('`chronyc tracking` on each monitor host.',)),
Rule('MDS_SLOW_*', 3, 'CephFS metadata requests are slow.', ('`ceph fs status`, `ceph health detail`',)),
Rule('OSD_SLOW_PING_TIME_*', 3,
'OSD heartbeats are slow: usually the network. Gandalf\'s network incident will own it once '
'Gandalf reports one to Thor (gandalf#66).',
('`ceph health detail` lists the slow OSD pairs; check those hosts\' links in Gandalf.',)),
Rule('BLUESTORE_SLOW_OP_ALERT', 4, 'Standing: OSDs observed slow operations in BlueStore.',
('Which OSDs: Thor lists them; compare with their drives\' SMART and latency.',)),
Rule('PG_NOT_SCRUBBED', 4, 'Standing: PGs not scrubbed in time.', ('`ceph health detail`',)),
Rule('PG_NOT_DEEP_SCRUBBED', 4, 'Standing: PGs not deep-scrubbed in time.', ('`ceph health detail`',)),
Rule('AUTH_INSECURE_*', 4,
'Standing: a key-security setting (Ceph calls two of these HEALTH_ERR; no data is at risk).',
('`ceph health detail`; see the Ceph release notes for the auth_* settings it names.',)),
Rule('OSD_DOWN', 2, 'Down OSDs: one ticket per host that is up, listing them.',
handled_by='host:<host>:osd_down'),
Rule('OSD_HOST_DOWN', 2, 'A whole OSD host is down: the host-down or fencing incident owns it.',
handled_by='host:<host>:osd_down'),
Rule('OSDMAP_FLAGS', 4, 'Cluster flags: one ticket per flag left set for 24 h.',
handled_by='cluster:ceph_flag:<flag>'),
]
UNKNOWN_ERR = Rule('*', 2, 'A HEALTH_ERR code Thor has no rule for.')
UNKNOWN_WARN = Rule('*', 3, 'A HEALTH_WARN code Thor has no rule for.')
OSD_DOWN_RULE = Rule('host:<host>:osd_down', 2, 'OSDs down on a host that is up (a dead drive or crashed daemon).',
('`ceph osd tree down`; `systemctl status ceph-osd@<id>` and the drive\'s SMART on that host.',
'If the drive is dead: the drive-swap steps in Thor\'s Ceph view (thor#3).'))
FLAGS = ('noout', 'nobackfill', 'norecover', 'norebalance', 'pause')
FLAG_RULE = Rule('cluster:ceph_flag:<flag>', 4,
'A cluster flag left set for 24 h. Not counted while a known condition (e.g. noout for '
'compute-storage-02, 693930698) or a Gandalf maintenance covers it.',
('`ceph osd dump | grep flags`; unset with `ceph osd unset <flag>` once the work is done.',),
timing=FLAG_TIMING)
FORECAST_RULE = Rule('cluster:ceph:forecast_nearfull', 4,
f'At the 14-day trend, the fullest OSD reaches nearfull ({int(NEARFULL_RATIO * 100)}%) '
f'within {FORECAST_HORIZON_DAYS} days.',
('`ceph osd df tree` for the fullest OSDs; reweight, rebalance or add capacity.',))
# Detail-line patterns for summaries: "osd.0 observed slow ...", "osd.29 crashed on host ...".
OSD_ID_RE = re.compile(r'\bosd\.(\d+)\b')
def rule_for(code: str, severity: str = '') -> Rule:
for r in RULES:
if r.code == code or ('*' in r.code and fnmatch.fnmatchcase(code, r.code)):
return r
return UNKNOWN_ERR if severity == 'HEALTH_ERR' else UNKNOWN_WARN
def _merged(series: List[dict], key: str) -> Dict[str, Dict[float, float]]:
"""{label value: {time: max value}} across instances (the active mgr moves between hosts)."""
out: Dict[str, Dict[float, float]] = {}
for s in series:
name = s['metric'].get(key)
if not name:
continue
points = out.setdefault(name, {})
for t, v in s['values']:
t, v = float(t), float(v)
points[t] = max(points.get(t, v), v)
return out
def runs(points: Dict[float, float]) -> List[Tuple[float, float]]:
"""(start, end) of each stretch the value was >= 1.
Only an explicit 0 ends a stretch. Missing samples (the exporter moved to another mgr, or
Prometheus was blind) are unknown, not "off".
"""
out: List[List[float]] = []
on = False
for t in sorted(points):
if points[t] >= 1:
if not on:
out.append([t, t])
on = True
else:
out[-1][1] = t
else:
on = False
return [(a, b) for a, b in out]
def _window_run(points: Dict[float, float], start: float, end: float) -> Optional[Tuple[float, float, float]]:
"""(first start in the window, end, start of the latest stretch) if it was on in the window."""
hit = [(a, b) for a, b in runs(points) if b >= start and a <= end]
if not hit:
return None
return hit[0][0], hit[-1][1], hit[-1][0]
def _open_ended(points: Dict[float, float], run_start: float) -> bool:
"""The stretch was already on at the first sample fetched: it really began earlier."""
return bool(points) and run_start <= min(points)
@dataclass
class _Detail:
summary: str = ''
lines: List[str] = field(default_factory=list)
class CephCheck:
name = 'ceph'
def __init__(self, nearfull_ratio: float = NEARFULL_RATIO):
self.nearfull_ratio = nearfull_ratio
self._forecast_at = 0.0
self._forecast: Optional[dict] = None
# -- one cycle ------------------------------------------------------------
def run(self, ctx) -> List[Finding]:
if not ctx.up.get('prometheus'):
raise NeedsSource('prometheus')
prom = ctx.sources['prometheus']
start, end = ctx.window_start, ctx.window_end
try:
health = prom.query_range(HEALTH_QUERY, min(start, end - HEALTH_LOOKBACK_S) - STEP_S, end, STEP_S)
osd_up = prom.query_range(OSD_UP_QUERY, start - 2 * STEP_S, end, STEP_S)
osd_host = prom.query_range(OSD_HOST_QUERY, start - 3600, end, 600) # static: coarse is enough
flags = prom.query_range(FLAG_QUERY, min(start, end - FLAG_TIMING.hold_s) - FLAG_STEP_S, end, FLAG_STEP_S)
quorum = prom.query_range(QUORUM_QUERY, start - 2 * STEP_S, end, STEP_S)
mons = prom.query_range(MONS_QUERY, start - 2 * STEP_S, end, STEP_S)
except SourceError as e:
raise NeedsSource('prometheus', e.message) from e
details, pve_flags = self._proxmox(ctx)
findings = self._health_findings(health, details, start, end)
findings += self._osd_findings(ctx, osd_up, osd_host, start, end)
findings += self._flag_findings(flags, pve_flags, start, end)
findings += self._quorum_findings(quorum, mons, start, end)
findings += self._forecast_findings(prom, end)
return findings
@staticmethod
def _proxmox(ctx) -> Tuple[Dict[str, _Detail], Optional[Dict[str, bool]]]:
"""What Ceph says now, through the Proxmox API. Optional: tickets still open without it."""
if not ctx.up.get('proxmox'):
return {}, None
px = ctx.sources['proxmox']
try:
status = px.ceph_status() or {}
flags = px.ceph_flags()
except SourceError:
return {}, None
out = {}
for code, c in ((status.get('health') or {}).get('checks') or {}).items():
out[code] = _Detail(summary=((c.get('summary') or {}).get('message') or '').strip(),
lines=[(d.get('message') or '').strip() for d in (c.get('detail') or [])
if (d.get('message') or '').strip()])
return out, flags
def _finding(self, rule: Rule, key: str, kind: str, subject: str, start: float, end: float,
run_start: Optional[float], summary: str, layer: int = LAYER_CEPH,
events: Optional[List[dict]] = None, **facts) -> Finding:
t = rule.hold_clear()
facts.setdefault('checks', list(rule.checks))
if run_start is not None:
facts['run_start'] = run_start
facts['rule'] = rule.code
facts['why'] = rule.why
return Finding(kind=kind, subject=subject, role=CAUSE, layer=layer, check=self.name, start=start,
end=end, key=key, summary=summary, priority=rule.priority, cluster_effect=True,
hold_s=t.hold_s, clear_s=t.clear_s, explains=rule.explains,
extends=rule.priority <= 2, events=events or [], facts=facts)
def _health_findings(self, health, details, start, end) -> List[Finding]:
severity = {s['metric'].get('name'): s['metric'].get('severity', '') for s in health}
out = []
for code, points in _merged(health, 'name').items():
rule = rule_for(code, severity.get(code, ''))
if rule.handled_by:
continue
hit = _window_run(points, start, end)
if hit is None:
continue
first, last, run_start = hit
if _open_ended(points, run_start):
extra = {'run_start_open': True}
else:
extra = {}
d = details.get(code)
said = d.summary if d and d.summary else rule.why
out.append(self._finding(rule, f'cluster:ceph:{code}', 'ceph_health', 'cluster', first, last,
run_start, f'Ceph {code}: {said}', code=code,
severity=severity.get(code, ''),
detail_lines=(d.lines[:30] if d else []), **extra))
return out
def _osd_findings(self, ctx, osd_up, osd_host, start, end) -> List[Finding]:
hosts: Dict[str, str] = {}
for s in osd_host:
daemon, host = s['metric'].get('ceph_daemon'), s['metric'].get('hostname')
if daemon and host:
hosts[daemon] = ctx.hosts.canonical(host) or host
by_host: Dict[str, List[Tuple[str, float, float, float]]] = {}
for daemon, points in _merged(osd_up, 'ceph_daemon').items():
down = {t: (1.0 if v < 1 else 0.0) for t, v in points.items()}
hit = _window_run(down, start, end)
if hit is None:
continue
by_host.setdefault(hosts.get(daemon, 'unknown host'), []).append((daemon,) + hit)
out = []
for host, osds in sorted(by_host.items()):
osds.sort(key=lambda o: int(OSD_ID_RE.search(o[0]).group(1)) if OSD_ID_RE.search(o[0]) else 0)
names = [o[0] for o in osds]
events = [{'id': f'{d}:down:{int(a)}', 'at': a, 'text': f'{d} down'} for d, a, _b, _r in osds]
out.append(self._finding(
OSD_DOWN_RULE, f'host:{host}:osd_down', 'osd_down', host, min(o[1] for o in osds),
max(o[2] for o in osds), max(o[3] for o in osds),
f'{len(names)} Ceph OSD{"s" if len(names) != 1 else ""} down on {host}: {", ".join(names)}',
layer=LAYER_CEPH_OSD, events=events, osds=names))
return out
def _flag_findings(self, flags, pve_flags, start, end) -> List[Finding]:
history = {}
for s in flags:
name = (s['metric'].get('__name__') or '').replace('ceph_osd_flag_', '')
if name:
history[name] = {float(t): float(v) for t, v in s['values']}
out = []
for flag in FLAGS:
points = history.get(flag, {})
hit = _window_run(points, start, end) if points else None
set_now = pve_flags.get(flag) if pve_flags is not None else None
if hit is None and not set_now:
continue
if hit is None:
# Set (Proxmox says so) but no history, e.g. pause: the engine keeps the first sighting.
first = last = end
run_start = None
else:
first, last, run_start = hit
if set_now:
last = end
extra = {'run_start_open': True} if hit is not None and _open_ended(points, run_start) else {}
out.append(self._finding(FLAG_RULE, f'cluster:ceph_flag:{flag}', 'ceph_flag', 'cluster', first, last,
run_start, f'Ceph flag {flag} is set', flag=flag, known_as=flag, **extra))
return out
def _quorum_findings(self, quorum, mons, start, end) -> List[Finding]:
if not quorum or not mons:
return []
total = max((float(v) for s in mons for _t, v in s['values']), default=0)
if total <= 0:
return []
lost = {float(t): (1.0 if float(v) <= total / 2 else 0.0) for s in quorum for t, v in s['values']}
hit = _window_run(lost, start, end)
if hit is None:
return []
first, last, run_start = hit
rule = rule_for('MON_QUORUM')
return [self._finding(rule, 'cluster:ceph:MON_QUORUM', 'ceph_health', 'cluster', first, last, run_start,
f'Ceph monitors lost quorum ({int(total)} monitors)', code='MON_QUORUM')]
def _forecast_findings(self, prom, end) -> List[Finding]:
if end - self._forecast_at >= FORECAST_EVERY_S:
self._forecast_at = end
try:
series = prom.query_range(FILL_QUERY, end - FORECAST_HISTORY_S, end, FORECAST_STEP_S)
except SourceError:
series = None # keep the last answer; the forecast is not worth holding a window for
if series is not None:
self._forecast = forecast(series, end, self.nearfull_ratio)
f = self._forecast
# Already past nearfull: Ceph's own OSD_NEARFULL warning is the ticket then.
if not f or f['days'] is None or f['days'] <= 0 or f['days'] > FORECAST_HORIZON_DAYS:
return []
# Dated from the start of the trend it rests on: a standing condition, not news.
return [self._finding(FORECAST_RULE, FORECAST_RULE.code, 'ceph_forecast', 'cluster', f['since'], end,
f['since'], f'Ceph: {f["osd"] or "the fullest OSD"} reaches nearfull in about '
f'{f["days"]} days at the 14-day trend', forecast=f,
display={'Fullest OSD now': f'{f["osd"] or "?"} at {f["now"] * 100:.1f}%',
'Nearfull at': f'{int(f["ratio"] * 100)}%',
'Trend': f'{f["slope_per_day"] * 100:+.2f} points a day'})]
# -- what the engine asks -------------------------------------------------
def summarize(self, inc: Incident) -> str:
if inc.kind == 'ceph_flag':
# Stable text: a summary that changes every cycle would re-send the ticket every 30 min.
from ..ticket_text import utc
since = utc(inc.facts.get('run_start', inc.first_seen))[:16] + ' UTC'
return f'Ceph flag {inc.facts.get("flag")} set since {since}'
return inc.summary
@staticmethod
def describe() -> List[dict]:
"""Rows for the Rules page: every rule, with its timing as words."""
rows = []
for r in RULES + [UNKNOWN_ERR, UNKNOWN_WARN, OSD_DOWN_RULE, FLAG_RULE, FORECAST_RULE]:
t = r.hold_clear()
rows.append({'code': ('any other HEALTH_ERR' if r is UNKNOWN_ERR else
'any other HEALTH_WARN' if r is UNKNOWN_WARN else r.code),
'priority': r.priority, 'why': r.why, 'handled_by': r.handled_by,
'ticket_after': timing_words(t.hold_s, hold=True),
'cleared_after': timing_words(t.clear_s, hold=False),
'explains': r.explains})
return rows
def timing_words(seconds: Optional[float], hold: bool) -> str:
from ..ticket_text import duration
if seconds is None:
return 'one held cycle (about 4 min)' if hold else '15 min quiet'
return f'{duration(seconds)}{"" if hold else " quiet"}'
def forecast(series: List[dict], now: float, ratio: float) -> Optional[dict]:
"""Least-squares trend of the fullest OSD's fill; days until it reaches ``ratio``."""
by_time: Dict[float, Tuple[float, str]] = {}
for s in series:
name = s['metric'].get('ceph_daemon', '')
for t, v in s['values']:
t, v = float(t), float(v)
if t not in by_time or v > by_time[t][0]:
by_time[t] = (v, name)
points = [(t, by_time[t][0]) for t in sorted(by_time)]
if len(points) < 24:
return None
n = len(points)
mx = sum(t for t, _ in points) / n
my = sum(v for _, v in points) / n
var = sum((t - mx) ** 2 for t, _ in points)
if var == 0:
return None
slope = sum((t - mx) * (v - my) for t, v in points) / var # fill per second
current = points[-1][1]
days = None
if current >= ratio:
days = 0
elif slope > 0:
days = int((ratio - current) / slope / 86400)
return {'now': current, 'ratio': ratio, 'slope_per_day': slope * 86400, 'days': days,
'since': points[0][0], 'osd': by_time[points[-1][0]][1]}
+12
View File
@@ -35,6 +35,18 @@ CHECKS = [
class ClusterCheck: class ClusterCheck:
name = 'cluster' name = 'cluster'
@staticmethod
def describe() -> List[Dict]:
"""For the Rules page."""
held, quiet = 'one held cycle (about 4 min)', '15 min quiet'
return [
dict(code='host:<host>:fenced', priority=2, why='A host lost its cluster link and was fenced.',
ticket_after=held, cleared_after=quiet, handled_by='', explains=True),
dict(code='cluster:corosync:partition', priority=1,
why='Two or more nodes fenced or out of quorum: a cluster partition.',
ticket_after=held, cleared_after=quiet, handled_by='', explains=True),
]
def run(self, ctx) -> List[Finding]: def run(self, ctx) -> List[Finding]:
if not ctx.up.get('loki'): if not ctx.up.get('loki'):
raise NeedsSource('loki') raise NeedsSource('loki')
+8
View File
@@ -28,6 +28,14 @@ def parse_time(value: Optional[str]) -> Optional[float]:
class MaintenanceCheck: class MaintenanceCheck:
name = 'maintenance' name = 'maintenance'
@staticmethod
def describe() -> List[dict]:
"""For the Rules page."""
return [dict(code='maintenance:gandalf:<id>', priority=5,
why='A Gandalf maintenance. Never a ticket: everything that happens inside it goes on '
'its timeline. If Gandalf cannot answer, Thor fails open.',
ticket_after='never', cleared_after='15 min quiet', handled_by='', explains=True)]
def run(self, ctx) -> List[Finding]: def run(self, ctx) -> List[Finding]:
gandalf = ctx.sources.get('gandalf') gandalf = ctx.sources.get('gandalf')
if gandalf is None or not ctx.up.get('gandalf'): if gandalf is None or not ctx.up.get('gandalf'):
+18
View File
@@ -104,6 +104,24 @@ def _hits_ceph(kill: Dict) -> bool:
class MemoryCheck: class MemoryCheck:
name = 'memory' name = 'memory'
@staticmethod
def describe() -> List[Dict]:
"""For the Rules page."""
held, quiet = 'one held cycle (about 4 min)', '15 min quiet'
return [
dict(code='host:<host>:oom', priority=3, why='The whole host ran out of memory (a global OOM kill).',
ticket_after=held, cleared_after=quiet, handled_by='', explains=True),
dict(code='host:<host>:oom', priority=2,
why=f'{LOOP_KILLS} or more kills within {LOOP_WINDOW_S // 60} minutes: an OOM loop.',
ticket_after='raised as it happens', cleared_after=quiet, handled_by='', explains=True),
dict(code='host:<host>:oom', priority=1,
why='A kill came from a Ceph OSD, or other hosts or Ceph stall while it happens.',
ticket_after='raised as it happens', cleared_after=quiet, handled_by='', explains=True),
dict(code='host:<host>:oom_cgroup', priority=5,
why="A container hit its own memory limit: the guest's problem. Shown in Thor, never ticketed.",
ticket_after='never', cleared_after='', handled_by='', explains=False),
]
def run(self, ctx) -> List[Finding]: def run(self, ctx) -> List[Finding]:
if not ctx.up.get('prometheus'): if not ctx.up.get('prometheus'):
raise NeedsSource('prometheus') raise NeedsSource('prometheus')
+18
View File
@@ -57,6 +57,24 @@ def find_reboots(values, after: float) -> List[Dict]:
class RebootCheck: class RebootCheck:
name = 'reboots' name = 'reboots'
@staticmethod
def describe() -> List[Dict]:
"""For the Rules page."""
held, quiet = 'one held cycle (about 4 min)', '15 min quiet'
return [
dict(code='host:<host>:reboot', priority=3, why='A host rebooted with no shutdown request.',
ticket_after=held, cleared_after=quiet, handled_by='', explains=True),
dict(code='host:<host>:reboot', priority=4,
why="A host rebooted but its journal went quiet first, so Thor can't tell why.",
ticket_after=held, cleared_after=quiet, handled_by='', explains=True),
dict(code='cluster:reboots:<n>', priority=2,
why=f'Two or more hosts rebooted within {GROUP_S // 60} minutes with nothing else explaining it.',
ticket_after=held, cleared_after=quiet, handled_by='', explains=True),
dict(code='host:<host>:reboot_planned', priority=5,
why='A reboot someone asked for (a logind shutdown line). Timeline only.',
ticket_after='never', cleared_after='', handled_by='', explains=False),
]
def run(self, ctx) -> List[Finding]: def run(self, ctx) -> List[Finding]:
if not ctx.up.get('prometheus'): if not ctx.up.get('prometheus'):
raise NeedsSource('prometheus') raise NeedsSource('prometheus')
+5 -33
View File
@@ -5,20 +5,20 @@ the cause that explains them (thor#1, Area 4). From 2026-11-23:
* node_exporter scrapes that are slow or fail on several hosts at once (Gandalf misread these * node_exporter scrapes that are slow or fail on several hosts at once (Gandalf misread these
as a network failure, gandalf#57); as a network failure, gandalf#57);
* ``pvestatd: got timeout`` on every node; * ``pvestatd: got timeout`` on every node.
* Ceph health alerts that switch on while it happens (OSD slow ping, stalled DB reads).
Alerts already on at the start of the window are standing conditions, not symptoms. Ceph warnings that switch on while a cause is active used to be symptoms here too; since
phase 2 they are causes in ``ceph.py`` that the engine files under a higher cause.
""" """
from typing import Dict, List from typing import Dict, List
from ..clients import SourceError from ..clients import SourceError
from ..model import LAYER_CEPH, LAYER_SCRAPE, SYMPTOM, Finding from ..model import LAYER_SCRAPE, SYMPTOM, Finding
from . import NeedsSource, query_regex from . import NeedsSource, query_regex
STEP_S = 30 STEP_S = 30
SLOW_SCRAPE_S = 5.0 SLOW_SCRAPE_S = 5.0
PVESTATD_QUERY = '{job="journal", unit="pvestatd.service"} |= "got timeout"' PVESTATD_QUERY = '{job="journal", unit="pvestatd.service"} |= "got timeout"'
CEPH_QUERY = 'ceph_health_detail'
def node_instances_regex(hosts) -> str: def node_instances_regex(hosts) -> str:
@@ -88,31 +88,3 @@ class PvestatdCheck:
start=min(t), end=max(t), key=f'host:{h}:pvestatd', cluster_effect=True, start=min(t), end=max(t), key=f'host:{h}:pvestatd', cluster_effect=True,
summary=f'{h}: pvestatd timed out talking to the cluster ({len(t)}x)') summary=f'{h}: pvestatd timed out talking to the cluster ({len(t)}x)')
for h, t in sorted(by_host.items())] for h, t in sorted(by_host.items())]
class CephAlertCheck:
name = 'ceph_alerts'
def run(self, ctx) -> List[Finding]:
if not ctx.up.get('prometheus'):
raise NeedsSource('prometheus')
try:
series = ctx.sources['prometheus'].query_range(CEPH_QUERY, ctx.window_start - STEP_S,
ctx.window_end, STEP_S)
except SourceError as e:
raise NeedsSource('prometheus', e.message) from e
out = []
for s in series:
name = s['metric'].get('name')
values = s['values']
if not name or not values:
continue
rises = [ts for (pt, pv), (ts, v) in zip(values, values[1:]) if pv == 0 and v >= 1]
if not rises:
continue
on = [ts for ts, v in values if v >= 1]
out.append(Finding(kind='ceph_alert', subject='cluster', role=SYMPTOM, layer=LAYER_CEPH,
check=self.name, start=min(rises), end=max(on), key=f'cluster:ceph_alert:{name}',
cluster_effect=True, summary=f'Ceph raised {name}',
facts={'severity': s['metric'].get('severity', '')}))
return out
+4
View File
@@ -64,6 +64,10 @@ class ProxmoxClient:
"""{flag: set?} including pause, which the Prometheus exporter doesn't export.""" """{flag: set?} including pause, which the Prometheus exporter doesn't export."""
return {f['name']: bool(f.get('value')) for f in (self.get('/cluster/ceph/flags') or [])} return {f['name']: bool(f.get('value')) for f in (self.get('/cluster/ceph/flags') or [])}
def ceph_status(self) -> Dict:
"""``ceph status`` as JSON, health checks with their summary and detail lines included."""
return self.get('/cluster/ceph/status') or {}
def ha_status(self) -> List[Dict]: def ha_status(self) -> List[Dict]:
return self.get('/cluster/ha/status/current') or [] return self.get('/cluster/ha/status/current') or []
+51 -9
View File
@@ -8,6 +8,11 @@
nothing explains stay in Thor only; they never open tickets in phase 1. nothing explains stay in Thor only; they never open tickets in phase 1.
* An incident clears after ``CLEAR_AFTER_S`` without new evidence: a "Cleared" note, never a * An incident clears after ``CLEAR_AFTER_S`` without new evidence: a "Cleared" note, never a
status change. Priority only ever goes up while an incident is active. status change. Priority only ever goes up while an incident is active.
* A cause may set its own timing (``hold_s``: how long it must last before its ticket opens;
``clear_s``: how long quiet before it clears). Ceph does, by priority (thor#3). One that goes
quiet before it has lasted long enough is dropped without a ticket.
* A lower cause attached to a higher one stays "Also seen" there. If it outlasts that cause,
it becomes its own incident, timed from when the cause cleared.
* Every Tinker-facing step is an :class:`Action`. In shadow mode it is recorded, never sent. * Every Tinker-facing step is an :class:`Action`. In shadow mode it is recorded, never sent.
Checks own the meaning of their incidents: ``summarize(inc)`` and ``priority(inc)`` are Checks own the meaning of their incidents: ``summarize(inc)`` and ``priority(inc)`` are
@@ -61,11 +66,14 @@ class Engine:
A host-scoped incident explains other hosts' symptoms (scrapes, pvestatd, Ceph alerts) A host-scoped incident explains other hosts' symptoms (scrapes, pvestatd, Ceph alerts)
when it can stall the cluster, but never another host's own cause (its reboot). when it can stall the cluster, but never another host's own cause (its reboot).
""" """
if not inc.active or inc.layer <= f.layer: if not inc.active or inc.layer <= f.layer or not inc.explains:
return False return False
if as_cause and f.subject != inc.subject and inc.subject != 'cluster': if as_cause and f.subject != inc.subject and inc.subject != 'cluster':
# A host cause explains another host's cause only if that one is cluster-wide
# fallout (Ceph warnings) and this host can stall the cluster (it runs OSDs).
if not (f.subject == 'cluster' and f.cluster_effect and self._can_stall_cluster(inc)):
return False return False
if f.start < inc.first_seen - ATTACH_BEFORE_S or f.start > self._last_activity(inc) + CLEAR_AFTER_S: if f.start < inc.first_seen - ATTACH_BEFORE_S or f.start > self._last_activity(inc) + self._clear_s(inc):
return False return False
if f.subject == inc.subject: if f.subject == inc.subject:
return True return True
@@ -73,12 +81,25 @@ class Engine:
@staticmethod @staticmethod
def _last_activity(inc: Incident) -> float: def _last_activity(inc: Incident) -> float:
"""Latest evidence for the cause or anything attached to it (a host still down keeps it going).""" """Latest evidence for the cause or anything attached to it (a host still down keeps it going).
return max([inc.last_seen] + [s.get('last', 0) for s in inc.symptoms.values()])
Standing warnings attached as "Also seen" (``extends`` False) don't keep it going.
"""
return max([inc.last_seen] + [s.get('last', 0) for s in inc.symptoms.values() if s.get('extends', True)])
@staticmethod
def _clear_s(inc: Incident) -> float:
return inc.clear_s or CLEAR_AFTER_S
def _released_at(self, f: Finding) -> Optional[float]:
"""When the cause that had ``f`` filed under it cleared, if ``f`` outlasted it."""
times = [i.cleared_at for i in self.incidents.values()
if i.state == CLEARED and i.cleared_at and f.key in i.symptoms and i.cleared_at >= f.start]
return max(times) if times else None
def _known_for(self, f: Finding) -> Optional[dict]: def _known_for(self, f: Finding) -> Optional[dict]:
for k in self.known: for k in self.known:
if k.get('kind') in (f.kind, '*') and k.get('subject') in (f.subject, '*'): if k.get('kind') in (f.kind, '*') and k.get('subject') in (f.subject, f.facts.get('known_as'), '*'):
return k return k
return None return None
@@ -86,7 +107,7 @@ class Engine:
rec = inc.symptoms.get(f.key) rec = inc.symptoms.get(f.key)
if rec is None: if rec is None:
rec = {'kind': f.kind, 'subject': f.subject, 'summary': f.summary, 'first': f.start, rec = {'kind': f.kind, 'subject': f.subject, 'summary': f.summary, 'first': f.start,
'last': f.end, 'cluster_effect': f.cluster_effect} 'last': f.end, 'cluster_effect': f.cluster_effect, 'extends': f.extends}
inc.symptoms[f.key] = rec inc.symptoms[f.key] = rec
if inc.state == OPEN: if inc.state == OPEN:
new_symptoms.setdefault(inc.key, []).append(rec) new_symptoms.setdefault(inc.key, []).append(rec)
@@ -218,7 +239,12 @@ class Engine:
inc.mode = mode inc.mode = mode
inc.first_seen = min(inc.first_seen, f.start) inc.first_seen = min(inc.first_seen, f.start)
inc.last_seen = max(inc.last_seen, f.end) inc.last_seen = max(inc.last_seen, f.end)
earlier = inc.facts.get('run_start')
inc.facts.update(f.facts) inc.facts.update(f.facts)
if f.facts.get('run_start_open') and earlier is not None and earlier < inc.facts['run_start']:
# The check's lookback only reaches so far: a stretch on since before it keeps the
# earliest start already known, instead of sliding forward every cycle.
inc.facts['run_start'] = earlier
known = {e.get('id') for e in inc.events} known = {e.get('id') for e in inc.events}
for e in f.events: for e in f.events:
if e.get('id') not in known: if e.get('id') not in known:
@@ -227,6 +253,13 @@ class Engine:
inc.events.sort(key=lambda e: e.get('at', 0)) inc.events.sort(key=lambda e: e.get('at', 0))
del inc.events[:-MAX_EVENTS] del inc.events[:-MAX_EVENTS]
inc.priority = min(inc.priority, f.priority) inc.priority = min(inc.priority, f.priority)
inc.hold_s, inc.clear_s, inc.explains, inc.extends = f.hold_s, f.clear_s, f.explains, f.extends
released = self._released_at(f) if inc.state == PENDING else None
if released is not None:
# It was "Also seen" on a cause that has cleared while it carried on: from now on it
# is its own problem, timed from that moment.
inc.facts['run_start'] = max(inc.facts.get('run_start', f.start), released)
inc.facts['outlasted'] = released
if catching_up and inc.state == PENDING and f.end < now - 2 * self.settings.cycle_seconds: if catching_up and inc.state == PENDING and f.end < now - 2 * self.settings.cycle_seconds:
inc.seen_after_the_fact = True inc.seen_after_the_fact = True
return inc return inc
@@ -234,7 +267,14 @@ class Engine:
def _lifecycle(self, inc: Incident, now: float, catching_up: bool, before: int, def _lifecycle(self, inc: Incident, now: float, catching_up: bool, before: int,
new_symptoms: List[dict], actions: List[Action]) -> None: new_symptoms: List[dict], actions: List[Action]) -> None:
if inc.state == PENDING: if inc.state == PENDING:
if now - inc.pending_since >= self.settings.cycle_seconds or catching_up: held = now - inc.pending_since >= self.settings.cycle_seconds or catching_up
lasted = not inc.hold_s or inc.last_seen - inc.facts.get('run_start', inc.first_seen) >= inc.hold_s
if not lasted and now - inc.last_seen >= self._clear_s(inc):
# Went quiet before it had lasted long enough to ticket: dropped, nothing sent.
inc.state, inc.cleared_at = CLEARED, now
inc.facts['never_opened'] = True
return
if held and lasted:
inc.state, inc.opened_at = OPEN, now inc.state, inc.opened_at = OPEN, now
inc.facts['sent_priority'] = inc.priority inc.facts['sent_priority'] = inc.priority
if inc.known_ticket: if inc.known_ticket:
@@ -248,7 +288,7 @@ class Engine:
return return
if not inc.ticket or inc.known_ticket: if not inc.ticket or inc.known_ticket:
# Timeline only (maintenance) or a known condition: no further ticket traffic. # Timeline only (maintenance) or a known condition: no further ticket traffic.
if now - self._last_activity(inc) >= CLEAR_AFTER_S: if now - self._last_activity(inc) >= self._clear_s(inc):
inc.state, inc.cleared_at = CLEARED, now inc.state, inc.cleared_at = CLEARED, now
return return
if inc.facts.pop('adopt', False): if inc.facts.pop('adopt', False):
@@ -268,7 +308,7 @@ class Engine:
for s in sorted(new_symptoms, key=lambda s: s['first'])) for s in sorted(new_symptoms, key=lambda s: s['first']))
self._action(actions, inc, 'also_seen', now, comment=text, self._action(actions, inc, 'also_seen', now, comment=text,
symptoms=[s['summary'] for s in new_symptoms]) symptoms=[s['summary'] for s in new_symptoms])
clearing = now - self._last_activity(inc) >= CLEAR_AFTER_S clearing = now - self._last_activity(inc) >= self._clear_s(inc)
changed = inc.summary != inc.facts.get('sent_summary') or len(inc.symptoms) != inc.facts.get('sent_symptoms') changed = inc.summary != inc.facts.get('sent_summary') or len(inc.symptoms) != inc.facts.get('sent_symptoms')
if changed and (clearing or now - inc.facts.get('sent_at', 0) >= REFRESH_EVERY_S): if changed and (clearing or now - inc.facts.get('sent_at', 0) >= REFRESH_EVERY_S):
# Same dedup_key: Tinker updates the open ticket's title and description in place. # Same dedup_key: Tinker updates the open ticket's title and description in place.
@@ -285,6 +325,8 @@ class Engine:
def covering(self, host: Optional[str] = None, scope: Optional[str] = None) -> List[Incident]: def covering(self, host: Optional[str] = None, scope: Optional[str] = None) -> List[Incident]:
out = [] out = []
for inc in self.active(): for inc in self.active():
if not inc.explains:
continue # standing warnings explain, and so cover, nothing
if host and (inc.subject == host or (inc.subject == 'cluster')): if host and (inc.subject == host or (inc.subject == 'cluster')):
out.append(inc) out.append(inc)
elif scope == 'cluster' and self._can_stall_cluster(inc): elif scope == 'cluster' and self._can_stall_cluster(inc):
+14
View File
@@ -17,6 +17,7 @@ LAYER_NETWORK = 70
LAYER_PARTITION = 60 LAYER_PARTITION = 60
LAYER_HOST_DOWN = 50 LAYER_HOST_DOWN = 50
LAYER_RESOURCE = 40 LAYER_RESOURCE = 40
LAYER_CEPH_OSD = 35 # OSDs down on a host that is up: explains the PG fallout after it
LAYER_CEPH = 30 LAYER_CEPH = 30
LAYER_SCRAPE = 20 LAYER_SCRAPE = 20
@@ -47,6 +48,15 @@ class Finding:
cluster_effect: bool = False # can be the result of trouble on another host cluster_effect: bool = False # can be the result of trouble on another host
# False for causes that explain things but never become tickets (planned maintenance). # False for causes that explain things but never become tickets (planned maintenance).
ticket: bool = True ticket: bool = True
# How long the condition must last before its ticket opens, and how long quiet before it
# clears. None: one held cycle, and the engine's 15 minutes (thor#1). Ceph sets these by
# priority (thor#3); the Rules page shows them.
hold_s: Optional[float] = None
clear_s: Optional[float] = None
# False for standing warnings: they never explain anything else.
explains: bool = True
# False: when attached to a cause as "Also seen", this doesn't keep the cause going.
extends: bool = True
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
return dict(self.__dict__) return dict(self.__dict__)
@@ -77,6 +87,10 @@ class Incident:
# A known condition covers this incident: notes go to that ticket instead of a new one. # A known condition covers this incident: notes go to that ticket instead of a new one.
known_ticket: Optional[str] = None known_ticket: Optional[str] = None
known_reason: str = '' known_reason: str = ''
hold_s: Optional[float] = None
clear_s: Optional[float] = None
explains: bool = True
extends: bool = True
@property @property
def active(self) -> bool: def active(self) -> bool:
+3 -2
View File
@@ -281,13 +281,14 @@ def build_sources(s: config_mod.Settings) -> Dict[str, Source]:
def build_checks() -> List[Check]: def build_checks() -> List[Check]:
from .checks.ceph import CephCheck
from .checks.cluster import ClusterCheck from .checks.cluster import ClusterCheck
from .checks.maintenance import MaintenanceCheck from .checks.maintenance import MaintenanceCheck
from .checks.memory import MemoryCheck from .checks.memory import MemoryCheck
from .checks.reboots import RebootCheck from .checks.reboots import RebootCheck
from .checks.symptoms import CephAlertCheck, PvestatdCheck, ScrapeCheck from .checks.symptoms import PvestatdCheck, ScrapeCheck
return [MaintenanceCheck(), ClusterCheck(), RebootCheck(), MemoryCheck(), ScrapeCheck(), PvestatdCheck(), return [MaintenanceCheck(), ClusterCheck(), RebootCheck(), MemoryCheck(), ScrapeCheck(), PvestatdCheck(),
CephAlertCheck()] CephCheck()]
def main() -> None: # pragma: no cover - process entry point def main() -> None: # pragma: no cover - process entry point
+14 -2
View File
@@ -9,7 +9,8 @@ from typing import Dict, Iterable, List, Optional
from .model import Incident from .model import Incident
AREA_BY_KIND = {'oom': 'software', 'oom_cgroup': 'software'} AREA_BY_KIND = {'oom': 'software', 'oom_cgroup': 'software', 'ceph_health': 'ceph', 'osd_down': 'ceph',
'ceph_flag': 'ceph', 'ceph_forecast': 'ceph'}
CATEGORY_BY_AREA = {'software': 'Software', 'hardware': 'Hardware', 'network': 'Network', 'ceph': 'Software'} CATEGORY_BY_AREA = {'software': 'Software', 'hardware': 'Hardware', 'network': 'Network', 'ceph': 'Software'}
PRIORITY_LABEL = {1: 'P1 Critical', 2: 'P2 High', 3: 'P3 Medium', 4: 'P4 Low', 5: 'P5 Minimal'} PRIORITY_LABEL = {1: 'P1 Critical', 2: 'P2 High', 3: 'P3 Medium', 4: 'P4 Low', 5: 'P5 Minimal'}
@@ -69,7 +70,10 @@ def symptom_lines(symptoms: Dict[str, Dict]) -> List[str]:
def description(inc: Incident, public_url: str = '', related: Iterable[str] = ()) -> str: def description(inc: Incident, public_url: str = '', related: Iterable[str] = ()) -> str:
lines = [f'## {inc.summary}', ''] lines = [f'## {inc.summary}', '']
lines.append(f'- **First seen:** {utc(inc.first_seen)}') first = utc(inc.first_seen)
if inc.facts.get('run_start_open'):
first += ' or earlier (already on when Thor first looked)'
lines.append(f'- **First seen:** {first}')
lines.append(f'- **Last seen:** {utc(inc.last_seen)}') lines.append(f'- **Last seen:** {utc(inc.last_seen)}')
lines.append(f'- **Priority:** {PRIORITY_LABEL.get(inc.priority, inc.priority)}') lines.append(f'- **Priority:** {PRIORITY_LABEL.get(inc.priority, inc.priority)}')
if inc.facts.get('escalation_reason') and inc.priority < 3: if inc.facts.get('escalation_reason') and inc.priority < 3:
@@ -79,6 +83,14 @@ def description(inc: Incident, public_url: str = '', related: Iterable[str] = ()
if inc.seen_after_the_fact: if inc.seen_after_the_fact:
lines += ['', '_Seen after the fact: Thor was away or blind while this happened and found it ' lines += ['', '_Seen after the fact: Thor was away or blind while this happened and found it '
'when it caught up._'] 'when it caught up._']
detail = inc.facts.get('detail_lines') or []
if detail:
lines += ['', '### What Ceph reports'] + [f'- {d}' for d in detail]
if inc.facts.get('why'):
lines += ['', f'_Thor rule `{inc.facts.get("rule", "")}`: {inc.facts["why"]}_']
if inc.facts.get('outlasted'):
lines += ['', f'_First seen as part of another incident; it carried on after that one cleared '
f'at {utc(inc.facts["outlasted"])}._']
if inc.events: if inc.events:
lines += ['', '### What happened'] + _events_lines(inc) lines += ['', '### What happened'] + _events_lines(inc)
if inc.symptoms: if inc.symptoms:
+27
View File
@@ -54,6 +54,21 @@
.t-preview { white-space: pre-wrap; font-size: .82em; background: var(--bg-terminal); border: 1px solid var(--border-dim); .t-preview { white-space: pre-wrap; font-size: .82em; background: var(--bg-terminal); border: 1px solid var(--border-dim);
padding: 12px; max-height: 520px; overflow: auto; color: var(--text-secondary); } padding: 12px; max-height: 520px; overflow: auto; color: var(--text-secondary); }
/* Rules page */
.t-rules-basics { margin: var(--space-md) 0 0; padding-left: 1.2em; font-size: .88em; color: var(--text-secondary);
max-width: 90ch; }
.t-rules-basics li { margin: 4px 0; }
.t-rules-basics b { color: var(--text-primary); font-weight: 600; }
.t-rules-table td { vertical-align: top; }
.t-rules-table td:last-child { color: var(--text-secondary); min-width: 28ch; }
.t-rules-table code { white-space: nowrap; }
.t-rule-handled td { color: var(--text-muted); }
.t-mode { font-size: .72em; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 1px 7px;
border: 1px solid currentColor; }
.t-mode-live { color: var(--accent-green); }
.t-mode-shadow { color: var(--accent-amber); }
.t-mode-off { color: var(--text-muted); }
.t-footer { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 14px var(--space-lg); color: var(--text-muted); .t-footer { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 14px var(--space-lg); color: var(--text-muted);
font-size: .78em; border-top: 1px solid var(--border-dim); } font-size: .78em; border-top: 1px solid var(--border-dim); }
.t-footer a { color: var(--text-muted); } .t-footer a { color: var(--text-muted); }
@@ -61,3 +76,15 @@
@media (max-width: 900px) { @media (max-width: 900px) {
.attention-groups, .t-columns { grid-template-columns: 1fr; } .attention-groups, .t-columns { grid-template-columns: 1fr; }
} }
/* Rules on a phone: each rule is a small card with labelled lines instead of a wide row. */
@media (max-width: 700px) {
.t-rules-stack thead { display: none; }
.t-rules-stack, .t-rules-stack tbody, .t-rules-stack tr, .t-rules-stack td { display: block; width: 100%; }
.t-rules-stack tr { padding: 8px 0; border-top: 1px solid var(--border-dim); }
.t-rules-stack td { padding: 2px 0; border: 0; min-width: 0; }
.t-rules-stack td:empty { display: none; }
.t-rules-stack td[data-label]:not([data-label="What"])::before { content: attr(data-label) ": ";
color: var(--text-muted); }
.t-rules-stack code { white-space: normal; word-break: break-all; }
}
+3
View File
@@ -26,6 +26,7 @@
<nav class="lt-nav-drawer-links" aria-label="Mobile navigation"> <nav class="lt-nav-drawer-links" aria-label="Mobile navigation">
<a href="{{ url_for('ui.index') }}" class="lt-nav-drawer-link{% if active_nav == 'index' %} active{% endif %}">Needs attention</a> <a href="{{ url_for('ui.index') }}" class="lt-nav-drawer-link{% if active_nav == 'index' %} active{% endif %}">Needs attention</a>
<a href="{{ url_for('ui.known') }}" class="lt-nav-drawer-link{% if active_nav == 'known' %} active{% endif %}">Known conditions</a> <a href="{{ url_for('ui.known') }}" class="lt-nav-drawer-link{% if active_nav == 'known' %} active{% endif %}">Known conditions</a>
<a href="{{ url_for('ui.rules') }}" class="lt-nav-drawer-link{% if active_nav == 'rules' %} active{% endif %}">Rules</a>
</nav> </nav>
</div> </div>
<div id="lt-nav-overlay" class="lt-nav-drawer-overlay"></div> <div id="lt-nav-overlay" class="lt-nav-drawer-overlay"></div>
@@ -46,6 +47,8 @@
{% if active_nav == 'index' %}aria-current="page"{% endif %}>Needs attention</a> {% if active_nav == 'index' %}aria-current="page"{% endif %}>Needs attention</a>
<a href="{{ url_for('ui.known') }}" class="lt-nav-link{% if active_nav == 'known' %} active{% endif %}" <a href="{{ url_for('ui.known') }}" class="lt-nav-link{% if active_nav == 'known' %} active{% endif %}"
{% if active_nav == 'known' %}aria-current="page"{% endif %}>Known conditions</a> {% if active_nav == 'known' %}aria-current="page"{% endif %}>Known conditions</a>
<a href="{{ url_for('ui.rules') }}" class="lt-nav-link{% if active_nav == 'rules' %} active{% endif %}"
{% if active_nav == 'rules' %}aria-current="page"{% endif %}>Rules</a>
</nav> </nav>
</div> </div>
<div class="lt-header-right"> <div class="lt-header-right">
+11 -1
View File
@@ -16,7 +16,10 @@
{% elif i.ticket_id %}<a href="https://t.lotusguild.org/ticket/{{ i.ticket_id }}">#{{ i.ticket_id }}</a> {% elif i.ticket_id %}<a href="https://t.lotusguild.org/ticket/{{ i.ticket_id }}">#{{ i.ticket_id }}</a>
{% elif i.mode != 'live' %}shadow: recorded below, not sent{% else %}not sent yet{% endif %}</dd> {% elif i.mode != 'live' %}shadow: recorded below, not sent{% else %}not sent yet{% endif %}</dd>
<dt>Key</dt><dd><code>{{ i.key }}</code></dd> <dt>Key</dt><dd><code>{{ i.key }}</code></dd>
<dt>First seen</dt><dd>{{ i.first_seen | utc }}</dd> <dt>Timing</dt><dd>{{ timing }} (<a href="{{ url_for('ui.rules') }}">rules</a>)</dd>
{% if d.facts.why %}<dt>Rule</dt><dd>{{ d.facts.why }}</dd>{% endif %}
{% if d.facts.outlasted %}<dt>Outlasted</dt><dd>first seen as part of another incident; carried on after it cleared at {{ d.facts.outlasted | utc }}</dd>{% endif %}
<dt>First seen</dt><dd>{{ i.first_seen | utc }}{% if d.facts.run_start_open %} or earlier (already on when Thor first looked){% endif %}</dd>
<dt>Last seen</dt><dd>{{ i.last_seen | utc }}</dd> <dt>Last seen</dt><dd>{{ i.last_seen | utc }}</dd>
{% if i.cleared_at %}<dt>Cleared</dt><dd>{{ i.cleared_at | utc }}</dd>{% endif %} {% if i.cleared_at %}<dt>Cleared</dt><dd>{{ i.cleared_at | utc }}</dd>{% endif %}
{% for k, v in (d.facts.display or {}).items() %}<dt>{{ k }}</dt><dd>{{ v }}</dd>{% endfor %} {% for k, v in (d.facts.display or {}).items() %}<dt>{{ k }}</dt><dd>{{ v }}</dd>{% endfor %}
@@ -26,6 +29,13 @@
{% if d.seen_after_the_fact %}<p class="t-note">Seen after the fact: Thor was away or blind while this happened and found it when it caught up.</p>{% endif %} {% if d.seen_after_the_fact %}<p class="t-note">Seen after the fact: Thor was away or blind while this happened and found it when it caught up.</p>{% endif %}
</section> </section>
{% if d.facts.detail_lines %}
<section class="t-section" aria-labelledby="ceph-title">
<div class="t-section-header"><h2 class="t-section-title" id="ceph-title">What Ceph reports <span class="attention-count">{{ d.facts.detail_lines | length }}</span></h2></div>
<ul class="t-timeline">{% for line in d.facts.detail_lines %}<li>{{ line }}</li>{% endfor %}</ul>
</section>
{% endif %}
<div class="t-columns"> <div class="t-columns">
<section class="t-section" aria-labelledby="ev-title"> <section class="t-section" aria-labelledby="ev-title">
<div class="t-section-header"><h2 class="t-section-title" id="ev-title">What happened</h2></div> <div class="t-section-header"><h2 class="t-section-title" id="ev-title">What happened</h2></div>
+64
View File
@@ -0,0 +1,64 @@
{% extends "base.html" %}
{% block title %}Rules{% endblock %}
{% block content %}
<section class="t-section" aria-labelledby="rules-title">
<div class="t-section-header">
<h1 class="t-section-title" id="rules-title">Rules</h1>
</div>
<p class="t-note">What Thor tickets, at what priority, and when. This page is built from the same tables the
checks use, so it is always what Thor actually does. Decisions: thor#1 (phase 1) and thor#3 (Ceph).</p>
<ul class="t-rules-basics">
<li><b>One ticket per root cause.</b> Something that starts while a higher cause is active (maintenance, a
partition, a fenced or rebooted host, a host out of memory) is "Also seen" on that cause's ticket.</li>
<li><b>Held, then opened.</b> A new problem waits one cycle so what comes with it lands in the first ticket
text. Some wait longer (Ceph, below). One that stops before then is dropped without a ticket.</li>
<li><b>Cleared, never closed.</b> When it has been quiet long enough, Thor adds a "Cleared" note and leaves
closing the ticket to you.</li>
<li><b>Outlasting a cause.</b> Something first seen as part of another incident that carries on after that
one clears becomes its own problem, timed from that moment.</li>
<li><b>Shadow first.</b> A check in shadow shows everything here but sends nothing to Tinker.</li>
</ul>
</section>
<section class="t-section" aria-labelledby="timing-title">
<div class="t-section-header"><h2 class="t-section-title" id="timing-title">Ceph timing by priority</h2></div>
<p class="t-note">Some Ceph warnings come and go (PGs not scrubbed, stalled DB reads, clock skew), so lower
priorities must last longer before a ticket, and standing ones must stay quiet longer before "Cleared".</p>
<div class="lt-table-wrap">
<table class="lt-table t-rules-table">
<thead><tr><th>Priority</th><th>Ticket after</th><th>Cleared after</th></tr></thead>
<tbody>
{% for t in d.ceph_timing %}
<tr><td><span class="t-prio t-prio-{{ t.priority | pclass }}">P{{ t.priority }}</span></td>
<td>{{ t.ticket_after }}</td><td>{{ t.cleared_after }}</td></tr>
{% endfor %}
</tbody>
</table>
</div>
</section>
{% for c in d.checks %}
<section class="t-section" aria-labelledby="check-{{ c.name }}">
<div class="t-section-header">
<h2 class="t-section-title" id="check-{{ c.name }}">{{ c.label }}</h2>
<span class="t-mode t-mode-{{ c.mode }}">{{ c.mode }}</span>
</div>
<div class="lt-table-wrap">
<table class="lt-table t-rules-table t-rules-stack">
<thead><tr><th>What</th><th>Priority</th><th>Ticket after</th><th>Cleared after</th><th>Meaning</th></tr></thead>
<tbody>
{% for r in c.rows %}
<tr{% if r.handled_by %} class="t-rule-handled"{% endif %}>
<td data-label="What"><code>{{ r.code }}</code></td>
<td data-label="Priority">{% if r.handled_by %}see <code>{{ r.handled_by }}</code>{% elif r.priority >= 5 %}no ticket{% else %}<span class="t-prio t-prio-{{ r.priority | pclass }}">P{{ r.priority }}</span>{% endif %}</td>
<td data-label="Ticket after">{% if not r.handled_by %}{{ r.ticket_after }}{% endif %}</td>
<td data-label="Cleared after">{% if not r.handled_by %}{{ r.cleared_after }}{% endif %}</td>
<td data-label="Meaning">{{ r.why }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</section>
{% endfor %}
{% endblock %}
+7 -1
View File
@@ -101,7 +101,13 @@ def incident(key):
detail = views.incident_detail(current_app.config['THOR_STORE'], key, settings.public_url) detail = views.incident_detail(current_app.config['THOR_STORE'], key, settings.public_url)
if detail is None: if detail is None:
abort(404) abort(404)
return render_template('incident.html', d=detail, active_nav='index') return render_template('incident.html', d=detail, timing=views.timing_line(detail['incident']),
active_nav='index')
@bp.route('/rules')
def rules():
return render_template('rules.html', d=views.rules(current_app.config['THOR_SETTINGS']), active_nav='rules')
@bp.route('/known') @bp.route('/known')
+36 -2
View File
@@ -17,6 +17,7 @@ def incident_brief(inc: Dict[str, Any], public_url: str = '') -> Dict[str, Any]:
'last_seen': inc.get('last_seen'), 'opened_at': inc.get('opened_at'), 'cleared_at': inc.get('cleared_at'), 'last_seen': inc.get('last_seen'), 'opened_at': inc.get('opened_at'), 'cleared_at': inc.get('cleared_at'),
'symptoms': len(inc.get('symptoms') or {}), 'events': len(inc.get('events') or []), 'symptoms': len(inc.get('symptoms') or {}), 'events': len(inc.get('events') or []),
'url': f'{public_url}/incident/{inc["key"]}' if public_url else f'/incident/{inc["key"]}', 'url': f'{public_url}/incident/{inc["key"]}' if public_url else f'/incident/{inc["key"]}',
'hold_s': inc.get('hold_s'), 'clear_s': inc.get('clear_s'),
} }
@@ -48,7 +49,10 @@ def covering(store, hosts: HostRegistry, host: Optional[str], scope: Optional[st
their own ticket as before (fail open). their own ticket as before (fail open).
""" """
canonical = hosts.canonical(host) if host else None canonical = hosts.canonical(host) if host else None
rows = [r for r in store.load_incidents(0) if r.get('state') in ACTIVE and r.get('ticket', True)] # Standing warnings (a P4 BlueStore alert, a flag left set) explain nothing, so they never
# cover another app's report: Gandalf must not comment a host-down onto a BlueStore ticket.
rows = [r for r in store.load_incidents(0)
if r.get('state') in ACTIVE and r.get('ticket', True) and r.get('explains', True)]
matched = [] matched = []
for r in rows: for r in rows:
subject = r.get('subject') subject = r.get('subject')
@@ -111,7 +115,9 @@ def incident_detail(store, key: str, public_url: str = '') -> Optional[Dict[str,
return None return None
actions = store.actions_for(key) actions = store.actions_for(key)
brief = incident_brief(inc, public_url) brief = incident_brief(inc, public_url)
brief['ticket_id'] = next((a['ticket_id'] for a in reversed(actions) if a.get('ticket_id')), None) \ # Only Thor's own creates name its ticket: attach and link rows carry another app's number.
brief['ticket_id'] = next((a['ticket_id'] for a in reversed(actions)
if a.get('ticket_id') and a['kind'] in ('open', 'escalate', 'refresh')), None) \
or inc.get('known_ticket') or inc.get('known_ticket')
symptoms = sorted((inc.get('symptoms') or {}).values(), key=lambda s: s.get('first', 0)) symptoms = sorted((inc.get('symptoms') or {}).values(), key=lambda s: s.get('first', 0))
events = sorted(inc.get('events') or [], key=lambda e: e.get('at', 0)) events = sorted(inc.get('events') or [], key=lambda e: e.get('at', 0))
@@ -122,3 +128,31 @@ def incident_detail(store, key: str, public_url: str = '') -> Optional[Dict[str,
'links': links, 'links': links,
'actions': actions, 'preview': preview, 'known_reason': inc.get('known_reason', ''), 'actions': actions, 'preview': preview, 'known_reason': inc.get('known_reason', ''),
'seen_after_the_fact': inc.get('seen_after_the_fact', False)} 'seen_after_the_fact': inc.get('seen_after_the_fact', False)}
CHECK_LABELS = {'maintenance': 'Maintenance (Gandalf)', 'cluster': 'Partitions and fencing', 'reboots': 'Reboots',
'memory': 'Memory', 'ceph': 'Ceph health'}
def rules(settings) -> Dict[str, Any]:
"""Every ticketing rule Thor applies, straight from the checks that apply them."""
from ..checks.ceph import TIMING, timing_words
from ..monitor import build_checks
checks = []
for c in build_checks():
if not hasattr(c, 'describe'):
continue # symptom checks (scrapes, pvestatd) never open tickets
checks.append({'name': c.name, 'label': CHECK_LABELS.get(c.name, c.name), 'mode': settings.check_mode(c.name),
'rows': c.describe()})
timing = [{'priority': p, 'ticket_after': timing_words(t.hold_s, hold=True),
'cleared_after': timing_words(t.clear_s, hold=False)} for p, t in sorted(TIMING.items())]
return {'checks': checks, 'ceph_timing': timing}
def timing_line(inc: Dict[str, Any]) -> str:
""""Ticket after X; cleared after Y quiet" for an incident page."""
from ..checks.ceph import timing_words
if not inc.get('ticket', True):
return f'timeline only; cleared after {timing_words(inc.get("clear_s"), hold=False)}'
return (f'ticket after {timing_words(inc.get("hold_s"), hold=True)}; '
f'cleared after {timing_words(inc.get("clear_s"), hold=False)}')