SHOW:
|
|
- or go back to the newest paste.
1 | puts "autonomous_system_name\tcider\tpercentage" | |
2 | @all_stats.each do |stat| | |
3 | asys = stat.autonomous_system | |
4 | name = asys.name | |
5 | pgbb = stat.percentages_grouped_by_block | |
6 | pgbb.each do |k ,v| | |
7 | puts "#{name}\t#{k}\t#{v}" | |
8 | end | |
9 | end | |
10 | ||
11 | __END__ | |
12 | input | |
13 | @all_stats= | |
14 | [#<LowIpAlertStat:0x7f5af0527cc0 | |
15 | @autonomous_system= | |
16 | #<AutonomousSystem id: 11, name: "DFW", number: 33070, description: "DFW", created_at: nil, updated_at: "2013-09-04 19:30:06", owner_number: "DCO1", private: false, autonomous_system_id: nil, network_environment_id: 55, low_ip_alert_check: true, low_ip_alert_threshold: 70>, | |
17 | @percentages_grouped_by_block= | |
18 | {"166.78.42.0/23"=>100.0, | |
19 | "166.78.33.0/24"=>100.0, | |
20 | "209.61.129.0/24"=>100.0, | |
21 | "166.78.36.0/22"=>99.21875, | |
22 | "166.78.32.0/24"=>100.0, | |
23 | "209.61.131.0/24"=>100.0, | |
24 | "209.61.128.0/24"=>100.0, | |
25 | "50.56.228.0/24"=>100.0},>] | |
26 | =>nil | |
27 | ||
28 | desired out put | |
29 | autonomous_system_name cider percentage | |
30 | DFW 166.78.42.0/23 100 | |
31 | DFW 166.78.33.0/24 100 | |
32 | DFW 209.61.129.0/24 100.0 | |
33 | DFW 166.78.36.0/22 99.21875 |