mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
allow the ability to rewrite locations
git-svn-id: http://www.observium.org/svn/observer/trunk@3180 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -269,6 +269,11 @@ $config['nfsen_enable'] = 0;
|
||||
#$config['nfsen_rrds'] = "/var/nfsen/profiles-stat/live/";
|
||||
#$config['nfsen_suffix'] = "_yourdomain_com";
|
||||
|
||||
### Location Mapping
|
||||
### Use this feature to map ugly locations to pretty locations
|
||||
#config['location_map']['Under the Sink'] = "Under The Sink, The Office, London, UK";
|
||||
|
||||
|
||||
### Ignores & Allows
|
||||
# Has to be lowercase
|
||||
|
||||
|
||||
@@ -82,6 +82,13 @@
|
||||
}
|
||||
|
||||
$poll_device['sysLocation'] = str_replace("\"","", $poll_device['sysLocation']);
|
||||
|
||||
/// Rewrite sysLocation if there is a mapping array (database too?)
|
||||
if(!empty($poll_device['sysLocation']) && is_array($config['location_map']))
|
||||
{
|
||||
$poll_device['sysLocation'] = rewrite_location($poll_device['sysLocation']);
|
||||
}
|
||||
|
||||
$poll_device['sysContact'] = str_replace("\"","", $poll_device['sysContact']);
|
||||
|
||||
if ($poll_device['sysLocation'] == "not set")
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
<?php
|
||||
|
||||
|
||||
function rewrite_location($location){
|
||||
|
||||
// FIXME -- also check the database for rewrites?
|
||||
|
||||
global $config;
|
||||
global $debug;
|
||||
|
||||
if(isset($config['location_map'][$location]))
|
||||
{
|
||||
$location = $config['location_map'][$location];
|
||||
}
|
||||
return $location;
|
||||
|
||||
}
|
||||
|
||||
function formatMac($mac)
|
||||
{
|
||||
$mac = preg_replace("/(..)(..)(..)(..)(..)(..)/", "\\1:\\2:\\3:\\4:\\5:\\6", $mac);
|
||||
|
||||
Reference in New Issue
Block a user