The modules.d directory contains default configurations for all the modules that are available in Metricbeat. The configuration that's specific to a module is stored in a .yml file, with the name of the file being the name of the module. For example, the configuration related to the MySQL module will be stored in the mysql.yml file. By default, except for the system module, all other modules are disabled. To list the modules that are available in Metricbeat, execute the following command:
Windows:
E:metricbeat-7.0.0-windows-x86_64>metricbeat.exe modules list
Linux:
[locationOfMetricBeat]$./metricbeat modules list
The modules list command displays all the available modules and also lists which modules are currently enabled/disabled.
Since each module comes with default configurations, make the appropriate changes in the module configuration file.
The basic configuration for the mongodb module will look as follows:
- module: mongodb
metricsets: ["dbstats", "status"]
period: 10s
hosts: ["localhost:27017"]
username: user
password: pass
To enable it, execute the modules enable command, passing one or more module names. For example:
Windows:
E:metricbeat-7.0.0-windows-x86_64>metricbeat.exe modules enable redis mongodb
Linux:
[locationOfMetricBeat]$./metricbeat modules enable redis mongodb
Similar to disabling modules, execute the modules disable command, passing one or more module names to it. For example:
Windows:
E:metricbeat-7.0.0-windows-x86_64>metricbeat.exe modules disable redis mongodb
Linux:
[locationOfMetricBeat]$./metricbeat modules disable redis mongodb
For example:
#metricbeat.ymlmetricbeat.config.modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: true
reload.period: 20s