I needed a way to monitor each aspect of a Ubiquiti deployment but had a constraint on only polling data from the Unifi controller. We are not able to poll each Ubiquiti device directly via SNMP. This solution is two part.
- This script will read data from the Unifi API and import each Unifi site and every device in each site as an ICMP only node into Orion. It will automatically set all associated custom properties needed for part two below. If this script is re-run again it will skip over what has already been added and fix any custom property assignments if they differ. This is something that could be set as a scheduled task in Windows to run daily/weekly etc or just run adhoc as needed. If a Unifi Site is removed from Unifi, that respective Orion node will also be removed. What is unique here is that each ICMP only node is added with an IP of '127.0.0.1' with a polling interval of 9999 seconds. So by itself it should always respond but the end goal is to have a entry for the node which will allow me to do more things.

- There is a SAM Template attached to this article which will reference the created Orion Custom Property detail from step 1. It will call into the Ubiquiti Unifi API to gather general health per Unifi site. I created an Orion Group called "Ubiquiti Controller" with a Dynamic Query of MachineType is "Ubiquiti Site Controller". I also created a second Orion Group called "Ubiquiti WAP" with a Dynamic Query of Machine Type begins with "Ubiquiti UAP". Then I assigned the SAM template to each respective Orion group. Note* You will have to assign a credential in the SAM template that has access to the Unifi API.

You'll notice in the Manage Node page above that after the SAM template is assigned I can roll up application status to the node to know when a site is having a general problem. This then allows me to leverage existing Orion Alerts and Dashboards.
Future enhancements: Adding each device (Switch, Gateway/Firewall/ WAP) as ICMP only nodes and then having a second SAM template to poll into the Ubiquiti Unifi API to gather metrics specific to them.
You can download zip file here. There are two files. The first, Unifi Auto Import.ps1 is to be run adhoc or on a schedule (Step one above), the second, Ubiquiti Controller Stats.apm-template, needs to be imported into SAM as a template.
[View:/cfs-file/__key/communityserver-discussions-components-files/4/Ubiquiti-Setup-Files.zip:640:480]