Files
unpoller_unpoller/examples/up.yaml.example
T
Cody LeeandClaude Opus 5 d5dfc771d5 feat: add opt-in UNAS Pro support (closes #785)
Adds a new `unas` input plugin that polls UNAS Pro storage consoles and
exports console health, storage pools, disks and shares to Prometheus,
InfluxDB and DataDog.

UNAS is a separate plugin rather than a device type inside inputunifi
because a storage-only console has no Network application: it cannot
answer /status, has no sites, and shares none of the UniFi device schema.

The plugin is opt-in and inert until an operator names a console. Opt-in
is expressed as "no devices configured" rather than a `disable` flag,
because a bool named `disable` zero-values to false and so cannot make a
plugin default-off. Initialize returns silently on an empty device list
and, unlike inputunifi, nothing synthesizes a default URL.

Two behaviours are worth calling out for reviewers:

  - Metrics returns (metrics, nil) whenever any console was collected.
    poller.collectMetrics uses `if err != nil {} else if metric != nil`,
    so returning both would discard every healthy console because one
    failed. Only a total failure returns an error.

  - Re-auth fires on total failure, not on a 401. A mid-session 401 from
    GetData surfaces as ErrInvalidStatusCode, not ErrAuthenticationFailed,
    so there is no sentinel to match on. Session expiry fails all four
    endpoints at once, which is exactly the total-failure case.

Prometheus metrics use the `unifi_unas_` prefix, which diverges from the
`unas_` prefix used by the reference implementation; dashboards built
against that will need query edits.

Requires unifi/v5 v5.31.0 for the UNAS client and structs.

Credit to alexgreenbank/unaspoller for mapping the endpoints.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 07:52:37 -05:00

107 lines
2.8 KiB
Plaintext

##############################################
# UniFi Poller primary configuration file. #
# YAML FORMAT. Provided values are defaults. #
# See up.conf.example! v2 #
##############################################
---
poller:
debug: false
quiet: false
plugins: []
# log_unknown_types: false # Set to true to log unknown device types as DEBUG messages.
# By default, newer UniFi device types that aren't recognized
# are silently ignored to reduce log volume. Enable this when
# debugging or reporting new device types to developers.
prometheus:
disable: false
http_listen: "0.0.0.0:9130"
ssl_cert_path: ""
ssl_key_path: ""
report_errors: false
interval: "60s"
influxdb:
disable: false
interval: "30s"
url: "http://127.0.0.1:8086"
user: "unifipoller"
pass: "unifipoller"
db: "unifi"
verify_ssl: false
tags:
customer: abc_corp
env: prod
webserver:
enable: false
port: 37288
html_path: "/usr/local/lib/unpoller/web"
ssl_cert_path: ""
ssl_key_path: ""
max_events: 200
accounts:
captain: "$2a$04$mxw6i0LKH6u46oaLK2cq5eCTAAFkfNiRpzNbz.EyvJZZWNa2FzIlS"
datadog:
enable: false
address: localhost:8125
namespace: ""
tags:
- customer:abcdef
unifi:
dynamic: false
defaults:
url: "https://127.0.0.1:8443"
user: "unifipoller"
pass: "unifipoller"
sites:
- all
timeout: 60s
save_ids: false
save_events: false
save_alarms: false
save_anomalies: false
save_dpi: false
save_sites: true
hash_pii: false
verify_ssl: false
# Added an example for overriding the default site name.
# default_site_name_override: "My Custom Default Site"
controllers:
# Repeat the following stanza to poll multiple controllers.
- url: "https://127.0.0.1:8443"
user: "unifipoller"
pass: "unifipoller"
sites:
- all
save_ids: false
save_events: false
save_alarms: false
save_anomalies: false
save_dpi: false
save_sites: true
hash_pii: false
verify_ssl: false
# A UNAS Pro is a standalone UniFi OS console with no Network application, so it is polled
# by its own input plugin with its own credentials and host -- not as a UniFi controller.
# This section is optional: with no devices configured the plugin stays silent and inert.
#unas:
# disable: false
# defaults:
# user: "unpoller"
# pass: ""
# verify_ssl: false
# timeout: "60s"
# devices:
# # Repeat the following stanza to poll multiple UNAS consoles.
# - url: "https://192.168.1.10"
# user: "unpoller"
# pass: "unpoller"
# verify_ssl: false
# timeout: "60s"