oxidized 0.10.0 → 0.11.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: 4f601ebdf3c7562322e2b76313f60e4128863968
4
- data.tar.gz: c0151bcf8e6c02d53511321f198bdd7fd55ac1cf
3
+ metadata.gz: cdb31290367c66dd2c76fe99a93efa832e676446
4
+ data.tar.gz: 23e3a5a6c42f603d72e8266f2b705e03edec502b
5
5
  SHA512:
6
- metadata.gz: ff1578ea27961bdf57d32433da245795a880f95e6698f1f2b37692617d4779467673c78a1e27318204c8fc5b0ef4bbb05c379bee870f1fe59365727bef7a8222
7
- data.tar.gz: fde31a1ef6e58ceebe9b1bcc822efdcc37971c234b474f64daa679bb50c87f308e474c7aad132ac41f837be91e4034aaba8db346fed987cc3f3a6dea7846bc3d
6
+ metadata.gz: 48675858978583b89c86a3943fe4f95a78d44eedffe4ae59a0e624a608707a9e85ad93277e3bd878710777208bc45100b10dc8fd9824f67fe476d0db9577ed41
7
+ data.tar.gz: 4f2dfe9e24f3e6f9afe878c5cf786c89701aaeb531966d37dd2e37e188be6069cbca9358f3a61b6bf9db8cf4e02c5261bbe45d90f2625784445cec127427b8bf
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.11.0
2
+ - FEATURE: ssh proxycommand (by @ElvinEfendi)
3
+ - FEATURE: basic auth in HTTP source (by @laf)
4
+ - BUGFIX: do not inject string to output before model gets it
5
+ - BUGFIX: store pidfile in oxidized root
6
+
1
7
  # 0.10.0
2
8
  - FEATURE: Various refactoring (by @ElvinEfendi)
3
9
  - FEATURE: Ciena SOAS support (by @jgroom33)
data/Dockerfile CHANGED
@@ -1,11 +1,15 @@
1
- FROM debian:latest
1
+ FROM phusion/baseimage:0.9.18
2
2
  MAINTAINER Samer Abdel-Hafez <sam@arahant.net>
3
3
 
4
- RUN apt-get update && \
5
- apt-get install -y ruby ruby-dev libsqlite3-dev libssl-dev pkg-config make cmake
4
+ RUN add-apt-repository ppa:brightbox/ruby-ng && \
5
+ apt-get update && \
6
+ apt-get install -y ruby2.1 ruby2.1-dev libsqlite3-dev libssl-dev pkg-config make cmake
6
7
 
7
8
  RUN gem install oxidized oxidized-web --no-ri --no-rdoc
8
9
 
9
10
  RUN apt-get remove -y ruby-dev pkg-config make cmake
10
11
 
11
- RUN apt-get -y autoremove
12
+ RUN apt-get -y autoremove
13
+
14
+ ADD extra/oxidized.runit /etc/service/oxidized/run
15
+ ADD extra/auto-reload-config.runit /etc/service/auto-reload-config/run
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oxidized (0.9.0)
4
+ oxidized (0.10.0)
5
5
  asetus (~> 0.1)
6
6
  net-ssh (~> 3.0, >= 3.0.2)
7
7
  rugged (~> 0.21, >= 0.21.4)
data/README.md CHANGED
@@ -7,8 +7,8 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen
7
7
  * automatically adds/removes threads to meet configured retrieval interval
8
8
  * restful API to move node immediately to head-of-queue (GET/POST /node/next/[NODE])
9
9
  * syslog udp+file example to catch config change event (ios/junos) and trigger config fetch
10
- * will signal ios/junos user who made change, which output module can (git does) use (via POST)
11
- * 'git blame' will show for each line who and when the change was made
10
+ * will signal ios/junos user who made change, which output modules can use (via POST)
11
+ * The git output module uses this info - 'git blame' will for each line show who made the change and when
12
12
  * restful API to reload list of nodes (GET /reload)
13
13
  * restful API to fetch configurations (/node/fetch/[NODE] or /node/fetch/group/[NODE])
14
14
  * restful API to show list of nodes (GET /nodes)
@@ -144,7 +144,7 @@ Maps define how to map a model's fields to model [model fields](https://github.c
144
144
 
