浅谈
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