bin/riemann-net in riemann-tools-0.1.7 vs bin/riemann-net in riemann-tools-0.1.8
- old
+ new
@@ -10,10 +10,12 @@
opt :interfaces, "Interfaces to monitor", :type => :strings, :default => nil
opt :ignore_interfaces, "Interfaces to ignore", :type => :strings, :default =>['lo']
def initialize
@old_state = nil
+ @interfaces = opts[:interfaces].map(&:dup) if opts[:interfaces]
+ @ignore_interfaces = opts[:ignore_interfaces].map(&:dup)
end
def state
f = File.read('/proc/net/dev')
state = f.split("\n").inject({}) do |s, line|
@@ -46,17 +48,17 @@
s
end
# Filter interfaces
- if is = opts[:interfaces]
+ if is = @interfaces
state = state.select do |service, value|
is.include? service.split(' ').first
end
end
state = state.reject do |service, value|
- opts[:ignore_interfaces].include? service.split(' ').first
+ @ignore_interfaces.include? service.split(' ').first
end
state
end