From e89c92145a16457c7b3e0ebc4a5e900cb9edcc36 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 10 Apr 2021 10:12:23 +0200 Subject: [PATCH] net/chrony: add diagnostics (#2220) --- net/chrony/Makefile | 3 +- net/chrony/pkg-descr | 4 ++ .../OPNsense/Chrony/Api/ServiceController.php | 48 ++++++++++++- .../app/views/OPNsense/Chrony/general.volt | 71 +++++++++++++++++-- .../conf/actions.d/actions_chrony.conf | 24 +++++++ 5 files changed, 140 insertions(+), 10 deletions(-) diff --git a/net/chrony/Makefile b/net/chrony/Makefile index a905579e2..4bfc40a55 100644 --- a/net/chrony/Makefile +++ b/net/chrony/Makefile @@ -1,6 +1,5 @@ PLUGIN_NAME= chrony -PLUGIN_VERSION= 1.1 -PLUGIN_REVISION= 1 +PLUGIN_VERSION= 1.2 PLUGIN_COMMENT= Chrony time synchronisation PLUGIN_DEPENDS= chrony PLUGIN_MAINTAINER= m.muenz@gmail.com diff --git a/net/chrony/pkg-descr b/net/chrony/pkg-descr index 4464c2fa7..c273e6581 100644 --- a/net/chrony/pkg-descr +++ b/net/chrony/pkg-descr @@ -4,6 +4,10 @@ better in virtual environments. Plugin Changelog ---------------- +1.2 + +* Add Diagnostics + 1.1 * Add NTS support diff --git a/net/chrony/src/opnsense/mvc/app/controllers/OPNsense/Chrony/Api/ServiceController.php b/net/chrony/src/opnsense/mvc/app/controllers/OPNsense/Chrony/Api/ServiceController.php index d441d9dc6..e3a681390 100644 --- a/net/chrony/src/opnsense/mvc/app/controllers/OPNsense/Chrony/Api/ServiceController.php +++ b/net/chrony/src/opnsense/mvc/app/controllers/OPNsense/Chrony/Api/ServiceController.php @@ -1,7 +1,7 @@ + * Copyright (C) 2020-2021 Michael Muenz * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,6 +29,8 @@ namespace OPNsense\Chrony\Api; use OPNsense\Base\ApiMutableServiceControllerBase; +use OPNsense\Core\Backend; +use OPNsense\Chrony\General; class ServiceController extends ApiMutableServiceControllerBase { @@ -36,4 +38,48 @@ class ServiceController extends ApiMutableServiceControllerBase protected static $internalServiceTemplate = 'OPNsense/Chrony'; protected static $internalServiceEnabled = 'enabled'; protected static $internalServiceName = 'chrony'; + + /** + * show chrony sources + * @return array + */ + public function chronysourcesAction() + { + $backend = new Backend(); + $response = $backend->configdRun("chrony chronysources"); + return array("response" => $response); + } + + /** + * show chrony stats + * @return array + */ + public function chronysourcestatsAction() + { + $backend = new Backend(); + $response = $backend->configdRun("chrony chronysourcestats"); + return array("response" => $response); + } + + /** + * show chrony tracking + * @return array + */ + public function chronytrackingAction() + { + $backend = new Backend(); + $response = $backend->configdRun("chrony chronytracking"); + return array("response" => $response); + } + + /** + * show chrony authdata + * @return array + */ + public function chronyauthdataAction() + { + $backend = new Backend(); + $response = $backend->configdRun("chrony chronyauthdata"); + return array("response" => $response); + } } diff --git a/net/chrony/src/opnsense/mvc/app/views/OPNsense/Chrony/general.volt b/net/chrony/src/opnsense/mvc/app/views/OPNsense/Chrony/general.volt index be8b75de2..00ba99420 100644 --- a/net/chrony/src/opnsense/mvc/app/views/OPNsense/Chrony/general.volt +++ b/net/chrony/src/opnsense/mvc/app/views/OPNsense/Chrony/general.volt @@ -1,6 +1,6 @@ {# # Copyright (c) 2019 Deciso B.V. - # Copyright (c) 2020 Michael Muenz + # Copyright (c) 2020-2021 Michael Muenz # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -25,15 +25,66 @@ # POSSIBILITY OF SUCH DAMAGE. #} -
- {{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_general_settings'])}} -
-
- + + +
+
+
+ {{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_general_settings'])}} +
+
+ +
+
+
+
+

+    
+
+

+    
+
+

+    
+
+