Skip to content

Commit

Permalink
[home,docs] support hertzbeat i18n docs and website (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
DreamGirl524 authored and tomsun28 committed Jul 22, 2022
1 parent 1265059 commit a3cd9e6
Show file tree
Hide file tree
Showing 46 changed files with 1,706 additions and 2,183 deletions.
2 changes: 1 addition & 1 deletion home/docs/help/centos.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ sidebar_label: CentOS操作系统
| used | Mb | 用户程序内存量 |
| free | Mb | 空闲内存容量 |
| buff_cache | Mb | 缓存占用内存 |
| available | Mb | 剩余可用内存容 |
| available | Mb | 剩余可用内存容量 |
| usage | % | 内存使用率 |

#### 指标集合:disk
Expand Down
2 changes: 1 addition & 1 deletion home/docs/help/linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ sidebar_label: Linux操作系统
| used | Mb | 用户程序内存量 |
| free | Mb | 空闲内存容量 |
| buff_cache | Mb | 缓存占用内存 |
| available | Mb | 剩余可用内存容 |
| available | Mb | 剩余可用内存容量 |
| usage | % | 内存使用率 |

#### 指标集合:disk
Expand Down
2 changes: 1 addition & 1 deletion home/docs/help/ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ sidebar_label: Ubuntu操作系统
| used | Mb | 用户程序内存量 |
| free | Mb | 空闲内存容量 |
| buff_cache | Mb | 缓存占用内存 |
| available | Mb | 剩余可用内存容 |
| available | Mb | 剩余可用内存容量 |
| usage | % | 内存使用率 |

#### 指标集合:disk
Expand Down
420 changes: 2 additions & 418 deletions home/docs/others/policy.md

Large diffs are not rendered by default.

72 changes: 13 additions & 59 deletions home/docs/others/service.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
id: extend-http-default
title: HTTP协议系统默认解析方式
sidebar_label: 系统默认解析方式
title: HTTP Protocol System Default Parsing Method
sidebar_label: System Default Parsing Method
---
> HTTP接口调用获取响应数据后,用HertzBeat默认的解析方式去解析响应数据。
> After calling the HTTP interface to obtain the response data, use the default parsing method of hertzbeat to parse the response data.
**此需接口响应数据结构符合HertzBeat指定的数据结构规则**
**The interface response data structure must be consistent with the data structure rules specified by hertzbeat**

### HertzBeat数据格式规范
注意⚠️ 响应数据为JSON
### HertzBeat data format specification
Note⚠️ The response data is JSON format.

单层格式:key-value
Single layer format :key-value
```json
{
"metricName1": "metricValue",
Expand All @@ -19,7 +19,7 @@ sidebar_label: 系统默认解析方式
"metricName4": "metricValue"
}
```
多层格式:数组里面套key-value
Multilayer format:Set key value in the array
```json
[
{
Expand All @@ -36,9 +36,9 @@ sidebar_label: 系统默认解析方式
}
]
```
样例
查询自定义系统的CPU信息,其暴露接口为 `/metrics/cpu`,我们需要其中的`hostname,core,useage`指标
若只有一台虚拟机,其单层格式为:
eg
Query the CPU information of the custom system. The exposed interface is `/metrics/cpu`. We need `hostname,core,useage` indicator.
If there is only one virtual machine, its single-layer format is :
```json
{
"hostname": "linux-1",
Expand All @@ -48,7 +48,7 @@ sidebar_label: 系统默认解析方式
"runningTime": 100
}
```
若有多台虚拟机,其多层格式为:
If there are multiple virtual machines, the multilayer format is: :
```json
[
{
Expand All @@ -75,35 +75,35 @@ sidebar_label: 系统默认解析方式
]
```

**对应的监控配置定义文件YML可以配置为如下**
**The corresponding monitoring configuration definition file YML can be configured as follows**

```yaml
# 此监控类型所属类别:service-应用服务监控 db-数据库监控 custom-自定义监控 os-操作系统监控
# The monitoring type category:service-application service monitoring db-database monitoring custom-custom monitoring os-operating system monitoring
category: custom
# 监控应用类型(与文件名保持一致) eg: linux windows tomcat mysql aws...
# Monitoring application type(consistent with the file name) eg: linux windows tomcat mysql aws...
app: example
name:
zh-CN: 模拟应用类型
en-US: EXAMPLE APP
# 参数映射map. 这些为输入参数变量,即可以用^_^host^_^的形式写到后面的配置中,系统自动变量值替换
# type是参数类型: 0-number数字, 1-string明文字符串, 2-secret加密字符串
# 强制固定必须参数 - host
# parameter mapping map. These are input parameter variables which can be written to the configuration in form of ^_^host^_^. The system automatically replace variable's value.
# type means parameter type: 0-number number, 1-string cleartext string, 2-secret encrypted string
# required parameters - host
configmap:
- key: host
type: 1
- key: port
type: 0
# 指标组列表
# indicator group list
metrics:
# 第一个监控指标组 cpu
# 注意:内置监控指标有 (responseTime - 响应时间)
# The first monitoring indicator group cpu
# Note:the built-in monitoring indicators have (responseTime - response time)
- name: cpu
# 指标组调度优先级(0-127)越小优先级越高,优先级低的指标组会等优先级高的指标组采集完成后才会被调度,相同优先级的指标组会并行调度采集
# 优先级为0的指标组为可用性指标组,即它会被首先调度,采集成功才会继续调度其它指标组,采集失败则中断调度
# The smaller indicator group scheduling priority(0-127), the higher the priority. After completion of the high priority indicator group collection,the low priority indicator group will then be scheduled. Indicator groups with the same priority will be scheduled in parallel.
# Indicator group with a priority of 0 is an availability group which will be scheduled first. If the collection succeeds, the scheduling will continue otherwise interrupt scheduling.
priority: 0
# 指标组中的具体监控指标
# Specific monitoring indicators in the indicator group
fields:
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
# indicator information include field: name type: field type(0-number: number, 1-string: string) nstance: primary key of instance or not unit: indicator unit
- field: hostname
type: 1
instance: true
Expand All @@ -112,21 +112,21 @@ metrics:
unit: '%'
- field: core
type: 0
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
# protocol for monitoring and collection eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: http
# 当protocol为http协议时具体的采集配置
# Specific collection configuration when the protocol is HTTP protocol
http:
# 主机host: ipv4 ipv6 域名
# host: ipv4 ipv6 domain name
host: ^_^host^_^
# 端口
# port
port: ^_^port^_^
# url请求接口路径
# url request interface path
url: /metrics/cpu
# 请求方式 GET POST PUT DELETE PATCH
# request mode: GET POST PUT DELETE PATCH
method: GET
# 是否启用ssl/tls,即是http还是https,默认false
# enable ssl/tls or not, that is to say, HTTP or HTTPS. The default is false
ssl: false
# 响应数据解析方式: default-系统规则,jsonPath-jsonPath脚本,website-网站可用性指标监控
# 这里使用HertzBeat默认解析
# parsing method for reponse data: default-system rules, jsonPath-jsonPath script, website-website availability indicator monitoring
# Hertzbeat default parsing is used here
parseType: default
```
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
---
id: extend-http-jsonpath
title: HTTP协议JsonPath解析方式
sidebar_label: JsonPath解析方式
title: HTTP Protocol JsonPath Parsing Method
sidebar_label: JsonPath Parsing Method
---
> HTTP接口调用获取响应数据后,用JsonPath脚本解析的解析方式去解析响应数据。
> After calling the HTTP interface to obtain the response data, use JsonPath script parsing method to parse the response data.
注意⚠️ 响应数据为JSON格式
Note⚠️ The response data is JSON format.

**使用JsonPath脚本将响应数据解析成符合HertzBeat指定的数据结构规则的数据**
**Use the JsonPath script to parse the response data into data that conforms to the data structure rules specified by HertzBeat**

#### JsonPath操作符
[JSONPath在线验证](https://www.jsonpath.cn)
#### JsonPath Operator
[JSONPath online verification](https://www.jsonpath.cn)

| JSONPATH | 帮助描述 |
| JSONPATH | Help description |
| ----------- | ----------- |
| $ | 根对象或元素 |
| @ | 当前对象或元素 |
| . or [] | 子元素操作符 |
| .. | 递归匹配所有子元素 |
| * | 通配符. 匹配所有对象或元素. |
| [] | 下标运算符,JsonPath索引从0开始 |
| [,] | 连接运算符,将多个结果拼成数组返回,JSONPath允许使用别名. |
| [start:end:step] | 数组切片运算符 |
| ?() | 过滤器(脚本)表达式. |
| () | 脚本表达式. |
| $ | Root object or element |
| @ | Current object or element |
| . or [] | Child element operator |
| .. | Recursively match all child elements |
| * | Wildcard. Match all objects or elements |
| [] | Subscript operator, jsonpath index starts from 0 |
| [,] | Join operator, return multiple results as an array. Jsonpath allows the use of aliases |
| [start:end:step] | Array slice operator |
| ?() | Filter (script) expression |
| () | Script Expression |

#### HertzBeat数据格式规范
单层格式:key-value
#### HertzBeat data format specification
Single layer format :key-value
```json
{
"metricName1": "metricValue",
Expand All @@ -35,7 +35,7 @@ sidebar_label: JsonPath解析方式
"metricName4": "metricValue"
}
```
多层格式:数组里面套key-value
Multilayer format:Set key value in the array
```json
[
{
Expand All @@ -53,10 +53,10 @@ sidebar_label: JsonPath解析方式
]
```

#### 样例
#### Example

查询自定义系统的数值信息,其暴露接口为 `/metrics/person`,我们需要其中的`type,num`指标
接口返回的原始数据如下
Query the value information of the custom system, and its exposed interface is `/metrics/person`. We need `type,num` indicator.
The raw data returned by the interface is as follows
```json
{
"firstName": "John",
Expand All @@ -80,7 +80,7 @@ sidebar_label: JsonPath解析方式
}
```

我们使用JsonPath脚本解析,对应的脚本为: `$.number[*]`解析后的数据结构如下
We use the jsonpath script to parse, and the corresponding script is: `$.number[*]`The parsed data structure is as follows
```json
[
{
Expand All @@ -93,57 +93,57 @@ sidebar_label: JsonPath解析方式
}
]
```
此数据结构符合HertzBeat的数据格式规范,成功提取指标`type,num`值。
This data structure conforms to the data format specification of HertzBeat, and the indicator `type,num` is successfully extracted.

**对应的监控配置定义文件YML可以配置为如下**
**The corresponding monitoring configuration definition file YML can be configured as follows**

```yaml
# 此监控类型所属类别:service-应用服务监控 db-数据库监控 custom-自定义监控 os-操作系统监控
# The monitoring type category:service-application service monitoring db-database monitoring custom-custom monitoring os-operating system monitoring
category: custom
# 监控应用类型(与文件名保持一致) eg: linux windows tomcat mysql aws...
# Monitoring application type(consistent with the file name) eg: linux windows tomcat mysql aws...
app: example
name:
zh-CN: 模拟应用类型
en-US: EXAMPLE APP
# 参数映射map. 这些为输入参数变量,即可以用^_^host^_^的形式写到后面的配置中,系统自动变量值替换
# type是参数类型: 0-number数字, 1-string明文字符串, 2-secret加密字符串
# 强制固定必须参数 - host
# parameter mapping map. These are input parameter variables which can be written to the configuration in form of ^_^host^_^. The system automatically replace variable's value.
# type means parameter type: 0-number number, 1-string cleartext string, 2-secret encrypted string
# required parameters - host
configmap:
- key: host
type: 1
- key: port
type: 0
# 指标组列表
# indicator group list
metrics:
# 第一个监控指标组 person
# 注意:内置监控指标有 (responseTime - 响应时间)
# The first monitoring indicator group person
# Note:the built-in monitoring indicators have (responseTime - response time)
- name: cpu
# 指标组调度优先级(0-127)越小优先级越高,优先级低的指标组会等优先级高的指标组采集完成后才会被调度,相同优先级的指标组会并行调度采集
# 优先级为0的指标组为可用性指标组,即它会被首先调度,采集成功才会继续调度其它指标组,采集失败则中断调度
# The smaller indicator group scheduling priority(0-127), the higher the priority. After completion of the high priority indicator group collection,the low priority indicator group will then be scheduled. Indicator groups with the same priority will be scheduled in parallel.
# Indicator group with a priority of 0 is an availability group which will be scheduled first. If the collection succeeds, the scheduling will continue otherwise interrupt scheduling.
priority: 0
# 指标组中的具体监控指标
# Specific monitoring indicators in the indicator group
fields:
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
# indicator information include field: name type: field type(0-number: number, 1-string: string) nstance: primary key of instance or not unit: indicator unit
- field: type
type: 1
instance: true
- field: num
type: 0
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
# protocol for monitoring and collection eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: http
# 当protocol为http协议时具体的采集配置
# Specific collection configuration when the protocol is HTTP protocol
http:
# 主机host: ipv4 ipv6 域名
# host: ipv4 ipv6 domain name
host: ^_^host^_^
# 端口
# port
port: ^_^port^_^
# url请求接口路径
# url request interface path
url: /metrics/person
# 请求方式 GET POST PUT DELETE PATCH
# request mode GET POST PUT DELETE PATCH
method: GET
# 是否启用ssl/tls,即是http还是https,默认false
# enable ssl/tls or not, that is to say, HTTP or HTTPS. The default is false
ssl: false
# 响应数据解析方式: default-系统规则,jsonPath-jsonPath脚本,website-网站可用性指标监控
# 这里使用jsonPath解析
# parsing method for reponse data: default-system rules, jsonPath-jsonPath script, website-website availability indicator monitoring
# jsonPath parsing is used here
parseType: $.number[*]
```
Loading

0 comments on commit a3cd9e6

Please sign in to comment.