Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

日志监控支持企业微信、钉钉报警吗? #51

Open
nd230 opened this issue Aug 3, 2022 · 19 comments
Open

日志监控支持企业微信、钉钉报警吗? #51

nd230 opened this issue Aug 3, 2022 · 19 comments

Comments

@nd230
Copy link

nd230 commented Aug 3, 2022

日志监控支持企业微信、钉钉报警吗?是不是只有主机监控才支持报警。

@tianshiyeben
Copy link
Owner

tianshiyeben commented Aug 3, 2022 via email

@nd230
Copy link
Author

nd230 commented Aug 3, 2022

你好,我用企业微信机器人用类似钉钉机器人的bat脚本写了个bat,调整了application.yml,业重启了服务端,日志更新后没有报警
@echo off
echo warn content is : %1
set timeHour=%time:~0,2%
set timeMin=%time:~3,2%
set timeSec=%time:~6,2%
set content="WARNING: %timeHour%:%timeMin%:%timeSec%, %1"
set content=%content:"=%
set weixin_url="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx"
curl -H "Content-Type: application/json" -d "{"content":"%content%"}" -s %weixin_url%

@tianshiyeben
Copy link
Owner

tianshiyeben commented Aug 3, 2022 via email

@nd230
Copy link
Author

nd230 commented Aug 3, 2022

手动执行可以发测试消息,不过部署到application.yml就没反应了

@tianshiyeben
Copy link
Owner

tianshiyeben commented Aug 3, 2022 via email

@nd230
Copy link
Author

nd230 commented Aug 3, 2022

2022-08-03 10:26:17.474 [pool-1-thread-4] ERROR com.wgcloud.util.ExecUtil - ?????????
java.io.IOException: Cannot run program "E:\Downloads\wgcloud-v3.3.9\server\weixinbot.bat": CreateProcess error=206, ??????????
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at com.wgcloud.util.ExecUtil.runScript(ExecUtil.java:41)
at com.wgcloud.util.msg.WarnMailUtil.sendUtil(WarnMailUtil.java:1008)
at com.wgcloud.util.msg.WarnMailUtil.sendFileWarnDown(WarnMailUtil.java:935)
at com.wgcloud.controller.AgentLogGoController.lambda$minTask$0(AgentLogGoController.java:109)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: CreateProcess error=206, ??????????
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 11 common frames omitted

@tianshiyeben
Copy link
Owner

tianshiyeben commented Aug 3, 2022 via email

@nd230
Copy link
Author

nd230 commented Aug 3, 2022

好像就是?号
图片

@tianshiyeben
Copy link
Owner

tianshiyeben commented Aug 3, 2022 via email

@nd230
Copy link
Author

nd230 commented Aug 3, 2022

如果监控周期内日志监控数据或日志条数太多了,是不是会报错,推不出来

1 similar comment
@nd230
Copy link
Author

nd230 commented Aug 3, 2022

如果监控周期内日志监控数据或日志条数太多了,是不是会报错,推不出来

@nd230
Copy link
Author

nd230 commented Aug 3, 2022

版本是server 2016

@nd230
Copy link
Author

nd230 commented Aug 5, 2022

测试了下用curl发送长度有限制,同时微信机器人也有长度限制,超过了就报错了,建议日志可以按行拆分下,或者发送报警时控制下发送内容长度,超过了可以拆分成几个告警发送。

@tianshiyeben
Copy link
Owner

tianshiyeben commented Aug 5, 2022 via email

@nd230
Copy link
Author

nd230 commented Aug 5, 2022

curl超过1024字节可能就有问题,微信机器人直接限制5120字节
图片

@tianshiyeben
Copy link
Owner

tianshiyeben commented Aug 5, 2022 via email

@nd230
Copy link
Author

nd230 commented Aug 8, 2022

bat脚本,我部署在win2016上。

@tianshiyeben
Copy link
Owner

tianshiyeben commented Oct 11, 2022 via email

@nd230
Copy link
Author

nd230 commented Oct 16, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants