Configure Zabbix Server

Details on configuring Zabbix Server on OpenWrt, including a PROCD initscript, and an example configuration file.

Prepare for Zabbix Server

  1. mkdir -p /srv/tmp
  2. chmod 1777 /srv/tmp
  3. mkdir -p /srv/log/zabbix
  4. chown root:zabbix /srv/log/zabbix
  5. chmod g+rwX /srv/log/zabbix

Add an initscript for zabbix_server

Add the following as /etc/init.d/zabbix_server, then

  1. chmod a+x /etc/init.d/zabbix_server
  2. /etc/init.d/zabbix_server enable
#!/bin/sh /etc/rc.common
# Copyright (C) 2008-2011 OpenWrt.org

START=59

USE_PROCD=1
PROG=/usr/sbin/zabbix_server
CONFIG=/etc/zabbix_server.conf

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

start_service() {
  [ -f ${CONFIG} ] || return 1

  procd_open_instance
  procd_set_param command ${PROG} -c ${CONFIG} -f
  procd_set_param pidfile /run/zabbix_server.pid
  procd_set_param limits nofile="16384 100000"
  procd_set_param file /etc/zabbix_server.conf
  procd_set_param respawn
  procd_set_param stdout 1
  procd_set_param stderr 1
  procd_close_instance
}

Update zabbix_server.conf as appropriate. For example (comments trimmed; see /rom/etc/zabbix_server.conf to see an unmodified config file):

# This is a configuration file for Zabbix server daemon
# To get more information about Zabbix, visit https://www.zabbix.com

LogType=file
LogFile=/srv/log/zabbix/zabbix_server.log

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=<your-db-password>

Timeout=4
LogSlowQueries=3000
TmpDir=/srv/tmp

StatsAllowedIP=127.0.0.1

TLSCAFile=/path/to/your/ca-certificate.pem
TLSCertFile=/path/to/your/server-certificate.pem
TLSKeyFile=/path/to/your/server-key.pem

Start the Zabbix Server

service zabbix_server start