在 Linux 下設定 iDRAC 透過 IPMI

手邊有幾台 Dell PowerEdge 有安裝 iDRAC 卡. 之前每次進去設定都要重新開機. 然後在開機過程中按 Ctrl + E 個別進去設定 iDRAC 的 IP 密碼…等等狀態相當麻煩. 如果我有100台那我就要不停的在等待開機畫面.不停在一直重複設定那些密碼…etc 後來, 我才知道可以透過 IPMI 的方式去管理那個 iDRAC.

在管理 iDRAC 前, 必須在你的 Linux 環境安裝 OpenIPMI, OpenIPMI-tools 和 OpenIPMI-libs 套件.

# yum install -y OpenIPMI

然後要啟動 IPMI 服務.

# chkconfig impi on
# service ipmi start

再來就可以設定 iDRAC 的狀態了, 例如我要設定該機器的 iDRAC 網路資訊並且啟用 IPMI 網路控制

# ipmitool -I open lan set 1 ipaddr 192.168.1.101
# ipmitool -I open lan set 1 defgw ipaddr 192.168.0.1
# ipmitool -I open lan set 1 netmask 255.255.255.0
# ipmitool -I open lan set 1 access on

為了確保 iDARC 不受到未授權的使用者重開你的機器.所以要記得改一下預設的 SNMP community. 設定 null 使用者及 root 的密碼.

設定 SNMP community 字串

# ipmitool -I open lan set 1 snmp TOP_SECRET

設定 null 使用者密碼

# ipmitool -I open lan set 1 password TOP_SECRET

設定 root 密碼

# ipmitool -I open user set password 2 TOP_SECRET

可以用下列指令檢查剛剛設定的值是否正確 :

# ipmitool -I open lan print 1

如果確認無誤, 那你可以到別台伺服器下 IPMI 指令進行管理. 你可以把你 iDRAC 遠端管理的密碼放在環境變數內方便操作. 雖然這樣會比較不安全!

# export IPMI_PASSWORD=”TOP_SECRET”

在下指令的時候可以用 “-E” 選項 就可以直接不打密碼就可以下達指令.

# ipmitool -I lan -U root -E -H 192.168.1.101 chassis power status
Chassis Power is on

如果你要用互動的方式敲密碼就用 “-a” 的方式下指令.

# ipmitool -I lan -U root -a -H 192.168.1.101 chassis power status
Password:
Chassis Power is on

如果你想放在 script 內. 你可以使用 “-P” 的方式加上你的密碼明碼. 就可以下達指令.

# ipmitool -I lan -U root -P “TOP_SECRET” -H 192.168.1.101 chassis power status
Chassis Power is on

再來你就可以用下列指完成開關機

## 開機 – Power On
# ipmitool -I lan -U root -E -H 192.168.1.101 chassis power on
## 強制斷電關機 – Power Off
# ipmitool -I lan -U root -E -H 192.168.1.101 chassis power off
## 透過作業系統正常關機 – Graceful Shutdown
# ipmitool -I lan -U root -E -H 192.168.1.101 chassis power soft
## 重新開機不切斷電源 – Reset System (warm boot)
# ipmitool -I lan -U root -E -H 192.168.1.101 chassis power reset
## 斷電式重新開機 – Power Cycle System (cold boot)
# ipmitool -I lan -U root -E -H 192.168.1.101 chassis power cycle

其他資訊

## 檢查電流瓦特狀態
# ipmitool -I lan -U root -E -H 192.168.1.101 sdr type “Current”
Current | 94h | ok | 10.1 | 2 Amps
Current | 95h | ns | 10.2 | Disabled
System Level | 98h | ok | 7.1 | 245 Watts
## 檢查溫度狀態
# ipmitool -I lan -U root -E -H 192.168.1.101 sdr type “Temperature”
Temp | 01h | ns | 3.1 | Disabled
Temp | 02h | ns | 3.2 | Disabled
Temp | 05h | ns | 10.1 | Disabled
Ambient Temp | 07h | ns | 10.1 | Disabled
Temp | 06h | ns | 10.2 | Disabled
Ambient Temp | 08h | ns | 10.2 | Disabled
Ambient Temp | 0Eh | ok | 7.1 | 16 degrees C
Planar Temp | 0Fh | ns | 7.1 | Disabled
IOH THERMTRIP | 5Dh | ns | 7.1 | Disabled
CPU Temp Interf | 76h | ns | 7.1 | Disabled
Temp | 0Ah | ns | 8.1 | Disabled
Temp | 0Bh | ns | 8.1 | Disabled
Temp | 0Ch | ns | 8.1 | Disabled
## 列出 event logs
# ipmitool -I lan -U root -E -H 192.168.1.101 sel list
1 | 01/11/2011 | 11:40:54 | Temperature #0x0e | Upper Non-critical going high
2 | 01/01/2011 | 12:32:41 | Temperature #0x0e | Upper Critical going high

大致上這樣在搭配程式就可以遠端管理多台機器了.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.