spm-agent-mongodb

SPM Agent for monitoring MongoDB


Keywords
SPM, APM, application performance monitoring, Sematext, performance monitoring, monitoring, alerting, anomaly detection, heartbeat, metrics, custom metrics, devops, operations, dashboards, profiling, mongodb, agent, logging, performance-metrics, performance-monitoring, devops-tools, mongodb-agent
License
OGTSL
Install
npm install spm-agent-mongodb@1.29.13

Documentation

Build Status

This Sematext Cloud agent for MongoDB monitoring has been deprecated. A new agent with much simpler setup is available now. MongoDB monitoring can now be set up automatically via service auto-discovery and without the need to install any additional agents. See auto-discovery documentation.


Preparation

  1. Get a free Sematext account

  2. Create a Monitoring App of type "MongoDB" and copy the App Token - or execute the commands displayed in the Sematext UI (which are described here as well)

  3. Install Node.js on your MongoDB server

  4. The MongoDB driver might need libkrb5-dev for Kerberos authentication (if you use Kerberos ...)

apt-get install libkrb5-dev

Setup

# Install spm-agent-mongodb 
npm i spm-agent-mongodb -g

# In case you use Sematext Cloud EU (https://apps.eu.sematext.com): 
#   configure the API endpoints for EU. 
#   The  following commands create the file /etc/sematext/receivers.config: 
# sudo spm-mongodb-setup -r EU 
#   Note: To switch back to Sematext US region use
# sudo spm-mongodb-setup -r US # default for apps.sematext.com

# Install systemd or upstart service file for spm-agent-mongodb
# Create an SPM App of type MongoDB in Sematext UI 
# and use your SPM Token:
sudo spm-mongodb-setup -t SPM_TOKEN -m mongodb://localhost:27017/local

# or to specify the username and password for the agent to use to connect to MongoDB
sudo spm-mongodb-setup -t SPM_TOKEN -m mongodb://UsernameHere:PasswordHere@localhost:27017/DbNameHere

Note that the monitoring agent requires admin rights to query the relevant tables. It should have ClusterAdmin role and read access to any DB.

Configuration

The setup script will store your configuration in /etc/sematext/spm-agent-mongodb.config

If you want to change the settings later edit /etc/sematext/spm-agent-mongodb.config. Then restart the Sematext MongoDB Agent after config changes, depending on the init system:

  • Upstart (Ubuntu):
    sudo service spm-agent-mongodb restart 
  • Systemd (Linux others):
    sudo systemctl stop spm-agent-mongodb
    sudo systemctl start spm-agent-mongodb
  • Launchd (Mac OS X):
    sudo launchctl stop com.sematext.spm-agent-mongodb
    sudo launchctl stop com.sematext.spm-agent-mongodb

For tests you can just run the agent from command line:

spm-agent-mongodb SPM_TOKEN MONGODB_URL

Setup on Docker

The MongoDB agent is integrated in SPM-Client docker image. The relevant SPM_CONFIG string ist: mongodb SPM_TOKEN MONGODB_URL.

Run SPM-Client, replace the App Token and MongoDB URL with your configuration:

docker run --name spm-client --restart=always -v /var/run/docker.sock:/var/run/docker.sock -e SPM_CONFIG="mongodb YOUR_SPM_MONGODB_TOKEN mongodb://mongodbUser:mogodbPassword@mongodb-server:port/database" sematext/spm-client

Docker-Compose example with SPM-Client and MongoDB server: docker-compose.yml.

Results

Metrics Overview

More Information:

Support