This commit is contained in:
2024-06-23 20:26:54 +03:00
parent c772daa1a1
commit 3364544c55
3 changed files with 12 additions and 8 deletions

View File

@@ -7,7 +7,7 @@ FROM ${BUILD_BASE_IMAGE} AS builder
# FROM $BUILD_FROM
# FROM alpine:3.19
FROM ghcr.io/home-assistant/amd64-base:3.18
FROM ghcr.io/hassio-addons/base:16.1.0
ARG MAJOR_VERSION
ARG ZBX_VERSION
@@ -64,8 +64,8 @@ RUN set -eux && \
chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \
chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \
chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \
# chmod a+x /etc/services.d/zabbix_agent2/run && \
# chmod a+x /etc/services.d/zabbix_agent2/finish
chmod a+x /etc/services.d/zabbix_agent2/run && \
chmod a+x /etc/services.d/zabbix_agent2/finish && \
chmod a+x /run.sh
EXPOSE 10050/TCP 31999/TCP
@@ -80,4 +80,5 @@ WORKDIR /var/lib/zabbix
USER 1997
# CMD ["/usr/sbin/zabbix_agent2", "--foreground", "-c", "/config/zabbix_agent2.conf"]
ENTRYPOINT []
CMD ["/run.sh"]

View File

@@ -12,7 +12,8 @@ arch:
- i386
startup: system
boot: auto
init: true
# init: true
apparmor: false
full_access: true
host_ipc: true
host_pid: true

View File

@@ -4,7 +4,7 @@
# Home Assistant Add-on: Zabbix agent 2
# Runs zabbix agent 2
# ==============================================================================
declare -a options
readonly ZBX_CFG_FILE='/config/zabbix_agent2.conf'
bashio::log.info 'Starting zabbix-agent2...'
@@ -14,5 +14,7 @@ if ! bashio::fs.file_exists "${ZBX_CFG_FILE}" || [ -z "$(ls -A ${ZBX_CFG_FILE})"
cp /etc/zabbix/zabbix_agent2.conf ${ZBX_CFG_FILE}
fi
# Run zabbix-agent2 in foreground
zabbix_agent2 --foreground -c /config/zabbix_agent2.conf
options+=(--foreground)
options+=(-c /config/zabbix_agent2.conf)
exec zabbix_agent2 "${options[@]}"