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.
1) A server with (Ubuntu 18.04) Zabbix and Grafana installed and set up.
2) A Linux client with the Unifi controller and Zabbix agent installed.
3) About 30+ minutes.
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.
Step 2: Edit the configuration files to match your environment.
2a: Edit the main config file
-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: Edit the zbx_unifi.conf file
-Double check the module path, but the defaults should be good.
2c: Customize Unifi Proxy service scripts, if need be.
-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.
-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 (done as root).
3a: Copy the services files and make executable.
cp ~/unifi_proxy/etc/init.d/unifi_proxy /etc/init.d/unifi_proxy
chmod +x /etc/init.d/unifi_proxy
3b: Create the Unifi Proxies folder and copy the files.
cp ~/unifi_proxy/etc/unifi_proxy/unifi_proxy.conf /etc/unifi_proxy/
cp ~/unifi_proxy/etc/zabbix/zbx_unifi.conf /etc/zabbix/
cp ~/unifi_proxy/usr/lib/systemd/system/unifi-proxy.service /lib/systemd/system/
cp ~/unifi_proxy/usr/local/lib/zabbix/unifi.conf /usr/local/lib/zabbix/
cp ~/unifi_proxy/usr/local/sbin/unifi_proxy.pl /usr/local/sbin/
chmod +x /usr/local/sbin/unifi_proxy.pl
3c: Restart the Zabbix Agent service and make sure its running.
service zabbix-agent restart
service zabbix-agent status
3d: Enable on start and start the Unifi Proxy service and test it.
systemctl enable unifi_proxy
service unifi_proxy start
zabbix_agentd -t "unifi.proxy[discovery,wlan]";
Step 4: Upload the template to the Zabbix server and apply it to the Agent and ensure everything is working.
4b: Live data collection
About me: I am an IT professional who is passionate about technology and it's uses to propel people to their potential. I would love to talk to you!