oxidized 0.20.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. checksums.yaml +5 -5
  2. data/.codeclimate.yml +4 -0
  3. data/.github/PULL_REQUEST_TEMPLATE.md +12 -0
  4. data/.github/no-response.yml +13 -0
  5. data/.github/workflows/publishdocker.yml +13 -0
  6. data/.gitignore +4 -0
  7. data/.rubocop.yml +73 -0
  8. data/.rubocop_todo.yml +120 -0
  9. data/.travis.yml +6 -1
  10. data/CHANGELOG.md +693 -243
  11. data/Dockerfile +27 -19
  12. data/LICENSE +201 -0
  13. data/README.md +234 -913
  14. data/Rakefile +48 -7
  15. data/TODO.md +29 -23
  16. data/bin/console +1 -1
  17. data/bin/oxidized +6 -5
  18. data/docs/Configuration.md +313 -0
  19. data/docs/Creating-Models.md +140 -0
  20. data/docs/Hooks.md +274 -0
  21. data/docs/Model-Notes/AireOS.md +11 -0
  22. data/docs/Model-Notes/ArbOS.md +11 -0
  23. data/docs/Model-Notes/Comware.md +13 -0
  24. data/docs/Model-Notes/Cumulus.md +40 -0
  25. data/docs/Model-Notes/EOS.md +12 -0
  26. data/docs/Model-Notes/IOS.md +29 -0
  27. data/docs/Model-Notes/JunOS.md +33 -0
  28. data/docs/Model-Notes/LinuxGeneric.md +24 -0
  29. data/docs/Model-Notes/Netgear.md +87 -0
  30. data/docs/Model-Notes/Nokia.md +9 -0
  31. data/docs/Model-Notes/README.md +24 -0
  32. data/docs/Model-Notes/SmartAX-Huawei.md +35 -0
  33. data/docs/Model-Notes/VRP-Huawei.md +34 -0
  34. data/docs/Model-Notes/Viptela.md +12 -0
  35. data/docs/Model-Notes/XGS4600-Zyxel.md +36 -0
  36. data/docs/Outputs.md +190 -0
  37. data/docs/Ruby-API.md +199 -0
  38. data/docs/Sources.md +171 -0
  39. data/docs/Supported-OS-Types.md +227 -0
  40. data/docs/Troubleshooting.md +66 -0
  41. data/extra/nagios_check_failing_nodes.rb +9 -2
  42. data/extra/oxidized-report-git-commits +21 -40
  43. data/extra/oxidized-ubuntu.haproxy +45 -0
  44. data/extra/oxidized.logrotate +7 -0
  45. data/extra/oxidized.service +13 -0
  46. data/extra/rest_client.rb +7 -10
  47. data/extra/syslog.rb +47 -42
  48. data/lib/oxidized/cli.rb +41 -31
  49. data/lib/oxidized/config/vars.rb +9 -14
  50. data/lib/oxidized/config.rb +20 -13
  51. data/lib/oxidized/core.rb +8 -10
  52. data/lib/oxidized/hook/awssns.rb +6 -7
  53. data/lib/oxidized/hook/ciscosparkdiff.rb +43 -0
  54. data/lib/oxidized/hook/exec.rb +19 -24
  55. data/lib/oxidized/hook/githubrepo.rb +17 -17
  56. data/lib/oxidized/hook/noophook.rb +1 -1
  57. data/lib/oxidized/hook/slackdiff.rb +32 -19
  58. data/lib/oxidized/hook/xmppdiff.rb +59 -0
  59. data/lib/oxidized/hook.rb +63 -64
  60. data/lib/oxidized/input/cli.rb +22 -12
  61. data/lib/oxidized/input/exec.rb +28 -0
  62. data/lib/oxidized/input/ftp.rb +16 -15
  63. data/lib/oxidized/input/http.rb +72 -0
  64. data/lib/oxidized/input/input.rb +6 -6
  65. data/lib/oxidized/input/ssh.rb +64 -56
  66. data/lib/oxidized/input/telnet.rb +59 -102
  67. data/lib/oxidized/input/tftp.rb +9 -10
  68. data/lib/oxidized/jobs.rb +9 -10
  69. data/lib/oxidized/manager.rb +42 -44
  70. data/lib/oxidized/model/acos.rb +19 -20
  71. data/lib/oxidized/model/acsw.rb +62 -0
  72. data/lib/oxidized/model/adtran.rb +26 -0
  73. data/lib/oxidized/model/aen.rb +19 -0
  74. data/lib/oxidized/model/aireos.rb +9 -10
  75. data/lib/oxidized/model/airfiber.rb +22 -0
  76. data/lib/oxidized/model/alteonos.rb +58 -0
  77. data/lib/oxidized/model/alvarion.rb +0 -4
  78. data/lib/oxidized/model/aos.rb +11 -5
  79. data/lib/oxidized/model/aos7.rb +6 -7
  80. data/lib/oxidized/model/aosw.rb +30 -27
  81. data/lib/oxidized/model/apc_aos.rb +2 -5
  82. data/lib/oxidized/model/arbos.rb +26 -0
  83. data/lib/oxidized/model/aricentiss.rb +49 -0
  84. data/lib/oxidized/model/asa.rb +61 -22
  85. data/lib/oxidized/model/asyncos.rb +46 -0
  86. data/lib/oxidized/model/audiocodes.rb +28 -0
  87. data/lib/oxidized/model/audiocodesmp.rb +28 -0
  88. data/lib/oxidized/model/awplus.rb +84 -0
  89. data/lib/oxidized/model/axos.rb +16 -0
  90. data/lib/oxidized/model/boss.rb +77 -0
  91. data/lib/oxidized/model/br6910.rb +42 -45
  92. data/lib/oxidized/model/c4cmts.rb +6 -10
  93. data/lib/oxidized/model/cambium.rb +23 -0
  94. data/lib/oxidized/model/casa.rb +1 -1
  95. data/lib/oxidized/model/catos.rb +1 -3
  96. data/lib/oxidized/model/cisconga.rb +1 -3
  97. data/lib/oxidized/model/ciscosma.rb +42 -0
  98. data/lib/oxidized/model/ciscosmb.rb +30 -10
  99. data/lib/oxidized/model/ciscovpn3k.rb +11 -0
  100. data/lib/oxidized/model/cnos.rb +33 -0
  101. data/lib/oxidized/model/comnetms.rb +43 -0
  102. data/lib/oxidized/model/comtrol.rb +41 -0
  103. data/lib/oxidized/model/comware.rb +28 -16
  104. data/lib/oxidized/model/coriant8600.rb +3 -5
  105. data/lib/oxidized/model/coriantgroove.rb +26 -0
  106. data/lib/oxidized/model/corianttmos.rb +1 -3
  107. data/lib/oxidized/model/cumulus.rb +60 -49
  108. data/lib/oxidized/model/datacom.rb +1 -4
  109. data/lib/oxidized/model/dcnos.rb +46 -0
  110. data/lib/oxidized/model/dellx.rb +76 -0
  111. data/lib/oxidized/model/dlink.rb +5 -4
  112. data/lib/oxidized/model/dnos.rb +11 -5
  113. data/lib/oxidized/model/eciapollo.rb +34 -0
  114. data/lib/oxidized/model/edgecos.rb +49 -0
  115. data/lib/oxidized/model/edgeos.rb +12 -5
  116. data/lib/oxidized/model/edgeswitch.rb +2 -4
  117. data/lib/oxidized/model/enterasys.rb +28 -0
  118. data/lib/oxidized/model/eos.rb +8 -8
  119. data/lib/oxidized/model/fabricos.rb +4 -6
  120. data/lib/oxidized/model/fastiron.rb +66 -0
  121. data/lib/oxidized/model/fiberdriver.rb +2 -2
  122. data/lib/oxidized/model/firebrick.rb +31 -0
  123. data/lib/oxidized/model/firelinuxos.rb +41 -0
  124. data/lib/oxidized/model/firewareos.rb +3 -6
  125. data/lib/oxidized/model/fortios.rb +31 -19
  126. data/lib/oxidized/model/ftos.rb +8 -5
  127. data/lib/oxidized/model/fujitsupy.rb +5 -7
  128. data/lib/oxidized/model/gaiaos.rb +7 -11
  129. data/lib/oxidized/model/gcombnps.rb +84 -0
  130. data/lib/oxidized/model/grandstream.rb +9 -0
  131. data/lib/oxidized/model/hatteras.rb +9 -6
  132. data/lib/oxidized/model/hirschmann.rb +39 -0
  133. data/lib/oxidized/model/hpebladesystem.rb +20 -18
  134. data/lib/oxidized/model/hpemsa.rb +10 -0
  135. data/lib/oxidized/model/hpmsm.rb +84 -0
  136. data/lib/oxidized/model/ibos.rb +55 -0
  137. data/lib/oxidized/model/icotera.rb +27 -0
  138. data/lib/oxidized/model/ios.rb +63 -70
  139. data/lib/oxidized/model/iosxe.rb +5 -0
  140. data/lib/oxidized/model/iosxr.rb +2 -3
  141. data/lib/oxidized/model/ipos.rb +10 -6
  142. data/lib/oxidized/model/ironware.rb +20 -19
  143. data/lib/oxidized/model/isam.rb +5 -6
  144. data/lib/oxidized/model/junos.rb +9 -11
  145. data/lib/oxidized/model/linuxgeneric.rb +74 -0
  146. data/lib/oxidized/model/masteros.rb +3 -6
  147. data/lib/oxidized/model/mlnxos.rb +9 -10
  148. data/lib/oxidized/model/model.rb +72 -46
  149. data/lib/oxidized/model/mtrlrfs.rb +1 -4
  150. data/lib/oxidized/model/ndms.rb +23 -0
  151. data/lib/oxidized/model/netgear.rb +35 -15
  152. data/lib/oxidized/model/netonix.rb +2 -2
  153. data/lib/oxidized/model/netscaler.rb +6 -3
  154. data/lib/oxidized/model/nos.rb +5 -7
  155. data/lib/oxidized/model/nsxconfig.rb +22 -0
  156. data/lib/oxidized/model/nsxfirewall.rb +22 -0
  157. data/lib/oxidized/model/nxos.rb +13 -3
  158. data/lib/oxidized/model/oneos.rb +15 -9
  159. data/lib/oxidized/model/openbsd.rb +63 -0
  160. data/lib/oxidized/model/opengear.rb +3 -5
  161. data/lib/oxidized/model/openwrt.rb +78 -0
  162. data/lib/oxidized/model/opnsense.rb +19 -0
  163. data/lib/oxidized/model/os10.rb +46 -0
  164. data/lib/oxidized/model/outputs.rb +5 -7
  165. data/lib/oxidized/model/panos.rb +11 -12
  166. data/lib/oxidized/model/pfsense.rb +11 -6
  167. data/lib/oxidized/model/planet.rb +14 -17
  168. data/lib/oxidized/model/powerconnect.rb +24 -19
  169. data/lib/oxidized/model/procurve.rb +43 -11
  170. data/lib/oxidized/model/purityos.rb +12 -0
  171. data/lib/oxidized/model/qtech.rb +41 -0
  172. data/lib/oxidized/model/quantaos.rb +4 -6
  173. data/lib/oxidized/model/raisecom.rb +19 -0
  174. data/lib/oxidized/model/routeros.rb +26 -8
  175. data/lib/oxidized/model/saos.rb +1 -2
  176. data/lib/oxidized/model/screenos.rb +8 -11
  177. data/lib/oxidized/model/sgos.rb +45 -0
  178. data/lib/oxidized/model/siklu.rb +1 -3
  179. data/lib/oxidized/model/slxos.rb +59 -0
  180. data/lib/oxidized/model/smartax.rb +25 -0
  181. data/lib/oxidized/model/sonicos.rb +51 -0
  182. data/lib/oxidized/model/speedtouch.rb +34 -0
  183. data/lib/oxidized/model/sros.rb +96 -0
  184. data/lib/oxidized/model/stoneos.rb +32 -0
  185. data/lib/oxidized/model/supermicro.rb +6 -41
  186. data/lib/oxidized/model/tdre.rb +30 -0
  187. data/lib/oxidized/model/telco.rb +24 -0
  188. data/lib/oxidized/model/timos.rb +6 -114
  189. data/lib/oxidized/model/tmos.rb +6 -3
  190. data/lib/oxidized/model/tplink.rb +11 -11
  191. data/lib/oxidized/model/trango.rb +21 -42
  192. data/lib/oxidized/model/ucs.rb +30 -0
  193. data/lib/oxidized/model/viptela.rb +29 -0
  194. data/lib/oxidized/model/voltaire.rb +9 -12
  195. data/lib/oxidized/model/voss.rb +17 -6
  196. data/lib/oxidized/model/vrp.rb +11 -6
  197. data/lib/oxidized/model/vyatta.rb +8 -6
  198. data/lib/oxidized/model/weos.rb +20 -0
  199. data/lib/oxidized/model/xos.rb +20 -8
  200. data/lib/oxidized/model/zhoneolt.rb +2 -2
  201. data/lib/oxidized/model/zynos.rb +1 -3
  202. data/lib/oxidized/model/zynoscli.rb +36 -0
  203. data/lib/oxidized/model/zynosgs.rb +38 -0
  204. data/lib/oxidized/node/stats.rb +33 -8
  205. data/lib/oxidized/node.rb +86 -95
  206. data/lib/oxidized/nodes.rb +48 -44
  207. data/lib/oxidized/output/file.rb +32 -37
  208. data/lib/oxidized/output/git.rb +138 -153
  209. data/lib/oxidized/output/gitcrypt.rb +228 -242
  210. data/lib/oxidized/output/http.rb +35 -34
  211. data/lib/oxidized/output/output.rb +2 -3
  212. data/lib/oxidized/source/csv.rb +50 -44
  213. data/lib/oxidized/source/http.rb +58 -58
  214. data/lib/oxidized/source/source.rb +9 -10
  215. data/lib/oxidized/source/sql.rb +47 -45
  216. data/lib/oxidized/string.rb +18 -14
  217. data/lib/oxidized/version.rb +17 -1
  218. data/lib/oxidized/worker.rb +72 -33
  219. data/oxidized.gemspec +20 -19
  220. metadata +180 -36
  221. data/.ruby-version +0 -1
  222. data/Gemfile.lock +0 -44
