Added support for os in oxidized groups

This commit is contained in:
laf
2016-03-05 00:48:51 +00:00
parent 7ea7bd4c92
commit f0fb602046
2 changed files with 15 additions and 1 deletions
+7 -1
View File
@@ -62,7 +62,7 @@ $config['oxidized']['reload_nodes'] = TRUE;
#### 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:
```php
@@ -70,6 +70,12 @@ $config['oxidized']['group']['hostname'][] = array('regex' => '/^lon-sw/', 'grou
$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:
```bash
+8
View File
@@ -953,6 +953,14 @@ function list_oxidized() {
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'])) {
foreach ($config['oxidized']['group']['location'] as $host_group) {
if (preg_match($host_group['regex'].'i', $device['location'])) {