不统计k8s的虚拟挂载点方案临时解决

pull/92/head
CHN-STUDENT 2021-01-19 16:48:22 +08:00
parent c659ea5894
commit 353996ef14
2 changed files with 7 additions and 3 deletions

View File

@ -458,7 +458,7 @@ func main() {
//fmt.Println(time.Now().Format("2006-01-02 15:04:05")," [main]Error transforming client info: ", err)
break
}
logger.Info("\nInfo:\n"+data+"\n")
//logger.Info("\nInfo:\n"+data+"\n")
info := "update " + data + "\n"
_ , err = mainConnect.Write(str2bytes(info))
if err != nil {

View File

@ -187,8 +187,12 @@ func spaceCount() {
continue
} else {
diskUsageOf, _ := disk.Usage(d.Mountpoint)
used += diskUsageOf.Used
total += diskUsageOf.Total
path := diskUsageOf.Path
//不统计K8s的虚拟挂载点see herehttps://github.com/shirou/gopsutil/issues/1007
if !strings.Contains(path,"/var/lib/kubelet") {
used += diskUsageOf.Used
total += diskUsageOf.Total
}
}
}
}