mongodb记录如下:
[root@varnish1 ~]# mongo loldbRtmp
MongoDB shell version: 2.4.3
connecting to: loldbRtmp
Server has startup warnings:
Fri May 24 10:27:29.880 [initandlisten]
Fri May 24 10:27:29.880 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Fri May 24 10:27:29.880 [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with --journal).
Fri May 24 10:27:29.880 [initandlisten] ** Note that journaling defaults to off for 32 bit and is currently off.
Fri May 24 10:27:29.880 [initandlisten] ** See
Fri May 24 10:27:29.881 [initandlisten]
> db.serverList.find();
{ "_id" : ObjectId("519ed7e10ca3766ebe3411b0"), "ip" : "192.168.1.2", "port" : "3346", "status" : "1" }
{ "_id" : ObjectId("519ed7e50ca3766ebe3411b1"), "ip" : "192.168.1.3", "port" : "3346", "status" : "1" }
{ "_id" : ObjectId("519ed7e90ca3766ebe3411b2"), "ip" : "192.168.1.4", "port" : "3346", "status" : "1" }
{ "_id" : ObjectId("519ed7ed0ca3766ebe3411b3"), "ip" : "192.168.1.5", "port" : "3346", "status" : "1" }
{ "_id" : ObjectId("519ed7f10ca3766ebe3411b4"), "ip" : "192.168.1.6", "port" : "3346", "status" : "1" }
{ "_id" : ObjectId("519ed7f80ca3766ebe3411b5"), "ip" : "192.168.1.7", "port" : "3346", "status" : "1" }
{ "_id" : ObjectId("519ed8030ca3766ebe3411b6"), "ip" : "192.168.1.8", "port" : "3346", "status" : "1" }
{ "_id" : ObjectId("519ed8060ca3766ebe3411b7"), "ip" : "192.168.1.9", "port" : "3346", "status" : "1" }
脚本如下:
echo "db.serverList.find({},{ip:1,\"_id\":0})" | mongo loldbRtmp | grep ip |/bin/awk -F\" '{ print $4}' >/root/telnetip.txt
>/root/socketerror.txt
for ip in `cat /root/telnetip.txt`
do
telnet $ip $port >/root/telnet.log<
quit
CHECK
conn=`cat /root/telnet.log|grep "Connected"|wc -l`
if [ $conn -ne 1 ] ; then
echo $ip >>/root/socketerror.txt
fi
done
mail -s "socket error" mashouliu@****.com < /root/socketerror.txt
因为通过本地发邮件会被腾讯给阻止掉,不得已修改使用网易的代理来发邮件
修改方法如下:
set from=g****mongodb@163.com smtp=smtp.163.com
set smtp-auth-user=g****mongodb smtp-auth-password=g****z smtp-auth=login
g****mongodb@163.com 为在网易上注册的免费邮箱
g****z 为该邮箱对应的密码
这样腾讯就不会阻止邮件的发送了!
留为备份!
阅读(1326) | 评论(0) | 转发(0) |