01.经过检查出现错误的服务器的编码格式是gb18030,正常的都是utf-8
02.所以出现错误的原因在于服务器gb18030的编码格式
03.有趣的地方在于不是所有命令都会出现故障,只是“iostat”这个命令才会报错
04.到现在我都找不到解决错误的方法,所以我只好跳过。
05.那个服务器不常用,直接删除不巡检应该可以,因为至从写脚本后手动访问堡垒机感觉好麻烦
06.如果有人能解决这个问题可以私信找一下我
def comand2txt_loop(
ip,
port,
account,
pwd,
fwq_search_name,
fwq_command,
fwq_name,
fwq_pre_txt_address):
fwq_imf=[]
for ip_imf in zip(fwq_search_name,fwq_name):
for command in fwq_command:
fwq_imf.insert(0,ip)
fwq_imf.insert(1,port)
fwq_imf.insert(2,account)
fwq_imf.insert(3,pwd)
fwq_imf.insert(4,ip_imf[0])
fwq_imf.insert(5,command)
fwq_imf.insert(6,fwq_pre_txt_address+ip_imf[1]+"-"+str(fwq_command.index(command))+".txt")
print(fwq_imf[4]+" "+fwq_imf[5]+" "+fwq_imf[6])
if fwq_imf[4]=='应用服务器01' and fwq_imf[5]== 'iostat':
continue
# comand2gb18030="iostat"
# comand2txt_test(fwq_imf[0],fwq_imf[1],fwq_imf[2],fwq_imf[3],fwq_imf[4],comand2gb18030,fwq_imf[6])
else:
comand2txt_test(fwq_imf[0],fwq_imf[1],fwq_imf[2],fwq_imf[3],fwq_imf[4],fwq_imf[5],fwq_imf[6])