mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
117 lines
4.4 KiB
PHP
117 lines
4.4 KiB
PHP
<?php
|
|
|
|
// Set Defaults here
|
|
|
|
if(!isset($vars['format'])) { $vars['format'] = "list_detail"; }
|
|
|
|
$sql_param = array();
|
|
if(isset($vars['state']))
|
|
{
|
|
if($vars['state'] == 'up')
|
|
{
|
|
$state = '1';
|
|
}
|
|
elseif($vars['state'] == 'down')
|
|
{
|
|
$state = '0';
|
|
}
|
|
}
|
|
|
|
if ($vars['hostname']) { $where .= " AND hostname LIKE ?"; $sql_param[] = "%".$vars['hostname']."%"; }
|
|
if ($vars['os']) { $where .= " AND os = ?"; $sql_param[] = $vars['os']; }
|
|
if ($vars['version']) { $where .= " AND version = ?"; $sql_param[] = $vars['version']; }
|
|
if ($vars['hardware']) { $where .= " AND hardware = ?"; $sql_param[] = $vars['hardware']; }
|
|
if ($vars['features']) { $where .= " AND features = ?"; $sql_param[] = $vars['features']; }
|
|
if ($vars['type']) { $where .= " AND type = ?"; $sql_param[] = $vars['type']; }
|
|
if ($vars['state']) {
|
|
$where .= " AND status= ?"; $sql_param[] = $state;
|
|
$where .= " AND disabled='0' AND `ignore`='0'"; $sql_param[] = '';
|
|
}
|
|
if ($vars['disabled']) { $where .= " AND disabled= ?"; $sql_param[] = $vars['disabled']; }
|
|
if ($vars['ignore']) { $where .= " AND `ignore`= ?"; $sql_param[] = $vars['ignore']; }
|
|
|
|
$pagetitle[] = "Public Devices";
|
|
|
|
//print_optionbar_end();
|
|
|
|
echo '<div class="well"><h3>System Status</h3></div>';
|
|
|
|
$query = "SELECT * FROM `devices` WHERE 1 ".$where." ORDER BY hostname";
|
|
|
|
list($format, $subformat) = explode("_", $vars['format']);
|
|
|
|
if($format == "graph")
|
|
{
|
|
$row = 1;
|
|
foreach (dbFetchRows($query, $sql_param) as $device)
|
|
{
|
|
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
|
|
|
if (device_permitted($device['device_id']))
|
|
{
|
|
if (!$location_filter || ((get_dev_attrib($device,'override_sysLocation_bool') && get_dev_attrib($device,'override_sysLocation_string') == $location_filter)
|
|
|| $device['location'] == $location_filter))
|
|
{
|
|
$graph_type = "device_".$subformat;
|
|
|
|
if ($_SESSION['widescreen']) { $width=270; } else { $width=315; }
|
|
|
|
echo("<div style='display: block; padding: 1px; margin: 2px; min-width: ".($width+78)."px; max-width:".($width+78)."px; min-height:170px; max-height:170px; text-align: center; float: left; background-color: #f5f5f5;'>
|
|
<a href='device/device=".$device['device_id']."/' onmouseover=\"return overlib('\
|
|
<div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname']." - ".$interface['ifDescr']."</div>\
|
|
<img src=\'graph.php?type=$graph_type&device=".$device['device_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=450&height=150&title=yes\'>\
|
|
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
|
|
"<img src='graph.php?type=$graph_type&device=".$device['device_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=".$width."&height=110&legend=no&title=yes'>
|
|
</a>
|
|
</div>");
|
|
}
|
|
}
|
|
}
|
|
|
|
} else {
|
|
|
|
echo('<div class="panel panel-default panel-condensed">
|
|
<div class="table-responsive">
|
|
<table class="table table-condensed">');
|
|
if ($subformat == "detail" || $subformat == "basic")
|
|
{
|
|
echo('<tr>
|
|
<th></th>
|
|
<th></th>
|
|
<th>Device</th>
|
|
<th></th>
|
|
<th>Platform</th>
|
|
<th>Operating System</th>
|
|
<th>Uptime/Location</th>
|
|
</tr>');
|
|
}
|
|
|
|
foreach (dbFetchRows($query, $sql_param) as $device)
|
|
{
|
|
if (!device_permitted($device['device_id']))
|
|
{
|
|
include("includes/hostbox-basic.inc.php");
|
|
}
|
|
}
|
|
echo("</table>");
|
|
echo('</div>');
|
|
echo('</div>');
|
|
}
|
|
|
|
?>
|
|
<footer>
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-md-12 text-center">
|
|
<?php
|
|
echo(' <br /> <br /> ' . (isset($config['footer']) ? $config['footer'] : ''));
|
|
echo(' <br /><a href="' . $config['site_url'] . 'login/" target="_self">Admins Logon Here</a>. ');
|
|
echo(' <br />Powered by <a href="' . $config['project_url'] . '" target="_blank">' . $config['project_name_version'].'</a>. ');
|
|
echo( $config['project_name'].' is <a href="http://www.gnu.org/philosophy/free-sw.html">Free Software</a>, released under the <a href="http://www.gnu.org/copyleft/gpl.html">GNU GPLv3</a>.<br/>');
|
|
echo(' Copyright © 2006-2012 by Adam Armstrong. Copyright © 2013-'.date("Y").' by the '.$config['project_name'].' Contributors.');
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</footer>
|