lib/mongodb/graphite/agent.rb in mongodb-graphite-agent-0.0.9 vs lib/mongodb/graphite/agent.rb in mongodb-graphite-agent-0.1.0

- old
+ new

@@ -6,10 +6,11 @@ require 'socket' require 'awesome_print' require 'time_difference' require 'mongodb/graphite/agent/utils' require 'mongodb/graphite/agent/op_counters_sample' +require 'mongodb/graphite/agent/mongo_cient_extensions' module Mongodb module Graphite module Agent class Runner @@ -27,12 +28,14 @@ server_status_result = connection["local"].command('serverStatus' => 1) metric_hash = Utils.to_hash(server_status_result).select { |k| k.match('^connection|^network\.|^cursors|^mem\.mapped|^indexCounters|^repl.oplog') } - unless (@opts[:mongodb_replicaset].blank?) + if (connection.is_replicaset?) + puts "ReplicaSet detected" if @opts[:verbose] opcounters_per_second_metric_hash = calculate_opcounters_per_second server_status_result["opcountersRepl"] else + puts "Single host mode detected" if @opts[:verbose] opcounters_per_second_metric_hash = calculate_opcounters_per_second server_status_result["opcounters"] end if @opts[:verbose] puts "Calculating metrics..." \ No newline at end of file