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--
This article mainly introduces the configuration of zabbix monitoring mongodb.
Zabbix monitoring mongodb needs to be monitored by a custom script, which can pass in multiple parameters.
Principle: through the mongodb client connection command, filter out the information output by db.serverStatus ().
First, create a monitoring data collection script
1. Content of the script:
# cat checkboxes mongodb.shatter raceme # mongodb status# db.serverStatus (). Ok# memory status# Physical memory: db.serverStatus (). Mem.resident# Virtual memory: db.serverStatus (). Mem.virtual# opcounters status# insert: db.serverStatus (). Opcounters.insert# query: db.serverStatus (). Opcounters.query# update: db.serverStatus (). Opcounters.update# delete: db.serverStatus (). Opcounters.delete# connections status# current connections: db.serverStatus (). Connections. CurrentMONGODBPATH= "/ usr/local/mongodb3.2.1/bin/mongo" HOST= "127.0.0.1" PORT= "$1" MONGODB_PA= "$MONGODBPATH ${HOST}: ${PORT}" if [$# = = 3] Then result=$ (/ bin/echo "db.serverStatus (). $2.room3" | $MONGODBPATH ${HOST}: ${PORT}-- quiet) echo $resultelif [$# = = 2]; then result=$ (/ bin/echo "db.serverStatus (). $2" | $MONGODBPATH ${HOST}: ${PORT}-- quiet) echo $resultelse echo "Usage:$0 PORT mem resident" fi
two。 Script usage
Storage location: / usr/local/zabbix/etc/scripts
Features:
(1)。 The script can accept three parameters to monitor mongodb memory usage, number of client connections, dml operation statements, etc.
(2)。 The script can accept two parameters and monitor whether the mongodb is online.
Second, modify the agent configuration file
1. Modify zabbix_agentd.conf
Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
two。 Define the key for monitoring mongodb under zabbix_agentd.conf.d
# cat mongodb_stats.confUserParameter=mongodb_stats [*], / usr/local/zabbix/etc/scripts/check_mongodb.sh $1 $2 $3
3. Restart the agent service
Create monitoring items in the web interface
The port of mongodb instance is defined as a host macro. For more information on macro operation, please see http://hnr520.blog.51cto.com/4484939/1852655.
1. Create an items to monitor whether the mongodb is online
Key value: mongodb_stats [{$MONGODB_PORT_TEST}, ok]
two。 Create an itmes to monitor mongodb memory usage
Key value: mongodb_stats [{$MONGODB_PORT_TEST}, mem,resident]
Note: the unit of data collected is MB, and the unit is B, so you need to define a multiple of 1024 times. Otherwise, the GB cannot be displayed when the memory usage exceeds GB.
3. Create a monitoring mongodb client connection count items
Key value: mongodb_stats [{$MONGODB_PORT_TEST}, connections,current]
4. Create monitoring dml statement related information items
Key value: mongodb_stats [{$MONGODB_PORT_TEST}, opcounters,insert]
Note: it is monitored through db.serverStatus () .opcounters that the data is the total quantity since the service was started, so the stored value type needs to be modified to a difference.
Several other query, delete, and update types are created
Fourth, view the data
Select monitoring-> latest data-> Select the appropriate filter conditions
5. Create mongodb opcounters information graphics
Select configuration-> hosts-> Select mongodb hosts-> Graphics
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.