diff --git a/collector/src/main/java/org/dromara/hertzbeat/collector/collect/http/HttpCollectImpl.java b/collector/src/main/java/org/dromara/hertzbeat/collector/collect/http/HttpCollectImpl.java index 609e15d5017..94ed696b652 100644 --- a/collector/src/main/java/org/dromara/hertzbeat/collector/collect/http/HttpCollectImpl.java +++ b/collector/src/main/java/org/dromara/hertzbeat/collector/collect/http/HttpCollectImpl.java @@ -470,7 +470,7 @@ public HttpContext createHttpContext(HttpProtocol httpProtocol) { && StringUtils.hasText(auth.getDigestAuthPassword())) { CredentialsProvider provider = new BasicCredentialsProvider(); UsernamePasswordCredentials credentials - = new UsernamePasswordCredentials(auth.getBasicAuthUsername(), auth.getBasicAuthPassword()); + = new UsernamePasswordCredentials(auth.getDigestAuthUsername(), auth.getDigestAuthPassword()); provider.setCredentials(AuthScope.ANY, credentials); AuthCache authCache = new BasicAuthCache(); authCache.put(new HttpHost(httpProtocol.getHost(), Integer.parseInt(httpProtocol.getPort())), new DigestScheme()); diff --git a/manager/src/main/resources/define/app-emqx.yml b/manager/src/main/resources/define/app-emqx.yml new file mode 100644 index 00000000000..4c0a01f08da --- /dev/null +++ b/manager/src/main/resources/define/app-emqx.yml @@ -0,0 +1,422 @@ +# 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. + +# 此监控类型所属类别:service-应用服务监控 db-数据库监控 custom-自定义监控 os-操作系统监控 +category: mid +# 监控应用类型名称(与文件名保持一致) eg: linux windows tomcat mysql aws... +app: emqx +# The app api i18n name +# app api国际化名称 +name: + zh-CN: EMQX消息服务器 + en-US: EMQX Server +# The description and help of this monitoring type +# 监控类型的帮助描述信息 +help: + zh-CN: Hertzbeat对emqx消息服务器的通用指标进行测量监控,
您可以点击 “新建 EMQX消息服务器” 并进行配置,或者选择“更多操作”,导入已有配置。 + en-US: Hertzbeat measures and monitors common indicators of the emqx message server.
You can click "New EMQX message server" and configure it, or select "More operations", Import existing configuration. + zh-TW: Hertzbeat對emqx訊息伺服器的通用指標進行測量監控,
您可以點擊“新EMQX訊息伺服器” 並進行配置,或選擇“更多操作”,導入已有配置。 +helpLink: + zh-CN: https://hertzbeat.com/zh-cn/docs/help/emqx + en-US: https://hertzbeat.com/docs/help/emqx +# Input params define for monitoring(render web ui by the definition) +# 监控所需输入参数定义(根据定义渲染页面UI) +params: + # field-param field key + # field-字段名称标识符 + - field: host + # name-param field display i18n name + # name-参数字段显示名称 + name: + zh-CN: 主机Host + en-US: Host + # 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 + # required-是否是必输项 true-必填 false-可选 + required: true + # default value + # 端口默认值 + defaultValue: 18083 +# - field: ssl +# name: +# zh-CN: 启用HTTPS +# en-US: HTTPS +# type: boolean +# required: true +# defaultValue: false + - field: timeout + name: + zh-CN: 超时时间(ms) + en-US: Timeout(ms) + type: number + required: false + hide: true + - field: authType + name: + zh-CN: 认证方式 + en-US: Auth Type + type: radio + required: true + options: + - label: Basic Auth + value: Basic Auth + - field: apikey + name: + zh-CN: API Key + en-US: API Key + type: text + required: true +# hide: true + - field: secretkey + name: + zh-CN: Secret Key + en-US: Secret Key + type: text + required: true +# hide: true +metrics: + # the first metrics summary + # attention: Built-in monitoring metrics contains (responseTime - Response time) + # 第一个监控指标组 summary + # 注意:内置监控指标有 (responseTime - 响应时间) + - name: summary + # metrics group scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics group is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + # 指标组调度优先级(0-127)越小优先级越高,优先级低的指标组会等优先级高的指标组采集完成后才会被调度,相同优先级的指标组会并行调度采集 + # 优先级为0的指标组为可用性指标组,即它会被首先调度,采集成功才会继续调度其它指标组,采集失败则中断调度 + priority: 0 + # collect metrics content + # 指标组中的具体监控指标 + fields: + # metrics content contains field-metric name, type-metric type:0-number,1-string, instance-if is metrics group, unit-metric unit('%','ms','MB') + # 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位 + - field: client.connected + type: 0 + - field: client.disconnected + type: 0 + - field: packets.sent + type: 0 + - field: packets.received + type: 0 + - field: bytes.sent + type: 0 + - field: bytes.received + type: 0 + - field: messages.sent + type: 0 + - field: messages.acked + type: 0 + - field: messages.delayed + type: 0 + - field: authorization.deny + type: 0 + - field: client.authorize + type: 0 + - field: session.created + type: 0 + - field: session.discarded + type: 0 + + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk, we use HTTP protocol here + # 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk, 我们这里使用HTTP协议 + protocol: http + # the config content when protocol is http + # 当protocol为http协议时具体的采集配置 + http: + # http host: ipv4 ipv6 domain + # 主机host: ipv4 ipv6 域名 + host: ^_^host^_^ + # http port + # 端口 + port: ^_^port^_^ + # http url, we don't need to enter a parameter here, just set the fixed value to /api/summary + # url请求接口路径,我们这里不需要输入传参,写死为 /api/summary + url: /api/v5/metrics?aggregate=true + timeout: ^_^timeout^_^ + # http method: GET POST PUT DELETE PATCH, default fixed value is GET + # 请求方式 GET POST PUT DELETE PATCH,写死为 GET + method: GET + # if enabled https, default value is false + # 是否启用ssl/tls,即是http还是https,默认false + ssl: false # ^_^ssl^_^ + # http auth + # 认证 + authorization: + # http auth type: Basic Auth, Digest Auth, Bearer Token + # 认证方式: Basic Auth, Digest Auth, Bearer Token + type: ^_^authType^_^ + basicAuthUsername: ^_^apikey^_^ + basicAuthPassword: ^_^secretkey^_^ + # digestAuthUsername: ^_^username^_^ + # digestAuthPassword: ^_^password^_^ + # http response data parse type: default-hertzbeat rule, jsonpath-jsonpath script, website-for website monitoring, we use jsonpath to parse response data here + # 响应数据解析方式: default-系统规则,jsonPath-jsonPath脚本,website-网站可用性指标监控,我们这里使用jsonpath来解析响应数据 + parseType: jsonPath + parseScript: '$' + + - name: all + # metrics group scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics group is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + # 指标组调度优先级(0-127)越小优先级越高,优先级低的指标组会等优先级高的指标组采集完成后才会被调度,相同优先级的指标组会并行调度采集 + # 优先级为0的指标组为可用性指标组,即它会被首先调度,采集成功才会继续调度其它指标组,采集失败则中断调度 + priority: 0 + # collect metrics content + # 指标组中的具体监控指标 + fields: + # metrics content contains field-metric name, type-metric type:0-number,1-string, instance-if is metrics group, unit-metric unit('%','ms','MB') + # 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位 + - field: packets.pubcomp.received + type: 0 +# instance: true + - field: packets.pingreq.received + type: 0 + - field: packets.publish.inuse + type: 0 + - field: packets.pubrel.sent + type: 0 + - field: packets.pubrec.missed + type: 0 + - field: messages.delivered + type: 0 + - field: messages.dropped.await_pubrel_timeout + type: 0 + - field: client.connect + type: 0 + - field: packets.publish.auth_error + type: 0 + - field: client.connected + type: 0 + - field: messages.acked + type: 0 + - field: packets.publish.dropped + type: 0 + - field: packets.received + type: 0 + - field: packets.disconnect.sent + type: 0 + - field: client.subscribe + type: 0 + - field: authorization.superuser + type: 0 + - field: packets.disconnect.received + type: 0 + - field: packets.puback.received + type: 0 + - field: session.terminated + type: 0 + - field: client.authenticate + type: 0 + - field: packets.pubcomp.inuse + type: 0 + - field: olp.hbn + type: 0 + - field: session.resumed + type: 0 + - field: packets.pubrec.received + type: 0 + - field: packets.auth.sent + type: 0 + - field: olp.delay.ok + type: 0 + - field: client.disconnected + type: 0 + - field: messages.forward + type: 0 + - field: messages.qos2.sent + type: 0 + - field: packets.sent + type: 0 + - field: client.auth.anonymous + type: 0 + - field: packets.pubrel.missed + type: 0 + - field: delivery.dropped.no_local + type: 0 + - field: packets.pubcomp.missed + type: 0 + - field: packets.connack.auth_error + type: 0 + - field: authorization.nomatch + type: 0 + - field: messages.dropped + type: 0 + - field: packets.publish.error + type: 0 + - field: authorization.matched.deny + type: 0 + - field: authentication.success.anonymous + type: 0 + - field: packets.pubrel.received + type: 0 + - field: packets.unsuback.sent + type: 0 + - field: packets.unsubscribe.received + type: 0 + - field: packets.subscribe.received + type: 0 + - field: packets.unsubscribe.error + type: 0 + - field: client.connack + type: 0 + - field: bytes.received + type: 0 + - field: delivery.dropped.expired + type: 0 + - field: messages.qos1.sent + type: 0 + - field: packets.puback.inuse + type: 0 + - field: packets.publish.sent + type: 0 + - field: packets.pingresp.sent + type: 0 + - field: authorization.matched.allow + type: 0 + - field: messages.dropped.no_subscribers + type: 0 + - field: authorization.deny + type: 0 + - field: packets.puback.sent + type: 0 + - field: olp.delay.timeout + type: 0 + - field: messages.delayed + type: 0 + - field: packets.subscribe.error + type: 0 + - field: packets.connect.received + type: 0 + - field: authorization.allow + type: 0 + - field: packets.pubcomp.sent + type: 0 + - field: messages.received + type: 0 + - field: packets.pubrec.inuse + type: 0 + - field: packets.pubrec.sent + type: 0 + - field: client.authorize + type: 0 + - field: delivery.dropped.too_large + type: 0 + - field: bytes.sent + type: 0 + - field: olp.new_conn + type: 0 + - field: packets.subscribe.auth_error + type: 0 + - field: messages.qos1.received + type: 0 + - field: messages.qos0.sent + type: 0 + - field: authentication.failure + type: 0 + - field: packets.connack.sent + type: 0 + - field: messages.sent + type: 0 + - field: messages.publish + type: 0 + - field: session.takenover + type: 0 + - field: authentication.success + type: 0 + - field: session.created + type: 0 + - field: delivery.dropped.queue_full + type: 0 + - field: packets.publish.received + type: 0 + - field: packets.auth.received + type: 0 + - field: packets.puback.missed + type: 0 + - field: messages.qos0.received + type: 0 + - field: packets.connack.error + type: 0 + - field: session.discarded + type: 0 + - field: delivery.dropped + type: 0 + - field: olp.gc + type: 0 + - field: client.unsubscribe + type: 0 + - field: authorization.cache_hit + type: 0 + - field: delivery.dropped.qos0_msg + type: 0 + - field: messages.qos2.received + type: 0 + - field: packets.suback.sent + type: 0 + + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk, we use HTTP protocol here + # 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk, 我们这里使用HTTP协议 + protocol: http + # the config content when protocol is http + # 当protocol为http协议时具体的采集配置 + http: + # http host: ipv4 ipv6 domain + # 主机host: ipv4 ipv6 域名 + host: ^_^host^_^ + # http port + # 端口 + port: ^_^port^_^ + # http url, we don't need to enter a parameter here, just set the fixed value to /api/summary + # url请求接口路径,我们这里不需要输入传参,写死为 /api/summary + url: /api/v5/metrics?aggregate=true + timeout: ^_^timeout^_^ + # http method: GET POST PUT DELETE PATCH, default fixed value is GET + # 请求方式 GET POST PUT DELETE PATCH,写死为 GET + method: GET + # if enabled https, default value is false + # 是否启用ssl/tls,即是http还是https,默认false + ssl: false # ^_^ssl^_^ + # http auth + # 认证 + authorization: + # http auth type: Basic Auth, Digest Auth, Bearer Token + # 认证方式: Basic Auth, Digest Auth, Bearer Token + type: ^_^authType^_^ + basicAuthUsername: ^_^apikey^_^ + basicAuthPassword: ^_^secretkey^_^ +# digestAuthUsername: ^_^username^_^ +# digestAuthPassword: ^_^password^_^ + # http response data parse type: default-hertzbeat rule, jsonpath-jsonpath script, website-for website monitoring, we use jsonpath to parse response data here + # 响应数据解析方式: default-系统规则,jsonPath-jsonPath脚本,website-网站可用性指标监控,我们这里使用jsonpath来解析响应数据 + parseType: jsonPath + parseScript: '$' \ No newline at end of file