Skip to content

Commit

Permalink
Submitting change to oxidized group api to include device purpose or …
Browse files Browse the repository at this point in the history
…device notes (librenms#13976)
  • Loading branch information
sajiby3k authored May 14, 2022
1 parent d57b225 commit a7147a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion doc/Extensions/Oxidized.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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:
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion includes/html/api_functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit a7147a1

Please sign in to comment.