监控服务器连通性的shell脚本
下面这个脚本是用来监控全国各个机房哪些服务器无法与其相应的日志备份服务器相联通。假设每个机房有300台应用服务器,对应一台大容量的日志备份服务器。 这是我最近根据需要写的一个监控脚本,大家可以不必知道这个脚步的具体功能,只需要掌握其中的一些技巧就可以了。#!/bin/bash #Finding out the IP which logserver cannot connected from the ip list(locates:/home/list) inlogserver.
#Written on xxxx.
#Author:Levin.
trap 'echo;exit 0' 2 15
IP=`cat /home/admin/IP.logserver`
list=/home/list
for i in $IP
do
ip=`echo $i|awk -F'--->' '{print $2}'`
echo $i
ssh$ip "cd /home/admin/
cat > testconnect.sh
页:
[1]