lib/riemann/babbler/plugins/net.rb in riemann-babbler-0.2.8 vs lib/riemann/babbler/plugins/net.rb in riemann-babbler-0.3.0
- old
+ new
@@ -1,33 +1,25 @@
class Riemann::Babbler::Net
include Riemann::Babbler
WORDS = ['rx bytes',
- 'rx packets',
- 'rx errs',
- 'rx drop',
- 'rx fifo',
- 'rx frame',
- 'rx compressed',
- 'rx multicast',
- 'tx bytes',
- 'tx packets',
- 'tx drops',
- 'tx fifo',
- 'tx colls',
- 'tx carrier',
- 'tx compressed']
+ 'rx packets',
+ 'rx errs',
+ 'rx drop',
+ 'rx fifo',
+ 'rx frame',
+ 'rx compressed',
+ 'rx multicast',
+ 'tx bytes',
+ 'tx packets',
+ 'tx drops',
+ 'tx fifo',
+ 'tx colls',
+ 'tx carrier',
+ 'tx compressed']
- def plugin
- options.plugins.net
- end
-
- def init
- @old_status = Hash.new
- end
-
- def net
+ def collect
f = File.read('/proc/net/dev')
status = Hash.new
f.split("\n").each do |line|
iface = line.split(":")[0].strip
iface.gsub!(/\./,"_")
@@ -41,20 +33,7 @@
end
end
status
end
- def tick
- status = net
- status.each_key do |service|
- #next if status[service] == 0
- report({
- :service => service,
- :metric => status[service],
- :is_diff => true
- })
- end
- end
-
end
-Riemann::Babbler::Net.run