diff --git a/net-mgmt/xymon-client/LICENSE b/net-mgmt/xymon-client/LICENSE new file mode 100644 index 0000000000..05e44609c7 --- /dev/null +++ b/net-mgmt/xymon-client/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Kumy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/net-mgmt/xymon-client/Makefile b/net-mgmt/xymon-client/Makefile new file mode 100644 index 0000000000..10576a5e6c --- /dev/null +++ b/net-mgmt/xymon-client/Makefile @@ -0,0 +1,8 @@ +PLUGIN_NAME= xymon-client +PLUGIN_VERSION= 1.0.0 +PLUGIN_REVISION= 1 +PLUGIN_DEPENDS= xymon-client +PLUGIN_COMMENT= Client for the Xymon network monitor +PLUGIN_MAINTAINER= github+opnsense-xymon-client@kumy.net + +.include "../../Mk/plugins.mk" diff --git a/net-mgmt/xymon-client/pkg-descr b/net-mgmt/xymon-client/pkg-descr new file mode 100644 index 0000000000..b903f655e1 --- /dev/null +++ b/net-mgmt/xymon-client/pkg-descr @@ -0,0 +1,13 @@ +Client data collection package for Xymon (previously known as Hobbit). + +This gathers statistics and data from a single system and reports it to +the Xymon monitor. + +WWW: https://sourceforge.net/projects/xymon/ + +Plugin Changelog +================ + +1.0.0 + +* Initial release diff --git a/net-mgmt/xymon-client/src/etc/inc/plugins.inc.d/xymonclient.inc b/net-mgmt/xymon-client/src/etc/inc/plugins.inc.d/xymonclient.inc new file mode 100644 index 0000000000..d095d3b54e --- /dev/null +++ b/net-mgmt/xymon-client/src/etc/inc/plugins.inc.d/xymonclient.inc @@ -0,0 +1,69 @@ +enabled == '1'; +} + +function xymonclient_services() +{ + global $config; + + $services = []; + + $fqdn = sprintf('%s.%s', + $config['system']['hostname'], + $config['system']['domain'], + ); + + if (xymonclient_enabled()) { + $services[] = [ + 'description' => gettext('Xymon client'), + 'configd' => [ + 'restart' => ['xymonclient restart'], + 'start' => ['xymonclient start'], + 'stop' => ['xymonclient stop'], + ], + 'name' => 'xymonclient', + 'pidfile' => "/var/run/xymon/xymon_client.pid" + ]; + } + + return $services; +} + +function xymonclient_xmlrpc_sync() +{ + $result = []; + + $result[] = [ + 'description' => gettext('Xymon client'), + 'section' => 'kumy.xymon.client', + 'id' => 'xymonclient', + 'services' => ['xymonclient'], + ]; + + return $result; +} diff --git a/net-mgmt/xymon-client/src/opnsense/mvc/app/controllers/Kumy/XymonClient/Api/ServiceController.php b/net-mgmt/xymon-client/src/opnsense/mvc/app/controllers/Kumy/XymonClient/Api/ServiceController.php new file mode 100644 index 0000000000..1586d290c9 --- /dev/null +++ b/net-mgmt/xymon-client/src/opnsense/mvc/app/controllers/Kumy/XymonClient/Api/ServiceController.php @@ -0,0 +1,35 @@ +request->isPost()) { + $backend = new Backend(); + $status = strtolower(trim($backend->configdRun('template reload Kumy/XymonClient'))); + if ($status === 'ok') { + $config = $this->getModel(); + if ((string)$config->enabled == "1" && !empty((string)$config->XYMSERVERS)) { + $status = $backend->configdRun('xymonclient restart'); + } else { + $status = $backend->configdRun('xymonclient stop'); + } + } + } + return ['status' => strtolower(trim($status))]; + } +} diff --git a/net-mgmt/xymon-client/src/opnsense/mvc/app/controllers/Kumy/XymonClient/IndexController.php b/net-mgmt/xymon-client/src/opnsense/mvc/app/controllers/Kumy/XymonClient/IndexController.php new file mode 100644 index 0000000000..5c5274ab56 --- /dev/null +++ b/net-mgmt/xymon-client/src/opnsense/mvc/app/controllers/Kumy/XymonClient/IndexController.php @@ -0,0 +1,34 @@ +view->formSettings = $this->getForm('settings'); + $this->view->pick('Kumy/XymonClient/index'); + } +} diff --git a/net-mgmt/xymon-client/src/opnsense/mvc/app/controllers/Kumy/XymonClient/forms/settings.xml b/net-mgmt/xymon-client/src/opnsense/mvc/app/controllers/Kumy/XymonClient/forms/settings.xml new file mode 100644 index 0000000000..f7f0b96410 --- /dev/null +++ b/net-mgmt/xymon-client/src/opnsense/mvc/app/controllers/Kumy/XymonClient/forms/settings.xml @@ -0,0 +1,16 @@ +
+ + xymonclient.enabled + + checkbox + + + xymonclient.XYMSERVERS + + select_multiple + true + + + Xymon server addresses. + +
diff --git a/net-mgmt/xymon-client/src/opnsense/mvc/app/models/Kumy/XymonClient/Menu/Menu.xml b/net-mgmt/xymon-client/src/opnsense/mvc/app/models/Kumy/XymonClient/Menu/Menu.xml new file mode 100644 index 0000000000..0fffdf082b --- /dev/null +++ b/net-mgmt/xymon-client/src/opnsense/mvc/app/models/Kumy/XymonClient/Menu/Menu.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/net-mgmt/xymon-client/src/opnsense/mvc/app/models/Kumy/XymonClient/Settings.php b/net-mgmt/xymon-client/src/opnsense/mvc/app/models/Kumy/XymonClient/Settings.php new file mode 100644 index 0000000000..f3fb72613c --- /dev/null +++ b/net-mgmt/xymon-client/src/opnsense/mvc/app/models/Kumy/XymonClient/Settings.php @@ -0,0 +1,30 @@ + + //kumy/xymon/client + Xymon client settings + 0.0.0 + + + 0 + Y + + + N + Y + N + N + N + Y + + + + diff --git a/net-mgmt/xymon-client/src/opnsense/mvc/app/views/Kumy/XymonClient/index.volt b/net-mgmt/xymon-client/src/opnsense/mvc/app/views/Kumy/XymonClient/index.volt new file mode 100644 index 0000000000..6a547b9007 --- /dev/null +++ b/net-mgmt/xymon-client/src/opnsense/mvc/app/views/Kumy/XymonClient/index.volt @@ -0,0 +1,41 @@ + + +
+
+ {{ partial("layout_partials/base_form", ["fields": formSettings, "id": "frm_Settings"]) }} +
+

