淺談
staragent 是什麼?部署在 ECS 上的一個組件,兩個主要功能:
- 數據功能,上報 ECS 上的系統日誌
- 命令功能,接收控制檯的下發指令,上報心跳狀態,記錄執行任務過程等功能。
主要目錄結構
主要的目錄都統計出來,不重要的目錄這裏就不過介紹。
├── bin
│ ├── agent.sh
│ ├── agent_start_cmd.txt
│ ├── dnsresolver
│ ├── fakeStaragentctl7u
│ ├── pluginctl
│ ├── pluginplatform
│ ├── post_install.sh
│ ├── sa_healthCheck.sh
│ ├── sa_install_lock.sh
│ ├── sa_install.sh
│ ├── sa_recovery.sh
│ ├── staragent2
│ ├── staragentctl
│ ├── staragentctl7u
│ ├── staragentd
│ └── unzip
|
├── conf
│ ├── channels.conf
│ └── staragent.conf
|
├── log
│ ├── dbscanner.log
│ ├── dbscanner.log.20181118195157
│ ├── staragent_channels.log
│ ├── staragent_channels.log.20181116175937
│ ├── staragent_core.log
│ ├── staragent_core.log.20181111214336
│ ├── staragent_core.log.20181117070750
│ ├── staragent_ctl.log
│ ├── staragent_master.log
│ └── staragent_tasks.log
└──
主要配置文件如下
1)/home/staragent/conf/staragent.conf,配置 staragent 註冊的服務地址
{
"Common":
{
"LogLevel" : "debug" //error,warn,info,debug
},
"Sub_Core": {
"ConfServer":{
"ConfServer" : [
"http://staragent-edas.aliyuncs.com" //服務端域名
]
}
}
}
2)/home/staragent/conf/channels.conf 服務端的備份 IP
100.100.27.142 80
100.100.36.55 80
排查命令
- ps aux | grep -E "staragentd|staragent-core|staragent-ppf" | grep -v grep
檢查 staragent 進程是否存活 - suodo /home/staragent/bin/agent.sh {start|stop|restart}
啓動、停止、重啓Agent - /home/staragent/bin/staragent2 -e GetStatus
/home/staragent/bin/staragent2 -e GetStatus
------agent running ok------
StartTime : 2016-08-30 19:03:34 CST
RegisterTime : 2016-08-30 19:03:44 CST
ServiceTag : 94a2a7e7-5baa-4623-95f4-ef2f22741bff
ServerConnected : 1
ServerAddr : 10.125.250.64:8000
LocalAddr : 10.101.94.148
Max Core count : 0
Total CPU Count : 2
Total CPU Rate : 1.01%
Total MEM Rate : 12.85%
Process CPU Rate : 0.00%
Load Avg (1,5,15) : 6,4,5
Virtual Memory : 397MB
Physical Memory : 11MB
檢查
1) ServerConnected 是否爲 1
如果ServerConnected爲1,表示已連接,agent已工作正常。
- 重啓 logagent 插件
/home/staragent/plugins/logAgent/logagentctl.sh restart