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
391 changes: 254 additions & 137 deletions admin/zabbix/Makefile

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions admin/zabbix/files/zabbix-discovery-workers.conf.sysctl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fs.file-max=100000
3 changes: 3 additions & 0 deletions admin/zabbix/files/zabbix_agentd.init
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ start_service() {

[ -f ${CONFIG} ] || return 1

mkdir -p /var/run/zabbix
chown zabbix:zabbix /var/run/zabbix

procd_open_instance
procd_set_param command ${PROG} -c ${CONFIG} -f
procd_set_param respawn
Expand Down
3 changes: 3 additions & 0 deletions admin/zabbix/files/zabbix_server.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

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

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

# shellcheck disable=SC2034
START=59

# shellcheck disable=SC2034
USE_PROCD=1

NAME=zabbix_server
PROG=/usr/sbin/${NAME}
CONFIG=/etc/zabbix_server.conf

start_service() {
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

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

mkdir -p /var/run/zabbix
chown zabbix:zabbix /var/run/zabbix

procd_open_instance
procd_set_param command ${PROG} -c ${CONFIG} -f
procd_set_param user zabbix
procd_set_param limits nofile="16384 100000"
procd_set_param file ${CONFIG}
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
12 changes: 6 additions & 6 deletions admin/zabbix/patches/010-change-agentd-config.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Date: Wed, 17 Dec 2025 18:28:37 -0500
Subject: [PATCH] zabbix_agentd: Tweak config file for OpenWrt

Note: original patch had no header, header added 2025-12-16, while
bumping package version.
bumping package version. Modified 2025-12-25.

1. Use syslog not a file for logging
2. Do not use PidFile
3. Only start in passive agent by default
2. Place PidFile under /var/run/zabbix
3. Only start passive agent by default
4. Do not do active checks by default
5. Use the system hostname as hostname.
5. Use the system hostname as hostname (except on zabbix server)
6. Include configurations under /etc/zabbix_agentd.conf.d/

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
Expand All @@ -30,8 +30,8 @@ Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
-# Mandatory: no
-# Default:
-# PidFile=/tmp/zabbix_agentd.pid
+# We do not need PidFile with procd
+# PidFile=/var/run/zabbix_agentd.pid
+# Zabbix always creates a PidFile. Make sure it is where we want it.
+PidFile=/var/run/zabbix/zabbix_agentd.pid
+
+# use syslog
+LogType=system
Expand Down
52 changes: 52 additions & 0 deletions admin/zabbix/patches/020-change-server-config.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From 9675bd17ae35744696c90b423b0c19905349c8a1 Mon Sep 17 00:00:00 2001
From: "Daniel F. Dickinson" <dfdpublic@wildtechgarden.ca>
Date: Wed, 17 Dec 2025 06:39:16 -0500
Subject: [PATCH] Make zabbix_server config suitable for OpenWrt

1. Log to (default ephemeral) syslog, not a file (and don't rotate)
2. Update PidFile path so correct permissions can be set for access by
Zabbix server running without privileges.

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
---
conf/zabbix_server.conf | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

--- a/conf/zabbix_server.conf
+++ b/conf/zabbix_server.conf
@@ -27,6 +27,7 @@
# Mandatory: no
# Default:
# LogType=file
+LogType=system

### Option: LogFile
# Log file name for LogType 'file' parameter.
@@ -35,7 +36,7 @@
# Default:
# LogFile=

-LogFile=/tmp/zabbix_server.log
+# LogFile=/tmp/zabbix_server.log

### Option: LogFileSize
# Maximum size of log file in MB.
@@ -45,6 +46,7 @@ LogFile=/tmp/zabbix_server.log
# Range: 0-1024
# Default:
# LogFileSize=1
+LogFileSize=0

### Option: DebugLevel
# Specifies debug level:
@@ -67,6 +69,10 @@ LogFile=/tmp/zabbix_server.log
# Default:
# PidFile=/tmp/zabbix_server.pid

+# Although procd does not require a pid file, zabbix uses the pidfile to
+# correctly shutdown on receipt of a TERM or INT signal.
+PidFile=/var/run/zabbix/zabbix_server.pid
+
### Option: SocketDir
# IPC socket directory.
# Directory to store IPC sockets used by internal Zabbix services.