remove a bunch of unused things from influx code
This commit is contained in:
parent
25e5f1c4b6
commit
f9a4963b23
|
|
@ -11,97 +11,79 @@ import (
|
|||
// These points can be passed directly to influx.
|
||||
func ClientPoints(c *unifi.Client, now time.Time) ([]*influx.Point, error) {
|
||||
tags := map[string]string{
|
||||
"id": c.ID,
|
||||
"mac": c.Mac,
|
||||
"user_id": c.UserID,
|
||||
"site_id": c.SiteID,
|
||||
"site_name": c.SiteName,
|
||||
"network_id": c.NetworkID,
|
||||
"usergroup_id": c.UserGroupID,
|
||||
"ap_mac": c.ApMac,
|
||||
"gw_mac": c.GwMac,
|
||||
"sw_mac": c.SwMac,
|
||||
"ap_name": c.ApName,
|
||||
"gw_name": c.GwName,
|
||||
"sw_name": c.SwName,
|
||||
"oui": c.Oui,
|
||||
"radio_name": c.RadioName,
|
||||
"radio": c.Radio,
|
||||
"radio_proto": c.RadioProto,
|
||||
"name": c.Name,
|
||||
"fixed_ip": c.FixedIP,
|
||||
"sw_port": c.SwPort.Txt,
|
||||
"os_class": c.OsClass.Txt,
|
||||
"os_name": c.OsName.Txt,
|
||||
"dev_cat": c.DevCat.Txt,
|
||||
"dev_id": c.DevID.Txt,
|
||||
"dev_vendor": c.DevVendor.Txt,
|
||||
"dev_family": c.DevFamily.Txt,
|
||||
"is_11r": c.Is11R.Txt,
|
||||
"is_wired": c.IsWired.Txt,
|
||||
"is_guest": c.IsGuest.Txt,
|
||||
"is_guest_by_uap": c.IsGuestByUAP.Txt,
|
||||
"is_guest_by_ugw": c.IsGuestByUGW.Txt,
|
||||
"is_guest_by_usw": c.IsGuestByUSW.Txt,
|
||||
"noted": c.Noted.Txt,
|
||||
"powersave_enabled": c.PowersaveEnabled.Txt,
|
||||
"qos_policy_applied": c.QosPolicyApplied.Txt,
|
||||
"use_fixedip": c.UseFixedIP.Txt,
|
||||
"channel": c.Channel.Txt,
|
||||
"vlan": c.Vlan.Txt,
|
||||
"id": c.ID,
|
||||
"mac": c.Mac,
|
||||
"user_id": c.UserID,
|
||||
"site_id": c.SiteID,
|
||||
"site_name": c.SiteName,
|
||||
"ap_mac": c.ApMac,
|
||||
"gw_mac": c.GwMac,
|
||||
"sw_mac": c.SwMac,
|
||||
"ap_name": c.ApName,
|
||||
"gw_name": c.GwName,
|
||||
"sw_name": c.SwName,
|
||||
"oui": c.Oui,
|
||||
"radio_name": c.RadioName,
|
||||
"radio": c.Radio,
|
||||
"radio_proto": c.RadioProto,
|
||||
"name": c.Name,
|
||||
"fixed_ip": c.FixedIP,
|
||||
"sw_port": c.SwPort.Txt,
|
||||
"os_class": c.OsClass.Txt,
|
||||
"os_name": c.OsName.Txt,
|
||||
"dev_cat": c.DevCat.Txt,
|
||||
"dev_id": c.DevID.Txt,
|
||||
"dev_vendor": c.DevVendor.Txt,
|
||||
"dev_family": c.DevFamily.Txt,
|
||||
"is_wired": c.IsWired.Txt,
|
||||
"is_guest": c.IsGuest.Txt,
|
||||
"use_fixedip": c.UseFixedIP.Txt,
|
||||
"channel": c.Channel.Txt,
|
||||
"vlan": c.Vlan.Txt,
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"anomalies": c.Anomalies,
|
||||
"ip": c.IP,
|
||||
"essid": c.Essid,
|
||||
"bssid": c.Bssid,
|
||||
"radio_desc": c.RadioDescription,
|
||||
"satisfaction": c.Satisfaction.Val,
|
||||
"hostname": c.Hostname,
|
||||
"dpi_stats_last_updated": c.DpiStatsLastUpdated,
|
||||
"last_seen_by_uap": c.LastSeenByUAP,
|
||||
"last_seen_by_ugw": c.LastSeenByUGW,
|
||||
"last_seen_by_usw": c.LastSeenByUSW,
|
||||
"uptime_by_uap": c.UptimeByUAP,
|
||||
"uptime_by_ugw": c.UptimeByUGW,
|
||||
"uptime_by_usw": c.UptimeByUSW,
|
||||
"assoc_time": c.AssocTime,
|
||||
"bytes_r": c.BytesR,
|
||||
"ccq": c.Ccq,
|
||||
"first_seen": c.FirstSeen,
|
||||
"idle_time": c.IdleTime,
|
||||
"last_seen": c.LastSeen,
|
||||
"latest_assoc_time": c.LatestAssocTime,
|
||||
"network": c.Network,
|
||||
"noise": c.Noise,
|
||||
"note": c.Note,
|
||||
"roam_count": c.RoamCount,
|
||||
"rssi": c.Rssi,
|
||||
"rx_bytes": c.RxBytes,
|
||||
"rx_bytes_r": c.RxBytesR,
|
||||
"rx_packets": c.RxPackets,
|
||||
"rx_rate": c.RxRate,
|
||||
"signal": c.Signal,
|
||||
"tx_bytes": c.TxBytes,
|
||||
"tx_bytes_r": c.TxBytesR,
|
||||
"tx_packets": c.TxPackets,
|
||||
"tx_retries": c.TxRetries,
|
||||
"tx_power": c.TxPower,
|
||||
"tx_rate": c.TxRate,
|
||||
"uptime": c.Uptime,
|
||||
"wifi_tx_attempts": c.WifiTxAttempts,
|
||||
"wired-rx_bytes": c.WiredRxBytes,
|
||||
"wired-rx_bytes-r": c.WiredRxBytesR,
|
||||
"wired-rx_packets": c.WiredRxPackets,
|
||||
"wired-tx_bytes": c.WiredTxBytes,
|
||||
"wired-tx_bytes-r": c.WiredTxBytesR,
|
||||
"wired-tx_packets": c.WiredTxPackets,
|
||||
"dpi_app": c.DpiStats.App.Val,
|
||||
"dpi_cat": c.DpiStats.Cat.Val,
|
||||
"dpi_rx_bytes": c.DpiStats.RxBytes.Val,
|
||||
"dpi_rx_packets": c.DpiStats.RxPackets.Val,
|
||||
"dpi_tx_bytes": c.DpiStats.TxBytes.Val,
|
||||
"dpi_tx_packets": c.DpiStats.TxPackets.Val,
|
||||
"anomalies": c.Anomalies,
|
||||
"ip": c.IP,
|
||||
"essid": c.Essid,
|
||||
"bssid": c.Bssid,
|
||||
"radio_desc": c.RadioDescription,
|
||||
"satisfaction": c.Satisfaction.Val,
|
||||
"hostname": c.Hostname,
|
||||
"bytes_r": c.BytesR,
|
||||
"ccq": c.Ccq,
|
||||
"first_seen": c.FirstSeen,
|
||||
"idle_time": c.IdleTime,
|
||||
"last_seen": c.LastSeen,
|
||||
"network": c.Network,
|
||||
"noise": c.Noise,
|
||||
"note": c.Note,
|
||||
"roam_count": c.RoamCount,
|
||||
"rssi": c.Rssi,
|
||||
"rx_bytes": c.RxBytes,
|
||||
"rx_bytes_r": c.RxBytesR,
|
||||
"rx_packets": c.RxPackets,
|
||||
"rx_rate": c.RxRate,
|
||||
"signal": c.Signal,
|
||||
"tx_bytes": c.TxBytes,
|
||||
"tx_bytes_r": c.TxBytesR,
|
||||
"tx_packets": c.TxPackets,
|
||||
"tx_retries": c.TxRetries,
|
||||
"tx_power": c.TxPower,
|
||||
"tx_rate": c.TxRate,
|
||||
"uptime": c.Uptime,
|
||||
"wifi_tx_attempts": c.WifiTxAttempts,
|
||||
"wired-rx_bytes": c.WiredRxBytes,
|
||||
"wired-rx_bytes-r": c.WiredRxBytesR,
|
||||
"wired-rx_packets": c.WiredRxPackets,
|
||||
"wired-tx_bytes": c.WiredTxBytes,
|
||||
"wired-tx_bytes-r": c.WiredTxBytesR,
|
||||
"wired-tx_packets": c.WiredTxPackets,
|
||||
"dpi_app": c.DpiStats.App.Val,
|
||||
"dpi_cat": c.DpiStats.Cat.Val,
|
||||
"dpi_rx_bytes": c.DpiStats.RxBytes.Val,
|
||||
"dpi_rx_packets": c.DpiStats.RxPackets.Val,
|
||||
"dpi_tx_bytes": c.DpiStats.TxBytes.Val,
|
||||
"dpi_tx_packets": c.DpiStats.TxPackets.Val,
|
||||
}
|
||||
pt, err := influx.NewPoint("clients", tags, fields, now)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -14,36 +14,27 @@ func SitePoints(u *unifi.Site, now time.Time) ([]*influx.Point, error) {
|
|||
points := []*influx.Point{}
|
||||
for _, s := range u.Health {
|
||||
tags := map[string]string{
|
||||
"id": u.ID,
|
||||
"name": u.Name,
|
||||
"site_name": u.SiteName,
|
||||
"desc": u.Desc,
|
||||
"status": s.Status,
|
||||
"subsystem": s.Subsystem,
|
||||
"wan_ip": s.WanIP,
|
||||
"netmask": s.Netmask,
|
||||
"gw_name": s.GwName,
|
||||
"gw_mac": s.GwMac,
|
||||
"gw_version": s.GwVersion,
|
||||
"speedtest_status": s.SpeedtestStatus,
|
||||
"lan_ip": s.LanIP,
|
||||
"remote_user_enabled": s.RemoteUserEnabled.Txt,
|
||||
"site_to_site_enabled": s.SiteToSiteEnabled.Txt,
|
||||
"nameservers": strings.Join(s.Nameservers, ","),
|
||||
"gateways": strings.Join(s.Gateways, ","),
|
||||
"num_new_alarms": u.NumNewAlarms.Txt,
|
||||
"attr_hidden_id": u.AttrHiddenID,
|
||||
"attr_no_delete": u.AttrNoDelete.Txt,
|
||||
"name": u.Name,
|
||||
"site_name": u.SiteName,
|
||||
"desc": u.Desc,
|
||||
"status": s.Status,
|
||||
"subsystem": s.Subsystem,
|
||||
"wan_ip": s.WanIP,
|
||||
"netmask": s.Netmask,
|
||||
"gw_name": s.GwName,
|
||||
"gw_mac": s.GwMac,
|
||||
"gw_version": s.GwVersion,
|
||||
"lan_ip": s.LanIP,
|
||||
"nameservers": strings.Join(s.Nameservers, ","),
|
||||
"gateways": strings.Join(s.Gateways, ","),
|
||||
"num_new_alarms": u.NumNewAlarms.Txt,
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"attr_hidden_id": u.AttrHiddenID,
|
||||
"attr_no_delete": u.AttrNoDelete.Val,
|
||||
"num_user": s.NumUser.Val,
|
||||
"num_guest": s.NumGuest.Val,
|
||||
"num_iot": s.NumIot.Val,
|
||||
"tx_bytes-r": s.TxBytesR.Val,
|
||||
"rx_bytes-r": s.RxBytesR.Val,
|
||||
"status": s.Status,
|
||||
"num_ap": s.NumAp.Val,
|
||||
"num_adopted": s.NumAdopted.Val,
|
||||
"num_disabled": s.NumDisabled.Val,
|
||||
|
|
|
|||
|
|
@ -14,27 +14,15 @@ func UAPPoints(u *unifi.UAP, now time.Time) ([]*influx.Point, error) {
|
|||
u.Stat.Ap = &unifi.Ap{}
|
||||
}
|
||||
tags := map[string]string{
|
||||
"id": u.ID,
|
||||
"ip": u.IP,
|
||||
"mac": u.Mac,
|
||||
"device_type": u.Stat.Ap.O,
|
||||
"device_oid": u.Stat.Ap.Oid,
|
||||
"device_ap": u.Stat.Ap.Ap,
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"name": u.Name,
|
||||
"adopted": u.Adopted.Txt,
|
||||
"cfgversion": u.Cfgversion,
|
||||
"config_network_ip": u.ConfigNetwork.IP,
|
||||
"config_network_type": u.ConfigNetwork.Type,
|
||||
"connect_request_ip": u.ConnectRequestIP,
|
||||
"device_id": u.DeviceID,
|
||||
"has_eth1": u.HasEth1.Txt,
|
||||
"inform_ip": u.InformIP,
|
||||
"known_cfgversion": u.KnownCfgversion,
|
||||
"model": u.Model,
|
||||
"serial": u.Serial,
|
||||
"type": u.Type,
|
||||
"ip": u.IP,
|
||||
"mac": u.Mac,
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"name": u.Name,
|
||||
"cfgversion": u.Cfgversion,
|
||||
"model": u.Model,
|
||||
"serial": u.Serial,
|
||||
"type": u.Type,
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"ip": u.IP,
|
||||
|
|
@ -47,7 +35,6 @@ func UAPPoints(u *unifi.UAP, now time.Time) ([]*influx.Point, error) {
|
|||
"user-num_sta": int(u.UserNumSta.Val),
|
||||
"guest-num_sta": int(u.GuestNumSta.Val),
|
||||
"num_sta": u.NumSta.Val,
|
||||
"version": u.Version,
|
||||
"loadavg_1": u.SysStats.Loadavg1.Val,
|
||||
"loadavg_5": u.SysStats.Loadavg5.Val,
|
||||
"loadavg_15": u.SysStats.Loadavg15.Val,
|
||||
|
|
@ -95,7 +82,7 @@ func UAPPoints(u *unifi.UAP, now time.Time) ([]*influx.Point, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
morePoints, err := processVAPs(u.VapTable, u.RadioTable, u.RadioTableStats, u.Name, u.ID, u.Mac, u.SiteName, now)
|
||||
morePoints, err := processVAPs(u.VapTable, u.RadioTable, u.RadioTableStats, u.Name, u.Mac, u.SiteName, now)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -103,7 +90,7 @@ func UAPPoints(u *unifi.UAP, now time.Time) ([]*influx.Point, error) {
|
|||
}
|
||||
|
||||
// processVAPs creates points for Wifi Radios. This works with several types of UAP-capable devices.
|
||||
func processVAPs(vt unifi.VapTable, rt unifi.RadioTable, rts unifi.RadioTableStats, name, id, mac, sitename string, ts time.Time) ([]*influx.Point, error) {
|
||||
func processVAPs(vt unifi.VapTable, rt unifi.RadioTable, rts unifi.RadioTableStats, name, mac, sitename string, ts time.Time) ([]*influx.Point, error) {
|
||||
tags := make(map[string]string)
|
||||
fields := make(map[string]interface{})
|
||||
points := []*influx.Point{}
|
||||
|
|
@ -112,7 +99,6 @@ func processVAPs(vt unifi.VapTable, rt unifi.RadioTable, rts unifi.RadioTableSta
|
|||
// from radio_tables and radio_table_stats.
|
||||
for _, s := range vt {
|
||||
tags["device_name"] = name
|
||||
tags["device_id"] = id
|
||||
tags["device_mac"] = mac
|
||||
tags["site_name"] = sitename
|
||||
tags["ap_mac"] = s.ApMac
|
||||
|
|
@ -120,13 +106,11 @@ func processVAPs(vt unifi.VapTable, rt unifi.RadioTable, rts unifi.RadioTableSta
|
|||
tags["id"] = s.ID
|
||||
tags["name"] = s.Name
|
||||
tags["radio_name"] = s.RadioName
|
||||
tags["wlanconf_id"] = s.WlanconfID
|
||||
tags["essid"] = s.Essid
|
||||
tags["site_id"] = s.SiteID
|
||||
tags["usage"] = s.Usage
|
||||
tags["state"] = s.State
|
||||
tags["is_guest"] = s.IsGuest.Txt
|
||||
tags["is_wep"] = s.IsWep.Txt
|
||||
|
||||
fields["ccq"] = s.Ccq
|
||||
fields["extchannel"] = s.Extchannel
|
||||
|
|
@ -171,13 +155,11 @@ func processVAPs(vt unifi.VapTable, rt unifi.RadioTable, rts unifi.RadioTableSta
|
|||
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.Txt
|
||||
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
|
||||
|
|
|
|||
|
|
@ -17,29 +17,20 @@ func UDMPoints(u *unifi.UDM, now time.Time) ([]*influx.Point, error) {
|
|||
u.Stat.Gw = &unifi.Gw{}
|
||||
}
|
||||
tags := map[string]string{
|
||||
"id": u.ID,
|
||||
"mac": u.Mac,
|
||||
"device_oid": u.Stat.Gw.Oid,
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"adopted": u.Adopted.Txt,
|
||||
"name": u.Name,
|
||||
"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,
|
||||
"device_id": u.DeviceID,
|
||||
"guest_token": u.GuestToken,
|
||||
"inform_ip": u.InformIP,
|
||||
"known_cfgversion": u.KnownCfgversion,
|
||||
"model": u.Model,
|
||||
"serial": u.Serial,
|
||||
"type": u.Type,
|
||||
"usg_caps": u.UsgCaps.Txt,
|
||||
"speedtest-status-saved": u.SpeedtestStatusSaved.Txt,
|
||||
"wan1_up": u.Wan1.Up.Txt,
|
||||
"wan2_up": u.Wan2.Up.Txt,
|
||||
"id": u.ID,
|
||||
"mac": u.Mac,
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"name": u.Name,
|
||||
"cfgversion": u.Cfgversion,
|
||||
"device_id": u.DeviceID,
|
||||
"known_cfgversion": u.KnownCfgversion,
|
||||
"model": u.Model,
|
||||
"serial": u.Serial,
|
||||
"type": u.Type,
|
||||
"usg_caps": u.UsgCaps.Txt,
|
||||
"wan1_up": u.Wan1.Up.Txt,
|
||||
"wan2_up": u.Wan2.Up.Txt,
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"ip": u.IP,
|
||||
|
|
@ -147,29 +138,16 @@ func UDMPoints(u *unifi.UDM, now time.Time) ([]*influx.Point, error) {
|
|||
}
|
||||
points := []*influx.Point{pt}
|
||||
tags = map[string]string{
|
||||
"id": u.ID,
|
||||
"mac": u.Mac,
|
||||
"device_oid": u.Stat.Sw.Oid,
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"name": u.Name,
|
||||
"adopted": u.Adopted.Txt,
|
||||
"cfgversion": u.Cfgversion,
|
||||
"config_network_ip": u.ConfigNetwork.IP,
|
||||
"config_network_type": u.ConfigNetwork.Type,
|
||||
"device_id": u.DeviceID,
|
||||
"inform_ip": u.InformIP,
|
||||
"known_cfgversion": u.KnownCfgversion,
|
||||
"locating": u.Locating.Txt,
|
||||
"model": u.Model,
|
||||
"serial": u.Serial,
|
||||
"type": u.Type,
|
||||
"dot1x_portctrl_enabled": u.Dot1XPortctrlEnabled.Txt,
|
||||
"flowctrl_enabled": u.FlowctrlEnabled.Txt,
|
||||
"has_fan": u.HasFan.Txt,
|
||||
"has_temperature": u.HasTemperature.Txt,
|
||||
"jumboframe_enabled": u.JumboframeEnabled.Txt,
|
||||
"stp_version": u.StpVersion,
|
||||
"id": u.ID,
|
||||
"mac": u.Mac,
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"name": u.Name,
|
||||
"model": u.Model,
|
||||
"serial": u.Serial,
|
||||
"type": u.Type,
|
||||
"has_fan": u.HasFan.Txt,
|
||||
"has_temperature": u.HasTemperature.Txt,
|
||||
}
|
||||
fields = map[string]interface{}{
|
||||
"fw_caps": u.FwCaps.Val,
|
||||
|
|
@ -219,23 +197,19 @@ func UDMPoints(u *unifi.UDM, now time.Time) ([]*influx.Point, error) {
|
|||
|
||||
for _, p := range u.NetworkTable {
|
||||
tags := map[string]string{
|
||||
"device_name": u.Name,
|
||||
"device_id": u.ID,
|
||||
"device_mac": u.Mac,
|
||||
"site_name": u.SiteName,
|
||||
"up": p.Up.Txt,
|
||||
"dhcpd_dns_enabled": p.DhcpdDNSEnabled.Txt,
|
||||
"dhcpd_enabled": p.DhcpdEnabled.Txt,
|
||||
"dhcpd_time_offset_enabled": p.DhcpdTimeOffsetEnabled.Txt,
|
||||
"dhcp_relay_enabledy": p.DhcpRelayEnabled.Txt,
|
||||
"dhcpd_gateway_enabled": p.DhcpdGatewayEnabled.Txt,
|
||||
"enabled": p.Enabled.Txt,
|
||||
"vlan_enabled": p.VlanEnabled.Txt,
|
||||
"attr_no_delete": p.AttrNoDelete.Txt,
|
||||
"is_guest": p.IsGuest.Txt,
|
||||
"is_nat": p.IsNat.Txt,
|
||||
"networkgroup": p.Networkgroup,
|
||||
"site_id": p.SiteID,
|
||||
"device_name": u.Name,
|
||||
"device_id": u.ID,
|
||||
"device_mac": u.Mac,
|
||||
"site_name": u.SiteName,
|
||||
"up": p.Up.Txt,
|
||||
"enabled": p.Enabled.Txt,
|
||||
"site_id": p.SiteID,
|
||||
"ip": p.IP,
|
||||
"ip_subnet": p.IPSubnet,
|
||||
"mac": p.Mac,
|
||||
"name": p.Name,
|
||||
"domain_name": p.DomainName,
|
||||
"purpose": p.Purpose,
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"domain_name": p.DomainName,
|
||||
|
|
@ -263,35 +237,21 @@ func UDMPoints(u *unifi.UDM, now time.Time) ([]*influx.Point, error) {
|
|||
|
||||
for _, p := range u.PortTable {
|
||||
tags := map[string]string{
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"device_name": u.Name,
|
||||
"name": p.Name,
|
||||
"enable": p.Enable.Txt,
|
||||
"is_uplink": p.IsUplink.Txt,
|
||||
"up": p.Up.Txt,
|
||||
"portconf_id": p.PortconfID,
|
||||
"dot1x_mode": p.Dot1XMode,
|
||||
"dot1x_status": p.Dot1XStatus,
|
||||
"stp_state": p.StpState,
|
||||
"sfp_found": p.SfpFound.Txt,
|
||||
"op_mode": p.OpMode,
|
||||
"poe_mode": p.PoeMode,
|
||||
"port_poe": p.PortPoe.Txt,
|
||||
"port_idx": p.PortIdx.Txt,
|
||||
"port_id": u.Name + " Port " + p.PortIdx.Txt,
|
||||
"poe_enable": p.PoeEnable.Txt,
|
||||
"flowctrl_rx": p.FlowctrlRx.Txt,
|
||||
"flowctrl_tx": p.FlowctrlTx.Txt,
|
||||
"autoneg": p.Autoneg.Txt,
|
||||
"full_duplex": p.FullDuplex.Txt,
|
||||
"jumbo": p.Jumbo.Txt,
|
||||
"masked": p.Masked.Txt,
|
||||
"poe_good": p.PoeGood.Txt,
|
||||
"media": p.Media,
|
||||
"poe_class": p.PoeClass,
|
||||
"poe_caps": p.PoeCaps.Txt,
|
||||
"aggregated_by": p.AggregatedBy.Txt,
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"device_name": u.Name,
|
||||
"name": p.Name,
|
||||
"enable": p.Enable.Txt,
|
||||
"up": p.Up.Txt,
|
||||
"poe_mode": p.PoeMode,
|
||||
"port_poe": p.PortPoe.Txt,
|
||||
"port_idx": p.PortIdx.Txt,
|
||||
"port_id": u.Name + " Port " + p.PortIdx.Txt,
|
||||
"poe_enable": p.PoeEnable.Txt,
|
||||
"flowctrl_rx": p.FlowctrlRx.Txt,
|
||||
"flowctrl_tx": p.FlowctrlTx.Txt,
|
||||
"media": p.Media,
|
||||
"poe_class": p.PoeClass,
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"dbytes_r": p.BytesR.Val,
|
||||
|
|
@ -314,7 +274,6 @@ func UDMPoints(u *unifi.UDM, now time.Time) ([]*influx.Point, error) {
|
|||
"poe_current": p.PoeCurrent.Val,
|
||||
"poe_power": p.PoePower.Val,
|
||||
"poe_voltage": p.PoeVoltage.Val,
|
||||
"full_duplex": p.FullDuplex.Val,
|
||||
}
|
||||
pt, err = influx.NewPoint("usw_ports", tags, fields, now)
|
||||
if err != nil {
|
||||
|
|
@ -327,27 +286,15 @@ func UDMPoints(u *unifi.UDM, now time.Time) ([]*influx.Point, error) {
|
|||
// we're done now. the following code process UDM (non-pro) UAP data.
|
||||
}
|
||||
tags = map[string]string{
|
||||
"id": u.ID,
|
||||
"ip": u.IP,
|
||||
"mac": u.Mac,
|
||||
"device_type": u.Stat.Ap.O,
|
||||
"device_oid": u.Stat.Ap.Oid,
|
||||
"device_ap": u.Stat.Ap.Ap,
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"name": u.Name,
|
||||
"adopted": u.Adopted.Txt,
|
||||
"cfgversion": u.Cfgversion,
|
||||
"config_network_ip": u.ConfigNetwork.IP,
|
||||
"config_network_type": u.ConfigNetwork.Type,
|
||||
"connect_request_ip": u.ConnectRequestIP,
|
||||
"device_id": u.DeviceID,
|
||||
"has_eth1": u.HasEth1.Txt,
|
||||
"inform_ip": u.InformIP,
|
||||
"known_cfgversion": u.KnownCfgversion,
|
||||
"model": u.Model,
|
||||
"serial": u.Serial,
|
||||
"type": u.Type,
|
||||
"ip": u.IP,
|
||||
"mac": u.Mac,
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"name": u.Name,
|
||||
"cfgversion": u.Cfgversion,
|
||||
"model": u.Model,
|
||||
"serial": u.Serial,
|
||||
"type": u.Type,
|
||||
}
|
||||
fields = map[string]interface{}{
|
||||
"ip": u.IP,
|
||||
|
|
@ -360,7 +307,6 @@ func UDMPoints(u *unifi.UDM, now time.Time) ([]*influx.Point, error) {
|
|||
"user-num_sta": int(u.UserWlanNumSta.Val),
|
||||
"guest-num_sta": int(u.GuestWlanNumSta.Val),
|
||||
"num_sta": u.WlanNumSta.Val,
|
||||
"version": u.Version,
|
||||
"loadavg_1": u.SysStats.Loadavg1.Val,
|
||||
"loadavg_5": u.SysStats.Loadavg5.Val,
|
||||
"loadavg_15": u.SysStats.Loadavg15.Val,
|
||||
|
|
@ -408,7 +354,7 @@ func UDMPoints(u *unifi.UDM, now time.Time) ([]*influx.Point, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uapPoints, err := processVAPs(*u.VapTable, *u.RadioTable, *u.RadioTableStats, u.Name, u.ID, u.Mac, u.SiteName, now)
|
||||
uapPoints, err := processVAPs(*u.VapTable, *u.RadioTable, *u.RadioTableStats, u.Name, u.Mac, u.SiteName, now)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,33 +15,21 @@ func USGPoints(u *unifi.USG, now time.Time) ([]*influx.Point, error) {
|
|||
u.Stat.Gw = &unifi.Gw{}
|
||||
}
|
||||
tags := map[string]string{
|
||||
"id": u.ID,
|
||||
"mac": u.Mac,
|
||||
"device_type": u.Stat.O,
|
||||
"device_oid": u.Stat.Oid,
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"adopted": u.Adopted.Txt,
|
||||
"name": u.Name,
|
||||
"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,
|
||||
"device_id": u.DeviceID,
|
||||
"guest_token": u.GuestToken,
|
||||
"inform_ip": u.InformIP,
|
||||
"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,
|
||||
"usg_caps": u.UsgCaps.Txt,
|
||||
"speedtest-status-saved": u.SpeedtestStatusSaved.Txt,
|
||||
"wan1_up": u.Wan1.Up.Txt,
|
||||
"wan2_up": u.Wan2.Up.Txt,
|
||||
"id": u.ID,
|
||||
"mac": u.Mac,
|
||||
"device_type": u.Stat.O,
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"name": u.Name,
|
||||
"cfgversion": u.Cfgversion,
|
||||
"device_id": u.DeviceID,
|
||||
"known_cfgversion": u.KnownCfgversion,
|
||||
"model": u.Model,
|
||||
"serial": u.Serial,
|
||||
"type": u.Type,
|
||||
"usg_caps": u.UsgCaps.Txt,
|
||||
"wan1_up": u.Wan1.Up.Txt,
|
||||
"wan2_up": u.Wan2.Up.Txt,
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"ip": u.IP,
|
||||
|
|
@ -153,33 +141,19 @@ func USGPoints(u *unifi.USG, now time.Time) ([]*influx.Point, error) {
|
|||
points := []*influx.Point{pt}
|
||||
for _, p := range u.NetworkTable {
|
||||
tags := map[string]string{
|
||||
"device_name": u.Name,
|
||||
"device_id": u.ID,
|
||||
"device_mac": u.Mac,
|
||||
"site_name": u.SiteName,
|
||||
"up": p.Up.Txt,
|
||||
"dhcpd_dns_enabled": p.DhcpdDNSEnabled.Txt,
|
||||
"dhcpd_enabled": p.DhcpdEnabled.Txt,
|
||||
"dhcpd_time_offset_enabled": p.DhcpdTimeOffsetEnabled.Txt,
|
||||
"dhcp_relay_enabledy": p.DhcpRelayEnabled.Txt,
|
||||
"dhcpd_gateway_enabled": p.DhcpdGatewayEnabled.Txt,
|
||||
"enabled": p.Enabled.Txt,
|
||||
"vlan_enabled": p.VlanEnabled.Txt,
|
||||
"attr_no_delete": p.AttrNoDelete.Txt,
|
||||
"is_guest": p.IsGuest.Txt,
|
||||
"is_nat": p.IsNat.Txt,
|
||||
"networkgroup": p.Networkgroup,
|
||||
"site_id": p.SiteID,
|
||||
"ip": p.IP,
|
||||
"ip_subnet": p.IPSubnet,
|
||||
"mac": p.Mac,
|
||||
"name": p.Name,
|
||||
"domain_name": p.DomainName,
|
||||
"dhcpd_start": p.DhcpdStart,
|
||||
"dhcpd_stop": p.DhcpdStop,
|
||||
"ipv6_interface_type": p.Ipv6InterfaceType,
|
||||
"attr_hidden_id": p.AttrHiddenID,
|
||||
"purpose": p.Purpose,
|
||||
"device_name": u.Name,
|
||||
"device_id": u.ID,
|
||||
"device_mac": u.Mac,
|
||||
"site_name": u.SiteName,
|
||||
"up": p.Up.Txt,
|
||||
"enabled": p.Enabled.Txt,
|
||||
"site_id": p.SiteID,
|
||||
"ip": p.IP,
|
||||
"ip_subnet": p.IPSubnet,
|
||||
"mac": p.Mac,
|
||||
"name": p.Name,
|
||||
"domain_name": p.DomainName,
|
||||
"purpose": p.Purpose,
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"num_sta": p.NumSta.Val,
|
||||
|
|
|
|||
|
|
@ -14,29 +14,16 @@ func USWPoints(u *unifi.USW, now time.Time) ([]*influx.Point, error) {
|
|||
u.Stat.Sw = &unifi.Sw{}
|
||||
}
|
||||
tags := map[string]string{
|
||||
"id": u.ID,
|
||||
"mac": u.Mac,
|
||||
"device_oid": u.Stat.Oid,
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"name": u.Name,
|
||||
"adopted": u.Adopted.Txt,
|
||||
"cfgversion": u.Cfgversion,
|
||||
"config_network_ip": u.ConfigNetwork.IP,
|
||||
"config_network_type": u.ConfigNetwork.Type,
|
||||
"device_id": u.DeviceID,
|
||||
"inform_ip": u.InformIP,
|
||||
"known_cfgversion": u.KnownCfgversion,
|
||||
"locating": u.Locating.Txt,
|
||||
"model": u.Model,
|
||||
"serial": u.Serial,
|
||||
"type": u.Type,
|
||||
"dot1x_portctrl_enabled": u.Dot1XPortctrlEnabled.Txt,
|
||||
"flowctrl_enabled": u.FlowctrlEnabled.Txt,
|
||||
"has_fan": u.HasFan.Txt,
|
||||
"has_temperature": u.HasTemperature.Txt,
|
||||
"jumboframe_enabled": u.JumboframeEnabled.Txt,
|
||||
"stp_version": u.StpVersion,
|
||||
"id": u.ID,
|
||||
"mac": u.Mac,
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"name": u.Name,
|
||||
"model": u.Model,
|
||||
"serial": u.Serial,
|
||||
"type": u.Type,
|
||||
"has_fan": u.HasFan.Txt,
|
||||
"has_temperature": u.HasTemperature.Txt,
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"fw_caps": u.FwCaps.Val,
|
||||
|
|
@ -85,35 +72,21 @@ func USWPoints(u *unifi.USW, now time.Time) ([]*influx.Point, error) {
|
|||
points := []*influx.Point{pt}
|
||||
for _, p := range u.PortTable {
|
||||
tags := map[string]string{
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"device_name": u.Name,
|
||||
"name": p.Name,
|
||||
"enable": p.Enable.Txt,
|
||||
"is_uplink": p.IsUplink.Txt,
|
||||
"up": p.Up.Txt,
|
||||
"portconf_id": p.PortconfID,
|
||||
"dot1x_mode": p.Dot1XMode,
|
||||
"dot1x_status": p.Dot1XStatus,
|
||||
"stp_state": p.StpState,
|
||||
"sfp_found": p.SfpFound.Txt,
|
||||
"op_mode": p.OpMode,
|
||||
"poe_mode": p.PoeMode,
|
||||
"port_poe": p.PortPoe.Txt,
|
||||
"port_idx": p.PortIdx.Txt,
|
||||
"port_id": u.Name + " Port " + p.PortIdx.Txt,
|
||||
"poe_enable": p.PoeEnable.Txt,
|
||||
"flowctrl_rx": p.FlowctrlRx.Txt,
|
||||
"flowctrl_tx": p.FlowctrlTx.Txt,
|
||||
"autoneg": p.Autoneg.Txt,
|
||||
"full_duplex": p.FullDuplex.Txt,
|
||||
"jumbo": p.Jumbo.Txt,
|
||||
"masked": p.Masked.Txt,
|
||||
"poe_good": p.PoeGood.Txt,
|
||||
"media": p.Media,
|
||||
"poe_class": p.PoeClass,
|
||||
"poe_caps": p.PoeCaps.Txt,
|
||||
"aggregated_by": p.AggregatedBy.Txt,
|
||||
"site_id": u.SiteID,
|
||||
"site_name": u.SiteName,
|
||||
"device_name": u.Name,
|
||||
"name": p.Name,
|
||||
"enable": p.Enable.Txt,
|
||||
"up": p.Up.Txt,
|
||||
"poe_mode": p.PoeMode,
|
||||
"port_poe": p.PortPoe.Txt,
|
||||
"port_idx": p.PortIdx.Txt,
|
||||
"port_id": u.Name + " Port " + p.PortIdx.Txt,
|
||||
"poe_enable": p.PoeEnable.Txt,
|
||||
"flowctrl_rx": p.FlowctrlRx.Txt,
|
||||
"flowctrl_tx": p.FlowctrlTx.Txt,
|
||||
"media": p.Media,
|
||||
"poe_class": p.PoeClass,
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"dbytes_r": p.BytesR.Val,
|
||||
|
|
@ -136,7 +109,6 @@ func USWPoints(u *unifi.USW, now time.Time) ([]*influx.Point, error) {
|
|||
"poe_current": p.PoeCurrent.Val,
|
||||
"poe_power": p.PoePower.Val,
|
||||
"poe_voltage": p.PoeVoltage.Val,
|
||||
"full_duplex": p.FullDuplex.Val,
|
||||
}
|
||||
pt, err = influx.NewPoint("usw_ports", tags, fields, now)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue