aio_elin 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5add890da1f929e9fdf9b6975d2361ee53e19323b09e329e7ffda3875f0ba5c3
|
4
|
+
data.tar.gz: e8bbaa676e2ff53db21f720f43f4a05d43329ea758c3d9b2a4b1db296ffb5f36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 323842c51f98dbeb9819828e102f614bb38f8722d92a8a1b9f87d9a1846fdd9733b13c470b8485c57fc79802e7fbafd920ffb1d82b4deceac094c43fbe460a36
|
7
|
+
data.tar.gz: ff67ddef33a8641c8b2c716f9c5550f5eee64d45372a018ab874eec9c8748e479254b3382d006a4213141e213176aa37cec952cf23c08abecbb94507dd593ad0
|
@@ -165,6 +165,8 @@ module Aio::Device
|
|
165
165
|
rescue Aio::Text::Context::OutLineError
|
166
166
|
rescue NoMethodError
|
167
167
|
print_error "未找到方法,请检查模块的方法名拼写"
|
168
|
+
rescue NameError
|
169
|
+
print_error "#{module_klass.class} 未检测到对应版本"
|
168
170
|
rescue Exception => e
|
169
171
|
print_error "#{e.class} : #{module_klass.class}"
|
170
172
|
print_error e.message
|
@@ -3,69 +3,85 @@
|
|
3
3
|
require "aio/core"
|
4
4
|
|
5
5
|
class Aio::Module::Cmd::Cisco::ShowEnv < Aio::Module::Cmd::Cisco
|
6
|
-
|
6
|
+
include Aio::Module
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
8
|
+
def initialize
|
9
|
+
super({
|
10
|
+
:cmd_full => "show environment",
|
11
|
+
:cmd_short => "sh env",
|
12
|
+
:author => "Elin",
|
13
|
+
:description => "This is Cisco Command# show environment",
|
14
|
+
:ranking => Ranking_1,
|
15
|
+
:platform => "all",
|
16
|
+
:benchmark => {
|
17
|
+
:power_status => ["==", "Normal"],
|
18
|
+
:fan_status => ["==", "OK"],
|
19
|
+
:cpu_status => ["==", "Normal"],
|
20
|
+
}
|
21
|
+
})
|
22
|
+
end
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
def parse
|
25
|
+
cont = self.context.dup
|
26
|
+
debugger
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
# 是有版本区别的,要分开对待
|
29
|
+
case device_template
|
30
|
+
when Template_1, Template_2
|
31
|
+
parse_tmp_1(cont)
|
32
|
+
when Template_4
|
33
|
+
parse_tmp_2(cont)
|
34
|
+
end
|
35
|
+
end
|
33
36
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
37
|
+
def parse_tmp_1(cont)
|
38
|
+
useful[:power] = {}
|
39
|
+
cont.readline_match_block(/SYSTEM POWER SUPPLY STATUS/) {|b|b}
|
40
|
+
cont.readline_match_block(/==========================/) {|b|b}
|
41
|
+
cont.readline_range_loop(/Internal Power/, reg_blank) do |cont_layer|
|
42
|
+
power = {}
|
43
|
+
cont_layer.readline_match_block(/Internal Power Supply (?<power_id>\d+) Type: (?<type>.*)/) do |block|
|
44
|
+
power_id = block[:power_id]
|
45
|
+
useful[:power]["slot_#{power_id}"] = power
|
46
|
+
block.update(power, :power_id)
|
47
|
+
block.update(power, :type)
|
48
|
+
end
|
49
|
+
cont_layer.readline_match_block(/Output Status: (?<power_status>.*)/) do |block|
|
50
|
+
block.warning_serious(power, :power_status, self)
|
51
|
+
end
|
52
|
+
end
|
50
53
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
54
|
+
useful[:fan] = {}
|
55
|
+
cont.readline_match_block(/SYSTEM FAN STATUS/) {|b|b}
|
56
|
+
cont.readline_match_block(/=================/) {|b|b}
|
57
|
+
cont.readline_match_block_loop(/Fan (?<fan_id>\d+) (?<fan_status>.*)/, reg_blank) do |block|
|
58
|
+
fan = {}
|
59
|
+
fan_id = block[:fan_id]
|
60
|
+
useful[:fan]["slot_#{fan_id}"] = fan
|
61
|
+
block.update(fan, :fan_id)
|
62
|
+
block.warning_serious(fan, :fan_status, self)
|
63
|
+
end
|
61
64
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
65
|
+
cont.readline_match_block(/SYSTEM TEMPERATURE STATUS/) {|b|b}
|
66
|
+
cont.readline_match_block(/=========================/) {|b|b}
|
67
|
+
cont.readline_match_block(/CPU temperature: (?<cpu_temperature>\d+) Celsius, (?<cpu_status>.*)/) do |block|
|
68
|
+
useful[:temperature] = {}
|
69
|
+
block.update(useful[:temperature], :cpu_temperature)
|
70
|
+
block.warning_serious(useful[:temperature], :cpu_status, self)
|
71
|
+
end
|
72
|
+
end
|
69
73
|
|
70
|
-
|
74
|
+
def parse_tmp_2(cont)
|
75
|
+
debugger
|
76
|
+
useful[:fan] = {}
|
77
|
+
cont.readline_match_block(/Main Power Supply is AC/) {|b|b}
|
78
|
+
cont.readline_match_block(reg_blank) {|b|b}
|
79
|
+
cont.readline_match_block_loop(/Fan (?<fan_id>\d+) (?<fan_status>.*)/, reg_blank) do |block|
|
80
|
+
fan = {}
|
81
|
+
fan_id = block[:fan_id]
|
82
|
+
useful[:fan]["slot_#{fan_id}"] = fan
|
83
|
+
block.update(fan, :fan_id)
|
84
|
+
block.warning_serious(fan, :fan_status, self)
|
85
|
+
end
|
86
|
+
end
|
71
87
|
end
|
@@ -80,6 +80,8 @@ class Aio::Module::Cmd::Cisco::ShowVersion < Aio::Module::Cmd::Cisco
|
|
80
80
|
case block[:device_model]
|
81
81
|
when /76|65/ # 当是7600的时候,使用模板2
|
82
82
|
key_stand_template Template_2
|
83
|
+
when /28/ # 当是2800的时候,使用模板4
|
84
|
+
key_stand_template Template_4
|
83
85
|
else
|
84
86
|
key_stand_template Template_1
|
85
87
|
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.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 网络设备巡检工具
|
14
14
|
email: 365433079@qq.com
|