lib/sensu-plugins-mongodb/metics.rb in sensu-plugins-mongodb-1.4.0 vs lib/sensu-plugins-mongodb/metics.rb in sensu-plugins-mongodb-1.4.1
- old
+ new
@@ -164,11 +164,11 @@
end
end
# Database Sizes
@mongo_client.database_names.each do |name|
- @mongo_client.use(name)
+ @mongo_client = @mongo_client.use(name)
db = @mongo_client.database
result = db.command(dbstats: 1).documents.first
server_metrics["databaseSizes.#{name}.collections"] = result['collections']
server_metrics["databaseSizes.#{name}.objects"] = result['objects']
server_metrics["databaseSizes.#{name}.avgObjSize"] = result['avgObjSize']
@@ -179,10 +179,10 @@
server_metrics["databaseSizes.#{name}.indexSize"] = result['indexSize']
server_metrics["databaseSizes.#{name}.fileSize"] = result['fileSize']
server_metrics["databaseSizes.#{name}.nsSizeMB"] = result['nsSizeMB']
end
# Reset back to previous database
- @mongo_client.use(@db.name)
+ @mongo_client = @mongo_client.use(@db.name)
# Journaling (durability)
if server_status.key?('dur')
dur = server_status['dur']
server_metrics['journal.commits'] = dur['commits']