提交 fbb11de1 编写于 作者: 7 710leo

Fix parse port collect file

上级 b1924602
......@@ -3,6 +3,7 @@ package stra
import (
"fmt"
"os"
"path/filepath"
"strconv"
"strings"
"time"
......@@ -51,13 +52,15 @@ func GetPortCollects() map[int]*model.PortCollect {
continue
}
service, err := file.ToTrimString(StraConfig.PortPath + "/" + f)
filePath := filepath.Join(portPath, f)
service, err := file.ToTrimString(filePath)
if err != nil {
logger.Warning(err)
continue
}
info, err := os.Stat(f)
info, err := os.Stat(filePath)
if err != nil {
logger.Warning(err)
continue
......
......@@ -3,6 +3,7 @@ package stra
import (
"fmt"
"os"
"path/filepath"
"strconv"
"strings"
"time"
......@@ -37,7 +38,8 @@ func GetProcCollects() map[string]*model.ProcCollect {
}
}
files, err := file.FilesUnder(StraConfig.ProcPath)
procPath := StraConfig.ProcPath
files, err := file.FilesUnder(procPath)
if err != nil {
logger.Error(err)
return procs
......@@ -51,13 +53,14 @@ func GetProcCollects() map[string]*model.ProcCollect {
continue
}
service, err := file.ToTrimString(StraConfig.ProcPath + "/" + f)
filePath := filepath.Join(procPath, f)
service, err := file.ToTrimString(filePath)
if err != nil {
logger.Warning(err)
continue
}
info, err := os.Stat(f)
info, err := os.Stat(filePath)
if err != nil {
logger.Warning(err)
continue
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册