[ Agent ] [ Base ] - add support for centos/openeuler ; todo chronyToMasterExec centos

This commit is contained in:
zeaslity
2024-01-19 18:34:36 +08:00
parent 7b57a2a422
commit 42dee262cf
7 changed files with 290 additions and 128 deletions

View File

@@ -5,6 +5,7 @@ import (
"agent-go/g"
"agent-go/rabbitmq"
"agent-go/register"
"agent-go/status"
"encoding/json"
"fmt"
"gopkg.in/yaml.v3"
@@ -24,6 +25,13 @@ func INIT(agentServerInfoConf string) chan bool {
// 获取系统的环境变量
agentServerInfo := parseAgentServerInfo(agentServerInfoConf)
// re-get agentInfo from status module
agentInfo := status.ReportAgentInfo()
refreshAgentInfoByStatusInfo(agentInfo, agentServerInfo)
// build operator cache
BuildAgentOsOperator(agentInfo, agentServerInfo)
// 缓存此内容
//AgentServerInfoCache = agentServerInfo
@@ -95,6 +103,17 @@ func INIT(agentServerInfoConf string) chan bool {
return businessForeverChan
}
func refreshAgentInfoByStatusInfo(agentInfo *status.AgentInfo, agentServerInfo *register.AgentServerInfo) {
agentServerInfo.Platform = agentInfo.HostInfo.Platform
agentServerInfo.PlatformFamily = agentInfo.HostInfo.PlatformFamily
agentServerInfo.PlatformVersion = agentInfo.HostInfo.PlatformVersion
agentServerInfo.KernelVersion = agentInfo.HostInfo.KernelVersion
agentServerInfo.KernelArch = agentInfo.HostInfo.KernelArch
log.DebugF("[refreshAgentInfoByStatusInfo] - ok !")
}
// handleInitMsgFromServer 处理从Server接收的 注册信息
func handleInitMsgFromServer(initFromServerQueue *rabbitmq.RabbitQueue, initToServerQueue *rabbitmq.RabbitQueue, agentServerInfo *register.AgentServerInfo) chan bool {
@@ -187,9 +206,6 @@ func parseAgentServerInfo(agentServerInfoConf string) *register.AgentServerInfo
// uniform agent server info
UniformAgentServerInfo(agentServerInfo)
// build operator cache
BuildAgentOsOperator(agentServerInfo)
jsonFormat, err := json.Marshal(&agentServerInfo)
if err != nil {
log.Error(fmt.Sprintf("agent server info convert error ! agentserverinfo is %v", agentServerInfo))
@@ -225,7 +241,7 @@ func UniformAgentServerInfo(agentServerInfo *register.AgentServerInfo) {
}
func BuildAgentOsOperator(agentServerInfo *register.AgentServerInfo) {
func BuildAgentOsOperator(agentInfo *status.AgentInfo, agentServerInfo *register.AgentServerInfo) {
// 2023年8月4日 pass through some key information
ossOfflinePrefix := g.G.AgentConfig.GetString("octopus.agent.executor.ossOfflinePrefix")
@@ -234,7 +250,7 @@ func BuildAgentOsOperator(agentServerInfo *register.AgentServerInfo) {
}
// call the init exec function
agentOsOperator := executor.BuildAgentOsOperator(ossOfflinePrefix)
agentOsOperator := executor.BuildAgentOsOperator(agentInfo, ossOfflinePrefix)
// assign the agentServerInfo
agentOsOperator.AgentServerInfo = agentServerInfo

View File

@@ -58,6 +58,9 @@ func (op *AgentOsOperator) Exec(baseFuncName string, funcArgs ...string) (bool,
case "disableSwap":
resultOk, errorLog = op.disableSwapExec()
break
case "DISABLE_SELINUX":
resultOk, errorLog = op.disableSELinuxExec()
break
case "installDocker":
resultOk, errorLog = op.installDockerExec(funcArgs)
break
@@ -322,6 +325,30 @@ func (op *AgentOsOperator) disableSwapExec() (bool, []string) {
return true, resultLog
}
func (op *AgentOsOperator) disableSELinuxExec() (bool, []string) {
if op.IsOsTypeUbuntu {
return true, []string{
"[disableSELinuxExec] - os is ubuntu, success",
}
}
// delete contend
BasicFindDeleteContendLineInFile("SELINUX=enforcing", "/etc/selinux/config")
BasicFindDeleteContendLineInFile("SELINUX=permissive", "/etc/selinux/config")
BasicFindDeleteContendLineInFile("SELINUX=disabled", "/etc/selinux/config")
BasicAppendContentToFile("SELINUX=disabled", "/etc/selinux/config")
// shutdown
AllCommandExecutor([]string{
"setenforce",
"0",
})
return true, []string{}
}
func (op *AgentOsOperator) installDefaultSSHKeyExec(funcArgs []string) (bool, []string) {
// ssh-keygen -t ed25519 -C "wdd@cmii.com"
@@ -569,7 +596,7 @@ func (op *AgentOsOperator) installDocker(args []string) [][]string {
func (op *AgentOsOperator) installDockerExec(args []string) (bool, []string) {
BasicCreateFolder("/root/install/")
BasicCreateFolder("/root/wdd/")
if op.IsOsTypeUbuntu {
@@ -749,6 +776,12 @@ func (op *AgentOsOperator) installDockerExec(args []string) (bool, []string) {
if !completeExecutor {
return false, append(log5, "启动docker.service失败请查明原因", "journalctl -u docker -n 100 -f")
}
} else if op.IsOsTypeCentOS {
if !op.CanAccessInternet {
// offline version
log.InfoF("[installDockerExec] - centos can not access to internet, installing by offline !")
return op.installDockerOfflineExec(args)
}
}
return true, []string{
@@ -759,34 +792,34 @@ func (op *AgentOsOperator) installDockerExec(args []string) (bool, []string) {
func (op *AgentOsOperator) installDockerOfflineExec(args []string) (bool, []string) {
log.InfoF("[installDockerOfflineExec] - install docker 20.10.15 by offline method !")
BasicCreateFolder("/root/install")
BasicCreateFolder("/root/wdd")
// download static binary installer of docker
var dockerOfflineFileName string
if strings.HasPrefix(op.AgentArch, "amd") {
dockerOfflineFileName = "docker-amd64-20.10.15.tgz"
} else if strings.HasPrefix(op.AgentArch, "arm") {
} else if strings.HasPrefix(op.AgentArch, "arm64") {
dockerOfflineFileName = "docker-arm64-20.10.15.tgz"
}
ok, resultLog := BasicDownloadFile(op.OssOfflinePrefix+dockerOfflineFileName, "/root/install/"+dockerOfflineFileName)
ok, resultLog := BasicDownloadFile(op.OssOfflinePrefix+dockerOfflineFileName, "/root/wdd/"+dockerOfflineFileName)
if !ok {
return false, resultLog
}
BasicRemoveFolderComplete("/root/install/docker")
BasicRemoveFolderComplete("/root/wdd/docker")
PureResultSingleExecute([]string{
"tar",
"-vxf",
"/root/install/" + dockerOfflineFileName,
"/root/wdd/" + dockerOfflineFileName,
"-C",
"/root/install",
"/root/wdd",
})
HardCodeCommandExecutor("chmod 777 -R /root/install/docker/*")
HardCodeCommandExecutor("chmod 777 -R /root/wdd/docker/*")
resultOk, l := HardCodeCommandExecutor("mv /root/install/docker/* /usr/bin")
resultOk, l := HardCodeCommandExecutor("mv /root/wdd/docker/* /usr/bin")
if !resultOk {
return false, append(l, "[installDockerOfflineExec] - cp docker executable file error!")
}
@@ -922,7 +955,7 @@ func (op *AgentOsOperator) installDockerComposeExec() (bool, []string) {
var DockerComposeFile string
if strings.HasPrefix(op.AgentArch, "amd") {
DockerComposeFile = op.OssOfflinePrefix + "docker-compose-linux-x86_64-v2.18.0"
} else if strings.HasPrefix(op.AgentArch, "arm") {
} else if strings.HasPrefix(op.AgentArch, "arm64") {
DockerComposeFile = op.OssOfflinePrefix + "docker-compose-linux-aarch64-v2.18.0"
}
@@ -1109,11 +1142,11 @@ func (op *AgentOsOperator) modifyDockerConfigExec(args []string) (bool, []string
}
func (op *AgentOsOperator) installNfsOnlineExec() (bool, []string) {
if op.IsOsTypeUbuntu {
if !op.CanAccessInternet {
return op.installNFSOfflineExec()
}
if !op.CanAccessInternet {
return op.installNFSOfflineExec()
}
if op.IsOsTypeUbuntu {
// ubuntu
installOk, installLog := BasicInstallSoftwares(op.InstallCommandPrefix, false,
@@ -1126,6 +1159,20 @@ func (op *AgentOsOperator) installNfsOnlineExec() (bool, []string) {
if !ok {
return false, append(resultLog, "[installNfsOnlineExec] - start nfs-common.service failed !")
}
} else if op.IsOsTypeCentOS {
// centos
installOk, installLog := BasicInstallSoftwares(op.InstallCommandPrefix, false,
"nfs-utils")
if !installOk {
return false, installLog
}
ok, resultLog := BasicSystemdUp("rpcbind")
if !ok {
return false, append(resultLog, "[installNfsOnlineExec] - start rpcbind.service failed !")
}
}
return true, nil
@@ -1134,36 +1181,42 @@ func (op *AgentOsOperator) installNfsOnlineExec() (bool, []string) {
func (op *AgentOsOperator) installNFSOfflineExec() (bool, []string) {
log.InfoF("[installNFSOfflineExec] - start to install nfs-client offline !")
BasicCreateFolder("/root/install")
BasicCreateFolder("/root/wdd")
// check for version
executor, i := HardCodeCommandExecutor("grep PRETTY_NAME /etc/os-release | cut -d= -f2 | tr -d '\"' | sed 's/ /-/g'")
if !executor {
return false, append(i, "[installNFSOfflineExec]- get offline package name suffix error !")
}
nfsClientOfflinePackageName := "nfs-client-" + op.AgentArch + "-" + i[0] + ".tar.gz"
//executor, i := HardCodeCommandExecutor("grep PRETTY_NAME /etc/os-release | cut -d= -f2 | tr -d '\"' | sed 's/ /-/g'")
//if !executor {
// return false, append(i, "[installNFSOfflineExec]- get offline package name suffix error !")
//}
// 2024年1月19日 new version
nfsClientOfflinePackageName := "nfs-client-" + op.AgentArch + "-" + op.AgentServerInfo.Platform + "-" + op.AgentServerInfo.PlatformVersion + ".tar.gz"
// download from oss
nfsClientOfflinePackageOSSUrl := op.OssOfflinePrefix + nfsClientOfflinePackageName
log.InfoF("[installNFSOfflineExec]- start to download nfs-client offline package from => %s", nfsClientOfflinePackageOSSUrl)
ok, resultLog := BasicDownloadFile(nfsClientOfflinePackageOSSUrl, "/root/install/"+nfsClientOfflinePackageName)
ok, resultLog := BasicDownloadFile(nfsClientOfflinePackageOSSUrl, "/root/wdd/"+nfsClientOfflinePackageName)
if !ok {
return false, append(resultLog, "[installNFSOfflineExec]- download nfs-client offline package error !", nfsClientOfflinePackageOSSUrl)
}
BasicRemoveFolderComplete("/root/install/tmp")
BasicRemoveFolderComplete("/root/wdd/tmp")
// unzip
AllCommandExecutor([]string{
"tar",
"-zvxf",
"/root/install/" + nfsClientOfflinePackageName,
"/root/wdd/" + nfsClientOfflinePackageName,
"-C",
"/root/install",
"/root/wdd",
})
// install
BasicPrettyPrint(HardCodeCommandExecutor("dpkg -i /root/install/tmp/nfs-client/*.deb"))
if op.IsOsTypeUbuntu {
BasicPrettyPrint(HardCodeCommandExecutor("dpkg -i /root/wdd/tmp/nfs-client/*.deb"))
} else if op.IsOsTypeCentOS {
BasicPrettyPrint(HardCodeCommandExecutor("rpm -ivh /root/wdd/tmp/nfs-client/*.rpm"))
}
ok, resultLog = BasicSystemdUp("nfs")
if !ok {
@@ -1178,13 +1231,32 @@ func (op *AgentOsOperator) installNFSOfflineExec() (bool, []string) {
func (op *AgentOsOperator) installNfsServerOnlineExec() (bool, []string) {
if !op.CanAccessInternet {
return op.installNFSServerOfflineExec()
}
if !PureResultSingleExecuteBatch([][]string{
{"mkdir", "-p", nfsDataPath},
{"chmod", "777", nfsDataPath},
}) {
return false, []string{
"[installNfsServerOnlineExec]- create nfs data folder failed !",
}
}
if !BasicFindContentInFile(nfsDataPath, "/etc/exports") {
log.DebugF("[installNfsServerOnlineExec]- add nfs path to /etc/exports !")
nfsExport := nfsDataPath + " *(rw,no_root_squash,no_all_squash,sync)"
if !BasicAppendContentToFile(nfsExport, "/etc/exports") {
return false, []string{
"[installNfsServerOnlineExec]- add nfs path to /etc/exports failed !",
}
}
}
// os
if op.IsOsTypeUbuntu {
if !op.CanAccessInternet {
return op.installNFSServerOfflineExec()
}
// ubuntu
installOk, installLog := BasicInstallSoftwares(op.InstallCommandPrefix, true, "nfs-kernel-server",
"nfs-common")
@@ -1192,46 +1264,42 @@ func (op *AgentOsOperator) installNfsServerOnlineExec() (bool, []string) {
return false, installLog
}
if !PureResultSingleExecuteBatch([][]string{
{"mkdir", "-p", nfsDataPath},
{"chmod", "777", nfsDataPath},
}) {
return false, []string{
"[installNfsServerOnlineExec]- create nfs data folder failed !",
}
// restart nfs-server
up, resultLog := BasicSystemdUp("nfs-kernel-server")
if !up {
msg := "[installNfsServerOnlineExec]- nfs-kernel-server start error"
log.Error(msg)
return false, append(resultLog, msg)
}
if !BasicGrepItemInFile(nfsDataPath, "/etc/exports") {
log.DebugF("[installNfsServerOnlineExec]- add nfs path to /etc/exports !")
nfsExport := nfsDataPath + " *(rw,no_root_squash,no_all_squash,sync)"
if !BasicAppendContentToFile(nfsExport, "/etc/exports") {
return false, []string{
"[installNfsServerOnlineExec]- add nfs path to /etc/exports failed !",
}
}
} else if op.IsOsTypeCentOS {
// ubuntu
installOk, installLog := BasicInstallSoftwares(op.InstallCommandPrefix, true, "nfs-utils")
if !installOk {
return false, installLog
}
// restart nfs-server
AllCompleteExecutor([][]string{
{
"systemctl",
"restart",
"nfs-kernel-server",
},
{
"systemctl",
"restart",
"nfs",
},
})
ok, i := HardCodeCommandExecutor("rpcinfo -p localhost")
if !ok {
return false, append(i,
"installNfsServerOnlineExec] - rpc info error !",
"please check nfs server installation")
up, resultLog := BasicSystemdUp("rpcbind")
if !up {
msg := "[installNfsServerOnlineExec]- rpcbind start error"
log.Error(msg)
return false, append(resultLog, msg)
}
up, resultLog = BasicSystemdUp("nfs-server")
if !up {
msg := "[installNfsServerOnlineExec]- nfs-server start error"
log.Error(msg)
return false, append(resultLog, msg)
}
}
ok, i := HardCodeCommandExecutor("rpcinfo -p localhost")
if !ok {
return false, append(i,
"installNfsServerOnlineExec] - rpc info error !",
"please check nfs server installation")
}
return true, nil
@@ -1240,43 +1308,39 @@ func (op *AgentOsOperator) installNfsServerOnlineExec() (bool, []string) {
func (op *AgentOsOperator) installNFSServerOfflineExec() (bool, []string) {
log.InfoF("[installNFSServerOfflineExec] - start to install nfs server offline !")
if !BasicCreateFolder("/root/install") {
if !BasicCreateFolder("/root/wdd") {
return false, []string{
"[installNFSServerOfflineExec] - create install folder error !",
}
}
// check for the version
executor, i := HardCodeCommandExecutor("grep PRETTY_NAME /etc/os-release | cut -d= -f2 | tr -d '\"' | sed 's/ /-/g'")
if !executor {
return false, append(i, "[installNFSServerOfflineExec]- get offline package name suffix error !")
}
nfsServerOfflinePackageName := "nfs-server-" + op.AgentArch + "-" + i[0] + ".tar.gz"
//executor, i := HardCodeCommandExecutor("grep PRETTY_NAME /etc/os-release | cut -d= -f2 | tr -d '\"' | sed 's/ /-/g'")
//if !executor {
// return false, append(i, "[installNFSServerOfflineExec]- get offline package name suffix error !")
//}
nfsServerOfflinePackageName := "nfs-server-" + op.AgentArch + "-" + op.AgentServerInfo.Platform + "-" + op.AgentServerInfo.PlatformVersion + ".tar.gz"
// download from oss
nfsServerOfflinePackageOSSUrl := op.OssOfflinePrefix + nfsServerOfflinePackageName
log.InfoF("[installNFSServerOfflineExec]- start to download nfs-server offline package from => %s", nfsServerOfflinePackageOSSUrl)
ok, resultLog := BasicDownloadFile(nfsServerOfflinePackageOSSUrl, "/root/install/"+nfsServerOfflinePackageName)
ok, resultLog := BasicDownloadFile(nfsServerOfflinePackageOSSUrl, "/root/wdd/"+nfsServerOfflinePackageName)
if !ok {
return false, append(resultLog, "[installNFSServerOfflineExec]- download nfs-server offline package error !", nfsServerOfflinePackageOSSUrl)
}
BasicRemoveFolderComplete("/root/install/tmp")
BasicRemoveFolderComplete("/root/wdd/tmp")
// unzip
AllCommandExecutor([]string{
"tar",
"-zvxf",
"/root/install/" + nfsServerOfflinePackageName,
"/root/wdd/" + nfsServerOfflinePackageName,
"-C",
"/root/install",
"/root/wdd",
})
// install
BasicPrettyPrint(HardCodeCommandExecutor(
"dpkg -i /root/install/tmp/nfs-server/*.deb",
))
if !PureResultSingleExecuteBatch([][]string{
{"mkdir", "-p", nfsDataPath},
{"chmod", "777", nfsDataPath},
@@ -1286,7 +1350,7 @@ func (op *AgentOsOperator) installNFSServerOfflineExec() (bool, []string) {
}
}
if !BasicGrepItemInFile(nfsDataPath, "/etc/exports") {
if !BasicFindContentInFile(nfsDataPath, "/etc/exports") {
log.DebugF("[installNFSServerOfflineExec]- add nfs path to /etc/exports !")
nfsExport := nfsDataPath + " *(rw,no_root_squash,no_all_squash,sync)"
@@ -1297,21 +1361,41 @@ func (op *AgentOsOperator) installNFSServerOfflineExec() (bool, []string) {
}
}
AllCompleteExecutor([][]string{
{
"systemctl",
"restart",
"nfs-kernel-server",
},
{
"systemctl",
"restart",
"nfs",
},
})
// install
if op.IsOsTypeUbuntu {
BasicPrettyPrint(HardCodeCommandExecutor(
"dpkg -i /root/wdd/tmp/nfs-server/*.deb",
))
ok, i = HardCodeCommandExecutor("rpcinfo -p localhost")
if !ok {
up, resultLog := BasicSystemdUp("nfs-kernel-server")
if !up {
msg := "[installNfsServerOnlineExec]- nfs-kernel-server start error"
log.Error(msg)
return false, append(resultLog, msg)
}
} else if op.IsOsTypeCentOS {
BasicPrettyPrint(HardCodeCommandExecutor(
"rpm -ivh /root/wdd/tmp/nfs-server/*.rpm",
))
// restart nfs-server
up, resultLog := BasicSystemdUp("rpcbind")
if !up {
msg := "[installNfsServerOnlineExec]- rpcbind start error"
log.Error(msg)
return false, append(resultLog, msg)
}
up, resultLog = BasicSystemdUp("nfs-server")
if !up {
msg := "[installNfsServerOnlineExec]- nfs-server start error"
log.Error(msg)
return false, append(resultLog, msg)
}
}
rpcinfoOK, i := HardCodeCommandExecutor("rpcinfo -p localhost")
if !rpcinfoOK {
return false, append(i,
"[installNFSServerOfflineExec] - rpc info error !",
"please check nfs server installation")
@@ -1433,7 +1517,7 @@ func (op *AgentOsOperator) installHarborExec() (bool, []string) {
}
}
if strings.HasPrefix(op.AgentArch, "arm") {
if strings.HasPrefix(op.AgentArch, "arm64") {
return false, []string{
"[install harbor] - script do not support for aarch64 version of harbor installation !",
}
@@ -1902,7 +1986,10 @@ func (op *AgentOsOperator) chronyToMaster(args []string) [][]string {
func (op *AgentOsOperator) chronyToMasterExec(args []string) (bool, []string) {
if !op.IsOsTypeUbuntu {
if op.IsOsTypeCentOS {
// todo
return false, []string{
"[chronyToMasterExec] - do not support none ubuntu os !",
}

View File

@@ -150,6 +150,52 @@ func BasicFindContentInFile(content string, fileName string) bool {
return false
}
func BasicFindDeleteContendLineInFile(content string, fileName string) bool {
// Open the file
file, err := os.Open(fileName)
if err != nil {
log.ErrorF("[FindDeleteContendLineInFile] - file not exits ")
return false
}
defer file.Close()
// Create a scanner to read the file line by line
scanner := bufio.NewScanner(file)
// Set the split function for the scanner
scanner.Split(bufio.ScanLines)
// 创建一个新的文件内容变量
var newContent string
// Iterate over the lines of the file
for scanner.Scan() {
// Get the current line
line := scanner.Text()
// Check if the current line contains the search term
if !strings.Contains(line, content) {
newContent += line + "\n"
}
}
// Check for any errors that occurred during scanning
if err := scanner.Err(); err != nil {
log.ErrorF("[BasicFindContentInFile] - scanner error ! %s", err.Error())
return false
}
// 将修改后的内容写回文件
err = os.WriteFile(fileName, []byte(newContent), os.ModePerm)
if err != nil {
log.ErrorF("[FindDeleteContendLineInFile] - write file %s error with contend %s", fileName, newContent)
return false
}
return true
}
func BasicDockerImageExists(imageName, imageVersion string) bool {
if !BasicCommandExistByPath("docker") {

View File

@@ -7,7 +7,7 @@ import (
"strings"
)
func BuildAgentOsOperator(ossOfflinePrefix string) *AgentOsOperator {
func BuildAgentOsOperator(agentInfo *status.AgentInfo, ossOfflinePrefix string) *AgentOsOperator {
AgentOsOperatorCache = &AgentOsOperator{
InstallCommandPrefix: []string{
@@ -25,7 +25,7 @@ func BuildAgentOsOperator(ossOfflinePrefix string) *AgentOsOperator {
}
// os type
detectByAgentStatusInfo(AgentOsOperatorCache)
detectByAgentStatusInfo(agentInfo, AgentOsOperatorCache)
// internet
detectByInternet(AgentOsOperatorCache)
@@ -33,8 +33,11 @@ func BuildAgentOsOperator(ossOfflinePrefix string) *AgentOsOperator {
return AgentOsOperatorCache
}
func detectByAgentStatusInfo(os *AgentOsOperator) {
agentInfo := status.ReportAgentInfo()
func detectByAgentStatusInfo(agentInfo *status.AgentInfo, os *AgentOsOperator) {
if agentInfo == nil {
log.WarnF("[detectByAgentStatusInfo] - agentInfo from status module is nil, roll back to traditional way!")
// detectByOsType()
}
bytes, _ := json.Marshal(agentInfo)
log.DebugF("[detectByAgentStatusInfo] - agent info is => %s", string(bytes))

View File

@@ -40,7 +40,7 @@ func TestFindDeploymentReplicasSmallerThanN(t *testing.T) {
}
func TestFindCmiiMiddlewarePodInterface(t *testing.T) {
middlewarePodInterface := FindCmiiMiddlewarePodInterface(devFlight)
middlewarePodInterface := FindCmiiMiddlewarePodInterface(integration)
for _, middlePod := range middlewarePodInterface {
println()

View File

@@ -1,26 +1,31 @@
package register
type AgentServerInfo struct {
ServerName string `json:"serverName" yaml:"serverName"`
ServerIPPbV4 string `json:"serverIpPbV4" yaml:"serverIpPbV4"`
ServerIPInV4 string `json:"serverIpInV4" yaml:"serverIpInV4"`
ServerIPPbV6 string `json:"serverIpPbV6" yaml:"serverIpPbV6"`
ServerIPInV6 string `json:"serverIpInV6" yaml:"serverIpInV6"`
Location string `json:"location" yaml:"location"`
Provider string `json:"provider" yaml:"provider"`
ManagePort string `json:"managePort" yaml:"managePort"`
CPUCore string `json:"cpuCore" yaml:"cpuCore"`
CPUBrand string `json:"cpuBrand" yaml:"cpuBrand"`
OSInfo string `json:"osInfo" yaml:"osInfo"`
OSKernelInfo string `json:"osKernelInfo" yaml:"osKernelInfo"`
TCPControl string `json:"tcpControl" yaml:"tcpControl"`
Virtualization string `json:"virtualization" yaml:"virtualization"`
IoSpeed string `json:"ioSpeed" yaml:"ioSpeed"`
MemoryTotal string `json:"memoryTotal" yaml:"memoryTotal"`
DiskTotal string `json:"diskTotal" yaml:"diskTotal"`
DiskUsage string `json:"diskUsage" yaml:"diskUsage"`
Comment string `json:"comment" yaml:"comment"`
MachineID string `json:"machineId" yaml:"machineId"`
AgentVersion string `json:"agentVersion" yaml:"agentVersion"`
TopicName string `json:"topicName" yaml:"topicName"`
ServerName string `json:"serverName" yaml:"serverName"`
ServerIPPbV4 string `json:"serverIpPbV4" yaml:"serverIpPbV4"`
ServerIPInV4 string `json:"serverIpInV4" yaml:"serverIpInV4"`
ServerIPPbV6 string `json:"serverIpPbV6" yaml:"serverIpPbV6"`
ServerIPInV6 string `json:"serverIpInV6" yaml:"serverIpInV6"`
Location string `json:"location" yaml:"location"`
Provider string `json:"provider" yaml:"provider"`
ManagePort string `json:"managePort" yaml:"managePort"`
CPUCore string `json:"cpuCore" yaml:"cpuCore"`
CPUBrand string `json:"cpuBrand" yaml:"cpuBrand"`
OSInfo string `json:"osInfo" yaml:"osInfo"`
OSKernelInfo string `json:"osKernelInfo" yaml:"osKernelInfo"`
TCPControl string `json:"tcpControl" yaml:"tcpControl"`
Virtualization string `json:"virtualization" yaml:"virtualization"`
Platform string `json:"platform"` // ex: ubuntu, linuxmint
PlatformFamily string `json:"platformFamily"` // ex: debian, rhel
PlatformVersion string `json:"platformVersion"` // version of the complete OS
KernelVersion string `json:"kernelVersion"` // version of the OS kernel (if available)
KernelArch string `json:"kernelArch"` // native cpu architecture queried at runtime, as returned by `uname -m` or empty string in case of error
IoSpeed string `json:"ioSpeed" yaml:"ioSpeed"`
MemoryTotal string `json:"memoryTotal" yaml:"memoryTotal"`
DiskTotal string `json:"diskTotal" yaml:"diskTotal"`
DiskUsage string `json:"diskUsage" yaml:"diskUsage"`
Comment string `json:"comment" yaml:"comment"`
MachineID string `json:"machineId" yaml:"machineId"`
AgentVersion string `json:"agentVersion" yaml:"agentVersion"`
TopicName string `json:"topicName" yaml:"topicName"`
}

View File

@@ -13,6 +13,11 @@ public enum BaseFunctionEnum {
),
DISABLE_SELINUX(
"DISABLE_SELINUX",
"关闭SELinux"
),
MODIFY_HOSTNAME(
"modifyHostname",
"修改主机名称, args 主机名"