Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mongodb] Cannot get metrics from arbiter - failed to gather data: NotMasterOrSecondary (oplog stats) #9742

Closed
alx75 opened this issue Sep 10, 2021 · 3 comments
Labels
area/mongodb bug unexpected problem or unintended behavior

Comments

@alx75
Copy link

alx75 commented Sep 10, 2021

Relevant telegraf.conf:

[[inputs.mongodb]]
  servers = ["mongodb://localhost:27017/?connect=direct"]
  gather_perdb_stats = true

System info:

OS : 4.9.0-16-amd64 #1 SMP Debian 4.9.272-2 (2021-07-19) x86_64 GNU/Linux
Telegraf version : Telegraf 1.19.3 (git: HEAD a799489)

Steps to reproduce:

start telegraf

Expected behavior:

Telegraf must gather metrics from mongo

Actual behavior:

Telegraf fails to get metrics from mongo

Additional info:

Logs:
E! [inputs.mongodb] Unable to get oplog stats: mongo: no documents in result
E! [inputs.mongodb] failed to gather data: "(NotMasterOrSecondary) node is not in primary or recovering state"

@alx75 alx75 added the bug unexpected problem or unintended behavior label Sep 10, 2021
@denispershin
Copy link
Contributor

Hi! If you want to run telegraf on arbiter, you have to comment or delete gather_perdb_stats = true. Arbiter does not have any information about collection or db.

@alx75
Copy link
Author

alx75 commented Sep 27, 2021

Great thanks it worked.

I do not see any option to get rid of the oplog stat that generates a lot of logs though. Any ideas ?

@alx75 alx75 closed this as completed Sep 27, 2021
@denispershin
Copy link
Contributor

denispershin commented Sep 27, 2021

For current implementation it is impossible, telegraf gather "replSetGetStatus" and "oplog.rs" by default. But you can disable log file in config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mongodb bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants