OneAgent MongoDB plugin¶
Gathers MongoDB stats using two MongoDB commands:
- dbStats - https://docs.mongodb.com/manual/reference/command/dbStats/
- serverStatus - https://docs.mongodb.com/manual/reference/command/serverStatus/
Running the plugin requires specifying:
- user credentials - clusterMonitor role is required. If authorization is disabled on MongoDB then leave user and password fields empty
- port - access to the MongoDB via localhost interface is required
This is a singleton type plugin - one instance will be created even if multiple MongoDB process groups instances are detected.
-
class
ruxit_mongodb.QueryDesc(timeseries_key, per_second_result_flag)¶ Bases:
tupleNamedtuple used for storing informations about timeseries metric, including corresponding timeseries key and information about metric type.
-
per_second_result_flag¶
-
timeseries_key¶
-
-
class
ruxit_mongodb.MongodbPlugin(**kwargs)[source]¶ Bases:
ruxit.api.base_plugin.BasePluginMongoDB plugin class. This plugin is stateful, however, the state is limited to processing of JSON and received configuration together with maintaining database connection.
__init__ should not be overridden without a call to super.
Parameters: - config (Dict[str, str]) -- plugin configuration
- results_builder (ResultsBuilder) -- instance for this plugin,
- json_config -- parsed plugin.json contents,
- plugin_info (PluginInfo) -- json data of the plugin exposed in a more convenient way,
- associated_entity -- monitored entity associated with the plugin, if any (deprecated).
- activation_context -- activation context for the plugin,
- process_snapshot (ProcessSnapshot) -- latest available at method call,
- entity_resolver (EntityResolver) -- exposes additional methods for querying snapshot
- logger -- plugin specific logger for plugin development, set to None only in unit tests
-
initialize_metrics()[source]¶ On plugin creation corresponding plugin.json file is processed in order to extract statistics that are related to server status and particular database.
-
query(**kwargs)[source]¶ Main method that creates connection to MongoDB engine based on provided credatials and controls plugin execution by invoking methods responsible for data collection.
Raises: ruxit.api.exceptions.AuthException-- MongoDB server returned either 13 or 18 error indicating auth issuesruxit.api.exceptions.ConfigException-- unable to connect for other reasons