mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Availability-map
- Availability-map - Maps submenu - Remove old network-map menu entry
This commit is contained in:
@ -67,11 +67,14 @@ if ($_SESSION['userlevel'] >= '10') {
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown-submenu">
|
||||
<a href="<?php echo(generate_url(array('page'=>'overview'))); ?>"><i class="fa fa-sitemap fa-fw fa-lg"></i> Maps</a>
|
||||
<ul class="dropdown-menu scrollable-menu">
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'availability-map'))); ?>"><i class="fa fa-arrow-circle-up fa-fw fa-lg"></i> Availability</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
<?php if (isset($config['enable_map']) && $config['enable_map']) {
|
||||
echo(' <li><a href="'.generate_url(array('page'=>'overview')).'"><i class="fa fa-globe fa-fw fa-lg"></i> Network Map</a></li>');
|
||||
} ?>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'eventlog'))); ?>"><i class="fa fa-book fa-fw fa-lg"></i> Eventlog</a></li>
|
||||
<?php if (isset($config['enable_syslog']) && $config['enable_syslog']) {
|
||||
echo(' <li><a href="'.generate_url(array('page'=>'syslog')).'"><i class="fa fa-book fa-fw fa-lg"></i> Syslog</a></li>');
|
||||
|
40
html/pages/availability-map.inc.php
Normal file
40
html/pages/availability-map.inc.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($_SESSION['userlevel'] >= '10') {
|
||||
$sql = "SELECT `hostname`,`device_id`,`status`,`uptime` FROM `devices` WHERE `ignore` = '0' AND `disabled` = '0' ORDER BY `hostname`";
|
||||
$sqlcount = "SELECT COUNT(*) FROM `devices` WHERE `ignore` = '0' AND `disabled` = '0' ORDER BY `hostname`";
|
||||
$rows = dbFetchCell($sqlcount);
|
||||
echo "<div style='max-width:800px; margin-left:auto; margin-right:auto;'><center><h3>All Devices(" . $rows . ")</h3></center>";
|
||||
}
|
||||
else {
|
||||
$sql = "SELECT D.`hostname`,D.`device_id`,D.`status`,D.`uptime` FROM `devices` AS D, `devices_perms` AS P WHERE D.`device_id` = P.`device_id` AND P.`user_id` = '" . $_SESSION['user_id'] . "' AND D.`ignore` = '0' AND D.`disabled` = '0' ORDER BY D.`hostname`";
|
||||
$sqlcount = "SELECT COUNT(*) FROM `devices` AS D, `devices_perms` AS P WHERE D.`device_id` = P.`device_id` AND P.`user_id` = '" . $_SESSION['user_id'] . "' AND D.`ignore` = '0' AND D.`disabled` = '0' ORDER BY D.`hostname`";
|
||||
$rows = dbFetchCell($sqlcount);
|
||||
echo "<div style='max-width:800px; margin-left:auto; margin-right:auto;'><center><h3>All Devices(" . $rows . ")</h3></center>";
|
||||
}
|
||||
|
||||
foreach(dbFetchRows($sql) as $device) {
|
||||
if ($device['status'] == '1') {
|
||||
$btn_type = 'btn-success';
|
||||
if ($device['uptime'] < $config['uptime_warning']) {
|
||||
$btn_type = 'btn-warning';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$btn_type = 'btn-danger';
|
||||
}
|
||||
|
||||
echo "<a href='/graphs/type=device_uptime/device=" . $device['device_id'] . "/' role='button' class='btn " . $btn_type . " btn-xs' title='" . $device['hostname'] . "' style='min-height:25px; min-width:25px; border-radius:0px;'></a>";
|
||||
}
|
||||
|
||||
echo "</div>";
|
Reference in New Issue
Block a user