Authored by FengRuwei

Merge branch 'master' of http://git.yoho.cn/ops/monitor-service

# Conflicts:
#	monitor-service-influxdb/src/main/java/com/monitor/influxdb/mapper/impl/ZkMapper.java
  1 +<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
  2 + <wb-module deploy-name="monitor-service-middleware">
  3 + <wb-resource deploy-path="/" source-path="/src/main/java"/>
  4 + <wb-resource deploy-path="/" source-path="/src/main/resources"/>
  5 + </wb-module>
  6 +</project-modules>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<faceted-project>
  3 + <installed facet="java" version="1.8"/>
  4 + <installed facet="jst.utility" version="1.0"/>
  5 +</faceted-project>
  1 +disabled=06target
  2 +eclipse.preferences.version=1
@@ -4,18 +4,14 @@ import com.monitor.middleware.rabbitmq.constant.InterVar; @@ -4,18 +4,14 @@ import com.monitor.middleware.rabbitmq.constant.InterVar;
4 import com.monitor.middleware.rabbitmq.model.PointView; 4 import com.monitor.middleware.rabbitmq.model.PointView;
5 import org.influxdb.InfluxDB; 5 import org.influxdb.InfluxDB;
6 import org.influxdb.InfluxDBFactory; 6 import org.influxdb.InfluxDBFactory;
7 -import org.influxdb.dto.BatchPoints;  
8 -import org.influxdb.dto.Point;  
9 import org.influxdb.dto.Query; 7 import org.influxdb.dto.Query;
10 import org.influxdb.dto.QueryResult; 8 import org.influxdb.dto.QueryResult;
11 import org.slf4j.Logger; 9 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
13 -import org.springframework.beans.factory.annotation.Autowired;  
14 import org.springframework.beans.factory.annotation.Value; 11 import org.springframework.beans.factory.annotation.Value;
15 import org.springframework.stereotype.Component; 12 import org.springframework.stereotype.Component;
16 13
17 import javax.annotation.PostConstruct; 14 import javax.annotation.PostConstruct;
18 -import java.util.List;  
19 15
20 /** 16 /**
21 * Created by yoho on 2016/6/21. 17 * Created by yoho on 2016/6/21.
@@ -26,13 +22,13 @@ public class InfluxComp { @@ -26,13 +22,13 @@ public class InfluxComp {
26 public static final Logger DEBUG = LoggerFactory.getLogger(InfluxComp.class); 22 public static final Logger DEBUG = LoggerFactory.getLogger(InfluxComp.class);
27 23
28 @Value("influxUrl") 24 @Value("influxUrl")
29 - private String influxUrl; 25 + private String influxUrl="http://123.206.79.151:8086";
30 26
31 @Value("influxUser") 27 @Value("influxUser")
32 - private String influxUser; 28 + private String influxUser="root";
33 29
34 @Value("influxPwd") 30 @Value("influxPwd")
35 - private String influxPwd; 31 + private String influxPwd="root";
36 32
37 private InfluxDB influxDBClient; 33 private InfluxDB influxDBClient;
38 34
@@ -22,7 +22,7 @@ public class MoScanTask implements Runnable{ @@ -22,7 +22,7 @@ public class MoScanTask implements Runnable{
22 ITypeInfoService typeService; 22 ITypeInfoService typeService;
23 23
24 //自动发现rabbit监控对象 24 //自动发现rabbit监控对象
25 - @Scheduled(cron = "") 25 + @Scheduled(cron = "0/1 0 0 * * ? *")
26 public void doTask() { 26 public void doTask() {
27 List<MObjectInfo> mObjectInfoList = moService.queryMObjectsInfo(); 27 List<MObjectInfo> mObjectInfoList = moService.queryMObjectsInfo();
28 28
@@ -21,7 +21,7 @@ import static com.monitor.middleware.rabbitmq.constant.InterVar.EXECUTOR_SERVICE @@ -21,7 +21,7 @@ import static com.monitor.middleware.rabbitmq.constant.InterVar.EXECUTOR_SERVICE
21 */ 21 */
22 public class MonitTask { 22 public class MonitTask {
23 23
24 - @Scheduled(cron = "") 24 + @Scheduled(cron = "0/1 0 0 * * ? *")
25 public void doTask() { 25 public void doTask() {
26 for (Map.Entry<Integer, MObjectInfo> entry : InterVar.moMaps.entrySet()) { 26 for (Map.Entry<Integer, MObjectInfo> entry : InterVar.moMaps.entrySet()) {
27 EXECUTOR_SERVICE.submit(new OneJob(new ClusterViewJob(entry.getKey()))); 27 EXECUTOR_SERVICE.submit(new OneJob(new ClusterViewJob(entry.getKey())));
1 package com.monitor.middleware.zookeeper.task; 1 package com.monitor.middleware.zookeeper.task;
2 2
3 -import com.monitor.influxdb.model.ZkInfo;  
4 -import org.apache.zookeeper.KeeperException;  
5 -import org.apache.zookeeper.ZooKeeper; 3 +import com.monitor.middleware.zookeeper.service.IZkMonitorService;
6 import org.slf4j.Logger; 4 import org.slf4j.Logger;
7 import org.slf4j.LoggerFactory; 5 import org.slf4j.LoggerFactory;
  6 +import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.scheduling.annotation.Scheduled; 7 import org.springframework.scheduling.annotation.Scheduled;
9 import org.springframework.stereotype.Component; 8 import org.springframework.stereotype.Component;
10 9
11 -import java.io.IOException;  
12 -import java.util.ArrayList;  
13 -import java.util.List;  
14 -  
15 /** 10 /**
16 * Created by yoho on 2016/6/21. 11 * Created by yoho on 2016/6/21.
17 */ 12 */
@@ -20,43 +15,13 @@ public class ZookeeperMonitorTask { @@ -20,43 +15,13 @@ public class ZookeeperMonitorTask {
20 15
21 Logger log = LoggerFactory.getLogger(ZookeeperMonitorTask.class); 16 Logger log = LoggerFactory.getLogger(ZookeeperMonitorTask.class);
22 17
  18 + @Autowired
  19 + IZkMonitorService zkMonitorService;
23 20
24 - @Scheduled(fixedRate=10000)  
25 - public void run() {  
26 - log.info("task start...");  
27 - List<String> ipList=new ArrayList<String>();  
28 - ipList.add("172.31.50.190");  
29 - ipList.add("172.31.50.191");  
30 - ipList.add("172.31.50.192");  
31 - ipList.add("172.31.50.193");  
32 - ipList.add("172.31.50.194");  
33 - ipList.add("10.66.4.3");  
34 - ipList.add("10.66.4.4");  
35 - ipList.add("10.66.4.5");  
36 - ipList.add("10.66.4.8");  
37 - ipList.add("10.66.4.9");  
38 -  
39 - List<ZkInfo> zkList=new ArrayList<ZkInfo>();  
40 - for(String ip:ipList){  
41 - boolean result=true;  
42 - try {  
43 - result=checkConnection(ip);  
44 - } catch (Exception e) {  
45 - result=false;  
46 - }  
47 - }  
48 -  
49 - log.info("task end...");  
50 - 21 + @Scheduled(fixedRate=5000)
  22 + public void zookeeperMonitor() {
  23 + zkMonitorService.zookeeperMonitor();
51 } 24 }
52 25
53 26
54 - public static boolean checkConnection(String ip) throws IOException, KeeperException, InterruptedException {  
55 - ZooKeeper zk = new ZooKeeper("192.168.102.205:2181", 2000,null);  
56 - // 获取某路径下所有节点  
57 - List<String> children = zk.getChildren("/", false);  
58 - // log.info("checkConnection is param { },size is { }",ip,null==children?0:children.size());  
59 - return true;  
60 - }  
61 -  
62 } 27 }
1 # ******************** influxdb common configs ******************** 1 # ******************** influxdb common configs ********************
2 2
3 influxdb.num=2 3 influxdb.num=2
4 -influxdb.name=test,alarm 4 +influxdb.name=test;alarm
5 influxdb.ip=http://192.168.102.162:8086;http://123.206.79.151:18086 5 influxdb.ip=http://192.168.102.162:8086;http://123.206.79.151:18086
6 influxdb.user=yoho;root 6 influxdb.user=yoho;root
7 influxdb.pwd=Yoho_9646;root 7 influxdb.pwd=Yoho_9646;root