oxidized 0.25.1 → 0.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +30 -9
- data/.rubocop_todo.yml +16 -637
- data/.travis.yml +2 -3
- data/CHANGELOG.md +14 -0
- data/Dockerfile +7 -5
- data/README.md +18 -14
- data/Rakefile +2 -2
- data/bin/console +1 -1
- data/bin/oxidized +2 -2
- data/docs/Configuration.md +6 -0
- data/docs/Model-Notes/README.md +1 -0
- data/docs/Model-Notes/SmartAX-Huawei.md +35 -0
- data/docs/Supported-OS-Types.md +12 -0
- data/extra/nagios_check_failing_nodes.rb +1 -1
- data/extra/rest_client.rb +6 -8
- data/extra/syslog.rb +33 -33
- data/lib/oxidized/cli.rb +25 -26
- data/lib/oxidized/config.rb +9 -9
- data/lib/oxidized/config/vars.rb +3 -7
- data/lib/oxidized/core.rb +4 -7
- data/lib/oxidized/hook.rb +16 -17
- data/lib/oxidized/hook/awssns.rb +4 -4
- data/lib/oxidized/hook/exec.rb +16 -20
- data/lib/oxidized/hook/githubrepo.rb +8 -14
- data/lib/oxidized/hook/noophook.rb +1 -1
- data/lib/oxidized/hook/xmppdiff.rb +1 -1
- data/lib/oxidized/input/cli.rb +12 -12
- data/lib/oxidized/input/ftp.rb +8 -8
- data/lib/oxidized/input/http.rb +37 -14
- data/lib/oxidized/input/input.rb +6 -6
- data/lib/oxidized/input/ssh.rb +31 -31
- data/lib/oxidized/input/telnet.rb +24 -24
- data/lib/oxidized/input/tftp.rb +9 -10
- data/lib/oxidized/jobs.rb +7 -7
- data/lib/oxidized/manager.rb +13 -13
- data/lib/oxidized/model/acos.rb +2 -2
- data/lib/oxidized/model/aireos.rb +3 -3
- data/lib/oxidized/model/aos7.rb +1 -1
- data/lib/oxidized/model/aosw.rb +12 -14
- data/lib/oxidized/model/apc_aos.rb +1 -1
- data/lib/oxidized/model/aricentiss.rb +6 -8
- data/lib/oxidized/model/asa.rb +1 -1
- data/lib/oxidized/model/audiocodesmp.rb +28 -0
- data/lib/oxidized/model/awplus.rb +9 -9
- data/lib/oxidized/model/boss.rb +1 -1
- data/lib/oxidized/model/ciscosmb.rb +1 -1
- data/lib/oxidized/model/ciscovpn3k.rb +11 -0
- data/lib/oxidized/model/comware.rb +1 -1
- data/lib/oxidized/model/cumulus.rb +3 -1
- data/lib/oxidized/model/dellx.rb +5 -5
- data/lib/oxidized/model/edgeos.rb +1 -1
- data/lib/oxidized/model/edgeswitch.rb +1 -1
- data/lib/oxidized/model/fabricos.rb +1 -1
- data/lib/oxidized/model/fortios.rb +5 -5
- data/lib/oxidized/model/ftos.rb +1 -1
- data/lib/oxidized/model/gcombnps.rb +7 -7
- data/lib/oxidized/model/grandstream.rb +9 -0
- data/lib/oxidized/model/hatteras.rb +8 -8
- data/lib/oxidized/model/ios.rb +22 -40
- data/lib/oxidized/model/ironware.rb +1 -1
- data/lib/oxidized/model/junos.rb +1 -1
- data/lib/oxidized/model/mlnxos.rb +1 -1
- data/lib/oxidized/model/model.rb +32 -38
- data/lib/oxidized/model/netgearxs716.rb +23 -0
- data/lib/oxidized/model/netonix.rb +1 -1
- data/lib/oxidized/model/netscaler.rb +1 -1
- data/lib/oxidized/model/nos.rb +2 -2
- data/lib/oxidized/model/nxos.rb +1 -1
- data/lib/oxidized/model/openbsd.rb +3 -2
- data/lib/oxidized/model/outputs.rb +4 -4
- data/lib/oxidized/model/planet.rb +4 -4
- data/lib/oxidized/model/powerconnect.rb +8 -8
- data/lib/oxidized/model/procurve.rb +2 -1
- data/lib/oxidized/model/quantaos.rb +3 -3
- data/lib/oxidized/model/raisecom.rb +19 -0
- data/lib/oxidized/model/siklu.rb +1 -1
- data/lib/oxidized/model/slxos.rb +1 -1
- data/lib/oxidized/model/smartax.rb +25 -0
- data/lib/oxidized/model/sros.rb +4 -4
- data/lib/oxidized/model/tdre.rb +30 -0
- data/lib/oxidized/model/tmos.rb +3 -0
- data/lib/oxidized/model/trango.rb +17 -37
- data/lib/oxidized/model/voltaire.rb +1 -1
- data/lib/oxidized/model/voss.rb +1 -1
- data/lib/oxidized/model/vyatta.rb +1 -1
- data/lib/oxidized/model/xos.rb +1 -1
- data/lib/oxidized/model/zhoneolt.rb +1 -1
- data/lib/oxidized/node.rb +42 -46
- data/lib/oxidized/node/stats.rb +6 -6
- data/lib/oxidized/nodes.rb +42 -42
- data/lib/oxidized/output/file.rb +16 -20
- data/lib/oxidized/output/git.rb +68 -78
- data/lib/oxidized/output/gitcrypt.rb +77 -91
- data/lib/oxidized/output/http.rb +17 -19
- data/lib/oxidized/output/output.rb +1 -1
- data/lib/oxidized/source/csv.rb +3 -3
- data/lib/oxidized/source/http.rb +11 -14
- data/lib/oxidized/source/source.rb +3 -3
- data/lib/oxidized/source/sql.rb +16 -18
- data/lib/oxidized/string.rb +10 -10
- data/lib/oxidized/version.rb +4 -4
- data/lib/oxidized/worker.rb +15 -15
- data/oxidized.gemspec +6 -9
- metadata +32 -25
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,20 @@
|
|
2
2
|
|
3
3
|
## Master
|
4
4
|
|
5
|
+
## 0.26.0
|
6
|
+
|
7
|
+
* FEATURE: add Cisco VPN3000 model (@baznikin)
|
8
|
+
* FEATURE: add NetGear PROSafe Smart switches model (@baznikin)
|
9
|
+
* FEATURE: Added possibility to pass root logs directory as environment variable (@Glorf)
|
10
|
+
* FEATURE: add OneAccess TDRE (1645) model (@starrsl)
|
11
|
+
* FEATURE: add Audiocodes MediaPack MP-1xx and Mediant 1000 model (@pedjaj)
|
12
|
+
* FEATURE: add raisecom RAX model (@vitalisator)
|
13
|
+
* FEATURE: add huawei smartax model (@nyash)
|
14
|
+
* FEATURE: add grandstream model
|
15
|
+
* MISC: prompt updates in siklu, netonix, netscaler models
|
16
|
+
* MISC: minimal supported ruby is now 2.3, net-ssh dependency ~> 5, rubocop ~> 0.65.0
|
17
|
+
* FIX: in git comparison we might mistakenly always detect change due to !utf8 vs. utf8 encoding of a char
|
18
|
+
|
5
19
|
## 0.25.0
|
6
20
|
|
7
21
|
* FEATURE: add viptela model (@bobthebutcher)
|
data/Dockerfile
CHANGED
@@ -3,8 +3,10 @@ FROM phusion/baseimage:0.11
|
|
3
3
|
LABEL maintainer="Samer Abdel-Hafez <sam@arahant.net>"
|
4
4
|
|
5
5
|
# set up dependencies for the build process
|
6
|
-
RUN apt-get -yq update
|
7
|
-
apt-get -yq install ruby2.5 ruby2.5-dev libssl1.1 libssl-dev pkg-config make cmake libssh2-1 libssh2-1-dev git g++ libffi-dev ruby-bundler libicu60 libicu-dev libsqlite3-0 libsqlite3-dev libmysqlclient20 libmysqlclient-dev
|
6
|
+
RUN apt-get -yq update \
|
7
|
+
&& apt-get -yq --no-install-recommends install ruby2.5 ruby2.5-dev libssl1.1 libssl-dev pkg-config make cmake libssh2-1 libssh2-1-dev git g++ libffi-dev ruby-bundler libicu60 libicu-dev libsqlite3-0 libsqlite3-dev libmysqlclient20 libmysqlclient-dev \
|
8
|
+
&& apt-get clean \
|
9
|
+
&& rm -rf /var/lib/apt/lists/*
|
8
10
|
|
9
11
|
# dependencies for hooks
|
10
12
|
RUN gem install aws-sdk slack-api xmpp4r cisco_spark --no-ri --no-rdoc
|
@@ -29,9 +31,9 @@ RUN rm -rf /tmp/oxidized
|
|
29
31
|
RUN apt-get -yq --purge autoremove ruby-dev pkg-config make cmake ruby-bundler libssl-dev libssh2-1-dev libicu-dev libsqlite3-dev libmysqlclient-dev
|
30
32
|
|
31
33
|
# add runit services
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
COPY extra/oxidized.runit /etc/service/oxidized/run
|
35
|
+
COPY extra/auto-reload-config.runit /etc/service/auto-reload-config/run
|
36
|
+
COPY extra/update-ca-certificates.runit /etc/service/update-ca-certificates/run
|
35
37
|
|
36
38
|
VOLUME ["/root/.config/oxidized"]
|
37
39
|
EXPOSE 8888/tcp
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ Check out the [Oxidized TREX 2014 presentation](http://youtu.be/kBQ_CTUuqeU#t=3h
|
|
37
37
|
* [FreeBSD](#freebsd)
|
38
38
|
* [Build from Git](#build-from-git)
|
39
39
|
* [Docker](#running-with-docker)
|
40
|
-
* [Installing Ruby 2.
|
40
|
+
* [Installing Ruby 2.3 using RVM](#installing-ruby-23-using-rvm)
|
41
41
|
3. [Initial Configuration](#configuration)
|
42
42
|
4. [Configuration](docs/Configuration.md)
|
43
43
|
* [Debugging](docs/Configuration.md#debugging)
|
@@ -86,7 +86,7 @@ add-apt-repository universe
|
|
86
86
|
Install the dependencies:
|
87
87
|
|
88
88
|
```shell
|
89
|
-
apt-get install ruby ruby-dev libsqlite3-dev libssl-dev pkg-config cmake libssh2-1-dev libicu-dev zlib1g-dev
|
89
|
+
apt-get install ruby ruby-dev libsqlite3-dev libssl-dev pkg-config cmake libssh2-1-dev libicu-dev zlib1g-dev g++
|
90
90
|
```
|
91
91
|
|
92
92
|
Finally, install the gems:
|
@@ -98,21 +98,25 @@ gem install oxidized-script oxidized-web # If you don't install oxidized-web, en
|
|
98
98
|
|
99
99
|
### CentOS, Oracle Linux, Red Hat Linux
|
100
100
|
|
101
|
-
On CentOS 6 / RHEL 6, begin by installing Ruby 2.
|
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:
|
102
102
|
|
103
|
-
|
103
|
+
Install Ruby 2.3 from [SCL](https://www.softwarecollections.org/en/scls/rhscl/rh-ruby23/):
|
104
104
|
|
105
105
|
```shell
|
106
|
-
yum install
|
106
|
+
yum install centos-release-scl
|
107
|
+
yum install rh-ruby23
|
108
|
+
scl enable rh-ruby23 bash
|
107
109
|
```
|
108
110
|
|
109
|
-
|
111
|
+
The following additional packages will be required to build the dependencies:
|
110
112
|
|
111
113
|
```shell
|
112
114
|
yum install make cmake which sqlite-devel openssl-devel libssh2-devel ruby gcc ruby-devel libicu-devel gcc-c++
|
113
115
|
```
|
114
116
|
|
115
|
-
|
117
|
+
Alternatively, install Ruby 2.3 by following the instructions at [Installing Ruby 2.3 using RVM](#installing-ruby-23-using-rvm).
|
118
|
+
|
119
|
+
Finally, install oxidized via Rubygems:
|
116
120
|
|
117
121
|
```shell
|
118
122
|
gem install oxidized
|
@@ -121,7 +125,7 @@ gem install oxidized-script oxidized-web # if you don't install oxidized-web, ma
|
|
121
125
|
|
122
126
|
### FreeBSD
|
123
127
|
|
124
|
-
[Use RVM to install Ruby v2.
|
128
|
+
[Use RVM to install Ruby v2.3](#installing-ruby-23-using-rvm), then install all required packages and gems:
|
125
129
|
|
126
130
|
```shell
|
127
131
|
pkg install cmake pkgconf
|
@@ -225,9 +229,9 @@ If you need to use an internal CA (e.g. to connect to an private github instance
|
|
225
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
|
226
230
|
```
|
227
231
|
|
228
|
-
### Installing Ruby 2.
|
232
|
+
### Installing Ruby 2.3 using RVM
|
229
233
|
|
230
|
-
Install Ruby 2.
|
234
|
+
Install Ruby 2.3 build dependencies
|
231
235
|
|
232
236
|
```shell
|
233
237
|
yum install curl gcc-c++ patch readline readline-devel zlib zlib-devel
|
@@ -241,12 +245,12 @@ Install RVM
|
|
241
245
|
curl -L get.rvm.io | bash -s stable
|
242
246
|
```
|
243
247
|
|
244
|
-
Setup RVM environment and compile and install Ruby 2.
|
248
|
+
Setup RVM environment and compile and install Ruby 2.3 and set it as default
|
245
249
|
|
246
250
|
```shell
|
247
251
|
source /etc/profile.d/rvm.sh
|
248
|
-
rvm install 2.
|
249
|
-
rvm use --default 2.
|
252
|
+
rvm install 2.3
|
253
|
+
rvm use --default 2.3
|
250
254
|
```
|
251
255
|
|
252
256
|
## Configuration
|
@@ -286,7 +290,7 @@ Oxidized supports [CSV](docs/Configuration.md#source-csv), [SQLite](docs/Config
|
|
286
290
|
|
287
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.
|
288
292
|
|
289
|
-
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`
|
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`.
|
290
294
|
|
291
295
|
First create the directory where the CSV `output` is going to store device configs and start Oxidized once.
|
292
296
|
|
data/Rakefile
CHANGED
@@ -32,7 +32,7 @@ task :test do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
task :
|
35
|
+
task build: :version_set
|
36
36
|
task :version_set do
|
37
37
|
Oxidized.version_set
|
38
38
|
Bundler::GemHelper.instance.gemspec.version = Oxidized::VERSION
|
@@ -54,7 +54,7 @@ task :tag do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
desc 'Push to rubygems'
|
57
|
-
task :
|
57
|
+
task push: :tag do
|
58
58
|
system "gem push pkg/#{file}"
|
59
59
|
end
|
60
60
|
|
data/bin/console
CHANGED
data/bin/oxidized
CHANGED
@@ -6,8 +6,8 @@ trap("INT") { exit } # sinatra will otherwise steal this from us
|
|
6
6
|
begin
|
7
7
|
require_relative '../lib/oxidized/cli'
|
8
8
|
Oxidized::CLI.new.run
|
9
|
-
rescue => error
|
10
|
-
warn
|
9
|
+
rescue StandardError => error
|
10
|
+
warn error.to_s
|
11
11
|
debug = Oxidized.config.debug rescue true
|
12
12
|
raise if debug
|
13
13
|
end
|
data/docs/Configuration.md
CHANGED
@@ -262,3 +262,9 @@ Names can instead be passed verbatim to the input:
|
|
262
262
|
```yaml
|
263
263
|
resolve_dns: false
|
264
264
|
```
|
265
|
+
|
266
|
+
## Environment variables
|
267
|
+
|
268
|
+
You can use some environment variables to change default root directories values.
|
269
|
+
* `OXIDIZED_HOME` may be used to set oxidized configuration directory, which defaults to `~/.config/oxidized`
|
270
|
+
* `OXIDIZED_LOGS` may be used to set oxidzied logs and crash directories root, which default to `~/.config/oxidized`
|
data/docs/Model-Notes/README.md
CHANGED
@@ -12,6 +12,7 @@ Arbor Networks|[ArbOS](ArbOS.md)|27 Feb 2018
|
|
12
12
|
Arista|[EOS](EOS.md)|05 Feb 2018
|
13
13
|
Cumulus|[Cumulus](Cumulus.md)|11 Jun 2018
|
14
14
|
Huawei|[VRP](VRP-Huawei.md)|17 Nov 2017
|
15
|
+
Huawei|[SmartAX series](SmartAX-Huawei.md)|21 Jan 2019
|
15
16
|
Juniper|[MX/QFX/EX/SRX/J Series](JunOS.md)|18 Jan 2018
|
16
17
|
Netgear|[Netgear](Netgear.md)|11 Apr 2018
|
17
18
|
Nokia|[Nokia ISAM](Nokia.md)|22 Aug 2018
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Huawei SmartAX GPON/EPON/DOCSIS network access devices
|
2
|
+
|
3
|
+
It is necessary to disable SSH keepalives in Oxidized for configuration retrieval via SSH to work properly.
|
4
|
+
|
5
|
+
To disable SSH keepalives globally edit the config's vars section and add:
|
6
|
+
|
7
|
+
```yaml
|
8
|
+
vars:
|
9
|
+
ssh_no_keepalive: true
|
10
|
+
```
|
11
|
+
|
12
|
+
To disable SSH keepalives per device edit the config's source section and map ssh_no_keepalive to a column inside router.db file.
|
13
|
+
|
14
|
+
```yaml
|
15
|
+
source:
|
16
|
+
default: csv
|
17
|
+
csv:
|
18
|
+
file: ~/.config/oxidized/router.db
|
19
|
+
delimiter: !ruby/regexp /:/
|
20
|
+
map:
|
21
|
+
name: 0
|
22
|
+
model: 1
|
23
|
+
username: 2
|
24
|
+
password: 3
|
25
|
+
vars_map:
|
26
|
+
ssh_no_keepalive: 4
|
27
|
+
```
|
28
|
+
|
29
|
+
```text
|
30
|
+
# router.db
|
31
|
+
10.0.0.1:smartax:someusername:somepassword:true
|
32
|
+
10.0.0.2:ios:someusername:somepassword:false
|
33
|
+
```
|
34
|
+
|
35
|
+
Back to [Model-Notes](README.md)
|
data/docs/Supported-OS-Types.md
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
* Wireless
|
17
17
|
* Allied Telesis
|
18
18
|
* [Alliedware Plus](/lib/oxidized/model/awplus.rb)
|
19
|
+
* [AT-8000S, AT-8000GS series](/lib/oxidized/model/powerconnect.rb)
|
19
20
|
* Alvarion
|
20
21
|
* [BreezeACCESS](/lib/oxidized/model/alvarion.rb)
|
21
22
|
* APC
|
@@ -30,6 +31,7 @@
|
|
30
31
|
* [AOSW](/lib/oxidized/model/aosw.rb)
|
31
32
|
* AudioCodes
|
32
33
|
* [AudioCodes](/lib/oxdized/model/audiocodes.rb)
|
34
|
+
* [MediaPack MP-1xx, Mediant1000](/lib/oxdized/model/audiocodesmp.rb)
|
33
35
|
* Avaya
|
34
36
|
* [VOSS (VSP Operating System Software)](/lib/oxidized/model/voss.rb)
|
35
37
|
* [BOSS (Baystack Operating System Software)](/lib/oxidized/model/boss.rb)
|
@@ -61,6 +63,7 @@
|
|
61
63
|
* [SMA](/lib/oxidized/model/ciscosma.rb)
|
62
64
|
* [SMB (Nikola series)](/lib/oxidized/model/ciscosmb.rb)
|
63
65
|
* [UCS](/lib/oxidized/model/ucs.rb)
|
66
|
+
* [VPN3000](/lib/oxidized/model/ciscovpn3k.rb)
|
64
67
|
* Citrix
|
65
68
|
* [NetScaler (Virtual Applicance)](/lib/oxidized/model/netscaler.rb)
|
66
69
|
* Coriant (former Tellabs)
|
@@ -109,6 +112,8 @@
|
|
109
112
|
* [PRIMERGY Blade switch 1/10Gbe](/lib/oxidized/model/fujitsupy.rb)
|
110
113
|
* GCOM Technologies
|
111
114
|
* [Broadband Network Platform Software](/lib/oxidized/model/gcombnps.rb)
|
115
|
+
* Grandstream Networks
|
116
|
+
* [GSX](/lib/oxidized/model/grandstream.rb)
|
112
117
|
* Hatteras
|
113
118
|
* [Hatteras](/lib/oxidized/model/hatteras.rb)
|
114
119
|
* Hillstone Networks
|
@@ -122,6 +127,7 @@
|
|
122
127
|
* [MSA](/lib/oxidized/model/hpemsa.rb)
|
123
128
|
* Huawei
|
124
129
|
* [VRP](/lib/oxidized/model/vrp.rb)
|
130
|
+
* [SmartAX series](/lib/oxidized/model/smartax.rb)
|
125
131
|
* Juniper
|
126
132
|
* [JunOS](/lib/oxidized/model/junos.rb)
|
127
133
|
* [ScreenOS (Netscreen)](/lib/oxidized/model/screenos.rb)
|
@@ -137,12 +143,14 @@
|
|
137
143
|
* [FiberDriver](/lib/oxidized/model/fiberdriver.rb)
|
138
144
|
* Netgear
|
139
145
|
* [Netgear](/lib/oxidized/model/netgear.rb)
|
146
|
+
* [Netgear PROSafe Smart switches](/lib/oxidized/model/netgearxs716.rb)
|
140
147
|
* Netonix
|
141
148
|
* [WISP Switch (As Netonix)](/lib/oxidized/model/netonix.rb)
|
142
149
|
* Nokia (formerly TiMetra, Alcatel, Alcatel-Lucent)
|
143
150
|
* [SR OS (TiMOS)](/lib/oxidized/model/sros.rb)
|
144
151
|
* OneAccess
|
145
152
|
* [OneOS](/lib/oxidized/model/oneos.rb)
|
153
|
+
* [TDRE](/lib/oxidized/model/tdre.rb)
|
146
154
|
* [OpenBSD](/lib/oxidized/model/openbsd.rb)
|
147
155
|
* Opengear
|
148
156
|
* [Opengear](/lib/oxidized/model/opengear.rb)
|
@@ -154,6 +162,8 @@
|
|
154
162
|
* [pfSense](/lib/oxidized/model/pfsense.rb)
|
155
163
|
* Radware
|
156
164
|
* [AlteonOS](/lib/oxidized/model/alteonos.rb)
|
165
|
+
* Raisecom
|
166
|
+
* [Raisecom](/lib/oxidized/model/raisecom.rb)
|
157
167
|
* Quanta
|
158
168
|
* [Quanta / VxWorks 6.6 (1.1.0.8)](/lib/oxidized/model/quantaos.rb)
|
159
169
|
* Siklu
|
@@ -171,6 +181,8 @@
|
|
171
181
|
* [Trango](/lib/oxidized/model/trango.rb)
|
172
182
|
* TPLink
|
173
183
|
* [TPLink](/lib/oxidized/model/tplink.rb)
|
184
|
+
* [TL-SL5428](/lib/oxidized/model/edgecos.rb)
|
185
|
+
* [TL-SL3428](/lib/oxidized/model/powerconnect.rb)
|
174
186
|
* Ubiquiti
|
175
187
|
* [AirOS](/lib/oxidized/model/airos.rb)
|
176
188
|
* [Edgeos](/lib/oxidized/model/edgeos.rb)
|
@@ -10,7 +10,7 @@ pending = false
|
|
10
10
|
critical_nodes = []
|
11
11
|
pending_nodes = []
|
12
12
|
|
13
|
-
json = JSON.
|
13
|
+
json = JSON.parse(open("http://localhost:8888/nodes.json"))
|
14
14
|
json.each do |node|
|
15
15
|
if not node['last'].nil?
|
16
16
|
if node['last']['status'] != 'success'
|
data/extra/rest_client.rb
CHANGED
@@ -9,36 +9,34 @@ module Oxidized
|
|
9
9
|
Root = Root = ENV['OXIDIZED_HOME'] || File.join(ENV['HOME'], '.config', 'oxidized')
|
10
10
|
end
|
11
11
|
|
12
|
-
CFGS = Asetus.new :
|
12
|
+
CFGS = Asetus.new name: 'oxidized', load: false, key_to_s: true
|
13
13
|
CFGS.default.rest = '127.0.0.1:8888'
|
14
14
|
|
15
15
|
begin
|
16
16
|
CFGS.load
|
17
|
-
rescue => error
|
17
|
+
rescue StandardError => error
|
18
18
|
raise InvalidConfig, "Error loading config: #{error.message}"
|
19
19
|
end
|
20
20
|
|
21
21
|
restcfg = CFGS.cfg.rest
|
22
|
-
unless restcfg
|
23
|
-
restcfg.insert(0, 'http://')
|
24
|
-
end
|
22
|
+
restcfg.insert(0, 'http://') unless restcfg =~ /^http:\/\//
|
25
23
|
|
26
24
|
HOST = URI(restcfg).host
|
27
25
|
PORT = URI(restcfg).port
|
28
26
|
PATH = URI(restcfg).path
|
29
27
|
|
30
28
|
class << self
|
31
|
-
def next
|
29
|
+
def next(opt = {}, host = HOST, port = PORT)
|
32
30
|
web = new host, port
|
33
31
|
web.next opt
|
34
32
|
end
|
35
33
|
end
|
36
34
|
|
37
|
-
def initialize
|
35
|
+
def initialize(host = HOST, port = PORT)
|
38
36
|
@web = Net::HTTP.new host, port
|
39
37
|
end
|
40
38
|
|
41
|
-
def next
|
39
|
+
def next(opt)
|
42
40
|
data = JSON.dump opt
|
43
41
|
@web.put PATH + '/node/next/' + opt[:name].to_s, data
|
44
42
|
end
|
data/extra/syslog.rb
CHANGED
@@ -32,14 +32,14 @@ module Oxidized
|
|
32
32
|
Root = File.join ENV['HOME'], '.config', 'oxidized'
|
33
33
|
end
|
34
34
|
|
35
|
-
CFGS = Asetus.new :
|
35
|
+
CFGS = Asetus.new name: 'oxidized', load: false, key_to_s: true
|
36
36
|
CFGS.default.syslogd.port = 514
|
37
37
|
CFGS.default.syslogd.file = 'messages'
|
38
38
|
CFGS.default.syslogd.resolve = true
|
39
39
|
|
40
40
|
begin
|
41
41
|
CFGS.load
|
42
|
-
rescue => error
|
42
|
+
rescue StandardError => error
|
43
43
|
raise InvalidConfig, "Error loading config: #{error.message}"
|
44
44
|
ensure
|
45
45
|
CFG = CFGS.cfg # convenienence, instead of Config.cfg.password, CFG.password
|
@@ -48,24 +48,24 @@ module Oxidized
|
|
48
48
|
class SyslogMonitor
|
49
49
|
NAME_MAP = {
|
50
50
|
/(.*)\.ip\.tdc\.net/ => '\1',
|
51
|
-
/(.*)\.ip\.fi/ => '\1'
|
52
|
-
}
|
51
|
+
/(.*)\.ip\.fi/ => '\1'
|
52
|
+
}.freeze
|
53
53
|
MSG = {
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
57
|
-
:
|
58
|
-
}
|
54
|
+
ios: /%SYS-(SW[0-9]+-)?5-CONFIG_I:/,
|
55
|
+
junos: 'UI_COMMIT:',
|
56
|
+
eos: /%SYS-5-CONFIG_I:/,
|
57
|
+
nxos: /%VSHD-5-VSHD_SYSLOG_CONFIG_I:/
|
58
|
+
}.freeze
|
59
59
|
|
60
60
|
class << self
|
61
|
-
def udp
|
61
|
+
def udp(port = Oxidized::CFG.syslogd.port, listen = 0)
|
62
62
|
io = UDPSocket.new
|
63
63
|
io.bind listen, port
|
64
64
|
new io, :udp
|
65
65
|
end
|
66
66
|
|
67
|
-
def file
|
68
|
-
io = open syslog_file, 'r'
|
67
|
+
def file(syslog_file = Oxidized::CFG.syslogd.file)
|
68
|
+
io = File.open syslog_file, 'r'
|
69
69
|
io.seek 0, IO::SEEK_END
|
70
70
|
new io, :file
|
71
71
|
end
|
@@ -73,43 +73,43 @@ module Oxidized
|
|
73
73
|
|
74
74
|
private
|
75
75
|
|
76
|
-
def initialize
|
76
|
+
def initialize(io, mode = :udp)
|
77
77
|
@mode = mode
|
78
78
|
run io
|
79
79
|
end
|
80
80
|
|
81
|
-
def rest
|
81
|
+
def rest(opt)
|
82
82
|
Oxidized::RestClient.next opt
|
83
83
|
end
|
84
84
|
|
85
|
-
def ios
|
85
|
+
def ios(ipaddr, log, index)
|
86
86
|
# TODO: we need to fetch 'ip/name' in mode == :file here
|
87
|
-
user = log[
|
87
|
+
user = log[index + 5]
|
88
88
|
from = log[-1][1..-2]
|
89
|
-
rest(:
|
90
|
-
:
|
89
|
+
rest(user: user, from: from, model: 'ios', ip: ipaddr,
|
90
|
+
name: getname(ipaddr))
|
91
91
|
end
|
92
92
|
|
93
|
-
def jnpr
|
93
|
+
def jnpr(ipaddr, log, index)
|
94
94
|
# TODO: we need to fetch 'ip/name' in mode == :file here
|
95
|
-
user = log[
|
96
|
-
msg = log[(
|
95
|
+
user = log[index + 2][1..-2]
|
96
|
+
msg = log[(index + 6)..-1].join(' ')[10..-2]
|
97
97
|
msg = nil if msg == 'none'
|
98
|
-
rest(:
|
99
|
-
:
|
98
|
+
rest(user: user, msg: msg, model: 'jnpr', ip: ipaddr,
|
99
|
+
name: getname(ipaddr))
|
100
100
|
end
|
101
101
|
|
102
|
-
def handle_log
|
102
|
+
def handle_log(log, ipaddr)
|
103
103
|
log = log.to_s.split ' '
|
104
|
-
if i = log.find_index { |e| e.match(MSG[:ios]) }
|
105
|
-
ios
|
106
|
-
elsif i = log.index(MSG[:junos])
|
107
|
-
jnpr
|
104
|
+
if (i = log.find_index { |e| e.match(MSG[:ios]) })
|
105
|
+
ios ipaddr, log, i
|
106
|
+
elsif (i = log.index(MSG[:junos]))
|
107
|
+
jnpr ipaddr, log, i
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
def run
|
112
|
-
|
111
|
+
def run(io)
|
112
|
+
loop do
|
113
113
|
log = select [io]
|
114
114
|
log, ip = log.first.first, nil
|
115
115
|
if @mode == :udp
|
@@ -127,11 +127,11 @@ module Oxidized
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
|
-
def getname
|
130
|
+
def getname(ipaddr)
|
131
131
|
if Oxidized::CFG.syslogd.resolve == false
|
132
|
-
|
132
|
+
ipddr
|
133
133
|
else
|
134
|
-
name = (Resolv.getname
|
134
|
+
name = (Resolv.getname ipaddr.to_s rescue ipadr)
|
135
135
|
NAME_MAP.each { |re, sub| name.sub! re, sub }
|
136
136
|
name
|
137
137
|
end
|