Mongodb has a db.serverStatus() command, which can be used to view the running status of Mongodb. Then Zabbix can call this command to monitor Mongodb. 1. Use of db.serverStatus() command Note: Only super administrator accounts have permission to use this command 1. Check the mongodb service status echo "db.serverStatus()" | mongo --port 37485 -u username -p 'password' --authenticationDatabase 'admin' 2. Check the memory usage of mongodb echo "db.serverStatus().mem" | mongo --port 37485 -u username -p 'password' --authenticationDatabase 'admin' 3. Check the number of mongodb connections echo "db.serverStatus().connections" | mongo --port 37485 -u username -p 'password' --authenticationDatabase 'admin' 2. Create a monitoring profile 1. Write a mongodb monitoring configuration file vim /etc/zabbix/zabbix_agentd.d/mongodb.conf UserParameter=MongoDB.status[*],/bin/echo "db.serverStatus().$1" |/data/mongodb/bin/mongo --port 37485 -u username -p 'password' --authenticationDatabase 'admin' | grep "$2" | awk -F ' : ' '{print $$2}' | awk -F ',' '{print $$1}' UserParameter=MongoDB.ok,/bin/echo "db.serverStatus().ok" | /data/mongodb/bin/mongo --port 37485 -u username -p 'password' --authenticationDatabase 'admin' | sed -n '5p' UserParameter=MongoDB.connections[*],/bin/echo "db.serverStatus().connections.$1" | /data/mongodb/bin/mongo Note: Use the super administrator account 2. Restart zabbix-agent systemctl restart zabbix-agent 3. Test on the zabbix server /data/zabbix/bin/zabbix_get -s xxx.xxx.xxx.xxx -p 10050 -k "MongoDB.status[mem,virtual]" /data/zabbix/bin/zabbix_get -s xxx.xxx.xxx.xxx -p 10050 -k "MongoDB.connections[available]" /data/zabbix/bin/zabbix_get -s xxx.xxx.xxx.xxx -p 10050 -k "MongoDB.ok" 3. Create a monitoring template 1. Add monitoring template 2. Create an application set Note: Create an application set based on the items you want to monitor. 3. Create monitoring items Note: Please create the sub-items you want to monitor one by one according to your own sub-items. 4. Create a trigger 5. Create monitoring graphics 4. Add monitoring template to the host 5. Monitoring effect diagram Summarize The above is the method of Zabbix3.4 monitoring the status of mongodb database introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: About Vue to eliminate repeated prompts when refreshing the page when the Token expires
>>: How to handle concurrent updates of MySQL data
Table of contents Concurrent scenarios Write-Writ...
I have read a lot of knowledge and articles about...
Table of contents 1. Introduction 1. Component da...
In Windows operating system, the program to query...
To set the line spacing of <p></p>, us...
When applying docker containers, we often mount t...
For databases that have been running for a long t...
The use of vue3 Teleport instant movement functio...
I used js to create a package for converting Chin...
1. Basic Concepts 1. Sitemesh is a page decoratio...
Introduction: MySQL database recovery by time poi...
Table of contents 1. Ant Design Vue 1. Official w...
Table of contents Preface difficulty Cross-domain...
Table of contents 1. Mysql data structure 2. The ...
1. Background Buttons are very commonly used, and...