init repo
This commit is contained in:
commit
176316efae
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
bmctool_output/*
|
||||
plugin/*
|
||||
230
bmctool.bat
Normal file
230
bmctool.bat
Normal file
@ -0,0 +1,230 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
:: Script Info
|
||||
set "ScriptVersion=0.0.1"
|
||||
set "ScriptName=bmctool"
|
||||
|
||||
set "OUTPUT_DIR=%CD%\bmctool_output"
|
||||
set "COMMAND="
|
||||
set "PLUGIN="
|
||||
|
||||
:: 检查配置文件
|
||||
:CONFIG_CHECK
|
||||
:: Step1. 导入默认配置
|
||||
set "CONF_PATH=%CD%\setting"
|
||||
for /f "usebackq delims=" %%a in (`
|
||||
powershell -command "$json = Get-Content '%CONF_PATH%\bmcconf.json' | ConvertFrom-Json; $json.ip"
|
||||
`) do set "BMC_IP=%%a"
|
||||
|
||||
for /f "usebackq delims=" %%a in (`
|
||||
powershell -command "$json = Get-Content '%CONF_PATH%\bmcconf.json' | ConvertFrom-Json; $json.user"
|
||||
`) do set "USERNAME=%%a"
|
||||
|
||||
for /f "usebackq delims=" %%a in (`
|
||||
powershell -command "$json = Get-Content '%CONF_PATH%\bmcconf.json' | ConvertFrom-Json; $json.pass"
|
||||
`) do set "PASSWORD=%%a"
|
||||
|
||||
:: Step2. 查询插件脚本是否启用
|
||||
:: 如果不存在plugin路径则直接跳过该步骤
|
||||
set "PLUGIN_DIR=%CD%\plugin"
|
||||
if not exist %PLUGIN_DIR% goto :END_CONFIG_CHECK
|
||||
|
||||
for %%f in ("%PLUGIN_DIR%\plugin_*.bat") do (
|
||||
set "filename=%%~nf"
|
||||
|
||||
for /f "tokens=2 delims=_" %%a in ("!filename!") do (
|
||||
set "plugin_id=%%a"
|
||||
)
|
||||
|
||||
:: echo Find plugin : !plugin_id!
|
||||
for /f "usebackq delims=" %%a in (`
|
||||
powershell -command "$json = Get-Content '%CONF_PATH%\plugin.json' | ConvertFrom-Json; $json.!plugin_id!"
|
||||
`) do set "is_enable=%%a"
|
||||
|
||||
if "!is_enable!" == "enable" (
|
||||
:: echo !plugin_id! is valid
|
||||
set "PLUGIN=!plugin_id!"
|
||||
set "PluginBat=%PLUGIN_DIR%\plugin_!PLUGIN!.bat"
|
||||
goto :END_CONFIG_CHECK
|
||||
)
|
||||
)
|
||||
|
||||
:END_CONFIG_CHECK
|
||||
:: Default Scirpt Varible
|
||||
:: set "BMC_IP=192.168.100.2"
|
||||
:: set "USERNAME=ADMIN"
|
||||
:: set "PASSWORD=ADMIN"
|
||||
|
||||
|
||||
:: 解析参数
|
||||
:PARSE_ARGS
|
||||
if "%1"=="" goto :USAGE
|
||||
if "%1"=="-h" goto :USAGE
|
||||
if "%1"=="--help" goto :USAGE
|
||||
|
||||
:ARG_LOOP
|
||||
if "%1"=="" goto :ARGS_PARSED
|
||||
if "%1"=="-i" (
|
||||
set "BMC_IP=%2"
|
||||
shift
|
||||
) else if "%1"=="--ip" (
|
||||
set "BMC_IP=%2"
|
||||
shift
|
||||
) else if "%1"=="-u" (
|
||||
set "USERNAME=%2"
|
||||
shift
|
||||
) else if "%1"=="--user" (
|
||||
set "USERNAME=%2"
|
||||
shift
|
||||
) else if "%1"=="-p" (
|
||||
set "PASSWORD=%2"
|
||||
shift
|
||||
) else if "%1"=="--pass" (
|
||||
set "PASSWORD=%2"
|
||||
shift
|
||||
) else (
|
||||
:: 剩余参数作为命令
|
||||
set "COMMAND=%COMMAND%%1"
|
||||
)
|
||||
shift
|
||||
goto :ARG_LOOP
|
||||
|
||||
:ARGS_PARSED
|
||||
:: 验证参数
|
||||
:: echo BMC IP : %BMC_IP%
|
||||
:: echo USERNAME: %USERNAME%
|
||||
:: echo PASSWORD: %PASSWORD%
|
||||
:: echo Command : %COMMAND%
|
||||
set "IPMI=ipmitool/ipmitool.exe -I lanplus -H %BMC_IP% -U %USERNAME% -P %PASSWORD%"
|
||||
|
||||
if "%COMMAND%"=="" set "COMMAND=info"
|
||||
|
||||
:: 创建输出目录
|
||||
if not exist "%OUTPUT_DIR%" mkdir "%OUTPUT_DIR%"
|
||||
|
||||
:: 执行命令
|
||||
call :EXECUTE_COMMAND
|
||||
exit /b %ERRORLEVEL%
|
||||
|
||||
:: 命令执行函数
|
||||
:EXECUTE_COMMAND
|
||||
if /i "%COMMAND%"=="info" (
|
||||
call :GET_SYSTEM_INFO
|
||||
) else if /i "%COMMAND:~0,5%"=="power" (
|
||||
call :MANAGE_POWER %COMMAND:~5%
|
||||
) else if /i "%COMMAND:~0,3%"=="set" (
|
||||
call :SET_CONFIG %COMMAND:~3%
|
||||
) else if /i "%COMMAND%" == "sensor" (
|
||||
call :GET_SENSOR_ELIST
|
||||
) else if /i "%COMMAND%" == "sdr" (
|
||||
call :GET_SDR_ELIST
|
||||
) else if /i "%COMMAND%" == "fru" (
|
||||
call :GET_FRU_INFO
|
||||
) else (
|
||||
:: 调用插件
|
||||
if defined PluginBat (
|
||||
call %PluginBat% -i %BMC_IP% -u %USERNAME% -p %PASSWORD% %COMMAND%
|
||||
|
||||
if !errorlevel! == 1 (
|
||||
echo Invalid Command !
|
||||
exit /b 1
|
||||
)
|
||||
) else (
|
||||
echo Invalid Command !
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
exit /b 0
|
||||
|
||||
:: 获取BMC系统信息
|
||||
:GET_SYSTEM_INFO
|
||||
echo Run Command GET_SYSTEM_INFO
|
||||
%IPMI% mc info
|
||||
exit /b 0
|
||||
|
||||
:: 电源管理
|
||||
:MANAGE_POWER
|
||||
echo Run Command MANAGE_POWER
|
||||
echo Param: %1
|
||||
set "action=%1"
|
||||
if /i "%action%"=="on" (
|
||||
%IPMI% power on
|
||||
) else if /i "%action%"=="off" (
|
||||
%IPMI% power off
|
||||
) else if /i "%action%"=="cycle" (
|
||||
%IPMI% power cycle
|
||||
)
|
||||
exit /b 0
|
||||
|
||||
:: Change defaut settings
|
||||
:SET_CONFIG
|
||||
echo Modify local config
|
||||
set "Param=%1"
|
||||
if /i "!Param:~0,2!" == "ip" (
|
||||
set "ipaddr=!Param:~2!"
|
||||
echo Change ip to !ipaddr!
|
||||
powershell -Command "$json = Get-Content '%CONF_PATH%\bmcconf.json' | ConvertFrom-Json; $json.ip = '!ipaddr!'; $json | ConvertTo-Json | Set-Content '%CONF_PATH%\bmcconf.json'"
|
||||
) else if /i "!Param:~0,4!" == "user" (
|
||||
set "inputuser=!Param:~4!"
|
||||
echo Change user to !inputuser!
|
||||
powershell -Command "$json = Get-Content '%CONF_PATH%\bmcconf.json' | ConvertFrom-Json; $json.user = '!inputuser!'; $json | ConvertTo-Json | Set-Content '%CONF_PATH%\bmcconf.json'"
|
||||
) else if /i "!Param:~0,4!" == "pass" (
|
||||
set "inputpass=!Param:~4!"
|
||||
echo Change password to !inputpass!
|
||||
powershell -Command "$json = Get-Content '%CONF_PATH%\bmcconf.json' | ConvertFrom-Json; $json.pass = '!inputpass!'; $json | ConvertTo-Json | Set-Content '%CONF_PATH%\bmcconf.json'"
|
||||
) else (
|
||||
echo Invalid Param !
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Modify Done
|
||||
exit /b 0
|
||||
|
||||
:GET_SENSOR_ELIST
|
||||
echo Run Command GET_SENSOR_ELIST
|
||||
%IPMI% sensor elist
|
||||
exit /b 0
|
||||
|
||||
:GET_SDR_ELIST
|
||||
echo Run Command GET_SDR_ELIST
|
||||
%IPMI% sdr elist
|
||||
exit /b 0
|
||||
|
||||
:GET_FRU_INFO
|
||||
echo Run Command GET_FRU_INFO
|
||||
%IPMI% fru
|
||||
exit /b 0
|
||||
|
||||
:: Help info
|
||||
:USAGE
|
||||
echo %ScriptName% v%ScriptVersion% Usage
|
||||
echo.
|
||||
echo Format: %ScriptName% [-i bmcip] [-u username] [-p password] command
|
||||
echo.
|
||||
echo Param Details
|
||||
echo -i, --ip BMC IP Address
|
||||
echo -u, --user BMC IPMI User Name
|
||||
echo -p, --pass BMC IPMI User Password
|
||||
echo -h, --help Show this info
|
||||
echo.
|
||||
echo Common Command List
|
||||
echo info Get BMC System Info
|
||||
echo power on Set Power on to BMC
|
||||
echo power off Set Power off to BMC
|
||||
echo power cycle Set Power cycle to BMC
|
||||
echo sensor Show the sensor elist
|
||||
echo sdr Show the sdr elist
|
||||
echo fru Show the fru info
|
||||
echo set ip [ip addr] Set ip addr to default config
|
||||
echo set user [name] Set IPMI user to default config
|
||||
echo set pass [pw] Set IPMI password to default config
|
||||
echo.
|
||||
|
||||
:: if enable plugin, show the help info here
|
||||
if defined PluginBat (
|
||||
%PluginBat% --help
|
||||
)
|
||||
exit /b 1
|
||||
|
||||
endlocal
|
||||
BIN
ipmitool/Command Prompt.lnk
Normal file
BIN
ipmitool/Command Prompt.lnk
Normal file
Binary file not shown.
BIN
ipmitool/MemoryAssistant_v110.exe
Normal file
BIN
ipmitool/MemoryAssistant_v110.exe
Normal file
Binary file not shown.
106
ipmitool/Readme.txt
Normal file
106
ipmitool/Readme.txt
Normal file
@ -0,0 +1,106 @@
|
||||
使用范围:互联网售前,配合ipmitool文档使用
|
||||
时间:2018.2.28
|
||||
版本1.8.18
|
||||
ipmitool 1.8.18
|
||||
配置过程:
|
||||
Interfaces
|
||||
lan : yes
|
||||
lanplus : yes
|
||||
open : no
|
||||
free : no
|
||||
imb : no
|
||||
bmc : no
|
||||
usb : no
|
||||
lipmi : no
|
||||
serial : yes
|
||||
dummy : no
|
||||
|
||||
集成lan和lanplus,测试阶段
|
||||
|
||||
PS C:\Users\Administrator\Desktop\IPMIToolWin1.8.18> .\ipmitool.exe -H $BMCIP -U $bmcuser -P $password -I lanplus -h
|
||||
ipmitool version 1.8.18
|
||||
|
||||
usage: ipmitool [options...] <command>
|
||||
|
||||
-h This help
|
||||
-V Show version information
|
||||
-v Verbose (can use multiple times)
|
||||
-c Display output in comma separated format
|
||||
-d N Specify a /dev/ipmiN device to use (default=0)
|
||||
-I intf Interface to use
|
||||
-H hostname Remote host name for LAN interface
|
||||
-p port Remote RMCP port [default=623]
|
||||
-U username Remote session username
|
||||
-f file Read remote session password from file
|
||||
-z size Change Size of Communication Channel (OEM)
|
||||
-S sdr Use local file for remote SDR cache
|
||||
-D tty:b[:s] Specify the serial device, baud rate to use
|
||||
and, optionally, specify that interface is the system one
|
||||
-4 Use only IPv4
|
||||
-6 Use only IPv6
|
||||
-a Prompt for remote password
|
||||
-Y Prompt for the Kg key for IPMIv2 authentication
|
||||
-e char Set SOL escape character
|
||||
-C ciphersuite Cipher suite to be used by lanplus interface
|
||||
-k key Use Kg key for IPMIv2 authentication
|
||||
-y hex_key Use hexadecimal-encoded Kg key for IPMIv2 authentication
|
||||
-L level Remote session privilege level [default=ADMINISTRATOR]
|
||||
Append a '+' to use name/privilege lookup in RAKP1
|
||||
-A authtype Force use of auth type NONE, PASSWORD, MD2, MD5 or OEM
|
||||
-P password Remote session password
|
||||
-E Read password from IPMI_PASSWORD environment variable
|
||||
-K Read kgkey from IPMI_KGKEY environment variable
|
||||
-m address Set local IPMB address
|
||||
-b channel Set destination channel for bridged request
|
||||
-t address Bridge request to remote target address
|
||||
-B channel Set transit channel for bridged request (dual bridge)
|
||||
-T address Set transit address for bridge request (dual bridge)
|
||||
-l lun Set destination lun for raw commands
|
||||
-o oemtype Setup for OEM (use 'list' to see available OEM types)
|
||||
-O seloem Use file for OEM SEL event descriptions
|
||||
-N seconds Specify timeout for lan [default=2] / lanplus [default=1] interface
|
||||
-R retry Set the number of retries for lan/lanplus interface [default=4]
|
||||
|
||||
Interfaces:
|
||||
lan IPMI v1.5 LAN Interface [default]
|
||||
lanplus IPMI v2.0 RMCP+ LAN Interface
|
||||
serial-terminal Serial Interface, Terminal Mode
|
||||
serial-basic Serial Interface, Basic Mode
|
||||
|
||||
Commands:
|
||||
raw Send a RAW IPMI request and print response
|
||||
i2c Send an I2C Master Write-Read command and print response
|
||||
spd Print SPD info from remote I2C device
|
||||
lan Configure LAN Channels
|
||||
chassis Get chassis status and set power state
|
||||
power Shortcut to chassis power commands
|
||||
event Send pre-defined events to MC
|
||||
mc Management Controller status and global enables
|
||||
sdr Print Sensor Data Repository entries and readings
|
||||
sensor Print detailed sensor information
|
||||
fru Print built-in FRU and scan SDR for FRU locators
|
||||
gendev Read/Write Device associated with Generic Device locators sdr
|
||||
sel Print System Event Log (SEL)
|
||||
pef Configure Platform Event Filtering (PEF)
|
||||
sol Configure and connect IPMIv2.0 Serial-over-LAN
|
||||
tsol Configure and connect with Tyan IPMIv1.5 Serial-over-LAN
|
||||
isol Configure IPMIv1.5 Serial-over-LAN
|
||||
user Configure Management Controller users
|
||||
channel Configure Management Controller channels
|
||||
session Print session information
|
||||
dcmi Data Center Management Interface
|
||||
nm Node Manager Interface
|
||||
sunoem OEM Commands for Sun servers
|
||||
kontronoem OEM Commands for Kontron devices
|
||||
picmg Run a PICMG/ATCA extended cmd
|
||||
fwum Update IPMC using Kontron OEM Firmware Update Manager
|
||||
firewall Configure Firmware Firewall
|
||||
delloem OEM Commands for Dell systems
|
||||
exec Run list of commands from file
|
||||
set Set runtime variable for shell and exec
|
||||
hpm Update HPM components using PICMG HPM.1 file
|
||||
ekanalyzer run FRU-Ekeying analyzer using FRU files
|
||||
ime Update Intel Manageability Engine Firmware
|
||||
vita Run a VITA 46.11 extended cmd
|
||||
lan6 Configure IPv6 LAN Channels
|
||||
|
||||
BIN
ipmitool/Riserfru.bin
Normal file
BIN
ipmitool/Riserfru.bin
Normal file
Binary file not shown.
BIN
ipmitool/cygcrypto-1.0.0.dll
Normal file
BIN
ipmitool/cygcrypto-1.0.0.dll
Normal file
Binary file not shown.
BIN
ipmitool/cyggcc_s-1.dll
Normal file
BIN
ipmitool/cyggcc_s-1.dll
Normal file
Binary file not shown.
BIN
ipmitool/cygwin1.dll
Normal file
BIN
ipmitool/cygwin1.dll
Normal file
Binary file not shown.
BIN
ipmitool/cygz.dll
Normal file
BIN
ipmitool/cygz.dll
Normal file
Binary file not shown.
2
ipmitool/desktop.ini
Normal file
2
ipmitool/desktop.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[LocalizedFileNames]
|
||||
Command Prompt.lnk=@%SystemRoot%\system32\shell32.dll,-22022
|
||||
BIN
ipmitool/ipmitool.exe
Normal file
BIN
ipmitool/ipmitool.exe
Normal file
Binary file not shown.
14
ipmitool/ipmitool_serial_log_collecting_commands.txt
Normal file
14
ipmitool/ipmitool_serial_log_collecting_commands.txt
Normal file
@ -0,0 +1,14 @@
|
||||
0.client端打开debug模式:
|
||||
ipmitool -I lanplus -H ip -U admin -P admin raw 0x3c 0x04 0x32 2
|
||||
1.vim /etc/default/grub
|
||||
2.编辑GRUB_CMDLINE_LINUX开头的那一行,
|
||||
删除掉其中的rhgb quiet,引号内增加console=tty0 console=ttyS0,115200
|
||||
3.grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg 生成新的grub启动项
|
||||
里面的redhat可能是centos,根据OS选择
|
||||
4.client端开启sol收集串口日志:
|
||||
ipmitool -I lanplus -H ip -U admin -P admin sol activate > debug.log
|
||||
5.测试完成,client端结束收集命令
|
||||
先新开一个终端,使用killall -9 ipmitool来结束命令
|
||||
然后ipmitool -I lanplus -H ip -U admin -P admin sol deactivate 关闭sol.
|
||||
6.client端关闭debug模式:
|
||||
ipmitool -I lanplus -H ip -U admin -P admin raw 0x3c 0x04 0x32 0
|
||||
16
ipmitool/null
Normal file
16
ipmitool/null
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
正在 Ping 127.0.0.1 具有 32 字节的数据:
|
||||
来自 127.0.0.1 的回复: 字节=32 时间<1ms TTL=128
|
||||
来自 127.0.0.1 的回复: 字节=32 时间<1ms TTL=128
|
||||
来自 127.0.0.1 的回复: 字节=32 时间<1ms TTL=128
|
||||
来自 127.0.0.1 的回复: 字节=32 时间<1ms TTL=128
|
||||
来自 127.0.0.1 的回复: 字节=32 时间<1ms TTL=128
|
||||
来自 127.0.0.1 的回复: 字节=32 时间<1ms TTL=128
|
||||
来自 127.0.0.1 的回复: 字节=32 时间<1ms TTL=128
|
||||
来自 127.0.0.1 的回复: 字节=32 时间<1ms TTL=128
|
||||
来自 127.0.0.1 的回复: 字节=32 时间<1ms TTL=128
|
||||
|
||||
127.0.0.1 的 Ping 统计信息:
|
||||
数据包: 已发送 = 9,已接收 = 9,丢失 = 0 (0% 丢失),
|
||||
往返行程的估计时间(以毫秒为单位):
|
||||
最短 = 0ms,最长 = 0ms,平均 = 0ms
|
||||
3
readme.md
Normal file
3
readme.md
Normal file
@ -0,0 +1,3 @@
|
||||
# BMC Tool for windows
|
||||
|
||||
一个用于在windows下执行的bat脚本工具
|
||||
5
setting/bmcconf.json
Normal file
5
setting/bmcconf.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"ip": "192.168.100.2",
|
||||
"user": "ADMIN",
|
||||
"pass": "ADMIN"
|
||||
}
|
||||
3
setting/plugin.json
Normal file
3
setting/plugin.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"ZiJin": "disable"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user