Submitting change to oxidized group api to include device purpose or device notes (#13976)

This commit is contained in:
sajiby3k 2022-05-14 19:13:44 +02:00 committed by GitHub
parent d57b225d5d
commit a7147a17e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -135,7 +135,7 @@ check for the validity of these attributes but will deliver them to
Oxidized as defined.
Matching of hosts can be done using `hostname`, `sysname`, `os`,
`location`, `sysDescr` or `hardware` and including either a 'match'
`location`, `sysDescr`, `hardware`, `purpose` or `notes` and including either a 'match'
key and value, or a 'regex' key and value. The order of matching is:
- `hostname`
@ -145,6 +145,8 @@ key and value, or a 'regex' key and value. The order of matching is:
- `os`
- `location`
- `ip`
- `purpose`
- `notes`
To match on the device hostnames or sysNames that contain 'lon-sw' or
if the location contains 'London' then you would set the following:
@ -166,6 +168,14 @@ To match on a device os of edgeos then please use the following:
Matching on OS requires system name of the OS. For example, "match": "RouterOS"
will not work, while "match": "routeros" will.
To match on a device purpose or device notes that contains 'lon-net' then you would set the following:
!!! setting "external/oxidized"
```bash
lnms config:set oxidized.maps.group.purpose.+ '{"regex": "/^lon-sw/", "value": "london-network"}'
lnms config:set oxidized.maps.group.notes.+ '{"regex": "/^lon-sw/", "value": "london-network"}'
```
To edit an existing map, you must use the index to override it.
!!! setting "external/oxidized"

View File

@ -1465,7 +1465,7 @@ function list_oxidized(Illuminate\Http\Request $request)
->whereNotIn('type', Config::get('oxidized.ignore_types', []))
->whereNotIn('os', Config::get('oxidized.ignore_os', []))
->whereAttributeDisabled('override_Oxidized_disable')
->select(['hostname', 'sysName', 'sysDescr', 'sysObjectID', 'hardware', 'os', 'ip', 'location_id'])
->select(['hostname', 'sysName', 'sysDescr', 'sysObjectID', 'hardware', 'os', 'ip', 'location_id', 'purpose', 'notes'])
->get();
/** @var Device $device */