From 1110836662b8c12f402cd0a96a98bf56e0564da5 Mon Sep 17 00:00:00 2001 From: Daniel Preussker Date: Tue, 9 Feb 2016 20:00:54 +0100 Subject: [PATCH] Revert "Added location_map_regex" --- AUTHORS.md | 1 - doc/Support/Configuration.md | 7 +------ includes/polling/core.inc.php | 2 +- includes/rewrites.php | 9 --------- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index ad2afab6e..1aa5c18ff 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -83,7 +83,6 @@ LibreNMS contributors: - Maximilian Wilhelm (BarbarossaTM) - Jameson Finney (JamesonFinney) - John Wells (jbwiv) -- Paul Blasquez (pblasquez) [1]: http://observium.org/ "Observium web site" Observium was written by: diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index 8070df0ce..f37f7bc78 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -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 diff --git a/includes/polling/core.inc.php b/includes/polling/core.inc.php index 1af4e3b58..ec23309a2 100644 --- a/includes/polling/core.inc.php +++ b/includes/polling/core.inc.php @@ -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']); } diff --git a/includes/rewrites.php b/includes/rewrites.php index b4b28cd63..e2516d5c2 100644 --- a/includes/rewrites.php +++ b/includes/rewrites.php @@ -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]; }