Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2752285
  • 博文数量: 587
  • 博客积分: 6356
  • 博客等级: 准将
  • 技术积分: 6410
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-23 10:54
个人简介

器量大者,福泽必厚

文章分类

全部博文(587)

文章存档

2019年(3)

2018年(1)

2017年(29)

2016年(39)

2015年(66)

2014年(117)

2013年(136)

2012年(58)

2011年(34)

2010年(50)

2009年(38)

2008年(16)

分类: LINUX

2013-05-24 15:40:57

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 为该邮箱对应的密码

这样腾讯就不会阻止邮件的发送了!


留为备份!
阅读(1281) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~