From ec0896983b45ede7917fa674de9fd0a52f69e848 Mon Sep 17 00:00:00 2001 From: John Fieber Date: Wed, 20 Dec 2023 14:08:17 -0800 Subject: [PATCH] include a vlan_id label on wireless client metrics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using PPSK, the controller doesn’t currently (as of v5.13.22) report which PPSK id a client is connected with, but if you use PPSK to assign clients to vlans, knowing the vlan can be a clue. --- README.md | 16 ++++++++-------- pkg/collector/client.go | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 1ebcf79..1b81dec 100644 --- a/README.md +++ b/README.md @@ -112,14 +112,14 @@ omada: ## 📊 Metrics | Name | Description | Labels | |--|--|--| -| omada_client_download_activity_bytes | The current download activity for the client in bytes. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid switch_port vlan_id | -| omada_client_signal_pct | The signal quality for the wireless client in percent. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid | -| omada_client_snr_dbm | The signal to noise ratio for the wireless client in dBm. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid | -| omada_client_rssi_dbm | The RSSI for the wireless client in dBm. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid | -| omada_client_traffic_down_bytes | Total bytes received by wireless client. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid | -| omada_client_traffic_up_bytes | Total bytes sent by wireless client. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid | -| omada_client_tx_rate | TX rate of wireless client. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid | -| omada_client_rx_rate | RX rate of wireless client. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid | +| omada_client_download_activity_bytes | The current download activity for the client in bytes. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid vlan_id switch_port | +| omada_client_signal_pct | The signal quality for the wireless client in percent. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid vlan_id | +| omada_client_snr_dbm | The signal to noise ratio for the wireless client in dBm. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid vlan_id | +| omada_client_rssi_dbm | The RSSI for the wireless client in dBm. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid vlan_id | +| omada_client_traffic_down_bytes | Total bytes received by wireless client. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid vlan_id | +| omada_client_traffic_up_bytes | Total bytes sent by wireless client. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid vlan_id | +| omada_client_tx_rate | TX rate of wireless client. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid vlan_id | +| omada_client_rx_rate | RX rate of wireless client. | client vendor ip mac host_name site site_id connection_mode wifi_mode ap_name ssid vlan_id | | omada_client_connected_total | Total number of connected clients. | site site_id connection_mode wifi_mode | | omada_controller_uptime_seconds | Uptime of the controller. | controller_name model controller_version firmware_version mac site site_id | | omada_controller_storage_used_bytes | Storage used on the controller. | storage_name controller_name model controller_version firmware_version mac site site_id | diff --git a/pkg/collector/client.go b/pkg/collector/client.go index 00c098c..e77059a 100644 --- a/pkg/collector/client.go +++ b/pkg/collector/client.go @@ -73,7 +73,7 @@ func (c *clientCollector) Collect(ch chan<- prometheus.Metric) { CollectWirelessMetrics := func(desc *prometheus.Desc, valueType prometheus.ValueType, value float64) { ch <- prometheus.MustNewConstMetric(desc, valueType, value, - item.Name, item.Vendor, item.Ip, item.Mac, item.HostName, site, client.SiteId, "wireless", wifiMode, item.ApName, item.Ssid) + item.Name, item.Vendor, item.Ip, item.Mac, item.HostName, site, client.SiteId, "wireless", wifiMode, item.ApName, item.Ssid, vlanId) } CollectWirelessMetrics(c.omadaClientSignalPct, prometheus.GaugeValue, item.SignalLevel) CollectWirelessMetrics(c.omadaClientSignalNoiseDbm, prometheus.GaugeValue, item.SignalNoise) @@ -85,12 +85,12 @@ func (c *clientCollector) Collect(ch chan<- prometheus.Metric) { totals[wifiMode] += 1 ch <- prometheus.MustNewConstMetric(c.omadaClientDownloadActivityBytes, prometheus.GaugeValue, item.Activity, - item.Name, item.Vendor, item.Ip, item.Mac, item.HostName, site, client.SiteId, "wireless", wifiMode, item.ApName, item.Ssid, "", "") + item.Name, item.Vendor, item.Ip, item.Mac, item.HostName, site, client.SiteId, "wireless", wifiMode, item.ApName, item.Ssid, vlanId, "") } if !item.Wireless { totals["wired"] += 1 ch <- prometheus.MustNewConstMetric(c.omadaClientDownloadActivityBytes, prometheus.GaugeValue, item.Activity, - item.Name, item.Vendor, item.Ip, item.Mac, item.HostName, site, client.SiteId, "wired", "", "", "", port, vlanId) + item.Name, item.Vendor, item.Ip, item.Mac, item.HostName, site, client.SiteId, "wired", "", "", "", vlanId, port) } } @@ -106,8 +106,8 @@ func (c *clientCollector) Collect(ch chan<- prometheus.Metric) { } func NewClientCollector(c *api.Client) *clientCollector { - client_labels := []string{"client", "vendor", "ip", "mac", "host_name", "site", "site_id", "connection_mode", "wifi_mode", "ap_name", "ssid"} - wired_client_labels := append(client_labels, "switch_port", "vlan_id") + client_labels := []string{"client", "vendor", "ip", "mac", "host_name", "site", "site_id", "connection_mode", "wifi_mode", "ap_name", "ssid", "vlan_id"} + wired_client_labels := append(client_labels, "switch_port") return &clientCollector{ omadaClientDownloadActivityBytes: prometheus.NewDesc("omada_client_download_activity_bytes",