| Crates.io | unifi-network-exporter |
| lib.rs | unifi-network-exporter |
| version | 0.1.4 |
| created_at | 2025-07-15 18:18:11.439433+00 |
| updated_at | 2025-07-16 06:20:03.491047+00 |
| description | Prometheus exporter for UniFi Network Controller |
| homepage | |
| repository | https://github.com/rvben/unifi-network-exporter |
| max_upload_size | |
| id | 1753678 |
| size | 158,611 |
Prometheus exporter for UniFi Network Controller metrics.
Device Metrics: Monitor UniFi devices (APs, switches, gateways)
Client Metrics: Track connected clients
Site Metrics: Multi-site support
docker run -d \
-p 9897:9897 \
-e UNIFI_CONTROLLER_URL=https://192.168.1.1:8443 \
-e UNIFI_API_KEY=your-api-key \
rvben/unifi-network-exporter:latest
version: '3.8'
services:
unifi-network-exporter:
image: rvben/unifi-network-exporter:latest
restart: unless-stopped
ports:
- "9897:9897"
environment:
- UNIFI_CONTROLLER_URL=https://192.168.1.1:8443
- UNIFI_API_KEY=your-api-key
- UNIFI_SITE=default
- VERIFY_SSL=false
# Download the latest release
wget https://github.com/rvben/unifi-network-exporter/releases/latest/download/unifi-network-exporter-x86_64-unknown-linux-gnu.tar.gz
tar -xzf unifi-network-exporter-x86_64-unknown-linux-gnu.tar.gz
# Run the exporter
UNIFI_CONTROLLER_URL=https://192.168.1.1:8443 \
UNIFI_API_KEY=your-api-key \
./unifi-network-exporter
The exporter can be configured via environment variables or command-line arguments:
| Environment Variable | CLI Flag | Default | Description |
|---|---|---|---|
UNIFI_CONTROLLER_URL |
--controller-url |
required | UniFi Controller URL (e.g., https://192.168.1.1:8443) |
UNIFI_API_KEY |
--api-key |
optional | UniFi API key (recommended) |
UNIFI_USERNAME |
--username |
optional | UniFi username (if no API key) |
UNIFI_PASSWORD |
--password |
optional | UniFi password (if no API key) |
UNIFI_SITE |
--site |
default |
UniFi site name |
METRICS_PORT |
--port |
9897 |
Port to expose metrics on |
POLL_INTERVAL |
--poll-interval |
30 |
Poll interval in seconds |
LOG_LEVEL |
--log-level |
info |
Log level (trace, debug, info, warn, error) |
HTTP_TIMEOUT |
--http-timeout |
10 |
HTTP timeout in seconds |
VERIFY_SSL |
--verify-ssl |
true |
Verify SSL certificates |
unifi_device_info - Device information (labels: id, name, mac, type, model, version)unifi_device_uptime_seconds - Device uptime in secondsunifi_device_adopted - Device adoption status (1=adopted, 0=not adopted)unifi_device_state - Device stateunifi_device_cpu_usage - Device CPU usage (load average)unifi_device_memory_usage_ratio - Device memory usage ratiounifi_device_memory_total_bytes - Device total memory in bytesunifi_device_bytes_total - Total bytes transferred (labels: direction)unifi_device_packets_total - Total packets transferred (labels: direction)unifi_client_info - Client information (labels: id, mac, hostname, name, ip, network, ap_mac)unifi_client_bytes_total - Total bytes transferred by client (labels: direction)unifi_client_signal_strength_dbm - Client WiFi signal strength in dBmunifi_client_uptime_seconds - Client connection uptime in secondsunifi_clients_total - Total number of clients (labels: type, network, is_guest)unifi_sites_total - Total number of sitesAdd this to your prometheus.yml:
scrape_configs:
- job_name: 'unifi'
static_configs:
- targets: ['localhost:9897']
# Clone the repository
git clone https://github.com/rvben/unifi-network-exporter.git
cd unifi-network-exporter
# Build release binary
make release
# Or using cargo directly
cargo build --release
make test
VERIFY_SSL=false) for self-signed certificates# Run with cargo
cargo run
# Run with make
make run
# Run tests
make test
# Check code quality
make check
# Build Docker image
make docker-build
# Run Docker container
make docker-run
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.