[doc] release the 1.9.0 documentation version (#4385)

This commit is contained in:
Duansg
2026-09-17 14:57:56 +08:00
committed by GitHub
parent a13d5af0a5
commit afd0f34e71
451 changed files with 51766 additions and 1 deletions
+1 -1
View File
@@ -327,7 +327,7 @@ module.exports = {
remarkPlugins: [
[require('@docusaurus/remark-plugin-npm2yarn'), { sync: true }],
],
lastVersion: '1.8.0',
lastVersion: '1.9.0',
versions: {
current: {
label: 'current',
@@ -0,0 +1,166 @@
{
"version.label": {
"message": "1.9.0",
"description": "The label for version current"
},
"sidebar.docs.category.quickstart": {
"message": "QuickStart",
"description": "The label for category quickstart in sidebar docs"
},
"sidebar.docs.category.custom": {
"message": "Custom Monitoring",
"description": "The label for category custom in sidebar docs"
},
"sidebar.docs.category.http": {
"message": "HTTP Protocol",
"description": "The label for category http in sidebar docs"
},
"sidebar.docs.category.jdbc": {
"message": "JDBC Protocol",
"description": "The label for category jdbc in sidebar docs"
},
"sidebar.docs.category.ssh": {
"message": "SSH Protocol",
"description": "The label for category ssh in sidebar docs"
},
"sidebar.docs.category.telnet": {
"message": "TELNET Protocol",
"description": "The label for category telnet in sidebar docs"
},
"sidebar.docs.category.guides": {
"message": "Use Guides",
"description": "The label for category guides in sidebar docs"
},
"sidebar.docs.category.service": {
"message": "Service Monitor",
"description": "The label for category service in sidebar docs"
},
"sidebar.docs.category.database": {
"message": "Database Monitor",
"description": "The label for category database in sidebar docs"
},
"sidebar.docs.category.os": {
"message": "OS Monitor",
"description": "The label for category os in sidebar docs"
},
"sidebar.docs.category.server": {
"message": "Server Monitor",
"description": "The label for category server in sidebar docs"
},
"sidebar.docs.category.alert": {
"message": "Alerting",
"description": "The label for category alert in sidebar docs"
},
"sidebar.docs.category.notice": {
"message": "Notification",
"description": "The label for category notice in sidebar docs"
},
"sidebar.docs.category.service-discovery": {
"message": "Service Discovery",
"description": "The label for category service-discovery in sidebar docs"
},
"sidebar.docs.category.mid": {
"message": "Middleware Monitor",
"description": "The label for category mid in sidebar docs"
},
"sidebar.docs.category.Others": {
"message": "Others",
"description": "The label for category Others in sidebar docs"
},
"sidebar.docs.category.cloud-native": {
"message": "CloudNative Monitor",
"description": "The label for category cloud-native in sidebar docs"
},
"sidebar.docs.category.jmx": {
"message": "JMX Protocol",
"description": "The label for category jmx in sidebar docs"
},
"sidebar.docs.category.snmp": {
"message": "SNMP Protocol",
"description": "The label for category snmp in sidebar docs"
},
"sidebar.docs.link.Install via Helm": {
"message": "Install via Helm",
"description": "The label for link Install via Helm in sidebar docs, linking to https://artifacthub.io/packages/helm/hertzbeat/hertzbeat"
},
"sidebar.docs.category.push": {
"message": "Push",
"description": "The label for category push in sidebar docs"
},
"sidebar.docs.category.program": {
"message": "Program Monitor",
"description": "The label for category program in sidebar docs"
},
"sidebar.docs.category.cache": {
"message": "Cache Monitor",
"description": "The label for category cache in sidebar docs"
},
"sidebar.docs.category.bigdata": {
"message": "Bigdata Monitor",
"description": "The label for category bigdata in sidebar docs"
},
"sidebar.docs.category.webserver": {
"message": "WebServer Monitor",
"description": "The label for category webserver in sidebar docs"
},
"sidebar.docs.category.contribution": {
"message": "Contribution Guide",
"description": "The label for category contribution in sidebar docs"
},
"sidebar.docs.category.submit": {
"message": "Submit Guide",
"description": "The label for category submit in sidebar docs"
},
"sidebar.docs.category.release": {
"message": "Release Guide",
"description": "The label for category release in sidebar docs"
},
"sidebar.docs.category.Community": {
"message": "Community",
"description": "The label for category Community in sidebar docs"
},
"sidebar.docs.category.network": {
"message": "Network Monitor",
"description": "The label for category network in sidebar docs"
},
"sidebar.docs.category.NGQL": {
"message": "NGQL",
"description": "The label for category NGQL in sidebar docs"
},
"sidebar.docs.category.llm": {
"message": "AI LLM Monitor",
"description": "The label for category llm in sidebar docs"
},
"sidebar.docs.category.aiConfig": {
"message": "AI LLM Config",
"description": "The label for category aiConfig in sidebar docs"
},
"sidebar.docs.category.install": {
"message": "Install",
"description": "The label for category install in sidebar docs"
},
"sidebar.docs.category.upgrade": {
"message": "Upgrade",
"description": "The label for category upgrade in sidebar docs"
},
"sidebar.docs.category.setting": {
"message": "Setting",
"description": "The label for category setting in sidebar docs"
},
"sidebar.docs.category.change-db": {
"message": "Change DB",
"description": "The label for category change-db in sidebar docs"
},
"sidebar.docs.category.use-case": {
"message": "Use Case",
"description": "The label for category use-case in sidebar docs"
},
"sidebar.docs.category.extern-deploy": {
"message": "Extern Install",
"description": "The label for category extern-deploy in sidebar docs"
},
"sidebar.docs.category.log": {
"message": "Log",
"description": "The label for category log in sidebar docs"
}
}
@@ -0,0 +1,166 @@
{
"version.label": {
"message": "1.9.0",
"description": "The label for version current"
},
"sidebar.docs.category.quickstart": {
"message": "빠른 시작",
"description": "The label for category quickstart in sidebar docs"
},
"sidebar.docs.category.custom": {
"message": "커스텀 모니터링",
"description": "The label for category custom in sidebar docs"
},
"sidebar.docs.category.http": {
"message": "HTTP 프로토콜",
"description": "The label for category http in sidebar docs"
},
"sidebar.docs.category.jdbc": {
"message": "JDBC 프로토콜",
"description": "The label for category jdbc in sidebar docs"
},
"sidebar.docs.category.ssh": {
"message": "SSH 프로토콜",
"description": "The label for category ssh in sidebar docs"
},
"sidebar.docs.category.telnet": {
"message": "TELNET 프로토콜",
"description": "The label for category telnet in sidebar docs"
},
"sidebar.docs.category.guides": {
"message": "사용 가이드",
"description": "The label for category guides in sidebar docs"
},
"sidebar.docs.category.service": {
"message": "서비스 모니터링",
"description": "The label for category service in sidebar docs"
},
"sidebar.docs.category.database": {
"message": "데이터베이스 모니터링",
"description": "The label for category database in sidebar docs"
},
"sidebar.docs.category.os": {
"message": "OS 모니터링",
"description": "The label for category os in sidebar docs"
},
"sidebar.docs.category.server": {
"message": "서버 모니터링",
"description": "The label for category server in sidebar docs"
},
"sidebar.docs.category.alert": {
"message": "알람",
"description": "The label for category alert in sidebar docs"
},
"sidebar.docs.category.notice": {
"message": "알림",
"description": "The label for category notice in sidebar docs"
},
"sidebar.docs.category.service-discovery": {
"message": "서비스 디스커버리",
"description": "The label for category service-discovery in sidebar docs"
},
"sidebar.docs.category.mid": {
"message": "미들웨어 모니터링",
"description": "The label for category mid in sidebar docs"
},
"sidebar.docs.category.Others": {
"message": "기타",
"description": "The label for category Others in sidebar docs"
},
"sidebar.docs.category.cloud-native": {
"message": "클라우드 네이티브 모니터링",
"description": "The label for category cloud-native in sidebar docs"
},
"sidebar.docs.category.jmx": {
"message": "JMX 프로토콜",
"description": "The label for category jmx in sidebar docs"
},
"sidebar.docs.category.snmp": {
"message": "SNMP 프로토콜",
"description": "The label for category snmp in sidebar docs"
},
"sidebar.docs.link.Install via Helm": {
"message": "Helm으로 설치",
"description": "The label for link Install via Helm in sidebar docs, linking to https://artifacthub.io/packages/helm/hertzbeat/hertzbeat"
},
"sidebar.docs.category.push": {
"message": "Push",
"description": "The label for category push in sidebar docs"
},
"sidebar.docs.category.program": {
"message": "애플리케이션 모니터링",
"description": "The label for category program in sidebar docs"
},
"sidebar.docs.category.cache": {
"message": "캐시 모니터링",
"description": "The label for category cache in sidebar docs"
},
"sidebar.docs.category.bigdata": {
"message": "빅데이터 모니터링",
"description": "The label for category bigdata in sidebar docs"
},
"sidebar.docs.category.webserver": {
"message": "웹서버 모니터링",
"description": "The label for category webserver in sidebar docs"
},
"sidebar.docs.category.contribution": {
"message": "기여 가이드",
"description": "The label for category contribution in sidebar docs"
},
"sidebar.docs.category.submit": {
"message": "제출 가이드",
"description": "The label for category submit in sidebar docs"
},
"sidebar.docs.category.release": {
"message": "릴리스 가이드",
"description": "The label for category release in sidebar docs"
},
"sidebar.docs.category.Community": {
"message": "커뮤니티",
"description": "The label for category Community in sidebar docs"
},
"sidebar.docs.category.network": {
"message": "네트워크 모니터링",
"description": "The label for category network in sidebar docs"
},
"sidebar.docs.category.NGQL": {
"message": "NGQL",
"description": "The label for category NGQL in sidebar docs"
},
"sidebar.docs.category.llm": {
"message": "AI LLM 모니터링",
"description": "The label for category llm in sidebar docs"
},
"sidebar.docs.category.aiConfig": {
"message": "AI LLM 설정",
"description": "The label for category aiConfig in sidebar docs"
},
"sidebar.docs.category.install": {
"message": "설치",
"description": "The label for category install in sidebar docs"
},
"sidebar.docs.category.upgrade": {
"message": "업그레이드",
"description": "The label for category upgrade in sidebar docs"
},
"sidebar.docs.category.setting": {
"message": "설정",
"description": "The label for category setting in sidebar docs"
},
"sidebar.docs.category.change-db": {
"message": "DB 변경",
"description": "The label for category change-db in sidebar docs"
},
"sidebar.docs.category.use-case": {
"message": "사용 사례",
"description": "The label for category use-case in sidebar docs"
},
"sidebar.docs.category.extern-deploy": {
"message": "외부 설치",
"description": "The label for category extern-deploy in sidebar docs"
},
"sidebar.docs.category.log": {
"message": "로그",
"description": "The label for category log in sidebar docs"
}
}
@@ -0,0 +1,186 @@
{
"version.label": {
"message": "1.9.0",
"description": "The label for version current"
},
"sidebar.docs.category.quickstart": {
"message": "快速开始",
"description": "The label for category quickstart in sidebar docs"
},
"sidebar.docs.category.custom": {
"message": "自定义监控",
"description": "The label for category custom in sidebar docs"
},
"sidebar.docs.category.http": {
"message": "HTTP协议",
"description": "The label for category http in sidebar docs"
},
"sidebar.docs.category.jdbc": {
"message": "JDBC协议",
"description": "The label for category jdbc in sidebar docs"
},
"sidebar.docs.category.ssh": {
"message": "SSH协议",
"description": "The label for category ssh in sidebar docs"
},
"sidebar.docs.category.telnet": {
"message": "TELNET协议",
"description": "The label for category telnet in sidebar docs"
},
"sidebar.docs.category.guides": {
"message": "使用指南",
"description": "The label for category guides in sidebar docs"
},
"sidebar.docs.category.service": {
"message": "应用服务监控",
"description": "The label for category service in sidebar docs"
},
"sidebar.docs.category.database": {
"message": "数据库监控",
"description": "The label for category database in sidebar docs"
},
"sidebar.docs.category.os": {
"message": "操作系统监控",
"description": "The label for category os in sidebar docs"
},
"sidebar.docs.category.server": {
"message": "服务器监控",
"description": "The label for category server in sidebar docs"
},
"sidebar.docs.category.mid": {
"message": "中间件监控",
"description": "The label for category mid in sidebar docs"
},
"sidebar.docs.category.alert": {
"message": "阈值告警",
"description": "The label for category alert in sidebar docs"
},
"sidebar.docs.category.notice": {
"message": "消息通知",
"description": "The label for category notice in sidebar docs"
},
"sidebar.docs.category.service-discovery": {
"message": "服务发现",
"description": "The label for category service-discovery in sidebar docs"
},
"sidebar.docs.category.Others": {
"message": "其它",
"description": "The label for category Others in sidebar docs"
},
"sidebar.docs.category.cloud-native": {
"message": "云原生监控",
"description": "The label for category cloud-native in sidebar docs"
},
"sidebar.docs.link.Install via HuaweiCloud": {
"message": "华为云方式部署",
"description": "The label for link Install via HuaweiCloud in sidebar docs, linking to https://marketplace.huaweicloud.com/contents/0477015c-ad63-4522-a308-816861769f0a#productid=OFFI863735781612109824"
},
"sidebar.docs.category.jmx": {
"message": "JMX协议",
"description": "The label for category jmx in sidebar docs"
},
"sidebar.docs.category.snmp": {
"message": "SNMP协议",
"description": "The label for category snmp in sidebar docs"
},
"sidebar.docs.link.Install via Helm": {
"message": "Helm方式安装",
"description": "The label for link Install via Helm in sidebar docs, linking to https://artifacthub.io/packages/helm/hertzbeat/hertzbeat"
},
"sidebar.docs.category.push": {
"message": "Push",
"description": "The label for category push in sidebar docs"
},
"sidebar.docs.category.program": {
"message": "应用程序监控",
"description": "The label for category program in sidebar docs"
},
"sidebar.docs.category.cache": {
"message": "缓存监控",
"description": "The label for category cache in sidebar docs"
},
"sidebar.docs.category.bigdata": {
"message": "大数据监控",
"description": "The label for category bigdata in sidebar docs"
},
"sidebar.docs.category.webserver": {
"message": "Web服务器监控",
"description": "The label for category webserver in sidebar docs"
},
"sidebar.docs.category.Community": {
"message": "社区",
"description": "The label for category Community in sidebar docs"
},
"sidebar.docs.category.contribution": {
"message": "贡献指南",
"description": "The label for category contribution in sidebar docs"
},
"sidebar.docs.category.submit": {
"message": "提交指南",
"description": "The label for category submit in sidebar docs"
},
"sidebar.docs.category.release": {
"message": "发布指南",
"description": "The label for category release in sidebar docs"
},
"sidebar.docs.category.network": {
"message": "网络监控",
"description": "The label for category network in sidebar docs"
},
"sidebar.docs.category.NGQL": {
"message": "NGQL",
"description": "The label for category NGQL in sidebar docs"
},
"sidebar.docs.category.llm": {
"message": "AI大模型监控",
"description": "The label for category llm in sidebar docs"
},
"sidebar.docs.category.aiConfig": {
"message": "AI大模型配置",
"description": "The label for category aiConfig in sidebar docs"
},
"sidebar.docs.category.install": {
"message": "安装",
"description": "The label for category install in sidebar docs"
},
"sidebar.docs.category.upgrade": {
"message": "升级",
"description": "The label for category upgrade in sidebar docs"
},
"sidebar.docs.category.setting": {
"message": "配置",
"description": "The label for category setting in sidebar docs"
},
"sidebar.docs.category.change-db": {
"message": "数据库切换",
"description": "The label for category change-db in sidebar docs"
},
"sidebar.docs.category.use-case": {
"message": "使用案例",
"description": "The label for category use-case in sidebar docs"
},
"sidebar.docs.category.extern-deploy": {
"message": "集成平台部署",
"description": "The label for category extern-deploy in sidebar docs"
},
"sidebar.docs.category.quickstart-use-case": {
"message": "使用案例",
"description": "The label for category quickstart-use-case in sidebar docs"
},
"sidebar.docs.category.guides-use-case": {
"message": "使用案例",
"description": "The label for category guides-use-case in sidebar docs"
},
"sidebar.docs.category.help-custom": {
"message": "自定义监控",
"description": "The label for category help-custom in sidebar docs"
},
"sidebar.docs.category.advanced-custom": {
"message": "自定义监控",
"description": "The label for category advanced-custom in sidebar docs"
},
"sidebar.docs.category.log": {
"message": "日志监控 (Beta)",
"description": "The label for category log in sidebar docs"
}
}
@@ -0,0 +1,285 @@
---
id: extend-http-default
title: HTTP协议系统默认解析方式
sidebar_label: 系统默认解析方式
---
> HTTP接口调用获取响应数据后,用 Apache HertzBeat™ 默认的解析方式去解析响应数据。
**此需接口响应数据结构符合HertzBeat指定的数据结构规则**
## HertzBeat数据格式规范
注意⚠️ 响应数据为JSON
单层格式:key-value
```json
{
"metricName1": "metricValue",
"metricName2": "metricValue",
"metricName3": "metricValue",
"metricName4": "metricValue"
}
```
多层格式:数组里面套key-value
```json
[
{
"metricName1": "metricValue",
"metricName2": "metricValue",
"metricName3": "metricValue",
"metricName4": "metricValue"
},
{
"metricName1": "metricValue",
"metricName2": "metricValue",
"metricName3": "metricValue",
"metricName4": "metricValue"
}
]
```
样例:
查询自定义系统的CPU信息,其暴露接口为 `/metrics/cpu`,我们需要其中的`hostname,core,usage`指标
若只有一台虚拟机,其单层格式为:
```json
{
"hostname": "linux-1",
"core": 1,
"usage": 78.0,
"allTime": 200,
"runningTime": 100
}
```
若有多台虚拟机,其多层格式为:
```json
[
{
"hostname": "linux-1",
"core": 1,
"usage": 78.0,
"allTime": 200,
"runningTime": 100
},
{
"hostname": "linux-2",
"core": 3,
"usage": 78.0,
"allTime": 566,
"runningTime": 34
},
{
"hostname": "linux-3",
"core": 4,
"usage": 38.0,
"allTime": 500,
"runningTime": 20
}
]
```
**对应的监控模板YML可以配置为如下**
```yaml
category: custom
# The monitoring type eg: linux windows tomcat mysql aws...
app: a_example
# The monitoring i18n name
name:
zh-CN: 模拟应用
en-US: EXAMPLE APP
# The description and help of this monitoring type
help:
zh-CN: HertzBeat 支持自定义监控,您只需配置监控模板 YML 就能适配一款自定义的监控类型。`<br>`定义流程如下:HertzBeat 页面 -> 监控模板菜单 -> 新增监控类型 -> 配置自定义监控模板YML -> 点击保存应用 -> 使用新监控类型添加监控。
en-US: "HertzBeat supports custom monitoring, and you only need to configure the monitoring template YML to adapt to a custom monitoring type. `<br>`Definition process as follow: HertzBeat Pages -> Main Menu -> Monitor Template -> edit and save -> apply this template."
zh-TW: HertzBeat支持自定義監控,您只需配寘監控模板YML就能適配一款自定義的監控類型。`<br>`定義流程如下:HertzBeat頁面->監控模板選單->新增監控類型->配寘自定義監控模板YML ->點擊保存應用->使用新監控類型添加監控。
helpLink:
zh-CN: https://hertzbeat.apache.org/zh-cn/docs/advanced/extend-point/
en-US: https://hertzbeat.apache.org/docs/advanced/extend-point/
# Input params define for monitoring(render web ui by the definition)
params:
# field-param field key
- field: host
# name-param field display i18n name
name:
zh-CN: 目标Host
en-US: Target Host
# type-param field type(most mapping the html input type)
type: host
# required-true or false
required: true
# field-param field key
- field: port
# name-param field display i18n name
name:
zh-CN: 端口
en-US: Port
# type-param field type(most mapping the html input type)
type: number
# when type is number, range is required
range: '[0,65535]'
# required-true or false
required: true
# default value
defaultValue: 80
# param field input placeholder
placeholder: 'Please Input Port'
# field-param field key
- field: username
# name-param field display i18n name
name:
zh-CN: 用户名
en-US: Username
# type-param field type(most mapping the html input type)
type: text
# when type is text, use limit to limit string length
limit: 50
# required-true or false
required: false
# hide param-true or false
hide: true
# field-param field key
- field: password
# name-param field display i18n name
name:
zh-CN: 用户密码
en-US: Password
# type-param field type(most mapping the html input tag)
type: password
# required-true or false
required: false
# hide param-true or false
hide: true
# field-param field key
- field: ssl
# name-param field display i18n name
name:
zh-CN: 启动SSL
en-US: SSL
# type-param field type(boolean mapping the html switch tag)
type: boolean
# required-true or false
required: false
# field-param field key
- field: method
# name-param field display i18n name
name:
zh-CN: 请求方式
en-US: Method
# type-param field type(radio mapping the html radio tag)
type: radio
# required-true or false
required: true
# when type is radio checkbox, use option to show optional values {name1:value1,name2:value2}
options:
- label: GET
value: GET
- label: POST
value: POST
- label: PUT
value: PUT
- label: DELETE
value: DELETE
# field-param field key
- field: headers
# name-param field display i18n name
name:
zh-CN: 请求Headers
en-US: Headers
# type-param field type(key-value mapping the html key-value input tags)
type: key-value
# required-true or false
required: false
# when type is key-value, use keyAlias to config key alias name
keyAlias: Header Name
# when type is key-value, use valueAlias to config value alias name
valueAlias: Header Value
# collect metrics config list
metrics:
# metrics - cpu
- name: cpu
# metrics name i18n label
i18n:
zh-CN: CPU 信息
en-US: CPU Info
# 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
priority: 0
# collect metrics content
fields:
# field-metric name, i18n-metric name i18n label, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-whether it is a metrics label field
- field: hostname
type: 1
label: true
i18n:
zh-CN: 主机名称
en-US: Host Name
- field: usage
type: 0
unit: '%'
i18n:
zh-CN: 使用率
en-US: Usage
- field: cores
type: 0
i18n:
zh-CN: 核数
en-US: Cores
- field: waitTime
type: 0
unit: s
i18n:
zh-CN: 主机名称
en-US: Host Name
# (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field
aliasFields:
- hostname
- core1
- core2
- usage
- allTime
- runningTime
# mapping and conversion expressions, use these and aliasField above to calculate metrics value
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
calculates:
- hostname=hostname
- cores=core1+core2
- usage=usage
- waitTime=allTime-runningTime
# the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: http
# the config content when protocol is http
http:
# http host: ipv4 ipv6 domain
host: ^_^host^_^
# http port
port: ^_^port^_^
# http url
url: /metrics/cpu
# http method: GET POST PUT DELETE PATCH
method: GET
# if enabled https
ssl: false
# http request header content
headers:
^_^headers^_^: ^_^headers^_^
# http request params
params:
param1: param1
param2: param2
# http auth
authorization:
# http auth type: Basic Auth, Digest Auth, Bearer Token
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
# http response data parse type: default-hertzbeat rule, jsonpath-jsonpath script, website-for website monitoring, prometheus-prometheus exporter rule
parseType: jsonPath
parseScript: '$'
```
@@ -0,0 +1,217 @@
---
id: extend-http-example-hertzbeat
title: 教程一:适配一款基于HTTP协议的监控类型
sidebar_label: 教程一:适配一款HTTP协议监控
---
通过此教程我们一步一步描述如何在 Apache HertzBeat™ 监控系统下新增适配一款基于http协议的监控类型。
阅读此教程前我们希望您已经从[自定义监控](extend-point)和[http协议自定义](extend-http)了解熟悉了怎么自定义类型,指标,协议等。
## HTTP协议解析通用响应结构体,获取指标数据
>
> 很多场景我们需要对提供的 HTTP API 接口进行监控,获取接口返回的指标值。这篇文章我们通过http自定义协议来解析我们常见的http接口响应结构,获取返回体中的字段作为指标数据。
```json
{
"code": 200,
"msg": "success",
"data": {}
}
```
如上,通常我们的后台API接口会设计这这样一个通用返回。hertzbeat系统的后台也是如此,我们今天就用hertzbeat的 API 做样例,新增适配一款新的监控类型 **hertzbeat**,监控采集它的系统摘要统计API
`http://localhost:1157/api/summary`, 其响应数据为:
```json
{
"msg": null,
"code": 0,
"data": {
"apps": [
{
"category": "service",
"app": "jvm",
"status": 0,
"size": 2,
"availableSize": 0,
"unManageSize": 2,
"unAvailableSize": 0,
"unReachableSize": 0
},
{
"category": "service",
"app": "website",
"status": 0,
"size": 2,
"availableSize": 0,
"unManageSize": 2,
"unAvailableSize": 0,
"unReachableSize": 0
}
]
}
}
```
**我们这次获取其app下的 `category`,`app`,`status`,`size`,`availableSize`等指标数据。**
### 新增自定义监控模板YML
**HertzBeat页面** -> **监控模板菜单** -> **新增监控类型** -> **配置自定义监控模板YML** -> **点击保存应用** -> **使用新监控类型添加监控**
> 监控模板YML用于定义 *监控类型的名称(国际化), 请求参数结构定义(前端页面根据配置自动渲染UI), 采集指标信息, 采集协议配置* 等。
> 即我们通过自定义这个监控模板,配置定义什么监控类型,前端页面需要输入什么参数,采集哪些性能指标,通过什么协议去采集。
样例:自定义一个名称为`hertzbeat`的自定义监控类型,其使用HTTP协议采集指标数据。
```yaml
category: custom
# The monitoring type eg: linux windows tomcat mysql aws...
app: hertzbeat
name:
zh-CN: HertzBeat
en-US: HertzBeat
# The description and help of this monitoring type
help:
zh-CN: HertzBeat 对 HertzBeat 监控系统的通用指标进行测量监控。`<br>`您可以点击 “`<i>`新建 HertzBeat监控系统`</i>`” 并进行配置,或者选择“`<i>`更多操作`</i>`”,导入已有配置。
en-US: HertzBeat monitors HertzBeat Monitor through general performance metric. You could click the "`<i>`New HertzBeat Monitor`</i>`" button and proceed with the configuration or import an existing setup through the "`<i>`More Actions`</i>`" menu.
zh-TW: HertzBeat對HertzBeat監控系統的通用名額進行量測監控。`<br>`您可以點擊“`<i>`新建HertzBeat監控系統`</i>`”並進行配寘,或者選擇“`<i>`更多操作`</i>`”,導入已有配寘。
helpLink:
zh-CN: https://hertzbeat.apache.org/zh-cn/docs/help/hertzbeat
en-US: https://hertzbeat.apache.org/docs/help/hertzbeat
params:
- field: host
name:
zh-CN: 目标Host
en-US: Target Host
type: host
required: true
- field: port
name:
zh-CN: 端口
en-US: Port
type: number
range: '[0,65535]'
required: true
defaultValue: 1157
- field: ssl
name:
zh-CN: 启用HTTPS
en-US: HTTPS
type: boolean
required: true
- 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: false
hide: true
options:
- label: Basic Auth
value: Basic Auth
- label: Digest Auth
value: Digest Auth
- field: username
name:
zh-CN: 用户名
en-US: Username
type: text
limit: 50
required: false
hide: true
- field: password
name:
zh-CN: 密码
en-US: Password
type: password
required: false
hide: true
metrics:
# the first metrics summary
# attention: Built-in monitoring metrics contains (responseTime - Response time)
- name: summary
# 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
priority: 0
# collect metrics content
fields:
# metrics content contains field-metric name, type-metric type:0-number,1-string, instance-if is metrics, unit-metric unit('%','ms','MB')
- field: app
type: 1
label: true
- field: category
type: 1
- field: status
type: 0
- field: size
type: 0
- field: availableSize
type: 0
# the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk, we use HTTP protocol here
protocol: http
# the config content when protocol is http
http:
# host: ipv4 ipv6 domain
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
timeout: ^_^timeout^_^
# http method: GET POST PUT DELETE PATCH, default fixed value is GET
method: GET
# if enabled https, default value is false
ssl: ^_^ssl^_^
# http auth
authorization:
# http auth type: Basic Auth, Digest Auth, Bearer Token
type: ^_^authType^_^
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
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
parseType: jsonPath
parseScript: '$.data.apps.*'
```
**新增完毕,现在我们重启hertzbeat系统。我们可以看到系统页面已经多了一个`hertzbeat`监控类型了。**
![HertzBeat](/img/docs/advanced/extend-http-example-1.png)
### 系统页面添加对`hertzbeat`监控类型的监控
> 我们点击新增 `HertzBeat监控系统`,配置监控IP,端口,采集周期,高级设置里的账户密码等, 点击确定添加监控。
![HertzBeat](/img/docs/advanced/extend-http-example-2.png)
![HertzBeat](/img/docs/advanced/extend-http-example-3.png)
> 过一定时间(取决于采集周期)我们就可以在监控详情看到具体的指标数据和历史图表啦!
![HertzBeat](/img/docs/advanced/extend-http-example-4.png)
### 设置阈值告警通知
> 接下来我们就可以正常的设置阈值,告警触发后可以在告警中心查看,也可以新增接收人,设置告警通知等,Have Fun!!!
----
#### 完
HTTP协议的自定义监控的实践就到这里,HTTP协议还带其他参数headers,params等,我们可以像用postman一样去定义它,可玩性也非常高!
如果您觉得hertzbeat这个开源项目不错的话欢迎给我们在GitHub Gitee star哦,灰常感谢。感谢老铁们的支持。笔芯!
**github: [https://github.com/apache/hertzbeat](https://github.com/apache/hertzbeat)**
@@ -0,0 +1,400 @@
---
id: extend-http-example-token
title: 教程二:基于HTTP协议获取TOKEN指标值,给后续采集认证使用
sidebar_label: 教程二:获取TOKEN后续认证使用
---
通过此教程我们一步一步描述如何在教程一的基础上改造,新增一个监控指标,先调用认证接口获取TOKEN后,使用TOKEN作为参数供后面的监控指标采集认证使用。
阅读此教程前我们希望您已经从[自定义监控](extend-point)和[http协议自定义](extend-http)了解熟悉了怎么自定义类型,指标,协议等。
## 请求流程
【**认证信息监控指标(优先级最高)**】【**HTTP接口携带账户密码调用**】->【**响应数据解析**】->【**解析签发TOKEN-accessToken作为指标**】->【**将accessToken作为变量参数赋值给其他采集监控指标**】
> 这里我们依然用教程一的hertzbeat监控举例!hertzbeat后台接口不仅仅支持教程一使用的basic直接账户密码认证,也支持token认证。
**我们需要`POST`调用登录接口`/api/account/auth/form`获取`accessToken`,请求body(json格式)如下**:
```json
{
"credential": "hertzbeat",
"identifier": "admin"
}
```
**响应结构数据如下**:
```json
{
"data": {
"token": "xxxx",
"refreshToken": "xxxx"
},
"msg": null,
"code": 0
}
```
### 新增自定义监控类型`hertzbeat_token`
1. 自定义监控类型需新增配置监控模板YML,我们直接复用教程一的 `hertzbeat` 监控类型,在其基础上修改
监控配置定义文件是用来定义采集类型是啥,需要用哪种协议采集方式,采集的指标是啥,协议的配置参数等。
我们直接复用 app-hertzbeat.yml 里面的定义内容,修改为我们当前的监控类型`hertzbeat_auth`配置参数, 比如 `app, category等`
```yaml
category: custom
# The monitoring type eg: linux windows tomcat mysql aws...
app: hertzbeat_token
# The monitoring i18n name
name:
zh-CN: HertzBeat(Token)
en-US: HertzBeat(Token)
# The description and help of this monitoring type
help:
zh-CN: HertzBeat 对 HertzBeat监控(Token)进行测量监控。`<br>`您可以点击 “`<i>`新建 HertzBeat监控(Token)`</i>`” 并进行配置,或者选择“`<i>`更多操作`</i>`”,导入已有配置。
en-US: HertzBeat monitors HertzBeat Monitor(Token). You could click the "`<i>`New HertzBeat Monitor(Token)`</i>`" button and proceed with the configuration or import an existing setup through the "`<i>`More Actions`</i>`" menu.
zh-TW: HertzBeat對HertzBeat監控(Token)進行量測監控。`<br>`您可以點擊“`<i>`新建HertzBeat監控(Token`</i>`”並進行配寘,或者選擇“`<i>`更多操作`</i>`”,導入已有配寘。
helpLink:
zh-CN: https://hertzbeat.apache.org/zh-cn/docs/help/hertzbeat_token
en-US: https://hertzbeat.apache.org/docs/help/hertzbeat_token
# Input params define for monitoring(render web ui by the definition)
params:
# field-param field key
- field: host
# name-param field display i18n name
name:
zh-CN: 目标Host
en-US: Target Host
# type-param field type(most mapping the html input type)
type: host
# required-true or false
required: true
- field: port
name:
zh-CN: 端口
en-US: Port
# type-param field type(most mapping the html input type)
type: number
# when type is number, range is required
range: '[0,65535]'
required: true
defaultValue: 1157
placeholder: 'Please input port'
- field: ssl
name:
zh-CN: 启动SSL
en-US: SSL
# type-param field type(boolean mapping the html switch tag)
type: boolean
required: false
- field: contentType
name:
zh-CN: Content-Type
en-US: Content-Type
type: text
placeholder: 'Request Body Type'
required: false
- field: payload
name:
zh-CN: 请求BODY
en-US: BODY
type: textarea
placeholder: 'Available When POST PUT'
required: false
```
### 定义监控指标`auth`登录请求获取`token`
1.`app-hertzbeat_token.yml`新增一个监控指标定义 `auth`, 设置采集优先级为最高0,采集指标 `token`.
```yaml
category: custom
# The monitoring type eg: linux windows tomcat mysql aws...
app: hertzbeat_token
# The monitoring i18n name
name:
zh-CN: HertzBeat(Token)
en-US: HertzBeat(Token)
# The description and help of this monitoring type
help:
zh-CN: HertzBeat 对 HertzBeat监控(Token)进行测量监控。`<br>`您可以点击 “`<i>`新建 HertzBeat监控(Token)`</i>`” 并进行配置,或者选择“`<i>`更多操作`</i>`”,导入已有配置。
en-US: HertzBeat monitors HertzBeat Monitor(Token). You could click the "`<i>`New HertzBeat Monitor(Token)`</i>`" button and proceed with the configuration or import an existing setup through the "`<i>`More Actions`</i>`" menu.
zh-TW: HertzBeat對HertzBeat監控(Token)進行量測監控。`<br>`您可以點擊“`<i>`新建HertzBeat監控(Token`</i>`”並進行配寘,或者選擇“`<i>`更多操作`</i>`”,導入已有配寘。
helpLink:
zh-CN: https://hertzbeat.apache.org/zh-cn/docs/help/hertzbeat_token
en-US: https://hertzbeat.apache.org/docs/help/hertzbeat_token
# Input params define for monitoring(render web ui by the definition)
params:
# field-param field key
- field: host
# name-param field display i18n name
name:
zh-CN: 目标Host
en-US: Target Host
# type-param field type(most mapping the html input type)
type: host
# required-true or false
required: true
- field: port
name:
zh-CN: 端口
en-US: Port
# type-param field type(most mapping the html input type)
type: number
# when type is number, range is required
range: '[0,65535]'
required: true
defaultValue: 1157
placeholder: 'Please input port'
- field: ssl
name:
zh-CN: 启动SSL
en-US: SSL
# type-param field type(boolean mapping the html switch tag)
type: boolean
required: false
- field: contentType
name:
zh-CN: Content-Type
en-US: Content-Type
type: text
placeholder: 'Request Body Type'
required: false
- field: payload
name:
zh-CN: 请求BODY
en-US: BODY
type: textarea
placeholder: 'Available When POST PUT'
required: false
# collect metrics config list
metrics:
# metrics - auth
- name: auth
# 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
priority: 0
# collect metrics content
fields:
# field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-whether it is a metrics label field
- field: token
type: 1
- field: refreshToken
type: 1
# the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: http
# the config content when protocol is http
http:
# http host: ipv4 ipv6 domain
host: ^_^host^_^
# http port
port: ^_^port^_^
# http url
url: /api/account/auth/form
# http method: GET POST PUT DELETE PATCH
method: POST
# if enabled https
ssl: ^_^ssl^_^
payload: ^_^payload^_^
# http request header content
headers:
content-type: ^_^contentType^_^
^_^headers^_^: ^_^headers^_^
# http request params
params:
^_^params^_^: ^_^params^_^
# http response data parse type: default-hertzbeat rule, jsonpath-jsonpath script, website-for website monitoring, prometheus-prometheus exporter rule
parseType: jsonPath
parseScript: '$.data'
```
**此时,重启hertzbeat系统,在系统页面上添加 `hertzbeat_token` 类型监控,配置输入参数,`content-type`填`application/json` , `请求Body`填账户密码json如下:**
```json
{
"credential": "hertzbeat",
"identifier": "admin"
}
```
![HertzBeat](/img/docs/advanced/extend-http-example-5.png)
**新增成功后我们就可以在详情页面看到我们采集的 `token`, `refreshToken`指标数据。**
![HertzBeat](/img/docs/advanced/extend-http-example-6.png)
![HertzBeat](/img/docs/advanced/extend-http-example-7.png)
### 将`token`作为变量参数给后面的监控指标采集使用
**在`app-hertzbeat_token.yml`新增一个监控指标定义 `summary` 同教程一中的`summary`相同, 设置采集优先级为1**
**设置此监控指标的HTTP协议配置中认证方式为 `Bearer Token` 将上一个监控指标`auth`采集的指标`token`作为参数给其赋值,使用`^o^`作为内部替换符标识,即`^o^token^o^`。如下:**
```yaml
- name: summary
# 当protocol为http协议时具体的采集配置
http:
# 认证
authorization:
# 认证方式: Basic Auth, Digest Auth, Bearer Token
type: Bearer Token
bearerTokenToken: ^o^token^o^
```
**最终`app-hertzbeat_token.yml`定义如下:**
```yaml
category: custom
# The monitoring type eg: linux windows tomcat mysql aws...
app: hertzbeat_token
# The monitoring i18n name
name:
zh-CN: HertzBeat(Token)
en-US: HertzBeat(Token)
# The description and help of this monitoring type
help:
zh-CN: HertzBeat 对 HertzBeat监控(Token)进行测量监控。`<br>`您可以点击 “`<i>`新建 HertzBeat监控(Token)`</i>`” 并进行配置,或者选择“`<i>`更多操作`</i>`”,导入已有配置。
en-US: HertzBeat monitors HertzBeat Monitor(Token). You could click the "`<i>`New HertzBeat Monitor(Token)`</i>`" button and proceed with the configuration or import an existing setup through the "`<i>`More Actions`</i>`" menu.
zh-TW: HertzBeat對HertzBeat監控(Token)進行量測監控。`<br>`您可以點擊“`<i>`新建HertzBeat監控(Token`</i>`”並進行配寘,或者選擇“`<i>`更多操作`</i>`”,導入已有配寘。
helpLink:
zh-CN: https://hertzbeat.apache.org/zh-cn/docs/help/hertzbeat_token
en-US: https://hertzbeat.apache.org/docs/help/hertzbeat_token
# Input params define for monitoring(render web ui by the definition)
params:
# field-param field key
- field: host
# name-param field display i18n name
name:
zh-CN: 目标Host
en-US: Target Host
# type-param field type(most mapping the html input type)
type: host
# required-true or false
required: true
- field: port
name:
zh-CN: 端口
en-US: Port
# type-param field type(most mapping the html input type)
type: number
# when type is number, range is required
range: '[0,65535]'
required: true
defaultValue: 1157
placeholder: 'Please input port'
- field: ssl
name:
zh-CN: 启动SSL
en-US: SSL
# type-param field type(boolean mapping the html switch tag)
type: boolean
required: false
- field: contentType
name:
zh-CN: Content-Type
en-US: Content-Type
type: text
placeholder: 'Request Body Type'
required: false
- field: payload
name:
zh-CN: 请求BODY
en-US: BODY
type: textarea
placeholder: 'Available When POST PUT'
required: false
# collect metrics config list
metrics:
# metrics - auth
- name: auth
# 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
priority: 0
# collect metrics content
fields:
# field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-whether it is a metrics label field
- field: token
type: 1
- field: refreshToken
type: 1
# the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: http
# the config content when protocol is http
http:
# http host: ipv4 ipv6 domain
host: ^_^host^_^
# http port
port: ^_^port^_^
# http url
url: /api/account/auth/form
# http method: GET POST PUT DELETE PATCH
method: POST
# if enabled https
ssl: ^_^ssl^_^
payload: ^_^payload^_^
# http request header content
headers:
content-type: ^_^contentType^_^
^_^headers^_^: ^_^headers^_^
# http request params
params:
^_^params^_^: ^_^params^_^
# http response data parse type: default-hertzbeat rule, jsonpath-jsonpath script, website-for website monitoring, prometheus-prometheus exporter rule
parseType: jsonPath
parseScript: '$.data'
- name: summary
priority: 1
fields:
- field: app
type: 1
label: true
- field: category
type: 1
- field: status
type: 0
- field: size
type: 0
- field: availableSize
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: /api/summary
method: GET
ssl: ^_^ssl^_^
authorization:
type: Bearer Token
# ^o^xxx^o^ ^o^ substitution represents the value of the acquisition metric xxx of the previous priority
bearerTokenToken: ^o^token^o^
parseType: jsonPath
parseScript: '$.data.apps.*'
```
**配置完成后,再次重启 `hertzbeat` 系统,查看监控详情页面**
![HertzBeat](/img/docs/advanced/extend-http-example-8.png)
![HertzBeat](/img/docs/advanced/extend-http-example-9.png)
### 设置阈值告警通知
> 接下来我们就可以正常设置阈值,告警触发后可以在告警中心查看,也可以新增接收人,设置告警通知等,Have Fun!!!
----
#### 完
HTTP协议的自定义监控的实践就到这里,HTTP协议还带其他参数headers,params等,我们可以像用postman一样去定义它,可玩性也非常高!
如果您觉得hertzbeat这个开源项目不错的话欢迎给我们在GitHub Gitee star哦,灰常感谢。感谢老铁们的支持。笔芯!
**github: [https://github.com/apache/hertzbeat](https://github.com/apache/hertzbeat)**
@@ -0,0 +1,176 @@
---
id: extend-http-jsonpath
title: HTTP协议JsonPath解析方式
sidebar_label: JsonPath解析方式
---
> HTTP接口调用获取响应数据后,用JsonPath脚本解析的解析方式去解析响应数据。
注意⚠️ 响应数据为JSON格式
**使用JsonPath脚本将响应数据解析成符合 Apache HertzBeat™ 指定的数据结构规则的数据**
## JsonPath操作符
[JSONPath在线验证](https://www.jsonpath.cn)
| JSONPATH | 帮助描述 |
|------------------|-----------------------------------|
| $ | 根对象或元素 |
| @ | 当前对象或元素 |
| . or [] | 子元素操作符 |
| .. | 递归匹配所有子元素 |
| * | 通配符. 匹配所有对象或元素. |
| [] | 下标运算符,JsonPath索引从0开始 |
| [,] | 连接运算符,将多个结果拼成数组返回,JSONPath允许使用别名. |
| [start:end:step] | 数组切片运算符 |
| ?() | 过滤器(脚本)表达式. |
| () | 脚本表达式. |
### HertzBeat数据格式规范
单层格式:key-value
```json
{
"metricName1": "metricValue",
"metricName2": "metricValue",
"metricName3": "metricValue",
"metricName4": "metricValue"
}
```
多层格式:数组里面套key-value
```json
[
{
"metricName1": "metricValue",
"metricName2": "metricValue",
"metricName3": "metricValue",
"metricName4": "metricValue"
},
{
"metricName1": "metricValue",
"metricName2": "metricValue",
"metricName3": "metricValue",
"metricName4": "metricValue"
}
]
```
#### 样例
查询自定义系统的数值信息,其暴露接口为 `/metrics/person`,我们需要其中的`type,num`指标
接口返回的原始数据如下:
```json
{
"firstName": "John",
"lastName" : "doe",
"age" : 26,
"address" : {
"streetAddress": "naist street",
"city" : "Nara",
"postalCode" : "630-0192"
},
"number": [
{
"type": "core",
"num": 3343
},
{
"type": "home",
"num": 4543
}
]
}
```
我们使用JsonPath脚本解析,对应的脚本为: `$.number[*]` ,解析后的数据结构如下:
```json
[
{
"type": "core",
"num": 3343
},
{
"type": "home",
"num": 4543
}
]
```
此数据结构符合HertzBeat的数据格式规范,成功提取指标`type,num`值。
**对应的监控模板YML可以配置为如下**
```yaml
category: custom
# 监控应用类型 eg: linux windows tomcat mysql aws...
app: example
name:
zh-CN: 模拟应用类型
en-US: EXAMPLE APP
# 监控参数定义. field 这些为输入参数变量,即可以用^_^host^_^的形式写到后面的配置中,系统自动变量值替换
# 强制固定必须参数 - host
params:
# field-字段名称标识符
- field: host
# name-参数字段显示名称
name:
zh-CN: 主机Host
en-US: Host
# type-字段类型,样式(大部分映射input标签type属性)
type: host
# 是否是必输项 true-必填 false-可选
required: true
- field: port
name:
zh-CN: 端口
en-US: Port
type: number
# 当type为number时,用range表示范围
range: '[0,65535]'
required: true
# 端口默认值
defaultValue: 80
# 参数输入框提示信息
placeholder: '请输入端口'
# collect metrics config list
# 采集指标配置列表
metrics:
# metrics - cpu
# 监控指标 - cpu
- name: cpu
# 指标调度优先级(0-127)越小优先级越高,优先级低的指标会等优先级高的指标采集完成后才会被调度,相同优先级的指标会并行调度采集
# 优先级为0的指标为可用性指标,即它会被首先调度,采集成功才会继续调度其它指标,采集失败则中断调度
priority: 0
# 具体监控指标列表
fields:
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 label是否为标签 unit:指标单位
- field: type
type: 1
label: true
- field: num
type: 0
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: http
# 当protocol为http协议时具体的采集配置
http:
# 主机host: ipv4 ipv6 域名
host: ^_^host^_^
# 端口
port: ^_^port^_^
# url请求接口路径
url: /metrics/person
# 请求方式 GET POST PUT DELETE PATCH
method: GET
# 是否启用ssl/tls,即是http还是https,默认false
ssl: false
# 响应数据解析方式: default-系统规则,jsonPath-jsonPath脚本,website-网站可用性指标监控
# 这里使用jsonPath解析
parseType: jsonPath
parseScript: '$.number[*]'
```
@@ -0,0 +1,326 @@
---
id: extend-http-xmlpath
title: HTTP 协议 XmlPath 解析方法
sidebar_label: XmlPath 解析方法
---
> 调用 HTTP API 获取响应数据后,使用 XmlPath 脚本解析方法解析响应数据。
注意⚠️ 响应数据必须是 XML 格式。
**使用 XPath 脚本将响应数据解析为符合 HertzBeat 指定的数据结构规则的数据。**
## XmlPath 解析逻辑
HertzBeat 中的 XmlPath 解析方法使用两步 XPath 处理:
1. **主 XPath 表达式 (`parseScript`)**: 此 XPath 表达式在 `http` 配置部分的 `parseScript` 中定义。它用于从响应中选择一个或多个主要的 XML 节点。每个选中的节点将对应 HertzBeat 中的一行指标数据。
2. **相对字段 XPath 表达式 (`xpath`)**: 对于在 `fields` 列表中定义的每个指标字段,您可以指定一个相对的 `xpath`。此 XPath 表达式是*相对于*步骤 1 中 `parseScript` 选择的每个主节点进行评估的。它从当前主节点中提取该指标字段的具体值。
这使您可以轻松地解析包含多个记录或项目的结构化 XML 数据。
**特殊指标**:
* `responseTime`: 这个内置指标代表 HTTP 请求的响应时间,是自动收集的。它不需要 `xpath`
* `keyword`: 这个内置指标计算原始响应体中指定关键字(在 `http.keyword` 中配置)的出现次数。它不需要 `xpath`
### 示例
假设 HTTP API 返回以下 XML 数据:
```xml
<DeviceStatus xmlns="http://www.isapi.org/ver20/XMLSchema" version="2.0">
<CPUList>
<CPU>
<cpuUtilization>36.400002</cpuUtilization>
<CPU>
<CPUList>
<MemoryList>
<Memory>
<memoryUsage>399640</memoryUsage>
<memoryAvailable>98792</memoryAvailable>
<cacheSize>228492</cacheSize>
<Memory>
<MemoryList>
<NetPortStatusList>
<NetPortStatus>
<id>1</id>
<workSpeed>1000</workSpeed>
<NetPortStatus>
<NetPortStatus>
<id>2</id>
<workSpeed>0</workSpeed>
<NetPortStatus>
<NetPortStatusList>
<bootTime>2025-01-06 10:27:48</bootTime>
<deviceUpTime>87天0时55分59秒</deviceUpTime>
<lastCalibrationTime>2025-04-03 11:09:18</lastCalibrationTime>
<lastCalibrationTimeDiff>1</lastCalibrationTimeDiff>
<uploadTimeConsumingList>
<avgTime>16</avgTime>
<maxTime>23</maxTime>
<minTime>12</minTime>
</uploadTimeConsumingList>
<lastCalibrationTimeMode>NTP</lastCalibrationTimeMode>
<lastCalibrationTimeAddress>34.191.45.101</lastCalibrationTimeAddress>
<DeviceStatus>
```
我们想要监控设备状态并提取各种指标。
以下是您将如何配置监控模板 YML
```yaml
category: server
# The monitoring type eg: linux windows tomcat mysql aws...
app: hikvision_isapi
# The monitoring i18n name
name:
zh-CN: 海康威视 ISAPI
en-US: Hikvision ISAPI
# The description and help of this monitoring type
help:
zh-CN: 通过ISAPI接口监控海康威视设备状态,获取设备健康数据。
en-US: Monitor Hikvision devices through ISAPI interface to collect health data.
# Input params define for monitoring(render web ui by the definition)
params:
- field: host
name:
zh-CN: 主机Host
en-US: Host
type: host
required: true
- field: port
name:
zh-CN: 端口
en-US: Port
type: number
range: '[0,65535]'
required: true
defaultValue: 80
- field: timeout
name:
zh-CN: 超时时间(ms)
en-US: Timeout(ms)
type: number
range: '[1000,60000]'
required: true
defaultValue: 5000
- field: username
name:
zh-CN: 用户名
en-US: Username
type: text
required: true
- field: password
name:
zh-CN: 密码
en-US: Password
type: password
required: true
- field: ssl
name:
zh-CN: 启用HTTPS
en-US: SSL
type: boolean
required: false
defaultValue: false
# collect metrics config list
metrics:
- name: system_info
i18n:
zh-CN: 系统信息
en-US: System Info
priority: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
ssl: ^_^ssl^_^
url: /ISAPI/System/deviceInfo
method: GET
timeout: ^_^timeout^_^
authorization:
type: Digest Auth
digestAuthUsername: ^_^username^_^
digestAuthPassword: ^_^password^_^
parseType: xmlPath
parseScript: //DeviceInfo
fields:
- field: deviceName
type: 1
i18n:
zh-CN: 设备名称
en-US: Device Name
- field: deviceID
type: 1
i18n:
zh-CN: 设备ID
en-US: Device ID
- field: firmwareVersion
type: 1
i18n:
zh-CN: 固件版本
en-US: Firmware Version
- field: model
type: 1
i18n:
zh-CN: 设备型号
en-US: Device Model
- field: macAddress
type: 1
i18n:
zh-CN: mac地址
en-US: Mac Address
- name: status
i18n:
zh-CN: 设备状态
en-US: Status
priority: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
ssl: ^_^ssl^_^
url: /ISAPI/System/status
method: GET
timeout: ^_^timeout^_^
authorization:
type: Digest Auth
digestAuthUsername: ^_^username^_^
digestAuthPassword: ^_^password^_^
parseType: xmlPath
parseScript: //DeviceStatus
fields:
- field: CPU_utilization
i18n:
zh-CN: CPU 利用率
en-US: CPU Utilization
type: 0
unit: '%'
- field: memory_usage
i18n:
zh-CN: 内存使用量
en-US: Memory Usage
type: 0
unit: MB
- field: memory_available
i18n:
zh-CN: 可用内存
en-US: Memory Available
type: 0
unit: MB
- field: cache_size
i18n:
zh-CN: 缓存大小
en-US: Cache Size
type: 0
unit: MB
- field: net_port_1_speed
i18n:
zh-CN: 网口1速度
en-US: Net Port 1 Speed
type: 0
unit: Mbps
- field: net_port_2_speed
i18n:
zh-CN: 网口2速度
en-US: Net Port 2 Speed
type: 0
unit: Mbps
- field: boot_time
i18n:
zh-CN: 启动时间
en-US: Boot Time
type: 1
- field: device_uptime
i18n:
zh-CN: 运行时长
en-US: Device Uptime
type: 1
- field: last_calibration_time
i18n:
zh-CN: 上次校时时间
en-US: Last Calibration Time
type: 1
- field: last_calibration_time_diff
i18n:
zh-CN: 上次校时时间差
en-US: Last Calibration Time Diff
type: 0
unit: s
- field: avg_upload_time
i18n:
zh-CN: 平均上传耗时
en-US: Avg Upload Time
type: 0
unit: ms
- field: max_upload_time
i18n:
zh-CN: 最大上传耗时
en-US: Max Upload Time
type: 0
unit: ms
- field: min_upload_time
i18n:
zh-CN: 最小上传耗时
en-US: Min Upload Time
type: 0
unit: ms
- field: last_calibration_mode
i18n:
zh-CN: 上次校时模式
en-US: Last Calibration Mode
type: 1
- field: last_calibration_address
i18n:
zh-CN: 上次校时地址
en-US: Last Calibration Address
type: 1
- field: response_time
i18n:
zh-CN: 响应时间
en-US: Response Time
type: 0
unit: ms
aliasFields:
- CPUList/CPU/cpuUtilization
- MemoryList/Memory/memoryUsage
- MemoryList/Memory/memoryAvailable
- MemoryList/Memory/cacheSize
- NetPortStatusList/NetPortStatus[id='1']/workSpeed
- NetPortStatusList/NetPortStatus[id='2']/workSpeed
- bootTime
- deviceUpTime
- lastCalibrationTime
- lastCalibrationTimeDiff
- uploadTimeConsumingList/avgTime
- uploadTimeConsumingList/maxTime
- uploadTimeConsumingList/minTime
- lastCalibrationTimeMode
- lastCalibrationTimeAddress
- responseTime
calculates:
- CPU_utilization=CPUList/CPU/cpuUtilization
- memory_usage=MemoryList/Memory/memoryUsage
- memory_available=MemoryList/Memory/memoryAvailable
- cache_size=MemoryList/Memory/cacheSize
- net_port_1_speed=NetPortStatusList/NetPortStatus[id='1']/workSpeed
- net_port_2_speed=NetPortStatusList/NetPortStatus[id='2']/workSpeed
- boot_time=bootTime
- device_uptime=deviceUpTime
- last_calibration_time=lastCalibrationTime
- last_calibration_time_diff=lastCalibrationTimeDiff
- avg_upload_time=uploadTimeConsumingList/avgTime
- max_upload_time=uploadTimeConsumingList/maxTime
- min_upload_time=uploadTimeConsumingList/minTime
- last_calibration_mode=lastCalibrationTimeMode
- last_calibration_address=lastCalibrationTimeAddress
- response_time=responseTime
units:
- memory_usage=KB->MB
- memory_available=KB->MB
- cache_size=KB->MB
@@ -0,0 +1,279 @@
---
id: extend-http
title: HTTP协议自定义监控
sidebar_label: HTTP协议自定义监控
---
> 从[自定义监控](extend-point)了解熟悉了怎么自定义类型,指标,协议等,这里我们来详细介绍下用HTTP协议自定义指标监控。
## HTTP协议采集流程
【**HTTP接口调用**】->【**响应校验**】->【**响应数据解析**】->【**默认方式解析|JsonPath脚本解析 | XmlPath解析(todo) | Prometheus解析**】->【**指标数据提取**】
由流程可见,我们自定义一个HTTP协议的监控类型,需要配置HTTP请求参数,配置获取哪些指标,对响应数据配置解析方式和解析脚本。
HTTP协议支持我们自定义HTTP请求路径,请求header,请求参数,请求方式,请求体等。
**系统默认解析方式**http接口返回hertzbeat规定的json数据结构,即可用默认解析方式解析数据提取对应的指标数据,详细介绍见 [**系统默认解析**](extend-http-default)
**JsonPath脚本解析方式**:用JsonPath脚本对响应的json数据进行解析,返回系统指定的数据结构,然后提供对应的指标数据,详细介绍见 [**JsonPath脚本解析**](extend-http-jsonpath)
### 自定义步骤
**HertzBeat页面** -> **监控模板菜单** -> **新增监控类型** -> **配置自定义监控模板YML** -> **点击保存应用** -> **使用新监控类型添加监控**
![HertzBeat](/img/docs/advanced/extend-point-1.png)
-------
下面详细介绍下监控模板YML的配置用法,请注意看使用注释。
### 监控模板YML
> 监控模板YML用于定义 *监控类型的名称(国际化), 请求参数结构定义(前端页面根据配置自动渲染UI), 采集指标信息, 采集协议配置* 等。
> 即我们通过自定义这个监控模板,配置定义什么监控类型,前端页面需要输入什么参数,采集哪些性能指标,通过什么协议去采集。
样例:自定义一个名称为example_http的自定义监控类型,其使用HTTP协议采集指标数据。
```yaml
# The monitoring type categoryservice-application service monitoring db-database monitoring custom-custom monitoring os-operating system monitoring
category: custom
# The monitoring type eg: linux windows tomcat mysql aws...
app: a_example
# The monitoring i18n name
name:
zh-CN: 模拟应用
en-US: EXAMPLE APP
# The description and help of this monitoring type
help:
zh-CN: HertzBeat 支持自定义监控,您只需配置监控模板 YML 就能适配一款自定义的监控类型。`<br>`定义流程如下:HertzBeat 页面 -> 监控模板菜单 -> 新增监控类型 -> 配置自定义监控模板YML -> 点击保存应用 -> 使用新监控类型添加监控。
en-US: "HertzBeat supports custom monitoring, and you only need to configure the monitoring template YML to adapt to a custom monitoring type. `<br>`Definition process as follow: HertzBeat Pages -> Main Menu -> Monitor Template -> edit and save -> apply this template."
zh-TW: HertzBeat支持自定義監控,您只需配寘監控模板YML就能適配一款自定義的監控類型。`<br>`定義流程如下:HertzBeat頁面->監控模板選單->新增監控類型->配寘自定義監控模板YML ->點擊保存應用->使用新監控類型添加監控。
helpLink:
zh-CN: https://hertzbeat.apache.org/zh-cn/docs/advanced/extend-point/
en-US: https://hertzbeat.apache.org/docs/advanced/extend-point/
# Input params define for monitoring(render web ui by the definition)
params:
# field-param field key
- field: host
# name-param field display i18n name
name:
zh-CN: 目标Host
en-US: Target Host
# type-param field type(most mapping the html input type)
type: host
# required-true or false
required: true
# field-param field key
- field: port
# name-param field display i18n name
name:
zh-CN: 端口
en-US: Port
# type-param field type(most mapping the html input type)
type: number
# when type is number, range is required
range: '[0,65535]'
# required-true or false
required: true
# default value
defaultValue: 80
# param field input placeholder
placeholder: 'Please Input Port'
# field-param field key
- field: username
# name-param field display i18n name
name:
zh-CN: 用户名
en-US: Username
# type-param field type(most mapping the html input type)
type: text
# when type is text, use limit to limit string length
limit: 50
# required-true or false
required: false
# hide param-true or false
hide: true
# field-param field key
- field: password
# name-param field display i18n name
name:
zh-CN: 用户密码
en-US: Password
# type-param field type(most mapping the html input tag)
type: password
# required-true or false
required: false
# hide param-true or false
hide: true
# field-param field key
- field: ssl
# name-param field display i18n name
name:
zh-CN: 启动SSL
en-US: SSL
# type-param field type(boolean mapping the html switch tag)
type: boolean
# required-true or false
required: false
# field-param field key
- field: method
# name-param field display i18n name
name:
zh-CN: 请求方式
en-US: Method
# type-param field type(radio mapping the html radio tag)
type: radio
# required-true or false
required: true
# when type is radio checkbox, use option to show optional values {name1:value1,name2:value2}
options:
- label: GET
value: GET
- label: POST
value: POST
- label: PUT
value: PUT
- label: DELETE
value: DELETE
# field-param field key
- field: headers
# name-param field display i18n name
name:
zh-CN: 请求Headers
en-US: Headers
# type-param field type(key-value mapping the html key-value input tags)
type: key-value
# required-true or false
required: false
# when type is key-value, use keyAlias to config key alias name
keyAlias: Header Name
# when type is key-value, use valueAlias to config value alias name
valueAlias: Header Value
# collect metrics config list
metrics:
# metrics - cpu
- name: cpu
# metrics name i18n label
i18n:
zh-CN: CPU 信息
en-US: CPU Info
# 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
priority: 0
# collect metrics content
fields:
# field-metric name, i18n-metric name i18n label, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-whether it is a metrics label field
- field: hostname
type: 1
label: true
i18n:
zh-CN: 主机名称
en-US: Host Name
- field: usage
type: 0
unit: '%'
i18n:
zh-CN: 使用率
en-US: Usage
- field: cores
type: 0
i18n:
zh-CN: 核数
en-US: Cores
- field: waitTime
type: 0
unit: s
i18n:
zh-CN: 主机名称
en-US: Host Name
# (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field
aliasFields:
- hostname
- core1
- core2
- usage
- allTime
- runningTime
# mapping and conversion expressions, use these and aliasField above to calculate metrics value
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
calculates:
- hostname=hostname
- cores=core1+core2
- usage=usage
- waitTime=allTime-runningTime
# the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: http
# the config content when protocol is http
http:
# http host: ipv4 ipv6 domain
host: ^_^host^_^
# http port
port: ^_^port^_^
# http url
url: /metrics/cpu
# http method: GET POST PUT DELETE PATCH
method: GET
# if enabled https
ssl: false
# http request header content
headers:
^_^headers^_^: ^_^headers^_^
# http request params
params:
param1: param1
param2: param2
# http auth
authorization:
# http auth type: Basic Auth, Digest Auth, Bearer Token
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
# http response data parse type: default-hertzbeat rule, jsonpath-jsonpath script, website-for website monitoring, prometheus-prometheus exporter rule
parseType: jsonPath
parseScript: '$'
- name: memory
i18n:
zh-CN: 内存信息
en-US: Memory Info
priority: 1
fields:
- field: hostname
type: 1
label: true
i18n:
zh-CN: 主机名称
en-US: Hostname
- field: total
type: 0
unit: kb
i18n:
zh-CN: 总量
en-US: Total
- field: usage
type: 0
unit: '%'
i18n:
zh-CN: 使用率
en-US: Usage
- field: speed
type: 0
i18n:
zh-CN: 速率
en-US: Speed
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: /metrics/memory
method: GET
headers:
apiVersion: v1
params:
param1: param1
param2: param2
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: default
```
@@ -0,0 +1,245 @@
---
id: extend-jdbc
title: JDBC协议自定义监控
sidebar_label: JDBC协议自定义监控
---
> 从[自定义监控](extend-point)了解熟悉了怎么自定义类型,指标,协议等,这里我们来详细介绍下用JDBC(目前支持mysql,mariadb,postgresql,sqlserver)自定义指标监控。
> JDBC协议自定义监控可以让我们很方便的通过写SQL查询语句就能监控到我们想监控的指标
## JDBC协议采集流程
【**系统直连MYSQL**】->【**运行SQL查询语句**】->【**响应数据解析:oneRow, multiRow, columns**】->【**指标数据提取**】
由流程可见,我们自定义一个JDBC协议的监控类型,需要配置JDBC请求参数,配置获取哪些指标,配置查询SQL语句。
### 数据解析方式
SQL查询回来的数据字段和我们需要的指标映射,就能获取对应的指标数据,目前映射解析方式有三种:oneRow, multiRow, columns
#### **oneRow**
> 查询一行数据, 通过查询返回结果集的列名称,和查询的字段映射
例如:
查询的指标字段为:one tow three four
查询SQLselect one, tow, three, four from book limit 1;
这里指标字段就能和响应数据一一映射为一行采集数据。
#### **multiRow**
> 查询多行数据, 通过查询返回结果集的列名称,和查询的字段映射
例如:
查询的指标字段为:one tow three four
查询SQLselect one, tow, three, four from book;
这里指标字段就能和响应数据一一映射为多行采集数据。
#### **columns**
> 采集一行指标数据, 通过查询的两列数据(key-value),key和查询的字段匹配,value为查询字段的值
例如:
查询字段:one tow three four
查询SQLselect key, value from book;
SQL响应数据:
| key | value |
|-------|-------|
| one | 243 |
| two | 435 |
| three | 332 |
| four | 643 |
这里指标字段就能和响应数据的key映射,获取对应的value为其采集监控数据。
### 自定义步骤
**HertzBeat页面** -> **监控模板菜单** -> **新增监控类型** -> **配置自定义监控模板YML** -> **点击保存应用** -> **使用新监控类型添加监控**
![HertzBeat](/img/docs/advanced/extend-point-1.png)
-------
下面详细介绍下文件的配置用法,请注意看使用注释。
### 监控模板YML
> 监控配置定义文件用于定义 *监控类型的名称(国际化), 请求参数结构定义(前端页面根据配置自动渲染UI), 采集指标信息, 采集协议配置* 等。
> 即我们通过自定义这个YML,配置定义什么监控类型,前端页面需要输入什么参数,采集哪些性能指标,通过什么协议去采集。
样例:自定义一个名称为example_sql的自定义监控类型,其使用JDBC协议采集指标数据。
```yaml
# 监控类型所属类别:service-应用服务 program-应用程序 db-数据库 custom-自定义 os-操作系统 bigdata-大数据 mid-中间件 webserver-web服务器 cache-缓存 cn-云原生 network-网络监控等等
category: db
# 监控应用类型(与文件名保持一致) eg: linux windows tomcat mysql aws...
app: example_sql
name:
zh-CN: 模拟MYSQL应用类型
en-US: MYSQL EXAMPLE APP
# 监控参数定义. field 这些为输入参数变量,即可以用^_^host^_^的形式写到后面的配置中,系统自动变量值替换
# 强制固定必须参数 - host
params:
- field: host
name:
zh-CN: 主机Host
en-US: Host
type: host
required: true
- field: port
name:
zh-CN: 端口
en-US: Port
type: number
range: '[0,65535]'
required: true
defaultValue: 80
placeholder: '请输入端口'
- field: database
name:
zh-CN: 数据库名称
en-US: Database
type: text
required: false
- field: username
name:
zh-CN: 用户名
en-US: Username
type: text
limit: 50
required: false
- field: password
name:
zh-CN: 密码
en-US: Password
type: password
required: false
- field: url
name:
zh-CN: Url
en-US: Url
type: text
required: false
# 采集指标配置列表
metrics:
- name: basic
# 指标调度优先级(0-127)越小优先级越高,优先级低的指标会等优先级高的指标采集完成后才会被调度,相同优先级的指标会并行调度采集
# 优先级为0的指标为可用性指标,即它会被首先调度,采集成功才会继续调度其它指标,采集失败则中断调度
priority: 0
# 具体监控指标列表
fields:
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 label是否为标签 unit:指标单位
- field: version
type: 1
label: true
- field: port
type: 1
- field: datadir
type: 1
- field: max_connections
type: 0
# (非必须)监控指标别名,与上面的指标名映射。用于采集接口数据字段不直接是最终指标名称,需要此别名做映射转换
aliasFields:
- version
- version_compile_os
- version_compile_machine
- port
- datadir
- max_connections
# (非必须)指标计算表达式,与上面的别名一起作用,计算出最终需要的指标值
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
calculates:
- port=port
- datadir=datadir
- max_connections=max_connections
- version=version+"_"+version_compile_os+"_"+version_compile_machine
protocol: jdbc
jdbc:
# 主机host: ipv4 ipv6 域名
host: ^_^host^_^
# 端口
port: ^_^port^_^
platform: mysql
username: ^_^username^_^
password: ^_^password^_^
database: ^_^database^_^
# SQL查询方式: oneRow, multiRow, columns
queryType: columns
# sql
sql: show global variables where Variable_name like 'version%' or Variable_name = 'max_connections' or Variable_name = 'datadir' or Variable_name = 'port';
url: ^_^url^_^
- name: status
priority: 1
fields:
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 label是否为标签 unit:指标单位
- field: threads_created
type: 0
- field: threads_connected
type: 0
- field: threads_cached
type: 0
- field: threads_running
type: 0
# (非必须)监控指标别名,与上面的指标名映射。用于采集接口数据字段不直接是最终指标名称,需要此别名做映射转换
aliasFields:
- threads_created
- threads_connected
- threads_cached
- threads_running
# (非必须)指标计算表达式,与上面的别名一起作用,计算出最终需要的指标值
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
calculates:
- threads_created=threads_created
- threads_connected=threads_connected
- threads_cached=threads_cached
- threads_running=threads_running
protocol: jdbc
jdbc:
# 主机host: ipv4 ipv6 域名
host: ^_^host^_^
# 端口
port: ^_^port^_^
platform: mysql
username: ^_^username^_^
password: ^_^password^_^
database: ^_^database^_^
# SQL查询方式: oneRow, multiRow, columns
queryType: columns
# sql
sql: show global status where Variable_name like 'thread%' or Variable_name = 'com_commit' or Variable_name = 'com_rollback' or Variable_name = 'questions' or Variable_name = 'uptime';
url: ^_^url^_^
- name: innodb
priority: 2
fields:
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 label是否为标签 unit:指标单位
- field: innodb_data_reads
type: 0
unit: 次数
- field: innodb_data_writes
type: 0
unit: 次数
- field: innodb_data_read
type: 0
unit: kb
- field: innodb_data_written
type: 0
unit: kb
protocol: jdbc
jdbc:
# 主机host: ipv4 ipv6 域名
host: ^_^host^_^
# 端口
port: ^_^port^_^
platform: mysql
username: ^_^username^_^
password: ^_^password^_^
database: ^_^database^_^
# SQL查询方式: oneRow, multiRow, columns
queryType: columns
# sql
sql: show global status where Variable_name like 'innodb%';
url: ^_^url^_^
```
@@ -0,0 +1,238 @@
---
id: extend-jmx
title: JMX协议自定义监控
sidebar_label: JMX协议自定义监控
---
> 从[自定义监控](extend-point)了解熟悉了怎么自定义类型,指标,协议等,这里我们来详细介绍下用JMX协议自定义指标监控。
> JMX协议自定义监控可以让我们很方便的通过配置 JMX Mbean Object 就能监控采集到我们想监控的 Mbean 指标
## JMX协议采集流程
【**对端JAVA应用暴露JMX服务**】->【**HertzBeat直连对端JMX服务**】->【**获取配置的 Mbean Object 数据**】->【**指标数据提取**】
由流程可见,我们自定义一个JMX协议的监控类型,需要配置JMX请求参数,配置获取哪些指标,配置查询Object信息。
### 数据解析方式
通过配置监控模板YML的指标`field`, `aliasFields`, `jmx` 协议的 `objectName` 来和对端系统暴露的 `Mbean`对象信息映射解析。
### 自定义步骤
**HertzBeat页面** -> **监控模板菜单** -> **新增监控类型** -> **配置自定义监控模板YML** -> **点击保存应用** -> **使用新监控类型添加监控**
![HertzBeat](/img/docs/advanced/extend-point-1.png)
-------
下面详细介绍下监控模板的配置用法,请注意看使用注释。
### 监控模板YML
> 监控配置定义文件用于定义 *监控类型的名称(国际化), 请求参数结构定义(前端页面根据配置自动渲染UI), 采集指标信息, 采集协议配置* 等。
> 即我们通过自定义这个YML,配置定义什么监控类型,前端页面需要输入什么参数,采集哪些性能指标,通过什么协议去采集。
样例:自定义一个名称为 `example_jvm` 的自定义监控类型,其使用JMX协议采集指标数据。
```yaml
# The monitoring type categoryservice-application service monitoring db-database monitoring 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: example_jvm
# The monitoring i18n name
# 监控类型国际化名称
name:
zh-CN: 自定义JVM虚拟机
en-US: CUSTOM JVM
# 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: 9999
# field-param field key
# field-变量字段标识符
- field: url
# name-param field display i18n name
# name-参数字段显示名称
name:
zh-CN: JMX URL
en-US: JMX URL
# type-param field type(most mapping the html input type)
# type-字段类型,样式(大部分映射input标签type属性)
type: text
# required-true or false
# required-是否是必输项 true-必填 false-可选
required: false
# hide param-true or false
# 是否隐藏字段 true or false
hide: true
# param field input placeholder
# 参数输入框提示信息
placeholder: 'service:jmx:rmi:///jndi/rmi://host:port/jmxrmi'
# field-param field key
# field-变量字段标识符
- field: username
# name-param field display i18n name
# name-参数字段显示名称
name:
zh-CN: 用户名
en-US: Username
# type-param field type(most mapping the html input type)
# type-字段类型,样式(大部分映射input标签type属性)
type: text
# when type is text, use limit to limit string length
# 当type为text时,用limit表示字符串限制大小
limit: 50
# required-true or false
# required-是否是必输项 true-必填 false-可选
required: false
# hide param-true or false
# 是否隐藏字段 true or false
hide: true
# field-param field key
# field-变量字段标识符
- field: password
# name-param field display i18n name
# name-参数字段显示名称
name:
zh-CN: 密码
en-US: Password
# type-param field type(most mapping the html input tag)
# type-字段类型,样式(大部分映射input标签type属性)
type: password
# required-true or false
# required-是否是必输项 true-必填 false-可选
required: false
# hide param-true or false
# 是否隐藏字段 true or false
hide: true
# collect metrics config list
# 采集指标配置列表
metrics:
# metrics - basic
# 监控指标 - basic
- name: basic
# 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
# collect metrics content
# 具体监控指标列表
fields:
# field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-if is metrics label
# field-指标名称, type-指标类型(0-number数字,1-string字符串), unit-指标单位('%','ms','MB'), label-是否是指标集合唯一标识符字段
- field: VmName
type: 1
- field: VmVendor
type: 1
- field: VmVersion
type: 1
- field: Uptime
type: 0
unit: ms
# the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk
# 用于监控的协议,例: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: jmx
# the config content when protocol is jmx
jmx:
# host: ipv4 ipv6 domain
# 主机host: ipv4 ipv6 域名
host: ^_^host^_^
# port
# 端口
port: ^_^port^_^
username: ^_^username^_^
password: ^_^password^_^
# jmx mbean object name
# jmx mbean 对象名称
objectName: java.lang:type=Runtime
url: ^_^url^_^
- name: memory_pool
priority: 1
fields:
- field: name
type: 1
label: true
- field: committed
type: 0
unit: MB
- field: init
type: 0
unit: MB
- field: max
type: 0
unit: MB
- field: used
type: 0
unit: MB
units:
- committed=B->MB
- init=B->MB
- max=B->MB
- used=B->MB
# (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field
# (可选)监控指标别名, 做为中间字段与采集数据字段和指标字段映射转换
aliasFields:
- Name
- Usage->committed
- Usage->init
- Usage->max
- Usage->used
# mapping and conversion expressions, use these and aliasField above to calculate metrics value
# (可选)指标映射转换计算表达式,与上面的别名一起作用,计算出最终需要的指标值
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
calculates:
- name=Name
- committed=Usage->committed
- init=Usage->init
- max=Usage->max
- used=Usage->used
protocol: jmx
jmx:
# host: ipv4 ipv6 domain
# 主机host: ipv4 ipv6 域名
host: ^_^host^_^
# port
# 端口
port: ^_^port^_^
username: ^_^username^_^
password: ^_^password^_^
objectName: java.lang:type=MemoryPool,name=*
url: ^_^url^_^
```
@@ -0,0 +1,174 @@
---
id: extend-ngql
title: NQGL自定义监控
sidebar_label: NGQL自定义监控
---
> 从[自定义监控](extend-point)了解熟悉了怎么自定义类型,指标,协议等,这里我们来详细介绍下用NGQL自定义指标监控。
> NGQL自定义监控可以让我们很方便的使用NGQL或者OpenCypher从NebulaGraph图数据库中查询指标数据,支持NebulaGraph 3.X版本。
## 数据解析方式
NGQL查询回来的数据字段和我们需要的指标映射,就能获取对应的指标数据,目前映射解析方式有四种: filterCount, oneRow, multiRow, columns
### **filterCount**
>
> 对查询返回的结果按照指定字段进行过滤后,统计数量,通常用于 `SHOW ...` 语句中,如果可以使用NGQL语句直接返回数量的,建议使用NGQL语句统计数量。
> commands字段语法格式: aliasField#NGQL#filterName#filterValue
> `aliasField`: 对应监控模板中的`aliasFields`中的值
> `NGQL`: 查询语句
> `filterName`: 过滤属性名称(可选)
> `filterValue`: 过滤属性值(可选)
例如:
- online_meta_count#SHOW HOSTS META#Status#ONLINE
`SHOW HOSTS META` 返回的结果中统计滤Status==ONLINE的数量
- online_meta_count#SHOW HOSTS META##
统计 `SHOW HOSTS META` 返回的行数
#### **oneRow**
> 查询一行数据, 通过查询返回结果集的列名称,和查询的字段映射
例如:
- 查询的指标字段为:a,b
- 查询NGQLmatch (v:metrics) return v.metrics.a as a,v.metrics.b as b;
这里指标字段就能和响应数据一一映射为一行采集数据。
注意事项:
- 使用 `oneRow` 方式时单条查询语句返回多行结果时只会使用第一行结果映射到指标字段;
-`commands` 字段包含两条及两条以上查询语句时,如果多条查询语句返回的字段相同时,后一条语句返回的字段会覆盖前一条;
- 定义 `commands` 时建议使用 limit 语句限制返回结果集的行数;
#### **multiRow**
> 查询多行数据, 通过查询返回结果集的列名称,和查询的字段映射
例如:
- 查询的指标字段为:a,b
- 查询NGQLmatch (v:metrics) return v.metrics.a as a,v.metrics.b as b;
这里指标字段就能和响应数据一一映射为多行采集数据。
注意事项:
- 使用 `multiRow` 方式时,`commands` 字段只能包含一条查询语句
#### **columns**
> 采集一行指标数据, 通过查询的两列数据(key-value),key和查询的字段匹配,value为查询字段的值
注意事项:
- 使用 `columns` 方式时,会默认使用结果集的前两列映射采集数据,第一列数据对应指标名称,第二列对应指标值;
-`commands` 字段包含两条及两条以上查询语句时,如果多条查询语句返回的第一列数据有重复,会使用保留最后一条的结果;
### 自定义步骤
**HertzBeat页面** -> **监控模板菜单** -> **新增监控类型** -> **配置自定义监控模板YML** -> **点击保存应用** -> **使用新监控类型添加监控**
![HertzBeat](/img/docs/advanced/extend-point-1.png)
-------
下面详细介绍下文件的配置用法,请注意看使用注释。
### 监控模板YML
> 监控配置定义文件用于定义 *监控类型的名称(国际化), 请求参数结构定义(前端页面根据配置自动渲染UI), 采集指标信息, 采集协议配置* 等。
> 即我们通过自定义这个YML,配置定义什么监控类型,前端页面需要输入什么参数,采集哪些性能指标,通过什么协议去采集。
样例:自定义一个名称为example_ngql的自定义监控类型,其使用NGQL采集指标数据。
```yaml
# 监控类型所属类别:service-应用服务 program-应用程序 db-数据库 custom-自定义 os-操作系统 bigdata-大数据 mid-中间件 webserver-web服务器 cache-缓存 cn-云原生 network-网络监控等等
category: db
# 监控应用类型(与文件名保持一致) eg: linux windows tomcat mysql aws...
app: example_ngql
name:
zh-CN: NGQL自定义监控应用
en-US: NGQL Custom APP
# 监控参数定义. field 这些为输入参数变量,即可以用^_^host^_^的形式写到后面的配置中,系统自动变量值替换
# 这个部分通常不用修改
params:
# field-param field key
- field: host
name:
zh-CN: 目标Host
en-US: Target Host
type: host
required: true
- field: graphPort
name:
zh-CN: graph端口
en-US: graphPort
type: number
range: '[0,65535]'
required: true
defaultValue: 9669
- field: username
name:
zh-CN: 用户名
en-US: Username
type: text
required: true
- field: password
name:
zh-CN: 密码
en-US: Password
type: password
required: true
- field: spaceName
name:
zh-CN: 图空间
en-US: Space Name
type: text
required: false
- field: timeout
name:
zh-CN: 连接超时时间(ms)
en-US: Connect Timeout(ms)
type: number
unit: ms
range: '[0,100000]'
required: true
defaultValue: 6000
# 采集指标配置列表
metrics:
- name: base_info
i18n:
zh-CN: 节点统计
en-US: Vertex statistics
priority: 0
fields:
- field: tag1
type: 1
i18n:
zh-CN: tag1
en-US: tag1
- field: tag1
type: 1
i18n:
zh-CN: tag2
en-US: tag2
aliasFields:
- tag1
- tag2
protocol: ngql
ngql:
host: ^_^host^_^
username: ^_^username^_^
password: ^_^password^_^
port: ^_^graphPort^_^
spaceName: ^_^spaceName^_^
parseType: columns
# 定义采集数据使用的查询语句
commands:
- match (v:tag1) return "tag1" as name ,count(v) as cnt
- match (v:tag2) return "tag2" as name ,count(v) as cnt
timeout: ^_^timeout^_^
```
@@ -0,0 +1,185 @@
---
id: extend-point
title: 自定义监控
sidebar_label: 自定义监控
---
> HertzBeat拥有自定义监控能力,您只需配置监控模板YML就能适配一款自定义的监控类型。
> 目前自定义监控支持[HTTP协议](extend-http)[JDBC协议](extend-jdbc)[SSH协议](extend-ssh)[JMX协议](extend-jmx)[SNMP协议](extend-snmp),后续会支持更多通用协议。
## 自定义流程
**HertzBeat页面** -> **监控模板菜单** -> **新增监控类型** -> **配置自定义监控模板YML** -> **点击保存应用** -> **使用新监控类型添加监控**
![HertzBeat](/img/docs/advanced/extend-point-1.png)
### 自定义监控指标刷新时间
现在,HertzBeat支持为每组监控指标设置不同的刷新时间。您可以在监控模板的 `metrics` 部分通过设置 `interval` 字段来实现,单位为秒。若不进行设置,则使用创建监控时设置的默认刷新时间。
-------
### 监控模板YML
**HertzBeat的设计是一个监控模板对应一个监控类型,所有监控类型都是由监控模板来定义的**
> 监控模板YML定义了 *监控类型的名称(国际化), 配置参数映射, 采集指标信息, 采集协议配置* 等。
下面使用样例详细介绍下这监控模板YML的配置用法。
样例:自定义一个 `app` 名称为 `example2` 的自定义监控类型,其使用HTTP协议采集指标数据。
[监控模板] -> [新增监控类型] -> [右边配置如下监控模板YML] -> [保存并应用]
```yaml
# The monitoring type categoryservice-application service monitoring db-database monitoring custom-custom monitoring os-operating system monitoring
# 监控类型所属类别:service-应用服务 program-应用程序 db-数据库 custom-自定义 os-操作系统 bigdata-大数据 mid-中间件 webserver-web服务器 cache-缓存 cn-云原生 network-网络监控等等
category: custom
# The monitoring type eg: linux windows tomcat mysql aws...
# 监控类型 eg: linux windows tomcat mysql aws...
app: example2
# The monitoring i18n name
# 监控类型国际化名称
name:
zh-CN: 模拟网站监测
en-US: EXAMPLE WEBSITE
# The description and help of this monitoring type
help:
zh-CN: HertzBeat 支持自定义监控,您只需配置监控模板 YML 就能适配一款自定义的监控类型。`<br>`定义流程如下:HertzBeat 页面 -> 监控模板菜单 -> 新增监控类型 -> 配置自定义监控模板YML -> 点击保存应用 -> 使用新监控类型添加监控。
en-US: "HertzBeat supports custom monitoring, and you only need to configure the monitoring template YML to adapt to a custom monitoring type. `<br>`Definition process as follow: HertzBeat Pages -> Main Menu -> Monitor Template -> edit and save -> apply this template."
zh-TW: HertzBeat支持自定義監控,您只需配寘監控模板YML就能適配一款自定義的監控類型。`<br>`定義流程如下:HertzBeat頁面->監控模板選單->新增監控類型->配寘自定義監控模板YML ->點擊保存應用->使用新監控類型添加監控。
helpLink:
zh-CN: https://hertzbeat.apache.org/zh-cn/docs/advanced/extend-point/
en-US: https://hertzbeat.apache.org/docs/advanced/extend-point/
# 监控所需输入参数定义(根据定义渲染页面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: 主机Host
en-US: Host
# type-param field type(most mapping the html input type)
# type-字段类型,样式(大部分映射input标签type属性)
type: host
# required-true or false
# required-是否是必输项 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: 80
# field-param field key
# field-变量字段标识符
- field: uri
# name-param field display i18n name
# name-参数字段显示名称
name:
zh-CN: 相对路径
en-US: URI
# type-param field type(most mapping the html input tag)
# type-字段类型,样式(大部分映射input标签type属性)
type: text
# when type is text, use limit to limit string length
# 当type为text时,用limit表示字符串限制大小
limit: 200
# required-true or false
# required-是否是必输项 true-必填 false-可选
required: false
# 参数输入框提示信息
# param field input placeholder
placeholder: 'Website uri path(no ip port) EG:/console'
# field-param field key
# field-变量字段标识符
- field: ssl
# name-param field display i18n name
# name-参数字段显示名称
name:
zh-CN: 启用HTTPS
en-US: HTTPS
# type-param field type(most mapping the html input type)
# type-字段类型,样式(大部分映射input标签type属性)
type: boolean
# required-true or false
# required-是否是必输项 true-必填 false-可选
required: true
# field-param field key
# field-变量字段标识符
- field: timeout
# name-param field display i18n name
# name-参数字段显示名称
name:
zh-CN: 超时时间(ms)
en-US: Timeout(ms)
# type-param field type(most mapping the html input tag)
# type-字段类型,样式(大部分映射input标签type属性)
type: number
# required-true or false
# required-是否是必输项 true-必填 false-可选
required: false
# hide param-true or false
# 是否隐藏字段 true or false
hide: true
metrics:
# metrics - summary, inner monitoring metrics (responseTime - response time, keyword - number of keywords)
# 监控指标 - summary, 内置监控指标有 (responseTime - 响应时间, keyword - 关键字数量)
- name: summary
# 指标调度优先级(0-127)越小优先级越高,优先级低的指标会等优先级高的指标采集完成后才会被调度,相同优先级的指标会并行调度采集
# 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
# refresh interval for this metrics group
# 该指标组刷新时间
interval: 10
# collect metrics content
# 具体监控指标列表
fields:
# field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-if is metrics label
# field-指标名称, type-指标类型(0-number数字,1-string字符串), unit-指标单位('%','ms','MB'), label-是否是指标集合唯一标识符字段
- field: responseTime
type: 0
unit: ms
- field: keyword
type: 0
# the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: http
# the config content when protocol is http
http:
# http host: ipv4 ipv6 domain
host: ^_^host^_^
# http port
port: ^_^port^_^
# http url
url: ^_^uri^_^
timeout: ^_^timeout^_^
# http method: GET POST PUT DELETE PATCH
method: GET
# if enabled https
ssl: ^_^ssl^_^
# http response data parse type: default-hertzbeat rule, jsonpath-jsonpath script, website-for website monitoring, prometheus-prometheus exporter rule
# http 响应数据解析方式: default-系统规则, jsonPath-jsonPath脚本, website-网站可用性指标监控, prometheus-Prometheus数据规则
parseType: website
```
@@ -0,0 +1,209 @@
---
id: extend-snmp
title: SNMP协议自定义监控
sidebar_label: SNMP协议自定义监控
---
> 从[自定义监控](extend-point)了解熟悉了怎么自定义类型,指标,协议等,这里我们来详细介绍下用 SNMP 协议自定义指标监控。
> SNMP 协议自定义监控可以让我们很方便的通过配置 Mib OID信息 就能监控采集到我们想监控的OID指标
## SNMP协议采集流程
【**对端开启SNMP服务**】->【**HertzBeat直连对端SNMP服务**】->【**根据配置抓取对端OID指标信息**】->【**指标数据提取**】
由流程可见,我们自定义一个SNMP协议的监控类型,需要配置SNMP请求参数,配置获取哪些指标,配置查询OID信息。
### 数据解析方式
通过配置监控模板YML的指标`field`, `aliasFields`, `snmp` 协议下的 `oids`来抓取对端指定的数据并解析映射。
### 自定义步骤
**HertzBeat页面** -> **监控模板菜单** -> **新增监控类型** -> **配置自定义监控模板YML** -> **点击保存应用** -> **使用新监控类型添加监控**
![HertzBeat](/img/docs/advanced/extend-point-1.png)
-------
下面详细介绍下文件的配置用法,请注意看使用注释。
### 监控模板YML
> 监控配置定义文件用于定义 *监控类型的名称(国际化), 请求参数结构定义(前端页面根据配置自动渲染UI), 采集指标信息, 采集协议配置* 等。
> 即我们通过自定义这个YML,配置定义什么监控类型,前端页面需要输入什么参数,采集哪些性能指标,通过什么协议去采集。
样例:自定义一个名称为 example_windows 的自定义监控类型,其使用 SNMP 协议采集指标数据。
```yaml
# The monitoring type categoryservice-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: os
# The monitoring type eg: linux windows tomcat mysql aws...
# 监控类型 eg: linux windows tomcat mysql aws...
app: windows
# The monitoring i18n name
# 监控类型国际化名称
name:
zh-CN: Windows操作系统
en-US: OS Windows
# 监控所需输入参数定义(根据定义渲染页面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: 主机Host
en-US: Host
# type-param field type(most mapping the html input type)
# type-字段类型,样式(大部分映射input标签type属性)
type: host
# required-true or false
# required-是否是必输项 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: 161
# field-param field key
# field-变量字段标识符
- field: version
# name-param field display i18n name
# name-参数字段显示名称
name:
zh-CN: SNMP 版本
en-US: SNMP Version
# type-param field type(radio mapping the html radio tag)
# type-当type为radio时,前端用radio展示开关
type: radio
# required-true or false
# required-是否是必输项 true-必填 false-可选
required: true
# when type is radio checkbox, use option to show optional values {name1:value1,name2:value2}
# 当type为radio单选框, checkbox复选框时, option表示可选项值列表 {name1:value1,name2:value2}
options:
- label: SNMPv1
value: 0
- label: SNMPv2c
value: 1
# field-param field key
# field-变量字段标识符
- field: community
# name-param field display i18n name
# name-参数字段显示名称
name:
zh-CN: SNMP 团体字
en-US: SNMP Community
# type-param field type(most mapping the html input type)
# type-字段类型,样式(大部分映射input标签type属性)
type: text
# when type is text, use limit to limit string length
# 当type为text时,用limit表示字符串限制大小
limit: 100
# required-true or false
# required-是否是必输项 true-必填 false-可选
required: true
# 参数输入框提示信息
# param field input placeholder
placeholder: 'Snmp community for v1 v2c'
# field-param field key
# field-变量字段标识符
- field: timeout
# name-param field display i18n name
# name-参数字段显示名称
name:
zh-CN: 超时时间(ms)
en-US: 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
# required-是否是必输项 true-必填 false-可选
required: false
# hide-is hide this field and put it in advanced layout
# hide-是否隐藏此参数将其放入高级设置中
hide: true
# default value
# 默认值
defaultValue: 6000
# collect metrics config list
# 采集指标配置列表
metrics:
# metrics - system
# 监控指标 - system
- name: system
# 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
# collect metrics content
# 具体监控指标列表
fields:
# field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-if is metrics label
# field-指标名称, type-指标类型(0-number数字,1-string字符串), unit-指标单位('%','ms','MB'), label-是否是指标集合唯一标识符字段
- field: name
type: 1
- field: descr
type: 1
- field: uptime
type: 1
- field: numUsers
type: 0
- field: services
type: 0
- field: processes
type: 0
- field: responseTime
type: 0
unit: ms
- field: location
type: 1
# the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: snmp
# the config content when protocol is snmp
snmp:
# server host: ipv4 ipv6 domain
host: ^_^host^_^
# server port
port: ^_^port^_^
# snmp connect timeout
timeout: ^_^timeout^_^
# snmp community
# snmp 团体字
community: ^_^community^_^
# snmp version
version: ^_^version^_^
# snmp operation: get, walk
operation: get
# metrics oids: metric_name - oid_value
oids:
name: 1.3.6.1.2.1.1.5.0
descr: 1.3.6.1.2.1.1.1.0
uptime: 1.3.6.1.2.1.25.1.1.0
numUsers: 1.3.6.1.2.1.25.1.5.0
services: 1.3.6.1.2.1.1.7.0
processes: 1.3.6.1.2.1.25.1.6.0
location: 1.3.6.1.2.1.1.6.0
```
@@ -0,0 +1,218 @@
---
id: extend-ssh
title: SSH协议自定义监控
sidebar_label: SSH协议自定义监控
---
> 从[自定义监控](extend-point)了解熟悉了怎么自定义类型,指标,协议等,这里我们来详细介绍下用SSH协议自定义指标监控。
> SSH协议自定义监控可以让我们很方便的通过写sh命令脚本就能监控采集到我们想监控的Linux指标
## SSH协议采集流程
【**系统直连Linux**】->【**运行SHELL命令脚本语句**】->【**响应数据解析:oneRow, multiRow**】->【**指标数据提取**】
由流程可见,我们自定义一个SSH协议的监控类型,需要配置SSH请求参数,配置获取哪些指标,配置查询脚本语句。
### 数据解析方式
SHELL脚本查询回来的数据字段和我们需要的指标映射,就能获取对应的指标数据,目前映射解析方式有两种:oneRow, multiRow,能满足绝大部分指标需求。
#### **oneRow**
> 查询出一列数据, 通过查询返回结果集的字段值(一行一个值)与字段映射
例如:
需要查询Linux的指标 hostname-主机名称,uptime-启动时间
主机名称原始查询命令:`hostname`
启动时间原始查询命令:`uptime | awk -F "," '{print $1}'`
则在hertzbeat对应的这两个指标的查询脚本为(用`;`将其连接到一起)
`hostname; uptime | awk -F "," '{print $1}'`
终端响应的数据为:
```shell
tombook
14:00:15 up 72 days
```
则最后采集到的指标数据一一映射为:
hostname值为 `tombook`
uptime值为 `14:00:15 up 72 days`
这里指标字段就能和响应数据一一映射为一行采集数据。
#### **multiRow**
> 查询多行数据, 通过查询返回结果集的列名称,和查询的指标字段映射
例如:
查询的Linux内存相关指标字段:total-内存总量 used-已使用内存 free-空闲内存 buff-cache-缓存大小 available-可用内存
内存指标原始查询命令为:`free -m`, 控制台响应:
```shell
total used free shared buff/cache available
Mem: 7962 4065 333 1 3562 3593
Swap: 8191 33 8158
```
在hertzbeat中multiRow格式解析需要响应数据列名称和指标值一一映射,则对应的查询SHELL脚本为:
`free -m | grep Mem | awk 'BEGIN{print "total used free buff_cache available"} {print $2,$3,$4,$6,$7}'`
控制台响应为:
```shell
total used free buff_cache available
7962 4066 331 3564 3592
```
这里指标字段就能和响应数据一一映射为采集数据。
### 自定义步骤
**HertzBeat页面** -> **监控模板菜单** -> **新增监控类型** -> **配置自定义监控模板YML** -> **点击保存应用** -> **使用新监控类型添加监控**
![HertzBeat](/img/docs/advanced/extend-point-1.png)
-------
下面详细介绍下文件的配置用法,请注意看使用注释。
### 监控模板YML
> 监控配置定义文件用于定义 *监控类型的名称(国际化), 请求参数结构定义(前端页面根据配置自动渲染UI), 采集指标信息, 采集协议配置* 等。
> 即我们通过自定义这个YML,配置定义什么监控类型,前端页面需要输入什么参数,采集哪些性能指标,通过什么协议去采集。
样例:自定义一个名称为example_linux的自定义监控类型,其使用SSH协议采集指标数据。
```yaml
# 监控类型所属类别:service-应用服务 program-应用程序 db-数据库 custom-自定义 os-操作系统 bigdata-大数据 mid-中间件 webserver-web服务器 cache-缓存 cn-云原生 network-网络监控等等
category: os
# 监控应用类型(与文件名保持一致) eg: linux windows tomcat mysql aws...
app: example_linux
name:
zh-CN: 模拟LINUX应用类型
en-US: LINUX EXAMPLE APP
# 监控参数定义. field 这些为输入参数变量,即可以用^_^host^_^的形式写到后面的配置中,系统自动变量值替换
# 强制固定必须参数 - host
params:
- field: host
name:
zh-CN: 主机Host
en-US: Host
type: host
required: true
- field: port
name:
zh-CN: 端口
en-US: Port
type: number
range: '[0,65535]'
required: true
defaultValue: 22
placeholder: '请输入端口'
- field: username
name:
zh-CN: 用户名
en-US: Username
type: text
limit: 50
required: true
- field: password
name:
zh-CN: 密码
en-US: Password
type: password
required: true
# collect metrics config list
# 采集指标配置列表
metrics:
# 第一个监控指标 basic
# 注意:内置监控指标有 (responseTime - 响应时间)
- name: basic
# 指标调度优先级(0-127)越小优先级越高,优先级低的指标会等优先级高的指标采集完成后才会被调度,相同优先级的指标会并行调度采集
# 优先级为0的指标为可用性指标,即它会被首先调度,采集成功才会继续调度其它指标,采集失败则中断调度
priority: 0
# 具体监控指标列表
fields:
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 label是否为标签 unit:指标单位
- field: hostname
type: 1
label: true
- field: version
type: 1
- field: uptime
type: 1
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: ssh
# 当protocol为http协议时具体的采集配置
ssh:
# 主机host: ipv4 ipv6 域名
host: ^_^host^_^
# 端口
port: ^_^port^_^
username: ^_^username^_^
password: ^_^password^_^
script: (uname -r ; hostname ; uptime | awk -F "," '{print $1}' | sed "s/ //g") | sed ":a;N;s/\n/^/g;ta" | awk -F '^' 'BEGIN{print "version hostname uptime"} {print $1, $2, $3}'
# 响应数据解析方式:oneRow, multiRow
parseType: multiRow
- name: cpu
priority: 1
fields:
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 label是否为标签 unit:指标单位
- field: info
type: 1
- field: cores
type: 0
unit: 核数
- field: interrupt
type: 0
unit: 个数
- field: load
type: 1
- field: context_switch
type: 0
unit: 个数
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: ssh
# 当protocol为http协议时具体的采集配置
ssh:
# 主机host: ipv4 ipv6 域名
host: ^_^host^_^
# 端口
port: ^_^port^_^
username: ^_^username^_^
password: ^_^password^_^
script: "LANG=C lscpu | awk -F: '/Model name/ {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}'"
parseType: oneRow
- name: memory
priority: 2
fields:
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 label是否为标签 unit:指标单位
- field: total
type: 0
unit: Mb
- field: used
type: 0
unit: Mb
- field: free
type: 0
unit: Mb
- field: buff_cache
type: 0
unit: Mb
- field: available
type: 0
unit: Mb
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: ssh
# 当protocol为http协议时具体的采集配置
ssh:
# 主机host: ipv4 ipv6 域名
host: ^_^host^_^
# 端口
port: ^_^port^_^
username: ^_^username^_^
password: ^_^password^_^
script: free -m | grep Mem | awk 'BEGIN{print "total used free buff_cache available"} {print $2,$3,$4,$6,$7}'
parseType: multiRow
```
@@ -0,0 +1,299 @@
---
id: extend-telnet
title: Telnet协议自定义监控
sidebar_label: Telnet协议自定义监控
---
> 从[自定义监控](extend-point)了解熟悉了怎么自定义类型,指标,协议等,这里我们来详细介绍下用Telnet协议自定义指标监控。
> 使用 Telnet 协议自定义监控可以让我们通过编写 Telnet 命令脚本来监控和采集我们想要监控的 Linux 指标
## Telnet协议采集流程
【**系统直连Linux**】->【**运行TELNET命令脚本语句**】->【**响应数据解析**】->【**指标数据提取**】
由流程可见,我们自定义一个Telnet协议的监控类型,需要配置Telnet请求参数,配置获取哪些指标,配置查询脚本语句。
### 数据解析方式
通过配置监控模板YML的指标field, aliasFields, telnet 协议下的获取数据映射。
### 自定义步骤
**HertzBeat页面** -> **监控模板菜单** -> **新增监控类型** -> **配置自定义监控模板YML** -> **点击保存应用** -> **使用新监控类型添加监控**
![HertzBeat](/img/docs/advanced/extend-point-1.png)
-------
下面详细介绍下文件的配置用法,请注意看使用注释。
### 监控模板YML
> 监控配置定义文件用于定义 *监控类型的名称(国际化), 请求参数结构定义(前端页面根据配置自动渲染UI), 采集指标信息, 采集协议配置* 等。
> 即我们通过自定义这个YML,配置定义什么监控类型,前端页面需要输入什么参数,采集哪些性能指标,通过什么协议去采集。
样例:自定义一个名称为zookeeper的自定义监控类型,其使用telnet协议采集指标数据。
```yaml
# The monitoring type categoryservice-application service monitoring db-database monitoring custom-custom monitoring os-operating system monitoring
# 监控类型所属类别:service-应用服务 program-应用程序 db-数据库 custom-自定义 os-操作系统 bigdata-大数据 mid-中间件 webserver-web服务器 cache-缓存 cn-云原生 network-网络监控等等
category: mid
# Monitoring application type(consistent with the file name) eg: linux windows tomcat mysql aws...
# 监控应用类型(与文件名保持一致) eg: linux windows tomcat mysql aws...
app: zookeeper
# The monitoring i18n name
# 监控类型国际化名称
name:
zh-CN: Zookeeper服务
en-US: Zookeeper Server
# 监控参数定义. field 这些为输入参数变量,即可以用^_^host^_^的形式写到后面的配置中,系统自动变量值替换
# 强制固定必须参数 - host
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
# 是否是必输项 true-必填 false-可选
required: true
# default
# 默认值
defaultValue: 2181
# param field input placeholder
# 参数输入框提示信息
placeholder: '请输入端口'
# field-param field key
# field-字段名称标识符
- field: timeout
# name-param field display i18n name
# name-参数字段显示名称
name:
zh-CN: 查询超时时间(ms)
en-US: Query Timeout(ms)
# type-param field type(most mapping the html input type)
# type-字段类型,样式(大部分映射input标签type属性)
type: number
# required-true or false
# 是否是必输项 true-必填 false-可选
required: false
# hide-is hide this field and put it in advanced layout
# 隐藏是隐藏这个字段,并把它放在高级布局
hide: true
# default
# 默认值
defaultValue: 6000
# collect metrics config list
# 采集指标配置列表
metrics:
# metrics - conf
# 第一个监控指标 conf
# 注意:内置监控指标有 (responseTime - 响应时间)
- name: conf
# 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
# collect metrics content
# 具体监控指标列表
fields:
# field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-if is metrics label
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 label是否为标签 unit:指标单位
- field: clientPort
type: 0
i18n:
zh-CN: 客户端端口
en-US: Client Port
- field: dataDir
type: 1
i18n:
zh-CN: 数据目录
en-US: Data Directory
- field: dataDirSize
type: 0
unit: kb
i18n:
zh-CN: 数据目录大小
en-US: Data Directory Size
- field: dataLogDir
type: 1
i18n:
zh-CN: 日志目录
en-US: Data Log Directory
- field: dataLogSize
type: 0
unit: kb
i18n:
zh-CN: 日志目录大小
en-US: Data Log Size
- field: tickTime
type: 0
unit: ms
i18n:
zh-CN: 心跳间隔时间
en-US: Tick Time
- field: maxClientCnxns
type: 1
i18n:
zh-CN: 最大客户端连接数
en-US: Max Client Connections
- field: minSessionTimeout
type: 0
unit: ms
i18n:
zh-CN: 最小会话超时
en-US: Min Session Timeout
- field: maxSessionTimeout
type: 0
unit: ms
i18n:
zh-CN: 最大会话超时
en-US: Max Session Timeout
- field: serverId
type: 0
i18n:
zh-CN: 服务器ID
en-US: Server ID
# the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: telnet
# the config content when protocol is telnet
# 当protocol为telnet协议时具体的采集配置
telnet:
# host: ipv4 ipv6 domain
# 主机host: ipv4 ipv6 域名
host: ^_^host^_^
# port
# 端口
port: ^_^port^_^
# timeout
# 超时时间
timeout: ^_^timeout^_^
# telnet instruction
# telnet指令
cmd: conf
- name: stats
priority: 1
fields:
- field: zk_version
type: 1
i18n:
zh-CN: ZooKeeper版本
en-US: ZooKeeper Version
- field: zk_server_state
type: 1
i18n:
zh-CN: 服务器状态
en-US: Server State
- field: zk_num_alive_connections
type: 0
unit:
i18n:
zh-CN: 存活连接数
en-US: Number of Alive Connections
- field: zk_avg_latency
type: 0
unit: ms
i18n:
zh-CN: 平均延迟
en-US: Average Latency
- field: zk_outstanding_requests
type: 0
unit:
i18n:
zh-CN: 未完成请求数
en-US: Outstanding Requests
- field: zk_znode_count
type: 0
unit:
i18n:
zh-CN: ZNode数量
en-US: ZNode Count
- field: zk_packets_sent
type: 0
unit:
i18n:
zh-CN: 发送数据包数
en-US: Packets Sent
- field: zk_packets_received
type: 0
unit:
i18n:
zh-CN: 接收数据包数
en-US: Packets Received
- field: zk_watch_count
type: 0
unit:
i18n:
zh-CN: Watch数量
en-US: Watch Count
- field: zk_max_file_descriptor_count
type: 0
unit:
i18n:
zh-CN: 最大文件描述符数量
en-US: Max File Descriptor Count
- field: zk_approximate_data_size
type: 0
unit: kb
i18n:
zh-CN: 大致数据大小
en-US: Approximate Data Size
- field: zk_open_file_descriptor_count
type: 0
unit:
i18n:
zh-CN: 打开的文件描述符数量
en-US: Open File Descriptor Count
- field: zk_max_latency
type: 0
unit: ms
i18n:
zh-CN: 最大延迟
en-US: Max Latency
- field: zk_ephemerals_count
type: 0
unit:
i18n:
zh-CN: 临时节点数量
en-US: Ephemerals Count
- field: zk_min_latency
type: 0
unit: ms
i18n:
zh-CN: 最小延迟
en-US: Min Latency
protocol: telnet
telnet:
host: ^_^host^_^
port: ^_^port^_^
timeout: ^_^timeout^_^
cmd: mntr
```
@@ -0,0 +1,252 @@
---
id: extend-tutorial
title: 自定义适配一款基于HTTP协议的新监控类型
sidebar_label: 教程案例
---
通过此教程我们一步一步描述如何在 Apache HertzBeat™ 系统下自定义新增适配一款基于 http 协议的监控类型。
阅读此教程前我们希望您已经从[自定义监控](extend-point)和[http协议自定义](extend-http)了解熟悉了怎么自定义类型,指标,协议等。
## HTTP协议解析通用响应结构体,获取指标数据
>
> 很多场景我们需要对提供的 HTTP API 接口进行监控,获取接口返回的指标值。这篇文章我们通过http自定义协议来解析我们常见的http接口响应结构,获取返回体中的字段作为指标数据。
```json
{
"code": 200,
"msg": "success",
"data": {}
}
```
如上,通常我们的后台API接口会设计这这样一个通用返回。hertzbeat系统的后台也是如此,我们今天就用hertzbeat的 API 做样例,新增适配一款新的监控类型 **hertzbeat**,监控采集它的系统摘要统计API
`http://localhost:1157/api/summary`, 其响应数据为:
```json
{
"msg": null,
"code": 0,
"data": {
"apps": [
{
"category": "service",
"app": "jvm",
"status": 0,
"size": 2,
"availableSize": 0,
"unManageSize": 2,
"unAvailableSize": 0,
"unReachableSize": 0
},
{
"category": "service",
"app": "website",
"status": 0,
"size": 2,
"availableSize": 0,
"unManageSize": 2,
"unAvailableSize": 0,
"unReachableSize": 0
}
]
}
}
```
**我们这次获取其app下的 `category`,`app`,`status`,`size`,`availableSize`等指标数据。**
### 新增配置监控模板YML
**HertzBeat页面** -> **监控模板菜单** -> **新增监控类型** -> **配置自定义监控模板YML**
定义我们在页面上需要输入哪些参数,一般的HTTP协议参数主要有ip, port, headers, params, uri, 账户密码等,我们直接复用 `api`监控模板 里面的参数定义内容,删除其中的我们不需要输入的uri参数和keyword关键字等参数即可。
定义采集类型是啥,需要用哪种协议采集方式,采集的指标是啥,协议的配置参数等。我们直接复用 `api`监控模板 里面的定义内容,修改为我们当前的监控类型`hertzbeat`配置参数即可,如下:注意⚠️我们这次获取接口响应数据中的`category`,`app`,`status`,`size`,`availableSize`等字段作为指标数据。
```yaml
# The monitoring type categoryservice-application service monitoring db-database monitoring custom-custom monitoring os-operating system monitoring
# 监控类型所属类别:service-应用服务 program-应用程序 db-数据库 custom-自定义 os-操作系统 bigdata-大数据 mid-中间件 webserver-web服务器 cache-缓存 cn-云原生 network-网络监控等等
category: custom
# The monitoring type eg: linux windows tomcat mysql aws...
# 监控类型 eg: linux windows tomcat mysql aws...
app: hertzbeat
# The monitoring i18n name
# 监控类型国际化名称
name:
zh-CN: HertzBeat监控系统
en-US: HertzBeat Monitor
# The description and help of this monitoring type
help:
zh-CN: HertzBeat 对 HertzBeat 监控系统的通用指标进行测量监控。`<br>`您可以点击 “`<i>`新建 HertzBeat监控系统`</i>`” 并进行配置,或者选择“`<i>`更多操作`</i>`”,导入已有配置。
en-US: HertzBeat monitors HertzBeat Monitor through general performance metric. You could click the "`<i>`New HertzBeat Monitor`</i>`" button and proceed with the configuration or import an existing setup through the "`<i>`More Actions`</i>`" menu.
zh-TW: HertzBeat對HertzBeat監控系統的通用名額進行量測監控。`<br>`您可以點擊“`<i>`新建HertzBeat監控系統`</i>`”並進行配寘,或者選擇“`<i>`更多操作`</i>`”,導入已有配寘。
helpLink:
zh-CN: https://hertzbeat.apache.org/zh-cn/docs/help/hertzbeat
en-US: https://hertzbeat.apache.org/docs/help/hertzbeat
# 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: 1157
- field: ssl
name:
zh-CN: 启用HTTPS
en-US: HTTPS
type: boolean
required: true
- 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: false
hide: true
options:
- label: Basic Auth
value: Basic Auth
- label: Digest Auth
value: Digest Auth
- field: username
name:
zh-CN: 用户名
en-US: Username
type: text
limit: 50
required: false
hide: true
- field: password
name:
zh-CN: 密码
en-US: Password
type: password
required: false
hide: true
metrics:
# the first metrics summary
# attention: Built-in monitoring metrics contains (responseTime - Response time)
- name: summary
# 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
# collect metrics content
# 具体监控指标列表
fields:
# metrics content contains field-metric name, type-metric type:0-number,1-string, label-if is metrics label, unit-metric unit('%','ms','MB')
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 label是否为标签 unit:指标单位
- field: app
type: 1
label: true
- field: category
type: 1
- field: status
type: 0
- field: size
type: 0
- field: availableSize
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/summary
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: ^_^ssl^_^
# http auth
# 认证
authorization:
# http auth type: Basic Auth, Digest Auth, Bearer Token
# 认证方式: Basic Auth, Digest Auth, Bearer Token
type: ^_^authType^_^
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
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: '$.data.apps.*'
```
**点击保存并应用。我们可以看到系统页面的自定义监控菜单已经多了一个`hertzbeat`监控类型了。**
![HertzBeat](/img/docs/advanced/extend-http-example-1.png)
### 页面添加对`hertzbeat`监控类型的监控
> 我们点击新增 `HertzBeat监控系统`,配置监控IP,端口,采集周期,高级设置里的账户密码等, 点击确定添加监控。
![HertzBeat](/img/docs/advanced/extend-http-example-2.png)
![HertzBeat](/img/docs/advanced/extend-http-example-3.png)
> 过一定时间(取决于采集周期)我们就可以在监控详情看到具体的指标数据和历史图表啦!
![HertzBeat](/img/docs/advanced/extend-http-example-4.png)
### 设置阈值告警通知
> 接下来我们就可以正常设置阈值,告警触发后可以在告警中心查看,也可以新增接收人,设置告警通知等,Have Fun!!!
----
#### 完
HTTP协议的自定义监控的实践就到这里,HTTP协议还带其他参数 `headers,params` 等,我们可以像用postman一样去定义它,可玩性也非常高!
@@ -0,0 +1,58 @@
---
id: 'become_committer'
title: '成为Committer'
sidebar_position: 2
---
<!--
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
https://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.
-->
## 成为 Apache HertzBeat™ 的 Committer
任何支持社区并在 CoPDoC 领域中工作的人都可以成为 Apache HertzBeat™ 的 Committer。CoPDoC 是 ASF 的缩写,用来描述我们如何不仅仅通过代码来认识到您的贡献。
- **Community** - 你可以通过我们的邮件列表、问题追踪器、讨论页面与社区成员互动,并分享愿景和知识。
- **Project** - 需要明确的愿景和共识。
- **Documentation** - 没有它,内容只会停留在作者的头脑中。
- **Code** - 没有代码,讨论就毫无意义。
Apache HertzBeat™ 社区努力追求基于功绩的原则。因此,一旦有人在 CoPDoC 的任何领域有了足够的贡献,他们就可以成为 Committer 的候选人,最终被投票选为 HertzBeat 的 Committer。成为 Apache HertzBeat™ 的 Committer 并不一定意味着你必须使用你的提交权限向代码库提交代码;它意味着你致力于 HertzBeat 项目并为我们社区的成功做出了积极的贡献。
## Committer 的要求
没有成为 Committer 或 PMC 成员的严格规则。新的 Committer 的候选人通常是积极的贡献者和社区成员。但是,如果能稍微明确一些规则,就可以在一定程度上消除贡献者的疑虑,使社区更加透明、合理和公平。
### 持续的贡献
Committer 的候选人应该持续参与并为 HertzBeat 做出大量的贡献(例如修复漏洞、添加新功能、编写文档、维护问题板、代码审查或回答社区问题)。
- 3+ months 的活动和参与。
- 20+ pr 的代码,文档,测试等贡献。
### 贡献的质量
- 对项目有深入的理解。
- 经过充分测试、良好设计、遵循 Apache HertzBeat™ 的编码标准,及简单的修复补丁。
- 井井有条的面向用户的详细文档。
### 社区参与
- 在开发邮件列表上保持积极、礼貌与尊重,并帮助指导新的贡献者和用户。
- 在项目维护的问题跟踪器上积极、有礼貌与尊重。
- 对于拉取请求审查保持积极、有礼貌与尊重。
- 即使存在分歧,也要以专业和外交的态度参与技术路线图的讨论。
- 通过撰写文章或举办活动来推广项目。
@@ -0,0 +1,57 @@
---
id: 'become_pmc_member'
title: '成为PMC member'
sidebar_position: 3
---
<!--
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
https://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.
-->
## 成为 Apache HertzBeat™ 的 PMC 成员
任何支持社区并在 CoPDoC 领域中工作的人都可以成为 Apache HertzBeat™ 的PMC 成员。CoPDoC 是 ASF 的缩写,用来描述我们如何不仅仅通过代码来认识到您的贡献。
- **Community** - 您可以通过我们的邮件列表、问题追踪器、讨论页面与社区成员互动,并分享愿景和知识。
- **Project** - 需要明确的愿景和共识。
- **Documentation** - 没有它,内容只会停留在作者的头脑中。
- **Code** - 没有代码,讨论就毫无意义。
Apache HertzBeat™ 社区努力追求基于功绩的原则。因此,一旦有人在 CoPDoC 的任何领域有了足够的贡献,他们就可以成为 PMC 成员资格的候选人,最终被投票选为 HertzBeat 的 PMC 成员。成为 Apache HertzBeat™ 的 PMC 成员并不一定意味着您必须使用您的提交权限向代码库提交代码;它意味着您致力于 HertzBeat 项目并为我们社区的成功做出了积极的贡献。
## PMC 成员的要求
没有成为 Committer 或 PMC 成员的严格规则。新的 PMC 成员的候选人通常是积极的贡献者和社区成员。但是,如果能稍微明确一些规则,就可以在一定程度上消除贡献者的疑虑,使社区更加透明、合理和公平。
### 持续的贡献
PMC 成员的候选人应该持续参与并为 HertzBeat 做出大量的贡献(例如修复漏洞、添加新功能、编写文档、维护问题板、代码审查或回答社区问题)。
- 12+ months 的活动和参与。
### 贡献的质量
- 对项目有深入的理解。
- 经过充分测试、良好设计、遵循 Apache HertzBeat™ 的编码标准,及简单的修复补丁。
- 井井有条的面向用户的详细文档。
### 社区参与
- 在开发邮件列表上保持积极、礼貌与尊重,并帮助指导新的贡献者和用户。
- 在项目维护的问题跟踪器上积极、有礼貌与尊重。
- 对于拉取请求审查保持积极、有礼貌与尊重。
- 即使存在分歧,也要以专业和外交的态度参与技术路线图的讨论。
- 通过撰写文章或举办活动来推广项目。
@@ -0,0 +1,649 @@
---
id: 'code_style_and_quality_guide'
title: '代码风格和质量指南'
sidebar_position: 3
---
<!--
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
https://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.
-->
## 1 拉取请求与变更规则
1. `ISSUE`/`PR`(拉取请求) 的引导和命名
- 新建 `PR` 后需要在 `PR` 页面的 Github Development 按钮处关联已存在的对应 `ISSUE`(若无建议新建对应ISSUE)
- 标题命名格式(英文,小写)
`[feature/bugfix/doc/improve/refactor/bug/cleanup] title`
2. 添加描述信息
- 新建 `PR` 时请仔细描述此贡献,描述文档和代码同样重要。审阅者可以从描述中,而不仅仅是从代码中,了解问题和解决方案。
- 勾选是否完成了对应的 Checklist。
3. 建议一次 `PR` 只包含一个功能/一种修复/一类改进/一种重构/一次清理/一类文档等
4. 提交消息(英文,小写,无特殊字符)
消息的提交应遵循与 `PR` 类似的模式:`[feature/bugfix/doc/improve/refactor/bug/cleanup] title`
## 2 代码检查样式
### 2.1 配置 Checkstyle
1. 安装 Checkstyle-IDEA 插件.
2. 打开 Checkstyle 设置. 点击 **Settings****Tools****Checkstyle**
3. 设置 **Checkstyle version** 的版本为: **10.14.2**
4. 设置 **Scan scope****Only Java sources (including tests)**
5. 点击 **+** 按钮在 **Configuration** 部分打开一个对话框选择 checkstyle 配置文件。
1. 输入描述名称,比如:hertzbeat。
2. 选择 **Use a local checkstyle file**
3. 设置 **File** 路径为: **script/checkstyle/checkstyle.xml**
4. 选择 **Store relative to project location**
5. 点击 **Next****Next****Finish**
6. 激活刚才的 **Checkstyle** 配置。
7. 点击 **OK**
- 后端代码规范 Maven 插件:`checkstyle`
后端运行 `mvn checkstyle:checkstyle`
- 前端代码格式化插件 `eslint`
前端运行 `pnpm run lint:fix`
### 2.2 文档样式检查
1. 安装`markdownlint-cli2`,运行`npm install markdownlint-cli2 --global`
2. 在项目中运行`markdownlint-cli2 "home/**/*.md"`,会执行Markdown文件格式自动检测。
3. 在项目中运行`markdownlint-cli2 --fix "home/**/*.md"`,会执行Markdown文件格式自动格式化,以确保所有文档都符合规范。
> 提示: 修复只能修复部分问题,根据检查后的错误信息,手动调整。
错误码说明:
| 错误代码 |说明 |
|---------------------------------------| ------------------------|
| **MD001 heading-increment** | 标题级别应一次只递增一个级别 |
| **MD003 heading-style** | 标题样式 |
| **MD004 ul-style** | 无序列表样式 |
| **MD005 list-indent** | 同一层级的列表项缩进不一致 |
| **MD007 ul-indent** | 无序列表缩进 |
| **MD009 no-trailing-spaces** | 行尾空格 |
| **MD010 no-hard-tabs** | 硬制表符 |
| **MD011 no-reversed-links** | 链接语法反转 |
| **MD012 no-multiple-blanks** | 多个连续空行 |
| **MD013 line-length** | 行长度 |
| **MD014 commands-show-output** | 命令前使用 `$` 符号但未显示输出 |
| **MD018 no-missing-space-atx** | ATX 样式标题符号后缺少空格 |
| **MD019 no-multiple-space-atx** | ATX 样式标题符号后有多个空格 |
| **MD020 no-missing-space-closed-atx** | 闭合 ATX 样式标题符号内部缺少空格 |
| **MD021 no-multiple-space-closed-atx** | 闭合 ATX 样式标题符号内部有多个空格 |
| **MD022 blanks-around-headings** | 标题周围应有空行 |
| **MD023 heading-start-left** | 标题必须从行首开始 |
| **MD024 no-duplicate-heading** | 存在多个内容相同的标题 |
| **MD025 single-title/single-h1** | 同一文档中有多个一级标题 |
| **MD026 no-trailing-punctuation** | 标题中有尾随标点符号 |
| **MD027 no-multiple-space-blockquote** | 引用符号后有多个空格 |
| **MD028 no-blanks-blockquote** | 引用块内有空行 |
| **MD029 ol-prefix** | 有序列表项前缀 |
| **MD030 list-marker-space** | 列表标记后的空格 |
| **MD031 blanks-around-fences** | 围栏代码块应被空行包围 |
| **MD032 blanks-around-lists** | 列表应被空行包围 |
| **MD033 no-inline-html** | 内联 HTML |
| **MD034 no-bare-urls** | 使用了裸露的 URL |
| **MD035 hr-style** | 水平分割线样式 |
| **MD036 no-emphasis-as-heading** | 不应使用强调样式代替标题 |
| **MD037 no-space-in-emphasis** | 强调标记内有空格 |
| **MD038 no-space-in-code** | 代码片段元素内有空格 |
| **MD039 no-space-in-links** | 链接文本内有空格 |
| **MD040 fenced-code-language** | 围栏代码块应指定语言 |
| **MD041 first-line-heading/first-line-h1** | 文件的第一行应为一级标题 |
| **MD042 no-empty-links** | 链接不可为空 |
| **MD043 required-headings** | 必须的标题结构 |
| **MD044 proper-names** | 专有名词应正确大写 |
| **MD045 no-alt-text** | 图片应有替代文字(alt 文本) |
| **MD046 code-block-style** | 代码块样式 |
| **MD047 single-trailing-newline** | 文件应以单个换行符结尾 |
| **MD048 code-fence-style** | 代码围栏样式 |
| **MD049 emphasis-style** | 强调样式 |
| **MD050 strong-style** | 粗体样式 |
| **MD051 link-fragments** | 链接片段应有效 |
| **MD052 reference-links-images** | 引用链接和图片应使用已定义的标签 |
| **MD053 link-image-reference-definitions** | 链接和图片引用定义应是必要的 |
| **MD054 link-image-style** | 链接和图片样式 |
| **MD055 table-pipe-style** | 表格管道样式 |
| **MD056 table-column-count** | 表格列数 |
## 3 编程规范
### 3.1 命名风格
1. 优先为变量命名选择名词,这样更容易区分`变量``方法`
```java
Cache`<String>` publicKeyCache;
```
2. 变量的拼音缩写是禁止的(排除地名等名词),例如chengdu。
3. 推荐的变量名以 `类型` 结尾。
对于 `Collection/List` 类型的变量,取 `xxxx` (复数表示多个元素)或以 `xxxList` (特定类型)结束。
对于 `map` 类型的变量,清晰地描述 `key` 和 `value`
```java
Map<Long, User> idUserMap;
Map<Long, String> userIdNameMap;
```
4. 通过其名称直观地知道变量的类型和含义。
方法名称应首先以动词开始,如下所示:
```java
void computeVcores(Object parameter1);
```
> 注意:在 `Builder` 工具类中不必严格遵循这项规则。
### 3.2 常量变量定义
1. 多余的字符串应提取为常量
> 如果一个常量被硬编码两次或多次,请直接提取它为常量并更改相应的引用。
> 通常,`log` 中的常量可以忽略提取。
- 负面示例:
```java
public static RestResponse success(Object data) {
RestResponse resp = new RestResponse();
resp.put("status", "success");
resp.put("code", ResponseCode.CODE_SUCCESS);
resp.put("data", data);
return resp;
}
public static RestResponse error() {
RestResponse resp = new RestResponse();
resp.put("status", "error");
resp.put("code", ResponseCode.CODE_FAIL);
resp.put("data", null);
return resp;
}
```
- 正面示例:
> 字符串提取为常量引用。
```java
public static final String STATUS = "status";
public static final String CODE = "code";
public static final String DATA = "data";
public static RestResponse success(Object data) {
RestResponse resp = new RestResponse();
resp.put(STATUS, "success");
resp.put(CODE, ResponseCode.CODE_SUCCESS);
resp.put(DATA, data);
return resp;
}
public static RestResponse error() {
RestResponse resp = new RestResponse();
resp.put(STATUS, "error");
resp.put(CODE, ResponseCode.CODE_FAIL);
resp.put(DATA, null);
return resp;
}
```
2. 确保代码的可读性和直观性
- `annotation` 符号中的字符串不需要提取为常量。
- 被引用的 `package` 或 `resource` 名称不需要提取为常量。
3. 未被重新分配的变量也必须声明为 `<mark>` final `</mark>` 类型。
4. 关于 `constant/variable` 行的排序顺序
按以下顺序对类中的变量行进行排序:
1. `public static final V`, `static final V`,`protected static final V`, `private static final V`
2. `public static v`, `static v`,`protected static v`, `private static v`
3. `public v`, `v`, `protected v`, `private v`
### 3.3 方法规则
1. 按照 `public`、`protected`、`private` 的顺序对类中的方法进行排序。
类的静态方法可以放在非静态方法之后,并根据一致的方法可见性进行排序。
2. 当方法有限制时,方法的参数和返回值需要用 `@Nonnull` 或 `@Nullable` 注释和约束进行注释。
例如,如果参数不能为 null,最好添加一个 `@Nonnull` 注释。如果返回值可以为 null,则应首先添加 `@Nullable` 注释。
`<mark>` 注意:包名为 `<b>`javax.validation.requirements`</b>` `</mark>`
3. 如果方法中的代码行数太多,请尝试在适当的点上使用多个子方法来分段方法体。
一般来说,需要坚持以下原则:
- 便于测试
- 有好的语义
- 易于阅读
此外,还需要考虑在组件、逻辑、抽象和场景等方面的切割是否合理。
> 然而,目前还没有明确的演示定义。在演变过程中,我们将为开发者提供更多的示例,以便他们有更清晰的参考和理解。
### 3.4 集合规则
1. 对于返回的 `collection` 值,除非有特殊的 `concurrent` (如线程安全),总是返回 `interface`,例如:
- 如果使用 `ArrayList`,则返回 `<mark>` List `</mark>`
- 如果使用 `HashMap`,则返回 `<mark>` Map `</mark>`
- 如果使用 `HashSet`,则返回 `<mark>` Set `</mark>`
2. 如果存在多线程,可以使用以下声明或返回类型:
```java
private CurrentHashMap map;
public CurrentHashMap funName();
```
3. 使用 `isEmpty()` 而不是 `length() == 0` 或者 `size() == 0`
- 负面示例:
```java
if (pathPart.length() == 0) {
return;
}
```
- 正面示例:
```java
if (pathPart.isEmpty()) {
return;
}
```
### 3.5 并发处理
1. 需要管理 `线程池`,使用统一的入口点获取 `线程池`。
`<mark>` 注意:在演变过程中,我们将为开发者提供更多的示例,以便他们有更清晰的参考和理解。 `</mark>`
2. `线程池` 需要进行资源约束,以防止因处理不当导致的资源泄露。
### 3.6 控制/条件语句
1. 避免因不合理的 `条件/控制` 分支顺序导致:
- 多个代码行的 `深度` 为 `n+1`
- 多余的行
一般来说,如果一个方法的代码行深度由于连续嵌套的 `if... else..` 超过了 `2+ Tabs`,那么应该考虑试图
- `合并分支`
- `反转分支条件`
- `提取私有方法`
以减少代码行深度并提高可读性,例如:
- 联合或将逻辑合并到下一级调用中
- 负面示例:
```java
if (isInsert) {
save(platform);
} else {
updateById(platform);
}
```
- 正面示例:
```java
saveOrUpdate(platform);
```
- 合并条件
- 负面示例:
```java
if (expression1) {
if(expression2) {
// ......
}
}
```
- 正面示例:
```java
if (expression1 && expression2) {
// ......
}
```
- 反转条件
- 负面示例:
```java
public void doSomething() {
// 忽略更深的代码块行
// .....
if (condition1) {
// ...
} else {
// ...
}
}
```
- 正面示例:
```java
public void doSomething() {
// 忽略更深的代码块行
// .....
if (!condition1) {
// ...
return;
}
// ...
}
```
- 使用单一变量或方法减少复杂的条件表达式
- 负面示例:
```java
if (dbType.indexOf("sqlserver") >= 0 || dbType.indexOf("sql server") >= 0) {
// ...
}
```
- 正面示例:
```java
if (containsSqlServer(dbType)) {
// ....
}
//.....
// containsSqlServer的定义
```
> 在未来,使用 `sonarlint` 和 `better highlights` 检查代码深度看起来是个不错的选择。
### 3.7 代码注释规则
1. 方法缺少注释:
- `When`:该方法何时可以被调用
- `How`:如何使用此方法以及如何传递参数等
- `What`:此方法实现了哪些功能
- `Note`:在调用此方法时开发人员应注意什么
2. 缺少必要的类头部描述注释。
添加 `What``Note` 等,如上述 `1` 中提到的。
3. 在接口中的方法声明必须被注释。
- 如果实现的语义和接口声明的注释内容不一致,则具体的实现方法也需要用注释重写。
- 如果方法实现的语义与接口声明的注释内容一致,则建议不写注释以避免重复的注释。
4. 在注释行中的第一个词需要大写,如 `param` 行,`return` 行。
如果特殊引用作为主题不需要大写,需要注意特殊符号,例如引号。
### 3.8 Java Lambda 表达式
1. 更倾向于使用 `non-capturing` lambda(不包含对外部范围的引用的lambda)。
Capturing lambda 在每次调用时都需要创建一个新的对象实例。`Non-capturing` lambda 可以为每次调用使用相同的实例。
- 负面示例:
```java
map.computeIfAbsent(key, x -> key.toLowerCase())
```
- 正面示例:
```java
map.computeIfAbsent(key, k -> k.toLowerCase());
```
2. 考虑使用方法引用而不是内联lambda
- 负面示例:
```java
map.computeIfAbsent(key, k-> Loader.load(k));
```
- 正面示例:
```java
map.computeIfAbsent(key, Loader::load);
```
### 3.9 Java Streams
- 在任何对性能敏感的代码中避免使用 Java Streams。
- 使用 Java Streams 的主要动机是为了提高代码的可读性。因此,它们可以在代码的某些部分中很好地匹配,这些部分不是数据密集型的,而是处理协调。
- 即使在后一种情况下,也试图限制范围到一个方法,或者一个内部类中的几个私有方法。
### 3.10 前置条件检查
1. 使用统一的 `Utils.requireXXX` 来完成前提的验证,如果可能的话,用新的前置条件检查替换 `AlertXXException.throwIfXXX`。
### 3.11 StringUtils
1. 使用 `StringUtils.isBlank` 而不是 `StringUtils.isEmpty`
- 负面示例:
```java
if (StringUtils.isEmpty(name)) {
return;
}
```
- 正面示例:
```java
if (StringUtils.isBlank(name)) {
return;
}
```
2. 使用 `StringUtils.isNotBlank` 而不是 `StringUtils.isNotEmpty`
- 负面示例:
```java
if (StringUtils.isNotEmpty(name)) {
return;
}
```
- 正面示例:
```java
if (StringUtils.isNotBlank(name)) {
return;
}
```
3. 使用 `StringUtils.isAllBlank` 而不是 `StringUtils.isAllEmpty`
- 负面示例:
```java
if (StringUtils.isAllEmpty(name, age)) {
return;
}
```
- 正面示例:
```java
if (StringUtils.isAllBlank(name, age)) {
return;
}
```
### 3.12 `Enum` 类
1. 枚举值比较
- 负面示例:
```java
if (status.equals(JobStatus.RUNNING)) {
return;
}
```
- 正面示例:
```java
if (status == JobStatus.RUNNING) {
return;
}
```
2. 枚举类不需要实现 Serializable
- 负面示例:
```java
public enum JobStatus implements Serializable {
// ...
}
```
- 正面示例:
```java
public enum JobStatus {
// ...
}
```
3. 使用 `Enum.name()` 而不是 `Enum.toString()`
- 负面示例:
```java
System.out.println(JobStatus.RUNNING.toString());
```
- 正面示例:
```java
System.out.println(JobStatus.RUNNING.name());
```
4. 枚举类名称统一使用 Enum 后缀
- 负面示例:
```java
public enum JobStatus {
// ...
}
```
- 正面示例:
```java
public enum JobStatusEnum {
// ...
}
```
### 3.13 `Deprecated` 注解
- 负面示例:
```java
@deprecated
public void process(String input) {
// ...
}
```
- 正面示例:
```java
@Deprecated
public void process(String input) {
// ...
}
```
## 4 日志
1. 使用 `占位符` 进行日志输出:
- 负面示例
```java
log.info("Deploy cluster request " + deployRequest);
```
- 正面示例
```java
log.info("load plugin:{} to {}", file.getName(), appPlugins);
```
2. 打印日志时,注意选择 `日志级别`
当打印日志内容时,如果传递了日志占位符的实际参数,必须避免过早评估,以避免由日志级别导致的不必要评估。
- 负面示例:
假设当前日志级别为 `INFO`
```java
// 忽略声明行。
List`<User>` userList = getUsersByBatch(1000);
LOG.debug("All users: {}", getAllUserIds(userList));
```
- 正面示例:
在这种情况下,我们应该在进行实际的日志调用之前提前确定日志级别,如下所示:
```java
// 忽略声明行。
List`<User>` userList = getUsersByBatch(1000);
if (LOG.isDebugEnabled()) {
LOG.debug("All ids of users: {}", getAllIDsOfUsers(userList));
}
```
## 5 测试
1. 建议使用 `JUnit5` 进行测试用例的准备。
2. 实现的接口需在`e2e`模块下编写`e2e`测试用例脚本。
## 参考资料
- [https://site.mockito.org/](https://site.mockito.org/)
- [https://alibaba.github.io/p3c/](https://alibaba.github.io/p3c/)
- [https://junit.org/junit5/](https://junit.org/junit5/)
- [https://streampark.apache.org/](https://streampark.apache.org/)
@@ -0,0 +1,21 @@
---
id: contact
title: 交流联系
sidebar_label: 交流联系
---
> 如果您在使用过程中需要帮助或者想交流建议,可以通过 ISSUE 或 Github Discussion 讨论交流。
[订阅邮件列表](https://lists.apache.org/list.html?dev@hertzbeat.apache.org) : 发送邮件至 `dev-subscribe@hertzbeat.apache.org` 来订阅邮件列表.
[Chat On Discord](https://discord.gg/Fb6M73htGr)
微信交流群 : 加 `ahertzbeat` 好友邀请进群.
微信公众号 : 搜索 ID `usthecom`.
[Github Discussion](https://github.com/apache/hertzbeat/discussions)
[Follow Us Twitter](https://x.com/hertzbeat1024)
[Subscribe YouTube](https://www.youtube.com/channel/UCri75zfWX0GHqJFPENEbLow)
@@ -0,0 +1,178 @@
---
id: contribution
title: 贡献指南
sidebar_position: 0
---
<!--
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
https://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.
-->
> 非常欢迎参与项目贡献,我们致力于维护一个互相帮助的快乐社区。
## 贡献方式
>
> 在 Apache HertzBeat™ 社区,贡献方式有很多:
- 💻**代码**:可以帮助社区完成一些任务、编写新的 feature 或者是修复一些 bug
- ⚠️**测试**:可以来参与测试代码的编写,包括了单元测试、集成测试、e2e 测试;
- 📖**文档**:可以编写或完善文档,来帮助用户更好地了解和使用 HertzBeat;
- 📝**博客**:可以撰写 HertzBeat 的相关文章,来帮助社区更好地推广;
- 🤔**讨论**:可以参与 HertzBeat 新的 feature 的讨论,将您的想法跟 HertzBeat 融合;
- 💡**布道**:可以帮助宣传或推广 HertzBeat 社区,在 meetup 或 summit 中演讲;
- 💬**建议**:也可以对项目或者社区提出一些建议,促进社区的良性发展;
更多贡献方式参见 [Contribution Types](https://allcontributors.org/en/reference/emoji-key/)
即便是小到错别字的修正我们也都非常欢迎 :)
### 让 HertzBeat 运行起来
> 让 HertzBeat 的代码在您的开发工具上运行起来,并且能够断点调试。
> 此为前后端分离项目,本地代码启动需将后端 [manager](https://github.com/apache/hertzbeat/tree/master/hertzbeat-manager) 和前端 [web-app](https://github.com/apache/hertzbeat/tree/master/web-app) 分别启动生效。
#### 后端启动
1. 需要 `maven3+`, `java25``lombok` 环境
2. (可选)修改配置文件配置信息-`hertzbeat-startup/src/main/resources/application.yml`
3. 在项目根目录运行编译: `mvn clean install -DskipTests`
4.`jvm` 加入参数 `--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED`
5. 启动`springboot startup`服务 `hertzbeat-startup/src/main/java/org/apache/hertzbeat/startup/HertzBeatApplication.java`
#### 前端启动
1. 需要 `nodejs pnpm` 环境, 确保 `Node.js >= 18`
2. 进入 `web-app` 目录: `cd web-app`
3. 安装 pnpm: `npm install -g pnpm`
4. 在前端工程目录 `web-app` 下执行: `pnpm install` or `pnpm install --registry=https://registry.npmmirror.com` in `web-app`
5. 待本地后端启动后,在 web-app 目录下启动本地前端 `pnpm start`
6. 浏览器访问 localhost:4200 即可开始,默认账号密码 **admin/hertzbeat**
### 寻找任务
寻找您感兴趣的 Issue!在我们的 GitHub 仓库和邮件列表中,我们经常会发布一些带有 good first issue 或者 status: volunteer wanted 标签的 issue,这些issue都欢迎贡献者的帮助。
其中 good first issue 往往门槛较低、适合新手。
当然,如果您有好的想法,也可以直接在 GitHub Discussion 中提出或者联系社区。
### 提交 Pull Request
1. 首先您需要 Fork 目标仓库 [hertzbeat repository](https://github.com/apache/hertzbeat).
2. 然后 用 git 命令 将代码下载到本地:
```shell
git clone git@github.com:`YOUR_USERNAME`/hertzbeat.git #Recommended
```
3. 下载完成后,请参考目标仓库的入门指南或者 README 文件对项目进行初始化。
4. 接着,您可以参考如下命令进行代码的提交, 切换新的分支, 进行开发:
```shell
git checkout -b a-feature-branch #Recommended
```
5. 提交 commit, commit 描述信息需要符合约定格式: [module name or type name]feature or bugfix or doc: custom message.
```shell
git add <modified file/path>
git commit -m '[docs]feature: necessary instructions' #Recommended
```
6. 推送到远程仓库
```shell
git push origin a-feature-branch
```
7. 然后您就可以在 GitHub 上发起新的 PR (Pull Request)。
请注意 PR 的标题需要符合我们的规范,并且在 PR 中写上必要的说明,来方便 Committer 和其他贡献者进行代码审查。
### 等待PR代码被合并
在提交了 PR 后,Committer 或者社区的小伙伴们会对您提交的代码进行审查(Code Review),会提出一些修改建议,或者是进行一些讨论,请及时关注您的PR。
若后续需要改动,不需要发起一个新的 PR,在原有的分支上提交 commit 并推送到远程仓库后,PR会自动更新。
另外,我们的项目有比较规范和严格的 CI 检查流程,在提交 PR 之后会触发 CI,请注意是否通过 CI 检查。
最后,Committer 可以将 PR 合并入 master 主分支。
### 代码被合并后
在代码被合并后,您就可以在本地和远程仓库删除这个开发分支了:
```shell
git branch -d a-dev-branch
git push origin --delete a-dev-branch
```
在主分支上,您可以执行以下操作来同步上游仓库:
```shell
git remote add upstream https://github.com/apache/hertzbeat.git #Bind the remote warehouse, if it has been executed, it does not need to be executed again
git checkout master
git pull upstream master
```
### 领取贡献者证书
在您的 PR 被合并后,您可以发送如下内容邮件到 `dev@hertzbeat.apache.org` 来申请领取属于您的 Apache HertzBeat™ 贡献者电子证书。
```text
Title: [Contributor] Request for a Contributor Certificate: <Your Full Name>
Body:
Hello,
I would like to request a Contributor Certificate for my contributions to the Apache HertzBeat™ project.
- Full Name: <Your Full Name> # The Full Name will be printed on the certificate, any name you want.
- GitHub Username: <Your GitHub Username>
- Pull Request Links: <List the URLs of the pull requests you have submitted>
- Email Address: <Your Email Address>
Best regards,
<Your Name>
```
在几个工作日内,您会收到携带电子证书的回复,您的名字也会出现在贡献者列表中。
注意贡献者的证书是电子的,待您成为 `Committer` 或者 `PMC` 的证书是实体的。
证书样例:
![cert](/img/docs/hertzbeat-cert.png)
### 如何成为 Committer
通过上述步骤,您就是 HertzBeat 的贡献者了。重复前面的步骤,在社区中保持活跃,坚持下去,您就能成为 Committer!
### 加入讨论交流
[讨论交流](contact)
@@ -0,0 +1,75 @@
---
id: development
title: 如何将 HertzBeat 运行编译?
sidebar_label: 运行编译
---
## 让 HertzBeat 运行起来
> 让 HertzBeat 的代码在您的开发工具上运行起来,并且能够断点调试。
> 此为前后端分离项目,本地代码启动需将后端 [manager](https://github.com/apache/hertzbeat/tree/master/hertzbeat-manager) 和前端 [web-app](https://github.com/apache/hertzbeat/tree/master/web-app) 分别启动生效。
### 后端启动
1. 需要 `maven3+`, `java25``lombok` 环境
2. (可选)修改配置文件配置信息-`hertzbeat-startup/src/main/resources/application.yml`
3. 在项目根目录运行编译: `mvn clean install -DskipTests`
4.`jvm` 加入参数 `--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED`
5. 启动`springboot startup`服务 `hertzbeat-startup/src/main/java/org/apache/hertzbeat/startup/HertzBeatApplication.java`
### 前端启动
1. 需要 `nodejs pnpm` 环境, 版本要求 `Node.js >= 18`
2. 进入 `web-app` 目录: `cd web-app`
3. 安装pnpm: `npm install -g pnpm`
4. 在前端工程目录 `web-app` 下执行: `pnpm install` 或者 `pnpm install --registry=https://registry.npmmirror.com`
5. 待本地后端启动后,在web-app目录下启动本地前端 `pnpm start`
6. 浏览器访问 localhost:4200 即可开始,默认账号密码 admin/hertzbeat
## 生成二进制包
> 需要 `maven3+`, `java25`, `node` 和 `pnpm` 环境.
### 前端打包
1. 需要 `Node pnpm` 环境, 版本要求 `Node.js >= 18`
2. 切换到 `web-app` 目录: `cd web-app`
3. 安装 pnpm: `npm install -g pnpm`
4. 安装本项目依赖: `pnpm install``pnpm install --registry=https://registry.npmmirror.com`
5. 打包: `pnpm package`
### 后端打包
1. 需要 `maven3+`, `java25` 环境
2. 在项目根目录运行: `mvn clean package -Prelease`
HertzBeat 包将生成为 `dist/apache-hertzbeat-{version}-bin.tar.gz`
### 采样器打包
1. 需要 `maven3+`, `java25` 环境
2. 在项目根目录运行: `mvn clean install`
3. 切换到 `hertzbeat-collector` 目录: `cd hertzbeat-collector`
4.`hertzbeat-collector` 目录下打 JVM 采集器安装包: `mvn clean package -Pcluster`
5.`hertzbeat-collector` 目录下打 Native 采集器安装包: `mvn clean package -pl hertzbeat-collector-collector -am -Pnative`
> Native 采集器打包需要带有 `native-image` 命令的 GraalVM JDK 25 环境。
HertzBeat 采集器安装包将生成为 `dist/apache-hertzbeat-collector-{version}-bin.tar.gz`,以及类似 `dist/apache-hertzbeat-collector-native-{version}-linux-amd64-bin.tar.gz` 这样的 Native 平台安装包
@@ -0,0 +1,139 @@
---
id: 'document'
title: '文档说明'
sidebar_position: 1
---
<!--
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
https://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.
-->
对于任何类型的软件来说,良好的文档都是至关重要的。任何能够改进 HertzBeat 文档的贡献都是受欢迎的。
## 获取文档项目
HertzBeat 项目的文档在 [git 仓库 home 目录](https://github.com/apache/hertzbeat/tree/master/home) 中维护。
首先,您需要将文档项目 fork 到您自己的 github 仓库,然后将文`clone`到您的本地计算机。
```shell
git clone git@github.com:<your-github-user-name>/hertzbeat.git
```
## 预览和生成静态文件
此网站使用 node 进行编译,使用 Docusaurus 框架组件。
1. 下载并安装 nodejs (版本 18.8.0)
2. 将代码克隆到本地 `git clone git@github.com:apache/hertzbeat.git`
3.`home`目录下运行 `pnpm install` 来安装所需的依赖库。
4.`home`目录下运行 `pnpm start`,您可以访问 [http://localhost:3000](http://localhost:3000) 查看站点的英文模式预览
5.`home`目录下运行 `pnpm start-zh-cn`,您可以访问 [http://localhost:3000](http://localhost:3000) 查看站点的中文模式预览
6. 若要生成静态网站资源文件,请运行 `pnpm build`。构建的静态资源位于 build 目录中。
## 文档格式检验
在 Apache HertzBeat 中,所有的 MD 文章都要通过 MD 的 [CI](https://github.com/apache/hertzbeat/blob/master/.github/workflows/doc-build-test.yml) 检测才能够合并,目的是为了保持文档官网的美观和文章格式的一致性。
在您编写了相关 MD 文章之后,您可以在本地执行以下命令,预先检查 MD 的文章内容是否符合要求,减少 review 的工作量,节省您的时间:
```shell
cd home && pnpm install
pnpm md-lint
# 如果文档错误,您可以使用 pnpm md-lint-fix 修复
pnpm md-lint-fix
```
MD 文章的相关格式规则您可以参考:[Markdown-lint-rules](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md)
项目中的 MD 格式配置文件:[.markdownlint-cli2.jsonc](https://github.com/apache/hertzbeat/blob/master/.markdownlint-cli2.jsonc)
## 目录结构
```html
|-- docs
|-- blog
|-- i18n
| `-- zh-CN // 中文国际化
| |-- code.json
| |-- docusaurus-plugin-content-blog
| |-- docusaurus-plugin-content-docs
| `-- docusaurus-theme-classic
|-- resource // 静态资源文件
|-- src
| |-- theme
| |-- css
| |-- js
| |-- pages
| | |-- components
| | |-- index.js
| |-- constants.js
|-- static // 图片静态资源
| |-- img //
| | |-- blog // 博客图片
| | |-- docs // 文档图片
| | |-- home // 产品图片
| | |-- icons // 图标
|-- docusaurus.config.js
|-- sidebars.js // 文档侧边栏菜单配置
```
## 写一篇博客
文章放在 `blog/` 下,翻译版本放在 `i18n/<语种>/docusaurus-plugin-content-blog/`,文件名保持一致。
```yaml
---
title: Apache HertzBeat™ 1.8.0 版本发布公告
author: Apache HertzBeat Community
author_url: https://github.com/apache/hertzbeat
tags: [releases]
description: Apache HertzBeat 1.8.0 带来 AI 对话与 MCP 工具、日志监控,以及大幅性能提升。
cover_headline: Apache HertzBeat 1.8.0
---
```
- **`tags`** —— 第一个必须是 `blog/tags.yml` 里定义的分类之一(`releases``engineering`
`tutorials``community`),博客列表页的分类筛选依赖它。后面可以再加自由主题标签。
- **`description`** —— 一到两句话。它同时是卡片摘要和搜索引擎摘要。不填的话
Docusaurus 会取正文第一段,通常是问候语或小标题。
- **`cover_headline`** —— 可选。博客列表会为每篇文章渲染统一视觉风格的封面,这个字段
设置封面上的大标题(例如 `Welcome Bob`)。不填则自动从标题里的版本号或
被监控产品名推导。
- **`cover_kicker`** —— 可选。生成封面上的小胶囊徽章文字(例如 `New Committer`),
不填默认用分类英文名。封面文字各语言统一用英文,保持视觉一致。
- **`image`** —— 可选。真实封面图,配置后完全替代生成式封面。
## 规范
### 文件的命名规范
全部由小写,数字,下划线和破折号组成。
正例:`render-dom.js / signup.css / index.html / company-logo.png / hertz_beat.md`
反例:`renderDom.js / UserManagement.html`
### 资源路径
图片资源统一放在 `static/img/{模块名称}`
css 和其他样式文件放在 `src/css` 目录中。
### 页面内容修改
> 所有页面文档都可以通过底部的'编辑此页面'按钮直接跳转到相应的 github 资源修改页面。
@@ -0,0 +1,608 @@
---
id: 'how_to_release'
title: 如何进行版本发布
sidebar_position: 4
---
本教程详细描述了如何发布 Apache HertzBeat。
:::caution 开始之前:本文中需要替换的变量
文中的命令和邮件模板使用了占位符,执行前请全部替换为你自己的值,**不要直接复制粘贴**。
| 占位符 | 含义 | 示例 |
| --- | --- | --- |
| `{version}` | 发布版本号 | `1.9.0` |
| `RC1` | 候选版本号,从 1 开始,每次重新投票 +1 | `RC2` |
| `<YOUR_APACHE_ID>` | 你的 Apache LDAP 用户名 | `duansg` |
| `<YOUR_APACHE_ID>@apache.org` | 你的 Apache 邮箱 | `duansg@apache.org` |
| `<YOUR_KEY_ID>` | 你的 GPG 短密钥 ID`gpg --keyid-format SHORT --list-keys` 可查看 | `EF04C474` |
| `<YOUR_NAME>` | 邮件署名 | `Duan SiGuo` |
文中代码块里的**命令输出示例**(如 `gpg` 的回显、签名校验结果)保留了具体值,仅供对照格式,你实际看到的会是自己的信息。
:::
## 1. 环境要求
此发布过程在 UbuntuOS(可在 Windows Mac) 中进行操作,并需要以下环境:
- JDK 25
- Node18 pnpm
- Apache Maven 3.x
- GnuPG 2.x
- Git
- SVN (Apache使用svn来托管项目发布)
> 注意需要设置环境变量 `export GPG_TTY=$(tty)`
## 2. 准备发布
> 首先整理帐户信息以更好地了解操作过程,稍后会多次使用。
>
> - apache id: `<YOUR_APACHE_ID>` (APACHE LDAP 用户名)
> - apache passphrase: `APACHE LDAP 密钥`
> - apache email: `<YOUR_APACHE_ID>@apache.org`
> - gpg real name: `<YOUR_APACHE_ID>` (任何名称均可用, 建议设置为与 apache id 相同的名称)
> - gpg key passphrase: `创建gpg密钥时设置的密码,你需要记住此密码`
### 2.1 生成密钥
```shell
$ gpg --full-gen-key
gpg (GnuPG) 2.2.27; Copyright (C) 2021 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
(14) Existing key from card
Your selection? 1 # Please enter 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (3072) 4096 # Please enter 4096 here
Requested keysize is 4096 bits
Please specify how long the key should be valid.
0 = key does not expire
`<n>` = key expires in n days
`<n>`w = key expires in n weeks
`<n>`m = key expires in n months
`<n>`y = key expires in n years
Key is valid for? (0) 0 # Please enter 0
Key does not expire at all
Is this correct? (y/N) y # Please enter y here
GnuPG needs to construct a user ID to identify your key.
Real name: <YOUR_APACHE_ID> # Please enter 'gpg real name'
Email address: <YOUR_APACHE_ID>@apache.org # Please enter your apache email address here
Comment: apache key # Please enter some comments here
You selected this USER-ID:
"duansg (apache key) [duansg@apache.org](mailto:duansg@apache.org)"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O # Please enter O here
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
# At this time, a dialog box will pop up, asking you to enter the key for this gpg.
# you need to remember that it will be used in subsequent steps.
┌─────────────────────────────────────────────────────┐
│ Please enter this passphrase to │
│ protect your new key │
│ │
│ Passphrase: _______________________________________ │
│ │
`<OK>` `<Cancel>`
└─────────────────────────────────────────────────────┘
# Here you need to re-enter the password in the previous step.
┌─────────────────────────────────────────────────────┐
│ Please re-enter this passphrase │
│ │
│ Passphrase: _______________________________________ │
│ │
`<OK>` `<Cancel>`
└─────────────────────────────────────────────────────┘
gpg: directory '/Users/duansg/.gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/Users/duansg/.gnupg/openpgp-revocs.d/C787268D3396367EB3C2242402CA7E2CEF04C474.rev'
public and secret key created and signed.
pub rsa4096 2026-07-27 [SC]
C787268D3396367EB3C2242402CA7E2CEF04C474
uid duansg <duansg@apache.org>
sub rsa4096 2026-07-27 [E]
```
密钥可以通过`gpg --list-signatures` 或者 `gpg --keyid-format SHORT --list-keys` 命令查看
### 2.2 将生成的密钥上传到公共服务器
```shell
$ gpg --keyid-format SHORT --list-keys
------------------------
pub rsa4096/EF04C474 2026-07-27 [SC]
C787268D3396367EB3C2242402CA7E2CEF04C474
uid [ultimate] duansg <duansg@apache.org>
sub rsa4096/E955F059 2026-07-27 [E]
# Send public key to keyserver via key id
$ gpg --keyserver hkps://keyserver.ubuntu.com:443 --send-key <YOUR_KEY_ID>
# Among them, keyserver.ubuntu.com is the selected keyserver, it is recommended to use this, because the Apache Nexus verification uses this keyserver
```
#### 2.3 检查密钥是否创建成功
验证是否已经同步到公共网络,需要一分钟左右才能知道答案,如果不成功,您可以多次上传并重试。
```shell
gpg --keyserver hkps://keyserver.ubuntu.com:443 --recv-key <YOUR_KEY_ID> # If the following content appears, it means success
gpg: key 02CA7E2CEF04C474: "duansg <duansg@apache.org>" not changed
gpg: Total number processed: 1
gpg: unchanged: 1
```
或者进入 [https://keyserver.ubuntu.com/](https://keyserver.ubuntu.com/) 网址,输入密钥的名称,然后点击'Search key' 按钮,查看是否有对应名称的密钥。
#### 2.4 将 gpg 公钥添加到 Apache SVN 项目仓库的 KEYS 文件中
- Apache HertzBeat Dev 分支 [https://dist.apache.org/repos/dist/dev/hertzbeat](https://dist.apache.org/repos/dist/dev/hertzbeat)
- Apache HertzBeat Release 分支 [https://dist.apache.org/repos/dist/release/hertzbeat](https://dist.apache.org/repos/dist/release/hertzbeat)
##### 2.4.1 将公钥添加到dev分支的KEYS
切换到 HertzBeat 的根目录进行相关操作:
```shell
$ mkdir -p svn/dev
$ cd svn/dev
$ svn co https://dist.apache.org/repos/dist/dev/hertzbeat
$ cd svn/dev/hertzbeat
# 将生成的KEY追加到KEYS文件中,检查是否添加正确
$ (gpg --list-sigs <YOUR_APACHE_ID>@apache.org && gpg --export --armor <YOUR_APACHE_ID>@apache.org) >> KEYS
$ svn ci -m "add gpg key for <YOUR_APACHE_ID>"
```
##### 2.4.2 将公钥添加到release分支的KEYS
切换到 HertzBeat 的根目录进行相关操作:
```shell
$ mkdir -p svn/release
$ cd svn/release
$ svn co https://dist.apache.org/repos/dist/release/hertzbeat
$ cd svn/release/hertzbeat
# 将生成的KEY追加到KEYS文件中,检查是否添加正确
$ (gpg --list-sigs <YOUR_APACHE_ID>@apache.org && gpg --export --armor <YOUR_APACHE_ID>@apache.org) >> KEYS
$ svn ci -m "add gpg key for <YOUR_APACHE_ID>"
```
## 3. 准备物料 & 发布
### 准备发布物料
#### 3.1 基于 master 分支,创建一个名为 release-`release_version`-rcx 的分支,例如 `release-{version}-rc1`。并基于 `release-{version}-rc1` 分支创建一个名为 `v{version}-rc1` 的标签,并将此标签设置为预发布
```shell
git checkout master
git checkout -b release-{version}-rc1
```
#### 3.2 本地切换到待发布分支
```shell
git checkout release-{version}-rc1
```
#### 3.3 编译二进制包
> HertzBeat 编译打包,在项目`web-app`目录下执行以下命令,
```shell
pnpm install
pnpm package
```
> 在项目根目录下执行以下命令
```shell
mvn clean package -Prelease
```
然后
```shell
mvn clean install
```
> HertzBeat-Collector 编译打包,在项目根目录下执行以下命令
```shell
mvn clean package -pl hertzbeat-collector/hertzbeat-collector-collector -am -Pcluster
```
> 使用带 `native-image` 的 GraalVM JDK 25,为当前宿主机构建 Native 采集器安装包
```shell
mvn clean package -pl hertzbeat-collector/hertzbeat-collector-collector -am -Pnative -DskipTests
```
> 仓库中的 `.github/workflows/collector-native-build.yml` 是 release 辅助工作流,不参与日常 PR 或 push 的常规 CI。
>
> 之所以只保留手动触发,是因为跨平台 Native 构建耗时更长,也会占用相对稀缺的 Linux ARM、macOS 和 Windows Runner。准备发版时,请在 GitHub Actions 页面选择 `Collector Native Release`,基于 release 分支或 tag 手动触发,然后下载上传的产物用于签名和发布。
生成的二进制包在:
- `dist/apache-hertzbeat-{version}-bin.tar.gz`
- `dist/apache-hertzbeat-collector-{version}-bin.tar.gz`
- `dist/apache-hertzbeat-collector-native-{version}-linux-amd64-bin.tar.gz`
- `dist/apache-hertzbeat-collector-native-{version}-linux-arm64-bin.tar.gz`
- `dist/apache-hertzbeat-collector-native-{version}-windows-amd64-bin.zip`
- `dist/apache-hertzbeat-{version}-docker-compose.tar.gz`
> **构建完成后请逐个启动一次 Native 采集器包再进行签名。** Native 包曾出现过构建成功、启动即崩溃的情况,
> 而签名和上传流程都不会发现这一点。解压后执行 `bin/startup.sh`Windows 为 `bin\startup.bat`),
> 确认日志出现 `Started Collector` 和 `Registered N collect strategies`,且进程在十几秒后仍然存活。
#### 3.4 打包项目源代码
> 打包项目源码
```shell
# 注意替换版本号
git archive \
--format=tar.gz \
--output="dist/apache-hertzbeat-{version}-src.tar.gz" \
--prefix=apache-hertzbeat-{version}-src/ \
release-{version}-rc1
```
生成的代码归档文件在 `dist/apache-hertzbeat-{version}-src.tar.gz`
### 签名发布物料
#### 3.5 对二进制和源码包进行签名
将上步骤生成的三个文件包放到`dist`目录下(若无则新建目录),然后对文件包进行签名和SHA512校验和生成。
> 其中 `<YOUR_KEY_ID>` 是你的 GPG 短密钥 ID,可以通过 `gpg --keyid-format SHORT --list-keys` 查看。
```shell
cd dist
# 签名,已有签名的物料会跳过
for i in *.tar.gz *.zip; do
[ -e "$i.asc" ] || { echo "sign: $i"; gpg -u <YOUR_KEY_ID> --armor --output "$i.asc" --detach-sig "$i"; }
done
# SHA512 校验和,已有校验和的物料会跳过
for i in *.tar.gz *.zip; do
[ -e "$i.sha512" ] || { echo "sha512: $i"; sha512sum "$i" > "$i.sha512"; }
done
# macOS 上若提示 sha512sum 不存在,可通过 brew install coreutils 安装
# 完整性自检:每个物料都必须同时有 .asc 和 .sha512
# 通配符漏掉某类物料时(例如只写 *.tar.gz 会漏掉 Windows 的 .zip),这里会立刻发现
for i in *.tar.gz *.zip; do
[ -e "$i.asc" ] || echo "缺少签名: $i"
[ -e "$i.sha512" ] || echo "缺少校验和: $i"
done
```
> 最终文件列表如下
```text
apache-hertzbeat-{version}-src.tar.gz
apache-hertzbeat-{version}-src.tar.gz.asc
apache-hertzbeat-{version}-src.tar.gz.sha512
apache-hertzbeat-{version}-bin.tar.gz
apache-hertzbeat-{version}-bin.tar.gz.asc
apache-hertzbeat-{version}-bin.tar.gz.sha512
apache-hertzbeat-{version}-docker-compose.tar.gz
apache-hertzbeat-{version}-docker-compose.tar.gz.asc
apache-hertzbeat-{version}-docker-compose.tar.gz.sha512
apache-hertzbeat-collector-{version}-bin.tar.gz
apache-hertzbeat-collector-{version}-bin.tar.gz.asc
apache-hertzbeat-collector-{version}-bin.tar.gz.sha512
apache-hertzbeat-collector-native-{version}-linux-amd64-bin.tar.gz
apache-hertzbeat-collector-native-{version}-linux-amd64-bin.tar.gz.asc
apache-hertzbeat-collector-native-{version}-linux-amd64-bin.tar.gz.sha512
apache-hertzbeat-collector-native-{version}-linux-arm64-bin.tar.gz
apache-hertzbeat-collector-native-{version}-linux-arm64-bin.tar.gz.asc
apache-hertzbeat-collector-native-{version}-linux-arm64-bin.tar.gz.sha512
apache-hertzbeat-collector-native-{version}-windows-amd64-bin.zip
apache-hertzbeat-collector-native-{version}-windows-amd64-bin.zip.asc
apache-hertzbeat-collector-native-{version}-windows-amd64-bin.zip.sha512
```
#### 3.6 验证签名
```shell
$ cd dist
# 验证签名
$ for i in *.tar.gz *.zip; do echo $i; gpg --verify $i.asc $i ; done
apache-hertzbeat-{version}-bin.tar.gz
gpg: Signature made Sun Sep 13 06:59:54 2026 PDT
gpg: using RSA key C787268D3396367EB3C2242402CA7E2CEF04C474
gpg: Good signature from "duansg <duansg@apache.org>" [ultimate]
apache-hertzbeat-{version}-docker-bin.tar.gz
gpg: Signature made Sun Sep 13 07:00:39 2026 PDT
gpg: using RSA key C787268D3396367EB3C2242402CA7E2CEF04C474
gpg: Good signature from "duansg <duansg@apache.org>" [ultimate]
apache-hertzbeat-{version}-docker-compose.tar.gz
gpg: Signature made Sun Sep 13 07:00:39 2026 PDT
gpg: using RSA key C787268D3396367EB3C2242402CA7E2CEF04C474
gpg: Good signature from "duansg <duansg@apache.org>" [ultimate]
apache-hertzbeat-{version}-src.tar.gz
gpg: Signature made Sun Sep 13 07:00:39 2026 PDT
gpg: using RSA key C787268D3396367EB3C2242402CA7E2CEF04C474
gpg: Good signature from "duansg <duansg@apache.org>" [ultimate]
apache-hertzbeat-collector-{version}-bin.tar.gz
gpg: Signature made Sun Sep 13 07:00:40 2026 PDT
gpg: using RSA key C787268D3396367EB3C2242402CA7E2CEF04C474
gpg: Good signature from "duansg <duansg@apache.org>" [ultimate]
apache-hertzbeat-collector-native-{version}-linux-amd64-bin.tar.gz
gpg: Signature made Sun Sep 13 07:00:41 2026 PDT
gpg: using RSA key C787268D3396367EB3C2242402CA7E2CEF04C474
gpg: Good signature from "duansg <duansg@apache.org>" [ultimate]
apache-hertzbeat-collector-native-{version}-linux-arm64-bin.tar.gz
gpg: Signature made Sun Sep 13 07:00:41 2026 PDT
gpg: using RSA key C787268D3396367EB3C2242402CA7E2CEF04C474
gpg: Good signature from "duansg <duansg@apache.org>" [ultimate]
apache-hertzbeat-collector-native-{version}-windows-amd64-bin.zip
gpg: Signature made Sun Sep 13 18:42:45 2026 PDT
gpg: using RSA key C787268D3396367EB3C2242402CA7E2CEF04C474
gpg: Good signature from "duansg <duansg@apache.org>" [ultimate]
# 验证 SHA512
$ for i in *.tar.gz *.zip; do echo $i; sha512sum --check $i.sha512; done
apache-hertzbeat-{version}-bin.tar.gz
apache-hertzbeat-{version}-bin.tar.gz: OK
apache-hertzbeat-{version}-docker-bin.tar.gz
apache-hertzbeat-{version}-docker-bin.tar.gz: OK
apache-hertzbeat-{version}-docker-compose.tar.gz
apache-hertzbeat-{version}-docker-compose.tar.gz: OK
apache-hertzbeat-{version}-src.tar.gz
apache-hertzbeat-{version}-src.tar.gz: OK
apache-hertzbeat-collector-{version}-bin.tar.gz
apache-hertzbeat-collector-{version}-bin.tar.gz: OK
apache-hertzbeat-collector-native-{version}-linux-amd64-bin.tar.gz
apache-hertzbeat-collector-native-{version}-linux-amd64-bin.tar.gz: OK
apache-hertzbeat-collector-native-{version}-linux-arm64-bin.tar.gz
apache-hertzbeat-collector-native-{version}-linux-arm64-bin.tar.gz: OK
apache-hertzbeat-collector-native-{version}-windows-amd64-bin.zip
apache-hertzbeat-collector-native-{version}-windows-amd64-bin.zip: OK
```
#### 3.7 发布 Apache SVN 仓库中 dev 目录的物料包
- 检出仓库
```shell
# 检出 Apache SVN 仓库中的 dev/hertzbeat 目录到 Apache HertzBeat™ 项目根目录下的 svn/dev 目录下
svn co https://dist.apache.org/repos/dist/dev/hertzbeat svn/dev
# 历史候选版本较多时,可改用空检出,避免下载全部历史物料
# svn co --depth empty https://dist.apache.org/repos/dist/dev/hertzbeat svn/dev
```
- 复制物料包到 SVN 仓库
创建一个版本号目录,并以`release_version`-`RC_version`的形式命名。RC_version从1开始,即候选版本从RC1开始。在发布过程中,如果出现导致投票失败的问题,需要进行修正,那么RC版本需要迭代,RC版本号需要+1。例如:为版本 `{version}-RC1` 投票。如果投票顺利通过,那么RC1版本的资料将作为最终版本的资料发布。如果出现问题并需要纠正,那么修正后重新启动投票,下一次的候选版本为 `{version}-RC2`
```shell
mkdir -p svn/dev/{version}-RC1
cp -f dist/* svn/dev/{version}-RC1
```
- 提交到SVN
```shell
cd svn/dev
# 1. 检查svn状态
svn status
# 2. 添加到svn
svn add {version}-RC1
svn status
# 3. 提交到svn远端服务器
svn commit -m "release for HertzBeat {version}-RC1"
```
- 检查 Apache SVN 提交结果
> 在浏览器中访问 [https://dist.apache.org/repos/dist/dev/hertzbeat/](https://dist.apache.org/repos/dist/dev/hertzbeat/) , 检查是否有新的版本内容
## 4. 进入社区投票阶段
### 4.1 发送社区投票邮件
发送社区投票邮件需要至少三个`+1`,且无`-1`
:::caution 发信前先确认两件事
1. **你的公钥已经在 KEYS 文件里**:访问 [https://downloads.apache.org/hertzbeat/KEYS](https://downloads.apache.org/hertzbeat/KEYS) 搜索自己的邮箱,找不到则投票者无法验证签名。KEYS 的添加见 2.4。
2. **模板里的版本号和 RC 号已全部替换**:下面的模板共有 **5 处**需要改动——邮件标题、正文第一行、Release notes 链接、候选物料链接、Git tag 链接。RC 号递增时(RC1 → RC2)这几处必须同步修改,漏改任何一处都会让投票者困惑。
:::
> `Send to`: [dev@hertzbeat.apache.org](mailto:dev@hertzbeat.apache.org) <br />
> `Title`: `[VOTE] Release Apache HertzBeat {version} rc1` <br />
> `Body`:
```text
Hello HertzBeat Community:
This is a call for vote to release Apache HertzBeat version release-{version}-RC1.
Apache HertzBeat - a real-time observability system with agentless, performance cluster, prometheus-compatible, custom monitoring and status page building capabilities.
Release notes:
https://github.com/apache/hertzbeat/releases/tag/v{version}-rc1
The release candidates:
https://dist.apache.org/repos/dist/dev/hertzbeat/{version}-RC1/
Git tag for the release:
https://github.com/apache/hertzbeat/releases/tag/v{version}-rc1
The artifacts signed with PGP key [<YOUR_KEY_ID>], corresponding to [<YOUR_APACHE_ID>@apache.org], that can be found in keys file:
https://downloads.apache.org/hertzbeat/KEYS
The vote will be open for at least 72 hours or until the necessary number of votes are reached.
Please vote accordingly:
[ ] +1 approve
[ ] +0 no opinion
[ ] -1 disapprove with the reason
*Valid check is a requirement for a vote. *Checklist for reference:
[ ] Download HertzBeat are valid.
[ ] Checksums and PGP signatures are valid.
[ ] Source code distributions have correct names matching the current
release.
[ ] LICENSE and NOTICE files are correct for each HertzBeat repo.
[ ] All files have license headers if necessary.
[ ] No compiled archives bundled in source archive.
[ ] Can compile from source.
Steps to validate the releasePlease refer to:
https://hertzbeat.apache.org/docs/community/how_to_verify_release
How to Build:
https://hertzbeat.apache.org/docs/community/development/#build-hertzbeat-binary-package
Thanks!
```
在72小时后,将统计投票结果,并发送投票结果邮件,如下所示。
> `Send to`: [dev@hertzbeat.apache.org](mailto:dev@hertzbeat.apache.org) <br />
> `Title`: `[RESULT][VOTE] Release Apache HertzBeat {version}-rc1` <br />
> `Body`:
```text
Dear HertzBeat community,
Thanks for your review and vote for "Release Apache HertzBeat {version}-rc1"
I'm happy to announce the vote has passed:
---
4 binding +1, from:
- cc
1 non-binding +1, from:
- Roc Marshal
---
no 0 or -1 votes.
Vote thread:
https://lists.apache.org/thread/t01b2lbtqzyt7j4dsbdp5qjc3gngjsdq
---
Thank you to everyone who helped us to verify and vote for this release.
---
Best,
<YOUR_NAME>
```
邮件内容中的一项是`Vote thread`,在 [https://lists.apache.org/list.html?dev@hertzbeat.apache.org](https://lists.apache.org/list.html?dev@hertzbeat.apache.org) 查看获取
## 5. 完成最终发布步骤
### 5.1 迁移源代码和二进制包
```shell
svn mv https://dist.apache.org/repos/dist/dev/hertzbeat/{version}-RC1 https://dist.apache.org/repos/dist/release/hertzbeat/{version} -m "transfer packages for {version}-RC1"
```
### 5.2 添加新版本下载地址到官网
[https://github.com/apache/hertzbeat/blob/master/home/docs/download.md](https://github.com/apache/hertzbeat/blob/master/home/docs/download.md)
[https://github.com/apache/hertzbeat/blob/master/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/download.md](https://github.com/apache/hertzbeat/blob/master/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/download.md)
完成后打开官网地址 [https://hertzbeat.apache.org/docs/download/](https://hertzbeat.apache.org/docs/download/) 查看是否有新版本的下载
> 需要注意的是,下载链接可能需要一个小时后才会生效,请注意。
### 5.3 Github 生成 Release
基于 `release-{version}-rc1` 分支修改创建一个名为 `v{version}` 的标签,并将此标签设置为 latest release。
:::tip
在原有的 Release 上面修改,无需重新创建 Release。
:::
然后输入发版标题和描述
- 发版标题:
```text
v{version}
```
- 描述:
```text
xxx
release note: xxx
```
然后点击`Publish release`按钮。
然后将 `release-{version}-rc1` 分支重命名为 `release-{version}`
### 5.4 发送新版本公告邮件
> `Send to`: [announce@apache.org](mailto:announce@apache.org) <br />
> `cc`: [dev@hertzbeat.apache.org](mailto:dev@hertzbeat.apache.org) <br />
> `Title`: `[ANNOUNCE] Apache HertzBeat {version} released` <br />
> `Body`:
```text
Hi Community,
We are glad to announce the release of Apache HertzBeat {version}.
Thanks again for your help.
Apache HertzBeat (https://hertzbeat.apache.org/) - a real-time observability system with agentless, performance cluster, prometheus-compatible, custom monitoring and status page building capabilities.
Download Link:
https://hertzbeat.apache.org/docs/download/
Release Note:
https://github.com/apache/hertzbeat/releases/tag/v{version}
Website:
https://hertzbeat.apache.org/
HertzBeat Resources:
- Issue: https://github.com/apache/hertzbeat/issues
- Mailing list: dev@hertzbeat.apache.org
---
Apache HertzBeat Team
Best,
<YOUR_NAME>
```
该版本的发布顺利结束。
---
@@ -0,0 +1,268 @@
---
id: how_to_verify_release
title: 版本物料的验证
sidebar_position: 4
---
## 验证候选版本
详细检查列表请参考 ASF 官方的[发布策略](https://www.apache.org/legal/release-policy.html)与[发布检查清单](https://infra.apache.org/release-publishing.html)
在浏览器中可访问版本内容 [https://dist.apache.org/repos/dist/dev/hertzbeat/](https://dist.apache.org/repos/dist/dev/hertzbeat/)
### 1. 下载候选版本到本地
> 需要依赖gpg工具,如果没有,建议安装gpg2
```shell
# 将 {version} 与 RC1 替换为本次投票的版本号和候选版本号,例如 1.9.0 与 RC2
# 如果本地有 svn,可以整个目录检出
svn co https://dist.apache.org/repos/dist/dev/hertzbeat/{version}-RC1/
# 或者直接下载单个物料文件
wget https://dist.apache.org/repos/dist/dev/hertzbeat/{version}-RC1/apache-hertzbeat-{version}-src.tar.gz
```
### 2. 验证上传的版本是否合规
> 开始验证环节,验证包含但不局限于以下内容和形式
#### 2.1 查看发布包是否完整
> 上传到dist的包必须包含源码包,二进制包可选
1. 是否包含源码包
2. 是否包含源码包的签名
3. 是否包含源码包的sha512
4. 如果上传了二进制包(含 native 采集器包),则每个包同样检查第 2、3 项
> **每一个**物料都必须有对应的 `.asc` 和 `.sha512`,一个都不能少。可以用下面的命令快速核对,
> 有输出就说明有物料缺失:
>
> ```shell
> for i in *.tar.gz *.zip; do
> [ -e "$i.asc" ] || echo "缺少签名: $i"
> [ -e "$i.sha512" ] || echo "缺少校验和: $i"
> done
> ```
#### 2.2 检查gpg签名
首先导入发布人公钥。从svn仓库导入KEYS到本地环境。(发布版本的人不需要再导入,帮助做验证的人需要导入,用户名填发版人的即可)
##### 2.2.1 导入公钥
```shell
curl https://downloads.apache.org/hertzbeat/KEYS > KEYS # 下载KEYS
gpg --import KEYS # 导入KEYS到本地
```
##### 2.2.2 关于信任公钥
:::tip 验证签名并不需要信任公钥
`gpg --verify` 对未信任的公钥同样会输出 `Good signature`,只是会附带一行提示:
```text
WARNING: This key is not certified with a trusted signature!
```
**这行 WARNING 是正常的,只要出现 `Good signature` 即视为通过。**
如果你确实想消除这个提示,可以按下面的方式设置信任级别。但请注意,`5 = ultimate` 在 GPG 语义中表示
“这是我自己的密钥”,把他人的公钥设为 ultimate 会污染本地信任网,一般选择 `4 = fully` 更合适。
:::
> 设置此次版本所使用 KEY 的信任级别(可选)
```shell
$ gpg --edit-key xxxxxxxxxx #此次版本所使用的KEY用户
gpg (GnuPG) 2.2.21; Copyright (C) 2020 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Secret key is available.
gpg> trust #信任
Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)
1 = I don't know or won't say
2 = I do NOT trust
3 = I trust marginally
4 = I trust fully
5 = I trust ultimately
m = back to the main menu
Your decision? 5 #选择5
Do you really want to set this key to ultimate trust? (y/N) y #选择y
gpg>
```
##### 2.2.3 检查签名
```shell
# 注意同时覆盖 *.zipWindows 的 native 采集器包是 zip 格式,
# 只写 *.tar.gz 会静默跳过它
for i in *.tar.gz *.zip; do echo $i; gpg --verify $i.asc $i ; done
```
> 核对签名所用的 key 与投票邮件中声明的 PGP key ID 是否一致。只有 `Good signature` 而 key 对不上,
> 并不能说明物料是发布者签的。
检查结果
> 出现类似以下内容则说明签名正确,关键字:**`Good signature`**
```shell
apache-hertzbeat-${release_version}-src.tar.gz
gpg: Signature made XXXX
gpg: using RSA key XXXXX
gpg: Good signature from "XXX <xxx@apache.org>"
```
#### 2.3 检查sha512哈希
> 本地计算sha512哈希后,验证是否与dist上的一致,如果上传二进制包,则同样需要检查二进制包的sha512哈希
```shell
for i in *.tar.gz *.zip; do echo $i; sha512sum --check "$i.sha512"; done
# macOS 上如果没有 sha512sum,可用系统自带的 shasum 替代
# for i in *.tar.gz *.zip; do echo $i; shasum -a 512 -c "$i.sha512"; done
```
> 每个物料输出 `OK` 即为通过:
>
> ```text
> apache-hertzbeat-{version}-src.tar.gz: OK
> ```
#### 2.4 检查二进制包
解压缩 `apache-hertzbeat-${release_version}-bin.tar.gz`
```shell
tar -xzvf apache-hertzbeat-${release_version}-bin.tar.gz
```
进行如下检查:
- [ ] 存在`LICENSE``NOTICE`文件
- [ ] `NOTICE`文件中的年份正确
- [ ] 所有文本文件开头都有ASF许可证
- [ ] 检查第三方依赖许可证:
- [ ] 第三方依赖的许可证兼容
- [ ] 所有第三方依赖的许可证都在`LICENSE`文件中声名
- [ ] 如果依赖的是Apache许可证并且存在`NOTICE`文件,那么这些`NOTICE`文件也需要加入到版本的`NOTICE`文件中
- [ ] .....
参考: [https://apache.org/legal/resolved.html](https://apache.org/legal/resolved.html)
#### 2.5 检查 Native 采集器包
Native 采集器包(`apache-hertzbeat-collector-native-{version}-*`)是**预编译的原生可执行文件**
不适用下面的“源码编译验证”,需要单独检查。
```shell
tar -xzf apache-hertzbeat-collector-native-{version}-linux-amd64-bin.tar.gz
cd apache-hertzbeat-collector-native-{version}-linux-amd64-bin
MANAGER_HOST=127.0.0.1 ./bin/startup.sh
tail -f logs/startup.log
```
进行如下检查:
- [ ] 存在 `LICENSE``NOTICE``licenses/` 目录
- [ ] 能够正常启动:日志出现 `Started Collector``Registered N collect strategies`
- [ ] 启动十几秒后进程仍然存活(**崩溃可能发生在 `Started Collector` 之后**,只看这一行不够)
:::caution Native 包有硬性运行环境要求
不满足时的表现是**进程瞬间退出、没有任何日志输出**,很容易被误判为物料损坏。遇到这种情况请先确认环境:
- **x86 包需要 CPU 支持 AVX2**Intel Haswell2013)及以后、AMD Zen2017)及以后。部分 Atom 血统的低端芯片、
Apple Silicon 上的 Rosetta 2、旧版 Windows on ARM 模拟均不支持
- **Linux 包需要 glibc ≥ 2.34**Ubuntu 22.04+、Debian 12+、RHEL/Rocky 9+ 可用;
Ubuntu 20.04、Debian 11、RHEL 8、CentOS 7 不可用
- **Windows 包需要** Windows 10 / Server 2016 及以上,并安装 Microsoft Visual C++ 2015-2022 可再发行组件包
环境不满足属于已知限制,不应据此投 -1;请在回复中说明你的验证环境。
:::
#### 2.6 源码编译验证
解压缩 `apache-hertzbeat-${release_version}-src.tar.gz`
```shell
cd apache-hertzbeat-${release_version}-src
```
编译源码: [https://hertzbeat.apache.org/docs/community/development/#build-hertzbeat-binary-package](https://hertzbeat.apache.org/docs/community/development/#build-hertzbeat-binary-package)
进行如下检查:
- [ ] 检查源码包是否包含由于包含不必要文件,致使tar包过于庞大
- [ ] 存在`LICENSE``NOTICE`文件
- [ ] `NOTICE`文件中的年份正确
- [ ] 只存在文本文件,不存在二进制文件
- [ ] 所有文件的开头都有ASF许可证
- [ ] 能够正确编译
- [ ] .....
参考: [https://apache.org/legal/resolved.html](https://apache.org/legal/resolved.html)
### 3. 邮件回复
如果发起了发布投票,验证后,可以参照此回复示例进行邮件回复
:::caution 注意
回复的邮件一定要带上自己检查了那些项信息,仅仅回复`+1 approve`,是无效的。
PMC 在 [dev@hertzbeat.apache.org](mailto:dev@hertzbeat.apache.org) HertzBeat 的社区投票时,请带上 binding 后缀,表示对 HertzBeat 社区中的投票具有约束性投票,方便统计投票结果。
:::
非PMC成员
```text
+1 (non-binding)
I checked:
1. All download links are valid
2. Checksums and signatures are OK for all artifacts, including the .zip
3. LICENSE and NOTICE exist and are correct
4. Built successfully from source on <你的操作系统和版本>
5. Native collector package starts and registers its collect strategies
6. ....
```
PMC成员
```text
+1 (binding)
I checked:
1. All download links are valid
2. Checksums and signatures are OK for all artifacts, including the .zip
3. LICENSE and NOTICE exist and are correct
4. Built successfully from source on <你的操作系统和版本>
5. Native collector package starts and registers its collect strategies
6. ....
```
发现问题时,请给出具体的复现信息,便于发布者定位:
```text
-1 (binding)
The <物料名> is missing its .sha512 checksum.
Checked on: macOS 26 / arm64
Steps:
1. svn co https://dist.apache.org/repos/dist/dev/hertzbeat/1.9.0-RC2/
2. for i in *.tar.gz *.zip; do [ -e "$i.sha512" ] || echo "missing: $i"; done
Output:
missing: apache-hertzbeat-collector-native-1.9.0-windows-amd64-bin.zip
```
---
@@ -0,0 +1,61 @@
---
id: 'mailing_lists'
title: '邮件列表'
sidebar_position: 1
---
<!--
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
https://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.
-->
[开发者邮件列表](https://lists.apache.org/list.html?dev@hertzbeat.apache.org) 是社区推荐的沟通和获取最新信息的方式。
在您向邮件列表发送任何内容之前,请确保您已经**订阅**了它们。
## 用途
### 开发者列表
- 使用此列表提出您对 HertzBeat 的问题
- 由 HertzBeat 贡献者用来讨论 HertzBeat 的开发
| 列表名称 | 地址 | 订阅 | 退订 | 归档 |
|-----------|--------------------------|-------------------------------------------------|---------------------------------------------------|-------------------------------------------------------------------|
| **开发者列表** | [dev@hertzbeat.apache.org](mailto:dev@hertzbeat.apache.org) | [订阅](mailto:dev-subscribe@hertzbeat.apache.org) | [退订](mailto:dev-unsubscribe@hertzbeat.apache.org) | [归档](https://lists.apache.org/list.html?dev@hertzbeat.apache.org) |
### 通知列表
- 关于 HertzBeat 代码库的更改的通知,频繁通知
| 列表名称 | 地址 | 订阅 | 退订 | 归档 |
|----------|------------------------------------|-----------------------------------------------------------|-------------------------------------------------------------|-----------------------------------------------------------------------------|
| **通知列表** | [notifications@hertzbeat.apache.org](mailto:notifications@hertzbeat.apache.org) | [订阅](mailto:notifications-subscribe@hertzbeat.apache.org) | [退订](mailto:notifications-unsubscribe@hertzbeat.apache.org) | [归档](https://lists.apache.org/list.html?notifications@hertzbeat.apache.org) |
## 订阅步骤
发送订阅邮件即可订阅。步骤如下:
- 1、**订阅**:点击上表中的 **订阅** 按钮,它将重定向到您的邮件客户端。主题和内容是任意的。
之后,您会从 [dev-help@hertzbeat.apache.org](mailto:dev-help@hertzbeat.apache.org) 收到确认邮件(如果没有收到,请确认电子邮件是否被自动分类为垃圾邮件、推广邮件、订阅邮件等)。
- 2、**确认**:直接回复确认邮件,或点击邮件中的链接快速回复。主题和内容是任意的。
- 3、**欢迎**:在完成上述步骤后,您会收到一个主题为 WELCOME to [dev@hertzbeat.apache.org](mailto:dev@hertzbeat.apache.org) 的欢迎邮件,您已成功订阅 Apache HertzBeat 邮件列表。
## 发送纯文本邮件
在发送邮件列表时,请使用纯文本邮件。
**不要使用 HTML 邮件**
HTML 邮件更有可能被视为垃圾邮件并被拒绝。
通过不同的邮件客户端,它可能会出现格式错误,并且其他人不容易阅读。
@@ -0,0 +1,88 @@
---
id: maturity
title: Maturity
sidebar_position: 0
---
## Maturity Assessment for Apache HertzBeat™
The goals of this maturity model are to describe how Apache projects operate in a concise and high-level way, and to provide a basic framework that projects may choose to use to evaluate themselves.
More details can be found in the [Apache Project Maturity Model](https://community.apache.org/apache-way/apache-project-maturity-model.html).
## Status of this assessment
This assessment is evaluated during HertzBeat's Incubating.
## Maturity model assessment
The following table is filled according to the [Apache Maturity Model](https://community.apache.org/apache-way/apache-project-maturity-model.html). Mentors and community members are welcome to comment and modify it.
### CODE
| **ID** | **Description** | **Status** |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **CD10** | The project produces Open Source software for distribution to the public, at no charge. | **YES** The project source code is licensed under the `Apache License 2.0`. |
| **CD20** | Anyone can easily discover and access the project's code.. | **YES** The [official website](https://hertzbeat.apache.org/) includes `GitHub` link which can access the project's repository on GitHub directly. |
| **CD30** | Anyone using standard, widely-available tools, can build the code in a reproducible way. | **YES** Apache HertzBeat provide `how-to-build` document for every component to tell user how to compile on bare metal, such as the [core's](https://hertzbeat.apache.org/docs/community/development). |
| **CD40** | The full history of the project's code is available via a source code control system, in a way that allows anyone to recreate any released version. | **YES** It depends on git, and anyone can view the full history of the project via commit logs. |
| **CD50** | The source code control system establishes the provenance of each line of code in a reliable way, based on strong authentication of the committer. When third parties contribute code, commit messages provide reliable information about the code provenance. | **YES** The project uses GitHub and managed by Apache Infra, it ensuring provenance of each line of code to a committer. And the third-party contributions are accepted in accordance with the contributing guides. |
### LICENSE
| **ID** | **Description** | **Status** |
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **LC10** | The Apache License, version 2.0, covers the released code. | **YES** The [LICENSE](https://github.com/apache/hertzbeat/blob/master/LICENSE) is in GitHub repository. And all source files are with APLv2 header, checked by Github Action. |
| **LC20** | Libraries that are mandatory dependencies of the project's code do not create more restrictions than the Apache License does. | **YES** All dependencies are listed. |
| **LC30** | The libraries mentioned in LC20 are available as Open Source software. | **YES** All dependencies are listed are available as Open Source software |
| **LC40** | Committers are bound by an Individual Contributor Agreement (the "Apache iCLA") that defines which code they may commit and how they need to identify code that is not their own. | **YES** All committers have iCLAs. |
| **LC50** | The project clearly defines and documents the copyright ownership of everything that the project produces. | **YES** And all source files are with APLv2 header, checked by GitHub Action. |
### Releases
| **ID** | **Description** | **Status** |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **RE10** | Releases consist of source code, distributed using standard and open archive formats that are expected to stay readable in the long term. | **YES** Source release is distributed via [dist.apache.org](https://dist.apache.org/repos/dist/release/incubator/hertzbeat/) and linked from [download page](https://hertzbeat.apache.org/docs/download). |
| **RE20** | The project's PPMC (Project Management Committee, see CS10) approves each software release in order to make the release an act of the Foundation. | **YES** All releases have been voted at [dev@hertzbeat.apache.org](mailto:dev@hertzbeat.apache.org) and [general@incubator.apache.org](mailto:general@incubator.apache.org), and have at least 3 PPMC member's votes. |
| **RE30** | Releases are signed and/or distributed along with digests that anyone can reliably use to validate the downloaded archives. | **YES** All releases are signed, and the [KEYS](https://dist.apache.org/repos/dist/release/hertzbeat/KEYS) are available. |
| **RE40** | The project can distribute convenience binaries alongside source code, but they are not Apache Releases, they are provided with no guarantee. | **YES** User can easily build binaries from source code, and we do not provide binaries as Apache Releases. |
| **RE50** | The project documents a repeatable release process so that someone new to the project can independently generate the complete set of artifacts required for a release. | **YES** We can follow the [Release guide](https://hertzbeat.apache.org/docs/community/how_to_release) to make a new Apache HertzBeat release, and so far we had 4 different release managers. |
### Quality
| **ID** | **Description** | **Status** |
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **QU10** | The project is open and honest about the quality of its code. Various levels of quality and maturity for various modules are natural and acceptable as long as they are clearly communicated. | **YES** We encourage user to [report issues](https://github.com/apache/hertzbeat/issues). |
| **QU20** | The project puts a very high priority on producing secure software. | **YES** All security reports are actively handled. |
| **QU30** | The project provides a well-documented, secure and private channel to report security issues, along with a documented way of responding to them. | **Yes** The official Github Repo provides a [security doc](https://github.com/apache/hertzbeat/blob/master/SECURITY.md) |
| **QU40** | The project puts a high priority on backwards compatibility and aims to document any incompatible changes and provide tools and documentation to help users transition to new features. | **Yes** We follow semantic versions. As long as it's within one major version, it's backward compatible. And when any breaking changes added, we provide corresponding upgrade guides. |
| **QU50** | The project strives to respond to documented bug reports in a timely manner. | **YES** The project has resolved 743+ issues and 2348+ pull requests so far, with very prompt response. |
### Community
| **ID** | **Description** | **Status** |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **CO10** | The project has a well-known homepage that points to all the information required to operate according to this maturity model. | **YES** The [official website](https://hertzbeat.apache.org/) includes all information user need to run Apache HertzBeat. |
| **CO20** | The community welcomes contributions from anyone who acts in good faith and in a respectful manner, and who adds value to the project. | **Yes** We provide contributing guides for every component. And we also have a [general contributing guide](https://hertzbeat.apache.org/docs/community/contribution) |
| **CO30** | Contributions include source code, documentation, constructive bug reports, constructive discussions, marketing and generally anything that adds value to the project. | **YES** All good contributions including code and non-code are welcomed. |
| **CO40** | The community strives to be meritocratic and gives more rights and responsibilities to contributors who, over time, add value to the project. | **YES** The community has elected 3 new PPMC members and 13 new committers so far. |
| **CO50** | The project documents how contributors can earn more rights such as commit access or decision power, and applies these principles consistently. | **YES** The community has clear docs on nominating committers and PPMC members |
| **CO60** | The community operates based on consensus of its members (see CS10) who have decision power. Dictators, benevolent or not, are not welcome in Apache projects. | **YES** All decisions are made after vote by community members. |
| **CO70** | The project strives to answer user questions in a timely manner. | **YES** We use [dev@hertzbeat.apache.org](mailto:dev@hertzbeat.apache.org), [GitHub issue](https://github.com/apache/hertzbeat/issues) and [GitHub discussion](https://github.com/apache/hertzbeat/discussions) to do this in a timely manner. |
### Consensus
| **ID** | **Description** | **Status** |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |--------------------------------------------------------------------------------------------------------------|
| **CS10** | The project maintains a public list of its contributors who have decision power. The project's PPMC (Project Management Committee) consists of those contributors. | **Yes** See [members](https://hertzbeat.apache.org/team/) with all PPMC members and committers. |
| **CS20** | Decisions require a consensus among PPMC members and are documented on the project's main communications channel. The PPMC takes community opinions into account, but the PPMC has the final word. | **YES** All decisions are made by votes on [dev@hertzbeat.apache.org](mailto:dev@hertzbeat.apache.org), and with at least 3 +1 votes from PPMC. |
| **CS30** | The project uses documented voting rules to build consensus when discussion is not sufficient. | **YES** The project uses the standard ASF voting rules. |
| **CS40** | In Apache projects, vetoes are only valid for code commits. The person exercising the veto must justify it with a technical explanation, as per the Apache voting rules defined in CS30. | **YES** Apache HertzBeat community has not used the veto power yet except for code commits. |
| **CS50** | All "important" discussions happen asynchronously in written form on the project's main communications channel. Offline, face-to-face or private discussions that affect the project are also documented on that channel. | **YES** All important discussions and conclusions are recorded in written form. |
### Independence
| **ID** | **Description** | **Status** |
| -------- | ---------------------------------------------------------------------------------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **IN10** | The project is independent from any corporate or organizational influence. | **YES** The PPMC members and committer of Apache HertzBeat are from several different companies, and majority of them are NOT From the company that donated this project. |
| **IN20** | Contributors act as themselves, not as representatives of a corporation or organization. | **YES** The contributors act on their own initiative without representing a corporation or organization. |
@@ -0,0 +1,505 @@
---
id: 'new_committer_process'
title: '提名新Committer流程'
sidebar_position: 4
---
<!--
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
https://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.
-->
[官方指南](https://community.apache.org/newcommitter.html#new-committer-process)
## 提名新Committer的流程
- 在邮件`private@hertzbeat.apache.org`中发起投票
参见 **Committer投票模板**
- 关闭投票
参见 **关闭投票模板**
- 如果结果是赞成,邀请新的Committer
参见 **Committer邀请模板**
- 如果同意,那么:接受Committer
参见 **Committer接受模板**
- 新Committer签署CLA,等待CLA的接收记录
- 请求创建Committer账户
参见 **Committer账户创建模板**
- 等待root告诉我们已经完成
- [Roster](https://whimsy.apache.org/roster/ppmc/hertzbeat) 添加新的 committer
- Announce New Committer
参见 **Announce New Committer Template**
## 模板
请注意,模板中有三个占位符在使用之前应该替换:
- NEW_COMMITTER_NAME 这须是真实名字,而非 Github 名称或 Id
- NEW_COMMITTER_EMAIL
- NEW_COMMITTER_APACHE_NAME
### Committer投票模板
:::note
NEW_COMMITTER_NAME 这须是真实名字,而非 Github 名称或 Id
:::
```text
To: private@hertzbeat.apache.org
Subject: [VOTE] New committer: `NEW_COMMITTER_NAME`
```
```text
Hi HertzBeat PMC,
This is a formal vote about inviting `NEW_COMMITTER_NAME` as our community new committer.
Work list: https://github.com/apache/hertzbeat/commits?author=xxx
Here is the list of `NEW_COMMITTER_NAME`'s contributions in HertzBeat Community:
> [27 commits](https://github.com/apache/hertzbeat/commits?author=xxx)
>
> 7,495 ++ 627 --
Submitted PR (27 commits)
- [ISSUE #4534] [feature] add new feature in hertzbeat #3445
- xxx
Submitted Issues (18 commits)
- [bug] find some bugs in hertzbeat nodes #6565
- xxx
Please vote:
+1: I support this proposal and will welcome `NEW_COMMITTER_NAME` as a committer.
+0: I don't care.
-1: I object to this proposal and here are my reasons.
This vote will be open for at least 7 days.
Best Wishes,
ttt
```
注意,投票将在今天一周后结束,即
[midnight UTC on YYYY-MM-DD](https://www.timeanddate.com/counters/customcounter.html?year=YYYY&month=MM&day=DD)
[Apache投票指南](https://community.apache.org/newcommitter.html)
### 关闭投票模板
```text
To: private@hertzbeat.apache.org
Subject: [RESULT] [VOTE] New committer: `NEW_COMMITTER_NAME`
```
```text
Hi HertzBeat PMC,
The vote has now closed. The results are:
Binding Votes:
+1 [TOTAL BINDING +1 VOTES]
0 [TOTAL BINDING +0/-0 VOTES]
-1 [TOTAL BINDING -1 VOTES]
The vote is ***successful/not successful***
```
### Committer邀请模板
```text
To: NewCommiter@domain.com
Cc: private@hertzbeat.apache.org
Subject: Invitation to become HertzBeat committer: [Candidate Name]
```
```text
Hello [Candidate Name],
The HertzBeat Project Management Committee (PMC)
hereby offers you committer privileges to the project
These privileges are offered on the understanding that you'll use them
reasonably and with common sense. We like to work on trust
rather than unnecessary constraints.
Being a committer enables you to more easily make
changes without needing to go through the patch
submission process.
Being a committer does not require you to
participate any more than you already do. It does
tend to make one even more committed. You will
probably find that you spend more time here.
Of course, you can decline and instead remain as a
contributor, participating as you do now.
This personal invitation is a chance for you to accept or decline in private.
Please let us know in reply to this message whether you accept or decline.
Also, please refrain from sharing that you were invited before the official
announcement by the PMC.
If you accept, you will need an Apache account (id) with privileges.
Please follow these instructions.
A. If you already have an ICLA on file:
1. If you already have an Apache account, let us know your id and we
will grant you privileges on the project repositories.
2. If you have previously sent an ICLA, let us know the email address
and public name used on the ICLA and your preferred Apache id, and
we will request your account.
3. If the email address on the previously submitted ICLA is no longer
valid, let us know the email address and public name used on the new ICLA,
and your preferred Apache id. Continue to step B below and file your new ICLA.
Look to see if your preferred ID is already taken at
https://people.apache.org/committer-index.html
B. If there is not already an ICLA on file, you need to submit an ICLA:
1. Details of the ICLA and the forms are found
through this link: https://www.apache.org/licenses/#clas
2. Instructions for its completion and return to
the Secretary of the ASF are found at
https://www.apache.org/licenses/contributor-agreements.html#submitting
Do not copy the project or any other individual on your message
to Secretary, as the form contains Personally Identifiable Information
that should be kept private.
3. When you complete the ICLA form, be sure to include in the form
the Apache HertzBeat project and choose a
unique Apache ID. Look to see if your preferred
ID is already taken at
https://people.apache.org/committer-index.html
This will allow the Secretary to notify the PMC
when your ICLA has been recorded.
When recording of your ICLA is noted, you will
receive a follow-up message with the next steps for
establishing you as a committer.
```
### Committer接受模板
```text
To: `NEW_COMMITTER_EMAIL`
Cc: private@hertzbeat.apache.org
Subject: Re: invitation to become HertzBeat committer
```
```text
Welcome. Here are the next steps in becoming a project committer. After that
we will make an announcement to the dev@hertzbeat.apache.org list.
You need to send a Contributor License Agreement to the ASF.
Normally you would send an Individual CLA. If you also make
contributions done in work time or using work resources,
see the Corporate CLA. Ask us if you have any issues.
https://www.apache.org/licenses/#clas.
You need to choose a preferred ASF user name and alternatives.
In order to ensure it is available you can view a list of taken IDs at
https://people.apache.org/committer-index.html
Please notify us when you have submitted the CLA and by what means
you did so. This will enable us to monitor its progress.
We will arrange for your Apache user account when the CLA has
been recorded.
After that is done, please make followup replies to the dev@hertzbeat.apache.org list.
We generally discuss everything there and keep the
private@hertzbeat.apache.org list for occasional matters which must be private.
The developer section of the website describes roles within the ASF and provides other
resources:
https://www.apache.org/foundation/how-it-works.html
https://www.apache.org/dev/
The incubator also has some useful information for new committers
in incubating projects:
https://incubator.apache.org/guides/committer.html
https://incubator.apache.org/guides/ppmc.html
Just as before you became a committer, participation in any ASF community
requires adherence to the ASF Code of Conduct:
https://www.apache.org/foundation/policies/conduct.html
Yours,
The Apache HertzBeat PMC
```
### Announce New Committer Template
```text
To: dev@hertzbeat.apache.org, `NEW_COMMITTER_EMAIL`
Subject: [ANNOUNCE] New committer: `NEW_COMMITTER_NAME`
```
```text
Hello Community,
The Podling Project Management Committee (PMC) for Apache HertzBeat
has invited `NEW_COMMITTER_NAME` to become a committer and we are pleased to
announce that he has accepted.
`NEW_COMMITTER_NAME` is active in the Apache HertzBeat community, hope to see your
further interactions with the community!
Thanks for your contributions.
Best Wishes!
```
## 详细步骤
### 接受邀请
当通过PMC内部投票后,PMC会向您索要个人邮箱,之后您会收到一封邮件,邮件会指引您进行下一步操作,内容为:
```text
Hello xxxx,
The HertzBeat Project Management Committee (PMC)
hereby offers you committer privileges to the project.
These privileges are offered on the understanding that
you'll use them reasonably and with common sense.
We like to work on trust rather than unnecessary constraints.
Being a committer enables you to more easily make
changes without needing to go through the patch
submission process.
Being a committer does not require you to
participate any more than you already do. It does
tend to make one even more committed. You will
probably find that you spend more time here.
Of course, you can decline and instead remain as a
contributor, participating as you do now.
A. This personal invitation is a chance for you to
accept or decline in private. Either way, please
let us know in reply to the private@hertzbeat.apache.org
address only.
B. If you accept, the next step is to register an iCLA:
1. Details of the iCLA and the forms are found
through this link: https://www.apache.org/licenses/#clas
2. Instructions for its completion and return to
the Secretary of the ASF are found at
https://www.apache.org/licenses/#submitting
3. When you transmit the completed iCLA, request
to notify the Apache HertzBeat and choose a
unique Apache ID. Look to see if your preferred
ID is already taken at
https://people.apache.org/committer-index.html
This will allow the Secretary to notify the PMC
when your iCLA has been recorded.
When recording of your iCLA is noted, you will
receive a follow-up message with the next steps for
establishing you as a committer.
```
如果您接受邀请,请回复该邮件,记住要**回复全部**,回复内容为:
```text
hi, i accept. Thanks for invitaion.
```
随后您会收到一封邮件,里面描述这如何具体步骤,也可以根据我们的文档继续进行操作。
### ICLA签署流程
接受邀请后,会收到邮件,邮件会指引签署iCLA。
1. 下载iCLA申请表
打开访问:[https://www.apache.org/licenses/#clas](https://www.apache.org/licenses/#clas)
找到`CLAs`点击进入页面
![HertzBeat](/img/docs/community/clas-web.png)
找到`ICLA(个人贡献者许可协议)`,点击[Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf)
![HertzBeat](/img/docs/community/icla-web.png)
跳转后,会显示需要签署的协议,这里可以在网页上直接填写,也可以下载后填写。
![HertzBeat](/img/docs/community/icla-pdf.png)
2. 填写iCLA
> tips: 签名时需要手写签名,其他的可以直接填写后打印。
需要填写的内容:
![HertzBeat](/img/docs/community/icla-content-1.png)
![HertzBeat](/img/docs/community/icla-content-2.png)
在PDF中需要填写的字段:
- `Full name`
- `Public name`
- `Postal Address`
- `Country`
- `E-Mail`
- `(optional) preferred Apache id(s)`
- `(optional) notify project`
- `Date`
> 填写样例
> ![HertzBeat](/img/docs/community/icla-content-3.png)
> ![HertzBeat](/img/docs/community/icla-content-4.png)
3. 打印并签署
![HertzBeat](/img/docs/community/icla-content-5.png)
`Please sign`字段需要将文件打印出来然后手写签名,内容为自己姓名的全拼。
4. 将签名后的文件拍照或扫描转为PDF,并重命名为`姓名拼音-icla.pdf`
5. 发送邮件到指定邮箱
邮件发送到`secretary@apache.org`,抄送到`private@hertzbeat.apache.org`
注意⚠️此邮件内容需要附加上之前的 committer 邀请邮件信息, 建议在之前的往来邮件点击回复然后修改标题和收件人等。
**发送模板**
主题:`Accept to become a HertzBeat committer`
正文:
```text
Hello Apache,
I am willing contribute to the ASF. The attachment is my ICLA information. My Github account is : https://github.com/xxxx.
Thanks !
```
大概1-5个工作日你就会收到一封来自`root@apache.org`的邮件。
当您收到邮件标题为:`Welcome to the Apache Software Foundation`的邮件,恭喜你,你已经获取到Apache ID了!
### 设置Apache密码
在网站 [https://id.apache.org/reset/enter](https://id.apache.org/reset/enter) 输入您的Apache ID
![HertzBeat](/img/docs/community/account-1.png)
点击`Send Email`后会提示发送成功。
在您提供给PMC的邮箱中会收到一封来自`root@apache.org`重置密码的邮件,标题为`Password reset request for xxx from Apache ID`,在邮件正文中会有重置密码的链接,我们点击链接设置密码。
### 将Apache账号和GitHub账号关联
访问: [https://whimsy.apache.org/roster/committer/`APACHE_ID`](https://whimsy.apache.org/roster/committer/`APACHE_ID`)
- ``APACHE_ID``替换成你的Apache ID
登录后可以看到这个内容`Link GitHub username to ASF id`,点击跳转
![HertzBeat](/img/docs/community/account-2.png)
输入您的Apache的账号和密码并登录
![HertzBeat](/img/docs/community/account-3.png)
点击 `Authenticate with GitHub`
![HertzBeat](/img/docs/community/account-4.png)
点击`Authorize apache`授权给Apache
![HertzBeat](/img/docs/community/account-5.png)
点击`Send GitHub Invitation!` 发送GitHub邀请邮件
![HertzBeat](/img/docs/community/account-6.png)
邮箱中会收到一封邮件,点击`Join @apache`
> 这里邮箱指的是您提供给PMC的那个邮箱地址
![HertzBeat](/img/docs/community/account-7.png)
点击`Join The Apache Software Foundation`,加入GitHub加入Apache组织,会自动跳转到GitHub页面
![HertzBeat](/img/docs/community/account-8.png)
![HertzBeat](/img/docs/community/account-9.png)
回到Apache页面,提示GitHub启用多重身份认证,在GitHub页面启用双重身份认证
> GitHub双重身份认证介绍,[点击跳转官方文档](https://docs.github.com/zh/authentication/securing-your-account-with-two-factor-authentication-2fa/about-two-factor-authentication)
![HertzBeat](/img/docs/community/account-10.png)
启动完成之后等几分钟,提示已经绑定完成
![HertzBeat](/img/docs/community/account-11.png)
至此您的GitHub账号与Apache账号就绑定完成了。
最后一步,联系PMC主席开启svn和其他访问权限。
## 邮箱绑定
### GMail邮箱绑定
邮箱地址:[https://mail.google.com/](https://mail.google.com/)
进入设置页面,并点击`添加其他电子邮件地址``
![HertzBeat](/img/docs/community/email-1.png)
填写您的apache邮箱,按照指引点击下一步
![HertzBeat](/img/docs/community/email-2.png)
![HertzBeat](/img/docs/community/email-3.png)
![HertzBeat](/img/docs/community/email-4.png)
设置为默认发送邮箱(可选)
![HertzBeat](/img/docs/community/email-5.png)
配置完成。
最后一步,别忘了订阅[开发者邮箱列表](./mailing_lists.md)。
@@ -0,0 +1,309 @@
---
id: 'new_pmc_ember_process'
title: '提名新PMC成员流程'
sidebar_position: 5
---
<!--
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
https://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.
-->
这个指南是基于 [apache newcommitter](https://community.apache.org/newcommitter.html#new-committer-process) 的。
## 新PMC成员的流程
- 在邮件`private@hertzbeat.apache.org`中进行投票
参见 **PMC成员投票模板**
- 关闭投票
参见 **关闭投票模板**
- 董事会批准新的PMC成员
参见 **董事会批准新PMC成员**
- 如果结果是赞成,邀请新的PMC成员
参见 **PMC成员邀请模板**
- 如果同意,那么:接受PMC成员
参见 **PMC成员接受模板**
- 通知PMC成员完成
参见 **PMC成员完成模板**
- 宣布新的PMC成员
参见 **PMC成员公告模板**
## 模板
注意,在使用模板之前,有三个占位符需要被替换
- NEW_PMC_NAME
- NEW_PMC_EMAIL
- NEW_PMC_APACHE_NAME
### PMC成员投票模板
```text
To: private@hertzbeat.apache.org
Subject: [VOTE] New PMC member candidate: `NEW_PMC_NAME`
```
```text
Hi HertzBeat PMC,
This is a formal vote about inviting `NEW_PMC_NAME` as our new PMC member.
${Work list}[1]
[1] https://github.com/apache/hertzbeat/commits?author=`NEW_PMC_NAME`
```
注意,投票将在今天一周后结束,即
[midnight UTC on YYYY-MM-DD](https://www.timeanddate.com/counters/customcounter.html?year=YYYY&month=MM&day=DD)
[Apache 参考投票指南](https://community.apache.org/newcommitter.html)
### Close Vote Template
```text
To: private@hertzbeat.apache.org
Subject: [RESULT] [VOTE] New PMC member: `NEW_PMC_NAME`
```
```text
Hi HertzBeat PMC,
The vote has now closed. The results are:
Binding Votes:
+1 [TOTAL BINDING +1 VOTES]
0 [TOTAL BINDING +0/-0 VOTES]
-1 [TOTAL BINDING -1 VOTES]
The vote is ***successful/not successful***
```
### Board Approval of new PMC member Template
```text
To: board@apache.org
Cc: private@`<project>`.apache.org
Subject: [NOTICE] `NEW_PMC_NAME` for HertzBeat PMC member
```
```text
HertzBeat proposes to invite `NEW_PMC_NAME` to join the PMC.
The vote result is available here: https://lists.apache.org/...
```
[Apache New Pmc Guide](https://www.apache.org/dev/pmc.html#newpmc)
### PMC成员邀请模板
```text
To: `NEW_PMC_EMAIL`
Cc: private@hertzbeat.apache.org
Subject: Invitation to become HertzBeat PMC member: `NEW_PMC_NAME`
```
```text
Hello [Candidate Name],
The HertzBeat Project Management Committee (PMC)
hereby offers you PMC members privileges to the project
These privileges are offered on the understanding that you'll use them
reasonably and with common sense. We like to work on trust
rather than unnecessary constraints.
Being a PMC member enables you
to guide the direction of the project.
Being a committer does not require you to
participate any more than you already do. It does
tend to make one even more committed. You will
probably find that you spend more time here.
Of course, you can decline and instead remain as a
contributor, participating as you do now.
This personal invitation is a chance for you to accept or decline in private.
Please let us know in reply to this message whether you accept or decline.
Also, please refrain from sharing that you were invited before the official
announcement by the PMC.
If you accept, you will need an Apache account (id) with privileges.
Please follow these instructions.
A. If you already have an ICLA on file:
1. If you already have an Apache account, let us know your id and we
will grant you privileges on the project repositories.
2. If you have previously sent an ICLA, let us know the email address
and public name used on the ICLA and your preferred Apache id, and
we will request your account.
3. If the email address on the previously submitted ICLA is no longer
valid, let us know the email address and public name used on the new ICLA,
and your preferred Apache id. Continue to step B below and file your new ICLA.
Look to see if your preferred ID is already taken at
https://people.apache.org/committer-index.html
B. If there is not already an ICLA on file, you need to submit an ICLA:
1. Details of the ICLA and the forms are found
through this link: https://www.apache.org/licenses/#clas
2. Instructions for its completion and return to
the Secretary of the ASF are found at
https://www.apache.org/licenses/contributor-agreements.html#submitting
Do not copy the project or any other individual on your message
to Secretary, as the form contains Personally Identifiable Information
that should be kept private.
3. When you complete the ICLA form, be sure to include in the form
the Apache HertzBeat project and choose a
unique Apache ID. Look to see if your preferred
ID is already taken at
https://people.apache.org/committer-index.html
This will allow the Secretary to notify the PMC
when your ICLA has been recorded.
When recording of your ICLA is noted, you will
receive a follow-up message with the next steps for
establishing you as a PMC.
```
### PMC成员接受模板
```text
To: `NEW_PMC_EMAIL`
Cc: private@hertzbeatv.apache.org
Subject: Re: invitation to become HertzBeat PMC member
```
```text
Welcome. Here are the next steps in becoming a project PMC. After that
we will make an announcement to the dev@hertzbeat.apache.org list.
You need to send a Contributor License Agreement to the ASF.
Normally you would send an Individual CLA. If you also make
contributions done in work time or using work resources,
see the Corporate CLA. Ask us if you have any issues.
https://www.apache.org/licenses/#clas.
You need to choose a preferred ASF user name and alternatives.
In order to ensure it is available you can view a list of taken IDs at
https://people.apache.org/committer-index.html
Please notify us when you have submitted the CLA and by what means
you did so. This will enable us to monitor its progress.
We will arrange for your Apache user account when the CLA has
been recorded.
After that is done, please make followup replies to the dev@hertzbeat.apache.org list.
We generally discuss everything there and keep the
private@hertzbeat.apache.org list for occasional matters which must be private.
The developer section of the website describes roles within the ASF and provides other
resources:
https://www.apache.org/foundation/how-it-works.html
https://www.apache.org/dev/
The incubator also has some useful information for new PMC
in incubating projects:
https://incubator.apache.org/guides/committer.html
https://incubator.apache.org/guides/ppmc.html
Just as before you became a PMC member, participation in any ASF community
requires adherence to the ASF Code of Conduct:
https://www.apache.org/foundation/policies/conduct.html
Yours,
The Apache HertzBeat PMC
```
### PMC成员完成模板
```text
To: private@hertzbeat.apache.org, `NEW_PMC_EMAIL`
Subject: account request: `NEW_PMC_NAME`
```
```text
`NEW_PMC_EMAIL`, as you know, the ASF Infrastructure has set up your
committer account with the username '`NEW_PMC_APACHE_NAME`'.
Please follow the instructions to set up your SSH,
svn password, svn configuration, email forwarding, etc.
https://www.apache.org/dev/#committers
You have commit access to specific sections of the
ASF repository, as follows:
The general "committers" at:
https://svn.apache.org/repos/private/committers
If you have any questions during this phase, then please
see the following resources:
Apache developer's pages: https://www.apache.org/dev/
Incubator committer guide: https://incubator.apache.org/guides/committer.html
Naturally, if you don't understand anything be sure to ask us on the dev@hertzbeat.apache.org mailing list.
Documentation is maintained by volunteers and hence can be out-of-date and incomplete - of course
you can now help fix that.
A PMC member will announce your election to the dev list soon.
```
### PMC成员通知模板
```text
To: dev@hertzbeat.apache.org
[ANNOUNCE] New PMC member: `NEW_PMC_NAME`
```
```text
Hi HertzBeat Community,
The Podling Project Management Committee (PMC) for Apache HertzBeat
has invited `NEW_PMC_NAME` to become our PMC member and
we are pleased to announce that he has accepted.
### add specific details here ###
Please join me in congratulating `NEW_PMC_NAME`!
Being a committer enables easier contribution to the
project since there is no need to go via the patch
submission process. This should enable better productivity.
A PMC member helps manage and guide the direction of the project.
Thanks,
On behalf of the Apache HertzBeat PMC
```
@@ -0,0 +1,72 @@
---
id: 'submit_code'
title: '提交代码'
sidebar_position: 2
---
<!--
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
https://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.
-->
* 首先从远程仓库 [https://github.com/apache/hertzbeat.git](https://github.com/apache/hertzbeat.git) 将代码的一份副本 fork 到您自己的仓库
* 远程仓库开发合并分支:`master`
* 将您fork仓库clone到您的本地设备
```shell
git clone git@github.com:<您的账户名>/hertzbeat.git
```
* 添加远程仓库地址,命名为 upstream
```shell
git remote add upstream git@github.com:apache/hertzbeat.git
```
* 查看仓库
```shell
git remote -v
```
> 此时会有两个仓库:origin(您自己的仓库)和 upstream(远程仓库)
* 获取/更新远程仓库代码
```shell
git fetch upstream
```
* 将远程仓库代码同步到本地仓库
```shell
git checkout origin/master
git merge --no-ff upstream/master
```
* **⚠️注意一定要新建分支开发特性 `git checkout -b feature-xxx`,不建议使用master分支直接开发**
* 在本地修改代码后,提交到自己的仓库:
**注意提交信息为英文,不包含特殊字符**
```shell
git commit -m '[docs]necessary instructions'
git push
```
* 将更改提交到远程仓库后,您可以在您的仓库页面上看到一个绿色的按钮“Compare & pull request”,点击它。
* 这会弹出新建 Pull Request 页面,您需要这里仔细填写信息(英文),描述和代码同样重要,然后点击“Create pull request”按钮。
* 然后社区的 Committers 将进行 CodeReview,并与您讨论一些细节(包括设计、实现、性能等),之后您可以根据建议直接在这个分支更新代码(无需新建PR)。当社区 Committer approve之后,提交将被合并到 master 分支。
* 最后,恭喜您,您已经成为 HertzBeat 的官方贡献者,您会被加在贡献者墙上,您可以联系社区获取贡献者证书!
@@ -0,0 +1,132 @@
---
id: download
title: 下载 Apache HertzBeat - 最新版本
sidebar_label: 下载
description: Apache HertzBeat 监控系统下载 - 服务器、采集器、源码和 Docker Compose 包,包含签名和校验和。
---
## 如何下载 HertzBeat
下载最新 Apache HertzBeat™ 发布版(v1.9.0)的服务器二进制、采集器二进制、源码或 Docker Compose 包。所有发布版都包含 GPG 签名和 SHA512 校验和用于验证。
**最新版本:** v1.9.0(发布日期:2026年9月17日)
**快速下载:**
- [服务器二进制](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-1.9.0-bin.tar.gz)
- [采集器二进制](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-collector-1.9.0-bin.tar.gz)
- [源码](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-1.9.0-src.tar.gz)
## 下载包类型
| 包类型 | 大小 | 用途 | 平台 |
|--------|------|------|------|
| **服务器二进制** | ~364MB | 主监控服务器 | Linux、macOS、Windows |
| **采集器二进制** | ~163MB | 分布式采集器 | Linux、macOS、Windows |
| **Native 采集器** | ~77MB | 分布式采集器,无需 JVM | linux-amd64、linux-arm64、windows-amd64 |
| **源码** | ~3MB | 从源码构建 | 任何支持 Java 25+ 的平台 |
| **Docker Compose** | ~45KB | 全栈部署 | Docker 环境 |
:::tip Native 采集器推荐
如果你不需要 `ext-lib` 外部 JDBC 驱动,可以优先选择 Native 采集器安装包,通常启动更快、内存更省。MySQL、MariaDB、OceanBase 在没有提供 `mysql-connector-j` 时也属于这条 Native 友好路径;TiDB 的 SQL 查询指标也遵循同样规则。
它的代价是安装包按平台区分,且不支持运行时 `ext-lib` JDBC 加载。详见 [Native 采集器指南](start/native-collector)。
:::
:::tip 安全验证
使用 GPG 签名和 SHA512 校验和验证下载。参见 [Apache 验证指南](https://www.apache.org/dyn/closer.cgi#verify) 和 [HertzBeat KEYS](https://downloads.apache.org/hertzbeat/KEYS)。
:::
## 最新版本(推荐)
:::tip 安全公告
以前版本可能包含安全漏洞。请始终使用最新版本。
:::
| 版本 | 日期 | 下载 | Release |
|--------|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|
| v1.9.0 | 2026.09.17 | [apache-hertzbeat-1.9.0-bin.tar.gz](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-1.9.0-bin.tar.gz) (Server) ( [signature](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-1.9.0-bin.tar.gz.asc) , [sha512](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-1.9.0-bin.tar.gz.sha512) ) <br/> [apache-hertzbeat-collector-1.9.0-bin.tar.gz](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-collector-1.9.0-bin.tar.gz) (Collector) ( [signature](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-collector-1.9.0-bin.tar.gz.asc) , [sha512](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-collector-1.9.0-bin.tar.gz.sha512) ) <br/> [apache-hertzbeat-collector-native-1.9.0-linux-amd64-bin.tar.gz](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-collector-native-1.9.0-linux-amd64-bin.tar.gz) (Native Collector linux-amd64) ( [signature](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-collector-native-1.9.0-linux-amd64-bin.tar.gz.asc) , [sha512](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-collector-native-1.9.0-linux-amd64-bin.tar.gz.sha512) ) <br/> [apache-hertzbeat-collector-native-1.9.0-linux-arm64-bin.tar.gz](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-collector-native-1.9.0-linux-arm64-bin.tar.gz) (Native Collector linux-arm64) ( [signature](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-collector-native-1.9.0-linux-arm64-bin.tar.gz.asc) , [sha512](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-collector-native-1.9.0-linux-arm64-bin.tar.gz.sha512) ) <br/> [apache-hertzbeat-collector-native-1.9.0-windows-amd64-bin.zip](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-collector-native-1.9.0-windows-amd64-bin.zip) (Native Collector windows-amd64) ( [signature](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-collector-native-1.9.0-windows-amd64-bin.zip.asc) , [sha512](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-collector-native-1.9.0-windows-amd64-bin.zip.sha512) ) <br/> [apache-hertzbeat-1.9.0-src.tar.gz](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-1.9.0-src.tar.gz) (Source Code) ( [signature](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-1.9.0-src.tar.gz.asc) , [sha512](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-1.9.0-src.tar.gz.sha512) ) <br/> [apache-hertzbeat-1.9.0-docker-compose.tar.gz](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-1.9.0-docker-compose.tar.gz) (Docker Compose) ( [signature](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-1.9.0-docker-compose.tar.gz.asc) , [sha512](https://dlcdn.apache.org/hertzbeat/1.9.0/apache-hertzbeat-1.9.0-docker-compose.tar.gz.sha512) ) | [note](https://github.com/apache/hertzbeat/releases/tag/v1.9.0) |
## Docker 镜像版本
> Apache HertzBeat™ 为每个版本制作了 Docker 镜像. 你可以从 [Docker Hub](https://hub.docker.com/r/apache/hertzbeat) 拉取使用.
- HertzBeat [https://hub.docker.com/r/apache/hertzbeat](https://hub.docker.com/r/apache/hertzbeat)
- HertzBeat Collector [https://hub.docker.com/r/apache/hertzbeat-collector](https://hub.docker.com/r/apache/hertzbeat-collector)
## 归档版本
在这里查看所有历史已归档版本:[archive](https://archive.apache.org/dist/incubator/hertzbeat/).
## 下载常见问题
### 应该下载哪个包?
**服务器二进制** - 大多数用户使用。包含主 HertzBeat 监控服务器和 Web UI。
**采集器二进制** - 分布式部署使用。在远程网络部署采集器向主服务器上报。
Native 采集器下载包按目标平台区分,例如 `apache-hertzbeat-collector-native-{version}-linux-amd64-bin.tar.gz``apache-hertzbeat-collector-native-{version}-windows-amd64-bin.zip`
如果你正在 JVM 采集器和 Native 采集器之间做选择,建议先阅读 [Native 采集器指南](start/native-collector)。
**源码** - 开发者想要构建、修改或贡献 HertzBeat 时使用。
**Docker Compose** - 快速全栈部署,包含数据库和时间序列存储。
### 如何验证下载?
1. 下载 GPG 签名(.asc)和校验和(.sha512)文件
2. 验证签名:`gpg --verify apache-hertzbeat-*.tar.gz.asc apache-hertzbeat-*.tar.gz`
3. 验证校验和:`sha512sum -c apache-hertzbeat-*.tar.gz.sha512`
首先导入 Apache HertzBeat KEYS`wget https://downloads.apache.org/hertzbeat/KEYS && gpg --import KEYS`
### 系统要求是什么?
**服务器二进制要求:**
- Java 25 或更高版本
- 4GB RAM 最低(推荐 8GB
- 2 CPU 核心 最低
- 20GB 磁盘空间
**采集器二进制要求:**
- Java 25 或更高版本
- 2GB RAM 最低
- 1 CPU 核心 最低
- 5GB 磁盘空间
Native 采集器安装包会按目标平台分别发布,JVM 采集器安装包仍然保持跨平台。
### 可以用 Docker 代替二进制包吗?
可以。Docker 是推荐的安装方法:
```bash
docker run -d -p 1157:1157 -p 1158:1158 --name hertzbeat apache/hertzbeat
```
### 如何解压和运行二进制?
```bash
tar -xzf apache-hertzbeat-1.9.0-bin.tar.gz
cd apache-hertzbeat-1.9.0
./bin/startup.sh
```
访问 Web UI`http://localhost:1157`, 凭据:admin/hertzbeat
### 版本之间有什么区别?
每个版本包含错误修复、安全补丁和新功能。下载表中的发布说明链接详细说明了具体变更。
**始终使用最新版本**以确保安全性和稳定性。
### 在哪里可以找到旧版本?
以前版本归档在 [https://archive.apache.org/dist/incubator/hertzbeat/](https://archive.apache.org/dist/incubator/hertzbeat/)
### 新版本多久发布一次?
HertzBeat 遵循定期发布计划,新版本大约每 2-3 个月发布一次。安全补丁可能更频繁发布。
@@ -0,0 +1,145 @@
---
id: activemq
title: 监控 Apache ActiveMQ 消息中间件
sidebar_label: ActiveMQ消息中间件
keywords: [开源监控系统, 开源中间件监控, ActiveMQ消息中间件监控]
---
> 对 Apache ActiveMQ 消息中间件的运行状态,节点,Topic等相关指标进行监测。
**使用协议:JMX**
## 监控前操作
>
> 您需要在 ActiveMQ 开启 `JMX` 服务,HertzBeat 使用 JMX 协议对 ActiveMQ 进行指标采集。
1. 修改安装目录下的 `conf/activemq.xml` 文件,开启JMX
> 在 `broker` 标签中添加 `userJmx="true"` 属性
```xml
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}" useJmx="true">
<!-- others -->
</broker>
```
2. 修改安装目录下的 `bin/env` 文件,配置JMX 端口 IP等
将如下原配置信息
```text
# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.port=11099"
# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.password.file=`ACTIVEMQ_CONF`/jmx.password"
# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.access.file=`ACTIVEMQ_CONF`/jmx.access"
# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.ssl=false"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote"
```
更新为如下配置,⚠️注意修改`本机对外IP`
```text
# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.password.file=`ACTIVEMQ_CONF`/jmx.password"
# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.access.file=`ACTIVEMQ_CONF`/jmx.access"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.port=11099"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.ssl=false"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.authenticate=false"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Djava.rmi.server.hostname=本机对外IP"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote"
```
3. 重启 ACTIVEMQ 服务,在 HertzBeat 添加对应 ActiveMQ 监控即可,参数使用 JMX 配置的 IP 端口。
### 配置参数
| 参数名称 | 参数帮助描述 |
|---------|------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| JMX端口 | JMX 对外提供的HTTP端口,默认为 11099。 |
| JMX URL | 可选,自定义 JMX URL 连接 |
| 用户名 | 认证时使用的用户名 |
| 密码 | 认证时使用的密码 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:broker
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------------------------|------|-----------------------------------------------------------------------|
| BrokerName | 无 | The name of the broker. |
| BrokerVersion | 无 | The version of the broker. |
| Uptime | 无 | Uptime of the broker. |
| UptimeMillis | ms | Uptime of the broker in milliseconds. |
| Persistent | 无 | Messages are synchronized to disk. |
| MemoryPercentUsage | % | Percent of memory limit used. |
| StorePercentUsage | % | Percent of store limit used. |
| TempPercentUsage | % | Percent of temp limit used. |
| CurrentConnectionsCount | 无 | Attribute exposed for management |
| TotalConnectionsCount | 无 | Attribute exposed for management |
| TotalEnqueueCount | 无 | Number of messages that have been sent to the broker. |
| TotalDequeueCount | 无 | Number of messages that have been acknowledged on the broker. |
| TotalConsumerCount | 无 | Number of message consumers subscribed to destinations on the broker. |
| TotalProducerCount | 无 | Number of message producers active on destinations on the broker. |
| TotalMessageCount | 无 | Number of unacknowledged messages on the broker. |
| AverageMessageSize | 无 | Average message size on this broker |
| MaxMessageSize | 无 | Max message size on this broker |
| MinMessageSize | 无 | Min message size on this broker |
#### 指标集合:topic
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------------------|------|-------------------------------------------------------------------------------------------|
| Name | 无 | Name of this destination. |
| MemoryLimit | MB | Memory limit, in bytes, used by undelivered messages before paging to temporary storage. |
| MemoryPercentUsage | 无 | The percentage of the memory limit used |
| ProducerCount | 无 | Number of producers attached to this destination |
| ConsumerCount | 无 | Number of consumers subscribed to this destination. |
| EnqueueCount | 无 | Number of messages that have been sent to the destination. |
| DequeueCount | 无 | Number of messages that has been acknowledged (and removed) from the destination. |
| ForwardCount | 无 | Number of messages that have been forwarded (to a networked broker) from the destination. |
| InFlightCount | 无 | Number of messages that have been dispatched to, but not acknowledged by, consumers. |
| DispatchCount | 无 | Number of messages that has been delivered to consumers, including those not acknowledged |
| ExpiredCount | 无 | Number of messages that have been expired. |
| StoreMessageSize | B | The memory size of all messages in this destination's store. |
| AverageEnqueueTime | ms | Average time a message was held on this destination. |
| MaxEnqueueTime | ms | The longest time a message was held on this destination |
| MinEnqueueTime | ms | The shortest time a message was held on this destination |
| TotalBlockedTime | ms | Total time (ms) messages have been blocked by flow control |
| AverageMessageSize | B | Average message size on this destination |
| MaxMessageSize | B | Max message size on this destination |
| MinMessageSize | B | Min message size on this destination |
#### 指标集合:memory_pool
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| name | 无 | 指标名称 |
| committed | kb | 总量 |
| init | kb | 初始化大小 |
| max | kb | 最大 |
| used | kb | 已使用 |
#### 指标集合:class_loading
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------------------|------|----------|
| LoadedClassCount | 个 | 已加载类数量 |
| TotalLoadedClassCount | 个 | 历史已加载类总量 |
| UnloadedClassCount | 个 | 未加载类数量 |
#### 指标集合:thread
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------------------------|------|-----------|
| TotalStartedThreadCount | 个 | 已经开始的线程数量 |
| ThreadCount | 个 | 线程数 |
| PeakThreadCount | 个 | 未加载类数量 |
| DaemonThreadCount | 个 | 守护进程数 |
| CurrentThreadUserTime | ms | 使用时间 |
| CurrentThreadCpuTime | ms | 使用CPU时间 |
@@ -0,0 +1,357 @@
---
id: ai_agent
title: HertzBeat AI 智能助手用户指南
sidebar_label: HertzBeat AI
keywords: [AI, 聊天, 智能助手, 监控, AI Agent, OpenAI]
---
> HertzBeat AI 智能助手是一个智能监控 AI 助手,通过自然语言对话帮助您管理监控器、配置告警并优化基础设施监控。
## 概述
HertzBeat AI 智能助手功能提供了一个交互式聊天界面,您可以:
**监控器管理:**
- 🔍 按状态、类型、主机和标签查询和过滤现有监控器
- ➕ 为网站、API、数据库和服务添加新的监控器
- 📊 获取可用监控器类型及其参数的详细信息
- ⚡ 检查监控器状态并排除监控问题
**告警管理:**
- 🚨 通过综合过滤(类型、状态、搜索)查询活跃告警
- 📈 获取告警摘要统计和分布
- 🔔 查看单个和分组告警
- 📋 分析告警模式和趋势
**指标分析:**
- 📊 检索任何监控器的实时指标数据
- 📈 访问可自定义时间范围的历史指标
- 💾 检查仓库存储系统状态
- 🔍 查询特定指标字段和标签
**告警规则管理:**
- ⚙️ 配置告警规则和阈值
- 📝 管理不同监控器类型的告警定义
- 🎯 设置自定义告警条件
## 先决条件
在使用 AI 智能助手之前,请确保:
1. **OpenAI 配置**:必须配置有效的 OpenAI API 密钥。可选地,您可以在 `application.yml` 中的 `spring.ai.openai.chat.options.model` 下更改模型(默认为 `gpt-4.1-nano`)。
2. **数据库连接**:HertzBeat 数据库必须可访问以进行监控器操作
## 配置
### OpenAI API 密钥设置
AI 智能助手使用 OpenAI 的 GPT 模型。您需要通过以下方式配置 OpenAI API 密钥:
#### 通过 UI 进行数据库配置
1. 导航到 AI 智能助手界面
2. 如果未配置 API 密钥,您将看到配置对话框
3. 输入您的 OpenAI API 密钥
4. 点击 **保存配置**
### 配置优先级
- **数据库配置** 优先于 YAML 配置
- 配置更改立即生效,无需重启
- 保存前会自动验证无效的 API 密钥
## 使用 AI 智能助手
### 访问聊天界面
1. 在 HertzBeat Web 界面中导航到 **AI 智能助手** 部分
2. 您将看到 HertzBeat 监控 AI 助手欢迎屏幕
3. 在聊天输入框中开始输入您的问题
### 示例对话
#### 添加新监控器
```text
您:为我的网站 https://example.com 添加一个新的 HTTP 监控器
AI 助手:我将帮助您为 https://example.com 添加一个 HTTP 监控器。
让我使用以下配置创建该监控器:
- 名称:example.com 网站监控器
- 类型:HTTP
- 主机:example.com
- 端口:443 (HTTPS)
- 路径:/
- 间隔:60 秒
监控器创建成功,ID12345
```
#### 列出现有监控器
```text
您:显示我所有当前的监控器
AI 助手:以下是您当前的监控器:
1. **Linux 服务器** (ID: 1001)
- 状态:✅ 在线
- 主机:192.168.1.100
- 最后检查:2 分钟前
2. **MySQL 数据库** (ID: 1002)
- 状态:⚠️ 警告
- 主机:db.example.com
- 最后检查:30 秒前
3. **网站监控器** (ID: 1003)
- 状态:✅ 在线
- 主机:https://example.com
- 最后检查:1 分钟前
您想了解任何特定监控器的详细信息吗?
```
#### 获取监控器类型信息
```text
您:监控 PostgreSQL 数据库需要哪些参数?
AI 助手:要监控 PostgreSQL 数据库,您需要这些参数:
**必需参数:**
- **主机**:数据库服务器 IP/主机名
- **端口**PostgreSQL 端口(默认:5432
- **数据库**:要连接的数据库名称
- **用户名**:数据库用户名
- **密码**:数据库密码
**可选参数:**
- **超时**:连接超时(默认:6000ms)
- **查询超时**:SQL 查询超时(默认:3000ms
- **SSL**:启用 SSL 连接(默认:false)
您想让我帮助您添加一个 PostgreSQL 监控器吗?
```
#### 告警管理
```text
您:显示过去 24 小时内的所有严重告警
AI 助手:以下是过去 24 小时内的严重告警:
🚨 **活跃告警(3 个触发中)**
1. **高 CPU 使用率** - Linux 服务器 (ID: 1001)
- 状态:🔥 触发中
- 触发时间:2 小时前
- 严重程度:严重
- 消息:CPU 使用率 95% > 阈值 90%
2. **数据库连接失败** - MySQL 数据库 (ID: 1002)
- 状态:🔥 触发中
- 触发时间:45 分钟前
- 严重程度:严重
- 消息:10 秒后连接超时
3. **网站响应时间** - 网站监控器 (ID: 1003)
- 状态:⚠️ 警告
- 触发时间:15 分钟前
- 严重程度:警告
- 消息:响应时间 5.2s > 阈值 3s
**告警摘要:**
- 总告警数:12
- 触发中:3(2 个严重,1 个警告)
- 已解决:9
您想让我帮助调查任何特定的告警吗?
```
#### 指标分析
```text
您:显示我的 Linux 服务器过去 6 小时的 CPU 使用率
AI 助手:以下是您的 Linux 服务器(监控器 ID:1001)过去 6 小时的 CPU 使用率数据:
📊 **CPU 使用率指标 - 过去 6 小时**
时间 | 使用率 (%) | 负载平均 | 进程数
14:00-15:00 | 45.2% | 1.2 | 156
15:00-16:00 | 67.8% | 2.1 | 178
16:00-17:00 | 89.4% | 3.8 | 195
17:00-18:00 | 92.1% | 4.2 | 203
18:00-19:00 | 94.7% | 4.8 | 210
19:00-20:00 | 88.3% | 3.5 | 188
**分析:**
- 峰值使用率:19:00 时 94.7%
- 平均使用率:79.6%
- 趋势:高使用率持续 3+ 小时
- 当前状态:下降中(88.3%
**实时指标:**
- 当前 CPU76.2%
- 内存使用率:82.1%
- 磁盘 I/O:正常
您想让我检查历史数据进行比较或调查高使用率的原因吗?
```
#### 告警规则配置
```text
您:当我的网站响应时间超过 5 秒时设置告警规则
AI 助手:我将帮助您创建网站响应时间监控的告警规则。
**告警规则配置:**
- **监控器类型**HTTP/网站
- **指标**:响应时间
- **条件**:大于 5 秒
- **严重程度**:警告
- **评估**:每 60 秒检查一次
- **通知**:邮件 + 仪表板
**建议规则:**
```yaml
name: "网站响应时间告警"
condition: "response_time > 5000ms"
severity: "warning"
description: "当网站响应时间超过 5 秒时告警"
evaluation_interval: 60s
for: 2m # 条件持续 2 分钟后告警
```
此规则将:
1. 每分钟监控响应时间
2. 如果响应时间 > 5s 持续 2+ 分钟则触发告警
3. 通过配置的渠道发送通知
4. 在仪表板中显示警告状态
您想让我应用此配置还是修改任何设置?
``` text
### 聊天功能
#### 消息历史
- 所有对话都会自动保存
- 从侧边栏访问以前的对话
- 搜索对话历史
- 导出对话日志
#### 实时响应
- 流式响应提供即时反馈
- 输入指示器显示助手正在处理时
- 如需要可取消正在进行的请求
#### 对话管理
- 为不同主题创建新对话
- 重命名对话以便更好地组织
- 删除旧对话以保持整洁
注意:对话不会保存在数据库中
## 故障排除
### 常见问题
#### 聊天界面无法加载
**症状**:聊天界面无限显示加载旋转器
**解决方案**
1. 检查浏览器控制台中的 JavaScript 错误
2. 确保与 HertzBeat 服务器的网络连接
#### "服务不可用"消息
**症状**:聊天显示"HertzBeat AI 监控服务不可用"
**解决方案**
1. 验证 OpenAI API 密钥配置
2. 检查应用程序日志中的错误
3. 确保数据库连接
#### 无效 API 密钥错误
**症状**:配置对话框显示"无效 API 密钥"错误
**解决方案**
1. 验证您的 OpenAI API 密钥以 `sk-` 开头
2. 检查 API 密钥是否有足够的积分/配额
3. 直接使用 OpenAI API 测试 API 密钥
4. 确保 API 密钥中没有多余的空格
#### 监控器创建失败
**症状**:AI 建议监控器配置但创建失败
**解决方案**
1. 验证您有创建监控器的权限
2. 检查是否已存在同名监控器
3. 确保目标主机/服务可访问
4. 查看监控器参数验证错误
### 调试模式
通过设置日志级别为 DEBUG 来启用调试日志:
```yaml
logging:
level:
org.apache.hertzbeat.ai.agent: DEBUG
```
## 最佳实践
### 有效的聊天使用
1. **具体明确**"为 api.example.com 端口 8080 添加 HTTP 监控器" vs "添加一个监控器"
2. **提供上下文**:说明您想要生产环境还是测试环境监控器
3. **询问后续问题**:如需要请求配置详细信息
4. **使用自然语言**:AI 理解对话式请求
### 监控器管理
1. **命名约定**:使用描述性的监控器名称
2. **文档记录**:要求 AI 记录复杂配置
### 安全考虑
1. **API 密钥安全**:安全存储 OpenAI API 密钥
2. **访问控制**:限制 AI 聊天访问给授权用户
3. **数据隐私**:注意聊天日志中的敏感信息
4. **网络安全**:确保与 OpenAI API 的安全连接
## 高级功能
### 批量操作
```text
您:为我的预发布环境中的所有服务添加 HTTP 监控器:
- api-staging.example.com:8080
- web-staging.example.com:80
- admin-staging.example.com:3000
```
## 限制
- 需要活跃的互联网连接访问 OpenAI API
- OpenAI API 使用会根据令牌消耗产生费用
- 复杂的多步骤操作可能需要多次交互
- 某些高级配置可能需要手动设置
- 可能会根据 OpenAI 计划应用速率限制
## 支持
对于 AI 智能助手的问题:
1. 首先查看此文档
2. 查看应用程序日志中的错误
3. 独立测试 OpenAI API 连接
4. 联系 HertzBeat 支持并提供具体错误消息
---
@@ -0,0 +1,38 @@
---
id: airflow
title: 监控:Apache Airflow监控
sidebar_label: Apache Airflow
keywords: [开源监控系统, 开源数据库监控, Apache Airflow监控]
---
> 对Apache Airflow通用性能指标进行采集监控。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|-----------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://) |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性 |
| 端口 | 数据库对外提供的端口,默认为8080 |
| 查询超时时间 | 设置连接未响应的超时时间,单位ms毫秒,默认3000毫秒 |
| HTTPS | 是否启用HTTPS |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:airflow_health
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------------|------|------------------|
| metadatabase | 无 | metadatabase健康情况 |
| scheduler | 无 | scheduler健康情况 |
| triggerer | 无 | triggerer健康情况 |
#### 指标集合:airflow_version
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------------|------|---------------|
| value | 无 | Airflow版本 |
| git_version | 无 | Airflow git版本 |
@@ -0,0 +1,56 @@
---
id: alarm_center
title: 告警中心
sidebar_label: 告警中心
keywords: [开源监控系统, 告警中心, 告警管理,告警显示]
---
> 告警中心是一个展示平台,用于显示所有经过分组、收敛、抑制、静默等处理的告警,包括由内部系统阈值触发的告警和第三方接入告警。
## 告警来源
HertzBeat 的告警中心管理来自两个主要来源的告警:
1. 系统内部阈值触发的告警
- 当监控指标超过预定义阈值时生成
- 与系统中配置的监控任务和阈值规则直接相关
- 可以通过调整监控任务和阈值设置进行控制
2. 第三方接入告警
- 通过 API 接口从外部系统接收
- 支持与其他监控系统或告警平台集成
- 与内部告警一样经过相同的处理流程
## 告警处理机制
在显示到告警中心之前,所有告警都会经过几个处理步骤:
1. 分组
- 基于来源、类型、日志级别和其他属性(标签)对相关告警进行分类
- 帮助高效管理大量告警
- 支持针对不同场景的自定义分组规则
2. 收敛
- 减少短时间内发生的多个类似告警产生的干扰
- 以更简洁的方式呈现收敛后的告警,避免信息冗余
3. 抑制
- 处理告警之间的依赖关系
- 当关键告警触发时,可以抑制相关的次要告警
- 支持配置定义告警依赖关系的抑制规则
4. 静默
- 在特定时间段内暂时屏蔽某些告警
- 适用于系统维护、已知问题处理等场景
- 可以基于时间设置静默规则
## 告警中心界面
![alarm_center](/img/docs/help/alarm-center-1.png)
告警中心提供了系统所有告警的全面视图:
1. 告警显示
- 列出所有告警,包含告警状态、来源、标签和时间等关键信息
- 提供详细视图功能,显示完整的告警信息和上下文
2. 搜索功能
- 帮助快速定位特定告警
- 支持多种搜索(标签、注解、告警状态等)
3. 告警管理
- 告警删除:移除不再需要关注的告警
@@ -0,0 +1,24 @@
---
id: alarm_group
title: 分组收敛
sidebar_label: 分组收敛
keywords: [ 开源监控系统, 告警收敛, 告警分组 ]
---
> 分组收敛支持对指定分组标签的告警进行分组合并,对时间段的相同重复告警去重收敛。 当阈值规则触发告警或外部告警上报后,会进入到分组收敛进行告警分组,告警去重,以避免大量告警消息导致告警风暴。
## 分组策略参数配置
- 策略名称:唯一标识分组策略的名称
- 分组标签:告警分组标签,最多支持添加10个标签
> 标签来源:监控,阈值规则,外部告警携带的标签
- 等待时间:新告警产生后等待时间,在此时间内收到的相同告警将被分组,默认30秒
> 当一条新(无法加入已有分组)的告警产生,分组收敛将按照 `等待时间` 等待,在此期间,相同告警或满足分组条件的告警将被分组。直到当前时间与该分组第一条告警产生时间间隔超过 `等待时间`,分组后的告警才被发送到告警抑制模块进行后续处理。
- 间隔时间:发送分组告警通知的最小时间间隔,避免告警通知过于频繁,默认5分钟
- 重复间隔:重复告警的最小通知间隔,对于持续触发的告警,避免重复发送通知,默认4小时
**注意**:只有分组后的告警才能使用抑制规则进行告警抑制。
@@ -0,0 +1,38 @@
---
id: alarm_inhibit
title: 告警抑制
sidebar_label: 告警抑制
keywords: [ 开源监控系统, 告警收敛, 告警抑制 ]
---
> 告警抑制用于配置告警之间的抑制关系。当某个告警发生时,可以抑制其他告警的产生,可以理解为“重要”告警抑制“不重要”告警的产生,例如一台服务器宕机产生的告警抑制这台服务器上其他服务产生的告警。
## 前置条件
- 正确配置分组收敛规则
## 抑制规则配置
- 抑制规则名称: 唯一标识抑制规则的名称;
- 源标签: 当告警包含这些标签时,将会抑制目标告警,支持添加多个标签;
> 识别“重要”告警的标签,告警标签需要包含全部源标签才会抑制被目标标签标记的告警。
- 目标标签: 匹配这些标签的告警将被抑制;
> 识别“不重要”告警的标签,告警标签需要包含全部目标标签才会被抑制。
- 相等标签: 判断告警相关性的标签。支持最多10个标签;
- 启用状态: 启用或禁用该抑制规则。
## 示例
场景: 使用 HertzBeat 监控 两个 Centos 服务器 192.168.1.1 和 192.168.1.2,和部署在两个服务器上的 Redis 服务 Redis-1 和 Redis-2。
并配置如下阈值规则:
- 监控 Centos Linux /监控可用性。绑定标签 `server-status:down`
- 监控 Redis数据库 /监控可用性。绑定标签 `redis-status:down`
如果需要实现当Centos 宕机告警产生后,Redis 告警不再产生,则可以配置如下告警抑制规则:
- 源标签: `server-status:down`
- 目标标签: `redis-status:down`
- 相等标签: `instancehost`
当 Centos 192.168.1.1 宕机告警产生时,通知Redis-1 不可用的告警将不再产生。且同时 Centos 192.168.1.2 运行正常且 Redis-2 不可用时,通知 Redis-2 不可用的告警将正常产生。
@@ -0,0 +1,29 @@
---
id: alarm_silence
title: 告警静默
sidebar_label: 告警静默
keywords: [ 开源监控系统, 告警静默 ]
---
> 告警静默管理用于您在系统维护期间或夜晚周末不想受到告警打扰时,可以配置系统静默策略,设置指定时间段内屏蔽告警通知。告警静默规则支持一次性时间段或周期性时间段,支持标签匹配和告警级别匹配部分告警。
## 一次性时间段静默配置
- 策略名称:唯一标识静默策略的名称;
- 应用所有:是否对所有告警启用该静默策略;
- 匹配标签:当 `应用所有` 配置关闭时,可根据匹配标签匹配需要静默的告警;
- 静默类型:选择 `一次性静默` ;
- 静默时段:选择 `一次性静默` 类型后,静默时段设置如下图所示,可自行配置
![alarm_silence](/img/docs/help/alert-silence-1.png)
- 启用状态:启用或禁用该静默策略。
## 周期性时间段静默配置
- 策略名称:唯一标识静默策略的名称;
- 应用所有:是否对所有告警启用该静默策略;
- 匹配标签:当 `应用所有` 配置关闭时,可根据匹配标签匹配需要静默的告警;
- 静默类型:选择 `周期性静默` ;
- 选择日期: 选择 `周期性静默` 类型后,可以配置需要静默的日期;
- 静默时段:选择 `周期性静默` 类型后,静默时段设置如下图所示,可自行配置,比如在周末时间静默
![alarm_silence](/img/docs/help/alert-silence-2.png)
- 启用状态:启用或禁用该静默策略。
@@ -0,0 +1,18 @@
---
id: alert_console
title: 告警模板中自定义的控制台地址
sidebar_label: 告警模板登录台地址
---
> 阈值触发后发送告警信息,通过钉钉/企业微信/飞书机器人通知或者使用邮箱通知的时候,告警内容中有登录控制台的详情链接
## 自定义设置
在我们的启动配置文件application.yml中,找到下面的配置
```yml
alerter:
console-url: #这里就是我们的自定义控制台地址
```
默认值是赫兹跳动的官方控制台地址
@@ -0,0 +1,41 @@
---
id: alert_dingtalk
title: 告警钉钉机器人通知
sidebar_label: 告警钉钉机器人通知
keywords: [告警钉钉机器人通知, 开源告警系统, 开源监控告警系统]
---
> 阈值触发后发送告警信息,通过钉钉机器人通知到接收人。
## 操作步骤
1. **【钉钉桌面客户端】-> 【群设置】-> 【智能群助手】-> 【添加新建机器人-选自定义】-> 【设置机器人名称头像】-> 【注意⚠️设置自定义关键字: HertzBeat】 ->【添加成功后复制其WebHook地址】**
> 注意⚠️ 新增机器人时需在安全设置块需设置其自定义关键字: HertzBeat ,其它安全设置加签或IP段不填写
![email](/img/docs/help/alert-notice-8.png)
2. **【保存机器人的WebHook地址access_token值】**
> 例如: webHook地址:`https://oapi.dingtalk.com/robot/send?access_token=43aac28a236e001285ed84e473f8eabee70f63c7a70287acb0e0f8b65fade64f`
> 其机器人access_token值为 `43aac28a236e001285ed84e473f8eabee70f63c7a70287acb0e0f8b65fade64f`
3. **【告警通知】->【新增接收人】 ->【选择钉钉机器人通知方式】->【设置钉钉机器人ACCESS_TOKEN】-> 【确定】**
![email](/img/docs/help/alert-notice-9.png)
4. **配置关联的告警通知策略⚠️ 【新增通知策略】-> 【将刚设置的接收人关联】-> 【确定】**
> **注意⚠️ 新增了接收人并不代表已经生效可以接收告警信息,还需配置关联的告警通知策略,即指定哪些消息发给哪些接收人**。
![email](/img/docs/help/alert-notice-4.png)
### 钉钉机器人通知常见问题
1. 钉钉群未收到机器人告警通知
> 请排查在告警中心是否已有触发的告警信息
> 请排查钉钉机器人是否配置了安全自定义关键字:HertzBeat
> 请排查是否配置正确机器人ACCESS_TOKEN,是否已配置告警策略关联
其它问题可以通过交流群ISSUE反馈哦!
@@ -0,0 +1,70 @@
---
id: alert_discord
title: 告警 Discord 机器人通知
sidebar_label: 告警 Discord 机器人通知
keywords: [告警 Discord 机器人通知, 开源告警系统, 开源监控告警系统]
---
> 阈值触发后发送告警信息,通过 Discord 机器人通知到接收人。
## 操作步骤
> 部署网络本身需支持科学上网,不支持设置代理
### 在 Discord 创建应用, 应用下创建机器人, 获取机器人 Token
1. 访问 [https://discord.com/developers/applications](https://discord.com/developers/applications) 创建应用
![bot](/img/docs/help/discord-bot-1.png)
2. 在应用下创建机器人,获取机器人 Token
![bot](/img/docs/help/discord-bot-2.png)
![bot](/img/docs/help/discord-bot-3.png)
3. 授权机器人到聊天服务器
> 在 OAuth2 菜单下给此机器人授权,`SCOPES` 范围选 `bot`, `BOT PERMISSIONS` 选发送消息 `Send Messages`
![bot](/img/docs/help/discord-bot-4.png)
> 获取到最下方生成的 URL, 浏览器访问此 URL 给机器人正式授权,即设置将机器人加入哪个聊天服务器。
4. 查看您的聊天服务器是否已经加入机器人成员
![bot](/img/docs/help/discord-bot-5.png)
### 开启开发者模式,获取频道 Channel ID
1. 个人设置 -> 高级设置 -> 开启开发者模式
![bot](/img/docs/help/discord-bot-6.png)
2. 获取频道 Channel ID
> 右键选中您想要发送机器人消息的聊天频道,点击 COPY ID 按钮获取 Channel ID
![bot](/img/docs/help/discord-bot-7.png)
### 在 HertzBeat 新增告警通知人,通知方式为 Discord Bot
1. **【告警通知】->【新增接收人】 ->【选择 Discord 机器人通知方式】->【设置机器人Token和ChannelId】-> 【确定】**
![email](/img/docs/help/discord-bot-8.png)
2. **配置关联的告警通知策略⚠️ 【新增通知策略】-> 【将刚设置的接收人关联】-> 【确定】**
> **注意⚠️ 新增了接收人并不代表已经生效可以接收告警信息,还需配置关联的告警通知策略,即指定哪些消息发给哪些接收人**。
![email](/img/docs/help/alert-notice-policy.png)
### Discord 机器人通知常见问题
1. Discord 未收到机器人告警通知
> 请排查在告警中心是否已有触发的告警信息
> 请排查是否配置正确机器人Token, ChannelId,是否已配置告警策略关联
> 请排查机器人是否被 Discord聊天服务器正确赋权
其它问题可以通过交流群ISSUE反馈哦!
@@ -0,0 +1,39 @@
---
id: alert_email
title: 告警邮件通知
sidebar_label: 告警邮件通知
keywords: [告警邮件通知, 开源告警系统, 开源监控告警系统]
---
> 阈值触发后发送告警信息,通过邮件通知到接收人。
## 操作步骤
1. **【告警通知】->【新增接收人】 ->【选择邮件通知方式】**
![email](/img/docs/help/alert-notice-1.png)
2. **【获取验证码】-> 【输入邮箱验证码】-> 【确定】**
![email](/img/docs/help/alert-notice-2.png)
![email](/img/docs/help/alert-notice-3.png)
3. **配置关联的告警通知策略⚠️ 【新增通知策略】-> 【将刚设置的接收人关联】-> 【确定】**
> **注意⚠️ 新增了接收人并不代表已经生效可以接收告警信息,还需配置关联的告警通知策略,即指定哪些消息发给哪些接收人**。
![email](/img/docs/help/alert-notice-4.png)
### 邮件通知常见问题
1. 自己内网部署的HertzBeat无法接收到邮件通知
> HertzBeat需要自己配置邮件服务器,TanCloud无需,请确认是否在application.yml配置了自己的邮件服务器
2. 云环境TanCloud无法接收到邮件通知
> 请排查在告警中心是否已有触发的告警信息
> 请排查是否配置正确邮箱,是否已配置告警策略关联
> 请查询邮箱的垃圾箱里是否把告警邮件拦截
其它问题可以通过交流群ISSUE反馈哦!
@@ -0,0 +1,34 @@
---
id: alert_enterprise_wechat_app
title: 企业微信应用告警通知
sidebar_label: 告警企业微信应用通知
keywords: [开源告警系统, 开源监控告警系统, 企业微信应用告警通知]
---
> 阈值触发后发送告警信息,通过企业微信应用通知到接收人.
## Operation steps
1. **【企业微信后台管理】-> 【App管理】-> 【创建一个新的应用】-> 【设置应用信息】->【添加成功后复制应用的AgentId和Secret】**
![email](/img/docs/help/alert-wechat-1.jpg)
2. **【告警通知】->【新增接收人】 ->【选择企业微信应用通知方式】->【设置企业ID,企业应用id和应用的secret 】-> 【确定】**
![email](/img/docs/help/alert-wechat-2.jpg)
3. **配置关联的告警通知策略⚠️ 【新增通知策略】-> 【将刚设置的接收人关联】-> 【确定】**
> **注意⚠️ 新增了接收人并不代表已经生效可以接收告警信息,还需配置关联的告警通知策略,即指定哪些消息发给哪些接收人。**
![email](/img/docs/help/alert-wechat-3.jpg)
### 企业微信应用通知常见问题
1. 企业微信应用未收到告警通知.
> 请检查用户是否具有应用程序权限.
> 请检查企业应用程序回调地址设置是否正常.
> 请检查服务器IP是否在企业应用程序白名单上.
其它问题可以通过交流群ISSUE反馈哦!
@@ -0,0 +1,39 @@
---
id: alert_feishu
title: 告警飞书机器人通知
sidebar_label: 告警飞书机器人通知
keywords: [告警飞书机器人通知, 开源告警系统, 开源监控告警系统]
---
> 阈值触发后发送告警信息,通过飞书机器人通知到接收人。
## 操作步骤
1. **【飞书客户端】-> 【群设置】-> 【群机器人】-> 【添加机器人】 -> 【自定义机器人】 -> 【设置机器人名称头像】-> 【添加成功后复制其WebHook地址】**
2. **【保存机器人的WebHook地址的KEY值】**
> 例如: webHook地址:`https://open.feishu.cn/open-apis/bot/v2/hook/3adafc96-23d0-4cd5-8feb-17f6e0b5fcs4`
>
> 其机器人KEY值为 `3adafc96-23d0-4cd5-8feb-17f6e0b5fcs4`
3. **【告警通知】->【新增接收人】 ->【选择飞书机器人通知方式】->【设置飞书机器人KEY】-> 【确定】**
4. **配置关联的告警通知策略⚠️ 【新增通知策略】-> 【将刚设置的接收人关联】-> 【确定】**
> **注意⚠️ 新增了接收人并不代表已经生效可以接收告警信息,还需配置关联的告警通知策略,即指定哪些消息发给哪些接收人**。
![email](/img/docs/help/alert-notice-4.png)
### 飞书机器人通知常见问题
1. 飞书群未收到机器人告警通知
> 请排查在告警中心是否已有触发的告警信息
> 请排查是否配置正确机器人KEY,是否已配置告警策略关联
2. 如何在告警通知中@某人
> 在新增接收人的表单中,填写 `用户ID` 。如果需要 @所有人,可以在 `用户ID` 字段中填入 `all`。同时支持填写多个用户id,用逗号 `,` 分隔。获取飞书用户id的具体方法,请参考:[获取飞书用户ID](https://open.feishu.cn/document/faq/trouble-shooting/how-to-get-internal-user-id)
其它问题可以通过交流群ISSUE反馈哦!
@@ -0,0 +1,75 @@
---
id: alert_feishu_app
title: 告警飞书自建应用通知
sidebar_label: 告警飞书自建应用通知
keywords: [告警飞书自建应用通知 , 开源告警系统, 开源监控告警系统]
---
> 阈值触发后发送告警信息,通过飞书自建应用通知到接收人。
## 操作步骤
1. **【[飞书开放平台](https://open.feishu.cn/)】->【创建企业自建应用】->【创建】->【添加应用能力:机器人】**
2. **【开发配置】->【权限配置】:不同的通知对象类型所需要的API权限不同,可按需开通**
| 权限名称 | 权限代码 | 指定用户 | 指定群聊 | 指定部门 | 所有用户 |
|------------------------|-----------------------------------|:----:|:----:|:----:|:----:|
| 获取用户 user ID | contact:user.employee_id:readonly | ✓ | | | ✓ |
| 以应用的身份发消息 | im:message:send_as_bot | ✓ | ✓ | ✓ | ✓ |
| 获取飞书人事(标准版)应用中的员工花名册信息 | ehr:employee:readonly | | | | ✓ |
| 给一个或多个部门的成员批量发消息 | im:message:send_multi_depts | | | ✓ | |
| 给多个用户批量发消息 | im:message:send_multi_users | | | | ✓ |
> 注意⚠️:在指定群聊的通知类型中,应用需作为机器人添加进群聊里,若要@某人需要开通`获取用户 user ID`权限
>
> 批量导入权限
>
> ```json
> {
> "scopes": {
> "tenant": [
> "contact:user.employee_id:readonly",
> "im:message:send_as_bot",
> "ehr:employee:readonly",
> "im:message:send_multi_depts",
> "im:message:send_multi_users"
> ],
> "user": []
> }
> }
> ```
3. **【应用发布】->【版本发布与管理】->【创建版本】->【保存】->【发布】**
4. **【基础信息】->【凭证与基础信息】->【复制保存App ID和App Secret】**
5. **【告警通知】->【新增接收人】 ->【选择飞书自建应用通知方式】->【设置应用ID、应用secret】-> 【选择通知对象类型】-> 【设置对应的ID】**
6. **配置关联的告警通知策略⚠️ 【新增通知策略】-> 【将刚设置的接收人关联】-> 【确定】**
> **注意⚠️ 新增了接收人并不代表已经生效可以接收告警信息,还需配置关联的告警通知策略,即指定哪些消息发给哪些接收人**。
![email](/img/docs/help/alert-notice-4.png)
### 飞书自建应用通知常见问题
1. 飞书未收到告警通知
> 请排查在告警中心是否已有触发的告警信息
> 请排查是否配置正确App ID和App Secret,是否已配置告警策略关联
> 请排查应用发布时该用户是否在可用范围内
2. 如何在指定群聊中@某人
> 在新增接收人的表单中,填写 `用户ID` 。如果需要 @所有人,可以在 `用户ID` 字段中填入 `all`。同时支持填写多个用户id,用逗号 `,` 分隔。获取飞书用户id的具体方法,请参考:[如何获取用户的 User ID](https://open.feishu.cn/document/faq/trouble-shooting/how-to-obtain-user-id#529e21a9)
3. 如何获取群聊ID
请参考:[群ID获取方式](https://open.feishu.cn/document/server-docs/group/chat/chat-id-description#394516c9)
4. 如何获取部门ID
请参考:[部门资源介绍](https://open.feishu.cn/document/server-docs/contact-v3/department/field-overview#9c02ed7a)
其它问题可以通过交流群ISSUE反馈哦!
@@ -0,0 +1,32 @@
---
id: alert_integration
title: 告警集成
sidebar_label: 告警集成
keywords: [开源监控, 告警集成, 告警管理, 多源告警]
---
> HertzBeat 的告警集成模块旨在实现对来自不同第三方监控与可观测性平台的告警进行统一接收、标准化处理与智能分发。作为一个集中式“告警中心”,HertzBeat 能够高效地接入外部系统的告警信息,并执行灵活的告警管理策略。
## 核心能力
- **多源告警接入**:支持从 Webhook、Prometheus、Alertmanager、SkyWalking、腾讯云等主流平台接收告警消息
- **告警格式标准化**:将来自不同平台的告警数据转换为 HertzBeat 内部统一格式,便于后续处理
- **丰富的告警处理机制**,包括:
- **分组收敛**:根据标签对告警进行分组管理,对时间段的相同重复告警去重收敛
- **抑制**:在满足特定条件时自动屏蔽次要告警
- **静默**:在系统维护或已知异常期间临时关闭告警通知,避免干扰
### 已支持的告警来源
HertzBeat 当前已支持以下第三方监控平台的告警接入:
- **Webhook**:通用接入方式,支持自定义告警格式推送。
- **Prometheus**:可以在 Prometheus Server 的 Alertmanager 配置中直接配置 HertzBeat 的服务地址,使用 HertzBeat 替换 Alertmanager 直接来接收处理 Prometheus Server 的告警信息。
- **Alertmanager**:支持将 Prometheus AlertManager 的告警发送到 HertzBeat 告警平台。
- **SkyWalking**:将 SkyWalking 的告警通过 Webhook 方式发送到 HertzBeat 告警平台。
- **腾讯云监控**:将腾讯云的告警通过 Webhook 方式发送到 HertzBeat 告警平台。
- **更多**HertzBeat 正在积极扩展其集成支持。如果暂时没有找到你需要的集成,活跃的社区也可以协助你添加。
你可以通过 HertzBeat 的“集成接入”界面查看具体的接入方式和配置示例。
![integration](/img/docs/help/alert_integration_cn.png)
@@ -0,0 +1,124 @@
---
id: alert_notification_template
title: 通知模板
sidebar_label: 通知模板
keywords: [模板, 告警模板, 通知模板,消息通知, 告警 Webhook 回调通知]
---
> HertzBeat 支持自定义通知模板,模板采用占位符变量进行渲染,系统会在推送时自动将变量替换为实际告警数据。
## 模板配置
【消息通知】->【通知模板】->【模板配置】
![模板管理](/img/docs/help/alert-notification-template-1.png)
## 模板渲染
HertzBeat 通知模板基于 FreeMarker 语法,支持变量占位符、条件判断、循环、格式化等高级用法。模板渲染时,系统会将告警数据对象(如 GroupAlert、SingleAlert)注入模板,变量会被自动替换为实际值。
## 可用变量与数据结构
### GroupAlert 结构体字段
[GroupAlert定义](https://github.com/apache/hertzbeat/blob/master/hertzbeat-common-spring/src/main/java/org/apache/hertzbeat/common/entity/alerter/GroupAlert.java)
- `id`:告警分组主键
- `groupKey`:分组唯一标识
- `status`:分组状态(如 firing、resolved
- `groupLabels`:分组标签(Map
- `commonLabels`:公共标签(Map
- `commonAnnotations`:公共注解(Map
- `alertFingerprints`:告警指纹列表
- `creator``modifier``gmtCreate``gmtUpdate`:元数据
- `alerts`:告警明细列表(`List<SingleAlert>`
### SingleAlert 结构体字段
[SingleAlert定义](https://github.com/apache/hertzbeat/blob/master/hertzbeat-common-spring/src/main/java/org/apache/hertzbeat/common/entity/alerter/SingleAlert.java)
- `id`:明细主键
- `fingerprint`:唯一指纹
- `labels`:标签(Map
- `annotations`:注解(Map
- `content`:告警内容
- `status`:状态(firing|resolved
- `triggerTimes`:触发次数
- `startAt``activeAt``endAt`:时间戳
- `creator``modifier``gmtCreate``gmtUpdate`:元数据
## 模板变量与语法说明
- **全局变量**
- ``status``:告警状态(如告警、恢复等)
- ``groupKey``:分组唯一标识
- `${commonLabels.xxx}``${commonAnnotations.xxx}`:公共标签和注解,可通过 `xxx` 访问具体字段
- **告警明细列表**
- ``alerts``:告警明细集合,通常配合 `<#list alerts as alert>` 进行遍历
- `${alert.labels.xxx}``${alert.annotations.xxx}`:单条告警的标签和注解
- `${alert.content}`:告警内容
- `${alert.triggerTimes}`:触发次数
- `${alert.startAt}`:首次触发时间
- **模板语法支持**
- 支持 FreeMarker 语法,包括条件判断 `<#if>`、循环 `<#list>`、JSON 字符串化 `?json_string`、时间格式化 `?number_to_datetime`、字符串格式化 `?string('yyyy-MM-dd HH:mm:ss')`
- 可灵活组合变量与模板语法,实现复杂的消息定制
- 更多语法请参考 [FreeMarker 官方文档](https://freemarker.apache.org/)
## 模板示例
```json
{
"title": "🔔 HertzBeat Alert Notification",
"status": "${status!"UNKNOWN"}",
"commonLabels": {
<#if commonLabels?? && commonLabels.severity??>
"severity": "${commonLabels.severity?switch("critical", "❤️ Critical", "warning", "💛 Warning", "info", "💚 Info", "Unknown")}"<#if commonLabels.alertname??>,</#if>
</#if>
<#if commonLabels?? && commonLabels.alertname??>
"alertName": "${commonLabels.alertname}"
</#if>
},
"alerts": [
<#if alerts?? && alerts?size gt 0>
<#list alerts as alert>
{
"index": ${alert?index + 1},
"labels": {
<#if alert.labels?? && alert.labels?size gt 0>
<#list alert.labels?keys as key>
"`key`": "${alert.labels[key]?json_string}"<#if key?has_next>,</#if>
</#list>
</#if>
},
<#if alert.content?? && alert.content != "">
"content": "${alert.content?json_string}",
</#if>
"triggerTimes": ${alert.triggerTimes!0},
"startAt": "${((alert.startAt!0)?number_to_datetime)?string('yyyy-MM-dd HH:mm:ss')}",
<#if alert.activeAt?? && alert.activeAt gt 0>
"activeAt": "${((alert.activeAt!0)?number_to_datetime)?string('yyyy-MM-dd HH:mm:ss')}",
</#if>
<#if alert.endAt?? && alert.endAt gt 0>
"endAt": "${(alert.endAt?number_to_datetime)?string('yyyy-MM-dd HH:mm:ss')}"<#if alert.annotations?? && alert.annotations?size gt 0>,</#if>
</#if>
<#if alert.annotations?? && alert.annotations?size gt 0>
"annotations": {
<#list alert.annotations?keys as key>
"`key`": "${alert.annotations[key]?json_string}"<#if key?has_next>,</#if>
</#list>
}
</#if>
}<#if alert?has_next>,</#if>
</#list>
</#if>
],
"commonAnnotations": {
<#if commonAnnotations?? && commonAnnotations?size gt 0>
<#list commonAnnotations?keys as key>
"`key`": "${commonAnnotations[key]?json_string}"<#if key?has_next>,</#if>
</#list>
</#if>
}
}
@@ -0,0 +1,37 @@
---
id: alert_slack
title: 告警 Slack Webhook 通知
sidebar_label: 告警 Slack Webhook 通知
keywords: [告警 Slack Webhook 通知, 开源告警系统, 开源监控告警系统]
---
> 阈值触发后发送告警信息,通过 Slack Webhook 通知到接收人。
## 操作步骤
> 部署网络本身需支持科学上网,不支持设置代理
### 在 Slack 开启 Webhook, 获取 Webhook URL
参考官网文档 [Sending messages using Incoming Webhooks](https://api.slack.com/messaging/webhooks)
### 在 HertzBeat 新增告警通知人,通知方式为 Slack Webhook
1. **【告警通知】->【新增接收人】 ->【选择 Slack Webhook 通知方式】->【设置 Webhook URL】-> 【确定】**
![email](/img/docs/help/slack-bot-1.png)
2. **配置关联的告警通知策略⚠️ 【新增通知策略】-> 【将刚设置的接收人关联】-> 【确定】**
> **注意⚠️ 新增了接收人并不代表已经生效可以接收告警信息,还需配置关联的告警通知策略,即指定哪些消息发给哪些接收人**。
![email](/img/docs/help/alert-notice-policy.png)
### Slack 机器人通知常见问题
1. Slack 未收到机器人告警通知
> 请排查在告警中心是否已有触发的告警信息
> 请排查是否配置正确 Slack Webhook URL,是否已配置告警策略关联
其它问题可以通过交流群ISSUE反馈哦!
@@ -0,0 +1,43 @@
---
id: alert_smn
title: 华为云SMN通知
sidebar_label: 告警华为云SMN通知
keywords: [ 告警华为云SMN通知, 开源告警系统, 开源监控告警系统 ]
---
> 阈值触发后发送告警信息,通过华为云SMN通知到接收人。
## 操作步骤
1. **按照[华为云SMN官方文档](https://support.huaweicloud.com/qs-smn/smn_json.html)开通SMN服务并配置SMN**
![alert-notice-10](/img/docs/help/alert-notice-10.png)
2. **保存SMN的主题URN**
![alert-notice-11](/img/docs/help/alert-notice-11.png)
3. **按照[华为云签名文档](https://support.huaweicloud.com/devg-apisign/api-sign-provide.html)获取AK、SK和项目ID**
![alert-notice-12](/img/docs/help/alert-notice-12.png)
![alert-notice-13](/img/docs/help/alert-notice-13.png)
4. **【告警通知】->【新增接收人】 ->【选择华为云SMN通知方式】->【设置华为云SMN AK、SK等配置】-> 【确定】**
![alert-notice-14](/img/docs/help/alert-notice-14.png)
5. **配置关联的告警通知策略⚠️ 【新增通知策略】-> 【将刚设置的接收人关联】-> 【确定】**
> **注意⚠️ 新增了接收人并不代表已经生效可以接收告警信息,还需配置关联的告警通知策略,即指定哪些消息发给哪些接收人**。
![email](/img/docs/help/alert-notice-4.png)
### 华为云SMN通知常见问题
1. 华为云SMN群未收到告警通知
> 请排查在告警中心是否已有触发的告警信息
> 请排查是否正确配置华为云SMN AK、SK等配置,是否已配置告警策略关联
其它问题可以通过交流群ISSUE反馈哦!
@@ -0,0 +1,235 @@
---
id: alert_sms
title: 告警短信通知
sidebar_label: 告警短信通知
keywords: [开源监控系统, 开源告警系统, 开源短信告警通知]
---
> 当阈值触发后发送告警信息,通过短信方式通知接收人。
## 短信服务配置
只有成功配置了您自己的短信服务,监控系统内触发的告警短信才会正常发送。
hertzbeat有两种方式配置短信服务,一种是直接修改`application.yml`配置文件,另一种是通过hertzbeat前端界面(系统设置 > 消息服务配置)配置。
> 注意⚠️:两种方式配置的短信服务只能选择一种生效,当两种方式都配置并且开启时,hertzbeat将会优先使用前端界面配置的短信服务。
### 腾讯云短信配置
`application.yml`新增/填写如下腾讯平台短信服务器配置(参数需替换为您的短信服务器配置)
```yaml
alerter:
sms:
enable: true # 是否启用
type: tencent # 短信服务商类型,支持tencent、
tencent: # 腾讯云短信配置
secret-id: AKIDbQ4VhdMr89wDedFrIcgU2PaaMvOuBCzY
secret-key: PaXGl0ziY9UcWFjUyiFlCPMr77rLkJYlyA
app-id: 1435441637
sign-name: 赫兹跳动
template-id: 1343434
```
1. 腾讯云短信创建签名(sign-name)
![image](/img/docs/help/alert-sms-tencent-cloud-signature.png)
2. 腾讯云短信创建正文模板(template-id
```text
监控:{1},告警级别:{2}。内容:{3}
```
![image](/img/docs/help/alert-sms-tencent-cloud-template.png)
3. 腾讯云短信创建应用(app-id)
![image](/img/docs/help/alert-sms-tencent-cloud-app.png)
4. 腾讯云访问管理(secret-id、secret-key
![image](/img/docs/help/alert-sms-tencent-cloud-access.png)
### 阿里云短信配置
开通使用阿里云短信服务,您可参考阿里云官方文档:[短信新手操作指引](https://help.aliyun.com/zh/sms/getting-started/get-started-with-sms)
您可以使用图形化界面配置阿里云短信服务,也可以在`application.yml`中配置阿里云短信服务。
使用`application.yml`需要新增/填写如下阿里云短信配置(参数需替换为您的短信服务器配置)
```yaml
alerter:
sms:
enable: true # 启用配置
type: alibaba # 短信服务商类型,设置为alibaba
alibaba: # 填写阿里云短信配置
access-key-id: # 您的AccessKey ID
access-key-secret: # 您的AccessKey Secret
sign-name: # 短信签名
template-code: # 短信模板CODE
```
1. 创建阿里云账号并开通短信服务
- 访问[阿里云短信服务控制台](https://dysms.console.aliyun.com/)
- 开通短信服务
2. 创建短信签名(sign-name
- 登录[短信服务控制台](https://dysms.console.aliyun.com/)
- 选择国内/国际短信服务
- 进入"签名管理"页面,点击"添加签名"
- 填写签名信息并提交审核
- 等待签名审核通过
3. 创建短信模板(template-code
- 进入"模板管理"页面
- 点击"添加模板"
- 创建如下内容的模板(阿里云占位符语法为 `${...}`,且模板必须恰好声明这三个变量——多一个少一个都会报"模板变量与占位符不一致"错误):
```text
监控项:${instance},告警级别:${priority}。内容:${content}
```
- 提交模板等待审核
4. 获取访问密钥(access-key-id、access-key-secret
:::tip
阿里云官方建议使用 RAM 用户 AccessKey,并进行最小化授权。
:::
- 进入[RAM访问控制](https://ram.console.aliyun.com/users)管理RAM用户
- 创建用户并选择"使用永久 AccessKey 访问"
- 安全保存AccessKey ID和AccessKey Secret
- 为用户授权短信服务权限"AliyunDysmsFullAccess"
现在您可以把这些信息配置到您的hertzbeat应用中。
### uni-sms配置
uni-sms是一个聚合短信服务平台,您可以参考[UniSMS合一短信文档](https://unisms.apistd.com/docs/tutorials)进行配置。
在`application.yml`新增/填写如下uni-sms短信服务配置(参数需替换为您的短信服务器配置)
```yaml
alerter:
sms:
enable: true # 启用配置
type: unisms # 短信服务商类型,设置为unisms
unisms: # 填写uni-sms短信配置
# auth-mode: simple or hmac
auth-mode: simple
access-key-id: YOUR_ACCESS_KEY_ID
# hmac mode need to fill in access-key-secret
access-key-secret: YOUR_ACCESS_KEY_SECRET
signature: YOUR_SMS_SIGNATURE
template-id: YOUR_TEMPLATE_ID
```
1. 注册uni-sms账号
- 访问[uni-sms官网](https://unisms.apistd.com/)
2. 创建短信签名(signature
- 登录[uni-sms控制台](https://unisms.apistd.com/console/)
- 进入"短信报备-签名管理"页面
- 点击"添加签名"
- 填写签名信息并提交审核
- 等待签名审核通过
3. 创建短信模板(template-id
- 进入"短信报备-模板管理"页面
- 点击"添加模板"
- 创建如下格式的模板:
```text
监控项:{instance},告警级别:{priority}。内容:{content}
```
- 提交模板等待审核
4. 获取`access-key-id`和`access-key-secret`
- 登录[uni-sms控制台](https://unisms.apistd.com/console/)
- 进入"凭证管理"页面
- 获取AccessKey ID和AccessKey Secret
- 安全保存AccessKey ID和AccessKey Secret
:::note
UniSMS 提供以下两种鉴权方式共开发者选择,可在控制台-凭证管理中设置,默认为简易模式。
- 简易模式 [默认]:此模式仅核验 AccessKey ID,不对请求参数进行验签,方便开发者快速接入。
- HMAC模式:此模式要求使用 AccessKey Secret 对请求参数进行验签,以加强保障请求的安全与真实性。
:::
### AWS Cloud SMS配置
要激活和使用 AWS Cloud SMS 服务,请参考官方 AWS 文档: [SMS Getting Started Guide](https://docs.aws.amazon.com/sms-voice/latest/userguide/what-is-sms-mms.html)
您可以通过图形界面或 application.yml 文件配置 AWS Cloud SMS 服务。
要使用 application.yml,请添加/填写以下 AWS Cloud SMS 配置(请用您的 SMS 服务器配置信息替换参数):
```yaml
alerter:
sms:
enable: true # Whether to enable
type: aws # SMS provider type, supports "aws"
aws: # AWS Cloud SMS configuration
access-key-id: # Your AccessKey ID
access-key-secret: # Your AccessKey Secret
region: # Region Of Your AWS
```
1. 创建 AWS 账户
- 如果您尚未创建 AWS 账户,请访问 [AWS Cloud SMS Console](https://aws.amazon.com/console/)进行注册。
2. 获取访问密钥凭据(access-key-id, access-key-secret
- 进入 AWS IAM(身份与访问管理)控制台。
- 创建一个具有编程访问权限的 IAM 用户,并附加必要的权限。
- 获取您的 Access Key ID 和 Secret Access Key(配置时需要)。
3. 选择要用于 AWS 终端用户消息传递服务的特定区域
- 选择支持 AWS 终端用户消息传递(SMS 服务)的区域。
- 您可以在 这里 查看支持的区域[guide](https://docs.aws.amazon.com/sms-voice/latest/userguide/phone-numbers-sms-by-country.html).
4. 将 AWS SMS 从沙盒模式移动到生产模式
- 默认情况下,AWS SMS 以沙盒模式运行,在该模式下,短信仅能发送到已验证的电话号码。
要将消息发送到任意号码,您必须将您的账户升级到生产模式。请参考此 指南。 [guide](https://docs.aws.amazon.com/sms-voice/latest/userguide/sandbox.html#sandbox-sms-move-to-production)
5. 验证目标电话号码(适用于沙盒模式)
- 如果您的账户仍处于沙盒模式,您只能向已验证的电话号码发送短信。要添加已验证的号码,请参考此 [guide](https://docs.aws.amazon.com/sms-voice/latest/userguide/verify-destination-phone-number.html)
- 注意: 您不需要创建 Origination Identity 或 Origination Simulator,只需使用 AWS CLI 添加已验证的电话号码。
> 短信模板格式固定如下:“Instance: {}, Priority: {}, Content: {}”
现在,您可以在您的 HertzBeat 应用程序中配置这些信息.
现在您可以把这些信息配置到您的hertzbeat应用中。
### smslocal短信配置
smslocal是一款面向企业的一体化短信服务平台,具备诸如多种发送方式、强大的安全性以及全天候支持等特性。你可以参考 smslocal 的[开发者文档](https://www.smslocal.com/developer/)来进行配置。
在 `application.yml` 中添加/填写以下 smslocal 配置内容(请用你自己的短信服务器配置参数替换相关参数):
```yaml
alerter:
sms:
enable: true # 是否启用
type: smslocal # 短信服务提供商类型,设置为smslocal
smslocal: # smslocal配置
api-key: 在此处填入你的API密钥
```
1. 注册 smslocal 账号
- 访问 [smslocal官网](https://www.smslocal.com/)
2. 获取 `api-key`
- 登录 [smslocal API accessKey访问页面](https://secure.smslocal.com/cpaas/pages/profile/settings/api-reference)
- 进入 “API 访问” 页面
- 点击眼睛图标按钮
- 复制显示的访问密钥
- 然后你就可以配置 `application.yml` 文件了
现在你可以在你的 HertzBeat 应用程序中配置这些信息。
## 操作步骤
1. **【告警通知】->【新增接收人】 ->【选择短信通知方式】**
2. **配置关联的告警通知策略⚠️ 【新增通知策略】-> 【关联刚才设置的接收人】-> 【确认】**
> **注意⚠️ 新增接收人并不代表就生效能收到告警信息,还需要配置关联的告警通知策略,即指定哪些消息发给哪些接收人。**
如有问题可通过交流群ISSUE反馈!
@@ -0,0 +1,67 @@
---
id: alert_telegram
title: 告警 Telegram 机器人通知
sidebar_label: 告警 Telegram 机器人通知
keywords: [告警 Telegram 通知, 开源告警系统, 开源监控告警系统]
---
> 阈值触发后发送告警信息,通过 Telegram 机器人通知到接收人。
## 操作步骤
> 部署网络本身需支持科学上网,不支持设置代理
### 在 Telegram 创建机器人, 获取 Bot Token 和 UserId
1. 使用 [@BotFather](https://t.me/BotFather) 创建自己的机器人并获取访问令牌`Token`
![telegram-bot](/img/docs/help/telegram-bot-1.png)
2. 获取接收人的 `User ID`
**使用您要通知的接收人账户给刚创建 Bot 账户随便发送一个信息**,
访问 ```https://api.telegram.org/bot`<TOKEN>`/getUpdates``` , **`使用上一步的 Bot Token 替换其中的<TOKEN>`**, 响应`Json`数据中第一个`result.message.from.id` 值即为接收人的 `User ID`
```json
{
"ok":true,
"result":[
{
"update_id":632299191,
"message":{
"from":{
"id": "User ID"
},
"chat":{
},
"date":1673858065,
"text":"111"
}
}
]
}
```
3. 记录保存我们获得的 `Token` 和 `User Id`
### 在 HertzBeat 新增告警通知人,通知方式为 Telegram Bot
1. **【告警通知】->【新增接收人】 ->【选择 Telegram 机器人通知方式】->【设置机器人Token和UserId】-> 【确定】**
![email](/img/docs/help/telegram-bot-2.png)
2. **配置关联的告警通知策略⚠️ 【新增通知策略】-> 【将刚设置的接收人关联】-> 【确定】**
> **注意⚠️ 新增了接收人并不代表已经生效可以接收告警信息,还需配置关联的告警通知策略,即指定哪些消息发给哪些接收人**。
![email](/img/docs/help/alert-notice-policy.png)
### Telegram 机器人通知常见问题
1. Telegram 未收到机器人告警通知
> 请排查在告警中心是否已有触发的告警信息
> 请排查是否配置正确机器人Token, UserId,是否已配置告警策略关联
> UserId 应为消息接收对象的UserId
其它问题可以通过交流群ISSUE反馈哦!
@@ -0,0 +1,196 @@
---
id: alert_threshold
title: 告警阈值规则配置
sidebar_label: 阈值规则
---
:::tip
告警阈值规则是 `HertzBeat` 的核心功能,用户可以通过阈值规则来配置告警的触发条件。
阈值规则支持实时阈值和计划阈值,可应用于**监控指标**和**日志数据**两种数据类型。实时阈值可以在监控数据采集时直接触发告警,计划阈值支持 PromQL、SQL 等表达式在指定时间段内计算触发告警。
支持可视化页面配置或更高灵活性的表达式规则配置,支持配置触发次数,告警级别,通知模板,关联指定监控等。通知模板已支持对象嵌套访问,可以更灵活地展示告警信息。
:::
![threshold](/img/docs/help/alert-threshold-1.png)
## 实时阈值
> 实时阈值是指在监控数据采集时直接触发告警,适用于对实时性要求较高的场景。支持监控指标和日志数据两种数据类型。
### 创建实时阈值规则
> 系统页面 -> 告警 -> 告警阈值 -> 新增阈值 -> 选择实时阈值 -> 选择数据类型(监控指标/日志数据)
#### 监控指标实时阈值
配置阈值,例如: 选择SSL证书指标对象,配置告警表达式-当指标`expired``true`触发,即`equals(expired,"true")` , 设置告警级别通知模板信息等。
![HertzBeat](/img/docs/start/ssl_5.png)
配置项说明:
- **阈值名称**:定义此阈值规则的唯一名称
- **数据类型**:选择监控指标或日志数据
- **指标对象**:选择我们需要配置阈值的监控指标对象 例如:网站监控类型下的 -> 响应时间指标
- **阈值规则**:配置具体指标的告警触发规则,支持图形界面和表达式规则,表达式环境变量和操作符见页面提示。阈值表达式详细帮助见 [阈值表达式帮助](alert_threshold_expr)
- **关联监控**:应用此阈值规则到指定的监控对象(支持直接绑定和标签关联),若未配置,则应用到所有符合此阈值类型规则的监控对象上。
- **告警级别**:触发阈值的告警级别,从低到高依次为:警告-warning,严重-critical,紧急-emergency
- **触发次数**:设置触发阈值多少次之后才会真正的触发告警
- **通知模板**:告警触发后发送的通知信息模板,模板环境变量见页面提示,支持对象嵌套访问,例如:`__instancename__` 指标的值为 `responseTime`,大于 50 触发告警,也可以访问对象属性如 `${log.attributes.hostname}`
- **附加标签**:给此阈值规则附加标签,当产生告警时,此标签也会附加到告警上。
- **附加声明**:给此阈值规则附加声明信息(声明内容支持环境变量),当产生告警时,此声明信息会被渲染并附加到告警上。
- **启用告警**:此告警阈值配置开启生效或关闭
#### 日志数据实时阈值
针对日志数据配置实时告警规则,支持对日志内容、属性、资源信息等进行条件判断。
例如,当 300s 内收到 60 次错误日志时触发告警。
![log_realtime](/img/docs/help/alert-threshold-3.png)
配置项说明:
- **阈值名称**:定义此阈值规则的唯一名称
- **数据类型**:选择日志数据
- **阈值规则**:配置日志告警触发规则,支持图形界面和表达式规则:
- **图形界面**:可视化配置日志字段条件,支持 `log.level``log.message``log.attributes.*``log.resource.*` 等字段
- **表达式规则**:使用自定义表达式,支持对象嵌套访问,例如:`equals(log.level,"ERROR")``contains(log.attributes.hostname,"server-01")`
- **时间窗口**:设置日志聚合的时间窗口,单位为秒,最小60秒。在此时间窗口内的日志会被聚合处理
- **告警级别**:触发阈值的告警级别,从低到高依次为:警告-warning,严重-critical,紧急-emergency
- **告警模式**:选择告警发送方式:
- **窗口组模式(group)**:将时间窗口内满足条件的所有日志作为一个告警发送
- **单条模式(individual)**:每条满足条件的日志都单独发送告警
- **触发次数**:设置在时间窗口内满足条件的日志数量达到多少次后才触发告警
- **通知模板**:告警触发后发送的通知信息模板,支持对象嵌套访问:
- 基本变量:``__instancename__``、``__alertname__`` 等
- 日志字段:`${log.level}``${log.message}``${log.timestamp}`
- 嵌套属性:`${log.attributes.hostname}``${log.resource.service.name}`
- **附加标签**:给此阈值规则附加标签,当产生告警时,此标签也会附加到告警上
- **附加声明**:给此阈值规则附加声明信息(声明内容支持环境变量),当产生告警时,此声明信息会被渲染并附加到告警上
- **启用告警**:此告警阈值配置开启生效或关闭
**阈值告警配置完毕,已经被成功触发的告警信息可以在【告警中心】看到。**
**若需要将告警信息邮件,微信,钉钉飞书通知给相关人员,可以在【消息通知】配置。**
## 计划阈值
> 计划阈值规则是指系统按照设定的周期性时间间隔,执行一次表达式规则(如 PromQL、SQL),以判断指定时间范围内的监控数据或日志数据是否满足告警条件。这类规则适用于需要评估趋势或聚合数据的场景,而不是对单个实时数据点做出立即反应。支持监控指标和日志数据两种数据类型。
### 计划阈值表达式语法
计划阈值使用基于 ANTLR 语法的专用表达式语言,根据数据类型支持不同的查询语法:
#### 监控指标表达式语法(PromQL)
支持 PromQL 风格的查询,具体语法请查询配置的时序数据库官网关于 PromQL 的文档:
1. **查询表达式**: 引用监控数据
```text
cpu_usage
memory{__field__="field1"}
```
2. **比较表达式**: 将值与阈值进行比较
```text
cpu_usage > 80
memory_usage >= 90.5
response_time < 1000
```
3. **逻辑表达式**: 组合多个条件
```text
cpu_usage > 80 and memory_usage > 70
disk_usage > 90 or inode_usage > 85
cpu_usage > 80 unless maintenance_mode == 1
```
4. **括号表达式**: 控制求值顺序
```text
(cpu_usage > 80 or memory_usage > 90) and service_status == 1
```
#### 日志数据表达式语法(SQL)
支持标准 SQL 语法查询日志数据并过滤数据,可以对日志表进行聚合查询:
```sql
-- 查询错误日志数量
SELECT COUNT(*) as error_count
FROM hertzbeat_logs
WHERE level = 'ERROR'
AND timestamp >= NOW() - INTERVAL 5 MINUTE
-- 按服务分组统计错误数
SELECT service_name, COUNT(*) as error_count
FROM hertzbeat_logs
WHERE level = 'ERROR'
GROUP BY service_name
HAVING COUNT(*) > 10
```
### 创建计划阈值规则
> 系统页面 -> 告警 -> 告警阈值 -> 新增阈值 -> 选择计划阈值 -> 选择数据类型(监控指标/日志数据)
#### 监控指标计划阈值
针对监控指标配置计划阈值,例如:针对一组 CPU 指标,设定表达式 `cpu_usage{instance="server1"}` > 80`,当满足该表达式时触发告警。
![threshold](/img/docs/help/alert-threshold-2.png)
配置项说明:
- **规则名称**:用于唯一标识该阈值规则的名称
- **数据类型**:选择监控指标
- **查询语言**:选择 PromQL 作为查询语言
- **阈值表达式**:用于定义告警条件的 PromQL 表达式,系统会按照"执行周期"定期对其进行评估。表达式支持:
- **查询标识符**: 引用监控指标(如 `cpu_usage`, `memory{instance="server1"}`
- **比较操作符**: `>`, `>=`, `<`, `<=`, `==`, `!=`
- **逻辑操作符**: `and`, `or`, `unless`
- **括号**: 用于分组和控制求值顺序
- **数字字面量**: 阈值(如 `80`, `90.5`
- **执行周期**:表达式的执行时间间隔,单位为秒。例如 `300` 表示每 5 分钟评估一次表达式
- **告警级别**:设定当触发告警时的日志级别,包括:`warning`(警告)、`critical`(严重)、`emergency`(紧急)
- **触发次数**:表达式连续满足告警条件的次数,超过该次数后才实际触发告警
- **通知模板**:当告警被触发后发送的通知内容模板,支持对象嵌套访问,页面上提供了可用的模板变量供参考
- **附加标签**:给此阈值规则附加标签,当产生告警时,此标签也会附加到告警上
- **附加声明**:给此阈值规则附加声明信息(声明内容支持环境变量),当产生告警时,此声明信息会被渲染并附加到告警上
- **启用告警**:用于控制该阈值规则是否启用
#### 日志数据计划阈值
针对日志数据配置计划阈值,通过 SQL 查询对日志进行聚合分析和告警判断。
![threshold](/img/docs/help/alert-threshold-4.png)
配置项说明:
- **规则名称**:用于唯一标识该阈值规则的名称
- **数据类型**:选择日志数据
- **查询语言**:选择 SQL 作为查询语言
- **日志查询表达式**:使用标准 SQL 语法查询日志数据,支持聚合函数、分组、过滤等操作。例如:
```sql
SELECT COUNT(*) as error_count FROM hertzbeat_logs
WHERE level = 'ERROR' AND timestamp >= NOW() - INTERVAL 5 MINUTE
```
- **执行周期**:SQL 查询的执行时间间隔,单位为秒。例如 `300` 表示每 5 分钟执行一次查询
- **告警级别**:设定当触发告警时的日志级别,包括:`warning`(警告)、`critical`(严重)、`emergency`(紧急)
- **告警模式**:选择告警发送方式:
- **窗口组模式(group)**:将查询结果作为一个整体告警发送
- **单条模式(individual)**:查询结果中的每行数据都单独发送告警
- **触发次数**:查询结果连续满足告警条件的次数,超过该次数后才实际触发告警
- **通知模板**:当告警被触发后发送的通知内容模板,支持访问查询结果中的字段,例如:
- 查询结果字段:``error_count``、``service_name`` 等
- 基本变量:``__alertname__``、``__severity__`` 等
- **附加标签**:给此阈值规则附加标签,当产生告警时,此标签也会附加到告警上
- **附加声明**:给此阈值规则附加声明信息(声明内容支持环境变量),当产生告警时,此声明信息会被渲染并附加到告警上
- **启用告警**:用于控制该阈值规则是否启用
**阈值规则配置完成后,成功触发的告警将显示在【告警中心】中。**
**如需通过邮件、企业微信、钉钉、飞书等方式发送告警通知,请前往【通知配置】中进行设置。**
@@ -0,0 +1,67 @@
---
id: alert_threshold_expr
title: 阈值触发表达式
sidebar_label: 阈值触发表达式
---
> 在我们配置阈值告警时,需要配置阈值触发表达式,系统根据表达式和监控指标值计算触发是否告警,这里详细介绍下表达式使用。
## 表达式支持的操作符
| 运算符(可视化配置) | 运算符(表达式配置) | 支持类型 | 说明 | |
| ------------------ | -------------------- | ----------------------- | ------------------------ | - |
| 等于 | equals(str1,str2) | 字符型 | 判断字符串是否相等 | |
| 不等于 | !equals(str1,str2) | 字符型 | 判断字符串是否不相等 | |
| 包含 | contains(str1,str2) | 字符型 | 判断字符串是否包含 | |
| 不包含 | !contains(str1,str2) | 字符型 | 判断字符串是否不包含 | |
| 匹配 | matches(str1,str2) | 字符型 | 判断字符串正则是否匹配 | |
| 不匹配 | !matches(str1,str2) | 字符型 | 判断字符串正则是否不匹配 | |
| 存在值 | exists(obj) | 字符型、数值型、时间型 | 判断字符是否有值存在 | |
| 不存在值 | !exists(obj) | 字符型 、数值型、时间型 | 判断字符是否有值存在 | |
| > | obj1 > obj2 | 数值型、时间型 | 判断数值是否大于 | |
| `<` | `obj1 < obj2` | 数值型、时间型 | 判断数值是否小于 | |
| >= | obj1 >= obj2 | 数值型、时间型 | 判断数值是否大于等于 | |
| `<=` | `obj1 <= obj2` | 数值型、时间型 | 判断数值是否小于等于 | |
| != | obj1 != obj2 | 数值型、时间型 | 判断数值是否不相等 | |
| == | obj1 == obj2 | 数值型、时间型 | 判断数值是否相等 | |
### 表达式函数库列表
| 支持函数库 | 说明 |
|----------------------------------------------|-----------------------------------|
| condition ? trueExpression : falseExpression | 三元运算符 |
| toDouble(str) | 将字符串转换为Double类型 |
| toBoolean(str) | 将字符串转换为Boolean类型 |
| toInteger(str) | 将字符串转换为Integer类型 |
| array[n] | 取数组第n个元素 |
| * | 算法乘 |
| / | 算法除 |
| % | 求余 |
| ( 和 ) | 括号用于控制运算的优先级,确保在逻辑或数学表达式中某些部分先被计算 |
| + | 加号用于表示数学中的加法运算、字符串拼接 |
| - | 减号用于表示数学中的减法运算 |
| && | 逻辑AND操作符 |
| \|\| | 逻辑OR操作符 |
#### 支持的环境变量
> 环境变量即指标值等支持的变量,用于在表达式中,阈值计算判断时会将变量替换成实际值进行计算
非固定环境变量:这些变量会根据我们选择的监控指标对象而动态变化,例如我们选择了**网站监控的响应时间指标**,则环境变量就有 `responseTime - 此为响应时间变量`
如果我们想设置**网站监控的响应时间大于400时**触发告警,则表达式为 `responseTime>400`
固定环境变量(不常用)`instance : 所属行实例值`
此变量主要用于计算多实例时,比如采集到c盘d盘的`usage`(`usage为非固定环境变量`),我们只想设置**c盘的usage大于80**时告警,则表达式为 `equals(instance,"c")&&usage>80`
#### 表达式设置案例
1. 网站监控->响应时间大于等于400ms时触发告警
`responseTime>=400`
2. API监控->响应时间大于3000ms时触发告警
`responseTime>3000`
3. 全站监控->URL(instance)路径为 `https://baidu.com` 的响应时间大于200ms时触发告警
`equals(instance,"https://baidu.com")&&responseTime>200`
4. MYSQL监控->status指标->threads_running(运行线程数)指标大于7时触发告警
`threads_running>7`
若遇到问题可以通过交流群ISSUE交流反馈哦!
@@ -0,0 +1,66 @@
---
id: alert_webhook
title: 告警 Webhook 回调通知
sidebar_label: 告警 Webhook 回调通知
keywords: [告警 Webhook 回调通知, 开源告警系统, 开源监控告警系统]
---
> 阈值触发后发送告警信息,通过post请求方式调用WebHook接口通知到接收人。
## 操作步骤
1. **【告警通知】->【新增接收人】 ->【选择WebHook通知方式】-> 【设置WebHook回调地址】 -> 【确定】**
![email](/img/docs/help/alert-notice-5.png)
2. **配置关联的告警通知策略⚠️ 【新增通知策略】-> 【将刚设置的接收人关联】-> 【确定】**
> **注意⚠️ 新增了接收人并不代表已经生效可以接收告警信息,还需配置关联的告警通知策略,即指定哪些消息发给哪些接收人**。
![email](/img/docs/help/alert-notice-4.png)
### WebHook回调POST请求体BODY内容
内容格式:JSON
```json
{
"alarmId": 76456,
"target": "`target`",
"thresholdId": 33455,
"priority": 0,
"content": "udp_port monitoring availability alert, code is FAIL",
"status": 0,
"times": 1,
"triggerTime": "2022-02-25T13:32:13",
"tags": {
"app": "windows",
"monitorId": "180427708350720",
"metrics": "availability",
"code": "UN_CONNECTABLE",
"thresholdId": "112",
"monitorName": "WINDOWS_192.168.124.12"
}
}
```
| | |
|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| alarmId | integer($int64) title: Alarm record entity primary key index ID 告警记录实体主键索引ID |
| target | string title: Alert target object: monitor availability-available metrics-app.metrics.field 告警目标对象: 监控可用性-available 指标-app.metrics.field |
| thresholdId | integer($int64) title: Alarm definition ID associated with the alarm 告警关联的告警定义ID |
| priority | string($byte) title: Alarm level 0: high-emergency-critical alarm-red 1: medium-critical-critical alarm-orange 2: low-warning-warning alarm-yellow 告警级别 0:高-emergency-紧急告警-红色 1:中-critical-严重告警-橙色 2:低-warning-警告告警-黄色 |
| content | string title: The actual content of the alarm notification 告警通知实际内容 |
| status | string($byte) title: Alarm status: 0-normal alarm (to be processed) 1-threshold triggered but not reached the number of alarms 2-recovered alarm 3-processed 告警状态: 0-正常告警(待处理) 1-阈值触发但未达到告警次数 2-恢复告警 3-已处理 |
| times | integer($int32) title: Alarm threshold trigger times 告警阈值触发次数 |
| triggerTime | integer($int64) title: Alarm trigger time (timestamp in milliseconds) 首次告警触发时间(毫秒时间戳) |
| tags | example: `{key1:value1}` |
### webhook通知常见问题
1. WebHook回调未生效
> 请查看告警中心是否已经产生此条告警信息
> 请排查配置的WebHook回调地址是否正确
其它问题可以通过交流群ISSUE反馈哦!
@@ -0,0 +1,39 @@
---
id: alert_wework
title: 告警企业微信通知
sidebar_label: 告警企业微信通知
keywords: [告警企业微信通知, 开源告警系统, 开源监控告警系统]
---
> 阈值触发后发送告警信息,通过企业微信机器人通知到接收人。
## 操作步骤
1. **【企业微信端】-> 【群设置】-> 【群机器人】-> 【添加新建机器人】-> 【设置机器人名称头像】-> 【添加成功后复制其WebHook地址】**
![email](/img/docs/help/alert-notice-6.jpg)
2. **【保存机器人的WebHook地址的KEY值】**
> 例如: webHook地址:`https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=3adafc96-23d0-4cd5-8feb-17f6e0b5fcs4`
>
> 其机器人KEY值为 `3adafc96-23d0-4cd5-8feb-17f6e0b5fcs4`
3. **【告警通知】->【新增接收人】 ->【选择企业微信机器人通知方式】->【设置企业微信机器人KEY】-> 【确定】**
![email](/img/docs/help/alert-notice-7.png)
4. **配置关联的告警通知策略⚠️ 【新增通知策略】-> 【将刚设置的接收人关联】-> 【确定】**
> **注意⚠️ 新增了接收人并不代表已经生效可以接收告警信息,还需配置关联的告警通知策略,即指定哪些消息发给哪些接收人**。
![email](/img/docs/help/alert-notice-4.png)
### 企业微信机器人通知常见问题
1. 企业微信群未收到机器人告警通知
> 请排查在告警中心是否已有触发的告警信息
> 请排查是否配置正确机器人KEY,是否已配置告警策略关联
其它问题可以通过交流群ISSUE反馈哦!
@@ -0,0 +1,114 @@
---
id: almalinux
title: 监控:AlmaLinux操作系统监控
sidebar_label: AlmaLinux 操作系统
keywords: [开源监控系统, 开源操作系统监控, AlmaLinux操作系统监控]
---
> 对AlmaLinux操作系统的通用性能指标进行采集监控。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|---------------------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | Linux SSH对外提供的端口,默认为22。 |
| 超时时间 | 设置连接的超时时间,单位ms毫秒,默认6000毫秒。 |
| 复用连接 | 设置SSH连接是否复用,默认为:false。为false每次获取信息都会创建一个连接 |
| 使用代理 | 设置是否通过代理连接,默认为false。 |
| 用户名 | SSH连接用户名,可选 |
| 密码 | SSH连接密码,可选 |
| 采集器 | 配置此监控使用哪台采集器调度采集 |
| 监控周期 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 绑定标签 | 用于对监控资源进行分类管理 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
| 私钥 | 连接服务器所需的私钥 |
| 密钥短语 | 用于加密 SSH 私钥的密码短语(Passphrase)。如果私钥在生成时设置了密码短语,则必须填写此字段才能解密并使用私钥进行认证。 |
| 代理主机 | 代理服务器的地址,支持 IPV4、IPV6或域名。若使用 SSH 代理跳转访问目标主机,需填写代理服务器的地址。 |
| 代理端口 | 代理服务器的端口号。 |
| 代理用户名 | 连接代理服务器时所需的认证用户名。 |
| 代理密码 | 连接代理服务器时所需的认证密码。 |
| 代理主机私钥 | 连接代理服务器时所需的私钥。 |
### 采集指标
#### 指标集合:系统基本信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------|------|--------|
| hostname | 无 | 主机名称 |
| version | 无 | 操作系统版本 |
| uptime | 无 | 启动时间 |
#### 指标集合:CPU 信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|--------------------|
| info | 无 | CPU型号 |
| cores | 无 | CPU内核数量 |
| interrupt | 无 | CPU中断数量 |
| load | 无 | CPU最近1/5/15分钟的平均负载 |
| context_switch | 无 | 当前上下文切换数量 |
| usage | % | CPU使用率 |
#### 指标集合:内存信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|----------|
| total | Mb | 总内存容量 |
| used | Mb | 用户程序内存量 |
| free | Mb | 空闲内存容量 |
| buff_cache | Mb | 缓存占用内存 |
| available | Mb | 剩余可用内存容量 |
| usage | % | 内存使用率 |
#### 指标集合:磁盘信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------------|------|-----------|
| disk_num | 无 | 磁盘总数 |
| partition_num | 无 | 分区总数 |
| block_write | 无 | 写入磁盘的总块数 |
| block_read | 无 | 从磁盘读出的块数 |
| write_rate | iops | 每秒写磁盘块的速率 |
#### 指标集合:网卡信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|---------------|
| interface_name | 无 | 网卡名称 |
| receive_bytes | Byte | 入站数据流量(bytes) |
| transmit_bytes | Byte | 出站数据流量(bytes) |
#### 指标集合:文件系统
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|---------|
| filesystem | 无 | 文件系统的名称 |
| used | Mb | 已使用磁盘大小 |
| available | Mb | 可用磁盘大小 |
| usage | % | 使用率 |
| mounted | 无 | 挂载点目录 |
#### 指标集合:Top10 CPU进程
统计进程使用CPU的Top10进程。统计信息包括:进程ID、CPU占用率、内存占用率、执行命令。
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| pid | 无 | 进程ID |
| cpu_usage | % | CPU占用率 |
| mem_usage | % | 内存占用率 |
| command | 无 | 执行命令 |
#### 指标集合:Top10 内存进程
统计进程使用内存的Top10进程。统计信息包括:进程ID、内存占用率、CPU占用率、执行命令。
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| pid | 无 | 进程ID |
| mem_usage | % | 内存占用率 |
| cpu_usage | % | CPU占用率 |
| command | 无 | 执行命令 |
@@ -0,0 +1,36 @@
---
id: api
title: 监控:HTTP API
sidebar_label: HTTP API
keywords: [ 开源监控系统, 开源网站监控, HTTP API监控 ]
---
> 调用HTTP API接口,查看接口是否可用,对其响应时间等指标进行监测
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------------|-------------------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | 网站对外提供的端口,http一般默认为80,https一般默认为443。 |
| 相对路径 | 网站地址除IP端口外的后缀路径,例如 `www.tancloud.io/console` 网站的相对路径为 `/console`。 |
| 请求方式 | 设置接口调用的请求方式:GET,POST,PUT,DELETE。 |
| 启用HTTPS | 是否通过HTTPS访问网站,注意⚠️开启HTTPS一般默认对应端口需要改为443 |
| 用户名 | 接口Basic认证或Digest认证时使用的用户名 |
| 密码 | 接口Basic认证或Digest认证时使用的密码 |
| 请求Headers | HTTP 请求头 |
| 查询Params | HTTP查询参数,支持[时间表达式](time_expression) |
| Content-Type | 设置携带BODY请求体数据请求时的资源类型 |
| 请求BODY | 设置携带BODY请求体数据,PUT POST请求方式时有效,支持[时间表达式](time_expression) |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:summary
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------------|------|--------|
| responseTime | ms毫秒 | 网站响应时间 |
@@ -0,0 +1,57 @@
---
id: apollo
title: 监控:Apollo配置中心
sidebar_label: Apollo配置中心
keywords: [ 开源监控系统, 开源中间件监控, Apollo配置中心监控 ]
---
> 通过调用 Apollo配置中心 Prometheus 接口对 Apollo配置中心服务的通用指标进行采集监控。
## 前置条件
1. 按照[部署文档](https://www.apolloconfig.com/#/en/deployment/quick-start)搭建好Apollo配置中心。
2. 访问```http://${someIp:somePort}/prometheus```,查看是否能访问到metrics数据。
详情请参考:[Apollo 监控相关](https://www.apolloconfig.com/#/en/design/apollo-design?id=v-monitoring-related)
3. 注意⚠️:从1.5.0版本开始,Apollo服务端支持通过/prometheus暴露prometheus格式的metrics
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|------------------------------------------------------|
| 目标Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 端口 | Pulsar的webServiceProt值,默认为8080。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 查询超时时间 | 设置连接的超时时间,单位ms毫秒,默认3000毫秒。 |
| 监控周期 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 绑定标签 | 用于对监控资源进行分类管理 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:基础信息指标
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------------------------------|------|---------------|
| application_ready_time_seconds | 秒 | 应用从启动到就绪状态的耗时 |
| process_uptime_seconds | 秒 | 进程已运行的总时间 |
| process_cpu_usage | % | 当前进程的CPU使用率 |
#### 指标集合:jvm
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------------------------------|------|------------------|
| system_cpu_usage | % | 系统CPU使用率 |
| system_load_average_1m | 无 | 系统最近一分钟平均负载 |
| jvm_memory_committed_bytes | MB | JVM已向操作系统申请的内存大小 |
| jvm_memory_used_bytes | MB | JVM当前实际使用的内存大小 |
| jvm_memory_max_bytes | MB | JVM可使用的最大内存限制 |
| jvm_gc_pause_seconds_count | 无 | JVM GC暂停事件的总次数 |
| jvm_gc_pause_seconds_sum | 无 | JVM GC暂停的总耗时 |
| jvm_memory_usage_after_gc_percent | 无 | JVM GC后的内存使用率 |
#### 指标集合:系统资源
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------------------------|------|--------------------|
| process_files_max_files | 无 | 允许进程打开的最大文件描述符数量限制 |
| process_files_open_files | 无 | 进程当前已打开的文件描述符数量 |
@@ -0,0 +1,48 @@
---
id: bulletin
title: 自定义看板
sidebar_label: 自定义看板
keywords: [ 看板, 自定义 ]
---
> 自定义监控看板,以表格形式展示某种监控的自选指标。
## 新增看板项
1. 点击工具栏上的`新增`按钮,打开看板创建弹窗。
2. 输入`看板名称`,选择`监控类型`,再选择关联的`监控任务名称`
- `监控任务名称`为多选项,可在其搜索框中按**名称、标签键或标签值**进行筛选;每个选项还会以 `键:值` 标签的形式展示其标签。
3.`监控指标`树中勾选需要展示的指标。树按指标分组,勾选父节点即可一次性选中其下所有字段。
4. 点击`确定`按钮,即可完成自定义看板的创建。
![new-bulletin](/img/docs/help/bulletin-1.png)
## 编辑看板项
1. 在标签页中点击某个看板名称,将其设为当前看板。
2. 点击工具栏上的`...`(更多)按钮,选择`编辑`。弹窗会自动回填当前看板的名称、监控任务和已选指标。
- 编辑时`监控类型`不可修改。如需使用其他监控类型,请新建看板项。
3. 按需调整名称、监控任务或指标,然后点击`确定`保存。
![edit-bulletin](/img/docs/help/bulletin-2.png)
## 查看多个看板
1. 每个看板对应一个标签页,点击标签页中的看板名称,即可查看该看板的详细信息。
![dashboard-bulletin](/img/docs/help/bulletin-3.png)
## 删除看板项
1. 选中要删除的看板,点击工具栏上的`...`(更多)按钮,选择`删除看板项`,即可删除当前看板项。
2. 在同一个`...`菜单中选择`批量删除看板项`,即可选择并一次性删除多个看板项。
![bulletin](/img/docs/help/bulletin-4.png)
@@ -0,0 +1,114 @@
---
id: centos
title: 监控:CentOS操作系统监控
sidebar_label: CentOS 操作系统
keywords: [开源监控系统, 开源操作系统监控, CentOS操作系统监控]
---
> 对CentOS操作系统的通用性能指标进行采集监控。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|---------------------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | Linux SSH对外提供的端口,默认为22。 |
| 超时时间 | 设置连接的超时时间,单位ms毫秒,默认6000毫秒。 |
| 复用连接 | 设置SSH连接是否复用,默认为:false。为false每次获取信息都会创建一个连接 |
| 使用代理 | 设置是否通过代理连接,默认为false。 |
| 用户名 | SSH连接用户名,可选 |
| 密码 | SSH连接密码,可选 |
| 采集器 | 配置此监控使用哪台采集器调度采集 |
| 监控周期 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 绑定标签 | 用于对监控资源进行分类管理 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
| 私钥 | 连接服务器所需的私钥 |
| 密钥短语 | 用于加密 SSH 私钥的密码短语(Passphrase)。如果私钥在生成时设置了密码短语,则必须填写此字段才能解密并使用私钥进行认证。 |
| 代理主机 | 代理服务器的地址,支持 IPV4、IPV6或域名。若使用 SSH 代理跳转访问目标主机,需填写代理服务器的地址。 |
| 代理端口 | 代理服务器的端口号,默认为22。 |
| 代理用户名 | 连接代理服务器时所需的认证用户名。 |
| 代理密码 | 连接代理服务器时所需的认证密码。 |
| 代理主机私钥 | 连接代理服务器时所需的私钥。 |
### 采集指标
#### 指标集合:系统基本信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------|------|--------|
| hostname | 无 | 主机名称 |
| version | 无 | 操作系统版本 |
| uptime | 无 | 启动时间 |
#### 指标集合:CPU 信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|--------------------|
| info | 无 | CPU型号 |
| cores | 无 | CPU内核数量 |
| interrupt | 无 | CPU中断数量 |
| load | 无 | CPU最近1/5/15分钟的平均负载 |
| context_switch | 无 | 当前上下文切换数量 |
| usage | % | CPU使用率 |
#### 指标集合:内存信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|----------|
| total | Mb | 总内存容量 |
| used | Mb | 用户程序内存量 |
| free | Mb | 空闲内存容量 |
| buff_cache | Mb | 缓存占用内存 |
| available | Mb | 剩余可用内存容量 |
| usage | % | 内存使用率 |
#### 指标集合:磁盘信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------------|------|-----------|
| disk_num | 无 | 磁盘总数 |
| partition_num | 无 | 分区总数 |
| block_write | 无 | 写入磁盘的总块数 |
| block_read | 无 | 从磁盘读出的块数 |
| write_rate | iops | 每秒写磁盘块的速率 |
#### 指标集合:网卡信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|---------------|
| interface_name | 无 | 网卡名称 |
| receive_bytes | Byte | 入站数据流量(bytes) |
| transmit_bytes | Byte | 出站数据流量(bytes) |
#### 指标集合:文件系统
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|---------|
| filesystem | 无 | 文件系统的名称 |
| used | Mb | 已使用磁盘大小 |
| available | Mb | 可用磁盘大小 |
| usage | % | 使用率 |
| mounted | 无 | 挂载点目录 |
#### 指标集合:Top10 CPU进程
统计进程使用CPU的Top10进程。统计信息包括:进程ID、CPU占用率、内存占用率、执行命令。
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| pid | 无 | 进程ID |
| cpu_usage | % | CPU占用率 |
| mem_usage | % | 内存占用率 |
| command | 无 | 执行命令 |
#### 指标集合:Top10 内存进程
统计进程使用内存的Top10进程。统计信息包括:进程ID、内存占用率、CPU占用率、执行命令。
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| pid | 无 | 进程ID |
| mem_usage | % | 内存占用率 |
| cpu_usage | % | CPU占用率 |
| command | 无 | 执行命令 |
@@ -0,0 +1,95 @@
---
id: clickhouse
title: 监控:Clickhouse数据库监控
sidebar_label: Clickhouse数据库
keywords: [开源监控系统, 开源数据库监控, Clickhouse数据库监控]
---
> 对Clickhouse数据库的通用性能指标进行采集监控。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | 数据库对外提供的端口,默认为8123。 |
| 查询超时时间 | 设置SQL查询未响应数据时的超时时间,单位ms毫秒,默认6000毫秒。 |
| 数据库名称 | 数据库实例名称,可选。 |
| 用户名 | 数据库连接用户名,可选 |
| 密码 | 数据库连接密码,可选 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 绑定标签 | 用于对监控资源进行分类管理 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:ping 可用性
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------------|------|--------|
| responseTime | 无 | 响应时间 |
#### 指标集合:system.metrics表的数据
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------------|-------|------------------------------|
| Query | 无 | 正在执行的查询的数量 |
| Merge | 无 | 正在执行的后台合并的数量 |
| Move | 无 | 正在执行的后台移动的数量 |
| PartMutation | 无 | 表变更的次数 |
| ReplicatedFetch | 无 | 从副本收集的数据块数量 |
| ReplicatedSend | 无 | 发送到副本的数量块数量 |
| ReplicatedChecks | 无 | 检查一致性的数据块数量 |
| QueryPreempted | 无 | 停止或等待的查询数量 |
| TCPConnection | 无 | TCP连接数量 |
| HTTPConnection | 无 | HTTP连接数量 |
| OpenFileForRead | 无 | 打开的可读文件的数量 |
| OpenFileForWrite | 无 | 打开的可写文件的数量 |
| QueryThread | 无 | 查询处理的线程数量 |
| ReadonlyReplica | 无 | 处于只读状态的 Replicated table 的数量 |
| EphemeralNode | 无 | ZooKeeper 中保存的临时节点数 |
| ZooKeeperWatch | 无 | ZooKeeper事件订阅数 |
| StorageBufferBytes | Bytes | Buffer tables 中的字节数 |
| VersionInteger | 无 | ClickHouse 版本号 |
| RWLockWaitingReaders | 无 | 等待读表的读写锁的线程数量 |
| RWLockWaitingWriters | 无 | 等待写表的读写锁的线程数量 |
| RWLockActiveReaders | 无 | 在一个表的读写锁中持有读锁的线程数 |
| RWLockActiveWriters | 无 | 在一个表的读写锁中持有写锁的线程数 |
| GlobalThread | 无 | 全局线程池中的线程数 |
| GlobalThreadActive | 无 | 全局线程池中活跃的线程数 |
| LocalThread | 无 | 本地线程池中的线程数 |
| LocalThreadActive | 无 | 本地线程池中活跃的线程数 |
#### 指标集合:system.events表的数据
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------------------------------|-------|------------------------------------------------------------------------------------------------|
| Query | 无 | 要解释和可能执行的查询数量。 不包括由于 AST 大小限制、配额限制或同时运行的查询数量限制而无法解析或被拒绝的查询。 可能包括 ClickHouse 本身发起的内部查询。 不计算子查询。 |
| SelectQuery | 无 | 可能执行的 Select 查询数 |
| InsertQuery | 无 | 可能执行的 Insert 查询数 |
| InsertedRows | 无 | 被插入到所有表中的行数 |
| InsertedBytes | Bytes | 被插入到所有表中的字节数 |
| FailedQuery | 无 | 执行失败的查询数量 |
| FailedSelectQuery | 无 | 执行失败的 Select 查询数量 |
| FileOpen | 无 | 文件打开数 |
| MergeTreeDataWriterRows | 无 | 写入 MergeTree 表的数据行数 |
| MergeTreeDataWriterCompressedBytes | Bytes | 压缩写入 MergeTree 表的数据字节数 |
#### 指标集合:system.asynchronous_metrics表的数据
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------------------------------------|------|----------------------------------|
| AsynchronousMetricsCalculationTimeSpent | 无 | 异步指标计算花费的时间(秒) |
| jemalloc.arenas.all.muzzy_purged | 无 | 被清除的模糊(muzzy)页的数量 |
| jemalloc.arenas.all.dirty_purged | 无 | 被清除的脏 (dirty)页的数量 |
| BlockReadBytes_ram1 | 无 | ram1 块读取的字节数 |
| jemalloc.background_thread.run_intervals | 无 | jemalloc 后台线程的运行间隔数 |
| BlockQueueTime_nbd13 | 无 | nbd13 块队列等待时间 |
| jemalloc.background_thread.num_threads | 无 | jemalloc 后台线程的数量 |
| jemalloc.resident | 无 | jemalloc 分配器占用的物理内存大小(字节) |
| InterserverThreads | 无 | Interserver 线程数 |
| BlockWriteMerges_nbd7 | 无 | nbd7 块写合并数量 |
| MarkCacheBytes | 无 | StorageMergeTree 的 marks 的缓存大小 |
| MarkCacheFiles | 无 | StorageMergeTree 的 marks 的缓存文件数量 |
| MaxPartCountForPartition | 无 | partitions 中最大的活跃数据块的数量 |
@@ -0,0 +1,108 @@
---
id: consul_sd
title: 监控:Consul服务发现监控
sidebar_label: Consul服务发现
keywords: [开源监控系统, 开源服务发现监控, Consul服务发现监控]
---
> HertzBeat 集成 Consul 注册中心,自动发现服务实例并为发现的实例创建监控任务。
## 概述
Consul 服务发现允许 HertzBeat 连接到您的 Consul 服务器并自动发现所有注册的服务实例。当新服务实例注册或现有实例下线时,HertzBeat 将自动创建或删除相应的监控任务,实现微服务环境下的自动化监控。
### 监控前操作
#### 部署 Consul 服务器
1. 根据 [Consul 官方文档](https://developer.hashicorp.com/consul/docs/fundamentals/install)部署 Consul 服务器。
2. 确保 Consul 服务器可从 HertzBeat 访问。
3. 验证您可以访问 Consul UI`http://your-consul-server:8500/ui/`
4. 确保 Consul HTTP API 可访问(默认端口:8500)
### 配置参数
| 参数名称 | 参数帮助描述 |
|--------------|-----------------------------------------------------|
| 任务名称 | 标识此监控的名称,名称需要保证唯一性 |
| Consul Host | Consul 服务器 IP 地址或域名。注意⚠️不带协议头(例如: https://, http://)。示例:`consul-server``192.168.1.100` |
| Consul 端口 | Consul 服务器对外提供的端口,默认为 8500 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 使用步骤
1. **创建服务发现监控**
- 在 HertzBeat Web 界面中,导航到 **监控****新增监控**
- 选择监控类型:**Consul服务发现**
- 填写基本配置参数
2. **配置监控模板**
- 创建服务发现监控后,需要指定一个监控模板
- 模板定义了为发现的服务实例创建什么类型的监控
- 例如:如果发现的实例是 HTTP 服务,可以选择 HTTP 监控模板
- 常用模板类型:端口、HTTP、HTTPS、Ping 等
3. **自动发现**
- HertzBeat 会根据采集间隔定期查询 Consul 服务器
- 为新注册的服务实例自动创建监控任务
- 自动删除已下线服务实例的监控任务
4. **查看发现的实例**
- 在监控列表中,您可以看到所有自动创建的子监控任务
- 每个子监控任务对应一个发现的服务实例
### 使用示例
假设您的 Consul 服务器运行在 `192.168.1.100:8500`,您希望自动监控其中注册的所有服务实例。
配置示例:
- **任务名称**`Consul-Service-Discovery`
- **Consul Host**`192.168.1.100`
- **Consul 端口**`8500`
- **采集间隔**`60`
- **监控模板**:选择 `端口` 监控(检测实例可用性)
配置完成后:
1. HertzBeat 通过 HTTP API 连接到 Consul 服务器
2. 获取所有已注册的服务实例
3. 为每个实例自动创建端口监控(例如:`api-service-192.168.1.101:8080`
4. 每 60 秒检查一次新注册或下线的服务,并相应地更新监控任务
### 注意事项
- **网络连通性**:确保 HertzBeat 可以访问 Consul 服务器地址和端口(默认:8500)
- **监控模板**:服务发现仅发现服务实例地址,您需要配置合适的监控模板来实际监控这些实例
- **采集间隔**:建议最小间隔为 60 秒,避免对 Consul 服务器造成过多请求
- **ACL 令牌**:如果 Consul 配置了 ACL(访问控制列表),可能需要配置相应的令牌
- **服务健康状态**:Consul 服务发现会同时发现健康和不健康的实例
- **数据中心**:默认发现本地数据中心的服务。如果需要发现特定数据中心的服务,可能需要额外配置
- **实例命名**:自动创建的监控任务命名格式为:`{服务名}-{主机}:{端口}`
### 采集指标
#### 指标集合:监控目标
| 指标名称 | 指标单位 | 指标帮助描述 |
|------|-------|---------------|
| 目标 | 无 | 发现的服务实例目标 |
| 主机 | 无 | 服务实例主机地址 |
| 端口 | 无 | 服务实例端口号 |
### 适用场景
- **微服务架构**:自动监控 Consul 中注册的所有微服务实例
- **服务网格**:监控使用 Consul Connect 服务网格的服务
- **多数据中心**:监控多个 Consul 数据中心的服务实例
- **动态伸缩**:自动适应因自动扩缩容而增减的服务实例
- **健康检查**:结合 Consul 的健康检查机制监控服务健康状态
- **服务治理**:集中管理 Consul 服务生态中所有服务的监控
### 与 Consul 功能的集成
- **服务健康**:Consul 服务发现可以利用 Consul 的健康检查信息
- **服务标签**:从 Consul 发现的服务实例可能包含标签信息
- **KV 存储**:可与 Consul KV 存储结合使用,实现更灵活的服务发现
- **服务网格**:支持 Consul Connect 服务网格环境中的服务发现
@@ -0,0 +1,60 @@
---
id: dahua
title: 监控 大华设备
sidebar_label: 大华
keywords: [ monitor, dahua, 大华 ]
---
> 通过HTTP接口监控大华设备状态,获取设备健康数据。
## 监控配置参数
| 参数名称 | 参数帮助描述 |
| ----------- | ----------- |
| 监控Host | 被监控的对端IP或域名 |
| 监控名称 | 标识此监控的唯一名称 |
| 端口 | 网络请求端口,默认80 |
| 超时时间 | 请求超时时间,单位毫秒 |
| 用户名 | 设备登录用户名 |
| 密码 | 设备登录密码 |
| 启用HTTPS | 是否启用HTTPS协议 |
| 采集间隔 | 数据采集周期(≥30秒) |
## 采集指标
### 网络信息
- 默认网卡
- 域名
- 主机名
- 网卡 eth0 IP地址
- 网卡 eth0 默认网关
- 网卡 eth0 物理地址
- 网卡 eth0 子网掩码
- 网卡 eth0 MTU
- DNS服务器1/2
### 用户信息
- 客户端地址
- 客户端用户
- 客户端登录类型
- 客户端登录时间
### 校时信息
- 校时服务器
- 校时端口
- 校时间隔
## 实现原理
通过大华设备HTTP接口获取数据:
1. 网络信息:`/cgi-bin/configManager.cgi?action=getConfig&name=Network`
2. 用户信息:`/cgi-bin/userManager.cgi?action=getActiveUserInfoAll`
3. 校时信息:`/cgi-bin/configManager.cgi?action=getConfig&name=NTP`
使用Digest认证方式,解析设备返回的配置数据格式。
@@ -0,0 +1,115 @@
---
id: darwin
title: 监控:darwin操作系统监控
sidebar_label: darwin 操作系统
keywords: [开源监控系统, 开源操作系统监控, darwin操作系统监控]
---
> 对darwin操作系统的通用性能指标进行采集监控。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|---------------------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | Linux SSH对外提供的端口,默认为22。 |
| 超时时间 | 设置连接的超时时间,单位ms毫秒,默认6000毫秒。 |
| 复用连接 | 设置SSH连接是否复用,默认为:false。为false每次获取信息都会创建一个连接 |
| 使用代理 | 设置是否通过代理连接,默认为false。 |
| 用户名 | SSH连接用户名,可选 |
| 密码 | SSH连接密码,可选 |
| 采集器 | 配置此监控使用哪台采集器调度采集 |
| 监控周期 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 绑定标签 | 用于对监控资源进行分类管理 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
| 私钥 | 连接服务器所需的私钥 |
| 密钥短语 | 用于加密 SSH 私钥的密码短语(Passphrase)。如果私钥在生成时设置了密码短语,则必须填写此字段才能解密并使用私钥进行认证。 |
| 代理主机 | 代理服务器的地址,支持 IPV4、IPV6或域名。若使用 SSH 代理跳转访问目标主机,需填写代理服务器的地址。 |
| 代理端口 | 代理服务器的端口号,默认为22。 |
| 代理用户名 | 连接代理服务器时所需的认证用户名。 |
| 代理密码 | 连接代理服务器时所需的认证密码。 |
| 代理主机私钥 | 连接代理服务器时所需的私钥。 |
### 采集指标
#### 指标集合:系统基本信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------|------|--------|
| hostname | 无 | 主机名称 |
| version | 无 | 操作系统版本 |
| uptime | 无 | 启动时间 |
#### 指标集合:CPU 信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|--------------------|
| info | 无 | CPU型号 |
| cores | 无 | CPU内核数量 |
| interrupt | 无 | CPU中断数量 |
| load | 无 | CPU最近1/5/15分钟的平均负载 |
| context_switch | 无 | 当前上下文切换数量 |
| usage | % | CPU使用率(待完善) |
#### 指标集合:内存信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|----------|
| total | Mb | 总内存容量 |
| used | Mb | 用户程序内存量 |
| free | Mb | 空闲内存容量 |
| buff_cache | Mb | 缓存占用内存 |
| available | Mb | 剩余可用内存容量 |
| usage | % | 内存使用率 |
#### 指标集合:磁盘信息 - 待完善
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------------|------|-----------|
| disk_num | 无 | 磁盘总数 |
| partition_num | 无 | 分区总数 |
- darwin操作系统磁盘的其他指标采集待完善,当前版本不支持。
- 可以使用其他工具或脚本来获取磁盘信息。
- 未来版本将支持磁盘信息采集。
#### 指标集合:网卡信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|---------------|
| interface_name | 无 | 网卡名称 |
| receive_bytes | Byte | 入站数据流量(bytes) |
| transmit_bytes | Byte | 出站数据流量(bytes) |
#### 指标集合:文件系统
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|---------|
| filesystem | 无 | 文件系统的名称 |
| used | Mb | 已使用磁盘大小 |
| available | Mb | 可用磁盘大小 |
| usage | % | 使用率 |
| mounted | 无 | 挂载点目录 |
#### 指标集合:Top10 CPU进程
统计进程使用CPU的Top10进程。统计信息包括:进程ID、CPU占用率、内存占用率、执行命令。
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| pid | 无 | 进程ID |
| cpu_usage | % | CPU占用率 |
| mem_usage | % | 内存占用率 |
| command | 无 | 执行命令 |
#### 指标集合:Top10 内存进程
统计进程使用内存的Top10进程。统计信息包括:进程ID、内存占用率、CPU占用率、执行命令。
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| pid | 无 | 进程ID |
| mem_usage | % | 内存占用率 |
| cpu_usage | % | CPU占用率 |
| command | 无 | 执行命令 |
@@ -0,0 +1,86 @@
---
id: db2
title: 监控:DB2数据库监控
sidebar_label: DB2数据库
keywords: [ 开源监控系统, 开源数据库监控, DB2数据库监控 ]
---
> 对 DB2 数据库的通用性能指标(表空间、会话状态、进程数、锁、慢查询等)进行采集监控
## 注意, 必须添加 DB2 jdbc 驱动 jar
- 下载 DB2 jdbc 驱动 jar
包,例如 [jcc.jar](https://repo1.maven.org/maven2/com/ibm/db2/jcc/11.5.9.0/jcc-11.5.9.0.jar)
- 将 jar 包复制到 `hertzbeat/ext-lib` 目录下
- 重启 HertzBeat 服务
:::important 采集器包选择
DB2 监控依赖 `ext-lib` 目录下的外置 JDBC 驱动加载能力。
- DB2 监控请使用 HertzBeat 主程序内置采集器,或 JVM 采集器安装包
- 不要使用 Native 采集器安装包执行 DB2 监控
:::
### 配置参数
以下是 DB2 监控所需的配置参数:
| 参数名称 | 参数帮助描述 |
|:-----------|:-----------------------------------------|
| **目标Host** | 被监控的 DB2 数据库服务器的 IPv4、IPv6 或域名 |
| **端口** | DB2 数据库对外提供的端口,默认为 `50000` |
| **数据库名** | 要连接的 DB2 数据库的名称 |
| **用户名** | 数据库连接用户名 |
| **密码** | 数据库连接密码 |
| **查询超时时间** | 设置 SQL 查询未响应数据时的超时时间,单位毫秒 (ms),默认 `6000` |
| **复用连接** | 是否复用数据库连接,布尔值,默认 `true` |
| **URL** | 数据库连接 URL,可选,配置后将覆盖上面配置的数据库名、用户名、密码等参数 |
### 采集指标
#### 指标集合:基本信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|:-------------------|:-----|:-------|
| `database_version` | 无 | 数据库版本 |
| `instance_name` | 无 | 数据库实例名 |
| `status` | 无 | 实例状态 |
| `num_db` | 无 | 数据库数量 |
#### 指标集合:表空间使用率
| 指标名称 | 指标单位 | 指标帮助描述 |
|:------------------|:-------|:-------|
| `tablespace_name` | 无 | 表空间名 |
| `status` | 无 | 类型 |
| `total` | MB | 总容量 |
| `used` | MB | 已使用容量 |
| `free` | MB | 空闲容量 |
| `used_percentage` | 百分比(%) | 已用百分比 |
#### 指标集合:会话状态
| 指标名称 | 指标单位 | 指标帮助描述 |
|:--------------|:-----|:-----------|
| `status_type` | 无 | 会话状态类型 |
| `count` | 无 | 处于该状态的会话数量 |
#### 指标集合:应用进程数
| 指标名称 | 指标单位 | 指标帮助描述 |
|:----------------|:-----|:-------------|
| `process_count` | 无 | 总的应用进程数/会话总数 |
#### 指标集合:锁
| 指标名称 | 指标单位 | 指标帮助描述 |
|:----------------|:-----|:-------------|
| `waiting_locks` | 无 | 当前处于等待状态的锁数量 |
#### 指标集合:慢查询
| 指标名称 | 指标单位 | 指标帮助描述 |
|:---------------|:-----|:------------|
| `avg_exe_time` | ms | 平均执行时间 |
| `sql_text` | 无 | 慢查询的 SQL 文本 |
@@ -0,0 +1,114 @@
---
id: debian
title: 监控:Debian 系统监控
sidebar_label: Debian 操作系统
keywords: [开源监控系统, 操作系统监控, Debian监控]
---
> 对Debian系统的通用性能指标进行采集监控
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|---------------------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | Linux SSH对外提供的端口,默认为22。 |
| 超时时间 | 设置连接的超时时间,单位ms毫秒,默认6000毫秒。 |
| 复用连接 | 设置SSH连接是否复用,默认为:false。为false每次获取信息都会创建一个连接 |
| 使用代理 | 设置是否通过代理连接,默认为false。 |
| 用户名 | SSH连接用户名,可选 |
| 密码 | SSH连接密码,可选 |
| 采集器 | 配置此监控使用哪台采集器调度采集 |
| 监控周期 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 绑定标签 | 用于对监控资源进行分类管理 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
| 私钥 | 连接服务器所需的私钥 |
| 密钥短语 | 用于加密 SSH 私钥的密码短语(Passphrase)。如果私钥在生成时设置了密码短语,则必须填写此字段才能解密并使用私钥进行认证。 |
| 代理主机 | 代理服务器的地址,支持 IPV4、IPV6或域名。若使用 SSH 代理跳转访问目标主机,需填写代理服务器的地址。 |
| 代理端口 | 代理服务器的端口号。 |
| 代理用户名 | 连接代理服务器时所需的认证用户名。 |
| 代理密码 | 连接代理服务器时所需的认证密码。 |
| 代理主机私钥 | 连接代理服务器时所需的私钥。 |
### 采集指标
#### 指标集合:系统基本信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------|------|--------|
| hostname | 无 | 主机名称 |
| version | 无 | 操作系统版本 |
| uptime | 无 | 启动时间 |
#### 指标集合:CPU 信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|--------------------|
| info | 无 | CPU型号 |
| cores | 无 | CPU内核数量 |
| interrupt | 无 | CPU中断数量 |
| load | 无 | CPU最近1/5/15分钟的平均负载 |
| context_switch | 无 | 当前上下文切换数量 |
| usage | % | CPU使用率 |
#### 指标集合:内存信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|----------|
| total | Mb | 总内存容量 |
| used | Mb | 用户程序内存量 |
| free | Mb | 空闲内存容量 |
| buff_cache | Mb | 缓存占用内存 |
| available | Mb | 剩余可用内存容量 |
| usage | % | 内存使用率 |
#### 指标集合:磁盘信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------------|------|-----------|
| disk_num | 无 | 磁盘总数 |
| partition_num | 无 | 分区总数 |
| block_write | 无 | 写入磁盘的总块数 |
| block_read | 无 | 从磁盘读出的块数 |
| write_rate | iops | 每秒写磁盘块的速率 |
#### 指标集合:网卡信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|---------------|
| interface_name | 无 | 网卡名称 |
| receive_bytes | Byte | 入站数据流量(bytes) |
| transmit_bytes | Byte | 出站数据流量(bytes) |
#### 指标集合:文件系统
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|---------|
| filesystem | 无 | 文件系统的名称 |
| used | Mb | 已使用磁盘大小 |
| available | Mb | 可用磁盘大小 |
| usage | % | 使用率 |
| mounted | 无 | 挂载点目录 |
#### 指标集合:Top10 CPU进程
统计进程使用CPU的Top10进程。统计信息包括:进程ID、CPU占用率、内存占用率、执行命令。
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| pid | 无 | 进程ID |
| cpu_usage | % | CPU占用率 |
| mem_usage | % | 内存占用率 |
| command | 无 | 执行命令 |
#### 指标集合:Top10 内存进程
统计进程使用内存的Top10进程。统计信息包括:进程ID、内存占用率、CPU占用率、执行命令。
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| pid | 无 | 进程ID |
| mem_usage | % | 内存占用率 |
| cpu_usage | % | CPU占用率 |
| command | 无 | 执行命令 |
@@ -0,0 +1,35 @@
---
id: deepseek
title: 监控:Deepseek 账户情况
sidebar_label: Deepseek 账户情况
keywords: [开源监控系统, 开源网络监控, Deepseek账户监控]
---
## 准备工作
### 获取会话密钥
登录 Deepseek 后台,访问 `https://platform.deepseek.com/api_keys` 页面,获取会话密钥。
### 配置参数
| 参数名称 | 参数帮助描述 |
|-------|---------------------------------|
| 监控Host | 此处填写 api.deepseek.com 。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 会话密钥 | 即准备工作中获取的会话密钥。 |
| 采集器 | 配置此监控使用哪台采集器调度采集。 |
| 监控周期 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒。 |
| 绑定标签 | 对监控资源的分类管理标签。 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息。 |
### 采集指标
#### 指标集合:计费
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|--------|-----------|
| 货币 | 无 | 货币,人民币或美元 |
| 可用余额 | 人民币/美元 | 总的可用余额,包括赠金和充值余额 |
| 未过期的赠金余额 | 人民币/美元 | 未过期的赠金余额 |
| 充值的余额 | 人民币/美元 | 充值余额 |
@@ -0,0 +1,48 @@
---
id: dm
title: 监控:达梦数据库监控
sidebar_label: 达梦数据库
keywords: [开源监控系统, 开源数据库监控, 达梦数据库监控]
---
> 对DM达梦数据库的通用性能指标进行采集监控。支持DM8+。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | 数据库对外提供的端口,默认为5236。 |
| 查询超时时间 | 设置SQL查询未响应数据时的超时时间,单位ms毫秒,默认3000毫秒。 |
| 数据库名称 | 数据库实例名称,可选。 |
| 用户名 | 数据库连接用户名,可选 |
| 密码 | 数据库连接密码,可选 |
| URL | 数据库连接URL,可选 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:basic
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------------|------|-----------|
| PORT_NUM | 无 | 数据库暴露服务端口 |
| CTL_PATH | 无 | 控制文件路径 |
| MAX_SESSIONS | 无 | 数据库最大连接数 |
#### 指标集合:status
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|------|------------|
| status$ | 无 | DM数据库的开闭状态 |
#### 指标集合:thread
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------------|------|---------------------------------|
| dm_sql_thd | 无 | 用于编写 dmsql dmserver 的线程 |
| dm_io_thd | 无 | IO线程,由IO_THR_GROUPS参数控制,默认为2个线程 |
| dm_quit_thd | 无 | 用于执行正常关闭数据库的线程 |
@@ -0,0 +1,72 @@
---
id: dns
title: 监控 DNS 服务器
sidebar_label: DNS服务器
keywords: [ 开源监控系统, 开源DNS监控工具, 监控DNS指标 ]
---
## 监控:DNS服务器
> 收集和监控DNS的常规性能指标。
**协议使用:DNS**
### 配置参数
| 参数名称 | 参数帮助描述 |
|-----------|------------------------------------------------------------------|
| DNS服务器IP | 被监控的IPv4、IPv6。注意⚠️不包含协议头(例如:https://http://)。 |
| 监控名称 | 标识此监控的名称,名称需要是唯一的。 |
| 端口 | DNS服务对外提供的端口,默认为53。 |
| 域名解析的地址 | 域名解析的地址。 |
| 连接超时时间 | 设置连接DNS服务器的超时时间,单位ms毫秒,默认6000毫秒。 |
| 查询类别 | DNS查询的类别. 可选的值包括 `IN` `CHAOS` `HESIOD` `NONE``ANY`。默认值:IN |
| 是否使用tcp协议 | 设置DNS查询是否使用tcp协议。 |
| 采集间隔 | 监控周期性数据采集的时间间隔,单位:秒,最小可设置为30秒。 |
| 绑定标签 | 用于对监控资源进行分类管理。 |
| 描述备注 | 用于更多关于标识和描述此监控的信息,用户可以在此处添加备注信息。 |
### 采集指标
#### 指标集:Header
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|-----------------|
| 响应时间 | 毫秒 | DNS服务器响应请求所需的时间 |
| 操作码 | 无 | 当前消息的类型 |
| 响应状态 | 无 | 响应的状态码 |
| 响应标志 | 无 | 响应标志 |
| 请求记录数 | 无 | 请求记录的数量 |
| 响应记录数 | 无 | 响应记录的数量 |
| 授权记录数 | 无 | 表示权威资源记录的数量 |
| 附加记录数 | 无 | 表示附加资源记录的数量 |
### 指标集: Question
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|------|-----------------------------------|
| Section | 无 | 请求记录信息,其中包含查询的域名,资源类型,资源记录类,附加信息。 |
### 指标集: Answer
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------|------|----------------------------------------|
| Section0 | 无 | 请求响应信息,其中包含查询的域名,TTL,资源记录类,资源类型,查询的结果。 |
> Answer 指标集最多会采集10条响应记录,指标名称从 Section0 到 Section9。
### 指标集: Authority
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------|------|------------------------------------------------------------------|
| Section0 | 无 | 域名的SOAStart of Authority,权威区域起始)记录,其中包含查询的域名,TTL,资源类型,资源记录类等信息。 |
> Authority 指标集最多会采集10条响应记录,指标名称从 Section0 到 Section9。
### 指标集: Additional
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------|------|-------------|
| Section0 | 无 | DNS查询的附加信息。 |
> Additional 指标集最多会采集10条响应记录,指标名称从 Section0 到 Section9。
@@ -0,0 +1,223 @@
---
id: dns_sd
title: 监控:DNS服务发现监控
sidebar_label: DNS服务发现
keywords: [开源监控系统, 开源服务发现监控, DNS服务发现监控]
---
> HertzBeat 集成 DNS 服务,通过 DNS 记录自动发现服务实例并为发现的实例创建监控任务。
## 概述
DNS 服务发现允许 HertzBeat 通过查询 DNS 记录来发现服务实例。这是一种简单可靠的服务发现方法,利用标准 DNS 基础设施来查找服务实例。特别适用于使用 DNS SRV 记录或需要通过 DNS 发现服务的环境。
### 监控前操作
#### 配置 DNS 记录
确保您的 DNS 服务器已正确配置服务发现记录。不同的记录类型有不同的格式:
1. **SRV 记录**:用于服务发现,包含服务主机和端口信息
2. **A 记录**:返回 IPv4 地址
3. **AAAA 记录**:返回 IPv6 地址
4. **MX 记录**:邮件服务器记录
5. **NS 记录**:名称服务器记录
### 配置参数
| 参数名称 | 参数帮助描述 |
|--------------|-----------------------------------------------------|
| 任务名称 | 标识此监控的名称,名称需要保证唯一性 |
| DNS地址 | DNS 服务器地址。示例:`8.8.8.8``192.168.1.1` |
| DNS端口 | DNS 服务器端口,默认为 53 |
| 记录类型 | 要查询的 DNS 记录类型。选项:`SRV``A``AAAA``MX``NS` |
| 记录名称 | 要查询的 DNS 记录名称。示例:SRV 记录为 `_http._tcp.example.com` |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 使用步骤
1. **创建服务发现监控**
- 在 HertzBeat Web 界面中,导航到 **监控****新增监控**
- 选择监控类型:**DNS服务发现**
- 填写基本配置参数
2. **配置监控模板**
- 创建服务发现监控后,需要指定一个监控模板
- 模板定义了为发现的服务实例创建什么类型的监控
- 对于 SRV 记录,常用的模板包括端口、HTTP 等
- 对于 A/AAAA 记录,可以使用 Ping 或端口监控
3. **自动发现**
- HertzBeat 会根据采集间隔定期查询 DNS 服务器
- 为新发现的服务实例自动创建监控任务
- 自动删除已消失服务实例的监控任务
4. **查看发现的实例**
- 在监控列表中,您可以看到所有自动创建的子监控任务
- 每个子监控任务对应一个发现的服务实例
### 使用示例
#### 示例 1SRV 记录发现
假设您的 Web 服务有一个 SRV 记录:
- **SRV 记录**`_http._tcp.example.com`
- **DNS 服务器**`8.8.8.8`
- **预期发现**:自动发现所有 HTTP 服务实例
配置示例:
- **任务名称**`DNS-SRV-Discovery`
- **DNS地址**`8.8.8.8`
- **DNS端口**`53`
- **记录类型**:选择 `SRV`
- **记录名称**`_http._tcp.example.com`
- **采集间隔**`60`
- **监控模板**:选择 `端口` 监控(使用 SRV 记录中的端口)
配置完成后:
1. HertzBeat 查询 `_http._tcp.example.com` 的 SRV 记录
2. 从 SRV 记录响应中提取主机和端口信息
3. 为每个服务实例自动创建端口监控
#### 示例 2A 记录发现
通过 A 记录发现服务实例:
- **A 记录**`services.example.com`
- 该域名可能解析到多个 IP 地址
配置示例:
- **DNS地址**`192.168.1.1`(内部 DNS 服务器)
- **DNS端口**`53`
- **记录类型**:选择 `A`
- **记录名称**`services.example.com`
- **监控模板**:选择 `Ping``端口` 监控
#### 示例 3MX 记录发现
通过 MX 记录发现邮件服务器:
- **DNS地址**`8.8.8.8`
- **记录类型**:选择 `MX`
- **记录名称**`example.com`
- **监控模板**:选择 `端口` 监控(端口 25
### DNS 记录类型
#### SRV 记录(推荐)
SRV 记录是最常用的服务发现记录类型,包含服务名称、端口号和优先级信息。
格式:`_service._protocol.example.com`
示例:`_http._tcp.example.com`
典型的 SRV 记录响应包含:
- 目标域名
- 端口号
- 优先级和权重
#### A 记录
A 记录将域名映射到 IPv4 地址。如果一个域名解析到多个 IP,则可以发现所有 IP。
示例:`services.example.com``192.168.1.10``192.168.1.11``192.168.1.12`
#### AAAA 记录
AAAA 记录将域名映射到 IPv6 地址。
示例:`services.example.com``2001:db8::1`
#### MX 记录
MX 记录指定域的邮件服务器,包含优先级信息。
示例:`example.com``mail.example.com`
#### NS 记录
NS 记录指定域的名称服务器。
示例:`example.com``ns1.example.com`
### 注意事项
- **DNS 服务器**:确保指定的 DNS 服务器可访问且包含服务发现记录
- **记录名称**:记录名称必须准确,SRV 记录需要包含服务和协议前缀
- **端口信息**
- SRV 记录包含端口信息
- A/AAAA 记录不包含端口信息,需要在监控模板中指定默认端口
- **监控模板**:服务发现仅发现服务实例地址,您需要配置合适的监控模板来实际监控这些实例
- **采集间隔**:建议最小间隔为 60 秒,避免过多的 DNS 查询
- **DNS 缓存**:DNS 响应可能被缓存,实际更新频率取决于 DNS 记录的 TTL 值
- **网络连通性**:确保 HertzBeat 可以访问指定的 DNS 服务器和端口(默认:53)
- **防火墙**:确保防火墙允许 DNS 查询流量(UDP/TCP 53
### 采集指标
#### 指标集合:监控目标
| 指标名称 | 指标单位 | 指标帮助描述 |
|------|-------|---------------|
| 目标 | 无 | 发现的服务实例目标 |
| 主机 | 无 | 服务实例主机地址 |
| 端口 | 无 | 服务实例端口号 |
### 适用场景
- **Kubernetes Headless 服务**:通过 DNS 发现 Kubernetes Pod 实例
- **云服务**:从云服务发现实例(AWS Route53、Azure DNS、GCP Cloud DNS
- **传统 DNS**:使用现有 DNS 基础设施进行服务发现
- **负载均衡**:发现所有后端服务器实例
- **邮件服务器**:通过 MX 记录发现邮件服务器实例
- **多环境**:使用不同 DNS 记录在不同环境中进行服务发现
### 常见 SRV 记录格式
不同服务使用不同的 SRV 记录格式:
- **HTTP**`_http._tcp.example.com`
- **HTTPS**`_https._tcp.example.com`
- **LDAP**`_ldap._tcp.example.com`
- **FTP**`_ftp._tcp.example.com`
- **MySQL**`_mysql._tcp.example.com`
- **PostgreSQL**`_postgresql._tcp.example.com`
### Kubernetes 集成
在 Kubernetes 集群中,可以使用 DNS 服务发现来发现 Pod 实例:
1. **Headless 服务**Kubernetes 为 headless 服务的每个 Pod 创建 DNS A 记录
2. **服务发现**:使用 DNS 服务发现监控特定服务的所有 Pod
示例:
- **DNS地址**Kubernetes 集群 DNS 服务 IP(通常是 `10.96.0.10`
- **记录类型**`A`
- **记录名称**`my-service.default.svc.cluster.local`
- **监控模板**`端口` 监控
### DNS 服务器示例
常用的 DNS 服务器:
- **Google Public DNS**`8.8.8.8``8.8.4.4`
- **Cloudflare DNS**`1.1.1.1``1.0.0.1`
- **Quad9 DNS**`9.9.9.9`
- **OpenDNS**`208.67.222.222``208.67.220.220`
- **内部 DNS**:通常是企业内部 DNS 服务器地址
### 最佳实践
1. **使用 SRV 记录**:SRV 记录是推荐的服务发现方法,因为它包含完整的主机和端口信息
2. **设置合理的 TTL**:设置适当的 DNS 记录 TTL 以平衡实时性能和 DNS 服务器负载
3. **冗余配置**:配置多个 DNS 服务器以确保高可用性
4. **监控**:定期检查 DNS 记录的有效性和可用性
5. **安全性**:确保 DNS 查询安全,考虑使用 DNS over HTTPS (DoH) 或 DNS over TLS (DoT)
@@ -0,0 +1,101 @@
---
id: docker
title: 监控:Docker 监控
sidebar_label: Docker 容器监控
keywords: [开源监控系统, 开源容器监控, Docker容器监控]
---
> 对Docker容器的通用性能指标进行采集监控。
## 监控前操作
如果想要监控 `Docker` 中的容器信息,则需要按照一下步骤打开端口,让采集请求获取到对应的信息。
**1、编辑docker.server文件:**
```shell
vi /usr/lib/systemd/system/docker.service
```
找到 **[Service]** 节点,修改 ExecStart 属性,增加 `-H tcp://0.0.0.0:2375`
```shell
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:2375
```
这样相当于对外开放的是 **2375** 端口,当然也可以根据自己情况修改成其他的。
**2、重新加载Docker配置生效:**
```shell
systemctl daemon-reload
systemctl restart docker
```
**注意:记得在服务器中打开 `2375` 端口号。**
**3、如果上述方法不行则:**
在服务器内部打开 `2375` 端口号。
```shell
firewall-cmd --zone=public --add-port=2375/tcp --permanent
firewall-cmd --reload
```
### 配置参数
| 参数名称 | 参数帮助描述 |
|--------|------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | 数据库对外提供的端口,默认为2375。 |
| 查询超时时间 | 设置获取Docker服务器API接口时的超时时间,单位ms毫秒,默认3000毫秒。 |
| 器名称 | 一般是监控所有运行中的容器信息。 |
| 用户名 | 连接用户名,可选 |
| 密码 | 连接密码,可选 |
| URL | 数据库连接URL,可选,若配置,则URL里面的数据库名称,用户名密码等参数会覆盖上面配置的参数 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:system
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------------------|------|--------------------------------|
| Name | 无 | 服务器名称 |
| version | 无 | docker本版号 |
| os | 无 | 服务器版本 例如:linux x86_64 |
| root_dir | 无 | docker文件夹目录 例如:/var/lib/docker |
| containers | 无 | 容器总数(在运行+未运行) |
| containers_running | 无 | 运行中的容器数目 |
| containers_paused | 无 | 暂停中的容器数目 |
| images | 无 | 容器景象的总数目。 |
| ncpu | 无 | NCPU |
| mem_total | MB | 占用的内存总大小 |
| system_time | 无 | 系统时间 |
#### 指标集合:containers
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|------|----------------|
| id | 无 | Docker中容器的ID |
| name | 无 | Docker容器中的容器名称 |
| image | 无 | Docker容器使用的镜像 |
| command | 无 | Docker中的默认启动命令 |
| state | 无 | Docker中容器的运行状态 |
| status | 无 | Docker容器中的更新时间 |
#### 指标集合:stats
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------------|------|--------------------|
| name | 无 | Docker容器中的名字 |
| available_memory | MB | Docker容器可以利用的内存大小 |
| used_memory | MB | Docker容器已经使用的内存大小 |
| memory_usage | 无 | Docker容器的内存使用率 |
| cpu_delta | 无 | Docker容器已经使用的CPU数量 |
| number_cpus | 无 | Docker容器可以使用的CPU数量 |
| cpu_usage | 无 | Docker容器CPU使用率 |
@@ -0,0 +1,106 @@
---
id: dolphinscheduler
title: 监控:Apache DolphinScheduler
sidebar_label: Apache DolphinScheduler
keywords: [ 开源监控系统, 监控 Apache DolphinScheduler ]
---
> 对 Apache DolphinScheduler 指标进行采集监控。
## 监控前操作
> 支持 Apache DolphinScheduler v3.3.0 或更高版本
您需在 Apache DolphinScheduler 中创建令牌。
<!-- markdown-link-check-disable -->
可参考 [API 调用](https://dolphinscheduler.apache.org/zh-cn/docs/3.2.2/guide/api/open-api) 创建一个新令牌,具体步骤如下:
1. 登录 Apache DolphinScheduler 系统,点击 "安全中心",再点击左侧的 "令牌管理",点击 "令牌管理" 创建令牌。
2. 选择 "失效时间" (Token 有效期),选择 "用户" (以指定的用户执行接口操作),点击 "生成令牌" ,拷贝令牌字符串,然后点击 "提交" 。
## 配置参数
| 参数名称 | 参数帮助描述 |
|-----------|------------------------------------------------------|
| 目标Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | DolphinScheduler开放的监控端口,默认值:12345。 |
| 启用HTTPS | 是否启用HTTPS。 |
| 令牌 | DolphinScheduler 的令牌字符串。 |
| 查询超时时间 | 设置查询未响应数据时的超时时间,单位ms毫秒,默认6000毫秒。 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 绑定标签 | 用于对监控资源进行分类管理。 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息。 |
## 采集指标
### 指标集合:Master
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|--------|-----------------|
| host | 无 | 主机地址 |
| port | 无 | 端口 |
| serverStatus | 无 | 状态 |
| processId | 无 | 进程 ID |
| runningTime | 天 | 运行时间 |
| cpuUsage | 百分比(%) | 处理器使用量 |
| memoryUsage | 百分比(%) | 内存使用量 |
| diskUsage | 百分比(%) | 磁盘可用容量 |
| jvmCpuUsage | 百分比(%) | JVM CPU 使用量 |
| jvmMemoryUsage | 百分比(%) | JVM 内存 使用量 |
| jvmHeapUsed | 无 | JVM 已使用的堆内存大小 |
| jvmNonHeapUsed | 无 | JVM 已使用的非堆内存大小 |
| jvmHeapMax | 无 | JVM 配置的最大堆内存大小 |
| jvmNonHeapMax | 无 | JVM 配置的最大非堆内存大小 |
### 指标集合:Worker
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------------|--------|-----------------|
| host | 无 | 主机地址 |
| port | 无 | 端口 |
| serverStatus | 无 | 状态 |
| processId | 无 | 进程 ID |
| runningTime | 天 | 运行时间 |
| cpuUsage | 百分比(%) | CPU使用率 |
| memoryUsage | 百分比(%) | 内存使用率 |
| diskUsage | 百分比(%) | 磁盘可用容量 |
| jvmCpuUsage | 百分比(%) | JVM CPU 使用量 |
| jvmMemoryUsage | 百分比(%) | JVM 内存 使用量 |
| jvmHeapUsed | 无 | JVM 已使用的堆内存大小 |
| jvmNonHeapUsed | 无 | JVM 已使用的非堆内存大小 |
| jvmHeapMax | 无 | JVM 配置的最大堆内存大小 |
| jvmNonHeapMax | 无 | JVM 配置的最大非堆内存大小 |
| workerHostWeight | 无 | 权重 |
| threadPoolUsage | 无 | 线程池使用量 |
| workerGroup | 无 | Worker 组 |
### 指标集合:Alert Server
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|--------|-----------------|
| host | 无 | 主机地址 |
| port | 无 | 端口 |
| serverStatus | 无 | 状态 |
| processId | 无 | 进程 ID |
| runningTime | 天 | 运行时间 |
| cpuUsage | 百分比(%) | 处理器使用量 |
| memoryUsage | 百分比(%) | 内存使用量 |
| diskUsage | 百分比(%) | 磁盘可用容量 |
| jvmCpuUsage | 百分比(%) | JVM CPU 使用量 |
| jvmMemoryUsage | 百分比(%) | JVM 内存 使用量 |
| jvmHeapUsed | 无 | JVM 已使用的堆内存大小 |
| jvmNonHeapUsed | 无 | JVM 已使用的非堆内存大小 |
| jvmHeapMax | 无 | JVM 配置的最大堆内存大小 |
| jvmNonHeapMax | 无 | JVM 配置的最大非堆内存大小 |
### 指标:数据库
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------------------------|--------|-----------|
| dbType | 无 | 数据库类型 |
| state | 无 | 状态 |
| maxConnections | 无 | 最大连接数 |
| threadsConnections | 无 | 当前连接数 |
| threadsRunningConnections | 天 | 当前活跃连接数 |
@@ -0,0 +1,170 @@
---
id: doris_be
title: 监控:DORIS数据库BE监控
sidebar_label: DORIS数据库BE
keywords: [开源监控系统, 开源数据库监控, DORIS数据库BE监控]
---
> 对DORIS数据库FE的通用性能指标进行采集监控。支持DORIS2.0.0。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|-----------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://) |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性 |
| 端口 | 数据库对外提供的端口,默认为8040 |
| 查询超时时间 | 设置连接未响应的超时时间,单位ms毫秒,默认3000毫秒 |
| 数据库名称 | 数据库实例名称,可选 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:doris_be_load_channel_count
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|-----------------------|
| value | 无 | 当前打开的 load channel 个数 |
#### 指标集合:doris_be_memtable_flush_total
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|--------------------|
| value | 无 | memtable写入磁盘的个数累计值 |
#### 指标集合:doris_be_plan_fragment_count
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|------------------------------|
| value | 无 | 当前已接收的 fragment instance 的数量 |
#### 指标集合:doris_be_process_thread_num
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|---------------------------------|
| value | 无 | BE 进程线程数。通过 `/proc/pid/task` 采集 |
#### 指标集合:doris_be_query_scan_rows
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|------------------------------------------------------------------------------|
| value | 无 | 读取行数的累计值。这里只统计读取 Olap 表的数据量。并且是 RawRowsRead(部分数据行可能被索引跳过,并没有真正读取,但仍会记录到这个值中) |
#### 指标集合:doris_be_result_buffer_block_count
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|---------------------|
| value | 无 | 当前查询结果缓存中的 query 个数 |
#### 指标集合:doris_be_send_batch_thread_pool_queue_size
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|---------------------|
| value | 无 | 导入时用于发送数据包的线程池的排队个数 |
#### 指标集合:doris_be_tablet_base_max_compaction_score
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|-----------------------------|
| value | 无 | 当前最大的 Base Compaction Score |
#### 指标集合:doris_be_timeout_canceled_fragment_count
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|----------------------------------|
| value | 无 | 因超时而被取消的 fragment instance 数量累计值 |
#### 指标集合:doris_be_load_rows
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|------------------------|
| value | 无 | 通过 tablet sink 发送的行数累计 |
#### 指标集合:doris_be_all_rowsets_num
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|-----------------|
| value | 无 | 当前所有 rowset 的个数 |
#### 指标集合:doris_be_all_segments_num
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|------------------|
| value | 无 | 当前所有 segment 的个数 |
#### 指标集合:doris_be_heavy_work_max_threads
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|-------------------|
| value | 无 | brpc heavy线程池线程个数 |
#### 指标集合:doris_be_light_work_max_threads
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|-------------------|
| value | 无 | brpc light线程池线程个数 |
#### 指标集合:doris_be_heavy_work_pool_queue_size
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|---------------------------------|
| value | 无 | brpc heavy线程池队列最大长度,超过则阻塞提交work |
#### 指标集合:doris_be_light_work_pool_queue_size
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|---------------------------------|
| value | 无 | brpc light线程池队列最大长度,超过则阻塞提交work |
#### 指标集合:doris_be_heavy_work_active_threads
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|--------------------|
| value | 无 | brpc heavy线程池活跃线程数 |
#### 指标集合:doris_be_light_work_active_threads
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|--------------------|
| value | 无 | brpc light线程池活跃线程数 |
#### 指标集合:doris_be_compaction_bytes_total
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|------------------------------|
| base | 字节 | Base Compaction 的数据量累计 |
| cumulative | 字节 | Cumulative Compaction 的数据量累计 |
#### 指标集合:doris_be_disks_avail_capacity
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|--------------------------------------------|
| path | 无 | 指定数据目录 |
| value | 字节 | `{path="/path1/"}` 表示 `/path1` 目录所在磁盘的剩余空间 |
#### 指标集合:doris_be_disks_total_capacity
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|--------------------------------------------|
| path | 无 | 指定数据目录 |
| value | 字节 | `{path="/path1/"}` 表示 `/path1` 目录所在磁盘的全部空间 |
#### 指标集合:doris_be_local_bytes_read_total
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|----------------------------|
| value | 字节 | 由 `LocalFileReader` 读取的字节数 |
#### 指标集合:doris_be_local_bytes_written_total
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|----------------------------|
| value | 字节 | 由 `LocalFileWriter` 写入的字节数 |
#### 指标集合:doris_be_memory_allocated_bytes
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|------------------------------------------|
| value | 字节 | BE 进程物理内存大小,取自 `/proc/self/status/VmRSS` |
@@ -0,0 +1,131 @@
---
id: doris_fe
title: 监控:DORIS数据库FE监控
sidebar_label: DORIS数据库FE
keywords: [开源监控系统, 开源数据库监控, DORIS数据库FE监控]
---
> 对DORIS数据库FE的通用性能指标进行采集监控。支持DORIS2.0.0。
**使用协议:HTTP**
## 监控前操作
查看 `fe/conf/fe.conf` 文件,获取 `http_port` 配置项的值,该值用作监控使用。
### 配置参数
| 参数名称 | 参数帮助描述 |
|--------|-----------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://) |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性 |
| 端口 | 数据库对外提供的端口,默认为8030 , 取值自 `http_port` 配置项的值 |
| 查询超时时间 | 设置连接未响应的超时时间,单位ms毫秒,默认6000毫秒 |
| 采集器 | 配置此监控使用哪台采集器调度采集 |
| 绑定标签 | 您可以使用标签进行监控资源的分类管理, 例如给资源分别绑定生产环境、测试环境的标签。 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:doris_fe_connection_total
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|-----------------|
| value | 无 | 当前FE的MySQL端口连接数 |
#### 指标集合:doris_fe_edit_log_clean
不应失败,如失败,需人工介入
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|------|----------------|
| success | 无 | 清理历史元数据日志成功的次数 |
| failed | 无 | 清理历史元数据日志失败的次数 |
#### 指标集合:doris_fe_edit_log
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------------------|------|--------------|
| write | 无 | 元数据日志写入次数的计数 |
| read | 无 | 元数据日志读取次数的计数 |
| current | 无 | 元数据日志当前数量 |
| accumulated_bytes | 字节 | 元数据日志写入量的累计值 |
| current_bytes | 字节 | 元数据日志当前值 |
#### 指标集合:doris_fe_image_clean
不应失败,如失败,需人工介入
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|------|------------------|
| success | 无 | 清理历史元数据镜像文件成功的次数 |
| failed | 无 | 清理历史元数据镜像文件失败的次数 |
#### 指标集合:doris_fe_image_write
不应失败,如失败,需人工介入
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|------|----------------|
| success | 无 | 生成元数据镜像文件成功的次数 |
| failed | 无 | 生成元数据镜像文件失败的次数 |
#### 指标集合:doris_fe_query_err
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|----------|
| value | 无 | 错误查询的累积值 |
#### 指标集合:doris_fe_max_journal_id
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|---------------------------------------------------------------------------------------------------------------|
| value | 无 | 当前FE节点最大元数据日志ID。如果是Master FE,则是当前写入的最大ID,如果是非Master FE,则代表当前回放的元数据日志最大ID。用于观察多个FE之间的 id 是否差距过大。过大则表示元数据同步出现问题 |
#### 指标集合:doris_fe_max_tablet_compaction_score
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|--------------------------------------------------------------------------------------|
| value | 无 | 所有BE节点中最大的 compaction score 值。该值可以观测当前集群最大的 compaction score,以判断是否过高。如过高则可能出现查询或写入延迟 |
#### 指标集合:doris_fe_qps
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|---------------------|
| value | 无 | 当前FE每秒查询数量(仅统计查询请求) |
#### 指标集合:doris_fe_query_err_rate
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|---------|
| value | 无 | 每秒错误查询数 |
#### 指标集合:doris_fe_report_queue_size
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|--------------------------------------------------------------------|
| value | 无 | BE的各种定期汇报任务在FE端的队列长度,该值反映了汇报任务在 Master FE 节点上的阻塞程度,数值越大,表示FE处理能力不足 |
#### 指标集合:doris_fe_rps
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|--------------------------|
| value | 无 | 当前FE每秒请求数量(包含查询以及其他各类语句) |
#### 指标集合:doris_fe_scheduled_tablet_num
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------|------|------------------------------------------------------------------------------------------|
| value | 无 | Master FE节点正在调度的 tablet 数量。包括正在修复的副本和正在均衡的副本,该数值可以反映当前集群,正在迁移的 tablet 数量。如果长时间有值,说明集群不稳定 |
#### 指标集合:doris_fe_txn_status
可以观测各个状态下导入事务的数量,来判断是否有堆积
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|---------|
| unknown | 无 | 未知 |
| prepare | 无 | 准备中 |
| committed | 无 | 已提交 |
| visible | 无 | 可见 |
| aborted | 无 | 已中止/已撤销 |
@@ -0,0 +1,101 @@
---
id: dynamic_tp
title: 监控:DynamicTp 线程池监控
sidebar_label: DynamicTp线程池监控
keywords: [开源监控系统, 开源中间件监控, DynamicTp线程池监控]
---
> 对DynamicTp actuator 暴露的线程池性能指标进行采集监控。
## 前提
1. 集成使用 `DynamicTp`
`DynamicTp` 是Jvm语言的基于配置中心的轻量级动态线程池,内置监控告警功能,可通过SPI自定义扩展实现。
集成使用,请参考文档 [快速接入](https://dynamictp.cn/guide/use/quick-start.html)
2. 开启SpringBoot Actuator Endpoint 暴露出`DynamicTp`指标接口
```yaml
management:
endpoints:
web:
exposure:
include: '*'
```
测试访问指标接口 `ip:port/actuator/dynamic-tp` 是否有响应json数据如下:
```json
[
{
"poolName": "commonExecutor",
"corePoolSize": 1,
"maximumPoolSize": 1,
"queueType": "LinkedBlockingQueue",
"queueCapacity": 2147483647,
"queueSize": 0,
"fair": false,
"queueRemainingCapacity": 2147483647,
"activeCount": 0,
"taskCount": 0,
"completedTaskCount": 0,
"largestPoolSize": 0,
"poolSize": 0,
"waitTaskCount": 0,
"rejectCount": 0,
"rejectHandlerName": null,
"dynamic": false,
"runTimeoutCount": 0,
"queueTimeoutCount": 0
},
{
"maxMemory": "4 GB",
"totalMemory": "444 MB",
"freeMemory": "250.34 MB",
"usableMemory": "3.81 GB"
}
]
```
3. 在HertzBeat中间件监控下添加DynamicTp监控即可
### 配置参数
| 参数名称 | 参数帮助描述 |
|-----------|------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | 应用服务对外提供的端口,默认为8080。 |
| 启用HTTPS | 是否通过HTTPS访问网站,注意⚠️开启HTTPS一般默认对应端口需要改为443 |
| Base Path | 暴露接口路径前缀,默认 /actuator |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:thread_pool
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------------------------|------|--------------------------|
| pool_name | 无 | 线程池名称 |
| core_pool_size | 无 | 核心线程数 |
| maximum_pool_size | 无 | 最大线程数 |
| queue_type | 无 | 任务队列类型 |
| queue_capacity | MB | 任务队列容量 |
| queue_size | 无 | 任务队列当前占用大小 |
| fair | 无 | 队列模式,SynchronousQueue会用到 |
| queue_remaining_capacity | MB | 任务队列剩余大小 |
| active_count | 无 | 活跃线程数 |
| task_count | 无 | 任务总数 |
| completed_task_count | 无 | 已完成任务数 |
| largest_pool_size | 无 | 历史最大线程数 |
| pool_size | 无 | 当前线程数 |
| wait_task_count | 无 | 等待执行任务数 |
| reject_count | 无 | 拒绝任务数 |
| reject_handler_name | 无 | 拒绝策略类型 |
| dynamic | 无 | 是否动态线程池 |
| run_timeout_count | 无 | 运行超时任务数 |
| queue_timeout_count | 无 | 等待超时任务数 |
@@ -0,0 +1,63 @@
---
id: elasticsearch
title: 监控:ElasticSearch
sidebar_label: ElasticSearch
keywords: [ 开源监控系统, 监控ElasticSearch ]
---
> 对ElasticSearch的通用性能指标进行采集监控。
## 配置参数
| 参数名称 | 参数帮助描述 |
|---------|------------------------------------------------------|
| 目标Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | ElasticSearch开放的HTTP API端口,默认值:9200。 |
| 启用HTTPS | 是否启用HTTPS。 |
| 认证方式 | 连接ElasticSearch使用的认证方式,可选。 |
| 用户名 | 连接ElasticSearch的用户名,可选。 |
| 密码 | 连接ElasticSearch的密码,可选 |
| 查询超时时间 | 设置查询未响应数据时的超时时间,单位ms毫秒,默认6000毫秒。 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 绑定标签 | 用于对监控资源进行分类管理。 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息。 |
### 采集指标
#### 指标集合:health
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------------------|------|----------|
| cluster_name | 无 | 集群名称 |
| status | 无 | 集群状态 |
| nodes | 无 | 集群节点数 |
| data_nodes | 无 | 数据节点数 |
| active_primary_shards | 无 | 主节点活跃分片数 |
| active_shards | 无 | 活跃分片数 |
| active_percentage | % | 分片健康度 |
| initializing_shards | 无 | 初始化分片数 |
| unassigned_shards | 无 | 未分配分片数 |
#### 指标集合:nodes
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|--------|
| total | 无 | 节点数 |
| successful | 无 | 在线节点数 |
| failed | 无 | 离线节点数 |
#### 指标集合:nodes_detail
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------------------|------|---------|
| node_name | 无 | 节点名称 |
| ip | 无 | IP地址 |
| cpu_load_average | 无 | CPU平均负载 |
| cpu_percent | % | CPU占用率 |
| heap_used | MB | 内存使用量 |
| heap_used_percent | % | 内存使用率 |
| heap_total | MB | 总内存 |
| disk_free | GB | 磁盘剩余容量 |
| disk_total | GB | 磁盘总容量 |
| disk_used_percent | % | 磁盘使用率 |
@@ -0,0 +1,65 @@
---
id: etcd
title: 监控:etcd 监控
sidebar_label: etcd
keywords: [开源监控系统, 中间件监控, etcd监控]
---
> HertzBeat 通过采集 etcd 暴露的 Prometheus metrics 接口数据,对 etcd 键值存储进行监控。
>
> 支持 etcd 3.4 及以上版本(数据库大小指标 `etcd_mvcc_db_total_size_in_bytes` 自 3.4 起替代旧的 `etcd_debugging_*` 命名)。
## 监控前操作
### 确认 HertzBeat 能访问 etcd 的 metrics 接口
etcd 会在客户端端口(默认 `2379`)的 `/metrics` 路径暴露 Prometheus 格式的指标。请确保 HertzBeat 能访问该地址:
1. 若 etcd 仅监听 localhost,或客户端端口启用了双向 TLS,请通过 [`--listen-metrics-urls`](https://etcd.io/docs/latest/op-guide/configuration/) 配置独立的 metrics 监听地址。该地址提供 metrics 与健康检查端点;若不加 TLS 暴露,请仅限受信任网络访问。
2. 从 HertzBeat 所在机器访问 `{metrics-host}:{metrics-port}/metrics`(默认为客户端端口 `2379`),确认能获取到 metrics 数据。
更多信息请参考 [etcd 监控文档](https://etcd.io/docs/latest/op-guide/monitoring/)。
### 配置参数
| 参数名称 | 参数帮助描述 |
|--------|-----------------------------------------------|
| 目标Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 端口 | metrics 接口端口,使用客户端 listener 时默认为 2379 |
| 查询超时时间 | HTTP请求超时时间,单位毫秒,默认6000 |
| 启用HTTPS | 是否使用 HTTPS 请求 metrics 接口 |
| 请求Headers | 可选的额外 HTTP 请求头 |
| 认证方式 | 若 metrics 接口在认证代理后面,可选 Basic/Digest 认证 |
| 用户名/密码 | 配置认证方式后使用的凭据 |
### 采集指标
#### 指标集合:etcd_server_has_leader
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|------------------------------|
| hasLeader | 无 | 该 etcd 成员是否存在 raft 领导者(1有0无) |
#### 指标集合:etcd_mvcc_db_total_size_in_bytes
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------|------|-----------------|
| dbSize | MB | 物理分配的数据库总大小 |
#### 指标集合:etcd_server_leader_changes_seen_total
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|--------------|
| leaderChanges | 无 | 已观测到的领导者变更总次数 |
#### 指标集合:process_cpu_seconds_total
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|------------------|
| cpuSeconds | 秒 | 累计用户与系统CPU使用时间 |
#### 指标集合:process_resident_memory_bytes
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------|------|---------|
| memory | MB | 进程常驻内存大小 |
@@ -0,0 +1,114 @@
---
id: euleros
title: 监控:EulerOS操作系统监控
sidebar_label: EulerOS 操作系统
keywords: [ 开源监控系统, 开源操作系统监控, EulerOS操作系统监控 ]
---
> 对EulerOS操作系统的通用性能指标 (系统信息、CPU、内存、磁盘、网卡、文件系统、TOP资源进程等) 进行采集监控。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|---------------------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | Linux SSH对外提供的端口,默认为22。 |
| 超时时间 | 设置连接的超时时间,单位ms毫秒,默认6000毫秒。 |
| 复用连接 | 设置SSH连接是否复用,默认为:false。为false每次获取信息都会创建一个连接 |
| 使用代理 | 设置是否通过代理连接,默认为false。 |
| 用户名 | SSH连接用户名,可选 |
| 密码 | SSH连接密码,可选 |
| 采集器 | 配置此监控使用哪台采集器调度采集 |
| 监控周期 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 绑定标签 | 用于对监控资源进行分类管理 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
| 私钥 | 连接服务器所需的私钥 |
| 密钥短语 | 用于加密 SSH 私钥的密码短语(Passphrase)。如果私钥在生成时设置了密码短语,则必须填写此字段才能解密并使用私钥进行认证。 |
| 代理主机 | 代理服务器的地址,支持 IPV4、IPV6或域名。若使用 SSH 代理跳转访问目标主机,需填写代理服务器的地址。 |
| 代理端口 | 代理服务器的端口号。 |
| 代理用户名 | 连接代理服务器时所需的认证用户名。 |
| 代理密码 | 连接代理服务器时所需的认证密码。 |
| 代理主机私钥 | 连接代理服务器时所需的私钥。 |
### 采集指标
#### 指标集合:系统基本信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------|------|--------|
| hostname | 无 | 主机名称 |
| version | 无 | 操作系统版本 |
| uptime | 无 | 启动时间 |
#### 指标集合:CPU 信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|--------------------|
| info | 无 | CPU型号 |
| cores | 无 | CPU内核数量 |
| interrupt | 无 | CPU中断数量 |
| load | 无 | CPU最近1/5/15分钟的平均负载 |
| context_switch | 无 | 当前上下文切换数量 |
| usage | % | CPU使用率 |
#### 指标集合:内存信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|----------|
| total | Mb | 总内存容量 |
| used | Mb | 用户程序内存量 |
| free | Mb | 空闲内存容量 |
| buff_cache | Mb | 缓存占用内存 |
| available | Mb | 剩余可用内存容量 |
| usage | % | 内存使用率 |
#### 指标集合:磁盘信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------------|------|-----------|
| disk_num | 无 | 磁盘总数 |
| partition_num | 无 | 分区总数 |
| block_write | 无 | 写入磁盘的总块数 |
| block_read | 无 | 从磁盘读出的块数 |
| write_rate | iops | 每秒写磁盘块的速率 |
#### 指标集合:网卡信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|---------------|
| interface_name | 无 | 网卡名称 |
| receive_bytes | Byte | 入站数据流量(bytes) |
| transmit_bytes | Byte | 出站数据流量(bytes) |
#### 指标集合:文件系统
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|---------|
| filesystem | 无 | 文件系统的名称 |
| used | Mb | 已使用磁盘大小 |
| available | Mb | 可用磁盘大小 |
| usage | % | 使用率 |
| mounted | 无 | 挂载点目录 |
#### 指标集合:Top10 CPU进程
统计进程使用CPU的Top10进程。统计信息包括:进程ID、CPU占用率、内存占用率、执行命令。
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| pid | 无 | 进程ID |
| cpu_usage | % | CPU占用率 |
| mem_usage | % | 内存占用率 |
| command | 无 | 执行命令 |
#### 指标集合:Top10 内存进程
统计进程使用内存的Top10进程。统计信息包括:进程ID、内存占用率、CPU占用率、执行命令。
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| pid | 无 | 进程ID |
| mem_usage | % | 内存占用率 |
| cpu_usage | % | CPU占用率 |
| command | 无 | 执行命令 |
@@ -0,0 +1,94 @@
---
id: eureka_sd
title: 监控:Eureka服务发现监控
sidebar_label: Eureka服务发现
keywords: [开源监控系统, 开源服务发现监控, Eureka服务发现监控]
---
> HertzBeat 集成 Eureka 注册中心,自动发现服务实例并为发现的实例创建监控任务。
## 概述
Eureka 服务发现允许 HertzBeat 连接到您的 Eureka 服务器并自动发现所有注册的服务实例。当新服务实例注册或现有实例下线时,HertzBeat 将自动创建或删除相应的监控任务,实现微服务环境下的自动化监控。
### 监控前操作
#### 部署 Eureka 服务器
1. 根据 [Eureka 官方文档](https://spring.io/guides/gs/service-registration-and-discovery/)部署 Eureka 服务器。
2. 确保 Eureka 服务器可从 HertzBeat 访问。
3. 验证您可以访问 Eureka 控制台:`http://your-eureka-server:port/`
### 配置参数
| 参数名称 | 参数帮助描述 |
|---------------|-----------------------------------------------------|
| 任务名称 | 标识此监控的名称,名称需要保证唯一性 |
| Eureka服务发现地址 | Eureka 服务器地址。示例:`http://eureka-server:8761/eureka` |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 使用步骤
1. **创建服务发现监控**
- 在 HertzBeat Web 界面中,导航到 **监控****新增监控**
- 选择监控类型:**Eureka服务发现**
- 填写基本配置参数
2. **配置监控模板**
- 创建服务发现监控后,需要指定一个监控模板
- 模板定义了为发现的服务实例创建什么类型的监控
- 例如:如果发现的实例是 HTTP 服务,可以选择 HTTP 监控模板
- 常用模板类型:端口、HTTP、HTTPS 等
3. **自动发现**
- HertzBeat 会根据采集间隔定期查询 Eureka 服务器
- 为新注册的服务实例自动创建监控任务
- 自动删除已下线服务实例的监控任务
4. **查看发现的实例**
- 在监控列表中,您可以看到所有自动创建的子监控任务
- 每个子监控任务对应一个发现的服务实例
### 使用示例
假设您的 Eureka 服务器运行在 `http://192.168.1.100:8761/eureka`,您希望自动监控其中注册的所有服务实例。
配置示例:
- **任务名称**`Eureka-Service-Discovery`
- **Eureka服务发现地址**`http://192.168.1.100:8761/eureka`
- **采集间隔**`60`
- **监控模板**:选择 `端口` 监控(检测实例可用性)
配置完成后:
1. HertzBeat 连接到 Eureka 服务器
2. 获取所有已注册的应用实例
3. 为每个实例自动创建端口监控(例如:`USER-SERVICE-192.168.1.101:8080`
4. 每 60 秒检查一次新注册或下线的服务,并相应地更新监控任务
### 注意事项
- **网络连通性**:确保 HertzBeat 可以访问 Eureka 服务器地址
- **监控模板**:服务发现仅发现服务实例地址,您需要配置合适的监控模板来实际监控这些实例
- **采集间隔**:建议最小间隔为 60 秒,避免对 Eureka 服务器造成过多请求
- **权限要求**:Eureka 服务器默认不需要认证,但如果配置了认证,URL 需要包含用户名和密码
- **实例命名**:自动创建的监控任务命名格式为:`{应用名称}-{主机}:{端口}`
### 采集指标
#### 指标集合:监控目标
| 指标名称 | 指标单位 | 指标帮助描述 |
|------|-------|---------------|
| 目标 | 无 | 发现的服务实例目标 |
| 主机 | 无 | 服务实例主机地址 |
| 端口 | 无 | 服务实例端口号 |
### 适用场景
- **微服务架构**:自动监控 Eureka 中注册的所有微服务实例
- **动态伸缩**:自动适应因自动扩缩容而增减的服务实例
- **统一监控**:集中管理微服务环境中所有服务的监控
- **运维管理**:减少手动配置工作,提高运维效率
@@ -0,0 +1,114 @@
---
id: fedora
title: 监控:Fedora操作系统监控
sidebar_label: Fedora 操作系统
keywords: [ 开源监控系统, 开源操作系统监控, Fedora操作系统监控 ]
---
> 对Fedora操作系统的通用性能指标 (系统信息、CPU、内存、磁盘、网卡、文件系统、TOP资源进程等) 进行采集监控。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|---------------------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | Linux SSH对外提供的端口,默认为22。 |
| 超时时间 | 设置连接的超时时间,单位ms毫秒,默认6000毫秒。 |
| 复用连接 | 设置SSH连接是否复用,默认为:false。为false每次获取信息都会创建一个连接 |
| 使用代理 | 设置是否通过代理连接,默认为false。 |
| 用户名 | SSH连接用户名,可选 |
| 密码 | SSH连接密码,可选 |
| 采集器 | 配置此监控使用哪台采集器调度采集 |
| 监控周期 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 绑定标签 | 用于对监控资源进行分类管理 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
| 私钥 | 连接服务器所需的私钥 |
| 密钥短语 | 用于加密 SSH 私钥的密码短语(Passphrase)。如果私钥在生成时设置了密码短语,则必须填写此字段才能解密并使用私钥进行认证。 |
| 代理主机 | 代理服务器的地址,支持 IPV4、IPV6或域名。若使用 SSH 代理跳转访问目标主机,需填写代理服务器的地址。 |
| 代理端口 | 代理服务器的端口号,默认为22。 |
| 代理用户名 | 连接代理服务器时所需的认证用户名。 |
| 代理密码 | 连接代理服务器时所需的认证密码。 |
| 代理主机私钥 | 连接代理服务器时所需的私钥。 |
### 采集指标
#### 指标集合:系统基本信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------|------|--------|
| hostname | 无 | 主机名称 |
| version | 无 | 操作系统版本 |
| uptime | 无 | 启动时间 |
#### 指标集合:CPU 信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|--------------------|
| info | 无 | CPU型号 |
| cores | 无 | CPU内核数量 |
| interrupt | 无 | CPU中断数量 |
| load | 无 | CPU最近1/5/15分钟的平均负载 |
| context_switch | 无 | 当前上下文切换数量 |
| usage | % | CPU使用率 |
#### 指标集合:内存信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|----------|
| total | Mb | 总内存容量 |
| used | Mb | 用户程序内存量 |
| free | Mb | 空闲内存容量 |
| buff_cache | Mb | 缓存占用内存 |
| available | Mb | 剩余可用内存容量 |
| usage | % | 内存使用率 |
#### 指标集合:磁盘信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------------|------|-----------|
| disk_num | 无 | 磁盘总数 |
| partition_num | 无 | 分区总数 |
| block_write | 无 | 写入磁盘的总块数 |
| block_read | 无 | 从磁盘读出的块数 |
| write_rate | iops | 每秒写磁盘块的速率 |
#### 指标集合:网卡信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|---------------|
| interface_name | 无 | 网卡名称 |
| receive_bytes | Byte | 入站数据流量(bytes) |
| transmit_bytes | Byte | 出站数据流量(bytes) |
#### 指标集合:文件系统
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|---------|
| filesystem | 无 | 文件系统的名称 |
| used | Mb | 已使用磁盘大小 |
| available | Mb | 可用磁盘大小 |
| usage | % | 使用率 |
| mounted | 无 | 挂载点目录 |
#### 指标集合:Top10 CPU进程
统计进程使用CPU的Top10进程。统计信息包括:进程ID、CPU占用率、内存占用率、执行命令。
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| pid | 无 | 进程ID |
| cpu_usage | % | CPU占用率 |
| mem_usage | % | 内存占用率 |
| command | 无 | 执行命令 |
#### 指标集合:Top10 内存进程
统计进程使用内存的Top10进程。统计信息包括:进程ID、内存占用率、CPU占用率、执行命令。
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| pid | 无 | 进程ID |
| mem_usage | % | 内存占用率 |
| cpu_usage | % | CPU占用率 |
| command | 无 | 执行命令 |
@@ -0,0 +1,35 @@
---
id: flink
title: 监控:Flink
sidebar_label: Flink 监控
keywords: [开源监控系统, 开源 Flink 监控]
---
> 对 Flink 流引擎的通用指标进行测量监控。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | 监控的端口 |
| 查询超时时间 | 设置JVM连接的超时时间,单位ms毫秒,默认3000毫秒。 |
| SSL | 是否开启SSL(默认关闭) |
| 用户名 | 连接用户名 |
| 密码 | 连接密码 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:overview
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------------|------|----------|
| slots_total | 个 | 插槽总数 |
| slots_used | 个 | 已用插槽数 |
| task_total | 个 | 任务总数 |
| jobs_running | 个 | 正在运行的任务数 |
| jobs_failed | 个 | 已经失败的任务数 |
@@ -0,0 +1,143 @@
---
id: flink_on_yarn
title: 监控:Flink On Yarn
sidebar_label: Flink On Yarn 监控
keywords: [开源监控系统, 开源 Flink On Yarn 监控]
---
> 对Yarn运行模式下的Flink流引擎的通用指标进行测量监控。
> 监控指标对应的中文含义在本说明文档描述,页面监控显示的指标均为Flink原生指标没有翻译成中文,怕引发歧义。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|---------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| Yarn端口 | Yarn的端口,对应配置项:`yarn.resourcemanager.webapp.address`中的端口 |
| 查询超时时间 | 设置JVM连接的超时时间,单位ms毫秒,默认3000毫秒。 |
| 启动SSL | 是否启用SSL |
| 用户名 | 连接用户名 |
| 密码 | 连接密码 |
| 监控周期 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 绑定标签 | 用于对监控资源进行分类管理。 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息。 |
### 采集指标
#### 指标集合:JobManager Metrics
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------------------------------------------------------|------|-----------|
| Status.JVM.Memory.NonHeap.Committed | 字节 | 非堆内存的提交量 |
| Status.JVM.Memory.Mapped.TotalCapacity | 字节 | 映射内存的总容量 |
| Status.JVM.Memory.NonHeap.Used | 字节 | 非堆内存的使用量 |
| Status.JVM.Memory.Metaspace.Max | 字节 | 元空间的最大容量 |
| Status.JVM.GarbageCollector.G1_Old_Generation.Count | 字节 | 老年代垃圾收集次数 |
| Status.JVM.Memory.Direct.MemoryUsed | 字节 | 直接内存的使用量 |
| Status.JVM.Memory.Mapped.MemoryUsed | 字节 | 映射内存的使用量 |
| Status.JVM.GarbageCollector.G1_Young_Generation.Count | 字节 | 年轻代垃圾收集次数 |
| Status.JVM.Memory.Direct.TotalCapacity | 字节 | 直接内存的总容量 |
| Status.JVM.GarbageCollector.G1_Old_Generation.Time | 字节 | 老年代垃圾收集时间 |
| Status.JVM.Memory.Heap.Committed | 字节 | 堆内存的提交量 |
| Status.JVM.Memory.Mapped.Count | - | 映射内存的数量 |
| Status.JVM.Memory.Metaspace.Used | 字节 | 元空间的使用量 |
| Status.JVM.Memory.Direct.Count | - | 直接内存的数量 |
| Status.JVM.Memory.Heap.Used | 字节 | 堆内存的使用量 |
| Status.JVM.Memory.Heap.Max | 字节 | 堆内存的最大容量 |
| Status.JVM.GarbageCollector.G1_Young_Generation.Time | 字节 | 年轻代垃圾收集时间 |
| Status.JVM.Memory.NonHeap.Max | 字节 | 非堆内存的最大容量 |
#### 指标集合:JobManager Config
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------------------------------------------|------|------------------------|
| internal.jobgraph-path | - | 内部作业图路径 |
| env.java.home | - | Java 环境路径 |
| classloader.check-leaked-classloader | - | 是否检查类加载器 |
| env.java.opts | - | Java 选项 |
| high-availability.cluster-id | - | 高可用性集群 ID |
| jobmanager.rpc.address | - | JobManager 的 RPC 地址 |
| jobmanager.memory.jvm-overhead.min | 字节 | JobManager 的 JVM 开销最小值 |
| jobmanager.web.port | 端口号 | JobManager 的 Web 端口 |
| webclient.port | 端口号 | Web 客户端端口 |
| execution.savepoint.ignore-unclaimed-state | - | 是否忽略未声明的状态 |
| io.tmp.dirs | 路径 | 临时文件目录 |
| parallelism.default | - | 默认并行度 |
| taskmanager.memory.fraction | - | TaskManager 内存占比 |
| taskmanager.numberOfTaskSlots | - | TaskManager 的任务槽数量 |
| yarn.application.name | - | Yarn 应用名称 |
| taskmanager.heap.mb | MB | TaskManager 堆内存大小 |
| taskmanager.memory.process.size | GB | TaskManager 进程内存大小 |
| web.port | 端口号 | Web 端口 |
| classloader.resolve-order | - | 类加载器解析顺序 |
| jobmanager.heap.mb | MB | JobManager 堆内存大小 |
| jobmanager.memory.off-heap.size | 字节 | JobManager 堆外内存大小 |
| state.backend.incremental | - | 状态后端是否增量 |
| execution.target | - | 执行目标 |
| jobmanager.memory.process.size | GB | JobManager 进程内存大小 |
| web.tmpdir | 路径 | Web 临时目录 |
| yarn.ship-files | 路径 | Yarn 传输文件 |
| jobmanager.rpc.port | 端口号 | JobManager 的 RPC 端口 |
| internal.io.tmpdirs.use-local-default | - | 是否使用本地默认临时目录 |
| execution.checkpointing.interval | 毫秒 | 检查点间隔 |
| execution.attached | - | 是否附加执行 |
| internal.cluster.execution-mode | - | 内部集群执行模式 |
| execution.shutdown-on-attached-exit | - | 是否在附加退出时关闭 |
| pipeline.jars | 路径 | 管道 JAR 文件 |
| rest.address | - | REST 地址 |
| state.backend | - | 状态后端类型 |
| jobmanager.memory.jvm-metaspace.size | 字节 | JobManager JVM 元空间大小 |
| $internal.deployment.config-dir | 路径 | 内部部署配置目录 |
| $internal.yarn.log-config-file | 路径 | 内部 Yarn 日志配置文件路径 |
| jobmanager.memory.heap.size | 字节 | JobManager 堆内存大小 |
| state.checkpoints.dir | 路径 | 状态检查点目录 |
| jobmanager.memory.jvm-overhead.max | 字节 | JobManager 的 JVM 开销最大值 |
#### TaskManager
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------------------------------------|------|-----------------------------------|
| Container ID | - | 容器 ID,用于唯一标识一个容器 |
| Path | - | 容器路径 |
| Data Port | 端口号 | 数据传输端口 |
| JMX Port | 端口号 | JMXJava Management Extensions)端口 |
| Last Heartbeat | 时间戳 | 最后一次心跳时间 |
| All Slots | 数量 | 容器中所有任务槽的数量 |
| Free Slots | 数量 | 容器中空闲任务槽的数量 |
| totalResourceCpuCores | 核心数 | 容器总的CPU核心数 |
| totalResourceTaskHeapMemory | MB | 容器总的任务堆内存大小 |
| totalResourceManagedMemory | MB | 容器总的托管内存大小 |
| totalResourceNetworkMemory | MB | 容器总的网络内存大小 |
| freeResourceCpuCores | 核心数 | 容器中空闲的CPU核心数 |
| freeResourceTaskHeapMemory | MB | 容器中空闲的任务堆内存大小 |
| freeResourceTaskOffHeapMemory | MB | 容器中空闲的任务堆外内存大小 |
| freeResourceManagedMemory | MB | 容器中空闲的托管内存大小 |
| freeResourceNetworkMemory | MB | 容器中空闲的网络内存大小 |
| CPU Cores | 核心数 | CPU核心数 |
| Physical MEM | MB | 物理内存大小 |
| JVM Heap Size | MB | JVM堆内存大小 |
| Flink Managed MEM | MB | Flink管理的内存大小 |
| Framework Heap | MB | 框架堆内存大小 |
| Task Heap | MB | 任务堆内存大小 |
| Framework Off-Heap | MB | 框架堆外内存大小 |
| memoryConfigurationTaskOffHeap | Byte | 任务堆外内存配置 |
| Network | MB | 网络内存配置 |
| Managed Memory | MB | 托管内存配置 |
| JVM Metaspace | MB | JVM元空间大小 |
| JVM Overhead | MB | JVM开销 |
| memoryConfigurationTotalFlinkMemory | Byte | Flink总内存配置 |
| memoryConfigurationTotalProcessMemory | Byte | 进程总内存配置 |
#### TaskManager Metrics
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------------------------------|------|----------------------|
| Status.Shuffle.Netty.TotalMemory | MB | Netty Shuffle 使用的总内存 |
| Status.Flink.Memory.Managed.Used | MB | Flink 管理的已用内存 |
| Status.JVM.Memory.Metaspace.Used | MB | JVM 元空间已使用的内存 |
| Status.JVM.Memory.Metaspace.Max | MB | JVM 元空间的最大内存 |
| Status.JVM.Memory.Heap.Used | MB | JVM 堆内存已使用的内存 |
| Status.JVM.Memory.Heap.Max | MB | JVM 堆内存的最大容量 |
| Status.Flink.Memory.Managed.Total | MB | Flink 管理的内存总量 |
| Status.Shuffle.Netty.UsedMemory | MB | Netty Shuffle 使用的内存 |
@@ -0,0 +1,96 @@
---
id: freebsd
title: 监控:FreeBSD操作系统监控
sidebar_label: FreeBSD 操作系统
keywords: [ 开源监控系统, 开源操作系统监控, FreeBSD操作系统监控 ]
---
> 对FreeBSD操作系统的通用性能指标 (系统信息、CPU、内存、磁盘、网卡、文件系统、TOP资源进程等) 进行采集监控。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|---------------------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | Linux SSH对外提供的端口,默认为22。 |
| 超时时间 | 设置连接的超时时间,单位ms毫秒,默认6000毫秒。 |
| 复用连接 | 设置SSH连接是否复用,默认为:false。为false每次获取信息都会创建一个连接 |
| 使用代理 | 设置是否通过代理连接,默认为false。 |
| 用户名 | SSH连接用户名,可选 |
| 密码 | SSH连接密码,可选 |
| 采集器 | 配置此监控使用哪台采集器调度采集 |
| 监控周期 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 绑定标签 | 用于对监控资源进行分类管理 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
| 私钥 | 连接服务器所需的私钥 |
| 密钥短语 | 用于加密 SSH 私钥的密码短语(Passphrase)。如果私钥在生成时设置了密码短语,则必须填写此字段才能解密并使用私钥进行认证。 |
| 代理主机 | 代理服务器的地址,支持 IPV4、IPV6或域名。若使用 SSH 代理跳转访问目标主机,需填写代理服务器的地址。 |
| 代理端口 | 代理服务器的端口号,默认为22。 |
| 代理用户名 | 连接代理服务器时所需的认证用户名。 |
| 代理密码 | 连接代理服务器时所需的认证密码。 |
| 代理主机私钥 | 连接代理服务器时所需的私钥。 |
### 采集指标
#### 指标集合:系统基本信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------|------|--------|
| hostname | 无 | 主机名称 |
| version | 无 | 操作系统版本 |
| uptime | 无 | 启动时间 |
#### 指标集合:CPU 信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|--------------------|
| info | 无 | CPU型号 |
| cores | 无 | CPU内核数量 |
| interrupt | 无 | CPU中断数量 |
| load | 无 | CPU最近1/5/15分钟的平均负载 |
| context_switch | 无 | 当前上下文切换数量 |
| usage | % | CPU使用率 |
#### 指标集合:内存信息
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|----------|
| total | Mb | 总内存容量 |
| used | Mb | 用户程序内存量 |
| free | Mb | 空闲内存容量 |
| buff_cache | Mb | 缓存占用内存 |
| available | Mb | 剩余可用内存容量 |
| usage | % | 内存使用率 |
#### 指标集合:文件系统
| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|---------|
| filesystem | 无 | 文件系统的名称 |
| used | Mb | 已使用磁盘大小 |
| available | Mb | 可用磁盘大小 |
| usage | % | 使用率 |
| mounted | 无 | 挂载点目录 |
#### 指标集合:Top10 CPU进程
统计进程使用CPU的Top10进程。统计信息包括:进程ID、CPU占用率、内存占用率、执行命令。
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| pid | 无 | 进程ID |
| cpu_usage | % | CPU占用率 |
| mem_usage | % | 内存占用率 |
| command | 无 | 执行命令 |
#### 指标集合:Top10 内存进程
统计进程使用内存的Top10进程。统计信息包括:进程ID、内存占用率、CPU占用率、执行命令。
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| pid | 无 | 进程ID |
| mem_usage | % | 内存占用率 |
| cpu_usage | % | CPU占用率 |
| command | 无 | 执行命令 |
@@ -0,0 +1,56 @@
---
id: ftp
title: 监控:FTP服务器
sidebar_label: FTP服务器
keywords: [ 开源监控系统, 开源FTP服务器监控工具, 监控FTP指标 ]
---
> 采集和监控FTP服务的通用指标
**协议使用:FTP**
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|--------------------------------------|
| 目标Host | 被监控的IPv4、IPv6。注意⚠️不包含协议头(例如:ftp://)。 |
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | FTP服务端口,默认值:21。 |
| 目录 | FTP服务托管的目录。 |
| 超时时间 | 连接FTP服务器超时时间,默认值:1000毫秒。 |
| 用户名 | 连接FTP服务的用户名, 可选。 |
| 密码 | 连接FTP服务的密码,可选。 |
| 启用SFTP | 使用SFTP替代FTP;SFTP必须配置用户名和密码。 |
| SFTP主机密钥指纹 | 可信的SFTP服务器SHA-256指纹,每行一个或使用逗号分隔;除非显式跳过验证,否则必填。 |
| 跳过主机密钥验证 | **危险选项。** 仅应用于受控诊断;启用后无法验证SFTP服务器身份。 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒。 |
| 绑定标签 | 用于对监控资源进行分类管理。 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息。 |
## SFTP主机密钥验证
HertzBeat只接受已配置的SFTP主机密钥。请先获取服务器密钥,再通过服务器控制台、
配置管理系统或管理员等可信渠道核对指纹。单独使用`ssh-keyscan`不能证明服务器身份。
```shell
ssh-keyscan -p 22 sftp.example.com > /tmp/sftp-host-keys
ssh-keygen -lf /tmp/sftp-host-keys -E sha256
```
将核对后的`SHA256:...`填写到“SFTP主机密钥指纹”中。可以每行填写一个,也可以用
逗号分隔。
计划轮换主机密钥时,先通过可信渠道核对新密钥,将旧、新指纹同时加入配置,再轮换
服务器密钥;所有HertzBeat采集器都使用新密钥后,才能删除旧指纹。
SFTP监控和导入的配置必须至少固定一个指纹;只有操作员显式选择危险的跳过验证
选项时才允许省略。HertzBeat不会自动启用该选项。
### 采集指标
#### 指标集合:概要
| 指标名称 | 指标单位 | 指标帮助描述 |
|------|------|------------------|
| 活动状态 | 无 | 检查目录是否存在,且具有访问权限 |
| 响应时间 | ms | 连接FTP响应时间 |
@@ -0,0 +1,34 @@
---
id: fullsite
title: 监控:全站监控
sidebar_label: 全站监控
keywords: [开源监控系统, 开源网站监控, SiteMap监控]
---
> 对网站的全部页面监测是否可用
> 往往一个网站有多个不同服务提供的页面,我们通过采集网站暴露出来的网站地图SiteMap来监控全站。
> 注意⚠️,此监控需您网站支持SiteMap。我们支持XML和TXT格式的SiteMap。
## 配置参数
| 参数名称 | 参数帮助描述 |
|---------|------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | 网站对外提供的端口,http一般默认为80,https一般默认为443。 |
| 网站地图 | 网站SiteMap地图地址的相对路径,例如:/sitemap.xml。 |
| 启用HTTPS | 是否通过HTTPS访问网站,注意⚠️开启HTTPS一般默认对应端口需要改为443 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:summary
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------------|------|-----------------|
| url | 无 | 网页的URL路径 |
| statusCode | 无 | 请求此网页的响应HTTP状态码 |
| responseTime | ms毫秒 | 网站响应时间 |
| errorMsg | 无 | 请求此网站反馈的错误信息 |
@@ -0,0 +1,78 @@
---
id: grafana_dashboard
title: Grafana Dashboard
sidebar_label: Grafana历史图表
keywords: [Grafana, 历史图表]
---
> `Grafana`是一个开源的可视化和分析平台,它可以帮助你轻松地创建、分享和监控仪表板。本文将介绍如何在`HertzBeat`中使用`Grafana`展示历史数据。
## 前提条件
- 我们推荐使用最新的`Grafana`版本,早期的版本可能不支持暴露 api。
- `Grafana`服务已经启动,并配置好了账号密码。
- `HertzBeat`服务已经启动,并配置好了`VictoriaMetrics`时序数据库(注意: `VictoriaMetrics`数据源是必须的)。
:::caution 注意
`Grafana`只能展示`Prometheus`类型监控的历史数据,目前并不支持`HertzBeat``yml`定义的监控数据。
:::
### 启用Grafana可嵌入功能, 并配置匿名访问及权限角色
参考: [https://grafana.com/blog/2023/10/10/how-to-embed-grafana-dashboards-into-web-applications/](https://grafana.com/blog/2023/10/10/how-to-embed-grafana-dashboards-into-web-applications/),
修改配置文件`grafana.ini`中的配置项参数,
或者通过`docker`运行`Grafana`
修改配置文件`grafana.ini`中的以下配置项参数:
```ini
[auth.proxy]
enabled = true
[auth.anonymous]
enabled = true
org_role = Admin
[users]
viewers_can_edit = true
[security]
allow_embedding = true
```
或者通过`docker`启动`Grafana`,使用以下命令:
```bash
docker run -d -p 3000:3000 --name=grafana \
-v "$PWD/data:/var/lib/grafana" \
-e "GF_AUTH_PROXY_ENABLED=true" \
-e "GF_AUTH_ANONYMOUS_ENABLED=true" \
-e "GF_AUTH_ANONYMOUS_ORG_ROLE=Admin" \
-e "GF_USERS_VIEWERS_CAN_EDIT=true" \
-e "GF_SECURITY_ALLOW_EMBEDDING=true" \
grafana/grafana:latest
```
### 在HertzBeat中配置Grafana
`HertzBeat`的配置文件`application.yml`中,配置`Grafana`数据源:
```yaml
grafana:
enabled: true
url: http://127.0.0.1:3000
username: admin
password: admin
```
### 在HertzBeat监控中上传Grafana监控模板json文件
`HertzBeat`新建或编辑`Prometheus`类型监控时,点击启用Grafana模板,选择Grafana模板json文件上传。
监控模板json文件可以在 [https://grafana.com/grafana/dashboards/](https://grafana.com/grafana/dashboards/) 下载。
比如,在`HertzBeat`中新建一个关于`VictoriaMetrics`单节点的监控,然后打开 [https://grafana.com/grafana/dashboards/10229-victoriametrics-single-node/](https://grafana.com/grafana/dashboards/10229-victoriametrics-single-node/) ,点击右侧 `Download JSON`按钮,下载模板json文件。在`HertzBeat`监控中上传模板json文件,保存。
![grafana-1.png](/img/docs/help/grafana-1.png)
### 查看Grafana历史图表
`HertzBeat`监控页面,点击`Grafana`按钮,选择`Grafana`历史图表,选择监控模板,点击`查询`按钮,即可查看`Grafana`历史图表。
![grafana-2.png](/img/docs/help/grafana-2.png)
@@ -0,0 +1,55 @@
---
id: greenplum
title: 监控:GreenPlum 数据库监控
sidebar_label: GreenPlum 数据库
keywords: [开源监控系统, 开源数据库监控, GreenPlum 数据库监控]
---
> 对 GreenPlum 数据库的通用性能指标进行采集监控。支持 GreenPlum 6.23.0+。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|---------------------------------------------------|
| 监控Host | 被监控的 Host 地址。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | 数据库对外提供的端口,默认为5432。 |
| 查询超时时间 | 设置 SQL 查询未响应数据时的超时时间,单位 ms 毫秒,默认3000毫秒。 |
| 数据库名称 | 数据库实例名称,可选。 |
| 用户名 | 数据库连接用户名,可选 |
| 密码 | 数据库连接密码,可选 |
| URL | 数据库连接URL,可选,若配置,则 URL 里面的数据库名称,用户名密码等参数会覆盖上面配置的参数 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:basic
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------------|------|---------------|
| server_version | 无 | 数据库服务器的版本号 |
| port | 无 | 数据库服务器端暴露服务端口 |
| server_encoding | 无 | 数据库服务器端的字符集编码 |
| data_directory | 无 | 数据库存储数据盘地址 |
| max_connections | 连接数 | 数据库最大连接数 |
#### 指标集合:state
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|-------------------------------------------------------------------------|
| name | 无 | 数据库名称,或 share-object 为共享对象。 |
| conflicts | 次数 | 由于与恢复冲突而在这个数据库中被取消的查询的数目 |
| deadlocks | 个数 | 在这个数据库中被检测到的死锁数 |
| blks_read | 次数 | 在这个数据库中被读取的磁盘块的数量 |
| blks_hit | 次数 | 磁盘块被发现已经在缓冲区中的次数,这样不需要一次读取(这只包括 GreenPlum 缓冲区中的命中,而不包括在操作系统文件系统缓冲区中的命中) |
| blk_read_time | ms | 在这个数据库中后端花费在读取数据文件块的时间 |
| blk_write_time | ms | 在这个数据库中后端花费在写数据文件块的时间 |
| stats_reset | 无 | 这些统计信息上次被重置的时间 |
#### 指标集合:activity
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|------|----------|
| running | 连接数 | 当前客户端连接数 |
@@ -0,0 +1,144 @@
---
id: guide
title: 帮助中心
sidebar_label: 帮助入门
---
> 易用友好的实时监控工具,无需Agent,强大自定义监控能力。
> 使用过程中的帮助文档,辅助信息。
## 🔬 监控服务
> 定时采集监控对端服务暴露的性能指标,提供可视化界面,处理数据供告警等服务调度。
> 规划的监控类型:应用服务,数据库,操作系统,云原生,开源中间件
### 应用服务监控
&emsp;&#x1F449;&emsp;[网站监测](website) <br />
&emsp;&#x1F449;&emsp;[HTTP API](api) <br />
&emsp;&#x1F449;&emsp;[PING连通性](ping) <br />
&emsp;&#x1F449;&emsp;[端口可用性](port) <br />
&emsp;&#x1F449;&emsp;[全站监控](fullsite) <br />
&emsp;&#x1F449;&emsp;[SSL证书有效期](ssl_cert) <br />
&emsp;&#x1F449;&emsp;[JVM虚拟机](jvm) <br />
&emsp;&#x1F449;&emsp;[SpringBoot2.0](springboot2) <br />
&emsp;&#x1F449;&emsp;[DNS服务器](dns) <br />
&emsp;&#x1F449;&emsp;[FTP服务器](ftp) <br />
&emsp;&#x1F449;&emsp;[Websocket](websocket) <br />
&emsp;&#x1F449;&emsp;[MQTT连接](mqtt) <br />
### 应用程序监控
&emsp;&#x1F449;&emsp;[Linux进程](process) <br />
&emsp;&#x1F449;&emsp;[JVM虚拟机](jvm) <br />
&emsp;&#x1F449;&emsp;[SpringBoot2.0](springboot2) <br />
&emsp;&#x1F449;&emsp;[SpringBoot3.0](springboot3) <br />
&emsp;&#x1F449;&emsp;[DynamicTp线程池](dynamic_tp) <br />
### 数据库监控
&emsp;&#x1F449;&emsp;[MYSQL数据库监控](mysql) <br />
&emsp;&#x1F449;&emsp;[MariaDB数据库监控](mariadb) <br />
&emsp;&#x1F449;&emsp;[PostgreSQL数据库监控](postgresql) <br />
&emsp;&#x1F449;&emsp;[SqlServer数据库监控](sqlserver) <br />
&emsp;&#x1F449;&emsp;[Oracle数据库监控](oracle) <br />
&emsp;&#x1F449;&emsp;[达梦数据库监控](dm) <br />
&emsp;&#x1F449;&emsp;[OpenGauss数据库监控](opengauss) <br />
&emsp;&#x1F449;&emsp;[IoTDB数据库监控](iotdb) <br />
&emsp;&#x1F449;&emsp;[TiDB数据库监控](tidb) <br />
&emsp;&#x1F449;&emsp;[MongoDB数据库监控](mongodb) <br />
&emsp;&#x1F449;&emsp;[NebulaGraph集群监控](nebulagraph_cluster) <br />
### 缓存监控
&emsp;&#x1F449;&emsp;[Redis](redis) <br />
&emsp;&#x1F449;&emsp;[Memcached](memcached) <br />
### 操作系统监控
&emsp;&#x1F449;&emsp;[Linux操作系统监控](linux) <br />
&emsp;&#x1F449;&emsp;[Windows操作系统监控](windows) <br />
&emsp;&#x1F449;&emsp;[Ubuntu操作系统监控](ubuntu) <br />
&emsp;&#x1F449;&emsp;[Centos操作系统监控](centos) <br />
&emsp;&#x1F449;&emsp;[FreeBSD操作系统监控](freebsd) <br />
&emsp;&#x1F449;&emsp;[RedHat操作系统监控](redhat) <br />
&emsp;&#x1F449;&emsp;[RockyLinux操作系统监控](rockylinux) <br />
&emsp;&#x1F449;&emsp;[EulerOS操作系统监控](euleros) <br />
### 中间件监控
&emsp;&#x1F449;&emsp;[Zookeeper](zookeeper) <br />
&emsp;&#x1F449;&emsp;[Kafka](kafka) <br />
&emsp;&#x1F449;&emsp;[Tomcat](tomcat) <br />
&emsp;&#x1F449;&emsp;[ShenYu](shenyu) <br />
&emsp;&#x1F449;&emsp;[DynamicTp](dynamic_tp) <br />
&emsp;&#x1F449;&emsp;[RabbitMQ](rabbitmq) <br />
&emsp;&#x1F449;&emsp;[ActiveMQ](activemq) <br />
&emsp;&#x1F449;&emsp;[Jetty](jetty) <br />
&emsp;&#x1F449;&emsp;[Nacos](nacos) <br />
### 云原生监控
&emsp;&#x1F449;&emsp;[Docker](docker) <br />
&emsp;&#x1F449;&emsp;[Kubernetes](kubernetes) <br />
### 大数据监控
&emsp;&#x1F449;&emsp;[Clickhouse](clickhouse) <br />
&emsp;&#x1F449;&emsp;[ElasticSearch](elasticsearch) <br />
&emsp;&#x1F449;&emsp;[Flink](flink) <br />
### AI大模型监控
&emsp;&#x1F449;&emsp;[OpenAi](openai) <br />
### 网络监控
&emsp;&#x1F449;&emsp;[华为通用交换机](huawei_switch) <br />
### 服务器监控
## 💡 告警服务
> 更自由化的阈值告警配置,支持邮箱,短信,webhook,钉钉,企业微信,飞书机器人等告警通知。
> 告警服务的定位是阈值准确及时触发,告警通知及时可达。
### 告警中心
> 已触发的告警信息中心,提供告警删除,告警处理,标记未处理,告警级别状态等查询过滤。
详见&emsp;&#x1F449;&emsp;[告警中心](alarm_center)
### 告警配置
> 指标阈值配置,提供表达式形式的指标阈值配置,可设置告警级别,触发次数,告警通知模板和是否启用,关联监控等功能。
详见&emsp;&#x1F449;&emsp;[阈值告警](alert_threshold) <br />
&emsp;&emsp;&emsp;&#x1F449;&emsp;[阈值表达式](alert_threshold_expr)
### 告警收敛
> 通过分组收敛、告警抑制等功能合并相关告警,减少由一个事件引发的告警风暴,降低告警噪声,提升告警响应效率。
详见&emsp;&#x1F449;&emsp;[分组收敛](alarm_group) <br />
&emsp;&emsp;&emsp;&#x1F449;&emsp;[告警抑制](alarm_inhibit)
### 告警通知
> 触发告警信息后,除了显示在告警中心列表外,还可以用指定方式(邮件钉钉微信飞书等)通知给指定接收人。
> 告警通知提供设置不同类型的通知方式,如邮件接收人,企业微信机器人通知,钉钉机器人通知,飞书机器人通知。
> 接收人设置后需要设置关联的告警通知策略,来配置哪些告警信息发给哪些接收人。
&emsp;&#x1F449;&emsp;[配置邮箱通知](alert_email) <br />
&emsp;&#x1F449;&emsp;[配置 Webhook 通知](alert_webhook) <br />
&emsp;&#x1F449;&emsp;[配置 Telegram 通知](alert_telegram) <br />
&emsp;&#x1F449;&emsp;[配置 Discord 通知](alert_discord) <br />
&emsp;&#x1F449;&emsp;[配置 Slack 通知](alert_slack) <br />
&emsp;&#x1F449;&emsp;[配置企业微信机器人通知](alert_wework) <br />
&emsp;&#x1F449;&emsp;[配置钉钉机器人通知](alert_dingtalk) <br />
&emsp;&#x1F449;&emsp;[配置飞书机器人通知](alert_feishu) <br />
&emsp;&#x1F449;&emsp;[配置华为云SMN通知](alert_smn) <br />
### 插件
&emsp;&#x1F449;&emsp;[插件](plugin) <br />
@@ -0,0 +1,136 @@
---
id: h2
title: H2 数据库 - 仅供测试,禁止生产环境使用
sidebar_label: H2 数据库(仅供测试)
keywords: [开源监控工具, H2 数据库, 测试, 禁止生产环境, 安全警告]
---
> ⚠️ **严重安全警告**:H2 数据库**不适合生产环境**。它仅供本地测试和开发使用。在生产环境中使用 H2 会使您的服务器面临严重的安全漏洞。在使用 H2 之前,请仔细阅读本页面。
## 🔴 安全风险 - 使用前必读
### 什么是 H2 数据库?
H2 是一个开源的 Java SQL 数据库。HertzBeat 内置 H2 作为**默认嵌入式数据库**,以便在无需单独安装数据库的情况下快速进行测试和评估。
### 为什么 H2 在生产环境中危险
H2 拥有一个叫做 `CREATE ALIAS` 的内置功能,允许在数据库查询中执行任意 Java 代码。这意味着:
```sql
-- 极其危险的 H2 功能示例:
CREATE ALIAS EXEC AS $$
String exec(String cmd) throws Exception {
Runtime.getRuntime().exec(cmd);
return null;
}
$$;
-- 可以在服务器上执行 Shell 命令:
CALL EXEC('rm -rf /重要数据');
```
如果您的 H2 数据库被恶意用户访问,他们可以:
- **在 HertzBeat 服务器上执行任意 Shell 命令**
- **读取 HertzBeat 进程可访问的任何文件**
- **完全控制运行 HertzBeat 的服务器**
- **访问所有监控数据**,包括敏感凭据
📖 详细信息请参阅官方 [H2 安全文档](https://h2database.com/html/security.html)。
### 网络暴露风险
H2 可以以服务器模式运行,可能在网络上暴露数据库管理界面。默认情况下,H2 使用端口 **8082**Web 控制台)和 **9092**(TCP 服务器)。如果这些端口可以从外部访问,任何用户都可以直接连接到您的数据库。
---
## ✅ H2 适合的场景
- **本地开发**:快速搭建评估 HertzBeat 功能
- **自动化测试**:隔离环境中的 CI/CD 流水线
- **演示展示**:向利益相关者展示 HertzBeat
- **学习了解**:在生产部署前了解 HertzBeat
---
## 🚫 H2 不适合的场景
- 生产部署
- 多用户环境
- 含有敏感监控数据的系统
- 可从互联网访问的 HertzBeat 实例
- 需要跨重启数据持久化的环境
- 高可用性部署
---
## 🔒 迁移到生产数据库
对于生产使用,请迁移到以下支持的数据库之一:
### MySQL / MariaDB(推荐用于大多数部署)
1. 安装 MySQL 5.7+ 或 MariaDB 10.5+
2. 创建专用数据库和用户:
```sql
CREATE DATABASE hertzbeat;
CREATE USER 'hertzbeat'@'localhost' IDENTIFIED BY '强密码';
GRANT ALL PRIVILEGES ON hertzbeat.* TO 'hertzbeat'@'localhost';
FLUSH PRIVILEGES;
```
3. 更新 `application.yml`
```yaml
spring:
datasource:
url: jdbc:mysql://localhost:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8
username: hertzbeat
password: 强密码
driver-class-name: com.mysql.cj.jdbc.Driver
```
4. 下载 MySQL JDBC 驱动并放入 `ext-lib/`
5. 重启 HertzBeat
### PostgreSQL(推荐用于企业部署)
1. 安装 PostgreSQL 12+
2. 创建数据库和用户:
```sql
CREATE USER hertzbeat WITH PASSWORD '强密码';
CREATE DATABASE hertzbeat OWNER hertzbeat;
GRANT ALL PRIVILEGES ON DATABASE hertzbeat TO hertzbeat;
```
3. 更新 `application.yml`
```yaml
spring:
datasource:
url: jdbc:postgresql://localhost:5432/hertzbeat
username: hertzbeat
password: 强密码
driver-class-name: org.postgresql.Driver
```
---
## 📋 生产部署前安全检查清单
在任何非测试环境中部署 HertzBeat 之前,请验证:
- [ ] H2 数据库已替换为 MySQL 或 PostgreSQL
- [ ] H2 Web 控制台已禁用
- [ ] 数据库凭据强大且唯一
- [ ] 数据库无法直接从互联网访问
- [ ] HertzBeat 通过带 SSL 的反向代理运行
- [ ] 监控凭据已加密且受访问控制保护
- [ ] 已配置定期数据库备份
---
> **记住**:H2 的便利性是以安全为代价换来的。在任何实际环境中部署 HertzBeat 之前,请务必计划迁移到生产级数据库。
@@ -0,0 +1,89 @@
---
id: hadoop
title: 监控:Hadoop
sidebar_label: Apache Hadoop
keywords: [开源监控系统, 开源JAVA监控, Hadoop的JVM虚拟机监控]
---
> 对Hadoop的JVM虚拟机的通用性能指标进行采集监控
**使用协议:JMX**
## 监控前操作
>
> 您需要在 Hadoop 应用开启 `JMX` 服务,HertzBeat 使用 JMX 协议对Hadoop中的 JVM 进行指标采集。
### Hadoop应用开启JMX协议步骤
应用启动时添加JVM参数 ⚠️注意可自定义暴露端口,对外IP
- 1.进入hadoop-env.sh配置文件,在命令行终端输入以下命令:
```shell
vi $HADOOP_HOME/etc/hadoop/hadoop-env.sh
```
- 2.添加如下参数,`<port>` 为自定义暴露端口号。
```shell
export HADOOP_OPTS= "$HADOOP_OPTS
-Djava.rmi.server.hostname=对外ip地址
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false "
```
- 3.保存并退出,并在 $HADOOP_HOME/sbin 目录下执行 `start-all.sh` 重启服务。
### 配置参数
| 参数名称 | 参数帮助描述 |
|--------|------------------------------------------------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 查询超时时间 | 设置JVM连接的超时时间,单位ms毫秒,默认3000毫秒。 |
| 用户名 | JMX连接用户名 |
| 密码 | JMX连接密码 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:memory_pool
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| name | 无 | 指标名称 |
| committed | kb | 总量 |
| init | kb | 初始化大小 |
| max | kb | 最大 |
| used | kb | 已使用 |
#### 指标集合:code_cache (限JDK8及以下)
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| committed | kb | 总量 |
| init | kb | 初始化大小 |
| max | kb | 最大 |
| used | kb | 已使用 |
#### 指标集合:class_loading
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------------------|------|----------|
| LoadedClassCount | 个 | 已加载类数量 |
| TotalLoadedClassCount | 个 | 历史已加载类总量 |
| UnloadedClassCount | 个 | 未加载类数量 |
#### 指标集合:thread
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------------------------|------|-----------|
| TotalStartedThreadCount | 个 | 已经开始的线程数量 |
| ThreadCount | 个 | 线程数 |
| PeakThreadCount | 个 | 未加载类数量 |
| DaemonThreadCount | 个 | 守护进程数 |
| CurrentThreadUserTime | ms | 使用时间 |
| CurrentThreadCpuTime | ms | 使用CPU时间 |
@@ -0,0 +1,59 @@
---
id: hbase_master
title: 监控:Hbase Master监控
sidebar_label: Apache Hbase Master
keywords: [开源监控系统, 开源数据库监控, HbaseMaster监控]
---
> 对Hbase Master的通用性能指标进行采集监控
**使用协议:HTTP**
## 监控前操作
查看 `hbase-site.xml` 文件,获取 `hbase.master.info.port` 配置项的值,该值用作监控使用。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|---------------------------------------------------------|
| 目标Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 端口 | hbase master的端口号,默认为16010。即:`hbase.master.info.port`参数值 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 查询超时时间 | 设置连接的超时时间,单位ms毫秒,默认3000毫秒。 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
#### 指标集合:server
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------------|------|-------------------------|
| numRegionServers | 无 | 当前存活的 RegionServer 个数 |
| numDeadRegionServers | 无 | 当前Dead的 RegionServer 个数 |
| averageLoad | 无 | 集群平均负载 |
| clusterRequests | 无 | 集群请求数量 |
#### 指标集合:Rit
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------------------|------|--------------|
| ritCount | 无 | 当前的 RIT 数量 |
| ritCountOverThreshold | 无 | 超过阈值的 RIT 数量 |
| ritOldestAge | ms | 最老的RIT的持续时间 |
#### 指标集合:basic
| 指标名称 | 指标单位 | 指标帮助描述 |
|-------------------------|------|--------------------|
| liveRegionServers | 无 | 当前活跃RegionServer列表 |
| deadRegionServers | 无 | 当前离线RegionServer列表 |
| zookeeperQuorum | 无 | Zookeeper列表 |
| masterHostName | 无 | Master节点 |
| BalancerCluster_num_ops | 无 | 集群负载均衡次数 |
| numActiveHandler | 无 | RPC句柄数 |
| receivedBytes | MB | 集群接收数据量 |
| sentBytes | MB | 集群发送数据量(MB) |
| clusterRequests | 无 | 集群总请求数量 |
@@ -0,0 +1,93 @@
---
id: hbase_regionserver
title: 监控:Hbase RegionServer监控
sidebar_label: Apache Hbase RegionServer
keywords: [开源监控系统, 开源数据库监控, RegionServer监控]
---
> 对Hbase RegionServer的通用性能指标进行采集监控
**使用协议:HTTP**
## 监控前操作
查看 `hbase-site.xml` 文件,获取 `hbase.regionserver.info.port` 配置项的值,该值用作监控使用。
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|---------------------------------------------------------------------|
| 目标Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 端口 | hbase regionserver的端口号,默认为16030。即:`hbase.regionserver.info.port`参数值 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 查询超时时间 | 设置连接的超时时间,单位ms毫秒,默认3000毫秒。 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
> 所有指标名称均直接引用官方的字段,所以存在命名不规范。
#### 指标集合:server
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------------------------------|-------|-----------------------------------------|
| regionCount | 无 | Region数量 |
| readRequestCount | 无 | 重启集群后的读请求数量 |
| writeRequestCount | 无 | 重启集群后的写请求数量 |
| averageRegionSize | MB | 平均Region大小 |
| totalRequestCount | 无 | 全部请求数量 |
| ScanTime_num_ops | 无 | Scan 请求总量 |
| Append_num_ops | 无 | Append 请求量 |
| Increment_num_ops | 无 | Increment请求量 |
| Get_num_ops | 无 | Get 请求量 |
| Delete_num_ops | 无 | Delete 请求量 |
| Put_num_ops | 无 | Put 请求量 |
| ScanTime_mean | 无 | 平均 Scan 请求时间 |
| ScanTime_min | 无 | 最小 Scan 请求时间 |
| ScanTime_max | 无 | 最大 Scan 请求时间 |
| ScanSize_mean | bytes | 平均 Scan 请求大小 |
| ScanSize_min | 无 | 最小 Scan 请求大小 |
| ScanSize_max | 无 | 最大 Scan 请求大小 |
| slowPutCount | 无 | 慢操作次数/Put |
| slowGetCount | 无 | 慢操作次数/Get |
| slowAppendCount | 无 | 慢操作次数/Append |
| slowIncrementCount | 无 | 慢操作次数/Increment |
| slowDeleteCount | 无 | 慢操作次数/Delete |
| blockCacheSize | 无 | 缓存块内存占用大小 |
| blockCacheCount | 无 | 缓存块数量_Block Cache 中的 Block 数量 |
| blockCacheExpressHitPercent | 无 | 读缓存命中率 |
| memStoreSize | 无 | Memstore 大小 |
| FlushTime_num_ops | 无 | RS写磁盘次数/Memstore flush 写磁盘次数 |
| flushQueueLength | 无 | Region Flush 队列长度 |
| flushedCellsSize | 无 | flush到磁盘大小 |
| storeFileCount | 无 | Storefile 个数 |
| storeCount | 无 | Store 个数 |
| storeFileSize | 无 | Storefile 大小 |
| compactionQueueLength | 无 | Compaction 队列长度 |
| percentFilesLocal | 无 | Region 的 HFile 位于本地 HDFS Data Node的比例 |
| percentFilesLocalSecondaryRegions | 无 | Region 副本的 HFile 位于本地 HDFS Data Node的比例 |
| hlogFileCount | 无 | WAL 文件数量 |
| hlogFileSize | 无 | WAL 文件大小 |
#### 指标集合:IPC
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------------------------|------|--------------|
| numActiveHandler | 无 | 当前的 RIT 数量 |
| NotServingRegionException | 无 | 超过阈值的 RIT 数量 |
| RegionMovedException | ms | 最老的RIT的持续时间 |
| RegionTooBusyException | ms | 最老的RIT的持续时间 |
#### 指标集合:JVM
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------------|------|--------------------|
| MemNonHeapUsedM | 无 | 当前活跃RegionServer列表 |
| MemNonHeapCommittedM | 无 | 当前离线RegionServer列表 |
| MemHeapUsedM | 无 | Zookeeper列表 |
| MemHeapCommittedM | 无 | Master节点 |
| MemHeapMaxM | 无 | 集群负载均衡次数 |
| MemMaxM | 无 | RPC句柄数 |
| GcCount | MB | 集群接收数据量 |
@@ -0,0 +1,56 @@
---
id: hdfs_datanode
title: 监控:Apache HDFS DataNode监控
sidebar_label: Apache HDFS DataNode
keywords: [大数据监控系统, 分布式文件系统监控, Apache HDFS DataNode监控]
---
> HertzBeat 对 Apache HDFS DataNode 节点监控指标进行监控。
**使用协议:HTTP**
## 监控前操作
获取 Apache HDFS DataNode 的 HTTP 监控端口。 取值:`dfs.datanode.http.address`
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|----------------------------------------------|
| 目标Host | 被监控的对端IPV4,IPV6或域名。不带协议头。 |
| 端口 | Apache HDFS DataNode 的监控端口号,默认为50075。 |
| 查询超时时间 | 查询 Apache HDFS DataNode 的超时时间,单位毫秒,默认6000毫秒。 |
| 指标采集间隔 | 监控数据采集的时间间隔,单位秒,最小间隔为30秒。 |
| 是否探测 | 新增监控前是否先探测检查监控可用性。 |
| 描述备注 | 此监控的更多描述和备注信息。 |
### 采集指标
#### 指标集合:FSDatasetState
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|-------------------|
| DfsUsed | GB | DataNode HDFS使用量 |
| Remaining | GB | DataNode HDFS剩余空间 |
| Capacity | GB | DataNode HDFS空间总量 |
#### 指标集合:JvmMetrics
| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------------|------|-------------------------------|
| MemNonHeapUsedM | MB | JVM 当前已经使用的 NonHeapMemory 的大小 |
| MemNonHeapCommittedM | MB | JVM 配置的 NonHeapCommittedM 的大小 |
| MemHeapUsedM | MB | JVM 当前已经使用的 HeapMemory 的大小 |
| MemHeapCommittedM | MB | JVM HeapMemory 提交大小 |
| MemHeapMaxM | MB | JVM 配置的 HeapMemory 的大小 |
| MemMaxM | MB | JVM 运行时可以使用的最大内存大小 |
| ThreadsRunnable | 个 | 处于 RUNNABLE 状态的线程数量 |
| ThreadsBlocked | 个 | 处于 BLOCKED 状态的线程数量 |
| ThreadsWaiting | 个 | 处于 WAITING 状态的线程数量 |
| ThreadsTimedWaiting | 个 | 处于 TIMED WAITING 状态的线程数量 |
#### 指标集合:runtime
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| StartTime | | 启动时间 |
@@ -0,0 +1,92 @@
---
id: hdfs_namenode
title: 监控:Apache HDFS NameNode监控
sidebar_label: Apache HDFS NameNode
keywords: [大数据监控系统, 分布式文件系统监控, Apache HDFS NameNode监控]
---
> HertzBeat 对 Apache HDFS NameNode 节点监控指标进行监控。
**使用协议:HTTP**
## 监控前操作
获取 Apache HDFS NameNode 的 HTTP 监控端口。取值:`dfs.namenode.http-address`
## 配置参数
| 参数名称 | 参数帮助描述 |
|--------|---------------------------------------|
| 目标Host | 被监控的对端IPV4,IPV6或域名。不带协议头。 |
| 端口 | HDFS NameNode 的监控端口号,默认为50070。 |
| 查询超时时间 | 查询 HDFS NameNode 的超时时间,单位毫秒,默认6000毫秒。 |
| 指标采集间隔 | 监控数据采集的时间间隔,单位秒,最小间隔为30秒。 |
| 是否探测 | 新增监控前是否先探测检查监控可用性。 |
| 描述备注 | 此监控的更多描述和备注信息。 |
### 采集指标
#### 指标集合:FSNamesystem
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------------------------------|------|---------------------------------------------|
| CapacityTotal | | 集群存储总容量 |
| CapacityTotalGB | GB | 集群存储总容量 |
| CapacityUsed | | 集群存储已使用容量 |
| CapacityUsedGB | GB | 集群存储已使用容量 |
| CapacityRemaining | | 集群存储剩余容量 |
| CapacityRemainingGB | GB | 集群存储剩余容量 |
| CapacityUsedNonDFS | | 集群非 HDFS 使用容量 |
| TotalLoad | | 整个集群的客户端连接数 |
| FilesTotal | | 集群文件总数量 |
| BlocksTotal | | 总 BLOCK 数量 |
| PendingReplicationBlocks | | 等待被备份的块数量 |
| UnderReplicatedBlocks | | 副本数不够的块数量 |
| CorruptBlocks | | 坏块数量 |
| ScheduledReplicationBlocks | | 安排要备份的块数量 |
| PendingDeletionBlocks | | 等待被删除的块数量 |
| ExcessBlocks | | 多余的块数量 |
| PostponedMisreplicatedBlocks | | 被推迟处理的异常块数量 |
| NumLiveDataNodes | | 活的数据节点数量 |
| NumDeadDataNodes | | 已经标记为 Dead 状态的数据节点数量 |
| NumDecomLiveDataNodes | | 下线且 Live 的节点数量 |
| NumDecomDeadDataNodes | | 下线且 Dead 的节点数量 |
| NumDecommissioningDataNodes | | 正在下线的节点数量 |
| TransactionsSinceLastCheckpoint | | 从上次Checkpoint之后的事务数量 |
| LastCheckpointTime | | 上一次Checkpoint时间 |
| PendingDataNodeMessageCount | | DATANODE 的请求被 QUEUE 在 standby namenode 中的个数 |
#### 指标集合:RPC
| 指标名称 | 指标单位 | 指标帮助描述 |
|--------------------|------|----------|
| ReceivedBytes | | 接收数据速率 |
| SentBytes | | 发送数据速率 |
| RpcQueueTimeNumOps | | RPC 调用速率 |
#### 指标集合:runtime
| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| StartTime | | 启动时间 |
#### 指标集合:JvmMetrics
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------------------------------|------|-------------------------------|
| MemNonHeapUsedM | MB | JVM 当前已经使用的 NonHeapMemory 的大小 |
| MemNonHeapCommittedM | MB | JVM 配置的 NonHeapCommittedM 的大小 |
| MemHeapUsedM | MB | JVM 当前已经使用的 HeapMemory 的大小 |
| MemHeapCommittedM | MB | JVM HeapMemory 提交大小 |
| MemHeapMaxM | MB | JVM 配置的 HeapMemory 的大小 |
| MemMaxM | MB | JVM 运行时可以使用的最大内存大小 |
| GcCountParNew | 次 | 新生代GC消耗时间 |
| GcTimeMillisParNew | 毫秒 | 新生代GC消耗时间 |
| GcCountConcurrentMarkSweep | 毫秒 | 老年代GC次数 |
| GcTimeMillisConcurrentMarkSweep | 个 | 老年代GC消耗时间 |
| GcCount | 个 | GC次数 |
| GcTimeMillis | 个 | GC消耗时间 |
| ThreadsRunnable | 个 | 处于 BLOCKED 状态的线程数量 |
| ThreadsBlocked | 个 | 处于 BLOCKED 状态的线程数量 |
| ThreadsWaiting | 个 | 处于 WAITING 状态的线程数量 |
| ThreadsTimedWaiting | 个 | 处于 TIMED WAITING 状态的线程数量 |
@@ -0,0 +1,60 @@
---
id: hikvision_isapi
title: 监控 海康ISAPI
sidebar_label: 海康ISAPI
keywords: [ monitor, hikvision_isapi, 海康 ]
---
> 通过ISAPI接口监控海康威视设备状态,获取设备健康数据。
## 监控配置参数
| 参数名称 | 参数帮助描述 |
| ----------- | ----------- |
| 监控Host | 被监控的对端IP或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | 网络请求端口,默认为80。 |
| 超时时间 | 设置超时时间,单位ms毫秒,默认5000毫秒。 |
| 用户名 | 海康设备登录用户名。 |
| 密码 | 海康设备登录密码。 |
| 启用HTTPS | 是否启用HTTPS,默认未启用。 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
## 采集指标
### 系统信息
- 设备名称
- 设备ID
- 固件版本
- 设备型号
- mac地址
### 设备状态
- CPU 利用率(%)
- 内存使用量(MB)
- 可用内存(MB)
- 缓存大小(MB)
- 网口1速度(Mbps)
- 网口2速度(Mbps)
- 启动时间
- 运行时长
- 上次校时时间
- 上次校时时间差(s)
- 平均上传耗时(ms)
- 最大上传耗时(ms)
- 最小上传耗时(ms)
- 上次校时模式
- 上次校时地址
- 响应时间(ms)
## 监控实现原理
通过海康威视设备的ISAPI接口获取设备信息和状态:
1. 采集系统信息:`/ISAPI/System/deviceInfo`
2. 采集设备状态:`/ISAPI/System/status`
采用HTTP协议Digest认证方式访问接口,解析XML格式响应数据获取监控指标。
@@ -0,0 +1,76 @@
---
id: hive
title: 监控 Apache Hive
sidebar_label: Apache Hive
keywords: [开源监控工具, 开源 Apache Hive 监控工具, 监控 Apache Hive 指标]
---
> 收集和监控由 Apache Hive 提供的常规性能指标。
## 监控前操作
如果您想使用此监控类型监控 Apache Hive 的信息,您需要以远程模式启动您的 Hive Server2。
**1、启用元数据存储:**
```shell
hive --service metastore &
```
**2. 启用 Hive Server2:**
```shell
hive --service hiveserver2 &
```
### 配置参数
| 参数名称 | 参数描述 |
|----------|--------------------------------------------------------|
| 监控主机 | 被监控的目标 IPV4、IPV6 或域名。注意⚠️不要包含协议头(例如:https://http://)。 |
| 监控名称 | 用于标识此监控的名称,需要保证唯一性。 |
| 端口 | 数据库提供的默认端口为 10002。 |
| 启用 HTTPS | 是否通过 HTTPS 访问网站,请注意⚠️当启用 HTTPS 时,需要将默认端口更改为 443 |
| 采集间隔 | 监控周期性采集数据的时间间隔,单位为秒,最小间隔为 30 秒。 |
| 是否探测 | 在新增监控前是否先进行可用性探测,只有探测成功才会继续新增或修改操作。 |
| 描述备注 | 用于添加关于监控的额外标识和描述信息。 |
### 采集指标
#### 指标收集: 基本信息
| 指标名称 | 指标单位 | 指标描述 |
|--------|------|-----------------------------|
| 虚拟机名称 | 无 | 运行 HiveServer2 的虚拟机(VM)的名称。 |
| 虚拟机供应商 | 无 | 虚拟机的供应商或提供者。 |
| 虚拟机版本 | 无 | 虚拟机的版本。 |
| 允许持续时间 | 无 | HiveServer2 运行的持续时间。 |
#### 指标收集: 环境信息
| 指标名称 | 指标单位 | 指标描述 |
|------------|------|--------------------------------|
| HTTPS代理端口号 | 无 | 用于 HTTPS 代理通信的端口号。 |
| 操作系统 | 无 | 运行 HiveServer2 的操作系统的名称。 |
| 操作系统版本 | 无 | 操作系统的版本。 |
| 操作系统架构 | 无 | 操作系统的架构。 |
| java运行环境 | 无 | HiveServer2 使用的 Java 运行时环境的名称。 |
| java运行环境版本 | 无 | Java 运行时环境的版本。 |
#### 指标收集: 线程信息
| 指标名称 | 指标单位 | 指标描述 |
|--------|------|------------------------------|
| 线程数量 | None | HiveServer2 当前正在使用的线程数。 |
| 总启动线程数 | None | HiveServer2 启动以来启动的线程总数。 |
| 最高线程数 | None | HiveServer2 在任何给定时间使用的最高线程数。 |
| 守护线程数 | None | HiveServer2 当前活动的守护线程数。 |
#### 指标收集: 代码缓存
| 指标名称 | 指标单位 | 指标描述 |
|------------|------|---------------|
| 内存池当前内存 | MB | 当前为内存池分配的内存量。 |
| 内存池初始内存 | MB | 内存池请求的初始内存量。 |
| 内存池可分配最大内存 | MB | 内存池可分配的最大内存量。 |
| 内存池内存使用量 | MB | 内存池已使用内存量 |
@@ -0,0 +1,234 @@
---
id: http_sd
title: 监控:HTTP服务发现监控
sidebar_label: HTTP服务发现
keywords: [开源监控系统, 开源服务发现监控, HTTP服务发现监控]
---
> HertzBeat 集成自定义 HTTP API,自动发现服务实例并为发现的实例创建监控任务。
## 概述
HTTP 服务发现允许 HertzBeat 通过调用您的自定义 HTTP API 来发现服务实例。这是最灵活的服务发现方式,适用于任何可以通过 HTTP API 暴露服务实例信息的系统。您只需提供一个返回指定格式目标地址列表的 HTTP 端点即可。
### 监控前操作
#### 准备 HTTP API
您需要提供或开发一个满足以下要求的 HTTP API:
1. **HTTP 方法**:支持 GET 请求
2. **响应格式**:返回 JSON 格式数组
3. **响应结构**:必须是数组格式,每个元素包含 `target` 字段(注意是单数),该字段为字符串数组,每个字符串是一个服务实例地址,格式为 `host:port`
4. **可访问性**:该 API 必须可从 HertzBeat 访问
#### API 响应示例
```json
[
{
"target": [
"192.168.1.101:8080",
"192.168.1.102:8080",
"192.168.1.103:8080",
"api.example.com:443"
]
}
]
```
### 配置参数
| 参数名称 | 参数帮助描述 |
|------------------|-----------------------------------------------------|
| 任务名称 | 标识此监控的名称,名称需要保证唯一性 |
| 服务发现地址 | 用于服务发现的 HTTP API 地址,必须以 http:// 或 https:// 开头。示例:`http://api.example.com/services` |
| 认证方式 | 认证方式,可选值:`Bearer Token``Basic Auth``Digest Auth`。默认:无 |
| 访问令牌 | 当认证方式为 Bearer Token 时用于认证的令牌 |
| 用户名 | 当认证方式为 Basic Auth 或 Digest Auth 时用于认证的用户名 |
| 密码 | 当认证方式为 Basic Auth 或 Digest Auth 时用于认证的密码 |
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 使用步骤
1. **准备 HTTP API**
- 开发或配置一个返回服务实例列表的 API 端点
- 确保 API 返回正确格式的 JSON 数据
- 测试 API 的可访问性和响应格式
2. **创建服务发现监控**
- 在 HertzBeat Web 界面中,导航到 **监控****新增监控**
- 选择监控类型:**HTTP服务发现**
- 填写基本配置参数
- 根据需要配置认证信息
3. **配置监控模板**
- 创建服务发现监控后,需要指定一个监控模板
- 模板定义了为发现的服务实例创建什么类型的监控
- 常用模板类型:端口、HTTP、HTTPS、Ping 等
4. **自动发现**
- HertzBeat 会根据采集间隔定期调用您的 HTTP API
- 为新发现的服务实例自动创建监控任务
- 自动删除已消失服务实例的监控任务
### 使用示例
#### 示例 1:无需认证的 API
假设您有一个服务管理 API
- **API 地址**`http://service-manager.example.com/api/v1/services`
- **响应**
```json
[
{
"target": [
"10.0.1.10:8080",
"10.0.1.11:8080",
"10.0.1.12:8080"
]
}
]
```
配置示例:
- **任务名称**`HTTP-Service-Discovery`
- **服务发现地址**`http://service-manager.example.com/api/v1/services`
- **认证方式**:留空(无需认证)
- **采集间隔**`60` 秒
- **监控模板**:选择 `端口` 监控
#### 示例 2:使用 Bearer Token 认证的 API
如果您的 API 需要 Bearer Token 认证:
- **API 地址**`https://api.example.com/services`
- **认证方式**`Bearer Token`
- **访问令牌**`your-bearer-token-here`
配置示例:
- **任务名称**`Secure-API-Discovery`
- **服务发现地址**`https://api.example.com/services`
- **认证方式**:选择 `Bearer Token`
- **访问令牌**:输入您的令牌
- **监控模板**:选择 `HTTP` 监控
#### 示例 3:使用 Basic 认证的 API
如果您的 API 需要 Basic 认证:
- **API 地址**`http://api.internal.com/discover`
- **认证方式**`Basic Auth`
- **用户名**`admin`
- **密码**`password123`
配置示例:
- **任务名称**`Basic-Auth-Discovery`
- **服务发现地址**`http://api.internal.com/discover`
- **认证方式**:选择 `Basic Auth`
- **用户名**`admin`
- **密码**`password123`
- **监控模板**:选择合适的模板
### 注意事项
- **响应格式**:API 响应必须是 JSON 数组格式,每个元素包含 `target` 字段(注意是单数,字符串数组)
- **地址格式**:每个目标地址应为 `host:port` 格式,例如:
- `192.168.1.100:8080`
- `api.example.com:443`
- `localhost:3000`
- **网络连通性**:确保 HertzBeat 可以访问 HTTP API 地址
- **监控模板**:服务发现仅发现服务实例地址,您需要配置合适的监控模板来实际监控这些实例
- **采集间隔**:根据 API 性能和服务变更频率设置合理的采集间隔
- **认证方式**:根据您的 API 安全要求选择合适的认证方式
- **HTTPS**:如果使用 HTTPS,确保 SSL 证书配置正确
- **API 性能**:确保 API 能够快速响应,避免影响 HertzBeat 性能
- **错误处理**:如果 API 返回错误或格式无效,HertzBeat 将保持当前监控任务不变
### 采集指标
#### 指标集合:监控目标
| 指标名称 | 指标单位 | 指标帮助描述 |
|------|-------|---------------|
| 目标 | 无 | 发现的服务实例目标 |
| 主机 | 无 | 服务实例主机地址 |
| 端口 | 无 | 服务实例端口号 |
### 适用场景
- **自定义注册中心**:与您自己的服务注册系统集成
- **云平台**:从云平台(AWS、GCP、Azure)发现服务
- **CMDB**:与 CMDB 系统集成获取服务信息
- **服务网关**:通过 API 网关发现服务实例
- **容器平台**:从 Kubernetes API 或容器编排平台获取服务列表
- **服务管理系统**:与现有服务管理平台集成
- **多云环境**:统一管理不同云平台的服务发现
### 高级用法
#### 包含额外元数据的响应
虽然基本要求只是 `target` 字段,但您的 API 可以包含额外的元数据以供未来扩展使用:
```json
[
{
"target": [
"192.168.1.10:8080"
],
"labels": {
"env": "production",
"version": "1.0.0"
}
}
]
```
注意:目前仅使用 `target` 字段进行服务发现,但未来版本可能支持使用标签信息。
### API 实现示例
#### Spring Boot 示例
```java
@RestController
@RequestMapping("/api/v1")
public class ServiceDiscoveryController {
@GetMapping("/services")
public List<Map<String, Object>> getServices() {
List<String> targets = Arrays.asList(
"192.168.1.10:8080",
"192.168.1.11:8080",
"192.168.1.12:8080"
);
Map<String, Object> response = new HashMap<>();
response.put("target", targets);
return Collections.singletonList(response);
}
}
```
#### Node.js Express 示例
```javascript
app.get('/api/services', (req, res) => {
const targets = [
'192.168.1.10:8080',
'192.168.1.11:8080',
'192.168.1.12:8080'
];
res.json([{
target: targets
}]);
});
```
@@ -0,0 +1,53 @@
---
id: huawei_switch
title: 监控:华为通用交换机
sidebar_label: 华为通用交换机
keywords: [ 开源监控系统, 网络监控, 华为通用交换机监控 ]
---
> 对 华为交换机 的通用指标(可用性,系统信息,端口流量等)进行采集监控。
**使用协议:SNMP**
## 配置参数
| 参数名称 | 参数帮助描述 |
|---------------------|-------------------------------------------------------------------------------------------------------------------------------|
| 目标Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 |
| 端口 | SNMP端口号,默认为161 |
| SNMP 版本 | 所使用的SNMP版本 |
| SNMP 团体字 | 用于SNMP v1 和 SNMP v2c,用于在SNMP Agent完成认证,字符串形式。团体名包括“read”和“write”两种,执行SNMP查询操作时,采用“read”团体名进行认证;执行SNMP设置操作时,则采用“write”团体名进行认证。 |
| SNMP username | 用于SNMP v3MSG 用户名 |
| SNMP contextName | 用于SNMP v3,用于确定Context EngineID对被管理设备的MIB视图。 |
| SNMP authPassword | 用于SNMP v3SNMP 认证密码 |
| authPassword 加密方式 | 用于SNMP v3SNMP 认证算法 |
| SNMP privPassphrase | 用于SNMP v3SNMP 加密密码 |
| privPassword 加密方式 | 用于SNMP v3SNMP 加密算法 |
| 查询超时时间 | 设置查询未响应数据时的超时时间,单位ms毫秒,默认6000毫秒。 |
| 采集间隔 | 监控周期性采集数据的时间间隔,单位为秒,最小间隔为 30 秒。 |
| 描述备注 | 用于添加关于监控的额外标识和描述信息。 |
### 采集指标
由于华为通用交换机可查询的指标过多,详细的指标可于[华为MIB查询平台](https://info.support.huawei.com/info-finder/tool/zh/enterprise/mib)
进行查询。
此文档仅介绍监控模板中查询的监控指标。
#### 指标集合:huawei_core
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ifIndex | 无 | 接口索引 该值大于零且全局唯一。 |
| ifDescr | 无 | 描述接口的字符串,应该包含制造商、产品名和接口软硬件的版本。 |
| ifMtu | octets | 最大传输单元。接口上可以传送的最大报文的大小。对于传输网络数据报的接口,这是接口可以传输的最大数据报的大小。 |
| ifSpeed | 比特/秒 | 估计的接口当前带宽。对于带宽无法改变或者无法准确估计的接口,该项为额定带宽值。 如果接口的带宽比该表项的值大,则该表项的值是其最大值(4,294,967,295),并且ifHighSpeed的值是接口的速率。对于没有速率概念的子层接口,该表项的值为零。 |
| ifInOctets | octets | 该接口入方向通过的总字节数,包括分桢的数据。在管理系统的重新初始化和ifCounterDiscontinuityTime项指定的时间内,该节点的值将出现不连续的情况。 |
| ifInDiscards | 无 | 入方向的被丢弃的报文个数,即使没有错误发生。也将阻止这些报文送往上层协议。 一个可能的原因是释放buffer的空间。在管理系统的重新初始化和ifCounterDiscontinuityTime项指定的时间内,该节点的值将出现不连续的情况。 |
| ifInErrors | 无 | 出错而不会被送往上层协议的报文/传输单元个数。在管理系统的重新初始化和ifCounterDiscontinuityTime项指定的时间内,该节点的值将出现不连续的情况。 |
| ifOutOctets | octets | 该接口出方向通过的总字节数,包括分桢的数据。在管理系统的重新初始化和ifCounterDiscontinuityTime项指定的时间内,该节点的值将出现不连续的情况。 |
| ifOutDiscards | 无 | 出方向的被丢弃的报文个数,即使没有错误发生。也将阻止这些报文发送。丢弃此类报文的一个可能原因是为了释放缓冲区空间。 在管理系统的重新初始化和ifCounterDiscontinuityTime项指定的时间内,该节点的值将出现不连续的情况。 |
| ifOutErrors | 无 | 对于面向数据包的接口,该节点表示由于错误而无法发送的数据包数量。对于面向字符或固定长度接口,该节点表示由于错误而无法传输的传输单元的数量。这种计数器的值可能在管理系统的重新初始化时会不连续,其他时间如ifCounterDiscontinuityTime的值。 |
| ifAdminStatus | 无 | 接口的理想状态。 testing(3)状态表示没有可操作的数据包通过。 当受管系统初始化时,全部接口开始于ifAdminStatus在down(2)状态。由于明确的管理动作或被管理的系统保留的每个配置信息,ifAdminStatus然后被更改为Up1)或testing(3)状态(或保留在down(2)状态)。 |
| ifOperStatus | 无 | 当前接口的操作状态。testing(3)状态表示没有可操作的数据包可以通过。如果ifAdminStatus是down(2),则ifOperStatus应该是down2)。 如果ifAdminStatus是改为up1),则ifOperStatus应该更改为up(1)。如果接口准备好传输,接收网络流量; 它应该改为dormant(5)。如果接口正在等待外部动作(如串行线路等待传入连接); 它应该保持在down(2)状态,并且只有当有故障阻止它变成up(1)状态。 它应该留在notPresent(6)状态如果接口缺少(通常为硬件)组件。 |

Some files were not shown because too many files have changed in this diff Show More