MonitCtrl.java 2.48 KB
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;
    }
}