summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2023-08-08 19:31:00 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2023-08-09 14:28:21 +0000
commitf9acf743cc27727d38dcbff6fb59534b5a1b443f (patch)
tree12656781942f5b4448ae3b97fc00c1f343ff52e9 /data
parent0e92ee262d8ec6ee88d7331f2cbffe8b6b689437 (diff)
downloadvyos-1x-f9acf743cc27727d38dcbff6fb59534b5a1b443f.tar.gz
vyos-1x-f9acf743cc27727d38dcbff6fb59534b5a1b443f.zip
T5448: Add service zabbix-agent version 2
Add service zabbix-agent set service zabbix-agent directory '/config/zabbix/' set service zabbix-agent limits buffer-flush-interval '8' set service zabbix-agent limits buffer-size '120' set service zabbix-agent log debug-level 'warning' set service zabbix-agent log size '1' set service zabbix-agent server '192.0.2.5' set service zabbix-agent server-active 192.0.2.5 port '10051' set service zabbix-agent server-active 2001:db8::123
Diffstat (limited to 'data')
-rw-r--r--data/templates/zabbix-agent/10-override.conf.j214
-rw-r--r--data/templates/zabbix-agent/zabbix-agent.conf.j273
2 files changed, 87 insertions, 0 deletions
diff --git a/data/templates/zabbix-agent/10-override.conf.j2 b/data/templates/zabbix-agent/10-override.conf.j2
new file mode 100644
index 000000000..7c296e8fd
--- /dev/null
+++ b/data/templates/zabbix-agent/10-override.conf.j2
@@ -0,0 +1,14 @@
+[Unit]
+After=
+After=vyos-router.service
+ConditionPathExists=
+ConditionPathExists=/run/zabbix/zabbix-agent2.conf
+
+[Service]
+EnvironmentFile=
+ExecStart=
+ExecStart=/usr/sbin/zabbix_agent2 --config /run/zabbix/zabbix-agent2.conf --foreground
+WorkingDirectory=
+WorkingDirectory=/run/zabbix
+Restart=always
+RestartSec=10
diff --git a/data/templates/zabbix-agent/zabbix-agent.conf.j2 b/data/templates/zabbix-agent/zabbix-agent.conf.j2
new file mode 100644
index 000000000..77f57f32f
--- /dev/null
+++ b/data/templates/zabbix-agent/zabbix-agent.conf.j2
@@ -0,0 +1,73 @@
+# Generated by ${vyos_conf_scripts_dir}/service_zabbix_agent.py
+
+PidFile=/run/zabbix/zabbix_agent2.pid
+LogFile=/var/log/zabbix/zabbix_agent2.log
+ControlSocket=/run/zabbix/agent.sock
+
+{% if log is vyos_defined %}
+{% if log.size is vyos_defined %}
+### Option: LogFileSize
+# Maximum size of log file in MB.
+# 0 - disable automatic log rotation.
+#
+# Range: 0-1024
+LogFileSize={{ log.size }}
+{% endif %}
+{% if log.remote_commands is vyos_defined %}
+LogRemoteCommands=1
+{% endif %}
+{% if log.debug_level is vyos_defined %}
+{% set mapping = {
+ 'basic': 0,
+ 'critical': 1,
+ 'error': 2,
+ 'warning': 3,
+ 'debug': 4,
+ 'extended-debug': 5
+ } %}
+DebugLevel={{ mapping[log.debug_level] }}
+{% endif %}
+{% endif %}
+
+{% if server is vyos_defined %}
+Server={{ server | bracketize_ipv6 | join(',') }}
+{% endif %}
+{% if server_active is vyos_defined %}
+{% set servers = [] %}
+{% for key, value in server_active.items() %}
+{% if value.port %}
+{% set serv_item = key | bracketize_ipv6 + ':' + value.port %}
+{% set _ = servers.append(serv_item) %}
+{% else %}
+{% set _ = servers.append(key | bracketize_ipv6) %}
+{% endif %}
+{% endfor %}
+ServerActive={{ servers | join(',') }}
+{% endif %}
+
+{% if port is vyos_defined %}
+ListenPort={{ port }}
+{% endif %}
+{% if listen_address is vyos_defined %}
+ListenIP={{ listen_address | join(',') }}
+{% endif %}
+
+{% if limits is vyos_defined %}
+{% if limits.buffer_flush_interval is vyos_defined %}
+BufferSend={{ limits.buffer_flush_interval }}
+{% endif %}
+{% if limits.buffer_size is vyos_defined %}
+BufferSize={{ limits.buffer_size }}
+{% endif %}
+{% endif %}
+
+{% if directory is vyos_defined %}
+### Option: Include
+# You may include individual files or all files in a directory in the configuration file.
+Include={{ directory }}/*.conf
+{% endif %}
+
+{% if timeout is vyos_defined %}
+Timeout={{ timeout }}
+{% endif %}
+