注册
dem中主机监控异常常见原因总结
技术分享/ 文章详情 /

dem中主机监控异常常见原因总结

干煸牛蛙 2023/07/11 1392 2 0

agent介绍

部署完达梦dem后可以使用dem监控其他服务器状态,但需要在被监控的服务器上部署代理服务 dmagent,dem中主机监控失败时通常需要先从部署agent的服务器上排查原因

获取 dmagent

可以通过 2 种方式获取到 dmagent 程序:

  1. 达梦数据库安装目录的tool下存有dmagent。例如D:\dmdbms\tool\dmagent
    image.png

2.登录部署好的 DEM,在监控和告警模块下单击主机,打开主机面板,在工具栏选择更多->下载代理,下载 dmagent。拷贝 dmagent 到要部署的机器上
image.png

配置 dmagent

通过 agent.ini 配置文件来配置 dmagent, agent.ini 配置文件存放在AGENT_HOME 目录下(注: AGENT_HOME 目录表示 dmagent 程序的所在目录)

vi $AGENT_HOME/agent.ini
修改center_url = 你部署的dem的url 地址
## 文件内的其他参数具体配置可在$DM_HOME/tool/dmagent/readme.pdf--2--2.22里找到相关说明

启动与停止

dmagent 存在两种启动模式

