Add nil checks
This commit is contained in:
parent
61bf7ae31f
commit
8867de3707
|
|
@ -10,6 +10,9 @@ import (
|
|||
// UAPPoints generates Wireless-Access-Point datapoints for InfluxDB.
|
||||
// These points can be passed directly to influx.
|
||||
func UAPPoints(u *unifi.UAP, now time.Time) ([]*influx.Point, error) {
|
||||
if u.Stat.Ap == nil {
|
||||
u.Stat.Ap = &unifi.Ap{}
|
||||
}
|
||||
tags := map[string]string{
|
||||
"id": u.ID,
|
||||
"mac": u.Mac,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,12 @@ import (
|
|||
// UDMPoints generates Unifi Gateway datapoints for InfluxDB.
|
||||
// These points can be passed directly to influx.
|
||||
func UDMPoints(u *unifi.UDM, now time.Time) ([]*influx.Point, error) {
|
||||
if u.Stat.Sw == nil {
|
||||
u.Stat.Sw = &unifi.Sw{}
|
||||
}
|
||||
if u.Stat.Gw == nil {
|
||||
u.Stat.Gw = &unifi.Gw{}
|
||||
}
|
||||
tags := map[string]string{
|
||||
"id": u.ID,
|
||||
"mac": u.Mac,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ import (
|
|||
// USGPoints generates Unifi Gateway datapoints for InfluxDB.
|
||||
// These points can be passed directly to influx.
|
||||
func USGPoints(u *unifi.USG, now time.Time) ([]*influx.Point, error) {
|
||||
if u.Stat.Gw == nil {
|
||||
u.Stat.Gw = &unifi.Gw{}
|
||||
}
|
||||
tags := map[string]string{
|
||||
"id": u.ID,
|
||||
"mac": u.Mac,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ import (
|
|||
// USWPoints generates Unifi Switch datapoints for InfluxDB.
|
||||
// These points can be passed directly to influx.
|
||||
func USWPoints(u *unifi.USW, now time.Time) ([]*influx.Point, error) {
|
||||
if u.Stat.Sw == nil {
|
||||
u.Stat.Sw = &unifi.Sw{}
|
||||
}
|
||||
tags := map[string]string{
|
||||
"id": u.ID,
|
||||
"mac": u.Mac,
|
||||
|
|
|
|||
Loading…
Reference in New Issue