summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflorian <florian@debian-Florian>2015-04-22 16:36:21 +0200
committerroot <florian.doublet@hotmail.fr>2015-06-08 16:20:39 +0200
commit606d928bba675f05383bbae708650670dff3701d (patch)
tree979b4d2fc015b845018809786b5bc2962f68ca11
parente384332a707dbcae0908223e7d96f406bd3dc491 (diff)
Delete more uptime line, temp line, speed line, for few models
-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