echo '===MONITOR:dmesg===' # -T 输出人类可读时间戳(如 [Mon Aug 24 10:23:45 2026]), # 依赖挂载宿主机 /etc/localtime 保证时区正确;老内核不支持 -T 时回退 DMESG_ERR=$(dmesg -T --level=err,crit,alert,emerg 2>/dev/null | tail -30) if [ -z "$DMESG_ERR" ]; then DMESG_ERR=$(dmesg --level=err,crit,alert,emerg 2>/dev/null | tail -30 || true) fi if [ -n "$DMESG_ERR" ]; then echo 'status:fail' echo "output:${DMESG_ERR}" else echo 'status:pass' echo 'output:无硬件相关内核报错' fi echo '' echo '===END==='