Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 33 additions & 16 deletions admin/zabbix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=zabbix
PKG_VERSION:=7.0.28
PKG_RELEASE:=1
PKG_RELEASE:=2

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://cdn.zabbix.com/zabbix/sources/stable/$(basename $(PKG_VERSION))/ \
Expand Down Expand Up @@ -192,7 +192,6 @@ define Package/zabbix-server-or-proxy/Default
+libevent2-extra \
+libpcre2 \
+zlib
USERID:=zabbix-server=70:zabbix-server=70
endef

define Package/zabbix-proxy/Default
Expand All @@ -202,6 +201,7 @@ define Package/zabbix-proxy/Default
@zabbix-proxy-any \
zabbix-proxy-ssl \
zabbix-proxy-openssl
USERID:=zabbix-proxy=71:zabbix-proxy=71
endef

define Package/zabbix-proxy
Expand Down Expand Up @@ -281,6 +281,7 @@ define Package/zabbix-server
PROVIDES:= \
zabbix-server-ssl \
zabbix-server-openssl
USERID:=zabbix-server=70:zabbix-server=70
VARIANT:=full
endef

Expand Down Expand Up @@ -453,7 +454,7 @@ define Build/Configure
$(call Build/Configure/Default)
endef

# We use spaces for continued lines so that is if continuation does not parse
# We use spaces for continued lines so that if continuation does not parse
# properly we will get a hard error instead of subtle failure.
define Build/Compile
$(call Build/Compile/Default)
Expand Down Expand Up @@ -492,44 +493,60 @@ endef

define Package/zabbix-agentd/conffiles
/etc/zabbix_agentd.conf
/etc/config/zabbix_agentd
endef

define Package/zabbix-agentd/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || (. /etc/uci-defaults/90_zabbix_agentd) && rm -f /etc/uci-defaults/90_zabbix_agentd
exit 0
endef

