PDU (Power Distribution Unit) 機櫃式電源分配器.
我參考了使用手冊 MLAN-9F8QVU_R7_EN.pdf,該文件有 172 頁,整理一下怎麼快速入門使用它.
首先須將序列埠與網路先連接上.
- RJ-12 Serial Port(10) – 預設為 9600 bps, 8 data bits, no parity, 1 stop bit, 以及 no flow control.
- 10/100 Base-T Connector(11) – 預設為 DHCP.
要如何確認目前 PDU 的 IP ,可以透過以下的方式.
- PDU 顯示器(1)
在選單選擇 Network / IPV4 Address (預設使用 DHCP 來獲取 IP),如果沒有可以透過 RJ-12 Serial Port 來檢查一下. - RJ-12 Serial Port(10)
預設的 super user 帳號,密碼為 apc , pacUser Name : apc Password : xxx Schneider Electric Network Management Card AOS vx.x.x (c) Copyright 2018 All Rights Reserved RPDU 2g vx.x.x -------------------------------------------------------------------------- Name : xxxxxxxx Date : 5/30/2018 Contact : xxxxxxxxx Time : 5:58:30 Location : xxxxxxxxxx User : Administrator Up Time : 0 Days, 21 Hours, 21 Minutes Stat : P+ N4+ N6+ A+ Type ? For command listing Use tcpip for IP address (-i), subnet (-s), and gateway (-g) apc> tcpip E000: Success Active IPv4 Settings --------------------- Active IP Address: 172.16.0.96 Active Subnet Mask: 255.255.255.0 Active Gateway: 172.16.0.254 Manually Configured IPv4 Settings --------------------------------- IPv4: enabled Manual Settings: disabled IP Address: 0.0.0.0 Subnet Mask: 0.0.0.0 Gateway: 0.0.0.0 MAC Address: XX XX XX XX XX XX Domain Name: example.com Host Name: HostName
可以設定固定 (Static) IP
-i 設定 IP
apc> tcpip -i 172.16.0.6 E002: Success Reboot required for change to take effect. *Reboot required for change to take effect.
-s 設定 Subnet Mask (子網路遮罩)
apc> tcpip -s 255.255.255.0 E002: Success Reboot required for change to take effect. *Reboot required for change to take effect.
-g 設定 Gateway (閘道器)
apc> tcpip -g 172.16.0.254 E002: Success Reboot required for change to take effect. *Reboot required for change to take effect.
設定好需要重啟 PDU (指令 reboot) 才會生效.
apc> reboot E000: Success Reboot Management Interface Enter 'YES' or ‘Y’ to continue or <ENTER> to cancel : YES Rebooting... apc>
User Name : apc Password : xxx Schneider Electric Network Management Card AOS vx.x.x (c) Copyright 2018 All Rights Reserved RPDU 2g vx.x.x -------------------------------------------------------------------------- Name : xxxxxxxx Date : 5/30/2018 Contact : xxxxxxxxx Time : 5:58:30 Location : xxxxxxxxxx User : Administrator Up Time : 0 Days, 0 Hours, 2 Minutes Stat : P+ N4+ N6+ A+ Type ? For command listing Use tcpip for IP address (-i), subnet (-s), and gateway (-g) apc> tcpip E000: Success Active IPv4 Settings --------------------- Active IP Address: 172.16.0.6 Active Subnet Mask: 255.255.255.0 Active Gateway: 172.16.0.254 Manually Configured IPv4 Settings --------------------------------- IPv4: enabled Manual Settings: enabled IP Address: 172.16.0.6 Subnet Mask: 255.255.255.0 Gateway: 172.16.0.254 MAC Address: XX XX XX XX XX XX Domain Name: example.com Host Name: HostName
可以利用 ping 來確認使否跟網路其他 IP 互通.
apc> ping 172.16.0.2 Replay from 172.16.0.2: time(ms)= <10 Replay from 172.16.0.2: time(ms)= <10 Replay from 172.16.0.2: time(ms)= <10 Replay from 172.16.0.2: time(ms)= <10
IP 確認後就可以透過 web 的方式來檢視 APC 狀態,http 預設是開啟的,可以在 CLI (Command Line) 下可用指令 web 來確認.
apc> web E000: Success HttP: enabled Https: disabled Http Port: 80 Https Port: 443 Minimum Protocol: TLS1.1
或是透過 telnet(開啟) 或是 SSH(關閉) ,需要透過 console 指令來設定
apc> console E000: Success Telnet: enabled SSH: disabled Telnet Port: 23 SSH Port: 22 Baud Rate: 9600
可以把 SSH 連線功能打開,PDU 需重新開機才會生效.
apc> console -s enable E002: Success Reboot required for change to take effect. *Reboot required for change to take effect.
設定好需要重啟 PDU (指令 reboot) 才會生效.
apc> reboot E000: Success Reboot Management Interface Enter 'YES' or ‘Y’ to continue or <ENTER> to cancel : YES Rebooting... apc>
怎麼透過遠端將連接到 APC PDU 機櫃式電源分配器的伺服器關閉(立即或是延遲)呢!可以透過下面幾種方式.
- RJ-12 Serial Port Port , Telnet , SSH
與電源相關指令,有分 立即或是延遲 兩種
立即- olOn – Turn on an outlet or group of outlets without any delay.
- olOff – Turn off an outlet or group of outlets without any delay.
- olReboot – Cycle power to an outlet or group of outlets without any delays.
延遲
須先設定延遲 (Delay) 時間.- olOffDelay – Set or view the time delay for the Off Delayed command
- olOnDelay – Set or view the time delay for the On Delayed command
設定完延遲時間後,下面的指令會依據指定的時間來開關機.
- olDlyOff – Turns off an outlet or group of outlets after the Power Off Delay
- olDlyOn – Turns on an outlet or group of outlets after the Power On Delay
- olDlyReboot – Cycles power to an outlet or a group of outlets. The specified outlets will be turned off based on the configured Power Off Delay (指令 olOffDelay). After the longest Reboot Duration of the selected outlets, the outlets will then begin to turn on based on the configured Power On Delays (指令 olOnDelay) set for the specified outlets.
更多指令參考請搜尋 MLAN-9F8QVU_R7_EN.pdf 說明.
- 10/100 Base-T Connector (Web)
透過 Web 介面在 Control / RPDU / Outlet ,就可以針對不同的 Outlet 來開關機. - 10/100 Base-T Connector(SNMP)
APC 有支援 SNMP ,至於要怎麼透過 SNMP 控制 PDU ,可以先了解一下什麼是 SNMP – https://benjr.tw/8266 預設 SNMP 唯讀 (Read) community (功能類似 user id 或是 password 之類的意思) 為 public,可供讀寫 (read/write) community 為 private .
APC 的 OIDs 定義如下.iso(1).org(3).dod(6).internet(1).private(4).enterprises(1).apc(318).products(1).hardware(1).rPDU2(26)
詳細 OID 請查詢 – http://www.oidview.com/mibs/318/PowerNet-MIB.html ,以下是幾個常用透過 snmp 讀取 OID 的資料.
- Power KW
# snmpget -v 1 -c private 172.16.0.6 1.3.6.1.4.1.318.1.1.12.1.16.0
- Power Peak KW
# snmpget -v 1 -c private 172.16.0.6 1.3.6.1.4.1.318.1.1.26.4.3.1.6.1
- Energy KWh
# snmpget -v 1 -c private 172.16.0.6 1.3.6.1.4.1.318.1.1.26.4.3.1.9.1
- Phase Amp Load
# snmpget -v 1 -c private 172.16.0.6 1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1
- Phase Amp Peak Load
# snmpget -v 1 -c private 172.16.0.6 1.3.6.1.4.1.318.1.1.26.6.3.1.10.1
- Bank B1 Amp Load
# snmpget -v 1 -c private 172.16.0.6 1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.2
- Bank B2 Amp Load
# snmpget -v 1 -c private 172.16.0.6 1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.3
- Bank B1 Amp Peak Load
# snmpget -v 1 -c private 172.16.0.6 1.3.6.1.4.1.318.1.1.26.8.3.1.6.1
- Bank B2 Amp Peak Load
# snmpget -v 1 -c private 172.16.0.6 1.3.6.1.4.1.318.1.1.26.8.3.1.6.2
也可以透過 指令 snmpwalk 做查詢,後面接的字串可以是不完整的,如果是空的會透過 GETNEXT 把設備上的資訊一一輪詢出來.
[root@localhost ~]# snmpwalk -Of -v 2c -c public 172.16.0.6
參數說明:
- -Os : 顯示方式(Output) MIB object name (plus any instance 或 other subidentifiers),其它方式請 man snmpcmd 查詢.或是
- -Of : Include the full list of MIB objects.
- -On : Displays the OID numerically.
- -v: SNMP 版本,從 1 , 2c 到 3.
- -c community : SNMPv1/v2c 傳輸時需要設定 community string (類似 user id 或是 password 之類的意思) , 很多設備預設為 public.
- Power KW
- fence_apc
網友 Terry 建議可以使用 Linux 下的指令 fence_apc.[root@localhost ~]# yum install fence-agents-apc
檢視 APC PDU 目前狀態.
[root@localhost ~]# fence_apc -a 172.16.0.6 -l apc -p apc -o list-status | sort 10,Outlet 10,Off 11,Outlet 11,Off 12,Outlet 12,On 13,Outlet 13,On 14,Outlet 14,On 15,Outlet 15,On 16,Outlet 16,On 17,Outlet 17,On 18,Outlet 18,On 19,Outlet 19,On 1,Outlet 1,On 20,Outlet 20,On 21,Outlet 21,On 22,Outlet 22,On 23,Outlet 23,On 24,Outlet 24,On 2,Outlet 2,On 3,Outlet 3,On 4,Outlet 4,On 5,Outlet 5,On 6,Outlet 6,On 7,Outlet 7,On 8,Outlet 8,On 9,Outlet 9,On
參數:
- -a, –ip=<ip>
IP Address or Hostname This parameter is always required. - -l, –username=<name>
Login Name This parameter is always required. - -p, –password=<password>
Login password or passphrase - -o, –action=<action>
Fencing Action (Default Value: reboot),可用控制指令 on , off , reoot , status , list ,list-status , monitor , metadata , manpage , validate-all ,詳細說請使用 #man fence_apc
如果是要針對單一埠來操作,可以透過參數 -n .
[root@localhost ~]# fence_apc -a 172.16.0.6 -l apc -p apc -n 1 -o status Status: ON
- -n, –plug=<id>
Physical plug number or name of virtual machine This parameter is always required.
- -a, –ip=<ip>
詳細使用請參考 – http://www.serverspace.co.uk/blog/using-snmp-control-remote-apc-pdus
部分 APC OID 資料 – http://www.apc.com/us/en/faqs/FA156179/
CentOS 可以用這個套件 fence-agents-apc.x86_64 遠端控制APC PDU 插座
# fence_apc -a $PDU_IP -l apc -p apc -n $PDU_PLUG -o on
# fence_apc -a $PDU_IP -l apc -p apc -n $PDU_PLUG -o off
# fence_apc -a $PDU_IP -l apc -p apc -n $PDU_PLUG -o status
以上提供大家參考
感謝你,蠻好用的.