How To: Integrate Unifi AP Metrics into Zabbix (and Graph It in Grafana)
Integrate Unifi Access Point metrics into a Zabbix server and graph the data with Grafana, using the Unifi Proxy project on Ubuntu Linux 18.04.
Credits: zbx_sadman for creating the awesome Unifi Proxy project.
Difficulty level: Intermediate
Why? The Unifi Controller software is perfectly fine but if you have a Zabbix server set up and monitoring infrastructure, you can integrate Unifi AP’s into the mix, even with alerting and graphing (with Grafana). The instructions on Unifi Proxy’s github are very minimal which is the reason why for this guide. You can poll and graph all kinds of interesting Unifi Controller data such as signal strength, the number of connected clients, uptime, overall WiFi health, etc.
Purpose: to obtain and display information from Unifi Access Points into a Zabbix server and finally graph the data with Grafana. This guide uses Ubuntu Linux 18.04 ran in a Container.
Prerequisites:
-
A server with (Ubuntu 18.04) Zabbix and Grafana installed and set up.
-
A Linux client with the Unifi controller and Zabbix agent installed.
-
About 30+ minutes.
On the Unifi Controller
Step 1: Getting started.
1a: Install requirements.
sudo apt-get install git libjson-perl libjson-xs-perl libwww-perl libio-socket-ssl-perl libio-socket-ip-perl libdata-dumper-simple-perl libtime-hires-perl -y
1b: Clone the Unifi Proxy project a local folder on the server.
git clone https://github.com/zbx-sadman/unifi_proxy.git
1c: Change directory into the projects folder.
cd unifi_proxy/
Step 2: Edit the configuration files to match your environment.
2a: Edit the main config file
sudo nano ~/unifi_proxy/etc/unifi_proxy/unifi_proxy.conf
-Edit ‘UniFiUser’ to reflect your Unifi controllers username.
-Edit ‘UniFiPass’ to reflect your Unifi controllers password.
-Ensure that ‘UnifiLocation’ is set correctly.
-Ensure ‘UnifiVersion’ is correct.
-The defaults should be good, but its good to double check.
2b: OPTIONAL: Edit the zbx_unifi.conf file
sudo nano ~/unifi_proxy/etc/zabbix/zbx_unifi.conf
-Double check the module path, but the defaults should be good.
2c: OPTIONAL: Customize Unifi Proxy service scripts, if need be.
sudo nano ~/unifi_proxy/etc/init.d/unifi_proxy
-You shouldn’t have to edit this file but you can if you want to customize how the Unifi Proxy service starts, stops, reloads, etc.
2d: Edit your Zabbix agent config file. The UserParameter is used by the Zabbix Agent to poll Unifi Controller based on the templates predefined parameters.
sudo nano /etc/zabbix/zabbix_agentd.conf
-Add the following to the end of the file (be careful copying and pasting):
UserParameter=unifi.proxy[*],echo "$1,$2,$3,$4,$5,$6,$7" | nc 127.0.0.1 8448 -q 1
Step 3: Copy the programs files to finish the installation and restart services.
3a: Copy the services files and make executable.
sudo cp ~/unifi_proxy/etc/init.d/unifi_proxy /etc/init.d/unifi_proxy
sudo chmod +x /etc/init.d/unifi_proxy
3b: Create the Unifi Proxies folder and copy the files.
sudo mkdir /etc/unifi_proxy/
sudo mkdir /usr/local/lib/zabbix/
sudo cp ~/unifi_proxy/etc/unifi_proxy/unifi_proxy.conf /etc/unifi_proxy/
sudo cp ~/unifi_proxy/etc/zabbix/zbx_unifi.conf /etc/zabbix/
sudo cp ~/unifi_proxy/usr/lib/systemd/system/unifi-proxy.service /lib/systemd/system/
sudo cp ~/unifi_proxy/usr/local/lib/zabbix/unifi.conf /usr/local/lib/zabbix/
sudo cp ~/unifi_proxy/usr/local/sbin/unifi_proxy.pl /usr/local/sbin/
sudo chmod +x /usr/local/sbin/unifi_proxy.pl
3c: Restart the Zabbix Agent service and make sure its running.
sudo service zabbix-agent restart
sudo service zabbix-agent status
3d: Enable on start and start the Unifi Proxy service and test it.
sudo systemctl enable unifi_proxy
sudo service unifi_proxy start
sudo zabbix_agentd -t "unifi.proxy[discovery,wlan]";
On the Zabbix Server
Step 4: Upload the template to the Zabbix server and apply it to the Agent and ensure everything is working.
4a: Template - Download the template from the Unifi Proxy repository.
4b: Live data collection - Configure the template on your host and verify data is being collected.
More writing
Home Lab Fun: Virtualize a Domain — Part II: Router Configuration
Detailed instructions on installing and configuring pfSense as a router, optionally exposing its WebGUI on the WAN, and creating an IPSec tunnel between two offices on separate networks.
ReadThe Generalist's Edge: Doing IT Work in the Age of AI
I'm a generalist, not a specialist — and for the first time that feels like an advantage instead of an apology. How AI changed what one IT person can actually do in a day.
ReadMoonLander Enhanced: Teaching an AI to Land on the Moon (and Other Things I Didn't Plan to Build)
A browser remake of the 1979 Atari Lunar Lander that turned into real orbital physics, historic Apollo missions, and an AI Theater where you watch a neural net learn to land in real time. Built with AI, for fun.
Read