guard against NaN

This commit is contained in:
Alex Dadgar
2016-06-20 10:29:46 -07:00
parent 670af92d7b
commit 0b3a39b47f

View File

@@ -1,6 +1,7 @@
package stats
import (
"math"
"runtime"
"time"
@@ -117,6 +118,12 @@ func (h *HostStatsCollector) Collect() (*HostStats, error) {
UsedPercent: usage.UsedPercent,
InodesUsedPercent: usage.InodesUsedPercent,
}
if math.IsNaN(ds.UsedPercent) {
ds.UsedPercent = 0.0
}
if math.IsNaN(ds.InodesUsedPercent) {
ds.InodesUsedPercent = 0.0
}
diskStats = append(diskStats, &ds)
}
}