Compare commits

..

No commits in common. "631a5e398f52d06acfe399e166bf9901075d1ec2" and "6f4fc7681285b361f4b36bb552c0c81926b24f1e" have entirely different histories.

View File

@ -133,41 +133,39 @@ func processUnifiAPI(s int) ([]node, []link, error) {
// INFLUX STOP // INFLUX STOP
//log.Println(currentDevice.Mac) //log.Println(currentDevice.Mac)
if currentDevice.Mac != "" { nodes = append(nodes, node{
nodes = append(nodes, node{ Firstseen: "0",
Firstseen: "0", Lastseen: time.Unix(int64(currentDevice.LastSeen), 0).Format(iso8601),
Lastseen: time.Unix(int64(currentDevice.LastSeen), 0).Format(iso8601), IsOnline: itob(currentDevice.State),
IsOnline: itob(currentDevice.State), IsGateway: false,
IsGateway: false, Clients: clients,
Clients: clients, ClientsWifi24: 0,
ClientsWifi24: 0, ClientsWifi5: 0,
ClientsWifi5: 0, ClientsOther: clients,
ClientsOther: clients, RootFSUsage: 0,
RootFSUsage: 0, LoadAVG: load / 100,
LoadAVG: load / 100, MemoryUsage: mem / 100,
MemoryUsage: mem / 100, Uptime: time.Now().Add(-1 * time.Second * time.Duration(currentDevice.Uptime)).Format(iso8601),
Uptime: time.Now().Add(-1 * time.Second * time.Duration(currentDevice.Uptime)).Format(iso8601), GatewayNexthop: currentJSONDevice.GatewayNexthop,
GatewayNexthop: currentJSONDevice.GatewayNexthop, Gateway: currentJSONDevice.Gateway,
Gateway: currentJSONDevice.Gateway, Location: &currentJSONDevice.Location,
Location: &currentJSONDevice.Location, NodeID: strings.ReplaceAll(currentDevice.Mac, ":", ""),
NodeID: strings.ReplaceAll(currentDevice.Mac, ":", ""), MAC: currentDevice.Mac,
MAC: currentDevice.Mac, Adresses: []string{currentDevice.IP},
Adresses: []string{currentDevice.IP}, Domain: currentJSONDevice.Domain,
Domain: currentJSONDevice.Domain, Hostname: "[Unifi] " + currentDevice.Name,
Hostname: "[Unifi] " + currentDevice.Name, Owner: "Freifunk Rhein-Sieg",
Owner: "Freifunk Rhein-Sieg", Firmware: firmware{
Firmware: firmware{ Base: "Ubiquiti - Stock",
Base: "Ubiquiti - Stock", Release: currentDevice.Version,
Release: currentDevice.Version, },
}, Autoupdater: autoupdater{
Autoupdater: autoupdater{ Enabled: false,
Enabled: false, Branch: "stable",
Branch: "stable", },
}, NProc: 1,
NProc: 1, Model: model,
Model: model, })
})
}
} }
return nodes, links, err return nodes, links, err
} }