How to monitor the status of mongodb database using Zabbix3.4
This article introduces how to use Zabbix3.4 to monitor the status of mongodb database, the content is very detailed, interested friends can refer to, hope to be helpful to you.
I. the use of the db.serverStatus () command
Note: only the Super Admin account has permission to use this command.
1. View the status of mongodb service
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'
Second, create a monitoring profile
1. Write mongodb monitoring configuration file
Vim / etc/zabbix/zabbix_agentd.d/mongodb.confUserParameter=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 Admin account
2. Restart zabbix-agent
Systemctl restart zabbix-agent
3. Test on the zabbix server side
/ 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"
Create a monitoring template
1. Add a monitoring template
2. Create an application set
Note: create an application set based on the items you want to monitor
3. Create a monitoring item
Note: please create according to the subitems you want to monitor, and create the subitems to be monitored one by one
4. Create a trigger
5. Create a monitoring graph
4. Add monitoring template to the host
5. Monitoring effect map
On how to use Zabbix3.4 to monitor the status of mongodb database is shared here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it for more people to see.