ZabbixMongoDB监控-创新互联

去年监控mongodb设置的模板,包括mongodb连接数,内存,复制延迟,是否Master的监控,下面是一些监控图形示例

创新互联执着的坚持网站建设,微信小程序;我们不会转行,已经持续稳定运营10多年。专业的技术,丰富的成功经验和创作思维,提供一站式互联网解决方案,以客户的口碑塑造品牌,携手广大客户,共同发展进步。

Zabbix MongoDB监控

Zabbix MongoDB监控

Zabbix MongoDB监控

Zabbix MongoDB监控

Zabbix MongoDB监控

Zabbix MongoDB监控

Zabbix MongoDB监控

Zabbix MongoDB监控

我们还有一些触发器,比如mongodb实例是否可用,mongodb副本集的角色是否切换。

附件中是mongodb的模板文件,后台的脚本改日再行上传。

后台运行脚本:

#!/bin/bash ######################################################### #          mongod_stats.sh      # #          written by yanglixue      # #           2015/07/08               # ######################################################### command_line="/opt/mongodb-linux-x86_64-3.0.7/bin/mongo" username_m="admin" password_m="password" username_c="admin" password_c="password"   function get_mongo_conn() {    if [ $1 == "Primary" ];then      username=${username_m}      password=${password_m}    elif [ $1 == "Secondary" ];then      username=${username_m}      password=${password_m}    elif [ $1 == "Config" ];then      username=${username_c}      password=${password_c}    elif [ $1 == "Mongos" ];then      username=${username_c}      password=${password_c}    fi    command_line="${command_line} localhost:$port/admin -u$username -p$password" } case $# in   3)     port=$3         get_mongo_conn $1          if [ $2 == "Repl_lag" ];then        output=$(/bin/echo "db.printSlaveReplicationInfo()" |$command_line|grep "behind the primary" |awk '{print $1}'|sed  's/-//')     elif [ $2 == "IsMaster" ];then        o1=$(/bin/echo "db.isMaster().ismaster" |$command_line|sed -n '3p')        if [ $o1 == "true" ];then           output=1        elif [ $o1 == "false" ];then           output=0        else           output=-1        fi             else        output=$(/bin/echo "db.serverStatus().$2" |$command_line|sed -n '3p')     fi     ;;   4)     port=$4     get_mongo_conn $1     output=$(/bin/echo "db.serverStatus().$2.$3" |$command_line|sed -n '3p')     ;;   5)     port=$5     get_mongo_conn $1     output=$(/bin/echo "db.serverStatus().$2.$3.$4" |$command_line|sed -n '3p')     ;; esac   #check if the output contains "NumberLong" if [[ "$output" =~ "NumberLong"   ]];then   echo $output|sed -n 's/NumberLong(//p'|sed -n 's/)//p' else    echo $output fi

附件:http://down.51cto.com/data/2367256

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


文章名称:ZabbixMongoDB监控-创新互联
网站地址:http://myzitong.com/article/ephjj.html