Compare commits

...
10 Commits
Author SHA1 Message Date
tomsun28 1f89e1ef5d fix: fix test
Signed-off-by: tomsun28 <tomsun28@outlook.com>
2026-02-15 23:10:29 +08:00
Tomsun28andgithub-actions[bot] abea1d08f7 Update .testcontainers.properties
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Tomsun28 <tomsun28@outlook.com>
2026-02-15 16:01:19 +08:00
tomsun28 f27e527605 fix: fix the e2e container test
Signed-off-by: tomsun28 <tomsun28@outlook.com>
2026-02-15 15:59:37 +08:00
tomsun28 c4a402f4d6 fix: fix the e2e log test
Signed-off-by: tomsun28 <tomsun28@outlook.com>
2026-02-15 15:05:41 +08:00
Duansg ebfd3c73e3 [fix] Fixed template name mismatch issue (#4021) 2026-02-13 23:06:02 +08:00
Tomsun28 cc60f8453b docs: fix the sidebars i18n and version display, add auto deploy action (#4018)
Signed-off-by: tomsun28 <tomsun28@outlook.com>
2026-02-08 22:14:05 +08:00
0cf286a063 [Docs] Release version 1.8.0 documentation (#4017)
Signed-off-by: Tomsun28 <tomsun28@outlook.com>
Co-authored-by: Tomsun28 <tomsun28@outlook.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-07 10:18:41 +08:00
3da977a96f docs: update download page to v1.8.0 (#4015)
Co-authored-by: a-little-fool <2030509072@qq.com>
Co-authored-by: Duansg <siguoduan@gmail.com>
Co-authored-by: Tomsun28 <tomsun28@outlook.com>
2026-02-07 09:01:49 +08:00
Duansg c10761ec9a [improve] improved version validation documentation content (#4013) 2026-02-06 20:50:59 +08:00
Duansg b0c6324713 [fix] Fixed Prometheus task history charts not working in the Favorites tab (#4014) 2026-02-06 16:39:01 +08:00
464 changed files with 47429 additions and 104 deletions
+82
View File
@@ -0,0 +1,82 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: DOC Deploy
on:
# Trigger on push to master branch when home directory files are changed
push:
branches: [ master ]
paths:
- 'home/**'
# Allow manual workflow trigger
workflow_dispatch:
# Set permissions for deployment
permissions:
contents: write
jobs:
deploy:
name: Deploy Documentation to asf-site Branch
runs-on: ubuntu-latest
steps:
# Checkout the repository code
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# Setup Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# Install dependencies in home directory
- name: Install Dependencies
working-directory: home
run: npm ci
# Build the documentation site
- name: Build Documentation
working-directory: home
run: npm run build
env:
NODE_OPTIONS: --max-old-space-size=4096
# Deploy to asf-site branch using peaceiris/actions-gh-pages
- name: Deploy to asf-site Branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./home/build
publish_branch: asf-site
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: 'Deploy documentation to asf-site branch'
# Output deployment status
- name: Deployment Summary
run: |
echo "Documentation deployed successfully!"
echo "Deployment branch: asf-site"
echo "Source branch: ${{ github.ref_name }}"
echo "Commit SHA: ${{ github.sha }}"
+22
View File
@@ -0,0 +1,22 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# Testcontainers configuration
# Disable Ryuk container reuse to avoid issues in CI
testcontainers.reuse.enable=false
# Configure Docker host detection
testcontainers.docker.client.strategy=org.testcontainers.dockerclient.UnixSocketClientProviderStrategy
@@ -31,6 +31,7 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIf;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
import org.testcontainers.containers.GenericContainer;
@@ -48,8 +49,17 @@ import java.util.Map;
*/
@Slf4j
@ExtendWith(MockitoExtension.class)
@EnabledIf("isDockerAvailable")
public class ZookeeperMonitorE2eTest extends AbstractCollectE2eTest {
static boolean isDockerAvailable() {
try {
return org.testcontainers.DockerClientFactory.instance().isDockerAvailable();
} catch (Exception e) {
return false;
}
}
private static final String ZOOKEEPER_IMAGE_NAME = "zookeeper:3.8.4";
private static final String ZOOKEEPER_NAME = "zookeeper";
private static final Integer ZOOKEEPER_PORT = 2181;
@@ -0,0 +1,38 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hertzbeat.collector.collect;
import org.testcontainers.DockerClientFactory;
/**
* Utility class for E2E tests
*/
public class TestUtil {
/**
* Check if Docker is available for testcontainers
* @return true if Docker is available, false otherwise
*/
public static boolean isDockerAvailable() {
try {
return DockerClientFactory.instance().isDockerAvailable();
} catch (Exception e) {
return false;
}
}
}
@@ -28,6 +28,7 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIf;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.containers.Network;
@@ -50,8 +51,17 @@ import java.util.stream.Stream;
* KafkaCollectE2E
*/
@Slf4j
@EnabledIf("isDockerAvailable")
public class KafkaCollectE2eTest {
static boolean isDockerAvailable() {
try {
return org.testcontainers.DockerClientFactory.instance().isDockerAvailable();
} catch (Exception e) {
return false;
}
}
private static final String ZOOKEEPER_IMAGE_NAME = "zookeeper:3.8.4";
private static final String ZOOKEEPER_NAME = "zookeeper";
private static final Integer ZOOKEEPER_PORT = 2181;
@@ -65,34 +75,53 @@ public class KafkaCollectE2eTest {
@AfterAll
public static void tearDown() {
kafkaContainer.stop();
zookeeperContainer.stop();
if (kafkaContainer != null) {
kafkaContainer.stop();
}
if (zookeeperContainer != null) {
zookeeperContainer.stop();
}
}
@BeforeEach
public void setUp() {
kafkaCollect = new KafkaCollectImpl();
metrics = new Metrics();
Network.NetworkImpl network = Network.builder().build();
zookeeperContainer = new GenericContainer<>(DockerImageName.parse(ZOOKEEPER_IMAGE_NAME))
.withExposedPorts(ZOOKEEPER_PORT)
.withNetwork(network)
.withNetworkAliases(ZOOKEEPER_NAME)
.waitingFor(Wait.forListeningPort())
.withStartupTimeout(Duration.ofSeconds(120));
zookeeperContainer.setPortBindings(Collections.singletonList(ZOOKEEPER_PORT + ":" + ZOOKEEPER_PORT));
try {
Network.NetworkImpl network = Network.builder().build();
zookeeperContainer = new GenericContainer<>(DockerImageName.parse(ZOOKEEPER_IMAGE_NAME))
.withExposedPorts(ZOOKEEPER_PORT)
.withNetwork(network)
.withNetworkAliases(ZOOKEEPER_NAME)
.waitingFor(Wait.forListeningPort())
.withStartupTimeout(Duration.ofSeconds(120));
zookeeperContainer.setPortBindings(Collections.singletonList(ZOOKEEPER_PORT + ":" + ZOOKEEPER_PORT));
Startables.deepStart(Stream.of(zookeeperContainer)).join();
Startables.deepStart(Stream.of(zookeeperContainer)).join();
kafkaContainer = new KafkaContainer(DockerImageName.parse(KAFKA_IMAGE_NAME))
.withExternalZookeeper(ZOOKEEPER_NAME + ":2181")
.withNetwork(network)
.withNetworkAliases(KAFKA_NAME)
.withLogConsumer(
new Slf4jLogConsumer(
DockerLoggerFactory.getLogger(KAFKA_IMAGE_NAME)))
.withStartupTimeout(Duration.ofSeconds(120));
Startables.deepStart(Stream.of(kafkaContainer)).join();
kafkaContainer = new KafkaContainer(DockerImageName.parse(KAFKA_IMAGE_NAME))
.withExternalZookeeper(ZOOKEEPER_NAME + ":2181")
.withNetwork(network)
.withNetworkAliases(KAFKA_NAME)
.withLogConsumer(
new Slf4jLogConsumer(
DockerLoggerFactory.getLogger(KAFKA_IMAGE_NAME)))
.withStartupTimeout(Duration.ofSeconds(120));
Startables.deepStart(Stream.of(kafkaContainer)).join();
} catch (Exception e) {
log.error("Failed to start Kafka containers", e);
// Clean up any partially started containers
if (kafkaContainer != null) {
kafkaContainer.stop();
kafkaContainer = null;
}
if (zookeeperContainer != null) {
zookeeperContainer.stop();
zookeeperContainer = null;
}
throw new RuntimeException("Failed to start Kafka test environment", e);
}
}
@Test
@@ -26,12 +26,14 @@ import org.apache.hertzbeat.common.entity.alerter.SingleAlert;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.condition.EnabledIf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.wait.strategy.Wait;
@@ -61,8 +63,17 @@ import static org.mockito.Mockito.doAnswer;
@SpringBootTest(classes = org.apache.hertzbeat.startup.HertzBeatApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@Slf4j
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@EnabledIf("isDockerAvailable")
public class LogPeriodicAlertE2eTest {
static boolean isDockerAvailable() {
try {
return org.testcontainers.DockerClientFactory.instance().isDockerAvailable();
} catch (Exception e) {
return false;
}
}
private static final String VECTOR_IMAGE = "timberio/vector:latest-alpine";
private static final int VECTOR_PORT = 8686;
private static final String VECTOR_CONFIG_PATH = "/etc/vector/vector.yml";
@@ -85,18 +96,24 @@ public class LogPeriodicAlertE2eTest {
private AlarmCommonReduce alarmCommonReduce;
static GenericContainer<?> vector;
static GenericContainer<?> greptimedb;
static {
greptimedb = new GenericContainer<>(DockerImageName.parse(GREPTIME_IMAGE))
.withExposedPorts(GREPTIME_HTTP_PORT, GREPTIME_GRPC_PORT)
.withCommand("standalone", "start",
"--http-addr", "0.0.0.0:" + GREPTIME_HTTP_PORT,
"--rpc-bind-addr", "0.0.0.0:" + GREPTIME_GRPC_PORT)
.waitingFor(Wait.forListeningPorts(GREPTIME_HTTP_PORT, GREPTIME_GRPC_PORT))
.withStartupTimeout(CONTAINER_STARTUP_TIMEOUT);
greptimedb.start();
try {
if (DockerClientFactory.instance().isDockerAvailable()) {
greptimedb = new GenericContainer<>(DockerImageName.parse(GREPTIME_IMAGE))
.withExposedPorts(GREPTIME_HTTP_PORT, GREPTIME_GRPC_PORT)
.withCommand("standalone", "start",
"--http-addr", "0.0.0.0:" + GREPTIME_HTTP_PORT,
"--rpc-bind-addr", "0.0.0.0:" + GREPTIME_GRPC_PORT)
.waitingFor(Wait.forListeningPorts(GREPTIME_HTTP_PORT, GREPTIME_GRPC_PORT))
.withStartupTimeout(CONTAINER_STARTUP_TIMEOUT);
greptimedb.start();
}
} catch (Exception e) {
log.warn("Docker not available, skipping GreptimeDB container startup: {}", e.getMessage());
}
}
@DynamicPropertySource
@@ -26,6 +26,7 @@ import org.apache.hertzbeat.common.entity.alerter.SingleAlert;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.condition.EnabledIf;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.boot.test.web.server.LocalServerPort;
@@ -58,8 +59,17 @@ import static org.mockito.Mockito.doAnswer;
@SpringBootTest(classes = org.apache.hertzbeat.startup.HertzBeatApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@Slf4j
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@EnabledIf("isDockerAvailable")
public class LogRealTimeAlertE2eTest {
static boolean isDockerAvailable() {
try {
return org.testcontainers.DockerClientFactory.instance().isDockerAvailable();
} catch (Exception e) {
return false;
}
}
private static final String VECTOR_IMAGE = "timberio/vector:latest-alpine";
private static final int VECTOR_PORT = 8686;
private static final String VECTOR_CONFIG_PATH = "/etc/vector/vector.yml";
@@ -81,7 +91,7 @@ public class LogRealTimeAlertE2eTest {
void setUpAll() {
// Setup test alert definitions
setupTestAlertDefines();
// Expose host ports for testcontainers
Testcontainers.exposeHostPorts(port);
vector = new GenericContainer<>(DockerImageName.parse(VECTOR_IMAGE))
@@ -23,9 +23,11 @@ import org.apache.hertzbeat.common.queue.CommonDataQueue;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.condition.EnabledIf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.wait.strategy.Wait;
@@ -47,8 +49,17 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
@SpringBootTest(classes = org.apache.hertzbeat.startup.HertzBeatApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@Slf4j
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@EnabledIf("isDockerAvailable")
public class LogIngestionE2eTest {
static boolean isDockerAvailable() {
try {
return DockerClientFactory.instance().isDockerAvailable();
} catch (Exception e) {
return false;
}
}
private static final String VECTOR_IMAGE = "timberio/vector:latest-alpine";
private static final int VECTOR_PORT = 8686;
private static final String VECTOR_CONFIG_PATH = "/etc/vector/vector.yml";
@@ -24,11 +24,13 @@ import org.apache.hertzbeat.warehouse.store.history.tsdb.greptime.GreptimeDbData
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.condition.EnabledIf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.wait.strategy.Wait;
@@ -50,8 +52,17 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
@SpringBootTest(classes = org.apache.hertzbeat.startup.HertzBeatApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@Slf4j
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@EnabledIf("isDockerAvailable")
public class GreptimeLogStorageE2eTest {
static boolean isDockerAvailable() {
try {
return DockerClientFactory.instance().isDockerAvailable();
} catch (Exception e) {
return false;
}
}
private static final String VECTOR_IMAGE = "timberio/vector:latest-alpine";
private static final int VECTOR_PORT = 8686;
private static final String VECTOR_CONFIG_PATH = "/etc/vector/vector.yml";
@@ -74,14 +85,20 @@ public class GreptimeLogStorageE2eTest {
static GenericContainer<?> greptimedb;
static {
greptimedb = new GenericContainer<>(DockerImageName.parse(GREPTIME_IMAGE))
.withExposedPorts(GREPTIME_HTTP_PORT, GREPTIME_GRPC_PORT)
.withCommand("standalone", "start",
"--http-addr", "0.0.0.0:" + GREPTIME_HTTP_PORT,
"--rpc-bind-addr", "0.0.0.0:" + GREPTIME_GRPC_PORT)
.waitingFor(Wait.forListeningPorts(GREPTIME_HTTP_PORT, GREPTIME_GRPC_PORT))
.withStartupTimeout(CONTAINER_STARTUP_TIMEOUT);
greptimedb.start();
try {
if (DockerClientFactory.instance().isDockerAvailable()) {
greptimedb = new GenericContainer<>(DockerImageName.parse(GREPTIME_IMAGE))
.withExposedPorts(GREPTIME_HTTP_PORT, GREPTIME_GRPC_PORT)
.withCommand("standalone", "start",
"--http-addr", "0.0.0.0:" + GREPTIME_HTTP_PORT,
"--rpc-bind-addr", "0.0.0.0:" + GREPTIME_GRPC_PORT)
.waitingFor(Wait.forListeningPorts(GREPTIME_HTTP_PORT, GREPTIME_GRPC_PORT))
.withStartupTimeout(CONTAINER_STARTUP_TIMEOUT);
greptimedb.start();
}
} catch (Exception e) {
log.warn("Docker not available, skipping GreptimeDB container startup: {}", e.getMessage());
}
}
@DynamicPropertySource
+1 -1
View File
@@ -87,5 +87,5 @@
</dependency>
</dependencies>
</dependencyManagement>
</project>
@@ -16,7 +16,7 @@
# The monitoring type categoryservice-application service monitoring db-database monitoring mid-middleware custom-custom monitoring os-operating system monitoring
category: server
# The monitoring type eg: linux windows tomcat mysql aws...
app: synology
app: synology_nas
# The monitoring i18n name
name:
zh-CN: Synology NAS
+5 -5
View File
@@ -1,8 +1,8 @@
---
title: GreptimeDB & HertzBeat, using the open source temporal database GreptimeDB to store metrics for the open source real-time monitoring HertzBeat
author: tom
author_title: tom
author_url: https://github.com/tomsun28
title: GreptimeDB & HertzBeat, using the open source temporal database GreptimeDB to store metrics for the open source real-time monitoring HertzBeat
author: tom
author_title: tom
author_url: https://github.com/tomsun28
tags: [opensource, practice]
keywords: [open source monitoring system, open source temporal database, HertzBeat, GreptimeDB]
---
@@ -18,7 +18,7 @@ keywords: [open source monitoring system, open source temporal database, HertzBe
- Efficient storage and computation, with object storage and high data compression rate to achieve ultra-low storage costs. Built-in data analytics solution to avoid replicating data to external data warehouses.
- Distributed, Highly Reliable & Highly Available, easily scale each module independently with decoupled cloud-native architecture. Ensure data reliability and availability with configurable replicas and automated failover mechanisms.
Cloud: **[GreptimePlay](https://greptime.com/playground)**
Cloud: **[GreptimePlay](https://greptime.com/product/cloud)**
### What is HertzBeat?
@@ -27,7 +27,7 @@ limitations under the License.
- After creating a new `PR`, you need to associate the existing corresponding `ISSUE` at the Github Development button on the `PR` page (if there is no corresponding ISSUE, it is recommended to create a new corresponding ISSUE).
- Title naming format
- Title naming format
`[feature/bugfix/doc/improve/refactor/bug/cleanup] title`
2. Description
@@ -35,7 +35,7 @@ limitations under the License.
- Please fill in the `PR` template to describe the contribution. So that the reviewer can understand the problem and solution from the description, rather than just from the code.
- Check the CheckList
3. It's recommended that `PR` should be arranged changes such as `cleanup`, `Refactor`, `improve`, and `feature` into separated `PRs`/`Commits`.
4. Commit message(English, lowercase, no special characters)
4. Commit message(English, lowercase, no special characters)
The commit of messages should follow a pattern similar to the `[feature/bugfix/doc/improve/refactor/bug/cleanup] title`
## 2 Code Checkstyle
@@ -133,8 +133,8 @@ Error code description:
```
2. Pinyin abbreviations are prohibited for variables (excluding nouns such as place names), such as chengdu.
3. It is recommended to end variable names with a `type`.
For variables of type `Collection/List`, take `xxxx` (plural representing multiple elements) or end with `xxxList` (specific type).
3. It is recommended to end variable names with a `type`.
For variables of type `Collection/List`, take `xxxx` (plural representing multiple elements) or end with `xxxList` (specific type).
For variables of type `map`, describe the `key` and `value` clearly:
```java
@@ -142,7 +142,7 @@ Error code description:
Map<Long, String> userIdNameMap;
```
4. That can intuitively know the type and meaning of the variable through its name.
4. That can intuitively know the type and meaning of the variable through its name.
Method names should start with a verb first as follows:
```java
@@ -320,7 +320,7 @@ to reduce code line depth and improve readability like follows:
......
}
}
```
- Positive demo:
@@ -630,7 +630,7 @@ public void process(String input) {
// ignored declaration lines.
List`<User>` userList = getUsersByBatch(1000);
if (LOG.isDebugEnabled()) {
LOG.debug("All ids of users: {}", getAllIDsOfUsers(userList));
LOG.debug("All ids of users: {}", getAllIDsOfUsers(userList));
}
```
@@ -644,6 +644,5 @@ public void process(String input) {
- [https://site.mockito.org/](https://site.mockito.org/)
- [https://alibaba.github.io/p3c/](https://alibaba.github.io/p3c/)
- [https://rules.sonarsource.com/java/](https://rules.sonarsource.com/java/)
- [https://junit.org/junit5/](https://junit.org/junit5/)
- [https://streampark.apache.org/](https://streampark.apache.org/)
+4 -4
View File
@@ -91,10 +91,10 @@ check result
> If something like the following appears, it means the signature is correct. Keyword: **`Good signature`**
```shell
apache-hertzbeat-xxx-src.tar.gz
apache-hertzbeat-${release_version}-src.tar.gz
gpg: Signature made XXXX
gpg: using RSA key XXXXX
gpg: Good signature from "xxx @apache.org>"
gpg: Good signature from "XXX <xxx@apache.org>"
```
#### 2.3 Check sha512 hash
@@ -125,10 +125,10 @@ check as follows:
> If the binary/web-binary package is uploaded, check the binary package.
Unzip `apache-hertzbeat-`release_version`-src.tar.gz`
Unzip `apache-hertzbeat-${release_version}-src.tar.gz`
```shell
cd apache-hertzbeat-`release_version`-src
cd apache-hertzbeat-${release_version}-src
```
compile the source code: [Build HertzBeat Binary Package](https://hertzbeat.apache.org/docs/community/development/#build-hertzbeat-binary-package)
+1 -1
View File
@@ -22,7 +22,7 @@ Previous releases of HertzBeat may be affected by security issues, please use th
| Version | Date | Download | Release |
|---------|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|
| v1.7.3 | 2025.09.05 | [apache-hertzbeat-1.7.3-bin.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-bin.tar.gz) (Server) ( [signature](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-bin.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-bin.tar.gz.sha512) ) <br/> [apache-hertzbeat-collector-1.7.3-bin.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.7.3/apache-hertzbeat-collector-1.7.3-bin.tar.gz) (Collector) ( [signature](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-collector-1.7.3-bin.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-collector-1.7.3-bin.tar.gz.sha512) ) <br/> [apache-hertzbeat-1.7.3-src.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-src.tar.gz) (Source Code) ( [signature](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-src.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-src.tar.gz.sha512) ) <br/> [apache-hertzbeat-1.7.3-docker-compose.tar.gz](https://github.com/apache/hertzbeat/releases/download/v1.7.3/apache-hertzbeat-1.7.3-docker-compose.tar.gz) (Docker Compose) ( [signature](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-docker-compose.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-docker-compose.tar.gz.sha512) ) | [note](https://github.com/apache/hertzbeat/releases/tag/v1.7.3) |
| v1.8.0 | 2026.02.05 | [apache-hertzbeat-1.8.0-bin.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-bin.tar.gz) (Server) ( [signature](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-bin.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-bin.tar.gz.sha512) ) <br/> [apache-hertzbeat-collector-1.8.0-bin.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.8.0/apache-hertzbeat-collector-1.8.0-bin.tar.gz) (Collector) ( [signature](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-collector-1.8.0-bin.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-collector-1.8.0-bin.tar.gz.sha512) ) <br/> [apache-hertzbeat-1.8.0-src.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-src.tar.gz) (Source Code) ( [signature](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-src.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-src.tar.gz.sha512) ) <br/> [apache-hertzbeat-1.8.0-docker-compose.tar.gz](https://github.com/apache/hertzbeat/releases/download/1.8.0/apache-hertzbeat-1.8.0-docker-compose.tar.gz) (Docker Compose) ( [signature](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-docker-compose.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-docker-compose.tar.gz.sha512) ) | [note](https://github.com/apache/hertzbeat/releases/tag/1.8.0) |
## Release Docker Image
+1 -1
View File
@@ -15,7 +15,7 @@ Consul Service Discovery allows HertzBeat to connect to your Consul server and a
#### Deploy Consul Server
1. Deploy Consul server according to [Consul official documentation](https://www.consul.io/docs/install).
1. Deploy Consul server according to [Consul official documentation](https://developer.hashicorp.com/consul/docs/fundamentals/install).
2. Ensure Consul server is accessible from HertzBeat.
3. Verify that you can access Consul UI at `http://your-consul-server:8500/ui/`
4. Ensure the Consul HTTP API is accessible (default port: 8500)
+2 -2
View File
@@ -303,10 +303,10 @@ module.exports = {
remarkPlugins: [
[require('@docusaurus/remark-plugin-npm2yarn'), { sync: true }],
],
lastVersion: '1.7.x',
lastVersion: '1.8.0',
versions: {
current: {
label: 'dev',
label: 'current',
},
},
},
@@ -0,0 +1,166 @@
{
"version.label": {
"message": "1.8.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"
}
}
@@ -1,8 +1,8 @@
---
title: GreptimeDB & HertzBeat, 使用开源时序数据库 GreptimeDB 存储开源实时监控 HertzBeat 的度量数据
author: tom
author_title: tom
author_url: https://github.com/tomsun28
title: GreptimeDB & HertzBeat, 使用开源时序数据库 GreptimeDB 存储开源实时监控 HertzBeat 的度量数据
author: tom
author_title: tom
author_url: https://github.com/tomsun28
tags: [opensource, practice]
keywords: [开源监控系统, 开源时序数据库, HertzBeat, GreptimeDB]
---
@@ -18,7 +18,7 @@ keywords: [开源监控系统, 开源时序数据库, HertzBeat, GreptimeDB]
- 高效存储与计算,通过对象存储和高数据压缩率实现超低的存储成本。内置数据分析解决方案,避免将数据复制到外部数据仓库。
- 分布式、高可靠与高可用,通过解耦的云原生架构,轻松独立地扩展每个模块。通过可配置的副本和自动的故障转移机制,确保数据的可靠性和可用性。
Cloud: **[GreptimePlay](https://greptime.com/playground)**
Cloud: **[GreptimePlay](https://greptime.com/product/cloud)**
### 什么是 HertzBeat
@@ -35,7 +35,7 @@ limitations under the License.
- 新建 `PR` 时请仔细描述此贡献,描述文档和代码同样重要。审阅者可以从描述中,而不仅仅是从代码中,了解问题和解决方案。
- 勾选是否完成了对应的 Checklist。
3. 建议一次 `PR` 只包含一个功能/一种修复/一类改进/一种重构/一次清理/一类文档等
4. 提交消息(英文,小写,无特殊字符)
4. 提交消息(英文,小写,无特殊字符)
消息的提交应遵循与 `PR` 类似的模式:`[feature/bugfix/doc/improve/refactor/bug/cleanup] title`
## 2 代码检查样式
@@ -631,7 +631,7 @@ public void process(String input) {
// 忽略声明行。
List`<User>` userList = getUsersByBatch(1000);
if (LOG.isDebugEnabled()) {
LOG.debug("All ids of users: {}", getAllIDsOfUsers(userList));
LOG.debug("All ids of users: {}", getAllIDsOfUsers(userList));
}
```
@@ -645,6 +645,5 @@ public void process(String input) {
- [https://site.mockito.org/](https://site.mockito.org/)
- [https://alibaba.github.io/p3c/](https://alibaba.github.io/p3c/)
- [https://rules.sonarsource.com/java/](https://rules.sonarsource.com/java/)
- [https://junit.org/junit5/](https://junit.org/junit5/)
- [https://streampark.apache.org/](https://streampark.apache.org/)
@@ -86,10 +86,10 @@ for i in *.tar.gz; do echo $i; gpg --verify $i.asc $i ; done
> 出现类似以下内容则说明签名正确,关键字:**`Good signature`**
```shell
apache-hertzbeat-xxx-incubating-src.tar.gz
apache-hertzbeat-${release_version}-src.tar.gz
gpg: Signature made XXXX
gpg: using RSA key XXXXX
gpg: Good signature from "xxx @apache.org>"
gpg: Good signature from "XXX <xxx@apache.org>"
```
#### 2.3 检查sha512哈希
@@ -102,10 +102,10 @@ for i in *.tar.gz; do echo $i; sha512sum --check $i.sha512; done
#### 2.4 检查二进制包
解压缩 `apache-hertzbeat-${release.version}-incubating-bin.tar.gz`
解压缩 `apache-hertzbeat-${release_version}-bin.tar.gz`
```shell
tar -xzvf apache-hertzbeat-${release.version}-incubating-bin.tar.gz
tar -xzvf apache-hertzbeat-${release_version}-bin.tar.gz
```
进行如下检查:
@@ -123,10 +123,10 @@ tar -xzvf apache-hertzbeat-${release.version}-incubating-bin.tar.gz
#### 2.5. 源码编译验证
解压缩 `apache-hertzbeat-`release_version`-incubating-src.tar.gz`
解压缩 `apache-hertzbeat-${release_version}-src.tar.gz`
```shell
cd apache-hertzbeat-`release_version`-incubating-src
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)
@@ -22,7 +22,7 @@ sidebar_label: Download
| 版本 | 日期 | 下载 | Release |
|--------|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|
| v1.7.3 | 2025.09.05 | [apache-hertzbeat-1.7.3-bin.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-bin.tar.gz) (Server) ( [signature](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-bin.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-bin.tar.gz.sha512) ) <br/> [apache-hertzbeat-collector-1.7.3-bin.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.7.3/apache-hertzbeat-collector-1.7.3-bin.tar.gz) (Collector) ( [signature](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-collector-1.7.3-bin.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-collector-1.7.3-bin.tar.gz.sha512) ) <br/> [apache-hertzbeat-1.7.3-src.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-src.tar.gz) (Source Code) ( [signature](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-src.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-src.tar.gz.sha512) ) <br/> [apache-hertzbeat-1.7.3-docker-compose.tar.gz](https://github.com/apache/hertzbeat/releases/download/v1.7.3/apache-hertzbeat-1.7.3-docker-compose.tar.gz) (Docker Compose) ( [signature](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-docker-compose.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.7.3/apache-hertzbeat-1.7.3-docker-compose.tar.gz.sha512) ) | [note](https://github.com/apache/hertzbeat/releases/tag/v1.7.3) |
| v1.8.0 | 2026.02.05 | [apache-hertzbeat-1.8.0-bin.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-bin.tar.gz) (Server) ( [signature](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-bin.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-bin.tar.gz.sha512) ) <br/> [apache-hertzbeat-collector-1.8.0-bin.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.8.0/apache-hertzbeat-collector-1.8.0-bin.tar.gz) (Collector) ( [signature](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-collector-1.8.0-bin.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-collector-1.8.0-bin.tar.gz.sha512) ) <br/> [apache-hertzbeat-1.8.0-src.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-src.tar.gz) (Source Code) ( [signature](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-src.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-src.tar.gz.sha512) ) <br/> [apache-hertzbeat-1.8.0-docker-compose.tar.gz](https://github.com/apache/hertzbeat/releases/download/1.8.0/apache-hertzbeat-1.8.0-docker-compose.tar.gz) (Docker Compose) ( [signature](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-docker-compose.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-docker-compose.tar.gz.sha512) ) | [note](https://github.com/apache/hertzbeat/releases/tag/1.8.0) |
## Docker 镜像版本
@@ -15,7 +15,7 @@ Consul 服务发现允许 HertzBeat 连接到您的 Consul 服务器并自动发
#### 部署 Consul 服务器
1. 根据 [Consul 官方文档](https://www.consul.io/docs/install)部署 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)
@@ -35,7 +35,7 @@ limitations under the License.
- 新建 `PR` 时请仔细描述此贡献,描述文档和代码同样重要。审阅者可以从描述中,而不仅仅是从代码中,了解问题和解决方案。
- 勾选是否完成了对应的 Checklist。
3. 建议一次 `PR` 只包含一个功能/一种修复/一类改进/一种重构/一次清理/一类文档等
4. 提交消息(英文,小写,无特殊字符)
4. 提交消息(英文,小写,无特殊字符)
消息的提交应遵循与 `PR` 类似的模式:`[feature/bugfix/doc/improve/refactor/bug/cleanup] title`
## 2 代码检查样式
@@ -631,7 +631,7 @@ public void process(String input) {
// 忽略声明行。
List`<User>` userList = getUsersByBatch(1000);
if (LOG.isDebugEnabled()) {
LOG.debug("All ids of users: {}", getAllIDsOfUsers(userList));
LOG.debug("All ids of users: {}", getAllIDsOfUsers(userList));
}
```
@@ -645,6 +645,5 @@ public void process(String input) {
- [https://site.mockito.org/](https://site.mockito.org/)
- [https://alibaba.github.io/p3c/](https://alibaba.github.io/p3c/)
- [https://rules.sonarsource.com/java/](https://rules.sonarsource.com/java/)
- [https://junit.org/junit5/](https://junit.org/junit5/)
- [https://streampark.apache.org/](https://streampark.apache.org/)
@@ -35,7 +35,7 @@ limitations under the License.
- 新建 `PR` 时请仔细描述此贡献,描述文档和代码同样重要。审阅者可以从描述中,而不仅仅是从代码中,了解问题和解决方案。
- 勾选是否完成了对应的 Checklist。
3. 建议一次 `PR` 只包含一个功能/一种修复/一类改进/一种重构/一次清理/一类文档等
4. 提交消息(英文,小写,无特殊字符)
4. 提交消息(英文,小写,无特殊字符)
消息的提交应遵循与 `PR` 类似的模式:`[feature/bugfix/doc/improve/refactor/bug/cleanup] title`
## 2 代码检查样式
@@ -631,7 +631,7 @@ public void process(String input) {
// 忽略声明行。
List`<User>` userList = getUsersByBatch(1000);
if (LOG.isDebugEnabled()) {
LOG.debug("All ids of users: {}", getAllIDsOfUsers(userList));
LOG.debug("All ids of users: {}", getAllIDsOfUsers(userList));
}
```
@@ -645,6 +645,5 @@ public void process(String input) {
- [https://site.mockito.org/](https://site.mockito.org/)
- [https://alibaba.github.io/p3c/](https://alibaba.github.io/p3c/)
- [https://rules.sonarsource.com/java/](https://rules.sonarsource.com/java/)
- [https://junit.org/junit5/](https://junit.org/junit5/)
- [https://streampark.apache.org/](https://streampark.apache.org/)
@@ -15,7 +15,7 @@ Consul 服务发现允许 HertzBeat 连接到您的 Consul 服务器并自动发
#### 部署 Consul 服务器
1. 根据 [Consul 官方文档](https://www.consul.io/docs/install)部署 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)
@@ -0,0 +1,186 @@
{
"version.label": {
"message": "1.8.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,useage`指标
若只有一台虚拟机,其单层格式为:
```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,26 @@
---
id: extend-push
title: Push Style Custom Monitoring
sidebar_label: Push Style Custom Monitoring
---
> 推送方式监控是一种特殊的监控,允许用户配置数据格式并编写代码将指标推送到 Hertzbeat。
> 下面我们将介绍如何使用这一功能。
### 推送方式监控的采集流程
【用户开始推送数据】->【HertzBeat推送模块暂存数据】->【HertzBeat采集模块定期采集数据】
### 数据解析方式
HertzBeat会使用用户添加新监控时配置的格式来解析数据。
### 创建监控步骤
HertzBeat页面 -> 应用服务监控 -> 推送方式监控 -> 新建推送方式监视器 -> 设置推送模块主机(Hertzbeat服务器ip,通常为127.0.0.1或localhost -> 设置推送模块端口(hertzbeat服务器端口,通常为1157) -> 配置数据字段(单位:字符串表示,类型:0表示数字/1表示字符串)-> 结束
---
### 监控配置示例
![HertzBeat](/img/docs/advanced/extend-push-example-1.png)
@@ -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`
前端运行 `npm 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,25 @@
---
id: contact
title: 交流联系
sidebar_label: 交流联系
---
> 如果您在使用过程有任何需要帮助或者想交流建议,可以通过 群 ISSUE 讨论交流。
[订阅邮件列表](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`.
[QQ交流群](https://qm.qq.com/q/xxqecSC2cw) : 群号 `1035688434`
[Github Discussion](https://github.com/apache/hertzbeat/discussions)
[Reddit Community](https://www.reddit.com/r/hertzbeat/)
[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/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+`, `java17``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,72 @@
---
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+`, `java17``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+`, `java17`, `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+`, `java17` 环境
2. 在项目根目录运行: `mvn clean package -Prelease`
HertzBeat 包将生成为 `dist/hertzbeat-{version}.tar.gz`
### 采样器打包
1. 需要 `maven3+`, `java17` 环境
2. 在项目根目录运行: `mvn clean install`
3. 切换到 `hertzbeat-collector` 目录: `cd hertzbeat-collector`
4.`hertzbeat-collector` 目录下执行: `mvn clean package -Pcluster`
HertzBeat 采样器包将生成为 `dist/hertzbeat-collector-{version}.tar.gz`
@@ -0,0 +1,113 @@
---
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`目录下运行 `npm install` 来安装所需的依赖库。
4.`home`目录下运行 `npm run start`,您可以访问 [http://localhost:3000](http://localhost:3000) 查看站点的英文模式预览
5.`home`目录下运行 `npm run start-zh-cn`,您可以访问 [http://localhost:3000](http://localhost:3000) 查看站点的中文模式预览
6. 若要生成静态网站资源文件,请运行 `npm run 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 // 文档侧边栏菜单配置
```
## 规范
### 文件的命名规范
全部由小写,数字,下划线和破折号组成。
正例:`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,522 @@
---
id: 'how_to_release'
title: 如何进行版本发布
sidebar_position: 4
---
本教程详细描述了如何发布Apache HertzBeat,并以 v1.7.3 版本的发布为例。
## 1. 环境要求
此发布过程在 UbuntuOS(可在 Windows Mac) 中进行操作,并需要以下环境:
- JDK 17
- Node18 pnpm
- Apache Maven 3.x
- GnuPG 2.x
- Git
- SVN (Apache使用svn来托管项目发布)
> 注意需要设置环境变量 `export GPG_TTY=$(tty)`
## 2. 准备发布
> 首先整理帐户信息以更好地了解操作过程,稍后会多次使用。
>
> - apache id: `muchunjin (APACHE LDAP 用户名)`
> - apache passphrase: `APACHE LDAP 密钥`
> - apache email: `muchunjin@apache.org`
> - gpg real name: `muchunjin (任何名称均可用, 在这里我将其设置为与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: muchunjin # Please enter 'gpg real name'
Email address: muchunjin@apache.org # Please enter your apache email address here
Comment: apache key # Please enter some comments here
You selected this USER-ID:
"muchunjin (apache key) [muchunjin@apache.org](mailto:muchunjin@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: key ACFB69E705016886 marked as ultimately trusted
gpg: revocation certificate stored as '/root/.gnupg/openpgp-revocs.d/DC12398CCC33A5349EB9663DF9D970AB18C9EDF6.rev'
public and secret key created and signed.
pub rsa4096 2023-05-01 [SC]
85778A4CE4DD04B7E07813ABACFB69E705016886
uid muchunjin (apache key) [muchunjin@apache.org](mailto:muchunjin@apache.org)
sub rsa4096 2023-05-01 [E]
```
密钥可以通过`gpg --list-signatures`命令查看
### 2.2 将生成的密钥上传到公共服务器
```shell
$ gpg --keyid-format SHORT --list-keys
/root/.gnupg/pubring.kbx
------------------------
pub rsa4096/05016886 2023-05-01 [SC]
85778A4CE4DD04B7E07813ABACFB69E705016886
uid [ultimate] muchunjin (apache key) [muchunjin@apache.org](mailto:muchunjin@apache.org)
sub rsa4096/0C5A4E1C 2023-05-01 [E]
# Send public key to keyserver via key id
$ gpg --keyserver keyserver.ubuntu.com --send-key 05016886
# 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 keyserver.ubuntu.com --recv-keys 05016886 # If the following content appears, it means success
gpg: key ACFB69E705016886: "muchunjin (apache key) [muchunjin@apache.org](mailto:muchunjin@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
```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 muchunjin@apache.org && gpg --export --armor muchunjin@apache.org) >> KEYS
$ svn ci -m "add gpg key for muchunjin"
```
##### 2.4.2 将公钥添加到release分支的KEYS
```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 muchunjin@apache.org && gpg --export --armor muchunjin@apache.org) >> KEYS
$ svn ci -m "add gpg key for muchunjin"
```
## 3. 准备物料 & 发布
### 准备发布物料
#### 3.1 基于 master 分支,创建一个名为 release-`release_version`-rcx 的分支,例如 release-1.7.3-rc1。并基于 release-1.7.3-rc1 分支创建一个名为 v1.7.3-rc1 的标签,并将此标签设置为预发布
```shell
git checkout master
git checkout -b release-1.7.3-rc1
```
#### 3.2 本地切换到待发布分支
```shell
git checkout release-1.7.3-rc1
```
#### 3.3 编译二进制包
> HertzBeat 编译打包,在项目`web-app`目录下执行以下命令,
```shell
pnpm install
pnpm package
```
> 在项目根目录下执行以下命令
```shell
mvn clean package -Prelease
```
然后
```shell
mvn clean install
```
> HertzBeat-Collector 编译打包,在项目`collector`目录下执行以下命令
```shell
mvn clean package -Pcluster
```
生成的二进制包在:
- `dist/apache-hertzbeat-{version}-bin.tar.gz`
- `dist/apache-hertzbeat-collector-{version}-bin.tar.gz`
- `dist/apache-hertzbeat-{version}-docker-compose.tar.gz`
#### 3.4 打包项目源代码
> 打包项目源码
```shell
git archive \
--format=tar.gz \
--output="dist/apache-hertzbeat-1.7.3-src.tar.gz" \
--prefix=apache-hertzbeat-1.7.3-src/ \
release-1.7.3-rc1
```
生成的代码归档文件在 `dist/apache-hertzbeat-1.7.3-src.tar.gz`
### 签名发布物料
#### 3.5 对二进制和源码包进行签名
将上步骤生成的三个文件包放到`dist`目录下(若无则新建目录),然后对文件包进行签名和SHA512校验和生成。
> 其中 `gpg -u 33545C76` 的 `33545C76` 是你的 GPG 密钥 ID,可以通过 `gpg --keyid-format SHORT --list-keys` 查看。
```shell
cd dist
# sign
for i in *.tar.gz; do echo $i; gpg -u 33545C76 --armor --output $i.asc --detach-sig $i ; done
# SHA512
for i in *.tar.gz; do echo $i; sha512sum $i > $i.sha512 ; done
# if macos sha512sum not found, you can install by brew install coreutils
```
> 最终文件列表如下
```text
apache-hertzbeat-1.7.3-src.tar.gz
apache-hertzbeat-1.7.3-src.tar.gz.asc
apache-hertzbeat-1.7.3-src.tar.gz.sha512
apache-hertzbeat-1.7.3-bin.tar.gz
apache-hertzbeat-1.7.3-bin.tar.gz.asc
apache-hertzbeat-1.7.3-bin.tar.gz.sha512
apache-hertzbeat-1.7.3-docker-compose.tar.gz
apache-hertzbeat-1.7.3-docker-compose.tar.gz.asc
apache-hertzbeat-1.7.3-docker-compose.tar.gz.sha512
apache-hertzbeat-collector-1.7.3-bin.tar.gz
apache-hertzbeat-collector-1.7.3-bin.tar.gz.asc
apache-hertzbeat-collector-1.7.3-bin.tar.gz.sha512
```
#### 3.6 验证签名
```shell
$ cd dist
# 验证签名
$ for i in *.tar.gz; do echo $i; gpg --verify $i.asc $i ; done
apache-hertzbeat-1.7.3-bin.tar.gz
gpg: Signature made Tue May 2 12:16:35 2023 CST
gpg: using RSA key 85778A4CE4DD04B7E07813ABACFB69E705016886
gpg: Good signature from "muchunjin (apache key) [muchunjin@apache.org](mailto:muchunjin@apache.org)" [ultimate]
apache-hertzbeat-1.7.3-docker-compose.tar.gz
gpg: Signature made Tue May 2 12:16:36 2023 CST
gpg: using RSA key 85778A4CE4DD04B7E07813ABACFB69E705016886
gpg: Good signature from "muchunjin (apache key) [muchunjin@apache.org](mailto:muchunjin@apache.org)" [ultimate]
apache-hertzbeat-1.7.3-src.tar.gz
gpg: Signature made Tue May 2 12:16:37 2023 CST
gpg: using RSA key 85778A4CE4DD04B7E07813ABACFB69E705016886
gpg: Good signature from "muchunjin (apache key) [muchunjin@apache.org](mailto:muchunjin@apache.org)" [ultimate]
apache-hertzbeat-collector-1.7.3-bin.tar.gz
gpg: Signature made Tue May 2 12:16:37 2023 CST
gpg: using RSA key 85778A4CE4DD04B7E07813ABACFB69E705016886
gpg: Good signature from "muchunjin (apache key) [muchunjin@apache.org](mailto:muchunjin@apache.org)" [ultimate]
# 验证 SHA512
$ for i in *.tar.gz; do echo $i; sha512sum --check $i.sha512; done
apache-hertzbeat-1.7.3-src.tar.gz
apache-hertzbeat-1.7.3-src.tar.gz: OK
apache-hertzbeat-1.7.3-bin.tar.gz
apache-hertzbeat-1.7.3-bin.tar.gz: OK
apache-hertzbeat-1.7.3-docker-compose.tar.gz
apache-hertzbeat-1.7.3-docker-compose.tar.gz: OK
apache-hertzbeat-collector-1.7.3-bin.tar.gz
apache-hertzbeat-collector-1.7.3-bin.tar.gz: OK
```
#### 3.7 发布 Apache SVN 仓库中 dev 目录的物料包
- 检出仓库
```shell
# 检出 Apache SVN 仓库中的 dev/incubator/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 仓库
创建一个版本号目录,并以`release_version`-`RC_version`的形式命名。RC_version从1开始,即候选版本从RC1开始。在发布过程中,如果出现导致投票失败的问题,需要进行修正,那么RC版本需要迭代,RC版本号需要+1。例如:为版本1.7.3-RC1投票。如果投票顺利通过,那么RC1版本的资料将作为最终版本的资料发布。如果出现问题并需要纠正,那么修正后重新启动投票,下一次的候选版本为1.7.3-RC2。
```shell
mkdir -p svn/dev/1.7.3-RC1
cp -f dist/* svn/dev/1.7.3-RC1
```
- 提交到SVN
```shell
cd svn/dev
# 1. 检查svn状态
svn status
# 2. 添加到svn
svn add 1.7.3-RC1
svn status
# 3. 提交到svn远端服务器
svn commit -m "release for HertzBeat 1.7.3-RC1"
```
- 检查 Apache SVN 提交结果
> 在浏览器中访问 [https://dist.apache.org/repos/dist/dev/hertzbeat/](https://dist.apache.org/repos/dist/dev/hertzbeat/) , 检查是否有新的版本内容
## 4. 进入社区投票阶段
### 4.1 发送社区投票邮件
发送社区投票邮件需要至少三个`+1`,且无`-1`
> `Send to`: [dev@hertzbeat.apache.org](mailto:dev@hertzbeat.apache.org) <br />
> `Title`: [VOTE] Release Apache HertzBeat 1.7.3 rc1 <br />
> `Body`:
```text
Hello HertzBeat Community:
This is a call for vote to release Apache HertzBeat version release-1.7.3-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/v1.7.3-rc1
The release candidates:
https://dist.apache.org/repos/dist/dev/hertzbeat/1.7.3-RC1/
Git tag for the release:
https://github.com/apache/hertzbeat/releases/tag/v1.7.3-rc1
The artifacts signed with PGP key [33545C76], corresponding to [muchunjin@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 1.7.3-rc1 <br />
> `Body`:
```text
Dear HertzBeat community,
Thanks for your review and vote for "Release Apache HertzBeat 1.7.3-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,
ChunJin Mu
```
邮件内容中的一项是`Vote thread`,在 [https://lists.apache.org/list.html?dev@hertzbeat.apache.org](https://lists.apache.org/list.html?dev@hertzbeat.apache.org) 查看获取
## 4. 完成最终发布步骤
### 4.1 迁移源代码和二进制包
```shell
svn mv https://dist.apache.org/repos/dist/dev/hertzbeat/1.7.3-RC1 https://dist.apache.org/repos/dist/release/hertzbeat/1.7.3 -m "transfer packages for 1.7.3-RC1"
```
### 4.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/) 查看是否有新版本的下载
> 需要注意的是,下载链接可能需要一个小时后才会生效,请注意。
### 4.3 Github 生成 Release
基于 release-1.7.3-rc1 分支修改创建一个名为 v1.7.3 的标签,并将此标签设置为 latest release。
:::tip
在原有的 Release 上面修改,无需重新创建 Release。
:::
然后输入发版标题和描述
- 发版标题:
```text
v1.7.3
```
- 描述:
```text
xxx
release note: xxx
```
然后点击`Publish release`按钮。
然后将 release-1.7.3-rc1 分支重命名 为 release-1.7.3。
### 4.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 1.7.3 released <br />
> `Body`:
```text
Hi Community,
We are glad to announce the release of Apache HertzBeat 1.7.3.
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/v1.7.3
Website:
https://hertzbeat.apache.org/
HertzBeat Resources:
- Issue: https://github.com/apache/hertzbeat/issues
- Mailing list: dev@hertzbeat.apache.org
---
Apache HertzBeat Team
Best,
ChunJin Mu
```
该版本的发布顺利结束。
---
This doc refer from [Apache StreamPark](https://streampark.apache.org/)
@@ -0,0 +1,183 @@
---
id: how_to_verify_release
title: 版本物料的验证
sidebar_position: 4
---
## 验证候选版本
详细检查列表请参考官方的[check list](https://cwiki.apache.org/confluence/display/INCUBATOR/Incubator+Release+Checklist)
在浏览器中可访问版本内容 [https://dist.apache.org/repos/dist/dev/hertzbeat/](https://dist.apache.org/repos/dist/dev/hertzbeat/)
### 1. 下载候选版本到本地
> 需要依赖gpg工具,如果没有,建议安装gpg2
```shell
#如果本地有svn,可以clone到本地
svn co https://dist.apache.org/repos/dist/dev/hertzbeat/`release_version`-`rc_version`/
#或者 直接下载物料文件
wget https://dist.apache.org/repos/dist/dev/hertzbeat/`release_version`-`rc_version`/xxx.xxx
```
### 2. 验证上传的版本是否合规
> 开始验证环节,验证包含但不局限于以下内容和形式
#### 2.1 查看发布包是否完整
> 上传到dist的包必须包含源码包,二进制包可选
1. 是否包含源码包
2. 是否包含源码包的签名
3. 是否包含源码包的sha512
4. 如果上传了二进制包,则同样检查(2)-(4)所列的内容
#### 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 信任公钥
> 信任此次版本所使用的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
for i in *.tar.gz; do echo $i; gpg --verify $i.asc $i ; done
```
检查结果
> 出现类似以下内容则说明签名正确,关键字:**`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; do echo $i; sha512sum --check $i.sha512; done
```
#### 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. 源码编译验证
解压缩 `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成员
```html
+1 (non-binding)
I checked:
1. All download links are valid
2. Checksum and signature are OK
3. LICENSE and NOTICE are exist
4. Build successfully on macOS(Big Sur)
5. ....
```
PMC成员
```html
+1 (binding)
I checked:
1. All download links are valid
2. Checksum and signature are OK
3. LICENSE and NOTICE are exist
4. Build successfully on macOS(Big Sur)
5. ....
```
---
This doc refer from [Apache StreamPark](https://streampark.apache.org/)
@@ -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
[ANNONCE] 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,36 @@
---
id: download
title: 下载 Apache HertzBeat
sidebar_label: Download
---
> **这里是 Apache HertzBeat™ 官方下载页面。**
> **请在下方表中选择版本下载,推荐使用最新版本。**
:::tip
- 验证下载版本,请使用相应的哈希(sha512)、签名和[项目发布KEYS](https://downloads.apache.org/hertzbeat/KEYS)。
- 检查哈希和签名的方法参考 [如何验证](https://www.apache.org/dyn/closer.cgi#verify)。
:::
## 最新版本
:::tip
以前版本的 HertzBeat 可能会受到安全问题的影响,请考虑使用最新版本。
:::
| 版本 | 日期 | 下载 | Release |
|--------|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|
| v1.8.0 | 2026.02.05 | [apache-hertzbeat-1.8.0-bin.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-bin.tar.gz) (Server) ( [signature](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-bin.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-bin.tar.gz.sha512) ) <br/> [apache-hertzbeat-collector-1.8.0-bin.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.8.0/apache-hertzbeat-collector-1.8.0-bin.tar.gz) (Collector) ( [signature](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-collector-1.8.0-bin.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-collector-1.8.0-bin.tar.gz.sha512) ) <br/> [apache-hertzbeat-1.8.0-src.tar.gz](https://www.apache.org/dyn/closer.lua/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-src.tar.gz) (Source Code) ( [signature](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-src.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-src.tar.gz.sha512) ) <br/> [apache-hertzbeat-1.8.0-docker-compose.tar.gz](https://github.com/apache/hertzbeat/releases/download/1.8.0/apache-hertzbeat-1.8.0-docker-compose.tar.gz) (Docker Compose) ( [signature](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-docker-compose.tar.gz.asc) , [sha512](https://downloads.apache.org/hertzbeat/1.8.0/apache-hertzbeat-1.8.0-docker-compose.tar.gz.sha512) ) | [note](https://github.com/apache/hertzbeat/releases/tag/1.8.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/).
@@ -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/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/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,28 @@
---
id: bulletin
title: 自定义看板
sidebar_label: 自定义看板
keywords: [看板, 自定义]
---
> 自定义监控看板,以表格形式展示某种监控的自选指标。
### 新增看板项
1. 点击新增看板项, 输入`看板名称`, 下拉选择`监控类型`, 可根据`标签``监控任务名称`进行筛选,再选择关联的`监控任务名称`, 最后在穿梭框中选择需要展示的`监控指标`
2. 点击`确定`按钮, 即可完成自定义看板的创建。
![new-bulletin](/img/docs/help/bulletin-1.png)
### 查看多个看板
1. 点击标签页中的看板名称, 即可查看该看板的详细信息。
### 删除看板项
1. 点击`删除看板项`按钮, 即可删除当前看板项。
2. 点击`批量删除看板项`按钮, 即可选择批量删除选中的看板项。
![bulletin](/img/docs/help/bulletin-2.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,79 @@
---
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 服务
### 配置参数
以下是 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` |

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