mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 00:25:06 +02:00
@@ -322,6 +322,16 @@ by continuing the array.
|
||||
`bad_iftype` is matched against the ifType value.
|
||||
`bad_if_regexp` is matched against the ifDescr value as a regular expression.
|
||||
|
||||
#### Interfaces to be rewritten
|
||||
|
||||
```php
|
||||
$config['rewrite_if']['cpu'] = 'Management Interface';
|
||||
$config['rewrite_if_regexp']['/cpu /'] = 'Management ';
|
||||
```
|
||||
Entries defined in `rewrite_if` are being replaced completely.
|
||||
Entries defined in `rewrite_if_regexp` only replace the match.
|
||||
Matches are compared case-insensitive.
|
||||
|
||||
#### Storage configuration
|
||||
|
||||
```php
|
||||
|
||||
@@ -82,6 +82,22 @@ function ifLabel($interface, $device = NULL)
|
||||
list($interface['label']) = explode("thomson", $interface['label']);
|
||||
}
|
||||
|
||||
if( is_array($config['rewrite_if']) ) {
|
||||
foreach( $config['rewrite_if'] as $src => $val ) {
|
||||
if( stristr($interface['label'], $src) ) {
|
||||
$interface['label'] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( is_array($config['rewrite_if_regexp']) ) {
|
||||
foreach( $config['rewrite_if_regexp'] as $reg => $val ) {
|
||||
if( preg_match($reg."i", $interface['label']) ) {
|
||||
$interface['label'] = preg_replace($reg."i",$val,$interface['label']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $interface;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user