-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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 Input Plugin unexcepted output #9555
Comments
Same kind of new unexpected behavior here on 1.19.2, while running on a delayed secondary, I get
Excerpt from rs.config():
And yet, telegraf sends:
|
Hi, I have the same kind of behaviour with telegraf 1.19.3. Here are the data for a secondary node from influxDB when the rollback was made.
mongo is in v4.2.14 |
We do have the same problem. I skimmed through the code and I wonder if the problem is because in the commit that introduced the new mongo driver (https://github.com/influxdata/telegraf/pull/9493/files) we do not set the RunCmdOptions.ReadPreference and by default it's nil which means primary read (runcmdoptions.go) . I didn't get the time yet to put something together and test the theory |
I just switch the configuration to the following :
as per noted here : https://pkg.go.dev/go.mongodb.org/mongo-driver/mongo#Connect Seems to do the trick. |
IMO it would be worth putting this info in the mongodb input README. This is also worth being mentioned in the changelog since this is a breaking change. |
By default, the mongo-driver library will attempt to use the primary node of a cluster. For monitoring with Telegraf, users may specify a secondary node that they want to monitor. In these cases, the user will need to specify a direct connection to that node. The library has a number of options for how it connects, which include primary, primary preferred, secondary, secondary preferred, and closest. None of these are options to ensure that the specified node is used. fixes: influxdata#11275 fixes: influxdata#9555
By default, the mongo-driver library will attempt to use the primary node of a cluster. For monitoring with Telegraf, users may specify a secondary node that they want to monitor. In these cases, the user will need to specify a direct connection to that node. The library has a number of options for how it connects, which include primary, primary preferred, secondary, secondary preferred, and closest. None of these are options to ensure that the specified node is used. fixes: influxdata#11275 fixes: influxdata#9555
mongo v3.2.10
telegraf 1.19
I choose telegraf+prom+grafana to build my montior
I want to collect topstats of collections
when I check top_stat I found unexcepted output
1、one collection with node_type="PRI" but hostname was cfgsrv ip ,not the primary ip
2、cfgsrv has three rs ,so the output also become three
however my telegraf config do not include cfgsrv ips
I learn that the data is from {top:1} but how do it compare its hostname
The text was updated successfully, but these errors were encountered: