##Use Case The MongoDB custom monitor captures statistics from the MongoDB server and displays them in the AppDynamics Metric Browser. This extension works only with the standalone machine agent.
Metrics include:
- Server up time
- Global lock time
- Operations currently queued, number waiting for the read-lock or write-lock
- Total active connections, number of read and write operations
- Memory metrics including bits, resident RAM, virtual memory, mapped memory, mapped memory with journaling
- Current and available connections
- Index counters including index access, hits and misses, resets
- Background flushing metrics such as number of times, total time, average time, last time
- Network traffic sent and received (in bytes), number of distinct requests received
- Number of database operations including: insert, query, update, delete, get more, and total number of commands
- Number of asserts since the server process started: regular, warnings, message, user, and number of times the rollover counter has rolled
- Database related stats
- Cluster related stats (status, health and uptime)
##Installation
- To build from source, clone this repository and run 'mvn clean install'. This will produce a MongoMonitor-VERSION.zip in the target directory. Alternatively, download the latest release archive from Github.
- Unzip the file MongoMonitor-[version].zip into
<MACHINE_AGENT_HOME>/monitors/
. - In the newly created directory "MongoMonitor", edit the config.yml configuring the parameters specified in the below section.
- Restart the machineagent
- In the AppDynamics Metric Browser, look for: Application Infrastructure Performance | <Tier> | Custom Metrics | Mongo Server.
Note : Please make sure to not use tab (\t) while editing yaml files. You may want to validate the yaml file using a yaml validator
-
Configure the Mongo instances by editing the config.yml file in
<MACHINE_AGENT_HOME>/monitors/MongoMonitor/
.For eg.
# MongoDB host and port. If ReplicaSet is enabled, configure all OR subset of members of the cluster. servers: - host: "localhost" port: 27017 - host: "localhost" port: 27018 # Specify this key if Password Encryption Support is required else keep it empty # If specified, adminDBPassword and databases passwords are now the encrypted passwords. passwordEncryptionKey: "" # Admin DB username and password. Required if mongod is started with --auth (Authentication) else keep empty # The user should have clusterMonitor role as a minimum adminDBUsername: "admin" adminDBPassword: "admin" # Change ssl to true if mongod is started with ssl. Then specify the pemFilePath, if not keep empty. ssl: false pemFilePath: "" # https://docs.mongodb.com/manual/reference/command/serverStatus/ serverStatusExcludeMetricFields: [locks, wiredTiger, tcmalloc, opcountersRepl, metrics] #prefix used to show up metrics in AppDynamics metricPathPrefix: "Custom Metrics|Mongo Server|" #This will create it in specific Tier. Replace <TIER_ID> #metricPrefix: "Server|Component:<TIER_ID>|Custom Metrics|Mongo Server|"
-
Configure the path to the config.yml file by editing the in the monitor.xml file in the
<MACHINE_AGENT_HOME>/monitors/MongoMonitor/
directory. Below is the sample<task-arguments> <!-- config file--> <argument name="config-file" is-required="true" default-value="monitors/MongoMonitor/config.yml" /> .... </task-arguments>
Note : By default, a Machine agent or a AppServer agent can send a fixed number of metrics to the controller. To change this limit, please follow the instructions mentioned here. For eg.
java -Dappdynamics.agent.maxMetrics=2500 -jar machineagent.jar
##Password Encryption Support To avoid setting the clear text password in the config.yml, please follow the process below to encrypt the password
- Download the util jar to encrypt the password from https://github.com/Appdynamics/maven-repo/blob/master/releases/com/appdynamics/appd-exts-commons/1.1.2/appd-exts-commons-1.1.2.jar and navigate to the downloaded directory
- Encrypt password from the commandline
java -cp appd-exts-commons-1.1.2.jar com.appdynamics.extensions.crypto.Encryptor myKey myPassword
- Specify the passwordEncryptionKey and encrypted adminDBPassword in config.yml
##Metrics
###Server Stats
Metric Name | Description |
---|---|
Up Time (ms) | The duration of time that the server is up |
#####Metric Category: Asserts
Metric Name | Description |
---|---|
Message | |
Regular | |
Rollover | |
User | |
Warning |
#####Metric Category: Background Flushing
Metric Name | Description |
---|---|
Flushes | Number of times the database has been flushed |
Total (ms) | Total time (ms) that the mongod process spent writing data to disk |
Average (ms) | Average time (ms) that the mongod process spent writing data to disk |
Last (ms) | Time (ms) that the mongod process last spent writing data to disk |
#####Metric Category: Connections
Metric Name | Description |
---|---|
Current | Number of current connections to the database server from clients. This number includes the current shell connection as well as any inter-node connections to support a replica set or sharded cluster. |
Available | Number of unused available connections that the database can provide. Consider this value in combination with the value of Current to understand the connection load on the database. |
#####Metric Category: Global Lock
Metric Name | Description |
---|---|
Total Time | The total time since the globalLock was started and created |
######Active Clients
Metric Name | Description |
---|---|
Total | Number of active client connections to the database |
Readers | Number of readers performing read operations |
Writers | Number of writers performing write operations |
######Current Queue
Metric Name | Description |
---|---|
Total | Number of operations queued before a lock |
Readers | Number of operations waiting for the read-lock |
Writers | Number of operations waiting for the write-lock |
#####Metric Category: Index Counter
Metric Name | Description |
---|---|
Accesses | |
Hits | |
Misses | |
Resets |
#####Metric Category: Memory
Metric Name | Description |
---|---|
Bits | Target Architecture |
Resident | Amount of RAM (MB) currently used by the database process |
Virtual | MB currently used by the mongod process |
Mapped | Amount of mapped memory (MB) used by the database |
Mapped With Journal | Amount of mapped memory (MB), including memory used for journaling. |
#####Metric Category: Network
Metric Name | Description |
---|---|
Bytes In | The amount of network traffic (bytes) received by the database |
Bytes Out | The amount of network traffic (bytes) sent from the database |
Number Requests | Number of distinct requests that the server has received |
#####Metric Category: Operations
Metric Name | Description |
---|---|
Insert | Number of insert operations |
Query | Number of query operations |
Update | Number of update operations |
Delete | Number of delete operations |
GetMore | Number of getmore operations |
Command | Total number of commands issued to database |
###Replica Stats For each replica the following metrics are reported.
Metric Name | Description |
---|---|
Up Time (ms) | The duration of time that the server is up |
Health | Conveys if the member is up (i.e. 1) or down (i.e. 0.) |
[State](http://docs.mongodb.org/manual/reference/replica-states/) | Value between 0 and 10 that represents the replica state of the member. |
###DB Stats #####
Metric Name | Description |
---|---|
avgObjSize | The average size of each document in bytes. This is the dataSize divided by the number of documents |
collections | Contains a count of the number of collections in that database |
dataSize | The total size in bytes of the data held in this database including the padding factor |
fileSize | The total size in bytes of the data files that hold the database |
indexes | Contains a count of the total number of indexes across all collections in the database |
indexSize | The total size in bytes of all indexes created on this database |
nsSizeMB | The total size of the namespace files (i.e. that end with .ns) for this database |
numExtents | Contains a count of the number of extents in the database across all collections |
objects | Contains a count of the number of objects (i.e. documents) in the database across all collections |
storageSize | The total amount of space in bytes allocated to collections in this database for document storage |
#####Metric Category: Collection Stats #####
Metric Name | Description |
---|---|
count | The number of objects or documents in this collection |
lastExtentSize | The size of the last extent allocated |
nindexes | The number of indexes on the collection |
numExtents | The total number of contiguously allocated data file regions |
paddingFactor | The amount of space added to the end of each document at insert time |
size | The size of the data stored in this collection |
storageSize | The total amount of storage allocated to this collection for document storage |
systemFlags | Reports the flags on this collection that reflect internal server options |
totalIndexSize | The total size of all indexes. The scale argument affects this value |
userFlags | Reports the flags on this collection set by the user |
##Contributing
Always feel free to fork and contribute any changes directly here on GitHub.
##Community
Find out more in the AppSphere community.
##Support
For any questions or feature request, please contact AppDynamics Support.