summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/ironware.rb
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2015-06-08 19:03:52 +0300
committerytti <saku@ytti.fi>2015-06-08 19:03:52 +0300
commite18b4e9ff518a84ec2883fa72fd2c97b055242c8 (patch)
tree5273e9805856cb68add23f6782fbae72198b165d /lib/oxidized/model/ironware.rb
parent0330f824374e2b749959e653a7acd313096fc3e6 (diff)
parent606d928bba675f05383bbae708650670dff3701d (diff)
Merge pull request #127 from FlorianDoublet/ironwareModif
Delete more uptime line, temp line, speed line, for few ironware models
Diffstat (limited to 'lib/oxidized/model/ironware.rb')
-rw-r--r--lib/oxidized/model/ironware.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/oxidized/model/ironware.rb b/lib/oxidized/model/ironware.rb
index e18902b..1ec8b80 100644
--- a/lib/oxidized/model/ironware.rb
+++ b/lib/oxidized/model/ironware.rb
@@ -25,13 +25,28 @@ class IronWare < Oxidized::Model
end
cmd 'show version' do |cfg|
- cfg.gsub! /(^((.*)system uptime(.*))$)/, '' #remove unwanted line system uptime
+ cfg.gsub! /(^((.*)[Ss]ystem uptime(.*))$)/, '' #remove unwanted line system uptime
+ cfg.gsub! /uptime is .*/,''
+
comment cfg
end
cmd 'show chassis' do |cfg|
cfg.gsub! "\xFF", '' # ugly hack - avoids JSON.dump utf-8 breakage on 1.9..
cfg.gsub! /(^((.*)Current temp(.*))$)/, '' #remove unwanted lines current temperature
+ cfg.gsub! /Speed = [A-Z]{3} \(\d{2}\%\)/, '' #remove unwanted lines Speed Fans
+ cfg.gsub! /current speed is [A-Z]{3} \(\d{2}\%\)/, ''
+ cfg.gsub! /Fan controlled temperature: \d{2}\.\d deg-C/, 'Fan controlled temperature: XX.X d deg-C'
+ if cfg.include? "TEMPERATURE"
+ sc = StringScanner.new cfg
+ out = ''
+ temps = ''
+ out << sc.scan_until(/.*TEMPERATURE/)
+ temps << sc.scan_until(/.*Fans/)
+ out << sc.rest
+ cfg = out
+ end
+
comment cfg
end