mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge pull request #2969 from librenms/revert-2935-pblasquez-location_map_regex
Revert "Added location_map_regex"
This commit is contained in:
@@ -83,7 +83,6 @@ LibreNMS contributors:
|
||||
- Maximilian Wilhelm <max@rfc2324.org> (BarbarossaTM)
|
||||
- Jameson Finney <jameson.finney@gmail.com> (JamesonFinney)
|
||||
- John Wells <john.wells@greatworx.com> (jbwiv)
|
||||
- Paul Blasquez <pblasquez@gmail.com> (pblasquez)
|
||||
|
||||
[1]: http://observium.org/ "Observium web site"
|
||||
Observium was written by:
|
||||
|
@@ -379,15 +379,10 @@ NFSen integration support.
|
||||
|
||||
#### Location mapping
|
||||
|
||||
Exact Matching:
|
||||
```php
|
||||
$config['location_map']['Under the Sink'] = "Under The Sink, The Office, London, UK";
|
||||
```
|
||||
Regex Matching:
|
||||
```php
|
||||
$config['location_map']['/Sink/'] = "Under The Sink, The Office, London, UK";
|
||||
```
|
||||
The above are examples, these will rewrite device snmp locations so you don't need to configure full location within snmp.
|
||||
The above is an example, this will rewrite basic snmp locations so you don't need to configure full location within snmp.
|
||||
|
||||
#### Interfaces to be ignored
|
||||
|
||||
|
@@ -85,7 +85,7 @@ $poll_device['sysLocation'] = str_replace('"', '', $poll_device['sysLocation']);
|
||||
$poll_device['sysLocation'] = trim($poll_device['sysLocation'], '\\');
|
||||
|
||||
// Rewrite sysLocation if there is a mapping array (database too?)
|
||||
if (!empty($poll_device['sysLocation']) && (is_array($config['location_map']) || is_array($config['location_map_regex']))) {
|
||||
if (!empty($poll_device['sysLocation']) && is_array($config['location_map'])) {
|
||||
$poll_device['sysLocation'] = rewrite_location($poll_device['sysLocation']);
|
||||
}
|
||||
|
||||
|
@@ -5,15 +5,6 @@ function rewrite_location($location) {
|
||||
// FIXME -- also check the database for rewrites?
|
||||
global $config, $debug;
|
||||
|
||||
if (is_array($config['location_map_regex'])) {
|
||||
foreach ($config['location_map_regex'] as $reg => $val) {
|
||||
if (preg_match($reg, $location)) {
|
||||
$location = $val;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($config['location_map'][$location])) {
|
||||
$location = $config['location_map'][$location];
|
||||
}
|
||||
|
Reference in New Issue
Block a user