Compare commits

..
66 Commits
Author SHA1 Message Date
Jastandtomsun28 51bdb56592 [Feture]Add docker e2e test (#2916)
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-12-30 13:05:43 +08:00
yunfan24andtomsun28 3562e870d8 [improve] Add required field indicators and form validation prompts for convergence strategies and silent strategies in the form. (#2913)
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-12-30 13:04:03 +08:00
6f9ee2f4e6 [improve] Optimize CacheService and add relevant unit test (#2912)
Co-authored-by: LLWW04 <1713673102@qq.com>
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-12-29 23:52:36 +08:00
Jastandtomsun28 917c11f298 [bugfix] Fix docker container name unable to display problem (#2914)
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-12-29 11:45:51 +08:00
bf8d5b79bb [bugfix] Fix the bug where canceling an edit on a record still updates the page values. (#2911)
Co-authored-by: aias00 <rokkki@163.com>
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-12-29 11:38:57 +08:00
7178c444f2 [feature](web-app)Add Alarm Voice Alerts (#2906)
Signed-off-by: Logic <zqr10159@126.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: aias00 <rokkki@163.com>
2024-12-29 11:25:48 +08:00
Calvinandtomsun28 bc2dc1d567 [improve] fix import of CollectRep (#2910)
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-12-28 14:04:11 +08:00
Jastandtomsun28 9714123c98 [Improve] Improve OBS (#2909)
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-12-28 12:24:58 +08:00
leo 8ca2f70153 add an online parser for prometheus. (#2851) 2024-12-27 23:18:56 +08:00
doveLin 126268f7ec [feature] Add a new Singleton-pattern-based LRU local cache (#2907) 2024-12-27 14:39:00 +08:00
Logic 12d1f4990d [fix](flink): update calculate metrics definitions (#2905) 2024-12-26 23:45:02 +08:00
Jastandtomsun28 4b21df556c [Imporve] Support Kafka internal topic configuration (#2901)
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-12-26 00:06:12 +08:00
Jast 893d91c4f0 [doc] update doc (#2900)
Signed-off-by: Jast <shenghang@apache.org>
2024-12-26 00:00:34 +08:00
4236c438be [feature] integrate with Apache Arrow (#2864)
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Signed-off-by: shown <yuluo08290126@gmail.com>
Co-authored-by: shown <yuluo08290126@gmail.com>
Co-authored-by: tomsun28 <tomsun28@outlook.com>
Co-authored-by: aias00 <rokkki@163.com>
2024-12-24 20:43:14 +08:00
yunfan 6a64752af0 [Improve] add notification when port number changes automatically due to HTTPS toggle.(#2779) (#2896) 2024-12-24 18:22:26 +08:00
东风 c5cce27cb4 [improve]add Plc protocol , Modbus monitor (#2850) 2024-12-23 23:52:40 +08:00
doveLin 364de609bf [collector] fix the issue of reusing the adminClient in the Kafka client. (#2895) 2024-12-23 11:44:45 +08:00
Jast 5d81c32f9d [Improve] Improve Kafka chart display (#2894) 2024-12-23 10:53:53 +08:00
doveLinandtomsun28 6aff6ed053 [collector]add monitoring metrics for consumer groups in Kafka client (#2887)
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-12-20 14:20:05 +08:00
Nick Guoandtomsun28 5ba09cf5c1 [doc] add more hints when users are switching data source. (#2880)
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-12-20 13:52:46 +08:00
Logic a746e35dcf [Improve]Beautify Charts (#2891) 2024-12-20 12:06:28 +08:00
liutianyou a27777adcb [improve]improve linux process (#2889) 2024-12-20 07:41:17 +08:00
Logic 4b7dfb4c8e [improve] remove stack property from line charts (#2888) 2024-12-19 22:51:42 +08:00
AyuandAyu ceda4a65f9 [chore] delete the redundant else (#2881)
Co-authored-by: Ayu <14359932+lin-Ayu0v0@user.noreply.gitee.com>
2024-12-19 16:07:57 +08:00
d4f6fc1ae8 [Fix] fix clickhouse monitor (#2874)
Co-authored-by: Calvin <naruse_shinji@163.com>
Co-authored-by: aias00 <rokkki@163.com>
2024-12-17 14:20:27 +08:00
铁甲小宝 e999360da8 modified:add a small change. (#2878) 2024-12-16 00:16:29 +08:00
Nick Guo 948fcb739a [improve]Add more helpful messages when adding a Kafka monitor (#2876) 2024-12-14 15:22:27 +08:00
cdf060e9ac [Optimize] Add a reminder about potential collection issues caused by the Docker deployment method of collector. (#2844)
Co-authored-by: Calvin <naruse_shinji@163.com>
Co-authored-by: tomsun28 <tomsun28@outlook.com>
Co-authored-by: shown <yuluo08290126@gmail.com>
Co-authored-by: aias00 <rokkki@163.com>
2024-12-12 20:51:02 +08:00
starryCoder 1280c61af1 [doc] improve windows monitoring doc(#2869) 2024-12-12 15:10:18 +08:00
Nick Guo 86ad10ad7b [doc] Add ',' separator between monitoring types (#2865) 2024-12-10 21:08:55 +08:00
8961cf70a3 [bugfix]A bug fix (#2853)
Co-authored-by: shown <yuluo08290126@gmail.com>
Co-authored-by: aias00 <rokkki@163.com>
2024-12-08 11:48:18 +08:00
tomsun28andaias00 f31909a30d [doc] update security doc and some (#2856)
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Co-authored-by: aias00 <rokkki@163.com>
2024-12-05 08:49:18 +08:00
Jastandtomsun28 2df7e1d269 [improve] improve dependency (#2855)
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-12-04 21:24:37 +08:00
tomsun28andCalvin c10ebf0b60 [doc] add security model doc and update contributors (#2846)
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Co-authored-by: Calvin <naruse_shinji@163.com>
2024-12-04 13:58:16 +08:00
1fe70a60cc [bugfix]Fix wrong app name (#2845)
Co-authored-by: Calvin <naruse_shinji@163.com>
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-11-30 16:43:09 +08:00
Jastandtomsun28 3ea4c0e7da [Feature] Add ssh e2e code (#2843)
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-11-30 16:39:03 +08:00
tomsun28 8228938bd1 [fix] auto generated by protocol buffer (#2842)
Signed-off-by: tomsun28 <tomsun28@outlook.com>
2024-11-30 13:56:05 +08:00
5acaf4844a [feature] support managing tasks by using http_sd (#2830)
Co-authored-by: Zhang Yuxuan <1373529784@qq.com>
Co-authored-by: aias00 <rokkki@163.com>
2024-11-28 00:07:38 +08:00
fc8be06ad5 [improve] update victoriametrics and greptime store (#2836)
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Signed-off-by: Logic <zqr10159@126.com>
Co-authored-by: shown <yuluo08290126@gmail.com>
Co-authored-by: Logic <zqr10159@dromara.org>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Zhang Yuxuan <1373529784@qq.com>
2024-11-27 08:58:09 +08:00
tomsun28 509a9c9651 [fix] bugfix flyway location can not auto detect vendor when not h2 (#2835) 2024-11-26 19:28:39 +08:00
Logic 754b18c9ba [doc] update sidebar category label and plugin documentation (#2837) 2024-11-26 14:36:40 +08:00
8cdc92ab56 [chore] Delete redundant Spaces (#2834)
Signed-off-by: ayu-v0 <127600988+ayu-v0@users.noreply.github.com>
Co-authored-by: Ayu <14359932+lin-Ayu0v0@user.noreply.gitee.com>
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-11-24 21:01:25 +08:00
tomsun28andLogic f0cb2af031 [improve] update and fix template yml priority (#2829)
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Co-authored-by: Logic <zqr10159@dromara.org>
2024-11-24 15:38:21 +08:00
Jastandtomsun28 bd937bf7b8 [doc] Added custom development collector documentation (#2833)
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-11-24 14:10:33 +08:00
starryCoder 8852713e4d [fix]fix windows chinese encoding (#2831) 2024-11-24 11:39:50 +08:00
CalvinandZhang Yuxuan 12f4ecce01 [refactor] change name from http_sd to registry (#2827)
Co-authored-by: Zhang Yuxuan <1373529784@qq.com>
2024-11-22 19:34:42 +08:00
Kerwin Bryant ca9934ec81 Fixed the omissions in #2805 (#2826)
Signed-off-by: Kerwin Bryant <kerwin612@qq.com>
2024-11-22 08:51:00 +08:00
tomsun28andshown eaaf589083 [improve] update grafana auth method and add expose url (#2818)
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Co-authored-by: shown <yuluo08290126@gmail.com>
2024-11-18 23:19:57 +08:00
tomsun28 be84a0abae [improve] update windows metrics yml (#2816)
Signed-off-by: tomsun28 <tomsun28@outlook.com>
2024-11-18 21:57:50 +08:00
Jast 9a00f5a776 [improve] modify e2e test (#2814) 2024-11-14 23:38:43 +08:00
fb4626dd07 [feature] add e2e code (#2811)
Co-authored-by: aias00 <rokkki@163.com>
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-11-14 11:24:49 +08:00
Jast f28996255a [Improve] improve kafka monitor (#2813) 2024-11-13 21:35:04 +08:00
Jast 0b79222bd0 [Doc] Add blog (#2812) 2024-11-11 23:19:15 +08:00
liutianyouandZhang Yuxuan 120f3a12fe [fix] fix the Linux process monitoring process exits abnormally without warning (#2810)
Co-authored-by: Zhang Yuxuan <1373529784@qq.com>
2024-11-11 14:09:30 +08:00
b8b1885657 [improve] Fix error links caused by module name changes. (#2807)
Co-authored-by: aias00 <rokkki@163.com>
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-11-09 22:17:51 +08:00
caf13c09bd [feature] Support custom refresh intervals for each group of metrics (#2718)
Co-authored-by: tomsun28 <tomsun28@outlook.com>
Co-authored-by: shown <yuluo08290126@gmail.com>
Co-authored-by: aias00 <rokkki@163.com>
Co-authored-by: crossoverJie <crossoverJie@gmail.com>
2024-11-09 13:41:31 +08:00
dca3e351ed [improve] code according to code specifications (#2809)
Co-authored-by: shown <yuluo08290126@gmail.com>
Co-authored-by: aias00 <rokkki@163.com>
2024-11-08 19:16:19 +08:00
Jast 6298e7ae90 [Improve] Improve module name (#2805) 2024-11-08 09:25:28 +08:00
tomsun28 4b2c3756b1 [doc] update new contributors (#2802)
Signed-off-by: tomsun28 <tomsun28@outlook.com>
2024-11-04 11:12:16 +08:00
shinestare d32ec249b4 [fix]Remove the duplicate declaration of commons-net (#2801) 2024-11-03 11:03:01 +08:00
tomsun28andLogic 611ddc22e3 [bugfix] fix collector docker build error (#2799)
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Co-authored-by: Logic <zqr10159@dromara.org>
2024-11-01 17:28:27 +08:00
4373ab23f3 [improve] improve the way Ai is entered and requested (#2762)
Co-authored-by: tomsun28 <tomsun28@outlook.com>
Co-authored-by: shown <yuluo08290126@gmail.com>
Co-authored-by: aias00 <rokkki@163.com>
Co-authored-by: Zhang Yuxuan <1373529784@qq.com>
2024-10-31 22:02:02 +08:00
bff75757db [Task][OSPP] HertzBeat Official Template Marketplace (#2641)
Co-authored-by: Calvin <naruse_shinji@163.com>
Co-authored-by: aias00 <rokkki@163.com>
Co-authored-by: shown <yuluo08290126@gmail.com>
Co-authored-by: tomsun28 <tomsun28@outlook.com>
Co-authored-by: Logic <zqr10159@dromara.org>
2024-10-30 20:07:49 +08:00
tomsun28 50dd262fbf [doc] update deploy doc (#2796) 2024-10-30 15:38:34 +08:00
Jastandtomsun28 dc9743b7a5 [Doc] improve website (#2795)
Co-authored-by: tomsun28 <tomsun28@outlook.com>
2024-10-30 11:02:16 +08:00
Logic 8dc0fdee27 [doc](download): update for v1.6.1 release (#2794) 2024-10-30 10:08:20 +08:00
1470 changed files with 39845 additions and 11468 deletions
+81
View File
@@ -2081,6 +2081,87 @@
"contributions": [
"doc"
]
},
{
"login": "shinestare",
"name": "shinestare",
"avatar_url": "https://avatars.githubusercontent.com/u/13570619?v=4",
"profile": "https://github.com/shinestare",
"contributions": [
"code"
]
},
{
"login": "po-168",
"name": "po-168",
"avatar_url": "https://avatars.githubusercontent.com/u/185745593?v=4",
"profile": "https://github.com/po-168",
"contributions": [
"code"
]
},
{
"login": "All-The-Best-for",
"name": "wbs99",
"avatar_url": "https://avatars.githubusercontent.com/u/76414672?v=4",
"profile": "https://github.com/All-The-Best-for",
"contributions": [
"code"
]
},
{
"login": "starryCoder",
"name": "starryCoder",
"avatar_url": "https://avatars.githubusercontent.com/u/46510059?v=4",
"profile": "https://github.com/starryCoder",
"contributions": [
"code"
]
},
{
"login": "hasimmollah",
"name": "hasimmollah",
"avatar_url": "https://avatars.githubusercontent.com/u/32538599?v=4",
"profile": "https://github.com/hasimmollah",
"contributions": [
"code"
]
},
{
"login": "ayu-v0",
"name": "Ayu",
"avatar_url": "https://avatars.githubusercontent.com/u/127600988?v=4",
"profile": "https://github.com/ayu-v0",
"contributions": [
"code"
]
},
{
"login": "Rancho-7",
"name": "Nick Guo",
"avatar_url": "https://avatars.githubusercontent.com/u/59016860?v=4",
"profile": "https://github.com/Rancho-7",
"contributions": [
"doc"
]
},
{
"login": "doveLin0818",
"name": "doveLin",
"avatar_url": "https://avatars.githubusercontent.com/u/190927907?v=4",
"profile": "https://github.com/doveLin0818",
"contributions": [
"code"
]
},
{
"login": "yunfan24",
"name": "yunfan24",
"avatar_url": "https://avatars.githubusercontent.com/u/91836599?v=4",
"profile": "https://zzrl.cc/",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
+1 -1
View File
@@ -53,4 +53,4 @@ body:
validations:
required: false
- type: markdown
value: "Please read the [Contribution Guideline](https://hertzbeat.apache.org/docs/others/contributing) before submitting the PR"
value: "Please read the [Contribution Guideline](https://hertzbeat.apache.org/docs/community/contribution) before submitting the PR"
+1 -1
View File
@@ -39,4 +39,4 @@ body:
- type: markdown
attributes:
value: |
Please read the [Contribution Guideline](https://hertzbeat.com/docs/others/contributing/) before submitting the PR
Please read the [Contribution Guideline](https://hertzbeat.apache.org/docs/community/contribution) before submitting the PR
+1 -1
View File
@@ -30,5 +30,5 @@ body:
- type: markdown
attributes:
value: |
Please read the [Contribution Guideline](https://hertzbeat.apache.org/docs/others/contributing/) before submitting the PR
Please read the [Contribution Guideline](https://hertzbeat.apache.org/docs/community/contribution) before submitting the PR
@@ -1,71 +0,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
#
# 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.
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Backend CI
on:
workflow_call:
secrets:
codecov_token:
required: true
workflow_dispatch:
jobs:
backend-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./script/ci/github-actions/setup-deps
- name: Build with Maven
run: mvn clean -B package -Prelease --file pom.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Build Image
uses: docker/build-push-action@v3
with:
context: ./dist
file: ./script/docker/server/Dockerfile
push: false
tags: apache/hertzbeat:test
- name: Run E2E
run: |
sudo curl -L https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod u+x /usr/local/bin/docker-compose
cd e2e
sudo docker-compose version
sudo docker-compose up --exit-code-from testing --remove-orphans
# upload application logs
- name: Upload logs & API test reports
uses: actions/upload-artifact@v3
if: always()
with:
name: hz-logs-${{ github.run_id }}
path: |
e2e/logs/
e2e/report/
+41 -3
View File
@@ -40,6 +40,44 @@ on:
jobs:
backend-build:
uses: ./.github/workflows/backend-build-test-reuse.yml
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./script/ci/github-actions/setup-deps
- name: Build with Maven
run: mvn clean -B package -Prelease -Dmaven.test.skip=false --file pom.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Build Image
uses: docker/build-push-action@v3
with:
context: ./dist
file: ./script/docker/server/Dockerfile
push: false
tags: apache/hertzbeat:test
- name: Run E2E
run: |
sudo curl -L https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod u+x /usr/local/bin/docker-compose
cd e2e
sudo docker-compose version
sudo docker-compose up --exit-code-from testing --remove-orphans
# upload application logs
- name: Upload logs & API test reports
uses: actions/upload-artifact@v3
if: always()
with:
name: hz-logs-${{ github.run_id }}
path: |
e2e/logs/
e2e/report/
+1 -1
View File
@@ -1,7 +1,7 @@
tasks:
- name: Run backend
before: cd manager
before: cd hertzbeat-manager
command: |
gp sync-await setup-backend
mvn spring-boot:run
+11 -6
View File
@@ -38,7 +38,9 @@ Even small corrections to typos are very welcome :)
3. Execute under the project root directory: `mvn clean install -DskipTests`
4. Start `springboot manager` service: `manager/src/main/java/org/apache/hertzbeat/manager/Manager.java`
4. Add VM Options: `--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED`
5. Start `springboot manager` service: `manager/src/main/java/org/apache/hertzbeat/hertzbeat-manager/Manager.java`
#### Frontend start
@@ -131,13 +133,13 @@ Add WeChat account `ahertzbeat` to pull you into the WeChat group.
## 🥐 Architecture
- **[manager](https://github.com/apache/hertzbeat/tree/master/manager)** Provide monitoring management, system management basic services.
- **[manager](https://github.com/apache/hertzbeat/tree/master/hertzbeat-manager)** Provide monitoring management, system management basic services.
> Provides monitoring management, monitoring configuration management, system user management, etc.
- **[collector](https://github.com/apache/hertzbeat/tree/master/collector)** Provide metrics data collection services.
> Use common protocols to remotely collect and obtain peer-to-peer metrics data.
- **[warehouse](https://github.com/apache/hertzbeat/tree/master/warehouse)** Provide monitoring data warehousing services.
> Metrics data management, data query, calculation and statistics.
- **[alerter](https://github.com/apache/hertzbeat/tree/master/alerter)** Provide alert service.
- **[alerter](https://github.com/apache/hertzbeat/tree/master/hertzbeat-alerter)** Provide alert service.
> Alarm calculation trigger, monitoring status linkage, alarm configuration, and alarm notification.
- **[web-app](https://github.com/apache/hertzbeat/tree/master/web-app)** Provide web ui.
> Angular Web UI.
@@ -189,7 +191,10 @@ Add WeChat account `ahertzbeat` to pull you into the WeChat group.
3. 在项目根目录运行编译: `mvn clean install -DskipTests`
4. 启动`springboot manager`服务 `manager/src/main/java/org/apache/hertzbeat/manager/Manager.java`
4. 在 `jvm` 加入参数 `--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED`
5. 启动`springboot manager`服务 `manager/src/main/java/org/apache/hertzbeat/hertzbeat-manager/Manager.java`
#### 前端启动
@@ -281,13 +286,13 @@ Add WeChat account `ahertzbeat` to pull you into the WeChat group.
### 模块
- **[manager](https://github.com/apache/hertzbeat/tree/master/manager)** 提供监控管理,系统管理基础服务
- **[manager](https://github.com/apache/hertzbeat/tree/master/hertzbeat-manager)** 提供监控管理,系统管理基础服务
> 提供对监控的管理,监控应用配置的管理,系统用户租户后台管理等。
- **[collector](https://github.com/apache/hertzbeat/tree/master/collector)** 提供监控数据采集服务
> 使用通用协议远程采集获取对端指标数据。
- **[warehouse](https://github.com/apache/hertzbeat/tree/master/warehouse)** 提供监控数据仓储服务
> 采集指标结果数据管理,数据落盘,查询,计算统计。
- **[alerter](https://github.com/apache/hertzbeat/tree/master/alerter)** 提供告警服务
- **[alerter](https://github.com/apache/hertzbeat/tree/master/hertzbeat-alerter)** 提供告警服务
> 告警计算触发,任务状态联动,告警配置,告警通知。
- **[web-app](https://github.com/apache/hertzbeat/tree/master/web-app)** 提供可视化控制台页面
> 监控告警系统可视化控制台前端
+48 -37
View File
@@ -60,42 +60,42 @@
> Welcome everyone to contribute your customized general monitoring type YML template during use.
- [Website](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-website.yml), [Port Telnet](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-port.yml),
[Http Api](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-api.yml), [Ping Connect](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-ping.yml),
[Jvm](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-jvm.yml), [SiteMap](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-fullsite.yml),
[Ssl Certificate](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-ssl_cert.yml), [SpringBoot2](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-springboot2.yml),
[FTP Server](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-ftp.yml), [SpringBoot3](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-springboot3.yml),
[Udp Port](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-udp_port.yml), [Dns](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-dns.yml),
[Pop3](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-pop3.yml), [Ntp](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-ntp.yml),
[Api Code](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-api_code.yml), [Smtp](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-smtp.yml),
[Nginx](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-nginx.yml)
- [Mysql](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-mysql.yml), [PostgreSQL](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-postgresql.yml),
[MariaDB](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-mariadb.yml), [Redis](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-redis.yml),
[ElasticSearch](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-elasticsearch.yml), [SqlServer](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-sqlserver.yml),
[Oracle](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-oracle.yml), [MongoDB](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-mongodb.yml),
[DM](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-dm.yml), [OpenGauss](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-opengauss.yml),
[ClickHouse](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-clickhouse.yml), [IoTDB](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-iotdb.yml),
[Redis Cluster](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-redis_cluster.yml), [Redis Sentinel](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-redis_sentinel.yml)
[Doris BE](https://github.com/apache/hertzbeat/blob/master/manager/src/main/resources/define/app-doris_be.yml), [Doris FE](https://github.com/apache/hertzbeat/blob/master/manager/src/main/resources/define/app-doris_fe.yml),
[Memcached](https://github.com/apache/hertzbeat/blob/master/manager/src/main/resources/define/app-memcached.yml), [NebulaGraph](https://github.com/apache/hertzbeat/blob/master/manager/src/main/resources/define/app-nebulaGraph.yml)
- [Linux](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-linux.yml), [Ubuntu](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-ubuntu.yml),
[CentOS](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-centos.yml), [Windows](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-windows.yml),
[EulerOS](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-euleros.yml), [Fedora CoreOS](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-coreos.yml),
[OpenSUSE](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-opensuse.yml), [Rocky Linux](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-rockylinux.yml),
[Red Hat](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-redhat.yml), [FreeBSD](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-freebsd.yml),
[AlmaLinux](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-almalinux.yml), [Debian Linux](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-debian.yml)
- [Tomcat](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-tomcat.yml), [Nacos](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-nacos.yml),
[Zookeeper](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-zookeeper.yml), [RabbitMQ](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-rabbitmq.yml),
[Flink](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-flink.yml), [Kafka](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-kafka.yml),
[ShenYu](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-shenyu.yml), [DynamicTp](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-dynamic_tp.yml),
[Jetty](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-jetty.yml), [ActiveMQ](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-activemq.yml),
[Spring Gateway](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-spring_gateway.yml), [EMQX MQTT](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-emqx.yml),
[AirFlow](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-airflow.yml), [Hive](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-hive.yml),
[Spark](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-spark.yml), [Hadoop](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-hadoop.yml)
- [Kubernetes](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-kubernetes.yml), [Docker](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-docker.yml)
- [CiscoSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-cisco_switch.yml), [HpeSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-hpe_switch.yml),
[HuaweiSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-huawei_switch.yml), [TpLinkSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-tplink_switch.yml),
[H3cSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-h3c_switch.yml)
- [Website](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-website.yml), [Port Telnet](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-port.yml),
[Http Api](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-api.yml), [Ping Connect](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-ping.yml),
[Jvm](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-jvm.yml), [SiteMap](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-fullsite.yml),
[Ssl Certificate](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-ssl_cert.yml), [SpringBoot2](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-springboot2.yml),
[FTP Server](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-ftp.yml), [SpringBoot3](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-springboot3.yml),
[Udp Port](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-udp_port.yml), [Dns](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-dns.yml),
[Pop3](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-pop3.yml), [Ntp](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-ntp.yml),
[Api Code](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-api_code.yml), [Smtp](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-smtp.yml),
[Nginx](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-nginx.yml)
- [Mysql](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-mysql.yml), [PostgreSQL](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-postgresql.yml),
[MariaDB](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-mariadb.yml), [Redis](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-redis.yml),
[ElasticSearch](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-elasticsearch.yml), [SqlServer](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-sqlserver.yml),
[Oracle](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-oracle.yml), [MongoDB](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-mongodb.yml),
[DM](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-dm.yml), [OpenGauss](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-opengauss.yml),
[ClickHouse](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-clickhouse.yml), [IoTDB](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-iotdb.yml),
[Redis Cluster](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-redis_cluster.yml), [Redis Sentinel](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-redis_sentinel.yml)
[Doris BE](https://github.com/apache/hertzbeat/blob/master/hertzbeat-manager/src/main/resources/define/app-doris_be.yml), [Doris FE](https://github.com/apache/hertzbeat/blob/master/hertzbeat-manager/src/main/resources/define/app-doris_fe.yml),
[Memcached](https://github.com/apache/hertzbeat/blob/master/hertzbeat-manager/src/main/resources/define/app-memcached.yml), [NebulaGraph](https://github.com/apache/hertzbeat/blob/master/hertzbeat-manager/src/main/resources/define/app-nebula_graph.yml)
- [Linux](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-linux.yml), [Ubuntu](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-ubuntu.yml),
[CentOS](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-centos.yml), [Windows](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-windows.yml),
[EulerOS](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-euleros.yml), [Fedora CoreOS](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-coreos.yml),
[OpenSUSE](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-opensuse.yml), [Rocky Linux](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-rockylinux.yml),
[Red Hat](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-redhat.yml), [FreeBSD](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-freebsd.yml),
[AlmaLinux](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-almalinux.yml), [Debian Linux](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-debian.yml)
- [Tomcat](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-tomcat.yml), [Nacos](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-nacos.yml),
[Zookeeper](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-zookeeper.yml), [RabbitMQ](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-rabbitmq.yml),
[Flink](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-flink.yml), [Kafka](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-kafka.yml),
[ShenYu](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-shenyu.yml), [DynamicTp](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-dynamic_tp.yml),
[Jetty](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-jetty.yml), [ActiveMQ](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-activemq.yml),
[Spring Gateway](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-spring_gateway.yml), [EMQX MQTT](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-emqx.yml),
[AirFlow](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-airflow.yml), [Hive](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-hive.yml),
[Spark](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-spark.yml), [Hadoop](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-hadoop.yml)
- [Kubernetes](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-kubernetes.yml), [Docker](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-docker.yml)
- [CiscoSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-cisco_switch.yml), [HpeSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-hpe_switch.yml),
[HuaweiSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-huawei_switch.yml), [TpLinkSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-tplink_switch.yml),
[H3cSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-h3c_switch.yml)
- And More Your Custom Template.
- Notified Support `Discord` `Slack` `Telegram` `Email` `Dingtalk` `WeChat` `FeiShu` `Webhook` `SMS` `ServerChan`.
@@ -160,7 +160,7 @@ Detailed config refer to [Install HertzBeat via Package](https://hertzbeat.apach
##### 3Start via source code
1. Local source code debugging needs to start the back-end project `manager` and the front-end project `web-app`.
2. Backendneed `maven3+`, `java17`, `lombok`, start the `manager` service.
2. Backendneed `maven3+`, `java17`, `lombok`, add VM options in IDE: ` --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED `, then start the `manager` service.
3. Webneed `nodejs npm angular-cli` environment, Run `ng serve --open` in `web-app` directory after backend startup.
4. Access `http://localhost:4200` to start, default account: `admin/hertzbeat`
@@ -475,6 +475,17 @@ Thanks to these wonderful people, welcome to join us:
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sherry-peng2333"><img src="https://avatars.githubusercontent.com/u/70619577?v=4?s=100" width="100px;" alt="sherry-peng2333"/><br /><sub><b>sherry-peng2333</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=sherry-peng2333" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/lixiaobaivv"><img src="https://avatars.githubusercontent.com/u/39290771?v=4?s=100" width="100px;" alt="Yzzz"/><br /><sub><b>Yzzz</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=lixiaobaivv" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.bckf.cn/"><img src="https://avatars.githubusercontent.com/u/13309008?v=4?s=100" width="100px;" alt="puruidong"/><br /><sub><b>puruidong</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=pruidong" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/shinestare"><img src="https://avatars.githubusercontent.com/u/13570619?v=4?s=100" width="100px;" alt="shinestare"/><br /><sub><b>shinestare</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=shinestare" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/po-168"><img src="https://avatars.githubusercontent.com/u/185745593?v=4?s=100" width="100px;" alt="po-168"/><br /><sub><b>po-168</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=po-168" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/All-The-Best-for"><img src="https://avatars.githubusercontent.com/u/76414672?v=4?s=100" width="100px;" alt="wbs99"/><br /><sub><b>wbs99</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=All-The-Best-for" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/starryCoder"><img src="https://avatars.githubusercontent.com/u/46510059?v=4?s=100" width="100px;" alt="starryCoder"/><br /><sub><b>starryCoder</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=starryCoder" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/hasimmollah"><img src="https://avatars.githubusercontent.com/u/32538599?v=4?s=100" width="100px;" alt="hasimmollah"/><br /><sub><b>hasimmollah</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=hasimmollah" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ayu-v0"><img src="https://avatars.githubusercontent.com/u/127600988?v=4?s=100" width="100px;" alt="Ayu"/><br /><sub><b>Ayu</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=ayu-v0" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Rancho-7"><img src="https://avatars.githubusercontent.com/u/59016860?v=4?s=100" width="100px;" alt="Nick Guo"/><br /><sub><b>Nick Guo</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=Rancho-7" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/doveLin0818"><img src="https://avatars.githubusercontent.com/u/190927907?v=4?s=100" width="100px;" alt="doveLin"/><br /><sub><b>doveLin</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=doveLin0818" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://zzrl.cc/"><img src="https://avatars.githubusercontent.com/u/91836599?v=4?s=100" width="100px;" alt="yunfan24"/><br /><sub><b>yunfan24</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=yunfan24" title="Code">💻</a></td>
</tr>
</tbody>
</table>
+48 -37
View File
@@ -61,42 +61,42 @@
> 我们将监控采集类型(mysql,jvm,k8s)都定义为 `yml` 监控模版,用户可以导入这些模版来支持对应类型的监控!
> 欢迎大家一起贡献你使用过程中自定义的通用监控类型监控模版。
- [Website](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-website.yml), [Port Telnet](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-port.yml),
[Http Api](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-api.yml), [Ping Connect](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-ping.yml),
[Jvm](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-jvm.yml), [SiteMap](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-fullsite.yml),
[Ssl Certificate](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-ssl_cert.yml), [SpringBoot2](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-springboot2.yml),
[FTP Server](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-ftp.yml), [SpringBoot3](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-springboot3.yml),
[Udp Port](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-udp_port.yml), [Dns](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-dns.yml),
[Pop3](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-pop3.yml), [Ntp](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-ntp.yml),
[Api Code](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-api_code.yml), [Smtp](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-smtp.yml),
[Nginx](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-nginx.yml)
- [Mysql](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-mysql.yml), [PostgreSQL](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-postgresql.yml),
[MariaDB](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-mariadb.yml), [Redis](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-redis.yml),
[ElasticSearch](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-elasticsearch.yml), [SqlServer](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-sqlserver.yml),
[Oracle](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-oracle.yml), [MongoDB](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-mongodb.yml),
[DM](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-dm.yml), [OpenGauss](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-opengauss.yml),
[ClickHouse](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-clickhouse.yml), [IoTDB](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-iotdb.yml),
[Redis Cluster](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-redis_cluster.yml), [Redis Sentinel](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-redis_sentinel.yml)
[Doris BE](https://github.com/apache/hertzbeat/blob/master/manager/src/main/resources/define/app-doris_be.yml), [Doris FE](https://github.com/apache/hertzbeat/blob/master/manager/src/main/resources/define/app-doris_fe.yml),
[Memcached](https://github.com/apache/hertzbeat/blob/master/manager/src/main/resources/define/app-memcached.yml), [NebulaGraph](https://github.com/apache/hertzbeat/blob/master/manager/src/main/resources/define/app-nebulaGraph.yml)
- [Linux](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-linux.yml), [Ubuntu](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-ubuntu.yml),
[CentOS](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-centos.yml), [Windows](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-windows.yml),
[EulerOS](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-euleros.yml), [Fedora CoreOS](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-coreos.yml),
[OpenSUSE](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-opensuse.yml), [Rocky Linux](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-rockylinux.yml),
[Red Hat](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-redhat.yml), [FreeBSD](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-freebsd.yml),
[AlmaLinux](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-almalinux.yml), [Debian Linux](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-debian.yml)
- [Tomcat](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-tomcat.yml), [Nacos](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-nacos.yml),
[Zookeeper](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-zookeeper.yml), [RabbitMQ](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-rabbitmq.yml),
[Flink](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-flink.yml), [Kafka](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-kafka.yml),
[ShenYu](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-shenyu.yml), [DynamicTp](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-dynamic_tp.yml),
[Jetty](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-jetty.yml), [ActiveMQ](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-activemq.yml),
[Spring Gateway](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-spring_gateway.yml), [EMQX MQTT](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-emqx.yml),
[AirFlow](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-airflow.yml), [Hive](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-hive.yml),
[Spark](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-spark.yml), [Hadoop](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-hadoop.yml)
- [Kubernetes](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-kubernetes.yml), [Docker](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-docker.yml)
- [CiscoSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-cisco_switch.yml), [HpeSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-hpe_switch.yml),
[HuaweiSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-huawei_switch.yml), [TpLinkSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-tplink_switch.yml),
[H3cSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/manager/src/main/resources/define/app-h3c_switch.yml)
- [Website](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-website.yml), [Port Telnet](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-port.yml),
[Http Api](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-api.yml), [Ping Connect](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-ping.yml),
[Jvm](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-jvm.yml), [SiteMap](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-fullsite.yml),
[Ssl Certificate](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-ssl_cert.yml), [SpringBoot2](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-springboot2.yml),
[FTP Server](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-ftp.yml), [SpringBoot3](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-springboot3.yml),
[Udp Port](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-udp_port.yml), [Dns](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-dns.yml),
[Pop3](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-pop3.yml), [Ntp](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-ntp.yml),
[Api Code](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-api_code.yml), [Smtp](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-smtp.yml),
[Nginx](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-nginx.yml)
- [Mysql](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-mysql.yml), [PostgreSQL](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-postgresql.yml),
[MariaDB](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-mariadb.yml), [Redis](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-redis.yml),
[ElasticSearch](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-elasticsearch.yml), [SqlServer](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-sqlserver.yml),
[Oracle](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-oracle.yml), [MongoDB](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-mongodb.yml),
[DM](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-dm.yml), [OpenGauss](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-opengauss.yml),
[ClickHouse](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-clickhouse.yml), [IoTDB](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-iotdb.yml),
[Redis Cluster](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-redis_cluster.yml), [Redis Sentinel](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-redis_sentinel.yml)
[Doris BE](https://github.com/apache/hertzbeat/blob/master/hertzbeat-manager/src/main/resources/define/app-doris_be.yml), [Doris FE](https://github.com/apache/hertzbeat/blob/master/hertzbeat-manager/src/main/resources/define/app-doris_fe.yml),
[Memcached](https://github.com/apache/hertzbeat/blob/master/hertzbeat-manager/src/main/resources/define/app-memcached.yml), [NebulaGraph](https://github.com/apache/hertzbeat/blob/master/hertzbeat-manager/src/main/resources/define/app-nebula_graph.yml)
- [Linux](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-linux.yml), [Ubuntu](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-ubuntu.yml),
[CentOS](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-centos.yml), [Windows](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-windows.yml),
[EulerOS](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-euleros.yml), [Fedora CoreOS](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-coreos.yml),
[OpenSUSE](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-opensuse.yml), [Rocky Linux](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-rockylinux.yml),
[Red Hat](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-redhat.yml), [FreeBSD](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-freebsd.yml),
[AlmaLinux](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-almalinux.yml), [Debian Linux](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-debian.yml)
- [Tomcat](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-tomcat.yml), [Nacos](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-nacos.yml),
[Zookeeper](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-zookeeper.yml), [RabbitMQ](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-rabbitmq.yml),
[Flink](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-flink.yml), [Kafka](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-kafka.yml),
[ShenYu](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-shenyu.yml), [DynamicTp](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-dynamic_tp.yml),
[Jetty](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-jetty.yml), [ActiveMQ](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-activemq.yml),
[Spring Gateway](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-spring_gateway.yml), [EMQX MQTT](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-emqx.yml),
[AirFlow](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-airflow.yml), [Hive](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-hive.yml),
[Spark](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-spark.yml), [Hadoop](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-hadoop.yml)
- [Kubernetes](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-kubernetes.yml), [Docker](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-docker.yml)
- [CiscoSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-cisco_switch.yml), [HpeSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-hpe_switch.yml),
[HuaweiSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-huawei_switch.yml), [TpLinkSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-tplink_switch.yml),
[H3cSwitch](https://raw.githubusercontent.com/apache/hertzbeat/master/hertzbeat-manager/src/main/resources/define/app-h3c_switch.yml)
- 和更多自定义监控模版。
- 通知支持 `Discord` `Slack` `Telegram` `邮件` `钉钉` `微信` `飞书` `短信` `Webhook` `Server酱`
@@ -159,7 +159,7 @@
##### 方式三:本地代码启动
1. 此为前后端分离项目,本地代码调试需要分别启动后端工程 `manager` 和前端工程 `web-app`
2. 后端:需要 `maven3+`, `java17` 和 `lombok` 环境,修改 `YML` 配置信息启动 `manager` 服务
2. 后端:需要 `maven3+`, `java17` 和 `lombok` 环境,修改 `YML` 配置信息,添加JVM参数`--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED`后启动 `manager` 服务即可。
3. 前端:需要 `nodejs npm angular-cli`环境,待本地后端启动后,在 `web-app` 目录下启动 `ng serve --open`
4. 浏览器访问 `http://localhost:4200` 即可开始,默认账号密码 `admin/hertzbeat`
@@ -474,6 +474,17 @@ Thanks these wonderful people, welcome to join us:
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sherry-peng2333"><img src="https://avatars.githubusercontent.com/u/70619577?v=4?s=100" width="100px;" alt="sherry-peng2333"/><br /><sub><b>sherry-peng2333</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=sherry-peng2333" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/lixiaobaivv"><img src="https://avatars.githubusercontent.com/u/39290771?v=4?s=100" width="100px;" alt="Yzzz"/><br /><sub><b>Yzzz</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=lixiaobaivv" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.bckf.cn/"><img src="https://avatars.githubusercontent.com/u/13309008?v=4?s=100" width="100px;" alt="puruidong"/><br /><sub><b>puruidong</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=pruidong" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/shinestare"><img src="https://avatars.githubusercontent.com/u/13570619?v=4?s=100" width="100px;" alt="shinestare"/><br /><sub><b>shinestare</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=shinestare" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/po-168"><img src="https://avatars.githubusercontent.com/u/185745593?v=4?s=100" width="100px;" alt="po-168"/><br /><sub><b>po-168</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=po-168" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/All-The-Best-for"><img src="https://avatars.githubusercontent.com/u/76414672?v=4?s=100" width="100px;" alt="wbs99"/><br /><sub><b>wbs99</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=All-The-Best-for" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/starryCoder"><img src="https://avatars.githubusercontent.com/u/46510059?v=4?s=100" width="100px;" alt="starryCoder"/><br /><sub><b>starryCoder</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=starryCoder" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/hasimmollah"><img src="https://avatars.githubusercontent.com/u/32538599?v=4?s=100" width="100px;" alt="hasimmollah"/><br /><sub><b>hasimmollah</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=hasimmollah" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ayu-v0"><img src="https://avatars.githubusercontent.com/u/127600988?v=4?s=100" width="100px;" alt="Ayu"/><br /><sub><b>Ayu</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=ayu-v0" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Rancho-7"><img src="https://avatars.githubusercontent.com/u/59016860?v=4?s=100" width="100px;" alt="Nick Guo"/><br /><sub><b>Nick Guo</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=Rancho-7" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/doveLin0818"><img src="https://avatars.githubusercontent.com/u/190927907?v=4?s=100" width="100px;" alt="doveLin"/><br /><sub><b>doveLin</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=doveLin0818" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://zzrl.cc/"><img src="https://avatars.githubusercontent.com/u/91836599?v=4?s=100" width="100px;" alt="yunfan24"/><br /><sub><b>yunfan24</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=yunfan24" title="Code">💻</a></td>
</tr>
</tbody>
</table>
+9 -6
View File
@@ -1,12 +1,9 @@
# Security Policy
**[Version Releases](https://github.com/apache/hertzbeat/releases)**
Apache HertzBeat follows the [ASF vulnerability handling process](https://apache.org/security/#vulnerability-handling)
## Supported Versions
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
|-------------------|--------------------|
| Latest Version | :white_check_mark: |
@@ -14,6 +11,12 @@ currently being supported with security updates.
## Reporting a Vulnerability
Use this section to tell people how to report a vulnerability.
Please do not file GitHub issues for security vulnerabilities as they are public!
Please report vulnerability disclosures to `security@apache.org`.
To report a new vulnerability you have discovered please follow the [ASF vulnerability reporting process](https://apache.org/security/#reporting-a-vulnerability).
## Extra Information
- [Apache HertzBeat Security Model](https://hertzbeat.apache.org/docs/help/security_model)
- [ASF Security](https://www.apache.org/security/)
- [Apache HertzBeat Document](https://hertzbeat.apache.org/docs/)
@@ -1,113 +0,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
*
* 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.common.cache;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Optional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* Test case for {@link ConnectionCommonCache}
*/
class CommonCacheTest {
private AbstractConnection<?> mockConnection;
private ConnectionCommonCache<String, AbstractConnection<?>> cache;
@BeforeEach
void setUp() {
cache = new ConnectionCommonCache<>();
mockConnection = new AbstractConnection<>() {
@Override
public Object getConnection() {
return null;
}
@Override
public void closeConnection() throws Exception {
}
};
}
@Test
void testAddAndRetrieveCache() {
String key = "testKey";
cache.addCache(key, mockConnection);
Optional<AbstractConnection<?>> retrieved = cache.getCache(key, false);
assertTrue(retrieved.isPresent());
assertSame(mockConnection, retrieved.get());
}
@Test
void testCacheTimeout() throws InterruptedException {
String key = "timeoutKey";
cache.addCache(key, mockConnection, 1L);
Thread.sleep(2);
Optional<AbstractConnection<?>> retrieved = cache.getCache(key, false);
assertFalse(retrieved.isPresent());
}
@Test
void testRemoveCache() {
String key = "removeKey";
cache.addCache(key, mockConnection);
cache.removeCache(key);
Optional<AbstractConnection<?>> retrieved = cache.getCache(key, false);
assertFalse(retrieved.isPresent());
}
@Test
void testRefreshCache() {
String key = "refreshKey";
cache.addCache(key, mockConnection, 5000L);
Optional<AbstractConnection<?>> firstRetrieval = cache.getCache(key, true);
assertTrue(firstRetrieval.isPresent());
Optional<AbstractConnection<?>> secondRetrieval = cache.getCache(key, false);
assertTrue(secondRetrieval.isPresent());
}
@Test
void testConcurrentAccess() throws InterruptedException {
String key = "concurrentKey";
cache.addCache(key, mockConnection);
Runnable accessCache = () -> {
Optional<AbstractConnection<?>> retrieved = cache.getCache(key, false);
assertTrue(retrieved.isPresent());
};
Thread thread1 = new Thread(accessCache);
Thread thread2 = new Thread(accessCache);
thread1.start();
thread2.start();
thread1.join();
thread2.join();
}
}
@@ -1,147 +0,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
// *
// * 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.dispatch;
//
//import static org.mockito.ArgumentMatchers.any;
//import static org.mockito.Mockito.doAnswer;
//import static org.mockito.Mockito.mock;
//import static org.mockito.Mockito.times;
//import static org.mockito.Mockito.verify;
//import static org.mockito.Mockito.when;
//import java.util.List;
//import java.util.Set;
//import java.util.concurrent.ExecutorService;
//import java.util.concurrent.Executors;
//import org.apache.hertzbeat.collector.dispatch.entrance.internal.CollectJobService;
//import org.apache.hertzbeat.collector.dispatch.timer.Timeout;
//import org.apache.hertzbeat.collector.dispatch.timer.TimerDispatch;
//import org.apache.hertzbeat.collector.dispatch.timer.WheelTimerTask;
//import org.apache.hertzbeat.common.entity.job.Job;
//import org.apache.hertzbeat.common.entity.job.Metrics;
//import org.apache.hertzbeat.common.entity.message.CollectRep;
//import org.apache.hertzbeat.common.queue.CommonDataQueue;
//import org.junit.jupiter.api.BeforeEach;
//import org.junit.jupiter.api.Test;
//import org.mockito.InjectMocks;
//import org.mockito.Mock;
//import org.mockito.MockitoAnnotations;
//
///**
// * Test case for {@link CommonDispatcher}
// */
//class CommonDispatcherTest {
//
// @Mock
// private MetricsCollectorQueue jobRequestQueue;
//
// @Mock
// private TimerDispatch timerDispatch;
//
// @Mock
// private CommonDataQueue commonDataQueue;
//
// @Mock
// private WorkerPool workerPool;
//
// @InjectMocks
// private CommonDispatcher commonDispatcher;
//
// @Mock
// private CollectJobService collectJobService;
//
// @BeforeEach
// void setUp() {
//
// MockitoAnnotations.openMocks(this);
//
// ExecutorService executorService = Executors.newFixedThreadPool(2);
// doAnswer(invocation -> {
// Runnable task = invocation.getArgument(0);
// executorService.submit(task);
// return null;
// }).when(workerPool).executeJob(any(Runnable.class));
// }
//
// @Test
// void testDispatchMetricsTask() {
//
// Timeout timeout = mock(Timeout.class);
// WheelTimerTask timerTask = mock(WheelTimerTask.class);
//
// Job job = mock(Job.class);
// Set<Metrics> metricsSet = mock(Set.class);
//
// when(timeout.task()).thenReturn(timerTask);
// when(timerTask.getJob()).thenReturn(job);
// when(job.getNextCollectMetrics(null, true)).thenReturn(metricsSet);
//
// commonDispatcher.dispatchMetricsTask(timeout);
//
// verify(job, times(1)).getNextCollectMetrics(null, true);
// }
//
// @Test
// public void testDispatchCollectDataTimeoutMetricsCollectRepMetricsData() {
//
// Timeout timeout = mock(Timeout.class);
// Metrics metrics = mock(Metrics.class);
// WheelTimerTask timerTask = mock(WheelTimerTask.class);
// Job job = mock(Job.class);
// CollectRep.MetricsData metricsData = CollectRep.MetricsData.newBuilder().setMetrics("metrics").build();
//
// when(timeout.task()).thenReturn(timerTask);
// when(timerTask.getJob()).thenReturn(job);
// when(job.getNextCollectMetrics(metrics, false)).thenReturn(null);
// when(timeout.task()).thenReturn(timerTask);
// when(timerTask.getJob()).thenReturn(job);
// when(job.getNextCollectMetrics(metrics, false)).thenReturn(null);
// when(metrics.isHasSubTask()).thenReturn(false);
//
// commonDispatcher.dispatchCollectData(timeout, metrics, metricsData);
//
// verify(commonDataQueue, times(0)).sendMetricsData(metricsData);
// }
//
// @Test
// void testDispatchCollectDataTimeoutMetricsListOfCollectRepMetricsData() {
// Timeout timeout = mock(Timeout.class);
// Metrics metrics = mock(Metrics.class);
// CollectRep.MetricsData metricsData1 = CollectRep.MetricsData.newBuilder().build();
// CollectRep.MetricsData metricsData2 = CollectRep.MetricsData.newBuilder().build();
// List<CollectRep.MetricsData> metricsDataList = List.of(metricsData1, metricsData2);
// WheelTimerTask timerTask = mock(WheelTimerTask.class);
// Job job = mock(Job.class);
//
// when(timeout.task()).thenReturn(timerTask);
// when(timerTask.getJob()).thenReturn(job);
// when(job.isCyclic()).thenReturn(true);
//
// commonDispatcher.dispatchCollectData(timeout, metrics, metricsDataList);
//
// verify(commonDataQueue, times(2)).sendMetricsData(any(CollectRep.MetricsData.class));
// }
//
// @Test
// void testStart() {
//
// commonDispatcher.start();
//
// verify(workerPool, times(2)).executeJob(any(Runnable.class));
// }
//
//}
@@ -1,68 +0,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
// *
// * 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.dispatch;
//
//import static org.junit.jupiter.api.Assertions.assertEquals;
//import static org.junit.jupiter.api.Assertions.assertThrows;
//import static org.mockito.Mockito.mock;
//import java.util.concurrent.locks.ReentrantLock;
//import org.junit.jupiter.api.BeforeEach;
//import org.junit.jupiter.api.Test;
//
///**
// * Test case for {@link MetricsCollectorQueue}
// */
//class MetricsCollectorQueueTest {
//
// private MetricsCollectorQueue metricsCollectorQueue;
//
// private MetricsCollect mockJob;
//
// @BeforeEach
// void setUp() {
//
// metricsCollectorQueue = new MetricsCollectorQueue();
// mockJob = mock(MetricsCollect.class);
// }
//
// @Test
// void testAddJob() throws InterruptedException {
//
// metricsCollectorQueue.addJob(mockJob);
// assertEquals(mockJob, metricsCollectorQueue.getJob());
// }
//
// @Test
// void testGetJobTimeout() {
// ReentrantLock lock = new ReentrantLock();
// Thread run = new Thread(() -> {
// try {
// metricsCollectorQueue.getJob();
// } catch (Exception e) {
// assertThrows(InterruptedException.class, () -> {
// throw e;
// });
// lock.unlock();
// }
// });
// run.start();
// run.interrupt();
// lock.lock();
// }
//
//}
@@ -1,210 +0,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
*
* 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.kafka;
import lombok.extern.slf4j.Slf4j;
import org.apache.hertzbeat.collector.collect.AbstractCollect;
import org.apache.hertzbeat.collector.dispatch.DispatchConstants;
import org.apache.hertzbeat.common.entity.job.Metrics;
import org.apache.hertzbeat.common.entity.job.protocol.KafkaProtocol;
import org.apache.hertzbeat.common.entity.message.CollectRep;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.DescribeTopicsResult;
import org.apache.kafka.clients.admin.ListTopicsOptions;
import org.apache.kafka.clients.admin.ListTopicsResult;
import org.apache.kafka.clients.admin.OffsetSpec;
import org.apache.kafka.clients.admin.TopicDescription;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.TopicPartitionInfo;
import org.springframework.util.Assert;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@Slf4j
public class KafkaCollectImpl extends AbstractCollect {
@Override
public void preCheck(Metrics metrics) throws IllegalArgumentException {
KafkaProtocol kafkaProtocol = metrics.getKclient();
// Ensure that metrics and kafkaProtocol are not null
Assert.isTrue(metrics != null && kafkaProtocol != null, "Kafka collect must have kafkaProtocol params");
// Ensure that host and port are not empty
Assert.hasText(kafkaProtocol.getHost(), "Kafka Protocol host is required.");
Assert.hasText(kafkaProtocol.getPort(), "Kafka Protocol port is required.");
}
@Override
public void collect(CollectRep.MetricsData.Builder builder, long monitorId, String app, Metrics metrics) {
try {
KafkaProtocol kafkaProtocol = metrics.getKclient();
String command = kafkaProtocol.getCommand();
boolean isKafkaCommand = SupportedCommand.isKafkaCommand(command);
if (!isKafkaCommand) {
log.error("Unsupported command: {}", command);
return;
}
// Create AdminClient with the provided host and port
AdminClient adminClient = KafkaConnect.getAdminClient(kafkaProtocol.getHost() + ":" + kafkaProtocol.getPort());
// Execute the appropriate collection method based on the command
switch (SupportedCommand.fromCommand(command)) {
case TOPIC_DESCRIBE:
collectTopicDescribe(builder, adminClient);
break;
case TOPIC_LIST:
collectTopicList(builder, adminClient);
break;
case TOPIC_OFFSET:
collectTopicOffset(builder, adminClient);
break;
default:
log.error("Unsupported command: {}", command);
break;
}
} catch (InterruptedException | ExecutionException e) {
log.error("Kafka collect error", e);
}
}
/**
* Collect the earliest and latest offsets for each topic
*
* @param builder The MetricsData builder
* @param adminClient The AdminClient
* @throws InterruptedException If the thread is interrupted
* @throws ExecutionException If an error occurs during execution
*/
private void collectTopicOffset(CollectRep.MetricsData.Builder builder, AdminClient adminClient) throws InterruptedException, ExecutionException {
ListTopicsResult listTopicsResult = adminClient.listTopics(new ListTopicsOptions().listInternal(true));
Set<String> names = listTopicsResult.names().get();
names.forEach(name -> {
try {
Map<String, TopicDescription> map = adminClient.describeTopics(Collections.singleton(name)).all().get(3L, TimeUnit.SECONDS);
map.forEach((key, value) -> value.partitions().forEach(info -> extractedOffset(builder, adminClient, name, value, info)));
} catch (TimeoutException | InterruptedException | ExecutionException e) {
log.warn("Topic {} get offset fail", name);
}
});
}
private void extractedOffset(CollectRep.MetricsData.Builder builder, AdminClient adminClient, String name, TopicDescription value, TopicPartitionInfo info) {
try {
TopicPartition topicPartition = new TopicPartition(value.name(), info.partition());
long earliestOffset = getEarliestOffset(adminClient, topicPartition);
long latestOffset = getLatestOffset(adminClient, topicPartition);
CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder();
valueRowBuilder.addColumns(value.name());
valueRowBuilder.addColumns(String.valueOf(info.partition()));
valueRowBuilder.addColumns(String.valueOf(earliestOffset));
valueRowBuilder.addColumns(String.valueOf(latestOffset));
builder.addValues(valueRowBuilder.build());
} catch (TimeoutException | InterruptedException | ExecutionException e) {
log.warn("Topic {} get offset fail", name);
}
}
/**
* Get the earliest offset for a given topic partition
*
* @param adminClient The AdminClient
* @param topicPartition The TopicPartition
* @return The earliest offset
*/
private long getEarliestOffset(AdminClient adminClient, TopicPartition topicPartition)
throws InterruptedException, ExecutionException, TimeoutException {
return adminClient
.listOffsets(Collections.singletonMap(topicPartition, OffsetSpec.earliest()))
.all()
.get(3L, TimeUnit.SECONDS)
.get(topicPartition)
.offset();
}
/**
* Get the latest offset for a given topic partition
*
* @param adminClient The AdminClient
* @param topicPartition The TopicPartition
* @return The latest offset
*/
private long getLatestOffset(AdminClient adminClient, TopicPartition topicPartition)
throws InterruptedException, ExecutionException, TimeoutException {
return adminClient
.listOffsets(Collections.singletonMap(topicPartition, OffsetSpec.latest()))
.all()
.get(3L, TimeUnit.SECONDS)
.get(topicPartition)
.offset();
}
/**
* Collect the list of topics
*
* @param builder The MetricsData builder
* @param adminClient The AdminClient
*/
private static void collectTopicList(CollectRep.MetricsData.Builder builder, AdminClient adminClient) throws InterruptedException, ExecutionException {
ListTopicsOptions options = new ListTopicsOptions().listInternal(true);
Set<String> names = adminClient.listTopics(options).names().get();
names.forEach(name -> {
CollectRep.ValueRow valueRow = CollectRep.ValueRow.newBuilder().addColumns(name).build();
builder.addValues(valueRow);
});
}
/**
* Collect the description of each topic
*
* @param builder The MetricsData builder
* @param adminClient The AdminClient
*/
private static void collectTopicDescribe(CollectRep.MetricsData.Builder builder, AdminClient adminClient) throws InterruptedException, ExecutionException {
ListTopicsOptions options = new ListTopicsOptions();
options.listInternal(true);
ListTopicsResult listTopicsResult = adminClient.listTopics(options);
Set<String> names = listTopicsResult.names().get();
DescribeTopicsResult describeTopicsResult = adminClient.describeTopics(names);
Map<String, TopicDescription> map = describeTopicsResult.all().get();
map.forEach((key, value) -> {
List<TopicPartitionInfo> listp = value.partitions();
listp.forEach(info -> {
CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder();
valueRowBuilder.addColumns(value.name());
valueRowBuilder.addColumns(String.valueOf(value.partitions().size()));
valueRowBuilder.addColumns(String.valueOf(info.partition()));
valueRowBuilder.addColumns(info.leader().host());
valueRowBuilder.addColumns(String.valueOf(info.leader().port()));
valueRowBuilder.addColumns(String.valueOf(info.replicas().size()));
valueRowBuilder.addColumns(String.valueOf(info.replicas()));
builder.addValues(valueRowBuilder.build());
});
});
}
@Override
public String supportProtocol() {
return DispatchConstants.PROTOCOL_KAFKA;
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,255 +0,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
*
* 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.common.util.prometheus;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* prometheus metric sparser
*/
public final class PrometheusUtil {
//An unknown format occurred during parsing because parsing cannot continue
// or the end of the input stream has been reached
private static final int ERROR_FORMAT = -1;
//The input stream ends normally
private static final int NORMAL_END = -2;
private static final int COMMENT_LINE = -3;
private PrometheusUtil() {
}
private static int parseMetricName(InputStream inputStream, Metric.MetricBuilder metricBuilder) throws IOException {
StringBuilder stringBuilder = new StringBuilder();
int i;
i = inputStream.read();
if (i == -1) {
return NORMAL_END;
}
else if (i == '#') {
return COMMENT_LINE;
}
while (i != -1) {
if (i == ' ' || i == '{') {
metricBuilder.metricName(stringBuilder.toString());
return i;
}
stringBuilder.append((char) i);
i = inputStream.read();
}
return ERROR_FORMAT;
}
private static int parseLabel(InputStream inputStream, List<Label> labelList) throws IOException {
Label.LabelBuilder labelBuilder = new Label.LabelBuilder();
int i;
StringBuilder labelName = new StringBuilder();
i = inputStream.read();
while (i != -1 && i != '=') {
labelName.append((char) i);
i = inputStream.read();
}
if (i == -1) {
return ERROR_FORMAT;
}
labelBuilder.name(labelName.toString());
if (inputStream.read() != '\"') {
return ERROR_FORMAT;
}
StringBuilder labelValue = new StringBuilder();
i = inputStream.read();
while (i != -1 && i != ',' && i != '}') {
labelValue.append((char) i);
i = inputStream.read();
}
if (i == -1 || labelValue.charAt(labelValue.length() - 1) != '\"') {
return ERROR_FORMAT;
}
// skip space only in this condition
if (i == '}' && inputStream.read() != ' ') {
return ERROR_FORMAT;
}
labelValue.deleteCharAt(labelValue.length() - 1);
labelBuilder.value(labelValue.toString());
labelList.add(labelBuilder.build());
return i;
}
private static int parseLabelList(InputStream inputStream, Metric.MetricBuilder metricBuilder) throws IOException {
List<Label> labelList = new ArrayList<>();
int i;
i = parseLabel(inputStream, labelList);
while (i == ',') {
i = parseLabel(inputStream, labelList);
}
if (i == -1) {
return ERROR_FORMAT;
}
metricBuilder.labelList(labelList);
return i;
}
private static int parseValue(InputStream inputStream, Metric.MetricBuilder metricBuilder) throws IOException {
int i;
StringBuilder stringBuilder = new StringBuilder();
i = inputStream.read();
while (i != -1 && i != ' ' && i != '\n') {
stringBuilder.append((char) i);
i = inputStream.read();
}
String string = stringBuilder.toString();
switch (string) {
case "NaN":
metricBuilder.value(Double.NaN);
break;
case "+Inf":
metricBuilder.value(Double.POSITIVE_INFINITY);
break;
case "-Inf":
metricBuilder.value(Double.NEGATIVE_INFINITY);
break;
default:
try {
BigDecimal bigDecimal = new BigDecimal(string);
metricBuilder.value(bigDecimal.doubleValue());
} catch (NumberFormatException e) {
return ERROR_FORMAT;
}
break;
}
if (i == -1) {
return NORMAL_END;
}
else {
return i; // ' ' or \n'
}
}
private static int parseTimestamp(InputStream inputStream, Metric.MetricBuilder metricBuilder) throws IOException {
int i;
StringBuilder stringBuilder = new StringBuilder();
i = inputStream.read();
while (i != -1 && i != '\n') {
stringBuilder.append((char) i);
i = inputStream.read();
}
String string = stringBuilder.toString();
try {
metricBuilder.timestamp(Long.parseLong(string));
} catch (NumberFormatException e) {
return ERROR_FORMAT;
}
if (i == -1) {
return NORMAL_END;
}
else {
return i; // '\n'
}
}
// return value:
// -1: error format
// -2: normal end
// '\n': more lines
private static int parseMetric(InputStream inputStream, List<Metric> metrics) throws IOException {
Metric.MetricBuilder metricBuilder = new Metric.MetricBuilder();
int i = parseMetricName(inputStream, metricBuilder); // RET: -1, -2, -3, '{', ' '
if (i == ERROR_FORMAT || i == NORMAL_END || i == COMMENT_LINE) {
return i;
}
if (i == '{') {
i = parseLabelList(inputStream, metricBuilder); // RET: -1, '}'
if (i == ERROR_FORMAT) {
return i;
}
}
i = parseValue(inputStream, metricBuilder); // RET: -1, -2, '\n', ' '
if (i != ' ') {
metrics.add(metricBuilder.build());
return i;
}
i = parseTimestamp(inputStream, metricBuilder); // RET: -1, -2, '\n'
metrics.add(metricBuilder.build());
return i;
}
private static int skipCommentLine(InputStream inputStream) throws IOException {
int i = inputStream.read();
while (i != -1 && i != '\n') {
i = inputStream.read();
}
if (i == -1) {
return NORMAL_END;
}
return i;
}
public static List<Metric> parseMetrics(InputStream inputStream) throws IOException {
List<Metric> metricList = new ArrayList<>();
int i = parseMetric(inputStream, metricList);
while (i == '\n' || i == COMMENT_LINE) {
if (i == COMMENT_LINE) {
if (skipCommentLine(inputStream) == NORMAL_END) {
return metricList;
}
}
i = parseMetric(inputStream, metricList);
}
if (i == NORMAL_END) {
return metricList;
}
else {
return null;
}
}
}
-77
View File
@@ -1,77 +0,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
*
* 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.
*/
syntax = "proto3";
package org.apache.hertzbeat.common.entity.message;
message MetricsData
{
// monitoring id
uint64 id = 1;
// tenant id
uint64 tenantId = 2;
// monitoring app eg: linux | mysql | jvm
string app = 3;
// monitoring metrics eg: cpu | memory | health
string metrics = 4;
// monitoring collect priority >=0
uint32 priority = 5;
// collect timestamp
uint64 time = 6;
// collect response code
Code code = 7;
// collect response error message
string msg = 8;
// monitoring collect metric field
repeated Field fields = 9;
// monitoring collect metric data, mapping with the fields
repeated ValueRow values = 10;
}
message Field
{
// monitoring collect metric field name
string name = 1;
// monitoring collect metrics field type, 0-number 1-string
uint32 type = 2;
// monitoring collect metrics field unit, % MB GB TB S...
string unit = 3;
// is label field
bool label = 4;
}
message ValueRow
{
// monitoring collect metrics value, mapping with the fields
repeated string columns = 1;
}
enum Code
{
// collect success
SUCCESS = 0;
// collector not available
UN_AVAILABLE = 1;
// peer network un reachable(icmp)
UN_REACHABLE = 2;
// peer network server un connectable(tcp,udp...)
UN_CONNECTABLE = 3;
// collect metrics data failed(http,ssh,snmp...)
FAIL = 4;
// collect metrics data timeout
TIMEOUT = 5;
}
@@ -1,172 +0,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
*
* 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.common.queue.impl;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.lang.reflect.Field;
import java.time.Duration;
import java.util.Collections;
import org.apache.hertzbeat.common.config.CommonProperties;
import org.apache.hertzbeat.common.entity.alerter.Alert;
import org.apache.hertzbeat.common.entity.message.CollectRep;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.TopicPartition;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
/**
* Test case for {@link KafkaCommonDataQueue}
*/
class KafkaCommonDataQueueTest {
private KafkaProducer<Long, CollectRep.MetricsData> metricsDataProducer;
private KafkaProducer<Long, Alert> alertDataProducer;
private KafkaConsumer<Long, Alert> alertDataConsumer;
private KafkaConsumer<Long, CollectRep.MetricsData> metricsDataToAlertConsumer;
private KafkaConsumer<Long, CollectRep.MetricsData> metricsDataToPersistentStorageConsumer;
private KafkaConsumer<Long, CollectRep.MetricsData> metricsDataToRealTimeStorageConsumer;
private CommonProperties.KafkaProperties kafkaProperties;
private KafkaCommonDataQueue kafkaCommonDataQueue;
@BeforeEach
void setUp() throws Exception {
kafkaProperties = mock(CommonProperties.KafkaProperties.class);
when(kafkaProperties.getServers()).thenReturn("localhost:9092");
when(kafkaProperties.getAlertsDataTopic()).thenReturn("alerts");
when(kafkaProperties.getMetricsDataTopic()).thenReturn("metrics");
CommonProperties properties = mock(CommonProperties.class);
CommonProperties.DataQueueProperties queueProperties = mock(CommonProperties.DataQueueProperties.class);
when(properties.getQueue()).thenReturn(queueProperties);
when(queueProperties.getKafka()).thenReturn(kafkaProperties);
metricsDataProducer = mock(KafkaProducer.class);
alertDataProducer = mock(KafkaProducer.class);
alertDataConsumer = mock(KafkaConsumer.class);
metricsDataToAlertConsumer = mock(KafkaConsumer.class);
metricsDataToPersistentStorageConsumer = mock(KafkaConsumer.class);
metricsDataToRealTimeStorageConsumer = mock(KafkaConsumer.class);
kafkaCommonDataQueue = new KafkaCommonDataQueue(properties);
setPrivateField(kafkaCommonDataQueue, "metricsDataProducer", metricsDataProducer);
setPrivateField(kafkaCommonDataQueue, "alertDataProducer", alertDataProducer);
setPrivateField(kafkaCommonDataQueue, "alertDataConsumer", alertDataConsumer);
setPrivateField(kafkaCommonDataQueue, "metricsDataToAlertConsumer", metricsDataToAlertConsumer);
setPrivateField(kafkaCommonDataQueue, "metricsDataToPersistentStorageConsumer", metricsDataToPersistentStorageConsumer);
setPrivateField(kafkaCommonDataQueue, "metricsDataToRealTimeStorageConsumer", metricsDataToRealTimeStorageConsumer);
}
// Test use, set private field.
private void setPrivateField(Object target, String fieldName, Object value) throws Exception {
Field field = target.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
field.set(target, value);
}
@Test
void testSendAlertsData() {
Alert alert = new Alert();
kafkaCommonDataQueue.sendAlertsData(alert);
ArgumentCaptor<ProducerRecord<Long, Alert>> captor = ArgumentCaptor.forClass(ProducerRecord.class);
verify(alertDataProducer).send(captor.capture());
ProducerRecord<Long, Alert> record = captor.getValue();
assertEquals("alerts", record.topic());
assertEquals(alert, record.value());
}
@Test
void testPollAlertsData() throws InterruptedException {
Alert alert = new Alert();
ConsumerRecords<Long, Alert> records = new ConsumerRecords<>(Collections.emptyMap());
when(alertDataConsumer.poll(Duration.ofSeconds(1))).thenReturn(records);
assertNull(kafkaCommonDataQueue.pollAlertsData());
records = new ConsumerRecords<>(Collections.singletonMap(
new TopicPartition("alerts", 0),
Collections.singletonList(
new ConsumerRecord<>("alerts", 0, 0L, 1L, alert)
)
));
when(alertDataConsumer.poll(Duration.ofSeconds(1))).thenReturn(records);
assertEquals(alert, kafkaCommonDataQueue.pollAlertsData());
}
@Test
void testSendMetricsData() {
CollectRep.MetricsData metricsData = CollectRep.MetricsData.newBuilder().build();
kafkaCommonDataQueue.sendMetricsData(metricsData);
ArgumentCaptor<ProducerRecord<Long, CollectRep.MetricsData>> captor = ArgumentCaptor.forClass(ProducerRecord.class);
verify(metricsDataProducer).send(captor.capture());
ProducerRecord<Long, CollectRep.MetricsData> record = captor.getValue();
assertEquals("metrics", record.topic());
assertEquals(metricsData, record.value());
}
@Test
void testPollMetricsDataToAlerter() throws InterruptedException {
CollectRep.MetricsData metricsData = CollectRep.MetricsData.newBuilder().build();
ConsumerRecords<Long, CollectRep.MetricsData> records = new ConsumerRecords<>(Collections.emptyMap());
when(metricsDataToAlertConsumer.poll(Duration.ofSeconds(1))).thenReturn(records);
assertNull(kafkaCommonDataQueue.pollMetricsDataToAlerter());
records = new ConsumerRecords<>(Collections.singletonMap(
new TopicPartition("metrics", 0),
Collections.singletonList(
new ConsumerRecord<>("metrics", 0, 0L, 1L, metricsData)
)
));
when(metricsDataToAlertConsumer.poll(Duration.ofSeconds(1))).thenReturn(records);
assertEquals(metricsData, kafkaCommonDataQueue.pollMetricsDataToAlerter());
}
@Test
void testDestroy() throws Exception {
kafkaCommonDataQueue.destroy();
verify(metricsDataProducer).close();
verify(alertDataProducer).close();
verify(alertDataConsumer).close();
verify(metricsDataToAlertConsumer).close();
verify(metricsDataToPersistentStorageConsumer).close();
verify(metricsDataToRealTimeStorageConsumer).close();
}
}
@@ -1,225 +0,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
*
* 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.common.util.prometheus;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import org.junit.jupiter.api.Test;
/**
* test case for {@link PrometheusUtil}
*/
class PrometheusUtilTest {
@Test
void testParseMetricsNormalInput() throws IOException {
String input = "metric_name{label1=\"value1\",label2=\"value2\"} 123.45 67890\n";
InputStream inputStream = new ByteArrayInputStream(input.getBytes());
List<Metric> metrics = PrometheusUtil.parseMetrics(inputStream);
assertNotNull(metrics);
assertEquals(1, metrics.size());
Metric metric = metrics.get(0);
assertEquals("metric_name", metric.getMetricName());
assertEquals(123.45, metric.getValue());
assertEquals(67890, metric.getTimestamp());
List<Label> labels = metric.getLabelList();
assertEquals(2, labels.size());
assertEquals("label1", labels.get(0).getName());
assertEquals("value1", labels.get(0).getValue());
assertEquals("label2", labels.get(1).getName());
assertEquals("value2", labels.get(1).getValue());
}
@Test
void testParseMetricsComments() throws IOException {
String input = "# This is a comment\nmetric_name{label1=\"value1\"} 123.45 67890\n";
InputStream inputStream = new ByteArrayInputStream(input.getBytes());
List<Metric> metrics = PrometheusUtil.parseMetrics(inputStream);
assertNotNull(metrics);
assertEquals(1, metrics.size());
Metric metric = metrics.get(0);
assertEquals("metric_name", metric.getMetricName());
assertEquals(123.45, metric.getValue());
assertEquals(67890, metric.getTimestamp());
List<Label> labels = metric.getLabelList();
assertEquals(1, labels.size());
assertEquals("label1", labels.get(0).getName());
assertEquals("value1", labels.get(0).getValue());
}
@Test
void testParseMetricsMalformedInput() throws IOException {
String input = "metric_name{label1=value1} 123.45 67890\n";
InputStream inputStream = new ByteArrayInputStream(input.getBytes());
List<Metric> metrics = PrometheusUtil.parseMetrics(inputStream);
assertNull(metrics);
}
@Test
void testParseMetricsNanValue() throws IOException {
String input = "metric_name{label1=\"value1\"} NaN 67890\n";
InputStream inputStream = new ByteArrayInputStream(input.getBytes());
List<Metric> metrics = PrometheusUtil.parseMetrics(inputStream);
assertNotNull(metrics);
assertEquals(1, metrics.size());
Metric metric = metrics.get(0);
assertEquals("metric_name", metric.getMetricName());
assertTrue(Double.isNaN(metric.getValue()));
assertEquals(67890, metric.getTimestamp());
}
@Test
void testParseMetricsPositiveInfinity() throws IOException {
String input = "metric_name{label1=\"value1\"} +Inf 67890\n";
InputStream inputStream = new ByteArrayInputStream(input.getBytes());
List<Metric> metrics = PrometheusUtil.parseMetrics(inputStream);
assertNotNull(metrics);
assertEquals(1, metrics.size());
Metric metric = metrics.get(0);
assertEquals("metric_name", metric.getMetricName());
assertEquals(Double.POSITIVE_INFINITY, metric.getValue());
assertEquals(67890, metric.getTimestamp());
}
@Test
void testParseMetricsNegativeInfinity() throws IOException {
String input = "metric_name{label1=\"value1\"} -Inf 67890\n";
InputStream inputStream = new ByteArrayInputStream(input.getBytes());
List<Metric> metrics = PrometheusUtil.parseMetrics(inputStream);
assertNotNull(metrics);
assertEquals(1, metrics.size());
Metric metric = metrics.get(0);
assertEquals("metric_name", metric.getMetricName());
assertEquals(Double.NEGATIVE_INFINITY, metric.getValue());
assertEquals(67890, metric.getTimestamp());
}
@Test
void testParseMetricsWithoutLabels() throws IOException {
String input = "metric_name 123.45 67890\n";
InputStream inputStream = new ByteArrayInputStream(input.getBytes());
List<Metric> metrics = PrometheusUtil.parseMetrics(inputStream);
assertNotNull(metrics);
assertEquals(1, metrics.size());
Metric metric = metrics.get(0);
assertEquals("metric_name", metric.getMetricName());
assertEquals(123.45, metric.getValue());
assertEquals(67890, metric.getTimestamp());
assertNull(metric.getLabelList());
}
@Test
void testParseMetricsWithoutTimestamp() throws IOException {
String input = "metric_name{label1=\"value1\"} 123.45\n";
InputStream inputStream = new ByteArrayInputStream(input.getBytes());
List<Metric> metrics = PrometheusUtil.parseMetrics(inputStream);
assertNotNull(metrics);
assertEquals(1, metrics.size());
Metric metric = metrics.get(0);
assertEquals("metric_name", metric.getMetricName());
assertEquals(123.45, metric.getValue());
assertEquals(null, metric.getTimestamp()); // Assuming 0 for no timestamp
List<Label> labels = metric.getLabelList();
assertEquals(1, labels.size());
assertEquals("label1", labels.get(0).getName());
assertEquals("value1", labels.get(0).getValue());
}
@Test
void testParseMultipleMetrics() throws IOException {
String input = "metric_name1{label1=\"value1\"} 123.45 67890\nmetric_name2 678.90 12345\n";
InputStream inputStream = new ByteArrayInputStream(input.getBytes());
List<Metric> metrics = PrometheusUtil.parseMetrics(inputStream);
assertNotNull(metrics);
assertEquals(2, metrics.size());
Metric metric1 = metrics.get(0);
assertEquals("metric_name1", metric1.getMetricName());
assertEquals(123.45, metric1.getValue());
assertEquals(67890, metric1.getTimestamp());
List<Label> labels1 = metric1.getLabelList();
assertEquals(1, labels1.size());
assertEquals("label1", labels1.get(0).getName());
assertEquals("value1", labels1.get(0).getValue());
Metric metric2 = metrics.get(1);
assertEquals("metric_name2", metric2.getMetricName());
assertEquals(678.90, metric2.getValue());
assertEquals(12345, metric2.getTimestamp());
assertNull(metric2.getLabelList());
}
@Test
void testParseEmptyInput() throws IOException {
String input = "";
InputStream inputStream = new ByteArrayInputStream(input.getBytes());
List<Metric> metrics = PrometheusUtil.parseMetrics(inputStream);
assertNotNull(metrics);
assertTrue(metrics.isEmpty());
}
}
@@ -73,6 +73,14 @@
<version>${easy-poi.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-vector</artifactId>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-netty</artifactId>
</dependency>
</dependencies>
</project>
@@ -26,7 +26,10 @@ import static org.apache.hertzbeat.common.constants.CommonConstants.TAG_METRICS;
import static org.apache.hertzbeat.common.constants.CommonConstants.TAG_MONITOR_APP;
import static org.apache.hertzbeat.common.constants.CommonConstants.TAG_MONITOR_ID;
import static org.apache.hertzbeat.common.constants.CommonConstants.TAG_MONITOR_NAME;
import com.google.common.collect.Maps;
import jakarta.persistence.criteria.Predicate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -45,8 +48,10 @@ import org.apache.hertzbeat.alert.service.AlertDefineService;
import org.apache.hertzbeat.alert.service.AlertService;
import org.apache.hertzbeat.alert.util.AlertTemplateUtil;
import org.apache.hertzbeat.common.constants.CommonConstants;
import org.apache.hertzbeat.common.constants.MetricDataConstants;
import org.apache.hertzbeat.common.entity.alerter.Alert;
import org.apache.hertzbeat.common.entity.alerter.AlertDefine;
import org.apache.hertzbeat.common.entity.arrow.RowWrapper;
import org.apache.hertzbeat.common.entity.manager.Monitor;
import org.apache.hertzbeat.common.entity.manager.TagItem;
import org.apache.hertzbeat.common.entity.message.CollectRep;
@@ -124,6 +129,7 @@ public class CalculateAlarm {
if (metricsData != null) {
calculate(metricsData);
}
dataQueue.sendMetricsDataToStorage(metricsData);
} catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
} catch (Exception e) {
@@ -155,94 +161,97 @@ public class CalculateAlarm {
if (defineMap.isEmpty()) {
return;
}
List<CollectRep.Field> fields = metricsData.getFieldsList();
Map<String, Object> fieldValueMap = new HashMap<>(8);
int valueRowCount = metricsData.getValuesCount();
for (Map.Entry<String, List<AlertDefine>> entry : defineMap.entrySet()) {
List<AlertDefine> defines = entry.getValue();
for (AlertDefine define : defines) {
final String expr = define.getExpr();
if (StringUtils.isBlank(expr)) {
continue;
}
if (expr.contains(SYSTEM_VALUE_ROW_COUNT) && metricsData.getValuesCount() == 0) {
fieldValueMap.put(SYSTEM_VALUE_ROW_COUNT, valueRowCount);
try {
boolean match = execAlertExpression(fieldValueMap, expr);
try {
if (match) {
// If the threshold rule matches, the number of times the threshold has been triggered is determined and an alarm is triggered
afterThresholdRuleMatch(currentTimeMilli, monitorId, app, metrics, "", fieldValueMap, define);
// if the threshold is triggered, ignore other data rows
continue;
} else {
String alarmKey = String.valueOf(monitorId) + define.getId();
triggeredAlertMap.remove(alarmKey);
if (define.isRecoverNotice()) {
handleRecoveredAlert(currentTimeMilli, define, expr, alarmKey);
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
} catch (Exception ignored) {}
}
for (CollectRep.ValueRow valueRow : metricsData.getValuesList()) {
Map<String, Object> fieldValueMap = Maps.newHashMapWithExpectedSize(8);
if (CollectionUtils.isEmpty(valueRow.getColumnsList())) {
try {
for (Map.Entry<String, List<AlertDefine>> entry : defineMap.entrySet()) {
List<AlertDefine> defines = entry.getValue();
for (AlertDefine define : defines) {
final String expr = define.getExpr();
if (StringUtils.isBlank(expr)) {
continue;
}
fieldValueMap.clear();
fieldValueMap.put(SYSTEM_VALUE_ROW_COUNT, valueRowCount);
StringBuilder tagBuilder = new StringBuilder();
for (int index = 0; index < valueRow.getColumnsList().size(); index++) {
String valueStr = valueRow.getColumns(index);
if (CommonConstants.NULL_VALUE.equals(valueStr)) {
continue;
}
final CollectRep.Field field = fields.get(index);
final int fieldType = field.getType();
if (fieldType == CommonConstants.TYPE_NUMBER) {
final Double doubleValue;
if ((doubleValue = CommonUtil.parseStrDouble(valueStr)) != null) {
fieldValueMap.put(field.getName(), doubleValue);
}
} else if (fieldType == CommonConstants.TYPE_TIME) {
final Integer integerValue;
if ((integerValue = CommonUtil.parseStrInteger(valueStr)) != null) {
fieldValueMap.put(field.getName(), integerValue);
}
} else {
if (StringUtils.isNotEmpty(valueStr)) {
fieldValueMap.put(field.getName(), valueStr);
}
}
if (field.getLabel()) {
tagBuilder.append("-").append(valueStr);
}
}
try {
boolean match = execAlertExpression(fieldValueMap, expr);
if (expr.contains(SYSTEM_VALUE_ROW_COUNT) && metricsData.getValues().size() == 0L) {
fieldValueMap.put(SYSTEM_VALUE_ROW_COUNT, 0);
try {
if (match) {
// If the threshold rule matches, the number of times the threshold has been triggered is determined and an alarm is triggered
afterThresholdRuleMatch(currentTimeMilli, monitorId, app, metrics, tagBuilder.toString(), fieldValueMap, define);
boolean match = execAlertExpression(fieldValueMap, expr);
try {
if (match) {
// If the threshold rule matches, the number of times the threshold has been triggered is determined and an alarm is triggered
afterThresholdRuleMatch(currentTimeMilli, monitorId, app, metrics, "", fieldValueMap, define);
// if the threshold is triggered, ignore other data rows
continue;
} else {
String alarmKey = String.valueOf(monitorId) + define.getId();
triggeredAlertMap.remove(alarmKey);
if (define.isRecoverNotice()) {
handleRecoveredAlert(currentTimeMilli, define, expr, alarmKey);
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
} catch (Exception ignored) {}
}
RowWrapper rowWrapper = metricsData.readRow();
while (rowWrapper.hasNextRow()) {
rowWrapper = rowWrapper.nextRow();
StringBuilder tagBuilder = new StringBuilder();
fieldValueMap.clear();
fieldValueMap.put(SYSTEM_VALUE_ROW_COUNT, metricsData.getValues().size());
rowWrapper.cellStream().forEach(cell -> {
String valueStr = cell.getValue();
if (CommonConstants.NULL_VALUE.equals(valueStr)) {
return;
}
final String fieldName = cell.getField().getName();
final int fieldType = cell.getMetadataAsInteger(MetricDataConstants.TYPE);
if (fieldType == CommonConstants.TYPE_NUMBER) {
final Double doubleValue;
if ((doubleValue = CommonUtil.parseStrDouble(valueStr)) != null) {
fieldValueMap.put(fieldName, doubleValue);
}
} else if (fieldType == CommonConstants.TYPE_TIME) {
final Integer integerValue;
if ((integerValue = CommonUtil.parseStrInteger(valueStr)) != null) {
fieldValueMap.put(fieldName, integerValue);
}
} else {
String alarmKey = String.valueOf(monitorId) + define.getId() + tagBuilder;
triggeredAlertMap.remove(alarmKey);
if (define.isRecoverNotice()) {
handleRecoveredAlert(currentTimeMilli, define, expr, alarmKey);
if (StringUtils.isNotEmpty(valueStr)) {
fieldValueMap.put(fieldName, valueStr);
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
} catch (Exception ignored) {}
if (cell.getMetadataAsBoolean(MetricDataConstants.LABEL)) {
tagBuilder.append("-").append(valueStr);
}
});
try {
boolean match = execAlertExpression(fieldValueMap, expr);
try {
if (match) {
// If the threshold rule matches, the number of times the threshold has been triggered is determined and an alarm is triggered
afterThresholdRuleMatch(currentTimeMilli, monitorId, app, metrics, tagBuilder.toString(), fieldValueMap, define);
} else {
String alarmKey = String.valueOf(monitorId) + define.getId() + tagBuilder;
triggeredAlertMap.remove(alarmKey);
if (define.isRecoverNotice()) {
handleRecoveredAlert(currentTimeMilli, define, expr, alarmKey);
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
} catch (Exception ignored) {}
}
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
@@ -25,7 +25,6 @@ import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -190,7 +189,7 @@ public class AlertServiceImpl implements AlertService {
alert = AlertReport.builder()
.content("error do not has cloud service api")
.alertName("/api/alerts/report/" + cloudServiceName)
.alertTime(new Date().getTime())
.alertTime(Instant.now().getEpochSecond())
.priority(1)
.reportType(1)
.build();
@@ -33,6 +33,7 @@
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mqtt.version>1.3.3</mqtt.version>
</properties>
<dependencies>
@@ -141,7 +142,18 @@
<dependency>
<groupId>com.hivemq</groupId>
<artifactId>hivemq-mqtt-client</artifactId>
<version>1.3.3</version>
<version>${mqtt.version}</version>
</dependency>
<!--plc-->
<dependency>
<groupId>org.apache.plc4x</groupId>
<artifactId>plc4j-api</artifactId>
<version>0.12.0</version>
</dependency>
<dependency>
<groupId>org.apache.plc4x</groupId>
<artifactId>plc4j-driver-modbus</artifactId>
<version>0.12.0</version>
</dependency>
</dependencies>
</project>
@@ -28,8 +28,9 @@ import java.util.Objects;
import java.util.Optional;
import lombok.extern.slf4j.Slf4j;
import org.apache.hertzbeat.collector.collect.AbstractCollect;
import org.apache.hertzbeat.collector.collect.common.cache.AbstractConnection;
import org.apache.hertzbeat.collector.collect.common.cache.CacheIdentifier;
import org.apache.hertzbeat.collector.collect.common.cache.ConnectionCommonCache;
import org.apache.hertzbeat.collector.collect.common.cache.GlobalConnectionCache;
import org.apache.hertzbeat.collector.collect.common.cache.JdbcConnect;
import org.apache.hertzbeat.collector.constants.CollectorConstants;
import org.apache.hertzbeat.collector.dispatch.DispatchConstants;
@@ -57,11 +58,8 @@ public class JdbcCommonCollect extends AbstractCollect {
private static final String[] VULNERABLE_KEYWORDS = {"allowLoadLocalInfile", "allowLoadLocalInfileInPath", "useLocalInfile"};
private final ConnectionCommonCache<CacheIdentifier, JdbcConnect> connectionCommonCache;
private final GlobalConnectionCache connectionCommonCache = GlobalConnectionCache.getInstance();
public JdbcCommonCollect(){
connectionCommonCache = new ConnectionCommonCache<>();
}
@Override
public void preCheck(Metrics metrics) throws IllegalArgumentException {
@@ -78,7 +76,7 @@ public class JdbcCommonCollect extends AbstractCollect {
}
@Override
public void collect(CollectRep.MetricsData.Builder builder, long monitorId, String app, Metrics metrics) {
public void collect(CollectRep.MetricsData.Builder builder, Metrics metrics) {
long startTime = System.currentTimeMillis();
JdbcProtocol jdbcProtocol = metrics.getJdbc();
String databaseUrl = constructDatabaseUrl(jdbcProtocol);
@@ -140,10 +138,10 @@ public class JdbcCommonCollect extends AbstractCollect {
CacheIdentifier identifier = CacheIdentifier.builder()
.ip(url)
.username(username).password(password).build();
Optional<JdbcConnect> cacheOption = connectionCommonCache.getCache(identifier, true);
Optional<AbstractConnection<?>> cacheOption = connectionCommonCache.getCache(identifier, true);
Statement statement = null;
if (cacheOption.isPresent()) {
JdbcConnect jdbcConnect = cacheOption.get();
JdbcConnect jdbcConnect = (JdbcConnect) cacheOption.get();
try {
statement = jdbcConnect.getConnection().createStatement();
// set query timeout
@@ -171,6 +169,7 @@ public class JdbcCommonCollect extends AbstractCollect {
}
// renew connection when failed
Connection connection = DriverManager.getConnection(url, username, password);
connection.setReadOnly(true);
statement = connection.createStatement();
int timeoutSecond = timeout / 1000;
timeoutSecond = timeoutSecond <= 0 ? 1 : timeoutSecond;
@@ -200,14 +199,14 @@ public class JdbcCommonCollect extends AbstractCollect {
for (String column : columns) {
if (CollectorConstants.RESPONSE_TIME.equals(column)) {
long time = System.currentTimeMillis() - startTime;
valueRowBuilder.addColumns(String.valueOf(time));
valueRowBuilder.addColumn(String.valueOf(time));
} else {
String value = resultSet.getString(column);
value = value == null ? CommonConstants.NULL_VALUE : value;
valueRowBuilder.addColumns(value);
valueRowBuilder.addColumn(value);
}
}
builder.addValues(valueRowBuilder.build());
builder.addValueRow(valueRowBuilder.build());
}
}
}
@@ -240,14 +239,14 @@ public class JdbcCommonCollect extends AbstractCollect {
for (String column : columns) {
if (CollectorConstants.RESPONSE_TIME.equals(column)) {
long time = System.currentTimeMillis() - startTime;
valueRowBuilder.addColumns(String.valueOf(time));
valueRowBuilder.addColumn(String.valueOf(time));
} else {
String value = values.get(column.toLowerCase());
value = value == null ? CommonConstants.NULL_VALUE : value;
valueRowBuilder.addColumns(value);
valueRowBuilder.addColumn(value);
}
}
builder.addValues(valueRowBuilder.build());
builder.addValueRow(valueRowBuilder.build());
}
}
@@ -270,14 +269,14 @@ public class JdbcCommonCollect extends AbstractCollect {
for (String column : columns) {
if (CollectorConstants.RESPONSE_TIME.equals(column)) {
long time = System.currentTimeMillis() - startTime;
valueRowBuilder.addColumns(String.valueOf(time));
valueRowBuilder.addColumn(String.valueOf(time));
} else {
String value = resultSet.getString(column);
value = value == null ? CommonConstants.NULL_VALUE : value;
valueRowBuilder.addColumns(value);
valueRowBuilder.addColumn(value);
}
}
builder.addValues(valueRowBuilder.build());
builder.addValueRow(valueRowBuilder.build());
}
}
}
@@ -291,6 +290,14 @@ public class JdbcCommonCollect extends AbstractCollect {
if (Objects.nonNull(jdbcProtocol.getUrl())
&& !Objects.equals("", jdbcProtocol.getUrl())
&& jdbcProtocol.getUrl().startsWith("jdbc")) {
String url = jdbcProtocol.getUrl().toLowerCase(); // convert the URL to lowercase for case-insensitive checking
// check whether the parameter is valid
if (url.contains("create trigger") || url.contains("create alias") || url.contains("runscript from")
|| url.contains("allowloadlocalinfile") || url.contains("allowloadlocalinfileinpath")
|| url.contains("uselocalinfile") || url.contains("autodeserialize") || url.contains("detectcustomcollations")
|| url.contains("serverstatusdiffinterceptor")) {
throw new IllegalArgumentException("Invalid JDBC URL: contains malicious characters.");
}
// when has config jdbc url, use it
return jdbcProtocol.getUrl();
}
@@ -103,7 +103,7 @@ public class DnsCollectImpl extends AbstractCollect {
}
@Override
public void collect(CollectRep.MetricsData.Builder builder, long monitorId, String app, Metrics metrics) {
public void collect(CollectRep.MetricsData.Builder builder, Metrics metrics) {
DnsResolveResult dnsResolveResult;
try {
@@ -127,18 +127,18 @@ public class DnsCollectImpl extends AbstractCollect {
if (StringUtils.equals(HEADER, metrics.getName())) {
// add header columns
Map<String, String> headerInfo = dnsResolveResult.getHeaderInfo();
metrics.getAliasFields().forEach(field -> valueRowBuilder.addColumns(headerInfo.getOrDefault(field, CommonConstants.NULL_VALUE)));
metrics.getAliasFields().forEach(field -> valueRowBuilder.addColumn(headerInfo.getOrDefault(field, CommonConstants.NULL_VALUE)));
} else {
// add question/answer/authority/additional columns
List<String> currentMetricsResolveResultList = dnsResolveResult.getList(metrics.getName());
for (int index = 0; index < metrics.getAliasFields().size(); index++) {
valueRowBuilder.addColumns(index >= currentMetricsResolveResultList.size()
valueRowBuilder.addColumn(index >= currentMetricsResolveResultList.size()
? CommonConstants.NULL_VALUE
: currentMetricsResolveResultList.get(index));
}
}
builder.addValues(valueRowBuilder.build());
builder.addValueRow(valueRowBuilder.build());
}
@Override
@@ -58,7 +58,7 @@ public class FtpCollectImpl extends AbstractCollect {
@Override
public void collect(CollectRep.MetricsData.Builder builder, long monitorId, String app, Metrics metrics) {
public void collect(CollectRep.MetricsData.Builder builder, Metrics metrics) {
FTPClient ftpClient = new FTPClient();
FtpProtocol ftpProtocol = metrics.getFtp();
// Set timeout
@@ -72,9 +72,9 @@ public class FtpCollectImpl extends AbstractCollect {
metrics.getAliasFields().forEach(it -> {
if (valueMap.containsKey(it)) {
String fieldValue = valueMap.get(it);
valueRowBuilder.addColumns(Objects.requireNonNullElse(fieldValue, CommonConstants.NULL_VALUE));
valueRowBuilder.addColumn(Objects.requireNonNullElse(fieldValue, CommonConstants.NULL_VALUE));
} else {
valueRowBuilder.addColumns(CommonConstants.NULL_VALUE);
valueRowBuilder.addColumn(CommonConstants.NULL_VALUE);
}
});
} catch (Exception e) {
@@ -82,7 +82,7 @@ public class FtpCollectImpl extends AbstractCollect {
builder.setMsg(e.getMessage());
return;
}
builder.addValues(valueRowBuilder.build());
builder.addValueRow(valueRowBuilder.build());
}
/**
@@ -108,8 +108,7 @@ public class HttpCollectImpl extends AbstractCollect {
}
@Override
public void collect(CollectRep.MetricsData.Builder builder,
long monitorId, String app, Metrics metrics) {
public void collect(CollectRep.MetricsData.Builder builder, Metrics metrics) {
long startTime = System.currentTimeMillis();
HttpProtocol httpProtocol = metrics.getHttp();
@@ -156,6 +155,8 @@ public class HttpCollectImpl extends AbstractCollect {
parseResponseByWebsite(resp, metrics, metrics.getHttp(), builder, responseTime, response);
case DispatchConstants.PARSE_SITE_MAP ->
parseResponseBySiteMap(resp, metrics.getAliasFields(), builder);
case DispatchConstants.PARSE_HEADER ->
parseResponseByHeader(builder, metrics.getAliasFields(), response);
default ->
parseResponseByDefault(resp, metrics.getAliasFields(), metrics.getHttp(), builder, responseTime);
}
@@ -196,6 +197,24 @@ public class HttpCollectImpl extends AbstractCollect {
}
}
private void parseResponseByHeader(CollectRep.MetricsData.Builder builder, List<String> aliases, CloseableHttpResponse response) {
CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder();
for (String alias : aliases) {
if (!StringUtils.hasText(alias)) {
valueRowBuilder.addColumn(CommonConstants.NULL_VALUE);
continue;
}
final Header firstHeader = response.getFirstHeader(alias);
if (Objects.isNull(firstHeader)) {
valueRowBuilder.addColumn(CommonConstants.NULL_VALUE);
continue;
}
valueRowBuilder.addColumn(firstHeader.getValue());
}
builder.addValueRow(valueRowBuilder.build());
}
@Override
public String supportProtocol() {
return DispatchConstants.PROTOCOL_HTTP;
@@ -207,37 +226,18 @@ public class HttpCollectImpl extends AbstractCollect {
CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder();
int keywordNum = CollectUtil.countMatchKeyword(resp, http.getKeyword());
for (String alias : metrics.getAliasFields()) {
if ("summary".equalsIgnoreCase(metrics.getName())) {
addColumnForSummary(responseTime, valueRowBuilder, keywordNum, alias);
} else if ("header".equalsIgnoreCase(metrics.getName())) {
addColumnFromHeader(valueRowBuilder, alias, response);
}
addColumnForSummary(responseTime, valueRowBuilder, keywordNum, alias);
}
builder.addValues(valueRowBuilder.build());
}
private void addColumnFromHeader(CollectRep.ValueRow.Builder valueRowBuilder, String alias, CloseableHttpResponse response) {
if (!StringUtils.hasText(alias)) {
valueRowBuilder.addColumns(CommonConstants.NULL_VALUE);
return;
}
final Header firstHeader = response.getFirstHeader(alias);
if (Objects.isNull(firstHeader)) {
valueRowBuilder.addColumns(CommonConstants.NULL_VALUE);
return;
}
valueRowBuilder.addColumns(firstHeader.getValue());
builder.addValueRow(valueRowBuilder.build());
}
private void addColumnForSummary(Long responseTime, CollectRep.ValueRow.Builder valueRowBuilder, int keywordNum, String alias) {
if (NetworkConstants.RESPONSE_TIME.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(responseTime.toString());
valueRowBuilder.addColumn(responseTime.toString());
} else if (CollectorConstants.KEYWORD.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(Integer.toString(keywordNum));
valueRowBuilder.addColumn(Integer.toString(keywordNum));
} else {
valueRowBuilder.addColumns(CommonConstants.NULL_VALUE);
valueRowBuilder.addColumn(CommonConstants.NULL_VALUE);
}
}
@@ -308,19 +308,19 @@ public class HttpCollectImpl extends AbstractCollect {
CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder();
for (String alias : aliasFields) {
if (NetworkConstants.URL.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(siteUrl);
valueRowBuilder.addColumn(siteUrl);
} else if (NetworkConstants.STATUS_CODE.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(statusCode == null
valueRowBuilder.addColumn(statusCode == null
? CommonConstants.NULL_VALUE : String.valueOf(statusCode));
} else if (NetworkConstants.RESPONSE_TIME.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(String.valueOf(responseTime));
valueRowBuilder.addColumn(String.valueOf(responseTime));
} else if (NetworkConstants.ERROR_MSG.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(errorMsg);
valueRowBuilder.addColumn(errorMsg);
} else {
valueRowBuilder.addColumns(CommonConstants.NULL_VALUE);
valueRowBuilder.addColumn(CommonConstants.NULL_VALUE);
}
}
builder.addValues(valueRowBuilder.build());
builder.addValueRow(valueRowBuilder.build());
}
}
@@ -344,34 +344,34 @@ public class HttpCollectImpl extends AbstractCollect {
for (String alias : aliasFields) {
Object value = stringMap.get(alias);
if (value != null) {
valueRowBuilder.addColumns(String.valueOf(value));
valueRowBuilder.addColumn(String.valueOf(value));
} else {
if (alias.startsWith("$.")) {
List<Object> subResults = JsonPathParser.parseContentWithJsonPath(resp, http.getParseScript() + alias.substring(1));
if (subResults != null && subResults.size() > i) {
Object resultValue = subResults.get(i);
valueRowBuilder.addColumns(resultValue == null ? CommonConstants.NULL_VALUE : String.valueOf(resultValue));
valueRowBuilder.addColumn(resultValue == null ? CommonConstants.NULL_VALUE : String.valueOf(resultValue));
} else {
valueRowBuilder.addColumns(CommonConstants.NULL_VALUE);
valueRowBuilder.addColumn(CommonConstants.NULL_VALUE);
}
} else {
addColumnForSummary(responseTime, valueRowBuilder, keywordNum, alias);
}
}
}
builder.addValues(valueRowBuilder.build());
builder.addValueRow(valueRowBuilder.build());
} else if (objectValue instanceof String stringValue) {
CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder();
for (String alias : aliasFields) {
if (NetworkConstants.RESPONSE_TIME.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(responseTime.toString());
valueRowBuilder.addColumn(responseTime.toString());
} else if (CollectorConstants.KEYWORD.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(Integer.toString(keywordNum));
valueRowBuilder.addColumn(Integer.toString(keywordNum));
} else {
valueRowBuilder.addColumns(stringValue);
valueRowBuilder.addColumn(stringValue);
}
}
builder.addValues(valueRowBuilder.build());
builder.addValueRow(valueRowBuilder.build());
}
}
}
@@ -400,24 +400,24 @@ public class HttpCollectImpl extends AbstractCollect {
for (String aliasField : aliasFields) {
if ("value".equals(aliasField)) {
if (metric.getCounter() != null) {
valueRowBuilder.addColumns(String.valueOf(metric.getCounter().getValue()));
valueRowBuilder.addColumn(String.valueOf(metric.getCounter().getValue()));
} else if (metric.getGauge() != null) {
valueRowBuilder.addColumns(String.valueOf(metric.getGauge().getValue()));
valueRowBuilder.addColumn(String.valueOf(metric.getGauge().getValue()));
} else if (metric.getUntyped() != null) {
valueRowBuilder.addColumns(String.valueOf(metric.getUntyped().getValue()));
valueRowBuilder.addColumn(String.valueOf(metric.getUntyped().getValue()));
} else if (metric.getInfo() != null) {
valueRowBuilder.addColumns(String.valueOf(metric.getInfo().getValue()));
valueRowBuilder.addColumn(String.valueOf(metric.getInfo().getValue()));
} else if (metric.getSummary() != null) {
valueRowBuilder.addColumns(String.valueOf(metric.getSummary().getValue()));
valueRowBuilder.addColumn(String.valueOf(metric.getSummary().getValue()));
} else if (metric.getHistogram() != null) {
valueRowBuilder.addColumns(String.valueOf(metric.getHistogram().getValue()));
valueRowBuilder.addColumn(String.valueOf(metric.getHistogram().getValue()));
}
} else {
String columnValue = labelMap.get(aliasField);
valueRowBuilder.addColumns(columnValue == null ? CommonConstants.NULL_VALUE : columnValue);
valueRowBuilder.addColumn(columnValue == null ? CommonConstants.NULL_VALUE : columnValue);
}
}
builder.addValues(valueRowBuilder.build());
builder.addValueRow(valueRowBuilder.build());
}
}
}
@@ -444,12 +444,12 @@ public class HttpCollectImpl extends AbstractCollect {
JsonElement valueElement = object.get(alias);
if (valueElement != null) {
String value = valueElement.getAsString();
valueRowBuilder.addColumns(value);
valueRowBuilder.addColumn(value);
} else {
addColumnForSummary(responseTime, valueRowBuilder, keywordNum, alias);
}
}
builder.addValues(valueRowBuilder.build());
builder.addValueRow(valueRowBuilder.build());
}
}
@@ -68,7 +68,7 @@ public class SslCertificateCollectImpl extends AbstractCollect {
@Override
public void collect(CollectRep.MetricsData.Builder builder,
long monitorId, String app, Metrics metrics) {
Metrics metrics) {
long startTime = System.currentTimeMillis();
HttpProtocol httpProtocol = metrics.getHttp();
@@ -111,24 +111,24 @@ public class SslCertificateCollectImpl extends AbstractCollect {
CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder();
for (String alias : metrics.getAliasFields()) {
if (CollectorConstants.RESPONSE_TIME.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(Long.toString(responseTime));
valueRowBuilder.addColumn(Long.toString(responseTime));
} else if (NAME_SUBJECT.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(x509Certificate.getSubjectX500Principal().getName());
valueRowBuilder.addColumn(x509Certificate.getSubjectX500Principal().getName());
} else if (NAME_EXPIRED.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(Boolean.toString(expired));
valueRowBuilder.addColumn(Boolean.toString(expired));
} else if (NAME_START_TIME.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(x509Certificate.getNotBefore().toLocaleString());
valueRowBuilder.addColumn(x509Certificate.getNotBefore().toLocaleString());
} else if (NAME_START_TIMESTAMP.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(String.valueOf(x509Certificate.getNotBefore().getTime()));
valueRowBuilder.addColumn(String.valueOf(x509Certificate.getNotBefore().getTime()));
} else if (NAME_END_TIME.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(x509Certificate.getNotAfter().toLocaleString());
valueRowBuilder.addColumn(x509Certificate.getNotAfter().toLocaleString());
} else if (NAME_END_TIMESTAMP.equalsIgnoreCase(alias)) {
valueRowBuilder.addColumns(String.valueOf(x509Certificate.getNotAfter().getTime()));
valueRowBuilder.addColumn(String.valueOf(x509Certificate.getNotAfter().getTime()));
} else {
valueRowBuilder.addColumns(CommonConstants.NULL_VALUE);
valueRowBuilder.addColumn(CommonConstants.NULL_VALUE);
}
}
builder.addValues(valueRowBuilder.build());
builder.addValueRow(valueRowBuilder.build());
}
} catch (SSLPeerUnverifiedException e1) {
String errorMsg = "Ssl certificate does not exist.";
@@ -39,6 +39,6 @@ public class PrometheusLastParser extends AbstractPrometheusParse {
@Override
public void parse(String resp, List<String> aliasFields, HttpProtocol http, CollectRep.MetricsData.Builder builder) {
CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder();
aliasFields.forEach(aliasField -> valueRowBuilder.addColumns(CommonConstants.NULL_VALUE));
aliasFields.forEach(aliasField -> valueRowBuilder.addColumn(CommonConstants.NULL_VALUE));
}
}
@@ -63,35 +63,35 @@ public class PrometheusMatrixParser extends AbstractPrometheusParse {
if (!CollectUtil.assertPromRequireField(aliasField)) {
JsonElement jsonElement = r.getMetric().get(aliasField);
if (jsonElement != null) {
valueRowBuilder.addColumns(jsonElement.getAsString());
valueRowBuilder.addColumn(jsonElement.getAsString());
} else {
valueRowBuilder.addColumns(CommonConstants.NULL_VALUE);
valueRowBuilder.addColumn(CommonConstants.NULL_VALUE);
}
} else {
if (CommonConstants.PROM_TIME.equals(aliasField)) {
for (Object o : value) {
if (o instanceof Double time) {
valueRowBuilder.addColumns(String.valueOf(BigDecimal.valueOf(time * 1000)));
valueRowBuilder.addColumn(String.valueOf(BigDecimal.valueOf(time * 1000)));
setTimeFlag = true;
}
}
if (!setTimeFlag) {
valueRowBuilder.addColumns(CommonConstants.NULL_VALUE);
valueRowBuilder.addColumn(CommonConstants.NULL_VALUE);
}
} else {
for (Object o : value) {
if (o instanceof String str) {
valueRowBuilder.addColumns(str);
valueRowBuilder.addColumn(str);
setValueFlag = true;
}
}
if (!setValueFlag) {
valueRowBuilder.addColumns(CommonConstants.NULL_VALUE);
valueRowBuilder.addColumn(CommonConstants.NULL_VALUE);
}
}
}
}
builder.addValues(valueRowBuilder);
builder.addValueRow(valueRowBuilder.build());
}
}

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