lib/riemann/babbler/plugins/net.rb in riemann-babbler-0.2.0 vs lib/riemann/babbler/plugins/net.rb in riemann-babbler-0.2.1
- old
+ new
@@ -26,11 +26,10 @@
end
def net
f = File.read('/proc/net/dev')
status = Hash.new
- @diff = Hash.new
f.split("\n").each do |line|
iface = line.split(":")[0].strip
iface.gsub!(/\./,"_")
next unless line =~ /(\w*)\:\s*([\s\d]+)\s*/
WORDS.map do |service|
@@ -39,19 +38,17 @@
$2.split(/\s+/).map { |str| str.to_i }
).each do |service, value|
status.merge!({service => value})
end
end
- status.each_key { |key| @diff.merge!({key => status[key] - @old_status[key]}) } unless @old_status.empty?
- @old_status = status
- @diff
+ status
end
def tick
status = net
status.each_key do |service|
#next if status[service] == 0
- report({
+ report_with_diff({
:service => service,
:metric => status[service]
})
end
end