diff --git a/src/Script_ABC_Blanton/Blanton_Script/bmc_monitor.sh b/src/Script_ABC_Blanton/Blanton_Script/bmc_monitor.sh index 40af6fd..87b3d11 100644 --- a/src/Script_ABC_Blanton/Blanton_Script/bmc_monitor.sh +++ b/src/Script_ABC_Blanton/Blanton_Script/bmc_monitor.sh @@ -34,7 +34,6 @@ set -u # Add a line to add a command; comment it out to disable it. COMMANDS=( "free -m" - "memtester 500M 1" #"uptime" #"cat /proc/loadavg" #"cat /proc/meminfo" diff --git a/src/Script_ABC_Blanton/Blanton_Script/bmc_monitor_ddr.sh b/src/Script_ABC_Blanton/Blanton_Script/bmc_monitor_ddr.sh new file mode 100644 index 0000000..ef8d106 --- /dev/null +++ b/src/Script_ABC_Blanton/Blanton_Script/bmc_monitor_ddr.sh @@ -0,0 +1,340 @@ +#!/bin/bash +############################################################################### +# bmc_monitor_ddr.sh +# +# Version : V1.1.0 +# Author : ETWen +# Date : 20260820 +# +# Purpose : Periodically execute a list of commands on the BMC through +# `bmc-manager run ""` from the SONiC host side, and append all +# output to a rotating log file. Designed to run detached in the +# background so no interactive SSH session to the BMC is required. +# +# Notes : - Everything runs on the HOST. Nothing is deployed to the BMC, so +# the BMC busybox toolchain (no base64 / no setsid ...) is a +# non-issue. +# - `bmc-manager run` prints the remote command output on stdout and +# its own banner on stderr; the two streams are captured separately +# so the log stays clean. +# +# Version History +# V1.0.0 20260820 Initial Version +# V1.1.0 20260820 `start` clears the previous log by default +# (START_LOG_MODE: new / archive / append) +############################################################################### + +set -u + +############################################################################### +# User Configurable Section -- normally this is the only part you need to edit +############################################################################### + +# Commands executed on the BMC, one per line, in this order. +# Add a line to add a command; comment it out to disable it. +COMMANDS=( + "memtester 500M 1" + #"uptime" + #"cat /proc/loadavg" + #"cat /proc/meminfo" + #"df -h /tmp" + #"dmesg | tail -n 30" +) + +# Seconds to wait after a full round (all COMMANDS executed) before the next one +INTERVAL_SEC=5 + +# Seconds to wait between two commands inside the same round (0 = no wait) +INTER_CMD_DELAY_SEC=0 + +# Per-command timeout in seconds; prevents a hung bmc-manager from freezing the +# whole loop. Set to 0 to disable. +CMD_TIMEOUT_SEC=3600 + +# Stop after this many rounds. 0 = run until stopped manually. +MAX_ROUNDS=0 + +# Command runner. Final invocation is: +# "$RUNNER_BIN" "${RUNNER_ARGS[@]}" "" +# BMC side : RUNNER_BIN="bmc-manager" ; RUNNER_ARGS=(run) +# BMC by IP : RUNNER_BIN="bmc-manager" ; RUNNER_ARGS=(--ip 192.168.200.200 run) +# Host side : RUNNER_BIN="bash" ; RUNNER_ARGS=(-c) +RUNNER_BIN="bmc-manager" +RUNNER_ARGS=(run) + +# stderr handling of the runner (bmc-manager banner lives here) +# 0 = log stderr only when the command fails (recommended, keeps log clean) +# 1 = always log stderr +LOG_STDERR=0 + +# Logging +LOG_DIR="" # empty =