summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2024-07-31 15:25:47 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2024-07-31 15:25:47 +0000
commitab331fab9e92a69e68080d413bf926db14ac354b (patch)
treeaa65d6e9d253376575e1ddda64466f8d47a6545b
parent0dc248a587d6b002ce2f20877fe198d84f5e7945 (diff)
downloadvyos-1x-ab331fab9e92a69e68080d413bf926db14ac354b.tar.gz
vyos-1x-ab331fab9e92a69e68080d413bf926db14ac354b.zip
T5657: Add VRF support for zabbix-agent
To start the service under VRF requires starting under User=root otherwise it had issues with cgroups
-rw-r--r--data/templates/zabbix-agent/10-override.conf.j25
-rw-r--r--interface-definitions/service_monitoring_zabbix-agent.xml.in1
2 files changed, 5 insertions, 1 deletions
diff --git a/data/templates/zabbix-agent/10-override.conf.j2 b/data/templates/zabbix-agent/10-override.conf.j2
index 7c296e8fd..f6bd6500d 100644
--- a/data/templates/zabbix-agent/10-override.conf.j2
+++ b/data/templates/zabbix-agent/10-override.conf.j2
@@ -1,3 +1,4 @@
+{% set zabbix_command = 'ip vrf exec ' ~ vrf ~ ' ' if vrf is vyos_defined else '' %}
[Unit]
After=
After=vyos-router.service
@@ -5,9 +6,11 @@ ConditionPathExists=
ConditionPathExists=/run/zabbix/zabbix-agent2.conf
[Service]
+User=
+User=root
EnvironmentFile=
ExecStart=
-ExecStart=/usr/sbin/zabbix_agent2 --config /run/zabbix/zabbix-agent2.conf --foreground
+ExecStart={{ zabbix_command }}/usr/sbin/zabbix_agent2 --config /run/zabbix/zabbix-agent2.conf --foreground
WorkingDirectory=
WorkingDirectory=/run/zabbix
Restart=always
diff --git a/interface-definitions/service_monitoring_zabbix-agent.xml.in b/interface-definitions/service_monitoring_zabbix-agent.xml.in
index 3754e9145..e44b31312 100644
--- a/interface-definitions/service_monitoring_zabbix-agent.xml.in
+++ b/interface-definitions/service_monitoring_zabbix-agent.xml.in
@@ -185,6 +185,7 @@
</properties>
<defaultValue>3</defaultValue>
</leafNode>
+ #include <include/interface/vrf.xml.i>
</children>
</node>
</children>