mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added config options for region and resolution for the globe.php frontpage
$config['frontpage_globe']['region'] = any of https://developers.google.com/chart/interactive/docs/gallery/geochart#Continent_Hierarchy $config['frontpage_globe']['resolution'] = countries|provinces|metros $config['frontpage_globe']['markers'] = devices|ports
This commit is contained in:
@@ -43,7 +43,7 @@ foreach (getlocations() as $location) {
|
|||||||
$count = 0;
|
$count = 0;
|
||||||
$down = 0;
|
$down = 0;
|
||||||
foreach (dbFetchRows("SELECT devices.device_id,devices.hostname,devices.status FROM devices LEFT JOIN devices_attribs ON devices.device_id = devices_attribs.device_id WHERE ( devices.location = ? || ( devices_attribs.attrib_type = 'override_sysLocation_string' && devices_attribs.attrib_value = ? ) ) && devices.disabled = 0 && devices.ignore = 0 GROUP BY devices.hostname", array($location,$location)) as $device) {
|
foreach (dbFetchRows("SELECT devices.device_id,devices.hostname,devices.status FROM devices LEFT JOIN devices_attribs ON devices.device_id = devices_attribs.device_id WHERE ( devices.location = ? || ( devices_attribs.attrib_type = 'override_sysLocation_string' && devices_attribs.attrib_value = ? ) ) && devices.disabled = 0 && devices.ignore = 0 GROUP BY devices.hostname", array($location,$location)) as $device) {
|
||||||
if( $config['frontpage_custom']['globe'] == 'devices' || empty($config['frontpage_custom']['globe']) ) {
|
if( $config['frontpage_globe']['markers'] == 'devices' || empty($config['frontpage_globe']['markers']) ) {
|
||||||
$devices[] = $device['hostname'];
|
$devices[] = $device['hostname'];
|
||||||
$count++;
|
$count++;
|
||||||
if( $device['status'] == "0" ) {
|
if( $device['status'] == "0" ) {
|
||||||
@@ -52,7 +52,7 @@ foreach (getlocations() as $location) {
|
|||||||
} else {
|
} else {
|
||||||
$devices_up[] = $device;
|
$devices_up[] = $device;
|
||||||
}
|
}
|
||||||
} elseif( $config['frontpage_custom']['globe'] == 'ports' ) {
|
} elseif( $config['frontpage_globe']['markers'] == 'ports' ) {
|
||||||
foreach( dbFetchRows("SELECT ifName,ifOperStatus,ifAdminStatus FROM ports WHERE ports.device_id = ? && ports.ignore = 0 && ports.disabled = 0 && ports.deleted = 0",array($device['device_id'])) as $port ) {
|
foreach( dbFetchRows("SELECT ifName,ifOperStatus,ifAdminStatus FROM ports WHERE ports.device_id = ? && ports.ignore = 0 && ports.disabled = 0 && ports.deleted = 0",array($device['device_id'])) as $port ) {
|
||||||
$count++;
|
$count++;
|
||||||
if( $port['ifOperStatus'] == 'down' && $port['ifAdminStatus'] == 'up' ) {
|
if( $port['ifOperStatus'] == 'down' && $port['ifAdminStatus'] == 'up' ) {
|
||||||
@@ -65,9 +65,9 @@ foreach (getlocations() as $location) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$pdown = ($down / $count)*100;
|
$pdown = ($down / $count)*100;
|
||||||
if( $config['frontpage_custom']['globe'] == 'devices' || empty($config['frontpage_custom']['globe']) ) {
|
if( $config['frontpage_globe']['markers'] == 'devices' || empty($config['frontpage_globe']['markers']) ) {
|
||||||
$devices_down = array_merge(array(count($devices_up). " Devices OK"), $devices_down);
|
$devices_down = array_merge(array(count($devices_up). " Devices OK"), $devices_down);
|
||||||
} elseif( $config['frontpage_custom']['globe'] == 'ports' ) {
|
} elseif( $config['frontpage_globe']['markers'] == 'ports' ) {
|
||||||
$devices_down = array_merge(array(count($devices_up). " Ports OK"), $devices_down);
|
$devices_down = array_merge(array(count($devices_up). " Ports OK"), $devices_down);
|
||||||
}
|
}
|
||||||
$locations[] = " ['".$location."', ".$pdown.", ".$count.", '".implode(",<br/> ", $devices_down)."']";
|
$locations[] = " ['".$location."', ".$pdown.", ".$count.", '".implode(",<br/> ", $devices_down)."']";
|
||||||
@@ -77,8 +77,8 @@ echo implode(",\n", $locations);
|
|||||||
|
|
||||||
]);
|
]);
|
||||||
var options = {
|
var options = {
|
||||||
region: 'world',
|
region: '<?php echo($config['frontpage_globe']['region'] ? $config['frontpage_globe']['region'] : "world") ?>',
|
||||||
resolution: 'countries',
|
resolution: '<?php echo($config['frontpage_globe']['resolution'] ? $config['frontpage_globe']['resolution'] : "countries") ?>',
|
||||||
displayMode: 'markers',
|
displayMode: 'markers',
|
||||||
keepAspectRatio: 1,
|
keepAspectRatio: 1,
|
||||||
magnifyingGlass: {enable: true, zoomFactor: 100},
|
magnifyingGlass: {enable: true, zoomFactor: 100},
|
||||||
|
|||||||
Reference in New Issue
Block a user