Skip to content

omdb: one ereport pretty-printer to rule them all#10486

Merged
hawkw merged 6 commits into
mainfrom
eliza/one-ereport-pretty-printer-to-rule-them-all
May 26, 2026
Merged

omdb: one ereport pretty-printer to rule them all#10486
hawkw merged 6 commits into
mainfrom
eliza/one-ereport-pretty-printer-to-rule-them-all

Conversation

@hawkw
Copy link
Copy Markdown
Member

@hawkw hawkw commented May 22, 2026

As seen in today's Demo Friday, I have put together a little pretty-printer for formatting ereport JSON in a human-focused way. The format it outputs is a little less full of delimiters than the JSON object, as it's indentation delimited, and should look pretty familiar to anyone who's used fmdump -eV or similar. More importantly, though, giving us a custom formatter gives us opportunities to prettify and enrich specific fields and structures which commonly occur in ereports by convention. Currently, the most interesting example of this is PMBus status registers from ereports that SPs emit about PMBus devices.

For example, let's consider an ereport that I harvested from the dogfood rack's PSC. In the current (JSON) format, it looks like this:

root@oxz_switch1:~# omdb db ereport show e9674d6e-cd4b-0cf3-ee6d-0c062720b868 0x5
note: database URL not specified.  Will search DNS.
note: (override with --db-url or OMDB_DB_URL)
note: using DNS from system config (typically /etc/resolv.conf)
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using database URL postgresql://root@[fd00:1122:3344:109::3]:32221,[fd00:1122:3344:105::3]:32221,[fd00:1122:3344:10b::3]:32221,[fd00:1122:3344:107::3]:32221,[fd00:1122:3344:108::3]:32221/omicron?sslmode=disable
note: database schema version matches expected (257.0.0)

== EREPORT METADATA ============================================================
                      ENA: 0x5
                    class: hw.pwr.pwr_good.bad
             collected at: 2025-11-14 20:38:20.177799 UTC
             collected by: 8af5baf2-7611-43fc-817c-283cb25e149f
              reported by: Power 0 (service processor)
               restart ID: e9674d6e-cd4b-0cf3-ee6d-0c062720b868
              part number: 913-0000003
            serial number: BRM45220004
    marked seen in sitrep: None

== EREPORT =====================================================================
{
  "baseboard_part_number": "913-0000003",
  "baseboard_rev": 8,
  "baseboard_serial_number": "BRM45220004",
  "ereport_message_version": 0,
  "fruid": {
    "fw_rev": "0701",
    "mfr": "Murata-PS",
    "mpn": "MWOCP68-3600-D-RM",
    "serial": "LL2216RB003Z"
  },
  "hubris_archive_id": "qSm4IUtvQe0",
  "hubris_task_gen": 0,
  "hubris_task_name": "sequencer",
  "hubris_uptime_ms": 1197408566,
  "k": "hw.pwr.pwr_good.bad",
  "pmbus_status": {
    "cml": 0,
    "input": 48,
    "iout": 0,
    "mfr": 0,
    "temp": 0,
    "vout": 0,
    "word": 10312
  },
  "rail": "V54_PSU4",
  "refdes": "PSU4",
  "slot": 4,
  "v": 0
}
root@oxz_switch1:~#

With the new formatter, it looks like this:

root@oxz_switch1:~# /tmp/omdb-erebor db ereport show e9674d6e-cd4b-0cf3-ee6d-0c062720b868 0x5
note: database URL not specified.  Will search DNS.
note: (override with --db-url or OMDB_DB_URL)
note: using DNS from system config (typically /etc/resolv.conf)
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using database URL postgresql://root@[fd00:1122:3344:109::3]:32221,[fd00:1122:3344:105::3]:32221,[fd00:1122:3344:10b::3]:32221,[fd00:1122:3344:107::3]:32221,[fd00:1122:3344:108::3]:32221/omicron?sslmode=disable
WARN: found schema version 257.0.0, expected 261.0.0
It's possible the database is running a version that's different from what this
tool understands.  This may result in errors or incorrect output.

