Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PRMS
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhengfunan
PRMS
Commits
46c72c5e
Commit
46c72c5e
authored
Jan 25, 2021
by
gaozhentao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信告警修改完成
parent
93b70999
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
+13
-10
InitAscynTaskThreadPoolConfig.java
...om/yingxin/prms/config/InitAscynTaskThreadPoolConfig.java
+7
-1
AlarmTask.java
...in/java/com/yingxin/prms/service/asyncTask/AlarmTask.java
+3
-7
application.yml
src/main/resources/application.yml
+3
-2
No files found.
src/main/java/com/yingxin/prms/config/InitAscynTaskThreadPoolConfig.java
View file @
46c72c5e
...
...
@@ -21,6 +21,9 @@ public class InitAscynTaskThreadPoolConfig {
@Value
(
"${ascynTaskThreadPool.maxPoolSize}"
)
private
int
MAX_POOL_SIZE
;
@Value
(
"${ascynTaskThreadPool.queueCapacity}"
)
private
int
QUEUE_CAPACITY
;
@Bean
(
name
=
"asyncTaskPool"
)
public
AsyncTaskExecutor
taskExecutor
()
{
ThreadPoolTaskExecutor
executor
=
new
ThreadPoolTaskExecutor
();
...
...
@@ -35,14 +38,17 @@ public class InitAscynTaskThreadPoolConfig {
logger
.
info
(
"异步任务线程池最大线程数: {}"
,
MAX_POOL_SIZE
);
executor
.
setCorePoolSize
(
CORE_POOL_SIZE
);
executor
.
setMaxPoolSize
(
MAX_POOL_SIZE
);
executor
.
setQueueCapacity
(
QUEUE_CAPACITY
);
return
executor
;
}
@Bean
(
name
=
"monitorLink"
)
public
Executor
getLinkState
()
{
public
Executor
monitorTask
()
{
ThreadPoolTaskExecutor
executor
=
new
ThreadPoolTaskExecutor
();
executor
.
setCorePoolSize
(
CORE_POOL_SIZE
);
executor
.
setMaxPoolSize
(
MAX_POOL_SIZE
);
executor
.
setQueueCapacity
(
QUEUE_CAPACITY
);
executor
.
initialize
();
return
executor
;
}
...
...
src/main/java/com/yingxin/prms/service/asyncTask/AlarmTask.java
View file @
46c72c5e
...
...
@@ -131,24 +131,22 @@ public class AlarmTask {
if
(
flag
){
if
(
alarmCheck
!=
null
){
/* 如果存在告警 则恢复 */
System
.
out
.
println
(
"告警恢复了?"
);
cassandraDao
.
updateAlarm
(
alarmCheck
.
getSerialnum
(),
TimeUtil
.
getDate
());
String
recoveryMsg
=
alarmCheck
.
getClusterName
()
+
" "
+
alarmCheck
.
getIp
()
+
":"
+
alarmCheck
.
getPort
()
+
",告警已恢复"
;
monitorConfig
.
setAlarmMsg
(
"【告警恢复】"
+
recoveryMsg
);
if
(
TokenInterceptor
.
currSwitch
){
//
MonitorUtil.wxAlarm(monitorConfig);
MonitorUtil
.
wxAlarm
(
monitorConfig
);
}
}
}
else
{
if
(
alarmCheck
==
null
){
/* 如果不存在告警 新增数据 */
cassandraDao
.
insertAlarm
(
alarmLog
);
System
.
out
.
println
(
"kk:"
+(++
kk
));
monitorConfig
.
setAlarmMsg
(
alarmLog
.
getAlarmMessage
());
if
(
TokenInterceptor
.
currSwitch
){
//
MonitorUtil.wxAlarm(monitorConfig);
MonitorUtil
.
wxAlarm
(
monitorConfig
);
}
}
else
{
/* 如果告警发生变化 回复时间变成告警时间 */
...
...
@@ -157,7 +155,7 @@ public class AlarmTask {
cassandraDao
.
insertAlarm
(
alarmLog
);
monitorConfig
.
setAlarmMsg
(
"【告警内容更新】"
+
alarmLog
.
getAlarmMessage
());
if
(
TokenInterceptor
.
currSwitch
){
//
MonitorUtil.wxAlarm(monitorConfig);
MonitorUtil
.
wxAlarm
(
monitorConfig
);
}
}
}
...
...
@@ -166,8 +164,6 @@ public class AlarmTask {
logger
.
error
(
"告警校验发生错误。inMonitoring返回false"
);
logger
.
error
(
e
.
getMessage
());
}
long
end
=
System
.
currentTimeMillis
()-
begin
;
}
private
QueryBuilder
createQuery
(
int
start
,
TimeUnit
timeUnit
,
String
metric
,
String
tag
,
Aggregator
aggregator
)
{
...
...
src/main/resources/application.yml
View file @
46c72c5e
...
...
@@ -40,9 +40,10 @@ demo:
dailyAuthCount
:
url
:
"
http://15.1.3.8:9000/acl/v1/dailyCount"
ascynTaskThreadPool
:
corePoolSize
:
6
0
maxPoolSize
:
8
0
corePoolSize
:
10
0
maxPoolSize
:
20
0
clusterStatusPoolSize
:
16
queueCapacity
:
100
alarm
:
ip
:
"
15.2.249.205"
port
:
8899
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment