mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-03 00:11:49 +02:00
Merge pull request #3168 from laf/oxidized-os
This commit is contained in:
@@ -62,7 +62,7 @@ $config['oxidized']['reload_nodes'] = TRUE;
|
|||||||
|
|
||||||
#### Using Groups
|
#### Using Groups
|
||||||
|
|
||||||
To return a group to Oxidized you can do this by matching a regex for either hostname or location. The order is hostname is matched first, if nothing is found then location is attempted.
|
To return a group to Oxidized you can do this by matching a regex for either hostname, os or location. The order is hostname is matched first, if nothing is found then os is tried and then location is attempted.
|
||||||
The first match found will be used. To match on the device hostnames that contain 'lon-sw' or if the location contains 'London' then you would place the following within config.php:
|
The first match found will be used. To match on the device hostnames that contain 'lon-sw' or if the location contains 'London' then you would place the following within config.php:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
@@ -70,6 +70,12 @@ $config['oxidized']['group']['hostname'][] = array('regex' => '/^lon-sw/', 'grou
|
|||||||
$config['oxidized']['group']['location'][] = array('regex' => '/london/', 'group' => 'london-switches');
|
$config['oxidized']['group']['location'][] = array('regex' => '/london/', 'group' => 'london-switches');
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To match on a device os of edgeos then please use the following:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$config['oxidized']['group']['os'][] = array('match' => 'edgeos', 'group' => 'wireless');
|
||||||
|
```
|
||||||
|
|
||||||
If you need to, you can specify credentials for groups by using the following in your Oxidized config:
|
If you need to, you can specify credentials for groups by using the following in your Oxidized config:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -953,6 +953,14 @@ function list_oxidized() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (empty($device['group'])) {
|
||||||
|
foreach ($config['oxidized']['group']['os'] as $host_group) {
|
||||||
|
if ($host_group['match'] === $device['os']) {
|
||||||
|
$device['group'] = $host_group['group'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (empty($device['group'])) {
|
if (empty($device['group'])) {
|
||||||
foreach ($config['oxidized']['group']['location'] as $host_group) {
|
foreach ($config['oxidized']['group']['location'] as $host_group) {
|
||||||
if (preg_match($host_group['regex'].'i', $device['location'])) {
|
if (preg_match($host_group['regex'].'i', $device['location'])) {
|
||||||
|
|||||||
Reference in New Issue
Block a user