Closed filip7sr closed 9 years ago
Is the entire config single line of 'ERROR: System is busy', which command gives that output?
I guess you could do something like this:
cmd 'what ever' do |cfg|
raise 'router was busy' if cfg.include? /ERROR: System is busy/ cfg end
I don't know which commands returns that output. I tried your suggestion:
cmd 'show system' do |cfg| raise 'router was busy' if cfg.include? /ERROR: System is busy/ cfg = cfg.each_line.find{|line|line.match 'Description'} comment cfg.to_s.strip end
results to this in the log:
I, [2015-05-18T17:30:47.442818 #9534] INFO -- : Oxidized starting, running as pid 9534 I, [2015-05-18T17:30:47.826856 #9534] INFO -- : Loaded 2 nodes E, [2015-05-18T17:30:51.605457 #9534] ERROR -- : 192.168.253.101 raised TypeError with msg "can't convert Regexp into String", /root/.config/oxidized/crash.192.168.253.101 saved
sorry cfg.match /ERROR: System is busy/
Following configuration doesn't solve the issue:
class AOS < Oxidized::Model
comment '! '
cmd :all do |cfg| cfg.each_line.to_a[1..-2].join end
cmd 'show system' do |cfg| cfg.match /ERROR: System is busy/ cfg = cfg.each_line.find{|line|line.match 'Description'} comment cfg.to_s.strip end
cmd 'show chassis' do |cfg| cfg.match /ERROR: System is busy/ comment cfg end
cmd 'show hardware info' do |cfg| cfg.match /ERROR: System is busy/ comment cfg end
cmd 'show configuration snapshot' do |cfg| cfg.match /ERROR: System is busy/ cfg end
cmd 'show stack topology' do |cfg| cfg.match /ERROR: System is busy/ cfg end
cfg :telnet do username /^login : / password /^password : / end
cfg :telnet, :ssh do pre_logout 'exit' end
You forgot to raise error.
raise 'blaablaa' if cfg.match /.../
Any update?
Problem solved, thank you!
This isn't really an Oxidized issue since the program works flawless. However, I'd love to see some functionality to resolve the issue above. The notification is quite clear: from time to time our AOS switches are too busy which makes them return the error above. Functionality to filter for this kind of messages, so Oxidized wouldn't push it to Git, would come in very handy.