Commit 583cb579 authored by gaozhentao's avatar gaozhentao

刪除微信告警測試方法,打印日志

parent 6edfe40a
...@@ -107,15 +107,16 @@ public class ReliabilityApi { ...@@ -107,15 +107,16 @@ public class ReliabilityApi {
return manager.getStatistics(); return manager.getStatistics();
} }
@GetMapping("wxAlarm") /*
public boolean wxAlarm() { * 微信告警开关
return manager.wxAlarm(); * */
}
@PostMapping("changeSwitch") @PostMapping("changeSwitch")
public Map changeSwitch(@RequestBody String json) { public Map changeSwitch(@RequestBody String json) {
return manager.changeSwitch(json); return manager.changeSwitch(json);
} }
/*
* 获取微信告警开关状态
* */
@GetMapping("getSwitch") @GetMapping("getSwitch")
public Map getSwitch() { public Map getSwitch() {
return manager.getSwitch(); return manager.getSwitch();
......
...@@ -54,12 +54,10 @@ public class HttpTask extends BasicTask{ ...@@ -54,12 +54,10 @@ public class HttpTask extends BasicTask{
if(hostInfo.getRequest_body()== null){ if(hostInfo.getRequest_body()== null){
map = SendHttpUtil.doPost(hostInfo.getService_path(),""); map = SendHttpUtil.doPost(hostInfo.getService_path(),"");
}else { }else {
long getStart = System.currentTimeMillis();
map = SendHttpUtil.doPost(hostInfo.getService_path(),hostInfo.getRequest_body()); map = SendHttpUtil.doPost(hostInfo.getService_path(),hostInfo.getRequest_body());
} }
} }
if (hostInfo.getService_method().equals("get")) { if (hostInfo.getService_method().equals("get")) {
long getStart = System.currentTimeMillis();
map = SendHttpUtil.doGet(hostInfo.getService_path()); map = SendHttpUtil.doGet(hostInfo.getService_path());
} }
dur = System.currentTimeMillis() - start; dur = System.currentTimeMillis() - start;
......
...@@ -81,7 +81,7 @@ public class QueryHostStatusTask implements Callable<SingleHostStatus> { ...@@ -81,7 +81,7 @@ public class QueryHostStatusTask implements Callable<SingleHostStatus> {
if (faultCount5Min != 0) value = "unstable"; if (faultCount5Min != 0) value = "unstable";
// if (faultCount1Min != 0 && faultCount1Min >= correctCount1Min) value = "down"; // if (faultCount1Min != 0 && faultCount1Min >= correctCount1Min) value = "down";
if (faultCount1Min >= correctCount1Min) value = "down"; if (faultCount1Min >= correctCount1Min) value = "down";
if (!value.equals("ok")) logger.error("返回状态为:{},5分钟内失败数:{},1分钟内失败数:{},标准值:{}", value, faultCount5Min, faultCount1Min, correctCount1Min); if (!value.equals("ok")) logger.error("url:{},返回状态为:{},5分钟内失败数:{},1分钟内失败数:{},标准值:{}", tag, value, faultCount5Min, faultCount1Min, correctCount1Min);
hostStatusMap.put("faultCount", faultCountDay); hostStatusMap.put("faultCount", faultCountDay);
hostStatusMap.put("f60s", faultCount1Min); hostStatusMap.put("f60s", faultCount1Min);
hostStatusMap.put("value", value); hostStatusMap.put("value", value);
......
...@@ -570,22 +570,8 @@ public class Manager { ...@@ -570,22 +570,8 @@ public class Manager {
public boolean wxAlarm(){
/** 微信监控信息对象 */
MonitorConfig monitorConfig = new MonitorConfig();
monitorConfig.setAgentId(agentId);
monitorConfig.setCorpid(corpid);
monitorConfig.setCorpsecret(corpsecret);
monitorConfig.setUrl(wxurl);
String msg ="【告警测试】"+ "依图"+ " " + "192.168.56.15"
+ ":" +"22" + ",告警已恢复";
monitorConfig.setAlarmMsg(msg);
return MonitorUtil.wxAlarm(monitorConfig);
}
public Map changeSwitch(String json) { public Map changeSwitch(String json) {
JSONObject jsonObject = JSONObject.fromObject(json); JSONObject jsonObject = JSONObject.fromObject(json);
String currState = jsonObject.getString("state"); String currState = jsonObject.getString("state");
......
server: server:
port: 8091 port: 8090
spring: spring:
data: data:
cassandra: cassandra:
keyspace-name: ctid_prof keyspace-name: ctid_prof
# contact-points: 192.168.189.130 contact-points: 200.102.10.11
# contact-points: 200.102.10.11 port: 9042
contact-points: 121.22.111.251 username: gzt
# contact-points: 172.16.15.7 password: gzt
# port: 9042
port: 9002
# username: gzt
# password: gzt
security: security:
user: user:
name: user name: user
...@@ -27,12 +23,8 @@ jwt: ...@@ -27,12 +23,8 @@ jwt:
expiration: 1800000 expiration: 1800000
tokenHead: "Bearer " tokenHead: "Bearer "
demo: demo:
kairosdb: kairosdb:
# url: "http://172.16.15.7:8080"
# url: "http://192.168.189.130:8080"
# url: "http://200.102.10.11:8080"
url: "http://121.22.111.251:9008" url: "http://121.22.111.251:9008"
maxConnTotal: 50 maxConnTotal: 50
maxConnPerRoute: 30 maxConnPerRoute: 30
...@@ -49,10 +41,8 @@ alarm: ...@@ -49,10 +41,8 @@ alarm:
port: 8899 port: 8899
systemType: 101 systemType: 101
tokeTime: 1200000 tokeTime: 1200000
pointNumber: 60 pointNumber: 60
#微信告警 #微信告警
#应用代理ID #应用代理ID
agentId: 1000004 agentId: 1000004
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment