Files

128 lines
3.6 KiB
PHP
Raw Permalink Normal View History

2016-08-09 07:14:25 +10:00
<?php
/*
* LibreNMS module to capture statistics from the CISCO-NTP-MIB
*
* Copyright (c) 2016 Aaron Daniels <[email protected]>
*
* 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.
*/
2016-08-21 08:07:14 -05:00
$component = new LibreNMS\Component();
2016-08-09 07:14:25 +10:00
$options = array();
$options['filter']['ignore'] = array('=',0);
2016-08-12 17:21:55 +10:00
$options['type'] = 'ntp';
2016-08-18 20:28:22 -05:00
$components = $component->getComponents($device['device_id'], $options);
2016-08-09 07:14:25 +10:00
$components = $components[$device['device_id']];
?>
<table id='table' class='table table-condensed table-responsive table-striped'>
<thead>
<tr>
<th>Peer</th>
<th>Stratum</th>
<th>Peer Reference</th>
<th>Status</th>
</tr>
</thead>
<?php
2016-08-18 20:28:22 -05:00
foreach ($components as $peer) {
$string = $peer['peer'].":".$peer['port'];
if ($peer['status'] == 2) {
$status = $peer['error'];
$error = 'class="danger"';
} else {
$status = 'Ok';
$error = '';
}
2020-04-03 08:41:24 -05:00
?>
2016-08-18 20:28:22 -05:00
<tr <?php echo $error; ?>>
<td><?php echo $string; ?></td>
<td><?php echo $peer['stratum']; ?></td>
<td><?php echo $peer['peerref']; ?></td>
<td><?php echo $status; ?></td>
</tr>
2020-04-03 08:41:24 -05:00
<?php
2016-08-18 20:28:22 -05:00
}
2016-08-09 07:14:25 +10:00
?>
</table>
<div class="panel panel-default" id="stratum">
<div class="panel-heading">
<h3 class="panel-title">NTP Stratum</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
2019-06-23 00:29:12 -05:00
$graph_array['to'] = \LibreNMS\Config::get('time.now');
2016-08-12 17:21:55 +10:00
$graph_array['type'] = 'device_ntp_stratum';
2019-04-11 23:26:42 -05:00
require 'includes/html/print-graphrow.inc.php';
2016-08-09 07:14:25 +10:00
?>
</div>
</div>
<div class="panel panel-default" id="offset">
<div class="panel-heading">
<h3 class="panel-title">Offset</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
2019-06-23 00:29:12 -05:00
$graph_array['to'] = \LibreNMS\Config::get('time.now');
2016-08-12 17:21:55 +10:00
$graph_array['type'] = 'device_ntp_offset';
2019-04-11 23:26:42 -05:00
require 'includes/html/print-graphrow.inc.php';
2016-08-09 07:14:25 +10:00
?>
</div>
</div>
<div class="panel panel-default" id="delay">
<div class="panel-heading">
<h3 class="panel-title">Delay</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
2019-06-23 00:29:12 -05:00
$graph_array['to'] = \LibreNMS\Config::get('time.now');
2016-08-12 17:21:55 +10:00
$graph_array['type'] = 'device_ntp_delay';
2019-04-11 23:26:42 -05:00
require 'includes/html/print-graphrow.inc.php';
2016-08-09 07:14:25 +10:00
?>
</div>
</div>
<div class="panel panel-default" id="dispersion">
<div class="panel-heading">
<h3 class="panel-title">Dispersion</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
2019-06-23 00:29:12 -05:00
$graph_array['to'] = \LibreNMS\Config::get('time.now');
2016-08-12 17:21:55 +10:00
$graph_array['type'] = 'device_ntp_dispersion';
2019-04-11 23:26:42 -05:00
require 'includes/html/print-graphrow.inc.php';
2016-08-09 07:14:25 +10:00
?>
</div>
</div>