diff --git a/collector/pom.xml b/collector/pom.xml index 0a0bb63ebe5..af452161c36 100644 --- a/collector/pom.xml +++ b/collector/pom.xml @@ -172,6 +172,13 @@ rocketmq-tools 4.9.4 + + + + dnsjava + dnsjava + 3.5.2 + diff --git a/collector/src/main/java/org/dromara/hertzbeat/collector/collect/dns/DnsCollectImpl.java b/collector/src/main/java/org/dromara/hertzbeat/collector/collect/dns/DnsCollectImpl.java new file mode 100644 index 00000000000..06ad0af95a5 --- /dev/null +++ b/collector/src/main/java/org/dromara/hertzbeat/collector/collect/dns/DnsCollectImpl.java @@ -0,0 +1,210 @@ +package org.dromara.hertzbeat.collector.collect.dns; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.dromara.hertzbeat.collector.collect.AbstractCollect; +import org.dromara.hertzbeat.collector.dispatch.DispatchConstants; +import org.dromara.hertzbeat.common.constants.CommonConstants; +import org.dromara.hertzbeat.common.entity.job.Metrics; +import org.dromara.hertzbeat.common.entity.job.protocol.DnsProtocol; +import org.dromara.hertzbeat.common.entity.message.CollectRep; +import org.dromara.hertzbeat.common.util.CommonUtil; +import org.springframework.util.StopWatch; +import org.xbill.DNS.DClass; +import org.xbill.DNS.Message; +import org.xbill.DNS.Name; +import org.xbill.DNS.Opcode; +import org.xbill.DNS.RRset; +import org.xbill.DNS.Rcode; +import org.xbill.DNS.Record; +import org.xbill.DNS.Resolver; +import org.xbill.DNS.Section; +import org.xbill.DNS.SimpleResolver; +import org.xbill.DNS.Type; + +import java.io.IOException; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * dns protocol collection implementation + * @author Calvin + */ +@Slf4j +public class DnsCollectImpl extends AbstractCollect { + /* + each part of dig command output + */ + private static final String HEADER = "header"; + private static final String QUESTION = "question"; + private static final String ANSWER = "answer"; + private static final String AUTHORITY = "authority"; + private static final String ADDITIONAL = "additional"; + /* + * used for header key + * example: + * ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3221 + * ;; flags: qr rd ra ; qd: 1 an: 1 au: 0 ad: 0 + * + * + * opcode -> opcode + * status -> status + * flags -> flags + * qd -> questionRowCount + * an -> answerRowCount + * au -> authorityRowCount + * ad -> additionalRowCount + */ + private static final String RESPONSE_TIME = "responseTime"; + private static final String OP_CODE = "opcode"; + private static final String STATUS = "status"; + private static final String FLAGS = "flags"; + private static final String QUESTION_ROW_COUNT = "questionRowCount"; + private static final String ANSWER_ROW_COUNT = "answerRowCount"; + private static final String AUTHORITY_ROW_COUNT = "authorityRowCount"; + private static final String ADDITIONAL_ROW_COUNT = "additionalRowCount"; + + + @Override + public void collect(CollectRep.MetricsData.Builder builder, long monitorId, String app, Metrics metrics) { + // check params + if (checkDnsProtocolFailed(metrics.getDns())) { + builder.setCode(CollectRep.Code.FAIL); + builder.setMsg("DNS collect must have a valid DNS protocol param! "); + return; + } + + DNSResolveResult dnsResolveResult; + try { + // run dig command + dnsResolveResult = dig(metrics.getDns()); + } catch (IOException e) { + log.info(CommonUtil.getMessageFromThrowable(e)); + builder.setCode(CollectRep.Code.UN_CONNECTABLE); + builder.setMsg(e.getMessage()); + return; + } catch (Exception e) { + String errorMsg = CommonUtil.getMessageFromThrowable(e); + log.warn("[dns collect] error: {}", e.getMessage(), e); + builder.setCode(CollectRep.Code.FAIL); + builder.setMsg(errorMsg); + return; + } + + // build dns metrics data + CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder(); + if (StringUtils.equals(HEADER, metrics.getName())) { + // add header columns + Map headerInfo = dnsResolveResult.getHeaderInfo(); + metrics.getAliasFields().forEach(field -> valueRowBuilder.addColumns(headerInfo.getOrDefault(field, CommonConstants.NULL_VALUE))); + }else { + // add question/answer/authority/additional columns + List currentMetricsResolveResultList = dnsResolveResult.getList(metrics.getName()); + for (int index = 0; index < metrics.getAliasFields().size(); index++) { + valueRowBuilder.addColumns(index >= currentMetricsResolveResultList.size() + ? CommonConstants.NULL_VALUE + : currentMetricsResolveResultList.get(index)); + } + } + + builder.addValues(valueRowBuilder.build()); + } + + @Override + public String supportProtocol() { + return DispatchConstants.PROTOCOL_DNS; + } + + private boolean checkDnsProtocolFailed(DnsProtocol dnsProtocol) { + return Objects.isNull(dnsProtocol) || dnsProtocol.isInvalid(); + } + + /** + * run dig command + */ + private DNSResolveResult dig(DnsProtocol dns) throws IOException { + StopWatch responseTimeStopWatch = new StopWatch("responseTime"); + responseTimeStopWatch.start(); + + Name name = Name.fromString(dns.getAddress(), Name.root); + Message query = Message.newQuery(Record.newRecord(name, Type.ANY, DClass.ANY)); + Resolver res = new SimpleResolver(dns.getDnsServerIP()); + res.setTimeout(Duration.of(Long.parseLong(dns.getTimeout()), ChronoUnit.MILLIS)); + res.setTCP(Boolean.parseBoolean(dns.getTcp())); + res.setPort(Integer.parseInt(dns.getPort())); + + Message response = res.send(query); + responseTimeStopWatch.stop(); + return resolve(response, responseTimeStopWatch.getLastTaskTimeMillis()); + } + + private DNSResolveResult resolve(Message message, Long responseTime) { + return DNSResolveResult.builder() + .headerInfo(getHeaderInfo(message, responseTime)) + .questionList(getSectionInfo(message, Section.QUESTION)) + .answerList(getSectionInfo(message, Section.ANSWER)) + .authorityList(getSectionInfo(message, Section.AUTHORITY)) + .additionalList(getSectionInfo(message, Section.ADDITIONAL)) + .build(); + } + + private Map getHeaderInfo(Message message, Long responseTime) { + Map resultMap = Maps.newHashMap(); + resultMap.put(RESPONSE_TIME, String.valueOf(responseTime)); + resultMap.put(OP_CODE, Opcode.string(message.getHeader().getOpcode())); + resultMap.put(STATUS, Rcode.string(message.getHeader().getRcode())); + resultMap.put(FLAGS, message.getHeader().printFlags()); + resultMap.put(QUESTION_ROW_COUNT, String.valueOf(message.getHeader().getCount(Section.QUESTION))); + resultMap.put(ANSWER_ROW_COUNT, String.valueOf(message.getHeader().getCount(Section.ANSWER))); + resultMap.put(AUTHORITY_ROW_COUNT, String.valueOf(message.getHeader().getCount(Section.AUTHORITY))); + resultMap.put(ADDITIONAL_ROW_COUNT, String.valueOf(message.getHeader().getCount(Section.ADDITIONAL))); + + return resultMap; + } + + private List getSectionInfo(Message message, int section) { + List currentRRsetList = message.getSectionRRsets(section); + if (currentRRsetList == null || currentRRsetList.size() <= 0) { + return Lists.newArrayList(); + } + + List infoList = Lists.newArrayListWithCapacity(currentRRsetList.size()); + currentRRsetList.forEach(res -> infoList.add(res.toString())); + + return infoList; + } + + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + private static class DNSResolveResult { + private Map headerInfo; + /** example: www.google.com. 140 IN A 192.133.77.133 **/ + private List questionList; + private List answerList; + private List authorityList; + private List additionalList; + + public List getList(String metricsName) { + switch (metricsName) { + case QUESTION: return questionList; + case ANSWER: return answerList; + case AUTHORITY: return authorityList; + case ADDITIONAL: return additionalList; + default: return Collections.emptyList(); + } + } + } +} diff --git a/collector/src/main/java/org/dromara/hertzbeat/collector/dispatch/DispatchConstants.java b/collector/src/main/java/org/dromara/hertzbeat/collector/dispatch/DispatchConstants.java index daeb52114c4..7fc2490c4c5 100644 --- a/collector/src/main/java/org/dromara/hertzbeat/collector/dispatch/DispatchConstants.java +++ b/collector/src/main/java/org/dromara/hertzbeat/collector/dispatch/DispatchConstants.java @@ -95,7 +95,11 @@ public interface DispatchConstants { * protocol prometheus */ String PROTOCOL_PROMETHEUS = "prometheus"; - + /** + * protocol dns + */ + String PROTOCOL_DNS = "dns"; + // Protocol type related - end // 协议类型相关 - end // diff --git a/collector/src/main/resources/META-INF/services/org.dromara.hertzbeat.collector.collect.AbstractCollect b/collector/src/main/resources/META-INF/services/org.dromara.hertzbeat.collector.collect.AbstractCollect index 0ec7b3a9232..aea2549476a 100644 --- a/collector/src/main/resources/META-INF/services/org.dromara.hertzbeat.collector.collect.AbstractCollect +++ b/collector/src/main/resources/META-INF/services/org.dromara.hertzbeat.collector.collect.AbstractCollect @@ -15,3 +15,4 @@ org.dromara.hertzbeat.collector.collect.ftp.FtpCollectImpl org.dromara.hertzbeat.collector.collect.mq.RocketmqSingleCollectImpl org.dromara.hertzbeat.collector.collect.udp.UdpCollectImpl org.dromara.hertzbeat.collector.collect.push.PushCollectImpl +org.dromara.hertzbeat.collector.collect.dns.DnsCollectImpl diff --git a/collector/src/test/java/org/dromara/hertzbeat/collector/collect/dns/DnsCollectImplTest.java b/collector/src/test/java/org/dromara/hertzbeat/collector/collect/dns/DnsCollectImplTest.java new file mode 100644 index 00000000000..bb3ec628c58 --- /dev/null +++ b/collector/src/test/java/org/dromara/hertzbeat/collector/collect/dns/DnsCollectImplTest.java @@ -0,0 +1,38 @@ +package org.dromara.hertzbeat.collector.collect.dns; + + +import org.dromara.hertzbeat.common.entity.job.Metrics; +import org.dromara.hertzbeat.common.entity.job.protocol.DnsProtocol; +import org.dromara.hertzbeat.common.entity.message.CollectRep; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + + +/** + * Test case for {@link DnsCollectImpl} + * @author Calvin + */ +public class DnsCollectImplTest { + private DnsProtocol dnsProtocol; + private DnsCollectImpl dnsCollect; + + @BeforeEach + public void setup() { + dnsCollect = new DnsCollectImpl(); + dnsProtocol = DnsProtocol.builder() + .dnsServerIP("8.8.8.8") + .address("www.google.com") + .build(); + } + + @Test + public void testCollect() { + CollectRep.MetricsData.Builder builder = CollectRep.MetricsData.newBuilder(); + long monitorId = 666; + String app = "testDNS"; + Metrics metrics = new Metrics(); + metrics.setDns(dnsProtocol); + + dnsCollect.collect(builder, monitorId, app, metrics); + } +} diff --git a/common/src/main/java/org/dromara/hertzbeat/common/entity/job/Metrics.java b/common/src/main/java/org/dromara/hertzbeat/common/entity/job/Metrics.java index c1e78c9a830..a3b7fae82ca 100644 --- a/common/src/main/java/org/dromara/hertzbeat/common/entity/job/Metrics.java +++ b/common/src/main/java/org/dromara/hertzbeat/common/entity/job/Metrics.java @@ -182,6 +182,10 @@ public class Metrics { * Monitoring configuration information using the public prometheus protocol */ private PrometheusProtocol prometheus; + /** + * Monitoring configuration information using the public DNS protocol + */ + private DnsProtocol dns; /** * collector use - Temporarily store subTask metrics response data diff --git a/common/src/main/java/org/dromara/hertzbeat/common/entity/job/protocol/DnsProtocol.java b/common/src/main/java/org/dromara/hertzbeat/common/entity/job/protocol/DnsProtocol.java new file mode 100644 index 00000000000..eb872258489 --- /dev/null +++ b/common/src/main/java/org/dromara/hertzbeat/common/entity/job/protocol/DnsProtocol.java @@ -0,0 +1,26 @@ +package org.dromara.hertzbeat.common.entity.job.protocol; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +/** + * @author Calvin + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class DnsProtocol { + private String dnsServerIP; + private String port; + private String address; + private String timeout; + private String tcp; + + public boolean isInvalid() { + return StringUtils.isAnyBlank(dnsServerIP, port, address, timeout, tcp); + } +} diff --git a/manager/src/main/resources/define/app-dns.yml b/manager/src/main/resources/define/app-dns.yml new file mode 100644 index 00000000000..7fefdb58814 --- /dev/null +++ b/manager/src/main/resources/define/app-dns.yml @@ -0,0 +1,499 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# The monitoring type category:service-application service monitoring db-database monitoring mid-middleware custom-custom monitoring os-operating system monitoring +# 监控类型所属类别:service-应用服务 program-应用程序 db-数据库 custom-自定义 os-操作系统 bigdata-大数据 mid-中间件 webserver-web服务器 cache-缓存 cn-云原生 network-网络监控等等 +category: service +# The monitoring type eg: linux windows tomcat mysql aws... +# 监控类型 eg: linux windows tomcat mysql aws... +app: dns +# 监控类型国际化名称 +name: + zh-CN: DNS服务器监控 + en-US: DNS SERVER MONITORS +# The description and help of this monitoring type +# 监控类型的帮助描述信息 +help: + zh-CN: HertzBeat 对 DNS 服务相关指标进行监测。 + en-US: HertzBeat monitors related indicators of the DNS service. + zh-TW: HertzBeat對DNS服務相關名額進行監測。 +# 监控所需输入参数定义(根据定义渲染页面UI) +# Input params define for monitoring(render web ui by the definition) +params: + # field-param field key + # field-字段名称标识符 + - field: host + # name-param field display i18n name + # name-参数字段显示名称 + name: + zh-CN: DNS服务器IP + en-US: DNS Server IP + # type-param field type(most mapping the html input type) + # type-字段类型,样式(大部分映射input标签type属性) + type: host + # required-true or false + # 是否是必输项 true-必填 false-可选 + required: true + # field-param field key + # field-字段名称标识符 + - field: port + # name-param field display i18n name + # name-参数字段显示名称 + name: + zh-CN: 端口 + en-US: Port + # type-param field type(most mapping the html input type) + # type-字段类型,样式(大部分映射input标签type属性) + type: number + # when type is number, range is required + # 当type为number时,用range表示范围 + range: '[0,65535]' + # required-true or false + # 是否是必输项 true-必填 false-可选 + required: true + # default value 53 + # 默认值 53 + defaultValue: 53 + - field: address + # name-param field display i18n name + # name-参数字段显示名称 + name: + zh-CN: 域名解析的地址 + en-US: Address For DNS + # type-param field type(most mapping the html input type) + # type-字段类型,样式(大部分映射input标签type属性) + type: text + # required-true or false + # 是否是必输项 true-必填 false-可选 + required: true + # field-param field key + # field-字段名称标识符 + - field: timeout + # name-param field display i18n name + # name-参数字段显示名称 + name: + zh-CN: 连接超时时间(ms) + en-US: Connect Timeout(ms) + # type-param field type(most mapping the html input type) + # type-字段类型,样式(大部分映射input标签type属性) + type: number + # when type is number, range is required + # 当type为number时,用range表示范围 + range: '[0,100000]' + # required-true or false + # 是否是必输项 true-必填 false-可选 + required: true + # default value 6000 + # 默认值 6000 + defaultValue: 6000 + - field: tcp + # name-param field display i18n name + # name-参数字段显示名称 + name: + zh-CN: 是否使用tcp协议 + en-US: Use TCP Protocol + # type-param field type(boolean mapping the html switch tag) + # type-当type为boolean时,前端用switch展示开关 + type: boolean + # required-true or false + # required-是否是必输项 true-必填 false-可选 + required: true + # default value false + # 默认值 false + defaultValue: false + +# collect metrics config list +# 采集指标配置列表 +metrics: + # metrics - header + # 监控指标 - header + - name: header + i18n: + zh-CN: Header + en-US: Header + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + # 指标采集调度优先级(0->127)->(优先级高->低) 优先级低的指标会等优先级高的指标采集完成后才会被调度, 相同优先级的指标会并行调度采集 + # 优先级为0的指标为可用性指标,即它会被首先调度,采集成功才会继续调度其它指标,采集失败则中断调度 + priority: 0 + # 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 label-是否是指标标签字段 unit:指标单位 + # field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-whether it is a metrics label field + # field-指标名称, type-指标类型(0-number数字,1-string字符串), unit-指标单位('%','ms','MB'), label-是否是指标标签字段 + fields: + - field: responseTime + type: 0 + unit: ms + i18n: + zh-CN: 响应时间 + en-US: Response Time + - field: opcode + type: 1 + i18n: + zh-CN: 操作码 + en-US: Opcode + - field: status + type: 1 + i18n: + zh-CN: 响应状态 + en-US: Response Status + - field: flags + type: 1 + i18n: + zh-CN: 响应标志 + en-US: Response Flags + - field: questionRowCount + type: 0 + i18n: + zh-CN: 请求记录数 + en-US: Question Record Count + - field: answerRowCount + type: 0 + i18n: + zh-CN: 响应记录数 + en-US: Answer Record Count + - field: authorityRowCount + type: 0 + i18n: + zh-CN: 授权记录数 + en-US: Authority Record Count + - field: additionalRowCount + type: 0 + i18n: + zh-CN: 附加记录数 + en-US: Additional Record Count + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk, dns + # 采集协议, 目前支持sql, ssh, http, telnet, wmi, snmp, sdk, dns + protocol: dns + # Specific collection configuration when protocol is telnet protocol + # 当protocol为telnet协议时具体的采集配置 + dns: + # DNS Server IP + # DNS服务器IP + dnsServerIP: ^_^host^_^ + # port + # 端口 + port: ^_^port^_^ + # address that used to run dig command + # 运行dig命令的域名 + address: ^_^address^_^ + # timeout + # 超时时间 + timeout: ^_^timeout^_^ + # 是否使用tcp协议 + # Use TCP Protocol + tcp: ^_^tcp^_^ + + # metrics - question + # 监控指标 - question + - name: question + i18n: + zh-CN: Question + en-US: Question + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + # 指标采集调度优先级(0->127)->(优先级高->低) 优先级低的指标会等优先级高的指标采集完成后才会被调度, 相同优先级的指标会并行调度采集 + # 优先级为0的指标为可用性指标,即它会被首先调度,采集成功才会继续调度其它指标,采集失败则中断调度 + priority: 0 + # 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 label-是否是指标标签字段 unit:指标单位 + # field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-whether it is a metrics label field + # field-指标名称, type-指标类型(0-number数字,1-string字符串), unit-指标单位('%','ms','MB'), label-是否是指标标签字段 + fields: + - field: section + type: 1 + i18n: + zh-CN: Section + en-US: Section + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk, dns + # 采集协议, 目前支持sql, ssh, http, telnet, wmi, snmp, sdk, dns + protocol: dns + # Specific collection configuration when protocol is telnet protocol + # 当protocol为telnet协议时具体的采集配置 + dns: + # DNS Server IP + # DNS服务器IP + dnsServerIP: ^_^host^_^ + # port + # 端口 + port: ^_^port^_^ + # address that used to run dig command + # 运行dig命令的域名 + address: ^_^address^_^ + # timeout + # 超时时间 + timeout: ^_^timeout^_^ + # 是否使用tcp协议 + # Use TCP Protocol + tcp: ^_^tcp^_^ + + # metrics - answer + # 监控指标 - answer + - name: answer + i18n: + zh-CN: Answer + en-US: Answer + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + # 指标采集调度优先级(0->127)->(优先级高->低) 优先级低的指标会等优先级高的指标采集完成后才会被调度, 相同优先级的指标会并行调度采集 + # 优先级为0的指标为可用性指标,即它会被首先调度,采集成功才会继续调度其它指标,采集失败则中断调度 + priority: 0 + # 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 label-是否是指标标签字段 unit:指标单位 + # field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-whether it is a metrics label field + # field-指标名称, type-指标类型(0-number数字,1-string字符串), unit-指标单位('%','ms','MB'), label-是否是指标标签字段 + fields: + - field: section0 + type: 1 + i18n: + zh-CN: Section0 + en-US: Section0 + - field: section1 + type: 1 + i18n: + zh-CN: Section1 + en-US: Section1 + - field: section2 + type: 1 + i18n: + zh-CN: Section2 + en-US: Section2 + - field: section3 + type: 1 + i18n: + zh-CN: Section3 + en-US: Section3 + - field: section4 + type: 1 + i18n: + zh-CN: Section4 + en-US: Section4 + - field: section5 + type: 1 + i18n: + zh-CN: Section5 + en-US: Section5 + - field: section6 + type: 1 + i18n: + zh-CN: Section6 + en-US: Section6 + - field: section7 + type: 1 + i18n: + zh-CN: Section7 + en-US: Section7 + - field: section8 + type: 1 + i18n: + zh-CN: Section8 + en-US: Section8 + - field: section9 + type: 1 + i18n: + zh-CN: Section9 + en-US: Section9 + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk, dns + # 采集协议, 目前支持sql, ssh, http, telnet, wmi, snmp, sdk, dns + protocol: dns + # Specific collection configuration when protocol is telnet protocol + # 当protocol为telnet协议时具体的采集配置 + dns: + # DNS Server IP + # DNS服务器IP + dnsServerIP: ^_^host^_^ + # port + # 端口 + port: ^_^port^_^ + # address that used to run dig command + # 运行dig命令的域名 + address: ^_^address^_^ + # timeout + # 超时时间 + timeout: ^_^timeout^_^ + # 是否使用tcp协议 + # Use TCP Protocol + tcp: ^_^tcp^_^ + + # metrics - authority + # 监控指标 - authority + - name: authority + i18n: + zh-CN: Authority + en-US: Authority + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + # 指标采集调度优先级(0->127)->(优先级高->低) 优先级低的指标会等优先级高的指标采集完成后才会被调度, 相同优先级的指标会并行调度采集 + # 优先级为0的指标为可用性指标,即它会被首先调度,采集成功才会继续调度其它指标,采集失败则中断调度 + priority: 0 + # 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 label-是否是指标标签字段 unit:指标单位 + # field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-whether it is a metrics label field + # field-指标名称, type-指标类型(0-number数字,1-string字符串), unit-指标单位('%','ms','MB'), label-是否是指标标签字段 + fields: + - field: section0 + type: 1 + i18n: + zh-CN: Section0 + en-US: Section0 + - field: section1 + type: 1 + i18n: + zh-CN: Section1 + en-US: Section1 + - field: section2 + type: 1 + i18n: + zh-CN: Section2 + en-US: Section2 + - field: section3 + type: 1 + i18n: + zh-CN: Section3 + en-US: Section3 + - field: section4 + type: 1 + i18n: + zh-CN: Section4 + en-US: Section4 + - field: section5 + type: 1 + i18n: + zh-CN: Section5 + en-US: Section5 + - field: section6 + type: 1 + i18n: + zh-CN: Section6 + en-US: Section6 + - field: section7 + type: 1 + i18n: + zh-CN: Section7 + en-US: Section7 + - field: section8 + type: 1 + i18n: + zh-CN: Section8 + en-US: Section8 + - field: section9 + type: 1 + i18n: + zh-CN: Section9 + en-US: Section9 + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk, dns + # 采集协议, 目前支持sql, ssh, http, telnet, wmi, snmp, sdk, dns + protocol: dns + # Specific collection configuration when protocol is telnet protocol + # 当protocol为telnet协议时具体的采集配置 + dns: + # DNS Server IP + # DNS服务器IP + dnsServerIP: ^_^host^_^ + # port + # 端口 + port: ^_^port^_^ + # address that used to run dig command + # 运行dig命令的域名 + address: ^_^address^_^ + # timeout + # 超时时间 + timeout: ^_^timeout^_^ + # 是否使用tcp协议 + # Use TCP Protocol + tcp: ^_^tcp^_^ + + # metrics - additional + # 监控指标 - additional + - name: additional + i18n: + zh-CN: Additional + en-US: Additional + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + # 指标采集调度优先级(0->127)->(优先级高->低) 优先级低的指标会等优先级高的指标采集完成后才会被调度, 相同优先级的指标会并行调度采集 + # 优先级为0的指标为可用性指标,即它会被首先调度,采集成功才会继续调度其它指标,采集失败则中断调度 + priority: 0 + # 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 label-是否是指标标签字段 unit:指标单位 + # field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-whether it is a metrics label field + # field-指标名称, type-指标类型(0-number数字,1-string字符串), unit-指标单位('%','ms','MB'), label-是否是指标标签字段 + fields: + - field: section0 + type: 1 + i18n: + zh-CN: Section0 + en-US: Section0 + - field: section1 + type: 1 + i18n: + zh-CN: Section1 + en-US: Section1 + - field: section2 + type: 1 + i18n: + zh-CN: Section2 + en-US: Section2 + - field: section3 + type: 1 + i18n: + zh-CN: Section3 + en-US: Section3 + - field: section4 + type: 1 + i18n: + zh-CN: Section4 + en-US: Section4 + - field: section5 + type: 1 + i18n: + zh-CN: Section5 + en-US: Section5 + - field: section6 + type: 1 + i18n: + zh-CN: Section6 + en-US: Section6 + - field: section7 + type: 1 + i18n: + zh-CN: Section7 + en-US: Section7 + - field: section8 + type: 1 + i18n: + zh-CN: Section8 + en-US: Section8 + - field: section9 + type: 1 + i18n: + zh-CN: Section9 + en-US: Section9 + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk, dns + # 采集协议, 目前支持sql, ssh, http, telnet, wmi, snmp, sdk, dns + protocol: dns + # Specific collection configuration when protocol is telnet protocol + # 当protocol为telnet协议时具体的采集配置 + dns: + # DNS Server IP + # DNS服务器IP + dnsServerIP: ^_^host^_^ + # port + # 端口 + port: ^_^port^_^ + # address that used to run dig command + # 运行dig命令的域名 + address: ^_^address^_^ + # timeout + # 超时时间 + timeout: ^_^timeout^_^ + # 是否使用tcp协议 + # Use TCP Protocol + tcp: ^_^tcp^_^