bin/metrics-cassandra-graphite.rb in sensu-plugins-cassandra-0.0.5 vs bin/metrics-cassandra-graphite.rb in sensu-plugins-cassandra-1.0.0
- old
+ new
@@ -70,13 +70,17 @@
require 'socket'
UNITS_FACTOR = {
'bytes' => 1,
'KB' => 1024,
+ 'KiB' => 1024,
'MB' => 1024**2,
+ 'MiB' => 1024**2,
'GB' => 1024**3,
- 'TB' => 1024**4
+ 'GiB' => 1024**3,
+ 'TB' => 1024**4,
+ 'TiB' => 1024**4
}.freeze
#
# Cassandra Metrics
#
@@ -191,11 +195,11 @@
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
+ if m = line.match(/^Load\s*:\s+([0-9.]+)\s+([KMGT]i?B|bytes)$/)# rubocop:disable all
output "#{config[:scheme]}.load", convert_to_bytes(m[1], m[2]), @timestamp
end
if m = line.match(/^Uptime[^:]+:\s+(\d+)$/)# rubocop:disable all
output "#{config[:scheme]}.uptime", m[1], @timestamp
@@ -341,10 +345,10 @@
keyspace = nil
cf = nil
cfstats.each_line do |line|
num_indents = line.count("\t")
- if m = line.match(/^Keyspace:\s+(\w+)$/)# rubocop:disable all
+ if m = line.match(/^Keyspace\s?:\s+(\w+)$/)# rubocop:disable all
keyspace = m[1]
elsif m = line.match(/\t\tColumn Family[^:]*:\s+(\w+)$/)# rubocop:disable all
cf = m[1]
elsif num_indents == 0
# keyspace = nil