#!/bin/sh
#假设配置文件中提供的IP已经设置了免密登录,如果没有的话就根据配置文件中的IP和密码设置一下。;#IP配置文件的格式为 IP地址 密码#免密登录设置: #ssh-keygen -t rsa ssh-copy-id -i ~/.ssh/id_rsa.pub 208.208.131.200export TOP_PATH=
(
p
w
d
)
C
O
N
F
I
G
=
(pwd)CONFIG=
(pwd)CONFIG={TOP_PATH}/ipsys.config #IP配置文件OUTPUT=KaTeX parse error: Expected 'EOF', got '#' at position 27: …output.ini #̲输出文件OUTCSV={TOP_PATH}/output.csvwhile read -r linedo IPaddr="echo $line | awk {'print $1'}
" echo -n "${IPaddr} " >>
O
U
T
P
U
T
e
c
h
o
−
n
"
‘
s
s
h
−
n
r
o
o
t
@
{OUTPUT} echo -n "`ssh -n root@
OUTPUTecho−n"‘ssh−nroot@{IPaddr} "cat /etc/hostname"" >> ${OUTPUT} echo -n "
ssh -n root@${IPaddr} "cat /proc/cpuinfo |grep name | uniq | cut -f2 -d:"" >> ${OUTPUT} #型号 echo -n "
ssh -n root@${IPaddr} "cat /proc/cpuinfo |grep MHz | uniq | cut -f2 -d:"" >> ${OUTPUT} #主频 echo -n "
ssh -n root@${IPaddr} "cat /proc/cpuinfo | grep cores | uniq | cut -f2 -d:"" >> ${OUTPUT} #核数 echo -n "
ssh -n root@${IPaddr} "cat /proc/meminfo | grep MemTotal | cut -f2 -d:"" >> ${OUTPUT} #内存大小 echo -n "
ssh -n root@${IPaddr} “df -h / | grep /dev"" | awk {'print $1'} >> ${OUTPUT} #磁盘名 echo "
ssh -n root@${IPaddr} “df -h / | grep /dev”`” | awk {‘print $2’} >> ${OUTPUT} #磁盘大小done < ${CONFIG}cat KaTeX parse error: Undefined control sequence: \t at position 30: …"[[:space:]]" "\̲t̲" >{OUTCSV} #转换为.csv文件