Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
javalover123888
SkyWalking
提交
04fa404e
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,发现更多精彩内容 >>
提交
04fa404e
编写于
12月 24, 2015
作者:
Z
zhangxin10
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.启动脚本中添加监控信息
2. 修复发送邮件bug,不缓存Transport和session对象
上级
a2714223
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
23 deletion
+33
-23
skywalking-alarm/bin/sw-alarm-server.sh
skywalking-alarm/bin/sw-alarm-server.sh
+3
-1
skywalking-alarm/pom.xml
skywalking-alarm/pom.xml
+1
-1
skywalking-alarm/src/main/java/com/ai/cloud/skywalking/alarm/util/MailUtil.java
...ain/java/com/ai/cloud/skywalking/alarm/util/MailUtil.java
+22
-14
skywalking-alarm/src/main/resources/config.properties
skywalking-alarm/src/main/resources/config.properties
+7
-7
未找到文件。
skywalking-alarm/bin/sw-alarm-server.sh
浏览文件 @
04fa404e
...
...
@@ -46,4 +46,6 @@ done
echo
"CLASSPATH=
$CLASSPATH
"
$JAVA
-classpath
$CLASSPATH
com.ai.cloud.skywalking.alarm.AlarmProcessServer
>>
${
SW_ALARM_ALARM_SERVER_BIN_DIR
}
/../log/sw-alarm-server.log & 2>&1&
JAVA_OPTS
=
"
$JAVA_OPTS
-Djava.rmi.server.hostname=10.1.241.16 -Dcom.sun.management.jmxremote.port=28999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
$JAVA
${
JAVA_OPTS
}
-classpath
$CLASSPATH
com.ai.cloud.skywalking.alarm.AlarmProcessServer
>>
${
SW_ALARM_ALARM_SERVER_BIN_DIR
}
/../log/sw-alarm-server.log & 2>&1&
skywalking-alarm/pom.xml
浏览文件 @
04fa404e
...
...
@@ -143,7 +143,7 @@
<exclude>
*.properties
</exclude>
<exclude>
*.xml
</exclude>
</excludes>
<finalName>
sky-
walking
-server
</finalName>
<finalName>
sky-
alarm
-server
</finalName>
<outputDirectory>
${project.build.directory}/installer/lib
</outputDirectory>
</configuration>
</plugin>
...
...
skywalking-alarm/src/main/java/com/ai/cloud/skywalking/alarm/util/MailUtil.java
浏览文件 @
04fa404e
...
...
@@ -16,19 +16,14 @@ public class MailUtil {
private
static
Logger
logger
=
LogManager
.
getLogger
(
MailUtil
.
class
);
private
static
Session
session
;
private
static
String
sendAccount
;
private
static
Transport
ts
;
private
static
Properties
config
;
static
{
try
{
String
senderInfo
=
SystemConfigDao
.
getSystemConfig
(
Config
.
MailSenderInfo
.
configId
);
Properties
prop
=
new
Gson
().
fromJson
(
senderInfo
,
Properties
.
class
);
session
=
Session
.
getInstance
(
prop
);
ts
=
session
.
getTransport
();
ts
.
connect
(
prop
.
getProperty
(
"mail.host"
),
prop
.
getProperty
(
"mail.username"
),
prop
.
getProperty
(
"mail.password"
));
sendAccount
=
prop
.
getProperty
(
"mail.username"
)
+
prop
.
getProperty
(
"mail.account.prefix"
);
config
=
new
Gson
().
fromJson
(
senderInfo
,
Properties
.
class
);
sendAccount
=
config
.
getProperty
(
"mail.username"
)
+
config
.
getProperty
(
"mail.account.prefix"
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"Failed to connect the mail System."
,
e
);
System
.
exit
(-
1
);
...
...
@@ -37,7 +32,11 @@ public class MailUtil {
public
static
void
sendMail
(
String
[]
recipientAccounts
,
String
[]
ccList
,
String
content
,
String
title
)
{
Session
session
=
Session
.
getInstance
(
config
);
Transport
ts
=
null
;
try
{
ts
=
session
.
getTransport
();
ts
.
connect
(
config
.
getProperty
(
"mail.host"
),
config
.
getProperty
(
"mail.username"
),
config
.
getProperty
(
"mail.password"
));
MimeMessage
message
=
new
MimeMessage
(
session
);
message
.
setFrom
(
new
InternetAddress
(
sendAccount
));
InternetAddress
[]
recipientAccountArray
=
new
InternetAddress
[
recipientAccounts
.
length
];
...
...
@@ -45,23 +44,32 @@ public class MailUtil {
recipientAccountArray
[
i
]
=
new
InternetAddress
(
recipientAccounts
[
i
]);
}
message
.
addRecipients
(
Message
.
RecipientType
.
TO
,
recipientAccountArray
);
InternetAddress
[]
ccAccountArray
=
new
InternetAddress
[
ccList
.
length
];
for
(
int
i
=
0
;
i
<
ccList
.
length
;
i
++)
{
ccAccountArray
[
i
]
=
new
InternetAddress
(
ccList
[
i
]);
if
(
ccList
!=
null
&&
ccList
.
length
>
0
)
{
InternetAddress
[]
ccAccountArray
=
new
InternetAddress
[
ccList
.
length
];
for
(
int
i
=
0
;
i
<
ccList
.
length
;
i
++)
{
ccAccountArray
[
i
]
=
new
InternetAddress
(
ccList
[
i
]);
}
message
.
addRecipients
(
Message
.
RecipientType
.
CC
,
ccAccountArray
);
}
message
.
addRecipients
(
Message
.
RecipientType
.
CC
,
ccAccountArray
);
message
.
setSubject
(
title
);
message
.
setContent
(
content
,
"text/html;charset=UTF-8"
);
ts
.
sendMessage
(
message
,
message
.
getAllRecipients
());
}
catch
(
AddressException
e
)
{
logger
.
error
(
"Recipient Account is not correct."
,
e
);
}
catch
(
NoSuchProviderException
e
)
{
logger
.
error
(
"Failed to send mail."
,
e
);
}
catch
(
MessagingException
e
)
{
logger
.
error
(
"Failed to send mail."
,
e
);
}
finally
{
if
(
ts
!=
null
)
{
try
{
ts
.
close
();
}
catch
(
MessagingException
e
)
{
logger
.
error
(
"Failed to close transport."
,
e
);
}
}
}
}
...
...
skywalking-alarm/src/main/resources/config.properties
浏览文件 @
04fa404e
...
...
@@ -7,7 +7,7 @@ server.daemon_thread_wait_interval=50000
processthread.thread_wait_interval
=
5000
#zookeeper连接地址
zkpath.connect_str
=
10.1.2
35.197:29181,10.1.235.198:29181,10.1.235.199
:29181
zkpath.connect_str
=
10.1.2
41.18:29181,10.1.241.19:29181,10.1.241.20
:29181
#zookeeper连接超时时间(单位:毫秒)
zkpath.connect_timeout
=
1000
#zookeeper重试次数
...
...
@@ -33,11 +33,11 @@ coordinator.check_all_process_thread_interval=500
#数据库驱动类
db.driver_class
=
com.mysql.jdbc.Driver
#数据库连接地址
db.url
=
jdbc:mysql://10.1.2
28.202:31316/test
db.url
=
jdbc:mysql://10.1.2
41.20:31306/sw_db
#数据库用户名
db.user_name
=
devrdbusr2
1
db.user_name
=
sw_dbusr0
1
#数据库密码
db.password
=
devrdbusr2
1
db.password
=
sw_dbusr0
1
#数据库连接最大空闲数
db.max_idle
=
1
#数据库最大连接数
...
...
@@ -46,13 +46,13 @@ db.max_pool_size=20
db.connect_timeout
=
10000
#告警信息存在的redis服务器地址
alarm.redis_server
=
10.1.2
35.197:4
6379
alarm.redis_server
=
10.1.2
41.18:1
6379
#redis的最大空闲连接数
alarm.redis_max_idle
=
5
alarm.redis_max_idle
=
20
#redis的最小空闲连接数
alarm.redis_min_idle
=
1
#redis最大连接数
alarm.redis_max_total
=
2
0
alarm.redis_max_total
=
5
0
#是否关闭告警发送
alarm.alarm_off_flag
=
false
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录