Skip to content

Commit

Permalink
Merge pull request sensu#43 from kcrayon/more-system-metrics
Browse files Browse the repository at this point in the history
Fix interface metrics.
  • Loading branch information
portertech committed Apr 16, 2012
2 parents 223c682 + c0190aa commit b3a9a59
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/system/interface-metrics.rb
Expand Up @@ -23,10 +23,12 @@ def run
]

File.open("/proc/net/dev", "r").each_line do |line|
interface, stats_string = line.scan(/^\s+([^:]+):\s+(.*)$/).first
interface, stats_string = line.scan(/^\s*([^:]+):\s*(.*)$/).first
next unless interface

stats = stats_string.split(/\s+/)
next if stats == ['0'].cycle.take(stats.size)

metrics.size.times { |i| output "#{config[:scheme]}.#{interface}.#{metrics[i]}", stats[i] }
end

Expand Down

0 comments on commit b3a9a59

Please sign in to comment.