Commit Graph

83 Commits

Author SHA1 Message Date
Cody Lee a00aeb2eb5
Add byte counters for InfluxDB and Prometheus outputs (issue #350)
Track the number of bytes written per request for both InfluxDB and Prometheus outputs.

InfluxDB:
- Added bytesT counter constant
- Implemented calculateMetricBytes() to estimate line protocol size
- Updated batchV1() and batchV2() to count bytes per point
- Updated log output to display bytes written

Prometheus:
- Added Bytes field to Report struct
- Updated export() to calculate approximate metric byte size
- Updated log output to display bytes written

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-11 10:55:33 -06: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 8000597fce
Refactor Prometheus UBB label construction to use append
Replace manual array indexing (labels[1], labels[2], labels[3]) with
cleaner append syntax using slice notation (labels[1:]...).

This makes the code more maintainable and idiomatic Go.

Before: labelTotal := []string{"total", labels[1], labels[2], labels[3]}
After:  labelTotal := append([]string{"total"}, labels[1:]...)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-09 11:12:00 -06:00
Cody Lee 6a135c60a7
Enhance UBB device support with comprehensive Prometheus metrics
This change significantly improves UniFi Building Bridge (UBB) device
support by adding comprehensive Prometheus metric exports.

UBB devices are point-to-point wireless bridges with dual radios:
- wifi0: 5GHz radio (802.11ac)
- terra2/wlan0/ad: 60GHz radio (802.11ad - Terragraph/WiGig)

Changes:
- Added exportUBBstats() to export UBB-specific statistics separated
  by radio (total, wifi0, terra2, user-wifi0, user-terra2)
- Added exportP2Pstats() to export point-to-point link metrics
  (rx_rate, tx_rate, throughput)
- Added VAP (Virtual Access Point) table export via existing exportVAPtable()
- Added Radio table export via existing exportRADtable() to capture
  60GHz radio metrics
- Added link quality metrics (link_quality, link_quality_current,
  link_capacity)
- Added comprehensive comments documenting UBB device characteristics
  and 60GHz band support

The implementation reuses existing UAP metric descriptors where
appropriate, allowing UBB metrics to be collected alongside UAP metrics
in Prometheus with proper labeling for differentiation.

Requires: unpoller/unifi#169 (UBB type definition fixes)
Fixes: #409

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-09 10:20:23 -06:00
Cody Lee 832334655c
Fix health check port binding conflict (issue #892)
The Docker health check was attempting to bind to ports already in use by
the running application, causing "address already in use" errors. This fix
adds a health check mode that skips network binding operations while still
validating output configuration (listen addresses, paths, etc.).

Changes:
- Add health check mode flag in pkg/poller/outputs.go
- Update prometheus and webserver DebugOutput() to skip port binding in health check mode
- Maintain full configuration validation without network conflicts

Fixes #892

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-09 08:11:21 -06:00
Cody Lee 6f4384c18d
fix linting 2025-12-03 11:40:21 -06:00
Cody Lee 4b19b873ab
address issue 2025-04-04 08:33:58 -05:00
Cody Lee 4da299ff46
adds device uplink stats for issue #585 2025-01-02 12:41:34 -06:00
Cody Lee 3602d8cc8f
adds in UBB & UCI support 2025-01-02 08:57:47 -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 5b58e6c237
fix promver collector to default buildinfo collector 2024-04-19 15:51:18 -05:00
Austin Browder 8974cce072 Fixed PR lint failure 2023-11-07 12:25:02 -07:00
Austin Browder 746ab856e0 Added source interface identifier to exportUSGstats function 2023-10-23 14:39:22 -06:00
Mike Piatek-Jimenez ce55a864ea Make sure descPDU handles the power outlets. 2023-09-11 00:00:48 -04: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
Patrik Boström d4dc0d76d6
Fix for upgradable metric for Prometheus 2023-02-25 22:46:26 +01:00
Cody Lee 2b185e88c7
fixes sitedpi strings on influx and prom 2023-01-23 17:32:14 -06:00
Cody Lee 27bab9a01c
fixes client dpi strings on influx and prom 2023-01-07 11:36:11 -06:00
Cody Lee 1edb580084
bump unifi client and address
https://github.com/unpoller/dashboards/issues/20\#issuecomment-1364716049
and the duplicate https://github.com/unpoller/unpoller/issues/492
2023-01-06 21:12:24 -06: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 26e2771229
prom and influx support 2022-12-22 14:36:08 -06:00
Cody Lee 0329066fe5
remote upgrade metrics for #433 2022-12-21 20:14:22 -06:00
Cody Lee 2e8fb0b2ec
FlexInt adaptation 2022-12-20 21:29:56 -06:00
Cody Lee 97b3a476f9
fixes NPE on issue #422 2022-12-20 20:53:48 -06:00
Cody Lee fded91ce40
fixed start loop 2022-12-11 13:00:40 -06:00
Cody Lee bd51cf59f3
move to a common pattern on output plugins to catch common issues 2022-12-05 22:00:48 -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 bd0680b92a Add DPI collection 2019-12-27 23:59:16 -08:00
davidnewhall2 b812708b1a oops 2019-12-25 13:52:30 -08:00
davidnewhall2 ad562e5976 export buffer, lock cnfg 2019-12-25 00:19:40 -08:00
davidnewhall2 4a354647aa fix test 2019-12-24 23:56:00 -08:00
davidnewhall2 84edadaa94 Make a new docker image 2019-12-24 23:43:49 -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 0b8473657e convert input to plugin 2019-12-15 20:56:42 -08:00
davidnewhall2 4e48247f54 fix tests 2019-12-15 13:15:00 -08:00
davidnewhall2 1def43a4be trimming 2019-12-15 03:27:34 -08:00
davidnewhall2 ac39d1727f make output plugins call in to initialize 2019-12-15 02:52:43 -08:00
davidnewhall2 b8d9ac9f88 not sure how far I got.. 2019-12-13 14:17:28 -08:00
davidnewhall2 ecd1c64004 Updates 2019-12-10 01:19:56 -08:00
davidnewhall2 65dfedcf27 got it 2019-12-10 01:01:54 -08:00