MongoDB logs are not reflecting in kibana dashboard

MongoDB logs are not reflecting in kibana dashboard
MetricBeat YAML file is configured correctly and mongo DB YAML module enabled

mongodb.yml:

Module: mongodb

Docs: https://www.elastic.co/guide/en/beats/metricbeat/6.8/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: ["*.ec2.internal:27017"]

    Optional SSL. By default is off.

    ssl.enabled: true

    Mode of verification of server certificate ('none' or 'full')

    ssl.verification_mode: 'full'

    List of root certificates for TLS server verifications

    ssl.certificate_authorities: ["/etc/pki/tls/certificates/CA.crt"]

    Certificate for SSL client authentication

    ssl.certificate: "/etc/pki/tls/certificates/server.pem"

    Client Certificate Key

    ssl.key: "/etc/pki/tls/certificates/server.key"

    Username to use when connecting to MongoDB. Empty by default.

    username: ****

    Password to use when connecting to MongoDB. Empty by default.

    password: ******
    ~
    ~
    ~
    ~

Is there data in the metricbeat indices?
If not, you should check the metricbeat logs for any errors. It's usually pretty verbose.

logs are loading in dashboard but in dashboard i am trying view graphs getting below error
image

Are they mongo logs or system logs? Because by default the system metricset is also enabled in Metricbeat. Just check a couple of documents for the module field.

Thanks for quick reply i disabled system module already

i checked metricbeat logs below error throwing

2020-09-14T12:27:57.652Z ERROR mongodb/mongodb.go:98 Error establishing direct connection to mongo node at [ip-*.ec2.internal:27017]. Error output: no reachable servers

Oh then, let's try and open one of the visualization in from the dashboard and investigate more. You can use the inspect menu to see the requests and response from Elasticsearch. Check to see if there's anything there that doesn't match your data: maybe a different index pattern name or something.

Ah, ok, looks like a connectivity error then. I would check SSL settings and or port forwarding first.

mongodb.yml:

# Module: mongodb

# Docs: https://www.elastic.co/guide/en/beats/metricbeat/6.8/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: ["*.ec2.internal:27017"]

# Optional SSL. By default is off.

ssl.enabled: true

# Mode of verification of server certificate ('none' or 'full')

ssl.verification_mode: 'full'

# List of root certificates for TLS server verifications

ssl.certificate_authorities: ["/etc/pki/tls/certificates/CA.crt"]

# Certificate for SSL client authentication

ssl.certificate: "/etc/pki/tls/certificates/server.pem"

# Client Certificate Key

ssl.key: "/etc/pki/tls/certificates/server.key"

# Username to use when connecting to MongoDB. Empty by default.

username: ****

# Password to use when connecting to MongoDB. Empty by default.

password: ******
~
~

You followed this in the edited out part of the hosts, right?

issue resolved thank you so much you quick response @Marius_Dragomir

1 Like