145
145
  First create the directory where the CSV ```output``` is going to store device configs and start Oxidized once.
146
146
  ```
147
- mkdir ~/.config/oxidized/configs
147
+ mkdir -p ~/.config/oxidized/configs
148
148
  oxidized
149
149
  ```
150
150
 
@@ -230,6 +230,11 @@ rvm use --default 2.1.2
230
230
  root@bla:~#
231
231
  ```
232
232
 
233
+ If you want to have the config automatically reloaded (e.g. when using a http source that changes)
234
+ ```
235
+ root@bla:~# docker run -v /etc/oxidized:/root/.config/oxidized -p 8888:8888/tcp -e CONFIG_RELOAD_INTERVAL=3600 -t oxidized/oxidized:latest oxidized
236
+ ```
237
+
233
238
  ## Cookbook
234
239
  ### Debugging
235
240
  In case a model plugin doesn't work correctly (ios, procurve, etc.), you can enable live debugging of SSH/Telnet sessions. Just add a ```debug``` option, specifying a log file destination to the ```input``` section.
@@ -272,6 +277,21 @@ source:
272
277
  enable: 4
273
278
  ```
274
279
 
280
+ ### SSH Proxy Command
281
+
282
+ Oxidized can `ssh` through a proxy as well. To do so we just need to set `proxy` variable.
283
+
284
+ ```
285
+ ...
286
+ map:
287
+ name: 0
288
+ model: 1
289
+ vars_map:
290
+ enable: 2
291
+ proxy: 3
292
+ ...
293
+ ```
294
+
275
295
  ### Source: SQLite
276
296
 
277
297
  One row per device, filtered by hostname.
@@ -296,6 +316,8 @@ source:
296
316
 
297
317
  One object per device.
298
318
 
319
+ HTTP Supports basic auth, configure the user and pass you want to use under the http: section.
320
+
299
321
  ```
300
322
  source:
301
323
  default: http
@@ -326,6 +348,8 @@ output:
326
348
 
327
349
  ### Output: Git
328
350
 
351
+ This uses the rugged/libgit2 interface. So you should remember that normal Git hooks will not be executed.
352
+
329
353
  ```
330
354
  output:
331
355
  default: git
@@ -455,7 +479,7 @@ Following configuration keys need to be defined for all hooks:
455
479
  ### Events
456
480
  * `node_success`: triggered when configuration is succesfully pulled from a node and right before storing the configuration.
457
481
  * `node_fail`: triggered after `retries` amount of failed node pulls.
458
- * `post_store`: triggered after node configuration is stored.
482
+ * `post_store`: triggered after node configuration is stored (this is executed only when the configuration has changed).
459
483
 
460
484
  ## Hook type: exec
461
485
  The `exec` hook type allows users to run an arbitrary shell command or a binary when triggered.
data/bin/console CHANGED
File without changes
@@ -0,0 +1,12 @@
1
+ #!/bin/bash
2
+
3
+ if [ -z "$CONFIG_RELOAD_INTERVAL" ]; then
4
+ # Just stop and do nothing
5
+ read
6
+ fi
7
+
8
+ while true; do
9
+ sleep $CONFIG_RELOAD_INTERVAL
10
+ echo "Reloading config..."
11
+ curl -s http://localhost:8888/reload?format=json -O /dev/null
12
+ done
@@ -23,7 +23,7 @@
23
23
  # email_output:
24
24
  # type: exec
25
25
  # events: [post_store, node_fail]
26
- # cmd: 'update-local-repo.sh ~/gitdir/ | mail -s "Oxidized updates for ${OX_NODE_NAME}" update-recipient@example.com'
26
+ # cmd: '/home/oxidized/extra/oxidized-report-git-commits ~/gitdir/ | mail -s "Oxidized updates for ${OX_NODE_NAME}" update-recipient@example.com'
27
27
  # async: true
28
28
  # timeout: 120
29
29
  #
@@ -0,0 +1,2 @@
1
+ #!/bin/bash
2
+ exec setuser root oxidized
data/lib/oxidized/cli.rb CHANGED
@@ -24,7 +24,7 @@ module Oxidized
24
24
  Config.load(@opts)
25
25
  Oxidized.setup_logger
26
26
 
27
- @pidfile = File.expand_path("pid")
27
+ @pidfile = File.join(Oxidized::Config::Root, 'pid')
28
28
  end
29
29
 
30
30
  def crash error
@@ -1,5 +1,6 @@
1
1
  module Oxidized
2
2
  require 'net/ssh'
3
+ require 'net/ssh/proxy/command'
3
4
  require 'timeout'
4
5
  require 'oxidized/input/cli'
5
6
  class SSH < Input
@@ -22,11 +23,15 @@ module Oxidized
22
23
  secure = Oxidized.config.input.ssh.secure
23
24
  @log = File.open(Oxidized::Config::Crash + "-#{@node.ip}-ssh", 'w') if Oxidized.config.input.debug?
24
25
  port = vars(:ssh_port) || 22
25
- @ssh = Net::SSH.start @node.ip, @node.auth[:username], :port => port.to_i,
26
+ if proxy_host = vars(:proxy)
27
+ proxy = Net::SSH::Proxy::Command.new("ssh #{proxy_host} nc %h %p")
28
+ end
29
+ @ssh = Net::SSH.start(@node.ip, @node.auth[:username], :port => port.to_i,
26
30
  :password => @node.auth[:password], :timeout => Oxidized.config.timeout,
27
31
  :paranoid => secure,
28
32
  :auth_methods => %w(none publickey password keyboard-interactive),
29
- :number_of_password_prompts => 0
33
+ :number_of_password_prompts => 0,
34
+ :proxy => proxy)
30
35
  unless @exec
31
36
  shell_open @ssh
32
37
  begin
@@ -56,7 +56,7 @@ class AOSW < Oxidized::Model
56
56
  next if line.match /Output \d Config/i
57
57
  next if line.match /(Tachometers|Temperatures|Voltages)/
58
58
  next if line.match /((Card|CPU) Temperature|Chassis Fan|VMON1[0-9])/
59
- next if line.match /[0-9]+ (RPM|mV|C)$/
59
+ next if line.match /[0-9]+ (RPM|RPMs|mV|C)$/
60
60
  out << line.strip
61
61
  end
62
62
  out = comment out.join "\n"
@@ -33,9 +33,12 @@ class CiscoSMB < Oxidized::Model
33
33
  cfg
34
34
  end
35
35
 
36
- cfg :telnet, :ssh do
36
+ cfg :telnet do
37
37
  username /^User Name:/
38
38
  password /^\r?Password:$/
39
+ end
40
+
41
+ cfg :telnet, :ssh do
39
42
  post_login 'terminal datadump' # Disable pager
40
43
  post_login 'terminal width 0'
41
44
  pre_logout 'exit'
@@ -79,7 +79,7 @@ module Oxidized
79
79
  attr_accessor :input, :node
80
80
 
81
81
  def cmd string, &block
82
- out = "====================== #{string} ======================\n" + @input.cmd(string)
82
+ out = @input.cmd(string)
83
83
  return false unless out
84
84
  self.class.cmds[:all].each do |all_block|
85
85
  out = instance_exec Oxidized::String.new(out), string, &all_block
@@ -28,6 +28,9 @@ class HTTP < Source
28
28
  end
29
29
 
30
30
  request = Net::HTTP::Get.new(uri.request_uri, headers)
31
+ if (@cfg.user && @cfg.pass)
32
+ request.basic_auth(@cfg.user,@cfg.pass)
33
+ end
31
34
 
32
35
  response = http.request(request)
33
36
  data = JSON.parse(response.body)
@@ -1,3 +1,3 @@
1
1
  module Oxidized
2
- VERSION = '0.10.0'
2
+ VERSION = '0.11.0'
3
3
  end
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.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saku Ytti
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-01-06 00:00:00.000000000 Z
13
+ date: 2016-01-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: asetus
@@ -170,9 +170,11 @@ files:
170
170
  - TODO.md
171
171
  - bin/console
172
172
  - bin/oxidized
173
+ - extra/auto-reload-config.runit
173
174
  - extra/nagios_check_failing_nodes.rb
174
175
  - extra/oxidized-report-git-commits
175
176
  - extra/oxidized.init
177
+ - extra/oxidized.runit
176
178
  - extra/oxidized.service
177
179
  - extra/oxidized.supervisord
178
180
  - extra/oxidized.upstart