From d39344b88202a817006fd8210d1824145afa36f9 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 25 Jul 2020 08:00:18 +0200 Subject: [PATCH] net-mgmt/zabbix5-proxy: move to v5 (#1932) --- net-mgmt/zabbix4-proxy/Makefile | 1 + net-mgmt/zabbix5-proxy/Makefile | 8 + net-mgmt/zabbix5-proxy/pkg-descr | 26 ++++ .../src/etc/inc/plugins.inc.d/zabbixproxy.inc | 49 ++++++ .../Zabbixproxy/Api/GeneralController.php | 39 +++++ .../Zabbixproxy/Api/ServiceController.php | 47 ++++++ .../Zabbixproxy/GeneralController.php | 38 +++++ .../OPNsense/Zabbixproxy/forms/general.xml | 145 ++++++++++++++++++ .../models/OPNsense/Zabbixproxy/ACL/ACL.xml | 9 ++ .../models/OPNsense/Zabbixproxy/General.php | 35 +++++ .../models/OPNsense/Zabbixproxy/General.xml | 107 +++++++++++++ .../models/OPNsense/Zabbixproxy/Menu/Menu.xml | 5 + .../views/OPNsense/Zabbixproxy/general.volt | 60 ++++++++ .../scripts/OPNsense/Zabbixproxy/setup.sh | 16 ++ .../conf/actions.d/actions_zabbixproxy.conf | 23 +++ .../templates/OPNsense/Zabbixproxy/+TARGETS | 3 + .../OPNsense/Zabbixproxy/zabbix_proxy | 6 + .../OPNsense/Zabbixproxy/zabbix_proxy.conf | 76 +++++++++ .../OPNsense/Zabbixproxy/zabbix_proxy.psk | 5 + 19 files changed, 698 insertions(+) create mode 100644 net-mgmt/zabbix5-proxy/Makefile create mode 100644 net-mgmt/zabbix5-proxy/pkg-descr create mode 100644 net-mgmt/zabbix5-proxy/src/etc/inc/plugins.inc.d/zabbixproxy.inc create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/Api/GeneralController.php create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/Api/ServiceController.php create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/GeneralController.php create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/forms/general.xml create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/ACL/ACL.xml create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/General.php create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/General.xml create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/Menu/Menu.xml create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/views/OPNsense/Zabbixproxy/general.volt create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/scripts/OPNsense/Zabbixproxy/setup.sh create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/service/conf/actions.d/actions_zabbixproxy.conf create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/+TARGETS create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy.conf create mode 100644 net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy.psk diff --git a/net-mgmt/zabbix4-proxy/Makefile b/net-mgmt/zabbix4-proxy/Makefile index ed0fea33a..ae1fd3930 100644 --- a/net-mgmt/zabbix4-proxy/Makefile +++ b/net-mgmt/zabbix4-proxy/Makefile @@ -2,6 +2,7 @@ PLUGIN_NAME= zabbix4-proxy PLUGIN_VERSION= 1.2 PLUGIN_COMMENT= Zabbix Proxy enables decentralized monitoring PLUGIN_DEPENDS= zabbix4-proxy +PLUGIN_CONFLICTS= zabbix5-proxy PLUGIN_MAINTAINER= m.muenz@gmail.com .include "../../Mk/plugins.mk" diff --git a/net-mgmt/zabbix5-proxy/Makefile b/net-mgmt/zabbix5-proxy/Makefile new file mode 100644 index 000000000..89d4d33dd --- /dev/null +++ b/net-mgmt/zabbix5-proxy/Makefile @@ -0,0 +1,8 @@ +PLUGIN_NAME= zabbix5-proxy +PLUGIN_VERSION= 1.3 +PLUGIN_COMMENT= Zabbix Proxy enables decentralized monitoring +PLUGIN_DEPENDS= zabbix5-proxy +PLUGIN_CONFLICTS= zabbix4-proxy +PLUGIN_MAINTAINER= m.muenz@gmail.com + +.include "../../Mk/plugins.mk" diff --git a/net-mgmt/zabbix5-proxy/pkg-descr b/net-mgmt/zabbix5-proxy/pkg-descr new file mode 100644 index 000000000..c99e873c4 --- /dev/null +++ b/net-mgmt/zabbix5-proxy/pkg-descr @@ -0,0 +1,26 @@ +Zabbix is an enterprise-class open source distributed monitoring solution. + +Zabbix is software that monitors numerous parameters of a network and the +health and integrity of servers. Zabbix uses a flexible notification +mechanism that allows users to configure e-mail based alerts for virtually +any event. This allows a fast reaction to server problems. Zabbix offers +excellent reporting and data visualisation features based on the stored +data. This makes Zabbix ideal for capacity planning. + +WWW: https://www.zabbix.com/ + +Plugin Changelog +---------------- + +1.3 + +* Switch to zabbix5-proxy + +1.2 + +* Allow adding multiple listen addresses + +1.1 + +* Add ProxyOfflineBuffer parameter +* Switch to new service control UI diff --git a/net-mgmt/zabbix5-proxy/src/etc/inc/plugins.inc.d/zabbixproxy.inc b/net-mgmt/zabbix5-proxy/src/etc/inc/plugins.inc.d/zabbixproxy.inc new file mode 100644 index 000000000..d26017268 --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/etc/inc/plugins.inc.d/zabbixproxy.inc @@ -0,0 +1,49 @@ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +function zabbixproxy_services() +{ + global $config; + + $services = array(); + + if (isset($config['OPNsense']['zabbixproxy']['general']['enabled']) && $config['OPNsense']['zabbixproxy']['general']['enabled'] == 1) { + $services[] = array( + 'description' => gettext('Zabbix Proxy'), + 'configd' => array( + 'restart' => array('zabbixproxy restart'), + 'start' => array('zabbixproxy start'), + 'stop' => array('zabbixproxy stop'), + ), + 'name' => 'zabbixproxy', + 'pidfile' => '/var/run/zabbix/zabbix_proxy.pid' + ); + } + + return $services; +} diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/Api/GeneralController.php b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/Api/GeneralController.php new file mode 100644 index 000000000..7a930881d --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/Api/GeneralController.php @@ -0,0 +1,39 @@ + + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +namespace OPNsense\Zabbixproxy\Api; + +use OPNsense\Base\ApiMutableModelControllerBase; + +class GeneralController extends ApiMutableModelControllerBase +{ + protected static $internalModelClass = '\OPNsense\Zabbixproxy\General'; + protected static $internalModelName = 'general'; +} diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/Api/ServiceController.php b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/Api/ServiceController.php new file mode 100644 index 000000000..d94f2a1ce --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/Api/ServiceController.php @@ -0,0 +1,47 @@ + + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +namespace OPNsense\Zabbixproxy\Api; + +use OPNsense\Base\ApiMutableServiceControllerBase; +use OPNsense\Core\Backend; +use OPNsense\Zabbixproxy\General; + +/** + * Class ServiceController + * @package OPNsense\Zabbixproxy + */ +class ServiceController extends ApiMutableServiceControllerBase +{ + protected static $internalServiceClass = '\OPNsense\Zabbixproxy\General'; + protected static $internalServiceTemplate = 'OPNsense/Zabbixproxy'; + protected static $internalServiceEnabled = 'enabled'; + protected static $internalServiceName = 'zabbixproxy'; +} diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/GeneralController.php b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/GeneralController.php new file mode 100644 index 000000000..56e2667c7 --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/GeneralController.php @@ -0,0 +1,38 @@ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +namespace OPNsense\Zabbixproxy; + +class GeneralController extends \OPNsense\Base\IndexController +{ + public function indexAction() + { + $this->view->generalForm = $this->getForm("general"); + $this->view->pick('OPNsense/Zabbixproxy/general'); + } +} diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/forms/general.xml b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/forms/general.xml new file mode 100644 index 000000000..11de26c17 --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/forms/general.xml @@ -0,0 +1,145 @@ +
+ + general.enabled + + checkbox + This will activate the Zabbix Proxy service. + + + general.proxymode + + checkbox + Active (default) or passive mode, only switch to passive if you know what you are doing. + + + general.server + + text + IP address or hostname of Zabbix server. + + + general.serverport + + text + Port of Zabbix trapper on Zabbix server. Default is fine for most scenarios. + + + general.hostname + + text + The name of this Zabbix instance. It has to match with the defined name in the central Zabbix server. + + + general.listenip + + + select_multiple + true + List of comma delimited IP addresses that the trapper should listen on. Trapper will listen on all network interfaces if this parameter is missing. + + + general.listenport + + text + Listen port for trapper. Default is just fine. + + + general.sourceip + + text + Source IP address for outgoing connections. + + + general.startpollers + + text + Number of pre-forked instances of pollers. + + + general.startipmipollers + + text + Number of pre-forked instances of IPMI pollers. + + + general.startpollersunreachable + + text + Number of pre-forked instances of pollers for unreachable hosts (including IPMI and Java). + + + general.starttrappers + + text + Number of pre-forked instances of trappers. Trappers accept incoming connections from Zabbix sender and active agents. + + + general.startpingers + + text + Number of pre-forked instances of ICMP pingers. + + + general.startdiscoverers + + text + Number of pre-forked instances of discoverers. + + + general.starthttppollers + + text + Number of pre-forked instances of HTTP pollers. + + + general.cachesize + + text + Size of configuration cache, in bytes. Shared memory size, for storing hosts and items data. Range: 128K-8G + + + general.historycachesize + + text + Size of history cache in bytes. Shared memory size for storing history data. Range: 128K-2G + + + general.historyindexcachesize + + text + Size of history index cache in bytes. Shared memory size for indexing history cache. Range: 128K-2G + + + general.proxyofflinebuffer + + text + Set the time in hours how long the values will be buffered when the server is unreachable. + + + general.timeout + + text + Specifies how long we wait for agent, SNMP device or external check (in seconds). + + + general.encryption + + checkbox + Enable PSK based encryption for communicating with the Zabbix server + true + + + general.encryptionidentity + + text + The PSK identity configured on the Zabbix server + true + + + general.encryptionpsk + + text + The PSK configured on the Zabbix server + true + +
diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/ACL/ACL.xml b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/ACL/ACL.xml new file mode 100644 index 000000000..6166a2c68 --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/ACL/ACL.xml @@ -0,0 +1,9 @@ + + + Services: Zabbix Proxy + + ui/zabbixproxy/* + api/zabbixproxy/* + + + diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/General.php b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/General.php new file mode 100644 index 000000000..351dbd9db --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/General.php @@ -0,0 +1,35 @@ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +namespace OPNsense\Zabbixproxy; + +use OPNsense\Base\BaseModel; + +class General extends BaseModel +{ +} diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/General.xml b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/General.xml new file mode 100644 index 000000000..b4955e3c8 --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/General.xml @@ -0,0 +1,107 @@ + + //OPNsense/zabbixproxy/general + Zabbix Proxy configuration + 2.0.2 + + + 0 + Y + + + 0 + Y + + + + N + + + 10051 + N + + + Zabbix proxy + Y + + + 10051 + N + + + + , + Y + N + + + + N + + + 5 + N + + + 0 + N + + + 1 + N + + + 5 + N + + + 1 + N + + + 1 + N + + + 1 + N + + + 8M + N + + + 16M + N + + + 4M + N + + + N + 1 + 720 + Set a number between 1 and 720. + + + 4 + N + + + 0 + Y + + + + N + /^.{1,128}$/ + Should be a string between 1 and 128 characters. + + + + N + /^[A-Fa-f0-9]{32,512}$/ + Should be a hexadecimal string between 32 and 512 characters. + + + diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/Menu/Menu.xml b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/Menu/Menu.xml new file mode 100644 index 000000000..7b5301743 --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/Menu/Menu.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/views/OPNsense/Zabbixproxy/general.volt b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/views/OPNsense/Zabbixproxy/general.volt new file mode 100644 index 000000000..0d5bef383 --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/mvc/app/views/OPNsense/Zabbixproxy/general.volt @@ -0,0 +1,60 @@ +{# + +OPNsense® is Copyright © 2014 – 2017 by Deciso B.V. +This file is Copyright © 2019 by Michael Muenz +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +#} +
+ {{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_general_settings'])}} +
+
+ +
+
+ + diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/scripts/OPNsense/Zabbixproxy/setup.sh b/net-mgmt/zabbix5-proxy/src/opnsense/scripts/OPNsense/Zabbixproxy/setup.sh new file mode 100644 index 000000000..ba95dc0f4 --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/scripts/OPNsense/Zabbixproxy/setup.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Setup database directory +mkdir -p /var/db/zabbix +chown -R zabbix:zabbix /var/db/zabbix +chmod 755 /var/db/zabbix + +# Setup logging +mkdir /var/log/zabbix +chown -R zabbix:zabbix /var/log/zabbix +chmod 770 /var/log/zabbix + +# Setup PID directory +mkdir -p /var/run/zabbix +chown -R zabbix:zabbix /var/run/zabbix +chmod 755 /var/run/zabbix diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/service/conf/actions.d/actions_zabbixproxy.conf b/net-mgmt/zabbix5-proxy/src/opnsense/service/conf/actions.d/actions_zabbixproxy.conf new file mode 100644 index 000000000..7904a1445 --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/service/conf/actions.d/actions_zabbixproxy.conf @@ -0,0 +1,23 @@ +[start] +command:/usr/local/opnsense/scripts/OPNsense/Zabbixproxy/setup.sh;/usr/local/etc/rc.d/zabbix_proxy start +parameters: +type:script +message:starting Zabbix Proxy + +[stop] +command:/usr/local/etc/rc.d/zabbix_proxy stop; exit 0 +parameters: +type:script +message:stopping Zabbix Proxy + +[restart] +command:/usr/local/opnsense/scripts/OPNsense/Zabbixproxy/setup.sh;/usr/local/etc/rc.d/zabbix_proxy restart +parameters: +type:script +message:restarting Zabbix Proxy + +[status] +command:/usr/local/etc/rc.d/zabbix_proxy status;exit 0 +parameters: +type:script_output +message:request Zabbix Proxy status diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/+TARGETS b/net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/+TARGETS new file mode 100644 index 000000000..b797902b6 --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/+TARGETS @@ -0,0 +1,3 @@ +zabbix_proxy:/etc/rc.conf.d/zabbix_proxy +zabbix_proxy.conf:/usr/local/etc/zabbix5/zabbix_proxy.conf +zabbix_proxy.psk:/usr/local/etc/zabbix5/zabbix_proxy.psk diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy b/net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy new file mode 100644 index 000000000..f9c1bb348 --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy @@ -0,0 +1,6 @@ +{% if helpers.exists('OPNsense.zabbixproxy.general.enabled') and OPNsense.zabbixproxy.general.enabled == '1' %} +zabbix_proxy_var_script="/usr/local/opnsense/scripts/OPNsense/Zabbixproxy/setup.sh" +zabbix_proxy_enable="YES" +{% else %} +zabbix_proxy_enable="NO" +{% endif %} diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy.conf b/net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy.conf new file mode 100644 index 000000000..31e1e31ed --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy.conf @@ -0,0 +1,76 @@ +{% if helpers.exists('OPNsense.zabbixproxy.general.enabled') and OPNsense.zabbixproxy.general.enabled == '1' %} + +{% if helpers.exists('OPNsense.zabbixproxy.general.proxymode') and OPNsense.zabbixproxy.general.proxymode == '1' %} +ProxyMode=1 +{% else %} +ProxyMode=0 +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.server') and OPNsense.zabbixproxy.general.server != '' %} +Server={{ OPNsense.zabbixproxy.general.server }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.serverport') and OPNsense.zabbixproxy.general.serverport != '' %} +ServerPort={{ OPNsense.zabbixproxy.general.serverport }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.hostname') and OPNsense.zabbixproxy.general.hostname != '' %} +Hostname={{ OPNsense.zabbixproxy.general.hostname }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.listenport') and OPNsense.zabbixproxy.general.listenport != '' %} +ListenPort={{ OPNsense.zabbixproxy.general.listenport }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.sourceip') and OPNsense.zabbixproxy.general.sourceip != '' %} +SourceIP={{ OPNsense.zabbixproxy.general.sourceip }} +{% endif %} +LogFile=/var/log/zabbix/zabbix_proxy.log +PidFile=/var/run/zabbix/zabbix_proxy.pid +DBName=/var/db/zabbix/zabbix_proxy.db +{% if helpers.exists('OPNsense.zabbixproxy.general.proxyofflinebuffer') and OPNsense.zabbixproxy.general.proxyofflinebuffer != '' %} +ProxyOfflineBuffer={{ OPNsense.zabbixproxy.general.proxyofflinebuffer }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.startpollers') and OPNsense.zabbixproxy.general.startpollers != '' %} +StartPollers={{ OPNsense.zabbixproxy.general.startpollers }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.startipmipollers') and OPNsense.zabbixproxy.general.startipmipollers != '' %} +StartIPMIPollers={{ OPNsense.zabbixproxy.general.startipmipollers }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.startpollersunreachable') and OPNsense.zabbixproxy.general.startpollersunreachable != '' %} +StartPollersUnreachable={{ OPNsense.zabbixproxy.general.startpollersunreachable }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.starttrappers') and OPNsense.zabbixproxy.general.starttrappers != '' %} +StartTrappers={{ OPNsense.zabbixproxy.general.starttrappers }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.startpingers') and OPNsense.zabbixproxy.general.startpingers != '' %} +StartPingers={{ OPNsense.zabbixproxy.general.startpingers }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.startdiscoverers') and OPNsense.zabbixproxy.general.startdiscoverers != '' %} +StartDiscoverers={{ OPNsense.zabbixproxy.general.startdiscoverers }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.starthttppollers') and OPNsense.zabbixproxy.general.starthttppollers != '' %} +StartHTTPPollers={{ OPNsense.zabbixproxy.general.starthttppollers }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.listenip') and OPNsense.zabbixproxy.general.listenip != '' %} +ListenIP={{ OPNsense.zabbixproxy.general.listenip }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.cachesize') and OPNsense.zabbixproxy.general.cachesize != '' %} +CacheSize={{ OPNsense.zabbixproxy.general.cachesize }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.historycachesize') and OPNsense.zabbixproxy.general.historycachesize != '' %} +HistoryCacheSize={{ OPNsense.zabbixproxy.general.historycachesize }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.historyindexcachesize') and OPNsense.zabbixproxy.general.historyindexcachesize != '' %} +HistoryIndexCacheSize={{ OPNsense.zabbixproxy.general.historyindexcachesize }} +{% endif %} +{% if helpers.exists('OPNsense.zabbixproxy.general.timeout') and OPNsense.zabbixproxy.general.timeout != '' %} +Timeout={{ OPNsense.zabbixproxy.general.timeout }} +{% endif %} +FpingLocation=/usr/local/sbin/fping +Fping6Location=/usr/local/sbin/fping6 +{% if helpers.exists('OPNsense.zabbixproxy.general.encryption') and OPNsense.zabbixproxy.general.encryption == '1' %} +{% if helpers.exists('OPNsense.zabbixproxy.general.proxymode') and OPNsense.zabbixproxy.general.proxymode == '1' %} +TLSAccept=psk +{% else %} +TLSConnect=psk +{% endif %} +TLSPSKFile=/usr/local/etc/zabbix5/zabbix_proxy.psk +TLSPSKIdentity={{ OPNsense.zabbixproxy.general.encryptionidentity }} +{% endif %} +{% endif %} diff --git a/net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy.psk b/net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy.psk new file mode 100644 index 000000000..1e53053b5 --- /dev/null +++ b/net-mgmt/zabbix5-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy.psk @@ -0,0 +1,5 @@ +{% if helpers.exists('OPNsense.zabbixproxy.general.enabled') and OPNsense.zabbixproxy.general.enabled == '1' %} +{% if helpers.exists('OPNsense.zabbixproxy.general.encryption') and OPNsense.zabbixproxy.general.encryption == '1' %} +{{ OPNsense.zabbixproxy.general.encryptionpsk }} +{% endif %} +{% endif %}