Authored by skinny.wu

dns monitor工程 提交

... ... @@ -13,10 +13,6 @@
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.influxdb</groupId>
<artifactId>influxdb-java</artifactId>
</dependency>
<dependency>
<groupId>monitor-service</groupId>
... ... @@ -26,7 +22,6 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
... ...
package com.monitor.other.dns.service.impl;
import com.monitor.other.dns.common.DNSConfig;
import com.monitor.other.dns.service.IDNSMonitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
... ... @@ -9,15 +11,20 @@ import org.springframework.stereotype.Service;
@Service("dnsMonitorService")
public class DNSMonitorServiceImpl implements IDNSMonitorService{
@Autowired
DNSConfig dnsConfig;
/**
* 监控DNS域名解析是否出现异常
*/
@Override
public void monitor() {
//TODO 从配置文件中获取需要遍历的组合 host + uid
System.out.println(dnsConfig.getUids().length + " " + dnsConfig.getUids()[0] + " " + dnsConfig.getUids()[1]);
System.out.println(dnsConfig.getHosts());
System.out.println(dnsConfig.getServices());
//TODO step1 判断host + uid 是否返回一组有效的ip地址
//TODO step2 判断通过dns解析后的ip地址调取服务 是否返回正常相应 200码
}
... ...
... ... @@ -5,6 +5,6 @@
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="dnsConfig" class="com.monitor.other.dns.common.DNSConfig">
<constructor-arg name="url" value="${dns.config.url}"/>
<constructor-arg name = "url" value="${dns.config.url}"/>
</bean>
</beans>
... ...
... ... @@ -47,6 +47,10 @@
<artifactId>monitor-service-user</artifactId>
</dependency>
<dependency>
<groupId>monitor-service</groupId>
<artifactId>monitor-service-other</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
... ...
# ******************** dns monitor common configs ********************
dns.config.url=api.yoho.cn/?method=app.resources.config.clientInitConfig&client_secret=bf8f49754dc7058349146f922640000c&client_type=android;service.yoho.cn/?method=app.resources.config.clientInitConfig&client_secret=bf8f49754dc7058349146f922640000c&client_type=android;m.yohobuy.com/boys
#dns.config.hosts=api.yoho.cn;service.yoho.cn;m.yohobuy.com
#dns.config.services=/?method=app.resources.config.clientInitConfig&client_secret=bf8f49754dc7058349146f922640000c&client_type=android;/operations/api/v5/resource/get?app_version=3.9.0.1512170008&client_secret=00be285c73a816177652240fea5a4a54&client_type=iphone&content_code=a7989369aa86681c678bc40f171b8f1d&os_version=9.2&screen_size=375x667&v=7;/boys
... ...
... ... @@ -17,4 +17,4 @@ cron_task_rabbit_monit=0 0 0 * * ?
cron_task_rabbit_scan=0 0 0 * * ?
#cron_task_dns_monit=0 0/2 * * * ?
cron_task_dns_monit=0 0 0 * * ?
\ No newline at end of file
#cron_task_dns_monit=0 0 0 * * ?
\ No newline at end of file
... ...
... ... @@ -106,6 +106,11 @@
</dependency>
<dependency>
<groupId>monitor-service</groupId>
<artifactId>monitor-service-other</artifactId>
<version>${project-version}</version>
</dependency>
<dependency>
<groupId>monitor-service</groupId>
<artifactId>monitor-service-middleware</artifactId>
<version>${project-version}</version>
</dependency>
... ... @@ -129,6 +134,7 @@
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson-version}</version>
</dependency>
</dependencies>
</dependencyManagement>
... ...