diff --git a/net-mgmt/zabbix-agent/Makefile b/net-mgmt/zabbix-agent/Makefile
index 91e8b6420..9aad3a194 100644
--- a/net-mgmt/zabbix-agent/Makefile
+++ b/net-mgmt/zabbix-agent/Makefile
@@ -1,7 +1,8 @@
-PLUGIN_NAME= zabbix-agent
-PLUGIN_VERSION= 0.1
-PLUGIN_COMMENT= Enterprise-class open source distributed monitoring agent
+PLUGIN_NAME= zabbix-agent
+PLUGIN_VERSION= 0.1
+PLUGIN_COMMENT= Enterprise-class open source distributed monitoring agent
PLUGIN_DEPENDS= zabbix32-agent
-PLUGIN_MAINTAINER= opnsense@moov.de
+PLUGIN_DEVEL= yes
+PLUGIN_MAINTAINER= opnsense@moov.de
.include "../../Mk/plugins.mk"
diff --git a/net-mgmt/zabbix-agent/pkg-descr b/net-mgmt/zabbix-agent/pkg-descr
new file mode 100644
index 000000000..e16a89206
--- /dev/null
+++ b/net-mgmt/zabbix-agent/pkg-descr
@@ -0,0 +1 @@
+Manage the Zabbix Agent to allow OPNsense to be monitored by a Zabbix Server.
diff --git a/net-mgmt/zabbix-agent/src/etc/inc/plugins.inc.d/zabbixagent.inc b/net-mgmt/zabbix-agent/src/etc/inc/plugins.inc.d/zabbixagent.inc
index ce0beaa2f..709d9c49c 100644
--- a/net-mgmt/zabbix-agent/src/etc/inc/plugins.inc.d/zabbixagent.inc
+++ b/net-mgmt/zabbix-agent/src/etc/inc/plugins.inc.d/zabbixagent.inc
@@ -76,14 +76,11 @@ function zabbixagent_services()
* @return array
*/
-/**
-XXX: needs investigation, hostname must be unique/replaced/excluded on secondary node(s)
function zabbixagent_xmlrpc_sync()
{
$result = array();
$result['id'] = 'zabbixagent';
- $result['section'] = 'OPNsense.zabbixagent';
+ $result['section'] = 'OPNsense.zabbixagent.settings';
$result['description'] = gettext('Enterprise-class open source distributed monitoring agent');
return array($result);
}
- */
diff --git a/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/Api/ServiceController.php b/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/Api/ServiceController.php
index 67b537735..35c66c70b 100644
--- a/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/Api/ServiceController.php
+++ b/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/Api/ServiceController.php
@@ -96,14 +96,14 @@ class ServiceController extends ApiControllerBase
$response = $backend->configdRun("zabbixagent status");
if (strpos($response, "not running") > 0) {
- if ($mdlAgent->settings->main->enabled->__toString() == 1) {
+ if ($mdlAgent->settings->main->enabled->__toString() == "1") {
$status = "stopped";
} else {
$status = "disabled";
}
} elseif (strpos($response, "is running") > 0) {
$status = "running";
- } elseif ($mdlAgent->settings->main->enabled->__toString() == 0) {
+ } elseif ($mdlAgent->settings->main->enabled->__toString() == "0") {
$status = "disabled";
} else {
$status = "unkown";
@@ -129,7 +129,7 @@ class ServiceController extends ApiControllerBase
// stop zabbix agent when disabled
if ($runStatus['status'] == "running" &&
- ($mdlAgent->settings->main->enabled->__toString() == 0 || $force_restart)) {
+ ($mdlAgent->settings->main->enabled->__toString() == "0" || $force_restart)) {
$this->stopAction();
}
@@ -137,7 +137,7 @@ class ServiceController extends ApiControllerBase
$backend->configdRun('template reload OPNsense/ZabbixAgent');
// (res)start daemon
- if ($mdlAgent->settings->main->enabled->__toString() == 1) {
+ if ($mdlAgent->settings->main->enabled->__toString() == "1") {
if ($runStatus['status'] == "running" && !$force_restart) {
$backend->configdRun("zabbixagent reconfigure");
} else {
diff --git a/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/IndexController.php b/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/IndexController.php
index 1114cf453..4a9afa5c4 100644
--- a/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/IndexController.php
+++ b/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/IndexController.php
@@ -42,7 +42,7 @@ class IndexController extends \OPNsense\Base\IndexController
public function indexAction()
{
// set page title
- $this->view->title = "Zabbix Agent Settings";
+ $this->view->title = gettext('Zabbix Agent Settings');
// include form definitions
$this->view->settingsForm = $this->getForm("settings");
// pick the template to serve
diff --git a/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/forms/settings.xml b/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/forms/settings.xml
index 51c079dfa..9eeb9c64c 100644
--- a/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/forms/settings.xml
+++ b/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/forms/settings.xml
@@ -7,7 +7,7 @@
- zabbixagent.settings.main.hostname
+ zabbixagent.local.hostname
text
diff --git a/net-mgmt/zabbix-agent/src/opnsense/mvc/app/models/OPNsense/ZabbixAgent/ZabbixAgent.xml b/net-mgmt/zabbix-agent/src/opnsense/mvc/app/models/OPNsense/ZabbixAgent/ZabbixAgent.xml
index d14e54bbe..93525f6f9 100644
--- a/net-mgmt/zabbix-agent/src/opnsense/mvc/app/models/OPNsense/ZabbixAgent/ZabbixAgent.xml
+++ b/net-mgmt/zabbix-agent/src/opnsense/mvc/app/models/OPNsense/ZabbixAgent/ZabbixAgent.xml
@@ -5,21 +5,24 @@
Enterprise-class open source distributed monitoring agent
+
+
+
+ Y
+ /^.{1,255}$/u
+ Should be a string between 1 and 255 characters.
+
+
0
Y
-
- Y
- /^.{1,255}$/u
- Should be a string between 1 and 255 characters.
-
Y
Y
- /^([a-zA-Z0-9\.:\[\]\s\-]*?,)*([a-zA-Z0-9\.:\[\]\s\-]*)$/
+ /^([a-zA-Z0-9\.:\[\]\-]*?,)*([a-zA-Z0-9\.:\[\]\-]*)$/
lower
Please provide valid Zabbix server addresses, i.e. 10.0.0.1 or zabbix.example.com.
@@ -50,12 +53,12 @@
val_3
- 0 - basic information
- 1 - critical information
- 2 - error information
- 3 - warnings [default]
- 4 - debugging
- 5 - extended debugging
+ basic information (0)
+ critical information (1)
+ error information (2)
+ warnings (3, default)
+ debugging (4)
+ extended debugging (5)
Y
@@ -105,7 +108,7 @@
N
Y
- /^([a-zA-Z0-9\.:\[\]\s\-]*?,)*([a-zA-Z0-9\.:\[\]\s\-]*)$/
+ /^([a-zA-Z0-9\.:\[\]\-]*?,)*([a-zA-Z0-9\.:\[\]\-]*)$/
lower
Please provide valid active check receivers, i.e. 10.0.0.1:10051, zabbix.example.com or [::1]:30051.
diff --git a/net-mgmt/zabbix-agent/src/opnsense/scripts/OPNsense/ZabbixAgent/setup.sh b/net-mgmt/zabbix-agent/src/opnsense/scripts/OPNsense/ZabbixAgent/setup.sh
index f5b7a0302..29ed6bcb8 100755
--- a/net-mgmt/zabbix-agent/src/opnsense/scripts/OPNsense/ZabbixAgent/setup.sh
+++ b/net-mgmt/zabbix-agent/src/opnsense/scripts/OPNsense/ZabbixAgent/setup.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-AGENT_DIRS="/var/run/zabbix /var/log/zabbix /usr/local/etc/zabbix_agentd.d"
+AGENT_DIRS="/var/run/zabbix /var/log/zabbix /usr/local/etc/zabbix_agentd.conf.d"
for directory in ${AGENT_DIRS}; do
mkdir -p ${directory}
diff --git a/net-mgmt/zabbix-agent/src/opnsense/service/conf/actions.d/actions_zabbixagent.conf b/net-mgmt/zabbix-agent/src/opnsense/service/conf/actions.d/actions_zabbixagent.conf
index 21c42aba4..ec61e646b 100644
--- a/net-mgmt/zabbix-agent/src/opnsense/service/conf/actions.d/actions_zabbixagent.conf
+++ b/net-mgmt/zabbix-agent/src/opnsense/service/conf/actions.d/actions_zabbixagent.conf
@@ -1,8 +1,3 @@
-[setup]
-command:/usr/local/opnsense/scripts/OPNsense/ZabbixAgent/setup.sh
-parameters:
-type:script_output
-
[start]
command:/usr/local/opnsense/scripts/OPNsense/ZabbixAgent/setup.sh; /usr/local/etc/rc.d/zabbix_agentd start
parameters:
@@ -22,7 +17,7 @@ type:script
message:restarting zabbix_agentd
[status]
-command:/usr/local/etc/rc.d/zabbix_agentd status || exit 0
+command:/usr/local/etc/rc.d/zabbix_agentd status
parameters:
type:script_output
message:requesting zabbix_agentd status
diff --git a/net-mgmt/zabbix-agent/src/opnsense/service/templates/OPNsense/ZabbixAgent/rc.conf.d b/net-mgmt/zabbix-agent/src/opnsense/service/templates/OPNsense/ZabbixAgent/rc.conf.d
index 81b7bff39..2e9281997 100644
--- a/net-mgmt/zabbix-agent/src/opnsense/service/templates/OPNsense/ZabbixAgent/rc.conf.d
+++ b/net-mgmt/zabbix-agent/src/opnsense/service/templates/OPNsense/ZabbixAgent/rc.conf.d
@@ -1,5 +1,6 @@
{% if helpers.exists('OPNsense.ZabbixAgent.settings.main.enabled') and OPNsense.ZabbixAgent.settings.main.enabled|default("0") == "1" %}
zabbix_agentd_enable=YES
+zabbix_agentd_opnsense_bootup_run="/usr/local/opnsense/scripts/OPNsense/ZabbixAgent/setup.sh"
{% else %}
zabbix_agentd_enable=NO
{% endif %}
diff --git a/net-mgmt/zabbix-agent/src/opnsense/service/templates/OPNsense/ZabbixAgent/zabbix_agentd.conf b/net-mgmt/zabbix-agent/src/opnsense/service/templates/OPNsense/ZabbixAgent/zabbix_agentd.conf
index 1124aa863..abc2e806e 100644
--- a/net-mgmt/zabbix-agent/src/opnsense/service/templates/OPNsense/ZabbixAgent/zabbix_agentd.conf
+++ b/net-mgmt/zabbix-agent/src/opnsense/service/templates/OPNsense/ZabbixAgent/zabbix_agentd.conf
@@ -102,8 +102,6 @@ StartAgents={{OPNsense.ZabbixAgent.settings.tuning.startAgents}}
#
{% if OPNsense.ZabbixAgent.settings.features.enableActiveChecks == '1' and OPNsense.ZabbixAgent.settings.features.activeCheckServers|default("") != "" %}
ServerActive={{OPNsense.ZabbixAgent.settings.features.activeCheckServers}}
-{% else %}
-# NOTE: Active checks are disabled
{% endif %}
### Option: Hostname
@@ -111,8 +109,8 @@ ServerActive={{OPNsense.ZabbixAgent.settings.features.activeCheckServers}}
# Required for active checks and must match hostname as configured on the server.
# Value is acquired from HostnameItem if undefined.
#
-{% if OPNsense.ZabbixAgent.settings.main.hostname|default("") != "" %}
-Hostname={{OPNsense.ZabbixAgent.settings.main.hostname}}
+{% if OPNsense.ZabbixAgent.local.hostname|default("") != "" %}
+Hostname={{OPNsense.ZabbixAgent.local.hostname}}
{% endif %}
### Option: HostnameItem
@@ -193,7 +191,7 @@ User=zabbix
# You may include individual files or all files in a directory in the configuration file.
# Installing Zabbix will create include directory in /usr/local/etc, unless modified during the compile time.
#
-Include=/usr/local/etc/zabbix_agentd.d
+Include=/usr/local/etc/zabbix_agentd.conf.d
####### USER-DEFINED MONITORED PARAMETERS #######