+ +
+
+
+ +

+
+
+
diff --git a/net-mgmt/xymon-client/src/opnsense/service/conf/actions.d/actions_xymonclient.conf b/net-mgmt/xymon-client/src/opnsense/service/conf/actions.d/actions_xymonclient.conf new file mode 100644 index 0000000000..8dfc6ffdc4 --- /dev/null +++ b/net-mgmt/xymon-client/src/opnsense/service/conf/actions.d/actions_xymonclient.conf @@ -0,0 +1,25 @@ +[start] +command: service xymon-client start +parameters: +type:script +message:xymon-client service start + +[stop] +command: service xymon-client stop +parameters: +type:script +message:xymon-client service stop + +[restart] +command: service xymon-client restart +parameters: +type:script +message:xymon-client service restart + +[status] +# Note: The rc script is exiting with errcode 1 +# if the service is not running +command: service xymon-client status; exit 0 +parameters: +type:script_output +message:xymon-client service status diff --git a/net-mgmt/xymon-client/src/opnsense/service/templates/Kumy/XymonClient/+TARGETS b/net-mgmt/xymon-client/src/opnsense/service/templates/Kumy/XymonClient/+TARGETS new file mode 100644 index 0000000000..87c9cdf8cb --- /dev/null +++ b/net-mgmt/xymon-client/src/opnsense/service/templates/Kumy/XymonClient/+TARGETS @@ -0,0 +1,2 @@ +xymonclient.cfg:/usr/local/etc/xymon/xymonclient.cfg +xymon_client:/etc/rc.conf.d/xymon_client diff --git a/net-mgmt/xymon-client/src/opnsense/service/templates/Kumy/XymonClient/xymon_client b/net-mgmt/xymon-client/src/opnsense/service/templates/Kumy/XymonClient/xymon_client new file mode 100644 index 0000000000..2d28a76322 --- /dev/null +++ b/net-mgmt/xymon-client/src/opnsense/service/templates/Kumy/XymonClient/xymon_client @@ -0,0 +1 @@ +xymon_client_enable={% if not helpers.empty('kumy.xymon.client.enabled') and not helpers.empty('kumy.xymon.client.XYMSERVERS') %}YES{% else %}NO{% endif %} diff --git a/net-mgmt/xymon-client/src/opnsense/service/templates/Kumy/XymonClient/xymonclient.cfg b/net-mgmt/xymon-client/src/opnsense/service/templates/Kumy/XymonClient/xymonclient.cfg new file mode 100644 index 0000000000..7366e5aaaf --- /dev/null +++ b/net-mgmt/xymon-client/src/opnsense/service/templates/Kumy/XymonClient/xymonclient.cfg @@ -0,0 +1,4 @@ +# Automatically managed config do not edit manually + +XYMSRV="0.0.0.0" +XYMSERVERS="{% if not helpers.empty('kumy.xymon.client.XYMSERVERS') %}{{ kumy.xymon.client.XYMSERVERS }}{% endif %}"