博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
EDAS staragent 排查
阅读量:7096 次
发布时间:2019-06-28

本文共 4169 字,大约阅读时间需要 13 分钟。

浅谈

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  80100.100.36.55   80

排查命令

  • ps aux | grep -E "staragentd|staragent-core|staragent-ppf" | grep -v grep
    检查 staragent 进程是否存活
  • sudo /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
  • wget -q -O /root/install.sh http://edas-sz.oss-cn-shenzhen-internal.aliyuncs.com/install.sh && sh /root/install.sh -full -force
    强制重新安装 agent 脚本,其中 sz 代表深圳,可以替换成你自己的 region 比如 hz 就是杭州。shenzhen 替换成你的 region ,其他的不用变。

使用遇到的问题

案例:

ECS 进行集群转移,报错 "issue config fail on ecu"

1

image

排查:

1)先看下要迁移的源 ECS 是否还在应用中,确认是已经摘除掉应用的才能进行迁移;

2)源机器的 VPC 和目标机器的 VPC 必须是同一个;

3)客户端上执行下 /home/staragent/bin/staragent2 -e GetStatus 看下 ServerConnected 的状态是否为 1 ,如果不为 1 说明 agent 的状态异常,可以重启下 agent /home/staragent/bin/agent.sh restart

4)执行 ps aux | grep -E "staragentd|staragent-core|staragent-ppf" | grep -v grep

如果进程一直起不来,说明 agent 本身就有问题。要手动执行脚本重装 agent ;

5)第 3 步没有效果的话,再继续看下 /home/staragent/conf/ 目录下的配置文件 channels.conf staragent.conf;

  • 5.1)先看下 staragent.conf 配置的服务端注册地址是否正确,有的客户把这里固定 IP 协议,结果 IP 更换后这里没有更换导致网络不通。
"ConfServer" : [          "http://staragent-edas.aliyuncs.com"      ]
  • 5.2)看下 channels.conf 文件中配置的地址的 IP 能否 ping 通,telnet 80 是否能通
[root@hanli-edas-01 plugins]# cat /home/staragent/conf/channels.conf 100.100.27.142    80100.100.36.55    80[root@hanli-edas-01 plugins]# ping -c 4 100.100.27.142PING 100.100.27.142 (100.100.27.142) 56(84) bytes of data.64 bytes from 100.100.27.142: icmp_seq=1 ttl=46 time=27.4 ms64 bytes from 100.100.27.142: icmp_seq=2 ttl=46 time=26.9 ms64 bytes from 100.100.27.142: icmp_seq=3 ttl=46 time=26.9 ms64 bytes from 100.100.27.142: icmp_seq=4 ttl=46 time=26.9 ms--- 100.100.27.142 ping statistics ---4 packets transmitted, 4 received, 0% packet loss, time 3004msrtt min/avg/max/mdev = 26.924/27.082/27.477/0.229 ms[root@hanli-edas-01 plugins]# telnet 100.100.27.142 80Trying 100.100.27.142...Connected to 100.100.27.142.Escape character is '^]'.^]Connection closed by foreign host.[root@hanli-edas-01 plugins]#

5)第 4 步还是解决不了的话就需要查看 agent 的异常日志的,进去我们上面说的日志目录,找到 staragent_core.log ,这个是 agent 的启动、上报健康状态、注册的核心日志。这里就用到之前说的 grep error 关键

image

排查到这里基本上我们就知道问题了,接下来我们再客户端上部署下 tcpdump 抓包,然后看下超时的原因:

5.1)nohup tcpdump -i <网卡出口> -s0 host staragent-edas.aliyuncs.com &

image

通过抓包发现客户端发去的 request 后服务端没有响应,这时大致可以判断了是 staragent 在服务端注册失败,这种情况我们重新执行下安装脚本即可解决这个问题。

转载地址:http://qaaql.baihongyu.com/

你可能感兴趣的文章
Java 处理异常 9 个最佳实践,你知道几个?
查看>>
Apache 不能列目录解决。
查看>>
如何永久的修改主机名
查看>>
NSSearchPathForDirectoriesInDomains用法(后台缓存)
查看>>
Jqurey 全选和全不选
查看>>
ELK日志收集平台部署
查看>>
软件公司员工辞职、人员流动大是必然
查看>>
Ubuntu或debian下彻底卸载两步!!
查看>>
9月15日 sed
查看>>
我的友情链接
查看>>
Netlink Socket
查看>>
wordpress服务器安装与响应式网站配置
查看>>
VMware从初级到高级全攻略电子教程
查看>>
less引用其他less文件
查看>>
SQL Server Profiler – 存储过程调试
查看>>
在AWS的EU区域地理位置上分布式MongoDB集群
查看>>
在远程计算机运行PowerShell命令
查看>>
大道至简
查看>>
jdk安装问题
查看>>
系统镜像备份还原Windows 10 系统
查看>>