Compare commits
53 Commits
feature#mu
...
feature#ap
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
301558ca59 | ||
|
|
636303021f | ||
|
|
0cf66f32ff | ||
|
|
fbf7ebd834 | ||
|
|
327f527082 | ||
|
|
2f52ff5e63 | ||
|
|
abe24914d3 | ||
|
|
491ca17106 | ||
|
|
feef3e7054 | ||
|
|
5c7bb4b14e | ||
|
|
bb636c9bae | ||
|
|
d871572438 | ||
|
|
d169dac94d | ||
|
|
cc22196d4a | ||
|
|
820cb7a3e5 | ||
|
|
155bdaf462 | ||
|
|
11981942d7 | ||
|
|
8473545d89 | ||
|
|
eea9e601cf | ||
|
|
711f0e070a | ||
|
|
1f52ae4a88 | ||
|
|
a6a5f6abb4 | ||
|
|
56f2e826a9 | ||
|
|
ddb290bba3 | ||
|
|
f710795f0f | ||
|
|
88b03448e3 | ||
|
|
63d03c7ac6 | ||
|
|
223f36c6cb | ||
|
|
bf31faa831 | ||
|
|
792d461844 | ||
|
|
63fe51b597 | ||
|
|
eb65ee4206 | ||
|
|
b5bc5d2975 | ||
|
|
4db3e04dd6 | ||
|
|
540f4bcbf4 | ||
|
|
9eb3b9842d | ||
|
|
790bcc6f16 | ||
|
|
4ce0698834 | ||
|
|
6c69da92f6 | ||
|
|
84c1f6b348 | ||
|
|
4ebf408349 | ||
|
|
5b33ac687e | ||
|
|
0f5a0c0cfc | ||
|
|
4404d2347b | ||
|
|
49660ff03f | ||
|
|
b2558d641d | ||
|
|
a6038d1feb | ||
|
|
eca634bd55 | ||
|
|
c99cfaf2b7 | ||
|
|
daa505ce20 | ||
|
|
c2e60bebdd | ||
|
|
8b97d0a2ca | ||
|
|
7c12eda30e |
3
.github/FUNDING.yml
vendored
Normal file
3
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
custom: ['https://hertzbeat.com/docs/others/sponsor']
|
||||||
31
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
31
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**Used Version**
|
||||||
|
the version , tag or branch used
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
blank_issues_enabled: true
|
||||||
|
contact_links:
|
||||||
|
- name: Community Support
|
||||||
|
url: https://github.com/dromara/hertzbeat/discussions
|
||||||
|
about: Please ask and answer questions here.
|
||||||
|
- name: Security Bug Bounty
|
||||||
|
url: https://github.com/dromara/hertzbeat/issues
|
||||||
|
about: Please report security vulnerabilities here.
|
||||||
10
.github/ISSUE_TEMPLATE/custom.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE/custom.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
name: Custom issue template
|
||||||
|
about: Describe this issue template's purpose here.
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
67
.github/workflows/codeql-analysis.yml
vendored
Normal file
67
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
#
|
||||||
|
# ******** NOTE ********
|
||||||
|
# We have attempted to detect the languages in your repository. Please check
|
||||||
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
|
# supported CodeQL languages.
|
||||||
|
#
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ master ]
|
||||||
|
schedule:
|
||||||
|
- cron: '21 13 * * 4'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'java' ]
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||||
|
# Learn more:
|
||||||
|
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
|
#- run: |
|
||||||
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
||||||
12
.github/workflows/issues-translator.yml
vendored
Normal file
12
.github/workflows/issues-translator.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
name: 'issues-translator'
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
issues:
|
||||||
|
types: [opened]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: tomsun28/issues-translate-action@v2.6
|
||||||
24
.github/workflows/maven-build.yml
vendored
Normal file
24
.github/workflows/maven-build.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# 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: Java CI with Maven
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up JDK 1.8
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
- name: Build with Maven
|
||||||
|
run: mvn -B package --file pom.xml
|
||||||
62
CONTRIBUTING.md
Normal file
62
CONTRIBUTING.md
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
参与贡献
|
||||||
|
=======================================
|
||||||
|
|
||||||
|
非常欢迎参与项目贡献,我们致力于维护一个互相帮助的快乐社区。
|
||||||
|
|
||||||
|
### 模块
|
||||||
|
|
||||||
|
- **[manager](https://github.com/dromara/hertzbeat/tree/master/manager)** 提供监控管理,系统管理基础服务
|
||||||
|
> 提供对监控的管理,监控应用配置的管理,系统用户租户后台管理等。
|
||||||
|
- **[collector](https://github.com/dromara/hertzbeat/tree/master/collector)** 提供监控数据采集服务
|
||||||
|
> 使用通用协议远程采集获取对端指标数据。
|
||||||
|
- **[scheduler](https://github.com/dromara/hertzbeat/tree/master/scheduler)** 提供监控任务调度服务
|
||||||
|
> 采集任务管理,一次性任务和周期性任务的调度分发。
|
||||||
|
- **[warehouse](https://github.com/dromara/hertzbeat/tree/master/warehouse)** 提供监控数据仓储服务
|
||||||
|
> 采集指标结果数据管理,数据落盘,查询,计算统计。
|
||||||
|
- **[alerter](https://github.com/dromara/hertzbeat/tree/master/alerter)** 提供告警服务
|
||||||
|
> 告警计算触发,监控状态联动,告警配置,告警通知。
|
||||||
|
- **[web-app](https://github.com/dromara/hertzbeat/tree/master/web-app)** 提供可视化控制台页面
|
||||||
|
> 监控告警系统可视化控制台前端
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 如何贡献?
|
||||||
|
|
||||||
|
我们不仅仅接收代码的贡献提交,您也可以通过提交文档的更新或者BUG的报告来参与社区贡献。
|
||||||
|
|
||||||
|
如果是新的贡献者,请首先了解参考仓库提交Issues,提交Pull Requests如何工作。
|
||||||
|
|
||||||
|
https://github.com/dromara/hertzbeat/issues
|
||||||
|
https://github.com/dromara/hertzbeat/pulls
|
||||||
|
https://gitee.com/dromara/hertzbeat/issues
|
||||||
|
https://gitee.com/dromara/hertzbeat/pulls
|
||||||
|
|
||||||
|
## 本地代码工程启动
|
||||||
|
|
||||||
|
此为前后端分离项目,本地代码启动需将后端[manager](manager)和前端[web-app](web-app)分别启动生效。
|
||||||
|
|
||||||
|
### 后端启动
|
||||||
|
|
||||||
|
1. 部署启动依赖服务`MYSQL`和`TDengine`数据库
|
||||||
|
2. 需要`maven3+`和`java8+`环境
|
||||||
|
3. 修改配置文件的依赖服务地址等信息-`manager/src/main/resources/application.yml`
|
||||||
|
4. 启动`manager`服务 `manager/src/main/java/com/usthe/manager/Manager.java`
|
||||||
|
|
||||||
|
### 前端启动
|
||||||
|
|
||||||
|
1. 需要nodejs npm环境
|
||||||
|
下载地址:https://nodejs.org/en/download
|
||||||
|
2. 安装yarn `npm install -g yarn`
|
||||||
|
3. 在前端工程目录web-app下执行 `yarn install`
|
||||||
|
4. 全局安装angular-cli `npm install -g @angular/cli@12 --registry=https://registry.npm.taobao.org`
|
||||||
|
5. 待本地后端启动后,在web-app目录下启动本地前端 `ng serve --open`
|
||||||
|
6. 浏览器访问 localhost:4200 即可开始
|
||||||
|
|
||||||
|
## 加入交流
|
||||||
|
|
||||||
|
[Github Discussion](https://github.com/dromara/hertzbeat/discussions)
|
||||||
|
加微信号 tan-cloud 拉您进微信交流群
|
||||||
|
加QQ群号 718618151 进QQ交流群, 验证信息: tancloud
|
||||||
|
微信公众号:tancloudtech
|
||||||
|
[Dromara社区网站](https://dromara.org/)
|
||||||
|
[HertzBeat用户网站](https://support.qq.com/products/379369)
|
||||||
34
README.md
34
README.md
@@ -8,21 +8,22 @@
|
|||||||
|
|
||||||
## HertzBeat 赫兹跳动
|
## HertzBeat 赫兹跳动
|
||||||
|
|
||||||
> 易用友好的高性能监控告警系统。
|
> 易用友好的监控告警系统。
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
**官网: [hertzbeat.com](https://hertzBeat.com) | [tancloud.cn](https://tancloud.cn)**
|
**官网: [hertzbeat.com](https://hertzbeat.com) | [tancloud.cn](https://tancloud.cn)**
|
||||||
|
|
||||||
## 🎡 <font color="green">介绍</font>
|
## 🎡 <font color="green">介绍</font>
|
||||||
|
|
||||||
> [HertzBeat赫兹跳动](https://github.com/dromara/hertzbeat) 是由[Dromara](https://dromara.org)孵化,[TanCloud](https://tancloud.cn)开源的一个支持网站,API,PING,端口,数据库等监控类型,拥有易用友好的可视化操作界面的开源监控告警项目。
|
> [HertzBeat赫兹跳动](https://github.com/dromara/hertzbeat) 是由[Dromara](https://dromara.org)孵化,[TanCloud](https://tancloud.cn)开源的一个支持网站,API,PING,端口,数据库,操作系统等监控类型,拥有易用友好的可视化操作界面的开源监控告警项目。
|
||||||
> 我们也提供了对应的 **[SAAS版本监控云](https://console.tancloud.cn)**,中小团队和个人无需再为了监控自己的网站资源,而去部署一套繁琐的监控系统,**[登录即可免费开始](https://console.tancloud.cn)**。
|
> 我们也提供了对应的 **[SAAS版本监控云](https://console.tancloud.cn)**,中小团队和个人无需再为了监控自己的网站资源,而去部署一套繁琐的监控系统,**[登录即可免费开始](https://console.tancloud.cn)**。
|
||||||
> HertzBeat 支持[自定义监控](https://hertzbeat.com/docs/advanced/extend-point) ,只用通过配置YML文件我们就可以自定义需要的监控类型和指标,来满足常见的个性化需求。
|
> HertzBeat 支持[自定义监控](https://hertzbeat.com/docs/advanced/extend-point) ,只用通过配置YML文件我们就可以自定义需要的监控类型和指标,来满足常见的个性化需求。
|
||||||
> HertzBeat 模块化,`manager, collector, scheduler, warehouse, alerter` 各个模块解耦合,方便理解与定制开发。
|
> HertzBeat 模块化,`manager, collector, scheduler, warehouse, alerter` 各个模块解耦合,方便理解与定制开发。
|
||||||
@@ -59,7 +60,7 @@
|
|||||||
## 🐕 快速开始
|
## 🐕 快速开始
|
||||||
|
|
||||||
- 如果您不想部署而是直接使用,我们提供SAAS监控云-[TanCloud探云](https://console.tancloud.cn),即刻 **[登录注册](https://console.tancloud.cn)** 免费使用。
|
- 如果您不想部署而是直接使用,我们提供SAAS监控云-[TanCloud探云](https://console.tancloud.cn),即刻 **[登录注册](https://console.tancloud.cn)** 免费使用。
|
||||||
- 如果您是想将HertzBeat部署到内网环境搭建监控系统,请参考下面的[部署文档](https://hertzbeat.com/docs/start/quickstart)进行操作。
|
- 如果您是想将HertzBeat部署到内网环境搭建监控系统,请参考下面的 [部署文档](https://hertzbeat.com/docs/start/quickstart) 进行操作。
|
||||||
|
|
||||||
### 🐵 依赖服务部署
|
### 🐵 依赖服务部署
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@
|
|||||||
|
|
||||||
##### 安装MYSQL
|
##### 安装MYSQL
|
||||||
1. docker安装MYSQl
|
1. docker安装MYSQl
|
||||||
`docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql`
|
`docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7`
|
||||||
2. 创建名称为hertzbeat的数据库
|
2. 创建名称为hertzbeat的数据库
|
||||||
3. 执行位于项目仓库/script/sql/目录下的数据库脚本 [schema.sql](https://gitee.com/dromara/hertzbeat/raw/master/script/sql/schema.sql)
|
3. 执行位于项目仓库/script/sql/目录下的数据库脚本 [schema.sql](https://gitee.com/dromara/hertzbeat/raw/master/script/sql/schema.sql)
|
||||||
|
|
||||||
@@ -75,7 +76,7 @@
|
|||||||
|
|
||||||
##### 安装TDengine
|
##### 安装TDengine
|
||||||
1. docker安装TDengine
|
1. docker安装TDengine
|
||||||
`docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp --name tdengine tdengine/tdengine`
|
`docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/tcp -p 6030-6049:6030-6049/udp --name tdengine tdengine/tdengine:2.4.0.12`
|
||||||
2. 创建名称为hertzbeat的数据库
|
2. 创建名称为hertzbeat的数据库
|
||||||
|
|
||||||
详细步骤参考 [依赖服务TDengine安装初始化](https://hertzbeat.com/docs/start/tdengine-init)
|
详细步骤参考 [依赖服务TDengine安装初始化](https://hertzbeat.com/docs/start/tdengine-init)
|
||||||
@@ -83,18 +84,32 @@
|
|||||||
### 🍞 HertzBeat安装
|
### 🍞 HertzBeat安装
|
||||||
> HertzBeat支持通过源码安装启动,Docker容器运行和安装包方式安装部署。
|
> HertzBeat支持通过源码安装启动,Docker容器运行和安装包方式安装部署。
|
||||||
|
|
||||||
##### Docker方式快速安装
|
##### 方式一:Docker方式快速安装
|
||||||
`docker run -d -p 1157:1157 -v /opt/application.yml:/opt/hertzbeat/config/application.yml --name hertzbeat tancloud/hertzbeat:[版本tag]`
|
`docker run -d -p 1157:1157 -v /opt/application.yml:/opt/hertzbeat/config/application.yml --name hertzbeat tancloud/hertzbeat:[版本tag]`
|
||||||
|
|
||||||
详细步骤参考 [通过Docker方式安装HertzBeat](https://hertzbeat.com/docs/start/docker-deploy)
|
详细步骤参考 [通过Docker方式安装HertzBeat](https://hertzbeat.com/docs/start/docker-deploy)
|
||||||
|
|
||||||
##### 通过安装包安装
|
##### 方式二:通过安装包安装
|
||||||
1. 下载您系统环境对应的安装包 [GITEE Release](https://gitee.com/dromara/hertzbeat/releases) [GITHUB Release](https://github.com/dromara/hertzbeat/releases)
|
1. 下载您系统环境对应的安装包 [GITEE Release](https://gitee.com/dromara/hertzbeat/releases) [GITHUB Release](https://github.com/dromara/hertzbeat/releases)
|
||||||
2. 配置HertzBeat的配置文件 hertzbeat/config/application.yml
|
2. 配置HertzBeat的配置文件 hertzbeat/config/application.yml
|
||||||
3. 部署启动 `$ ./startup.sh `
|
3. 部署启动 `$ ./startup.sh `
|
||||||
|
|
||||||
详细步骤参考 [通过安装包安装HertzBeat](https://hertzbeat.com/docs/start/package-deploy)
|
详细步骤参考 [通过安装包安装HertzBeat](https://hertzbeat.com/docs/start/package-deploy)
|
||||||
|
|
||||||
|
##### 方式三:本地代码启动
|
||||||
|
1. 此为前后端分离项目,本地代码调试需要分别启动后端工程manager和前端工程web-app
|
||||||
|
2. 后端:需要`maven3+`和`java8+`环境,修改YML配置信息并启动manager服务
|
||||||
|
3. 前端:需要`nodejs npm angular-cli`环境,待本地后端启动后,在web-app目录下启动 `ng serve --open`
|
||||||
|
4. 浏览器访问 localhost:4200 即可开始,默认账号密码 admin/admin
|
||||||
|
|
||||||
|
详细步骤参考 [参与贡献之本地代码启动](CONTRIBUTING.md)
|
||||||
|
|
||||||
|
##### 方式四:Docker-compose统一安装hertzbeat及其依赖服务
|
||||||
|
|
||||||
|
通过 [docker-compose部署脚本](script/docker-compose) 一次性把mysql数据库,tdengine数据库和hertzbeat安装部署。
|
||||||
|
|
||||||
|
详细步骤参考 [docker-compose安装](script/docker-compose/README.md)
|
||||||
|
|
||||||
**HAVE FUN**
|
**HAVE FUN**
|
||||||
|
|
||||||
## 💬 社区交流
|
## 💬 社区交流
|
||||||
@@ -123,7 +138,8 @@ HertzBeat赫兹跳动为 [Dromara开源社区](https://dromara.org/) 孵化项
|
|||||||
|
|
||||||
##### 赞助
|
##### 赞助
|
||||||
|
|
||||||
感谢[吉实信息(构建全新的微波+光交易网络)](https://www.flarespeed.com)赞助服务器采集节点
|
感谢[吉实信息(构建全新的微波+光交易网络)](https://www.flarespeed.com) 赞助服务器采集节点
|
||||||
|
感谢[天上云计算(全新智慧上云)](https://www.tsyvps.com/aff/BZBEGYLX) 赞助服务器采集节点
|
||||||
|
|
||||||
## 🛡️ License
|
## 🛡️ License
|
||||||
[`Apache License, Version 2.0`](https://www.apache.org/licenses/LICENSE-2.0.html)
|
[`Apache License, Version 2.0`](https://www.apache.org/licenses/LICENSE-2.0.html)
|
||||||
|
|||||||
@@ -138,32 +138,24 @@ public class CalculateAlarm {
|
|||||||
}
|
}
|
||||||
List<CollectRep.Field> fields = metricsData.getFieldsList();
|
List<CollectRep.Field> fields = metricsData.getFieldsList();
|
||||||
Map<String, Object> fieldValueMap = new HashMap<>(16);
|
Map<String, Object> fieldValueMap = new HashMap<>(16);
|
||||||
fieldValueMap.put("app", app);
|
|
||||||
fieldValueMap.put("metrics", metrics);
|
|
||||||
for (CollectRep.ValueRow valueRow : metricsData.getValuesList()) {
|
for (CollectRep.ValueRow valueRow : metricsData.getValuesList()) {
|
||||||
if (!valueRow.getColumnsList().isEmpty()) {
|
if (!valueRow.getColumnsList().isEmpty()) {
|
||||||
|
fieldValueMap.clear();
|
||||||
String instance = valueRow.getInstance();
|
String instance = valueRow.getInstance();
|
||||||
if (!"".equals(instance)) {
|
if (!"".equals(instance)) {
|
||||||
fieldValueMap.put("instance", instance);
|
fieldValueMap.put("instance", instance);
|
||||||
} else {
|
|
||||||
fieldValueMap.remove("instance");
|
|
||||||
}
|
}
|
||||||
for (int index = 0; index < valueRow.getColumnsList().size(); index++) {
|
for (int index = 0; index < valueRow.getColumnsList().size(); index++) {
|
||||||
String valueStr = valueRow.getColumns(index);
|
String valueStr = valueRow.getColumns(index);
|
||||||
CollectRep.Field field = fields.get(index);
|
CollectRep.Field field = fields.get(index);
|
||||||
fieldValueMap.put("metric", field.getName());
|
|
||||||
if (field.getType() == CommonConstants.TYPE_NUMBER) {
|
if (field.getType() == CommonConstants.TYPE_NUMBER) {
|
||||||
Double doubleValue = CommonUtil.parseDoubleStr(valueStr);
|
Double doubleValue = CommonUtil.parseDoubleStr(valueStr);
|
||||||
if (doubleValue != null) {
|
if (doubleValue != null) {
|
||||||
fieldValueMap.put(field.getName(), doubleValue);
|
fieldValueMap.put(field.getName(), doubleValue);
|
||||||
} else {
|
|
||||||
fieldValueMap.remove(field.getName());
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!"".equals(valueStr)) {
|
if (!"".equals(valueStr)) {
|
||||||
fieldValueMap.put(field.getName(), valueStr);
|
fieldValueMap.put(field.getName(), valueStr);
|
||||||
} else {
|
|
||||||
fieldValueMap.remove(field.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,6 +179,9 @@ public class CalculateAlarm {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int times = 1;
|
int times = 1;
|
||||||
|
fieldValueMap.put("app", app);
|
||||||
|
fieldValueMap.put("metrics", metrics);
|
||||||
|
fieldValueMap.put("metric", define.getField());
|
||||||
Alert alert = Alert.builder()
|
Alert alert = Alert.builder()
|
||||||
.monitorId(monitorId)
|
.monitorId(monitorId)
|
||||||
.alertDefineId(define.getId())
|
.alertDefineId(define.getId())
|
||||||
|
|||||||
@@ -91,6 +91,30 @@
|
|||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<version>8.0.27</version>
|
<version>8.0.27</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- postgresql -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<version>42.3.3</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- linux ssh -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.sshd</groupId>
|
||||||
|
<artifactId>sshd-core</artifactId>
|
||||||
|
<version>2.8.0</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- sql server -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.microsoft.sqlserver</groupId>
|
||||||
|
<artifactId>mssql-jdbc</artifactId>
|
||||||
|
<version>10.2.0.jre8</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- oracle -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.oracle.database.jdbc</groupId>
|
||||||
|
<artifactId>ojdbc8</artifactId>
|
||||||
|
<version>21.5.0.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -2,6 +2,7 @@ package com.usthe.collector.collect.common.cache;
|
|||||||
|
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存key唯一标识符
|
* 缓存key唯一标识符
|
||||||
@@ -10,6 +11,7 @@ import lombok.Data;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
|
@ToString
|
||||||
public class CacheIdentifier {
|
public class CacheIdentifier {
|
||||||
|
|
||||||
private String ip;
|
private String ip;
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class CommonCache {
|
public class CommonCache {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认缓存时间 30minute
|
* 默认缓存时间 800s
|
||||||
*/
|
*/
|
||||||
private static final long DEFAULT_CACHE_TIMEOUT = 30 * 60 * 1000L;
|
private static final long DEFAULT_CACHE_TIMEOUT = 800 * 1000L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认最大缓存数量
|
* 默认最大缓存数量
|
||||||
@@ -121,15 +121,17 @@ public class CommonCache {
|
|||||||
timeoutMap.put(key, new Long[]{currentTime, DEFAULT_CACHE_TIMEOUT});
|
timeoutMap.put(key, new Long[]{currentTime, DEFAULT_CACHE_TIMEOUT});
|
||||||
} else if (cacheTime[0] + cacheTime[1] < currentTime) {
|
} else if (cacheTime[0] + cacheTime[1] < currentTime) {
|
||||||
// 过期了 discard 关闭这个cache的资源
|
// 过期了 discard 关闭这个cache的资源
|
||||||
|
log.warn("[cache] clean the timeout cache, key {}", key);
|
||||||
timeoutMap.remove(key);
|
timeoutMap.remove(key);
|
||||||
cacheMap.remove(key);
|
cacheMap.remove(key);
|
||||||
if (value instanceof CacheCloseable) {
|
if (value instanceof CacheCloseable) {
|
||||||
|
log.warn("[cache] close the timeout cache, key {}", key);
|
||||||
((CacheCloseable)value).close();
|
((CacheCloseable)value).close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("clean timeout cache error: {}.", e.getMessage(), e);
|
log.error("[cache] clean timeout cache error: {}.", e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,6 +157,15 @@ public class CommonCache {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增或更新cache
|
||||||
|
* @param key 存储对象key
|
||||||
|
* @param value 存储对象
|
||||||
|
*/
|
||||||
|
public void addCache(Object key, Object value) {
|
||||||
|
addCache(key, value, DEFAULT_CACHE_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据缓存key获取缓存对象
|
* 根据缓存key获取缓存对象
|
||||||
* @param key key
|
* @param key key
|
||||||
@@ -164,15 +175,18 @@ public class CommonCache {
|
|||||||
public Optional<Object> getCache(Object key, boolean refreshCache) {
|
public Optional<Object> getCache(Object key, boolean refreshCache) {
|
||||||
Long[] cacheTime = timeoutMap.get(key);
|
Long[] cacheTime = timeoutMap.get(key);
|
||||||
if (cacheTime == null || cacheTime.length != CACHE_TIME_LENGTH) {
|
if (cacheTime == null || cacheTime.length != CACHE_TIME_LENGTH) {
|
||||||
|
log.warn("[cache] not hit the cache, key {}.", key);
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
if (cacheTime[0] + cacheTime[1] < System.currentTimeMillis()) {
|
if (cacheTime[0] + cacheTime[1] < System.currentTimeMillis()) {
|
||||||
|
log.warn("[cache] is timeout, remove it, key {}.", key);
|
||||||
timeoutMap.remove(key);
|
timeoutMap.remove(key);
|
||||||
cacheMap.remove(key);
|
cacheMap.remove(key);
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
Object value = cacheMap.get(key);
|
Object value = cacheMap.get(key);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
log.error("[cache] value is null, remove it, key {}.", key);
|
||||||
cacheMap.remove(key);
|
cacheMap.remove(key);
|
||||||
timeoutMap.remove(key);
|
timeoutMap.remove(key);
|
||||||
} else if (refreshCache) {
|
} else if (refreshCache) {
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ import javax.net.ssl.SSLContext;
|
|||||||
import javax.net.ssl.TrustManager;
|
import javax.net.ssl.TrustManager;
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
import java.security.cert.CertificateException;
|
import java.security.cert.CertificateException;
|
||||||
|
import java.security.cert.CertificateExpiredException;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,7 +77,18 @@ public class CommonHttpClient {
|
|||||||
@Override
|
@Override
|
||||||
public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { }
|
public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { }
|
||||||
@Override
|
@Override
|
||||||
public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { }
|
public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
|
||||||
|
// 判断服务器证书有效期时间
|
||||||
|
Date now = new Date();
|
||||||
|
if (x509Certificates != null && x509Certificates.length > 0) {
|
||||||
|
for (X509Certificate certificate : x509Certificates) {
|
||||||
|
Date deadline = certificate.getNotAfter();
|
||||||
|
if (deadline != null && now.after(deadline)) {
|
||||||
|
throw new CertificateExpiredException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public X509Certificate[] getAcceptedIssuers() { return null; }
|
public X509Certificate[] getAcceptedIssuers() { return null; }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.usthe.collector.collect.common.ssh;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.sshd.client.SshClient;
|
||||||
|
import org.apache.sshd.client.keyverifier.AcceptAllServerKeyVerifier;
|
||||||
|
import org.apache.sshd.common.PropertyResolverUtils;
|
||||||
|
import org.apache.sshd.core.CoreModuleProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ssh公共client
|
||||||
|
* @author tom
|
||||||
|
* @date 2022/3/11 15:58
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class CommonSshClient {
|
||||||
|
|
||||||
|
private static SshClient sshClient;
|
||||||
|
|
||||||
|
|
||||||
|
static {
|
||||||
|
sshClient = SshClient.setUpDefaultClient();
|
||||||
|
// 接受所有服务端公钥校验,会打印warn日志 Server at {} presented unverified {} key: {}
|
||||||
|
AcceptAllServerKeyVerifier verifier = AcceptAllServerKeyVerifier.INSTANCE;
|
||||||
|
sshClient.setServerKeyVerifier(verifier);
|
||||||
|
// 设置链接保活心跳10000毫秒一次, 客户端等待保活心跳超时响应时间3000毫秒
|
||||||
|
PropertyResolverUtils.updateProperty(
|
||||||
|
sshClient, CoreModuleProperties.HEARTBEAT_INTERVAL.getName(), 10000);
|
||||||
|
PropertyResolverUtils.updateProperty(
|
||||||
|
sshClient, CoreModuleProperties.HEARTBEAT_REPLY_WAIT.getName(), 3000);
|
||||||
|
sshClient.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SshClient getSshClient() {
|
||||||
|
return sshClient;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ import com.usthe.common.entity.job.protocol.JdbcProtocol;
|
|||||||
import com.usthe.common.entity.message.CollectRep;
|
import com.usthe.common.entity.message.CollectRep;
|
||||||
import com.usthe.common.util.CommonConstants;
|
import com.usthe.common.util.CommonConstants;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.postgresql.util.PSQLException;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
@@ -51,9 +52,19 @@ public class JdbcCommonCollect extends AbstractCollect {
|
|||||||
}
|
}
|
||||||
JdbcProtocol jdbcProtocol = metrics.getJdbc();
|
JdbcProtocol jdbcProtocol = metrics.getJdbc();
|
||||||
String databaseUrl = constructDatabaseUrl(jdbcProtocol);
|
String databaseUrl = constructDatabaseUrl(jdbcProtocol);
|
||||||
|
// 查询超时时间默认6000毫秒
|
||||||
|
int timeout = 6000;
|
||||||
|
try {
|
||||||
|
// 获取查询语句超时时间
|
||||||
|
if (jdbcProtocol.getTimeout() != null) {
|
||||||
|
timeout = Integer.parseInt(jdbcProtocol.getTimeout());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn(e.getMessage());
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
Statement statement = getConnection(jdbcProtocol.getUsername(),
|
Statement statement = getConnection(jdbcProtocol.getUsername(),
|
||||||
jdbcProtocol.getPassword(), databaseUrl);
|
jdbcProtocol.getPassword(), databaseUrl, timeout);
|
||||||
switch (jdbcProtocol.getQueryType()) {
|
switch (jdbcProtocol.getQueryType()) {
|
||||||
case QUERY_TYPE_ONE_ROW:
|
case QUERY_TYPE_ONE_ROW:
|
||||||
queryOneRow(statement, jdbcProtocol.getSql(), metrics.getAliasFields(), builder, startTime);
|
queryOneRow(statement, jdbcProtocol.getSql(), metrics.getAliasFields(), builder, startTime);
|
||||||
@@ -72,7 +83,16 @@ public class JdbcCommonCollect extends AbstractCollect {
|
|||||||
} catch (CommunicationsException communicationsException) {
|
} catch (CommunicationsException communicationsException) {
|
||||||
log.warn("Jdbc sql error: {}, code: {}.", communicationsException.getMessage(), communicationsException.getErrorCode());
|
log.warn("Jdbc sql error: {}, code: {}.", communicationsException.getMessage(), communicationsException.getErrorCode());
|
||||||
builder.setCode(CollectRep.Code.UN_REACHABLE);
|
builder.setCode(CollectRep.Code.UN_REACHABLE);
|
||||||
builder.setMsg("Query Error: " + communicationsException.getMessage() + " Code: " + communicationsException.getErrorCode());
|
builder.setMsg("Error: " + communicationsException.getMessage() + " Code: " + communicationsException.getErrorCode());
|
||||||
|
} catch (PSQLException psqlException) {
|
||||||
|
// for PostgreSQL 08001
|
||||||
|
if (CollectorConstants.POSTGRESQL_UN_REACHABLE_CODE.equals(psqlException.getSQLState())) {
|
||||||
|
// 对端链接失败 不可达
|
||||||
|
builder.setCode(CollectRep.Code.UN_REACHABLE);
|
||||||
|
} else {
|
||||||
|
builder.setCode(CollectRep.Code.FAIL);
|
||||||
|
}
|
||||||
|
builder.setMsg("Error: " + psqlException.getMessage() + " Code: " + psqlException.getSQLState());
|
||||||
} catch (SQLException sqlException) {
|
} catch (SQLException sqlException) {
|
||||||
log.warn("Jdbc sql error: {}, code: {}.", sqlException.getMessage(), sqlException.getErrorCode());
|
log.warn("Jdbc sql error: {}, code: {}.", sqlException.getMessage(), sqlException.getErrorCode());
|
||||||
builder.setCode(CollectRep.Code.FAIL);
|
builder.setCode(CollectRep.Code.FAIL);
|
||||||
@@ -85,7 +105,7 @@ public class JdbcCommonCollect extends AbstractCollect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Statement getConnection(String username, String password, String url) throws Exception {
|
private Statement getConnection(String username, String password, String url,Integer timeout) throws Exception {
|
||||||
CacheIdentifier identifier = CacheIdentifier.builder()
|
CacheIdentifier identifier = CacheIdentifier.builder()
|
||||||
.ip(url)
|
.ip(url)
|
||||||
.username(username).password(password).build();
|
.username(username).password(password).build();
|
||||||
@@ -96,7 +116,9 @@ public class JdbcCommonCollect extends AbstractCollect {
|
|||||||
try {
|
try {
|
||||||
statement = jdbcConnect.getConnection().createStatement();
|
statement = jdbcConnect.getConnection().createStatement();
|
||||||
// 设置查询超时时间10秒
|
// 设置查询超时时间10秒
|
||||||
statement.setQueryTimeout(10);
|
int timeoutSecond = timeout / 1000;
|
||||||
|
timeoutSecond = timeoutSecond <= 0 ? 1 : timeoutSecond;
|
||||||
|
statement.setQueryTimeout(timeoutSecond);
|
||||||
// 设置查询最大行数1000行
|
// 设置查询最大行数1000行
|
||||||
statement.setMaxRows(1000);
|
statement.setMaxRows(1000);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -120,11 +142,13 @@ public class JdbcCommonCollect extends AbstractCollect {
|
|||||||
Connection connection = DriverManager.getConnection(url, username, password);
|
Connection connection = DriverManager.getConnection(url, username, password);
|
||||||
statement = connection.createStatement();
|
statement = connection.createStatement();
|
||||||
// 设置查询超时时间10秒
|
// 设置查询超时时间10秒
|
||||||
statement.setQueryTimeout(10);
|
int timeoutSecond = timeout / 1000;
|
||||||
|
timeoutSecond = timeoutSecond <= 0 ? 1 : timeoutSecond;
|
||||||
|
statement.setQueryTimeout(timeoutSecond);
|
||||||
// 设置查询最大行数1000行
|
// 设置查询最大行数1000行
|
||||||
statement.setMaxRows(1000);
|
statement.setMaxRows(1000);
|
||||||
JdbcConnect jdbcConnect = new JdbcConnect(connection);
|
JdbcConnect jdbcConnect = new JdbcConnect(connection);
|
||||||
CommonCache.getInstance().addCache(identifier, jdbcConnect, 10000L);
|
CommonCache.getInstance().addCache(identifier, jdbcConnect);
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +204,7 @@ public class JdbcCommonCollect extends AbstractCollect {
|
|||||||
HashMap<String, String> values = new HashMap<>(columns.size());
|
HashMap<String, String> values = new HashMap<>(columns.size());
|
||||||
while (resultSet.next()) {
|
while (resultSet.next()) {
|
||||||
if (resultSet.getString(1) != null) {
|
if (resultSet.getString(1) != null) {
|
||||||
values.put(resultSet.getString(1).toLowerCase(), resultSet.getString(2));
|
values.put(resultSet.getString(1).toLowerCase().trim(), resultSet.getString(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder();
|
CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder();
|
||||||
@@ -253,6 +277,18 @@ public class JdbcCommonCollect extends AbstractCollect {
|
|||||||
+ "/" + (jdbcProtocol.getDatabase() == null ? "" : jdbcProtocol.getDatabase())
|
+ "/" + (jdbcProtocol.getDatabase() == null ? "" : jdbcProtocol.getDatabase())
|
||||||
+ "?useUnicode=true&characterEncoding=utf-8&useSSL=false";
|
+ "?useUnicode=true&characterEncoding=utf-8&useSSL=false";
|
||||||
break;
|
break;
|
||||||
|
case "postgresql":
|
||||||
|
url = "jdbc:postgresql://" + jdbcProtocol.getHost() + ":" + jdbcProtocol.getPort()
|
||||||
|
+ "/" + (jdbcProtocol.getDatabase() == null ? "" : jdbcProtocol.getDatabase());
|
||||||
|
break;
|
||||||
|
case "sqlserver":
|
||||||
|
url = "jdbc:sqlserver://" + jdbcProtocol.getHost() + ":" + jdbcProtocol.getPort()
|
||||||
|
+ ";" + (jdbcProtocol.getDatabase() == null ? "" : "DatabaseName=" + jdbcProtocol.getDatabase());
|
||||||
|
break;
|
||||||
|
case "oracle":
|
||||||
|
url = "jdbc:oracle:thin:@" + jdbcProtocol.getHost() + ":" + jdbcProtocol.getPort()
|
||||||
|
+ "/" + (jdbcProtocol.getDatabase() == null ? "" : jdbcProtocol.getDatabase());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Not support database platform: " + jdbcProtocol.getPlatform());
|
throw new IllegalArgumentException("Not support database platform: " + jdbcProtocol.getPlatform());
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.usthe.collector.collect.database;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预加载jdbc驱动包 避免spi并发加载造成死锁
|
||||||
|
* @author tom
|
||||||
|
* @date 2022/3/19 15:39
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
@Order(value = 0)
|
||||||
|
public class JdbcSpiLoader implements CommandLineRunner {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(String... args) throws Exception {
|
||||||
|
log.info("start load jdbc drivers");
|
||||||
|
try {
|
||||||
|
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||||
|
Class.forName("org.postgresql.Driver");
|
||||||
|
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
|
||||||
|
Class.forName("oracle.jdbc.driver.OracleDriver");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("load jdbc error: {}", e.getMessage(), e);
|
||||||
|
}
|
||||||
|
log.info("end load jdbc drivers");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -406,7 +406,11 @@ public class HttpCollectImpl extends AbstractCollect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// headers
|
// The default request header can be overridden if customized
|
||||||
|
// keep-alive
|
||||||
|
requestBuilder.addHeader(HttpHeaders.CONNECTION, "keep-alive");
|
||||||
|
requestBuilder.addHeader(HttpHeaders.USER_AGENT,"Mozilla/5.0 (Windows NT 6.1; WOW64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.76 Safari/537.36");
|
||||||
|
// headers The custom request header is overwritten here
|
||||||
Map<String, String> headers = httpProtocol.getHeaders();
|
Map<String, String> headers = httpProtocol.getHeaders();
|
||||||
if (headers != null && !headers.isEmpty()) {
|
if (headers != null && !headers.isEmpty()) {
|
||||||
for (Map.Entry<String, String> header : headers.entrySet()) {
|
for (Map.Entry<String, String> header : headers.entrySet()) {
|
||||||
@@ -415,8 +419,6 @@ public class HttpCollectImpl extends AbstractCollect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// keep-alive
|
|
||||||
requestBuilder.addHeader(HttpHeaders.CONNECTION, "keep-alive");
|
|
||||||
// add accept
|
// add accept
|
||||||
if (DispatchConstants.PARSE_DEFAULT.equals(httpProtocol.getParseType())
|
if (DispatchConstants.PARSE_DEFAULT.equals(httpProtocol.getParseType())
|
||||||
|| DispatchConstants.PARSE_JSON_PATH.equals(httpProtocol.getParseType())) {
|
|| DispatchConstants.PARSE_JSON_PATH.equals(httpProtocol.getParseType())) {
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ public class IcmpCollectImpl extends AbstractCollect {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IcmpProtocol icmp = metrics.getIcmp();
|
IcmpProtocol icmp = metrics.getIcmp();
|
||||||
// 超时时间默认300毫秒
|
// 超时时间默认6000毫秒
|
||||||
int timeout = 300;
|
int timeout = 6000;
|
||||||
try {
|
try {
|
||||||
timeout = Integer.parseInt(icmp.getTimeout());
|
timeout = Integer.parseInt(icmp.getTimeout());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -0,0 +1,211 @@
|
|||||||
|
package com.usthe.collector.collect.ssh;
|
||||||
|
|
||||||
|
import com.usthe.collector.collect.AbstractCollect;
|
||||||
|
import com.usthe.collector.collect.common.cache.CacheIdentifier;
|
||||||
|
import com.usthe.collector.collect.common.cache.CommonCache;
|
||||||
|
import com.usthe.collector.collect.common.ssh.CommonSshClient;
|
||||||
|
import com.usthe.collector.util.CollectorConstants;
|
||||||
|
import com.usthe.collector.util.KeyPairUtil;
|
||||||
|
import com.usthe.common.entity.job.Metrics;
|
||||||
|
import com.usthe.common.entity.job.protocol.SshProtocol;
|
||||||
|
import com.usthe.common.entity.message.CollectRep;
|
||||||
|
import com.usthe.common.util.CommonConstants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.sshd.client.SshClient;
|
||||||
|
import org.apache.sshd.client.channel.ClientChannel;
|
||||||
|
import org.apache.sshd.client.channel.ClientChannelEvent;
|
||||||
|
import org.apache.sshd.client.session.ClientSession;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.ConnectException;
|
||||||
|
import java.security.KeyPair;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ssh协议采集实现
|
||||||
|
* @author tom
|
||||||
|
* @date 2022/03/11 15:10
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class SshCollectImpl extends AbstractCollect {
|
||||||
|
|
||||||
|
private static final String PARSE_TYPE_ONE_ROW = "oneRow";
|
||||||
|
private static final String PARSE_TYPE_MULTI_ROW = "multiRow";
|
||||||
|
|
||||||
|
private SshCollectImpl(){}
|
||||||
|
|
||||||
|
public static SshCollectImpl getInstance() {
|
||||||
|
return SshCollectImpl.Singleton.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collect(CollectRep.MetricsData.Builder builder, long appId, String app, Metrics metrics) {
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
// 校验参数
|
||||||
|
try {
|
||||||
|
validateParams(metrics);
|
||||||
|
} catch (Exception e) {
|
||||||
|
builder.setCode(CollectRep.Code.FAIL);
|
||||||
|
builder.setMsg(e.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SshProtocol sshProtocol = metrics.getSsh();
|
||||||
|
// 超时时间默认6000毫秒
|
||||||
|
int timeout = 6000;
|
||||||
|
try {
|
||||||
|
timeout = Integer.parseInt(sshProtocol.getTimeout());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn(e.getMessage());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ClientSession clientSession = getConnectSession(sshProtocol, timeout);
|
||||||
|
ClientChannel channel = clientSession.createExecChannel(sshProtocol.getScript());
|
||||||
|
ByteArrayOutputStream response = new ByteArrayOutputStream();
|
||||||
|
channel.setOut(response);
|
||||||
|
if (!channel.open().verify(timeout).isOpened()) {
|
||||||
|
throw new Exception("open failed");
|
||||||
|
}
|
||||||
|
List<ClientChannelEvent> list = new ArrayList<>();
|
||||||
|
list.add(ClientChannelEvent.CLOSED);
|
||||||
|
channel.waitFor(list, timeout);
|
||||||
|
Long responseTime = System.currentTimeMillis() - startTime;
|
||||||
|
channel.close();
|
||||||
|
String result = response.toString();
|
||||||
|
if (!StringUtils.hasText(result)) {
|
||||||
|
builder.setCode(CollectRep.Code.FAIL);
|
||||||
|
builder.setMsg("采集数据失败");
|
||||||
|
}
|
||||||
|
switch (sshProtocol.getParseType()) {
|
||||||
|
case PARSE_TYPE_ONE_ROW:
|
||||||
|
parseResponseDataByOne(result, metrics.getAliasFields(), builder, responseTime);
|
||||||
|
break;
|
||||||
|
default: parseResponseDataByMulti(result, metrics.getAliasFields(), builder, responseTime);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (ConnectException connectException) {
|
||||||
|
log.debug(connectException.getMessage());
|
||||||
|
builder.setCode(CollectRep.Code.UN_CONNECTABLE);
|
||||||
|
builder.setMsg("对端拒绝连接:服务未启动端口监听或防火墙");
|
||||||
|
} catch (IOException ioException) {
|
||||||
|
log.debug(ioException.getMessage());
|
||||||
|
builder.setCode(CollectRep.Code.UN_CONNECTABLE);
|
||||||
|
builder.setMsg("对端连接失败 " + ioException.getMessage());
|
||||||
|
} catch (Exception exception) {
|
||||||
|
log.debug(exception.getMessage());
|
||||||
|
builder.setCode(CollectRep.Code.FAIL);
|
||||||
|
builder.setMsg(exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseResponseDataByOne(String result, List<String> aliasFields, CollectRep.MetricsData.Builder builder, Long responseTime) {
|
||||||
|
String[] lines = result.split("\n");
|
||||||
|
if (lines.length + 1 < aliasFields.size()) {
|
||||||
|
log.error("ssh response data not enough: {}", result);
|
||||||
|
}
|
||||||
|
CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder();
|
||||||
|
int aliasIndex = 0;
|
||||||
|
int lineIndex = 0;
|
||||||
|
while (aliasIndex < aliasFields.size()) {
|
||||||
|
if (CollectorConstants.RESPONSE_TIME.equalsIgnoreCase(aliasFields.get(aliasIndex))) {
|
||||||
|
valueRowBuilder.addColumns(responseTime.toString());
|
||||||
|
} else {
|
||||||
|
valueRowBuilder.addColumns(lines[lineIndex].trim());
|
||||||
|
lineIndex++;
|
||||||
|
}
|
||||||
|
aliasIndex++;
|
||||||
|
}
|
||||||
|
builder.addValues(valueRowBuilder.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseResponseDataByMulti(String result, List<String> aliasFields,
|
||||||
|
CollectRep.MetricsData.Builder builder, Long responseTime) {
|
||||||
|
String[] lines = result.split("\n");
|
||||||
|
if (lines.length <= 1) {
|
||||||
|
log.error("ssh response data only has header: {}", result);
|
||||||
|
}
|
||||||
|
String[] fields = lines[0].split(" ");
|
||||||
|
Map<String, Integer> fieldMapping = new HashMap<>(fields.length);
|
||||||
|
for (int i = 0; i < fields.length; i++) {
|
||||||
|
fieldMapping.put(fields[i].trim().toLowerCase(), i);
|
||||||
|
}
|
||||||
|
for (int i = 1; i < lines.length; i++) {
|
||||||
|
String[] values = lines[i].split(" ");
|
||||||
|
CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder();
|
||||||
|
for (String alias : aliasFields) {
|
||||||
|
if (CollectorConstants.RESPONSE_TIME.equalsIgnoreCase(alias)) {
|
||||||
|
valueRowBuilder.addColumns(responseTime.toString());
|
||||||
|
} else {
|
||||||
|
Integer index = fieldMapping.get(alias.toLowerCase());
|
||||||
|
if (index != null && index < values.length) {
|
||||||
|
valueRowBuilder.addColumns(values[index]);
|
||||||
|
} else {
|
||||||
|
valueRowBuilder.addColumns(CommonConstants.NULL_VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
builder.addValues(valueRowBuilder.build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ClientSession getConnectSession(SshProtocol sshProtocol, int timeout) throws IOException {
|
||||||
|
CacheIdentifier identifier = CacheIdentifier.builder()
|
||||||
|
.ip(sshProtocol.getHost()).port(sshProtocol.getPort())
|
||||||
|
.username(sshProtocol.getUsername()).password(sshProtocol.getPassword())
|
||||||
|
.build();
|
||||||
|
Optional<Object> cacheOption = CommonCache.getInstance().getCache(identifier, true);
|
||||||
|
ClientSession clientSession = null;
|
||||||
|
if (cacheOption.isPresent()) {
|
||||||
|
clientSession = (ClientSession) cacheOption.get();
|
||||||
|
try {
|
||||||
|
if (clientSession.isClosed() || clientSession.isClosing()) {
|
||||||
|
clientSession = null;
|
||||||
|
CommonCache.getInstance().removeCache(identifier);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn(e.getMessage());
|
||||||
|
clientSession = null;
|
||||||
|
CommonCache.getInstance().removeCache(identifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (clientSession != null) {
|
||||||
|
return clientSession;
|
||||||
|
}
|
||||||
|
SshClient sshClient = CommonSshClient.getSshClient();
|
||||||
|
clientSession = sshClient.connect(sshProtocol.getUsername(), sshProtocol.getHost(), Integer.parseInt(sshProtocol.getPort()))
|
||||||
|
.verify(timeout, TimeUnit.MILLISECONDS).getSession();
|
||||||
|
if (StringUtils.hasText(sshProtocol.getPassword())) {
|
||||||
|
clientSession.addPasswordIdentity(sshProtocol.getPassword());
|
||||||
|
} else if (StringUtils.hasText(sshProtocol.getPublicKey())) {
|
||||||
|
KeyPair keyPair = KeyPairUtil.getKeyPairFromPublicKey(sshProtocol.getPublicKey());
|
||||||
|
if (keyPair != null) {
|
||||||
|
clientSession.addPublicKeyIdentity(keyPair);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("需填写账户登陆密码或公钥");
|
||||||
|
}
|
||||||
|
// 进行认证
|
||||||
|
if (!clientSession.auth().verify(timeout, TimeUnit.MILLISECONDS).isSuccess()) {
|
||||||
|
throw new IllegalArgumentException("认证失败");
|
||||||
|
}
|
||||||
|
CommonCache.getInstance().addCache(identifier, clientSession);
|
||||||
|
return clientSession;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateParams(Metrics metrics) throws Exception {
|
||||||
|
if (metrics == null || metrics.getSsh() == null) {
|
||||||
|
throw new Exception("Ssh collect must has ssh params");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class Singleton {
|
||||||
|
private static final SshCollectImpl INSTANCE = new SshCollectImpl();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ import java.io.IOException;
|
|||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* icmp协议采集实现 - ping
|
* telnet协议采集实现
|
||||||
* @author tom
|
* @author tom
|
||||||
* @date 2021/12/4 12:32
|
* @date 2021/12/4 12:32
|
||||||
*/
|
*/
|
||||||
@@ -38,8 +38,8 @@ public class TelnetCollectImpl extends AbstractCollect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TelnetProtocol telnet = metrics.getTelnet();
|
TelnetProtocol telnet = metrics.getTelnet();
|
||||||
// 超时时间默认300毫秒
|
// 超时时间默认6000毫秒
|
||||||
int timeout = 300;
|
int timeout = 6000;
|
||||||
try {
|
try {
|
||||||
timeout = Integer.parseInt(telnet.getTimeout());
|
timeout = Integer.parseInt(telnet.getTimeout());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class CommonDispatcher implements MetricsTaskDispatch, CollectDataDispatc
|
|||||||
/**
|
/**
|
||||||
* 指标组采集任务超时时间值
|
* 指标组采集任务超时时间值
|
||||||
*/
|
*/
|
||||||
private static final long DURATION_TIME = 120_000L;
|
private static final long DURATION_TIME = 240_000L;
|
||||||
/**
|
/**
|
||||||
* 指标组采集任务优先级队列
|
* 指标组采集任务优先级队列
|
||||||
*/
|
*/
|
||||||
@@ -94,7 +94,7 @@ public class CommonDispatcher implements MetricsTaskDispatch, CollectDataDispatc
|
|||||||
Thread.currentThread().setName("metrics-task-monitor");
|
Thread.currentThread().setName("metrics-task-monitor");
|
||||||
while (!Thread.currentThread().isInterrupted()) {
|
while (!Thread.currentThread().isInterrupted()) {
|
||||||
try {
|
try {
|
||||||
// 检测每个指标组采集单元是否超时2分钟,超时则丢弃并返回异常
|
// 检测每个指标组采集单元是否超时4分钟,超时则丢弃并返回异常
|
||||||
long deadline = System.currentTimeMillis() - DURATION_TIME;
|
long deadline = System.currentTimeMillis() - DURATION_TIME;
|
||||||
for (Map.Entry<String, MetricsTime> entry : metricsTimeoutMonitorMap.entrySet()) {
|
for (Map.Entry<String, MetricsTime> entry : metricsTimeoutMonitorMap.entrySet()) {
|
||||||
MetricsTime metricsTime = entry.getValue();
|
MetricsTime metricsTime = entry.getValue();
|
||||||
@@ -165,7 +165,7 @@ public class CommonDispatcher implements MetricsTaskDispatch, CollectDataDispatc
|
|||||||
metricsSet.forEach(metricItem -> {
|
metricsSet.forEach(metricItem -> {
|
||||||
MetricsCollect metricsCollect = new MetricsCollect(metricItem, timeout, this);
|
MetricsCollect metricsCollect = new MetricsCollect(metricItem, timeout, this);
|
||||||
jobRequestQueue.addJob(metricsCollect);
|
jobRequestQueue.addJob(metricsCollect);
|
||||||
metricsTimeoutMonitorMap.put(job.getId() + metrics.getName(),
|
metricsTimeoutMonitorMap.put(job.getId() + "-" + metrics.getName(),
|
||||||
new MetricsTime(System.currentTimeMillis(), metrics, timeout));
|
new MetricsTime(System.currentTimeMillis(), metrics, timeout));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -185,7 +185,7 @@ public class CommonDispatcher implements MetricsTaskDispatch, CollectDataDispatc
|
|||||||
metricsSet.forEach(metricItem -> {
|
metricsSet.forEach(metricItem -> {
|
||||||
MetricsCollect metricsCollect = new MetricsCollect(metricItem, timeout, this);
|
MetricsCollect metricsCollect = new MetricsCollect(metricItem, timeout, this);
|
||||||
jobRequestQueue.addJob(metricsCollect);
|
jobRequestQueue.addJob(metricsCollect);
|
||||||
metricsTimeoutMonitorMap.put(job.getId() + metrics.getName(),
|
metricsTimeoutMonitorMap.put(job.getId() + "-" + metrics.getName(),
|
||||||
new MetricsTime(System.currentTimeMillis(), metrics, timeout));
|
new MetricsTime(System.currentTimeMillis(), metrics, timeout));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ public interface DispatchConstants {
|
|||||||
* 协议 jdbc
|
* 协议 jdbc
|
||||||
*/
|
*/
|
||||||
String PROTOCOL_JDBC = "jdbc";
|
String PROTOCOL_JDBC = "jdbc";
|
||||||
|
/**
|
||||||
|
* 协议 ssh
|
||||||
|
*/
|
||||||
|
String PROTOCOL_SSH = "ssh";
|
||||||
// 协议类型相关 - end //
|
// 协议类型相关 - end //
|
||||||
|
|
||||||
// http协议相关 - start 需尽可能先复用 HttpHeaders //
|
// http协议相关 - start 需尽可能先复用 HttpHeaders //
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.usthe.collector.collect.AbstractCollect;
|
|||||||
import com.usthe.collector.collect.database.JdbcCommonCollect;
|
import com.usthe.collector.collect.database.JdbcCommonCollect;
|
||||||
import com.usthe.collector.collect.http.HttpCollectImpl;
|
import com.usthe.collector.collect.http.HttpCollectImpl;
|
||||||
import com.usthe.collector.collect.icmp.IcmpCollectImpl;
|
import com.usthe.collector.collect.icmp.IcmpCollectImpl;
|
||||||
|
import com.usthe.collector.collect.ssh.SshCollectImpl;
|
||||||
import com.usthe.collector.collect.telnet.TelnetCollectImpl;
|
import com.usthe.collector.collect.telnet.TelnetCollectImpl;
|
||||||
import com.usthe.collector.dispatch.timer.Timeout;
|
import com.usthe.collector.dispatch.timer.Timeout;
|
||||||
import com.usthe.collector.dispatch.timer.WheelTimerTask;
|
import com.usthe.collector.dispatch.timer.WheelTimerTask;
|
||||||
@@ -22,6 +23,7 @@ import java.util.HashMap;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,6 +113,9 @@ public class MetricsCollect implements Runnable, Comparable<MetricsCollect> {
|
|||||||
case DispatchConstants.PROTOCOL_JDBC:
|
case DispatchConstants.PROTOCOL_JDBC:
|
||||||
abstractCollect = JdbcCommonCollect.getInstance();
|
abstractCollect = JdbcCommonCollect.getInstance();
|
||||||
break;
|
break;
|
||||||
|
case DispatchConstants.PROTOCOL_SSH:
|
||||||
|
abstractCollect = SshCollectImpl.getInstance();
|
||||||
|
break;
|
||||||
// todo
|
// todo
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
@@ -168,14 +173,23 @@ public class MetricsCollect implements Runnable, Comparable<MetricsCollect> {
|
|||||||
if (metrics.getCalculates() == null) {
|
if (metrics.getCalculates() == null) {
|
||||||
metrics.setCalculates(Collections.emptyList());
|
metrics.setCalculates(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
// eg: database_pages=Database pages 非常规映射
|
||||||
|
Map<String, String> fieldAliasMap = new HashMap<>(8);
|
||||||
Map<String, Expression> fieldExpressionMap = metrics.getCalculates()
|
Map<String, Expression> fieldExpressionMap = metrics.getCalculates()
|
||||||
.stream()
|
.stream()
|
||||||
.map(cal -> {
|
.map(cal -> {
|
||||||
int splitIndex = cal.indexOf("=");
|
int splitIndex = cal.indexOf("=");
|
||||||
String field = cal.substring(0, splitIndex);
|
String field = cal.substring(0, splitIndex);
|
||||||
String expressionStr = cal.substring(splitIndex + 1);
|
String expressionStr = cal.substring(splitIndex + 1);
|
||||||
Expression expression = AviatorEvaluator.compile(expressionStr, true);
|
Expression expression = null;
|
||||||
|
try {
|
||||||
|
expression = AviatorEvaluator.compile(expressionStr, true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
fieldAliasMap.put(field, expressionStr);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return new Object[]{field, expression}; })
|
return new Object[]{field, expression}; })
|
||||||
|
.filter(Objects::nonNull)
|
||||||
.collect(Collectors.toMap(arr -> (String)arr[0], arr -> (Expression) arr[1]));
|
.collect(Collectors.toMap(arr -> (String)arr[0], arr -> (Expression) arr[1]));
|
||||||
|
|
||||||
List<Metrics.Field> fields = metrics.getFields();
|
List<Metrics.Field> fields = metrics.getFields();
|
||||||
@@ -222,7 +236,12 @@ public class MetricsCollect implements Runnable, Comparable<MetricsCollect> {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 不存在 则映射别名值
|
// 不存在 则映射别名值
|
||||||
value = aliasFieldValueMap.get(realField);
|
String aliasField = fieldAliasMap.get(realField);
|
||||||
|
if (aliasField != null) {
|
||||||
|
value = aliasFieldValueMap.get(aliasField);
|
||||||
|
} else {
|
||||||
|
value = aliasFieldValueMap.get(realField);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
value = CommonConstants.NULL_VALUE;
|
value = CommonConstants.NULL_VALUE;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.usthe.common.entity.job.Job;
|
|||||||
import com.usthe.common.entity.job.Metrics;
|
import com.usthe.common.entity.job.Metrics;
|
||||||
import com.usthe.common.util.AesUtil;
|
import com.usthe.common.util.AesUtil;
|
||||||
import com.usthe.common.util.CommonConstants;
|
import com.usthe.common.util.CommonConstants;
|
||||||
|
import com.usthe.common.util.GsonUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -84,6 +85,26 @@ public class WheelTimerTask implements TimerTask {
|
|||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Map.Entry<String, JsonElement> entry = iterator.next();
|
Map.Entry<String, JsonElement> entry = iterator.next();
|
||||||
JsonElement element = entry.getValue();
|
JsonElement element = entry.getValue();
|
||||||
|
String key = entry.getKey();
|
||||||
|
// 替换KEY-VALUE情况的属性 比如http headers params
|
||||||
|
if (key != null && key.startsWith("^_^") && key.endsWith("^_^")) {
|
||||||
|
key = key.replaceAll("\\^_\\^", "");
|
||||||
|
Configmap param = configmap.get(key);
|
||||||
|
if (param.getType() == (byte) 3) {
|
||||||
|
String jsonValue = (String) param.getValue();
|
||||||
|
Map<String, String> map = GsonUtil.fromJson(jsonValue, Map.class);
|
||||||
|
if (map != null) {
|
||||||
|
map.forEach((name, value) -> {
|
||||||
|
if (name != null && !"".equals(name.trim())) {
|
||||||
|
jsonObject.addProperty(name, value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
iterator.remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 替换正常的VALUE值
|
||||||
if (element.isJsonPrimitive()) {
|
if (element.isJsonPrimitive()) {
|
||||||
// 判断是否含有特殊字符 替换
|
// 判断是否含有特殊字符 替换
|
||||||
String value = element.getAsString();
|
String value = element.getAsString();
|
||||||
|
|||||||
@@ -14,4 +14,9 @@ public interface CollectorConstants {
|
|||||||
String ERROR_MSG = "errorMsg";
|
String ERROR_MSG = "errorMsg";
|
||||||
|
|
||||||
String URL = "url";
|
String URL = "url";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POSTGRESQL状态码 不可达
|
||||||
|
*/
|
||||||
|
String POSTGRESQL_UN_REACHABLE_CODE = "08001";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.usthe.collector.util;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.security.KeyFactory;
|
||||||
|
import java.security.KeyPair;
|
||||||
|
import java.security.PublicKey;
|
||||||
|
import java.security.spec.X509EncodedKeySpec;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密钥工具类
|
||||||
|
* @author tom
|
||||||
|
* @date 2022/4/2 17:04
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class KeyPairUtil {
|
||||||
|
|
||||||
|
private static KeyFactory keyFactory;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
keyFactory = KeyFactory.getInstance("RSA");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取密钥对
|
||||||
|
*/
|
||||||
|
public static KeyPair getKeyPairFromPublicKey(String publicKeyStr) {
|
||||||
|
try {
|
||||||
|
if (publicKeyStr == null || "".equals(publicKeyStr)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// todo fix 公钥解析
|
||||||
|
byte[] publicKeyBytes = Base64.getDecoder().decode(publicKeyStr);
|
||||||
|
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKeyBytes);
|
||||||
|
PublicKey publicKey = keyFactory.generatePublic(keySpec);
|
||||||
|
return new KeyPair(publicKey, null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("[keyPair] parse failed, {}." + e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,4 +6,5 @@ com.usthe.collector.dispatch.MetricsCollectorQueue,\
|
|||||||
com.usthe.collector.dispatch.WorkerPool,\
|
com.usthe.collector.dispatch.WorkerPool,\
|
||||||
com.usthe.collector.dispatch.entrance.internal.CollectJobService,\
|
com.usthe.collector.dispatch.entrance.internal.CollectJobService,\
|
||||||
com.usthe.collector.dispatch.export.MetricsDataExporter,\
|
com.usthe.collector.dispatch.export.MetricsDataExporter,\
|
||||||
com.usthe.collector.util.SpringContextHolder
|
com.usthe.collector.util.SpringContextHolder,\
|
||||||
|
com.usthe.collector.collect.database.JdbcSpiLoader
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class Configmap {
|
|||||||
private Object value;
|
private Object value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数类型 0:数字 1:字符串 2:加密串
|
* 参数类型 0:数字 1:字符串 2:加密串 3:map映射的json串
|
||||||
* number,string,secret
|
* number,string,secret
|
||||||
* 数字,非加密字符串,加密字符串
|
* 数字,非加密字符串,加密字符串
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ public class Job {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!metricsSet.remove(metrics)) {
|
if (!metricsSet.remove(metrics)) {
|
||||||
log.error("Job {} appId {} app {} metrics {} remove empty error in priorMetrics.",
|
log.warn("Job {} appId {} app {} metrics {} remove empty error in priorMetrics.",
|
||||||
id, monitorId, app, metrics.getName());
|
id, monitorId, app, metrics.getName());
|
||||||
}
|
}
|
||||||
if (metricsSet.isEmpty()) {
|
if (metricsSet.isEmpty()) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.usthe.common.entity.job;
|
|||||||
import com.usthe.common.entity.job.protocol.HttpProtocol;
|
import com.usthe.common.entity.job.protocol.HttpProtocol;
|
||||||
import com.usthe.common.entity.job.protocol.IcmpProtocol;
|
import com.usthe.common.entity.job.protocol.IcmpProtocol;
|
||||||
import com.usthe.common.entity.job.protocol.JdbcProtocol;
|
import com.usthe.common.entity.job.protocol.JdbcProtocol;
|
||||||
|
import com.usthe.common.entity.job.protocol.SshProtocol;
|
||||||
import com.usthe.common.entity.job.protocol.TcpUdpProtocol;
|
import com.usthe.common.entity.job.protocol.TcpUdpProtocol;
|
||||||
import com.usthe.common.entity.job.protocol.TelnetProtocol;
|
import com.usthe.common.entity.job.protocol.TelnetProtocol;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -73,6 +74,10 @@ public class Metrics {
|
|||||||
* 使用公共的jdbc规范实现的数据库配置信息
|
* 使用公共的jdbc规范实现的数据库配置信息
|
||||||
*/
|
*/
|
||||||
private JdbcProtocol jdbc;
|
private JdbcProtocol jdbc;
|
||||||
|
/**
|
||||||
|
* 使用公共的ssh协议的监控配置信息
|
||||||
|
*/
|
||||||
|
private SshProtocol ssh;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ public class JdbcProtocol {
|
|||||||
* 数据库
|
* 数据库
|
||||||
*/
|
*/
|
||||||
private String database;
|
private String database;
|
||||||
|
/**
|
||||||
|
* 超时时间
|
||||||
|
*/
|
||||||
|
private String timeout;
|
||||||
/**
|
/**
|
||||||
* 数据库类型 mysql oracle ...
|
* 数据库类型 mysql oracle ...
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.usthe.common.entity.job.protocol;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ssh 协议参数配置
|
||||||
|
* @author tom
|
||||||
|
* @date 2022/3/11 15:20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class SshProtocol {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对端主机ip或域名
|
||||||
|
*/
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对端主机端口
|
||||||
|
*/
|
||||||
|
private String port;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 超时时间
|
||||||
|
*/
|
||||||
|
private String timeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码(可选)
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公钥(可选)
|
||||||
|
*/
|
||||||
|
private String publicKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SSH执行脚本
|
||||||
|
*/
|
||||||
|
private String script;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应数据解析方式:oneRow, multiRow
|
||||||
|
*/
|
||||||
|
private String parseType;
|
||||||
|
}
|
||||||
@@ -15,7 +15,6 @@ public class JsonOptionListAttributeConverter implements AttributeConverter<List
|
|||||||
@Override
|
@Override
|
||||||
public String convertToDatabaseColumn(List<ParamDefine.Option> attribute) {
|
public String convertToDatabaseColumn(List<ParamDefine.Option> attribute) {
|
||||||
return GsonUtil.toJson(attribute);
|
return GsonUtil.toJson(attribute);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE;
|
|||||||
@ApiModel(description = "监控实体")
|
@ApiModel(description = "监控实体")
|
||||||
public class Monitor {
|
public class Monitor {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
@Id
|
@Id
|
||||||
@ApiModelProperty(value = "监控ID", example = "87584674384", accessMode = READ_ONLY, position = 0)
|
@ApiModelProperty(value = "监控ID", example = "87584674384", accessMode = READ_ONLY, position = 0)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|||||||
@@ -59,15 +59,15 @@ public class Param {
|
|||||||
* 参数值
|
* 参数值
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "参数值", example = "8080", accessMode = READ_WRITE, position = 3)
|
@ApiModelProperty(value = "参数值", example = "8080", accessMode = READ_WRITE, position = 3)
|
||||||
@Length(max = 255)
|
@Length(max = 8126)
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数类型 0:数字 1:字符串 2:加密串
|
* 参数类型 0:数字 1:字符串 2:加密串 3:map映射的json串
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "参数类型 0:数字 1:字符串 2:加密串", accessMode = READ_WRITE, position = 4)
|
@ApiModelProperty(value = "参数类型 0:数字 1:字符串 2:加密串 3:map映射的json串", accessMode = READ_WRITE, position = 4)
|
||||||
@Min(0)
|
@Min(0)
|
||||||
@Max(2)
|
@Max(3)
|
||||||
private byte type;
|
private byte type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -110,29 +110,41 @@ public class ParamDefine {
|
|||||||
@Convert(converter = JsonOptionListAttributeConverter.class)
|
@Convert(converter = JsonOptionListAttributeConverter.class)
|
||||||
private List<Option> options;
|
private List<Option> options;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当type为key-value时有效,表示key的别名描述
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "当type为key-value时有效,表示key的别名描述", example = "Name", accessMode = READ_WRITE, position = 9)
|
||||||
|
private String keyAlias;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当type为key-value时有效,表示value的别名描述
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "当type为key-value时有效,表示value的别名描述", example = "Value", accessMode = READ_WRITE, position = 10)
|
||||||
|
private String valueAlias;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 此条记录创建者
|
* 此条记录创建者
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "此条记录创建者", example = "tom", accessMode = READ_ONLY, position = 9)
|
@ApiModelProperty(value = "此条记录创建者", example = "tom", accessMode = READ_ONLY, position = 11)
|
||||||
private String creator;
|
private String creator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 此条记录最新修改者
|
* 此条记录最新修改者
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "此条记录最新修改者", example = "tom", accessMode = READ_ONLY, position = 10)
|
@ApiModelProperty(value = "此条记录最新修改者", example = "tom", accessMode = READ_ONLY, position = 12)
|
||||||
private String modifier;
|
private String modifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录创建时间
|
* 记录创建时间
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "记录创建时间(毫秒时间戳)", example = "1612198922000", accessMode = READ_ONLY, position = 11)
|
@ApiModelProperty(value = "记录创建时间(毫秒时间戳)", example = "1612198922000", accessMode = READ_ONLY, position = 13)
|
||||||
@Column(insertable = false, updatable = false)
|
@Column(insertable = false, updatable = false)
|
||||||
private LocalDateTime gmtCreate;
|
private LocalDateTime gmtCreate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录最新修改时间
|
* 记录最新修改时间
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "记录最新修改时间(毫秒时间戳)", example = "1612198444000", accessMode = READ_ONLY, position = 12)
|
@ApiModelProperty(value = "记录最新修改时间(毫秒时间戳)", example = "1612198444000", accessMode = READ_ONLY, position = 14)
|
||||||
@Column(insertable = false, updatable = false)
|
@Column(insertable = false, updatable = false)
|
||||||
private LocalDateTime gmtUpdate;
|
private LocalDateTime gmtUpdate;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: HertzBeat赫兹节拍 v1.0.beta.4 发布,易用友好的高性能监控告警系统
|
title: HertzBeat赫兹节拍 v1.0.beta.4 发布,易用友好的监控告警系统
|
||||||
author: tom
|
author: tom
|
||||||
author_title: tom
|
author_title: tom
|
||||||
author_url: https://github.com/tomsun28
|
author_url: https://github.com/tomsun28
|
||||||
|
|||||||
71
home/blog/2022-03-10-hertzbeat-v1.0-beta.5.md
Normal file
71
home/blog/2022-03-10-hertzbeat-v1.0-beta.5.md
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
---
|
||||||
|
title: HertzBeat赫兹节拍 v1.0.beta.5 发布,易用友好的监控告警系统
|
||||||
|
author: tom
|
||||||
|
author_title: tom
|
||||||
|
author_url: https://github.com/tomsun28
|
||||||
|
author_image_url: https://avatars.githubusercontent.com/u/24788200?s=400&v=4
|
||||||
|
tags: [opensource]
|
||||||
|
---
|
||||||
|
|
||||||
|
HertzBeat赫兹跳动是由Dromara孵化,TanCloud开源的一个支持网站,API,PING,端口,数据库,全站等监控类型,支持阈值告警,告警通知(邮箱,webhook,钉钉,企业微信,飞书机器人),拥有易用友好的可视化操作界面的开源监控告警项目。
|
||||||
|
|
||||||
|
官网:hertzbeat.com | tancloud.cn
|
||||||
|
|
||||||
|
此升级版本包含了dashboard仪表盘重新设计,阈值表达式支持多指标,丰富了数据库监控类型,新增mariaDB和postgreSQL数据库的监控,控制台页面新增帮助文档等,欢迎使用。
|
||||||
|
|
||||||
|
版本特性:
|
||||||
|
|
||||||
|
1. feature 支持mariadb监控类型 (#11)
|
||||||
|
2. feature dashboard仪表盘重构 (#13)
|
||||||
|
3. feature 告警配置支持多指标集合 !10 由 @pengliren 提出 thanks
|
||||||
|
4. feature 支持postgresql数据库的监控 (#16)
|
||||||
|
5. 新增监控默认开启探测.
|
||||||
|
6. 新增mysql采集指标.
|
||||||
|
7. 新增监控大类别,支持自定义监控页面菜单自动渲染
|
||||||
|
8. 操作页面新增帮助链接,完善自定义和阈值帮助文档
|
||||||
|
9. feat: 模拟浏览器设置为chrome浏览器 #Issues 14 由@learning-code 贡献 thanks
|
||||||
|
|
||||||
|
BUG修复
|
||||||
|
1. 登陆改登录,傻傻分不清.
|
||||||
|
2. 文档新增常见问题,采集器http参数优化校验.
|
||||||
|
3. 采集器调度第0优先级失败则取消后续的优化.
|
||||||
|
4. bugfix website monitor path Illegal character in path at index
|
||||||
|
5. bugfix深色主题适配问题 (#10)
|
||||||
|
6. fix国际化异常 放开hierarchy接口认证保护
|
||||||
|
|
||||||
|
欢迎在线试用 https://console.tancloud.cn
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
> [HertzBeat赫兹跳动](https://github.com/dromara/hertzbeat) 是由[Dromara](https://dromara.org)孵化,[TanCloud](https://tancloud.cn)开源的一个支持网站,API,PING,端口,数据库等监控类型,拥有易用友好的可视化操作界面的开源监控告警项目。
|
||||||
|
> 我们也提供了对应的 **[SAAS版本监控云](https://console.tancloud.cn)**,中小团队和个人无需再为了监控自己的网站资源,而去部署一套繁琐的监控系统,**[登录即可免费开始](https://console.tancloud.cn)**。
|
||||||
|
> HertzBeat 支持[自定义监控](https://hertzbeat.com/docs/advanced/extend-point) ,只用通过配置YML文件我们就可以自定义需要的监控类型和指标,来满足常见的个性化需求。
|
||||||
|
> HertzBeat 模块化,`manager, collector, scheduler, warehouse, alerter` 各个模块解耦合,方便理解与定制开发。
|
||||||
|
> HertzBeat 支持更自由化的告警配置(计算表达式),支持告警通知,告警模版,邮件钉钉微信飞书等及时通知送达
|
||||||
|
> 欢迎登录 HertzBeat 的 [云环境TanCloud](https://console.tancloud.cn) 试用发现更多。
|
||||||
|
> 我们正在快速迭代中,欢迎参与加入一起共建项目开源生态。
|
||||||
|
|
||||||
|
> `HertzBeat`的多类型支持,易扩展,低耦合,希望能帮助开发者和中小团队快速搭建自有监控系统。
|
||||||
|
|
||||||
|
老铁们可以通过演示视频来直观了解功能: https://www.bilibili.com/video/BV1Vi4y1f7i8
|
||||||
|
|
||||||
|
##### 欢迎联系交流哦
|
||||||
|
|
||||||
|
**微信交流群**
|
||||||
|
|
||||||
|
加微信号 tan-cloud 或 扫描下面账号二维码拉进微信群。
|
||||||
|
<img alt="tan-cloud" src="https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/docs/help/tan-cloud-wechat.jpg" width="200"/>
|
||||||
|
|
||||||
|
**QQ交流群**
|
||||||
|
|
||||||
|
加QQ群号 718618151 或 扫描下面的群二维码进群, 验证信息: tancloud
|
||||||
|
|
||||||
|
<img alt="tan-cloud" src="https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/docs/help/qq-qr.jpg" width="200"/>
|
||||||
|
|
||||||
|
**仓库地址**
|
||||||
|
|
||||||
|
[Github](https://github.com/dromara/hertzbeat) https://github.com/dromara/hertzbeat
|
||||||
|
[Gitee](https://gitee.com/dromara/hertzbeat) https://gitee.com/dromara/hertzbeat
|
||||||
|
|
||||||
|
看到这里不妨给个Star哦,灰常感谢,弯腰!!
|
||||||
70
home/blog/2022-03-20-hertzbeat-v1.0-beta.6.md
Normal file
70
home/blog/2022-03-20-hertzbeat-v1.0-beta.6.md
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
---
|
||||||
|
title: HertzBeat赫兹节拍 v1.0.beta.6 发布,Linux监控来啦
|
||||||
|
author: tom
|
||||||
|
author_title: tom
|
||||||
|
author_url: https://github.com/tomsun28
|
||||||
|
author_image_url: https://avatars.githubusercontent.com/u/24788200?s=400&v=4
|
||||||
|
tags: [opensource]
|
||||||
|
---
|
||||||
|
|
||||||
|
HertzBeat赫兹跳动是由Dromara孵化,TanCloud开源的一个支持网站,API,PING,端口,数据库,操作系统,全站等监控类型,支持阈值告警,告警通知(邮箱,webhook,钉钉,企业微信,飞书机器人),拥有易用友好的可视化操作界面的开源监控告警项目。
|
||||||
|
|
||||||
|
官网:hertzbeat.com | tancloud.cn
|
||||||
|
|
||||||
|
此升级版本包含了很多同学需要的Linux操作系统监控支持,支持其CPU,内存,磁盘,网络等指标,重要的是同步支持了SSH自定义,我们可以很方便的写脚本监控我们想要的Linux指标,也新增了对主流的数据库SqlServer监控支持等,更多功能欢迎使用。
|
||||||
|
|
||||||
|
版本特性:
|
||||||
|
1. feature 新增支持Linux操作系统监控类型(支持CPU内存磁盘网卡等监控指标) (#20)
|
||||||
|
2. feature 新增支持microsoft sqlserver数据库监控类型 (#37)
|
||||||
|
3. feature 添加docker-compose部署方案 (#27) 由 @jx10086 贡献 thanks
|
||||||
|
4. feature 监控列表支持状态过滤和字段搜索功能 (#29)
|
||||||
|
5. feature 新增mysql,postgresql等数据库查询超时时间设置 (#18) 由 @学习代码的小白 贡献
|
||||||
|
6. [纳管]修改为[监控]表述,[探测]修改为[测试]表述
|
||||||
|
7. feature add github build and translate action (#22)
|
||||||
|
8. feature 新增贡献指南,本地代码启动文档
|
||||||
|
9. docs 指定mysql和tdengine版本,避免环境问题
|
||||||
|
|
||||||
|
BUG修复
|
||||||
|
1. fix 由于链接复用不佳造成创建过多链接监控异常 (#26)
|
||||||
|
2. fix 页面全局监控搜索结果异常 (#28) issue by @Suremotoo
|
||||||
|
3. 代码优化 #I4U9BT 由 @学习代码的小白 贡献
|
||||||
|
4. fix 服务启动脚本偶现端口占用误判问题
|
||||||
|
5. 时间本地时区格式化 (#35)
|
||||||
|
6. fix 此版本引入问题jdbc解析异常 (#36)
|
||||||
|
7. fix jdbc并发注册加载时由于spi机制加载死锁问题 (#40)
|
||||||
|
|
||||||
|
欢迎在线试用 https://console.tancloud.cn.
|
||||||
|
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
> [HertzBeat赫兹跳动](https://github.com/dromara/hertzbeat) 是由[Dromara](https://dromara.org)孵化,[TanCloud](https://tancloud.cn)开源的一个支持网站,API,PING,端口,数据库,操作系统等监控类型,拥有易用友好的可视化操作界面的开源监控告警项目。
|
||||||
|
> 我们也提供了对应的 **[SAAS版本监控云](https://console.tancloud.cn)**,中小团队和个人无需再为了监控自己的网站资源,而去部署一套繁琐的监控系统,**[登录即可免费开始](https://console.tancloud.cn)**。
|
||||||
|
> HertzBeat 支持[自定义监控](https://hertzbeat.com/docs/advanced/extend-point) ,只用通过配置YML文件我们就可以自定义需要的监控类型和指标,来满足常见的个性化需求。
|
||||||
|
> HertzBeat 模块化,`manager, collector, scheduler, warehouse, alerter` 各个模块解耦合,方便理解与定制开发。
|
||||||
|
> HertzBeat 支持更自由化的告警配置(计算表达式),支持告警通知,告警模版,邮件钉钉微信飞书等及时通知送达
|
||||||
|
> 欢迎登录 HertzBeat 的 [云环境TanCloud](https://console.tancloud.cn) 试用发现更多。
|
||||||
|
> 我们正在快速迭代中,欢迎参与加入一起共建项目开源生态。
|
||||||
|
|
||||||
|
> `HertzBeat`的多类型支持,易扩展,低耦合,希望能帮助开发者和中小团队快速搭建自有监控系统。
|
||||||
|
|
||||||
|
老铁们可以通过演示视频来直观了解功能: https://www.bilibili.com/video/BV1Vi4y1f7i8
|
||||||
|
|
||||||
|
##### 欢迎联系交流哦
|
||||||
|
|
||||||
|
**微信交流群**
|
||||||
|
|
||||||
|
加微信号 tan-cloud 或 扫描下面账号二维码拉进微信群。
|
||||||
|
<img alt="tan-cloud" src="https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/docs/help/tan-cloud-wechat.jpg" width="200"/>
|
||||||
|
|
||||||
|
**QQ交流群**
|
||||||
|
|
||||||
|
加QQ群号 718618151 或 扫描下面的群二维码进群, 验证信息: tancloud
|
||||||
|
|
||||||
|
<img alt="tan-cloud" src="https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/docs/help/qq-qr.jpg" width="200"/>
|
||||||
|
|
||||||
|
**仓库地址**
|
||||||
|
|
||||||
|
[Github](https://github.com/dromara/hertzbeat) https://github.com/dromara/hertzbeat
|
||||||
|
[Gitee](https://gitee.com/dromara/hertzbeat) https://gitee.com/dromara/hertzbeat
|
||||||
|
|
||||||
|
看到这里不妨给个Star哦,灰常感谢,弯腰!!
|
||||||
@@ -29,14 +29,14 @@ HTTP协议支持我们自定义HTTP请求路径,请求header,请求参数,
|
|||||||
|
|
||||||
> 监控配置定义文件用于定义 *监控类型的名称(国际化), 请求参数映射, 指标信息, 采集协议配置信息*等。
|
> 监控配置定义文件用于定义 *监控类型的名称(国际化), 请求参数映射, 指标信息, 采集协议配置信息*等。
|
||||||
|
|
||||||
样例:自定义一个名称为example的自定义监控类型,其使用HTTP协议采集指标数据。
|
样例:自定义一个名称为example_http的自定义监控类型,其使用HTTP协议采集指标数据。
|
||||||
文件名称: example.yml 位于 /define/app/example.yml
|
文件名称: example_http.yml 位于 /define/app/example_http.yml
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# 此监控类型所属类别:service-应用服务监控 db-数据库监控 custom-自定义监控 os-操作系统监控
|
# 此监控类型所属类别:service-应用服务监控 db-数据库监控 custom-自定义监控 os-操作系统监控
|
||||||
category: custom
|
category: custom
|
||||||
# 监控应用类型(与文件名保持一致) eg: linux windows tomcat mysql aws...
|
# 监控应用类型(与文件名保持一致) eg: linux windows tomcat mysql aws...
|
||||||
app: example
|
app: example_http
|
||||||
name:
|
name:
|
||||||
zh-CN: 模拟应用类型
|
zh-CN: 模拟应用类型
|
||||||
en-US: EXAMPLE APP
|
en-US: EXAMPLE APP
|
||||||
@@ -157,12 +157,12 @@ metrics:
|
|||||||
|
|
||||||
> 监控参数定义文件用于定义 *需要的输入参数字段结构定义(前端页面根据结构渲染输入参数框)*。
|
> 监控参数定义文件用于定义 *需要的输入参数字段结构定义(前端页面根据结构渲染输入参数框)*。
|
||||||
|
|
||||||
样例:自定义一个名称为example的自定义监控类型,其使用HTTP协议采集指标数据。
|
样例:自定义一个名称为example_http的自定义监控类型,其使用HTTP协议采集指标数据。
|
||||||
文件名称: example.yml 位于 //define/param/example.yml
|
文件名称: example_http.yml 位于 //define/param/example_http.yml
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# 监控应用类型名称(与文件名保持一致) eg: linux windows tomcat mysql aws...
|
# 监控应用类型名称(与文件名保持一致) eg: linux windows tomcat mysql aws...
|
||||||
app: example
|
app: example_http
|
||||||
# 强制固定必须参数 - host(ipv4,ipv6,域名)
|
# 强制固定必须参数 - host(ipv4,ipv6,域名)
|
||||||
param:
|
param:
|
||||||
# field-字段名称标识符
|
# field-字段名称标识符
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
---
|
---
|
||||||
id: extend-mysql
|
id: extend-jdbc
|
||||||
title: MYSQL协议自定义监控
|
title: JDBC协议自定义监控
|
||||||
sidebar_label: MYSQL协议自定义监控
|
sidebar_label: JDBC协议自定义监控
|
||||||
---
|
---
|
||||||
> 从[自定义监控](extend-point)了解熟悉了怎么自定义类型,指标,协议等,这里我们来详细介绍下用MYSQL协议自定义指标监控。
|
> 从[自定义监控](extend-point)了解熟悉了怎么自定义类型,指标,协议等,这里我们来详细介绍下用JDBC(目前支持mysql,mariadb,postgresql,sqlserver)自定义指标监控。
|
||||||
> mysql协议自定义监控可以让我们很方便的通过写SQL查询语句就能监控到我们想监控的指标
|
> JDBC协议自定义监控可以让我们很方便的通过写SQL查询语句就能监控到我们想监控的指标
|
||||||
|
|
||||||
### MYSQL协议采集流程
|
### JDBC协议采集流程
|
||||||
【**系统直连MYSQL**】->【**运行SQL查询语句**】->【**响应数据解析:oneRow, multiRow, columns**】->【**指标数据提取**】
|
【**系统直连MYSQL**】->【**运行SQL查询语句**】->【**响应数据解析:oneRow, multiRow, columns**】->【**指标数据提取**】
|
||||||
|
|
||||||
由流程可见,我们自定义一个MYSQL协议的监控类型,需要配置MYSQL请求参数,配置获取哪些指标,配置查询SQL语句。
|
由流程可见,我们自定义一个JDBC协议的监控类型,需要配置JDBC请求参数,配置获取哪些指标,配置查询SQL语句。
|
||||||
|
|
||||||
### 数据解析方式
|
### 数据解析方式
|
||||||
SQL查询回来的数据字段和我们需要的指标映射,就能获取对应的指标数据,目前映射解析方式有三种:oneRow, multiRow, columns
|
SQL查询回来的数据字段和我们需要的指标映射,就能获取对应的指标数据,目前映射解析方式有三种:oneRow, multiRow, columns
|
||||||
@@ -50,8 +50,8 @@ SQL响应数据:
|
|||||||
### 自定义步骤
|
### 自定义步骤
|
||||||
|
|
||||||
配置自定义监控类型需新增配置两个YML文件
|
配置自定义监控类型需新增配置两个YML文件
|
||||||
1. 用监控类型命名的监控配置定义文件 - 例如:example.yml 需位于安装目录 /hertzbeat/define/app/ 下
|
1. 用监控类型命名的监控配置定义文件 - 例如:example_sql.yml 需位于安装目录 /hertzbeat/define/app/ 下
|
||||||
2. 用监控类型命名的监控参数定义文件 - 例如:example.yml 需位于安装目录 /hertzbeat/define/param/ 下
|
2. 用监控类型命名的监控参数定义文件 - 例如:example_sql.yml 需位于安装目录 /hertzbeat/define/param/ 下
|
||||||
3. 重启hertzbeat系统,我们就适配好了一个新的自定义监控类型。
|
3. 重启hertzbeat系统,我们就适配好了一个新的自定义监控类型。
|
||||||
|
|
||||||
-------
|
-------
|
||||||
@@ -61,14 +61,14 @@ SQL响应数据:
|
|||||||
|
|
||||||
> 监控配置定义文件用于定义 *监控类型的名称(国际化), 请求参数映射, 指标信息, 采集协议配置信息*等。
|
> 监控配置定义文件用于定义 *监控类型的名称(国际化), 请求参数映射, 指标信息, 采集协议配置信息*等。
|
||||||
|
|
||||||
样例:自定义一个名称为example的自定义监控类型,其使用HTTP协议采集指标数据。
|
样例:自定义一个名称为example_sql的自定义监控类型,其使用JDBC协议采集指标数据。
|
||||||
文件名称: example.yml 位于 /define/app/example.yml
|
文件名称: example_sql.yml 位于 /define/app/example_sql.yml
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# 此监控类型所属类别:service-应用服务监控 db-数据库监控 custom-自定义监控 os-操作系统监控
|
# 此监控类型所属类别:service-应用服务监控 db-数据库监控 custom-自定义监控 os-操作系统监控
|
||||||
category: db
|
category: db
|
||||||
# 监控应用类型(与文件名保持一致) eg: linux windows tomcat mysql aws...
|
# 监控应用类型(与文件名保持一致) eg: linux windows tomcat mysql aws...
|
||||||
app: example
|
app: example_sql
|
||||||
name:
|
name:
|
||||||
zh-CN: 模拟MYSQL应用类型
|
zh-CN: 模拟MYSQL应用类型
|
||||||
en-US: MYSQL EXAMPLE APP
|
en-US: MYSQL EXAMPLE APP
|
||||||
@@ -215,11 +215,11 @@ metrics:
|
|||||||
|
|
||||||
> 监控参数定义文件用于定义 *需要的输入参数字段结构定义(前端页面根据结构渲染输入参数框)*。
|
> 监控参数定义文件用于定义 *需要的输入参数字段结构定义(前端页面根据结构渲染输入参数框)*。
|
||||||
|
|
||||||
样例:自定义一个名称为example的自定义监控类型,其使用HTTP协议采集指标数据。
|
样例:自定义一个名称为example_sql的自定义监控类型,其使用JDBC协议采集指标数据。
|
||||||
文件名称: example.yml 位于 /define/param/example.yml
|
文件名称: example_sql.yml 位于 /define/param/example_sql.yml
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
app: example
|
app: example_sql
|
||||||
param:
|
param:
|
||||||
- field: host
|
- field: host
|
||||||
name: 主机Host
|
name: 主机Host
|
||||||
@@ -4,7 +4,7 @@ title: 自定义监控
|
|||||||
sidebar_label: 自定义监控
|
sidebar_label: 自定义监控
|
||||||
---
|
---
|
||||||
> HertzBeat拥有自定义监控能力,您只需配置两个YML文件就能适配一款自定义的监控类型。
|
> HertzBeat拥有自定义监控能力,您只需配置两个YML文件就能适配一款自定义的监控类型。
|
||||||
> 目前自定义监控支持[HTTP协议](extend-http),MYSQL协议,后续会支持更多通用协议(ssh telnet wmi snmp)。
|
> 目前自定义监控支持[HTTP协议](extend-http),[JDBC协议](extend-jdbc)(mysql,mariadb,postgresql..),[SSH协议](extend-ssh),后续会支持更多通用协议(ssh telnet wmi snmp)。
|
||||||
|
|
||||||
### 自定义步骤
|
### 自定义步骤
|
||||||
|
|
||||||
|
|||||||
220
home/docs/advanced/extend-ssh.md
Normal file
220
home/docs/advanced/extend-ssh.md
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
---
|
||||||
|
id: extend-ssh
|
||||||
|
title: SSH协议自定义监控
|
||||||
|
sidebar_label: SSH协议自定义监控
|
||||||
|
---
|
||||||
|
> 从[自定义监控](extend-point)了解熟悉了怎么自定义类型,指标,协议等,这里我们来详细介绍下用SSH协议自定义指标监控。
|
||||||
|
> SSH协议自定义监控可以让我们很方便的通过写sh命令脚本就能监控采集到我们想监控的Linux指标
|
||||||
|
|
||||||
|
### SSH协议采集流程
|
||||||
|
【**系统直连Linux**】->【**运行SHELL命令脚本语句**】->【**响应数据解析:oneRow, multiRow**】->【**指标数据提取**】
|
||||||
|
|
||||||
|
由流程可见,我们自定义一个SSH协议的监控类型,需要配置SSH请求参数,配置获取哪些指标,配置查询脚本语句。
|
||||||
|
|
||||||
|
### 数据解析方式
|
||||||
|
SHELL脚本查询回来的数据字段和我们需要的指标映射,就能获取对应的指标数据,目前映射解析方式有两种:oneRow, multiRow,能满足绝大部分指标需求。
|
||||||
|
|
||||||
|
#### **oneRow**
|
||||||
|
> 查询出一列数据, 通过查询返回结果集的字段值(一行一个值)与字段映射
|
||||||
|
|
||||||
|
例如:
|
||||||
|
需要查询Linux的指标 hostname-主机名称,uptime-启动时间
|
||||||
|
主机名称原始查询命令:`hostname`
|
||||||
|
启动时间原始查询命令:`uptime | awk -F "," '{print $1}'`
|
||||||
|
则在hertzbeat对应的这两个指标的查询脚本为(用`;`将其连接到一起):
|
||||||
|
`hostname; uptime | awk -F "," '{print $1}'`
|
||||||
|
终端响应的数据为:
|
||||||
|
```
|
||||||
|
tombook
|
||||||
|
14:00:15 up 72 days
|
||||||
|
```
|
||||||
|
则最后采集到的指标数据一一映射为:
|
||||||
|
hostname值为 `tombook`
|
||||||
|
uptime值为 `14:00:15 up 72 days`
|
||||||
|
|
||||||
|
这里指标字段就能和响应数据一一映射为一行采集数据。
|
||||||
|
|
||||||
|
#### **multiRow**
|
||||||
|
> 查询多行数据, 通过查询返回结果集的列名称,和查询的指标字段映射
|
||||||
|
|
||||||
|
例如:
|
||||||
|
查询的Linux内存相关指标字段:total-内存总量 used-已使用内存 free-空闲内存 buff-cache-缓存大小 available-可用内存
|
||||||
|
内存指标原始查询命令为:`free -m`, 控制台响应:
|
||||||
|
```shell
|
||||||
|
total used free shared buff/cache available
|
||||||
|
Mem: 7962 4065 333 1 3562 3593
|
||||||
|
Swap: 8191 33 8158
|
||||||
|
```
|
||||||
|
在heartbeat中multiRow格式解析需要响应数据列名称和指标值一一映射,则对应的查询SHELL脚本为:
|
||||||
|
`free -m | grep Mem | awk 'BEGIN{print "total used free buff_cache available"} {print $2,$3,$4,$6,$7}'`
|
||||||
|
控制台响应为:
|
||||||
|
```shell
|
||||||
|
total used free buff_cache available
|
||||||
|
7962 4066 331 3564 3592
|
||||||
|
```
|
||||||
|
|
||||||
|
这里指标字段就能和响应数据一一映射为采集数据。
|
||||||
|
|
||||||
|
### 自定义步骤
|
||||||
|
|
||||||
|
配置自定义监控类型需新增配置两个YML文件
|
||||||
|
1. 用监控类型命名的监控配置定义文件 - 例如:example_linux.yml 需位于安装目录 /hertzbeat/define/app/ 下
|
||||||
|
2. 用监控类型命名的监控参数定义文件 - 例如:example_linux.yml 需位于安装目录 /hertzbeat/define/param/ 下
|
||||||
|
3. 重启hertzbeat系统,我们就适配好了一个新的自定义监控类型。
|
||||||
|
|
||||||
|
-------
|
||||||
|
下面详细介绍下这俩文件的配置用法,请注意看使用注释。
|
||||||
|
|
||||||
|
### 监控配置定义文件
|
||||||
|
|
||||||
|
> 监控配置定义文件用于定义 *监控类型的名称(国际化), 请求参数映射, 指标信息, 采集协议配置信息*等。
|
||||||
|
|
||||||
|
样例:自定义一个名称为example_linux的自定义监控类型,其使用SSH协议采集指标数据。
|
||||||
|
文件名称: example_linux.yml 位于 /define/app/example_linux.yml
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# 此监控类型所属类别:service-应用服务监控 db-数据库监控 custom-自定义监控 os-操作系统监控
|
||||||
|
category: os
|
||||||
|
# 监控应用类型(与文件名保持一致) eg: linux windows tomcat mysql aws...
|
||||||
|
app: example_linux
|
||||||
|
name:
|
||||||
|
zh-CN: 模拟LINUX应用类型
|
||||||
|
en-US: LINUX EXAMPLE APP
|
||||||
|
# 参数映射map. 这些为输入参数变量,即可以用^_^host^_^的形式写到后面的配置中,系统自动变量值替换
|
||||||
|
# type是参数类型: 0-number数字, 1-string明文字符串, 2-secret加密字符串
|
||||||
|
# 强制固定必须参数 - host
|
||||||
|
configmap:
|
||||||
|
- key: host
|
||||||
|
type: 1
|
||||||
|
- key: port
|
||||||
|
type: 0
|
||||||
|
- key: username
|
||||||
|
type: 1
|
||||||
|
- key: password
|
||||||
|
type: 2
|
||||||
|
# 指标组列表
|
||||||
|
metrics:
|
||||||
|
# 第一个监控指标组 basic
|
||||||
|
# 注意:内置监控指标有 (responseTime - 响应时间)
|
||||||
|
- name: basic
|
||||||
|
# 指标组调度优先级(0-127)越小优先级越高,优先级低的指标组会等优先级高的指标组采集完成后才会被调度,相同优先级的指标组会并行调度采集
|
||||||
|
# 优先级为0的指标组为可用性指标组,即它会被首先调度,采集成功才会继续调度其它指标组,采集失败则中断调度
|
||||||
|
priority: 0
|
||||||
|
# 指标组中的具体监控指标
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: hostname
|
||||||
|
type: 1
|
||||||
|
instance: true
|
||||||
|
- field: version
|
||||||
|
type: 1
|
||||||
|
- field: uptime
|
||||||
|
type: 1
|
||||||
|
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
|
||||||
|
protocol: ssh
|
||||||
|
# 当protocol为http协议时具体的采集配置
|
||||||
|
ssh:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
script: (uname -r ; hostname ; uptime | awk -F "," '{print $1}' | sed "s/ //g") | sed ":a;N;s/\n/^/g;ta" | awk -F '^' 'BEGIN{print "version hostname uptime"} {print $1, $2, $3}'
|
||||||
|
# 响应数据解析方式:oneRow, multiRow
|
||||||
|
parseType: multiRow
|
||||||
|
|
||||||
|
- name: cpu
|
||||||
|
priority: 1
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: info
|
||||||
|
type: 1
|
||||||
|
- field: cores
|
||||||
|
type: 0
|
||||||
|
unit: 核数
|
||||||
|
- field: interrupt
|
||||||
|
type: 0
|
||||||
|
unit: 个数
|
||||||
|
- field: load
|
||||||
|
type: 1
|
||||||
|
- field: context_switch
|
||||||
|
type: 0
|
||||||
|
unit: 个数
|
||||||
|
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
|
||||||
|
protocol: ssh
|
||||||
|
# 当protocol为http协议时具体的采集配置
|
||||||
|
ssh:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
script: "LANG=C lscpu | awk -F: '/Model name/ {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}'"
|
||||||
|
parseType: oneRow
|
||||||
|
|
||||||
|
- name: memory
|
||||||
|
priority: 2
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: total
|
||||||
|
type: 0
|
||||||
|
unit: Mb
|
||||||
|
- field: used
|
||||||
|
type: 0
|
||||||
|
unit: Mb
|
||||||
|
- field: free
|
||||||
|
type: 0
|
||||||
|
unit: Mb
|
||||||
|
- field: buff_cache
|
||||||
|
type: 0
|
||||||
|
unit: Mb
|
||||||
|
- field: available
|
||||||
|
type: 0
|
||||||
|
unit: Mb
|
||||||
|
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
|
||||||
|
protocol: ssh
|
||||||
|
# 当protocol为http协议时具体的采集配置
|
||||||
|
ssh:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
script: free -m | grep Mem | awk 'BEGIN{print "total used free buff_cache available"} {print $2,$3,$4,$6,$7}'
|
||||||
|
parseType: multiRow
|
||||||
|
```
|
||||||
|
|
||||||
|
### 监控参数定义文件
|
||||||
|
|
||||||
|
> 监控参数定义文件用于定义 *需要的输入参数字段结构定义(前端页面根据结构渲染输入参数框)*。
|
||||||
|
|
||||||
|
样例:自定义一个名称为example_linux的自定义监控类型,其使用SSH协议采集指标数据。
|
||||||
|
文件名称: example_linux.yml 位于 /define/param/example_linux.yml
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
app: example_linux
|
||||||
|
param:
|
||||||
|
- field: host
|
||||||
|
name: 主机Host
|
||||||
|
type: host
|
||||||
|
required: true
|
||||||
|
- field: port
|
||||||
|
name: 端口
|
||||||
|
type: number
|
||||||
|
range: '[0,65535]'
|
||||||
|
required: true
|
||||||
|
defaultValue: 22
|
||||||
|
placeholder: '请输入端口'
|
||||||
|
- field: username
|
||||||
|
name: 用户名
|
||||||
|
type: text
|
||||||
|
limit: 20
|
||||||
|
required: true
|
||||||
|
- field: password
|
||||||
|
name: 密码
|
||||||
|
type: password
|
||||||
|
required: true
|
||||||
|
```
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
---
|
|
||||||
id: contributing
|
|
||||||
title: 参与贡献
|
|
||||||
sidebar_label: 参与贡献
|
|
||||||
---
|
|
||||||
|
|
||||||
Contributing to Sureness
|
|
||||||
=======================================
|
|
||||||
Very welcome to Contribute this project, go further and better with sureness.
|
|
||||||
Firstly, thanks for your interest in contributing! I hope that this will be a pleasant first experience for you, and that you will return to continue contributing.
|
|
||||||
|
|
||||||
Components of Repository:
|
|
||||||
- [sureness's kernel code--sureness-core](https://github.com/usthe/sureness/tree/master/core)
|
|
||||||
- [sureness integration springboot sample(configuration file scheme)--sample-bootstrap](https://github.com/usthe/sureness/tree/master/sample-bootstrap)
|
|
||||||
- [sureness integration springboot sample(database scheme)-sample-tom](https://github.com/usthe/sureness/tree/master/sample-tom)
|
|
||||||
- [sample projects using sureness in each framework(javalin,ktor,quarkus)--samples](https://github.com/usthe/sureness/tree/master/samples)
|
|
||||||
|
|
||||||
## How to contribute?
|
|
||||||
|
|
||||||
Most of the contributions that we receive are code contributions, but you can
|
|
||||||
also contribute to the documentation or simply report solid bugs
|
|
||||||
for us to fix.
|
|
||||||
|
|
||||||
For new contributors, please take a look at issues or pull requests with a tag called below.
|
|
||||||
|
|
||||||
[Good first issue](https://github.com/usthe/sureness/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
|
|
||||||
[Help wanted](https://github.com/usthe/sureness/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
|
|
||||||
[Good first pull request](https://github.com/usthe/sureness/issues?q=label%3A%22good+first+pull+request%22+)
|
|
||||||
|
|
||||||
## Join discussion
|
|
||||||
|
|
||||||
[Github Discussion](https://github.com/usthe/sureness/discussions)
|
|
||||||
[Gitter Channel](https://gitter.im/usthe/sureness)
|
|
||||||
|
|
||||||
----
|
|
||||||
----
|
|
||||||
|
|
||||||
参与贡献
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
非常欢迎参与项目贡献,我们致力于维护一个互相帮助的快乐社区。
|
|
||||||
|
|
||||||
仓库的组成部分:
|
|
||||||
- [sureness的核心代码--sureness-core](https://github.com/usthe/sureness/tree/master/core)
|
|
||||||
- [使用sureness集成springboot搭建权限项目(配置文件方案)--sample-bootstrap](https://github.com/usthe/sureness/tree/master/sample-bootstrap)
|
|
||||||
- [使用sureness集成springboot搭建权限项目(数据库方案)--sample-tom](https://github.com/usthe/sureness/tree/master/sample-tom)
|
|
||||||
- [各个框架使用sureness的样例项目(javalin,ktor,quarkus)--samples](https://github.com/usthe/sureness/tree/master/samples)
|
|
||||||
|
|
||||||
|
|
||||||
## 如何贡献?
|
|
||||||
|
|
||||||
我们不仅仅接收代码的贡献提交,您也可以通过提交文档的更新或者BUG的报告来参与社区贡献。
|
|
||||||
|
|
||||||
如果是新的贡献者,请首先了解参考如下样例的提交Issues,提交Pull Requests如果工作。
|
|
||||||
|
|
||||||
[Good first issue](https://github.com/usthe/sureness/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
|
|
||||||
[Help wanted](https://github.com/usthe/sureness/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
|
|
||||||
[Good first pull request](https://github.com/usthe/sureness/issues?q=label%3A%22good+first+pull+request%22+)
|
|
||||||
|
|
||||||
## 加入交流
|
|
||||||
|
|
||||||
[Github Discussion](https://github.com/usthe/sureness/discussions)
|
|
||||||
[Gitter Channel](https://gitter.im/usthe/sureness)
|
|
||||||
QQ交流群:390083213
|
|
||||||
微信公众号:sureness
|
|
||||||
@@ -18,7 +18,11 @@ sidebar_label: 帮助入门
|
|||||||
|
|
||||||
### 数据库监控
|
### 数据库监控
|
||||||
|
|
||||||
[MYSQL数据库监控](mysql)      [MariaDB数据库监控](mariadb)
|
[MYSQL数据库监控](mysql)      [MariaDB数据库监控](mariadb)      [PostgreSQL数据库监控](postgresql)      [SqlServer数据库监控](sqlserver)      [Oracle数据库监控](oracle)
|
||||||
|
|
||||||
|
### 操作系统监控
|
||||||
|
|
||||||
|
[Linux操作系统监控](linux)     
|
||||||
|
|
||||||
## 💡 告警服务
|
## 💡 告警服务
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,12 @@ sidebar_label: 常见问题
|
|||||||
> 如信息所示,输入的监控Host须是ipv4,ipv6或域名,不能携带协议头,例如协议头http
|
> 如信息所示,输入的监控Host须是ipv4,ipv6或域名,不能携带协议头,例如协议头http
|
||||||
|
|
||||||
2. ** 网站API等监控反馈statusCode:403或401,但对端服务本身无需认证,浏览器直接访问是OK **
|
2. ** 网站API等监控反馈statusCode:403或401,但对端服务本身无需认证,浏览器直接访问是OK **
|
||||||
> 请排查是否是被防火墙拦截,如宝塔等默认设置了对请求header中`User-Agent=Apache-HttpClient`的拦截,若被拦截请删除此拦截规则。
|
> 请排查是否是被防火墙拦截,如宝塔等默认设置了对请求header中`User-Agent=Apache-HttpClient`的拦截,若被拦截请删除此拦截规则。(v1.0.beat5版本已将user-agent模拟成浏览器此问题不存在)
|
||||||
|
|
||||||
|
3. 安装包部署的hertzbeat下ping连通性监控异常
|
||||||
|
安装包安装部署的hertzbeat,对ping连通性监控不可用,但本地直接ping是可用的。
|
||||||
|
> 安装包部署需要配置java虚拟机root权限启动hertzbeat从而使用ICMP,若未启用root权限则是判断telnet对端7号端口是否开通
|
||||||
|
> docker安装默认启用无此问题
|
||||||
|
|
||||||
### Docker部署常见问题
|
### Docker部署常见问题
|
||||||
|
|
||||||
|
|||||||
70
home/docs/help/linux.md
Normal file
70
home/docs/help/linux.md
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
---
|
||||||
|
id: linux
|
||||||
|
title: 监控:Linux操作系统监控
|
||||||
|
sidebar_label: Linux操作系统
|
||||||
|
---
|
||||||
|
|
||||||
|
> 对Linux操作系统的通用性能指标进行采集监控。
|
||||||
|
|
||||||
|
### 配置参数
|
||||||
|
|
||||||
|
| 参数名称 | 参数帮助描述 |
|
||||||
|
| ----------- | ----------- |
|
||||||
|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
|
||||||
|
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
|
||||||
|
| 端口 | Linux SSH对外提供的端口,默认为22。 |
|
||||||
|
| 用户名 | SSH连接用户名,可选 |
|
||||||
|
| 密码 | SSH连接密码,可选 |
|
||||||
|
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为10秒 |
|
||||||
|
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
|
||||||
|
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
|
||||||
|
|
||||||
|
### 采集指标
|
||||||
|
|
||||||
|
#### 指标集合:basic
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| hostname | 无 | 主机名称 |
|
||||||
|
| version | 无 | 操作系统版本 |
|
||||||
|
| uptime | 无 | 系统运行时间 |
|
||||||
|
|
||||||
|
#### 指标集合:cpu
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| info | 无 | CPU型号 |
|
||||||
|
| cores | 核数 | CPU内核数量 |
|
||||||
|
| interrupt | 个数 | CPU中断数量 |
|
||||||
|
| load | 无 | CPU最近1/5/15分钟的平均负载 |
|
||||||
|
| context_switch | 个数 | 当前上下文切换数量 |
|
||||||
|
|
||||||
|
|
||||||
|
#### 指标集合:memory
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| total | Mb | 总内存容量 |
|
||||||
|
| used | Mb | 用户程序内存量 |
|
||||||
|
| free | Mb | 空闲内存容量 |
|
||||||
|
| buff_cache | Mb | 缓存占用内存 |
|
||||||
|
| available | Mb | 剩余可用内存容 |
|
||||||
|
|
||||||
|
#### 指标集合:disk
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| disk_num | 块数 | 磁盘总数 |
|
||||||
|
| partition_num | 分区数 | 分区总数 |
|
||||||
|
| block_write | 块数 | 写入磁盘的总块数 |
|
||||||
|
| block_read | 块数 | 从磁盘读出的块数 |
|
||||||
|
| write_rate | iops | 每秒写磁盘块的速率 |
|
||||||
|
|
||||||
|
#### 指标集合:interface
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| interface_name | 无 | 网卡名称 |
|
||||||
|
| receive_bytes | byte | 入站数据流量(bytes) |
|
||||||
|
| transmit_bytes | byte | 出站数据流量(bytes) |
|
||||||
|
|
||||||
@@ -12,7 +12,8 @@ sidebar_label: MariaDB数据库
|
|||||||
| ----------- | ----------- |
|
| ----------- | ----------- |
|
||||||
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
|
||||||
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
|
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
|
||||||
| 端口 | 网站对外提供的端口,http一般默认为80,https一般默认为443。 |
|
| 端口 | 数据库对外提供的端口,默认为3306。 |
|
||||||
|
| 查询超时时间 | 设置SQL查询未响应数据时的超时时间,单位ms毫秒,默认3000毫秒。 |
|
||||||
| 数据库名称 | 数据库实例名称,可选。 |
|
| 数据库名称 | 数据库实例名称,可选。 |
|
||||||
| 用户名 | 数据库连接用户名,可选 |
|
| 用户名 | 数据库连接用户名,可选 |
|
||||||
| 密码 | 数据库连接密码,可选 |
|
| 密码 | 数据库连接密码,可选 |
|
||||||
@@ -40,8 +41,6 @@ sidebar_label: MariaDB数据库
|
|||||||
| threads_connected | 无 | MariaDB已经连接的连接数 |
|
| threads_connected | 无 | MariaDB已经连接的连接数 |
|
||||||
| threads_cached | 无 | MariaDB当前缓存的连接数 |
|
| threads_cached | 无 | MariaDB当前缓存的连接数 |
|
||||||
| threads_running | 无 | MariaDB当前活跃的连接数 |
|
| threads_running | 无 | MariaDB当前活跃的连接数 |
|
||||||
| qps | 无 | 每秒请求查询次数。`QPS = questions/uptimes` |
|
|
||||||
| tps | 无 | 每秒事务数据 `TPS= (commit+rollback)/seconds`|
|
|
||||||
|
|
||||||
|
|
||||||
#### 指标集合:innodb
|
#### 指标集合:innodb
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ sidebar_label: MYSQL数据库
|
|||||||
| ----------- | ----------- |
|
| ----------- | ----------- |
|
||||||
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
|
||||||
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
|
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
|
||||||
| 端口 | 网站对外提供的端口,http一般默认为80,https一般默认为443。 |
|
| 端口 | 数据库对外提供的端口,默认为3306。 |
|
||||||
|
| 查询超时时间 | 设置SQL查询未响应数据时的超时时间,单位ms毫秒,默认3000毫秒。 |
|
||||||
| 数据库名称 | 数据库实例名称,可选。 |
|
| 数据库名称 | 数据库实例名称,可选。 |
|
||||||
| 用户名 | 数据库连接用户名,可选 |
|
| 用户名 | 数据库连接用户名,可选 |
|
||||||
| 密码 | 数据库连接密码,可选 |
|
| 密码 | 数据库连接密码,可选 |
|
||||||
@@ -40,8 +41,6 @@ sidebar_label: MYSQL数据库
|
|||||||
| threads_connected | 无 | MySql已经连接的连接数 |
|
| threads_connected | 无 | MySql已经连接的连接数 |
|
||||||
| threads_cached | 无 | MySql当前缓存的连接数 |
|
| threads_cached | 无 | MySql当前缓存的连接数 |
|
||||||
| threads_running | 无 | MySql当前活跃的连接数 |
|
| threads_running | 无 | MySql当前活跃的连接数 |
|
||||||
| qps | 无 | 每秒请求查询次数。`QPS = questions/uptimes` |
|
|
||||||
| tps | 无 | 每秒事务数据 `TPS= (commit+rollback)/seconds`|
|
|
||||||
|
|
||||||
|
|
||||||
#### 指标集合:innodb
|
#### 指标集合:innodb
|
||||||
|
|||||||
62
home/docs/help/oracle.md
Normal file
62
home/docs/help/oracle.md
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
---
|
||||||
|
id: oracle
|
||||||
|
title: 监控:ORACLE数据库监控
|
||||||
|
sidebar_label: ORACLE数据库
|
||||||
|
---
|
||||||
|
|
||||||
|
> 对ORACLE数据库的通用性能指标进行采集监控。
|
||||||
|
|
||||||
|
### 配置参数
|
||||||
|
|
||||||
|
| 参数名称 | 参数帮助描述 |
|
||||||
|
| ----------- | ----------- |
|
||||||
|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
|
||||||
|
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
|
||||||
|
| 端口 | 数据库对外提供的端口,默认为1521。 |
|
||||||
|
| 查询超时时间 | 设置SQL查询未响应数据时的超时时间,单位ms毫秒,默认3000毫秒。 |
|
||||||
|
| 数据库名称 | 数据库实例名称,可选。 |
|
||||||
|
| 用户名 | 数据库连接用户名,可选 |
|
||||||
|
| 密码 | 数据库连接密码,可选 |
|
||||||
|
| URL | 数据库连接URL,可选,若配置,则URL里面的数据库名称,用户名密码等参数会覆盖上面配置的参数 |
|
||||||
|
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为10秒 |
|
||||||
|
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
|
||||||
|
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
|
||||||
|
|
||||||
|
### 采集指标
|
||||||
|
|
||||||
|
#### 指标集合:basic
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| database_version | 无 | 数据库版本 |
|
||||||
|
| database_type | 无 | 数据库类型 |
|
||||||
|
| hostname | 无 | 主机名称 |
|
||||||
|
| instance_name | 无 | 数据库实例名称 |
|
||||||
|
| startup_time | 无 | 数据库启动时间 |
|
||||||
|
| status | 无 | 数据库状态 |
|
||||||
|
|
||||||
|
#### 指标集合:tablespace
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| file_id | 无 | 文件ID |
|
||||||
|
| file_name | 无 | 文件名称 |
|
||||||
|
| tablespace_name | 无 | 所属表空间名称 |
|
||||||
|
| status | 无 | 状态 |
|
||||||
|
| bytes | MB | 大小 |
|
||||||
|
| blocks | 无 | 区块数量 |
|
||||||
|
|
||||||
|
#### 指标集合:user_connect
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| username | 无 | 用户名 |
|
||||||
|
| counts | 个数 | 当前连接数量 |
|
||||||
|
|
||||||
|
#### 指标集合:performance
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| qps | QPS | I/O Requests per Second 每秒IO请求数量 |
|
||||||
|
| tps | TPS | User Transaction Per Sec 每秒用户事物处理数量 |
|
||||||
|
| mbps | MBPS | I/O Megabytes per Second 每秒 I/O 兆字节数量 |
|
||||||
57
home/docs/help/postgresql.md
Normal file
57
home/docs/help/postgresql.md
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
---
|
||||||
|
id: postgresql
|
||||||
|
title: 监控:PostgreSQL数据库监控
|
||||||
|
sidebar_label: PostgreSQL数据库
|
||||||
|
---
|
||||||
|
|
||||||
|
> 对PostgreSQL数据库的通用性能指标进行采集监控。支持PostgreSQL 10+。
|
||||||
|
|
||||||
|
### 配置参数
|
||||||
|
|
||||||
|
| 参数名称 | 参数帮助描述 |
|
||||||
|
| ----------- | ----------- |
|
||||||
|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
|
||||||
|
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
|
||||||
|
| 端口 | 数据库对外提供的端口,默认为5432。 |
|
||||||
|
| 查询超时时间 | 设置SQL查询未响应数据时的超时时间,单位ms毫秒,默认3000毫秒。 |
|
||||||
|
| 数据库名称 | 数据库实例名称,可选。 |
|
||||||
|
| 用户名 | 数据库连接用户名,可选 |
|
||||||
|
| 密码 | 数据库连接密码,可选 |
|
||||||
|
| URL | 数据库连接URL,可选,若配置,则URL里面的数据库名称,用户名密码等参数会覆盖上面配置的参数 |
|
||||||
|
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为10秒 |
|
||||||
|
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
|
||||||
|
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
|
||||||
|
|
||||||
|
### 采集指标
|
||||||
|
|
||||||
|
#### 指标集合:basic
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| server_version | 无 | 数据库服务器的版本号 |
|
||||||
|
| port | 无 | 数据库服务器端暴露服务端口 |
|
||||||
|
| server_encoding | 无 | 数据库服务器端的字符集编码 |
|
||||||
|
| data_directory | 无 | 数据库存储数据盘地址 |
|
||||||
|
| max_connections | 连接数 | 数据库最大连接数 |
|
||||||
|
|
||||||
|
#### 指标集合:state
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| name | 无 | 数据库名称,或share-object为共享对象。 |
|
||||||
|
| conflicts | 次数 | 由于与恢复冲突而在这个数据库中被取消的查询的数目 |
|
||||||
|
| deadlocks | 个数 | 在这个数据库中被检测到的死锁数 |
|
||||||
|
| blks_read | 次数 | 在这个数据库中被读取的磁盘块的数量 |
|
||||||
|
| blks_hit | 次数 | 磁盘块被发现已经在缓冲区中的次数,这样不需要一次读取(这只包括 PostgreSQL 缓冲区中的命中,而不包括在操作系统文件系统缓冲区中的命中) |
|
||||||
|
| blk_read_time | ms | 在这个数据库中后端花费在读取数据文件块的时间 |
|
||||||
|
| blk_write_time | ms | 在这个数据库中后端花费在写数据文件块的时间 |
|
||||||
|
| stats_reset | 无 | 这些统计信息上次被重置的时间 |
|
||||||
|
|
||||||
|
|
||||||
|
#### 指标集合:activity
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| running | 连接数 | 当前客户端连接数 |
|
||||||
|
|
||||||
|
|
||||||
57
home/docs/help/sqlserver.md
Normal file
57
home/docs/help/sqlserver.md
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
---
|
||||||
|
id: sqlserver
|
||||||
|
title: 监控:SqlServer数据库监控
|
||||||
|
sidebar_label: SqlServer数据库
|
||||||
|
---
|
||||||
|
|
||||||
|
> 对SqlServer数据库的通用性能指标进行采集监控。支持SqlServer 2017+。
|
||||||
|
|
||||||
|
### 配置参数
|
||||||
|
|
||||||
|
| 参数名称 | 参数帮助描述 |
|
||||||
|
| ----------- | ----------- |
|
||||||
|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
|
||||||
|
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
|
||||||
|
| 端口 | 数据库对外提供的端口,默认为1433。 |
|
||||||
|
| 查询超时时间 | 设置SQL查询未响应数据时的超时时间,单位ms毫秒,默认3000毫秒。 |
|
||||||
|
| 数据库名称 | 数据库实例名称,可选。 |
|
||||||
|
| 用户名 | 数据库连接用户名,可选 |
|
||||||
|
| 密码 | 数据库连接密码,可选 |
|
||||||
|
| URL | 数据库连接URL,可选,若配置,则URL里面的数据库名称,用户名密码等参数会覆盖上面配置的参数 |
|
||||||
|
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为10秒 |
|
||||||
|
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
|
||||||
|
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
|
||||||
|
|
||||||
|
### 采集指标
|
||||||
|
|
||||||
|
#### 指标集合:basic
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| machine_name | 无 | 运行服务器实例的 Windows 计算机名称 |
|
||||||
|
| server_name | 无 | 与Windows实例关联的服务器和实例信息SQL Server |
|
||||||
|
| version | 无 | 实例的版本,SQL Server,格式为"major.minor.build.revision" |
|
||||||
|
| edition | 无 | 已安装的 实例的产品SQL Server版本 |
|
||||||
|
| start_time | 无 | 数据库启动时间 |
|
||||||
|
|
||||||
|
#### 指标集合:performance_counters
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| database_pages | 无 | Database pages, 已获得的页面数(缓冲池) |
|
||||||
|
| target_pages | 无 | Target pages, 缓冲池必须的理想页面数 |
|
||||||
|
| page_life_expectancy | s,秒 | Page life expectancy, 数据页在缓冲池中驻留的时间,这个时间一般会大于 300 |
|
||||||
|
| buffer_cache_hit_ratio | % | Buffer cache hit ratio, 数据库缓冲池高速缓冲命中率,被请求的数据在缓冲池中被找到的概率,一般会大于 80% 才算正常,否则可能是缓冲池容量太小 |
|
||||||
|
| checkpoint_pages_sec | 无 | Checkpoint pages/sec, 检查点每秒写入磁盘的脏页个数,如果数据过高,证明缺少内存容量 |
|
||||||
|
| page_reads_sec | 无 | Page reads/sec, 缓存池中每秒读的页数 |
|
||||||
|
| page_writes_sec | 无 | Page writes/sec, 缓存池中每秒写的页数 |
|
||||||
|
|
||||||
|
|
||||||
|
#### 指标集合:connection
|
||||||
|
|
||||||
|
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||||
|
| ----------- | ----------- | ----------- |
|
||||||
|
| user_connection | 无 | 已连接的会话数 |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -5,12 +5,13 @@ sidebar_label: 介绍
|
|||||||
slug: /
|
slug: /
|
||||||
---
|
---
|
||||||
|
|
||||||
> 易用友好的高性能监控告警系统。
|
> 易用友好的监控告警系统。
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
@@ -26,7 +27,7 @@ slug: /
|
|||||||
|
|
||||||
## 🎡 <font color="green">介绍</font>
|
## 🎡 <font color="green">介绍</font>
|
||||||
|
|
||||||
> [HertzBeat赫兹跳动](https://github.com/dromara/hertzbeat) 是由[Dromara](https://dromara.org)孵化,[TanCloud](https://tancloud.cn)开源的一个支持网站,API,PING,端口,数据库等监控类型,拥有易用友好的可视化操作界面的开源监控告警项目。
|
> [HertzBeat赫兹跳动](https://github.com/dromara/hertzbeat) 是由[Dromara](https://dromara.org)孵化,[TanCloud](https://tancloud.cn)开源的一个支持网站,API,PING,端口,数据库,操作系统等监控类型,拥有易用友好的可视化操作界面的开源监控告警项目。
|
||||||
> 当然,我们也提供了对应的[SAAS云监控版本](https://console.tancloud.cn),中小团队和个人无需再为了监控自己的网站资源,而去部署一套繁琐的监控系统,[登录即可免费开始](https://console.tancloud.cn)监控之旅。
|
> 当然,我们也提供了对应的[SAAS云监控版本](https://console.tancloud.cn),中小团队和个人无需再为了监控自己的网站资源,而去部署一套繁琐的监控系统,[登录即可免费开始](https://console.tancloud.cn)监控之旅。
|
||||||
> HertzBeat 支持自定义监控,只用通过配置YML文件我们就可以自定义需要的监控类型和指标,来满足常见的个性化需求。
|
> HertzBeat 支持自定义监控,只用通过配置YML文件我们就可以自定义需要的监控类型和指标,来满足常见的个性化需求。
|
||||||
> HertzBeat 模块化,`manager, collector, scheduler, warehouse, alerter` 各个模块解耦合,方便理解与定制开发。
|
> HertzBeat 模块化,`manager, collector, scheduler, warehouse, alerter` 各个模块解耦合,方便理解与定制开发。
|
||||||
|
|||||||
68
home/docs/others/contributing.md
Normal file
68
home/docs/others/contributing.md
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
---
|
||||||
|
id: contributing
|
||||||
|
title: 参与贡献
|
||||||
|
sidebar_label: 参与贡献
|
||||||
|
---
|
||||||
|
|
||||||
|
参与贡献
|
||||||
|
=======================================
|
||||||
|
|
||||||
|
非常欢迎参与项目贡献,我们致力于维护一个互相帮助的快乐社区。
|
||||||
|
|
||||||
|
### 模块
|
||||||
|
|
||||||
|
- **[manager](https://github.com/dromara/hertzbeat/tree/master/manager)** 提供监控管理,系统管理基础服务
|
||||||
|
> 提供对监控的管理,监控应用配置的管理,系统用户租户后台管理等。
|
||||||
|
- **[collector](https://github.com/dromara/hertzbeat/tree/master/collector)** 提供监控数据采集服务
|
||||||
|
> 使用通用协议远程采集获取对端指标数据。
|
||||||
|
- **[scheduler](https://github.com/dromara/hertzbeat/tree/master/scheduler)** 提供监控任务调度服务
|
||||||
|
> 采集任务管理,一次性任务和周期性任务的调度分发。
|
||||||
|
- **[warehouse](https://github.com/dromara/hertzbeat/tree/master/warehouse)** 提供监控数据仓储服务
|
||||||
|
> 采集指标结果数据管理,数据落盘,查询,计算统计。
|
||||||
|
- **[alerter](https://github.com/dromara/hertzbeat/tree/master/alerter)** 提供告警服务
|
||||||
|
> 告警计算触发,监控状态联动,告警配置,告警通知。
|
||||||
|
- **[web-app](https://github.com/dromara/hertzbeat/tree/master/web-app)** 提供可视化控制台页面
|
||||||
|
> 监控告警系统可视化控制台前端
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 如何贡献?
|
||||||
|
|
||||||
|
我们不仅仅接收代码的贡献提交,您也可以通过提交文档的更新或者BUG的报告来参与社区贡献。
|
||||||
|
|
||||||
|
如果是新的贡献者,请首先了解参考仓库提交Issues,提交Pull Requests如何工作。
|
||||||
|
|
||||||
|
https://github.com/dromara/hertzbeat/issues
|
||||||
|
https://github.com/dromara/hertzbeat/pulls
|
||||||
|
https://gitee.com/dromara/hertzbeat/issues
|
||||||
|
https://gitee.com/dromara/hertzbeat/pulls
|
||||||
|
|
||||||
|
## 本地代码工程启动
|
||||||
|
|
||||||
|
此为前后端分离项目,本地代码启动需将后端 [manager](https://github.com/dromara/hertzbeat/tree/master/manager) 和前端 [web-app](https://github.com/dromara/hertzbeat/tree/master/web-app) 分别启动生效。
|
||||||
|
|
||||||
|
### 后端启动
|
||||||
|
|
||||||
|
1. 部署启动依赖服务`MYSQL`和`TDengine`数据库
|
||||||
|
2. 需要`maven3+`和`java8+`环境
|
||||||
|
3. 修改配置文件的依赖服务地址等信息-`manager/src/main/resources/application.yml`
|
||||||
|
4. 启动`manager`服务 `manager/src/main/java/com/usthe/manager/Manager.java`
|
||||||
|
|
||||||
|
### 前端启动
|
||||||
|
|
||||||
|
1. 需要nodejs npm环境
|
||||||
|
下载地址:https://nodejs.org/en/download
|
||||||
|
2. 安装yarn `npm install -g yarn`
|
||||||
|
3. 在前端工程目录web-app下执行 `yarn install`
|
||||||
|
4. 全局安装angular-cli `npm install -g @angular/cli@12 --registry=https://registry.npm.taobao.org`
|
||||||
|
5. 待本地后端启动后,在web-app目录下启动本地前端 `ng serve --open`
|
||||||
|
6. 浏览器访问 localhost:4200 即可开始
|
||||||
|
|
||||||
|
## 加入交流
|
||||||
|
|
||||||
|
[Github Discussion](https://github.com/dromara/hertzbeat/discussions)
|
||||||
|
加微信号 tan-cloud 拉您进微信交流群
|
||||||
|
加QQ群号 718618151 进QQ交流群, 验证信息: tancloud
|
||||||
|
微信公众号:tancloudtech
|
||||||
|
[Dromara社区网站](https://dromara.org/)
|
||||||
|
[HertzBeat用户网站](https://support.qq.com/products/379369)
|
||||||
@@ -43,10 +43,56 @@ sidebar_label: Docker方式部署
|
|||||||
HertzBeat默认内置三个用户账户,分别为 admin/admin tom/tom@123 lili/lili
|
HertzBeat默认内置三个用户账户,分别为 admin/admin tom/tom@123 lili/lili
|
||||||
若需要新增删除修改账户或密码,可以通过配置 `sureness.yml` 实现,若无此需求可忽略此步骤
|
若需要新增删除修改账户或密码,可以通过配置 `sureness.yml` 实现,若无此需求可忽略此步骤
|
||||||
在主机目录下创建sureness.yml,eg:/opt/sureness.yml
|
在主机目录下创建sureness.yml,eg:/opt/sureness.yml
|
||||||
配置文件内容参考 项目仓库[/script/sureness.yml](https://gitee.com/dromara/hertzbeat/blob/master/script/sureness.yml)
|
配置文件内容参考 项目仓库[/script/sureness.yml](https://gitee.com/dromara/hertzbeat/blob/master/script/sureness.yml)
|
||||||
修改sureness.yml的如下部分参数:[注意⚠️sureness配置的其它默认参数需保留]
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|
||||||
|
resourceRole:
|
||||||
|
- /account/auth/refresh===post===[role1,role2,role3,role4]
|
||||||
|
|
||||||
|
excludedResource:
|
||||||
|
- /account/auth/**===*
|
||||||
|
- /===get
|
||||||
|
- /i18n/**===get
|
||||||
|
- /apps/hierarchy===get
|
||||||
|
- /console/**===get
|
||||||
|
- /**/*.html===get
|
||||||
|
- /**/*.js===get
|
||||||
|
- /**/*.css===get
|
||||||
|
- /**/*.ico===get
|
||||||
|
- /**/*.ttf===get
|
||||||
|
- /**/*.png===get
|
||||||
|
- /**/*.gif===get
|
||||||
|
- /**/*.png===*
|
||||||
|
- /swagger-resources/**===get
|
||||||
|
- /v2/api-docs===get
|
||||||
|
- /v3/api-docs===get
|
||||||
|
|
||||||
|
# 用户账户信息
|
||||||
|
# 下面有 admin tom lili 三个账户
|
||||||
|
# eg: admin 拥有[role1,role2]角色,密码为admin
|
||||||
|
# eg: tom 拥有[role1,role2,role3],密码为tom@123
|
||||||
|
# eg: lili 拥有[role1,role2],明文密码为lili, 加盐密码为1A676730B0C7F54654B0E09184448289
|
||||||
|
account:
|
||||||
|
- appId: admin
|
||||||
|
credential: admin
|
||||||
|
role: [role1,role2]
|
||||||
|
- appId: tom
|
||||||
|
credential: tom@123
|
||||||
|
role: [role1,role2,role3]
|
||||||
|
- appId: lili
|
||||||
|
# 注意 Digest认证不支持加盐加密的密码账户
|
||||||
|
# 加盐加密的密码,通过 MD5(password+salt)计算
|
||||||
|
# 此账户的原始密码为 lili
|
||||||
|
credential: 1A676730B0C7F54654B0E09184448289
|
||||||
|
salt: 123
|
||||||
|
role: [role1,role2]
|
||||||
|
```
|
||||||
|
|
||||||
|
修改sureness.yml的如下**部分参数**:**[注意⚠️sureness配置的其它默认参数需保留]**
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
|
||||||
# 用户账户信息
|
# 用户账户信息
|
||||||
# 下面有 admin tom lili 三个账户
|
# 下面有 admin tom lili 三个账户
|
||||||
# eg: admin 拥有[role1,role2]角色,密码为admin
|
# eg: admin 拥有[role1,role2]角色,密码为admin
|
||||||
@@ -82,7 +128,7 @@ sidebar_label: Docker方式部署
|
|||||||
- tancloud/hertzbeat:[版本tag] : 使用拉取的HertzBeat官方发布的应用镜像来启动容器,TAG可查看[官方镜像仓库](https://hub.docker.com/r/tancloud/hertzbeat/tags)
|
- tancloud/hertzbeat:[版本tag] : 使用拉取的HertzBeat官方发布的应用镜像来启动容器,TAG可查看[官方镜像仓库](https://hub.docker.com/r/tancloud/hertzbeat/tags)
|
||||||
|
|
||||||
7. 开始探索HertzBeat
|
7. 开始探索HertzBeat
|
||||||
浏览器访问 http://ip:1157/console 开始使用HertzBeat进行监控告警。
|
浏览器访问 http://ip:1157/console 开始使用HertzBeat进行监控告警,默认账户密码 admin/admin。
|
||||||
|
|
||||||
**HAVE FUN**
|
**HAVE FUN**
|
||||||
|
|
||||||
@@ -101,4 +147,4 @@ sidebar_label: Docker方式部署
|
|||||||
|
|
||||||
3. **日志报错TDengine连接或插入SQL失败**
|
3. **日志报错TDengine连接或插入SQL失败**
|
||||||
> 一:排查配置的数据库账户密码是否正确,数据库是否创建
|
> 一:排查配置的数据库账户密码是否正确,数据库是否创建
|
||||||
> 二:若是安装包安装的TDengine2.3+,除了启动server外,还需执行 `systemctl start taosadapter` 启动 adapter
|
> 二:若是安装包安装的TDengine2.3+,除了启动server外,还需执行 `systemctl start taosadapter` 启动 adapter
|
||||||
|
|||||||
@@ -17,14 +17,18 @@ MYSQL是一款值得信赖的关系型数据库,HertzBeat使用其存储监控
|
|||||||
```
|
```
|
||||||
2. Docker安装MYSQl
|
2. Docker安装MYSQl
|
||||||
```
|
```
|
||||||
$ docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:latest
|
$ docker run -d --name mysql -p 3306:3306 -v /opt/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7
|
||||||
526aa188da767ae94b244226a2b2eec2b5f17dd8eff594533d9ec0cd0f3a1ccd
|
526aa188da767ae94b244226a2b2eec2b5f17dd8eff594533d9ec0cd0f3a1ccd
|
||||||
```
|
```
|
||||||
|
`-v /opt/data:/var/lib/mysql` 为mysql数据目录本地持久化挂载,需将`/opt/data`替换为实际本地存在的目录
|
||||||
使用```$ docker ps```查看数据库是否启动成功
|
使用```$ docker ps```查看数据库是否启动成功
|
||||||
|
|
||||||
### SQL脚本执行
|
### SQL脚本执行
|
||||||
1. 进入MYSQL或使用客户端连接MYSQL服务
|
1. 进入MYSQL或使用客户端连接MYSQL服务
|
||||||
2. 创建名称为hertzbeat的数据库
|
`mysql -uroot -p123456`
|
||||||
|
2. 创建名称为hertzbeat的数据库
|
||||||
|
`create database hertzbeat;`
|
||||||
3. 执行位于项目仓库/script/sql/目录下的数据库建表初始化脚本 [schema.sql](https://gitee.com/dromara/hertzbeat/raw/master/script/sql/schema.sql)
|
3. 执行位于项目仓库/script/sql/目录下的数据库建表初始化脚本 [schema.sql](https://gitee.com/dromara/hertzbeat/raw/master/script/sql/schema.sql)
|
||||||
|
`mysql -uroot -p123456 < schema.sql`
|
||||||
4. 查看hertzbeat数据库是否成功建表
|
4. 查看hertzbeat数据库是否成功建表
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ sidebar_label: 安装包方式部署
|
|||||||
4. 配置用户配置文件(非必须,配置账户需要)
|
4. 配置用户配置文件(非必须,配置账户需要)
|
||||||
HertzBeat默认内置三个用户账户,分别为 admin/admin tom/tom@123 lili/lili
|
HertzBeat默认内置三个用户账户,分别为 admin/admin tom/tom@123 lili/lili
|
||||||
若需要新增删除修改账户或密码,可以通过修改位于 `hertzbeat/config/sureness.yml` 的配置文件实现,若无此需求可忽略此步骤
|
若需要新增删除修改账户或密码,可以通过修改位于 `hertzbeat/config/sureness.yml` 的配置文件实现,若无此需求可忽略此步骤
|
||||||
修改sureness.yml的如下部分参数:[注意⚠️sureness配置的其它默认参数需保留]
|
修改sureness.yml的如下**部分参数**:**[注意⚠️sureness配置的其它默认参数需保留]**
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# 用户账户信息
|
# 用户账户信息
|
||||||
@@ -76,7 +76,7 @@ sidebar_label: 安装包方式部署
|
|||||||
$ ./startup.sh
|
$ ./startup.sh
|
||||||
```
|
```
|
||||||
6. 开始探索HertzBeat
|
6. 开始探索HertzBeat
|
||||||
浏览器访问 http://ip:1157/console 开始使用HertzBeat进行监控告警。
|
浏览器访问 http://ip:1157/console 开始使用HertzBeat进行监控告警,默认账户密码 admin/admin。
|
||||||
|
|
||||||
**HAVE FUN**
|
**HAVE FUN**
|
||||||
|
|
||||||
@@ -90,4 +90,4 @@ sidebar_label: 安装包方式部署
|
|||||||
|
|
||||||
2. **日志报错TDengine连接或插入SQL失败**
|
2. **日志报错TDengine连接或插入SQL失败**
|
||||||
> 一:排查配置的数据库账户密码是否正确,数据库是否创建
|
> 一:排查配置的数据库账户密码是否正确,数据库是否创建
|
||||||
> 二:若是安装包安装的TDengine2.3+,除了启动server外,还需执行 `systemctl start taosadapter` 启动 adapter
|
> 二:若是安装包安装的TDengine2.3+,除了启动server外,还需执行 `systemctl start taosadapter` 启动 adapter
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ sidebar_label: 快速开始
|
|||||||
|
|
||||||
##### 安装MYSQL
|
##### 安装MYSQL
|
||||||
1. docker安装MYSQl
|
1. docker安装MYSQl
|
||||||
`docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql`
|
`docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7`
|
||||||
2. 创建名称为hertzbeat的数据库
|
2. 创建名称为hertzbeat的数据库
|
||||||
3. 执行位于项目仓库/script/sql/目录下的数据库脚本 [schema.sql](https://gitee.com/dromara/hertzbeat/raw/master/script/sql/schema.sql)
|
3. 执行位于项目仓库/script/sql/目录下的数据库脚本 [schema.sql](https://gitee.com/dromara/hertzbeat/raw/master/script/sql/schema.sql)
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ sidebar_label: 快速开始
|
|||||||
|
|
||||||
##### 安装TDengine
|
##### 安装TDengine
|
||||||
1. docker安装TDengine
|
1. docker安装TDengine
|
||||||
`docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp --name tdengine tdengine/tdengine`
|
`docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp --name tdengine tdengine/tdengine:2.4.0.12`
|
||||||
2. 创建名称为hertzbeat的数据库
|
2. 创建名称为hertzbeat的数据库
|
||||||
|
|
||||||
详细步骤参考 [依赖服务TDengine安装初始化](tdengine-init.md)
|
详细步骤参考 [依赖服务TDengine安装初始化](tdengine-init.md)
|
||||||
@@ -31,16 +31,30 @@ sidebar_label: 快速开始
|
|||||||
### 🍞 HertzBeat安装
|
### 🍞 HertzBeat安装
|
||||||
> HertzBeat支持通过源码安装启动,Docker容器运行和安装包方式安装部署。
|
> HertzBeat支持通过源码安装启动,Docker容器运行和安装包方式安装部署。
|
||||||
|
|
||||||
#### Docker方式快速安装
|
#### 方式一:Docker方式快速安装
|
||||||
`docker run -d -p 1157:1157 -v /opt/application.yml:/opt/hertzbeat/config/application.yml --name hertzbeat tancloud/hertzbeat:[版本tag]`
|
`docker run -d -p 1157:1157 -v /opt/application.yml:/opt/hertzbeat/config/application.yml --name hertzbeat tancloud/hertzbeat:[版本tag]`
|
||||||
|
|
||||||
详细步骤参考 [通过Docker方式安装HertzBeat](docker-deploy.md)
|
详细步骤参考 [通过Docker方式安装HertzBeat](docker-deploy.md)
|
||||||
|
|
||||||
#### 通过安装包安装
|
#### 方式二:通过安装包安装
|
||||||
1. 下载您系统环境对应的安装包 [GITEE Release](https://gitee.com/dromara/hertzbeat/releases) [GITHUB Release](https://github.com/dromara/hertzbeat/releases)
|
1. 下载您系统环境对应的安装包 [GITEE Release](https://gitee.com/dromara/hertzbeat/releases) [GITHUB Release](https://github.com/dromara/hertzbeat/releases)
|
||||||
2. 配置HertzBeat的配置文件 hertzbeat/config/application.yml
|
2. 配置HertzBeat的配置文件 hertzbeat/config/application.yml
|
||||||
3. 部署启动 `$ ./startup.sh `
|
3. 部署启动 `$ ./startup.sh `
|
||||||
|
|
||||||
详细步骤参考 [通过安装包安装HertzBeat](package-deploy.md)
|
详细步骤参考 [通过安装包安装HertzBeat](package-deploy.md)
|
||||||
|
|
||||||
|
#### 方式三:本地代码启动
|
||||||
|
1. 此为前后端分离项目,本地代码调试需要分别启动后端工程manager和前端工程web-app
|
||||||
|
2. 后端:需要`maven3+`和`java8+`环境,修改YML配置信息并启动manager服务
|
||||||
|
3. 前端:需要`nodejs npm angular-cli`环境,待本地后端启动后,在web-app目录下启动 `ng serve --open`
|
||||||
|
4. 浏览器访问 localhost:4200 即可开始,默认账户密码 admin/admin
|
||||||
|
|
||||||
|
详细步骤参考 [参与贡献之本地代码启动](../others/contributing)
|
||||||
|
|
||||||
|
#### 方式四:Docker-Compose统一安装hertzbeat及其依赖服务
|
||||||
|
|
||||||
|
通过 [docker-compose部署脚本](https://gitee.com/dromara/hertzbeat/tree/master/script/docker-compose) 一次性把mysql数据库,tdengine数据库和hertzbeat安装部署。
|
||||||
|
|
||||||
|
详细步骤参考 [docker-compose安装](https://gitee.com/dromara/hertzbeat/tree/master/script/docker-compose/README.md)
|
||||||
|
|
||||||
**HAVE FUN**
|
**HAVE FUN**
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ TDengine是一款国产的开源物联网时序型数据库,我们使用其替
|
|||||||
```
|
```
|
||||||
2. Docker安装TDengine
|
2. Docker安装TDengine
|
||||||
```
|
```
|
||||||
$ docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp --name tdengine tdengine/tdengine
|
$ docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp -v /opt/taosdata:/var/lib/taos --name tdengine tdengine/tdengine:2.4.0.12
|
||||||
526aa188da767ae94b244226a2b2eec2b5f17dd8eff594533d9ec0cd0f3a1ccd
|
526aa188da767ae94b244226a2b2eec2b5f17dd8eff594533d9ec0cd0f3a1ccd
|
||||||
```
|
```
|
||||||
|
`-v /opt/taosdata:/var/lib/taos` 为tdengine数据目录本地持久化挂载,需将`/opt/taosdata`替换为实际本地存在的目录
|
||||||
使用```$ docker ps```查看数据库是否启动成功
|
使用```$ docker ps```查看数据库是否启动成功
|
||||||
|
|
||||||
### 创建数据库实例
|
### 创建数据库实例
|
||||||
@@ -50,4 +51,4 @@ TDengine是一款国产的开源物联网时序型数据库,我们使用其替
|
|||||||
```
|
```
|
||||||
|
|
||||||
**注意⚠️若是安装包安装的TDengine2.3+版本**
|
**注意⚠️若是安装包安装的TDengine2.3+版本**
|
||||||
> 除了启动server外,还需执行 `systemctl start taosadapter` 启动 adapter
|
> 除了启动server外,还需执行 `systemctl start taosadapter` 启动 adapter
|
||||||
|
|||||||
@@ -28,9 +28,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "category",
|
"type": "category",
|
||||||
"label": "MYSQL协议",
|
"label": "JDBC协议",
|
||||||
"items": [
|
"items": [
|
||||||
"advanced/extend-mysql"
|
"advanced/extend-jdbc"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "category",
|
||||||
|
"label": "SSH协议",
|
||||||
|
"items": [
|
||||||
|
"advanced/extend-ssh"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -56,7 +63,17 @@
|
|||||||
"label": "数据库监控",
|
"label": "数据库监控",
|
||||||
"items": [
|
"items": [
|
||||||
"help/mysql",
|
"help/mysql",
|
||||||
"help/mariadb"
|
"help/mariadb",
|
||||||
|
"help/postgresql",
|
||||||
|
"help/sqlserver",
|
||||||
|
"help/oracle"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "category",
|
||||||
|
"label": "操作系统",
|
||||||
|
"items": [
|
||||||
|
"help/linux"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -89,7 +106,8 @@
|
|||||||
"others/design",
|
"others/design",
|
||||||
"others/sponsor",
|
"others/sponsor",
|
||||||
"others/private",
|
"others/private",
|
||||||
"others/resource"
|
"others/resource",
|
||||||
|
"others/contributing"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export const features = [{
|
|||||||
custom: <a href={'/docs/advanced/extend-point'}><strong>自定义监控</strong></a>,
|
custom: <a href={'/docs/advanced/extend-point'}><strong>自定义监控</strong></a>,
|
||||||
br: <br/>
|
br: <br/>
|
||||||
}}>
|
}}>
|
||||||
{'HertzBeat目前支持对网站,API,PING连通性,端口可用性,SiteMap全站,MYSQL数据库等的监控,不久我们将兼容 prometheus 协议,提供更多的监控类型和性能指标。{br}' +
|
{'HertzBeat目前支持对网站,API,PING连通性,端口可用性,SiteMap全站,数据库,操作系统等的监控,快速迭代提供更多的监控类型和性能指标。{br}' +
|
||||||
'我们提供了更自由化的阈值告警配置,支持邮箱,短信,webhook,钉钉,企业微信,飞书机器人等告警通知。{br}' +
|
'我们提供了更自由化的阈值告警配置,支持邮箱,短信,webhook,钉钉,企业微信,飞书机器人等告警通知。{br}' +
|
||||||
'不同团队的监控需求千变万化,我们提供{custom},仅需配置YML就能快速接入监控系统。'
|
'不同团队的监控需求千变万化,我们提供{custom},仅需配置YML就能快速接入监控系统。'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,12 +28,13 @@ function Home() {
|
|||||||
<h1 className="hero__title">
|
<h1 className="hero__title">
|
||||||
<img style={{width: '500px', marginTop: '100px'}} src={cdnTransfer('img/hertzbeat-brand.svg')} alt={'#'}/>
|
<img style={{width: '500px', marginTop: '100px'}} src={cdnTransfer('img/hertzbeat-brand.svg')} alt={'#'}/>
|
||||||
</h1>
|
</h1>
|
||||||
<p className="hero__subtitle"><Translate>易用友好的高性能监控告警系统</Translate></p>
|
<p className="hero__subtitle"><Translate>易用友好的监控告警系统</Translate></p>
|
||||||
<div className={styles.social}>
|
<div className={styles.social}>
|
||||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/web-monitor.svg')} alt={''}/></a>
|
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/web-monitor.svg')} alt={''}/></a>
|
||||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/ping-connect.svg')} alt={''}/></a>
|
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/ping-connect.svg')} alt={''}/></a>
|
||||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/port-available.svg')} alt={''}/></a>
|
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/port-available.svg')} alt={''}/></a>
|
||||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/database-monitor.svg')} alt={''}/></a>
|
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/database-monitor.svg')} alt={''}/></a>
|
||||||
|
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/os-monitor.svg')} alt={''}/></a>
|
||||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/custom-monitor.svg')} alt={''}/></a>
|
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/custom-monitor.svg')} alt={''}/></a>
|
||||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/threshold.svg')} alt={''}/></a>
|
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/threshold.svg')} alt={''}/></a>
|
||||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/alert.svg')} alt={''}/></a>
|
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/alert.svg')} alt={''}/></a>
|
||||||
|
|||||||
1
home/static/img/badge/os-monitor.svg
Normal file
1
home/static/img/badge/os-monitor.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="55" height="20" role="img" aria-label="操作系统"><title>操作系统</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="55" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="0" height="20" fill="#4c1"/><rect x="0" width="55" height="20" fill="#4c1"/><rect width="55" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">操作系统</text><text x="275" y="140" transform="scale(.1)" fill="#fff" textLength="450">操作系统</text></g></svg>
|
||||||
|
After Width: | Height: | Size: 929 B |
@@ -38,6 +38,8 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
|||||||
@RequestMapping(path = "/monitors", produces = {APPLICATION_JSON_VALUE})
|
@RequestMapping(path = "/monitors", produces = {APPLICATION_JSON_VALUE})
|
||||||
public class MonitorsController {
|
public class MonitorsController {
|
||||||
|
|
||||||
|
private static final byte ALL_MONITOR_STATUS = 9;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MonitorService monitorService;
|
private MonitorService monitorService;
|
||||||
|
|
||||||
@@ -48,6 +50,7 @@ public class MonitorsController {
|
|||||||
@ApiParam(value = "监控类型", example = "linux") @RequestParam(required = false) final String app,
|
@ApiParam(value = "监控类型", example = "linux") @RequestParam(required = false) final String app,
|
||||||
@ApiParam(value = "监控名称,模糊查询", example = "linux-127.0.0.1") @RequestParam(required = false) final String name,
|
@ApiParam(value = "监控名称,模糊查询", example = "linux-127.0.0.1") @RequestParam(required = false) final String name,
|
||||||
@ApiParam(value = "监控Host,模糊查询", example = "127.0.0.1") @RequestParam(required = false) final String host,
|
@ApiParam(value = "监控Host,模糊查询", example = "127.0.0.1") @RequestParam(required = false) final String host,
|
||||||
|
@ApiParam(value = "监控状态 0:未监控,1:可用,2:不可用,3:不可达,4:挂起,9:全部状态", example = "1") @RequestParam(required = false) final Byte status,
|
||||||
@ApiParam(value = "排序字段,默认id", example = "name") @RequestParam(defaultValue = "id") final String sort,
|
@ApiParam(value = "排序字段,默认id", example = "name") @RequestParam(defaultValue = "id") final String sort,
|
||||||
@ApiParam(value = "排序方式,asc:升序,desc:降序", example = "desc") @RequestParam(defaultValue = "desc") final String order,
|
@ApiParam(value = "排序方式,asc:升序,desc:降序", example = "desc") @RequestParam(defaultValue = "desc") final String order,
|
||||||
@ApiParam(value = "列表当前分页", example = "0") @RequestParam(defaultValue = "0") int pageIndex,
|
@ApiParam(value = "列表当前分页", example = "0") @RequestParam(defaultValue = "0") int pageIndex,
|
||||||
@@ -66,6 +69,10 @@ public class MonitorsController {
|
|||||||
Predicate predicateApp = criteriaBuilder.equal(root.get("app"), app);
|
Predicate predicateApp = criteriaBuilder.equal(root.get("app"), app);
|
||||||
andList.add(predicateApp);
|
andList.add(predicateApp);
|
||||||
}
|
}
|
||||||
|
if (status != null && status >= 0 && status < ALL_MONITOR_STATUS) {
|
||||||
|
Predicate predicateStatus = criteriaBuilder.equal(root.get("status"), status);
|
||||||
|
andList.add(predicateStatus);
|
||||||
|
}
|
||||||
Predicate[] andPredicates = new Predicate[andList.size()];
|
Predicate[] andPredicates = new Predicate[andList.size()];
|
||||||
Predicate andPredicate = criteriaBuilder.and(andList.toArray(andPredicates));
|
Predicate andPredicate = criteriaBuilder.and(andList.toArray(andPredicates));
|
||||||
|
|
||||||
@@ -79,9 +86,17 @@ public class MonitorsController {
|
|||||||
orList.add(predicateName);
|
orList.add(predicateName);
|
||||||
}
|
}
|
||||||
Predicate[] orPredicates = new Predicate[orList.size()];
|
Predicate[] orPredicates = new Predicate[orList.size()];
|
||||||
Predicate orPredicate = criteriaBuilder.and(orList.toArray(orPredicates));
|
Predicate orPredicate = criteriaBuilder.or(orList.toArray(orPredicates));
|
||||||
|
|
||||||
return query.where(andPredicate,orPredicate).getRestriction();
|
if (andPredicate.getExpressions().isEmpty() && orPredicate.getExpressions().isEmpty()) {
|
||||||
|
return query.where().getRestriction();
|
||||||
|
} else if (andPredicate.getExpressions().isEmpty()) {
|
||||||
|
return query.where(orPredicate).getRestriction();
|
||||||
|
} else if (orPredicate.getExpressions().isEmpty()) {
|
||||||
|
return query.where(andPredicate).getRestriction();
|
||||||
|
} else {
|
||||||
|
return query.where(andPredicate,orPredicate).getRestriction();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// 分页是必须的
|
// 分页是必须的
|
||||||
Sort sortExp = Sort.by(new Sort.Order(Sort.Direction.fromString(order), sort));
|
Sort sortExp = Sort.by(new Sort.Order(Sort.Direction.fromString(order), sort));
|
||||||
|
|||||||
@@ -236,6 +236,9 @@ public class MonitorServiceImpl implements MonitorService {
|
|||||||
case "checkbox":
|
case "checkbox":
|
||||||
// todo checkbox校验
|
// todo checkbox校验
|
||||||
break;
|
break;
|
||||||
|
case "key-value":
|
||||||
|
// todo key-value校验
|
||||||
|
break;
|
||||||
// todo 更多参数定义与实际值格式校验
|
// todo 更多参数定义与实际值格式校验
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("ParamDefine type " + paramDefine.getType() + " is invalid.");
|
throw new IllegalArgumentException("ParamDefine type " + paramDefine.getType() + " is invalid.");
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ spring:
|
|||||||
on-profile: prod
|
on-profile: prod
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
username: admin
|
username: root
|
||||||
password: admin
|
password: 123456
|
||||||
url: jdbc:mysql://localhost:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
url: jdbc:mysql://localhost:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
||||||
platform: mysql
|
platform: mysql
|
||||||
hikari:
|
hikari:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ app: example
|
|||||||
name:
|
name:
|
||||||
zh-CN: 模拟应用类型
|
zh-CN: 模拟应用类型
|
||||||
en-US: EXAMPLE APP
|
en-US: EXAMPLE APP
|
||||||
# 参数映射map. type是参数类型: 0-number数字, 1-string明文字符串, 2-secret加密字符串
|
# 参数映射map. type是参数类型: 0-number数字, 1-string明文字符串, 2-secret加密字符串, 3-map映射的json串
|
||||||
# 强制固定必须参数 - host
|
# 强制固定必须参数 - host
|
||||||
configmap:
|
configmap:
|
||||||
- key: host
|
- key: host
|
||||||
@@ -16,6 +16,8 @@ configmap:
|
|||||||
type: 1
|
type: 1
|
||||||
- key: password
|
- key: password
|
||||||
type: 2
|
type: 2
|
||||||
|
- key: headers
|
||||||
|
type: 3
|
||||||
# 指标组列表
|
# 指标组列表
|
||||||
metrics:
|
metrics:
|
||||||
# 第一个监控指标组 cpu
|
# 第一个监控指标组 cpu
|
||||||
@@ -69,7 +71,7 @@ metrics:
|
|||||||
ssl: false
|
ssl: false
|
||||||
# 请求头内容
|
# 请求头内容
|
||||||
headers:
|
headers:
|
||||||
apiVersion: v1
|
^_^headers^_^: ^_^headers^_^
|
||||||
# 请求参数内容
|
# 请求参数内容
|
||||||
params:
|
params:
|
||||||
param1: param1
|
param1: param1
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ configmap:
|
|||||||
type: 1
|
type: 1
|
||||||
- key: payload
|
- key: payload
|
||||||
type: 1
|
type: 1
|
||||||
|
- key: headers
|
||||||
|
type: 3
|
||||||
# 指标组列表
|
# 指标组列表
|
||||||
metrics:
|
metrics:
|
||||||
# 第一个监控指标组 cpu
|
# 第一个监控指标组 cpu
|
||||||
@@ -58,6 +60,7 @@ metrics:
|
|||||||
# 请求头内容
|
# 请求头内容
|
||||||
headers:
|
headers:
|
||||||
content-type: ^_^contentType^_^
|
content-type: ^_^contentType^_^
|
||||||
|
^_^headers^_^: ^_^headers^_^
|
||||||
# 认证
|
# 认证
|
||||||
authorization:
|
authorization:
|
||||||
# 认证方式: Basic Auth, Digest Auth, Bearer Token
|
# 认证方式: Basic Auth, Digest Auth, Bearer Token
|
||||||
|
|||||||
175
manager/src/main/resources/define/app/linux.yml
Normal file
175
manager/src/main/resources/define/app/linux.yml
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
# 此监控类型所属类别:service-应用服务监控 db-数据库监控 custom-自定义监控 os-操作系统监控
|
||||||
|
category: os
|
||||||
|
# 监控应用类型(与文件名保持一致) eg: linux windows tomcat mysql aws...
|
||||||
|
app: linux
|
||||||
|
name:
|
||||||
|
zh-CN: Linux操作系统
|
||||||
|
en-US: OS Linux
|
||||||
|
# 参数映射map. type是参数类型: 0-number数字, 1-string明文字符串, 2-secret加密字符串
|
||||||
|
# 强制固定必须参数 - host
|
||||||
|
configmap:
|
||||||
|
- key: host
|
||||||
|
type: 1
|
||||||
|
- key: port
|
||||||
|
type: 0
|
||||||
|
- key: username
|
||||||
|
type: 1
|
||||||
|
- key: password
|
||||||
|
type: 2
|
||||||
|
- key: timeout
|
||||||
|
type: 0
|
||||||
|
# 指标组列表
|
||||||
|
metrics:
|
||||||
|
# 第一个监控指标组 basic
|
||||||
|
# 注意:内置监控指标有 (responseTime - 响应时间)
|
||||||
|
- name: basic
|
||||||
|
# 指标组调度优先级(0-127)越小优先级越高,优先级低的指标组会等优先级高的指标组采集完成后才会被调度,相同优先级的指标组会并行调度采集
|
||||||
|
# 优先级为0的指标组为可用性指标组,即它会被首先调度,采集成功才会继续调度其它指标组,采集失败则中断调度
|
||||||
|
priority: 0
|
||||||
|
# 指标组中的具体监控指标
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: hostname
|
||||||
|
type: 1
|
||||||
|
instance: true
|
||||||
|
- field: version
|
||||||
|
type: 1
|
||||||
|
- field: uptime
|
||||||
|
type: 1
|
||||||
|
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
|
||||||
|
protocol: ssh
|
||||||
|
# 当protocol为http协议时具体的采集配置
|
||||||
|
ssh:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
script: (uname -r ; hostname ; uptime | awk -F "," '{print $1}' | sed "s/ //g") | sed ":a;N;s/\n/^/g;ta" | awk -F '^' 'BEGIN{print "version hostname uptime"} {print $1, $2, $3}'
|
||||||
|
# 响应数据解析方式:oneRow, multiRow
|
||||||
|
parseType: multiRow
|
||||||
|
|
||||||
|
- name: cpu
|
||||||
|
priority: 1
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: info
|
||||||
|
type: 1
|
||||||
|
- field: cores
|
||||||
|
type: 0
|
||||||
|
unit: 核数
|
||||||
|
- field: interrupt
|
||||||
|
type: 0
|
||||||
|
unit: 个数
|
||||||
|
- field: load
|
||||||
|
type: 1
|
||||||
|
- field: context_switch
|
||||||
|
type: 0
|
||||||
|
unit: 个数
|
||||||
|
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
|
||||||
|
protocol: ssh
|
||||||
|
# 当protocol为http协议时具体的采集配置
|
||||||
|
ssh:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
script: "LANG=C lscpu | awk -F: '/Model name/ {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}'"
|
||||||
|
parseType: oneRow
|
||||||
|
|
||||||
|
- name: memory
|
||||||
|
priority: 2
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: total
|
||||||
|
type: 0
|
||||||
|
unit: Mb
|
||||||
|
- field: used
|
||||||
|
type: 0
|
||||||
|
unit: Mb
|
||||||
|
- field: free
|
||||||
|
type: 0
|
||||||
|
unit: Mb
|
||||||
|
- field: buff_cache
|
||||||
|
type: 0
|
||||||
|
unit: Mb
|
||||||
|
- field: available
|
||||||
|
type: 0
|
||||||
|
unit: Mb
|
||||||
|
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
|
||||||
|
protocol: ssh
|
||||||
|
# 当protocol为http协议时具体的采集配置
|
||||||
|
ssh:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
script: free -m | grep Mem | awk 'BEGIN{print "total used free buff_cache available"} {print $2,$3,$4,$6,$7}'
|
||||||
|
parseType: multiRow
|
||||||
|
|
||||||
|
- name: disk
|
||||||
|
priority: 3
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: disk_num
|
||||||
|
type: 0
|
||||||
|
unit: 块数
|
||||||
|
- field: partition_num
|
||||||
|
type: 0
|
||||||
|
unit: 分区数
|
||||||
|
- field: block_write
|
||||||
|
type: 0
|
||||||
|
unit: 块数
|
||||||
|
- field: block_read
|
||||||
|
type: 0
|
||||||
|
unit: 块数
|
||||||
|
- field: write_rate
|
||||||
|
type: 0
|
||||||
|
unit: iops
|
||||||
|
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
|
||||||
|
protocol: ssh
|
||||||
|
# 当protocol为http协议时具体的采集配置
|
||||||
|
ssh:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
script: vmstat -D | awk 'NR==1{print $1}';vmstat -D | awk 'NR==2{print $1}';vmstat 1 1 | awk 'NR==3{print $10}';vmstat 1 1 | awk 'NR==3{print $9}';vmstat 1 1 | awk 'NR==3{print $16}'
|
||||||
|
parseType: oneRow
|
||||||
|
|
||||||
|
- name: interface
|
||||||
|
priority: 4
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: interface_name
|
||||||
|
type: 1
|
||||||
|
- field: receive_bytes
|
||||||
|
type: 0
|
||||||
|
unit: byte
|
||||||
|
- field: transmit_bytes
|
||||||
|
type: 0
|
||||||
|
unit: byte
|
||||||
|
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
|
||||||
|
protocol: ssh
|
||||||
|
# 当protocol为http协议时具体的采集配置
|
||||||
|
ssh:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}'
|
||||||
|
parseType: multiRow
|
||||||
@@ -16,6 +16,8 @@ configmap:
|
|||||||
type: 2
|
type: 2
|
||||||
- key: database
|
- key: database
|
||||||
type: 1
|
type: 1
|
||||||
|
- key: timeout
|
||||||
|
type: 0
|
||||||
- key: url
|
- key: url
|
||||||
type: 1
|
type: 1
|
||||||
# 指标组列表
|
# 指标组列表
|
||||||
@@ -61,6 +63,7 @@ metrics:
|
|||||||
username: ^_^username^_^
|
username: ^_^username^_^
|
||||||
password: ^_^password^_^
|
password: ^_^password^_^
|
||||||
database: ^_^database^_^
|
database: ^_^database^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
# SQL查询方式: oneRow, multiRow, columns
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
queryType: columns
|
queryType: columns
|
||||||
# sql
|
# sql
|
||||||
@@ -102,6 +105,7 @@ metrics:
|
|||||||
username: ^_^username^_^
|
username: ^_^username^_^
|
||||||
password: ^_^password^_^
|
password: ^_^password^_^
|
||||||
database: ^_^database^_^
|
database: ^_^database^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
# SQL查询方式: oneRow, multiRow, columns
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
queryType: columns
|
queryType: columns
|
||||||
# sql
|
# sql
|
||||||
@@ -134,6 +138,7 @@ metrics:
|
|||||||
username: ^_^username^_^
|
username: ^_^username^_^
|
||||||
password: ^_^password^_^
|
password: ^_^password^_^
|
||||||
database: ^_^database^_^
|
database: ^_^database^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
# SQL查询方式: oneRow, multiRow, columns
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
queryType: columns
|
queryType: columns
|
||||||
# sql
|
# sql
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ configmap:
|
|||||||
type: 2
|
type: 2
|
||||||
- key: database
|
- key: database
|
||||||
type: 1
|
type: 1
|
||||||
|
- key: timeout
|
||||||
|
type: 0
|
||||||
- key: url
|
- key: url
|
||||||
type: 1
|
type: 1
|
||||||
# 指标组列表
|
# 指标组列表
|
||||||
@@ -61,6 +63,7 @@ metrics:
|
|||||||
username: ^_^username^_^
|
username: ^_^username^_^
|
||||||
password: ^_^password^_^
|
password: ^_^password^_^
|
||||||
database: ^_^database^_^
|
database: ^_^database^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
# SQL查询方式: oneRow, multiRow, columns
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
queryType: columns
|
queryType: columns
|
||||||
# sql
|
# sql
|
||||||
@@ -102,6 +105,7 @@ metrics:
|
|||||||
username: ^_^username^_^
|
username: ^_^username^_^
|
||||||
password: ^_^password^_^
|
password: ^_^password^_^
|
||||||
database: ^_^database^_^
|
database: ^_^database^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
# SQL查询方式: oneRow, multiRow, columns
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
queryType: columns
|
queryType: columns
|
||||||
# sql
|
# sql
|
||||||
@@ -134,6 +138,7 @@ metrics:
|
|||||||
username: ^_^username^_^
|
username: ^_^username^_^
|
||||||
password: ^_^password^_^
|
password: ^_^password^_^
|
||||||
database: ^_^database^_^
|
database: ^_^database^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
# SQL查询方式: oneRow, multiRow, columns
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
queryType: columns
|
queryType: columns
|
||||||
# sql
|
# sql
|
||||||
|
|||||||
182
manager/src/main/resources/define/app/oracle.yml
Normal file
182
manager/src/main/resources/define/app/oracle.yml
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
category: db
|
||||||
|
app: oracle
|
||||||
|
name:
|
||||||
|
zh-CN: Oracle数据库
|
||||||
|
en-US: Oracle DB
|
||||||
|
# 参数映射map. type是参数类型: 0-number数字, 1-string明文字符串, 2-secret加密字符串
|
||||||
|
# 强制固定必须参数 - host
|
||||||
|
configmap:
|
||||||
|
- key: host
|
||||||
|
type: 1
|
||||||
|
- key: port
|
||||||
|
type: 0
|
||||||
|
- key: username
|
||||||
|
type: 1
|
||||||
|
- key: password
|
||||||
|
type: 2
|
||||||
|
- key: database
|
||||||
|
type: 1
|
||||||
|
- key: timeout
|
||||||
|
type: 0
|
||||||
|
- key: url
|
||||||
|
type: 1
|
||||||
|
# 指标组列表
|
||||||
|
metrics:
|
||||||
|
- name: basic
|
||||||
|
# 指标组调度优先级(0-127)越小优先级越高,优先级低的指标组会等优先级高的指标组采集完成后才会被调度,相同优先级的指标组会并行调度采集
|
||||||
|
# 优先级为0的指标组为可用性指标组,即它会被首先调度,采集成功才会继续调度其它指标组,采集失败则中断调度
|
||||||
|
priority: 0
|
||||||
|
# 指标组中的具体监控指标
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: database_version
|
||||||
|
type: 1
|
||||||
|
instance: true
|
||||||
|
- field: database_type
|
||||||
|
type: 1
|
||||||
|
- field: hostname
|
||||||
|
type: 1
|
||||||
|
- field: instance_name
|
||||||
|
type: 1
|
||||||
|
- field: startup_time
|
||||||
|
type: 1
|
||||||
|
- field: status
|
||||||
|
type: 1
|
||||||
|
# (非必须)监控指标别名,与上面的指标名映射。用于采集接口数据字段不直接是最终指标名称,需要此别名做映射转换
|
||||||
|
aliasFields:
|
||||||
|
- VERSION
|
||||||
|
- DATABASE_TYPE
|
||||||
|
- HOST_NAME
|
||||||
|
- INSTANCE_NAME
|
||||||
|
- STARTUP_TIME
|
||||||
|
- STATUS
|
||||||
|
# (非必须)指标计算表达式,与上面的别名一起作用,计算出最终需要的指标值
|
||||||
|
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
|
||||||
|
calculates:
|
||||||
|
- database_version=VERSION
|
||||||
|
- database_type=DATABASE_TYPE
|
||||||
|
- hostname=HOST_NAME
|
||||||
|
- instance_name=INSTANCE_NAME
|
||||||
|
- startup_time=STARTUP_TIME
|
||||||
|
- status=STATUS
|
||||||
|
protocol: jdbc
|
||||||
|
jdbc:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
platform: oracle
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
database: ^_^database^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
|
queryType: oneRow
|
||||||
|
# sql
|
||||||
|
sql: select * from sys.v_$instance
|
||||||
|
url: ^_^url^_^
|
||||||
|
|
||||||
|
- name: tablespace
|
||||||
|
priority: 1
|
||||||
|
# 指标组中的具体监控指标
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: file_id
|
||||||
|
type: 1
|
||||||
|
instance: true
|
||||||
|
- field: file_name
|
||||||
|
type: 1
|
||||||
|
- field: tablespace_name
|
||||||
|
type: 1
|
||||||
|
- field: status
|
||||||
|
type: 1
|
||||||
|
- field: bytes
|
||||||
|
type: 0
|
||||||
|
unit: MB
|
||||||
|
- field: blocks
|
||||||
|
type: 0
|
||||||
|
unit: 块数
|
||||||
|
protocol: jdbc
|
||||||
|
jdbc:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
platform: oracle
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
database: ^_^database^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
|
queryType: oneRow
|
||||||
|
# sql
|
||||||
|
sql: select file_id, file_name, tablespace_name, status, bytes / 1024 / 1024 as bytes, blocks from dba_data_files
|
||||||
|
url: ^_^url^_^
|
||||||
|
|
||||||
|
- name: user_connect
|
||||||
|
priority: 1
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: username
|
||||||
|
type: 1
|
||||||
|
instance: true
|
||||||
|
- field: counts
|
||||||
|
type: 0
|
||||||
|
unit: 连接数
|
||||||
|
protocol: jdbc
|
||||||
|
jdbc:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
platform: oracle
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
database: ^_^database^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
|
queryType: oneRow
|
||||||
|
# sql
|
||||||
|
sql: SELECT username, count( username ) as counts FROM v$session WHERE username IS NOT NULL GROUP BY username
|
||||||
|
url: ^_^url^_^
|
||||||
|
|
||||||
|
- name: performance
|
||||||
|
priority: 1
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: qps
|
||||||
|
type: 0
|
||||||
|
unit: qps
|
||||||
|
- field: tps
|
||||||
|
type: 0
|
||||||
|
unit: tps
|
||||||
|
- field: mbps
|
||||||
|
type: 0
|
||||||
|
unit: mbps
|
||||||
|
# (非必须)监控指标别名,与上面的指标名映射。用于采集接口数据字段不直接是最终指标名称,需要此别名做映射转换
|
||||||
|
aliasFields:
|
||||||
|
- I/O Requests per Second
|
||||||
|
- User Transaction Per Sec
|
||||||
|
- I/O Megabytes per Second
|
||||||
|
# (非必须)指标计算表达式,与上面的别名一起作用,计算出最终需要的指标值
|
||||||
|
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
|
||||||
|
calculates:
|
||||||
|
- qps=I/O Requests per Second
|
||||||
|
- tps=User Transaction Per Sec
|
||||||
|
- mbps=I/O Megabytes per Second
|
||||||
|
protocol: jdbc
|
||||||
|
jdbc:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
platform: oracle
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
database: ^_^database^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
|
queryType: columns
|
||||||
|
# sql
|
||||||
|
sql: select metric_name, value from gv$sysmetric where metric_name = 'I/O Megabytes per Second' or metric_name = 'User Transaction Per Sec' or metric_name = 'I/O Requests per Second'
|
||||||
|
url: ^_^url^_^
|
||||||
126
manager/src/main/resources/define/app/postgresql.yml
Normal file
126
manager/src/main/resources/define/app/postgresql.yml
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
category: db
|
||||||
|
app: postgresql
|
||||||
|
name:
|
||||||
|
zh-CN: PostgreSQL数据库
|
||||||
|
en-US: PostgreSQL DB
|
||||||
|
# 参数映射map. type是参数类型: 0-number数字, 1-string明文字符串, 2-secret加密字符串
|
||||||
|
# 强制固定必须参数 - host
|
||||||
|
configmap:
|
||||||
|
- key: host
|
||||||
|
type: 1
|
||||||
|
- key: port
|
||||||
|
type: 0
|
||||||
|
- key: username
|
||||||
|
type: 1
|
||||||
|
- key: password
|
||||||
|
type: 2
|
||||||
|
- key: database
|
||||||
|
type: 1
|
||||||
|
- key: url
|
||||||
|
type: 1
|
||||||
|
- key: timeout
|
||||||
|
type: 0
|
||||||
|
# 指标组列表
|
||||||
|
metrics:
|
||||||
|
- name: basic
|
||||||
|
# 指标组调度优先级(0-127)越小优先级越高,优先级低的指标组会等优先级高的指标组采集完成后才会被调度,相同优先级的指标组会并行调度采集
|
||||||
|
# 优先级为0的指标组为可用性指标组,即它会被首先调度,采集成功才会继续调度其它指标组,采集失败则中断调度
|
||||||
|
priority: 0
|
||||||
|
# 指标组中的具体监控指标
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: server_version
|
||||||
|
type: 1
|
||||||
|
instance: true
|
||||||
|
- field: port
|
||||||
|
type: 1
|
||||||
|
- field: server_encoding
|
||||||
|
type: 1
|
||||||
|
- field: data_directory
|
||||||
|
type: 1
|
||||||
|
- field: max_connections
|
||||||
|
type: 0
|
||||||
|
unit: 连接数
|
||||||
|
protocol: jdbc
|
||||||
|
jdbc:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
platform: postgresql
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
database: ^_^database^_^
|
||||||
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
|
queryType: columns
|
||||||
|
# sql
|
||||||
|
sql: select name, setting as value from pg_settings where name = 'max_connections' or name = 'server_version' or name = 'server_encoding' or name = 'port' or name = 'data_directory';
|
||||||
|
url: ^_^url^_^
|
||||||
|
|
||||||
|
- name: state
|
||||||
|
priority: 1
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: name
|
||||||
|
type: 1
|
||||||
|
- field: conflicts
|
||||||
|
type: 0
|
||||||
|
unit: 次数
|
||||||
|
- field: deadlocks
|
||||||
|
type: 0
|
||||||
|
unit: 个数
|
||||||
|
- field: blks_read
|
||||||
|
type: 0
|
||||||
|
unit: 次数
|
||||||
|
- field: blks_hit
|
||||||
|
type: 0
|
||||||
|
unit: 次数
|
||||||
|
- field: blk_read_time
|
||||||
|
type: 0
|
||||||
|
unit: ms
|
||||||
|
- field: blk_write_time
|
||||||
|
type: 0
|
||||||
|
unit: ms
|
||||||
|
- field: stats_reset
|
||||||
|
type: 1
|
||||||
|
protocol: jdbc
|
||||||
|
jdbc:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
platform: postgresql
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
database: ^_^database^_^
|
||||||
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
|
queryType: multiRow
|
||||||
|
# sql
|
||||||
|
sql: SELECT COALESCE(datname,'shared-object') as name, conflicts, deadlocks, blks_read, blks_hit, blk_read_time, blk_write_time, stats_reset from pg_stat_database where (datname != 'template1' and datname != 'template0') or datname is null;
|
||||||
|
url: ^_^url^_^
|
||||||
|
|
||||||
|
- name: activity
|
||||||
|
priority: 2
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: running
|
||||||
|
type: 0
|
||||||
|
unit: 连接数
|
||||||
|
protocol: jdbc
|
||||||
|
jdbc:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
platform: postgresql
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
database: ^_^database^_^
|
||||||
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
|
queryType: oneRow
|
||||||
|
# sql
|
||||||
|
sql: SELECT count(*) as running FROM pg_stat_activity WHERE NOT pid=pg_backend_pid();
|
||||||
|
url: ^_^url^_^
|
||||||
136
manager/src/main/resources/define/app/sqlserver.yml
Normal file
136
manager/src/main/resources/define/app/sqlserver.yml
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
category: db
|
||||||
|
app: sqlserver
|
||||||
|
name:
|
||||||
|
zh-CN: SqlServer数据库
|
||||||
|
en-US: SqlServer DB
|
||||||
|
# 参数映射map. type是参数类型: 0-number数字, 1-string明文字符串, 2-secret加密字符串
|
||||||
|
# 强制固定必须参数 - host
|
||||||
|
configmap:
|
||||||
|
- key: host
|
||||||
|
type: 1
|
||||||
|
- key: port
|
||||||
|
type: 0
|
||||||
|
- key: username
|
||||||
|
type: 1
|
||||||
|
- key: password
|
||||||
|
type: 2
|
||||||
|
- key: database
|
||||||
|
type: 1
|
||||||
|
- key: timeout
|
||||||
|
type: 0
|
||||||
|
- key: url
|
||||||
|
type: 1
|
||||||
|
# 指标组列表
|
||||||
|
metrics:
|
||||||
|
- name: basic
|
||||||
|
# 指标组调度优先级(0-127)越小优先级越高,优先级低的指标组会等优先级高的指标组采集完成后才会被调度,相同优先级的指标组会并行调度采集
|
||||||
|
# 优先级为0的指标组为可用性指标组,即它会被首先调度,采集成功才会继续调度其它指标组,采集失败则中断调度
|
||||||
|
priority: 0
|
||||||
|
# 指标组中的具体监控指标
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: machine_name
|
||||||
|
type: 1
|
||||||
|
instance: true
|
||||||
|
- field: server_name
|
||||||
|
type: 1
|
||||||
|
- field: version
|
||||||
|
type: 1
|
||||||
|
- field: edition
|
||||||
|
type: 1
|
||||||
|
- field: start_time
|
||||||
|
type: 1
|
||||||
|
protocol: jdbc
|
||||||
|
jdbc:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
platform: sqlserver
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
database: ^_^database^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
|
queryType: oneRow
|
||||||
|
# sql
|
||||||
|
sql: SELECT SERVERPROPERTY('MachineName') AS machine_name, SERVERPROPERTY('ServerName') AS server_name, SERVERPROPERTY('ProductVersion') AS version, SERVERPROPERTY('Edition') AS edition, sqlserver_start_time AS start_time FROM sys.dm_os_sys_info;
|
||||||
|
url: ^_^url^_^
|
||||||
|
|
||||||
|
- name: performance_counters
|
||||||
|
priority: 1
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: database_pages
|
||||||
|
type: 0
|
||||||
|
- field: target_pages
|
||||||
|
type: 0
|
||||||
|
- field: page_life_expectancy
|
||||||
|
type: 0
|
||||||
|
- field: buffer_cache_hit_ratio
|
||||||
|
type: 0
|
||||||
|
- field: checkpoint_pages_sec
|
||||||
|
type: 0
|
||||||
|
- field: page_reads_sec
|
||||||
|
type: 0
|
||||||
|
- field: page_writes_sec
|
||||||
|
type: 0
|
||||||
|
# (非必须)监控指标别名,与上面的指标名映射。用于采集接口数据字段不直接是最终指标名称,需要此别名做映射转换
|
||||||
|
aliasFields:
|
||||||
|
- Database pages
|
||||||
|
- Target pages
|
||||||
|
- Page life expectancy
|
||||||
|
- Buffer cache hit ratio
|
||||||
|
- Checkpoint pages/sec
|
||||||
|
- Page reads/sec
|
||||||
|
- Page writes/sec
|
||||||
|
# (非必须)指标计算表达式,与上面的别名一起作用,计算出最终需要的指标值
|
||||||
|
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
|
||||||
|
calculates:
|
||||||
|
- database_pages=Database pages
|
||||||
|
- target_pages=Target pages
|
||||||
|
- page_life_expectancy=Page life expectancy
|
||||||
|
- buffer_cache_hit_ratio=Buffer cache hit ratio
|
||||||
|
- checkpoint_pages_sec=Checkpoint pages/sec
|
||||||
|
- page_reads_sec=Page reads/sec
|
||||||
|
- page_writes_sec=Page writes/sec
|
||||||
|
protocol: jdbc
|
||||||
|
jdbc:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
platform: sqlserver
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
database: ^_^database^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
|
queryType: columns
|
||||||
|
# sql
|
||||||
|
sql: select counter_name, cntr_value from sys.dm_os_performance_counters where object_name = 'SQLServer:Buffer Manager';
|
||||||
|
url: ^_^url^_^
|
||||||
|
|
||||||
|
- name: connection
|
||||||
|
priority: 1
|
||||||
|
fields:
|
||||||
|
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||||
|
- field: user_connection
|
||||||
|
type: 0
|
||||||
|
unit: 连接数
|
||||||
|
protocol: jdbc
|
||||||
|
jdbc:
|
||||||
|
# 主机host: ipv4 ipv6 域名
|
||||||
|
host: ^_^host^_^
|
||||||
|
# 端口
|
||||||
|
port: ^_^port^_^
|
||||||
|
platform: sqlserver
|
||||||
|
username: ^_^username^_^
|
||||||
|
password: ^_^password^_^
|
||||||
|
database: ^_^database^_^
|
||||||
|
timeout: ^_^timeout^_^
|
||||||
|
# SQL查询方式: oneRow, multiRow, columns
|
||||||
|
queryType: oneRow
|
||||||
|
# sql
|
||||||
|
sql: SELECT cntr_value as user_connection FROM sys.dm_os_performance_counters WHERE object_name = 'SQLServer:General Statistics' AND counter_name = 'User Connections';
|
||||||
|
url: ^_^url^_^
|
||||||
@@ -48,4 +48,10 @@ param:
|
|||||||
- label: PUT请求
|
- label: PUT请求
|
||||||
value: PUT
|
value: PUT
|
||||||
- label: DELETE请求
|
- label: DELETE请求
|
||||||
value: DELETE
|
value: DELETE
|
||||||
|
- field: headers
|
||||||
|
name: 请求Headers
|
||||||
|
type: key-value
|
||||||
|
required: false
|
||||||
|
keyAlias: Header Name
|
||||||
|
valueAlias: Header Value
|
||||||
@@ -17,13 +17,6 @@ param:
|
|||||||
range: '[0,65535]'
|
range: '[0,65535]'
|
||||||
required: true
|
required: true
|
||||||
defaultValue: 80
|
defaultValue: 80
|
||||||
- field: uri
|
|
||||||
name: 相对路径
|
|
||||||
type: text
|
|
||||||
# 当type为text时,用limit表示字符串限制大小
|
|
||||||
limit: 200
|
|
||||||
required: false
|
|
||||||
placeholder: 'API地址除IP端口外的路径 例如:/v2/book/bar'
|
|
||||||
- field: method
|
- field: method
|
||||||
name: 请求方式
|
name: 请求方式
|
||||||
type: radio
|
type: radio
|
||||||
@@ -38,21 +31,24 @@ param:
|
|||||||
value: PUT
|
value: PUT
|
||||||
- label: DELETE请求
|
- label: DELETE请求
|
||||||
value: DELETE
|
value: DELETE
|
||||||
|
- field: uri
|
||||||
|
name: 相对路径
|
||||||
|
type: text
|
||||||
|
# 当type为text时,用limit表示字符串限制大小
|
||||||
|
limit: 200
|
||||||
|
required: false
|
||||||
|
placeholder: 'API地址除IP端口外的路径 例如:/v2/book/bar'
|
||||||
- field: ssl
|
- field: ssl
|
||||||
name: 启用HTTPS
|
name: 启用HTTPS
|
||||||
# 当type为boolean时,前端用switch展示开关
|
# 当type为boolean时,前端用switch展示开关
|
||||||
type: boolean
|
type: boolean
|
||||||
required: true
|
required: true
|
||||||
- field: username
|
- field: headers
|
||||||
name: 用户名
|
name: 请求Headers
|
||||||
type: text
|
type: key-value
|
||||||
# 当type为text时,用limit表示字符串限制大小
|
|
||||||
limit: 20
|
|
||||||
required: false
|
|
||||||
- field: password
|
|
||||||
name: 密码
|
|
||||||
type: password
|
|
||||||
required: false
|
required: false
|
||||||
|
keyAlias: Header Name
|
||||||
|
valueAlias: Header Value
|
||||||
- field: contentType
|
- field: contentType
|
||||||
name: Content-Type
|
name: Content-Type
|
||||||
type: text
|
type: text
|
||||||
@@ -63,3 +59,13 @@ param:
|
|||||||
type: textarea
|
type: textarea
|
||||||
placeholder: 'POST PUT请求时有效'
|
placeholder: 'POST PUT请求时有效'
|
||||||
required: false
|
required: false
|
||||||
|
- field: username
|
||||||
|
name: 用户名
|
||||||
|
type: text
|
||||||
|
# 当type为text时,用limit表示字符串限制大小
|
||||||
|
limit: 20
|
||||||
|
required: false
|
||||||
|
- field: password
|
||||||
|
name: 密码
|
||||||
|
type: password
|
||||||
|
required: false
|
||||||
|
|||||||
28
manager/src/main/resources/define/param/linux.yml
Normal file
28
manager/src/main/resources/define/param/linux.yml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
app: linux
|
||||||
|
param:
|
||||||
|
- field: host
|
||||||
|
name: 主机Host
|
||||||
|
type: host
|
||||||
|
required: true
|
||||||
|
- field: port
|
||||||
|
name: 端口
|
||||||
|
type: number
|
||||||
|
range: '[0,65535]'
|
||||||
|
required: true
|
||||||
|
defaultValue: 22
|
||||||
|
placeholder: '请输入端口'
|
||||||
|
- field: timeout
|
||||||
|
name: 超时时间
|
||||||
|
type: number
|
||||||
|
required: false
|
||||||
|
defaultValue: 6000
|
||||||
|
placeholder: '超时时间'
|
||||||
|
- field: username
|
||||||
|
name: 用户名
|
||||||
|
type: text
|
||||||
|
limit: 20
|
||||||
|
required: true
|
||||||
|
- field: password
|
||||||
|
name: 密码
|
||||||
|
type: password
|
||||||
|
required: false
|
||||||
@@ -9,8 +9,14 @@ param:
|
|||||||
type: number
|
type: number
|
||||||
range: '[0,65535]'
|
range: '[0,65535]'
|
||||||
required: true
|
required: true
|
||||||
defaultValue: 80
|
defaultValue: 3306
|
||||||
placeholder: '请输入端口'
|
placeholder: '请输入端口'
|
||||||
|
- field: timeout
|
||||||
|
name: 查询超时时间
|
||||||
|
type: number
|
||||||
|
required: false
|
||||||
|
defaultValue: 6000
|
||||||
|
placeholder: '查询超时时间'
|
||||||
- field: database
|
- field: database
|
||||||
name: 数据库名称
|
name: 数据库名称
|
||||||
type: text
|
type: text
|
||||||
|
|||||||
@@ -9,8 +9,14 @@ param:
|
|||||||
type: number
|
type: number
|
||||||
range: '[0,65535]'
|
range: '[0,65535]'
|
||||||
required: true
|
required: true
|
||||||
defaultValue: 80
|
defaultValue: 3306
|
||||||
placeholder: '请输入端口'
|
placeholder: '请输入端口'
|
||||||
|
- field: timeout
|
||||||
|
name: 查询超时时间
|
||||||
|
type: number
|
||||||
|
required: false
|
||||||
|
defaultValue: 6000
|
||||||
|
placeholder: '查询超时时间'
|
||||||
- field: database
|
- field: database
|
||||||
name: 数据库名称
|
name: 数据库名称
|
||||||
type: text
|
type: text
|
||||||
|
|||||||
36
manager/src/main/resources/define/param/oracle.yml
Normal file
36
manager/src/main/resources/define/param/oracle.yml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
app: oracle
|
||||||
|
param:
|
||||||
|
- field: host
|
||||||
|
name: 主机Host
|
||||||
|
type: host
|
||||||
|
required: true
|
||||||
|
- field: port
|
||||||
|
name: 端口
|
||||||
|
type: number
|
||||||
|
range: '[0,65535]'
|
||||||
|
required: true
|
||||||
|
defaultValue: 1521
|
||||||
|
placeholder: '请输入端口'
|
||||||
|
- field: timeout
|
||||||
|
name: 查询超时时间
|
||||||
|
type: number
|
||||||
|
required: false
|
||||||
|
defaultValue: 6000
|
||||||
|
placeholder: '查询超时时间'
|
||||||
|
- field: database
|
||||||
|
name: 数据库名称
|
||||||
|
type: text
|
||||||
|
required: false
|
||||||
|
- field: username
|
||||||
|
name: 用户名
|
||||||
|
type: text
|
||||||
|
limit: 20
|
||||||
|
required: false
|
||||||
|
- field: password
|
||||||
|
name: 密码
|
||||||
|
type: password
|
||||||
|
required: false
|
||||||
|
- field: url
|
||||||
|
name: URL
|
||||||
|
type: text
|
||||||
|
required: false
|
||||||
@@ -17,4 +17,4 @@ param:
|
|||||||
range: '[0,100000]'
|
range: '[0,100000]'
|
||||||
required: true
|
required: true
|
||||||
placeholder: '请输入超时时间,单位毫秒'
|
placeholder: '请输入超时时间,单位毫秒'
|
||||||
defaultValue: 3000
|
defaultValue: 6000
|
||||||
@@ -24,4 +24,4 @@ param:
|
|||||||
range: '[0,100000]'
|
range: '[0,100000]'
|
||||||
required: true
|
required: true
|
||||||
placeholder: '请输入超时时间,单位毫秒'
|
placeholder: '请输入超时时间,单位毫秒'
|
||||||
defaultValue: 3000
|
defaultValue: 6000
|
||||||
36
manager/src/main/resources/define/param/postgresql.yml
Normal file
36
manager/src/main/resources/define/param/postgresql.yml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
app: postgresql
|
||||||
|
param:
|
||||||
|
- field: host
|
||||||
|
name: 主机Host
|
||||||
|
type: host
|
||||||
|
required: true
|
||||||
|
- field: port
|
||||||
|
name: 端口
|
||||||
|
type: number
|
||||||
|
range: '[0,65535]'
|
||||||
|
required: true
|
||||||
|
defaultValue: 5432
|
||||||
|
placeholder: '请输入端口'
|
||||||
|
- field: timeout
|
||||||
|
name: 查询超时时间
|
||||||
|
type: number
|
||||||
|
required: false
|
||||||
|
defaultValue: 6000
|
||||||
|
placeholder: '查询超时时间'
|
||||||
|
- field: database
|
||||||
|
name: 数据库名称
|
||||||
|
type: text
|
||||||
|
required: false
|
||||||
|
- field: username
|
||||||
|
name: 用户名
|
||||||
|
type: text
|
||||||
|
limit: 20
|
||||||
|
required: false
|
||||||
|
- field: password
|
||||||
|
name: 密码
|
||||||
|
type: password
|
||||||
|
required: false
|
||||||
|
- field: url
|
||||||
|
name: URL
|
||||||
|
type: text
|
||||||
|
required: false
|
||||||
36
manager/src/main/resources/define/param/sqlserver.yml
Normal file
36
manager/src/main/resources/define/param/sqlserver.yml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
app: sqlserver
|
||||||
|
param:
|
||||||
|
- field: host
|
||||||
|
name: 主机Host
|
||||||
|
type: host
|
||||||
|
required: true
|
||||||
|
- field: port
|
||||||
|
name: 端口
|
||||||
|
type: number
|
||||||
|
range: '[0,65535]'
|
||||||
|
required: true
|
||||||
|
defaultValue: 1433
|
||||||
|
placeholder: '请输入端口'
|
||||||
|
- field: timeout
|
||||||
|
name: 查询超时时间
|
||||||
|
type: number
|
||||||
|
required: false
|
||||||
|
defaultValue: 6000
|
||||||
|
placeholder: '查询超时时间'
|
||||||
|
- field: database
|
||||||
|
name: 数据库名称
|
||||||
|
type: text
|
||||||
|
required: false
|
||||||
|
- field: username
|
||||||
|
name: 用户名
|
||||||
|
type: text
|
||||||
|
limit: 20
|
||||||
|
required: false
|
||||||
|
- field: password
|
||||||
|
name: 密码
|
||||||
|
type: password
|
||||||
|
required: false
|
||||||
|
- field: url
|
||||||
|
name: URL
|
||||||
|
type: text
|
||||||
|
required: false
|
||||||
@@ -24,4 +24,4 @@ param:
|
|||||||
range: '[0,100000]'
|
range: '[0,100000]'
|
||||||
required: true
|
required: true
|
||||||
placeholder: '请输入超时时间,单位毫秒'
|
placeholder: '请输入超时时间,单位毫秒'
|
||||||
defaultValue: 3000
|
defaultValue: 6000
|
||||||
@@ -13,6 +13,7 @@ excludedResource:
|
|||||||
- /account/auth/**===*
|
- /account/auth/**===*
|
||||||
- /===get
|
- /===get
|
||||||
- /i18n/**===get
|
- /i18n/**===get
|
||||||
|
- /apps/hierarchy===get
|
||||||
# web ui 静态资源
|
# web ui 静态资源
|
||||||
- /console/**===get
|
- /console/**===get
|
||||||
- /**/*.html===get
|
- /**/*.html===get
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ spring:
|
|||||||
on-profile: prod
|
on-profile: prod
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
username: admin
|
username: root
|
||||||
password: admin
|
password: 123456
|
||||||
url: jdbc:mysql://localhost:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
url: jdbc:mysql://localhost:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
||||||
platform: mysql
|
platform: mysql
|
||||||
hikari:
|
hikari:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd
|
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd
|
||||||
http://maven.apache.org/ASSEMBLY/2.0.0 ">
|
http://maven.apache.org/ASSEMBLY/2.0.0 ">
|
||||||
<!--必填,会追加到打包文件名称的末尾-->
|
<!--必填,会追加到打包文件名称的末尾-->
|
||||||
<id>1.0-beta.4</id>
|
<id>1.0-beta.6</id>
|
||||||
<!--打包类型,可以设置多种类型,打包的时候不同的类型都会打包打出来-->
|
<!--打包类型,可以设置多种类型,打包的时候不同的类型都会打包打出来-->
|
||||||
<formats>
|
<formats>
|
||||||
<format>tar</format>
|
<format>tar</format>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ APPLICATION="${project.artifactId}"
|
|||||||
APPLICATION_JAR="${project.build.finalName}.jar"
|
APPLICATION_JAR="${project.build.finalName}.jar"
|
||||||
|
|
||||||
# 通过项目名称查找到PI,然后kill -9 pid
|
# 通过项目名称查找到PI,然后kill -9 pid
|
||||||
PID=$(ps -ef | grep "${APPLICATION_JAR}" | grep -v grep | awk '{ print $2 }')
|
PID=$(ps -ef | grep java | grep "${APPLICATION_JAR}" | grep -v grep | awk '{ print $2 }')
|
||||||
if [[ -z "$PID" ]]
|
if [[ -z "$PID" ]]
|
||||||
then
|
then
|
||||||
echo ${APPLICATION} is already stopped
|
echo ${APPLICATION} is already stopped
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ CONF_DIR=$DEPLOY_DIR/config
|
|||||||
# 应用的端口号
|
# 应用的端口号
|
||||||
SERVER_PORT=1157
|
SERVER_PORT=1157
|
||||||
|
|
||||||
PIDS=`ps -f | grep java | grep "$CONF_DIR" |awk '{print $2}'`
|
PIDS=`ps -ef | grep java | grep "$CONF_DIR" | awk '{print $2}'`
|
||||||
if [ "$1" = "status" ]; then
|
if [ "$1" = "status" ]; then
|
||||||
if [ -n "$PIDS" ]; then
|
if [ -n "$PIDS" ]; then
|
||||||
echo "The $SERVER_NAME is running...!"
|
echo "The $SERVER_NAME is running...!"
|
||||||
@@ -41,11 +41,21 @@ if [ -n "$PIDS" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$SERVER_PORT" ]; then
|
if [ -n "$SERVER_PORT" ]; then
|
||||||
SERVER_PORT_COUNT=`netstat -tln | grep $SERVER_PORT | wc -l`
|
# linux 下查询端口是否占用
|
||||||
|
SERVER_PORT_COUNT=`netstat -tln | grep :$SERVER_PORT | wc -l`
|
||||||
if [ $SERVER_PORT_COUNT -gt 0 ]; then
|
if [ $SERVER_PORT_COUNT -gt 0 ]; then
|
||||||
echo "ERROR: The $SERVER_NAME port $SERVER_PORT already used!"
|
echo "ERROR: netstat the $SERVER_NAME port $SERVER_PORT already used!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
# mac 下查询端口是否占用
|
||||||
|
LSOF_AVA=`command -v lsof | wc -l`
|
||||||
|
if [ $LSOF_AVA -gt 0 ]; then
|
||||||
|
SERVER_PORT_COUNT=`lsof -i:$SERVER_PORT | wc -l`
|
||||||
|
if [ $SERVER_PORT_COUNT -gt 0 ]; then
|
||||||
|
echo "ERROR: lsof the $SERVER_NAME port $SERVER_PORT already used!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 项目日志输出绝对路径
|
# 项目日志输出绝对路径
|
||||||
@@ -56,11 +66,10 @@ if [ ! -d $LOGS_DIR ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# JVM Configuration
|
# JVM Configuration
|
||||||
JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true "
|
JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Duser.timezone=Asia/Shanghai"
|
||||||
|
|
||||||
JAVA_MEM_OPTS=" -server -Xms256m -Xmx1024m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
|
JAVA_MEM_OPTS=" -server -Xms256m -Xmx1024m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
|
||||||
|
|
||||||
|
|
||||||
# 加载外部log文件的配置
|
# 加载外部log文件的配置
|
||||||
LOG_IMPL_FILE=logback-spring.xml
|
LOG_IMPL_FILE=logback-spring.xml
|
||||||
LOGGING_CONFIG=""
|
LOGGING_CONFIG=""
|
||||||
|
|||||||
52
script/docker-compose/README.md
Normal file
52
script/docker-compose/README.md
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
## docker-compose部署方案
|
||||||
|
|
||||||
|
- 如果不想部署而是直接使用,我们提供SAAS监控云-[TanCloud探云](https://console.tancloud.cn),即刻 **[登录注册](https://console.tancloud.cn)** 免费使用。
|
||||||
|
- 如果想自己本地快速部署的话,可以参考下面进行操作。
|
||||||
|
|
||||||
|
##### 安装Docker & Docker-compose
|
||||||
|
|
||||||
|
1. 下载安装 docker 环境 & docker-compose 环境
|
||||||
|
请参考 [Docker官网文档](https://docs.docker.com/get-docker/), [Compose安装](https://docs.docker.com/compose/install/)
|
||||||
|
```
|
||||||
|
$ docker -v
|
||||||
|
Docker version 20.10.12, build e91ed57
|
||||||
|
```
|
||||||
|
|
||||||
|
##### docker compose部署heartbeat及其依赖服务
|
||||||
|
|
||||||
|
1. 下载hertzbeat-docker-compose安装部署脚本文件
|
||||||
|
脚本文件位于代码仓库下`script/docker-compose` 链接 [script/docker-compose](https://gitee.com/dromara/hertzbeat/tree/master/script/docker-compose)
|
||||||
|
|
||||||
|
|
||||||
|
2. 进入部署脚本 docker-compose 目录, 执行
|
||||||
|
|
||||||
|
`docker-compose up -d`
|
||||||
|
|
||||||
|
3. 进入tdengine创建hertzbeat数据库
|
||||||
|
|
||||||
|
`$ docker exec -it tdengine /bin/bash
|
||||||
|
root@tdengine-server:~/TDengine-server-2.4.0.4#`
|
||||||
|
|
||||||
|
创建名称为hertzbeat的数据库 进入容器后,执行 taos shell 客户端程序。
|
||||||
|
|
||||||
|
`root@tdengine-server:~/TDengine-server-2.4.0.4# taos
|
||||||
|
Welcome to the TDengine shell from Linux, Client Version:2.4.0.4
|
||||||
|
Copyright (c) 2020 by TAOS Data, Inc. All rights reserved.
|
||||||
|
taos>`
|
||||||
|
|
||||||
|
执行创建数据库命令
|
||||||
|
|
||||||
|
`taos> show databases;`
|
||||||
|
|
||||||
|
`taos> CREATE DATABASE hertzbeat KEEP 90 DAYS 10 BLOCKS 6 UPDATE 1;`
|
||||||
|
|
||||||
|
##### 重启应用
|
||||||
|
|
||||||
|
`docker-compose restart hertzbeat`
|
||||||
|
|
||||||
|
##### 开始探索HertzBeat
|
||||||
|
浏览器访问 http://ip:1157/console 开始使用HertzBeat进行监控告警。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
怎么样是不是很简单,只要几分钟就可以部署完成,赶紧试试吧!
|
||||||
70
script/docker-compose/conf/application.yml
Normal file
70
script/docker-compose/conf/application.yml
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
server:
|
||||||
|
port: 1157
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: ${HOSTNAME:@hertzbeat@}${PID}
|
||||||
|
profiles:
|
||||||
|
active: prod
|
||||||
|
mvc:
|
||||||
|
static-path-pattern: /console/**
|
||||||
|
resources:
|
||||||
|
static-locations:
|
||||||
|
- classpath:/dist/
|
||||||
|
- classpath:../dist/
|
||||||
|
jackson:
|
||||||
|
default-property-inclusion: NON_EMPTY
|
||||||
|
|
||||||
|
sureness:
|
||||||
|
auths:
|
||||||
|
- digest
|
||||||
|
- basic
|
||||||
|
- jwt
|
||||||
|
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
config:
|
||||||
|
activate:
|
||||||
|
on-profile: prod
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
url: jdbc:mysql://mysql:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
||||||
|
platform: mysql
|
||||||
|
hikari:
|
||||||
|
max-lifetime: 120000
|
||||||
|
jpa:
|
||||||
|
database: mysql
|
||||||
|
|
||||||
|
mail:
|
||||||
|
# 请注意邮件服务器地址:qq邮箱为 smtp.qq.com qq企业邮箱为 smtp.exmail.qq.com
|
||||||
|
host: smtp.qq.com
|
||||||
|
username: example@qq.com
|
||||||
|
# 请注意此非邮箱账户密码 此需填写邮箱授权码
|
||||||
|
password: xxqzvuqbnqvbbdac
|
||||||
|
port: 465
|
||||||
|
default-encoding: UTF-8
|
||||||
|
properties:
|
||||||
|
mail:
|
||||||
|
smtp:
|
||||||
|
socketFactoryClass: javax.net.ssl.SSLSocketFactory
|
||||||
|
ssl:
|
||||||
|
enable: true
|
||||||
|
|
||||||
|
thymeleaf:
|
||||||
|
prefix: classpath:/templates/
|
||||||
|
check-template-location: true
|
||||||
|
cache: true
|
||||||
|
suffix: .html
|
||||||
|
#encoding: UTF-8
|
||||||
|
#content-type: text/html
|
||||||
|
mode: LEGACYHTML5
|
||||||
|
|
||||||
|
warehouse:
|
||||||
|
store:
|
||||||
|
td-engine:
|
||||||
|
enabled: true
|
||||||
|
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
|
||||||
|
url: jdbc:TAOS-RS://tdengine:6041/hertzbeat
|
||||||
|
username: root
|
||||||
|
password: taosdata
|
||||||
167
script/docker-compose/conf/sql/schema.sql
Normal file
167
script/docker-compose/conf/sql/schema.sql
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
set names utf8mb4;
|
||||||
|
drop database if exists hertzbeat;
|
||||||
|
create database hertzbeat;
|
||||||
|
use hertzbeat;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for monitor
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS monitor ;
|
||||||
|
CREATE TABLE monitor
|
||||||
|
(
|
||||||
|
id bigint not null auto_increment comment '监控ID',
|
||||||
|
job_id bigint not null comment '监控对应下发的任务ID',
|
||||||
|
name varchar(100) not null comment '监控的名称',
|
||||||
|
app varchar(100) not null comment '监控的类型:linux,mysql,jvm...',
|
||||||
|
host varchar(100) not null comment '监控的对端host:ipv4,ipv6,域名',
|
||||||
|
intervals int not null default 600 comment '监控的采集间隔时间,单位秒',
|
||||||
|
status tinyint not null default 1 comment '监控状态 0:未监控,1:可用,2:不可用,3:不可达',
|
||||||
|
description varchar(255) comment '描述备注信息',
|
||||||
|
creator varchar(100) comment '创建者',
|
||||||
|
modifier varchar(100) comment '最新修改者',
|
||||||
|
gmt_create timestamp default current_timestamp comment 'create time',
|
||||||
|
gmt_update datetime default current_timestamp on update current_timestamp comment 'update time',
|
||||||
|
primary key (id),
|
||||||
|
index query_index (app, host, name)
|
||||||
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for param
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS param ;
|
||||||
|
CREATE TABLE param
|
||||||
|
(
|
||||||
|
id bigint not null auto_increment comment '参数ID',
|
||||||
|
monitor_id bigint not null comment '监控ID',
|
||||||
|
field varchar(100) not null comment '参数标识符',
|
||||||
|
value varchar(8126) comment '参数值,最大字符长度8126',
|
||||||
|
type tinyint not null default 0 comment '参数类型 0:数字 1:字符串 2:加密串',
|
||||||
|
gmt_create timestamp default current_timestamp comment 'create time',
|
||||||
|
gmt_update datetime default current_timestamp on update current_timestamp comment 'update time',
|
||||||
|
primary key (id),
|
||||||
|
index monitor_id (monitor_id),
|
||||||
|
unique key unique_param (monitor_id, field)
|
||||||
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for param
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS param_define ;
|
||||||
|
CREATE TABLE param_define
|
||||||
|
(
|
||||||
|
id bigint not null auto_increment comment '参数ID',
|
||||||
|
app varchar(100) not null comment '监控的类型:linux,mysql,jvm...',
|
||||||
|
name varchar(100) not null comment '参数字段对外显示名称',
|
||||||
|
field varchar(100) not null comment '参数字段标识符',
|
||||||
|
type varchar(20) not null default 'text' comment '字段类型,样式(大部分映射input标签type属性)',
|
||||||
|
required boolean not null default false comment '是否是必输项 true-必填 false-可选',
|
||||||
|
param_range varchar(100) not null comment '当type为number时,用range表示范围 eg: 0-233',
|
||||||
|
param_limit tinyint unsigned not null comment '当type为text时,用limit表示字符串限制大小.最大255',
|
||||||
|
param_option varchar(255) not null comment '当type为radio单选框,checkbox复选框时,option表示可选项值列表',
|
||||||
|
creator varchar(100) comment '创建者',
|
||||||
|
modifier varchar(100) comment '最新修改者',
|
||||||
|
gmt_create timestamp default current_timestamp comment 'create time',
|
||||||
|
gmt_update datetime default current_timestamp on update current_timestamp comment 'update time',
|
||||||
|
primary key (id),
|
||||||
|
unique key unique_param_define (app, field)
|
||||||
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for alert_define
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS alert_define ;
|
||||||
|
CREATE TABLE alert_define
|
||||||
|
(
|
||||||
|
id bigint not null auto_increment comment '告警定义ID',
|
||||||
|
app varchar(100) not null comment '配置告警的监控类型:linux,mysql,jvm...',
|
||||||
|
metric varchar(100) not null comment '配置告警的指标集合:cpu,memory,info...',
|
||||||
|
field varchar(100) not null comment '配置告警的指标:usage,cores...',
|
||||||
|
preset boolean not null default false comment '是否是全局默认告警,是则所有此类型监控默认关联此告警',
|
||||||
|
expr varchar(255) not null comment '告警触发条件表达式',
|
||||||
|
priority tinyint not null default 0 comment '告警级别 0:高-emergency-紧急告警-红色 1:中-critical-严重告警-橙色 2:低-warning-警告告警-黄色',
|
||||||
|
times int not null default 1 comment '触发次数,即达到触发阈值次数要求后才算触发告警',
|
||||||
|
enable boolean not null default true comment '告警阈值开关',
|
||||||
|
template varchar(255) not null comment '告警通知模板内容',
|
||||||
|
creator varchar(100) comment '创建者',
|
||||||
|
modifier varchar(100) comment '最新修改者',
|
||||||
|
gmt_create timestamp default current_timestamp comment 'create time',
|
||||||
|
gmt_update datetime default current_timestamp on update current_timestamp comment 'update time',
|
||||||
|
primary key (id)
|
||||||
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for alert_define_monitor_bind
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS alert_define_monitor_bind ;
|
||||||
|
CREATE TABLE alert_define_monitor_bind
|
||||||
|
(
|
||||||
|
id bigint not null auto_increment comment '告警定义与监控关联ID',
|
||||||
|
alert_define_id bigint not null comment '告警定义ID',
|
||||||
|
monitor_id bigint not null comment '监控ID',
|
||||||
|
gmt_create timestamp default current_timestamp comment 'create time',
|
||||||
|
gmt_update datetime default current_timestamp on update current_timestamp comment 'update time',
|
||||||
|
primary key (id),
|
||||||
|
index index_bind (alert_define_id, monitor_id)
|
||||||
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for alert
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS alert ;
|
||||||
|
CREATE TABLE alert
|
||||||
|
(
|
||||||
|
id bigint not null auto_increment comment '告警ID',
|
||||||
|
target varchar(255) not null comment '告警目标对象: 监控可用性-available 指标-app.metrics.field',
|
||||||
|
monitor_id bigint not null comment '告警对象关联的监控ID',
|
||||||
|
monitor_name varchar(100) comment '告警对象关联的监控名称',
|
||||||
|
alert_define_id bigint comment '告警关联的告警定义ID',
|
||||||
|
priority tinyint not null default 0 comment '告警级别 0:高-emergency-紧急告警-红色 1:中-critical-严重告警-橙色 2:低-warning-警告告警-黄色',
|
||||||
|
content varchar(255) not null comment '告警通知实际内容',
|
||||||
|
status tinyint not null default 0 comment '告警状态: 0-正常告警(待处理) 1-阈值触发但未达到告警次数 2-恢复告警 3-已处理',
|
||||||
|
times int not null comment '触发次数,即达到告警定义的触发阈值次数要求后才会发告警',
|
||||||
|
gmt_create timestamp default current_timestamp comment 'create time',
|
||||||
|
primary key (id)
|
||||||
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for notice_rule
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS notice_rule ;
|
||||||
|
CREATE TABLE notice_rule
|
||||||
|
(
|
||||||
|
id bigint not null auto_increment comment '通知策略主键索引ID',
|
||||||
|
name varchar(100) not null comment '策略名称',
|
||||||
|
receiver_id bigint not null comment '消息接收人ID',
|
||||||
|
receiver_name varchar(100) not null comment '消息接收人标识',
|
||||||
|
enable boolean not null default true comment '是否启用此策略',
|
||||||
|
filter_all boolean not null default true comment '是否转发所有',
|
||||||
|
creator varchar(100) comment '创建者',
|
||||||
|
modifier varchar(100) comment '最新修改者',
|
||||||
|
gmt_create timestamp default current_timestamp comment 'create time',
|
||||||
|
gmt_update datetime default current_timestamp on update current_timestamp comment 'update time',
|
||||||
|
primary key (id)
|
||||||
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for notice_receiver
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS notice_receiver ;
|
||||||
|
CREATE TABLE notice_receiver
|
||||||
|
(
|
||||||
|
id bigint not null auto_increment comment '消息接收人ID',
|
||||||
|
name varchar(100) not null comment '消息接收人姓名',
|
||||||
|
type tinyint not null comment '通知信息方式: 0-手机短信 1-邮箱 2-webhook 3-微信公众号 4-企业微信机器人 5-钉钉机器人',
|
||||||
|
phone varchar(100) comment '手机号, 通知方式为手机短信时有效',
|
||||||
|
email varchar(100) comment '邮箱账号, 通知方式为邮箱时有效',
|
||||||
|
hook_url varchar(255) comment 'URL地址, 通知方式为webhook有效',
|
||||||
|
wechat_id varchar(255) comment 'openId, 通知方式为微信公众号或企业微信机器人有效',
|
||||||
|
access_token varchar(255) comment '访问token, 通知方式为钉钉机器人有效',
|
||||||
|
creator varchar(100) comment '创建者',
|
||||||
|
modifier varchar(100) comment '最新修改者',
|
||||||
|
gmt_create timestamp default current_timestamp comment 'create time',
|
||||||
|
gmt_update datetime default current_timestamp on update current_timestamp comment 'update time',
|
||||||
|
primary key (id)
|
||||||
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
50
script/docker-compose/conf/sureness.yml
Normal file
50
script/docker-compose/conf/sureness.yml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
## -- sureness.yml文本数据源 -- ##
|
||||||
|
|
||||||
|
# 加载到匹配字典的资源,也就是需要被保护的,设置了所支持角色访问的资源
|
||||||
|
# 没有配置的资源也默认被认证保护,但不鉴权
|
||||||
|
# eg: /api/v1/source1===get===[role2] 表示 /api/v2/host===post 这条资源支持 role2 这一种角色访问
|
||||||
|
# eg: /api/v1/source2===get===[] 表示 /api/v1/source2===get 这条资源不支持任何角色访问
|
||||||
|
resourceRole:
|
||||||
|
- /account/auth/refresh===post===[role1,role2,role3,role4]
|
||||||
|
|
||||||
|
# 需要被过滤保护的资源,不认证鉴权直接访问
|
||||||
|
# /api/v1/source3===get 表示 /api/v1/source3===get 可以被任何人访问 无需登录认证鉴权
|
||||||
|
excludedResource:
|
||||||
|
- /account/auth/**===*
|
||||||
|
- /===get
|
||||||
|
- /i18n/**===get
|
||||||
|
- /apps/hierarchy===get
|
||||||
|
# web ui 静态资源
|
||||||
|
- /console/**===get
|
||||||
|
- /**/*.html===get
|
||||||
|
- /**/*.js===get
|
||||||
|
- /**/*.css===get
|
||||||
|
- /**/*.ico===get
|
||||||
|
- /**/*.ttf===get
|
||||||
|
- /**/*.png===get
|
||||||
|
- /**/*.gif===get
|
||||||
|
- /**/*.png===*
|
||||||
|
# swagger ui 资源
|
||||||
|
- /swagger-resources/**===get
|
||||||
|
- /v2/api-docs===get
|
||||||
|
- /v3/api-docs===get
|
||||||
|
|
||||||
|
# 用户账户信息
|
||||||
|
# 下面有 admin tom lili 三个账户
|
||||||
|
# eg: admin 拥有[role1,role2]角色,密码为admin
|
||||||
|
# eg: tom 拥有[role1,role2,role3],密码为tom@123
|
||||||
|
# eg: lili 拥有[role1,role2],明文密码为lili, 加盐密码为1A676730B0C7F54654B0E09184448289
|
||||||
|
account:
|
||||||
|
- appId: admin
|
||||||
|
credential: admin
|
||||||
|
role: [role1,role2]
|
||||||
|
- appId: tom
|
||||||
|
credential: tom
|
||||||
|
role: [role1,role2,role3]
|
||||||
|
- appId: lili
|
||||||
|
# 注意 Digest认证不支持加盐加密的密码账户
|
||||||
|
# 加盐加密的密码,通过 MD5(password+salt)计算
|
||||||
|
# 此账户的原始密码为 lili
|
||||||
|
credential: 1A676730B0C7F54654B0E09194448289
|
||||||
|
salt: 123
|
||||||
|
role: [role1,role2]
|
||||||
2
script/docker-compose/dbdata/mysqldata/.gitignore
vendored
Normal file
2
script/docker-compose/dbdata/mysqldata/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
.gitignore
|
||||||
|
!.gitignore
|
||||||
2
script/docker-compose/dbdata/taosdata/.gitignore
vendored
Normal file
2
script/docker-compose/dbdata/taosdata/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
.gitignore
|
||||||
|
!.gitignore
|
||||||
50
script/docker-compose/docker-compose.yaml
Normal file
50
script/docker-compose/docker-compose.yaml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
version: "3.7"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
heartzbeat:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: "mysql:5.7"
|
||||||
|
container_name: mysql
|
||||||
|
hostname: mysql
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
environment:
|
||||||
|
TZ: Asia/Shanghai
|
||||||
|
MYSQL_ROOT_PASSWORD: 123456
|
||||||
|
volumes:
|
||||||
|
- ./dbdata/mysqldata:/var/lib/mysql/
|
||||||
|
- ./conf/sql:/docker-entrypoint-initdb.d/
|
||||||
|
networks:
|
||||||
|
- heartzbeat
|
||||||
|
|
||||||
|
TDengine:
|
||||||
|
image: "tdengine/tdengine:2.4.0.12"
|
||||||
|
container_name: tdengine
|
||||||
|
hostname: tdengine
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "6030-6049:6030-6049"
|
||||||
|
- "6030-6049:6030-6049/udp"
|
||||||
|
volumes:
|
||||||
|
- ./dbdata/taosdata:/var/lib/taos/
|
||||||
|
networks:
|
||||||
|
- heartzbeat
|
||||||
|
|
||||||
|
hertzbeat:
|
||||||
|
image: "tancloud/hertzbeat:1.0-beta.6"
|
||||||
|
container_name: hertzbeat
|
||||||
|
hostname: hertzbeat
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
TZ: Asia/Shanghai
|
||||||
|
volumes:
|
||||||
|
- ./conf/application.yml:/opt/hertzbeat/config/application.yml
|
||||||
|
- ./conf/sureness.yml:/opt/hertzbeat/config/sureness.yml
|
||||||
|
ports:
|
||||||
|
- "1157:1157"
|
||||||
|
networks:
|
||||||
|
- heartzbeat
|
||||||
@@ -2,7 +2,11 @@ FROM openjdk:8-alpine
|
|||||||
|
|
||||||
MAINTAINER tomsun28 "tomsun28@outlook.com"
|
MAINTAINER tomsun28 "tomsun28@outlook.com"
|
||||||
|
|
||||||
ADD hertzbeat-1.0-beta.4.tar /opt/
|
ADD hertzbeat-1.0-beta.6.tar /opt/
|
||||||
|
|
||||||
|
RUN apk add --no-cache tzdata
|
||||||
|
|
||||||
|
ENV TZ=Asia/Shanghai
|
||||||
|
|
||||||
EXPOSE 1157
|
EXPOSE 1157
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user