[ Agent ] [ init ] - add debug feature
This commit is contained in:
@@ -2,6 +2,7 @@ package executor
|
||||
|
||||
import (
|
||||
"agent-go/status"
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
@@ -33,9 +34,12 @@ func BuildAgentOsOperator(ossOfflinePrefix string) *AgentOsOperator {
|
||||
}
|
||||
|
||||
func detectByAgentStatusInfo(os *AgentOsOperator) {
|
||||
agentMetric := status.ReportAgentInfo()
|
||||
agentInfo := status.ReportAgentInfo()
|
||||
|
||||
if strings.Contains(agentMetric.HostInfo.PlatformFamily, "centos") {
|
||||
bytes, _ := json.Marshal(agentInfo)
|
||||
log.DebugF("[detectByAgentStatusInfo] - agent info is => %s", string(bytes))
|
||||
|
||||
if strings.Contains(agentInfo.HostInfo.PlatformFamily, "centos") {
|
||||
// centos
|
||||
os.IsOsTypeUbuntu = false
|
||||
os.IsOsTypeCentOS = true
|
||||
@@ -46,7 +50,7 @@ func detectByAgentStatusInfo(os *AgentOsOperator) {
|
||||
"yum", "remove",
|
||||
}
|
||||
|
||||
} else if strings.Contains(agentMetric.HostInfo.PlatformFamily, "debian") {
|
||||
} else if strings.Contains(agentInfo.HostInfo.PlatformFamily, "debian") {
|
||||
// ubuntu
|
||||
os.IsOsTypeUbuntu = true
|
||||
os.IsOsTypeCentOS = false
|
||||
@@ -56,11 +60,11 @@ func detectByAgentStatusInfo(os *AgentOsOperator) {
|
||||
}
|
||||
|
||||
// os release code
|
||||
os.AgentOSReleaseCode = judgeUbuntuReleaseFromOsVersion(agentMetric.HostInfo.PlatformVersion)
|
||||
os.AgentOSReleaseCode = judgeUbuntuReleaseFromOsVersion(agentInfo.HostInfo.PlatformVersion)
|
||||
}
|
||||
|
||||
// agent cpu arch
|
||||
os.AgentArch = judgeAgentCpuArchByKernelArch(agentMetric.HostInfo.KernelArch)
|
||||
os.AgentArch = judgeAgentCpuArchByKernelArch(agentInfo.HostInfo.KernelArch)
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user