bin/metrics-cassandra-graphite.rb in sensu-plugins-cassandra-0.0.4 vs bin/metrics-cassandra-graphite.rb in sensu-plugins-cassandra-0.0.5

- old
+ new

@@ -73,11 +73,11 @@ 'bytes' => 1, 'KB' => 1024, 'MB' => 1024**2, 'GB' => 1024**3, 'TB' => 1024**4 -} +}.freeze # # Cassandra Metrics # class CassandraMetrics < Sensu::Plugin::Metric::CLI::Graphite @@ -186,11 +186,11 @@ # TB/GB/MB/KB/bytes # def parse_info# rubocop:disable all info = nodetool_cmd('info') # #YELLOW - info.each_line do |line| # rubocop:disable Style/Next + info.each_line do |line| if m = line.match(/^Exceptions\s*:\s+([0-9]+)$/)# rubocop:disable all output "#{config[:scheme]}.exceptions", m[1], @timestamp end if m = line.match(/^Load\s*:\s+([0-9.]+)\s+([KMGT]B|bytes)$/)# rubocop:disable all @@ -248,12 +248,12 @@ # MUTATION 0 # REQUEST_RESPONSE 0 def parse_tpstats# rubocop:disable all tpstats = nodetool_cmd('tpstats') tpstats.each_line do |line| - next if line.match(/^Pool Name/) - next if line.match(/^Message type/) + next if line =~ /^Pool Name/ + next if line =~ /^Message type/ if m = line.match(/^(\w+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$/)# rubocop:disable all (thread, active, pending, completed, blocked) = m.captures output "#{config[:scheme]}.threadpool.#{thread}.active", active, @timestamp @@ -320,10 +320,10 @@ # - a line preceeded by 2 tabs contains column family metrics def parse_cfstats def get_metric(string) # rubocop:disable NestedMethodDefinition string.strip! (metric, value) = string.split(': ') - if metric.nil? || value.nil? + if metric.nil? || value.nil? # rubocop:disable Style/GuardClause return [nil, nil] else # sanitize metric names for graphite metric.gsub!(/[^a-zA-Z0-9]/, '_') # convert all other chars to _ metric.gsub!(/[_]*$/, '') # remove any _'s at end of the string