Initial commit of vrcx (Vegman Remote Collect, extended) — the BMC-only bmccollect renamed and extended with a parallel SDS-host log branch. - dev/prod/old repo layout - per-host bmc/ + os/ subdirs, archives/dump_<ip>.tar.gz, outer session tarball - SdsSession (paramiko, sudo via -S), OS_COMMAND_TABLE (lsiget, storcli, smartctl, journal, dmidecode, etc.) - SDS IP discovery via Redfish EthernetInterfaces -> /24 ping-sweep -> arp -a - UI shows BMC|OS dual progress per host - CI/pyinstaller paths updated for dev/
84 lines
4.6 KiB
Python
84 lines
4.6 KiB
Python
"""
|
|
Mapping of "output file name" → "how to obtain it from the BMC".
|
|
|
|
Adding a new artefact = adding one line below. The collector iterates this
|
|
table per host and writes each entry into the per-host dump folder.
|
|
|
|
The file names mirror what the original YADRO VRC tool produces, so the
|
|
support flow doesn't change.
|
|
|
|
`kind`:
|
|
"ssh" : run a command in the YADRO BMC CLI (interactive shell over SSH)
|
|
"shell" : run a raw shell command on the BMC (via SSH exec_command, bash)
|
|
"cat" : `cat <path>` over SSH — capture a file verbatim
|
|
"journal" : `journalctl --no-pager -u <unit>` for a systemd unit
|
|
"redfish" : GET an HTTPS endpoint on the BMC (Redfish API)
|
|
|
|
`max_lines`:
|
|
Cap on the number of lines kept in the output. When the raw response is
|
|
bigger, only the **last** `max_lines` lines are written, with a single
|
|
"# truncated to last N (original was M lines)" header line on top.
|
|
Used to keep huge logs (sellog, journal) small and the run fast — the
|
|
original VRC pulled ~30 000 lines of sellog by default; 5 000 is plenty
|
|
for triage and dramatically reduces transfer time."""
|
|
|
|
from __future__ import annotations
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class CommandSpec:
|
|
filename: str
|
|
kind: str # one of: ssh / shell / cat / journal / redfish
|
|
target: str # CLI command / shell command / path / unit / endpoint
|
|
max_lines: int | None = None
|
|
|
|
|
|
# Initial subset — the same artefacts the original VRC produces. Each line is
|
|
# a self-contained collector instruction. Easy to add/remove without touching
|
|
# the rest of the code.
|
|
#
|
|
# Note on YADRO CLI: many top-level words (`bmc`, `host`, `bmc info`, `host
|
|
# power`) are **menus**, not leaf commands — typing them just prints their
|
|
# sub-command listing. To get actual data you have to go all the way down
|
|
# (e.g. `bmc info version`, `host power status`).
|
|
COMMAND_TABLE: list[CommandSpec] = [
|
|
# --- BMC state & version ---
|
|
CommandSpec("bmc-state.txt", "ssh", "bmc info version"),
|
|
CommandSpec("chassis-state.txt", "shell", "obmcutil chassisstate || true"),
|
|
CommandSpec("host-state.txt", "ssh", "host power status"),
|
|
CommandSpec("bmc_ver&power_status.log", "ssh", "bmc info version; bmc info uptime; host power status"),
|
|
CommandSpec("hostnamectl.log", "shell", "hostnamectl"),
|
|
CommandSpec("uptime.log", "shell", "uptime"),
|
|
|
|
# --- BMC inventory & sensors ---
|
|
CommandSpec("inventory.json", "ssh", "lsinventory -j"),
|
|
CommandSpec("lsinventory.json", "ssh", "lsinventory -j"),
|
|
CommandSpec("inventory.log", "ssh", "health logs show inventory"),
|
|
CommandSpec("sensors.log", "ssh", "health logs show sensors", max_lines=5000),
|
|
CommandSpec("sellog.log", "ssh", "health logs show sellog", max_lines=5000),
|
|
|
|
# --- BMC config & users ---
|
|
CommandSpec("bmc-users.txt", "ssh", "user list"),
|
|
CommandSpec("bmc-net-cfg.log", "shell", "ip addr; echo ---; ip route; echo ---; ip link"),
|
|
CommandSpec("bmc-service-settings.log", "ssh", "bmc services list"),
|
|
CommandSpec("fan-settings.log", "ssh", "bmc cooling show"),
|
|
|
|
# --- Raw OS files / journals ---
|
|
CommandSpec("cpuinfo", "cat", "/proc/cpuinfo"),
|
|
CommandSpec("meminfo", "cat", "/proc/meminfo"),
|
|
CommandSpec("osrelease", "cat", "/etc/os-release"),
|
|
CommandSpec("ipaddr.log", "shell", "ip -4 -j addr"),
|
|
CommandSpec("iplink.log", "shell", "ip -j link"),
|
|
CommandSpec("disk-usage.log", "shell", "df -h"),
|
|
CommandSpec("failed-services.log", "shell", "systemctl --failed --no-pager"),
|
|
CommandSpec("top.log", "shell", "top -b -n1", max_lines=100),
|
|
CommandSpec("fw-printenv.log", "shell", "fw_printenv 2>&1 || true"),
|
|
CommandSpec("audit.log", "cat", "/var/log/audit/audit.log", max_lines=5000),
|
|
CommandSpec("bmc-journal_full_date.log", "shell", "journalctl --no-pager --since '7 days ago'", max_lines=5000),
|
|
CommandSpec("obmc-console.log", "journal", "obmc-console@*.service", max_lines=5000),
|
|
CommandSpec("obmc-yadro-vrm-setter.log", "journal", "obmc-yadro-vrm-setter.service", max_lines=5000),
|
|
|
|
# --- Redfish ---
|
|
CommandSpec("redfish.json", "redfish", "/redfish/v1/Systems"),
|
|
]
|