In this article, we will go through how to monitor UniFi Controller values using Zabbix Server and custom templates. Zabbix is a network monitoring software, where we can have multiple servers reporting details about their status, such as network connectivity, disk space, available memory etc. The UniFi Controller is software required to monitor and control Ubiquiti’s network devices. The controller exposes a web API that we will utilize to extract information about the status of our WiFi and detect any issues.
We will go through the process of installing the binaries required to extract the information from the controller. Then we’ll create the template that will call the the binaries and process the data on the Zabbix Server. Finally, we’ll connect the server running the controller to the Zabbix Server and create a graph so that we can monitor past and current data from the controller.
Installed Zabbix Server (I’m currently running v4.0); SSH access to server running the controller and familiarity with apt and Ubuntu/Debian. Its assumed that the controller is running on a Linux OS. If the controller is installed on a CloudKey, you’ll find directions on how to enable SSH access and install Zabbix and the binaries at the bottom of this article. If you have any questions or comments, write in the comment section below or contact me directly.
Installing binaries on the UniFi Controller
For the next step, I wrote a shell script that would utilize the curl command to retrieve data from the controller. In this case, what we want to monitor is the WiFi experience. This value is calculated by the controller and gives us an indication of the health of the current WiFi setup. As far as I know, the only way to get this data is from the website, if there is a way to grab it from the MongoDB, please leave a comment and I’ll update the article.
Grab the files from the GitHub repository.
Copy the .sh and the .conf file to the /etc/zabbix directory and change the owner and permission on the .sh and conf file.
chown zabbix:zabbix unifi_command.sh
chown zabbix:zabbix userparameter_unifi.conf
chmod u+x unifi_command.sh
Edit the zabbix_agent.conf file, browse down to the Include option and add the following;
Restart the zabbix-agent service
systemctl restart zabbix-agent
Then head back to the Zabbix server and we’ll create the template.