[ZBX-22689] mongodb.ping is using default client timeout Created: 2023 Apr 17 Updated: 2024 Apr 10 Resolved: 2023 May 16 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Agent2 plugin (G) |
Affects Version/s: | 6.4.1 |
Fix Version/s: | 6.0.18rc1, 6.4.3rc1, 7.0.0alpha1, 7.0 (plan) |
Type: | Problem report | Priority: | Minor |
Reporter: | Aigars Kadikis | Assignee: | Eriks Sneiders |
Resolution: | Fixed | Votes: | 1 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Issue Links: |
|
||||
Team: | |||||
Sprint: | Sprint 99 (Apr 2023), Sprint 100 (May 2023) | ||||
Story Points: | 1 |
Description |
Mongo driver is having multiple timeouts and one of them is serverSelectionTimeoutMS integer 30000 Specifies the number of milliseconds to wait to find an available, suitable server to execute an operation. It has a default value of 30 seconds, so it will always try maximum time allowed by Zabbix agent. The MongoDB timeout for agent 2 plugin should be configurable or at least smaller than default timeout. In the source, part where it is creating connection options We can modify the code to allow the user to manually configure timeout. Here is diff of MongoDB plugin which allows to lower down timeout: diff --git a/plugin/conn.go b/plugin/conn.go index e872a78..7cf65bb 100644 --- a/plugin/conn.go +++ b/plugin/conn.go @@ -298,6 +298,7 @@ func (c *ConnManager) createOptions(uri uri.URI, details tlsconfig.Details) (*op opt.SetHosts([]string{uri.Addr()}) opt.SetDirect(true) opt.SetConnectTimeout(c.timeout) + opt.SetServerSelectionTimeout(c.timeout) opt.SetMaxPoolSize(1) return opt, nil Now we can use: Plugins.MongoDB.Timeout=1 Registering this as a bug report because with existing agent configuration, it's not possible to workaround the issue. The poller which is fetching "mongodb.ping" metric will get stuck. |
Comments |
Comment by Eriks Sneiders [ 2023 May 10 ] |
FIXED in
|