What should we monitor?
There are many things you can monitor in a MongoDB environment, but a few key areas will tip you off quickly if something is amiss. You should be analyzing the following metrics:- Replication lag. Replication lag refers to delays in copying data from the primary node to a secondary node.
- Replica state. The replica state is a method of tracking if secondary nodes have died, and if there was an election of a new primary node.
- Locking state. The locking state shows what data locks are set, and the length of time they have been in place.
- Disk utilization. Disk utilization refers to disk access.
- Memory usage. Memory usages refers to how much memory is being used, and how it is being used.
- Number of connections. The number of connections the database has open in order to serve requests as quickly as possible.
serverStatus
The serverStatus
command, or db.serverStatus()
from the shell, returns a general overview of the status of the database, detailing disk usage, memory use, connection, journaling, and index access. The command returns quickly and does not impact MongoDB performance.
The
serverStatus
command, or db.serverStatus()
from the shell, returns a general overview of the status of the database, detailing disk usage, memory use, connection, journaling, and index access. The command returns quickly and does not impact MongoDB performance.
mongostat
mongostat
captures and returns the counts of database
operations by type (e.g. insert, query, update, delete, etc.). These
counts report on the load distribution on the server.Use
mongostat
to understand the distribution of operation types
and to inform capacity planning. See the mongostat manual for details.mongotop
mongotop
tracks and reports the current read and write
activity of a MongoDB instance, and reports these statistics on a per
collection basis.Use
mongotop
to check if your database activity and use
match your expectations. See the mongotop manual for details.replSetGetStatus
replSetGetStatus
command (rs.status()
from the shell) returns an overview of your replica set’s status. The replSetGetStatus document details the state and configuration of the replica set and statistics about its members.In Server side add below User parameter in zabbix_agentd.conf
UserParameter=MongoDB.Status[*],/bin/echo "db.serverStatus().$1" | /usr/bin/mongo | grep "$2"|awk -F: '{print $$2}'|awk -F, '{print $$1}'
Only above one entry.
then restart Agent.
Items screenshot
In zabbix-Server side Import below template MongoDB template
https://drive.google.com/open?id=13RaeVEpO_yxjW2wdIZKBrT8i8cmu0wFY
If want more parameters just run commands and grep using AWK and project it in zabbix.
Some Userparameters from mongostat command
------------------------------------------------------------------
UserParameter=MongoDB.Status[*],/bin/echo "db.serverStatus().$1" | /usr/bin/mongo | grep "$2"|awk -F: '{print $$2}'|awk -F, '{print $$1}'
UserParameter=mongouptime,echo "db.serverStatus()" | mongo | grep uptime | cut -f2 -d ":" | head -1 | cut -d ',' -f 1
UserParameter=networkbytesIn,echo "db.serverStatus()" | mongo | grep bytesIn | tr -dc '0-9'
UserParameter=networkbytesOut,echo "db.serverStatus()" | mongo | grep bytesOut | tr -dc '0-9'
UserParameter=repStatus,echo "rs.status()" | mongo | grep { | awk '{print $4}' | tr -dc '0-1'
UserParameter=insert,mongostat --rowcount 1 |awk {'print $1'} | tr -dc '0-9'
UserParameter=query,mongostat --rowcount 1 |awk {'print $2'} | tr -dc '0-9'
UserParameter=update,mongostat --rowcount 1 |awk {'print $3'} | tr -dc '0-9'
UserParameter=delete,mongostat --rowcount 1 |awk {'print $4'} | tr -dc '0-9'
UserParameter=mapped,mongostat --rowcount 1 | awk '{print $8}' | tail -1 | sed 's/M/ /'
UserParameter=vsize,mongostat --rowcount 1 | awk '{print $9}' | tail -1 | sed 's/M/ /'
UserParameter=conn,mongostat --rowcount 1 | awk '{print $16}' | tail -1
For concerns Please comment below.
it is not connectinfg
ReplyDeleteMongoDB shell version v3.6.2
connecting to: mongodb://127.0.0.1:27017
bye
showig me this
Getting unsupported item after importing template and adding that line in server side let me know if i am missing anything.
ReplyDeletePlease Link template not working
ReplyDeleteCan you send the link again, please?
ReplyDelete