OneAgent MongoDB plugin

Gathers MongoDB stats using two MongoDB commands:

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: tuple

Namedtuple 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.BasePlugin

MongoDB 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(**kwargs)[source]
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:
get_server_metrics(client)[source]

Collect MongoDB server level metrics and sends results.

get_database_metrics(client, databases)[source]

Iterates over a list of database received in main query, collects and sends database level metrics.

get_value_of_indices_chain(indices, dict)[source]