Open lyongdee opened 1 year ago
你好: 你可以这样验证下脚本是否被系统调用执行,你在脚本中把告警内容先输出到一个文件里
Good Luck
WGCLOUD
------------------ 原始邮件 ------------------ 发件人: "tianshiyeben/wgcloud" @.>; 发送时间: 2023年4月24日(星期一) 晚上8:34 @.>; @.***>; 主题: [tianshiyeben/wgcloud] 未触发告警脚本 (Issue #78)
1、Windows 服务器 2、server 日志,正常 2023-04-24 20:28:47.440 [main] INFO com.wgcloud.WgcloudServiceApplication - Starting WgcloudServiceApplication vrelease using Java 1.8.0_341 on WIN-JIQHK8EHO32 with PID 20640 (D:\Sft\wgcloud\server\wgcloud-server-release.jar started by Administrator in D:\Sft\wgcloud\server) 2023-04-24 20:28:47.446 [main] INFO com.wgcloud.WgcloudServiceApplication - No active profile set, falling back to 1 default profile: "default" 2023-04-24 20:28:48.976 [main] INFO o.s.boot.web.embedded.tomcat.TomcatWebServer - Tomcat initialized with port(s): 11004 (http) 2023-04-24 20:28:48.987 [main] INFO org.apache.catalina.core.StandardService - Starting service [Tomcat] 2023-04-24 20:28:48.988 [main] INFO org.apache.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.60] 2023-04-24 20:28:49.136 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/wgcloud] - Initializing Spring embedded WebApplicationContext 2023-04-24 20:28:49.137 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 1619 ms 2023-04-24 20:28:49.662 [main] WARN com.zaxxer.hikari.HikariConfig - HikariPool-1 - idleTimeout has been set but has no effect because the pool is operating as a fixed size pool. 2023-04-24 20:28:49.665 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting... 2023-04-24 20:28:49.670 [main] WARN com.zaxxer.hikari.util.DriverDataSource - Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation. 2023-04-24 20:28:49.877 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed. 2023-04-24 20:28:51.010 [main] INFO com.wgcloud.util.IdGeneratorSnowflake - 当前机器的workerId: 0 2023-04-24 20:28:51.368 [main] INFO o.s.b.a.web.servlet.WelcomePageHandlerMapping - Adding welcome page template: index 2023-04-24 20:28:51.707 [main] INFO o.s.boot.web.embedded.tomcat.TomcatWebServer - Tomcat started on port(s): 11004 (http) with context path '/wgcloud' 2023-04-24 20:28:51.722 [main] INFO com.wgcloud.WgcloudServiceApplication - Started WgcloudServiceApplication in 5.111 seconds (JVM running for 5.616) 2023-04-24 20:28:51.735 [main] INFO com.wgcloud.common.ApplicationStartListener - NettyServer服务启动,端口:9998 2023-04-24 20:28:52.929 [http-nio-11004-exec-1] INFO o.a.c.c.C.[Tomcat].[localhost].[/wgcloud] - Initializing Spring DispatcherServlet 'dispatcherServlet' 2023-04-24 20:28:52.929 [http-nio-11004-exec-1] INFO org.springframework.web.servlet.DispatcherServlet - Initializing Servlet 'dispatcherServlet' 2023-04-24 20:28:52.931 [http-nio-11004-exec-1] INFO org.springframework.web.servlet.DispatcherServlet - Completed initialization in 2 ms 2023-04-24 20:28:56.721 [taskScheduler-2] INFO com.wgcloud.task.ScheduledTask - validateLicense------------2023-04-24 20:28:56 2023-04-24 20:28:56.967 [taskScheduler-2] INFO com.wgcloud.util.license.LicenseUtil - 未检测到授权文件---------------- 2023-04-24 20:28:56.967 [taskScheduler-2] INFO com.wgcloud.util.license.LicenseUtil - 没有检测到授权文件/server/license.txt,当前版本重置为个人版。个人版免费,不需要授权文件,请放心使用。如果您需要专业版,请联系我们 www.wgstart.com 2023-04-24 20:29:00.721 [taskScheduler-1] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:29:00 2023-04-24 20:29:00.849 [taskScheduler-1] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:29:00 2023-04-24 20:29:06.719 [taskScheduler-3] INFO com.wgcloud.task.ScheduledTask - sumDiskSizeCacheTask------------2023-04-24 20:29:06 2023-04-24 20:29:09.719 [taskScheduler-4] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:29:09 2023-04-24 20:29:09.725 [taskScheduler-4] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:29:09 2023-04-24 20:29:11.719 [taskScheduler-5] INFO com.wgcloud.task.ScheduledTask - initTask------------2023-04-24 20:29:11 2023-04-24 20:29:18.720 [taskScheduler-6] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:29:18 2023-04-24 20:29:18.724 [taskScheduler-6] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:29:18 2023-04-24 20:29:27.719 [taskScheduler-8] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:29:27 2023-04-24 20:29:27.721 [taskScheduler-8] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:29:27 2023-04-24 20:29:36.720 [taskScheduler-10] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:29:36 2023-04-24 20:29:36.722 [taskScheduler-10] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:29:36 2023-04-24 20:29:45.720 [taskScheduler-12] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:29:45 2023-04-24 20:29:45.722 [taskScheduler-12] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:29:45 2023-04-24 20:29:51.719 [taskScheduler-11] INFO com.wgcloud.task.ScheduledTask - heathMonitorTask------------2023-04-24 20:29:51 2023-04-24 20:29:54.720 [taskScheduler-13] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:29:54 2023-04-24 20:29:54.723 [taskScheduler-13] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:29:54 2023-04-24 20:30:03.719 [taskScheduler-2] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:30:03 2023-04-24 20:30:03.721 [taskScheduler-2] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:30:03 2023-04-24 20:30:12.719 [taskScheduler-1] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:30:12 2023-04-24 20:30:12.722 [taskScheduler-1] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:30:12 2023-04-24 20:30:21.721 [taskScheduler-15] INFO com.wgcloud.task.ScheduledTask - dceInfoTask------------2023-04-24 20:30:21 2023-04-24 20:30:21.721 [taskScheduler-14] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:30:21 2023-04-24 20:30:21.721 [taskScheduler-14] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:30:21 2023-04-24 20:30:30.719 [taskScheduler-17] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:30:30 2023-04-24 20:30:30.721 [taskScheduler-17] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:30:30 2023-04-24 20:30:39.719 [taskScheduler-18] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:30:39 2023-04-24 20:30:39.721 [taskScheduler-18] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:30:39 2023-04-24 20:30:48.721 [taskScheduler-19] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:30:48 2023-04-24 20:30:48.722 [taskScheduler-19] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:30:48 2023-04-24 20:30:51.720 [taskScheduler-4] INFO com.wgcloud.task.ScheduledTask - tableCountTask------------2023-04-24 20:30:51 2023-04-24 20:30:57.720 [taskScheduler-6] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:30:57 2023-04-24 20:30:57.814 [taskScheduler-6] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:30:57 2023-04-24 20:31:06.719 [taskScheduler-8] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:31:06 2023-04-24 20:31:06.720 [taskScheduler-8] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:31:06 3、server application.yml 配置 warnCronTime: '1 0/2 * ?' warnScript: D:/Sft/wgcloud/warning.bat 4、warning.bat @echo off echo warning content is: %1 curl -X POST -H "Content-Type:application/json" --data "{\"msgtype\":\"text\",\"text\":{\"content\":\"告警:%1\"},\"at\":{\"isAtAll\":true}}" "https://oapi.dingtalk.com/robot/send?access_token=xxx" pause 单独执行 warning.bat 是正常的。
请问下是哪里的问题呢?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>
@tianshiyeben bat脚本己输出至文本,观察了半小时,wgcloud没有日志输出。手动执行正常。
端口监控列表示例:
application.yml
warnCronTime: '1 0/2 * ?'
warnScript: D:/Sft/wgcloud/warning.bat
你有没有在server配置文件中,这里配置告警脚本
Good Luck
WGCLOUD
------------------ 原始邮件 ------------------ 发件人: "tianshiyeben/wgcloud" @.>; 发送时间: 2023年4月25日(星期二) 晚上9:22 @.>; @.**@.>; 主题: Re: [tianshiyeben/wgcloud] 未触发告警脚本 (Issue #78)
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
@tianshiyeben 有的,在 application.yml 里配置了,是这样吗。
是这样的,看着没问题,或者你可以进入到qq群问问
Good Luck
WGCLOUD
------------------ 原始邮件 ------------------ 发件人: "tianshiyeben/wgcloud" @.>; 发送时间: 2023年4月26日(星期三) 下午2:04 @.>; @.**@.>; 主题: Re: [tianshiyeben/wgcloud] 未触发告警脚本 (Issue #78)
@tianshiyeben 有的,在 application.yml 里配置了,是这样吗。
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
@tianshiyeben 还是没有跟踪到问题呢。再请教下,告警的执行,在日志列表会有记录吗。
1、Windows 服务器
2、server 日志,正常
2023-04-24 20:28:47.440 [main] INFO com.wgcloud.WgcloudServiceApplication - Starting WgcloudServiceApplication vrelease using Java 1.8.0_341 on WIN-JIQHK8EHO32 with PID 20640 (D:\Sft\wgcloud\server\wgcloud-server-release.jar started by Administrator in D:\Sft\wgcloud\server) 2023-04-24 20:28:47.446 [main] INFO com.wgcloud.WgcloudServiceApplication - No active profile set, falling back to 1 default profile: "default" 2023-04-24 20:28:48.976 [main] INFO o.s.boot.web.embedded.tomcat.TomcatWebServer - Tomcat initialized with port(s): 11004 (http) 2023-04-24 20:28:48.987 [main] INFO org.apache.catalina.core.StandardService - Starting service [Tomcat] 2023-04-24 20:28:48.988 [main] INFO org.apache.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.60] 2023-04-24 20:28:49.136 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/wgcloud] - Initializing Spring embedded WebApplicationContext 2023-04-24 20:28:49.137 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 1619 ms 2023-04-24 20:28:49.662 [main] WARN com.zaxxer.hikari.HikariConfig - HikariPool-1 - idleTimeout has been set but has no effect because the pool is operating as a fixed size pool. 2023-04-24 20:28:49.665 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting... 2023-04-24 20:28:49.670 [main] WARN com.zaxxer.hikari.util.DriverDataSource - Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation. 2023-04-24 20:28:49.877 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed. 2023-04-24 20:28:51.010 [main] INFO com.wgcloud.util.IdGeneratorSnowflake - 当前机器的workerId: 0 2023-04-24 20:28:51.368 [main] INFO o.s.b.a.web.servlet.WelcomePageHandlerMapping - Adding welcome page template: index 2023-04-24 20:28:51.707 [main] INFO o.s.boot.web.embedded.tomcat.TomcatWebServer - Tomcat started on port(s): 11004 (http) with context path '/wgcloud' 2023-04-24 20:28:51.722 [main] INFO com.wgcloud.WgcloudServiceApplication - Started WgcloudServiceApplication in 5.111 seconds (JVM running for 5.616) 2023-04-24 20:28:51.735 [main] INFO com.wgcloud.common.ApplicationStartListener - NettyServer服务启动,端口:9998 2023-04-24 20:28:52.929 [http-nio-11004-exec-1] INFO o.a.c.c.C.[Tomcat].[localhost].[/wgcloud] - Initializing Spring DispatcherServlet 'dispatcherServlet' 2023-04-24 20:28:52.929 [http-nio-11004-exec-1] INFO org.springframework.web.servlet.DispatcherServlet - Initializing Servlet 'dispatcherServlet' 2023-04-24 20:28:52.931 [http-nio-11004-exec-1] INFO org.springframework.web.servlet.DispatcherServlet - Completed initialization in 2 ms 2023-04-24 20:28:56.721 [taskScheduler-2] INFO com.wgcloud.task.ScheduledTask - validateLicense------------2023-04-24 20:28:56 2023-04-24 20:28:56.967 [taskScheduler-2] INFO com.wgcloud.util.license.LicenseUtil - 未检测到授权文件---------------- 2023-04-24 20:28:56.967 [taskScheduler-2] INFO com.wgcloud.util.license.LicenseUtil - 没有检测到授权文件/server/license.txt,当前版本重置为个人版。个人版免费,不需要授权文件,请放心使用。如果您需要专业版,请联系我们 www.wgstart.com 2023-04-24 20:29:00.721 [taskScheduler-1] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:29:00 2023-04-24 20:29:00.849 [taskScheduler-1] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:29:00 2023-04-24 20:29:06.719 [taskScheduler-3] INFO com.wgcloud.task.ScheduledTask - sumDiskSizeCacheTask------------2023-04-24 20:29:06 2023-04-24 20:29:09.719 [taskScheduler-4] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:29:09 2023-04-24 20:29:09.725 [taskScheduler-4] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:29:09 2023-04-24 20:29:11.719 [taskScheduler-5] INFO com.wgcloud.task.ScheduledTask - initTask------------2023-04-24 20:29:11 2023-04-24 20:29:18.720 [taskScheduler-6] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:29:18 2023-04-24 20:29:18.724 [taskScheduler-6] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:29:18 2023-04-24 20:29:27.719 [taskScheduler-8] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:29:27 2023-04-24 20:29:27.721 [taskScheduler-8] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:29:27 2023-04-24 20:29:36.720 [taskScheduler-10] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:29:36 2023-04-24 20:29:36.722 [taskScheduler-10] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:29:36 2023-04-24 20:29:45.720 [taskScheduler-12] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:29:45 2023-04-24 20:29:45.722 [taskScheduler-12] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:29:45 2023-04-24 20:29:51.719 [taskScheduler-11] INFO com.wgcloud.task.ScheduledTask - heathMonitorTask------------2023-04-24 20:29:51 2023-04-24 20:29:54.720 [taskScheduler-13] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:29:54 2023-04-24 20:29:54.723 [taskScheduler-13] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:29:54 2023-04-24 20:30:03.719 [taskScheduler-2] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:30:03 2023-04-24 20:30:03.721 [taskScheduler-2] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:30:03 2023-04-24 20:30:12.719 [taskScheduler-1] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:30:12 2023-04-24 20:30:12.722 [taskScheduler-1] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:30:12 2023-04-24 20:30:21.721 [taskScheduler-15] INFO com.wgcloud.task.ScheduledTask - dceInfoTask------------2023-04-24 20:30:21 2023-04-24 20:30:21.721 [taskScheduler-14] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:30:21 2023-04-24 20:30:21.721 [taskScheduler-14] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:30:21 2023-04-24 20:30:30.719 [taskScheduler-17] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:30:30 2023-04-24 20:30:30.721 [taskScheduler-17] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:30:30 2023-04-24 20:30:39.719 [taskScheduler-18] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:30:39 2023-04-24 20:30:39.721 [taskScheduler-18] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:30:39 2023-04-24 20:30:48.721 [taskScheduler-19] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:30:48 2023-04-24 20:30:48.722 [taskScheduler-19] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:30:48 2023-04-24 20:30:51.720 [taskScheduler-4] INFO com.wgcloud.task.ScheduledTask - tableCountTask------------2023-04-24 20:30:51 2023-04-24 20:30:57.720 [taskScheduler-6] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:30:57 2023-04-24 20:30:57.814 [taskScheduler-6] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:30:57 2023-04-24 20:31:06.719 [taskScheduler-8] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务开始----------2023-04-24 20:31:06 2023-04-24 20:31:06.720 [taskScheduler-8] INFO com.wgcloud.task.DataScheduledTask - 批量提交监控数据任务结束----------2023-04-24 20:31:06
3、server application.yml 配置,只改了两个地方触发cron和脚本目录 ` warnCronTime: '1 0/2 * ?'
warnScript: D:/Sft/wgcloud/warning.bat `
4、warning.bat
@echo off echo warning content is: %1 curl -X POST -H "Content-Type:application/json" --data "{\"msgtype\":\"text\",\"text\":{\"content\":\"告警:%1\"},\"at\":{\"isAtAll\":true}}" "https://oapi.dingtalk.com/robot/send?access_token=xxx" pause
单独执行 warning.bat 是正常的。
手动设置了1个端口异常监听,一直没有触发,日志也正常,请问下是哪里的问题呢?