Chrony support (#12488)

* initial chrony implementation

* remove unused import

* add testing data

* fix test data

* fix tests

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
This commit is contained in:
Serphentas
2021-03-18 20:11:25 +01:00
committed by GitHub
parent ac7b4539ce
commit c88ef64169
13 changed files with 560 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
require 'includes/html/graphs/common.inc.php';
$colours = 'mixed';
$nototal = (($width < 224) ? 1 : 0);
$unit_text = 'Seconds PPM';
$rrd_filename = rrd_name($device['hostname'], ['app', 'chronyd', $app['app_id']]);
$array = [
'frequency' => ['descr' => 'Error rate'],
'residual_frequency' => ['descr' => 'Ref clk offset'],
'skew' => ['descr' => 'Sys clk skew'],
];
$i = 0;
if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds => $var) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $var['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = \LibreNMS\Config::get("graph_colours.$colours.$i");
$i++;
}
} else {
echo "file missing: $file";
}
require 'includes/html/graphs/generic_multi_line.inc.php';

View File

@@ -0,0 +1,28 @@
<?php
require 'includes/html/graphs/common.inc.php';
$colours = 'mixed';
$nototal = (($width < 224) ? 1 : 0);
$unit_text = 'Seconds';
$rrd_filename = rrd_name($device['hostname'], ['app', 'chronyd', $app['app_id']]);
$array = [
'root_delay' => ['descr' => 'Root clk delay'],
'root_dispersion' => ['descr' => 'Root clk disp.'],
];
$i = 0;
if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds => $var) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $var['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = \LibreNMS\Config::get("graph_colours.$colours.$i");
$i++;
}
} else {
echo "file missing: $file";
}
require 'includes/html/graphs/generic_multi_line.inc.php';

View File

@@ -0,0 +1,27 @@
<?php
require 'includes/html/graphs/common.inc.php';
$colours = 'mixed';
$nototal = (($width < 224) ? 1 : 0);
$unit_text = 'Seconds PPM';
$rrd_filename = rrd_name($device['hostname'], ['app', 'chronyd', $app['app_id'], $vars['source']]);
$array = [
'frequency' => ['descr' => 'Estimated'],
'frequency_skew' => ['descr' => 'Est. error'],
];
$rrd_list = [];
if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds => $var) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $var['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = \LibreNMS\Config::get("graph_colours.$colours.$i");
$i++;
}
} else {
d_echo('RRD "' . $rrd_filename . '" not found');
}
require 'includes/html/graphs/generic_multi_line.inc.php';

View File

@@ -0,0 +1,29 @@
<?php
require 'includes/html/graphs/common.inc.php';
$colours = 'mixed';
$nototal = (($width < 224) ? 1 : 0);
$rrd_filename = rrd_name($device['hostname'], ['app', 'chronyd', $app['app_id'], $vars['source']]);
$array = [
'polling_rate' => ['descr' => 'Polling rate'],
'last_rx' => ['descr' => 'Last RX'],
'number_samplepoints' => ['descr' => '# sample pts'],
'number_runs' => ['descr' => '# runs'],
'span' => ['descr' => 'Sample span'],
];
$rrd_list = [];
if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds => $var) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $var['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = \LibreNMS\Config::get("graph_colours.$colours.$i");
$i++;
}
} else {
d_echo('RRD "' . $rrd_filename . '" not found');
}
require 'includes/html/graphs/generic_multi_line.inc.php';

View File

@@ -0,0 +1,30 @@
<?php
require 'includes/html/graphs/common.inc.php';
$colours = 'mixed';
$nototal = (($width < 224) ? 1 : 0);
$unit_text = 'Seconds';
$rrd_filename = rrd_name($device['hostname'], ['app', 'chronyd', $app['app_id'], $vars['source']]);
$array = [
'adjusted_offset' => ['descr' => 'Adjusted'],
'measured_offset' => ['descr' => 'Measured'],
'offset' => ['descr' => 'Estimated'],
'estimated_error' => ['descr' => 'Est. error'],
'stddev' => ['descr' => 'Std dev'],
];
$rrd_list = [];
if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds => $var) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $var['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = \LibreNMS\Config::get("graph_colours.$colours.$i");
$i++;
}
} else {
d_echo('RRD "' . $rrd_filename . '" not found');
}
require 'includes/html/graphs/generic_multi_line.inc.php';

View File

@@ -0,0 +1,26 @@
<?php
require 'includes/html/graphs/common.inc.php';
$colours = 'mixed';
$nototal = (($width < 224) ? 1 : 0);
$unit_text = 'Level';
$rrd_filename = rrd_name($device['hostname'], ['app', 'chronyd', $app['app_id']]);
$array = [
'stratum' => ['descr' => 'Stratum'],
];
$rrd_list = [];
if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds => $var) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $var['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = \LibreNMS\Config::get("graph_colours.$colours.$i");
$i++;
}
} else {
d_echo('RRD "' . $rrd_filename . '" not found');
}
require 'includes/html/graphs/generic_multi_line.inc.php';

View File

@@ -0,0 +1,29 @@
<?php
require 'includes/html/graphs/common.inc.php';
$colours = 'mixed';
$nototal = (($width < 224) ? 1 : 0);
$unit_text = 'Seconds';
$rrd_filename = rrd_name($device['hostname'], ['app', 'chronyd', $app['app_id']]);
$array = [
'system_time' => ['descr' => 'Clock lag'],
'last_offset' => ['descr' => 'Last offset'],
'rms_offset' => ['descr' => 'Avg offset'],
];
$i = 0;
if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds => $var) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $var['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = \LibreNMS\Config::get("graph_colours.$colours.$i");
$i++;
}
} else {
echo "file missing: $file";
}
require 'includes/html/graphs/generic_multi_line.inc.php';