Zabbix network monitoring
There are a number of packages for Zabbix in OpenWrt, as listed on administration---zabbix.
Zabbix Agent
In OpenWrt the zabbix-agentd is a standard Zabbix 7.0.9 agent (for OpenWrt 24.10.0 through 24.10.4, at least) whose configuration is detailed in the upstream Zabbix documentation. In OpenWrt, however, there are three precompiled 'flavors': the base (no SSL) agent, the agent with GnuTLS for SSL, and the agent with OpenSSL for SSL.
Zabbix Server
The Zabbix Server packages (for the same three flavors as the agent) in OpenWrt currently do not have a procd initscript, so here is one you can use until one is added to the package (add as /etc/init.d/zabbix_server and issue /etc/init.d/zabbix_server enable. You will likely also want to add /etc/init.d/zabbix_server to /etc/sysupgrade.conf in order to preserve the initscript during a sysupgrade).
Note: This script expects /etc/zabbix_server.conf to contain a directive PidFile=/etc/zabbix/zabbix_server.pid
#!/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
chown zabbix:zabbix ${CONFIG}
start_service() {
[ -f ${CONFIG} ] || return 1
procd_open_instance
procd_set_param command ${PROG} -c ${CONFIG} -f
procd_set_param limits nofile="16384 100000"
procd_set_param file ${CONFIG}
procd_set_param user zabbix
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
Zabbix Server Frontend (Web UI)
The web interface for Zabbix is in the package zabbix-server-frontend. It is not configured by default and takes some work to get setup. For a tutorial on this, see frontend_tutorial.
OpenWrt 'extra' packages for Zabbix
There are 3 'extra' packages for zabbix that add userparameters and detections rules for zabbix-agentd:
- zabbix-extra-network: a detection rule with the ifname (eth0.1) and the network name (wan)
- zabbix-extra-wifi: an universal detection rule for wifi (using libuci-lua) and many userparameters (using libiwinfo-lua)
- zabbix-extra-mac80211: a phy (phy0) detection rule and userparameters for mac80211 devices
Here follow Zabbix templates for Openwrt
“Template Openwrt Mac80211” (for zabbix-extra-mac80211): http://pastebin.com/3iWQq2kc
“Template Openwrt Network” (for zabbix-extra-network): http://pastebin.com/5Jcg7w9j
“Template Openwrt Wifi” (for zabbix-extra-wifi): http://pastebin.com/uWtWT6C8
“All in one”: http://pastebin.com/nQdZM89w
Relevant commit: https://dev.openwrt.org/changeset/36740
Tips and tricks for Zabbix on OpenWrt
Configure Zabbix Server to monitor flash file systems
By default, Zabbix does not monitor flash filesystems such as ubifs or f2fs. Here is how to monitor them.
In the Zabbix web UI:
- Select 'Administration|General|Regular expressions'
- Update 'Filesystems for discovery to include f2fs|ubifs (E.g. update 'Expressions' to
^(btrfs|ext2|ext3|ext4|f2fs|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|ubifs|zfs)$ - Select 'Update'
- Clone 'Data collection|templates|Linux by Zabbix agent' (and/or 'Data collection|templates|Linux by Zabbix agent active') as 'Data collection|Templates|Linux on OpenWrt by Zabbix agent'
- Select 'Data collection|Templates|Linux on OpenWrt by Zabbix agent'
- Select 'Macros'
- Edit
{$VFS.FS.FSTYPE.MATCHES}to be^(btrfs|ext2|ext3|ext4|f2fs|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|ubifs|zfs)$ - Select 'Update'
- Optional: Repeat this for host macros