Parameters and configuration
Parameters
--conf | Path to configuration file |
--target_databases | Path to the configuration file containing the database targets |
--target_agents | Path to the configuration file containing the agent targets |
--custom_queries | Path to the configuration file containing the modules with custom queries |
Configuration file (--conf)
agents_group_id = < ID of the group in which the agents will be created >
interval = < Agent monitoring interval in seconds >
uri = < Connection string in URI format >
threads = < Number of threads to use for agent creation >
module_prefix = <Modules Prefix>
execute_custom_queries = < Activate with 1 to enable the use of custom queries. >
analyze_connections = < Enable with 1 to enable connection monitoring >
engine_uptime = <Enable with 1 to enable runtime monitoring>
query_stats = < Enable with 1 to enable query statistics monitoring >
network = < Activate with 1 to enable network statistics monitoring >
latency = < Enable with 1 to enable latency statistics monitoring >
Example
agents_group_id = 10
interval = 300
uri = mongodb://172.17.0.3:27017
threads = 1
modules_prefix = Mongodb.
execute_custom_queries = 1
analyze_connections = 1
network = 1
query_stats = 1
latency = 1
engine_uptime = 1
List of target databases (--target_databases)
The content of the file will be a list of target databases, separating each database by commas or lines. The format for a database will be its name:
Example
admin
db_analytics
db_geospatial
db_guides
List of target agents (--target_agents)
The content of the file will be a list of agent name bases, separating each agent by commas or lines. These agent names will be used to dump the information from each target database into the corresponding indicated agent name, rather than letting the plugin generate the agent names automatically.
The position of each agent name in the listing must match the position of the target database in its own listing, that is, the name for the first target database will be the first name in this listing, taking into account that blank lines are ignored.
Example
agente1,,agente3
agente4
agente5,agente6,agente7,,agente9
Custom queries (--custom_queries)
A module must be entered for each custom query to be monitored. The modules must follow a structure, which is as follows:
check_begin --> Module opening label
name --> Module name
description --> Module description.
operation --> Operation typetype, value | full -> value returns a simple value, full returns all rows in a string
datatype --> Module type
min_warning --> Minimum warning threshold setting
max_warning --> Maximum warning threshold configuration
str_warning --> Warning string configuration
warning_inverse --> Enable inverse interval with 1 for warning threshold
min_critical --> Minimum critical threshold setting
max_critical --> Maximum critical threshold configuration
str_critical --> Critical string configuration
critical_inverse --> Activate inverse interval with 1 for critical threshold
module_interval --> This interval is calculated as a multiplier of the agent interval.
target --> Custom query
target_databases --> Database agents in which the module will be created. Select according to the name that has been assigned to the database agent. The one that has been put in target agents.
check_end --> Module closing label.
Example
check_begin
name DatabaseStats
description Database statistics
operation value
datatype generic_data
target db.runCommand({ dbStats: 1 })
target_databases all
check_end
check_begin
name Getcollection
description get collection
datatype generic_data_string
min_warning 10
target db.system.version.find({})
target_databases agent2
check_end
check_begin
name Getdocument
description get document
#operation value
datatype generic_data_string
min_warning 10
target db.mi_coleccion.find({ "_id": ObjectId("655b4a235d797f3769d6b03e") })
target_databases agent4
check_end
Queries for the target parameter of the modules
Commands can be executed according to the following format:
db.runCommand(< command >)
or
runCommand(< command >)
To know the expected response, to configure the type of module in string or data as required.
As a precaution only the following type of commands will be executed : dbStats,collStats,find,cound,aggregate,listCollections
Find queries can be run to obtain data from collections and documents:
db.< collection >.find({})
or
< collection >.find({})
With the possibility of specifying queries within the find method:
db.< collection >.find({ "<key document": "value" })
Example:
db.mi_collection.find({ "_id": ObjectId("655b4a235d797f3769d6b03e") })