1.运行 start.bat(sh) 脚本启动 dmagent
chmod 777 ./*.sh
./start.sh -d agent.ini
2.运行 service.bat(sh) 脚本安装 dmagent 服务后,通过系统服务命令或者service.bat(sh) 脚本启动 dmagent 服务
chmod 777 ./*.sh
./service.sh install / delete ##安装anegt服务,根据提示填写相应信息 / 删除服务
./service.sh start / stop / status

部署成功后dem的资源监控中可以看到服务器的ip
image.png

dem监视异常时常见agent问题排查

监视异常时可见下图,ip192.168.3.77服务器的连接状态变成了未知
image.png

查看agent运行状态

agent异常时首先要排查的就是服务有没有正常启动,有以下两种方式

1.ps -ef|grep agent.ini 查看有没有agent进程
image.png

2.服务方式启动时,使用service.sh status查看agent服务状态
image.png

日志

观察agent log里是否记录有可用信息,但一般没什么东西
image.png

时间

部署agent的服务器和dem服务器时间不一致也是导致监控状态异常的一大原因,通常要求误差在五分钟以内;建议部署ntp服务,图例的92.168.3.77连接状态异常原因就是时间误差导致的
image.png
image.png

date -s 'xxxx-xx-xx xx:xx:xx'或部署ntp同步时间后重启agent服务

网络

监视机与被监视机之间的网络正常通信自然是服务正常运作的一大前提,在agent服务器上执行tenlet查看,ip和端口使用anegt.ini里的ip和端口
image.png

image.png

dm_svc.conf

agent服务器的/etc/dm_svc.conf文件配置出错时也有可能会导致监控的状态异常,要确保参数描述正确,参数值合理
以下是默认情况下的文件内容,具体参数注释可见$DM_HOME/doc/系统管理员手册--配置文件说明--dm_svc.conf
image.png

关键字被屏蔽 主要针对数据库的资源监控状态异常

image.png
达梦有直接修改dm.ini文件的方式屏蔽关键字,但这种方法会影响到数据库内部的sql,比如agent进程会自动调用sql,sql中包含top关键字,但top关键字被屏蔽了就会导致sql出错,监控异常
下图是dm.ini中屏蔽关键字的参数,要确认是否有值;建议使用修改dm_svc.conf的方式屏蔽关键字
image.png

总结

看anegt程序状态 ps -ef|grep agent.ini service.sh status
看日志 cat AGENT_HOME/log | grep ERROR cat AGENT_HOME/log | grep WARNING
对比时间是否一致 date 五分钟以内,建议部署ntp
检查网络 telnet demip dem端口 ssh -v -p dem端口 demip
检查dm_svc.conf文件配置 cat dm_svc.conf 官方文档-系统管理员手册--2.1.1
检查屏蔽关键字 cat dm.ini | grep EXCLUDE_RESERVED_WORDS 主要针对数据库监控异常

案例

以上图192.168.3.77连接异常为例
image.png

[root@LJF dmagent]# ps -ef|grep agent.ini ##有进程 root 2211 1 0 11:00 ? 00:00:13 java -Xms64m -Xmx2048m -cp /home/dmdba/dmagent/lib/* -Dnoconsole=true -Ddameng.log.file=/home/dmdba/dmagent/log4j.xml -Dagent.home=/home/dmdba/dmagent -Dagent.pid.file=/home/dmdba/dmagent/service/DmAgentService.pid com.dameng.agent.Agent /home/dmdba/dmagent/agent.ini root 3018 1857 0 11:40 pts/0 00:00:00 grep --color=auto agent.ini [root@LJF dmagent]# [root@LJF dmagent]# /home/dmdba/dmagent/service.sh status ##服务状态正常 Redirecting to /bin/systemctl status DmAgentService.service ● DmAgentService.service - Dm Agent Service Loaded: loaded (/usr/lib/systemd/system/DmAgentService.service; enabled; vendor preset: disabled) Active: active (running) since 日 2023-07-23 11:00:20 CST; 40min ago Process: 2103 ExecStop=/home/dmdba/dmagent/service/DmAgentService stop (code=exited, status=0/SUCCESS) Process: 2182 ExecStart=/home/dmdba/dmagent/service/DmAgentService start (code=exited, status=0/SUCCESS) Main PID: 2211 (java) CGroup: /system.slice/DmAgentService.service └─2211 java -Xms64m -Xmx2048m -cp /home/dmdba/dmagent/lib/* -Dnoconsole=true -Ddameng.log.file=/home/dmdba/dmagent/log4j.xml -Dage... 7月 23 11:00:15 LJF systemd[1]: Starting Dm Agent Service... 7月 23 11:00:20 LJF DmAgentService[2182]: Starting dmagent SUCCESS! 7月 23 11:00:20 LJF systemd[1]: Started Dm Agent Service. [root@LJF dmagent]# [root@LJF dmagent]# cat /home/dmdba/dmagent/log/agent.log | grep ERROR ##日志里显示dem拒绝请求,但没有更具体原因 [ERROR - 2023-07-23 10:51:40] http request fail - [ERROR - 2023-07-23 10:51:40] Get system config from center fail! [ERROR - 2023-07-23 11:01:40] http request fail - [root@LJF dmagent]# [root@LJF dmagent]# ssh -v -p 8080 192.168.3.88 ##ip和端口可以通 OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 58: Applying options for * debug1: Connecting to 192.168.3.88 [192.168.3.88] port 8080. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_rsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.4 debug1: ssh_exchange_identification: HTTP/1.1 400 debug1: ssh_exchange_identification: Content-Type: text/html;charset=utf-8 debug1: ssh_exchange_identification: Content-Language: zh-CN debug1: ssh_exchange_identification: Content-Length: 1868 debug1: ssh_exchange_identification: Date: Sun, 23 Jul 2023 03:57:54 GMT debug1: ssh_exchange_identification: Connection: close debug1: ssh_exchange_identification: debug1: ssh_exchange_identification: <!doctype html><html lang="zh"><head><title>HTTP\347\212\266\346\200\201 400 - \351\224\231\350\257\257\347\232\204\350\257\267\346\261\202</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font debug1: ssh_exchange_identification: -size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP\347\212\266\346\200\201 400 - \351\224\231\350\257\257\347\232\204\350\257\267\346\261\202</h1><hr class="line" /><p><b>\347\261\273\345\236\213</b> \345\274\202\345\270\270\346\212\245\345\221\212</p><p><b>\346\266\210\346\201\257</b> \345\234\250\346\226\271\346\263\225\345\220\215\347\247\260\344\270\255 debug1: ssh_exchange_identification: \345\217\221\347\216\260\346\227\240\346\225\210\347\232\204\345\255\227\347\254\246\344\270\262, HTTP \346\226\271\346\263\225\345\220\215\345\277\205\351\241\273\346\230\257\346\234\211\346\225\210\347\232\204\347\254\246\345\217\267.</p><p><b>\346\217\217\350\277\260</b> \347\224\261\344\272\216\350\242\253\350\256\244\344\270\272\346\230\257\345\256\242\346\210\267\347\253\257\345\257\271\351\224\231\350\257\257\357\274\210\344\276\213\345\246\202\357\274\232\347\225\270\345\275\242\347\232\204\350\257\267\346\261\202\350\257\255\346\263\225\343\200\201\346\227\240\346\225\210\347\232\204\350\257\267\346\261\202\344\277\241\346\201\257\345\270\247\346\210\226\350\200\205\350\231\232\346\213\237\347\232\204\350\257\267\346\261\202\350\267\257\347\224\261\357\274\211\357\274\214\346\234\215\345\212\241\345\231\250\346\227\240\346\263\225\346\210\226\344\270\215\344\274\232\345\244\204\347\220\206\345\275\223\345\211\215\350\257\267\346 debug1: ssh_exchange_identification: \261\202\343\200\202</p><p><b>\344\276\213\345\244\226\346\203\205\345\206\265</b></p><pre>java.lang.IllegalArgumentException: \345\234\250\346\226\271\346\263\225\345\220\215\347\247\260\344\270\255\345\217\221\347\216\260\346\227\240\346\225\210\347\232\204\345\255\227\347\254\246\344\270\262, HTTP \346\226\271\346\263\225\345\220\215\345\277\205\351\241\273\346\230\257\346\234\211\346\225\210\347\232\204\347\254\246\345\217\267. debug1: ssh_exchange_identification: org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:434) debug1: ssh_exchange_identification: org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:511) debug1: ssh_exchange_identification: org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) debug1: ssh_exchange_identification: org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:831) debug1: ssh_exchange_identification: org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1651) debug1: ssh_exchange_identification: org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) debug1: ssh_exchange_identification: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) debug1: ssh_exchange_identification: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) debug1: ssh_exchange_identification: org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) debug1: ssh_exchange_identification: java.lang.Thread.run(Thread.java:748) ssh_exchange_identification: Connection closed by remote host [root@LJF dmagent]# [root@LJF dmagent]# [root@LJF dmagent]# [root@LJF dmagent]# [root@LJF dmagent]# cat /etc/dm_svc.conf ##/etc/dm_svc.conf默认内容,无异常参数和参数值 TIME_ZONE=(480) LANGUAGE=(cn) [root@LJF dmagent]# [root@LJF dmagent]# [root@LJF dmagent]# cat /opt/dmdbms/data/DAMENG/dm.ini | grep EXCLUDE_RESERVED_WORDS ##无屏蔽关键字 EXCLUDE_RESERVED_WORDS = #Reserved words to be exclude [root@LJF dmagent]# [root@LJF dmagent]# date ##对比dem服务器时间发现差异 2023年 07月 23日 星期日 11:46:07 CST

dem服务器时间
image.png

可见两台机器时间差异在五分钟以上,所以导致连接异常
修改服务器时间使相同,重启agent服务

[root@LJF dmagent]# date -s '2023-07-23 12:06:00' 2023年 07月 23日 星期日 12:06:00 CST [root@LJF dmagent]# date 2023年 07月 23日 星期日 12:06:01 CST [root@LJF dmagent]# [root@LJF dmagent]# /home/dmdba/dmagent/service.sh stop Redirecting to /bin/systemctl stop DmAgentService.service [root@LJF dmagent]# [root@LJF dmagent]# /home/dmdba/dmagent/service.sh start Redirecting to /bin/systemctl start DmAgentService.service

刷新dem资源监控界面,状态正常
image.png

评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服