[release] v0.12.0-unstable4
This commit is contained in:
parent
6aa8a9e5fa
commit
8a547e1b9c
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cosmos-server",
|
||||
"version": "0.12.0-unstable3",
|
||||
"version": "0.12.0-unstable4",
|
||||
"description": "",
|
||||
"main": "test-server.js",
|
||||
"bugs": {
|
||||
|
|
|
@ -2,7 +2,9 @@ package metrics
|
|||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"os"
|
||||
|
||||
"github.com/shirou/gopsutil/cpu"
|
||||
"github.com/shirou/gopsutil/mem"
|
||||
|
@ -122,9 +124,16 @@ func GetSystemMetrics() {
|
|||
}
|
||||
|
||||
for _, part := range parts {
|
||||
u, err := disk.Usage(part.Mountpoint)
|
||||
if strings.HasPrefix(part.Mountpoint, "/dev") || strings.HasPrefix(part.Mountpoint, "/mnt") {
|
||||
realMount := part.Mountpoint
|
||||
|
||||
if os.Getenv("HOSTANME") != "" {
|
||||
realMount = "/mnt/host" + part.Mountpoint
|
||||
}
|
||||
|
||||
u, err := disk.Usage(realMount)
|
||||
if err != nil {
|
||||
utils.Error("Metrics - Error fetching Disk usage for " + part.Mountpoint + " : ", err)
|
||||
utils.Error("Metrics - Error fetching Disk usage for " + realMount + " : ", err)
|
||||
} else {
|
||||
PushSetMetric("system.disk." + part.Mountpoint, int(u.Used), DataDef{
|
||||
Max: u.Total,
|
||||
|
@ -134,3 +143,4 @@ func GetSystemMetrics() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue