mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
First Status page
This commit is contained in:
+14
-3
@@ -205,9 +205,20 @@ if ($_SESSION['authenticated'])
|
||||
}
|
||||
|
||||
} else {
|
||||
// Not Authenticated. Print login.
|
||||
include("pages/logon.inc.php");
|
||||
|
||||
// Not Authenticated. Show status page if enabled
|
||||
if ( $config['public_status'] )
|
||||
{
|
||||
if (isset($vars['page']) && strstr("login", $vars['page']))
|
||||
{
|
||||
include("pages/logon.inc.php");
|
||||
} else {
|
||||
include("pages/public.inc.php");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
include("pages/logon.inc.php");
|
||||
}
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
<?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>
|
||||
@@ -118,6 +118,7 @@ $config['page_title_suffix'] = $config['project_name'];
|
||||
$config['timestamp_format'] = 'd-m-Y H:i:s';
|
||||
$config['page_gen'] = 0; # display MySqL & PHP stats in footer?
|
||||
$config['login_message'] = "Unauthorised access or use shall render the user liable to criminal and/or civil prosecution.";
|
||||
$config['public_status'] = false; // Enable public accessable status page
|
||||
|
||||
$config['old_graphs'] = 1; // RRDfiles from before the great rra reform. This is default for a while.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user