data/README.md CHANGED
@@ -1,352 +1,191 @@
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)
1
+ # Oxidized
2
+ [![Build Status](https://api.travis-ci.com/ytti/oxidized.svg)](https://travis-ci.com/ytti/oxidized)
3
+ [![codecov.io](https://codecov.io/gh/ytti/oxidized/coverage.svg?branch=master)](https://codecov.io/gh/ytti/oxidized?branch=master)
4
+ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/5a90cb22db6a4d5ea23ad0dfb53fe03a)](https://www.codacy.com/app/ytti/oxidized?utm_source=github.com&utm_medium=referral&utm_content=ytti/oxidized&utm_campaign=Badge_Grade)
5
+ [![Code Climate](https://codeclimate.com/github/ytti/oxidized/badges/gpa.svg)](https://codeclimate.com/github/ytti/oxidized)
6
+ [![Gem Version](https://badge.fury.io/rb/oxidized.svg)](http://badge.fury.io/rb/oxidized)
7
+ [![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
8
 
3
9
  Oxidized is a network device configuration backup tool. It's a RANCID replacement!
4
10
 
5
- * automatically adds/removes threads to meet configured retrieval interval
6
- * restful API to move node immediately to head-of-queue (GET/POST /node/next/[NODE])
7
- * syslog udp+file example to catch config change event (ios/junos) and trigger config fetch
8
- * will signal ios/junos user who made change, which output modules can use (via POST)
9
- * The git output module uses this info - 'git blame' will for each line show who made the change and when
10
- * restful API to reload list of nodes (GET /reload)
11
- * restful API to fetch configurations (/node/fetch/[NODE] or /node/fetch/group/[NODE])
12
- * restful API to show list of nodes (GET /nodes)
13
- * restful API to show list of version for a node (/node/version[NODE]) and diffs
11
+ Light and extensible, Oxidized supports more than 120 operating system types.
14
12
 
15
- [Youtube Video: Oxidized TREX 2014 presentation](http://youtu.be/kBQ_CTUuqeU#t=3h)
13
+ Feature highlights:
16
14
 
17
- #### Index
18
- 1. [Supported OS Types](#supported-os-types)
15
+ * Automatically adds/removes threads to meet configured retrieval interval
16
+ * Restful API to a move node immediately to head-of-queue (GET/POST /node/next/[NODE])
17
+ * Syslog udp+file example to catch config change events (IOS/JunOS) and trigger a config fetch
18
+ * Will signal which IOS/JunOS user made the change, can then be used by output modules (via POST)
19
+ * The `git` output module uses this info - 'git blame' will show who changed each line, and when
20
+ * Restful API to reload list of nodes (GET /reload)
21
+ * Restful API to fetch configurations (/node/fetch/[NODE] or /node/fetch/group/[NODE])
22
+ * Restful API to show list of nodes (GET /nodes)
23
+ * Restful API to show list of version for a node (/node/version[NODE]) and diffs
24
+
25
+ Check out the [Oxidized TREX 2014 presentation](http://youtu.be/kBQ_CTUuqeU#t=3h) video on YouTube!
26
+
27
+ > :warning: [Maintainer Wanted!](#help-needed) :warning:
28
+ >
29
+ > Is your company using Oxidized and has Ruby developers on staff? I'd love help from an extra maintainer!
30
+
31
+ ## Index
32
+
33
+ 1. [Supported OS Types](docs/Supported-OS-Types.md)
19
34
  2. [Installation](#installation)
20
- * [Debian](#debian)
35
+ * [Debian and Ubuntu](#debian-and-ubuntu)
21
36
  * [CentOS, Oracle Linux, Red Hat Linux](#centos-oracle-linux-red-hat-linux)
22
- * [BSD](#freebsd)
37
+ * [FreeBSD](#freebsd)
38
+ * [Build from Git](#build-from-git)
39
+ * [Docker](#running-with-docker)
40
+ * [Installing Ruby 2.3 using RVM](#installing-ruby-23-using-rvm)
23
41
  3. [Initial Configuration](#configuration)
24
- 4. [Installing Ruby 2.1.2 using RVM](#installing-ruby-2.1.2-using-rvm)
25
- 5. [Running with Docker](#running-with-docker)
26
- 6. [Cookbook](#cookbook)
27
- * [Debugging](#debugging)
28
- * [Privileged mode](#privileged-mode)
29
- * [Disabling SSH exec channels](#disabling-ssh-exec-channels)
30
- * [Source: CSV](#source-csv)
31
- * [Source: SQL](#source-sql)
32
- * [Source: SQLite](#source-sqlite)
33
- * [Source: Mysql](#source-mysql)
34
- * [Source: HTTP](#source-http)
35
- * [Output: GIT](#output-git)
36
- * [Output: GIT-Crypt](#output-git-crypt)
37
- * [Output: HTTP](#output-http)
38
- * [Output: File](#output-file)
39
- * [Output types](#output-types)
40
- * [Advanced Configuration](#advanced-configuration)
41
- * [Advanced Group Configuration](#advanced-group-configuration)
42
- 7. [Ruby API](#ruby-api)
43
- * [Input](#input)
44
- * [Output](#output)
45
- * [Source](#source)
46
- * [Model](#model)
47
-
48
- # Supported OS types
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
-
176
-
177
- # Installation
178
- ## Debian
179
- Install all required packages and gems.
42
+ 4. [Configuration](docs/Configuration.md)
43
+ * [Debugging](docs/Configuration.md#debugging)
44
+ * [Privileged mode](docs/Configuration.md#privileged-mode)
45
+ * [Disabling SSH exec channels](docs/Configuration.md#disabling-ssh-exec-channels)
46
+ * [Sources](docs/Sources.md)
47
+ * [Source: CSV](docs/Sources.md#source-csv)
48
+ * [Source: SQL](docs/Sources.md#source-sql)
49
+ * [Source: SQLite](docs/Sources.md#source-sqlite)
50
+ * [Source: Mysql](docs/Sources.md#source-mysql)
51
+ * [Source: HTTP](docs/Sources.md#source-http)
52
+ * [Outputs](docs/Outputs.md)
53
+ * [Output: GIT](docs/Outputs.md#output-git)
54
+ * [Output: GIT-Crypt](docs/Outputs.md#output-git-crypt)
55
+ * [Output: HTTP](docs/Outputs.md#output-http)
56
+ * [Output: File](docs/Outputs.md#output-file)
57
+ * [Output types](docs/Outputs.md#output-types)
58
+ * [Advanced Configuration](docs/Configuration.md#advanced-configuration)
59
+ * [Advanced Group Configuration](docs/Configuration.md#advanced-group-configuration)
60
+ * [Hooks](docs/Hooks.md)
61
+ * [Hook: exec](docs/Hooks.md#hook-type-exec)
62
+ * [Hook: githubrepo](docs/Hooks.md#hook-type-githubrepo)
63
+ * [Hook: awssns](docs/Hooks.md#hook-type-awssns)
64
+ * [Hook: slackdiff](docs/Hooks.md#hook-type-slackdiff)
65
+ * [Hook: xmppdiff](docs/Hooks.md#hook-type-xmppdiff)
66
+ * [Hook: ciscosparkdiff](docs/Hooks.md#hook-type-ciscosparkdiff)
67
+ 5. [Creating and Extending Models](docs/Creating-Models.md)
68
+ 6. [Help](#help)
69
+ 7. [Ruby API](docs/Ruby-API.md#ruby-api)
70
+ * [Input](docs/Ruby-API.md#input)
71
+ * [Output](docs/Ruby-API.md#output)
72
+ * [Source](docs/Ruby-API.md#source)
73
+ * [Model](docs/Ruby-API.md#model)
74
+
75
+ ## Installation
76
+
77
+ ### Debian and Ubuntu
78
+
79
+ Debian "buster" or newer and Ubuntu 17.10 (artful) or newer are recommended. On Ubuntu, begin by enabling the `universe`
80
+ repository (required for libssh2-1-dev):
180
81
 
181
82
  ```shell
182
- apt-get install ruby ruby-dev libsqlite3-dev libssl-dev pkg-config cmake libssh2-1-dev
183
- gem install oxidized
184
- gem install oxidized-script oxidized-web # if you don't install oxidized-web, make sure you remove "rest" from your config
83
+ add-apt-repository universe
185
84
  ```
186
85
 
187
- ## 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 "Installing Ruby 2.1.2 using RVM"), then install Oxidized dependencies
189
- ```shell
190
- yum install cmake sqlite-devel openssl-devel libssh2-devel
191
- ```
192
-
193
- RHEL 7 / CentOS 7 will work out of the box with the following package list:
86
+ Install the dependencies:
194
87
 
195
88
  ```shell
196
- yum install cmake sqlite-devel openssl-devel libssh2-devel ruby gcc ruby-devel
89
+ apt-get install ruby ruby-dev libsqlite3-dev libssl-dev pkg-config cmake libssh2-1-dev libicu-dev zlib1g-dev g++
197
90
  ```
198
91
 
199
- Now let's install oxidized via Rubygems:
200
- ```shell
201
- gem install oxidized
202
- gem install oxidized-script oxidized-web
203
- ```
204
-
205
- ## FreeBSD
206
- Use RVM to install Ruby v2.1.2
207
-
208
- Install all required packages and gems.
92
+ Finally, install the gems:
209
93
 
210
94
  ```shell
211
- pkg install cmake pkgconf
212
95
  gem install oxidized
213
- gem install oxidized-script oxidized-web
96
+ gem install oxidized-script oxidized-web # If you don't install oxidized-web, ensure "rest" is removed from your Oxidized config.
214
97
  ```
215
98
 
99
+ ### CentOS, Oracle Linux, Red Hat Linux
100
+
101
+ On CentOS 6 and 7 / RHEL 6 and 7, begin by installing Ruby 2.3 or greater. This can be accomplished in one of two ways:
216
102
 
103
+ Install Ruby 2.3 from [SCL](https://www.softwarecollections.org/en/scls/rhscl/rh-ruby23/):
217
104
 
218
- ## Build from Git
219
105
  ```shell
220
- git clone https://github.com/ytti/oxidized.git
221
- cd oxidized/
222
- gem build *.gemspec
223
- gem install pkg/*.gem
106
+ yum install centos-release-scl
107
+ yum install rh-ruby23 rh-ruby23-ruby-devel
108
+ scl enable rh-ruby23 bash
224
109
  ```
225
110
 
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).
111
+ The following additional packages will be required to build the dependencies:
229
112
 
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
113
+ ```shell
114
+ yum install make cmake which sqlite-devel openssl-devel libssh2-devel ruby gcc ruby-devel libicu-devel gcc-c++
234
115
  ```
235
116
 
236
- It is recommended not to run Oxidized as root.
117
+ Alternatively, install Ruby 2.3 by following the instructions at [Installing Ruby 2.3 using RVM](#installing-ruby-23-using-rvm).
237
118
 
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
119
+ Finally, install oxidized via Rubygems:
244
120
 
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
121
+ ```shell
122
+ gem install oxidized
123
+ gem install oxidized-script oxidized-web # if you don't install oxidized-web, make sure you remove "rest" from your config
253
124
  ```
254
125
 
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.
126
+ ### FreeBSD
262
127
 
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
- ```
128
+ [Use RVM to install Ruby v2.3](#installing-ruby-23-using-rvm), then install all required packages and gems:
270
129
 
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
130
+ ```shell
131
+ pkg install cmake pkgconf
132
+ gem install oxidized
133
+ gem install oxidized-script oxidized-web
285
134
  ```
286
135
 
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:
136
+ Oxidized is also available via [FreeBSD ports](https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203374):
288
137
 
289
- ```
290
- router01.example.com:ios
291
- switch01.example.com:procurve
292
- router02.example.com:ios
138
+ ```shell
139
+ pkg install rubygem-oxidized rubygem-oxidized-script rubygem-oxidized-web
293
140
  ```
294
141
 
295
- Run ```oxidized``` again to take the first backups.
142
+ ### Build from Git
296
143
 
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
144
+ ```shell
145
+ git clone https://github.com/ytti/oxidized.git
146
+ cd oxidized/
147
+ gem install bundler
148
+ rake install
309
149
  ```
310
150
 
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
- ```
151
+ ### Running with Docker
317
152
 
318
- # Running with Docker
153
+ Currently, Docker Hub automatically builds the master branch as [oxidized/oxidized](https://hub.docker.com/r/oxidized/oxidized/), you can make use of this container or build your own.
319
154
 
320
- clone git repo:
155
+ To build your own, clone git repo:
321
156
 
322
- ```
157
+ ```shell
323
158
  git clone https://github.com/ytti/oxidized
324
159
  ```
325
160
 
326
- build container locally:
161
+ Then, build the container locally (requires docker 17.05.0-ce or higher):
327
162
 
328
- ```
163
+ ```shell
329
164
  docker build -q -t oxidized/oxidized:latest oxidized/
330
165
  ```
331
166
 
332
- create config directory in main system:
167
+ Once you've built the container (or chosen to make use of the automatically built container in Docker Hub, which will be downloaded for you by docker on the first `run` command had you not built it), proceed as follows:
333
168
 
334
- ```
169
+ Create a configuration directory in the host system:
170
+
171
+ ```shell
335
172
  mkdir /etc/oxidized
336
173
  ```
337
174
 
338
- run container the first time:
339
- _Note: this step in only needed for creating Oxidized's configuration file and can be skipped if you already have it
175
+ Run the container for the first time to initialize the config:
340
176
 
341
- ```
177
+ _Note: this step in only required for creating the Oxidized configuration file and can be skipped if you already have one._
178
+
179
+ ```shell
342
180
  docker run --rm -v /etc/oxidized:/root/.config/oxidized -p 8888:8888/tcp -t oxidized/oxidized:latest oxidized
343
181
  ```
182
+
344
183
  If the RESTful API and Web Interface are enabled, on the docker host running the container
345
- 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. (Issue #445)
184
+ edit `/etc/oxidized/config` and modify `rest: 127.0.0.1:8888` to `rest: 0.0.0.0:8888`. This will bind port 8888 to all interfaces, and expose the port so that it could be accessed externally. [(Issue #445)](https://github.com/ytti/oxidized/issues/445)
347
185
 
348
- You can also use docker-compose to launch oxidized container:
349
- ```
186
+ Alternatively, you can use docker-compose to launch the oxidized container:
187
+
188
+ ```yaml
350
189
  # docker-compose.yml
351
190
  # docker-compose file example for oxidized that will start along with docker daemon
352
191
  oxidized:
@@ -360,15 +199,15 @@ oxidized:
360
199
  - /etc/oxidized:/root/.config/oxidized
361
200
  ```
362
201
 
363
- create the `/etc/oxidized/router.db`
202
+ Create the `/etc/oxidized/router.db` (see [CSV Source](docs/Sources.md#source-csv) for further info):
364
203
 
365
- ```
204
+ ```shell
366
205
  vim /etc/oxidized/router.db
367
206
  ```
368
207
 
369
- run container again:
208
+ Run container again to start oxidized with your configuration:
370
209
 
371
- ```
210
+ ```shell
372
211
  docker run -v /etc/oxidized:/root/.config/oxidized -p 8888:8888/tcp -t oxidized/oxidized:latest
373
212
  oxidized[1]: Oxidized starting, running as pid 1
374
213
  oxidized[1]: Loaded 1 nodes
@@ -378,431 +217,91 @@ Puma 2.13.4 starting...
378
217
  * Listening on tcp://0.0.0.0:8888
379
218
  ```
380
219
 
381
- If you want to have the config automatically reloaded (e.g. when using a http source that changes)
220
+ If you want to have the config automatically reloaded (e.g. when using a http source that changes):
382
221
 
383
- ```
222
+ ```shell
384
223
  docker run -v /etc/oxidized:/root/.config/oxidized -p 8888:8888/tcp -e CONFIG_RELOAD_INTERVAL=3600 -t oxidized/oxidized:latest
385
224
  ```
386
225
 
387
- If you need to use an internal CA (e.g. to connect to an private github instance)
226
+ If you need to use an internal CA (e.g. to connect to an private github instance):
388
227
 
389
- ```
228
+ ```shell
390
229
  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
230
  ```
392
231
 
393
- ## Cookbook
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.
232
+ ### Installing Ruby 2.3 using RVM
423
233
 
424
- ```
425
- vars:
426
- remove_secret: true
427
- ```
234
+ Install Ruby 2.3 build dependencies
428
235
 
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:
610
-
611
- ``` csv
612
- host1:ios:first
613
- host2:nxos:second
614
- ```
615
-
616
- This will generate the following repositories:
617
-
618
- ``` bash
619
- $ ls /var/lib/oxidized/git-repos
620
-
621
- default.git first.git second.git
236
+ ```shell
237
+ yum install curl gcc-c++ patch readline readline-devel zlib zlib-devel
238
+ yum install libyaml-devel libffi-devel openssl-devel make cmake
239
+ yum install bzip2 autoconf automake libtool bison iconv-devel libssh2-devel libicu-devel
622
240
  ```
623
241
 
624
- If you would like to use groups and a single repository, you can force this with the `single_repo` config.
625
-
626
- ``` yaml
627
- output:
628
- default: git
629
- git:
630
- single_repo: true
631
- repo: "/var/lib/oxidized/devices.git"
242
+ Install RVM
632
243
 
244
+ ```shell
245
+ curl -L get.rvm.io | bash -s stable
633
246
  ```
634
247
 
635
- ### Output: Git-Crypt
248
+ Setup RVM environment and compile and install Ruby 2.3 and set it as default
636
249
 
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>"
653
- ```
654
-
655
- And for groups repositories:
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"
250
+ ```shell
251
+ source /etc/profile.d/rvm.sh
252
+ rvm install 2.3
253
+ rvm use --default 2.3
667
254
  ```
668
255
 
669
- Oxidized will create a repository for each group in the same directory as the `default`. For
670
- example:
671
-
672
- ``` csv
673
- host1:ios:first
674
- host2:nxos:second
675
- ```
256
+ ## Configuration
676
257
 
677
- This will generate the following repositories:
258
+ 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
259
 
679
- ``` bash
680
- $ ls /var/lib/oxidized/git-repos
260
+ It is recommended practice to run Oxidized using its own username. This username can be added using standard command-line tools:
681
261
 
682
- default.git first.git second.git
262
+ ```shell
263
+ useradd oxidized
683
264
  ```
684
265
 
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
-
697
- ```
266
+ > It is recommended __not__ to run Oxidized as root.
698
267
 
699
- Please note that user list is only updated once at creation.
268
+ 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.
700
269
 
701
- ### Output: Http
270
+ You can set the env variable `OXIDIZED_HOME` to change its home directory.
702
271
 
703
- POST a config to the specified URL
272
+ ```shell
273
+ OXIDIZED_HOME=/etc/oxidized
704
274
 
275
+ $ tree -L 1 /etc/oxidized
276
+ /etc/oxidized/
277
+ ├── config
278
+ ├── log-router-ssh
279
+ ├── log-router-telnet
280
+ ├── pid
281
+ ├── router.db
282
+ └── repository.git
705
283
  ```
706
- output:
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
284
 
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
719
-
720
- ```
721
- - cmd 'show version' do |cfg|
722
- - comment cfg.lines.first
723
- + cmd 'show version' do |state|
724
- + state.type = 'nodiff'
725
- + state
726
-
727
- - cmd 'show inventory' do |cfg|
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
750
- ```
285
+ ## Source
751
286
 
752
- which will result in the following layout
287
+ 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.
753
288
 
754
- ```
755
- diff/$FQDN--show_running_config
756
- nodiff/$FQDN--show_version
757
- nodiff/$FQDN--show_inventory
758
- ```
289
+ ## Outputs
759
290
 
760
- ### RESTful API and Web Interface
291
+ 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 [HTTP](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.
761
292
 
762
- The RESTful API and Web Interface is enabled by configuring the `rest:` parameter in the config file. This parameter can optionally contain a relative URI.
293
+ 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` is set to `true`.
763
294
 
764
- ```
765
- # Listen on http://127.0.0.1:8888/
766
- rest: 127.0.0.1:8888
767
- ```
295
+ First create the directory where the CSV `output` is going to store device configs and start Oxidized once.
768
296
 
769
- ```
770
- # Listen on http://10.0.0.1:8000/oxidized/
771
- rest: 10.0.0.1:8000/oxidized
297
+ ```shell
298
+ mkdir -p ~/.config/oxidized/configs
299
+ oxidized
772
300
  ```
773
301
 
774
- ### Advanced Configuration
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.
302
+ 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
303
 
778
- ```
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"
304
+ ```yaml
806
305
  source:
807
306
  default: csv
808
307
  csv:
@@ -811,273 +310,95 @@ source:
811
310
  map:
812
311
  name: 0
813
312
  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
313
  ```
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
- ```
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
-
880
- ### Events
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).
884
-
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
- ```
925
-
926
- ### githubrepo
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
314
 
930
- `githubrepo` hook recognizes following configuration keys:
315
+ 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:
931
316
 
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
317
+ ```text
318
+ router01.example.com:ios
319
+ switch01.example.com:procurve
320
+ router02.example.com:ios
960
321
  ```
961
322
 
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.
323
+ Run `oxidized` again to take the first backups.
965
324
 
966
- Fields sent in the message:
325
+ ## Extra
967
326
 
968
- * `event`: Event type (e.g. `node_success`)
969
- * `group`: Group name
970
- * `model`: Model name (e.g. `eos`)
971
- * `node`: Device hostname
327
+ ### Ubuntu SystemV init setup
972
328
 
973
- Configuration example:
329
+ The init script assumes that you have a user named 'oxidized' and that oxidized is in one of the following paths:
974
330
 
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
331
+ ```text
332
+ /sbin
333
+ /bin
334
+ /usr/sbin
335
+ /usr/bin
336
+ /usr/local/bin
982
337
  ```
983
338
 
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:
339
+ 1. Copy init script from extra/ folder to /etc/init.d/oxidized
340
+ 2. Setup /var/run/
996
341
 
997
- ```
998
- gem install slack-api
342
+ ```shell
343
+ mkdir /var/run/oxidized
344
+ chown oxidized:oxidized /var/run/oxidized
999
345
  ```
1000
346
 
1001
- Configuration example:
347
+ 3. Make oxidized start on boot
1002
348
 
1003
- ``` yaml
1004
- hooks:
1005
- slack:
1006
- type: slackdiff
1007
- events: [post_store]
1008
- token: SLACK_BOT_TOKEN
1009
- channel: "#network-changes"
349
+ ```shell
350
+ update-rc.d oxidized defaults
1010
351
  ```
1011
352
 
1012
- # Extra
353
+ ## Help
1013
354
 
1014
- ## Ubuntu SystemV init setup
355
+ If you need help with Oxidized then we have a few methods you can use to get in touch.
1015
356
 
1016
- The init script assumes that you have a used named 'oxidized' and that oxidized is in one of the following paths:
357
+ * [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.
358
+ * [GitHub](https://github.com/ytti/oxidized/) - For help and requests for code changes / updates.
359
+ * [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.
1017
360
 
1018
- ```
1019
- /sbin
1020
- /bin
1021
- /usr/sbin
1022
- /usr/bin
1023
- /usr/local/bin
1024
- ```
361
+ ## Help Needed
1025
362
 
1026
- 1.)Copy init script from extra/ folder to /etc/init.d/oxidized
1027
- 2.)Setup /var/run/
363
+ As things stand right now, `oxidized` is maintained by a single person. A great
364
+ many [contributors](https://github.com/ytti/oxidized/graphs/contributors) have
365
+ helped further the software, however contributions are not the same as ongoing
366
+ owner- and maintainer-ship. It appears that many companies use the software to
367
+ manage their network infrastructure, this is great news! But without additional
368
+ help to maintain the software and put out releases, the future of oxidized
369
+ might be less bright. The current pace of development and the much needed
370
+ refactoring simply are not sustainable if they are to be driven by a single
371
+ person.
1028
372
 
1029
- ```
1030
- mkdir /var/run/oxidized
1031
- chown oxidized:oxidized /var/run/oxidized
1032
- ```
373
+ ## Maintainers
1033
374
 
1034
- 3.)Make oxidized start on boot
375
+ 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 :)
1035
376
 
1036
- ```
1037
- update-rc.d oxidized deafults
1038
- ```
377
+ * Triage on issues, review pull requests and help answer any questions from users.
378
+ * Above average knowledge of the Ruby programming language.
379
+ * Professional experience with both oxidized and some other config backup tool (like rancid).
380
+ * Ability to keep a cool head, and enjoy interaction with end users! :)
381
+ * A desire and passion to help drive `oxidized` towards its `1.x.x` stage of life
382
+ * Help refactor the code
383
+ * Rework the core infrastructure
384
+ * Permission from your employer to contribute to open source projects
1039
385
 
1040
- Note the channel name must be in quotes.
386
+ ## YES, I WANT TO HELP
1041
387
 
1042
- # Ruby API
388
+ Awesome! Simply send an email to Saku Ytti <saku@ytti.fi>.
1043
389
 
1044
- The following objects exist in Oxidized.
390
+ ## Further reading
1045
391
 
1046
- ## Input
1047
- * gets config from nodes
1048
- * must implement 'connect', 'get', 'cmd'
1049
- * 'ssh', 'telnet, ftp, and tftp' implemented
392
+ Brian Anderson (from Rust fame) wrote an [excellent
393
+ post](http://brson.github.io/2017/04/05/minimally-nice-maintainer) on what it
394
+ means to be a maintainer.
1050
395
 
1051
- ## Output
1052
- * stores config
1053
- * must implement 'store' (may implement 'fetch')
1054
- * 'git' and 'file' (store as flat ascii) implemented
396
+ ## License and Copyright
1055
397
 
1056
- ## Source
1057
- * gets list of nodes to poll
1058
- * must implement 'load'
1059
- * source can have 'name', 'model', 'group', 'username', 'password', 'input', 'output', 'prompt'
1060
- * name - name of the devices
1061
- * model - model to use ios/junos/xyz, model is loaded dynamically when needed (Also default in config file)
1062
- * input - method to acquire config, loaded dynamically as needed (Also default in config file)
1063
- * output - method to store config, loaded dynamically as needed (Also default in config file)
1064
- * prompt - prompt used for node (Also default in config file, can be specified in model too)
1065
- * 'sql', 'csv' and 'http' (supports any format with single entry per line, like router.db)
1066
-
1067
- ## Model
1068
- * lists commands to gather from given device model
1069
- * can use 'cmd', 'prompt', 'comment', 'cfg'
1070
- * cfg is executed in input/output/source context
1071
- * cmd is executed in instance of model
1072
- * 'junos', 'ios', 'ironware' and 'powerconnect' implemented
1073
-
1074
-
1075
- # License and Copyright
1076
-
1077
- Copyright 2013-2015 Saku Ytti <saku@ytti.fi>
398
+ Copyright
399
+ 2013-2015 Saku Ytti <saku@ytti.fi>
1078
400
  2013-2015 Samer Abdel-Hafez <sam@arahant.net>
1079
401
 
1080
-
1081
402
  Licensed under the Apache License, Version 2.0 (the "License");
1082
403
  you may not use this file except in compliance with the License.
1083
404
  You may obtain a copy of the License at