From 71d83d40b9eecd4f5617a7319bf39b288791af37 Mon Sep 17 00:00:00 2001 From: DN2 Date: Sun, 29 Apr 2018 01:35:18 -0700 Subject: [PATCH 1/2] Better errors, fix bugs, correct usg data. --- unidev/README.md | 10 +++ unidev/unidev.go | 9 +- unidev/unifi.go | 68 ++++++++------ unidev/usg.go | 217 +++++++++++++++++++++++++++++---------------- unidev/usg_type.go | 14 +-- unidev/usw.go | 6 +- unidev/usw_type.go | 12 +-- 7 files changed, 213 insertions(+), 123 deletions(-) create mode 100644 unidev/README.md diff --git a/unidev/README.md b/unidev/README.md new file mode 100644 index 00000000..a5195c1e --- /dev/null +++ b/unidev/README.md @@ -0,0 +1,10 @@ +# Go Library: `unidev` + +It connects to a Unifi Controller, given a url, username and password. Returns +an authenticated http Client you may use to query the device for data. Also +contains some built-in methods for de-serializing common client and device +data. The included asset interface currently only works for InfluxDB but could +probably be modified to support other output mechanisms; not sure really. + +This lib is rudimentary and gets a job done for the tool at hand. It could be +used to base your own library. Good luck! diff --git a/unidev/unidev.go b/unidev/unidev.go index 7cba8d98..f9399263 100644 --- a/unidev/unidev.go +++ b/unidev/unidev.go @@ -3,10 +3,11 @@ package unidev import ( "bytes" "crypto/tls" - influx "github.com/influxdata/influxdb/client/v2" - "github.com/pkg/errors" "net/http" "net/http/cookiejar" + + influx "github.com/influxdata/influxdb/client/v2" + "github.com/pkg/errors" ) // LoginPath is Unifi Controller Login API Path @@ -41,9 +42,9 @@ func AuthController(user, pass, url string) (*AuthedReq, error) { Jar: jar, }, url} if req, err := authReq.UniReq(LoginPath, json); err != nil { - return nil, errors.Wrap(err, "uniRequest(LoginPath, json)") + return nil, errors.Wrap(err, "UniReq(LoginPath, json)") } else if resp, err := authReq.Do(req); err != nil { - return nil, errors.Wrap(err, "c.uniClient.Do(req)") + return nil, errors.Wrap(err, "authReq.Do(req)") } else if resp.StatusCode != http.StatusOK { return nil, errors.Errorf("authentication failed (%v): %v (status: %v/%v)", user, url+LoginPath, resp.StatusCode, resp.Status) diff --git a/unidev/unifi.go b/unidev/unifi.go index 8239e620..e1f1e6f2 100644 --- a/unidev/unifi.go +++ b/unidev/unifi.go @@ -4,6 +4,8 @@ import ( "encoding/json" "io/ioutil" "log" + + "github.com/pkg/errors" ) // Debug .... @@ -28,16 +30,23 @@ func (c *AuthedReq) GetUnifiClients() ([]UCL, error) { Rc string `json:"rc"` } `json:"meta"` } - if req, err := c.UniReq(ClientPath, ""); err != nil { - return nil, err - } else if resp, err := c.Do(req); err != nil { - return nil, err - } else if body, err := ioutil.ReadAll(resp.Body); err != nil { - return nil, err + req, err := c.UniReq(ClientPath, "") + if err != nil { + return nil, errors.Wrap(err, "c.UniReq(ClientPath)") + } + resp, err := c.Do(req) + if err != nil { + return nil, errors.Wrap(err, "c.Do(req)") + } + defer func() { + if err := resp.Body.Close(); err != nil { + log.Println("resp.Body.Close():", err) // Not fatal? Just log it. + } + }() + if body, err := ioutil.ReadAll(resp.Body); err != nil { + return nil, errors.Wrap(err, "ioutil.ReadAll(resp.Body)") } else if err = json.Unmarshal(body, &response); err != nil { - return nil, err - } else if err = resp.Body.Close(); err != nil { - log.Println("resp.Body.Close():", err) // Not fatal? Just log it. + return nil, errors.Wrap(err, "json.Unmarshal([]UCL)") } return response.Clients, nil } @@ -62,30 +71,39 @@ func (c *AuthedReq) GetUnifiDevices() ([]USG, []USW, []UAP, error) { Rc string `json:"rc"` } `json:"meta"` } - if req, err := c.UniReq(DevicePath, ""); err != nil { - return nil, nil, nil, err - } else if resp, err := c.Do(req); err != nil { - return nil, nil, nil, err - } else if body, err := ioutil.ReadAll(resp.Body); err != nil { - return nil, nil, nil, err - } else if err = json.Unmarshal(body, &parsed); err != nil { - return nil, nil, nil, err - } else if err = resp.Body.Close(); err != nil { - log.Println("resp.Body.Close():", err) // Not fatal? Just log it. + req, err := c.UniReq(DevicePath, "") + if err != nil { + return nil, nil, nil, errors.Wrap(err, "c.UniReq(DevicePath)") } + resp, err := c.Do(req) + if err != nil { + return nil, nil, nil, errors.Wrap(err, "c.Do(req)") + } + defer func() { + if err := resp.Body.Close(); err != nil { + log.Println("resp.Body.Close():", err) // Not fatal? Just log it. + } + }() + if body, err := ioutil.ReadAll(resp.Body); err != nil { + return nil, nil, nil, errors.Wrap(err, "ioutil.ReadAll(resp.Body)") + } else if err = json.Unmarshal(body, &parsed); err != nil { + return nil, nil, nil, errors.Wrap(err, "json.Unmarshal([]json.RawMessage)") + } + var usgs []USG var usws []USW var uaps []UAP - for _, r := range parsed.Data { + // Loop each item in the raw JSON message, detect its type and unmarshal it. + for i, r := range parsed.Data { var usg USG var usw USW var uap UAP // Unamrshal into a map and check "type" var obj map[string]interface{} if err := json.Unmarshal(r, &obj); err != nil { - return nil, nil, nil, err + return nil, nil, nil, errors.Wrapf(err, "[%d] json.Unmarshal(interfce{})", i) } - assetType := "- missing -" + assetType := "" if t, ok := obj["type"].(string); ok { assetType = t } @@ -96,17 +114,17 @@ func (c *AuthedReq) GetUnifiDevices() ([]USG, []USW, []UAP, error) { switch assetType { case "uap": if err := json.Unmarshal(r, &uap); err != nil { - return nil, nil, nil, err + return nil, nil, nil, errors.Wrapf(err, "[%d] json.Unmarshal([]UAP)", i) } uaps = append(uaps, uap) case "ugw", "usg": // in case they ever fix the name in the api. if err := json.Unmarshal(r, &usg); err != nil { - return nil, nil, nil, err + return nil, nil, nil, errors.Wrapf(err, "[%d] json.Unmarshal([]USG)", i) } usgs = append(usgs, usg) case "usw": if err := json.Unmarshal(r, &usw); err != nil { - return nil, nil, nil, err + return nil, nil, nil, errors.Wrapf(err, "[%d] json.Unmarshal([]USW)", i) } usws = append(usws, usw) default: diff --git a/unidev/usg.go b/unidev/usg.go index f904f37c..86efb7ab 100644 --- a/unidev/usg.go +++ b/unidev/usg.go @@ -11,45 +11,44 @@ import ( func (u USG) Points() ([]*influx.Point, error) { var points []*influx.Point tags := map[string]string{ - "id": u.ID, - "mac": u.Mac, - "device_type": u.Stat.O, - "device_oid": u.Stat.Oid, - "site_id": u.SiteID, - "addopted": strconv.FormatBool(u.Adopted), - "name": u.Name, - "adopt_ip": u.AdoptIP, - "adopt_url": u.AdoptURL, - "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": strconv.FormatBool(u.Default), - "device_id": u.DeviceID, - "discovered_via": u.DiscoveredVia, - "fw_caps": strconv.FormatFloat(u.FwCaps, 'f', 6, 64), - "guest-num_sta": strconv.FormatFloat(u.GuestNumSta, 'f', 6, 64), - "guest_token": u.GuestToken, - "inform_ip": u.InformIP, - "last_seen": strconv.FormatFloat(u.LastSeen, 'f', 6, 64), - "known_cfgversion": u.KnownCfgversion, - "led_override": u.LedOverride, - "locating": strconv.FormatBool(u.Locating), - "model": u.Model, - "outdoor_mode_override": u.OutdoorModeOverride, - "serial": u.Serial, - "type": u.Type, - "version_incompatible": strconv.FormatBool(u.VersionIncompatible), - "config_network_wan_type": u.ConfigNetworkWan.Type, - "usg_caps": strconv.FormatFloat(u.UsgCaps, 'f', 6, 64), - "speedtest-status-saved": strconv.FormatBool(u.SpeedtestStatusSaved), + "id": u.ID, + "mac": u.Mac, + "device_type": u.Stat.O, + "device_oid": u.Stat.Oid, + "site_id": u.SiteID, + "addopted": strconv.FormatBool(u.Adopted), + "name": u.Name, + "adopt_ip": u.AdoptIP, + "adopt_url": u.AdoptURL, + "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": strconv.FormatBool(u.Default), + "device_id": u.DeviceID, + "discovered_via": u.DiscoveredVia, + "guest_token": u.GuestToken, + "inform_ip": u.InformIP, + "last_seen": strconv.FormatFloat(u.LastSeen, 'f', 6, 64), + "known_cfgversion": u.KnownCfgversion, + "led_override": u.LedOverride, + "locating": strconv.FormatBool(u.Locating), + "model": u.Model, + "outdoor_mode_override": u.OutdoorModeOverride, + "serial": u.Serial, + "type": u.Type, + "version_incompatible": strconv.FormatBool(u.VersionIncompatible), + "usg_caps": strconv.FormatFloat(u.UsgCaps, 'f', 6, 64), + "speedtest-status-saved": strconv.FormatBool(u.SpeedtestStatusSaved), } fields := map[string]interface{}{ "ip": u.IP, "bytes": u.Bytes, "last_seen": u.LastSeen, "license_state": u.LicenseState, + "fw_caps": u.FwCaps, + "guest-num_sta": u.GuestNumSta, "rx_bytes": u.RxBytes, "tx_bytes": u.TxBytes, "uptime": u.Uptime, @@ -73,53 +72,115 @@ func (u USG) Points() ([]*influx.Point, error) { "speedtest-status_xput_download": u.SpeedtestStatus.XputDownload, "speedtest-status_xput_upload": u.SpeedtestStatus.XputUpload, // have two WANs? mmmm, go ahead and add it. ;) - "wan1_bytes-r": u.Wan1.BytesR, - "wan1_enable": u.Wan1.Enable, - "wan1_full_duplex": u.Wan1.FullDuplex, - "wan1_gateway": u.Wan1.Gateway, - "wan1_ifname": u.Wan1.Ifname, - "wan1_ip": u.Wan1.IP, - "wan1_mac": u.Wan1.Mac, - "wan1_max_speed": u.Wan1.MaxSpeed, - "wan1_name": u.Wan1.Name, - "wan1_netmask": u.Wan1.Netmask, - "wan1_rx_bytes": u.Wan1.RxBytes, - "wan1_rx_bytes-r": u.Wan1.RxBytesR, - "wan1_rx_dropped": u.Wan1.RxDropped, - "wan1_rx_errors": u.Wan1.RxErrors, - "wan1_rx_multicast": u.Wan1.RxMulticast, - "wan1_rx_packets": u.Wan1.RxPackets, - "wan1_type": u.Wan1.Type, - "wan1_speed": u.Wan1.Speed, - "wan1_up": u.Wan1.Up, - "wan1_tx_bytes": u.Wan1.TxBytes, - "wan1_tx_bytes-r": u.Wan1.TxBytesR, - "wan1_tx_dropped": u.Wan1.TxDropped, - "wan1_tx_errors": u.Wan1.TxErrors, - "wan1_tx_packets": u.Wan1.TxPackets, - "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, - "cpu": u.SystemStats.CPU, - "mem": u.SystemStats.Mem, - "system_uptime": u.SystemStats.Uptime, - "stat_duration": u.Stat.Duration, - "stat_datetime": u.Stat.Datetime, - "gw": u.Stat.Gw, - "lan-rx_bytes": u.Stat.LanRxBytes, - "lan-rx_packets": u.Stat.LanRxPackets, - "lan-tx_bytes": u.Stat.LanTxBytes, - "lan-tx_packets": u.Stat.LanTxPackets, - "wan-rx_bytes": u.Stat.WanRxBytes, - "wan-rx_dropped": u.Stat.WanRxDropped, - "wan-rx_packets": u.Stat.WanRxPackets, - "wan-tx_bytes": u.Stat.WanTxBytes, - "wan-tx_packets": u.Stat.WanTxPackets, + "config_network_wan_type": u.ConfigNetworkWan.Type, + "wan1_bytes-r": u.Wan1.BytesR, + "wan1_enable": u.Wan1.Enable, + "wan1_full_duplex": u.Wan1.FullDuplex, + "wan1_purpose": "uplink", // because it should have a purpose. + "wan1_gateway": u.Wan1.Gateway, + "wan1_ifname": u.Wan1.Ifname, + "wan1_ip": u.Wan1.IP, + "wan1_mac": u.Wan1.Mac, + "wan1_max_speed": u.Wan1.MaxSpeed, + "wan1_name": u.Wan1.Name, + "wan1_netmask": u.Wan1.Netmask, + "wan1_rx_bytes": u.Wan1.RxBytes, + "wan1_rx_bytes-r": u.Wan1.RxBytesR, + "wan1_rx_dropped": u.Wan1.RxDropped, + "wan1_rx_errors": u.Wan1.RxErrors, + "wan1_rx_multicast": u.Wan1.RxMulticast, + "wan1_rx_packets": u.Wan1.RxPackets, + "wan1_type": u.Wan1.Type, + "wan1_speed": u.Wan1.Speed, + "wan1_up": u.Wan1.Up, + "wan1_tx_bytes": u.Wan1.TxBytes, + "wan1_tx_bytes-r": u.Wan1.TxBytesR, + "wan1_tx_dropped": u.Wan1.TxDropped, + "wan1_tx_errors": u.Wan1.TxErrors, + "wan1_tx_packets": u.Wan1.TxPackets, + "loadavg_1": u.SysStats.Loadavg1, + "loadavg_5": u.SysStats.Loadavg5, + "loadavg_15": u.SysStats.Loadavg15, + "mem_used": u.SysStats.MemUsed, + "mem_buffer": u.SysStats.MemBuffer, + "mem_total": u.SysStats.MemTotal, + "cpu": u.SystemStats.CPU, + "mem": u.SystemStats.Mem, + "system_uptime": u.SystemStats.Uptime, + "stat_duration": u.Stat.Duration, + "stat_datetime": u.Stat.Datetime, + "gw": u.Stat.Gw, + "false": "false", // to fill holes in graphs. + "lan-rx_bytes": u.Stat.LanRxBytes, + "lan-rx_packets": u.Stat.LanRxPackets, + "lan-tx_bytes": u.Stat.LanTxBytes, + "lan-tx_packets": u.Stat.LanTxPackets, + "wan-rx_bytes": u.Stat.WanRxBytes, + "wan-rx_dropped": u.Stat.WanRxDropped, + "wan-rx_packets": u.Stat.WanRxPackets, + "wan-tx_bytes": u.Stat.WanTxBytes, + "wan-tx_packets": u.Stat.WanTxPackets, + "uplink_name": u.Uplink.Name, + "uplink_latency": u.Uplink.Latency, + "uplink_speed": u.Uplink.Speed, + "uplink_num_ports": u.Uplink.NumPort, + "uplink_max_speed": u.Uplink.MaxSpeed, } pt, err := influx.NewPoint("usg", tags, fields, time.Now()) - if err == nil { + if err != nil { + return nil, err + } + points = append(points, pt) + for _, p := range u.NetworkTable { + tags := map[string]string{ + "device_name": u.Name, + "device_id": u.ID, + "device_mac": u.Mac, + "name": p.Name, + "dhcpd_dns_enabled": strconv.FormatBool(p.DhcpdDNSEnabled), + "dhcpd_enabled": strconv.FormatBool(p.DhcpdEnabled), + "dhcpd_ntp_enabled": strconv.FormatBool(p.DhcpdNtpEnabled), + "dhcpd_time_offset_enabled": strconv.FormatBool(p.DhcpdTimeOffsetEnabled), + "dhcp_relay_enabledy": strconv.FormatBool(p.DhcpRelayEnabled), + "dhcpd_gateway_enabled": strconv.FormatBool(p.DhcpdGatewayEnabled), + "dhcpd_wins_enabled": strconv.FormatBool(p.DhcpdWinsEnabled), + "dhcpguard_enabled": strconv.FormatBool(p.DhcpguardEnabled), + "enabled": strconv.FormatBool(p.Enabled), + "vlan_enabled": strconv.FormatBool(p.VlanEnabled), + "attr_no_delete": strconv.FormatBool(p.AttrNoDelete), + "upnp_lan_enabled": strconv.FormatBool(p.UpnpLanEnabled), + "igmp_snooping": strconv.FormatBool(p.IgmpSnooping), + "is_guest": strconv.FormatBool(p.IsGuest), + "is_nat": strconv.FormatBool(p.IsNat), + "networkgroup": p.Networkgroup, + "site_id": p.SiteID, + } + fields := map[string]interface{}{ + "dhcpd_ip_1": p.DhcpdIP1, + "domain_name": p.DomainName, + "dhcpd_start": p.DhcpdStart, + "dhcpd_stop": p.DhcpdStop, + "ip": p.IP, + "ip_subnet": p.IPSubnet, + "mac": p.Mac, + "name": p.Name, + "num_sta": p.NumSta, + "purpose": p.Purpose, + "rx_bytes": p.RxBytes, + "rx_packets": p.RxPackets, + "tx_bytes": p.TxBytes, + "tx_packets": p.TxPackets, + "up": p.Up, + "vlan": p.Vlan, + "dhcpd_ntp_1": p.DhcpdNtp1, + "dhcpd_unifi_controller": p.DhcpdUnifiController, + "ipv6_interface_type": p.Ipv6InterfaceType, + "attr_hidden_id": p.AttrHiddenID, + } + pt, err = influx.NewPoint("usg_networks", tags, fields, time.Now()) + if err != nil { + return points, err + } points = append(points, pt) } return points, err diff --git a/unidev/usg_type.go b/unidev/usg_type.go index 8d6b4d82..d5a7d15a 100644 --- a/unidev/usg_type.go +++ b/unidev/usg_type.go @@ -79,7 +79,7 @@ type USG struct { DhcpdNtpEnabled bool `json:"dhcpd_ntp_enabled,omitempty"` DhcpdTimeOffsetEnabled bool `json:"dhcpd_time_offset_enabled,omitempty"` DhcpdUnifiController string `json:"dhcpd_unifi_controller,omitempty"` - Ipv6float64erfaceType string `json:"ipv6_float64erface_type,omitempty"` + Ipv6InterfaceType string `json:"ipv6_interface_type,omitempty"` AttrHiddenID string `json:"attr_hidden_id,omitempty"` AttrNoDelete bool `json:"attr_no_delete,omitempty"` UpnpLanEnabled bool `json:"upnp_lan_enabled,omitempty"` @@ -148,17 +148,17 @@ type USG struct { } `json:"stat"` State float64 `json:"state"` SysStats struct { - Loadavg1 string `json:"loadavg_1"` - Loadavg15 string `json:"loadavg_15"` - Loadavg5 string `json:"loadavg_5"` + 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"` } `json:"sys_stats"` SystemStats struct { - CPU string `json:"cpu"` - Mem string `json:"mem"` - Uptime string `json:"uptime"` + CPU float64 `json:"cpu,string"` + Mem float64 `json:"mem,string"` + Uptime float64 `json:"uptime,string"` } `json:"system-stats"` TxBytes float64 `json:"tx_bytes"` Type string `json:"type"` diff --git a/unidev/usw.go b/unidev/usw.go index bbcb1dc1..8211ca2b 100644 --- a/unidev/usw.go +++ b/unidev/usw.go @@ -28,10 +28,7 @@ func (u USW) Points() ([]*influx.Point, error) { "default": strconv.FormatBool(u.Default), "device_id": u.DeviceID, "discovered_via": u.DiscoveredVia, - "fw_caps": strconv.FormatFloat(u.FwCaps, 'f', 6, 64), - "guest-num_sta": strconv.FormatFloat(u.GuestNumSta, 'f', 6, 64), "inform_ip": u.InformIP, - "last_seen": strconv.FormatFloat(u.LastSeen, 'f', 6, 64), "last_uplink_mac": u.LastUplink.UplinkMac, "known_cfgversion": u.KnownCfgversion, "led_override": u.LedOverride, @@ -51,6 +48,8 @@ func (u USW) Points() ([]*influx.Point, error) { "uplink_depth": strconv.FormatFloat(u.UplinkDepth, 'f', 6, 64), } fields := map[string]interface{}{ + "fw_caps": u.FwCaps, + "guest-num_sta": u.GuestNumSta, "ip": u.IP, "bytes": u.Bytes, "fan_level": u.FanLevel, @@ -72,6 +71,7 @@ func (u USW) Points() ([]*influx.Point, error) { "loadavg_5": u.SysStats.Loadavg5, "loadavg_15": u.SysStats.Loadavg15, "mem_buffer": u.SysStats.MemBuffer, + "mem_used": u.SysStats.MemUsed, "mem_total": u.SysStats.MemTotal, "cpu": u.SystemStats.CPU, "mem": u.SystemStats.Mem, diff --git a/unidev/usw_type.go b/unidev/usw_type.go index 5ed47065..0b61ce17 100644 --- a/unidev/usw_type.go +++ b/unidev/usw_type.go @@ -366,17 +366,17 @@ type USW struct { StpPriority string `json:"stp_priority"` StpVersion string `json:"stp_version"` SysStats struct { - Loadavg1 string `json:"loadavg_1"` - Loadavg15 string `json:"loadavg_15"` - Loadavg5 string `json:"loadavg_5"` + 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"` } `json:"sys_stats"` SystemStats struct { - CPU string `json:"cpu"` - Mem string `json:"mem"` - Uptime string `json:"uptime"` + CPU float64 `json:"cpu,string"` + Mem float64 `json:"mem,string"` + Uptime float64 `json:"uptime,string"` } `json:"system-stats"` TxBytes float64 `json:"tx_bytes"` Type string `json:"type"` From 2ab226137d691685d4a7f179c5b1996ae6c47f0b Mon Sep 17 00:00:00 2001 From: DN2 Date: Sun, 29 Apr 2018 01:49:46 -0700 Subject: [PATCH 2/2] Add USG dashboard. --- .../unifi-usg-grafana-dash.json | 3588 +++++++++++++++++ 1 file changed, 3588 insertions(+) create mode 100644 grafana-dashboards/unifi-usg-grafana-dash.json diff --git a/grafana-dashboards/unifi-usg-grafana-dash.json b/grafana-dashboards/unifi-usg-grafana-dash.json new file mode 100644 index 00000000..f43847b9 --- /dev/null +++ b/grafana-dashboards/unifi-usg-grafana-dash.json @@ -0,0 +1,3588 @@ +{ + "__inputs": [ + { + "name": "DS_UNIFI", + "label": "Unifi", + "description": "", + "type": "datasource", + "pluginId": "influxdb", + "pluginName": "InfluxDB" + } + ], + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "5.0.4" + }, + { + "type": "panel", + "id": "grafana-clock-panel", + "name": "Clock", + "version": "0.0.9" + }, + { + "type": "panel", + "id": "graph", + "name": "Graph", + "version": "5.0.0" + }, + { + "type": "datasource", + "id": "influxdb", + "name": "InfluxDB", + "version": "5.0.0" + }, + { + "type": "panel", + "id": "singlestat", + "name": "Singlestat", + "version": "5.0.0" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "5.0.0" + }, + { + "type": "panel", + "id": "text", + "name": "Text", + "version": "5.0.0" + } + ], + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "", + "editable": true, + "gnetId": 1486, + "graphTooltip": 1, + "id": null, + "iteration": 1524993362759, + "links": [], + "panels": [ + { + "content": "
\n
Unifi USG
\n", + "gridPos": { + "h": 4, + "w": 3, + "x": 0, + "y": 0 + }, + "id": 34, + "links": [], + "mode": "html", + "title": "", + "transparent": true, + "type": "text" + }, + { + "columns": [], + "datasource": "${DS_UNIFI}", + "editable": true, + "error": false, + "fontSize": "100%", + "gridPos": { + "h": 4, + "w": 21, + "x": 3, + "y": 0 + }, + "id": 1, + "isNew": true, + "links": [], + "pageSize": null, + "scroll": false, + "showHeader": true, + "sort": { + "col": 11, + "desc": true + }, + "styles": [ + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "Time", + "thresholds": [], + "type": "hidden", + "unit": "short" + }, + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "Uptime", + "thresholds": [], + "type": "number", + "unit": "dtdurations" + }, + { + "alias": "Name", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "link": false, + "linkTargetBlank": true, + "linkUrl": "http:", + "pattern": "name", + "preserveFormat": false, + "sanitize": false, + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "Config Version", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "cfgversion", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "Model", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "model", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "Device MAC", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "mac", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "Unifi Serial #", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "serial", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "Site ID", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "site_id", + "thresholds": [], + "type": "hidden", + "unit": "short" + }, + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "Version", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 1, + "pattern": "Last Seen", + "sanitize": true, + "thresholds": [], + "type": "number", + "unit": "dateTimeAsUS" + }, + { + "alias": "", + "colorMode": "value", + "colors": [ + "rgba(50, 172, 45, 0.97)", + "rgba(237, 129, 40, 0.89)", + "rgba(245, 54, 54, 0.9)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 1, + "pattern": "CPU", + "thresholds": [ + "60", + "80" + ], + "type": "number", + "unit": "percent" + }, + { + "alias": "LAN IP", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "connect_request_ip", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "", + "colorMode": "value", + "colors": [ + "rgba(50, 172, 45, 0.97)", + "rgba(237, 129, 40, 0.89)", + "rgba(245, 54, 54, 0.9)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 1, + "pattern": "Memory", + "thresholds": [ + "50", + "80" + ], + "type": "number", + "unit": "percent" + }, + { + "alias": "", + "colorMode": "value", + "colors": [ + "#890f02", + "#890f02", + "rgb(35, 143, 0)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 0, + "pattern": "Upgradable", + "thresholds": [ + "0", + "0" + ], + "type": "number", + "unit": "short" + } + ], + "targets": [ + { + "alias": "$col", + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "model" + ], + "type": "tag" + }, + { + "params": [ + "cfgversion" + ], + "type": "tag" + }, + { + "params": [ + "connect_request_ip" + ], + "type": "tag" + }, + { + "params": [ + "serial" + ], + "type": "tag" + }, + { + "params": [ + "site_id" + ], + "type": "tag" + }, + { + "params": [ + "mac" + ], + "type": "tag" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "version" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "Version" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "ip" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "WAN IP" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "uptime" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "Uptime" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "last_seen" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "*1000" + ], + "type": "math" + }, + { + "params": [ + "Last Seen" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "cpu" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "CPU" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "mem" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "Memory" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "upgradable" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "Upgradable" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "timeFrom": null, + "title": "USG Details", + "transform": "table", + "transparent": true, + "type": "table" + }, + { + "cacheTimeout": null, + "colorBackground": true, + "colorValue": false, + "colors": [ + "#511749", + "#3f2b5b", + "#511749" + ], + "datasource": "${DS_UNIFI}", + "decimals": 3, + "format": "dtdurations", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 0, + "y": 4 + }, + "id": 29, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "20%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "system_uptime", + "targets": [ + { + "groupBy": [ + { + "params": [ + "name" + ], + "type": "tag" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "uptime" + ], + "type": "field" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": "", + "title": "System Uptime", + "type": "singlestat", + "valueFontSize": "30%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": true, + "colors": [ + "#299c46", + "rgba(237, 129, 40, 0.89)", + "#d44a3a" + ], + "datasource": "${DS_UNIFI}", + "decimals": 0, + "format": "none", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": true, + "thresholdMarkers": true + }, + "gridPos": { + "h": 2, + "w": 1, + "x": 3, + "y": 4 + }, + "hideTimeOverride": true, + "id": 39, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": true + }, + "tableColumn": "system_uptime", + "targets": [ + { + "groupBy": [ + { + "params": [ + "name" + ], + "type": "tag" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "guest-num_sta" + ], + "type": "field" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": "", + "timeFrom": "1h", + "title": "Guests", + "transparent": true, + "type": "singlestat", + "valueFontSize": "70%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "#299c46", + "rgba(237, 129, 40, 0.89)", + "#d44a3a" + ], + "datasource": "${DS_UNIFI}", + "decimals": 1, + "description": "", + "format": "ms", + "gauge": { + "maxValue": 100, + "minValue": 10, + "show": true, + "thresholdLabels": true, + "thresholdMarkers": true + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 4, + "y": 4 + }, + "hideTimeOverride": false, + "id": 45, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "#3f2b5b", + "full": true, + "lineColor": "#dedaf7", + "show": true + }, + "tableColumn": "system_uptime", + "targets": [ + { + "groupBy": [ + { + "params": [ + "name" + ], + "type": "tag" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "uplink_latency" + ], + "type": "field" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": "40,60", + "timeFrom": null, + "title": "Uplink Latency", + "transparent": true, + "type": "singlestat", + "valueFontSize": "70%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "#d44a3a", + "rgba(237, 129, 40, 0.89)", + "#299c46" + ], + "datasource": "${DS_UNIFI}", + "decimals": 1, + "description": "", + "format": "Mbits", + "gauge": { + "maxValue": 50, + "minValue": 0, + "show": true, + "thresholdLabels": true, + "thresholdMarkers": true + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 8, + "y": 4 + }, + "hideTimeOverride": false, + "id": 44, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "#3f2b5b", + "full": false, + "lineColor": "#dedaf7", + "show": false + }, + "tableColumn": "system_uptime", + "targets": [ + { + "groupBy": [ + { + "params": [ + "name" + ], + "type": "tag" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "speedtest-status_xput_upload" + ], + "type": "field" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": "10,20", + "timeFrom": null, + "title": "Upload Test", + "transparent": true, + "type": "singlestat", + "valueFontSize": "50%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "#d44a3a", + "rgba(237, 129, 40, 0.89)", + "#299c46" + ], + "datasource": "${DS_UNIFI}", + "decimals": 1, + "description": "", + "format": "Mbits", + "gauge": { + "maxValue": 1000, + "minValue": 0, + "show": true, + "thresholdLabels": true, + "thresholdMarkers": true + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 12, + "y": 4 + }, + "hideTimeOverride": false, + "id": 41, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "#3f2b5b", + "full": false, + "lineColor": "#dedaf7", + "show": false + }, + "tableColumn": "system_uptime", + "targets": [ + { + "groupBy": [ + { + "params": [ + "name" + ], + "type": "tag" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "speedtest-status_xput_download" + ], + "type": "field" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": "200,400", + "timeFrom": null, + "title": "Download Test", + "transparent": true, + "type": "singlestat", + "valueFontSize": "50%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "#299c46", + "rgba(237, 129, 40, 0.89)", + "#d44a3a" + ], + "datasource": "${DS_UNIFI}", + "decimals": 1, + "format": "percent", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": true, + "thresholdLabels": true, + "thresholdMarkers": true + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 16, + "y": 4 + }, + "hideTimeOverride": false, + "id": 37, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "#3f2b5b", + "full": true, + "lineColor": "#806eb7", + "show": true + }, + "tableColumn": "system_uptime", + "targets": [ + { + "groupBy": [ + { + "params": [ + "name" + ], + "type": "tag" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "cpu" + ], + "type": "field" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": "60,80", + "timeFrom": null, + "title": "CPU Usage", + "transparent": true, + "type": "singlestat", + "valueFontSize": "70%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "#299c46", + "rgba(237, 129, 40, 0.89)", + "#d44a3a" + ], + "datasource": "${DS_UNIFI}", + "decimals": 1, + "description": "", + "format": "percent", + "gauge": { + "minValue": null, + "show": true, + "thresholdLabels": true, + "thresholdMarkers": true + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 20, + "y": 4 + }, + "hideTimeOverride": false, + "id": 30, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "#3f2b5b", + "full": true, + "lineColor": "#dedaf7", + "show": true + }, + "tableColumn": "system_uptime", + "targets": [ + { + "groupBy": [ + { + "params": [ + "name" + ], + "type": "tag" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "mem" + ], + "type": "field" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": "50,80", + "timeFrom": null, + "title": "Memory Usage", + "transparent": true, + "type": "singlestat", + "valueFontSize": "70%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": true, + "colors": [ + "#299c46", + "rgba(237, 129, 40, 0.89)", + "#d44a3a" + ], + "datasource": "${DS_UNIFI}", + "decimals": 0, + "format": "none", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": true, + "thresholdMarkers": true + }, + "gridPos": { + "h": 2, + "w": 1, + "x": 3, + "y": 6 + }, + "hideTimeOverride": true, + "id": 38, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": true + }, + "tableColumn": "system_uptime", + "targets": [ + { + "groupBy": [ + { + "params": [ + "name" + ], + "type": "tag" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "user-num_sta" + ], + "type": "field" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": "", + "timeFrom": "1h", + "title": "Users", + "transparent": true, + "type": "singlestat", + "valueFontSize": "70%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "bgColor": "#3f2b5b", + "clockType": "12 hour", + "countdownSettings": { + "endCountdownTime": "2018-04-29T21:47:00.000Z", + "endText": "00:00:00" + }, + "dateSettings": { + "dateFormat": "YYYY-MM-DD", + "fontSize": "12px", + "fontWeight": "bold", + "showDate": true + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 0, + "y": 7 + }, + "id": 32, + "links": [], + "mode": "time", + "offsetFromUtc": null, + "offsetFromUtcMinutes": null, + "timeSettings": { + "customFormat": "HH:mm:ss", + "fontSize": "24px", + "fontWeight": "normal" + }, + "title": "Now", + "type": "grafana-clock-panel" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": true, + "colors": [ + "#299c46", + "rgba(237, 129, 40, 0.89)", + "#d44a3a" + ], + "datasource": "${DS_UNIFI}", + "decimals": 0, + "format": "none", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": true, + "thresholdMarkers": true + }, + "gridPos": { + "h": 2, + "w": 1, + "x": 3, + "y": 8 + }, + "hideTimeOverride": true, + "id": 46, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "M", + "postfixFontSize": "30%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "system_uptime", + "targets": [ + { + "groupBy": [ + { + "params": [ + "name" + ], + "type": "tag" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "uplink_speed" + ], + "type": "field" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": "", + "timeFrom": "1h", + "title": "Speed", + "transparent": true, + "type": "singlestat", + "valueFontSize": "30%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_UNIFI}", + "decimals": 2, + "description": "", + "editable": true, + "error": false, + "fill": 2, + "gridPos": { + "h": 7, + "w": 9, + "x": 0, + "y": 10 + }, + "id": 47, + "isNew": true, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 3, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/In$/", + "color": "#806eb7" + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "$tag_name:$col", + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "30s" + ], + "type": "time" + }, + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "wan1_rx_multicast" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "1s" + ], + "type": "derivative" + }, + { + "params": [ + "Multicast:In" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "WAN Multicast", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "transparent": false, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": 2, + "format": "pps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ] + }, + { + "columns": [], + "datasource": "${DS_UNIFI}", + "fontSize": "90%", + "gridPos": { + "h": 7, + "w": 15, + "x": 9, + "y": 10 + }, + "id": 43, + "links": [], + "pageSize": null, + "scroll": true, + "showHeader": true, + "sort": { + "col": 0, + "desc": true + }, + "styles": [ + { + "alias": "Time", + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "pattern": "Time", + "type": "hidden" + }, + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "device_name", + "thresholds": [], + "type": "hidden", + "unit": "short" + }, + { + "alias": "MAC", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "device_mac", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "On", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "enabled", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "IGMP", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "igmp_snooping", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "Guest", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "is_guest", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "Nat", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "is_nat", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "Network Name", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "name", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "Group", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "networkgroup", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "UPNP", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "upnp_lan_enabled", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "Domain", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "IP", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "Subnet", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 0, + "pattern": "Clients", + "thresholds": [], + "type": "number", + "unit": "none" + }, + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 0, + "pattern": "VLAN", + "thresholds": [], + "type": "number", + "unit": "none" + }, + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "Purpose", + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "dhcpd_enabled", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "config_network_type", + "preserveFormat": false, + "thresholds": [], + "type": "string", + "unit": "short" + }, + { + "alias": "DHCPD", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "pattern": "dhcpd_enabled", + "thresholds": [], + "type": "string", + "unit": "short" + } + ], + "targets": [ + { + "alias": "$tag_device_name $col", + "groupBy": [ + { + "params": [ + "device_name" + ], + "type": "tag" + }, + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "device_mac" + ], + "type": "tag" + }, + { + "params": [ + "dhcpd_enabled" + ], + "type": "tag" + }, + { + "params": [ + "enabled" + ], + "type": "tag" + }, + { + "params": [ + "is_nat" + ], + "type": "tag" + }, + { + "params": [ + "networkgroup" + ], + "type": "tag" + }, + { + "params": [ + "upnp_lan_enabled" + ], + "type": "tag" + }, + { + "params": [ + "igmp_snooping" + ], + "type": "tag" + }, + { + "params": [ + "is_guest" + ], + "type": "tag" + } + ], + "measurement": "usg_networks", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "domain_name" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "Domain" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "ip" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "IP" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "ip_subnet" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "Subnet" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "num_sta" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "Clients" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "vlan" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "VLAN" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "purpose" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "Purpose" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "device_name", + "operator": "=~", + "value": "/^$host$/" + } + ] + }, + { + "groupBy": [], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "wan1_enable" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "enabled" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "wan1_ip" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "IP" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "wan1_netmask" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "Subnet" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "user-num_sta" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "Clients" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "wan1_gateway" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "Domain" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "wan1_mac" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "device_mac" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "wan1_name" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "name" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "wan1_name" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "networkgroup" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "false" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "igmp_snooping" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "false" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "upnp_lan_enabled" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "false" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "is_nat" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "false" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "is_guest" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "config_network_wan_type" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "dhcpd_enabled" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "wan1_purpose" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "Purpose" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "title": "Networks", + "transform": "table", + "transparent": false, + "type": "table" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_UNIFI}", + "description": "Spikes on this graph that are missing from the LAN graph indicate gateway-originated traffic, like a scheduled speed test.", + "editable": true, + "error": false, + "fill": 1, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 17 + }, + "id": 3, + "isNew": true, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": true, + "show": true, + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 3, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/Rx$/", + "color": "#7eb26d", + "transform": "negative-Y" + }, + { + "alias": "/Tx$/", + "color": "#052b51" + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "$tag_name $col", + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "30s" + ], + "type": "time" + }, + { + "params": [ + "name" + ], + "type": "tag" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "wan-rx_bytes" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "1s" + ], + "type": "derivative" + }, + { + "params": [ + "Rx" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "wan-tx_bytes" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "1s" + ], + "type": "derivative" + }, + { + "params": [ + "Tx" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "WAN Throughput", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "transparent": true, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_UNIFI}", + "description": "Spikes on this graph that do not appear on the WAN graph indicate inter-VLAN-routing.", + "editable": true, + "error": false, + "fill": 1, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 17 + }, + "id": 35, + "isNew": true, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": true, + "show": true, + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 3, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/Rx$/", + "color": "#584477", + "transform": "negative-Y" + }, + { + "alias": "/Tx$/", + "color": "#ba43a9" + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "$tag_name $col", + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "30s" + ], + "type": "time" + }, + { + "params": [ + "name" + ], + "type": "tag" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "lan-rx_bytes" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "1s" + ], + "type": "derivative" + }, + { + "params": [ + "Rx" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "lan-tx_bytes" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "1s" + ], + "type": "derivative" + }, + { + "params": [ + "Tx" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "LAN Throughput", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "transparent": true, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_UNIFI}", + "decimals": 2, + "description": "May show problems with your WAN interface.", + "editable": true, + "error": false, + "fill": 2, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 26 + }, + "id": 26, + "isNew": true, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "sort": null, + "sortDesc": null, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/:In$/", + "color": "#890f02", + "transform": "negative-Y" + }, + { + "alias": "/Out$/", + "color": "#ea6460" + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "$tag_name:$col", + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "30s" + ], + "type": "time" + }, + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "wan1_rx_errors" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "1s" + ], + "type": "derivative" + }, + { + "params": [ + "Error:In" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "wan1_tx_errors" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "1s" + ], + "type": "derivative" + }, + { + "params": [ + "Error:Out" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "WAN Errors", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "transparent": false, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": 1, + "format": "pps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_UNIFI}", + "decimals": 2, + "description": "May show problems with your WAN interface.", + "editable": true, + "error": false, + "fill": 2, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 26 + }, + "id": 48, + "isNew": true, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "sort": null, + "sortDesc": null, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/:In$/", + "color": "#890f02", + "transform": "negative-Y" + }, + { + "alias": "/Out$/", + "color": "#ea6460" + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "$tag_name:$col", + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "30s" + ], + "type": "time" + }, + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "wan1_rx_dropped" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "1s" + ], + "type": "derivative" + }, + { + "params": [ + "Drop:In" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "wan1_tx_dropped" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "1s" + ], + "type": "derivative" + }, + { + "params": [ + "Drop:Out" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "WAN Drops", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "transparent": false, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": 1, + "format": "pps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_UNIFI}", + "decimals": 0, + "description": "PPS on the WAN interface, calculated in 30 second buckets.", + "editable": true, + "error": false, + "fill": 1, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 33 + }, + "id": 36, + "isNew": true, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "sort": "max", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 3, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/:In$/", + "color": "#f9d9f9", + "transform": "negative-Y" + }, + { + "alias": "/Out$/", + "color": "#0a437c" + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "$tag_name:$col", + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "30s" + ], + "type": "time" + }, + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "wan-rx_packets" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "1s" + ], + "type": "derivative" + }, + { + "params": [ + "In" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "wan-tx_packets" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "1s" + ], + "type": "derivative" + }, + { + "params": [ + "Out" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "WAN Packets", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "transparent": true, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": 1, + "format": "pps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "pps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_UNIFI}", + "decimals": 0, + "description": "PPS on the LAN interface, calculated in 30 second buckets.", + "editable": true, + "error": false, + "fill": 1, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 33 + }, + "id": 25, + "isNew": true, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "sort": "max", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 3, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/:In$/", + "color": "#2f575e", + "transform": "negative-Y" + }, + { + "alias": "/Out$/", + "color": "#806eb7" + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "$tag_name:$col", + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "30s" + ], + "type": "time" + }, + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "usg", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "lan-rx_packets" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "1s" + ], + "type": "derivative" + }, + { + "params": [ + "In" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "lan-tx_packets" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "1s" + ], + "type": "derivative" + }, + { + "params": [ + "Out" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^$host$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "LAN Packets", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "transparent": true, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": 1, + "format": "pps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "pps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ] + } + ], + "refresh": "30s", + "schemaVersion": 16, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "allValue": null, + "current": {}, + "datasource": "${DS_UNIFI}", + "hide": 0, + "includeAll": true, + "label": "UniFi USG:", + "multi": true, + "name": "host", + "options": [], + "query": "show tag values from \"usg\" with key=\"name\"", + "refresh": 1, + "regex": "", + "sort": 0, + "tagValuesQuery": null, + "tags": [], + "tagsQuery": null, + "type": "query", + "useTags": false + } + ] + }, + "time": { + "from": "now-2h", + "to": "now-5s" + }, + "timepicker": { + "nowDelay": "5s", + "refresh_intervals": [ + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "browser", + "title": "UniFi USG Insights", + "uid": "WX6RJOMik", + "version": 1 +}