Log error in la.go if unable to open file
This commit is contained in:
@@ -2,6 +2,7 @@ package lib
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/shirou/gopsutil/load"
|
"github.com/shirou/gopsutil/load"
|
||||||
@@ -22,7 +23,13 @@ func (c *MyConfig) UpdateLaStats() {
|
|||||||
ticker.Reset(Delay)
|
ticker.Reset(Delay)
|
||||||
}
|
}
|
||||||
|
|
||||||
l, _ := load.Avg()
|
l, err := load.Avg()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Unable to get LA stats: %s", err)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
lav := fmt.Sprintf("%.2f", l.Load1)
|
lav := fmt.Sprintf("%.2f", l.Load1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user