add rogueap
This commit is contained in:
parent
c5202d2b3b
commit
ad52081f9a
|
|
@ -4,8 +4,8 @@ go 1.15
|
|||
|
||||
require (
|
||||
github.com/influxdata/influxdb1-client v0.0.0-20200515024757-02f0bf5dbca3
|
||||
github.com/unifi-poller/poller v0.0.8
|
||||
github.com/unifi-poller/poller v0.0.0-20210315011940-c43dc3c221b4
|
||||
github.com/unifi-poller/unifi v0.0.7-0.20210315051727-4c317f9a2b95
|
||||
github.com/unifi-poller/webserver v0.0.0-20200628212441-340749c94743
|
||||
github.com/unifi-poller/webserver v0.0.0-20210315055414-fa42b37295b7
|
||||
golift.io/cnfg v0.0.7
|
||||
)
|
||||
|
|
|
|||
|
|
@ -231,6 +231,10 @@ func (u *InfluxUnifi) collect(r report, ch chan *metric) {
|
|||
func (u *InfluxUnifi) loopPoints(r report) {
|
||||
m := r.metrics()
|
||||
|
||||
for _, s := range m.RogueAPs {
|
||||
u.switchExport(r, s)
|
||||
}
|
||||
|
||||
for _, s := range m.Sites {
|
||||
u.switchExport(r, s)
|
||||
}
|
||||
|
|
@ -263,6 +267,8 @@ func (u *InfluxUnifi) loopPoints(r report) {
|
|||
|
||||
func (u *InfluxUnifi) switchExport(r report, v interface{}) { //nolint:cyclop
|
||||
switch v := v.(type) {
|
||||
case *unifi.RogueAP:
|
||||
u.batchRogueAP(r, v)
|
||||
case *unifi.UAP:
|
||||
u.batchUAP(r, v)
|
||||
case *unifi.USW:
|
||||
|
|
|
|||
|
|
@ -7,6 +7,33 @@ import (
|
|||
// uapT is used as a name for printed/logged counters.
|
||||
const uapT = item("UAP")
|
||||
|
||||
// batchRogueAP generates metric points for neighboring access points.
|
||||
func (u *InfluxUnifi) batchRogueAP(r report, s *unifi.RogueAP) {
|
||||
r.send(&metric{
|
||||
Table: "rogue_ap",
|
||||
Tags: map[string]string{
|
||||
"mac": s.ApMac,
|
||||
"site_name": s.SiteName,
|
||||
"source": s.SourceName,
|
||||
"name": s.Essid,
|
||||
"security": s.Security,
|
||||
"oui": s.Oui,
|
||||
"band": s.Band,
|
||||
},
|
||||
Fields: map[string]interface{}{
|
||||
"age": s.Age,
|
||||
"bw": s.Bw.Val,
|
||||
"center_freq": s.CenterFreq.Val,
|
||||
"channel": s.Channel,
|
||||
"freq": s.Freq.Val,
|
||||
"noise": s.Noise.Val,
|
||||
"rssi": s.Rssi.Val,
|
||||
"rssi_age": s.RssiAge.Val,
|
||||
"signal": s.Signal.Val,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// batchUAP generates Wireless-Access-Point datapoints for InfluxDB.
|
||||
// These points can be passed directly to influx.
|
||||
func (u *InfluxUnifi) batchUAP(r report, s *unifi.UAP) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue