Commit Graph

32 Commits

Author SHA1 Message Date
Sven Grossmann a3dc4cd0b2 feat: add save_syslog option for v2 system-log API
Add new save_syslog config option to collect events from the v2 UniFi
system-log API (/v2/api/site/{site}/system-log/all).

Changes:
- Add SaveSyslog field to Controller struct
- Add collectSyslog() function using v2 API
- Keep collectEvents() using v1 API for backwards compatibility
- Add RedactIPPII() helper for PII redaction
- Update lokiunifi to log raw JSON (parseable with Loki | json)
- Reduce indexed labels to low-cardinality fields only
- Add SystemLogEntry handler in lokiunifi report

Config: save_syslog (v2 API) vs save_events (v1 API)
Env: UP_UNIFI_DEFAULT_SAVE_SYSLOG=true
2025-12-22 17:23:53 +01:00
Cody Lee 0ffe6152ab
Fix multi-WAN speed test reporting (issue #841)
Speed tests were not being reported correctly for multi-WAN setups
because the device-level speedtest-status field was returning zeros.
The data has moved to a new aggregated dashboard API endpoint.

Changes:
- Add GetSpeedTests() and GetSiteSpeedTests() methods to fetch from
  /v2/api/site/{site}/aggregated-dashboard endpoint
- Create SpeedTestResult data structures to capture per-WAN metrics
- Update Prometheus exporter with new speedtest_* metrics per interface
- Update InfluxDB exporter to write speedtest measurements per WAN
- Update Datadog exporter with unifi.speedtest.* metrics per WAN
- Update metrics collection to include speed test data for all sites

Metrics now include labels/tags for:
- wan_interface: Physical interface (eth8, eth9, etc.)
- wan_group: Logical WAN name (WAN, WAN2, etc.)
- site_name: Site identifier
- source: Controller URL

Gracefully handles older controllers without the new API endpoint.

Fixes #841

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-09 16:46:14 -06:00
Cody Lee 6f4384c18d
fix linting 2025-12-03 11:40:21 -06:00
Sofiane A 10ccd0c2d7 Correct logic for default site condition 2025-04-29 19:34:52 +02:00
Sofiane A 5a89a4634a Add default_site_name_override to support customizable default site names 2025-04-29 16:12:32 +02:00
Cody Lee cba1111f29
add support for api-key auth 2025-01-10 15:19:30 -06:00
Cody Lee a30c82093d
add ubb and uci initial support 2024-12-31 16:26:54 -06:00
Cody Lee b372198840
painful upgrade for dumb go versioning 2024-12-31 14:44:10 -06:00
Cody Lee 9bdc6e8d0f
auto fix lint rules 2024-09-09 08:55:12 -05:00
Mike Piatek-Jimenez 6ddb2055d0 Fix a bug where the PDU metrics captured by the unifi collector wouldn’t be included in the device output. 2023-09-10 13:06:37 -04:00
Cody Lee 7e87e7f4fb
rename package per per comment, add comments, and drop unnecessary compile time check 2023-08-03 09:27:09 -05:00
Cody Lee ffb8579369
add integration test guard;
datadog integration test works

influx package tests

update unifi version

golanglint-ci and address *all* issues.

all tests pass

bump unifi version
2023-07-31 14:40:33 -05:00
Cody Lee 0e4affbcd5
update unifi to v0.3.5, fix flexint conversions 2023-07-18 11:59:41 -05:00
Cody Lee 0f915e88c9
bump unifi version and fix data types
https://github.com/unpoller/unpoller/issues/575
2023-07-18 10:57:23 -05:00
Cody Lee 3768c53512
CLI works 2022-12-22 18:16:43 -06:00
Cody Lee db9bcd5687
add new interface for testing 2022-12-22 17:44:39 -06:00
Cody Lee a2c8fa1af1
add missing commit 2022-12-21 20:35:45 -06:00
Cody Lee 0e5d743182
Add support to completely remove PII
https://github.com/unpoller/unifi/issues/56
2022-12-21 20:34:32 -06:00
Cody Lee 247cc868b3
go 1.19 interface{} -> any 2022-12-03 16:32:12 -06:00
Cody Lee 1900e69d7a
all to pkg 2022-12-02 20:48:01 -05:00
Cody Lee 06594f67eb
move to the pkg dir 2022-12-02 20:46:16 -05:00
davidnewhall2 5e203701b5 initial 2019-12-28 17:08:16 -08:00
davidnewhall2 1d923fd7c5 fix lint 2019-12-28 00:07:16 -08:00
davidnewhall2 bd0680b92a Add DPI collection 2019-12-27 23:59:16 -08:00
davidnewhall2 ed3bed4c7b rename some things 2019-12-20 03:19:00 -08:00
davidnewhall2 de16ba2399 fixes 2019-12-20 02:44:53 -08:00
davidnewhall2 17e7c8edb3 allow dynamic controller scrapes 2019-12-19 19:59:51 -08:00
davidnewhall2 9022ab288d allow pulling specific sites through output plugins 2019-12-17 02:39:36 -08:00
davidnewhall2 da75406310 fixes 2019-12-17 02:09:30 -08:00
davidnewhall2 d3d420597e make dumper work 2019-12-17 01:31:30 -08:00
davidnewhall2 44c544d8e1 Add dynamic plugin support 2019-12-16 03:11:40 -08:00
davidnewhall2 0b8473657e convert input to plugin 2019-12-15 20:56:42 -08:00