MongoDB Databases
ZenPacks.zenoss.MongoDBMonitor
This ZenPack models and collects data from Mongo DB servers and the individual databases belonging to them.
Releases
Version 2.1.0 - Download
- Released on 2023/08/10
- Requires ZenPackLib ZenPack, PS.Utils ZenPack
- Compatible with Zenoss 6.x and Zenoss Cloud
Version 2.0.0 - Download
- Released on 2021/04/30
- Requires ZenPackLib ZenPack, PS.Utils ZenPack
- Compatible with Zenoss 6.x and Zenoss Cloud
Usage
Once the MongoDBMonitor ZenPack is installed you will have the following new zProperties which should be set either for device classes or individual devices.
zMongoDBPort
- Port where MongoDBMonitor is listening. Default:
27017
zMongoDBUsername
- Valid Mongo username. No default.
zMongoDBPassword
- Password for user. No default.
zMongoDBSSLEnable
- Whether to use SSL for connections (see below). Default:
false
zMongoDBMechanism
- Authentication mechanism. Default:
SCRAM-SHA-1
Possible values: (SCRAM-SHA-1
|SCRAM-SHA-256
|MONGODB-CR
|MONGODB-X509
|PLAIN
) zMongoDBTLSCertificateKeyContent
- Content of client certificafile (.pem). No default.
zMongoDBTLSCAContent
- Content of root Certificate Authoricertificate file (.pem). No default.
zMongoDBHosts
- List of hostnames, including port. Hosts must be members of the same replica set or mongos instances in the same sharded cluster. No default.
zMongoDBDeployment
- Type of MongoDB deployment. Default:
Standalone Server
Possible values: (Standalone Server
|Replica Set
|Sharded Cluster
)
In order to use TLS/SSL authentication zMongoDBSSLEnable must be set to
true
, zMongoDBMechanism should be set to MONGODB-X509
,
zMongoDBTLSCertificateKeyContent and zMongoDBTLSCAContent should be
filled in with valid content data of appropriate certificates.
zMongoDBDeployment property should be configured according to the deployment type of MongoDB. If the deployment type of the server is changed, the value of this property should be updated in order to connect to MongoDB correctly.
In addition to setting these properties, you must add the zenoss.Mongo modeler plugin to a device class or individual device. This modeler plugin will discover all databases using the connectivity information provided through the above settings.
This ZenPack attempts to cache information locally for a short amount of time to avoid multiple, redundant calls to Mongo. If the cached data is older than one minute, it will request fresh information over the network.
Note
Only databases that authenticate against the provided username and password will be modeled and monitored.
Effects of Monitoring
The MongoDBMonitor ZenPack attempts to run lightweight commands for both monitoring and modeling. Monitored MongoDB servers should not be adversely affected by these commands.
Monitoring
By default, the following commands are run every five (5) minutes (300 seconds).
Purpose | Command | Repeats |
---|---|---|
Server statistics | db.runCommand('serverStatus') |
No |
Database statistics | db.runCommand('dbStats') |
Once per database |
Note
The dbStats
command will block all incoming requests to the target
database until it has completed execution. The larger the nssize of the
database the longer it may take to complete. Please see this doc
link
and this jira bug bug for
more information.
Modeling
The following queries will be run whenever the MongoDBMonitor server device is remodeled. By default, this occurs once every 24 hours for Zenoss Cloud and every 12 hours for Zenoss Resource Manager.
Purpose | Command | Repeats |
---|---|---|
Server attributes | db.adminCommand('serverStatus') |
Remodel interval |
Database attributes | db.adminCommand('listDatabases') |
Remodel interval |
Replica Set
To start monitoring a replica set the following properties should be configured:
- zMongoDBDeployment - should be set to
Replica Set
value -
zMongoDBHosts - (optional) a list of hostnames, including port (must be members of the same replica set) can be provided in the following format:
hostname1:portNumber nostname2:portNumber
MongoS Server Status
To begin modeling and monitoring MongoS Servers
- add the SSH enabled device where the MongoDB Shell is configured with access to MongoDB deployments.
- zCommandUsername and zCommandPassword should be set to allow for command collection and SSH access on the device.
- zMongoDBUsername and zMongoDBPassword should be set if the MongoDB Shell requires authentication for shell commands.
Modeled mongoS servers will update their status every five (5) minutes.
Note
If a mongoS server becomes inactive, only one event will be sent per down mongoS server. If the event is deleted or lost a new event will only be sent again if the device goes from an active state -> inactive state.
Status down events need to be cleared manually; if the device goes from inactive -> active, the event will NOT clear automatically.
Changes
2.1.0
- Features
- SVC-2940: Support for MongoS Status
- SVC-2939: Support for Replica Sets
- SVC-2937: Support for certificate-based authentication for SSL databases
- SVC-2938: Support for Plain authentication using AD credentials
- SVC-3058: Add documentation to build .rst file
- SVC-3450: Upgrade PyMongo from 3.7.0 to 3.12.3
2.0.0
- Features
- Zenpack is rewritten using zenpacklib
1.2.0
- Fixes
- Fix traceback when monitoring an instance that is also part of a cluster.
1.1.0
- Features
- Upgraded
pymongo
from 2.5.1 to 3.7.0 - Added new zProperty zMongoDBMechanism with default value of
SCRAM-SHA-1
- Removed datapoints
mongoCursorsTotalOpen
mongoCursorsClientCursorsSize
mongoCursorsTimedOut
mongoHeapUsageBytes
- Upgraded
Notice
This ZenPack includes the Mongo Python Driver (pymongo
), originally authored by
Mike Dirolf, and licensed under the
Apache 2.0 license.
Please note that the license only applies to the Python Mongo
Driver, not to the MongoDBMonitor ZenPack itself. The ZenPack simply
includes the Python Mongo Driver (according to the Apache 2.0 license),
but is not subject to the same conditions.