== EREPORT METADATA ============================================================
                      ENA: 0x5
                    class: hw.pwr.pwr_good.bad
             collected at: 2025-11-14 20:38:20.177799 UTC
             collected by: 8af5baf2-7611-43fc-817c-283cb25e149f
              reported by: Power 0 (service processor)
               restart ID: e9674d6e-cd4b-0cf3-ee6d-0c062720b868
              part number: 913-0000003
            serial number: BRM45220004
    marked seen in sitrep: None

== EREPORT =====================================================================
baseboard_part_number = 913-0000003
baseboard_rev = 0x8
baseboard_serial_number = BRM45220004
ereport_message_version = 0x0
fruid = (object)
    fw_rev = 0701
    mfr = Murata-PS
    mpn = MWOCP68-3600-D-RM
    serial = LL2216RB003Z
(end fruid)

hubris_archive_id = qSm4IUtvQe0
hubris_task_gen = 0x0
hubris_task_name = sequencer
hubris_uptime_ms = 1197408566 (1197408.566s)
class = hw.pwr.pwr_good.bad
pmbus_status = (PMBus status)
    STATUS_WORD         = 0x2848 (InputFault | PowerGoodStatus | Off | InputUndervoltageFault)
    STATUS_VOUT         = 0x00
    STATUS_IOUT         = 0x00
    STATUS_INPUT        = 0x30 (InputUndervoltageWarning | InputUndervoltageFault)
    STATUS_TEMPERATURE  = 0x00
    STATUS_CML          = 0x00
    STATUS_MFR_SPECIFIC = 0x00
(end PMBus status)

rail = V54_PSU4
refdes = PSU4
slot = 0x4
version = 0


root@oxz_switch1:~#

Note that Bryan's pmbus crate is used to decode the PMBus status registers, which should allow folks to get a sense for what happened here without having to manually interpret the status register bitflags.

I've put this new formatter in a crate, named erebor --- this is either a portmanteau of "ereport" and "CBOR", or a reference to the Lonely Mountain of Middle-Earth, named "Erebor" in Sindarin; where Smaug destroyed the Dwarves' kingdom in an event that one assumes must have produced a great deal of ereports. This is intended to allow reusing it in omdb, in the faux-mgs ereports command, and perhaps elsewhere, eventually.

This branch adds it to omdb. Since I am sure there are situations where one would want to get the output as JSON, I've also added new --json adn --raw flags for doing that.

Copy link
Copy Markdown
Contributor

@wfchandler wfchandler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Two small suggestions, but this looks good to me.

Comment thread dev-tools/omdb/src/bin/omdb/db/ereport.rs Outdated
Comment thread dev-tools/omdb/src/bin/omdb/db/ereport.rs Outdated
@hawkw hawkw enabled auto-merge (squash) May 26, 2026 17:29
hawkw added a commit to oxidecomputer/management-gateway-service that referenced this pull request May 26, 2026
As seen in [last week's Demo Friday][1], I have put together a little
pretty-printer for formatting ereport JSON in a human-focused way. The
format it outputs is a little less full of delimiters than the JSON
object, as it's indentation delimited, and should look pretty familiar
to anyone who's used `fmdump -eV` or similar. More importantly, though,
giving us a custom formatter gives us opportunities to prettify and
enrich specific fields and structures which commonly occur in ereports
by convention. Currently, the most interesting example of this is PMBus
status registers from ereports that SPs emit about PMBus devices.

I've put this new formatter in a crate, named
[`erebor`](github.com/oxidecomputer/erebor) --- this is either a
portmanteau of "ereport" and "CBOR", or a reference to the Lonely
Mountain of Middle-Earth, named "Erebor" in Sindarin; where Smaug
destroyed the Dwarves' kingdom in an event that one assumes must have
produced a great deal of ereports. This is intended to allow reusing it
in the `faux-mgs ereports` command, in `omdb` (see
oxidecomputer/omicron#10486), and perhaps elsewhere, eventually.

This branch adds it to `faux-mgs`.

Closes #493

[1]:
    https://drive.google.com/file/d/16Snam3jJBQ5vyGoeji0zYaeMKrR3q1me/view?usp=sharing&t=827.273
@hawkw hawkw merged commit 2fb3663 into main May 26, 2026
19 checks passed
@hawkw hawkw deleted the eliza/one-ereport-pretty-printer-to-rule-them-all branch May 26, 2026 18:17
@hawkw hawkw mentioned this pull request May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants