Installing Zabbix Agent Version 1
Preparation
You need to install zabbix-agent:
apt update && apt install zabbix-agent -y
Our repository contains only version 1 of the agent, but you can install version 2 on the Zabbix server (or on the controller) and connect to the controller's MQTT from there.
Templates
For convenience, you can use the ready-to-use Zabbix templates for Wiren Board devices.
Configuring Zabbix Agent
In Zabbix, variable values are obtained by reading the retained values of the channels.
For the zabbix agent to work, it must be given extended access rights. For this you will need to install sudo:
apt install sudo -y
You can grant the required rights to the zabbix user with the command:
echo 'zabbix ALL=(ALL) NOPASSWD: /usr/bin/mosquitto_sub' > /etc/sudoers.d/zabbix-mqtt
Next, create the file zabbix-mqtt.conf in the /etc/zabbix/zabbix_agentd.conf.d/ directory and write the following line into it:
UserParameter=mqtt.value[*], sudo mosquitto_sub -t '$1' -C 1
You can do this with a single command:
echo "UserParameter=mqtt.value[*], sudo mosquitto_sub -t '\$1' -C 1" > /etc/zabbix/zabbix_agentd.conf.d/zabbix-mqtt.conf
Usage
Channels in Zabbix are accessed as follows:
mqtt.value[topic]
where topic is the topic of the corresponding channel in MQTT
for example:
mqtt.value[/devices/sht1x/controls/humidity] mqtt.value[/devices/sht1x/controls/temperature]
An example of testing the agent, run it on the controller:
zabbix_agentd -t mqtt.value[/devices/buzzer/controls/frequency]
Useful links
- Repository with the deprecated native Zabbix bridge. Packages are in the Releases section.