In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The template used to monitor mongodb settings last year, including the number of mongodb connections, memory, replication latency, and whether to monitor Master. Here are some examples of monitoring graphics.
We also have some triggers, such as whether the mongodb instance is available and whether the roles of the mongodb replica set are switched.
Attached is the template file of mongodb, and the script in the background will be uploaded another day.
Run the script in the background:
#! / 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 Universe Universe') elif [$2 = = "IsMaster"] Then o1room$ (/ 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.3p' | $command_line | sed-n '3p'); 5) port=$5 get_mongo_conn $1 output=$ (/ bin/echo" db.serverStatus (). $2.03.3p' | $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 $outputfi
Attachment: http://down.51cto.com/data/2367256
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.