物理サーバを管理・運用する際、ベンダーによって呼称は異なると思うが、マネジメントポート(管理ポートとか)は便利に使うことも多いだろう。
ただ、台数が多いといちいちWebコンソールからアクセスしてるのは面倒臭い。コマンドでできる内容ならそちらから作業したほうがいいだろう。
そんなときに非常に役に立つのが、IPMI(システムボードを管理しているBMCという処理装置を操作するための規格)を扱うためのコマンド「ipmitool」コマンドだ。
これがあれば、マネジメントポートで行える操作の大半はコマンドから行える(さすがにリモートKVM機能でWindowsとかのGUI操作は無理だけど)。
今回は、このipmitoolで最低限覚えておきたい使い方を抜粋して記述する(機能が多すぎて全部はちょっと。。。そもそもそんなに機能使わないだろうし)。
1.ローカルの物理サーバへの操作を行う
ローカル(ipmitoolを実行しているOS自身が乗っている物理サーバ)のBMCを操作する場合は、普通にipmitoolをホストやID/PW無しで実行してやれば良い。
ipmitool サブコマンド ...
2.リモートの物理サーバへの操作を行う
リモートの物理サーバへ操作を行う(BMCに設定されているIPアドレス等を元に接続して操作する)場合は、対象のホストやIPMI操作用ユーザのID/PWを指定して接続する。
ipmitool -H IPアドレス -U ユーザ名 -P パスワード サブコマンド ...
3.電源を操作する
IPMI経由でサーバの電源をON/OFFしたり、起動しているかどうかを確認する場合は、サブコマンド「power」を用いると良いだろう。
電源の状態を確認する
ipmitool -H IPアドレス -U admin -P パスワード power status
電源をONにする
ipmitool -H IPアドレス -U admin -P パスワード power on
電源をOFFにする
ipmitool -H IPアドレス -U admin -P パスワード power off
電源をリセットする
ipmitool -H IPアドレス -U admin -P パスワード power reset
ACPI経由でソフトウェアレベルのシャットダウンを行う
ipmitool -H IPアドレス -U admin -P パスワード power soft
NMIをプロセッサに送信する
ipmitool -H IPアドレス -U admin -P パスワード power diag
1秒間隔を開けて電源オフ、オンを実行する
ipmitool -H IPアドレス -U admin -P パスワード power cycle
4.BMCのネットワーク情報の取得・設定
BMCのネットワーク情報を取得したり、IPアドレス等を設定することができる。
個人的には、IPアドレスを設定し忘れたからローカルから設定したり、IPアドレスを忘れたのでローカルから確認したりといった使い方が主だろうか。
channelは環境によって異なるが、だいたい2が使用されていることが多い気がする。
ネットワーク情報を取得する
ipmitool -H IPアドレス -U admin -P パスワード lan print <channel>
[root@BS-PUB-CENT7-01 ~]# ipmitool -H 172.XXX.XXX.XXX -U admin -P XXXXXX lan print 2 Set in Progress : Set Complete Auth Type Support : NONE MD5 PASSWORD Auth Type Enable : Callback : NONE MD5 PASSWORD : User : NONE MD5 PASSWORD : Operator : NONE MD5 PASSWORD : Admin : NONE MD5 PASSWORD : OEM : NONE MD5 PASSWORD IP Address Source : BIOS Assigned Address IP Address : 172.XXX.XXX.XXX Subnet Mask : 255.255.255.0 MAC Address : 00:22:4d:37:78:6b SNMP Community String : public IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10 Default Gateway IP : 172.XXX.XXX.1 802.1q VLAN ID : Disabled 802.1q VLAN Priority : 0 RMCP+ Cipher Suites : 0,1,2,3 Cipher Suite Priv Max : OOOOXXXXXXXXXXX : X=Cipher Suite Unused : c=CALLBACK : u=USER : o=OPERATOR : a=ADMIN : O=OEM
ネットワーク情報を設定する(DHCP)
ipmitool lan set <channel> ipsrc dhcp
ネットワーク情報を設定する(固定IP)
ipmitool lan set <channel> ipsrc static ipmitool lan set <channel> ipaddr IPアドレス ipmitool lan set <channel> netmask ネットマスク ipmitool lan set <channel> defgw ipaddr デフォルトゲートウェイ
5.各種センサーの情報を取得する
IPMIでは、各種センサー(ファンや各コンポーネントの温度など)の情報を取得することもできる。
各種センサー情報を一覧で取得する
ipmitool -H IPアドレス -U admin -P パスワード sdr list
[root@BS-PUB-CENT7-01 ~]# ipmitool -H 172.XXX.XXX.XXX -U admin -P XXXXXX sdr list Ambient | 24.50 degrees C | ok Systemboard 1 | 31 degrees C | ok Systemboard 2 | 31 degrees C | ok Systemboard 3 | 44 degrees C | ok CPU | no reading | ns DIMM-1A | no reading | ns DIMM-2A | no reading | ns DIMM-1B | no reading | ns DIMM-2B | no reading | ns Temp1 PSU | no reading | ns Temp2 PSU | no reading | ns Temp3 PSU | no reading | ns BATT 3.0V | no reading | ns STBY 5V | 4.95 Volts | ok iRMC 3.3V STBY | 3.30 Volts | ok iRMC 1.2V STBY | 1.19 Volts | ok LAN 1.05V STBY | 1.07 Volts | ok MAIN 12V | no reading | ns MAIN 5V | no reading | ns MAIN 3.3V | no reading | ns PCH 1.05V | no reading | ns MEM 1.5V | no reading | ns SFR 1.8V | no reading | ns FAN1 SYS | no reading | ns FAN2 SYS | no reading | ns FAN3 SYS | no reading | ns FAN4 SYS | no reading | ns FAN5 SYS | no reading | ns FAN1 PSU | no reading | ns FAN2 PSU | no reading | ns Total Power | 13.20 Watts | ok I2C1 error ratio | 0 percent | ok I2C2 error ratio | 0 percent | ok I2C3 error ratio | 0 percent | ok I2C4 error ratio | 0 percent | ok I2C5 error ratio | 0 percent | ok I2C6 error ratio | 0 percent | ok SEL Level | 0 percent | ok Ambient | 0x01 | ok CPU | 0x00 | ok DIMM-1A | 0x00 | ok DIMM-1A | 0x00 | ok DIMM-2A | 0x00 | ok DIMM-2A | 0x00 | ok DIMM-1B | 0x00 | ok DIMM-1B | 0x00 | ok DIMM-2B | 0x00 | ok DIMM-2B | 0x00 | ok PSU | Not Readable | ns PSU | 0x02 | ok Power Level | 0x03 | ok FAN1 SYS | Not Readable | ns FAN2 SYS | Not Readable | ns FAN3 SYS | Not Readable | ns FAN4 SYS | Not Readable | ns FAN5 SYS | Not Readable | ns FAN1 PSU | Not Readable | ns FAN2 PSU | Not Readable | ns Watchdog | 0x00 | ok CPU detection | 0x01 | ok iRMC request | 0x00 | ok I2C1 | 0x00 | ok I2C2 | 0x00 | ok I2C3 | 0x00 | ok I2C4 | 0x00 | ok I2C5 | 0x00 | ok I2C6 | 0x00 | ok Config backup | 0x00 | ok Power Level | 0x03 | ok Total Power | 0x00 | ok System Mgmt SW | Not Readable | ns Local Monitor | 0x01 | ok Pwr Btn override | 0x00 | ok NMI | 0x00 | ok System BIOS | Not Readable | ns iRMC | Not Readable | ns
温度やCPUのセンサー情報など、タイプを指定して値を取得する
ipmitool -H IPアドレス -U admin -P パスワード sdr type 'タイプ名'
[root@BS-PUB-CENT7-01 ~]# ipmitool -H 172.XXX.XXX.XXX -U admin -P XXXXXX sdr type Sensor Types: Temperature (0x01) Voltage (0x02) Current (0x03) Fan (0x04) Physical Security (0x05) Platform Security (0x06) Processor (0x07) Power Supply (0x08) Power Unit (0x09) Cooling Device (0x0a) Other (0x0b) Memory (0x0c) Drive Slot / Bay (0x0d) POST Memory Resize (0x0e) System Firmwares (0x0f) Event Logging Disabled (0x10) Watchdog1 (0x11) System Event (0x12) Critical Interrupt (0x13) Button (0x14) Module / Board (0x15) Microcontroller (0x16) Add-in Card (0x17) Chassis (0x18) Chip Set (0x19) Other FRU (0x1a) Cable / Interconnect (0x1b) Terminator (0x1c) System Boot Initiated (0x1d) Boot Error (0x1e) OS Boot (0x1f) OS Critical Stop (0x20) Slot / Connector (0x21) System ACPI Power State (0x22) Watchdog2 (0x23) Platform Alert (0x24) Entity Presence (0x25) Monitor ASIC (0x26) LAN (0x27) Management Subsys Health (0x28) Battery (0x29) Session Audit (0x2a) Version Change (0x2b) FRU State (0x2c) [root@BS-PUB-CENT7-01 ~]# ipmitool -H 172.XXX.XXX.XXX -U admin -P XXXXXX sdr type Processor CPU | 28h | ok | 3.0 | Presence detected [root@BS-PUB-CENT7-01 ~]# ipmitool -H 172.XXX.XXX.XXX -U admin -P XXXXXX sdr type Temperature Ambient | 01h | ok | 39.0 | 24.50 degrees C Systemboard 1 | 02h | ok | 7.0 | 32 degrees C Systemboard 2 | 03h | ok | 7.1 | 31 degrees C Systemboard 3 | 04h | ok | 7.2 | 44 degrees C CPU | 05h | ns | 3.0 | No Reading DIMM-1A | 06h | ns | 32.0 | No Reading DIMM-2A | 07h | ns | 32.1 | No Reading DIMM-1B | 08h | ns | 32.2 | No Reading DIMM-2B | 09h | ns | 32.3 | No Reading Temp1 PSU | 0Ah | ns | 10.0 | No Reading Temp2 PSU | 0Bh | ns | 10.1 | No Reading Temp3 PSU | 0Ch | ns | 10.2 | No Reading Ambient | 27h | ok | 39.0 | Device Present
6.各種ハードウェアの情報取得・操作をする
ipmitoolでは、ハードウェアベンダーの情報やメンテナンスLEDライトの点灯・消灯など、各種ハードウェアの情報を取得したり操作を行うことも可能となっている。
システムボードのシリアルナンバーなども取得できるので、Kickstartなどを利用したOSの自動インストール時において固定IPアドレスを割り振ったりする際に役に立つだろう。
シリアルナンバーや筐体のモデル名、ベンダーなどのハードウェア情報を取得する
ipmitool -H IPアドレス -U admin -P パスワード fru print
[root@BS-PUB-CENT7-01 ~]# ipmitool -H 172.XXX.XXX.XXX -U admin -P XXXXXX fru print FRU Device Description : Builtin FRU Device (ID 0) Device not present (Requested sensor, data, or record not found) FRU Device Description : Chassis (ID 2) Chassis Type : Rack Mount Chassis Chassis Part Number : 340781700003 Chassis Serial : SM024S14817 Chassis Extra : RX100S6R2 Product Manufacturer : FUJITSU Product Name : PRIMERGY RX100 S6 Product Part Number : S26361-K1264-Vxxx Product Version : GS05 Product Serial : MA1A004737 Product Asset Tag : 15 Product Extra : 56fc73 Product Extra : 0245 FRU Device Description : MainBoard (ID 3) Board Mfg Date : Fri Jun 11 01:42:00 2010 Board Mfg : FUJITSU Board Product : D2863 Board Serial : RM2E-P02BD4 Board Part Number : S26361-D2863-A10 Board Extra : WGS01 GS04 Board Extra : 02 FRU Device Description : PSU (ID 5) Board Mfg Date : Wed Apr 7 18:42:00 2010 Board Mfg : DELTA Board Product : DPS-350YB A Board Serial : CLUD1014012688 Board Part Number : A3C40102750 Board Extra : 01F Board Extra : 08 FRU Device Description : HDD-BP (ID 7) Device not present (Command response could not be provided)
現在のシステム状態(Power ON/OFFなど)を一括で取得する
ipmitool -H IPアドレス -U admin -P パスワード chassis status
[root@BS-PUB-CENT7-01 ~]# ipmitool -H 172.XXX.XXX.XXX -U admin -P XXXXXX chassis status System Power : off Power Overload : false Power Interlock : inactive Main Power Fault : false Power Control Fault : false Power Restore Policy : previous Last Power Event : Chassis Intrusion : inactive Front-Panel Lockout : inactive Drive Fault : false Cooling/Fan Fault : false Sleep Button Disable : allowed Diag Button Disable : allowed Reset Button Disable : allowed Power Button Disable : allowed Sleep Button Disabled: false Diag Button Disabled : false Reset Button Disabled: false Power Button Disabled: false
通電時間を取得する
ipmitool -H IPアドレス -U admin -P パスワード chassis poh
[root@BS-PUB-CENT7-01 ~]# ipmitool -H 172.20.100.17 -U admin -P admin chassis poh POH Counter : 1095 days, 1 hours, 40 minutes
識別用LEDライトを指定した秒数だけ点灯させる
ipmitool -H IPアドレス -U admin -P パスワード chassis identify <秒数(デフォルトは15秒)>
前回サーバが再起動された原因を確認する
ipmitool -H IPアドレス -U admin -P パスワード chassis restart_cause
[root@BS-PUB-CENT7-01 ~]# ipmitool -H 172.XXX.XXX.XXX -U admin -P XXXXXX chassis restart_cause System restart cause: chassis power control command
通電が行われた際(停電から復旧した際)の電源ポリシーを設定する
ipmitool -H IPアドレス -U admin -P パスワード chassis policy <ポリシー>
設定できるポリシーは以下
- always-on :電源復旧したら常に起動する
- previous :電源復旧したら停電前の状態に戻す
- always-off :電源復旧しても起動しない
次回再起動時のブートデバイスを指定する
ipmitool -H IPアドレス -U admin -P パスワード chassis bootdev <デバイス>
[root@BS-PUB-CENT7-01 ~]# ipmitool -H 172.XXX.XXX.XXX -U admin -P XXXXXX chassis bootdev bootdev [clear-cmos=yes|no] bootdev [options=help,...] none : Do not change boot device order pxe : Force PXE boot disk : Force boot from default Hard-drive safe : Force boot from default Hard-drive, request Safe Mode diag : Force boot from Diagnostic Partition cdrom : Force boot from CD/DVD bios : Force boot into BIOS Setup floppy: Force boot from Floppy/primary removable media
7.SOL(Serial Over LAN)を使ってシリアル接続を行う
SOL(Serial Over LAN)を使ってシリアル接続を行うことで、コンソールからBIOSの設定やシリアル接続対応しているOSの操作を行うことができる。
ipmitool -I lanplus -H IPアドレス -U admin -P パスワード sol activate
8.ユーザを管理する
IPMIで利用するユーザを追加・削除したり、パスワードを変更したりする。
ユーザ一覧を取得する
ipmitool -I lanplus -H IPアドレス -U admin -P パスワード user list
ユーザ情報を取得する
ipmitool -I lanplus -H IPアドレス -U admin -P パスワード user summary
ユーザのパスワードを設定する
ipmitool -I lanplus -H IPアドレス -U admin -P パスワード user set password <ユーザID> [<パスワード>]
