MongoDB (Linux)

MongoDB (Linux)

This template allows you to monitor the performance of MongoDB installed on a Linux machine by using Perl scripts.

Prerequisites:

  • SSH and Perl installed on the target server;
  • SNMP installed on the target server;
  • Permission to monitor mongod processes.

Credentials: User under which MongoDB were installed.

Each Linux/Unix monitor uses the same arguments structure

For Example:

perl ${SCRIPT} /mongodb/bin/mongo test

 

where:


/usr/bin/mongo is the full path to Mongo client. On different Linux/Unix distributions this path could be different;     

  test is the name of target database.

 

Note:You must specify the correct arguments for each monitored component in the Script Arguments field. If you fail to do this, the monitor will return with a status error of "Undefined."

Note: This template have been created on MongoDB 2.4.5.

 

Components Monitors

Server: Global Lock Statistic

This monitor returns global lock statistics. The returned values are as follows:

Queue_total- This component returns the current number of operations queued and waiting for the global lock.

Queue_readers- This component returns the current number of operations queued and waiting on a read lock.

Queue_writers- This component returns the current number of operations queued and waiting for a write lock.

Clients_total- This component returns the total number of active clients connected to this server.

Clients_readers- This component returns the total number of active clients currently performing read operations.

Clients_writers- This component returns the total number of active clients currently performing write operations.

Server: Connections Statistic

This monitor returns connection statistics. The returned values are as follows:

Connections_current- This component returns the number of currently active connections to this server.

Connections_available- This component returns the number of available connections remaining. This value should be as high as possible.

Server: Network Statistic

      This monitor returns network statistics. The returned values are as follows:

Network_bytes_in- This component returns the total number of bytes sent to this database.

Network_bytes_out- This component returns the total number of bytes sent from this database.

Network_requests- This component returns the total number of requests that have been sent to this database.

Note: By default, this monitor has the Count statistic as difference box checked. It will show the total number of byte requests in the Message field while the Statistic field will only show the number of new byte requests since the last polling period.

Server: Messages Statistic

This monitor returns the messages statistic. The returned value for these components should be as low as possible.

Asserts_warnings- This component returns the number of warnings raised since this process started.

Asserts_messages- This component returns the number of message asserts. These are internal server errors that have a well-defined text string. Stack traces are logged.

Asserts_user_errors- This component returns the number of user asserts. These are errors that can be generated by a user such as Out of Disk Space or Duplicate Key.

Note: By default, this monitor has the Count statistic as difference box checked. It will show the total number of messages in the Message field while the Statistic field will only show the number of new messages since the last polling period.

Server: Operations Statistic

This monitor returns operations statistics. The returned values are as follows:

Insert - This component returns the total number of inserts performed since this process started.

Query - This component returns the total number of queries performed since this process started.

Update - This component returns the total number of updates performed since this process started.

Delete - This component returns the total number of deletes performed since this process started.

GetMore - This component returns the total number of times getMorehas been called on any cursor since this process started.

Command - This component returns the total number of other commands performed since this process started.

Note: By default, this monitor has the Count statistic as difference box checked. It will show the total number of operations in the Message field while the Statistic field will only show the new operations since the last polling period.

Server: Other Statistic

This monitor returns other MongoDB statistics. The returned values are as follows:

Memory_virtual- This component returns the number of virtual memory megabytes for the mongod process. In general, virtual memory should be a little larger than mapped memory. If the virtual memory is significantly larger, this could indicate a memory leak. With journaling enabled, virtual memory is twice the amount of mapped memory.

Memory_mapped- This component returns the number of megabytes of data mapped by the database. MongoDB memory maps all the data files. As a result, this number is likely to be similar to your total database(s) size.

Flushes_total- This component returns the number of times the database has flushed writes to the disk.

Flushes_average_time- This component returns the average number of milliseconds it takes to perform a single flush.

Cursors_opened- This component returns the total number of cursors that the server is maintaining for clients.

Cursors_timed_out- This component returns the number of cursors that have timed out since this server was started.

Database Statistic

This monitor returns database statistics. The returned values are as follows::

Collections- This component returns the total number of collections in the database.

Objects - This component returns the total number of objects in the database.

Average_Object_Size- This component returns the average size of objects in the database, measured in bytes.

Data_Size - This component returns the size of database files, measured in megabytes.

Indexes - This component returns the total number of indexes in the database.

Index_Size - This component returns the size of indexes in the database, measured in megabytes.

File_Size - This component returns the total size of all files allocated for the database, measured in megabytes.

MongoDB server TCP port

This component monitor tests the ability of a MongoDB service to accept incoming sessions. By default, it monitors TCP port 27017.

Process: mongod

This monitors returns CPU and memory usage of the MondoDB server process.

 

Portions of this document were originally created by and are excerpted from the following sources:

10gen, Inc., “The MongoDBManual,” , Copyright © 2011-2012 10gen, Inc. All rights reserved.
Available at
http://www.mongodb.org/display/DOCS/serverStatus+Command.