Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to monitor the status of mongodb database using Zabbix3.4

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

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.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report