首页 > 代码库 > 显示列表中的xenserver的总内存,可用内存,可用内存比【易读版】

显示列表中的xenserver的总内存,可用内存,可用内存比【易读版】

9==显示列表中的xenserver的总内存,可用内存,可用内存比【易读版】-----------------------
for I in $(
cat <<eof | cat
PTtile
192.168.1.xxx

192.168.1.xxx

eof

);do
{
[ "$I" = "PTtile" ] && echo -e "NameLabel:\t\tIpAddress:\t\tHostName:\t\tMemTotal:\t\tMemFree:\tMemP%:" || ssh $I "
for XX in  \`/opt/xensource/bin/xe host-list params=uuid --minimal|sed ‘s/,/ /g‘\`
do  
IpAddress=\`/opt/xensource/bin/xe host-param-get param-name=address uuid=\$XX\`
NameLabel=\`/opt/xensource/bin/xe host-param-get param-name=name-label uuid=\$XX\`
HostName=\`/opt/xensource/bin/xe host-param-get param-name=hostname uuid=\$XX\`
MemTotal=\`/opt/xensource/bin/xe host-param-get param-name=memory-total uuid=\$XX\`
MemFree=\`/opt/xensource/bin/xe host-param-get param-name=memory-free uuid=\$XX\`
MemTotalG=\$[MemTotal/1024/1024/1022]
MemFreeG=\$[MemFree/1024/1024/1022]
MemP=\$[MemFree*100/MemTotal]
echo -en \$NameLabel:\\\t\$IpAddress:\\\t\\\t\$HostName:\\\t\\\t\$MemTotalG‘G‘\\\t\\\t\$MemFreeG‘G‘\\\t\\\t\$MemP%
echo
done ;
";
}
done

10===显示列表中的xenserver的总内存,可用内存,可用内存比【数字版】
for I in $(
cat <<eof | cat
PTtile
192.168.1.xxx

192.168.1.xxx

eof

);do
{
[ "$I" = "PTtile" ] && echo -e "NameLabel:\t\tIpAddress:\t\tHostName:\t\tMemTotal:\t\tMemFree:\t\tMemP%:" || ssh $I "
for XX in  \`/opt/xensource/bin/xe host-list params=uuid --minimal|sed ‘s/,/ /g‘\`
do  
IpAddress=\`/opt/xensource/bin/xe host-param-get param-name=address uuid=\$XX\`
NameLabel=\`/opt/xensource/bin/xe host-param-get param-name=name-label uuid=\$XX\`
HostName=\`/opt/xensource/bin/xe host-param-get param-name=hostname uuid=\$XX\`
MemTotal=\`/opt/xensource/bin/xe host-param-get param-name=memory-total uuid=\$XX\`
MemFree=\`/opt/xensource/bin/xe host-param-get param-name=memory-free uuid=\$XX\`
MemP=\$[MemFree*100/MemTotal]
echo -en \$NameLabel:\\\t\$IpAddress:\\\t\\\t\$HostName:\\\t\\\t\$MemTotal:\\\t\\\t\$MemFree:\\\t\$MemP:
echo
done ;
";
}
done
---------------------------------------------------------------------------

本文出自 “11416160” 博客,谢绝转载!

显示列表中的xenserver的总内存,可用内存,可用内存比【易读版】