Bugfixing error on empty Load or Memory
This commit is contained in:
parent
3f0d6fc3d4
commit
abc9e01d3a
10
main.go
10
main.go
@ -26,7 +26,7 @@ const (
|
||||
// flags
|
||||
var configPath = flag.String("configPath", "config.json", "Path to config.json")
|
||||
var version = "development"
|
||||
var delay time.Duration = 60 * time.Second
|
||||
var delay time.Duration = 5 * time.Second
|
||||
var conf = loadconfig(*configPath)
|
||||
var ucDev = getDevices(conf.Unifi.UCDevicesURL)
|
||||
|
||||
@ -100,14 +100,16 @@ func processUcAPIs() ([]node, []link) {
|
||||
if isRemoteMACpublished(jsonDevice.MAC, d.Devices) == true {
|
||||
links = ucAddLink(jsonDevice, links)
|
||||
}
|
||||
|
||||
load, err := strconv.ParseFloat(currentDevice.Sysstats.CPU, 64)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
fmt.Println("Error: ", currentDevice.Name)
|
||||
//log.Fatalln(err)
|
||||
load = 0
|
||||
}
|
||||
mem, err := strconv.ParseFloat(currentDevice.Sysstats.Memory, 64)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
//log.Fatalln(err)
|
||||
load = 0
|
||||
}
|
||||
var model = lookupModels(currentDevice.Model)
|
||||
var clients = currentDevice.Users
|
||||
|
Loading…
Reference in New Issue
Block a user