Re-do uap struct and points.

This commit is contained in:
David Newhall II 2019-07-04 04:02:07 -07:00
parent 13161ed28e
commit 7cde4b0c26
2 changed files with 622 additions and 548 deletions

View File

@ -1,7 +1,6 @@
package unifi
import (
"strconv"
"time"
influx "github.com/influxdata/influxdb1-client/v2"
@ -10,9 +9,6 @@ import (
// Points generates Wireless-Access-Point datapoints for InfluxDB.
// These points can be passed directly to influx.
func (u UAP) Points() ([]*influx.Point, error) {
/* I generally suck at InfluxDB, so if I got the tags/fields wrong,
please send me a PR or open an Issue to address my faults. Thanks!
*/
tags := map[string]string{
"id": u.ID,
"mac": u.Mac,
@ -23,48 +19,32 @@ func (u UAP) Points() ([]*influx.Point, error) {
"site_name": u.SiteName,
"name": u.Name,
"adopted": u.Adopted.Txt,
"bandsteering_mode": u.BandsteeringMode,
"board_rev": strconv.Itoa(u.BoardRev),
"cfgversion": u.Cfgversion,
"config_network_ip": u.ConfigNetwork.IP,
"config_network_type": u.ConfigNetwork.Type,
"connect_request_ip": u.ConnectRequestIP,
"connect_request_port": u.ConnectRequestPort,
"default": u.Default.Txt,
"device_id": u.DeviceID,
"discovered_via": u.DiscoveredVia,
"fw_caps": strconv.Itoa(u.FwCaps),
"guest_token": u.GuestToken,
"has_eth1": u.HasEth1.Txt,
"has_speaker": u.HasSpeaker.Txt,
"inform_ip": u.InformIP,
"isolated": u.Isolated.Txt,
"last_uplink_mac": u.LastUplink.UplinkMac,
"last_uplink_remote_port": strconv.Itoa(u.LastUplink.UplinkRemotePort),
"known_cfgversion": u.KnownCfgversion,
"led_override": u.LedOverride,
"locating": u.Locating.Txt,
"model": u.Model,
"outdoor_mode_override": u.OutdoorModeOverride,
"serial": u.Serial,
"type": u.Type,
"version_incompatible": u.VersionIncompatible.Txt,
"vwireEnabled": u.VwireEnabled.Txt,
"wifi_caps": strconv.Itoa(u.WifiCaps),
}
fields := map[string]interface{}{
"ip": u.IP,
"bytes": u.Bytes,
"bytes_d": u.BytesD,
"bytes_r": u.BytesR,
"last_seen": u.LastSeen,
"rx_bytes": u.RxBytes,
"rx_bytes-d": u.RxBytesD,
"tx_bytes": u.TxBytes,
"tx_bytes-d": u.TxBytesD,
"bytes": u.Bytes.Val,
"bytes_d": u.BytesD.Val,
"bytes_r": u.BytesR.Val,
"last_seen": u.LastSeen.Val,
"rx_bytes": u.RxBytes.Val,
"rx_bytes-d": u.RxBytesD.Val,
"tx_bytes": u.TxBytes.Val,
"tx_bytes-d": u.TxBytesD.Val,
"uptime": u.Uptime.Val,
"considered_lost_at": u.ConsideredLostAt,
"next_heartbeat_at": u.NextHeartbeatAt,
"scanning": u.Scanning.Val,
"spectrum_scanning": u.SpectrumScanning.Val,
"roll_upgrade": u.Rollupgrade.Val,
@ -76,192 +56,195 @@ func (u UAP) Points() ([]*influx.Point, error) {
"loadavg_1": u.SysStats.Loadavg1,
"loadavg_5": u.SysStats.Loadavg5,
"loadavg_15": u.SysStats.Loadavg15,
"mem_buffer": u.SysStats.MemBuffer,
"mem_total": u.SysStats.MemTotal,
"mem_used": u.SysStats.MemUsed,
"mem_buffer": u.SysStats.MemBuffer.Val,
"mem_total": u.SysStats.MemTotal.Val,
"mem_used": u.SysStats.MemUsed.Val,
"cpu": u.SystemStats.CPU,
"mem": u.SystemStats.Mem,
"system_uptime": u.SystemStats.Uptime,
"stat_bytes": u.Stat.Bytes,
"stat_duration": u.Stat.Duration,
"stat_guest-rx_bytes": u.Stat.RxBytes,
"stat_guest-rx_crypts": u.Stat.RxCrypts,
"stat_guest-rx_dropped": u.Stat.RxDropped,
"stat_guest-rx_errors": u.Stat.RxErrors,
"stat_guest-rx_frags": u.Stat.RxFrags,
"stat_guest-rx_packets": u.Stat.RxPackets,
"stat_guest-tx_bytes": u.Stat.TxBytes,
"stat_guest-tx_dropped": u.Stat.TxDropped,
"stat_guest-tx_errors": u.Stat.TxErrors,
"stat_guest-tx_packets": u.Stat.TxPackets,
"stat_guest-tx_retries": u.Stat.TxRetries,
"stat_port_1-rx_broadcast": u.Stat.Port1RxBroadcast,
"stat_port_1-rx_bytes": u.Stat.Port1RxBytes,
"stat_port_1-rx_multicast": u.Stat.Port1RxMulticast,
"stat_port_1-rx_packets": u.Stat.Port1RxPackets,
"stat_port_1-tx_broadcast": u.Stat.Port1TxBroadcast,
"stat_port_1-tx_bytes": u.Stat.Port1TxBytes,
"stat_port_1-tx_multicast": u.Stat.Port1TxMulticast,
"stat_port_1-tx_packets": u.Stat.Port1TxPackets,
"stat_rx_bytes": u.Stat.RxBytes,
"stat_rx_crypts": u.Stat.RxCrypts,
"stat_rx_dropped": u.Stat.RxDropped,
"stat_rx_errors": u.Stat.RxErrors,
"stat_rx_frags": u.Stat.RxFrags,
"stat_rx_packets": u.Stat.TxPackets,
"stat_tx_bytes": u.Stat.TxBytes,
"stat_tx_dropped": u.Stat.TxDropped,
"stat_tx_errors": u.Stat.TxErrors,
"stat_tx_packets": u.Stat.TxPackets,
"stat_tx_retries": u.Stat.TxRetries,
"stat_user-rx_bytes": u.Stat.UserRxBytes,
"stat_user-rx_crypts": u.Stat.UserRxCrypts,
"stat_user-rx_dropped": u.Stat.UserRxDropped,
"stat_user-rx_errors": u.Stat.UserRxErrors,
"stat_user-rx_frags": u.Stat.UserRxFrags,
"stat_user-rx_packets": u.Stat.UserRxPackets,
"stat_user-tx_bytes": u.Stat.UserTxBytes,
"stat_user-tx_dropped": u.Stat.UserTxDropped,
"stat_user-tx_errors": u.Stat.UserTxErrors,
"stat_user-tx_packets": u.Stat.UserTxPackets,
"stat_user-tx_retries": u.Stat.UserTxRetries,
"stat_user-wifi0-rx_bytes": u.Stat.UserWifi0RxBytes,
"stat_user-wifi0-rx_crypts": u.Stat.UserWifi0RxCrypts,
"stat_user-wifi0-rx_dropped": u.Stat.UserWifi0RxDropped,
"stat_user-wifi0-rx_errors": u.Stat.UserWifi0RxErrors,
"stat_user-wifi0-rx_frags": u.Stat.UserWifi0RxFrags,
"stat_user-wifi0-rx_packets": u.Stat.UserWifi0RxPackets,
"stat_user-wifi0-tx_bytes": u.Stat.UserWifi0TxBytes,
"stat_user-wifi0-tx_dropped": u.Stat.UserWifi0TxDropped,
"stat_user-wifi0-tx_errors": u.Stat.UserWifi0TxErrors,
"stat_user-wifi0-tx_packets": u.Stat.UserWifi0TxPackets,
"stat_user-wifi0-tx_retries": u.Stat.UserWifi0TxRetries,
"stat_user-wifi1-rx_bytes": u.Stat.UserWifi1RxBytes,
"stat_user-wifi1-rx_crypts": u.Stat.UserWifi1RxCrypts,
"stat_user-wifi1-rx_dropped": u.Stat.UserWifi1RxDropped,
"stat_user-wifi1-rx_errors": u.Stat.UserWifi1RxErrors,
"stat_user-wifi1-rx_frags": u.Stat.UserWifi1RxFrags,
"stat_user-wifi1-rx_packets": u.Stat.UserWifi1RxPackets,
"stat_user-wifi1-tx_bytes": u.Stat.UserWifi1TxBytes,
"stat_user-wifi1-tx_dropped": u.Stat.UserWifi1TxDropped,
"stat_user-wifi1-tx_errors": u.Stat.UserWifi1TxErrors,
"stat_user-wifi1-tx_packets": u.Stat.UserWifi1TxPackets,
"stat_user-wifi1-tx_retries": u.Stat.UserWifi1TxRetries,
"stat_wifi0-rx_bytes": u.Stat.Wifi0RxBytes,
"stat_wifi0-rx_crypts": u.Stat.Wifi0RxCrypts,
"stat_wifi0-rx_dropped": u.Stat.Wifi0RxDropped,
"stat_wifi0-rx_errors": u.Stat.Wifi0RxErrors,
"stat_wifi0-rx_frags": u.Stat.Wifi0RxFrags,
"stat_wifi0-rx_packets": u.Stat.Wifi0RxPackets,
"stat_wifi0-tx_bytes": u.Stat.Wifi0TxBytes,
"stat_wifi0-tx_dropped": u.Stat.Wifi0TxDropped,
"stat_wifi0-tx_errors": u.Stat.Wifi0TxErrors,
"stat_wifi0-tx_packets": u.Stat.Wifi0TxPackets,
"stat_wifi0-tx_retries": u.Stat.Wifi0TxRetries,
"stat_wifi1-rx_bytes": u.Stat.Wifi1RxBytes,
"stat_wifi1-rx_crypts": u.Stat.Wifi1RxCrypts,
"stat_wifi1-rx_dropped": u.Stat.Wifi1RxDropped,
"stat_wifi1-rx_errors": u.Stat.Wifi1RxErrors,
"stat_wifi1-rx_frags": u.Stat.Wifi1RxFrags,
"stat_wifi1-rx_packets": u.Stat.Wifi1RxPackets,
"stat_wifi1-tx_bytes": u.Stat.Wifi1TxBytes,
"stat_wifi1-tx_dropped": u.Stat.Wifi1TxDropped,
"stat_wifi1-tx_errors": u.Stat.Wifi1TxErrors,
"stat_wifi1-tx_packets": u.Stat.Wifi1TxPackets,
"stat_wifi1-tx_retries": u.Stat.Wifi1TxRetries,
"stat_bytes": u.Stat.Bytes.Val,
"stat_duration": u.Stat.Duration.Val,
"stat_guest-rx_bytes": u.Stat.RxBytes.Val,
"stat_guest-rx_crypts": u.Stat.RxCrypts.Val,
"stat_guest-rx_dropped": u.Stat.RxDropped.Val,
"stat_guest-rx_errors": u.Stat.RxErrors.Val,
"stat_guest-rx_frags": u.Stat.RxFrags.Val,
"stat_guest-rx_packets": u.Stat.RxPackets.Val,
"stat_guest-tx_bytes": u.Stat.TxBytes.Val,
"stat_guest-tx_dropped": u.Stat.TxDropped.Val,
"stat_guest-tx_errors": u.Stat.TxErrors.Val,
"stat_guest-tx_packets": u.Stat.TxPackets.Val,
"stat_guest-tx_retries": u.Stat.TxRetries.Val,
/* snip */
"stat_rx_bytes": u.Stat.RxBytes.Val,
"stat_rx_crypts": u.Stat.RxCrypts.Val,
"stat_rx_dropped": u.Stat.RxDropped.Val,
"stat_rx_errors": u.Stat.RxErrors.Val,
"stat_rx_frags": u.Stat.RxFrags.Val,
"stat_rx_packets": u.Stat.TxPackets.Val,
"stat_tx_bytes": u.Stat.TxBytes.Val,
"stat_tx_dropped": u.Stat.TxDropped.Val,
"stat_tx_errors": u.Stat.TxErrors.Val,
"stat_tx_packets": u.Stat.TxPackets.Val,
"stat_tx_retries": u.Stat.TxRetries.Val,
"stat_user-rx_bytes": u.Stat.UserRxBytes.Val,
"stat_user-rx_crypts": u.Stat.UserRxCrypts.Val,
"stat_user-rx_dropped": u.Stat.UserRxDropped.Val,
"stat_user-rx_errors": u.Stat.UserRxErrors.Val,
"stat_user-rx_frags": u.Stat.UserRxFrags.Val,
"stat_user-rx_packets": u.Stat.UserRxPackets.Val,
"stat_user-tx_bytes": u.Stat.UserTxBytes.Val,
"stat_user-tx_dropped": u.Stat.UserTxDropped.Val,
"stat_user-tx_errors": u.Stat.UserTxErrors.Val,
"stat_user-tx_packets": u.Stat.UserTxPackets.Val,
"stat_user-tx_retries": u.Stat.UserTxRetries.Val,
"stat_user-wifi0-rx_bytes": u.Stat.UserWifi0RxBytes.Val,
"stat_user-wifi0-rx_crypts": u.Stat.UserWifi0RxCrypts.Val,
"stat_user-wifi0-rx_dropped": u.Stat.UserWifi0RxDropped.Val,
"stat_user-wifi0-rx_errors": u.Stat.UserWifi0RxErrors.Val,
"stat_user-wifi0-rx_frags": u.Stat.UserWifi0RxFrags.Val,
"stat_user-wifi0-rx_packets": u.Stat.UserWifi0RxPackets.Val,
"stat_user-wifi0-tx_bytes": u.Stat.UserWifi0TxBytes.Val,
"stat_user-wifi0-tx_dropped": u.Stat.UserWifi0TxDropped.Val,
"stat_user-wifi0-tx_errors": u.Stat.UserWifi0TxErrors.Val,
"stat_user-wifi0-tx_packets": u.Stat.UserWifi0TxPackets.Val,
"stat_user-wifi0-tx_retries": u.Stat.UserWifi0TxRetries.Val,
"stat_user-wifi1-rx_bytes": u.Stat.UserWifi1RxBytes.Val,
"stat_user-wifi1-rx_crypts": u.Stat.UserWifi1RxCrypts.Val,
"stat_user-wifi1-rx_dropped": u.Stat.UserWifi1RxDropped.Val,
"stat_user-wifi1-rx_errors": u.Stat.UserWifi1RxErrors.Val,
"stat_user-wifi1-rx_frags": u.Stat.UserWifi1RxFrags.Val,
"stat_user-wifi1-rx_packets": u.Stat.UserWifi1RxPackets.Val,
"stat_user-wifi1-tx_bytes": u.Stat.UserWifi1TxBytes.Val,
"stat_user-wifi1-tx_dropped": u.Stat.UserWifi1TxDropped.Val,
"stat_user-wifi1-tx_errors": u.Stat.UserWifi1TxErrors.Val,
"stat_user-wifi1-tx_packets": u.Stat.UserWifi1TxPackets.Val,
"stat_user-wifi1-tx_retries": u.Stat.UserWifi1TxRetries.Val,
"stat_wifi0-rx_bytes": u.Stat.Wifi0RxBytes.Val,
"stat_wifi0-rx_crypts": u.Stat.Wifi0RxCrypts.Val,
"stat_wifi0-rx_dropped": u.Stat.Wifi0RxDropped.Val,
"stat_wifi0-rx_errors": u.Stat.Wifi0RxErrors.Val,
"stat_wifi0-rx_frags": u.Stat.Wifi0RxFrags.Val,
"stat_wifi0-rx_packets": u.Stat.Wifi0RxPackets.Val,
"stat_wifi0-tx_bytes": u.Stat.Wifi0TxBytes.Val,
"stat_wifi0-tx_dropped": u.Stat.Wifi0TxDropped.Val,
"stat_wifi0-tx_errors": u.Stat.Wifi0TxErrors.Val,
"stat_wifi0-tx_packets": u.Stat.Wifi0TxPackets.Val,
"stat_wifi0-tx_retries": u.Stat.Wifi0TxRetries.Val,
"stat_wifi1-rx_bytes": u.Stat.Wifi1RxBytes.Val,
"stat_wifi1-rx_crypts": u.Stat.Wifi1RxCrypts.Val,
"stat_wifi1-rx_dropped": u.Stat.Wifi1RxDropped.Val,
"stat_wifi1-rx_errors": u.Stat.Wifi1RxErrors.Val,
"stat_wifi1-rx_frags": u.Stat.Wifi1RxFrags.Val,
"stat_wifi1-rx_packets": u.Stat.Wifi1RxPackets.Val,
"stat_wifi1-tx_bytes": u.Stat.Wifi1TxBytes.Val,
"stat_wifi1-tx_dropped": u.Stat.Wifi1TxDropped.Val,
"stat_wifi1-tx_errors": u.Stat.Wifi1TxErrors.Val,
"stat_wifi1-tx_packets": u.Stat.Wifi1TxPackets.Val,
"stat_wifi1-tx_retries": u.Stat.Wifi1TxRetries.Val,
}
pt, err := influx.NewPoint("uap", tags, fields, time.Now())
if err != nil {
return nil, err
}
points := []*influx.Point{pt}
for _, p := range u.RadioTable {
tags := map[string]string{
"device_name": u.Name,
"device_id": u.ID,
"device_mac": u.Mac,
"name": p.Name,
"wlangroup_id": p.WlangroupID,
"channel": p.Channel.Txt,
"radio": p.Radio,
}
fields := map[string]interface{}{
"builtin_ant_gain": p.BuiltinAntGain,
"current_antenna_gain": p.CurrentAntennaGain,
"has_dfs": p.HasDfs.Val,
"has_fccdfs": p.HasFccdfs.Val,
"ht": p.Ht,
"is_11ac": p.Is11Ac.Val,
"max_txpower": p.MaxTxpower,
"min_rssi_enabled": p.MinRssiEnabled.Val,
"min_txpower": p.MinTxpower,
"nss": p.Nss,
"radio_caps": p.RadioCaps,
"tx_power": int(p.TxPower.Val), // this will go float in 2.1.
"tx_power_mode": p.TxPowerMode,
}
for _, s := range u.RadioTableStats {
// This may be a tad slower but it allows putting
// all the radio stats into one table.
if p.Name == s.Name {
fields["ast_be_xmit"] = s.AstBeXmit
fields["ast_cst"] = s.AstCst
fields["channel"] = s.Channel
fields["ast_txto"] = s.AstTxto
fields["cu_self_rx"] = s.CuSelfRx
fields["cu_self_tx"] = s.CuSelfTx
fields["cu_total"] = s.CuTotal
fields["extchannel"] = s.Extchannel
fields["gain"] = s.Gain
fields["guest-num_sta"] = s.GuestNumSta
fields["num_sta"] = s.NumSta
fields["radio"] = s.Radio
fields["state"] = s.State
fields["radio_tx_packets"] = s.TxPackets
fields["radio_tx_power"] = s.TxPower.Val
fields["radio_tx_retries"] = s.TxRetries
fields["user-num_sta"] = s.UserNumSta
break
}
}
tags = make(map[string]string)
fields = make(map[string]interface{})
// Loop each virtual AP (ESSID) and extract data for it from radio_tables and radio_table_stats.
for _, s := range u.VapTable {
if p.Name == s.RadioName {
tags["device_name"] = u.Name
tags["device_id"] = u.ID
tags["device_mac"] = u.Mac
tags["site_name"] = u.SiteName
tags["ap_mac"] = s.ApMac
tags["bssid"] = s.Bssid
tags["vap_id"] = s.ID
tags["vap_name"] = s.Name
tags["id"] = s.ID
tags["name"] = s.Name
tags["radio_name"] = s.RadioName
tags["wlanconf_id"] = s.WlanconfID
tags["site_id"] = s.SiteID
tags["site_name"] = s.SiteName
fields["ccq"] = s.Ccq
fields["essid"] = s.Essid
fields["extchannel"] = s.Extchannel
fields["is_guest"] = s.IsGuest.Val
fields["is_wep"] = s.IsWep.Val
fields["mac_filter_rejections"] = s.MacFilterRejections
fields["map_id"] = s.MapID
fields["vap_rx_bytes"] = s.RxBytes
fields["vap_rx_crypts"] = s.RxCrypts
fields["vap_rx_dropped"] = s.RxDropped
fields["vap_rx_errors"] = s.RxErrors
fields["vap_rx_frags"] = s.RxFrags
fields["vap_rx_nwids"] = s.RxNwids
fields["vap_rx_packets"] = s.RxPackets
fields["vap_tx_bytes"] = s.TxBytes
fields["vap_tx_dropped"] = s.TxDropped
fields["vap_tx_errors"] = s.TxErrors
fields["vap_tx_latency_avg"] = s.TxLatencyAvg
fields["vap_tx_latency_max"] = s.TxLatencyMax
fields["vap_tx_latency_min"] = s.TxLatencyMin
fields["vap_tx_packets"] = s.TxPackets
fields["vap_tx_power"] = s.TxPower.Val
fields["vap_tx_retries"] = s.TxRetries
fields["num_satisfaction_sta"] = s.NumSatisfactionSta.Val
fields["avg_client_signal"] = s.AvgClientSignal.Val
fields["satisfaction"] = s.Satisfaction.Val
fields["satisfaction_now"] = s.SatisfactionNow.Val
fields["rx_bytes"] = s.RxBytes.Val
fields["rx_crypts"] = s.RxCrypts.Val
fields["rx_dropped"] = s.RxDropped.Val
fields["rx_errors"] = s.RxErrors.Val
fields["rx_frags"] = s.RxFrags.Val
fields["rx_nwids"] = s.RxNwids.Val
fields["rx_packets"] = s.RxPackets.Val
fields["tx_bytes"] = s.TxBytes.Val
fields["tx_dropped"] = s.TxDropped.Val
fields["tx_errors"] = s.TxErrors.Val
fields["tx_packets"] = s.TxPackets.Val
fields["tx_power"] = s.TxPower.Val
fields["tx_retries"] = s.TxRetries.Val
fields["tx_combined_retries"] = s.TxCombinedRetries.Val
fields["tx_data_mpdu_bytes"] = s.TxDataMpduBytes.Val
fields["tx_rts_retries"] = s.TxRtsRetries.Val
fields["tx_success"] = s.TxSuccess.Val
fields["tx_total"] = s.TxTotal.Val
fields["tx_tcp_goodbytes"] = s.TxTCPStats.Goodbytes.Val
fields["tx_tcp_lat_avg"] = s.TxTCPStats.LatAvg.Val
fields["tx_tcp_lat_max"] = s.TxTCPStats.LatMax.Val
fields["tx_tcp_lat_min"] = s.TxTCPStats.LatMin.Val
fields["rx_tcp_goodbytes"] = s.RxTCPStats.Goodbytes.Val
fields["rx_tcp_lat_avg"] = s.RxTCPStats.LatAvg.Val
fields["rx_tcp_lat_max"] = s.RxTCPStats.LatMax.Val
fields["rx_tcp_lat_min"] = s.RxTCPStats.LatMin.Val
fields["wifi_tx_latency_mov_avg"] = s.WifiTxLatencyMov.Avg.Val
fields["wifi_tx_latency_mov_max"] = s.WifiTxLatencyMov.Max.Val
fields["wifi_tx_latency_mov_min"] = s.WifiTxLatencyMov.Min.Val
fields["wifi_tx_latency_mov_total"] = s.WifiTxLatencyMov.Total.Val
fields["wifi_tx_latency_mov_cuont"] = s.WifiTxLatencyMov.TotalCount.Val
fields["usage"] = s.Usage
break
for _, p := range u.RadioTable {
if p.Name != s.RadioName {
continue
}
tags["wlangroup_id"] = p.WlangroupID
tags["channel"] = p.Channel.Txt
tags["radio"] = p.Radio
fields["current_antenna_gain"] = p.CurrentAntennaGain.Val
fields["ht"] = p.Ht
fields["max_txpower"] = p.MaxTxpower.Val
fields["min_rssi_enabled"] = p.MinRssiEnabled.Val
fields["min_txpower"] = p.MinTxpower.Val
fields["nss"] = p.Nss.Val
fields["radio_caps"] = p.RadioCaps.Val
fields["tx_power"] = p.TxPower.Val
}
pt, err := influx.NewPoint("uap_radios", tags, fields, time.Now())
for _, p := range u.RadioTableStats {
// This may be a tad slower but it allows putting
// all the radio stats into one table.
if p.Name != s.RadioName {
continue
}
fields["ast_be_xmit"] = p.AstBeXmit.Val
fields["channel"] = p.Channel.Val
fields["cu_self_rx"] = p.CuSelfRx.Val
fields["cu_self_tx"] = p.CuSelfTx.Val
fields["cu_total"] = p.CuTotal.Val
fields["extchannel"] = p.Extchannel.Val
fields["gain"] = p.Gain.Val
fields["guest-num_sta"] = p.GuestNumSta.Val
fields["num_sta"] = p.NumSta.Val
fields["radio"] = p.Radio
fields["tx_packets"] = p.TxPackets.Val
fields["tx_power"] = p.TxPower.Val
fields["tx_retries"] = p.TxRetries.Val
fields["user-num_sta"] = p.UserNumSta.Val
}
pt, err := influx.NewPoint("uap_vaps", tags, fields, time.Now())
if err != nil {
return points, err
}

View File

@ -1,363 +1,454 @@
package unifi
import "time"
// UAP represents all the data from the Ubiquiti Controller for a Unifi Access Point.
type UAP struct {
/* This was auto generated and then slowly edited by hand
to get all the data types right and graphable.
No ones feelings will be hurt if you want to break this
up into multiple structs, and/or make it better in general.
*/
ID string `json:"_id"`
UUptime float64 `json:"_uptime"`
AdoptIP string `json:"adopt_ip,omitempty"`
AdoptURL string `json:"adopt_url,omitempty"`
Adopted FlexBool `json:"adopted"`
AntennaTable []struct {
ID float64 `json:"id"`
Default FlexBool `json:"default"`
ID FlexInt `json:"id"`
Name string `json:"name"`
Wifi0Gain float64 `json:"wifi0_gain"`
Wifi1Gain float64 `json:"wifi1_gain"`
Wifi0Gain FlexInt `json:"wifi0_gain"`
Wifi1Gain FlexInt `json:"wifi1_gain"`
} `json:"antenna_table"`
BandsteeringMode string `json:"bandsteering_mode,omitempty"`
BoardRev int `json:"board_rev"`
Bytes float64 `json:"bytes"`
BytesD float64 `json:"bytes-d"`
BytesR float64 `json:"bytes-r"`
Cfgversion string `json:"cfgversion"`
ConfigNetwork struct {
IP string `json:"ip"`
Type string `json:"type"`
IP string `json:"ip"`
} `json:"config_network"`
ConnectRequestIP string `json:"connect_request_ip"`
ConnectRequestPort string `json:"connect_request_port"`
ConsideredLostAt float64 `json:"considered_lost_at"`
CountrycodeTable []float64 `json:"countrycode_table"`
Default FlexBool `json:"default,omitempty"`
DeviceID string `json:"device_id"`
DiscoveredVia string `json:"discovered_via,omitempty"`
DownlinkTable []interface{} `json:"downlink_table"`
CountrycodeTable []int `json:"countrycode_table"`
EthernetTable []struct {
Mac string `json:"mac"`
NumPort FlexInt `json:"num_port"`
Name string `json:"name"`
NumPort float64 `json:"num_port"`
} `json:"ethernet_table"`
FwCaps int `json:"fw_caps"`
GuestNumSta int `json:"guest-num_sta"`
GuestToken string `json:"guest_token"`
HasEth1 FlexBool `json:"has_eth1"`
HasSpeaker FlexBool `json:"has_speaker"`
InformIP string `json:"inform_ip"`
InformURL string `json:"inform_url"`
IP string `json:"ip"`
Isolated FlexBool `json:"isolated"`
KnownCfgversion string `json:"known_cfgversion"`
LastSeen float64 `json:"last_seen"`
LastUplink struct {
UplinkMac string `json:"uplink_mac"`
UplinkRemotePort int `json:"uplink_remote_port"`
} `json:"last_uplink"`
LedOverride string `json:"led_override"`
Locating FlexBool `json:"locating"`
Mac string `json:"mac"`
MeshStaVapEnabled FlexBool `json:"mesh_sta_vap_enabled"`
Model string `json:"model"`
Name string `json:"name"`
NextHeartbeatAt float64 `json:"next_heartbeat_at"`
NumSta float64 `json:"num_sta"`
OutdoorModeOverride string `json:"outdoor_mode_override"`
PortTable []struct {
AggregatedBy FlexBool `json:"aggregated_by"`
PortIdx FlexInt `json:"port_idx"`
OpMode string `json:"op_mode"`
PortconfID string `json:"portconf_id"`
AttrNoEdit FlexBool `json:"attr_no_edit,omitempty"`
Autoneg FlexBool `json:"autoneg"`
BytesR float64 `json:"bytes-r"`
Enable FlexBool `json:"enable"`
FlowctrlRx FlexBool `json:"flowctrl_rx"`
FlowctrlTx FlexBool `json:"flowctrl_tx"`
FullDuplex FlexBool `json:"full_duplex"`
IsUplink FlexBool `json:"is_uplink"`
Jumbo FlexBool `json:"jumbo"`
MacTable []struct {
Age float64 `json:"age"`
Mac string `json:"mac"`
Static FlexBool `json:"static"`
Uptime float64 `json:"uptime"`
Vlan float64 `json:"vlan"`
} `json:"mac_table"`
Masked FlexBool `json:"masked"`
Media string `json:"media"`
Name string `json:"name"`
OpMode string `json:"op_mode"`
PoeCaps float64 `json:"poe_caps"`
PortDelta struct {
RxBytes float64 `json:"rx_bytes"`
RxPackets float64 `json:"rx_packets"`
TimeDelta float64 `json:"time_delta"`
TxBytes float64 `json:"tx_bytes"`
TxPackets float64 `json:"tx_packets"`
} `json:"port_delta"`
PortIdx float64 `json:"port_idx"`
PoeCaps FlexInt `json:"poe_caps"`
PortPoe FlexBool `json:"port_poe"`
PortconfID string `json:"portconf_id"`
RxBroadcast float64 `json:"rx_broadcast"`
RxBytes float64 `json:"rx_bytes"`
RxBytesR float64 `json:"rx_bytes-r"`
RxDropped float64 `json:"rx_dropped"`
RxErrors float64 `json:"rx_errors"`
RxMulticast float64 `json:"rx_multicast"`
RxPackets float64 `json:"rx_packets"`
Speed float64 `json:"speed"`
StpPathcost float64 `json:"stp_pathcost"`
StpState string `json:"stp_state"`
TxBroadcast float64 `json:"tx_broadcast"`
TxBytes float64 `json:"tx_bytes"`
TxBytesR float64 `json:"tx_bytes-r"`
TxDropped float64 `json:"tx_dropped"`
TxErrors float64 `json:"tx_errors"`
TxMulticast float64 `json:"tx_multicast"`
TxPackets float64 `json:"tx_packets"`
Up FlexBool `json:"up"`
TxBytesR FlexInt `json:"tx_bytes-r"`
RxBytesR FlexInt `json:"rx_bytes-r"`
BytesR FlexInt `json:"bytes-r"`
PortDelta struct {
TimeDelta FlexInt `json:"time_delta"`
} `json:"port_delta"`
Enable FlexBool `json:"enable"`
Masked FlexBool `json:"masked"`
AggregatedBy FlexBool `json:"aggregated_by"`
} `json:"port_table"`
RadioTable []struct {
BuiltinAntGain float64 `json:"builtin_ant_gain"`
BuiltinAntenna FlexBool `json:"builtin_antenna"`
Channel FlexInt `json:"channel"`
CurrentAntennaGain float64 `json:"current_antenna_gain"`
Ht string `json:"ht"`
MaxTxpower float64 `json:"max_txpower"`
MinRssiEnabled FlexBool `json:"min_rssi_enabled"`
MinTxpower float64 `json:"min_txpower"`
Name string `json:"name"`
Nss float64 `json:"nss"`
Radio string `json:"radio"`
RadioCaps float64 `json:"radio_caps"`
TxPower FlexInt `json:"tx_power"`
Name string `json:"name"`
Channel FlexInt `json:"channel"`
Ht string `json:"ht"`
TxPowerMode string `json:"tx_power_mode"`
TxPower FlexInt `json:"tx_power"`
MaxTxpower FlexInt `json:"max_txpower"`
MinTxpower FlexInt `json:"min_txpower"`
Nss FlexInt `json:"nss"`
MinRssiEnabled FlexBool `json:"min_rssi_enabled"`
BuiltinAntenna FlexBool `json:"builtin_antenna"`
BuiltinAntGain FlexInt `json:"builtin_ant_gain"`
CurrentAntennaGain FlexInt `json:"current_antenna_gain"`
RadioCaps FlexInt `json:"radio_caps"`
WlangroupID string `json:"wlangroup_id"`
Is11Ac FlexBool `json:"is_11ac,omitempty"`
HasDfs FlexBool `json:"has_dfs,omitempty"`
HasFccdfs FlexBool `json:"has_fccdfs,omitempty"`
Is11Ac FlexBool `json:"is_11ac,omitempty"`
} `json:"radio_table"`
RadioTableStats []struct {
AstBeXmit float64 `json:"ast_be_xmit"`
AstCst float64 `json:"ast_cst"`
AstTxto float64 `json:"ast_txto"`
Channel float64 `json:"channel"`
CuSelfRx float64 `json:"cu_self_rx"`
CuSelfTx float64 `json:"cu_self_tx"`
CuTotal float64 `json:"cu_total"`
Extchannel float64 `json:"extchannel"`
Gain float64 `json:"gain"`
GuestNumSta float64 `json:"guest-num_sta"`
Name string `json:"name"`
NumSta float64 `json:"num_sta"`
Radio string `json:"radio"`
State string `json:"state"`
TxPackets float64 `json:"tx_packets"`
TxPower FlexInt `json:"tx_power"`
TxRetries float64 `json:"tx_retries"`
UserNumSta float64 `json:"user-num_sta"`
} `json:"radio_table_stats"`
Rollupgrade FlexBool `json:"rollupgrade"`
RxBytes float64 `json:"rx_bytes"`
RxBytesD float64 `json:"rx_bytes-d"`
ScanRadioTable []interface{} `json:"scan_radio_table"`
Scanning FlexBool `json:"scanning"`
Serial string `json:"serial"`
SiteID string `json:"site_id"`
SiteName string `json:"-"`
SpectrumScanning FlexBool `json:"spectrum_scanning"`
SSHSessionTable []interface{} `json:"ssh_session_table"`
Stat struct {
Ap string `json:"ap"`
Bytes float64 `json:"bytes"`
Datetime string `json:"datetime"`
Duration float64 `json:"duration"`
GuestRxBytes float64 `json:"guest-rx_bytes"`
GuestRxCrypts float64 `json:"guest-rx_crypts"`
GuestRxDropped float64 `json:"guest-rx_dropped"`
GuestRxErrors float64 `json:"guest-rx_errors"`
GuestRxFrags float64 `json:"guest-rx_frags"`
GuestRxPackets float64 `json:"guest-rx_packets"`
GuestTxBytes float64 `json:"guest-tx_bytes"`
GuestTxDropped float64 `json:"guest-tx_dropped"`
GuestTxErrors float64 `json:"guest-tx_errors"`
GuestTxPackets float64 `json:"guest-tx_packets"`
GuestTxRetries float64 `json:"guest-tx_retries"`
O string `json:"o"`
Oid string `json:"oid"`
Port1RxBroadcast float64 `json:"port_1-rx_broadcast"`
Port1RxBytes float64 `json:"port_1-rx_bytes"`
Port1RxMulticast float64 `json:"port_1-rx_multicast"`
Port1RxPackets float64 `json:"port_1-rx_packets"`
Port1TxBroadcast float64 `json:"port_1-tx_broadcast"`
Port1TxBytes float64 `json:"port_1-tx_bytes"`
Port1TxMulticast float64 `json:"port_1-tx_multicast"`
Port1TxPackets float64 `json:"port_1-tx_packets"`
RxBytes float64 `json:"rx_bytes"`
RxCrypts float64 `json:"rx_crypts"`
RxDropped float64 `json:"rx_dropped"`
RxErrors float64 `json:"rx_errors"`
RxFrags float64 `json:"rx_frags"`
RxPackets float64 `json:"rx_packets"`
SiteID string `json:"site_id"`
Time float64 `json:"time"`
TxBytes float64 `json:"tx_bytes"`
TxDropped float64 `json:"tx_dropped"`
TxErrors float64 `json:"tx_errors"`
TxPackets float64 `json:"tx_packets"`
TxRetries float64 `json:"tx_retries"`
UserRxBytes float64 `json:"user-rx_bytes"`
UserRxCrypts float64 `json:"user-rx_crypts"`
UserRxDropped float64 `json:"user-rx_dropped"`
UserRxErrors float64 `json:"user-rx_errors"`
UserRxFrags float64 `json:"user-rx_frags"`
UserRxPackets float64 `json:"user-rx_packets"`
UserTxBytes float64 `json:"user-tx_bytes"`
UserTxDropped float64 `json:"user-tx_dropped"`
UserTxErrors float64 `json:"user-tx_errors"`
UserTxPackets float64 `json:"user-tx_packets"`
UserTxRetries float64 `json:"user-tx_retries"`
UserWifi0RxBytes float64 `json:"user-wifi0-rx_bytes"`
UserWifi0RxCrypts float64 `json:"user-wifi0-rx_crypts"`
UserWifi0RxDropped float64 `json:"user-wifi0-rx_dropped"`
UserWifi0RxErrors float64 `json:"user-wifi0-rx_errors"`
UserWifi0RxFrags float64 `json:"user-wifi0-rx_frags"`
UserWifi0RxPackets float64 `json:"user-wifi0-rx_packets"`
UserWifi0TxBytes float64 `json:"user-wifi0-tx_bytes"`
UserWifi0TxDropped float64 `json:"user-wifi0-tx_dropped"`
UserWifi0TxErrors float64 `json:"user-wifi0-tx_errors"`
UserWifi0TxPackets float64 `json:"user-wifi0-tx_packets"`
UserWifi0TxRetries float64 `json:"user-wifi0-tx_retries"`
UserWifi1RxBytes float64 `json:"user-wifi1-rx_bytes"`
UserWifi1RxCrypts float64 `json:"user-wifi1-rx_crypts"`
UserWifi1RxDropped float64 `json:"user-wifi1-rx_dropped"`
UserWifi1RxErrors float64 `json:"user-wifi1-rx_errors"`
UserWifi1RxFrags float64 `json:"user-wifi1-rx_frags"`
UserWifi1RxPackets float64 `json:"user-wifi1-rx_packets"`
UserWifi1TxBytes float64 `json:"user-wifi1-tx_bytes"`
UserWifi1TxDropped float64 `json:"user-wifi1-tx_dropped"`
UserWifi1TxErrors float64 `json:"user-wifi1-tx_errors"`
UserWifi1TxPackets float64 `json:"user-wifi1-tx_packets"`
UserWifi1TxRetries float64 `json:"user-wifi1-tx_retries"`
Wifi0RxBytes float64 `json:"wifi0-rx_bytes"`
Wifi0RxCrypts float64 `json:"wifi0-rx_crypts"`
Wifi0RxDropped float64 `json:"wifi0-rx_dropped"`
Wifi0RxErrors float64 `json:"wifi0-rx_errors"`
Wifi0RxFrags float64 `json:"wifi0-rx_frags"`
Wifi0RxPackets float64 `json:"wifi0-rx_packets"`
Wifi0TxBytes float64 `json:"wifi0-tx_bytes"`
Wifi0TxDropped float64 `json:"wifi0-tx_dropped"`
Wifi0TxErrors float64 `json:"wifi0-tx_errors"`
Wifi0TxPackets float64 `json:"wifi0-tx_packets"`
Wifi0TxRetries float64 `json:"wifi0-tx_retries"`
Wifi1RxBytes float64 `json:"wifi1-rx_bytes"`
Wifi1RxCrypts float64 `json:"wifi1-rx_crypts"`
Wifi1RxDropped float64 `json:"wifi1-rx_dropped"`
Wifi1RxErrors float64 `json:"wifi1-rx_errors"`
Wifi1RxFrags float64 `json:"wifi1-rx_frags"`
Wifi1RxPackets float64 `json:"wifi1-rx_packets"`
Wifi1TxBytes float64 `json:"wifi1-tx_bytes"`
Wifi1TxDropped float64 `json:"wifi1-tx_dropped"`
Wifi1TxErrors float64 `json:"wifi1-tx_errors"`
Wifi1TxPackets float64 `json:"wifi1-tx_packets"`
Wifi1TxRetries float64 `json:"wifi1-tx_retries"`
} `json:"stat"`
Type string `json:"type"`
Version string `json:"version"`
VwireTable []interface{} `json:"vwire_table"`
WifiCaps int `json:"wifi_caps"`
WlangroupIDNa string `json:"wlangroup_id_na"`
WlangroupIDNg string `json:"wlangroup_id_ng"`
RequiredVersion string `json:"required_version"`
HwCaps int `json:"hw_caps"`
Unsupported FlexBool `json:"unsupported"`
UnsupportedReason FlexInt `json:"unsupported_reason"`
SysErrorCaps int `json:"sys_error_caps"`
HasFan FlexBool `json:"has_fan"`
HasTemperature FlexBool `json:"has_temperature"`
DeviceID string `json:"device_id"`
State int `json:"state"`
LastSeen FlexInt `json:"last_seen"`
Upgradable FlexBool `json:"upgradable"`
AdoptableWhenUpgraded FlexBool `json:"adoptable_when_upgraded"`
Rollupgrade FlexBool `json:"rollupgrade"`
KnownCfgversion string `json:"known_cfgversion"`
Uptime FlexInt `json:"uptime"`
UUptime FlexInt `json:"_uptime"`
Locating FlexBool `json:"locating"`
ConnectRequestIP string `json:"connect_request_ip"`
ConnectRequestPort string `json:"connect_request_port"`
SysStats struct {
Loadavg1 float64 `json:"loadavg_1,string"`
Loadavg15 float64 `json:"loadavg_15,string"`
Loadavg5 float64 `json:"loadavg_5,string"`
MemBuffer float64 `json:"mem_buffer"`
MemTotal float64 `json:"mem_total"`
MemUsed float64 `json:"mem_used"`
MemBuffer FlexInt `json:"mem_buffer"`
MemTotal FlexInt `json:"mem_total"`
MemUsed FlexInt `json:"mem_used"`
} `json:"sys_stats"`
SystemStats struct {
CPU float64 `json:"cpu,string"`
Mem float64 `json:"mem,string"`
Uptime float64 `json:"uptime,string"`
} `json:"system-stats"`
TxBytes float64 `json:"tx_bytes"`
TxBytesD float64 `json:"tx_bytes-d"`
Type string `json:"type"`
Upgradable FlexBool `json:"upgradable"`
SSHSessionTable []interface{} `json:"ssh_session_table"`
Scanning FlexBool `json:"scanning"`
SpectrumScanning FlexBool `json:"spectrum_scanning"`
GuestToken string `json:"guest_token"`
Meshv3PeerMac string `json:"meshv3_peer_mac"`
Satisfaction FlexInt `json:"satisfaction"`
Isolated FlexBool `json:"isolated"`
RadioTableStats []struct {
Name string `json:"name"`
Channel FlexInt `json:"channel"`
Radio string `json:"radio"`
AstTxto interface{} `json:"ast_txto"`
AstCst interface{} `json:"ast_cst"`
AstBeXmit FlexInt `json:"ast_be_xmit"`
CuTotal FlexInt `json:"cu_total"`
CuSelfRx FlexInt `json:"cu_self_rx"`
CuSelfTx FlexInt `json:"cu_self_tx"`
Gain FlexInt `json:"gain"`
State string `json:"state"`
Extchannel FlexInt `json:"extchannel"`
TxPower FlexInt `json:"tx_power"`
TxPackets FlexInt `json:"tx_packets"`
TxRetries FlexInt `json:"tx_retries"`
NumSta FlexInt `json:"num_sta"`
GuestNumSta FlexInt `json:"guest-num_sta"`
UserNumSta FlexInt `json:"user-num_sta"`
} `json:"radio_table_stats"`
Uplink struct {
FullDuplex FlexBool `json:"full_duplex"`
IP string `json:"ip"`
Mac string `json:"mac"`
MaxSpeed int `json:"max_speed"`
MaxVlan int `json:"max_vlan"`
Media string `json:"media"`
Name string `json:"name"`
Netmask string `json:"netmask"`
NumPort int `json:"num_port"`
RxBytes float64 `json:"rx_bytes"`
RxBytesR float64 `json:"rx_bytes-r"`
RxDropped float64 `json:"rx_dropped"`
RxErrors float64 `json:"rx_errors"`
RxMulticast float64 `json:"rx_multicast"`
RxPackets float64 `json:"rx_packets"`
Speed float64 `json:"speed"`
TxBytes float64 `json:"tx_bytes"`
TxBytesR float64 `json:"tx_bytes-r"`
TxDropped float64 `json:"tx_dropped"`
TxErrors float64 `json:"tx_errors"`
TxPackets float64 `json:"tx_packets"`
Type string `json:"type"`
RxBytes FlexInt `json:"rx_bytes"`
RxDropped FlexInt `json:"rx_dropped"`
RxErrors FlexInt `json:"rx_errors"`
RxMulticast FlexInt `json:"rx_multicast"`
RxPackets FlexInt `json:"rx_packets"`
Speed FlexInt `json:"speed"`
TxBytes FlexInt `json:"tx_bytes"`
TxDropped FlexInt `json:"tx_dropped"`
TxErrors FlexInt `json:"tx_errors"`
TxPackets FlexInt `json:"tx_packets"`
Up FlexBool `json:"up"`
MaxSpeed FlexInt `json:"max_speed"`
Type string `json:"type"`
TxBytesR FlexInt `json:"tx_bytes-r"`
RxBytesR FlexInt `json:"rx_bytes-r"`
UplinkMac string `json:"uplink_mac"`
UplinkRemotePort int `json:"uplink_remote_port"`
} `json:"uplink"`
UplinkTable []interface{} `json:"uplink_table"`
Uptime FlexInt `json:"uptime"`
UserNumSta int `json:"user-num_sta"`
VapTable []struct {
ApMac string `json:"ap_mac"`
SiteName string `json:"-"`
AnomaliesBarChart struct {
HighTCPLatency FlexInt `json:"high_tcp_latency"`
HighTCPPacketLoss FlexInt `json:"high_tcp_packet_loss"`
HighWifiLatency FlexInt `json:"high_wifi_latency"`
HighWifiRetries FlexInt `json:"high_wifi_retries"`
LowPhyRate FlexInt `json:"low_phy_rate"`
PoorStreamEff FlexInt `json:"poor_stream_eff"`
SleepyClient FlexInt `json:"sleepy_client"`
StaArpTimeout FlexInt `json:"sta_arp_timeout"`
StaDNSTimeout FlexInt `json:"sta_dns_timeout"`
StaIPTimeout FlexInt `json:"sta_ip_timeout"`
WeakSignal FlexInt `json:"weak_signal"`
} `json:"anomalies_bar_chart"`
AnomaliesBarChartNow struct {
HighTCPLatency FlexInt `json:"high_tcp_latency"`
HighTCPPacketLoss FlexInt `json:"high_tcp_packet_loss"`
HighWifiLatency FlexInt `json:"high_wifi_latency"`
HighWifiRetries FlexInt `json:"high_wifi_retries"`
LowPhyRate FlexInt `json:"low_phy_rate"`
PoorStreamEff FlexInt `json:"poor_stream_eff"`
SleepyClient FlexInt `json:"sleepy_client"`
StaArpTimeout FlexInt `json:"sta_arp_timeout"`
StaDNSTimeout FlexInt `json:"sta_dns_timeout"`
StaIPTimeout FlexInt `json:"sta_ip_timeout"`
WeakSignal FlexInt `json:"weak_signal"`
} `json:"anomalies_bar_chart_now"`
AvgClientSignal FlexInt `json:"avg_client_signal"`
Bssid string `json:"bssid"`
Ccq int `json:"ccq"`
Channel int `json:"channel"`
Essid string `json:"essid"`
Extchannel int `json:"extchannel"`
ID string `json:"id"`
IsGuest FlexBool `json:"is_guest"`
IsWep FlexBool `json:"is_wep"`
MacFilterRejections int `json:"mac_filter_rejections"`
MapID string `json:"map_id"`
Name string `json:"name"`
NumSatisfactionSta FlexInt `json:"num_satisfaction_sta"`
NumSta int `json:"num_sta"`
Radio string `json:"radio"`
RadioName string `json:"radio_name"`
RxBytes float64 `json:"rx_bytes"`
RxCrypts float64 `json:"rx_crypts"`
RxDropped float64 `json:"rx_dropped"`
RxErrors float64 `json:"rx_errors"`
RxFrags float64 `json:"rx_frags"`
RxNwids float64 `json:"rx_nwids"`
RxPackets float64 `json:"rx_packets"`
SiteID string `json:"site_id"`
SiteName string `json:"-"`
ReasonsBarChart struct {
PhyRate FlexInt `json:"phy_rate"`
Signal FlexInt `json:"signal"`
SleepyClient FlexInt `json:"sleepy_client"`
StaArpTimeout FlexInt `json:"sta_arp_timeout"`
StaDNSTimeout FlexInt `json:"sta_dns_timeout"`
StaIPTimeout FlexInt `json:"sta_ip_timeout"`
StreamEff FlexInt `json:"stream_eff"`
TCPLatency FlexInt `json:"tcp_latency"`
TCPPacketLoss FlexInt `json:"tcp_packet_loss"`
WifiLatency FlexInt `json:"wifi_latency"`
WifiRetries FlexInt `json:"wifi_retries"`
} `json:"reasons_bar_chart"`
ReasonsBarChartNow struct {
PhyRate FlexInt `json:"phy_rate"`
Signal FlexInt `json:"signal"`
SleepyClient FlexInt `json:"sleepy_client"`
StaArpTimeout FlexInt `json:"sta_arp_timeout"`
StaDNSTimeout FlexInt `json:"sta_dns_timeout"`
StaIPTimeout FlexInt `json:"sta_ip_timeout"`
StreamEff FlexInt `json:"stream_eff"`
TCPLatency FlexInt `json:"tcp_latency"`
TCPPacketLoss FlexInt `json:"tcp_packet_loss"`
WifiLatency FlexInt `json:"wifi_latency"`
WifiRetries FlexInt `json:"wifi_retries"`
} `json:"reasons_bar_chart_now"`
RxBytes FlexInt `json:"rx_bytes"`
RxCrypts FlexInt `json:"rx_crypts"`
RxDropped FlexInt `json:"rx_dropped"`
RxErrors FlexInt `json:"rx_errors"`
RxFrags FlexInt `json:"rx_frags"`
RxNwids FlexInt `json:"rx_nwids"`
RxPackets FlexInt `json:"rx_packets"`
RxTCPStats struct {
Goodbytes FlexInt `json:"goodbytes"`
LatAvg FlexInt `json:"lat_avg"`
LatMax FlexInt `json:"lat_max"`
LatMin FlexInt `json:"lat_min"`
Stalls FlexInt `json:"stalls"`
} `json:"rx_tcp_stats"`
Satisfaction FlexInt `json:"satisfaction"`
SatisfactionNow FlexInt `json:"satisfaction_now"`
State string `json:"state"`
T string `json:"t"`
TxBytes float64 `json:"tx_bytes"`
TxDropped float64 `json:"tx_dropped"`
TxErrors float64 `json:"tx_errors"`
TxLatencyAvg float64 `json:"tx_latency_avg"`
TxLatencyMax float64 `json:"tx_latency_max"`
TxLatencyMin float64 `json:"tx_latency_min"`
TxPackets float64 `json:"tx_packets"`
TxBytes FlexInt `json:"tx_bytes"`
TxCombinedRetries FlexInt `json:"tx_combined_retries"`
TxDataMpduBytes FlexInt `json:"tx_data_mpdu_bytes"`
TxDropped FlexInt `json:"tx_dropped"`
TxErrors FlexInt `json:"tx_errors"`
TxPackets FlexInt `json:"tx_packets"`
TxPower FlexInt `json:"tx_power"`
TxRetries int `json:"tx_retries"`
TxRetries FlexInt `json:"tx_retries"`
TxRtsRetries FlexInt `json:"tx_rts_retries"`
TxSuccess FlexInt `json:"tx_success"`
TxTCPStats struct {
Goodbytes FlexInt `json:"goodbytes"`
LatAvg FlexInt `json:"lat_avg"`
LatMax FlexInt `json:"lat_max"`
LatMin FlexInt `json:"lat_min"`
Stalls FlexInt `json:"stalls"`
} `json:"tx_tcp_stats"`
TxTotal FlexInt `json:"tx_total"`
Up FlexBool `json:"up"`
Usage string `json:"usage"`
WifiTxAttempts FlexInt `json:"wifi_tx_attempts"`
WifiTxDropped FlexInt `json:"wifi_tx_dropped"`
WifiTxLatencyMov struct {
Avg FlexInt `json:"avg"`
Max FlexInt `json:"max"`
Min FlexInt `json:"min"`
Total FlexInt `json:"total"`
TotalCount FlexInt `json:"total_count"`
} `json:"wifi_tx_latency_mov"`
T string `json:"t"`
WlanconfID string `json:"wlanconf_id"`
IsGuest FlexBool `json:"is_guest"`
IsWep FlexBool `json:"is_wep"`
ApMac string `json:"ap_mac"`
MapID interface{} `json:"map_id"`
SiteID string `json:"site_id"`
} `json:"vap_table"`
Version string `json:"version"`
VersionIncompatible FlexBool `json:"version_incompatible"`
DownlinkTable []interface{} `json:"downlink_table"`
VwireVapTable []interface{} `json:"vwire_vap_table"`
BytesD FlexInt `json:"bytes-d"`
TxBytesD FlexInt `json:"tx_bytes-d"`
RxBytesD FlexInt `json:"rx_bytes-d"`
BytesR FlexInt `json:"bytes-r"`
LastUplink struct {
UplinkMac string `json:"uplink_mac"`
UplinkRemotePort int `json:"uplink_remote_port"`
} `json:"last_uplink"`
Stat struct {
SiteID string `json:"site_id"`
O string `json:"o"`
Oid string `json:"oid"`
Ap string `json:"ap"`
Time FlexInt `json:"time"`
Datetime time.Time `json:"datetime"`
GuestWifi0RxPackets FlexInt `json:"guest-wifi0-rx_packets"`
GuestWifi1RxPackets FlexInt `json:"guest-wifi1-rx_packets"`
UserWifi1RxPackets FlexInt `json:"user-wifi1-rx_packets"`
UserWifi0RxPackets FlexInt `json:"user-wifi0-rx_packets"`
UserRxPackets FlexInt `json:"user-rx_packets"`
GuestRxPackets FlexInt `json:"guest-rx_packets"`
Wifi0RxPackets FlexInt `json:"wifi0-rx_packets"`
Wifi1RxPackets FlexInt `json:"wifi1-rx_packets"`
RxPackets FlexInt `json:"rx_packets"`
GuestWifi0RxBytes FlexInt `json:"guest-wifi0-rx_bytes"`
GuestWifi1RxBytes FlexInt `json:"guest-wifi1-rx_bytes"`
UserWifi1RxBytes FlexInt `json:"user-wifi1-rx_bytes"`
UserWifi0RxBytes FlexInt `json:"user-wifi0-rx_bytes"`
UserRxBytes FlexInt `json:"user-rx_bytes"`
GuestRxBytes FlexInt `json:"guest-rx_bytes"`
Wifi0RxBytes FlexInt `json:"wifi0-rx_bytes"`
Wifi1RxBytes FlexInt `json:"wifi1-rx_bytes"`
RxBytes FlexInt `json:"rx_bytes"`
GuestWifi0RxErrors FlexInt `json:"guest-wifi0-rx_errors"`
GuestWifi1RxErrors FlexInt `json:"guest-wifi1-rx_errors"`
UserWifi1RxErrors FlexInt `json:"user-wifi1-rx_errors"`
UserWifi0RxErrors FlexInt `json:"user-wifi0-rx_errors"`
UserRxErrors FlexInt `json:"user-rx_errors"`
GuestRxErrors FlexInt `json:"guest-rx_errors"`
Wifi0RxErrors FlexInt `json:"wifi0-rx_errors"`
Wifi1RxErrors FlexInt `json:"wifi1-rx_errors"`
RxErrors FlexInt `json:"rx_errors"`
GuestWifi0RxDropped FlexInt `json:"guest-wifi0-rx_dropped"`
GuestWifi1RxDropped FlexInt `json:"guest-wifi1-rx_dropped"`
UserWifi1RxDropped FlexInt `json:"user-wifi1-rx_dropped"`
UserWifi0RxDropped FlexInt `json:"user-wifi0-rx_dropped"`
UserRxDropped FlexInt `json:"user-rx_dropped"`
GuestRxDropped FlexInt `json:"guest-rx_dropped"`
Wifi0RxDropped FlexInt `json:"wifi0-rx_dropped"`
Wifi1RxDropped FlexInt `json:"wifi1-rx_dropped"`
RxDropped FlexInt `json:"rx_dropped"`
GuestWifi0RxCrypts FlexInt `json:"guest-wifi0-rx_crypts"`
GuestWifi1RxCrypts FlexInt `json:"guest-wifi1-rx_crypts"`
UserWifi1RxCrypts FlexInt `json:"user-wifi1-rx_crypts"`
UserWifi0RxCrypts FlexInt `json:"user-wifi0-rx_crypts"`
UserRxCrypts FlexInt `json:"user-rx_crypts"`
GuestRxCrypts FlexInt `json:"guest-rx_crypts"`
Wifi0RxCrypts FlexInt `json:"wifi0-rx_crypts"`
Wifi1RxCrypts FlexInt `json:"wifi1-rx_crypts"`
RxCrypts FlexInt `json:"rx_crypts"`
GuestWifi0RxFrags FlexInt `json:"guest-wifi0-rx_frags"`
GuestWifi1RxFrags FlexInt `json:"guest-wifi1-rx_frags"`
UserWifi1RxFrags FlexInt `json:"user-wifi1-rx_frags"`
UserWifi0RxFrags FlexInt `json:"user-wifi0-rx_frags"`
UserRxFrags FlexInt `json:"user-rx_frags"`
GuestRxFrags FlexInt `json:"guest-rx_frags"`
Wifi0RxFrags FlexInt `json:"wifi0-rx_frags"`
Wifi1RxFrags FlexInt `json:"wifi1-rx_frags"`
RxFrags FlexInt `json:"rx_frags"`
GuestWifi0TxPackets FlexInt `json:"guest-wifi0-tx_packets"`
GuestWifi1TxPackets FlexInt `json:"guest-wifi1-tx_packets"`
UserWifi1TxPackets FlexInt `json:"user-wifi1-tx_packets"`
UserWifi0TxPackets FlexInt `json:"user-wifi0-tx_packets"`
UserTxPackets FlexInt `json:"user-tx_packets"`
GuestTxPackets FlexInt `json:"guest-tx_packets"`
Wifi0TxPackets FlexInt `json:"wifi0-tx_packets"`
Wifi1TxPackets FlexInt `json:"wifi1-tx_packets"`
TxPackets FlexInt `json:"tx_packets"`
GuestWifi0TxBytes FlexInt `json:"guest-wifi0-tx_bytes"`
GuestWifi1TxBytes FlexInt `json:"guest-wifi1-tx_bytes"`
UserWifi1TxBytes FlexInt `json:"user-wifi1-tx_bytes"`
UserWifi0TxBytes FlexInt `json:"user-wifi0-tx_bytes"`
UserTxBytes FlexInt `json:"user-tx_bytes"`
GuestTxBytes FlexInt `json:"guest-tx_bytes"`
Wifi0TxBytes FlexInt `json:"wifi0-tx_bytes"`
Wifi1TxBytes FlexInt `json:"wifi1-tx_bytes"`
TxBytes FlexInt `json:"tx_bytes"`
GuestWifi0TxErrors FlexInt `json:"guest-wifi0-tx_errors"`
GuestWifi1TxErrors FlexInt `json:"guest-wifi1-tx_errors"`
UserWifi1TxErrors FlexInt `json:"user-wifi1-tx_errors"`
UserWifi0TxErrors FlexInt `json:"user-wifi0-tx_errors"`
UserTxErrors FlexInt `json:"user-tx_errors"`
GuestTxErrors FlexInt `json:"guest-tx_errors"`
Wifi0TxErrors FlexInt `json:"wifi0-tx_errors"`
Wifi1TxErrors FlexInt `json:"wifi1-tx_errors"`
TxErrors FlexInt `json:"tx_errors"`
GuestWifi0TxDropped FlexInt `json:"guest-wifi0-tx_dropped"`
GuestWifi1TxDropped FlexInt `json:"guest-wifi1-tx_dropped"`
UserWifi1TxDropped FlexInt `json:"user-wifi1-tx_dropped"`
UserWifi0TxDropped FlexInt `json:"user-wifi0-tx_dropped"`
UserTxDropped FlexInt `json:"user-tx_dropped"`
GuestTxDropped FlexInt `json:"guest-tx_dropped"`
Wifi0TxDropped FlexInt `json:"wifi0-tx_dropped"`
Wifi1TxDropped FlexInt `json:"wifi1-tx_dropped"`
TxDropped FlexInt `json:"tx_dropped"`
GuestWifi0TxRetries FlexInt `json:"guest-wifi0-tx_retries"`
GuestWifi1TxRetries FlexInt `json:"guest-wifi1-tx_retries"`
UserWifi1TxRetries FlexInt `json:"user-wifi1-tx_retries"`
UserWifi0TxRetries FlexInt `json:"user-wifi0-tx_retries"`
UserTxRetries FlexInt `json:"user-tx_retries"`
GuestTxRetries FlexInt `json:"guest-tx_retries"`
Wifi0TxRetries FlexInt `json:"wifi0-tx_retries"`
Wifi1TxRetries FlexInt `json:"wifi1-tx_retries"`
TxRetries FlexInt `json:"tx_retries"`
GuestWifi0MacFilterRejections FlexInt `json:"guest-wifi0-mac_filter_rejections"`
GuestWifi1MacFilterRejections FlexInt `json:"guest-wifi1-mac_filter_rejections"`
UserWifi1MacFilterRejections FlexInt `json:"user-wifi1-mac_filter_rejections"`
UserWifi0MacFilterRejections FlexInt `json:"user-wifi0-mac_filter_rejections"`
UserMacFilterRejections FlexInt `json:"user-mac_filter_rejections"`
GuestMacFilterRejections FlexInt `json:"guest-mac_filter_rejections"`
Wifi0MacFilterRejections FlexInt `json:"wifi0-mac_filter_rejections"`
Wifi1MacFilterRejections FlexInt `json:"wifi1-mac_filter_rejections"`
MacFilterRejections FlexInt `json:"mac_filter_rejections"`
GuestWifi0WifiTxAttempts FlexInt `json:"guest-wifi0-wifi_tx_attempts"`
GuestWifi1WifiTxAttempts FlexInt `json:"guest-wifi1-wifi_tx_attempts"`
UserWifi1WifiTxAttempts FlexInt `json:"user-wifi1-wifi_tx_attempts"`
UserWifi0WifiTxAttempts FlexInt `json:"user-wifi0-wifi_tx_attempts"`
UserWifiTxAttempts FlexInt `json:"user-wifi_tx_attempts"`
GuestWifiTxAttempts FlexInt `json:"guest-wifi_tx_attempts"`
Wifi0WifiTxAttempts FlexInt `json:"wifi0-wifi_tx_attempts"`
Wifi1WifiTxAttempts FlexInt `json:"wifi1-wifi_tx_attempts"`
WifiTxAttempts FlexInt `json:"wifi_tx_attempts"`
GuestWifi0WifiTxDropped FlexInt `json:"guest-wifi0-wifi_tx_dropped"`
GuestWifi1WifiTxDropped FlexInt `json:"guest-wifi1-wifi_tx_dropped"`
UserWifi1WifiTxDropped FlexInt `json:"user-wifi1-wifi_tx_dropped"`
UserWifi0WifiTxDropped FlexInt `json:"user-wifi0-wifi_tx_dropped"`
UserWifiTxDropped FlexInt `json:"user-wifi_tx_dropped"`
GuestWifiTxDropped FlexInt `json:"guest-wifi_tx_dropped"`
Wifi0WifiTxDropped FlexInt `json:"wifi0-wifi_tx_dropped"`
Wifi1WifiTxDropped FlexInt `json:"wifi1-wifi_tx_dropped"`
WifiTxDropped FlexInt `json:"wifi_tx_dropped"`
Bytes FlexInt `json:"bytes"`
Duration FlexInt `json:"duration"`
} `json:"stat,omitempty"`
TxBytes FlexInt `json:"tx_bytes"`
RxBytes FlexInt `json:"rx_bytes"`
Bytes FlexInt `json:"bytes"`
VwireEnabled FlexBool `json:"vwireEnabled"`
VwireTable []interface{} `json:"vwire_table"`
VwireVapTable []struct {
Bssid string `json:"bssid"`
Radio string `json:"radio"`
RadioName string `json:"radio_name"`
State string `json:"state"`
} `json:"vwire_vap_table"`
WifiCaps int `json:"wifi_caps"`
UplinkTable []interface{} `json:"uplink_table"`
NumSta int `json:"num_sta"`
UserNumSta int `json:"user-num_sta"`
GuestNumSta int `json:"guest-num_sta"`
TwoPhaseAdopt FlexBool `json:"two_phase_adopt,omitempty"`
}