收录一下 dell 服务器 idrac 操作常用脚本
显示Raid卡硬盘
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm raid get controllers
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm raid get vdisks
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm raid get pdisks
清理Foreign磁盘状态
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm storage clearconfig:RAID.Integrated.1-1
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm jobqueue create RAID.Integrated.1-1 -s TIME_NOW --realtime
删除vdisk
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.5.14 racadm raid deletevd:Disk.Virtual.0:RAID.Integrated.1-1
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm jobqueue create RAID.Integrated.1-1 -s TIME_NOW --realtime
建立Raid0
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm raid createvd:RAID.Integrated.1-1 -rl r0 -wp wb -rp ra -name raid_0 -pdkey:Disk.Bay.0:Enclosure.Internal.0-1:RAID.Integrated.1-1
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm jobqueue create RAID.Integrated.1-1 -s TIME_NOW --realtime
建立Raid5
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm raid createvd:RAID.Integrated.1-1 -rl r5 -wp wb -rp ra -name raid_5 -pdkey:Disk.Bay.1:Enclosure.Internal.0-1:RAID.Integrated.1-1,Disk.Bay.2:Enclosure.Internal.0-1:RAID.Integrated.1-1,Disk.Bay.3:Enclosure.Internal.0-1:RAID.Integrated.1-1
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm jobqueue create RAID.Integrated.1-1 -s TIME_NOW --realtime
重启服务器
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm serveraction hardreset
设置硬盘第一启动,禁止F1/F2等待
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set BIOS.biosbootsettings.BootSeq HardDisk.List.1-1,NIC.Integrated.1-1-1
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set BIOS.MiscSettings.ErrPrompt Disabled
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.5.16 racadm jobqueue create BIOS.Setup.1-1
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm serveraction hardreset
设置vnc
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.vncserver.enable Enabled
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.vncserver.Password calvin
设置idrac其他用户
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm config -g cfgUserAdmin -o cfgUserAdminUserName -i 4 newuser
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm config -g cfgUserAdmin -o cfgUserAdminPassword -i 4 123456
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm config -g cfgUserAdmin -o cfgUserAdminPrivilege -i 4 0x000001ff
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm config -g cfgUserAdmin -o cfgUserAdminEnable -i 4 1
改掉密码
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm config -g cfgUserAdmin -o cfgUserAdminPassword -i 4 987654
NTP的设置
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.ipv4static.dns1 8.8.8.8
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.ntp1 0.asia.pool.ntp.org
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.ntp2 1.asia.pool.ntp.org
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.ntp3 2.asia.pool.ntp.org
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.ntp1 129.250.35.250
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.ntp2 180.211.88.50
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.ntp3 202.112.29.82
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.NTPEnable Enabled
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.NTPMaxDist 16
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.time.timezone Japan
修改网卡启动为Legacy PXE
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm get nic.nicconfig.1 | grep Legacy
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set nic.nicconfig.1.legacybootproto PXE
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm get nic.nicconfig.1 | grep Legacy
sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm jobqueue create NIC.Integrated.1-1-1
ipmitool -I lanplus -H $ip -U root -P calvin chassis power reset