oxidized 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe0fdfc750565821617c3d13ebe990821f30aeec
4
- data.tar.gz: 3030719bac957813ff5a56799cd76a95e7219789
3
+ metadata.gz: 1bfddbfd99ad2fed7d779ec60118dbd86f4bad07
4
+ data.tar.gz: beaccfd0dfd4b30f324bee21e24057972d76ec9d
5
5
  SHA512:
6
- metadata.gz: adfc55ef26a4b72afc8e165f3c7e7b5ed4e138185125ed6601bd68cc2b9597f8549f0893be75627d3ecd9c793796d63a3b0985294c44dcff9aa11de5ab898ea3
7
- data.tar.gz: 0eec4da96cd31c171c8507152a9fbe555a1833e46ead96c6085d16180d0b28a35f523eaf3d1c5153e222863a133918208049c5a23c8a954ab623731bbaa1cb4a
6
+ metadata.gz: bae25268e3a819d06d65d4eb633946e7db774b078bed111ab3a99d351f449adfb6f6ae4cd862c214caceea990050057f3b59e2dd83ef80cfb45d1ba52ca8cb4a
7
+ data.tar.gz: 518319120a58a267662c2dd27bda071b505a5ced89c94d38936ad69a0eedf015ba1c15aa47b43a24032d26238a77cc35d15c6260456ac563c3057db818cec43b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 0.5.0
2
+ - FEATURE: Mikrotik RouterOS model (by @emjemj)
3
+ - FEATURE: add support for Cisco VSS (by @MrRJ45)
4
+ - BUGFIX: general fixes to powerconnect model (by @MrRJ45)
5
+ - BUGFIX: fix initial commit issues with rugged (by @MrRJ45)
6
+ - BUGFIX: pager error for old dell powerconnect switches (by @emjemj)
7
+ - BUGFIX: logout error for old dell powerconnect switches (by @emjemj)
8
+
1
9
  # 0.4.1
2
10
  - BUGFIX: handle missing output file (by @brandt)
3
11
  - BUGFIX: fix passwordless enable on Arista EOS model (by @brandt)
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Oxidized
2
2
 
3
- Oxidized is a network device configration backup tool. Its a RANCID replacment!
3
+ [![Gem Version](https://badge.fury.io/rb/oxidized.svg)](http://badge.fury.io/rb/oxidized)
4
+
5
+ Oxidized is a network device configuration backup tool. It's a RANCID replacment!
4
6
 
5
7
  * automatically adds/removes threads to meet configured retrieval interval
6
8
  * restful API to move node immediately to head-of-queue (GET/POST /node/next/[NODE])
@@ -62,6 +64,7 @@ Oxidized is a network device configration backup tool. Its a RANCID replacment!
62
64
  * Huawei VRP
63
65
  * Juniper JunOS
64
66
  * Juniper ScreenOS (Netscreen)
67
+ * Mikrotik RouterOS
65
68
  * Ubiquiti AirOS
66
69
 
67
70
 
@@ -0,0 +1,10 @@
1
+ # by @MrRJ45 at issues #45
2
+
3
+ [program:oxidized]
4
+ command=/usr/local/bin/oxidized
5
+ autostart=true
6
+ autorestart=true
7
+ user=oxidized
8
+ stderr_logfile=/var/log/oxidized.err.log
9
+ stdout_logfile=/var/log/oxidized.out.log
10
+ environment=HOME='/home/oxidized/'
@@ -0,0 +1,18 @@
1
+ # by @andrewpwade in issue #45
2
+
3
+ start on started networking
4
+
5
+ respawn
6
+
7
+ setuid oxidized
8
+ setgid oxidized
9
+
10
+ chdir /home/oxidized
11
+
12
+ env HOME=/home/oxidized
13
+
14
+ pre-start script
15
+ test -x /usr/local/bin/oxidized || { stop; exit 0; }
16
+ end script
17
+
18
+ exec /usr/local/bin/oxidized
data/extra/syslog.rb CHANGED
@@ -1,20 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # IOS:
4
- # logging discriminator CFG mnemonics includes CONFIG_I
4
+ # logging discriminator CFG mnemonics includes CONFIG_I
5
5
  # logging host SERVER discriminator CFG
6
6
 
7
7
  # JunOS:
8
8
  # set system syslog host SERVER interactive-commands notice
9
9
  # set system syslog host SERVER match "^mgd\[[0-9]+\]: UI_COMMIT: .*"
10
10
 
11
+ # Ports < 1024 need extra privileges, use a port higher than this by passing the first argument a number
12
+ # To use the default port for syslog (514) you shouldnt pass an argument, but you will need to allow this with:
11
13
  # sudo setcap 'cap_net_bind_service=+ep' /usr/bin/ruby
12
14
 
13
15
  # exit if fork ## TODO: proper daemonize
14
16
 
15
17
  require 'socket'
16
18
  require 'resolv'
17
- require './rest_client'
19
+ require_relative 'rest_client'
18
20
 
19
21
  module Oxidized
20
22
  class SyslogMonitor
@@ -25,12 +27,13 @@ module Oxidized
25
27
  PORT = 514
26
28
  FILE = 'messages'
27
29
  MSG = {
28
- :ios => '%SYS-5-CONFIG_I:',
30
+ :ios => /%SYS-(SW[0-9]+-)?5-CONFIG_I:/,
29
31
  :junos => 'UI_COMMIT:',
30
32
  }
31
33
 
32
34
  class << self
33
35
  def udp port=PORT, listen=0
36
+ port ||= PORT
34
37
  io = UDPSocket.new
35
38
  io.bind listen, port
36
39
  new io, :udp
@@ -42,7 +45,7 @@ module Oxidized
42
45
  end
43
46
  end
44
47
 
45
- private
48
+ private
46
49
 
47
50
  def initialize io, mode=:udp
48
51
  @mode = mode
@@ -72,7 +75,7 @@ module Oxidized
72
75
 
73
76
  def handle_log log, ip
74
77
  log = log.to_s.split ' '
75
- if i = log.index(MSG[:ios])
78
+ if i = log.find_index { |e| e.match( MSG[:ios] ) }
76
79
  ios ip, log, i
77
80
  elsif i = log.index(MSG[:junos])
78
81
  jnpr ip, log, i
@@ -86,7 +89,7 @@ module Oxidized
86
89
  if @mode == :udp
87
90
  log, ip = log.recvfrom_nonblock 2000
88
91
  ip = ip.last
89
- else
92
+ else
90
93
  begin
91
94
  log = log.read_nonblock 2000
92
95
  rescue EOFError
@@ -106,5 +109,5 @@ module Oxidized
106
109
  end
107
110
  end
108
111
 
109
- Oxidized::SyslogMonitor.udp
112
+ Oxidized::SyslogMonitor.udp ARGV[0]
110
113
  #Oxidized::SyslogMonitor.file '/var/log/poop'
@@ -23,7 +23,7 @@ class ASA < Oxidized::Model
23
23
  comment cfg
24
24
  end
25
25
 
26
- cmd 'show running-config' do |cfg|
26
+ cmd 'more system:running-config' do |cfg|
27
27
  cfg = cfg.each_line.to_a[3..-1].join
28
28
  cfg.gsub! /^: [^\n]*\n/, ''
29
29
  cfg
@@ -9,7 +9,7 @@ class JunOS < Oxidized::Model
9
9
  cmd :all do |cfg|
10
10
  # we don't need screen-scraping in ssh due to exec
11
11
  cfg = cfg.lines.to_a[1..-2].join if telnet
12
- cfg
12
+ cfg.lines.map { |line| line.rstrip }.join "\n"
13
13
  end
14
14
 
15
15
  cmd :secret do |cfg|
@@ -19,9 +19,8 @@ class PowerConnect < Oxidized::Model
19
19
  end
20
20
 
21
21
  cmd 'show system' do |cfg|
22
- cfg = cfg.split("\n").select { |line| not line[/Up\sTime/] }
23
- cfg = cfg[0..-28]<<" "
24
- comment cfg.join("\n")
22
+ @model = $1 if cfg.match /Power[C|c]onnect (\d{4})[P|F]?/
23
+ clean cfg
25
24
  end
26
25
 
27
26
  cmd 'show running-config'
@@ -39,9 +38,31 @@ class PowerConnect < Oxidized::Model
39
38
  end
40
39
  end
41
40
 
41
+ post_login "terminal datadump"
42
42
  post_login "terminal length 0"
43
43
  pre_logout "logout"
44
+ pre_logout "exit"
44
45
 
45
46
  end
46
47
 
48
+ def clean cfg
49
+ out = []
50
+ skip_block = false
51
+ cfg.each_line do |line|
52
+ if line.match /Up\sTime|Temperature|Power Supplies/i
53
+ # For 34xx, 54xx, 55xx, and 8024F we should skip this block (terminated by a blank line)
54
+ skip_block = true if @model =~ /^(34|35)(24|48)$|^(54|55)(24|48)$|^8024$/
55
+ end
56
+ # If we have lines to skip do this until we reach and empty line
57
+ if skip_block
58
+ skip_block = false if /\S/ !~ line
59
+ next
60
+ end
61
+ out << line.strip
62
+ end
63
+ out = comment out.join "\n"
64
+ out << "\n"
65
+ end
66
+
67
+
47
68
  end
@@ -0,0 +1,17 @@
1
+ class RouterOS < Oxidized::Model
2
+ prompt /^\[\w+@\S+\]\s?>\s?$/
3
+ comment "# "
4
+
5
+ cmd '/system routerboard print' do |cfg|
6
+ comment cfg
7
+ end
8
+
9
+ cmd '/export' do |cfg|
10
+ cfg = cfg.split("\n").select { |line| not line[/^\#\s\w{3}\/\d{2}\/\d{4}.*$/] }
11
+ cfg.join("\n") + "\n"
12
+ end
13
+
14
+ cfg :ssh do
15
+ exec true
16
+ end
17
+ end
@@ -99,6 +99,7 @@ class Git < Output
99
99
  :parents => repo.empty? ? [] : [repo.head.target].compact,
100
100
  :update_ref => 'HEAD',
101
101
  )
102
+ index.write
102
103
  end
103
104
  end
104
105
  end
data/oxidized.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'oxidized'
3
- s.version = '0.4.1'
3
+ s.version = '0.5.0'
4
4
  s.licenses = %w( Apache-2.0 )
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = [ 'Saku Ytti', 'Samer Abdel-Hafez' ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxidized
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saku Ytti
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-10 00:00:00.000000000 Z
12
+ date: 2015-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: asetus
@@ -84,6 +84,8 @@ files:
84
84
  - bin/oxidized
85
85
  - extra/nagios_check_failing_nodes.rb
86
86
  - extra/oxidized.init
87
+ - extra/oxidized.supervisord
88
+ - extra/oxidized.upstart
87
89
  - extra/rest_client.rb
88
90
  - extra/syslog.rb
89
91
  - lib/oxidized.rb
@@ -123,6 +125,7 @@ files:
123
125
  - lib/oxidized/model/outputs.rb
124
126
  - lib/oxidized/model/powerconnect.rb
125
127
  - lib/oxidized/model/procurve.rb
128
+ - lib/oxidized/model/routeros.rb
126
129
  - lib/oxidized/model/screenos.rb
127
130
  - lib/oxidized/model/timos.rb
128
131
  - lib/oxidized/model/vrp.rb