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
edff05f0
Commit
edff05f0
authored
May 27, 2021
by
shaochangbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Server_host_info信息添加删除
parent
5ab5371c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
4 deletions
+58
-4
ReliabilityApi.java
src/main/java/com/yingxin/prms/api/ReliabilityApi.java
+17
-4
Manager.java
src/main/java/com/yingxin/prms/service/business/Manager.java
+30
-0
CassandraDaoImpl.java
...n/java/com/yingxin/prms/service/dao/CassandraDaoImpl.java
+11
-0
No files found.
src/main/java/com/yingxin/prms/api/ReliabilityApi.java
View file @
edff05f0
package
com
.
yingxin
.
prms
.
api
;
import
com.yingxin.prms.domain.FlowLine
;
import
com.yingxin.prms.domain.FlowNode
;
import
com.yingxin.prms.domain.Server_Host_Info
;
import
com.yingxin.prms.service.business.Manager
;
import
com.yingxin.prms.service.dao.CassandraDaoImpl
;
import
net.sf.json.JSONObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.task.AsyncTaskExecutor
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.web.bind.annotation.*
;
import
javax.ws.rs.POST
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -21,11 +21,13 @@ public class ReliabilityApi {
private
final
Manager
manager
;
private
final
AsyncTaskExecutor
taskExecutor
;
private
final
CassandraDaoImpl
cassandraDao
;
@Autowired
public
ReliabilityApi
(
Manager
manager
,
AsyncTaskExecutor
taskExecutor
)
{
public
ReliabilityApi
(
Manager
manager
,
AsyncTaskExecutor
taskExecutor
,
CassandraDaoImpl
cassandraDao
)
{
this
.
manager
=
manager
;
this
.
taskExecutor
=
taskExecutor
;
this
.
cassandraDao
=
cassandraDao
;
}
/**
...
...
@@ -126,4 +128,15 @@ public class ReliabilityApi {
return
manager
.
getSwitch
();
}
//新建监控服务信息
@PostMapping
(
"insertServerHostInfo"
)
public
String
insertServerHostInfo
(
@RequestBody
String
json
){
return
manager
.
insertServerHostInfo
(
json
);
}
//删除监控服务信息
@PostMapping
(
"delServerHostInfo"
)
public
String
delServerHostInfo
(
@RequestBody
String
json
){
return
manager
.
delServerHostInfo
(
json
);
}
}
src/main/java/com/yingxin/prms/service/business/Manager.java
View file @
edff05f0
...
...
@@ -8,7 +8,9 @@ import com.yingxin.prms.service.asyncTask.QueryHostStatusTask;
import
com.yingxin.prms.service.dao.CassandraDaoImpl
;
import
com.yingxin.prms.service.dao.FlowDaoImpl
;
import
com.yingxin.prms.utils.*
;
import
net.sf.json.JSON
;
import
net.sf.json.JSONObject
;
import
org.apache.catalina.Server
;
import
org.kairosdb.client.HttpClient
;
import
org.kairosdb.client.builder.*
;
import
org.kairosdb.client.response.QueryResponse
;
...
...
@@ -57,6 +59,8 @@ public class Manager {
private
final
CassandraDaoImpl
cassandraDao
;
private
static
CassandraDaoImpl
cassandraDaoStatic
;
@Autowired
private
FlowDaoImpl
flowDao
;
...
...
@@ -723,6 +727,27 @@ public class Manager {
}
return
map
;
}
//新建监控服务信息
public
String
insertServerHostInfo
(
String
json
){
JSONObject
job
=
JSONObject
.
fromObject
(
json
);
Server_Host_Info
server_host_info
=
new
Server_Host_Info
(
job
.
getString
(
"service_method"
),
job
.
getString
(
"cluster_name"
),
job
.
getString
(
"host_name"
),
job
.
getString
(
"service_path"
),
job
.
getString
(
"host_ip"
),
Short
.
parseShort
(
job
.
getString
(
"host_port"
)),
job
.
getString
(
"request_body"
),
job
.
getString
(
"response_body"
),
job
.
getString
(
"service_password"
),
job
.
getString
(
"layer"
));
cassandraDao
.
insertServerHostInfo
(
server_host_info
);
return
server_host_info
.
toString
();
}
//删除监控服务信息
public
String
delServerHostInfo
(
String
json
){
JSONObject
job
=
JSONObject
.
fromObject
(
json
);
Server_Host_Info
server_host_info
=
new
Server_Host_Info
(
job
.
getString
(
"service_method"
),
job
.
getString
(
"cluster_name"
),
job
.
getString
(
"host_name"
),
job
.
getString
(
"service_path"
),
job
.
getString
(
"host_ip"
),
Short
.
parseShort
(
job
.
getString
(
"host_port"
)),
job
.
getString
(
"request_body"
),
job
.
getString
(
"response_body"
),
job
.
getString
(
"service_password"
),
job
.
getString
(
"layer"
));
cassandraDao
.
delServerHostInfo
(
server_host_info
);
return
server_host_info
.
toString
();
}
public
static
void
main
(
String
[]
args
)
{
List
<
String
>
m
=
new
ArrayList
<>();
...
...
@@ -734,6 +759,11 @@ public class Manager {
m
.
add
(
"f"
);
m
=
m
.
subList
(
1
,
4
);
System
.
out
.
println
(
m
);
// cassandraDaoStatic.insertServerHostInfo();
// System.out.println("@@@@@@@@@@@@@@@@@@@@");
}
// public Map<String, Object> searchLog(String json) {
...
...
src/main/java/com/yingxin/prms/service/dao/CassandraDaoImpl.java
View file @
edff05f0
...
...
@@ -38,6 +38,17 @@ public class CassandraDaoImpl {
return
template
.
select
(
"select * from ctid_prof.server_host_info;"
,
Server_Host_Info
.
class
);
}
//插入server_host_info信息
public
int
insertServerHostInfo
(
Server_Host_Info
server_host_info
)
{
template
.
insert
(
server_host_info
);
return
1
;
}
//删除server_host_info信息
public
int
delServerHostInfo
(
Server_Host_Info
server_host_info
)
{
template
.
delete
(
server_host_info
);
return
1
;
}
public
void
saveReqBLV
(
CTID_Request_Perf_BaseLineValue
entity
)
{
template
.
insert
(
entity
);
}
...
...
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