栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

跨机采集信息

跨机采集信息

写个简单的信息采集脚本,需要ssh免密操作

#!/bin/bash
ip_array=("10.10.1.145" "10.10.2.4")
for ip in ${ip_array[*]}  
do 
ssh -p 36301  root@$ip "echo '存储空间' >> ceshi.log ;df -h >> ceshi.log ;
echo '内存' >> ceshi.log ; free -h >> ceshi.log ;
echo '防火墙' >> ceshi.log ; firewall-cmd --zone=public --list-all >> ceshi.log ;
 echo 'selinux防火墙' >> ceshi.log ; cat /etc/sysconfig/selinux >> ceshi.log ;
 echo 'cpu型号及使用率(idle为空闲率)' >> ceshi.log;iostat -c 2 3 >> ceshi.log ;
 echo 'ulimit连接数' >> ceshi.log; ulimit -a >> ceshi.log; 
 echo '监视文件最大连接数' >> ceshi.log;cat /etc/sysctl.d/99-sysctl.conf|head -n 6 >> ceshi.log;
 echo 'redis最大连接数' >> ceshi.log ; redis-cli config get maxclients >> ceshi.log;
 echo 'redis目前连接数' >> ceshi.log ;redis-cli info | grep connected_clients >> ceshi.log ;
 scp -P 22 ceshi.log root@10.10.1.23:/root/$ip.log ;
 rm -rf ceshi.log ;
 exit"
done
exit`
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/602078.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号