oxidized 0.32.1 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +45 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
- data/.github/ISSUE_TEMPLATE/support-request.md +39 -0
- data/.github/workflows/publishdocker.yml +35 -16
- data/.github/workflows/ruby.yml +4 -2
- data/.gitignore +2 -0
- data/.rubocop.yml +29 -8
- data/.rubocop_todo.yml +1 -60
- data/CHANGELOG.md +103 -2
- data/CONTRIBUTING.md +20 -10
- data/Dockerfile +37 -64
- data/README.md +47 -141
- data/Rakefile +9 -11
- data/docs/Configuration.md +236 -27
- data/docs/DeviceSimulation.md +19 -7
- data/docs/Docker.md +245 -0
- data/docs/Issues.md +27 -1
- data/docs/Model-Notes/EatonNetwork.md +18 -0
- data/docs/Model-Notes/HPEAruba.md +3 -2
- data/docs/ModelUnitTests.md +35 -25
- data/docs/Outputs.md +83 -2
- data/docs/Release.md +34 -24
- data/docs/Supported-OS-Types.md +7 -0
- data/docs/Troubleshooting.md +4 -13
- data/extra/device2yaml.rb +24 -9
- data/extra/rest_client.rb +3 -2
- data/extra/syslog.rb +8 -3
- data/lib/oxidized/cli.rb +7 -3
- data/lib/oxidized/config/vars.rb +22 -14
- data/lib/oxidized/config.rb +3 -2
- data/lib/oxidized/core.rb +30 -8
- data/lib/oxidized/hook/ciscosparkdiff.rb +11 -9
- data/lib/oxidized/hook/exec.rb +5 -4
- data/lib/oxidized/hook/githubrepo.rb +23 -17
- data/lib/oxidized/hook/noophook.rb +2 -2
- data/lib/oxidized/hook/slackdiff.rb +9 -8
- data/lib/oxidized/hook/xmppdiff.rb +9 -9
- data/lib/oxidized/hook.rb +10 -8
- data/lib/oxidized/input/cli.rb +8 -3
- data/lib/oxidized/input/exec.rb +1 -1
- data/lib/oxidized/input/ftp.rb +2 -2
- data/lib/oxidized/input/http.rb +6 -6
- data/lib/oxidized/input/input.rb +1 -0
- data/lib/oxidized/input/scp.rb +2 -2
- data/lib/oxidized/input/ssh.rb +21 -14
- data/lib/oxidized/input/telnet.rb +3 -3
- data/lib/oxidized/input/tftp.rb +1 -1
- data/lib/oxidized/job.rb +7 -4
- data/lib/oxidized/logger.rb +51 -0
- data/lib/oxidized/model/acos.rb +1 -0
- data/lib/oxidized/model/aos7.rb +9 -0
- data/lib/oxidized/model/aoscx.rb +2 -0
- data/lib/oxidized/model/aosw.rb +22 -17
- data/lib/oxidized/model/aricentiss.rb +2 -2
- data/lib/oxidized/model/asa.rb +3 -3
- data/lib/oxidized/model/awplus.rb +13 -10
- data/lib/oxidized/model/eatonnetwork.rb +65 -0
- data/lib/oxidized/model/edgecos.rb +2 -1
- data/lib/oxidized/model/edgeos.rb +7 -6
- data/lib/oxidized/model/edgeswitch.rb +3 -1
- data/lib/oxidized/model/efos.rb +41 -0
- data/lib/oxidized/model/eltex.rb +1 -1
- data/lib/oxidized/model/fabricos.rb +1 -1
- data/lib/oxidized/model/fastiron.rb +3 -1
- data/lib/oxidized/model/firelinuxos.rb +12 -3
- data/lib/oxidized/model/fortios.rb +5 -4
- data/lib/oxidized/model/gaiaos.rb +4 -4
- data/lib/oxidized/model/ingate.rb +47 -0
- data/lib/oxidized/model/ios.rb +16 -5
- data/lib/oxidized/model/ironware.rb +1 -1
- data/lib/oxidized/model/junos.rb +4 -0
- data/lib/oxidized/model/linksyssrw.rb +3 -3
- data/lib/oxidized/model/mlnxos.rb +14 -7
- data/lib/oxidized/model/model.rb +4 -3
- data/lib/oxidized/model/netgear.rb +8 -0
- data/lib/oxidized/model/nsxdfw.rb +2 -1
- data/lib/oxidized/model/nsxfirewall.rb +2 -1
- data/lib/oxidized/model/nxos.rb +2 -2
- data/lib/oxidized/model/openwrt.rb +6 -6
- data/lib/oxidized/model/powerconnect.rb +31 -10
- data/lib/oxidized/model/procurve.rb +3 -1
- data/lib/oxidized/model/qtech.rb +3 -1
- data/lib/oxidized/model/quantaos.rb +8 -6
- data/lib/oxidized/model/routeros.rb +3 -2
- data/lib/oxidized/model/saos10.rb +38 -0
- data/lib/oxidized/model/sixwind.rb +28 -0
- data/lib/oxidized/model/sonicos.rb +1 -1
- data/lib/oxidized/model/srosmd.rb +1 -1
- data/lib/oxidized/model/supermicro.rb +1 -1
- data/lib/oxidized/model/timos.rb +1 -1
- data/lib/oxidized/model/tmos.rb +1 -0
- data/lib/oxidized/model/tnsr.rb +53 -0
- data/lib/oxidized/model/trango.rb +3 -1
- data/lib/oxidized/model/unifiap.rb +144 -0
- data/lib/oxidized/model/vrp.rb +3 -1
- data/lib/oxidized/model/xos.rb +3 -1
- data/lib/oxidized/model/zhoneolt.rb +3 -1
- data/lib/oxidized/model/zynos.rb +3 -3
- data/lib/oxidized/node.rb +44 -27
- data/lib/oxidized/nodes.rb +8 -4
- data/lib/oxidized/output/file.rb +28 -0
- data/lib/oxidized/output/git.rb +148 -41
- data/lib/oxidized/output/gitcrypt.rb +18 -13
- data/lib/oxidized/output/http.rb +5 -4
- data/lib/oxidized/output/output.rb +14 -0
- data/lib/oxidized/source/http.rb +4 -2
- data/lib/oxidized/version.rb +6 -4
- data/lib/oxidized/worker.rb +13 -13
- data/lib/oxidized.rb +3 -24
- data/lib/refinements.rb +2 -0
- data/oxidized.gemspec +10 -8
- metadata +74 -41
- data/examples/podman-compose/Makefile +0 -103
- data/examples/podman-compose/README.md +0 -94
- data/examples/podman-compose/docker-compose.yml +0 -30
- data/examples/podman-compose/gitserver/.gitignore +0 -1
- data/examples/podman-compose/gitserver/Dockerfile +0 -14
- data/examples/podman-compose/model-simulation/Dockerfile-model +0 -13
- data/examples/podman-compose/model-simulation/asternos.sh +0 -36
- data/examples/podman-compose/oxidized-config/.gitignore +0 -10
- data/examples/podman-compose/oxidized-config/config +0 -46
- data/examples/podman-compose/oxidized-config/config_csv-file +0 -46
- data/examples/podman-compose/oxidized-config/config_csv-gitserver +0 -56
- data/examples/podman-compose/oxidized-config/router.db +0 -1
- data/examples/podman-compose/oxidized-ssh/.gitignore +0 -1
- data/examples/podman-compose/oxidized-ssh/README.md +0 -14
data/docs/Configuration.md
CHANGED
@@ -2,9 +2,15 @@
|
|
2
2
|
|
3
3
|
## Debugging
|
4
4
|
|
5
|
-
In case a model plugin doesn't work correctly (ios, procurve, etc.), you can
|
5
|
+
In case a model plugin doesn't work correctly (ios, procurve, etc.), you can
|
6
|
+
enable live debugging of SSH/Telnet sessions. Just add a `debug` option
|
7
|
+
containing the value true to the `input` section. The log files will be created
|
8
|
+
depending on the parent directory of the logfile option.
|
6
9
|
|
7
|
-
The following example will log an active ssh/telnet session
|
10
|
+
The following example will log an active ssh/telnet session
|
11
|
+
`/home/oxidized/.config/oxidized/log/<IP-Address>-<PROTOCOL>`. The file will be
|
12
|
+
truncated on each consecutive ssh/telnet session, so you need to put a `tailf`
|
13
|
+
or `tail -f` on that file!
|
8
14
|
|
9
15
|
```yaml
|
10
16
|
log: /home/oxidized/.config/oxidized/log
|
@@ -22,7 +28,9 @@ input:
|
|
22
28
|
|
23
29
|
## Privileged mode
|
24
30
|
|
25
|
-
To start privileged mode before pulling the configuration, Oxidized needs to
|
31
|
+
To start privileged mode before pulling the configuration, Oxidized needs to
|
32
|
+
send the enable command. You can globally enable this, by adding the following
|
33
|
+
snippet to the global section of the configuration file.
|
26
34
|
|
27
35
|
```yaml
|
28
36
|
vars:
|
@@ -31,14 +39,17 @@ vars:
|
|
31
39
|
|
32
40
|
## Removing secrets
|
33
41
|
|
34
|
-
To strip out secrets from configurations before storing them, Oxidized needs the
|
42
|
+
To strip out secrets from configurations before storing them, Oxidized needs the
|
43
|
+
`remove_secret` flag. You can globally enable this by adding the following
|
44
|
+
snippet to the global section of the configuration file.
|
35
45
|
|
36
46
|
```yaml
|
37
47
|
vars:
|
38
48
|
remove_secret: true
|
39
49
|
```
|
40
50
|
|
41
|
-
Device models that contain substitution filters to remove sensitive data will
|
51
|
+
Device models that contain substitution filters to remove sensitive data will
|
52
|
+
now be run on any fetched configuration.
|
42
53
|
|
43
54
|
As a partial example from ios.rb:
|
44
55
|
|
@@ -56,7 +67,9 @@ The above strips out snmp community strings from your saved configs.
|
|
56
67
|
|
57
68
|
## Disabling SSH exec channels
|
58
69
|
|
59
|
-
Oxidized uses exec channels to make information extraction simpler, but there
|
70
|
+
Oxidized uses exec channels to make information extraction simpler, but there
|
71
|
+
are some situations where this doesn't work well, e.g. configuring devices. This
|
72
|
+
feature can be turned off by setting the `ssh_no_exec`
|
60
73
|
variable.
|
61
74
|
|
62
75
|
```yaml
|
@@ -66,7 +79,11 @@ vars:
|
|
66
79
|
|
67
80
|
## Disabling SSH keepalives
|
68
81
|
|
69
|
-
Oxidized SSH input makes use of SSH keepalives to prevent timeouts from slower
|
82
|
+
Oxidized SSH input makes use of SSH keepalives to prevent timeouts from slower
|
83
|
+
devices and to quickly tear down stale sessions in larger deployments. There
|
84
|
+
have been reports of SSH keepalives breaking compatibility with certain OS
|
85
|
+
types. They can be disabled using the `ssh_no_keepalive` variable on a per-node
|
86
|
+
basis (by specifying it in the source) or configured application-wide.
|
70
87
|
|
71
88
|
```yaml
|
72
89
|
vars:
|
@@ -84,9 +101,12 @@ vars:
|
|
84
101
|
|
85
102
|
## Public Key Authentication with SSH
|
86
103
|
|
87
|
-
Instead of password-based login, Oxidized can make use of key-based SSH
|
104
|
+
Instead of password-based login, Oxidized can make use of key-based SSH
|
105
|
+
authentication.
|
88
106
|
|
89
|
-
You can tell Oxidized to use one or more private keys globally, or specify the
|
107
|
+
You can tell Oxidized to use one or more private keys globally, or specify the
|
108
|
+
key to be used on a per-node basis. The latter can be done by mapping the
|
109
|
+
`ssh_keys` variable through the active source.
|
90
110
|
|
91
111
|
Global:
|
92
112
|
|
@@ -108,7 +128,8 @@ vars_map:
|
|
108
128
|
# ...
|
109
129
|
```
|
110
130
|
|
111
|
-
If you are using a non-standard path, especially when copying the private key
|
131
|
+
If you are using a non-standard path, especially when copying the private key
|
132
|
+
via a secured channel, make sure that the permissions are set correctly:
|
112
133
|
|
113
134
|
```bash
|
114
135
|
foo@bar:~$ ls -la ~/.ssh/
|
@@ -120,15 +141,20 @@ drwx------ 5 oxidized oxidized 4096 Mar 13 21:40 ..
|
|
120
141
|
-rw-r--r-- 1 oxidized oxidized 94 Mar 13 17:02 id_ed25519.pub
|
121
142
|
```
|
122
143
|
|
123
|
-
Finally, multiple private keys can be specified as an array of file paths, such
|
144
|
+
Finally, multiple private keys can be specified as an array of file paths, such
|
145
|
+
as `["~/.ssh/id_rsa", "~/.ssh/id_another_rsa"]`.
|
124
146
|
|
125
147
|
## SSH Proxy Command
|
126
148
|
|
127
|
-
Oxidized can `ssh` through a proxy as well. To do so we just need to set
|
149
|
+
Oxidized can `ssh` through a proxy as well. To do so we just need to set
|
150
|
+
`ssh_proxy` variable with the proxy host information and optionally set the
|
151
|
+
`ssh_proxy_port` with the SSH port if it is not listening on port 22.
|
128
152
|
|
129
|
-
This can be provided on a per-node basis by mapping the proper fields from your
|
153
|
+
This can be provided on a per-node basis by mapping the proper fields from your
|
154
|
+
source.
|
130
155
|
|
131
|
-
An example for a `csv` input source that maps the 4th field as the `ssh_proxy`
|
156
|
+
An example for a `csv` input source that maps the 4th field as the `ssh_proxy`
|
157
|
+
value and the 5th field as `ssh_proxy_port`.
|
132
158
|
|
133
159
|
```yaml
|
134
160
|
# ...
|
@@ -144,9 +170,12 @@ vars_map:
|
|
144
170
|
|
145
171
|
## SSH enabling legacy algorithms
|
146
172
|
|
147
|
-
When connecting to older firmware over SSH, it is sometimes necessary to enable
|
173
|
+
When connecting to older firmware over SSH, it is sometimes necessary to enable
|
174
|
+
legacy/disabled settings like KexAlgorithms, HostKeyAlgorithms, MAC or the
|
175
|
+
Encryption.
|
148
176
|
|
149
|
-
These settings can be provided on a per-node basis by mapping the ssh_kex,
|
177
|
+
These settings can be provided on a per-node basis by mapping the ssh_kex,
|
178
|
+
ssh_host_key, ssh_hmac and the ssh_encryption fields from you source.
|
150
179
|
|
151
180
|
```yaml
|
152
181
|
# ...
|
@@ -164,7 +193,9 @@ vars_map:
|
|
164
193
|
|
165
194
|
## FTP Passive Mode
|
166
195
|
|
167
|
-
Oxidized uses ftp passive mode by default. Some devices require passive mode to
|
196
|
+
Oxidized uses ftp passive mode by default. Some devices require passive mode to
|
197
|
+
be disabled. To do so, we can set `input.ftp.passive` to false - this will make
|
198
|
+
use of FTP active mode.
|
168
199
|
|
169
200
|
```yaml
|
170
201
|
input:
|
@@ -207,7 +238,21 @@ crash:
|
|
207
238
|
vars:
|
208
239
|
enable: S3cr3tx
|
209
240
|
groups: {}
|
210
|
-
|
241
|
+
extensions:
|
242
|
+
oxidized-web:
|
243
|
+
load: true
|
244
|
+
# Bind to any IPv4 interface
|
245
|
+
listen: 0.0.0.0
|
246
|
+
# Bind to port 8888 (default)
|
247
|
+
port: 8888
|
248
|
+
# Prefix prod to the URL, so http://oxidized.full.domain/prod/
|
249
|
+
url_prefix: prod
|
250
|
+
# virtual hosts to listen to (others will be denied)
|
251
|
+
vhosts:
|
252
|
+
- localhost
|
253
|
+
- 127.0.0.1
|
254
|
+
- oxidized
|
255
|
+
- oxidized.full.domain
|
211
256
|
pid: ~/.config/oxidized/oxidized.pid
|
212
257
|
input:
|
213
258
|
default: ssh, telnet
|
@@ -337,35 +382,99 @@ From least to most important:
|
|
337
382
|
|
338
383
|
More important options overwrite less important ones if they are set.
|
339
384
|
|
340
|
-
## RESTful API and
|
385
|
+
## oxidized-web: RESTful API and web interface
|
386
|
+
|
387
|
+
The RESTful API and web interface are enabled by installing the `oxidized-web`
|
388
|
+
gem and configuring the `extensions.oxidized-web:` section in the configuration
|
389
|
+
file. You can set the following parameter:
|
390
|
+
- `load`: `true`/`false`: Enables or disables the `oxidized-web` extension
|
391
|
+
(default: `false`)
|
392
|
+
- `listen`: Specifies the interface to bind to (default: `127.0.0.1`). Valid
|
393
|
+
options:
|
394
|
+
- `127.0.0.1`: Allows IPv4 connections from localhost only
|
395
|
+
- `'[::1]'`: Allows IPv6 connections from localhost only
|
396
|
+
- `<IPv4-Address>` or `'[<IPv6-Address>]'`: Binds to a specific interface
|
397
|
+
- `0.0.0.0`: Binds to any IPv4 interface
|
398
|
+
- `'[::]'`: Binds to any IPv4 and IPv6 interface
|
399
|
+
- `port`: Specifies the TCP port to listen to (default: `8888`)
|
400
|
+
- `url_prefix`: Defines a URL prefix (default: no prefix)
|
401
|
+
- `vhosts`: A list of virtual hosts to listen to. If not specified, it will
|
402
|
+
respond to any virtual host.
|
403
|
+
|
404
|
+
> [!NOTE]
|
405
|
+
> The old syntax `rest: 127.0.0.1:8888/prefix` is still supported but
|
406
|
+
> deprecated. It produces a warning and won't be suported in future releases.
|
407
|
+
>
|
408
|
+
> If the `rest` configuration is used, the extensions.oxidized-web will be
|
409
|
+
> ignored.
|
410
|
+
|
411
|
+
> [!NOTE]
|
412
|
+
> You need oxidized-web version 0.16.0 or later to use the
|
413
|
+
> extentions.oxidized-web configuration
|
341
414
|
|
342
|
-
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.
|
343
415
|
|
344
416
|
```yaml
|
345
417
|
# Listen on http://[::1]:8888/
|
346
|
-
|
418
|
+
extensions:
|
419
|
+
oxidized-web:
|
420
|
+
load: true
|
421
|
+
listen: '[::1]'
|
422
|
+
port: 8888
|
347
423
|
```
|
348
424
|
|
349
425
|
```yaml
|
350
426
|
# Listen on http://127.0.0.1:8888/
|
351
|
-
|
427
|
+
extensions:
|
428
|
+
oxidized-web:
|
429
|
+
load: true
|
430
|
+
listen: 127.0.0.1
|
431
|
+
port: 8888
|
352
432
|
```
|
353
433
|
|
354
434
|
```yaml
|
355
435
|
# Listen on http://[2001:db8:0:face:b001:0:dead:beaf]:8888/oxidized/
|
356
|
-
|
436
|
+
extensions:
|
437
|
+
oxidized-web:
|
438
|
+
load: true
|
439
|
+
listen: '[2001:db8:0:face:b001:0:dead:beaf]'
|
440
|
+
port: 8888
|
441
|
+
url_prefix: oxidized
|
357
442
|
```
|
358
443
|
|
359
444
|
```yaml
|
360
445
|
# Listen on http://10.0.0.1:8000/oxidized/
|
361
|
-
|
446
|
+
extensions:
|
447
|
+
oxidized-web:
|
448
|
+
load: true
|
449
|
+
listen: 10.0.0.1
|
450
|
+
port: 8000
|
451
|
+
url_prefix: oxidized
|
452
|
+
```
|
453
|
+
|
454
|
+
```yaml
|
455
|
+
# Listen on any interface to http://oxidized.rocks:8888 and
|
456
|
+
# http://oxidized:8888
|
457
|
+
extensions:
|
458
|
+
oxidized-web:
|
459
|
+
load: true
|
460
|
+
listen: '[::]'
|
461
|
+
url_prefix: oxidized
|
462
|
+
vhosts:
|
463
|
+
- oxidized.rocks
|
464
|
+
- oxidized
|
362
465
|
```
|
363
466
|
|
364
467
|
## Triggered backups
|
365
468
|
|
366
|
-
A node can be moved to head-of-queue via the REST API `GET/
|
469
|
+
A node can be moved to head-of-queue via the REST API `GET/PUT
|
470
|
+
/node/next/[NODE]`. This can be useful to immediately schedule a fetch of the
|
471
|
+
configuration after some other event such as a syslog message indicating a
|
472
|
+
configuration update on the device.
|
367
473
|
|
368
|
-
In the default configuration this node will be processed when the next job
|
474
|
+
In the default configuration this node will be processed when the next job
|
475
|
+
worker becomes available, it could take some time if existing backups are in
|
476
|
+
progress. To execute moved jobs immediately a new job can be added
|
477
|
+
automatically:
|
369
478
|
|
370
479
|
```yaml
|
371
480
|
next_adds_job: true
|
@@ -375,7 +484,10 @@ This will allow for a more timely fetch of the device configuration.
|
|
375
484
|
|
376
485
|
## Disabling DNS resolution
|
377
486
|
|
378
|
-
In some instances it might not be desirable to attempt to resolve names of
|
487
|
+
In some instances it might not be desirable to attempt to resolve names of
|
488
|
+
nodes. One such use case is when nodes are accessed through an SSH proxy, where
|
489
|
+
the remote end resolves the names differently than the host on which Oxidized
|
490
|
+
runs would.
|
379
491
|
|
380
492
|
Names can instead be passed verbatim to the input:
|
381
493
|
|
@@ -389,3 +501,100 @@ You can use some environment variables to change default root directories values
|
|
389
501
|
|
390
502
|
* `OXIDIZED_HOME` may be used to set oxidized configuration directory, which defaults to `~/.config/oxidized`
|
391
503
|
* `OXIDIZED_LOGS` may be used to set oxidzied logs and crash directories root, which default to `~/.config/oxidized`
|
504
|
+
|
505
|
+
## Logging
|
506
|
+
Oxidized supports parallel logging to different systems (appenders). The
|
507
|
+
following appenders are currently supported:
|
508
|
+
- `stderr`: log to standard error (this is the default)
|
509
|
+
- `stdout`: log to standard output
|
510
|
+
- `file`: log to a file
|
511
|
+
- `syslog`: log to syslog
|
512
|
+
|
513
|
+
> `stderr` and `stdout` are mutually exclusive and will produce a warning if used
|
514
|
+
> simultaneously.
|
515
|
+
|
516
|
+
> Note: `syslog` currently produces two timestamps because of an issue in
|
517
|
+
> [Sematic Logger](https://github.com/reidmorrison/semantic_logger/issues/316).
|
518
|
+
|
519
|
+
> You can configure as many file appenders as you wish.
|
520
|
+
|
521
|
+
You can set a log level globally and/or for each appender.
|
522
|
+
- The global log level will limit which log messages are accepted, depending
|
523
|
+
on their level.
|
524
|
+
- The default global log level is `:info`.
|
525
|
+
- If you set `debug: true` in the configuration, the global log level will be
|
526
|
+
forced to `:debug`.
|
527
|
+
- The appender log level limits which log messages are displayed by the
|
528
|
+
appender, depending on their level.
|
529
|
+
- The default is `:trace`.
|
530
|
+
|
531
|
+
|
532
|
+
> Available log levels: `:trace`, `:debug`, `:info`, `:warn`,
|
533
|
+
> `:error` and `:fatal`
|
534
|
+
|
535
|
+
Here is a configuration example logging `:error` to syslog, `:warn` to stdout
|
536
|
+
and `:info` to `~/.config/oxidized/info.log`:
|
537
|
+
|
538
|
+
```yaml
|
539
|
+
logger:
|
540
|
+
# Default level
|
541
|
+
# level: :info
|
542
|
+
appenders:
|
543
|
+
- type: syslog
|
544
|
+
level: :error
|
545
|
+
- type: stdout
|
546
|
+
level: :warn
|
547
|
+
- type: file
|
548
|
+
# Default level is :trace, so we get the logs in the default level (:info)
|
549
|
+
file: ~/.config/oxidized/info.log
|
550
|
+
```
|
551
|
+
|
552
|
+
If you want to log :trace to a file and `:info` to stdout, you must set the
|
553
|
+
global log level to `:trace`, and limit the stdout appender to `:info`:
|
554
|
+
|
555
|
+
```yaml
|
556
|
+
logger:
|
557
|
+
level: :trace
|
558
|
+
appenders:
|
559
|
+
- type: stdout
|
560
|
+
level: :info
|
561
|
+
- type: file
|
562
|
+
file: ~/.config/oxidized/trace.log
|
563
|
+
```
|
564
|
+
|
565
|
+
### Change log level
|
566
|
+
You can change the global log level of oxidized by sending a SIGUSR2 to
|
567
|
+
the process:
|
568
|
+
```
|
569
|
+
kill -SIGUSR2 424242
|
570
|
+
```
|
571
|
+
It will rotate between the log levels and log a warning with the new level
|
572
|
+
(you won't see the warning when the log level is `:fatal` or `:error`):
|
573
|
+
```
|
574
|
+
2025-06-30 15:25:27.972881 W [109750:2640] SemanticLogger -- Changed global default log level to :warn
|
575
|
+
```
|
576
|
+
|
577
|
+
If you specified a log level for an appender, this log level won't be
|
578
|
+
changed.
|
579
|
+
|
580
|
+
> :warning: **Warning** This currently does not work when oxidized-web is used
|
581
|
+
> and will kill the whole oxidized application. This will be corrected in a
|
582
|
+
> future release of oxidized-web.
|
583
|
+
|
584
|
+
### Dump running threads
|
585
|
+
With the SIGTTIN signal, oxidized will log a backtrace for each of its threads.
|
586
|
+
```
|
587
|
+
kill -SIGTTIN 424242
|
588
|
+
```
|
589
|
+
|
590
|
+
The threads used to fetch the configs are named `Oxidized::Job 'hostname'`:
|
591
|
+
|
592
|
+
```
|
593
|
+
2025-06-30 15:32:22.293047 W [110549:2640 core.rb:76] Thread Dump -- Backtrace:
|
594
|
+
/home/xxx/oxidized/lib/oxidized/core.rb:76:in `sleep'
|
595
|
+
/home/xxx/oxidized/lib/oxidized/core.rb:76:in `block in run'
|
596
|
+
(...)
|
597
|
+
2025-06-30 15:32:22.293409 W [110549:Oxidized::Job 'host2' ssh.rb:127] Thread Dump -- Backtrace:
|
598
|
+
/home/xxx/oxidized/lib/oxidized/input/ssh.rb:127:in `sleep'
|
599
|
+
/home/xxx/oxidized/lib/oxidized/input/ssh.rb:127:in `block (2 levels) in expect'
|
600
|
+
```
|
data/docs/DeviceSimulation.md
CHANGED
@@ -21,7 +21,7 @@ information is the responses to the commands used in the Oxidized models.
|
|
21
21
|
|
22
22
|
The YAML simulation files are stored under
|
23
23
|
[/spec/model/data/](/spec/model/data/), with the naming convention
|
24
|
-
`<model
|
24
|
+
`<model>#<description>#simulation.yaml`, where `<model>` is the lowercase name
|
25
25
|
of the Oxidized model and `<description>` is the name of the test case.
|
26
26
|
`<description>` is generally formatted as `<hardware>_<software>` or
|
27
27
|
`<hardware>_<software>_<information>`.
|
@@ -61,6 +61,7 @@ Usages:
|
|
61
61
|
-o, --output file Specify an output YAML-file
|
62
62
|
-t, --timeout value Specify the idle timeout beween commands (default: 5 seconds)
|
63
63
|
-e, --exec-mode Run ssh in exec mode (without tty)
|
64
|
+
-u, --unordered The YAML simulation should not enforce an order of the commands
|
64
65
|
-h, --help Print this help
|
65
66
|
```
|
66
67
|
|
@@ -80,10 +81,16 @@ output of the command is shortened or slips into the next command in the YAML
|
|
80
81
|
file. You will have to change the idle timeout to a greater value to address
|
81
82
|
this.
|
82
83
|
- When run without the output argument, `device2yaml.rb` will only print the SSH
|
83
|
-
output to the standard output. You must use `-o <model
|
84
|
+
output to the standard output. You must use `-o <model#HW_SW#simulation.yaml>`
|
84
85
|
to store the collected data in a YAML file.
|
85
86
|
- If your Oxidized model uses SSH exec mode (look for `exec true` in the model),
|
86
87
|
you will have to use the option `-e` to run `device2yaml.rb` in SSH exec mode.
|
88
|
+
- The default behavior is to create a YAML file in which the commands must
|
89
|
+
appear in the order used in the Oxidized model. This is useful for simulating
|
90
|
+
devices that paginate output. To allow any order or include more commands than
|
91
|
+
the model uses, use the option `-u`. Note that the `unordered` mode may not
|
92
|
+
produce a useful YAML file when combined with user input (see
|
93
|
+
[Interactive Mode](#interactive-mode) below).
|
87
94
|
|
88
95
|
Note that `device2yaml.rb` takes some time to run because of the idle timeout of
|
89
96
|
(default) 5 seconds between each command. You can press the "Escape" key if you
|
@@ -100,7 +107,7 @@ show version
|
|
100
107
|
show vtp status
|
101
108
|
show inventory
|
102
109
|
show running-config
|
103
|
-
exit" -o spec/model/data/ios
|
110
|
+
exit" -o spec/model/data/ios#C8200L_16.12.1#simulation.yaml
|
104
111
|
```
|
105
112
|
### Publishing the YAML Simulation File to Oxidized
|
106
113
|
Publishing the YAML simulation file of your device helps maintain Oxidized. This
|
@@ -124,7 +131,7 @@ change the hostname everywhere.
|
|
124
131
|
|
125
132
|
The YAML simulation files are stored under
|
126
133
|
[/spec/model/data/](/spec/model/data/), with the naming convention
|
127
|
-
`<model
|
134
|
+
`<model>#<description>#simulation.yaml`, where `<model>` is the lowercase name
|
128
135
|
of the Oxidized model and `<description>` is the name of the test case.
|
129
136
|
`<description>` is generally formatted as `<hardware>_<software>` or
|
130
137
|
`<hardware>_<software>_<information>`.
|
@@ -134,9 +141,9 @@ automatic model unit tests.
|
|
134
141
|
|
135
142
|
Examples:
|
136
143
|
|
137
|
-
- spec/model/data/aoscx
|
138
|
-
- spec/model/data/asa
|
139
|
-
- spec/model/data/ios
|
144
|
+
- spec/model/data/aoscx#R0X25A-6410_FL.10.10.1100#simulation.yaml
|
145
|
+
- spec/model/data/asa#5512_9.12-4-67_single-context#simulation.yaml
|
146
|
+
- spec/model/data/ios#C9200L-24P-4G_17.09.04a#simulation.yaml
|
140
147
|
|
141
148
|
When you are finished, commit and push to your forked repository on GitHub, and
|
142
149
|
submit a Pull Request. Thank you for your help!
|
@@ -153,6 +160,11 @@ page.
|
|
153
160
|
|
154
161
|
You can also use this to enter an enable password.
|
155
162
|
|
163
|
+
Every key press will be recorded in the YAML file, so that it can be used
|
164
|
+
in the simulation afterwards, especialy for devices that paginate output. You
|
165
|
+
may need to clean the YAML file manually if you don't want some input (such
|
166
|
+
as passwords) to be included.
|
167
|
+
|
156
168
|
If you press the "Esc" key, `device2yaml.rb` will not wait for the idle timeout
|
157
169
|
and will process the next command right away.
|
158
170
|
|