Merge pull request #664 from Rosiak/PollLog1

Add Polling Information Page
This commit is contained in:
Neil Lathwood 2015-03-25 21:38:28 +00:00
commit b01c7051dc
2 changed files with 44 additions and 2 deletions

View File

@ -454,18 +454,24 @@ if ($_SESSION['userlevel'] >= '10')
<li><a href="authlog/"><img src="images/16/lock.png" border="0" align="absmiddle" /> Authlog</a></li>
<li role="presentation" class="divider"></li>
');
if($config['distributed_poller'] === TRUE) {
echo('
<li class="dropdown-submenu">
<a href="#"><img src="images/16/clock.png" alt="Pollers" width="16" height="16" /> Pollers</a>
<ul class="dropdown-menu scrollable-menu">
<li><a href="/poll-log/"><img src="images/16/information.png" alt="Poll-log" width="16" height="16" /> Poll-log</a></li>
');
if($config['distributed_poller'] === TRUE) {
echo ('
<li><a href="/pollers/tab=pollers/"><img src="images/16/clock_link.png" alt="Pollers" width="16" height="16" /> Pollers</a></li>
<li><a href="/pollers/tab=groups/"><img src="images/16/clock_add.png" alt="Groups" width="16" height="16" /> Groups</a></li>
');
}
echo ('
</ul>
</li>
<li role="presentation" class="divider"></li>
');
}
echo('
<li class="dropdown-submenu">

View File

@ -0,0 +1,36 @@
<?php
if ($_SESSION['userlevel'] >= '10') {
$sql = "SELECT D.device_id,D.hostname, D.last_polled, D.last_polled_timetaken FROM devices AS D WHERE D.status ='1' AND D.ignore='0' AND D.disabled='0' ORDER BY hostname";
$result = mysql_query($sql);
}
else {
$sql = "SELECT D.device_id,D.hostname, D.last_polled, D.last_polled_timetaken FROM devices AS D, devices_perms AS P WHERE D.status ='1' AND D.ignore='0' AND D.disabled='0' AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND D.ignore = '0' ORDER BY hostname";
$result = mysql_query($sql);
}
echo "
<table class='table table-bordered table-condensed table-hover'>
<thead>
<tr>
<th>Hostname</th>
<th>Last Polled</th>
<th>Polling Duration(Seconds)</th>
</tr>
</thead>
<tbody>";
foreach(dbFetchRows($sql) as $device) {
if ($device['last_polled_timetaken'] < 180 ) {
$tr_class = NULL;
}
elseif ($device['last_polled_timetaken'] < 300 ) {
$tr_class = ' class="warning"';
}
elseif ($device['last_polled_timetaken'] >= 300 ) {
$tr_class = ' class="danger"';
}
echo "<tr" .$tr_class. "><td><a class='list-device' href='" .generate_device_url($device, array('tab' => 'graphs', 'group' => 'poller')). "'>" .$device['hostname']. "</a><td>" .$device['last_polled']. "<td>" .$device['last_polled_timetaken']. "</tr>";
}
echo "</tbody></table>";
?>