From a54574ee01060097259adc22413efe1853b83bbb Mon Sep 17 00:00:00 2001 From: Elvin Efendi Date: Mon, 26 Oct 2015 14:30:48 -0400 Subject: include health and hardware info into config --- lib/oxidized/model/junos.rb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'lib/oxidized') diff --git a/lib/oxidized/model/junos.rb b/lib/oxidized/model/junos.rb index da3af72..2572b93 100644 --- a/lib/oxidized/model/junos.rb +++ b/lib/oxidized/model/junos.rb @@ -20,7 +20,7 @@ class JunOS < Oxidized::Model cmd 'show configuration | display omit' - cmd 'show version' do |cfg| + cmd 'show version detail' do |cfg| @model = $1 if cfg.match(/^Model: (\S+)/) comment cfg end @@ -30,13 +30,26 @@ class JunOS < Oxidized::Model case @model when 'mx960' out << cmd('show chassis fabric reachability') { |cfg| comment cfg } + when 'mx480' + out << cmd('show chassis scb') { |cfg| comment cfg } + out << cmd('show chassis sfm detail') { |cfg| comment cfg } + out << cmd('show chassis ssb') { |cfg| comment cfg } + out << cmd('show chassis feb detail') { |cfg| comment cfg } + out << cmd('show chassis feb') { |cfg| comment cfg } + out << cmd('show chassis cfeb') { |cfg| comment cfg } end out end - cmd 'show chassis hardware' do |cfg| - comment cfg - end + cmd('show chassis environment') { |cfg| comment cfg } + cmd('show chassis firmware') { |cfg| comment cfg } + cmd('show chassis fpc detail') { |cfg| comment cfg } + cmd('show chassis hardware detail') { |cfg| comment cfg } + cmd('show chassis routing-engine') { |cfg| comment cfg } + cmd('show chassis alarms') { |cfg| comment cfg } + cmd('show system license') { |cfg| comment cfg } + cmd('show system boot-messages') { |cfg| comment cfg } + cmd('show system core-dumps') { |cfg| comment cfg } cfg :telnet do username(/^login:/) -- cgit v1.2.1 From 13d89b7e1a4f91728e528a5290779bcf4b645a6a Mon Sep 17 00:00:00 2001 From: Elvin Efendi Date: Mon, 26 Oct 2015 15:02:09 -0400 Subject: strip temprature and speed measurement from chassis environment output --- lib/oxidized/model/junos.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/oxidized') diff --git a/lib/oxidized/model/junos.rb b/lib/oxidized/model/junos.rb index 2572b93..6ba18ad 100644 --- a/lib/oxidized/model/junos.rb +++ b/lib/oxidized/model/junos.rb @@ -41,7 +41,11 @@ class JunOS < Oxidized::Model out end - cmd('show chassis environment') { |cfg| comment cfg } + cmd('show chassis environment') do |cfg| + cfg.gsub! /\d+ degrees.* F/, '' + cfg.gsub! /Spinning at \S+/, '' + comment cfg + end cmd('show chassis firmware') { |cfg| comment cfg } cmd('show chassis fpc detail') { |cfg| comment cfg } cmd('show chassis hardware detail') { |cfg| comment cfg } -- cgit v1.2.1 From 7312e8ef0d10d8846c69d6962e98a450e6950bc9 Mon Sep 17 00:00:00 2001 From: Elvin Efendi Date: Mon, 23 Nov 2015 11:23:59 -0500 Subject: use paranthesis for method call --- lib/oxidized/model/junos.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/oxidized') diff --git a/lib/oxidized/model/junos.rb b/lib/oxidized/model/junos.rb index 6ba18ad..949a757 100644 --- a/lib/oxidized/model/junos.rb +++ b/lib/oxidized/model/junos.rb @@ -42,8 +42,8 @@ class JunOS < Oxidized::Model end cmd('show chassis environment') do |cfg| - cfg.gsub! /\d+ degrees.* F/, '' - cfg.gsub! /Spinning at \S+/, '' + cfg.gsub!(/\d+ degrees.* F/, '') + cfg.gsub!(/Spinning at \S+/, '') comment cfg end cmd('show chassis firmware') { |cfg| comment cfg } -- cgit v1.2.1 From 26b02bf064c76d6ef7943016c798629810986092 Mon Sep 17 00:00:00 2001 From: Elvin Efendi Date: Mon, 23 Nov 2015 12:41:50 -0500 Subject: include executed command into output --- lib/oxidized/model/model.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/oxidized') diff --git a/lib/oxidized/model/model.rb b/lib/oxidized/model/model.rb index c95cc67..ca851e3 100644 --- a/lib/oxidized/model/model.rb +++ b/lib/oxidized/model/model.rb @@ -79,7 +79,7 @@ module Oxidized attr_accessor :input, :node def cmd string, &block - out = @input.cmd string + out = "====================== #{string} ======================\n" + @input.cmd(string) return false unless out self.class.cmds[:all].each do |all_block| out = instance_exec Oxidized::String.new(out), string, &all_block -- cgit v1.2.1 From 6b47e7122ea9e8f470c30335d4bcb588ed279a18 Mon Sep 17 00:00:00 2001 From: Elvin Efendi Date: Mon, 23 Nov 2015 13:32:17 -0500 Subject: ignore frequently changing monitoring data --- lib/oxidized/model/junos.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/oxidized') diff --git a/lib/oxidized/model/junos.rb b/lib/oxidized/model/junos.rb index 949a757..a02d588 100644 --- a/lib/oxidized/model/junos.rb +++ b/lib/oxidized/model/junos.rb @@ -47,9 +47,18 @@ class JunOS < Oxidized::Model comment cfg end cmd('show chassis firmware') { |cfg| comment cfg } - cmd('show chassis fpc detail') { |cfg| comment cfg } + cmd('show chassis fpc detail') do |cfg| + cfg.gsub!(/(Temperature\s+)(\d+)(.+)/, '\1\3') + cfg.gsub!(/(\s+\d+ days,)(.+seconds)/, '\1 \3') + comment cfg + end cmd('show chassis hardware detail') { |cfg| comment cfg } - cmd('show chassis routing-engine') { |cfg| comment cfg } + cmd('show chassis routing-engine') do |cfg| + cfg.gsub!(/(\S+\s+)(\d+)( percent)/, '\1\3') + cfg.gsub!(/(\s+\d+ days,)(.+seconds)/, '\1 \3') + cfg.gsub!(/(\s+)(\d+\.\d+)(\s+)(\d+\.\d+)(\s+)(\d+\.\d+)/, '\1\3\5') + comment cfg + end cmd('show chassis alarms') { |cfg| comment cfg } cmd('show system license') { |cfg| comment cfg } cmd('show system boot-messages') { |cfg| comment cfg } -- cgit v1.2.1