define Package/zabbix-agentd/install
$(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d
$(call Package/zabbix/install/sbin,$(1),agentd)
$(call Package/zabbix/install/etc,$(1),agentd)
$(call Package/zabbix/install/init.d,$(1),agentd)
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/zabbix_agentd.config $(1)/etc/config/zabbix_agentd
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/zabbix_agentd.defaults $(1)/etc/uci-defaults/90_zabbix_agentd
endef

define Package/zabbix-agentd-basic/conffiles
/etc/zabbix_agentd.conf
endef
Package/zabbix-agentd-basic/conffiles=$(call Package/zabbix-agentd/conffiles)
Package/zabbix-agentd-basic/postinst=$(call Package/zabbix-agentd/postinst)

define Package/zabbix-agentd-basic/install
$(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d
$(call Package/zabbix/install/sbin,$(1),agentd)
$(call Package/zabbix/install/etc,$(1),agentd)
$(call Package/zabbix/install/init.d,$(1),agentd)
$(call Package/zabbix-agentd/install,$(1))
endef

define Package/zabbix-proxy/conffiles
/etc/zabbix_proxy.conf
/etc/config/zabbix_proxy
endef

define Package/zabbix-proxy/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || (. /etc/uci-defaults/90_zabbix_proxy) && rm -f /etc/uci-defaults/90_zabbix_proxy
exit 0
endef

define Package/zabbix-proxy/install
$(INSTALL_DIR) $(1)/etc/zabbix_proxy.conf.d
$(call Package/zabbix/install/sbin,$(1),proxy)
$(call Package/zabbix/install/etc,$(1),proxy)
$(call Package/zabbix/install/init.d,$(1),proxy)
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/zabbix_proxy.config $(1)/etc/config/zabbix_proxy
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/zabbix_proxy.defaults $(1)/etc/uci-defaults/90_zabbix_proxy
endef

define Package/zabbix-proxy-basic-sqlite/conffiles
/etc/zabbix_proxy.conf
endef
Package/zabbix-proxy-basic-sqlite/conffiles=$(call Package/zabbix-proxy/conffiles)
Package/zabbix-proxy-basic-sqlite/postinst=$(call Package/zabbix-proxy/postinst)

define Package/zabbix-proxy-basic-sqlite/install
$(INSTALL_DIR) $(1)/etc/zabbix_proxy.conf.d
$(call Package/zabbix/install/sbin,$(1),proxy)
$(call Package/zabbix/install/etc,$(1),proxy)
$(call Package/zabbix-proxy/install,$(1))
endef

define Package/zabbix-server/conffiles
Expand Down
4 changes: 4 additions & 0 deletions admin/zabbix/files/zabbix_agentd.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

config zabbix_agentd 'general'
option enabled 0
# option never_root 1
3 changes: 3 additions & 0 deletions admin/zabbix/files/zabbix_agentd.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

chown zabbix-agent:zabbix-agent /etc/zabbix_agentd.conf
38 changes: 32 additions & 6 deletions admin/zabbix/files/zabbix_agentd.init
Original file line number Diff line number Diff line change
@@ -1,26 +1,52 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2008-2011 OpenWrt.org

# shellcheck shell=busybox

# shellcheck disable=SC2034
START=60

# shellcheck disable=SC2034
USE_PROCD=1
PROG=/usr/sbin/zabbix_agentd
CONFIG=/etc/zabbix_agentd.conf
NAME=zabbix_agentd
PROG=/usr/sbin/${NAME}
CONFIG=/etc/${NAME}.conf
UCI_CONFIG=/etc/config/${NAME}
USER=zabbix-agent

start_service() {
local enabled never_root

# Sometimes the agentd config was installed in /etc/zabbix/zabbix_agentd.conf
[ -f /etc/zabbix/zabbix_agentd.conf ] && mv /etc/zabbix/zabbix_agentd.conf ${CONFIG}

[ -f ${CONFIG} ] || return 1
if [ ! -f "${CONFIG}" ]; then
logger "Configuration file not found: '${CONFIG}'"
return 1
fi

# Get enabled config option
config_load "$NAME"
config_get_bool enabled general enabled 0
config_get_bool never_root general never_root 1

mkdir -p /var/run/zabbix-agent
chown zabbix-agent:zabbix-agent /var/run/zabbix-agent
# shellcheck disable=SC2154
if [ "$enabled" -eq 0 ]; then
logger "service not enabled in $UCI_CONFIG"
return 1
fi

mkdir -p "/var/run/$USER"
chown $USER:$USER "/var/run/$USER"

procd_open_instance
procd_set_param command ${PROG} -c ${CONFIG} -f
if [ "$never_root" -eq 1 ]; then
procd_set_param user ${USER}
fi
procd_set_param file ${CONFIG}
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}

4 changes: 4 additions & 0 deletions admin/zabbix/files/zabbix_proxy.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

config zabbix_proxy 'general'
option enabled 0
# option never_root 1
3 changes: 3 additions & 0 deletions admin/zabbix/files/zabbix_proxy.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

chown zabbix-proxy:zabbix-proxy /etc/zabbix_proxy.conf
50 changes: 50 additions & 0 deletions admin/zabbix/files/zabbix_proxy.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2008-2025 OpenWrt.org

# shellcheck shell=busybox

# shellcheck disable=SC2034
START=59

# shellcheck disable=SC2034
USE_PROCD=1

NAME=zabbix_proxy
PROG=/usr/sbin/${NAME}
CONFIG=/etc/${NAME}.conf
UCI_CONFIG=/etc/config/${NAME}
USER=zabbix-proxy

start_service() {
local enabled never_root

if [ ! -f "${CONFIG}" ]; then
logger "Configuration file not found: '${CONFIG}'"
return 1
fi

# Get enabled config option
config_load "$NAME"
config_get_bool enabled general enabled 0
config_get_bool never_root general never_root 1

# shellcheck disable=SC2154
if [ "$enabled" -eq 0 ]; then
logger "service not enabled in $UCI_CONFIG"
return 1
fi

mkdir -p "/var/run/$USER"
chown $USER:$USER "/var/run/$USER"

procd_open_instance
procd_set_param command ${PROG} -c ${CONFIG} -f
if [ "$never_root" -eq 1 ]; then
procd_set_param user ${USER}
fi
procd_set_param file ${CONFIG}
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
1 change: 1 addition & 0 deletions admin/zabbix/files/zabbix_server.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

config zabbix_server 'general'
option enabled 0
# option never_root 1
19 changes: 14 additions & 5 deletions admin/zabbix/files/zabbix_server.init
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2008-2025 OpenWrt.org

# shellcheck shell=busybox

# shellcheck disable=SC2034
START=59

Expand All @@ -9,9 +11,13 @@ USE_PROCD=1

NAME=zabbix_server
PROG=/usr/sbin/${NAME}
CONFIG=/etc/zabbix_server.conf
CONFIG=/etc/${NAME}.conf
UCI_CONFIG=/etc/config/${NAME}
USER=zabbix-server

start_service() {
local enabled never_root

if [ ! -f "${CONFIG}" ]; then
logger "Configuration file not found: '${CONFIG}'"
return 1
Expand All @@ -20,19 +26,22 @@ start_service() {
# Get enabled config option
config_load "$NAME"
config_get_bool enabled general enabled 0
config_get_bool never_root general never_root 1

# shellcheck disable=SC2154
if [ "$enabled" -eq 0 ]; then
logger "service not enabled in /etc/config/$NAME"
logger "service not enabled in $UCI_CONFIG"
return 1
fi

mkdir -p /var/run/zabbix-server
chown zabbix-server:zabbix-server /var/run/zabbix-server
mkdir -p "/var/run/$USER"
chown $USER:$USER "/var/run/$USER"

procd_open_instance
procd_set_param command ${PROG} -c ${CONFIG} -f
procd_set_param user zabbix-server
if [ "$never_root" -eq 1 ]; then
procd_set_param user ${USER}
fi
procd_set_param limits nofile="16384 100000"
procd_set_param file ${CONFIG}
procd_set_param respawn
Expand Down
92 changes: 0 additions & 92 deletions admin/zabbix/patches/010-change-agentd-config.patch

This file was deleted.

Loading