aio_elin 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d58fe2e4aa1926532b060162295287d8bcb4e21558abc6c076eab95880c2193b
4
- data.tar.gz: 621981fd2c0f9ff81bca907737fcde468cd569299f26e31d1e5d2ac696f2b1e9
3
+ metadata.gz: 4ff4b79d8dfb0eee95b68a8fb9ea60048d8334ba960ed423f96bf0243b7a22ca
4
+ data.tar.gz: ff4eabfe6f0d01ad5eb6b6d256373db776e0c5b0748766af5eb130a5268f4d89
5
5
  SHA512:
6
- metadata.gz: 157a2bf1cf0e15ea4b4bb1fab624f5e0a29b46a59e4c8a541e7702e757da5a10ee6c4e6fe1993af336ff61e9bde4aceaf5d93f13f905e1dcdb2ecacc0ee5d314
7
- data.tar.gz: 38a0fe68b1f51befcb0d8c13d959678585159ad20f608518aa253b9e81bb40396c22401aca2bce59de9abca10b9e1ed26ac73d52c238186d1c69f218dddcb34f
6
+ metadata.gz: c1e41c44d5d6ee7af92a666415755076b6111df2601bf76f95e5e2bf07b10eafff8c76d8ca780f3cee702ee84fdb69b02c323abbcebda578b6735334a0253d31
7
+ data.tar.gz: 3a23240a7853a3258c292ebdf77abff04aa128cbbfa5fada3e76b8894b64635e019bbea0b6d300e40f1c3b674652d4324aadbe4983b7c8df89e0284a6d7bfba7
@@ -3,79 +3,56 @@
3
3
  require "aio/core"
4
4
 
5
5
  class Aio::Module::Cmd::Cisco::ShowIpRouteSummary < Aio::Module::Cmd::Cisco
6
- include Aio::Module
6
+ include Aio::Module
7
+
8
+ def initialize
9
+ super({
10
+ :cmd_full => "show ip route summary",
11
+ :cmd_short => "sh ip rou sum",
12
+ :author => "Elin",
13
+ :description => "This is Cisco Command# show ip route summary",
14
+ :platform => "all",
15
+ :benchmark => {}
16
+ })
17
+ end
18
+
19
+ def parse
20
+ cont = self.context.dup
21
+ summary = {}
22
+ useful[:route_summary] = summary
23
+
24
+ cont.readline_match_block(/Route Source Networks Subnets Replicates Overhead/)
25
+ cont.readline_match_block(/connected (?<networks>\d+) (?<subnets>\d+) (?<replicates>\d+)/) do |block|
26
+ summary_conn = {}
27
+ summary[:connected] = summary_conn
28
+ block.update(summary_conn, :networks)
29
+ block.update(summary_conn, :subnets)
30
+ block.update(summary_conn, :replicates)
31
+ end
32
+
33
+ cont.readline_match_block(/static (?<networks>\d+) (?<subnets>\d+) (?<replicates>\d+)/) do |block|
34
+ summary_static = {}
35
+ summary[:static] = summary_static
36
+ block.update(summary_static, :networks)
37
+ block.update(summary_static, :subnets)
38
+ block.update(summary_static, :replicates)
39
+ end
40
+
41
+
42
+ # 有的多一个Replicates,整个数值有可能是5,也有可能是4
43
+ # 但是后面的 Replicates Overhead Memory 不做考虑,直接忽略
44
+ cont.readline_match_block_loop(/(?<proto>[^\d\s]+) (?<proto_id>\d+) (?<networks>\d+) (?<subnets>\d+) (?<replicates>\d+) .*/, reg_blank) do |block|
45
+ proto = block[:proto]
46
+ proto_id = block[:proto_id]
47
+ summary_proto = {}
48
+ summary["#{proto}_#{proto_id}".to_sym] = summary_proto
49
+ block.update(summary_proto, :proto, proto)
50
+ block.update(summary_proto, :proto_id)
51
+ block.update(summary_proto, :networks)
52
+ block.update(summary_proto, :subnets)
53
+ block.update(summary_proto, :replicates)
54
+ end
55
+ end
7
56
 
8
- def initialize
9
- super({
10
- :cmd_full => "show ip route summary",
11
- :cmd_short => "sh ip rou sum",
12
- :author => "Elin",
13
- :description => "This is Cisco Command# show ip route summary",
14
- :platform => "all",
15
- :benchmark => {}
16
- })
17
- end
18
57
 
