Hi,
Here is the log:
Error establishing direct connection to mongo node at [127.0.0.1:27017]. Error output: no reachable servers
I tried a lot of things, but after so many days, I can't find it work.
Here is my mongodb.yml configuration
# Module: mongodb
# Docs: https://www.elastic.co/guide/en/beats/metricbeat/7.10/metricbeat-module-mongodb.html
- module: mongodb
metricsets:
- dbstats
# - status
# - collstats
# - metrics
# - replstatus
period: 10s
# The hosts must be passed as MongoDB URLs in the format:
# [mongodb://][user:pass@]host[:port].
# The username and password can also be set using the respective configuration
# options. The credentials in the URL take precedence over the username and
# password configuration options.
hosts:
- "mongodb://127.0.0.1:27017"
It doesn't have a password. I verified it by running on local and also remote.
The /etc/mongod.conf bind IP is set to 0.0.0.0. I verified that it can connect outside using this command.
mongosh mongodb://18.191.206.XXX:27017
I am using MongoDB version 4, I tried using MongoDB version6 but it doesn't work as well.
My Metricbeat Version is OSS 7.2
Here is the fulll error log:
2022-08-31T21:40:21.476Z INFO [esclientleg] eslegclient/connection.go:314 Attempting to connect to Elasticsearch version 7.10.2
2022-08-31T21:40:21.478Z INFO template/load.go:97 Template metricbeat-7.10.2 already exists and will not be overwritten.
2022-08-31T21:40:21.479Z INFO [index-management] idxmgmt/std.go:298 Loaded index template.
2022-08-31T21:40:21.480Z INFO [publisher_pipeline_output] pipeline/output.go:151 Connection to backoff(elasticsearch(https://elastic-wazuh.dts-nonprod.ardentcloud.com:9200)) established
2022-08-31T21:40:30.451Z ERROR mongodb/mongodb.go:98 Error establishing direct connection to mongo node at [127.0.0.1:27017]. Error output: no reachable servers
2022-08-31T21:40:30.451Z INFO module/wrapper.go:259 Error fetching data for metricset mongodb.dbstats: error creating new Session: no reachable servers