说明:
1、脚本在VIO SERVER上执行
2、VIO SERVER上要先安装expect,用于管理所有的VIO CLIENT
3、VIO SERVER上要先安装ssh,用于访问HMC,并获得所有VIO CLIENT的IP列表
4、HMC要配置一下,以便VIO SERVER通过ssh方式访问时,不需输入密码
5、lparmon v2主程序位于WINDOWS机器上,要起TFTP服务,用于所有的VIO CLIENT从这里安装lparmon v2的agent
cat <<'!!' > inst_agent
#!/usr/bin/expect -f
set timeout -1
spawn $env(SHELL)
match_max 100000
expect -exact "#"
send -- "telnet [lindex $argv 0]\r"
expect -exact "login:"
send -- "root\r"
expect -exact "Password:"
send -- "root\r"
expect -exact "#"
send -- "cat <<'!' > /etc/rc.d/rc2.d/Src.local\r"
expect -exact "c"
send -- "/usr/bin/lparmon\r"
send -- "!\r"
expect -exact "#"
send -- "chmod 555 /etc/rc.d/rc2.d/Src.local"
send -- "\r"
expect -exact "#"
send -- "cat <<'!' > /etc/rc.d/rc2.d/Krc.local\r"
expect -exact "c"
send -- "hostname | grep -q VIOS\r"
send -- " if \[ \$? == 0 \] \r"
send -- " then\r"
send -- " exit\r"
send -- " else \r"
send -- " for i in `lspv |awk '{print \$1}'`; do chdev -l \$i -a hcheck_interval=60 -a hcheck_mode=nonactive -P; done\r"
send -- " fi\r"
send -- "!"
send -- "\r"
expect -exact "#"
send -- "chmod 555 /etc/rc.d/rc2.d/Krc.local"
send -- "\r"
expect -exact "#"
send -- "tftp -o /bin/lparmon 99.1.70.94 lparmon_v2_aix5`uname -r` image\r"
send -- "chmod +x /bin/lparmon\r"
send -- "/bin/lparmon\r"
send -- "exit\r"
send -- "exit\r"
expect eof
!!
chmod +x inst_agent
for i in `ssh "lspartition -dlpar" | awk -F[\ \>] '/99.1/ {print $(NF-1)}'`; do
echo ./inst_agent $i
done
for i in `ssh "lspartition -dlpar" | awk -F[\ \>] '/99.1/ {print $(NF-1)}'`; do
echo ./inst_agent $i
done
阅读(803) | 评论(0) | 转发(0) |