19
- def parse
20
- cont = self.context.dup
21
- summary = {}
22
- useful[:route_summary] = summary
23
-
24
- cont.readline_match_block(/Route Source Networks Subnets Replicates Overhead/)
25
- cont.readline_match_block(/connected (?<networks>\d+) (?<subnets>\d+) (?<replicates>\d+)/) do |block|
26
- summary_conn = {}
27
- summary[:connected] = summary_conn
28
- block.update(summary_conn, :networks)
29
- block.update(summary_conn, :subnets)
30
- block.update(summary_conn, :replicates)
31
- end
32
-
33
- cont.readline_match_block(/static (?<networks>\d+) (?<subnets>\d+) (?<replicates>\d+)/) do |block|
34
- summary_static = {}
35
- summary[:static] = summary_static
36
- block.update(summary_static, :networks)
37
- block.update(summary_static, :subnets)
38
- block.update(summary_static, :replicates)
39
- end
40
-
41
- loop do
42
- # 当出现 internal 则代表循环结束
43
- if cont.count_line =~ /internal/
44
- cont.readline_match_block(/internal (?<networks>\d+)/) do |block|
45
- summary[:internal] = {}
46
- block.update(summary[:internal], :networks)
47
- end
48
- break
49
- end
50
-
51
- # 当出现不是预想情况,则跳过
52
- unless cont.count_line =~ /.*\s+\d+\s+\d+\s+\d+\s+\d+/
53
- cont.next
54
- next
55
- end
56
-
57
- # 有的多一个Replicates,整个数值有可能是5,也有可能是4
58
- # 但是后面的 Replicates Overhead Memory 不做考虑,直接忽略
59
- cont.readline_match_block(/(?<proto>[^\d\s]+) (?<proto_id>\d+) (?<networks>\d+) (?<subnets>\d+) (?<replicates>\d+) .*/) do |block|
60
- proto = block[:proto]
61
- proto_id = block[:proto_id]
62
- summary_proto = {}
63
- summary["#{proto}_#{proto_id}".to_sym] = summary_proto
64
- block.update(summary_proto, :proto, proto)
65
- block.update(summary_proto, :proto_id)
66
- block.update(summary_proto, :networks)
67
- block.update(summary_proto, :subnets)
68
- block.update(summary_proto, :replicates)
69
- end
70
- end
71
-
72
- cont.readline_match_block(/Total (?<networks>\d+) (?<subnets>\d+) (?<replicates>\d+)/) do |block|
73
- summary_total = {}
74
- summary[:total] = summary_total
75
- block.update(summary_total, :networks)
76
- block.update(summary_total, :subnets)
77
- block.update(summary_total, :replicates)
78
- end
79
-
80
- end
81
58
  end
@@ -3,33 +3,33 @@
3
3
  require "aio/core"
4
4
 
5
5
  class Aio::Module::Cmd::Cisco::ShowProcessCPU < Aio::Module::Cmd::Cisco
6
- include Aio::Module
6
+ include Aio::Module
7
7
 
8
- def initialize
9
- super({
10
- :cmd_full => "show process cpu",
11
- :cmd_short => "sh pro cpu",
12
- :author => "Elin",
13
- :description => "This is Cisco Command# show process cpu",
14
- :ranking => Ranking_1,
15
- :platform => "all",
16
- :benchmark => {
17
- :seconds_5 => ["<", 50],
18
- :minute_1 => ["<", 50],
19
- :minutes_5 => ["<", 50],
20
- }
21
- })
22
- end
8
+ def initialize
9
+ super({
10
+ :cmd_full => "show process cpu",
11
+ :cmd_short => "sh pro cpu",
12
+ :author => "Elin",
13
+ :description => "This is Cisco Command# show process cpu",
14
+ :ranking => Ranking_1,
15
+ :platform => "all",
16
+ :benchmark => {
17
+ :seconds_5 => ["<", 50],
18
+ :minute_1 => ["<", 50],
19
+ :minutes_5 => ["<", 50],
20
+ }
21
+ })
22
+ end
23
23
 
24
- def parse
25
- cont = self.context.dup
26
- cpu = {}
27
- useful[:cpu] = cpu
24
+ def parse
25
+ cont = self.context.dup
26
+ cpu = {}
27
+ useful[:cpu] = cpu
28
28
 
29
- cont.readline_match_block(/one minute: (?<minute_1>\d+)%; five minutes: (?<minutes_5>\d+)%/) do |block|
30
- #block.warning_serious(cpu, :seconds_5, self)
31
- #block.warning_serious(cpu, :minute_1, self)
32
- block.warning_serious(cpu, :minutes_5, self)
33
- end
34
- end
29
+ cont.readline_match_block(/one minute: (?<minute_1>\d+)%; five minutes: (?<minutes_5>\d+)%/) do |block|
30
+ #block.warning_serious(cpu, :seconds_5, self)
31
+ #block.warning_serious(cpu, :minute_1, self)
32
+ block.warning_serious(cpu, :minutes_5, self)
33
+ end
34
+ end
35
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aio_elin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-13 00:00:00.000000000 Z
11
+ date: 2019-01-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 网络设备巡检工具
14
14
  email: 365433079@qq.com