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