mirror of
https://github.com/unpoller/unpoller.git
synced 2026-10-18 22:40:03 +02:00
Add nil checks
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user