Compare commits

..

No commits in common. "master" and "v1.4.0" 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
} }