Plan Thor: architecture, scope, and the ticket contract with gandalf and hwmonDaemon #1

Open
opened 2026-11-23 23:27:21 -05:00 by jared · 1 comment
Owner

This is a planning session, to be done before any code. The README has the charter and the boundaries between the three apps.

Questions to settle

  1. Where it runs. It must be off the cluster nodes, and preferably on a different box from Gandalf. Decide what it monitors itself with: who watches Thor?
  2. Data sources and cadence.
    • Prometheus queries: node_vmstat_oom_kill, memory and pressure (PSI), up and scrape_duration, Ceph exporter metrics.
    • Loki: the kernel lines for OOM kills, which name the guest.
    • The Proxmox API: HA, guests and storage.
    • Ceph status.
  3. Ticket contract between the three apps.
    • A shared incident key.
    • The rule for checking for an open ticket before cutting a new one.
    • How each app tags its tickets.
    • Auto-resolve notes.
    • How a Thor root-cause ticket absorbs symptom tickets from the other two.
  4. Root-cause grouping. For example, an OOM on a host plus Ceph slow ops plus scrape timeouts cluster-wide should produce one ticket: "compute-storage-01 out of memory (CT 154)".
  5. Migration order from hwmonDaemon (#39, #40): memory, CPU, LXC storage, Ceph. Include how to switch each check off in hwmonDaemon without leaving a gap.
  6. Stack. Reuse Gandalf's patterns (Flask + MariaDB + monitor loop, the Tinker client), or keep Thor headless with no UI?
  7. Tests. A replay of 2026-11-23 06:01 should produce exactly one correct ticket across all three apps.

Reference incident

Tinker 615797777, gandalf#57 and hwmonDaemon#39.

This is a planning session, to be done before any code. The README has the charter and the boundaries between the three apps. ## Questions to settle 1. **Where it runs.** It must be off the cluster nodes, and preferably on a different box from Gandalf. Decide what it monitors itself with: who watches Thor? 2. **Data sources and cadence.** - Prometheus queries: `node_vmstat_oom_kill`, memory and pressure (PSI), `up` and `scrape_duration`, Ceph exporter metrics. - Loki: the kernel lines for OOM kills, which name the guest. - The Proxmox API: HA, guests and storage. - Ceph status. 3. **Ticket contract between the three apps.** - A shared incident key. - The rule for checking for an open ticket before cutting a new one. - How each app tags its tickets. - Auto-resolve notes. - How a Thor root-cause ticket absorbs symptom tickets from the other two. 4. **Root-cause grouping.** For example, an OOM on a host plus Ceph slow ops plus scrape timeouts cluster-wide should produce one ticket: "compute-storage-01 out of memory (CT 154)". 5. **Migration order from hwmonDaemon** (#39, #40): memory, CPU, LXC storage, Ceph. Include how to switch each check off in hwmonDaemon without leaving a gap. 6. **Stack.** Reuse Gandalf's patterns (Flask + MariaDB + monitor loop, the Tinker client), or keep Thor headless with no UI? 7. **Tests.** A replay of 2026-11-23 06:01 should produce exactly one correct ticket across all three apps. ## Reference incident Tinker 615797777, gandalf#57 and hwmonDaemon#39.
Author
Owner

Handoff brief for the planning session (2026-11-25)

This collects what the Gandalf sessions learned that Thor's planning needs. It's here so a fresh session can start from it.

Ownership rule (decided 2026-11-23)

App Owns
gandalf The network only. It must not open memory or host-health tickets.
hwmonDaemon Only what the host alone can read: SMART, ECC, the hardware event log.
thor Anything visible from Prometheus, Loki, Proxmox or Ceph, with one ticket per root cause.

Routing rule for new checks: if node_exporter or Loki exposes it, it's thor; if only the box knows, it's hwmonDaemon; if it's network, it's gandalf.

Data sources (all verified working)

  • Prometheus: http://10.10.10.48:9090.
    • node_exporter runs on every host.
    • node_boot_time_seconds, node_vmstat_oom_kill, up and scrape_duration_seconds all work.
  • Loki: http://10.10.10.69:3100.
    • Journals use {job="journal", host="<host>", unit="<unit>"}, and the host label matches Gandalf's host names.
    • Proxmox tasks are under {job="pve-tasks"}, but they're only ingested after a host comes back.
    • Queries over 30 days are rejected.
    • /ready can return 503 while queries still work.
  • Ceph exporter: 10.10.10.4:9283.
    • ceph_health_status, ceph_health_detail{name,severity} (e.g. OSDMAP_FLAGS, RECENT_CRASH, BLUESTORE_SLOW_OP_ALERT) and ceph_osd_flag_*.
    • The pause flags aren't exported, so read them from ceph osd dump.
  • Hosts:
Host Address
compute-storage-01 .4
compute-storage-02 .2
compute-storage-gpu-01 .10
storage-01 .11
monitor-01 .8
monitor-02 .9
pbs .3
  • Renames: large1 is now compute-storage-02 and micro1 is now monitor-01. Older Loki lines use the old names.

Code thor can lift from gandalf

  • reboots.py (gandalf#65): the Loki client, find_shutdown, and planned-reboot grace.
  • Ticket client and ticket text, with the title-tag format [host][auto][production][issue][...].
  • gandalf#57's rule: never call it a network fault without network evidence.

Known conditions thor must handle (operator decisions)

  • compute-storage-02: it reboots every 2 to 3 days from a known failing DIMM (P0 Channel B DIMM 1, ECC errors).
    • Tracked in Tinker 693930698.
    • Don't open new tickets for it. If anything, add notes to that ticket.
    • It sits outside the rack and isn't on the rack UPS.
  • Ceph noout: set on purpose, long-term, because of compute-storage-02. A "maintenance flag left on" check therefore needs an acknowledge or known-condition mechanism (for example, linked to the tracking ticket), not a fixed time limit.

Lessons from real incidents

  • 2026-11-23 (Tinker 615797777): an OOM loop on compute-storage-01 (CT 154) stalled Ceph and timed out scrapes on three hosts. Gandalf wrongly opened a P1 network ticket (fixed in gandalf#57). This is the replay test in item 7 above.
  • 2026-11-24 evening (03:10 to 03:35 UTC on 11-25), planned rack maintenance:
    • What the operator did:
      1. Silenced Gandalf and paused Ceph.
      2. Started host shutdowns.
      3. Updated the UniFi switches, which rebooted the network.
      4. Updated the UPS firmware, knowing beforehand that the update would cut power to the rack.
    • The power cut was planned and expected, not a surprise outage.
    • What it means for thor:
      • Journals stopped reaching Loki about 20 minutes before the hosts lost power, when the switches went down.
      • Thor needs maintenance awareness: Gandalf silences, Ceph flags, firmware updates.
      • A journal that went quiet before the host did means "unknown", not "crash".
      • Group simultaneous reboots into one event. See #4.

Operator preferences (apply everywhere)

  • No em or en dashes, anywhere: UI, code, commits, PRs, tickets, replies. Use hyphens, colons, commas or pipes.
  • Never mark something unused or suppress an alert on your own diagnosis. Ask first.
  • UI: the top concern is avoiding overload. Fold new problems into one "Needs attention" style list rather than adding new sections.
  • Merges: the operator says "merge N". After merging, verify the deploy: prod HEAD, the services active, health 200, and no tracebacks.

Open thor issues

  • #2: hardware registry keyed by serial number, linked to HomeBox.
  • #3: detailed Ceph view.
  • #4: unexpected-reboot alerts.
## Handoff brief for the planning session (2026-11-25) This collects what the Gandalf sessions learned that Thor's planning needs. It's here so a fresh session can start from it. ### Ownership rule (decided 2026-11-23) | App | Owns | |---|---| | **gandalf** | The network only. It must not open memory or host-health tickets. | | **hwmonDaemon** | Only what the host alone can read: SMART, ECC, the hardware event log. | | **thor** | Anything visible from Prometheus, Loki, Proxmox or Ceph, with one ticket per root cause. | Routing rule for new checks: if node_exporter or Loki exposes it, it's thor; if only the box knows, it's hwmonDaemon; if it's network, it's gandalf. ### Data sources (all verified working) - **Prometheus:** `http://10.10.10.48:9090`. - node_exporter runs on every host. - `node_boot_time_seconds`, `node_vmstat_oom_kill`, `up` and `scrape_duration_seconds` all work. - **Loki:** `http://10.10.10.69:3100`. - Journals use `{job="journal", host="<host>", unit="<unit>"}`, and the `host` label matches Gandalf's host names. - Proxmox tasks are under `{job="pve-tasks"}`, but they're only ingested after a host comes back. - Queries over 30 days are rejected. - `/ready` can return 503 while queries still work. - **Ceph exporter:** `10.10.10.4:9283`. - `ceph_health_status`, `ceph_health_detail{name,severity}` (e.g. OSDMAP_FLAGS, RECENT_CRASH, BLUESTORE_SLOW_OP_ALERT) and `ceph_osd_flag_*`. - The `pause` flags aren't exported, so read them from `ceph osd dump`. - **Hosts:** | Host | Address | |---|---| | compute-storage-01 | .4 | | compute-storage-02 | .2 | | compute-storage-gpu-01 | .10 | | storage-01 | .11 | | monitor-01 | .8 | | monitor-02 | .9 | | pbs | .3 | - Renames: large1 is now compute-storage-02 and micro1 is now monitor-01. Older Loki lines use the old names. ### Code thor can lift from gandalf - `reboots.py` (gandalf#65): the Loki client, `find_shutdown`, and planned-reboot grace. - Ticket client and ticket text, with the title-tag format `[host][auto][production][issue][...]`. - gandalf#57's rule: never call it a network fault without network evidence. ### Known conditions thor must handle (operator decisions) - **compute-storage-02:** it reboots every 2 to 3 days from a known failing DIMM (P0 Channel B DIMM 1, ECC errors). - Tracked in Tinker [693930698](https://t.lotusguild.org/ticket/693930698). - Don't open new tickets for it. If anything, add notes to that ticket. - It sits outside the rack and isn't on the rack UPS. - **Ceph `noout`:** set on purpose, long-term, because of compute-storage-02. A "maintenance flag left on" check therefore needs an acknowledge or known-condition mechanism (for example, linked to the tracking ticket), not a fixed time limit. ### Lessons from real incidents - **2026-11-23 (Tinker 615797777):** an OOM loop on compute-storage-01 (CT 154) stalled Ceph and timed out scrapes on three hosts. Gandalf wrongly opened a P1 network ticket (fixed in gandalf#57). This is the replay test in item 7 above. - **2026-11-24 evening (03:10 to 03:35 UTC on 11-25), planned rack maintenance:** - What the operator did: 1. Silenced Gandalf and paused Ceph. 2. Started host shutdowns. 3. Updated the UniFi switches, which rebooted the network. 4. Updated the UPS firmware, knowing beforehand that the update would cut power to the rack. - The power cut was planned and expected, not a surprise outage. - What it means for thor: - Journals stopped reaching Loki about 20 minutes before the hosts lost power, when the switches went down. - Thor needs maintenance awareness: Gandalf silences, Ceph flags, firmware updates. - A journal that went quiet before the host did means "unknown", not "crash". - Group simultaneous reboots into one event. See #4. ### Operator preferences (apply everywhere) - **No em or en dashes**, anywhere: UI, code, commits, PRs, tickets, replies. Use hyphens, colons, commas or pipes. - **Never mark something unused or suppress an alert on your own diagnosis.** Ask first. - **UI:** the top concern is avoiding overload. Fold new problems into one "Needs attention" style list rather than adding new sections. - **Merges:** the operator says "merge N". After merging, verify the deploy: prod HEAD, the services active, health 200, and no tracebacks. ### Open thor issues - #2: hardware registry keyed by serial number, linked to HomeBox. - #3: detailed Ceph view. - #4: unexpected-reboot alerts.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/thor#1