DolphinScheduler告警
[toc]
# 如何创建告警插件以及告警组
用户需要创建告警实例,在创建告警实例时,需要选择告警策略,有三个选项,成功发、失败发,以及成功和失败都发。在执行完工作流或任务时,如果触发告警,调用告警实例发送方法会进行逻辑判断,将告警实例与任务状态进行匹配,匹配则执行该告警实例发送逻辑,不匹配则过滤。创建完告警实例后,需要同告警组进行关联,一个告警组可以使用多个告警实例。 告警模块支持场景如下:
使用步骤如下:
首先需要进入到安全中心,选择告警组管理,然后点击左侧的告警实例管理,然后创建一个告警实例,然后选择对应的告警插件,填写相关告警参数。
然后选择告警组管理,创建告警组,选择相应的告警实例即可。
# 在执行时配置告警组
配置通知策略
和告警组
,并执行
通知策略设置为成功或失败都发,这样方便测试,执行后会收到邮件通知。
如果没有发送成功可以在部署alert-server
的机器上查看日志
具体日志目录dolphinscheduler/alert-server/logs
[ERROR] 2023-03-25 04:19:46.357 +0000 org.apache.dolphinscheduler.plugin.alert.email.MailSender:[400] - Send email to [xxxx@qq.com] failed
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.qq.com:465
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1469)
at org.apache.commons.mail.Email.send(Email.java:1496)
at org.apache.dolphinscheduler.plugin.alert.email.MailSender.getStringObjectMap(MailSender.java:372)
at org.apache.dolphinscheduler.plugin.alert.email.MailSender.sendMails(MailSender.java:187)
at org.apache.dolphinscheduler.plugin.alert.email.MailSender.sendMails(MailSender.java:141)
at org.apache.dolphinscheduler.plugin.alert.email.EmailAlertChannel.process(EmailAlertChannel.java:42)
at org.apache.dolphinscheduler.alert.AlertSenderService.alertResultHandler(AlertSenderService.java:257)
at org.apache.dolphinscheduler.alert.AlertSenderService.send(AlertSenderService.java:114)
at org.apache.dolphinscheduler.alert.AlertSenderService.run(AlertSenderService.java:81)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.qq.com, port: 465, response: -1
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2197)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:740)
at javax.mail.Service.connect(Service.java:388)
at javax.mail.Service.connect(Service.java:246)
at javax.mail.Service.connect(Service.java:195)
at javax.mail.Transport.send0(Transport.java:254)
at javax.mail.Transport.send(Transport.java:124)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1459)
... 8 common frames omitted
[INFO] 2023-03-25 04:19:46.364 +0000 org.apache.dolphinscheduler.plugin.alert.email.EmailAlertChannel:[61] - alert send error : alert send error.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
上次更新: 2023/05/11, 15:51:39