AppDynamics Monitoring Extension for use with MongoDB

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.

Pre-requisite

Before the extension is installed, the prerequisites mentioned here need to be met. Please do not proceed with the extension installation if the specified prerequisites are not met.

Installation

  1. Download and unzip MongoMonitor.zip into <MACHINE_AGENT_HOME>/monitors/
  2. Edit the file config.yml located at <MachineAgent_Dir>/monitors/ The metricPrefix of the extension has to be configured as specified here. Please make sure that the right metricPrefix is chosen based on your machine agent deployment, otherwise this could lead to metrics not being visible in the controller.
  3. Restart the machineagent
  4. In the AppDynamics Metric Browser, look for: Application Infrastructure Performance | <Tier> | Custom Metrics | Mongo Server.

Configuration

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

  1. 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. T
        ssl: false
    
        #prefix used to show up metrics in AppDynamics
        metricPathPrefix:  "Custom Metrics|Mongo Server|"
        #This will create it in specific Tier. Replace 
        #metricPathPrefix:  "Server|Component:|Custom Metrics|Mongo Server|"
    
    
  2. 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

Metrics

Server Stats

Metric NameDescription
Up Time (ms)The duration of time that the server is up

Metric Category: Asserts

Metric NameDescription
Message 
Regular 
Rollover 
User 
Warning 

Metric Category: Background Flushing

Metric NameDescription
FlushesNumber 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 NameDescription
CurrentNumber 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.
AvailableNumber 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 NameDescription
Total TimeThe total time since the globalLock was started and created
Active Clients
Metric NameDescription
TotalNumber of active client connections to the database
ReadersNumber of readers performing read operations
WritersNumber of writers performing write operations
Current Queue
Metric NameDescription
TotalNumber of operations queued before a lock
ReadersNumber of operations waiting for the read-lock
WritersNumber of operations waiting for the write-lock

Metric Category: Index Counter

Metric NameDescription
Accesses 
Hits 
Misses 
Resets 

Metric Category: Memory

Metric NameDescription
BitsTarget Architecture
ResidentAmount of RAM (MB) currently used by the database process
VirtualMB currently used by the mongod process
MappedAmount of mapped memory (MB) used by the database
Mapped With JournalAmount of mapped memory (MB), including memory used for journaling.

Metric Category: Network

Metric NameDescription
Bytes InThe amount of network traffic (bytes) received by the database
Bytes OutThe amount of network traffic (bytes) sent from the database
Number RequestsNumber of distinct requests that the server has received

Metric Category: Operations

Metric NameDescription
InsertNumber of insert operations
QueryNumber of query operations
UpdateNumber of update operations
DeleteNumber of delete operations
GetMoreNumber of getmore operations
CommandTotal number of commands issued to database

Replica Stats

For each replica the following metrics are reported.

Metric NameDescription
Up Time (ms)The duration of time that the server is up
HealthConveys 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 NameDescription
avgObjSizeThe average size of each document in bytes. This is the dataSize divided by the number of documents
collectionsContains a count of the number of collections in that database
dataSizeThe total size in bytes of the data held in this database including the padding factor
fileSizeThe total size in bytes of the data files that hold the database
indexesContains a count of the total number of indexes across all collections in the database
indexSizeThe total size in bytes of all indexes created on this database
nsSizeMBThe total size of the namespace files (i.e. that end with .ns) for this database
numExtentsContains a count of the number of extents in the database across all collections
objectsContains a count of the number of objects (i.e. documents) in the database across all collections
storageSizeThe total amount of space in bytes allocated to collections in this database for document storage

Metric Category: Collection Stats

Metric NameDescription
countThe number of objects or documents in this collection
lastExtentSizeThe size of the last extent allocated
nindexesThe number of indexes on the collection
numExtentsThe total number of contiguously allocated data file regions
paddingFactorThe amount of space added to the end of each document at insert time
sizeThe size of the data stored in this collection
storageSizeThe total amount of storage allocated to this collection for document storage
systemFlagsReports the flags on this collection that reflect internal server options
totalIndexSizeThe total size of all indexes. The scale argument affects this value
userFlagsReports the flags on this collection set by the user

 

Credentials Encryption

Please visit this page to get detailed instructions on password encryption. The steps in this document will guide you through the whole process.

Extensions Workbench

Workbench is an inbuilt feature provided with each extension in order to assist you to fine tune the extension setup before you actually deploy it on the controller. Please review the following document on How to use the Extensions WorkBench

Troubleshooting

Please look at the troubleshooting document and make sure that everything is followed correctly.

Support Tickets

If after going through the Troubleshooting Document you have not been able to get your extension working, please file a ticket and add the following information.

Please provide the following in order for us to assist you better.

1. Stop the running machine agent.
2. Delete all existing logs under <MachineAgent>/logs.
3. Please enable debug logging by editing the file                                <MachineAgent>/conf/logging/log4j.xml. Change the level value of the            following <logger> elements to debug.
    <logger name="com.singularity">
    <logger name="com.appdynamics">
4. Start the machine agent and please let it run for 10 mins. Then zip and        upload all the logs in the directory 
    <MachineAgent>/logs/*.
5. Attach the zipped <MachineAgent>/conf/* directory here.
6. Attach the zipped <MachineAgent>/monitors/ExtensionFolderYouAreHavingIssuesWith directory here.

For any support related questions, you can also contact help@appdynamics.com.

Contributing

Always feel free to fork and contribute any changes directly via GitHub.

Version

Extension Version:

2.0.0

MongoDB Tested on:

3.4

Controller Compatibility:

4.5+

MA Compatibility:

4.5.13+

Last Update:

05/29/2020

 

List of Changes changes to this extension can be found here