diff --git a/agent/linux/report-tasks.sh b/agent/linux/report-tasks.sh index 8df7337..17981e2 100644 --- a/agent/linux/report-tasks.sh +++ b/agent/linux/report-tasks.sh @@ -191,10 +191,18 @@ collect_system_info() { fi local cpu_model="" cpu_cores=0 cpu_load_percent="null" - # Some ARM kernels (e.g. Raspberry Pi) have no "model name" line in - # /proc/cpuinfo at all — grep then finds no match and exits 1, which is not - # a real error here, just an absent field. - cpu_model=$(grep -m1 "model name" /proc/cpuinfo 2>/dev/null | cut -d: -f2- | sed 's/^ *//' || true) + # x86 /proc/cpuinfo has a per-core "model name" line. Most 64-bit ARM + # kernels (Raspberry Pi included) don't — they instead have a single + # "Model" line at the very end, or nothing at all, in which case + # /proc/device-tree/model (present on any device-tree/SBC board) has the + # board's friendly name. Try each in turn; leave blank if none exist. + cpu_model=$(grep -m1 "^model name" /proc/cpuinfo 2>/dev/null | cut -d: -f2- | sed 's/^ *//' || true) + if [[ -z "$cpu_model" ]]; then + cpu_model=$(grep -m1 "^Model" /proc/cpuinfo 2>/dev/null | cut -d: -f2- | sed 's/^ *//' || true) + fi + if [[ -z "$cpu_model" && -r /proc/device-tree/model ]]; then + cpu_model=$(tr -d '\0' < /proc/device-tree/model 2>/dev/null || true) + fi cpu_cores=$(nproc 2>/dev/null || echo 0) if [[ -r /proc/loadavg && "$cpu_cores" -gt 0 ]]; then local load1