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
762400ae
Commit
762400ae
authored
Feb 05, 2021
by
gaozhentao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拓扑图消息显示增加错误ip
parent
583cb579
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
39 deletions
+51
-39
ReliabilityApi.java
src/main/java/com/yingxin/prms/api/ReliabilityApi.java
+1
-1
HttpTask.java
...ain/java/com/yingxin/prms/service/asyncTask/HttpTask.java
+3
-0
Manager.java
src/main/java/com/yingxin/prms/service/business/Manager.java
+18
-2
SendHttpUtil.java
src/main/java/com/yingxin/prms/utils/SendHttpUtil.java
+18
-29
application.yml
src/main/resources/application.yml
+11
-7
No files found.
src/main/java/com/yingxin/prms/api/ReliabilityApi.java
View file @
762400ae
...
...
@@ -81,7 +81,7 @@ public class ReliabilityApi {
return
manager
.
selectChart
(
json
);
}
/**
* 获取拓扑图
点
数据
* 获取拓扑图数据
*
* @return
*/
...
...
src/main/java/com/yingxin/prms/service/asyncTask/HttpTask.java
View file @
762400ae
...
...
@@ -121,6 +121,9 @@ public class HttpTask extends BasicTask{
default
:
flag
=
checkStatusCode
(
map
);
}
if
(!
flag
){
logger
.
warn
(
"错误:"
+
hostInfo
.
getService_path
()+
", body:"
+
map
.
get
(
"body"
));
}
if
(
map
.
get
(
"body"
)
!=
null
&&
!
map
.
get
(
"body"
).
isEmpty
()
)
{
insertToKairos
(
httpClient
,
hostInfo
.
getService_path
(),
dur
,
flag
);
logger
.
info
(
"httpTask to {}|{}"
,
hostInfo
.
getHost_ip
(),
flag
);
...
...
src/main/java/com/yingxin/prms/service/business/Manager.java
View file @
762400ae
...
...
@@ -417,12 +417,14 @@ public class Manager {
Map
result
=
new
HashMap
();
List
<
FlowNode
>
flowNodes
=
flowDao
.
findNodeAll
();
List
<
FlowLine
>
flowLines
=
flowDao
.
findLineAll
();
List
<
Server_Host_Info
>
hostInfos
=
cassandraDao
.
getClusterBeMonitoredList
();
List
<
TcpFlowLineDto
>
lineDtos
=
new
ArrayList
<>();
List
<
TcpFlowNodeDto
>
nodeDtos
=
new
ArrayList
<>();
for
(
FlowNode
node
:
flowNodes
){
TcpFlowNodeDto
nodeDto
=
new
TcpFlowNodeDto
();
long
faultCount
=
0
;
String
errorCount
=
"0"
;
String
errorIp
=
""
;
String
totalCount
=
"0"
;
if
(
node
.
getServerPath
()==
null
||
node
.
getServerPath
().
isEmpty
()){
nodeDto
.
setCategory
(
node
.
getMark
());
...
...
@@ -432,7 +434,8 @@ public class Manager {
totalCount
=
String
.
valueOf
(
total
.
get
(
node
.
getCluster_name
()));
}
if
(
error
.
containsKey
(
node
.
getCluster_name
())){
errorCount
=
String
.
valueOf
(
total
.
get
(
node
.
getCluster_name
()));
errorCount
=
String
.
valueOf
(
error
.
get
(
node
.
getCluster_name
()));
errorIp
=
String
.
valueOf
(
error
.
get
(
node
.
getCluster_name
()+
"msg"
));
nodeDto
.
setCategory
(
"clusterFault"
);
}
...
...
@@ -451,7 +454,7 @@ public class Manager {
}
nodeDto
.
setFaultCount
((
int
)
faultCount
);
nodeDto
.
setKey
(
node
.
getCluster_name
());
nodeDto
.
setDescription
(
"服务异常数:"
+
errorCount
+
"/"
+
totalCount
);
nodeDto
.
setDescription
(
"服务异常数:"
+
errorCount
+
"/"
+
totalCount
+
"<br>"
+
errorIp
);
nodeDto
.
setUrl
(
node
.
getServerPath
());
nodeDto
.
setServerName
(
node
.
getCluster_name
());
nodeDto
.
setText
(
node
.
getCluster_name
());
...
...
@@ -557,6 +560,19 @@ public class Manager {
// map中没有 就新建一个 默认值是1
errorMap
.
put
(
hostInfo
.
getCluster_name
(),
1
);
}
/*记录错误IP*/
if
(
errorMap
.
containsKey
(
hostInfo
.
getCluster_name
()+
"msg"
)){
// map中存在 取出原先值 +1 然后覆盖原有的
// errorMap.put(hostInfo.getCluster_name()+"msg",errorMap.get(hostInfo.getCluster_name()+"msg")
// +"<div>"+hostInfo.getHost_ip()+"</div>");
errorMap
.
put
(
hostInfo
.
getCluster_name
()+
"msg"
,
errorMap
.
get
(
hostInfo
.
getCluster_name
()+
"msg"
)
+
hostInfo
.
getHost_ip
()+
"<br>"
);
}
else
{
// map中没有 就新建一个 默认值是1
// errorMap.put(hostInfo.getCluster_name()+"msg","<div>"+hostInfo.getHost_ip()+"</div>");
errorMap
.
put
(
hostInfo
.
getCluster_name
()+
"msg"
,
hostInfo
.
getHost_ip
()+
"<br>"
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
src/main/java/com/yingxin/prms/utils/SendHttpUtil.java
View file @
762400ae
...
...
@@ -56,10 +56,10 @@ public class SendHttpUtil {
RequestConfig
requestConfig
=
RequestConfig
.
custom
()
// 设置连接超时时间(单位毫秒)
.
setConnectTimeout
(
5000
)
// 设置请求超时时间(单位毫秒)
.
setConnectionRequestTimeout
(
5000
)
// socket读写超时时间(单位毫秒)
.
setSocketTimeout
(
5000
)
//
// 设置请求超时时间(单位毫秒)
//
.setConnectionRequestTimeout(5000)
//
// socket读写超时时间(单位毫秒)
//
.setSocketTimeout(5000)
// 设置是否允许重定向(默认为true)
.
setRedirectsEnabled
(
true
).
build
();
...
...
@@ -76,16 +76,11 @@ public class SendHttpUtil {
map
.
put
(
"body"
,
EntityUtils
.
toString
(
responseEntity
));
}
}
catch
(
ConnectException
e
){
// logger.error(uri+"请求超时"
);
logger
.
error
(
uri
+
"请求超时"
+
" "
+
e
.
getMessage
()
);
}
catch
(
ConnectTimeoutException
e
){
}
catch
(
ClientProtocolException
e
)
{
e
.
printStackTrace
();
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
logger
.
error
(
uri
+
"请求超时"
+
" "
+
e
.
getMessage
());
}
catch
(
Exception
e
){
logger
.
error
(
uri
+
"请求失败"
+
" "
+
e
.
getMessage
());
}
finally
{
try
{
// 释放资源
...
...
@@ -112,11 +107,11 @@ public class SendHttpUtil {
RequestConfig
requestConfig
=
RequestConfig
.
custom
()
// 设置连接超时时间(单位毫秒)
.
setConnectTimeout
(
5000
)
// 设置请求超时时间(单位毫秒)
.
setConnectionRequestTimeout
(
3000
)
// socket读写超时时间(单位毫秒)
.
setSocketTimeout
(
3000
)
// 设置是否允许重定向(默认为true)
//
// 设置请求超时时间(单位毫秒)
//
.setConnectionRequestTimeout(3000)
//
// socket读写超时时间(单位毫秒)
//
.setSocketTimeout(3000)
//
// 设置是否允许重定向(默认为true)
.
setRedirectsEnabled
(
true
).
build
();
httpPost
.
setConfig
(
requestConfig
);
StringEntity
entity
=
new
StringEntity
(
body
,
"UTF-8"
);
...
...
@@ -140,18 +135,12 @@ public class SendHttpUtil {
}
// 从响应模型中获取响应实体
}
catch
(
ConnectTimeoutException
e
){
// logger.error(uri+"连接超时"
);
logger
.
error
(
uri
+
"连接超时"
+
" "
+
e
.
getMessage
()
);
}
catch
(
ConnectException
e
){
// logger.error(uri+"请求超时");
}
catch
(
ClientProtocolException
e
)
{
e
.
printStackTrace
();
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
catch
(
SocketException
e
){
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
logger
.
error
(
uri
+
"请求超时"
+
" "
+
e
.
getMessage
());
}
catch
(
Exception
e
){
logger
.
error
(
uri
+
"请求失败"
+
" "
+
e
.
getMessage
());
}
finally
{
try
{
// 释放资源
if
(
httpClient
!=
null
)
{
...
...
src/main/resources/application.yml
View file @
762400ae
server
:
port
:
809
0
port
:
809
1
spring
:
data
:
cassandra
:
keyspace-name
:
ctid_prof
contact-points
:
200.102.10.11
port
:
9042
username
:
gzt
password
:
gzt
# contact-points: 200.102.10.11
contact-points
:
121.22.111.251
# port: 9042
port
:
9002
# username: gzt
# password: gzt
security
:
user
:
name
:
user
...
...
@@ -47,8 +49,10 @@ pointNumber: 60
#应用代理ID
agentId
:
1000004
#管理组凭证密钥
corpsecret
:
0gXvh18To60vLpw1wlPO4ncshvZjDKR0vaUuHAeDOb0
corpsecret
:
0gXvhsss
#corpsecret: 0gXvh18To60vLpw1wlPO4ncshvZjDKR0vaUuHAeDOb0
#wx告警地址
wxurl
:
https://qyapi.weixin.qq.com/cgi-bin/gettoken
wxurl
:
hssss
#wxurl: https://qyapi.weixin.qq.com/cgi-bin/gettoken
#企业ID
corpid
:
wwb8a34ddb02c87228
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