oxidized 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +4 -1
- data/extra/oxidized.supervisord +10 -0
- data/extra/oxidized.upstart +18 -0
- data/extra/syslog.rb +10 -7
- data/lib/oxidized/model/asa.rb +1 -1
- data/lib/oxidized/model/junos.rb +1 -1
- data/lib/oxidized/model/powerconnect.rb +24 -3
- data/lib/oxidized/model/routeros.rb +17 -0
- data/lib/oxidized/output/git.rb +1 -0
- data/oxidized.gemspec +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bfddbfd99ad2fed7d779ec60118dbd86f4bad07
|
4
|
+
data.tar.gz: beaccfd0dfd4b30f324bee21e24057972d76ec9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
3
|
+
[](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,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
|
-
|
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 =>
|
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.
|
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'
|
data/lib/oxidized/model/asa.rb
CHANGED
data/lib/oxidized/model/junos.rb
CHANGED
@@ -19,9 +19,8 @@ class PowerConnect < Oxidized::Model
|
|
19
19
|
end
|
20
20
|
|
21
21
|
cmd 'show system' do |cfg|
|
22
|
-
|
23
|
-
|
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
|
data/lib/oxidized/output/git.rb
CHANGED
data/oxidized.gemspec
CHANGED
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
|
+
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
|
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
|