Metricset mongodb.replstatus only work on primary server

We deploy metricbeat on 3 mongo servers ( 1 primary, 2 secondary )
While metricbeat run on secondary server we get the following error:
Error fetching data for metricset mongodb.replstatus: error getting replication info: no reachable servers
Once this server become the primary this error disappear.
Is this a bug or by design that metricset mongodb.replstatus work only for primary server:
metricbeat.yml -

metricbeat.modules:
- module: mongodb
  metricsets: ["dbstats", "status", "collstats", "metrics", "replstatus"]
  period: 10s
  enabled: true

  # 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: ["localhost:27017"]
  username: beats
  password: pass

Hi @dbargo :slightly_smiling_face:

I guess that replication only servers do not expose some cluster wide metrics, which makes sense or you'll get duplicate data. I'm not sure but it might be the case that you only need to monitor the master to get cluster wide metrics (which I know is unfortunate as the master and its IP can change but something you can solve with DNS)

Can you check if it's something related with a single metricset by enabling/disabling them one by one too, please?

Thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.