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

Telegraf MongoDB plugin doesn't work. #11830

Closed
hackdefendr opened this issue Sep 18, 2022 · 7 comments · Fixed by #11849
Closed

Telegraf MongoDB plugin doesn't work. #11830

hackdefendr opened this issue Sep 18, 2022 · 7 comments · Fixed by #11849
Labels
area/mongodb bug unexpected problem or unintended behavior plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins regression something that used to work, but is now broken

Comments

@hackdefendr
Copy link

Relevant telegraf.conf

[[inputs.mongodb]]
  servers = ["mongodb://192.168.10.81:27017"]
  gather_perdb_stats = true
  gather_col_stats = true
  gather_top_stat = true
  col_stats_dbs = ["jschan"]

Logs from Telegraf

No logs. No errors.

System info

Telegraf 1.24.0 (git: HEAD@3c4a6516), Debian 11.4, LXC

Docker

N/A

Steps to reproduce

  1. Install Telegraf
  2. Configure required output and input
  3. Verify connectivity outside of Telegraf
    ...

Expected behavior

I expect Telegraf to connect to my MongoDB and pull the configured metrics.

root@influx:~# telnet 192.168.10.81 27017
Trying 192.168.10.81...
Connected to 192.168.10.81.
Escape character is '^]'.
^]
telnet> quit
Connection closed.

Actual behavior

Nothing happens. Nothing is logged.

When I run: telegraf --config /etc/telegraf/telegraf.conf --input-filter mongodb --test there is no output. It doesn't even try to connect from what I can tell. TCPDump shows zero packets going to my MongoDB server.

root@influx:~# telegraf --config /etc/telegraf/telegraf.conf --input-filter mongodb --test
2022-09-18T16:36:30Z I! Starting Telegraf 1.24.0
2022-09-18T16:36:30Z I! Available plugins: 222 inputs, 9 aggregators, 26 processors, 20 parsers, 57 outputs
2022-09-18T16:36:30Z I! Loaded inputs: mongodb
2022-09-18T16:36:30Z I! Loaded aggregators: 
2022-09-18T16:36:30Z I! Loaded processors: 
2022-09-18T16:36:30Z W! Outputs are not used in testing mode!
2022-09-18T16:36:30Z I! Tags enabled: host=influx.unfufadoo.net

Additional info

Proxmox VE is the primary host. InfluxDB runs in a container. MongoDB runs in another container. Everything is on the same subnet with no internal firewalls between the containers.

Can someone help me figure this out? I am out of ideas.

Regards,
Jeff

@hackdefendr hackdefendr added the bug unexpected problem or unintended behavior label Sep 18, 2022
@hackdefendr
Copy link
Author

Here is that telegraf command with --debug:

root@influx:~# telegraf --config /etc/telegraf/telegraf.conf --input-filter mongodb --debug --test 
2022-09-18T16:44:32Z I! Starting Telegraf 1.24.0
2022-09-18T16:44:32Z I! Available plugins: 222 inputs, 9 aggregators, 26 processors, 20 parsers, 57 outputs
2022-09-18T16:44:32Z I! Loaded inputs: mongodb
2022-09-18T16:44:32Z I! Loaded aggregators: 
2022-09-18T16:44:32Z I! Loaded processors: 
2022-09-18T16:44:32Z W! Outputs are not used in testing mode!
2022-09-18T16:44:32Z I! Tags enabled: host=influx.unfufadoo.net
2022-09-18T16:44:32Z D! [agent] Initializing plugins
2022-09-18T16:44:32Z D! [agent] Starting service inputs
2022-09-18T16:44:32Z D! [agent] Stopping service inputs
2022-09-18T16:44:32Z D! [agent] Input channel closed
2022-09-18T16:44:32Z D! [agent] Stopped Successfully

@MaxSamsonov
Copy link

Same issue. 1.23.4 works fine. At 1.24 - seems nothing happens with mongodb plugin.

OS: Centos8
MongoDB: 4.4.16

@hackdefendr
Copy link
Author

Confirmed. I downgraded to Telegraf 1.23.4-1 and I am now seeing mongo metrics.

@Hipska Hipska added regression something that used to work, but is now broken area/mongodb plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Sep 19, 2022
@xkvnn
Copy link

xkvnn commented Sep 20, 2022

Same here with v1.24.0

powersj added a commit to powersj/telegraf that referenced this issue Sep 20, 2022
The start method handler did not match the interface, nor was there a
stop function. As a result, start was never called and the plugin was
never setting up the servers to connect to and collect from correctly.

This was introduced in influxdata#11629.

fixes: influxdata#11830
@powersj
Copy link
Contributor

powersj commented Sep 20, 2022

Hey Folks,

I took a look at this today and it looks like we made a mistake while merging #11629. I have put up #11849 with a fix, if someone could grab the artifacts from the tiger bot in the next 20-30 mins and test them out I would greatly appreciate it.

Thanks!

@hackdefendr
Copy link
Author

It will be a little longer than 30 minutes before I can test this out. But I will test this out for you Josh!
Thanks for the speedy turnaround.

@hackdefendr
Copy link
Author

Tests all pass. Upgraded and reconfigured.
Getting good metrics now.

We can close this out when you see fit.

J

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 plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins regression something that used to work, but is now broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants