HP服務器在線配置ilo地址
阿新 • • 發佈:2018-02-28
ilo HP hpocfg 安裝工具hponcfg
rpm -ivh /share/perdir/chaichuan/ipmi/hponcfg-4.3.0-0.x86_64.rpm
查看幫助 hponcfg ?
192.168.2.145 [/opt] 2015-12-15 16:16:06 root@pts/0 # hponcfg ? HP Lights-Out Online Configuration utility Version 4.2.0 Date 6/10/2013 (c) Hewlett-Packard Company, 2013 Firmware Revision = 1.30 Device type = iLO 4 Driver name = hpilo Error: Syntax Error. USAGE: hponcfg -? hponcfg -h hponcfg -m minFw hponcfg -r [-m minFw ] hponcfg [-a] -w filename [-m minFw] hponcfg -g [-m minFw] hponcfg -f filename [-l filename] [-s namevaluepair] [-v] [-m minFw] hponcfg -i [-l filename] [-s namevaluepair] [-v] [-m minFw] -h, --help Display this message -? Display this message -r, --reset Reset the Management Processor to factory defaults -f, --file Get/Set Management Processor configuration from "filename" -i, --input Get/Set Management Processor configuration from the XML input received through the standard input stream. -w, --writeconfig Write the Management Processor configuration to "filename" -a, --all Capture complete Management Processor configuration to the file. This should be used along with ‘-w‘ option -l, --log Log replies to "filename" -v, --xmlverbose Display all the responses from Management Processor -s, --substitute Substitute variables present in input config file with values specified in "namevaluepairs" -g, --get_hostinfo Get the Host information -m, --minfwlevel Minimum firmware level
HP DL388 gen9
導出ILO普通配置
hponcfg -w /tmp/hp_ilo.xml
導出ILO所有配置
hponcfg -aw /tmp/hp_ilo.xml
修改後導入配置
hponcfg -f /tmp/hp_ilo.xml
HP DL380 gen8
導出ILO普通配置
hponcfg -w /tmp/hp_ilo.xml
導出ILO所有配置
hponcfg [-a] -w /tmp/hp_ilo.xml
修改後導入配置
hponcfg -f /tmp/hp_ilo.xml
other
hponcfg -w /tmp/outpu.xml 導出ILO 配置文件
導入配置
需要刪除用戶信息:
<USER_INFO MODE="write"> <ADD_USER USER_NAME = "user" USER_LOGIN = "user" PASSWORD = "%user_password%"> <ADMIN_PRIV value = "Y"/> <REMOTE_CONS_PRIV value = "Y"/> <RESET_SERVER_PRIV value = "Y"/> <VIRTUAL_MEDIA_PRIV value = "Y"/> <CONFIG_ILO_PRIV value = "Y"/> </ADD_USER> </USER_INFO>
配置ilo腳本參考
#!/bin/bash
## the scripts from chaichuan
dell=$(dmidecode | grep -ci dell)
hp=$(dmidecode |grep -ci hp)
if [[ ${hp} -gt 0 ]]
then
hostip=`bash /share/yunwei/shell/commonapi/get_hostip_01.sh|awk -F ‘168.‘ ‘{print $2}‘`
echo -e "\033[32m ----check hponcfg---- \033[0m"
echo ""
rpm -qa|grep hponcfg
if [ $? != 0 ]
then
echo -e "\033[31m Warning: hponcfg faild \033[0m"
echo ""
echo -e "\033[32m install hponcfg \033[0m"
rpm -ivh /share/perdir/chaichuan/ipmi/hponcfg-4.3.0-0.x86_64.rpm >/dev/null 2>&1
else
echo -e "\033[32m hponcfg is OK! \033[0m"
fi
echo ""
echo -e "\033[32m ----configure ilo---- \033[0m"
echo ""
if [ -f /root/ilo.xml ]
then
rm /root/ilo.xml
/sbin/hponcfg -w /root/ilo.xml >/dev/null 2>&1
else
/sbin/hponcfg -w /root/ilo.xml >/dev/null 2>&1
fi
grep user /root/ilo.xml >/dev/null 2>&1
if [ $? == 0 ]
then
cat << EOF > /root/ilo.xml
<!-- HPONCFG VERSION = "4.3.0" -->
<LOGIN USER_LOGIN="Administrator" PASSWORD="password">
<RIB_INFO MODE="write">
<MOD_NETWORK_SETTINGS>
<IP_ADDRESS VALUE = "172.17.$hostip"/>
<SUBNET_MASK VALUE = "255.255.0.0"/>
<GATEWAY_IP_ADDRESS VALUE = "172.17.0.1"/>
<DHCP_ENABLE VALUE = "N"/>
<DHCP_GATEWAY VALUE = "N"/>
<DHCP_DNS_SERVER VALUE = "N"/>
<DHCP_STATIC_ROUTE VALUE = "N"/>
<DHCP_WINS_SERVER VALUE = "N"/>
</MOD_NETWORK_SETTINGS>
</RIB_INFO>
</LOGIN>
</RIBCL>
EOF
/sbin/hponcfg -f /root/ilo.xml >/dev/null 2>&1
else
cat << EOF > /root/ilo.xml
<!-- HPONCFG VERSION = "4.3.0" -->
<RIBCL VERSION="2.1">
<LOGIN USER_LOGIN="Administrator" PASSWORD="password">
<RIB_INFO MODE="write">
<MOD_NETWORK_SETTINGS>
<IP_ADDRESS VALUE = "172.17.$hostip"/>
<SUBNET_MASK VALUE = "255.255.0.0"/>
<GATEWAY_IP_ADDRESS VALUE = "172.17.0.1"/>
<DHCP_ENABLE VALUE = "N"/>
<DHCP_GATEWAY VALUE = "N"/>
<DHCP_DNS_SERVER VALUE = "N"/>
<DHCP_STATIC_ROUTE VALUE = "N"/>
<DHCP_WINS_SERVER VALUE = "N"/>
</MOD_NETWORK_SETTINGS>
</RIB_INFO>
<USER_INFO MODE="write">
<ADD_USER
USER_NAME = "user"
USER_LOGIN = "user"
PASSWORD = "passwd">
<ADMIN_PRIV value = "Y"/>
<REMOTE_CONS_PRIV value = "Y"/>
<RESET_SERVER_PRIV value = "Y"/>
<VIRTUAL_MEDIA_PRIV value = "Y"/>
<CONFIG_ILO_PRIV value = "Y"/>
</ADD_USER>
</USER_INFO>
</LOGIN>
</RIBCL>
EOF
/sbin/hponcfg -f /root/ilo.xml >/dev/null 2>&1
fi
if [ $? == 0 ]
then
echo ""
echo -e "\033[32m configure is OK! \033[0m"
echo ""
else
echo ""
echo -e "\033[31m configure is error! \033[0m"
echo ""
exit 0
fi
sleep 2
echo ""
echo -e "\033[32m ----check ilo---- \033[0m"
echo ""
rpm -qa|grep -w nc >/dev/null 2>&1
if [ $? != 0 ]
then
yum -y install nc >/dev/null 2>&1
fi
/usr/bin/nc -z -w 3 172.17.$hostip 443
if [ $? != 0 ]
then
echo -e "\033[31m 172.17.$hostip: ilo is error! \033[0m"
echo ""
echo ""
else
echo -e "\033[32m ilo is OK! \033[0m"
echo ""
echo ""
fi
else
exit 0
fi
Ps:/share/yunwei/shell/commonapi/get_hostip_01.sh 腳本內容如下:
echo `/sbin/ip a | grep -E "eth[0-9]$|em[0-9]$|br[0-9]$|bond[0-9]$" |grep "/2" | awk ‘{print $2}‘|awk -F "/" ‘{print $1}‘ | grep 192.168 | awk -F ‘.‘ ‘$3 < 30 {print $0}‘`
HP服務器在線配置ilo地址