MonitCtrl.java
2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package com.ui.ctrl;
import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
import com.ui.model.req.ActionRequest;
import com.ui.model.req.MonitRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
/**
* Created by yoho on 2016/10/27.
*/
@RestController
@RequestMapping(value = "/monit")
public class MonitCtrl {
@Autowired
HttpRestClient httpRestClient;
@RequestMapping("/toMonit")
public ModelAndView toNginxView() {
return new ModelAndView("monit/monit");
}
@RequestMapping("/service/all")
public BaseResponse queryAllService() {
BaseResponse response = httpRestClient.defaultGet("/monit/service/all", BaseResponse.class);
return response;
}
/* @RequestMapping("/hosts/action")
public BaseResponse operHostService(String request) {
BaseResponse response = httpRestClient.defaultPost("/monit/hosts/action", request, BaseResponse.class);
return response;
}*/
@RequestMapping("/hosts/oneAction")
public BaseResponse operOneHostService(ActionRequest request) {
BaseResponse response = httpRestClient.defaultPost("/monit/hosts/oneAction", request, BaseResponse.class);
return response;
}
@RequestMapping("/hosts/delete/{monitId}")
public BaseResponse delHostService(@PathVariable("monitId") String monitId) {
BaseResponse response = httpRestClient.defaultPost("/monit/hosts/delete/" + monitId, null, BaseResponse.class);
return response;
}
@RequestMapping("/service/allMonit")
public BaseResponse queryAllMonit(MonitRequest request) {
BaseResponse response = httpRestClient.defaultPost("/monit/service/allMonit", request, BaseResponse.class);
return response;
}
/* @RequestMapping("/service/searchMonit")
public BaseResponse queryMonit(MonitRequest request) {
BaseResponse response = httpRestClient.defaultPost("/monit/service/searchMonit", request, BaseResponse.class);
return response;
}*/
@RequestMapping("/service/searchService")
public BaseResponse queryService(MonitRequest request) {
BaseResponse response = httpRestClient.defaultPost("/monit/service/searchService", request, BaseResponse.class);
return response;
}
}