parent
a271422353
commit
04fa404e88
|
|
@ -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&
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ server.daemon_thread_wait_interval=50000
|
|||
processthread.thread_wait_interval=5000
|
||||
|
||||
#zookeeper连接地址
|
||||
zkpath.connect_str=10.1.235.197:29181,10.1.235.198:29181,10.1.235.199:29181
|
||||
zkpath.connect_str=10.1.241.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.228.202:31316/test
|
||||
db.url=jdbc:mysql://10.1.241.20:31306/sw_db
|
||||
#数据库用户名
|
||||
db.user_name=devrdbusr21
|
||||
db.user_name=sw_dbusr01
|
||||
#数据库密码
|
||||
db.password=devrdbusr21
|
||||
db.password=sw_dbusr01
|
||||
#数据库连接最大空闲数
|
||||
db.max_idle=1
|
||||
#数据库最大连接数
|
||||
|
|
@ -46,13 +46,13 @@ db.max_pool_size=20
|
|||
db.connect_timeout=10000
|
||||
|
||||
#告警信息存在的redis服务器地址
|
||||
alarm.redis_server=10.1.235.197:46379
|
||||
alarm.redis_server=10.1.241.18:16379
|
||||
#redis的最大空闲连接数
|
||||
alarm.redis_max_idle=5
|
||||
alarm.redis_max_idle=20
|
||||
#redis的最小空闲连接数
|
||||
alarm.redis_min_idle=1
|
||||
#redis最大连接数
|
||||
alarm.redis_max_total=20
|
||||
alarm.redis_max_total=50
|
||||
#是否关闭告警发送
|
||||
alarm.alarm_off_flag=false
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue