UniFi Inventory & Diagnostics: Automated Site Audit

The Challenge
Managing a large UniFi environment often involves clicking through multiple sites in the Controller UI to get a simple headcount of devices or to check WAN status. For Managed Service Providers (MSPs) or large enterprises, manually aggregating this data for reports is tedious and prone to error.
The goal was to instantly retrieve a high-level inventory to:
- List all sites and their unique IDs
- Count connected clients (Wireless vs. Wired)
- Verify the health of WAN uplinks
- Present data in a clean, administrative format
The Prompt Sent to Myrmex
Using the Myrmex integration for UniFi, we sent:
Connect to the UniFi Controller and retrieve a complete list of all configured sites.
For each site, display the site name, its unique site ID, and the current number of
connected devices. Present the data in a clear list or table format for administrative
review without making any configuration changes.
Note: Myrmex abstracts the complexity of the UniFi API, handling authentication and JSON parsing to deliver human-readable insights.
What Myrmex Did
Myrmex connected to the UniFi Controller and retrieved the inventory data.
✅ UniFi Site Inventory Report
The following table provides the administrative overview of the configured sites and their current connection metrics:
| Site Name | Site ID | Connected Clients (Total) | Infrastructure Devices |
|---|---|---|---|
| Default (Site 1) | 67e5b22607d16a1beddf0193 | 550 | 95 |
| Default (Site 2) | 67f815a6c586ec1e33bd0cac | 440 | 83 |
Technical Summary & Observations
Based on the metadata retrieved during the execution, here is a breakdown of the client distribution and site health:
Site 1 (67e5b226...)
- Wireless Clients: 547
- Wired Clients: 3
- Health Status: ⚠️ WAN1 is down (0% uptime). Traffic is currently being successfully rerouted and sustained by the WAN2 link (98.18% uptime), indicating failover is working.
Site 2 (67f815a6...)
- Wireless Clients: 439
- Wired Clients: 1
- Health Status: ✅ Primary connectivity is stable via WAN1 (98.81% uptime).
Benefits of the Approach
🦅 Bird's Eye View
Instead of logging into each site individually, administrators get a consolidated view of the entire network estate in seconds.
🚨 Failover Verification
The audit instantly highlighted that Site 1 is running on backup internet (WAN2). Without this automated check, IT might not notice the primary link failure until the backup also fails.
🛡️ Non-Intrusive Safety
The operation is strictly read-only. It uses API calls (list_sites, get_health) that do not modify firewall rules or device configurations.
Result
With Myrmex analysis:
- ✅ Inventory Automated: Retrieved precise client and device counts for billing/capacity planning.
- ✅ Resilience Tested: Confirmed SD-WAN failover on Site 1 is active.
- ✅ Time Saved: Eliminated the need for manual login and manual data aggregation.
Prompt Variations
The same pattern can be used for deeper UniFi management:
For device firmware audit:
List all Access Points in 'Site 1' that are running firmware older
than version 6.5.54.
For guest Wi-Fi management:
Generate a new Wi-Fi voucher code for the 'Guest' network valid for
24 hours and display it here.
