Added Performance menu to System and add pollers page

This commit is contained in:
laf 2015-03-02 17:02:28 +00:00
parent fe06a0a443
commit d780a4d214
3 changed files with 92 additions and 0 deletions

View File

@ -446,6 +446,13 @@ if ($_SESSION['userlevel'] >= '10')
<li><a href="edituser/"><img src="images/16/user_edit.png" border="0" align="absmiddle" /> Edit User</a></li>
<li><a href="authlog/"><img src="images/16/lock.png" border="0" align="absmiddle" /> Authlog</a></li>
<li role="presentation" class="divider"></li>
<li class="dropdown-submenu">
<a href="#"><img src="images/16/clock.png" alt="Performance" width="16" height="16" /> Performance</a>
<ul class="dropdown-menu scrollable-menu">
<li><a href="/performance/tab=pollers/"><img src="images/16/clock_link.png" alt="Pollers" width="16" height="16" /> Pollers</a></li>
</ul>
</li>
<li role="presentation" class="divider"></li>
<li class="dropdown-submenu">
<a href="#"><img src="images/16/building.png" border="0" align="absmiddle" /> API</a>
<ul class="dropdown-menu scrollable-menu">

View File

@ -0,0 +1,33 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
*
* 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.
*/
echo('<ul class="nav nav-tabs">');
$perf_tabs = array(array("name" => 'Pollers', 'icon' => 'clock_link'));
foreach ($perf_tabs as $tab) {
echo('
<li>
<a href="/performance/'. lcfirst($tab["name"]) .'">
<img src="images/16/'. $tab["icon"] .'.png" align="absmiddle" border="0"> ' . $tab["name"] . '
</a>
</li>');
}
echo ('</ul>');
if (isset($vars['tab'])) {
require_once "pages/performance/".mres($vars['tab']).".inc.php";
}

View File

@ -0,0 +1,52 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
*
* 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.
*/
?>
<br />
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-condensed">
<tr>
<th>Poller Name</th>
<th>Devices Polled</th>
<th>Total Poll Time</th>
<th>Last Ran</th>
</tr>
<?php
$query = "SELECT *,UNIX_TIMESTAMP(NOW()) AS `now`, UNIX_TIMESTAMP(`last_polled`) AS `then` FROM `pollers`";
foreach (dbFetchRows($query) as $poller) {
$old = $poller['now'] - $poller['then'];
if ($old > 600) {
$row_class = 'danger';
} elseif ($old >= 280 && $old <= 300) {
$row_class = 'warning';
} else {
$row_class = 'success';
}
echo('
<tr class="'.$row_class.'">
<td>'.$poller['poller_name'].'</td>
<td>'.$poller['devices'].'</td>
<td>'.$poller['time_taken'].' Seconds</td>
<td>'.$poller['last_polled'].'</td>
</tr>
');
}
?>
</table>
</div>