Zabbix - Monitoring UniFi Controller

I usually run the UniFi Network Application in Docker, and more recently UniFi OS Server in podman. One of our locations, though, runs it on a Windows Server VM. The application can't run as a Windows service, so after a reboot it just doesn't start. I needed an alert for that, and Zabbix can do it.

Using a "Web scenario" we can set up a monitor on the UniFi webpage to detect if it is up or not. Then we set up a trigger on whether the one step of that scenario fails (1) or passes (0).

Create the web scenario

  1. Go to Monitoring > Hosts, click the host running the app, and choose Web.
  2. Click "Create web scenario" in the top right and give it a name. I used "UniFi Controller".
  3. Under Steps, add one step pointing at the UniFi login page. No credentials are needed, because we only care whether the page loads.

Create the trigger

Under Triggers, click "Create trigger". The name is up to you. Use these expressions:

Problem: last(/HOST/web.test.fail[UniFi Controller],#1)=1

Recovery: last(/HOST/web.test.fail[UniFi Controller],#1)=0

Replace HOST with your host's name, and "UniFi Controller" with whatever you named the scenario. The #1 means "the most recent check", so a single failed check fires the alert. Raise it if you want the page more chances to come back on its own. The value after the equals sign is the number of the failed step. It's 0 when nothing failed, which is why the recovery expression uses 0. I only have one step, so the problem expression uses 1.

Add a dashboard widget (optional)

I like having a widget that shows up or down at a glance.

  1. Add a widget to the dashboard. I use Honeycomb, but Item card or Item value also work.
  2. Pick the host. For Item pattern, enter "Failed step of scenario...".
  3. Under Advanced configuration, set Text to {ITEM.NAME}.
  4. Set the background color to green. Add a threshold of 1 and set its color to red.

The widget is green while every step passes (0) and turns red if step 1 fails (1).