Skip to content

Commit 89f4dbc

Browse files
committed
Ensure server + replicaset metrics are pulled for local host, not using 'read preference'
1 parent f047ede commit 89f4dbc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/sensu-plugins-mongodb/metics.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ def get_mongo_client(db_name)
376376
address_str = "#{host}:#{port}"
377377
client_opts = {}
378378
client_opts[:database] = db_name
379+
client_opts[:connect] = :direct
379380
unless db_user.nil?
380381
client_opts[:user] = db_user
381382
client_opts[:password] = db_password

0 commit comments

Comments
 (0)