aio_elin 1.0.4 → 1.0.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7705e0b0dfd3a615aaaea053cd08f487f6d28a2ff52836a84a53c060db2f32e0
|
4
|
+
data.tar.gz: 68891b269da5dd3e5718dd561378485ef2af1c48cb1e6f2adab335d3001d45fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9ade4e7e071112527b159cdca410b5a3811459e088fa8fe6fccaaa40b048487f06d25c02295fe2c6aae4eeb1747d435ee24e37b539c2cfb525dfaf918251c4c
|
7
|
+
data.tar.gz: 9c9cf70d64214bbe40677add0bca5bd9895d7f4e3f348581c3366b7ba55e83122dc0b9f6c603240527bc54413461b9f316dcc69b048c8d51ab63c28740e26bca
|
@@ -25,7 +25,7 @@ class Aio::Module::Cmd::H3C::DisplayCpu < Aio::Module::Cmd::H3C
|
|
25
25
|
cont = self.context.dup
|
26
26
|
useful[:cpu] = {}
|
27
27
|
loop do
|
28
|
-
cont.readline_range(/Slot \d+ CPU usage/, reg_blank) do |cont_layer|
|
28
|
+
cont.readline_range(/Slot \d+ (CPU \d+\s+){0,1}CPU usage/, reg_blank) do |cont_layer|
|
29
29
|
parse_cpu(cont_layer)
|
30
30
|
end
|
31
31
|
end
|
@@ -34,7 +34,9 @@ class Aio::Module::Cmd::H3C::DisplayCpu < Aio::Module::Cmd::H3C
|
|
34
34
|
def parse_cpu(context)
|
35
35
|
cpu = {}
|
36
36
|
useful[:cpu] = cpu
|
37
|
-
context.readline_match_block(/Slot (?<slot_id>\d+) CPU/) do |block|
|
37
|
+
context.readline_match_block(/Slot (?<slot_id>\d+) (CPU \d+\s+){0,1}CPU/) do |block|
|
38
|
+
# 目前只保留 slot 0 的CPU使用率
|
39
|
+
#return if block[:slot_id].to_s != '0'
|
38
40
|
block.update(cpu, :slot_id)
|
39
41
|
end
|
40
42
|
context.readline_match_block(/(?<seconds_5>\d+)% in last 5 seconds/) do |block|
|
@@ -3,88 +3,77 @@
|
|
3
3
|
require "aio/core"
|
4
4
|
|
5
5
|
class Aio::Module::Cmd::H3C::DisplayFan < Aio::Module::Cmd::H3C
|
6
|
-
|
6
|
+
include Aio::Module
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
8
|
+
def initialize
|
9
|
+
super({
|
10
|
+
:cmd_full => "display fan",
|
11
|
+
:cmd_short => "dis fan",
|
12
|
+
:author => "Elin",
|
13
|
+
:description => "This is H3C Command# display fan",
|
14
|
+
:ranking => Ranking_1,
|
15
|
+
:platform => "all",
|
16
|
+
:benchmark => {
|
17
|
+
:fan_status => ["=~", /Normal/],
|
18
|
+
},
|
19
|
+
})
|
20
|
+
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
22
|
+
def parse
|
23
|
+
cont = self.context.dup
|
24
|
+
useful[:fan] = {}
|
25
|
+
case device_template
|
26
|
+
when Template_1
|
27
|
+
cont.readline_range_loop(/Slot/, /Slot/) do |cont_layer|
|
28
|
+
parse_slot(cont_layer)
|
29
|
+
end
|
30
|
+
when Template_2
|
31
|
+
cont.readline_range_loop(/Unit/, /Unit/) do |cont_layer|
|
32
|
+
parse_unit(cont_layer)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
+
# 遇到的有两种情况,开头是Slot 或者是 Unit
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
39
|
+
def parse_slot(context)
|
40
|
+
fan = {}
|
41
|
+
context.readline_match_block(/Slot (?<slot_id>\d+)/) do |block|
|
42
|
+
useful[:fan] = {}
|
43
|
+
useful[:fan]["slot_#{block[:slot_id]}"] = fan
|
44
|
+
block.update(fan, :slot_id)
|
45
|
+
end
|
46
|
+
context.readline_range_loop(/FAN \d+/, reg_blank) do |cont_layer|
|
47
|
+
parse_slot_2(cont_layer, fan)
|
48
|
+
end
|
49
|
+
end
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
51
|
+
def parse_slot_2(context, fan)
|
52
|
+
fan_id = nil
|
53
|
+
context.readline_match_block(/FAN (?<fan_id>\d+)/) do |block|
|
54
|
+
fan_id = block[:fan_id]
|
55
|
+
fan["fan_#{fan_id}"] = {}
|
56
|
+
block.update(fan["fan_#{fan_id}"], :fan_id)
|
57
|
+
end
|
58
|
+
context.readline_match_block(/State : (?<fan_status>.*)/) do |block|
|
59
|
+
block.warning_serious(fan["fan_#{fan_id}"], :fan_status, self)
|
60
|
+
end
|
61
|
+
end
|
61
62
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
63
|
+
def parse_unit(context)
|
64
|
+
fan = {}
|
65
|
+
context.readline_match_block(/Unit (?<slot_id>\d+)/) do |block|
|
66
|
+
useful[:fan]["slot_#{block[:slot_id]}"] = fan
|
67
|
+
block.update(fan, :slot_id)
|
68
|
+
end
|
69
|
+
context.readline_match_block_loop(/Fan (?<fan_id>\d+) State: (?<fan_status>.*)/, reg_blank) do |block|
|
70
|
+
fan_id = block[:fan_id]
|
71
|
+
fan["fan_#{fan_id}"] = {}
|
72
|
+
block.update(fan["fan_#{fan_id}"], :fan_id)
|
73
|
+
block.warning_serious(fan["fan_#{fan_id}"], :fan_status, self)
|
74
|
+
end
|
75
|
+
end
|
73
76
|
|
74
|
-
def parse_unit(context)
|
75
|
-
fan = {}
|
76
|
-
context.readline_match_block(/Unit (?<slot_id>\d+)/) do |block|
|
77
|
-
useful[:fan]["slot_#{block[:slot_id]}"] = fan
|
78
|
-
block.update(fan, :slot_id)
|
79
|
-
end
|
80
|
-
context.readline_match_block_loop(/Fan (?<fan_id>\d+) State: (?<fan_status>.*)/, reg_blank) do |block|
|
81
|
-
fan_id = block[:fan_id]
|
82
|
-
fan["fan_#{fan_id}"] = {}
|
83
|
-
block.update(fan["fan_#{fan_id}"], :fan_id)
|
84
|
-
block.warning_serious(fan["fan_#{fan_id}"], :fan_status, self)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
77
|
end
|
89
78
|
|
90
79
|
|
@@ -3,33 +3,54 @@
|
|
3
3
|
require "aio/core"
|
4
4
|
|
5
5
|
class Aio::Module::Cmd::H3C::DisplayMemory < Aio::Module::Cmd::H3C
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
6
|
+
include Aio::Module
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
super({
|
10
|
+
:cmd_full => "display memory",
|
11
|
+
:cmd_short => "dis mem",
|
12
|
+
:author => "Elin",
|
13
|
+
:description => "This is H3C Command# display memory",
|
14
|
+
:ranking => Ranking_1,
|
15
|
+
:platform => "all",
|
16
|
+
:benchmark => {}
|
17
|
+
})
|
18
|
+
end
|
19
|
+
|
20
|
+
def parse
|
21
|
+
cont = self.context.dup
|
22
|
+
#memory = {}
|
23
|
+
#useful[:memory] = memory
|
24
|
+
|
25
|
+
case device_template
|
26
|
+
when Template_3
|
27
|
+
parse_template_3(cont)
|
28
|
+
else
|
29
|
+
parse_default(cont)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def parse_default(cont)
|
34
|
+
useful[:memory] = {}
|
35
|
+
cont.readline_match_block(/System Total Memory\(bytes\): (?<total_memory>\d+)/) do |block|
|
36
|
+
#block.update(memory, :total_memory)
|
37
|
+
end
|
38
|
+
cont.readline_match_block(/Total Used Memory\(bytes\): (?<used_memory>\d+)/) do |block|
|
39
|
+
#block.update(memory, :used_memory)
|
40
|
+
end
|
41
|
+
cont.readline_match_block(/Used Rate: (?<used_rate>\d+)%/) do |block|
|
42
|
+
block.update(useful[:memory], :used_rate)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# MSR56-60 模板
|
47
|
+
def parse_template_3(cont)
|
48
|
+
useful[:memory] = {}
|
49
|
+
cont.readline_match_block(/Total Used Free Shared Buffers Cached FreeRatio/) {|b|b}
|
50
|
+
cont.readline_match_block(/Mem: .* (?<used_free>\d+\.\d)%$/) do |block|
|
51
|
+
used = 100 - block[:used_free].to_f
|
52
|
+
block.update(useful[:memory], :used_rate, used.to_s[0,4])
|
53
|
+
end
|
54
|
+
end
|
34
55
|
end
|
35
56
|
|
@@ -29,17 +29,27 @@ class Aio::Module::Cmd::H3C::DisplayVersion < Aio::Module::Cmd::H3C
|
|
29
29
|
cont.readline_match_block(/Comware Software, Version (?<version>.*)/) do |block|
|
30
30
|
block.update(soft_info, :version)
|
31
31
|
key_stand_version(block[:version])
|
32
|
+
|
33
|
+
# 按版本来确定
|
34
|
+
case block[:version]
|
35
|
+
when /^7\./ # 当是7.x 版本的时候,show memory 会不一样
|
36
|
+
key_stand_template Template_3
|
37
|
+
else
|
38
|
+
key_stand_template Template_1
|
39
|
+
end
|
40
|
+
|
32
41
|
end
|
33
42
|
cont.readline_match_block(/.*/)
|
34
43
|
cont.readline_match_block(/H3C (?<device_model>.*) uptime is (?<uptime>.*)/) do |block|
|
44
|
+
key_stand_h3c
|
35
45
|
block.update(soft_info, :device_model)
|
36
46
|
block.update(soft_info, :uptime)
|
37
47
|
key_stand_model(block[:device_model])
|
48
|
+
|
49
|
+
# 按设备类型来确定
|
38
50
|
case block[:device_model]
|
39
51
|
when /3600|8800/ # 当是S3600,S5500,S8800 的时候
|
40
52
|
key_stand_template Template_2
|
41
|
-
else
|
42
|
-
key_stand_template Template_1
|
43
53
|
end
|
44
54
|
end
|
45
55
|
|
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.
|
4
|
+
version: 1.0.5
|
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-
|
11
|
+
date: 2018-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 网络设备巡检工具
|
14
14
|
email: 365433079@qq.com
|