Guest User

Untitled

a guest
Jan 21st, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. ints = Hash.new
  2. Device.all.each do |d|
  3. if d.hostname =~ /rwc.*idf/
  4. d.interfaces.each do |i|
  5. ints[i.speed] = 0 unless ints.has_key?(i.speed)
  6. ints[i.speed] += 1 if (i.up? || (!i.up? && i.last_changed > 30.days.ago))
  7. end
  8. end
  9. end
  10. ints.each_pair do |speed,count|
  11. puts "#{speed}: #{count}"
  12. end
Add Comment
Please, Sign In to add comment