Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #246 from bohdan-s/statuspage
Public status page for all active devices
- Loading branch information
Showing
4 changed files
with
149 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/* | ||
* This file is part of LibreNMS | ||
* | ||
* Copyright (c) 2014 Bohdan Sanders <http://bohdans.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. | ||
*/ | ||
?> | ||
<?php | ||
|
||
if ($bg == $list_colour_b) { $bg = $list_colour_a; } else { $bg = $list_colour_b; } | ||
|
||
if ($device['status'] == '0') | ||
{ | ||
$class = "bg-danger"; | ||
} else { | ||
$class = "bg-primary"; | ||
} | ||
if ($device['ignore'] == '1') | ||
{ | ||
$class = "bg-warning"; | ||
if ($device['status'] == '1') | ||
{ | ||
$class = "bg-success"; | ||
} | ||
} | ||
if ($device['disabled'] == '1') | ||
{ | ||
$class = "bg-info"; | ||
} | ||
|
||
$type = strtolower($device['os']); | ||
|
||
if ($device['os'] == "ios") { formatCiscoHardware($device, true); } | ||
$device['os_text'] = $config['os'][$device['os']]['text']; | ||
|
||
echo(' <tr> | ||
<td class="'. $class .' "></td> | ||
<td>' . $image . '</td> | ||
<td><span style="font-size: 15px;">' . generate_device_link($device) . '</span></td>' | ||
); | ||
|
||
echo('<td>'); | ||
if ($port_count) { echo(' <img src="images/icons/port.png" align=absmiddle /> '.$port_count); } | ||
echo('<br />'); | ||
if ($sensor_count) { echo(' <img src="images/icons/sensors.png" align=absmiddle /> '.$sensor_count); } | ||
echo('</td>'); | ||
echo(' <td>' . $device['hardware'] . ' ' . $device['features'] . '</td>'); | ||
echo(' <td>' . formatUptime($device['uptime'], 'short') . ' <br />'); | ||
|
||
if (get_dev_attrib($device,'override_sysLocation_bool')) { $device['location'] = get_dev_attrib($device,'override_sysLocation_string'); } | ||
echo(' ' . truncate($device['location'],32, '') . '</td>'); | ||
|
||
echo(' </tr>'); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
/* | ||
* This file is part of LibreNMS | ||
* | ||
* Copyright (c) 2014 Bohdan Sanders <http://bohdans.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. | ||
*/ | ||
?> | ||
|
||
<script class="code" type="text/javascript"> | ||
$(document).ready(function() { | ||
$("#ToggleLogon").click( function() | ||
{ | ||
document.getElementById('public-logon').style.display="block"; | ||
document.getElementById('public-status').style.display="none"; | ||
}); | ||
$("#ToggleStatus").click( function() | ||
{ | ||
document.getElementById('public-logon').style.display="none"; | ||
document.getElementById('public-status').style.display="block"; | ||
}); | ||
}); | ||
</script> | ||
|
||
<?php | ||
|
||
// Set Defaults here | ||
|
||
$sql_param = array(); | ||
$pagetitle[] = "Public Devices"; | ||
|
||
$query = "SELECT * FROM `devices` WHERE 1 AND disabled='0' AND `ignore`='0' ORDER BY hostname"; | ||
|
||
?> | ||
<div class="well"><h3>System Status<button class="btn btn-default" type="submit" style="float:right;" id="ToggleLogon">Logon</button></h3></div> | ||
<div class="panel panel-default panel-condensed"> | ||
<div class="table-responsive"> | ||
<table class="table table-condensed"> | ||
<tr> | ||
<th></th> | ||
<th></th> | ||
<th>Device</th> | ||
<th></th> | ||
<th>Platform</th> | ||
<th>Uptime/Location</th> | ||
</tr> | ||
<?php | ||
foreach (dbFetchRows($query, $sql_param) as $device) | ||
{ | ||
include("includes/hostbox-public.inc.php"); | ||
} | ||
?> | ||
</table> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters