Added "Ping Response" graph to "Ping Only" Device Overview page (#13886)

* Add Ping performance to Device Overview page

Only if device type is "Ping Only"

* Re-use $perf_url
This commit is contained in:
Mark Westerterp
2022-04-03 15:15:23 +02:00
committed by GitHub
parent 7e5641d4fe
commit 971404f416
2 changed files with 38 additions and 0 deletions

View File

@@ -30,6 +30,10 @@ if ($device['os'] == 'cimc') {
require 'overview/cimc.inc.php';
}
if ($device['os'] == 'ping') {
require 'overview/ping.inc.php';
}
echo '
</div>
<div class="col-md-6">

View File

@@ -0,0 +1,34 @@
<?php
$perf = \DeviceCache::getPrimary()->perf;
if ($perf->isNotEmpty()) {
$perf_url = Url('device') . '/device=' . DeviceCache::getPrimary()->device_id . '/tab=graphs/group=poller/';
echo '
<div class="row">
<div class="col-md-12">
<div class="panel panel-default panel-condensed">
<div class="panel-heading">
<a href="' . $perf_url . '">
<i class="fas fa-area-chart fa-lg icon-theme" aria-hidden="true"></i><strong>Ping Response</strong></a>
</div>
<table class="table table-hover table-condensed table-striped">
<tr>
<td colspan="4">';
$graph = \App\Http\Controllers\Device\Tabs\OverviewController::setGraphWidth([
'device' => DeviceCache::getPrimary()->device_id,
'type' => 'device_ping_perf',
'from' => \LibreNMS\Config::get('time.day'),
'legend' => 'yes',
'popup_title' => DeviceCache::getPrimary()->hostname . ' - Ping Response',
]);
echo \LibreNMS\Util\Url::graphPopup($graph, \LibreNMS\Util\Url::lazyGraphTag($graph), $perf_url);
echo ' </td>
</tr>
</table>
</div>
</div>
</div>';
}//end if