Selaa lähdekoodia

add debug code

何知谦 4 vuotta sitten
vanhempi
commit
35be5c422b

+ 12 - 12
PaasMonitor-client/src/main/java/com/nju/edu/paasMonitorClient/MonitorClient.java

@@ -62,7 +62,7 @@ public class MonitorClient {
         return new Call(system, category);
     }
 
-//    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) throws InterruptedException {
 ////        logEvent(SeecSystem.PAAS, "try", "first try", EventStatus.FAIL);
 ////        logEvent(SeecSystem.PAAS, "try", "first try", EventStatus.SUCCESS);
 //
@@ -107,16 +107,16 @@ public class MonitorClient {
 ////            logError(SeecSystem.BOK, "try1", "t", "error", e);
 ////            logError(SeecSystem.BOK, "try2", "t1", "error", e);
 ////            logError(SeecSystem.BOK, "try1", "t", "error", e);
-////            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.FAIL);
-////            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
-////            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
-////            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.FAIL);
-////            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
-////            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
-////            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
-////            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
-////            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
-////            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
+            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.FAIL);
+            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
+            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
+            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.FAIL);
+            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
+            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
+            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
+            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
+            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
+            logEvent(SeecSystem.PAAS, "tryEvent", "tryEvent", EventStatus.SUCCESS);
 //        }
-//    }
+    }
 }

BIN
PaasMonitor-client/target/classes/com/nju/edu/paasMonitorClient/MonitorClient.class


BIN
PaasMonitor-client/target/classes/com/nju/edu/paasMonitorClient/entity/Data.class


+ 1 - 1
PaasMonitor-client/target/classes/config.properties

@@ -1 +1 @@
-server.address.prefix = http://icomo.top:8080/api/log/
+server.address.prefix = http://localhost:8080/api/log/

+ 2 - 0
PaasMonitor-server/src/main/java/com/nju/edu/paasMonitorServer/alert/entity/vo/SubCheckItem.java

@@ -3,9 +3,11 @@ package com.nju.edu.paasMonitorServer.alert.entity.vo;
 import com.nju.edu.paasMonitorServer.alert.entity.po.ConfigPO;
 import lombok.AllArgsConstructor;
 import lombok.Data;
+import lombok.ToString;
 
 @Data
 @AllArgsConstructor
+@ToString
 public class SubCheckItem<T> {
     T data;
     ConfigPO configPO;

+ 1 - 0
PaasMonitor-server/src/main/java/com/nju/edu/paasMonitorServer/alert/process/checker/EventChecker.java

@@ -39,6 +39,7 @@ public class EventChecker implements Checker<EventPO> {
                 return;
             }
             if (alertItem == AlertItem.TOTAL.getVal()) {
+                System.out.println("run check total");
                 checkTotal(eventPOS, configPO, current, times[0], times[1]);
             } else if (alertItem == AlertItem.FAIL_RATE.getVal()) {
                 checkFailRate(eventPOS, configPO, current, times[0], times[1]);

+ 2 - 0
PaasMonitor-server/src/main/java/com/nju/edu/paasMonitorServer/alert/process/checker/SubConditionChecker.java

@@ -23,6 +23,8 @@ public class SubConditionChecker {
     }
 
     public void checkSingle(SubCheckItem<Double> subCheckItem) {
+        System.out.println("run check single");
+        System.out.println(subCheckItem.toString());
         double value = subCheckItem.getData();
         long cid = subCheckItem.getConfigPO().getId();
         Map<SubConditionPO, Double> map = new HashMap<>();

+ 2 - 0
PaasMonitor-server/src/main/java/com/nju/edu/paasMonitorServer/alert/process/watcher/Watcher.java

@@ -40,6 +40,7 @@ public class Watcher extends TimerTask {
 
     @Override
     public void run() {
+        System.out.println("watcher running");
         List<ConfigPO> configPOS = configDao.getAllConfig();
         long current = System.currentTimeMillis();
         configPOS
@@ -53,6 +54,7 @@ public class Watcher extends TimerTask {
                             configPO.getEndTime(), times[1]);
                 })
                 .forEach(configPO -> {
+                    System.out.println(configPO);
                     int type = configPO.getType();
                     if (type == AlertType.CALL.getVal()) {
                         callChecker.check(configPO, current);

+ 3 - 0
PaasMonitor-server/src/main/java/com/nju/edu/paasMonitorServer/util/TimeCalculator.java

@@ -71,6 +71,9 @@ public class TimeCalculator {
                 TimeCalculator.subtractMinute(duration, current));
         long endTime = TimeCalculator.getEndTimeInMinute(
                 TimeCalculator.subtractMinute(1, current));
+        System.out.println(String.format("current: %s, start: %s, end: %s",
+                TimeCalculator.getTimeString(current), TimeCalculator.getTimeString(startTime),
+                TimeCalculator.getTimeString(endTime)));
         return new long[]{startTime, endTime};
     }
 }

+ 5 - 5
PaasMonitor-server/target/classes/application.yml

@@ -2,12 +2,12 @@ server:
   port: 8080
 spring:
   datasource:
-    url: jdbc:mysql://paas-monitor-mysql:3306/monitor?characterEncoding=utf8&useSSL=false
-    username: root
-    password: 1qaz2wsx
-#    url: jdbc:mysql://localhost:3306/monitor?characterEncoding=utf8&useSSL=false
+#    url: jdbc:mysql://paas-monitor-mysql:3306/monitor?characterEncoding=utf8&useSSL=false
 #    username: root
-#    password: 123456
+#    password: 1qaz2wsx
+    url: jdbc:mysql://localhost:3306/monitor?characterEncoding=utf8&useSSL=false
+    username: root
+    password: 123456
     driver-class-name: com.mysql.cj.jdbc.Driver
   mail:
     host: smtp.163.com