oxidized 0.20.0 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +135 -865
- data/docs/Configuration.md +186 -0
- data/docs/Hooks.md +143 -0
- data/docs/Outputs.md +190 -0
- data/docs/Ruby-API.md +115 -0
- data/docs/Sources.md +110 -0
- data/docs/Supported-OS-Types.md +149 -0
- data/docs/VRP-Huawei.md +27 -0
- data/extra/oxidized-report-git-commits +21 -40
- data/extra/oxidized-ubuntu.haproxy +45 -0
- data/extra/oxidized.service +4 -0
- data/lib/oxidized/hook.rb +1 -0
- data/lib/oxidized/hook/exec.rb +0 -1
- data/lib/oxidized/input/ssh.rb +11 -8
- data/lib/oxidized/model/acsw.rb +67 -0
- data/lib/oxidized/model/aen.rb +20 -0
- data/lib/oxidized/model/alteonos.rb +60 -0
- data/lib/oxidized/model/asa.rb +53 -18
- data/lib/oxidized/model/asyncos.rb +49 -0
- data/lib/oxidized/model/audiocodes.rb +32 -0
- data/lib/oxidized/model/boss.rb +76 -0
- data/lib/oxidized/model/ciscosma.rb +45 -0
- data/lib/oxidized/model/ciscosmb.rb +6 -1
- data/lib/oxidized/model/coriantgroove.rb +30 -0
- data/lib/oxidized/model/dlink.rb +1 -0
- data/lib/oxidized/model/enterasys.rb +30 -0
- data/lib/oxidized/model/fiberdriver.rb +1 -1
- data/lib/oxidized/model/fortios.rb +3 -1
- data/lib/oxidized/model/ftos.rb +2 -0
- data/lib/oxidized/model/hirschmann.rb +41 -0
- data/lib/oxidized/model/hpemsa.rb +13 -0
- data/lib/oxidized/model/ios.rb +2 -2
- data/lib/oxidized/model/iosxr.rb +1 -0
- data/lib/oxidized/model/ipos.rb +7 -1
- data/lib/oxidized/model/ironware.rb +4 -1
- data/lib/oxidized/model/netgear.rb +12 -4
- data/lib/oxidized/model/panos.rb +1 -1
- data/lib/oxidized/model/planet.rb +2 -1
- data/lib/oxidized/model/powerconnect.rb +5 -0
- data/lib/oxidized/model/procurve.rb +13 -0
- data/lib/oxidized/model/routeros.rb +12 -5
- data/lib/oxidized/model/sgos.rb +46 -0
- data/lib/oxidized/model/ucs.rb +31 -0
- data/lib/oxidized/model/voss.rb +12 -3
- data/lib/oxidized/model/vrp.rb +6 -0
- data/lib/oxidized/model/weos.rb +22 -0
- data/lib/oxidized/model/xos.rb +4 -0
- data/lib/oxidized/node.rb +4 -2
- data/lib/oxidized/nodes.rb +1 -0
- data/lib/oxidized/version.rb +1 -1
- data/lib/oxidized/worker.rb +23 -2
- data/oxidized.gemspec +1 -1
- metadata +54 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c68d3b3818ff8c011c232a2dda22bb14bdd0a30
|
4
|
+
data.tar.gz: c7135e67bacb9cadef51dbaf1826c4f9a3923f4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2aaa1f8ccf0d9cc2816309859c31bc3caf8c16cc0bd5abb34c94756823e461428cc19bcda619fe28980eeb379e3ad9c48c907e104d58b9e2a7f63c777f99c9a
|
7
|
+
data.tar.gz: 1313b8e85f766be9e9605107a96a8fd8d11af350670ae1165496f7d702358faa160825af15b9d848c43d9014ac8325502305ad4f6f6aa633fc0032c6bd056e29
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,180 +1,61 @@
|
|
1
1
|
# Oxidized [![Build Status](https://travis-ci.org/Shopify/oxidized.svg)](https://travis-ci.org/Shopify/oxidized) [![Gem Version](https://badge.fury.io/rb/oxidized.svg)](http://badge.fury.io/rb/oxidized) [![Join the chat at https://gitter.im/oxidized/Lobby](https://badges.gitter.im/oxidized/Lobby.svg)](https://gitter.im/oxidized/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
2
2
|
|
3
|
+
> Is your company using Oxidized and has Ruby developers on staff? I'd love help from an extra maintainer!
|
4
|
+
|
5
|
+
[WANTED: MAINTAINER](#help-needed)
|
6
|
+
|
3
7
|
Oxidized is a network device configuration backup tool. It's a RANCID replacement!
|
4
8
|
|
5
|
-
*
|
6
|
-
*
|
7
|
-
|
8
|
-
*
|
9
|
+
* Automatically adds/removes threads to meet configured retrieval interval
|
10
|
+
* Restful API to move node immediately to head-of-queue (GET/POST /node/next/[NODE])
|
11
|
+
* Syslog udp+file example to catch config change event (ios/junos) and trigger config fetch
|
12
|
+
* Will signal ios/junos user who made change, which output modules can use (via POST)
|
9
13
|
* The git output module uses this info - 'git blame' will for each line show who made the change and when
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
+
* Restful API to reload list of nodes (GET /reload)
|
15
|
+
* Restful API to fetch configurations (/node/fetch/[NODE] or /node/fetch/group/[NODE])
|
16
|
+
* Restful API to show list of nodes (GET /nodes)
|
17
|
+
* Restful API to show list of version for a node (/node/version[NODE]) and diffs
|
14
18
|
|
15
19
|
[Youtube Video: Oxidized TREX 2014 presentation](http://youtu.be/kBQ_CTUuqeU#t=3h)
|
16
20
|
|
17
21
|
#### Index
|
18
|
-
1. [Supported OS Types](
|
22
|
+
1. [Supported OS Types](docs/Supported-OS-Types.md)
|
19
23
|
2. [Installation](#installation)
|
20
24
|
* [Debian](#debian)
|
21
25
|
* [CentOS, Oracle Linux, Red Hat Linux](#centos-oracle-linux-red-hat-linux)
|
22
|
-
* [
|
26
|
+
* [FreeBSD](#freebsd)
|
27
|
+
* [Build from Git](#build-from-git)
|
28
|
+
* [Docker](#running-with-docker)
|
29
|
+
* [Installing Ruby 2.1.2 using RVM](#installing-ruby-212-using-rvm)
|
23
30
|
3. [Initial Configuration](#configuration)
|
24
|
-
4. [
|
25
|
-
|
26
|
-
|
27
|
-
* [
|
28
|
-
* [
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
* [
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
* [Advanced Configuration](#advanced-configuration)
|
41
|
-
* [Advanced Group Configuration](#advanced-group-configuration)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
* [
|
46
|
-
* [
|
47
|
-
|
48
|
-
#
|
49
|
-
* Vendor
|
50
|
-
* OS model
|
51
|
-
|
52
|
-
* A10 Networks
|
53
|
-
* [ACOS](lib/oxidized/model/acos.rb)
|
54
|
-
* Alcatel-Lucent
|
55
|
-
* [AOS](lib/oxidized/model/aos.rb)
|
56
|
-
* [AOS7](lib/oxidized/model/aos7.rb)
|
57
|
-
* [ISAM](lib/oxidized/model/isam.rb)
|
58
|
-
* Wireless
|
59
|
-
* Alvarion
|
60
|
-
* [BreezeACCESS](lib/oxidized/model/alvarion.rb)
|
61
|
-
* APC
|
62
|
-
* [AOS](lib/oxidized/model/apc_aos.rb)
|
63
|
-
* Arista
|
64
|
-
* [EOS](lib/oxidized/model/eos.rb)
|
65
|
-
* Arris
|
66
|
-
* [C4CMTS](lib/oxidized/model/c4cmts.rb)
|
67
|
-
* Aruba
|
68
|
-
* [AOSW](lib/oxidized/model/aosw.rb)
|
69
|
-
* Avaya
|
70
|
-
* [VOSS](lib/oxidized/model/voss.rb)
|
71
|
-
* Brocade
|
72
|
-
* [FabricOS](lib/oxidized/model/fabricos.rb)
|
73
|
-
* [Ironware](lib/oxidized/model/ironware.rb)
|
74
|
-
* [NOS (Network Operating System)](lib/oxidized/model/nos.rb)
|
75
|
-
* [Vyatta](lib/oxidized/model/vyatta.rb)
|
76
|
-
* [6910](lib/oxidized/model/br6910.rb)
|
77
|
-
* Casa
|
78
|
-
* [Casa](lib/oxidized/model/casa.rb)
|
79
|
-
* Check Point
|
80
|
-
* [GaiaOS](lib/oxidized/model/gaiaos.rb)
|
81
|
-
* Ciena
|
82
|
-
* [SAOS](lib/oxidized/model/saos.rb)
|
83
|
-
* Cisco
|
84
|
-
* [AireOS](lib/oxidized/model/aireos.rb)
|
85
|
-
* [ASA](lib/oxidized/model/asa.rb)
|
86
|
-
* [CatOS](lib/oxidized/model/catos.rb)
|
87
|
-
* [IOS](lib/oxidized/model/ios.rb)
|
88
|
-
* [IOSXR](lib/oxidized/model/iosxr.rb)
|
89
|
-
* [NGA](lib/oxidized/model/cisconga.rb)
|
90
|
-
* [NXOS](lib/oxidized/model/nxos.rb)
|
91
|
-
* [SMB (Nikola series)](lib/oxidized/model/ciscosmb.rb)
|
92
|
-
* Citrix
|
93
|
-
* [NetScaler (Virtual Applicance)](lib/oxidized/model/netscaler.rb)
|
94
|
-
* Coriant (former Tellabs)
|
95
|
-
* [TMOS (8800)](lib/oxidized/model/corianttmos.rb)
|
96
|
-
* [8600](lib/oxidized/model/coriant8600.rb)
|
97
|
-
* Cumulus
|
98
|
-
* [Linux](lib/oxidized/model/cumulus.rb)
|
99
|
-
* DataCom
|
100
|
-
* [DmSwitch 3000](lib/oxidized/model/datacom.rb)
|
101
|
-
* DELL
|
102
|
-
* [PowerConnect](lib/oxidized/model/powerconnect.rb)
|
103
|
-
* [AOSW](lib/oxidized/model/aosw.rb)
|
104
|
-
* D-Link
|
105
|
-
* [D-Link](lib/oxidized/model/dlink.rb)
|
106
|
-
* Ericsson/Redback
|
107
|
-
* [IPOS (former SEOS)](lib/oxidized/model/ipos.rb)
|
108
|
-
* Extreme Networks
|
109
|
-
* [XOS](lib/oxidized/model/xos.rb)
|
110
|
-
* [WM](lib/oxidized/model/mtrlrfs.rb)
|
111
|
-
* F5
|
112
|
-
* [TMOS](lib/oxidized/model/tmos.rb)
|
113
|
-
* Force10
|
114
|
-
* [DNOS](lib/oxidized/model/dnos.rb)
|
115
|
-
* [FTOS](lib/oxidized/model/ftos.rb)
|
116
|
-
* FortiGate
|
117
|
-
* [FortiOS](lib/oxidized/model/fortios.rb)
|
118
|
-
* Fujitsu
|
119
|
-
* [PRIMERGY Blade switch 1/10Gbe](lib/oxidized/model/fujitsupy.rb)
|
120
|
-
* Hatteras
|
121
|
-
* [Hatteras](lib/oxidized/model/hatteras.rb)
|
122
|
-
* HP
|
123
|
-
* [Comware (HP A-series, H3C, 3Com)](lib/oxidized/model/comware.rb)
|
124
|
-
* [Procurve](lib/oxidized/model/procurve.rb)
|
125
|
-
* [BladeSystem (Onboard Administrator)](lib/oxidized/model/hpebladesystem.rb)
|
126
|
-
* Huawei
|
127
|
-
* [VRP](lib/oxidized/model/vrp.rb)
|
128
|
-
* Juniper
|
129
|
-
* [JunOS](lib/oxidized/model/junos.rb)
|
130
|
-
* [ScreenOS (Netscreen)](lib/oxidized/model/screenos.rb)
|
131
|
-
* Mellanox
|
132
|
-
* [MLNX-OS](lib/oxidized/model/mlnxos.rb)
|
133
|
-
* [Voltaire](lib/oxidized/model/voltaire.rb)
|
134
|
-
* Mikrotik
|
135
|
-
* [RouterOS](lib/oxidized/model/routeros.rb)
|
136
|
-
* Motorola
|
137
|
-
* [RFS](lib/oxidized/model/mtrlrfs.rb)
|
138
|
-
* MRV
|
139
|
-
* [MasterOS](lib/oxidized/model/masteros.rb)
|
140
|
-
* [FiberDriver](lib/oxidized/model/fiberdriver.rb)
|
141
|
-
* Netgear
|
142
|
-
* [Netgear](lib/oxidized/model/netgear.rb)
|
143
|
-
* Netonix
|
144
|
-
* [WISP Switch (As Netonix)](lib/oxidized/model/netonix.rb)
|
145
|
-
* Nokia (formerly TiMetra, Alcatel, Alcatel-Lucent)
|
146
|
-
* [SR OS (TiMOS)](lib/oxidized/model/timos.rb)
|
147
|
-
* OneAccess
|
148
|
-
* [OneOS](lib/oxidized/model/oneos.rb)
|
149
|
-
* Opengear
|
150
|
-
* [Opengear](lib/oxidized/model/opengear.rb)
|
151
|
-
* Palo Alto
|
152
|
-
* [PANOS](lib/oxidized/model/panos.rb)
|
153
|
-
* [PLANET SG/SGS Switches](lib/oxidized/model/planet.rb)
|
154
|
-
* [pfSense](lib/oxidized/model/pfsense.rb)
|
155
|
-
* Quanta
|
156
|
-
* [Quanta / VxWorks 6.6 (1.1.0.8)](lib/oxidized/model/quantaos.rb)
|
157
|
-
* Siklu
|
158
|
-
* [EtherHaul](lib/oxidized/model/siklu.rb)
|
159
|
-
* Supermicro
|
160
|
-
* [Supermicro](lib/oxidized/model/supermicro.rb)
|
161
|
-
* Trango Systems
|
162
|
-
* [Trango](lib/oxidized/model/trango.rb)
|
163
|
-
* TPLink
|
164
|
-
* [TPLink](lib/oxidized/model/tplink.rb)
|
165
|
-
* Ubiquiti
|
166
|
-
* [AirOS](lib/oxidized/model/airos.rb)
|
167
|
-
* [Edgeos](lib/oxidized/model/edgeos.rb)
|
168
|
-
* [EdgeSwitch](lib/oxidized/model/edgeswitch.rb)
|
169
|
-
* Watchguard
|
170
|
-
* [Fireware OS](lib/oxidized/model/firewareos.rb)
|
171
|
-
* Zhone
|
172
|
-
* [Zhone (OLT and MX)](lib/oxidized/model/zhoneolt.rb)
|
173
|
-
* Zyxel
|
174
|
-
* [ZyNOS](lib/oxidized/model/zynos.rb)
|
175
|
-
|
31
|
+
4. [Configuration](docs/Configuration.md)
|
32
|
+
* [Debugging](docs/Configuration.md#debugging)
|
33
|
+
* [Privileged mode](docs/Configuration.md#privileged-mode)
|
34
|
+
* [Disabling SSH exec channels](docs/Configuration.md#disabling-ssh-exec-channels)
|
35
|
+
* [Sources:](docs/Sources.md)
|
36
|
+
* [Source: CSV](docs/Sources.md#source-csv)
|
37
|
+
* [Source: SQL](docs/Sources.md#source-sql)
|
38
|
+
* [Source: SQLite](docs/Sources.md#source-sqlite)
|
39
|
+
* [Source: Mysql](docs/Sources.md#source-mysql)
|
40
|
+
* [Source: HTTP](docs/Sources.md#source-http)
|
41
|
+
* [Outputs:](docs/Outputs.md)
|
42
|
+
* [Output: GIT](docs/Outputs.md#output-git)
|
43
|
+
* [Output: GIT-Crypt](docs/Outputs.md#output-git-crypt)
|
44
|
+
* [Output: HTTP](docs/Outputs.md#output-http)
|
45
|
+
* [Output: File](docs/Outputs.md#output-file)
|
46
|
+
* [Output types](docs/Outputs.md#output-types)
|
47
|
+
* [Advanced Configuration](docs/Configuration.md#advanced-configuration)
|
48
|
+
* [Advanced Group Configuration](docs/Configuration.md#advanced-group-configuration)
|
49
|
+
* [Hooks](docs/Hooks.md)
|
50
|
+
5. [Help](#help)
|
51
|
+
6. [Ruby API](docs/Ruby-API.md#ruby-api)
|
52
|
+
* [Input](docs/Ruby-API.md#input)
|
53
|
+
* [Output](docs/Ruby-API.md#output)
|
54
|
+
* [Source](docs/Ruby-API.md#source)
|
55
|
+
* [Model](docs/Ruby-API.md#model)
|
176
56
|
|
177
57
|
# Installation
|
58
|
+
|
178
59
|
## Debian
|
179
60
|
Install all required packages and gems.
|
180
61
|
|
@@ -185,7 +66,8 @@ gem install oxidized-script oxidized-web # if you don't install oxidized-web, ma
|
|
185
66
|
```
|
186
67
|
|
187
68
|
## CentOS, Oracle Linux, Red Hat Linux
|
188
|
-
On CentOS 6 / RHEL 6, install Ruby greater than 1.9.3 (for Ruby 2.1.2 installation instructions see
|
69
|
+
On CentOS 6 / RHEL 6, install Ruby greater than 1.9.3 (for Ruby 2.1.2 installation instructions see [Installing Ruby 2.1.2 using RVM](#installing-ruby-212-using-rvm)), then install Oxidized dependencies
|
70
|
+
|
189
71
|
```shell
|
190
72
|
yum install cmake sqlite-devel openssl-devel libssh2-devel
|
191
73
|
```
|
@@ -197,13 +79,14 @@ yum install cmake sqlite-devel openssl-devel libssh2-devel ruby gcc ruby-devel
|
|
197
79
|
```
|
198
80
|
|
199
81
|
Now let's install oxidized via Rubygems:
|
82
|
+
|
200
83
|
```shell
|
201
84
|
gem install oxidized
|
202
85
|
gem install oxidized-script oxidized-web
|
203
86
|
```
|
204
87
|
|
205
88
|
## FreeBSD
|
206
|
-
Use RVM to install Ruby v2.1.2
|
89
|
+
[Use RVM to install Ruby v2.1.2](#installing-ruby-2.1.2-using-rvm)
|
207
90
|
|
208
91
|
Install all required packages and gems.
|
209
92
|
|
@@ -213,8 +96,6 @@ gem install oxidized
|
|
213
96
|
gem install oxidized-script oxidized-web
|
214
97
|
```
|
215
98
|
|
216
|
-
|
217
|
-
|
218
99
|
## Build from Git
|
219
100
|
```shell
|
220
101
|
git clone https://github.com/ytti/oxidized.git
|
@@ -223,98 +104,6 @@ gem build *.gemspec
|
|
223
104
|
gem install pkg/*.gem
|
224
105
|
```
|
225
106
|
|
226
|
-
# Configuration
|
227
|
-
|
228
|
-
Oxidized configuration is in YAML format. Configuration files are subsequently sourced from ```/etc/oxidized/config``` then ```~/.config/oxidized/config```. The hashes will be merged, this might be useful for storing source information in a system wide file and user specific configuration in the home directory (to only include a staff specific username and password). Eg. if many users are using ```oxs```, see [Oxidized::Script](https://github.com/ytti/oxidized-script).
|
229
|
-
|
230
|
-
It is recommended practice to run Oxidized using its own username. This username can be added using standard command-line tools:
|
231
|
-
|
232
|
-
```
|
233
|
-
useradd oxidized
|
234
|
-
```
|
235
|
-
|
236
|
-
It is recommended not to run Oxidized as root.
|
237
|
-
|
238
|
-
To initialize a default configuration in your home directory ```~/.config/oxidized/config```, simply run ```oxidized``` once. If you don't further configure anything from the output and source sections, it'll extend the examples on a subsequent ```oxidized``` execution. This is useful to see what options for a specific source or output backend are available.
|
239
|
-
|
240
|
-
You can set the env variable `OXIDIZED_HOME` to change its home directory.
|
241
|
-
|
242
|
-
```
|
243
|
-
OXIDIZED_HOME=/etc/oxidized
|
244
|
-
|
245
|
-
$ tree -L 1 /etc/oxidized
|
246
|
-
/etc/oxidized/
|
247
|
-
├── config
|
248
|
-
├── log-router-ssh
|
249
|
-
├── log-router-telnet
|
250
|
-
├── pid
|
251
|
-
├── router.db
|
252
|
-
└── repository.git
|
253
|
-
```
|
254
|
-
|
255
|
-
## Source
|
256
|
-
|
257
|
-
Oxidized supports ```CSV```, ```SQLite``` and ```HTTP``` as source backends. The CSV backend reads nodes from a rancid compatible router.db file. The SQLite backend will fire queries against a database and map certain fields to model items. The HTTP backend will fire queries against a http/https url. Take a look at the [Cookbook](#cookbook) for more details.
|
258
|
-
|
259
|
-
## Outputs
|
260
|
-
|
261
|
-
Possible outputs are either ```file```, ```git``` or ```git-crypt```. The file backend takes a destination directory as argument and will keep a file per device, with most recent running version of a device. The GIT backend (recommended) will initialize an empty GIT repository in the specified path and create a new commit on every configuration change. The GIT-Crypt backend will also initialize a GIT repository but every configuration push to it will be encrypted on the fly by using ```git-crypt``` tool. Take a look at the [Cookbook](#cookbook) for more details.
|
262
|
-
|
263
|
-
Maps define how to map a model's fields to model [model fields](https://github.com/ytti/oxidized/tree/master/lib/oxidized/model). Most of the settings should be self explanatory, log is ignored if `use_syslog`(requires Ruby >= 2.0) is set to `true`.
|
264
|
-
|
265
|
-
First create the directory where the CSV ```output``` is going to store device configs and start Oxidized once.
|
266
|
-
```
|
267
|
-
mkdir -p ~/.config/oxidized/configs
|
268
|
-
oxidized
|
269
|
-
```
|
270
|
-
|
271
|
-
Now tell Oxidized where it finds a list of network devices to backup configuration from. You can either use CSV or SQLite as source. To create a CSV source add the following snippet:
|
272
|
-
|
273
|
-
Note: If gpg is set to anything other than false it will attempt to decrypt the file contents
|
274
|
-
```
|
275
|
-
source:
|
276
|
-
default: csv
|
277
|
-
csv:
|
278
|
-
file: ~/.config/oxidized/router.db
|
279
|
-
delimiter: !ruby/regexp /:/
|
280
|
-
gpg: false
|
281
|
-
gpg_password: 'password'
|
282
|
-
map:
|
283
|
-
name: 0
|
284
|
-
model: 1
|
285
|
-
```
|
286
|
-
|
287
|
-
Now lets create a file based device database (you might want to switch to SQLite later on). Put your routers in ```~/.config/oxidized/router.db``` (file format is compatible with rancid). Simply add an item per line:
|
288
|
-
|
289
|
-
```
|
290
|
-
router01.example.com:ios
|
291
|
-
switch01.example.com:procurve
|
292
|
-
router02.example.com:ios
|
293
|
-
```
|
294
|
-
|
295
|
-
Run ```oxidized``` again to take the first backups.
|
296
|
-
|
297
|
-
# Installing Ruby 2.1.2 using RVM
|
298
|
-
|
299
|
-
Install Ruby 2.1.2 build dependencies
|
300
|
-
```
|
301
|
-
yum install curl gcc-c++ patch readline readline-devel zlib zlib-devel
|
302
|
-
yum install libyaml-devel libffi-devel openssl-devel make cmake
|
303
|
-
yum install bzip2 autoconf automake libtool bison iconv-devel libssh2-devel
|
304
|
-
```
|
305
|
-
|
306
|
-
Install RVM
|
307
|
-
```
|
308
|
-
curl -L get.rvm.io | bash -s stable
|
309
|
-
```
|
310
|
-
|
311
|
-
Setup RVM environment and compile and install Ruby 2.1.2 and set it as default
|
312
|
-
```
|
313
|
-
source /etc/profile.d/rvm.sh
|
314
|
-
rvm install 2.1.2
|
315
|
-
rvm use --default 2.1.2
|
316
|
-
```
|
317
|
-
|
318
107
|
# Running with Docker
|
319
108
|
|
320
109
|
clone git repo:
|
@@ -343,7 +132,7 @@ docker run --rm -v /etc/oxidized:/root/.config/oxidized -p 8888:8888/tcp -t oxid
|
|
343
132
|
```
|
344
133
|
If the RESTful API and Web Interface are enabled, on the docker host running the container
|
345
134
|
edit /etc/oxidized/config and modify 'rest: 127.0.0.1:8888' by 'rest: 0.0.0.0:8888'
|
346
|
-
this will bind port 8888 to all interfaces then expose port out.
|
135
|
+
this will bind port 8888 to all interfaces then expose port out. [Issue #445](https://github.com/ytti/oxidized/issues/445)
|
347
136
|
|
348
137
|
You can also use docker-compose to launch oxidized container:
|
349
138
|
```
|
@@ -360,7 +149,7 @@ oxidized:
|
|
360
149
|
- /etc/oxidized:/root/.config/oxidized
|
361
150
|
```
|
362
151
|
|
363
|
-
create the `/etc/oxidized/router.db`
|
152
|
+
create the `/etc/oxidized/router.db` [See CSV Source for further info](docs/Configuration.md#source-csv)
|
364
153
|
|
365
154
|
```
|
366
155
|
vim /etc/oxidized/router.db
|
@@ -390,624 +179,96 @@ If you need to use an internal CA (e.g. to connect to an private github instance
|
|
390
179
|
docker run -v /etc/oxidized:/root/.config/oxidized -v /path/to/MY-CA.crt:/usr/local/share/ca-certificates/MY-CA.crt -p 8888:8888/tcp -e UPDATE_CA_CERTIFICATES=true -t oxidized/oxidized:latest
|
391
180
|
```
|
392
181
|
|
393
|
-
|
394
|
-
### Debugging
|
395
|
-
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 containing the value true to the ```input``` section. The log files will be created depending on the parent directory of the logfile option.
|
396
|
-
|
397
|
-
The following example will log an active ssh/telnet session ```/home/oxidized/.config/oxidized/log/<IP-Adress>-<PROTOCOL>```. The file will be truncated on each consecutive ssh/telnet session, so you need to put a ```tailf``` or ```tail -f``` on that file!
|
398
|
-
|
399
|
-
```
|
400
|
-
log: /home/oxidized/.config/oxidized/log
|
401
|
-
|
402
|
-
...
|
403
|
-
|
404
|
-
input:
|
405
|
-
default: ssh, telnet
|
406
|
-
debug: true
|
407
|
-
ssh:
|
408
|
-
secure: false
|
409
|
-
```
|
410
|
-
|
411
|
-
### Privileged mode
|
412
|
-
|
413
|
-
To start privileged mode before pulling the configuration, Oxidized needs to send the enable command. You can globally enable this, by adding the following snippet to the global section of the configuration file.
|
414
|
-
|
415
|
-
```
|
416
|
-
vars:
|
417
|
-
enable: S3cre7
|
418
|
-
```
|
419
|
-
|
420
|
-
### Removing secrets
|
421
|
-
|
422
|
-
To strip out secrets from configurations before storing them, Oxidized needs the the remove_secrets flag. You can globally enable this by adding the following snippet to the global sections of the configuration file.
|
423
|
-
|
424
|
-
```
|
425
|
-
vars:
|
426
|
-
remove_secret: true
|
427
|
-
```
|
428
|
-
|
429
|
-
Device models can contain substitution filters to remove potentially sensitive data from configs.
|
430
|
-
|
431
|
-
As a partial example from ios.rb:
|
432
|
-
|
433
|
-
```
|
434
|
-
cmd :secret do |cfg|
|
435
|
-
cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
|
436
|
-
(...)
|
437
|
-
cfg
|
438
|
-
end
|
439
|
-
```
|
440
|
-
The above strips out snmp community strings from your saved configs.
|
441
|
-
|
442
|
-
**NOTE:** Removing secrets reduces the usefulness as a full configuration backup, but it may make sharing configs easier.
|
443
|
-
|
444
|
-
### Disabling SSH exec channels
|
445
|
-
|
446
|
-
Oxidized uses exec channels to make information extraction simpler, but there are some situations where this doesn't work well, e.g. configuring devices. This feature can be turned off by setting the ```ssh_no_exec```
|
447
|
-
variable.
|
448
|
-
|
449
|
-
```
|
450
|
-
vars:
|
451
|
-
ssh_no_exec: true
|
452
|
-
```
|
453
|
-
|
454
|
-
### Source: CSV
|
455
|
-
|
456
|
-
One line per device, colon seperated. If `ip` isn't present, a DNS lookup will be done against `name`. For large installations, setting `ip` will dramatically reduce startup time.
|
457
|
-
|
458
|
-
```
|
459
|
-
source:
|
460
|
-
default: csv
|
461
|
-
csv:
|
462
|
-
file: /var/lib/oxidized/router.db
|
463
|
-
delimiter: !ruby/regexp /:/
|
464
|
-
map:
|
465
|
-
name: 0
|
466
|
-
ip: 1
|
467
|
-
model: 2
|
468
|
-
username: 3
|
469
|
-
password: 4
|
470
|
-
vars_map:
|
471
|
-
enable: 5
|
472
|
-
```
|
473
|
-
|
474
|
-
### SSH Proxy Command
|
475
|
-
|
476
|
-
Oxidized can `ssh` through a proxy as well. To do so we just need to set `ssh_proxy` variable.
|
477
|
-
|
478
|
-
```
|
479
|
-
...
|
480
|
-
map:
|
481
|
-
name: 0
|
482
|
-
model: 1
|
483
|
-
vars_map:
|
484
|
-
enable: 2
|
485
|
-
ssh_proxy: 3
|
486
|
-
...
|
487
|
-
```
|
488
|
-
### Source: SQL
|
489
|
-
Oxidized uses the `sequel` ruby gem. You can use a variety of databases that aren't explicitly listed. For more information visit https://github.com/jeremyevans/sequel Make sure you have the correct adapter!
|
490
|
-
### Source: MYSQL
|
491
|
-
|
492
|
-
```sudo apt-get install libmysqlclient-dev```
|
493
|
-
|
494
|
-
The values correspond to your fields in the DB such that ip, model, etc are field names in the DB
|
495
|
-
|
496
|
-
```
|
497
|
-
source:
|
498
|
-
default: sql
|
499
|
-
sql:
|
500
|
-
adapter: mysql2
|
501
|
-
database: oxidized
|
502
|
-
table: nodes
|
503
|
-
username: root
|
504
|
-
password: rootpass
|
505
|
-
map:
|
506
|
-
name: ip
|
507
|
-
model: model
|
508
|
-
username: username
|
509
|
-
password: password
|
510
|
-
vars_map:
|
511
|
-
enable: enable
|
512
|
-
```
|
513
|
-
|
514
|
-
### Source: SQLite
|
515
|
-
|
516
|
-
One row per device, filtered by hostname.
|
517
|
-
|
518
|
-
```
|
519
|
-
source:
|
520
|
-
default: sql
|
521
|
-
sql:
|
522
|
-
adapter: sqlite
|
523
|
-
database: "/var/lib/oxidized/devices.db"
|
524
|
-
table: devices
|
525
|
-
map:
|
526
|
-
name: fqdn
|
527
|
-
model: model
|
528
|
-
username: username
|
529
|
-
password: password
|
530
|
-
vars_map:
|
531
|
-
enable: enable
|
532
|
-
```
|
533
|
-
|
534
|
-
### Source: HTTP
|
535
|
-
|
536
|
-
One object per device.
|
537
|
-
|
538
|
-
HTTP Supports basic auth, configure the user and pass you want to use under the http: section.
|
539
|
-
|
540
|
-
```
|
541
|
-
source:
|
542
|
-
default: http
|
543
|
-
http:
|
544
|
-
url: https://url/api
|
545
|
-
scheme: https
|
546
|
-
delimiter: !ruby/regexp /:/
|
547
|
-
user: username
|
548
|
-
pass: password
|
549
|
-
map:
|
550
|
-
name: hostname
|
551
|
-
model: os
|
552
|
-
username: username
|
553
|
-
password: password
|
554
|
-
vars_map:
|
555
|
-
enable: enable
|
556
|
-
headers:
|
557
|
-
X-Auth-Token: 'somerandomstring'
|
558
|
-
```
|
559
|
-
|
560
|
-
You can also pass `secure: false` if you want to disable ssl certificate verification:
|
561
|
-
|
562
|
-
```
|
563
|
-
source:
|
564
|
-
default: http
|
565
|
-
http:
|
566
|
-
url: https://url/api
|
567
|
-
scheme: https
|
568
|
-
secure: false
|
569
|
-
```
|
570
|
-
|
571
|
-
### Output: File
|
572
|
-
|
573
|
-
Parent directory needs to be created manually, one file per device, with most recent running config.
|
574
|
-
|
575
|
-
```
|
576
|
-
output:
|
577
|
-
file:
|
578
|
-
directory: /var/lib/oxidized/configs
|
579
|
-
```
|
580
|
-
|
581
|
-
### Output: Git
|
582
|
-
|
583
|
-
This uses the rugged/libgit2 interface. So you should remember that normal Git hooks will not be executed.
|
584
|
-
|
585
|
-
|
586
|
-
For a single repositories for all devices:
|
587
|
-
|
588
|
-
``` yaml
|
589
|
-
output:
|
590
|
-
default: git
|
591
|
-
git:
|
592
|
-
user: Oxidized
|
593
|
-
email: o@example.com
|
594
|
-
repo: "/var/lib/oxidized/devices.git"
|
595
|
-
```
|
596
|
-
|
597
|
-
And for groups repositories:
|
598
|
-
|
599
|
-
``` yaml
|
600
|
-
output:
|
601
|
-
default: git
|
602
|
-
git:
|
603
|
-
user: Oxidized
|
604
|
-
email: o@example.com
|
605
|
-
repo: "/var/lib/oxidized/git-repos/default.git"
|
606
|
-
```
|
607
|
-
|
608
|
-
Oxidized will create a repository for each group in the same directory as the `default.git`. For
|
609
|
-
example:
|
182
|
+
# Installing Ruby 2.1.2 using RVM
|
610
183
|
|
611
|
-
|
612
|
-
host1:ios:first
|
613
|
-
host2:nxos:second
|
184
|
+
Install Ruby 2.1.2 build dependencies
|
614
185
|
```
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
``` bash
|
619
|
-
$ ls /var/lib/oxidized/git-repos
|
620
|
-
|
621
|
-
default.git first.git second.git
|
186
|
+
yum install curl gcc-c++ patch readline readline-devel zlib zlib-devel
|
187
|
+
yum install libyaml-devel libffi-devel openssl-devel make cmake
|
188
|
+
yum install bzip2 autoconf automake libtool bison iconv-devel libssh2-devel
|
622
189
|
```
|
623
190
|
|
624
|
-
|
625
|
-
|
626
|
-
``` yaml
|
627
|
-
output:
|
628
|
-
default: git
|
629
|
-
git:
|
630
|
-
single_repo: true
|
631
|
-
repo: "/var/lib/oxidized/devices.git"
|
632
|
-
|
191
|
+
Install RVM
|
633
192
|
```
|
634
|
-
|
635
|
-
### Output: Git-Crypt
|
636
|
-
|
637
|
-
This uses the gem git and system git-crypt interfaces. Have a look at [GIT-Crypt](https://www.agwa.name/projects/git-crypt/) documentation to know how to install it.
|
638
|
-
Additionally to user and email informations, you have to provide the users ID that can be a key ID, a full fingerprint, an email address, or anything else that uniquely identifies a public key to GPG (see "HOW TO SPECIFY A USER ID" in the gpg man page).
|
639
|
-
|
640
|
-
|
641
|
-
For a single repositories for all devices:
|
642
|
-
|
643
|
-
``` yaml
|
644
|
-
output:
|
645
|
-
default: gitcrypt
|
646
|
-
gitcrypt:
|
647
|
-
user: Oxidized
|
648
|
-
email: o@example.com
|
649
|
-
repo: "/var/lib/oxidized/devices"
|
650
|
-
users:
|
651
|
-
- "0x0123456789ABCDEF"
|
652
|
-
- "<user@example.com>"
|
193
|
+
curl -L get.rvm.io | bash -s stable
|
653
194
|
```
|
654
195
|
|
655
|
-
|
656
|
-
|
657
|
-
``` yaml
|
658
|
-
output:
|
659
|
-
default: gitcrypt
|
660
|
-
gitcrypt:
|
661
|
-
user: Oxidized
|
662
|
-
email: o@example.com
|
663
|
-
repo: "/var/lib/oxidized/git-repos/default"
|
664
|
-
users:
|
665
|
-
- "0xABCDEF0123456789"
|
666
|
-
- "0x0123456789ABCDEF"
|
196
|
+
Setup RVM environment and compile and install Ruby 2.1.2 and set it as default
|
667
197
|
```
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
``` csv
|
673
|
-
host1:ios:first
|
674
|
-
host2:nxos:second
|
198
|
+
source /etc/profile.d/rvm.sh
|
199
|
+
rvm install 2.1.2
|
200
|
+
rvm use --default 2.1.2
|
675
201
|
```
|
676
202
|
|
677
|
-
|
203
|
+
# Configuration
|
204
|
+
Oxidized configuration is in YAML format. Configuration files are subsequently sourced from `/etc/oxidized/config` then `~/.config/oxidized/config`. The hashes will be merged, this might be useful for storing source information in a system wide file and user specific configuration in the home directory (to only include a staff specific username and password). Eg. if many users are using `oxs`, see [Oxidized::Script](https://github.com/ytti/oxidized-script).
|
678
205
|
|
679
|
-
|
680
|
-
$ ls /var/lib/oxidized/git-repos
|
206
|
+
It is recommended practice to run Oxidized using its own username. This username can be added using standard command-line tools:
|
681
207
|
|
682
|
-
default.git first.git second.git
|
683
208
|
```
|
684
|
-
|
685
|
-
If you would like to use groups and a single repository, you can force this with the `single_repo` config.
|
686
|
-
|
687
|
-
``` yaml
|
688
|
-
output:
|
689
|
-
default: gitcrypt
|
690
|
-
gitcrypt:
|
691
|
-
single_repo: true
|
692
|
-
repo: "/var/lib/oxidized/devices"
|
693
|
-
users:
|
694
|
-
- "0xABCDEF0123456789"
|
695
|
-
- "0x0123456789ABCDEF"
|
696
|
-
|
209
|
+
useradd oxidized
|
697
210
|
```
|
698
211
|
|
699
|
-
|
212
|
+
> It is recommended __not__ to run Oxidized as root.
|
700
213
|
|
701
|
-
|
214
|
+
To initialize a default configuration in your home directory `~/.config/oxidized/config`, simply run `oxidized` once. If you don't further configure anything from the output and source sections, it'll extend the examples on a subsequent `oxidized` execution. This is useful to see what options for a specific source or output backend are available.
|
702
215
|
|
703
|
-
|
216
|
+
You can set the env variable `OXIDIZED_HOME` to change its home directory.
|
704
217
|
|
705
218
|
```
|
706
|
-
|
707
|
-
default: http
|
708
|
-
http:
|
709
|
-
user: admin
|
710
|
-
password: changeit
|
711
|
-
url: "http://192.168.162.50:8080/db/coll"
|
712
|
-
```
|
713
|
-
|
714
|
-
### Output types
|
715
|
-
|
716
|
-
If you prefer to have different outputs in different files and/or directories, you can easily do this by modifying the corresponding model. To change the behaviour for IOS, you would edit `lib/oxidized/model/ios.rb` (run `gem contents oxidized` to find out the full file path).
|
717
|
-
|
718
|
-
For example, let's say you want to split out `show version` and `show inventory` into separate files in a directory called `nodiff` which your tools will not send automated diffstats for. You can apply a patch along the lines of
|
219
|
+
OXIDIZED_HOME=/etc/oxidized
|
719
220
|
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
- comment cfg
|
729
|
-
+ cmd 'show inventory' do |state|
|
730
|
-
+ state.type = 'nodiff'
|
731
|
-
+ state
|
732
|
-
+ end
|
733
|
-
|
734
|
-
- cmd 'show running-config' do |cfg|
|
735
|
-
- cfg = cfg.each_line.to_a[3..-1].join
|
736
|
-
- cfg.gsub! /^Current configuration : [^\n]*\n/, ''
|
737
|
-
- cfg.sub! /^(ntp clock-period).*/, '! \1'
|
738
|
-
- cfg.gsub! /^\ tunnel\ mpls\ traffic-eng\ bandwidth[^\n]*\n*(
|
739
|
-
+ cmd 'show running-config' do |state|
|
740
|
-
+ state = state.each_line.to_a[3..-1].join
|
741
|
-
+ state.gsub! /^Current configuration : [^\n]*\n/, ''
|
742
|
-
+ state.sub! /^(ntp clock-period).*/, '! \1'
|
743
|
-
+ state.gsub! /^\ tunnel\ mpls\ traffic-eng\ bandwidth[^\n]*\n*(
|
744
|
-
(?:\ [^\n]*\n*)*
|
745
|
-
tunnel\ mpls\ traffic-eng\ auto-bw)/mx, '\1'
|
746
|
-
- cfg
|
747
|
-
+ state = Oxidized::String.new state
|
748
|
-
+ state.type = 'nodiff'
|
749
|
-
+ state
|
221
|
+
$ tree -L 1 /etc/oxidized
|
222
|
+
/etc/oxidized/
|
223
|
+
├── config
|
224
|
+
├── log-router-ssh
|
225
|
+
├── log-router-telnet
|
226
|
+
├── pid
|
227
|
+
├── router.db
|
228
|
+
└── repository.git
|
750
229
|
```
|
751
230
|
|
752
|
-
|
231
|
+
## Source
|
753
232
|
|
754
|
-
|
755
|
-
diff/$FQDN--show_running_config
|
756
|
-
nodiff/$FQDN--show_version
|
757
|
-
nodiff/$FQDN--show_inventory
|
758
|
-
```
|
233
|
+
Oxidized supports [CSV](docs/Configuration.md#source-csv), [SQLite](docs/Configuration.md#source-sqlite), [MySQL](docs/Configuration.md#source-mysql) and [HTTP](docs/Configuration.md#source-http) as source backends. The CSV backend reads nodes from a rancid compatible router.db file. The SQLite and MySQL backends will fire queries against a database and map certain fields to model items. The HTTP backend will fire queries against a http/https url. Take a look at the [Configuration](docs/Configuration.md) for more details.
|
759
234
|
|
760
|
-
|
235
|
+
## Outputs
|
761
236
|
|
762
|
-
The
|
237
|
+
Possible outputs are either [File](docs/Configuration.md#output-file), [GIT](docs/Configuration.md#output-git), [GIT-Crypt](docs/Configuration.md#output-git-crypt) and [HTT](docs/Configuration.md#output-http). The file backend takes a destination directory as argument and will keep a file per device, with most recent running version of a device. The GIT backend (recommended) will initialize an empty GIT repository in the specified path and create a new commit on every configuration change. The GIT-Crypt backend will also initialize a GIT repository but every configuration push to it will be encrypted on the fly by using `git-crypt` tool. Take a look at the [Configuration](docs/Configuration.md) for more details.
|
763
238
|
|
764
|
-
|
765
|
-
# Listen on http://127.0.0.1:8888/
|
766
|
-
rest: 127.0.0.1:8888
|
767
|
-
```
|
239
|
+
Maps define how to map a model's fields to model [model fields](https://github.com/ytti/oxidized/tree/master/lib/oxidized/model). Most of the settings should be self explanatory, log is ignored if `use_syslog`(requires Ruby >= 2.0) is set to `true`.
|
768
240
|
|
241
|
+
First create the directory where the CSV `output` is going to store device configs and start Oxidized once.
|
769
242
|
```
|
770
|
-
|
771
|
-
|
243
|
+
mkdir -p ~/.config/oxidized/configs
|
244
|
+
oxidized
|
772
245
|
```
|
773
246
|
|
774
|
-
|
775
|
-
|
776
|
-
Below is an advanced example configuration. You will be able to (optionally) override options per device. The router.db format used is ```hostname:model:username:password:enable_password```. Hostname and model will be the only required options, all others override the global configuration sections.
|
247
|
+
Now tell Oxidized where it finds a list of network devices to backup configuration from. You can either use CSV or SQLite as source. To create a CSV source add the following snippet:
|
777
248
|
|
249
|
+
Note: If gpg is set to anything other than false it will attempt to decrypt the file contents
|
778
250
|
```
|
779
|
-
---
|
780
|
-
username: oxidized
|
781
|
-
password: S3cr3tx
|
782
|
-
model: junos
|
783
|
-
interval: 3600
|
784
|
-
log: ~/.config/oxidized/log
|
785
|
-
debug: false
|
786
|
-
threads: 30
|
787
|
-
timeout: 20
|
788
|
-
retries: 3
|
789
|
-
prompt: !ruby/regexp /^([\w.@-]+[#>]\s?)$/
|
790
|
-
vars:
|
791
|
-
enable: S3cr3tx
|
792
|
-
groups: {}
|
793
|
-
rest: 127.0.0.1:8888
|
794
|
-
pid: ~/.config/oxidized/oxidized.pid
|
795
|
-
input:
|
796
|
-
default: ssh, telnet
|
797
|
-
debug: false
|
798
|
-
ssh:
|
799
|
-
secure: false
|
800
|
-
output:
|
801
|
-
default: git
|
802
|
-
git:
|
803
|
-
user: Oxidized
|
804
|
-
email: oxidized@example.com
|
805
|
-
repo: "~/.config/oxidized/oxidized.git"
|
806
251
|
source:
|
807
252
|
default: csv
|
808
253
|
csv:
|
809
254
|
file: ~/.config/oxidized/router.db
|
810
255
|
delimiter: !ruby/regexp /:/
|
256
|
+
gpg: false
|
257
|
+
gpg_password: 'password'
|
811
258
|
map:
|
812
259
|
name: 0
|
813
260
|
model: 1
|
814
|
-
username: 2
|
815
|
-
password: 3
|
816
|
-
vars_map:
|
817
|
-
enable: 4
|
818
|
-
model_map:
|
819
|
-
cisco: ios
|
820
|
-
juniper: junos
|
821
|
-
|
822
|
-
```
|
823
|
-
|
824
|
-
### Advanced Group Configuration
|
825
|
-
|
826
|
-
For group specific credentials
|
827
|
-
|
828
|
-
```
|
829
|
-
groups:
|
830
|
-
mikrotik:
|
831
|
-
username: admin
|
832
|
-
password: blank
|
833
|
-
ubiquiti:
|
834
|
-
username: ubnt
|
835
|
-
password: ubnt
|
836
|
-
```
|
837
|
-
and add group mapping
|
838
|
-
```
|
839
|
-
map:
|
840
|
-
model: 0
|
841
|
-
name: 1
|
842
|
-
group: 2
|
843
|
-
```
|
844
|
-
For model specific credentials
|
845
|
-
|
846
261
|
```
|
847
|
-
models:
|
848
|
-
junos:
|
849
|
-
username: admin
|
850
|
-
password: password
|
851
|
-
ironware:
|
852
|
-
username: admin
|
853
|
-
password: password
|
854
|
-
vars:
|
855
|
-
enable: enablepassword
|
856
|
-
apc_aos:
|
857
|
-
username: apc
|
858
|
-
password: password
|
859
|
-
```
|
860
|
-
|
861
|
-
### Triggered backups
|
862
|
-
|
863
|
-
A node can be moved to head-of-queue via the REST API `GET/POST /node/next/[NODE]`.
|
864
|
-
|
865
|
-
In the default configuration this node will be processed when the next job worker becomes available, it could take some time if existing backups are in progress. To execute moved jobs immediately a new job can be added:
|
866
|
-
|
867
|
-
```
|
868
|
-
next_adds_job: true
|
869
|
-
```
|
870
|
-
|
871
|
-
# Hooks
|
872
|
-
You can define arbitrary number of hooks that subscribe different events. The hook system is modular and different kind of hook types can be enabled.
|
873
|
-
|
874
|
-
## Configuration
|
875
|
-
Following configuration keys need to be defined for all hooks:
|
876
|
-
|
877
|
-
* `events`: which events to subscribe. Needs to be an array. See below for the list of available events.
|
878
|
-
* `type`: what hook class to use. See below for the list of available hook types.
|
879
262
|
|
880
|
-
|
881
|
-
* `node_success`: triggered when configuration is succesfully pulled from a node and right before storing the configuration.
|
882
|
-
* `node_fail`: triggered after `retries` amount of failed node pulls.
|
883
|
-
* `post_store`: triggered after node configuration is stored (this is executed only when the configuration has changed).
|
263
|
+
Now lets create a file based device database (you might want to switch to SQLite later on). Put your routers in `~/.config/oxidized/router.db` (file format is compatible with rancid). Simply add an item per line:
|
884
264
|
|
885
|
-
## Hook type: exec
|
886
|
-
The `exec` hook type allows users to run an arbitrary shell command or a binary when triggered.
|
887
|
-
|
888
|
-
The command is executed on a separate child process either in synchronous or asynchronous fashion. Non-zero exit values cause errors to be logged. STDOUT and STDERR are currently not collected.
|
889
|
-
|
890
|
-
Command is executed with the following environment:
|
891
|
-
```
|
892
|
-
OX_EVENT
|
893
|
-
OX_NODE_NAME
|
894
|
-
OX_NODE_IP
|
895
|
-
OX_NODE_FROM
|
896
|
-
OX_NODE_MSG
|
897
|
-
OX_NODE_GROUP
|
898
|
-
OX_JOB_STATUS
|
899
|
-
OX_JOB_TIME
|
900
|
-
OX_REPO_COMMITREF
|
901
|
-
OX_REPO_NAME
|
902
|
-
```
|
903
|
-
|
904
|
-
Exec hook recognizes following configuration keys:
|
905
|
-
|
906
|
-
* `timeout`: hard timeout for the command execution. SIGTERM will be sent to the child process after the timeout has elapsed. Default: 60
|
907
|
-
* `async`: influences whether main thread will wait for the command execution. Set this true for long running commands so node pull is not blocked. Default: false
|
908
|
-
* `cmd`: command to run.
|
909
|
-
|
910
|
-
|
911
|
-
## Hook configuration example
|
912
|
-
```
|
913
|
-
hooks:
|
914
|
-
name_for_example_hook1:
|
915
|
-
type: exec
|
916
|
-
events: [node_success]
|
917
|
-
cmd: 'echo "Node success $OX_NODE_NAME" >> /tmp/ox_node_success.log'
|
918
|
-
name_for_example_hook2:
|
919
|
-
type: exec
|
920
|
-
events: [post_store, node_fail]
|
921
|
-
cmd: 'echo "Doing long running stuff for $OX_NODE_NAME" >> /tmp/ox_node_stuff.log; sleep 60'
|
922
|
-
async: true
|
923
|
-
timeout: 120
|
924
265
|
```
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
This hook configures the repository `remote` and _push_ the code when the specified event is triggerd. If the `username` and `password` are not provided, the `Rugged::Credentials::SshKeyFromAgent` will be used.
|
929
|
-
|
930
|
-
`githubrepo` hook recognizes following configuration keys:
|
931
|
-
|
932
|
-
* `remote_repo`: the remote repository to be pushed to.
|
933
|
-
* `username`: username for repository auth.
|
934
|
-
* `password`: password for repository auth.
|
935
|
-
* `publickey`: publickey for repository auth.
|
936
|
-
* `privatekey`: privatekey for repository auth.
|
937
|
-
|
938
|
-
When using groups repositories, each group must have its own `remote` in the `remote_repo` config.
|
939
|
-
|
940
|
-
``` yaml
|
941
|
-
hooks:
|
942
|
-
push_to_remote:
|
943
|
-
remote_repo:
|
944
|
-
routers: git@git.intranet:oxidized/routers.git
|
945
|
-
switches: git@git.intranet:oxidized/switches.git
|
946
|
-
firewalls: git@git.intranet:oxidized/firewalls.git
|
947
|
-
```
|
948
|
-
|
949
|
-
|
950
|
-
## Hook configuration example
|
951
|
-
|
952
|
-
``` yaml
|
953
|
-
hooks:
|
954
|
-
push_to_remote:
|
955
|
-
type: githubrepo
|
956
|
-
events: [post_store]
|
957
|
-
remote_repo: git@git.intranet:oxidized/test.git
|
958
|
-
username: user
|
959
|
-
password: pass
|
960
|
-
```
|
961
|
-
|
962
|
-
## Hook type: awssns
|
963
|
-
|
964
|
-
The `awssns` hook publishes messages to AWS SNS topics. This allows you to notify other systems of device configuration changes, for example a config orchestration pipeline. Multiple services can subscribe to the same AWS topic.
|
965
|
-
|
966
|
-
Fields sent in the message:
|
967
|
-
|
968
|
-
* `event`: Event type (e.g. `node_success`)
|
969
|
-
* `group`: Group name
|
970
|
-
* `model`: Model name (e.g. `eos`)
|
971
|
-
* `node`: Device hostname
|
972
|
-
|
973
|
-
Configuration example:
|
974
|
-
|
975
|
-
``` yaml
|
976
|
-
hooks:
|
977
|
-
hook_script:
|
978
|
-
type: awssns
|
979
|
-
events: [node_fail,node_success,post_store]
|
980
|
-
region: us-east-1
|
981
|
-
topic_arn: arn:aws:sns:us-east-1:1234567:oxidized-test-backup_events
|
982
|
-
```
|
983
|
-
|
984
|
-
AWS SNS hook requires the following configuration keys:
|
985
|
-
|
986
|
-
* `region`: AWS Region name
|
987
|
-
* `topic_arn`: ASN Topic reference
|
988
|
-
|
989
|
-
Your AWS credentials should be stored in `~/.aws/credentials`.
|
990
|
-
|
991
|
-
## Hook type: slackdiff
|
992
|
-
|
993
|
-
The `slackdiff` hook posts colorized config diffs to a [Slack](http://www.slack.com) channel of your choice. It only triggers for `post_store` events.
|
994
|
-
|
995
|
-
You will need to manually install the `slack-api` gem on your system:
|
996
|
-
|
997
|
-
```
|
998
|
-
gem install slack-api
|
266
|
+
router01.example.com:ios
|
267
|
+
switch01.example.com:procurve
|
268
|
+
router02.example.com:ios
|
999
269
|
```
|
1000
270
|
|
1001
|
-
|
1002
|
-
|
1003
|
-
``` yaml
|
1004
|
-
hooks:
|
1005
|
-
slack:
|
1006
|
-
type: slackdiff
|
1007
|
-
events: [post_store]
|
1008
|
-
token: SLACK_BOT_TOKEN
|
1009
|
-
channel: "#network-changes"
|
1010
|
-
```
|
271
|
+
Run `oxidized` again to take the first backups.
|
1011
272
|
|
1012
273
|
# Extra
|
1013
274
|
|
@@ -1023,58 +284,67 @@ The init script assumes that you have a used named 'oxidized' and that oxidized
|
|
1023
284
|
/usr/local/bin
|
1024
285
|
```
|
1025
286
|
|
1026
|
-
1.
|
1027
|
-
2.
|
287
|
+
1. Copy init script from extra/ folder to /etc/init.d/oxidized
|
288
|
+
2. Setup /var/run/
|
1028
289
|
|
1029
290
|
```
|
1030
291
|
mkdir /var/run/oxidized
|
1031
292
|
chown oxidized:oxidized /var/run/oxidized
|
1032
293
|
```
|
1033
294
|
|
1034
|
-
3.
|
295
|
+
3. Make oxidized start on boot
|
1035
296
|
|
1036
297
|
```
|
1037
|
-
update-rc.d oxidized
|
298
|
+
update-rc.d oxidized defaults
|
1038
299
|
```
|
1039
300
|
|
1040
|
-
|
301
|
+
# Help
|
1041
302
|
|
1042
|
-
|
303
|
+
If you need help with Oxidized then we have a few methods you can use to get in touch.
|
1043
304
|
|
1044
|
-
|
305
|
+
- [Gitter](https://gitter.im/oxidized/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - You can join the Lobby on gitter to chat to other Oxidized users.
|
306
|
+
- [GitHub](https://github.com/ytti/oxidized/) - For help and requests for code changes / updates.
|
307
|
+
- [Forum](https://community.librenms.org/c/help/oxidized) - A user forum run by [LibreNMS](https://github.com/librenms/librenms) where you can ask for help and support.
|
1045
308
|
|
1046
|
-
|
1047
|
-
* gets config from nodes
|
1048
|
-
* must implement 'connect', 'get', 'cmd'
|
1049
|
-
* 'ssh', 'telnet, ftp, and tftp' implemented
|
309
|
+
# Help Needed
|
1050
310
|
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
311
|
+
As things stand right now, `oxidized` is maintained by a single person. A great
|
312
|
+
many [contributors](https://github.com/ytti/oxidized/graphs/contributors) have
|
313
|
+
helped further the software, however contributions are not the same as ongoing
|
314
|
+
owner- and maintainer-ship. It appears that many companies use the software to
|
315
|
+
manage their network infrastructure, this is great news! But without additional
|
316
|
+
help to maintain the software and put out releases, the future of oxidized
|
317
|
+
might be less bright. The current pace of development and the much needed
|
318
|
+
refactoring simply are not sustainable if they are to be driven by a single
|
319
|
+
person.
|
1055
320
|
|
1056
|
-
##
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
321
|
+
## Maintainers
|
322
|
+
|
323
|
+
If you would like to be a maintainer for Oxidized then please read through the below and see if it's something you would like to help with. It's not a requirement that you can tick all the boxes below but it helps :)
|
324
|
+
|
325
|
+
* Triage on issues, review pull requests and help answer any questions from users.
|
326
|
+
* Above average knowledge of the Ruby programming language.
|
327
|
+
* Professional experience with both oxidized and some other config backup tool (like rancid).
|
328
|
+
* Ability to keep a cool head, and enjoy interaction with end users! :)
|
329
|
+
* A desire and passion to help drive `oxidized` towards its `1.x.x` stage of life
|
330
|
+
* Help refactor the code
|
331
|
+
* Rework the core infrastructure
|
332
|
+
* Permission from your employer to contribute to open source projects
|
333
|
+
|
334
|
+
## YES, I WANT TO HELP
|
335
|
+
|
336
|
+
Awesome! Simply send an email to Saku Ytti <saku@ytti.fi>.
|
337
|
+
|
338
|
+
## Further reading
|
1073
339
|
|
340
|
+
Brian Anderson (from Rust fame) wrote an [excellent
|
341
|
+
post](http://brson.github.io/2017/04/05/minimally-nice-maintainer) on what it
|
342
|
+
means to be a maintainer.
|
1074
343
|
|
1075
344
|
# License and Copyright
|
1076
345
|
|
1077
|
-
Copyright
|
346
|
+
Copyright
|
347
|
+
2013-2015 Saku Ytti <saku@ytti.fi>
|
1078
348
|
2013-2015 Samer Abdel-Hafez <sam@arahant.net>
|
1079
349
|
|
1080
350
|
|