Here’s a script to check linux hba model name, firmware version:
#!/bin/ksh
for SCSI in `ls -d /sys/class/scsi_host/host*`;
do
[ -e ${SCSI}/modelname ] && echo -n ‘Model Name ‘ && cat ${SCSI}/modelname;
[ -e ${SCSI}/model_name ] && echo -n ‘Model Name ‘ && cat ${SCSI}/model_name;
[ -e ${SCSI}/fwrev ] && echo -n ‘Firmware Version ‘ && cat ${SCSI}/fwrev;
[ -e ${SCSI}/fw_version ] && echo -n ‘Firmware Version ‘ && cat ${SCSI}/fw_version;
done
Also here’s a script for you if you’re checking bunches of servers:
#!/bin/ksh
for SCSI in `ls -d /sys/class/scsi_host/host*`;
do
[ -e ${SCSI}/modelname ] && echo -n ‘Model Name ‘ && cat ${SCSI}/modelname;
[ -e ${SCSI}/model_name ] && echo -n ‘Model Name ‘ && cat ${SCSI}/model_name;
[ -e ${SCSI}/fwrev ] && echo -n ‘Firmware Version ‘ && cat ${SCSI}/fwrev;
[ -e ${SCSI}/fw_version ] && echo -n ‘Firmware Version ‘ && cat ${SCSI}/fw_version;
done
Also here’s a script for you if you’re checking bunches of servers:
#!/bin/ksh
USERNAME=”root”
PASSWORD=”yourpassword”
for i in `cat /home/doxer/servers_list_linux`
do
echo “”>/root/.ssh/known_hosts
expect <spawn ssh -l${USERNAME} -p22 $i “echo -n ‘====’;hostname;cat /sys/class/scsi_host/host*/{modelname,model_name,fwrev,fw_version}”
set timeout 20
expect “*yes*”
send “yes\r”
expect “assword:”
send “${PASSWORD}\r”
expect eof
EOF
done
1 comment:
thanks a lot buddy, very useful :)
Post a Comment