Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
javalover123888
SkyWalking
提交
35fde12f
S
SkyWalking
项目概览
javalover123888
/
SkyWalking
与 Fork 源项目一致
Fork自
山不在高_有仙则灵 / SkyWalking
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
35fde12f
编写于
12月 25, 2015
作者:
Z
zhangxin10
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1. 以前邮件模板从数据库读取,目前将邮件模板独立,将邮件模板从告警的配置中读取,
上级
7341f899
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
17 deletion
+20
-17
skywalking-alarm/src/main/java/com/ai/cloud/skywalking/alarm/model/MailInfo.java
...in/java/com/ai/cloud/skywalking/alarm/model/MailInfo.java
+0
-9
skywalking-alarm/src/main/java/com/ai/cloud/skywalking/alarm/procesor/AlarmMessageProcessor.java
...loud/skywalking/alarm/procesor/AlarmMessageProcessor.java
+15
-6
skywalking-alarm/src/main/resources/config.properties
skywalking-alarm/src/main/resources/config.properties
+4
-2
skywalking-alarm/src/main/resources/mail-template.config
skywalking-alarm/src/main/resources/mail-template.config
+1
-0
未找到文件。
skywalking-alarm/src/main/java/com/ai/cloud/skywalking/alarm/model/MailInfo.java
浏览文件 @
35fde12f
...
...
@@ -5,8 +5,6 @@ public class MailInfo {
private
String
[]
mailCc
;
private
String
mailTemp
;
public
String
[]
getMailTo
()
{
return
mailTo
;
}
...
...
@@ -23,11 +21,4 @@ public class MailInfo {
this
.
mailCc
=
mailCc
;
}
public
String
getMailTemp
()
{
return
mailTemp
;
}
public
void
setMailTemp
(
String
mailTemp
)
{
this
.
mailTemp
=
mailTemp
;
}
}
skywalking-alarm/src/main/java/com/ai/cloud/skywalking/alarm/procesor/AlarmMessageProcessor.java
浏览文件 @
35fde12f
package
com.ai.cloud.skywalking.alarm.procesor
;
import
com.ai.cloud.skywalking.alarm.dao.AlarmMessageDao
;
import
com.ai.cloud.skywalking.alarm.model.AlarmRule
;
import
com.ai.cloud.skywalking.alarm.model.ApplicationInfo
;
import
com.ai.cloud.skywalking.alarm.model.MailInfo
;
...
...
@@ -20,13 +19,25 @@ import java.io.StringWriter;
import
java.sql.SQLException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
public
class
AlarmMessageProcessor
{
private
static
Logger
logger
=
LogManager
.
getLogger
(
AlarmMessageProcessor
.
class
);
static
String
mailTemplate
=
""
;
static
{
Properties
properties
=
new
Properties
();
try
{
properties
.
load
(
AlarmMessageProcessor
.
class
.
getResourceAsStream
(
"/mail-template_new.config"
));
mailTemplate
=
properties
.
getProperty
(
"template.default"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
public
void
process
(
UserInfo
userInfo
,
AlarmRule
rule
)
throws
TemplateException
,
IOException
,
SQLException
{
Set
<
String
>
warningTracingIds
=
new
HashSet
<
String
>();
Set
<
String
>
warningMessageKeys
=
new
HashSet
<
String
>();
...
...
@@ -63,9 +74,9 @@ public class AlarmMessageProcessor {
rule
.
getPreviousFireTimeM
()
*
10000
*
6
)));
parameter
.
put
(
"endDate"
,
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
(
currentFireMinuteTime
*
10000
*
6
)));
String
mailContext
=
generateContent
(
rule
String
mailContext
=
generateContent
(
/*
rule
.getConfigArgsDescriber().getMailInfo()
.
getMailTemp
(),
parameter
);
.getMailTemp()
*/
mailTemplate
,
parameter
);
if
(
mailContext
.
length
()
>
0
)
{
MailInfo
mailInfo
=
rule
.
getConfigArgsDescriber
()
.
getMailInfo
();
...
...
@@ -142,6 +153,4 @@ public class AlarmMessageProcessor {
t
.
process
(
parameter
,
out
);
return
out
.
getBuffer
().
toString
();
}
private
static
Map
<
String
,
String
>
idCodeMapper
=
new
ConcurrentHashMap
<
String
,
String
>();
}
skywalking-alarm/src/main/resources/config.properties
浏览文件 @
35fde12f
...
...
@@ -7,7 +7,8 @@ server.daemon_thread_wait_interval=50000
processthread.thread_wait_interval
=
5000
#zookeeper连接地址
zkpath.connect_str
=
10.1.241.18:29181,10.1.241.19:29181,10.1.241.20:29181
#zkpath.connect_str=10.1.241.18:29181,10.1.241.19:29181,10.1.241.20:29181
zkpath.connect_str
=
127.0.0.1:29181
#zookeeper连接超时时间(单位:毫秒)
zkpath.connect_timeout
=
1000
#zookeeper重试次数
...
...
@@ -46,7 +47,8 @@ db.max_pool_size=20
db.connect_timeout
=
10000
#告警信息存在的redis服务器地址
alarm.redis_server
=
10.1.241.18:16379
#alarm.redis_server=10.1.241.18:16379
alarm.redis_server
=
127.0.0.1:6379
#redis的最大空闲连接数
alarm.redis_max_idle
=
20
#redis的最小空闲连接数
...
...
skywalking-alarm/src/main/resources/mail-template.config
0 → 100644
浏览文件 @
35fde12f
template
.
default
=<!
DOCTYPE
html
PUBLIC
\
"-//W3C//DTD XHTML 1.0 Transitional//EN\"
\
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"
><
html
xmlns
=\
"http://www.w3.org/1999/xhtml\"
><
head
><
meta
http
-
equiv
=\
"Content-Type\"
content
=\
"text/html; charset=utf-8\"
><
style
type
=\
"text/css\"
>
li
{
text
-
indent
:
2
em
}</
style
><
title
>
templete1_welcome
</
title
></
head
><
body
style
=\
"background:#eee;\"
><
table
width
=\
"80%\"
cellpadding
=\
"0\"
cellspacing
=\
"0\"
border
=\
"0\"
style
=\
"text-align:left;font:12px/15px simsun; line-height:20px; color:#000;background:#fff; padding:30px 20px; border:20px solid #fff; margin:0 auto;\"
><
tbody
><
tr
><
td
style
=\
"margin:0; padding:0;\"
><
div
style
=\
"background:#f9f9f9; padding:25px; font-family: \u5fae\u8f6f\u96c5\u9ed1, \u9ed1\u4f53, Arial; font-size:14px; line-height:25px; margin:5px 0; overflow:hidden;\"
><
p
>\
u5c0a
\
u656c
\
u7684SkyWalking
\
u7528
\
u6237
\
u60a8
\
u597d
:</
p
><
p
>\
u81ea
<
b
>${
startDate
!}</
b
>\
u8d77
\
uff0c
\
u5230
<
b
>${
endDate
!}</
b
>\
u6b62
\
uff0c
\
u5e73
\
u53f0
\
u63a5
\
u6536
\
u5230
\
u76d1
\
u63a7
\
u544a
\
u8b66
\
u4fe1
\
u606f
\
u5982
\
u4e0b
\
uff1a
</
p
><
p
><
#
if
warningTracingIds
??><
#
list
warningTracingIds
as
traceId
><
li
><
a
href
=\
"${(portalAddr + traceId)!}\"
>${
traceId
!}</
a
></
li
></
#
list
></
#
if
></
p
></
div
></
td
></
tr
></
tbody
></
table
></
body
></
html
>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录