Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ biuld方法:
Contributors
------------------------------------------
- mengzhuo: QQ:296142139; MAIL:mengzhuo@xiaomi.com
- hangyuzhang: MAIL:hangyuzhang@meilishuo.com
23 changes: 3 additions & 20 deletions getDatas.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,9 @@ func getContainerId(cadvisorData string) string {
}

func getEndPoint(DockerData string) string {
filepath := getBetween(DockerData, `"HostsPath":"`, `",`)
buf := make(map[int]string, 6)
inputFile, inputError := os.Open(filepath)
if inputError != nil {
LogErr(inputError, "getEndPoint open file err"+filepath)
return ""
}
defer inputFile.Close()

inputReader := bufio.NewReader(inputFile)
lineCounter := 0
for i := 0; i < 2; i++ {
inputString, readerError := inputReader.ReadString('\n')
if readerError == io.EOF {
break
}
lineCounter++
buf[lineCounter] = inputString
}
hostname := strings.Split(buf[1], " ")[0]
hostnameprefix := getBetween(DockerData, `"Hostname":"`, `",`)
hostnamesubfix := getBetween(DockerData, `"Domainname":"`, `",`)
hostname := hostnameprefix + `.` + hostnamesubfix
return hostname
}

Expand Down