Zabbix3.4 method to monitor mongodb database status

Zabbix3.4 method to monitor mongodb database status

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!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Detailed usage and command explanation of mongodb monitoring tool mongostat
  • Python monitors Linux memory and writes to MongoDB (recommended)
  • Using the oplog mechanism in MongoDB to implement quasi-real-time data operation monitoring
  • MongoDB performance optimization and monitoring
  • How to use zabbix to monitor mongodb
  • Detailed explanation of MongoDB operation status monitoring and performance analysis tool mongostat
  • Use of MongoDB monitoring tools mongostat and mongotop

<<:  About Vue to eliminate repeated prompts when refreshing the page when the Token expires

>>:  How to handle concurrent updates of MySQL data

Recommend

The principle and application of ES6 deconstruction assignment

Table of contents Array destructuring assignment ...

Detailed explanation of CSS3 rotating cube problem

3D coordinate concept When an element rotates, it...

Explain MySQL's binlog log and how to use binlog log to recover data

As we all know, binlog logs are very important fo...

SQL uses ROW_NUMBER() OVER function to generate sequence number

Syntax: ROW_NUMBER() OVER(PARTITION BY COLUMN ORD...

mysql group_concat method example to write group fields into one row

This article uses an example to describe how to u...

How to modify the time zone and time in Ubuntu system

On a Linux computer, there are two times, one is ...

How to limit the value range of object keys in TypeScript

When we use TypeScript, we want to use the type s...

How to run Python script on Docker

First create a specific project directory for you...

js native waterfall flow plug-in production

This article shares the specific code of the js n...

How to locate MySQL slow queries

Preface I believe that everyone has had experienc...

Nginx builds rtmp live server implementation code

1. Create a new rtmp directory in the nginx sourc...

JavaScript to implement input box content prompt and hidden function

Sometimes the input box is small, and you want to...

Several ways to hide Html elements

1. Use CSS Copy code The code is as follows: style...