Mongo DB and Mongo DB atlas

Plugin to grab stats from a server, database and its collections, supports Mongo DB atlas compatibility.

Introduction

Ver. 25-08-2021

With this plug-in you can view the stats of a database and its collections, it supports Mongo DB atlas compatibility.

Tipo: Server plugin

Compatibility matrix

Systems where it has been tested

CentOS 7, Fedora

Systems where it should work

Any linux system

 

Prerequisites

Requires:

Configuration

To use the plugin you will need to have a number of dependencies installed.

The first thing is to have python 3 installed

yum install python3

The plugin comes with a file called requirements.txt that will install the other necessary dependencies. To run it we will use:

pip3 install -r requirements.txt

However, if you want to install its dependencies without the requirements file, you can use the following commands (recommended if you don't use a Mongo DB atlas database)

PyMongo 

python -m pip install pymongo

dnspython

python -m pip install dnspython

note: dnspython is only required if you use a MongoDB atlas database.

 

To connect, you need to know your connection ip or uri. If you have set up the database in docker you can see it with :

docker inspect <id-contenedor>

image-1629969157626.png

The default port is usually 27017. For example with this ip the connection url would be :

mongodb://172.17.0.2:27017


For MongoDB atlas, we will need the connection string, this is obtained by doing the following.

Let's go to connect:

1.png

We will be presented with several options to connect:

2.png

For example, I have chosen MongoDB compass, and when I click on it, it will show us the connection string, if we have already installed it, or it will give us the option to install it.

3.png

That would be the connection string, obviously you would have to change <password> to your password.

 

 

General parameters

Execution command:

python pandora_mongodb -u <uri> -s <server> -d <databases> -a <alldatabases> -p <prefix> -c <collectionstats> [ -g <group> ] [ --data_dir <data dir> ] [ --as_agent_plugin 1]

 

If the execution is successful we will see an integer, which will be the database number we have.

4.png

If we want to run it as an agent plugin, we will do it using the optional parameter "as_agent_plugin" with a "1" which will return an xml with the data of our server: