Compare commits
4 Commits
feature#fi
...
feature#li
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4e9b0d187 | ||
|
|
ffa3194113 | ||
|
|
f52247df67 | ||
|
|
25d692cf37 |
3
.github/FUNDING.yml
vendored
3
.github/FUNDING.yml
vendored
@@ -1,3 +0,0 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
custom: ['https://hertzbeat.com/docs/others/sponsor']
|
||||
31
.github/ISSUE_TEMPLATE/bug_report.md
vendored
31
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,31 +0,0 @@
|
||||
---
|
||||
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
8
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,8 +0,0 @@
|
||||
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
10
.github/ISSUE_TEMPLATE/custom.md
vendored
@@ -1,10 +0,0 @@
|
||||
---
|
||||
name: Custom issue template
|
||||
about: Describe this issue template's purpose here.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,20 +0,0 @@
|
||||
---
|
||||
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
67
.github/workflows/codeql-analysis.yml
vendored
@@ -1,67 +0,0 @@
|
||||
# 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
12
.github/workflows/issues-translator.yml
vendored
@@ -1,12 +0,0 @@
|
||||
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
24
.github/workflows/maven-build.yml
vendored
@@ -1,24 +0,0 @@
|
||||
# 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
|
||||
@@ -1,62 +0,0 @@
|
||||
参与贡献
|
||||
=======================================
|
||||
|
||||
非常欢迎参与项目贡献,我们致力于维护一个互相帮助的快乐社区。
|
||||
|
||||
### 模块
|
||||
|
||||
- **[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)
|
||||
@@ -95,14 +95,6 @@
|
||||
|
||||
详细步骤参考 [通过安装包安装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 即可开始
|
||||
|
||||
详细步骤参考 [参与贡献之本地代码启动](CONTRIBUTING.md)
|
||||
|
||||
**HAVE FUN**
|
||||
|
||||
## 💬 社区交流
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.usthe.collector.collect.common.cache;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* 缓存key唯一标识符
|
||||
@@ -11,7 +10,6 @@ import lombok.ToString;
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@ToString
|
||||
public class CacheIdentifier {
|
||||
|
||||
private String ip;
|
||||
|
||||
@@ -21,9 +21,9 @@ import java.util.concurrent.TimeUnit;
|
||||
public class CommonCache {
|
||||
|
||||
/**
|
||||
* 默认缓存时间 800s
|
||||
* 默认缓存时间 10minute
|
||||
*/
|
||||
private static final long DEFAULT_CACHE_TIMEOUT = 800 * 1000L;
|
||||
private static final long DEFAULT_CACHE_TIMEOUT = 10 * 60 * 1000L;
|
||||
|
||||
/**
|
||||
* 默认最大缓存数量
|
||||
@@ -121,17 +121,15 @@ public class CommonCache {
|
||||
timeoutMap.put(key, new Long[]{currentTime, DEFAULT_CACHE_TIMEOUT});
|
||||
} else if (cacheTime[0] + cacheTime[1] < currentTime) {
|
||||
// 过期了 discard 关闭这个cache的资源
|
||||
log.warn("[cache] clean the timeout cache, key {}", key);
|
||||
timeoutMap.remove(key);
|
||||
cacheMap.remove(key);
|
||||
if (value instanceof CacheCloseable) {
|
||||
log.warn("[cache] close the timeout cache, key {}", key);
|
||||
((CacheCloseable)value).close();
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("[cache] clean timeout cache error: {}.", e.getMessage(), e);
|
||||
log.error("clean timeout cache error: {}.", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,18 +173,15 @@ public class CommonCache {
|
||||
public Optional<Object> getCache(Object key, boolean refreshCache) {
|
||||
Long[] cacheTime = timeoutMap.get(key);
|
||||
if (cacheTime == null || cacheTime.length != CACHE_TIME_LENGTH) {
|
||||
log.warn("[cache] not hit the cache, key {}.", key);
|
||||
return Optional.empty();
|
||||
}
|
||||
if (cacheTime[0] + cacheTime[1] < System.currentTimeMillis()) {
|
||||
log.warn("[cache] is timeout, remove it, key {}.", key);
|
||||
timeoutMap.remove(key);
|
||||
cacheMap.remove(key);
|
||||
return Optional.empty();
|
||||
}
|
||||
Object value = cacheMap.get(key);
|
||||
if (value == null) {
|
||||
log.error("[cache] value is null, remove it, key {}.", key);
|
||||
cacheMap.remove(key);
|
||||
timeoutMap.remove(key);
|
||||
} else if (refreshCache) {
|
||||
|
||||
@@ -134,7 +134,7 @@ public class JdbcCommonCollect extends AbstractCollect {
|
||||
// 设置查询最大行数1000行
|
||||
statement.setMaxRows(1000);
|
||||
JdbcConnect jdbcConnect = new JdbcConnect(connection);
|
||||
CommonCache.getInstance().addCache(identifier, jdbcConnect);
|
||||
CommonCache.getInstance().addCache(identifier, jdbcConnect, 10000L);
|
||||
return statement;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
## docker-compose部署方案
|
||||
|
||||
- 如果您不想部署而是直接使用,我们提供SAAS监控云-[TanCloud探云](https://console.tancloud.cn),即刻 **[登录注册](https://console.tancloud.cn)** 免费使用。
|
||||
- 如果你想自己本地快速部署的话,可以参考下面进行操作。
|
||||
|
||||
###
|
||||
|
||||
##### 安装Docker&Docker-compose
|
||||
|
||||
1. docker &docker-compos 安装自行百度,如果这也不会,那这个部署方式可能不适合您。
|
||||
|
||||
##### 下载并解压部署包-hertzbeat-for-dockercompose
|
||||
|
||||
1.进入 hertzbeat-for-dockercompose目录
|
||||
|
||||
`docker-compose up -d`
|
||||
|
||||
2.创建tdengine数据库
|
||||
|
||||
`$ 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`
|
||||
|
||||
|
||||
---
|
||||
怎么样是不是很简单,只要几分钟就可以部署完成,赶紧试试吧!
|
||||
@@ -1,70 +0,0 @@
|
||||
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: 1234
|
||||
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: 936751812@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
|
||||
@@ -1,167 +0,0 @@
|
||||
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(255) comment '参数值,最大字符长度255',
|
||||
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;
|
||||
@@ -1,49 +0,0 @@
|
||||
## -- 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
|
||||
# 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@123.
|
||||
role: [role1,role2]
|
||||
- appId: tom
|
||||
credential: tom@123.
|
||||
role: [role1,role2,role3]
|
||||
- appId: lili
|
||||
# 注意 Digest认证不支持加盐加密的密码账户
|
||||
# 加盐加密的密码,通过 MD5(password+salt)计算
|
||||
# 此账户的原始密码为 lili
|
||||
credential: 1A676730B0C7F54654B0E09194448289
|
||||
salt: 123
|
||||
role: [role1,role2]
|
||||
@@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -1,50 +0,0 @@
|
||||
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: 1234
|
||||
volumes:
|
||||
- ./dbdata/mysqldata:/var/lib/mysql/
|
||||
- ./conf/sql:/docker-entrypoint-initdb.d/
|
||||
networks:
|
||||
- heartzbeat
|
||||
|
||||
TDengine:
|
||||
image: "tdengine/tdengine:latest"
|
||||
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.5"
|
||||
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
|
||||
@@ -38,8 +38,6 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
@RequestMapping(path = "/monitors", produces = {APPLICATION_JSON_VALUE})
|
||||
public class MonitorsController {
|
||||
|
||||
private static final byte ALL_MONITOR_STATUS = 9;
|
||||
|
||||
@Autowired
|
||||
private MonitorService monitorService;
|
||||
|
||||
@@ -50,7 +48,6 @@ public class MonitorsController {
|
||||
@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 = "监控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 = "排序方式,asc:升序,desc:降序", example = "desc") @RequestParam(defaultValue = "desc") final String order,
|
||||
@ApiParam(value = "列表当前分页", example = "0") @RequestParam(defaultValue = "0") int pageIndex,
|
||||
@@ -69,10 +66,6 @@ public class MonitorsController {
|
||||
Predicate predicateApp = criteriaBuilder.equal(root.get("app"), app);
|
||||
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 andPredicate = criteriaBuilder.and(andList.toArray(andPredicates));
|
||||
|
||||
@@ -86,17 +79,9 @@ public class MonitorsController {
|
||||
orList.add(predicateName);
|
||||
}
|
||||
Predicate[] orPredicates = new Predicate[orList.size()];
|
||||
Predicate orPredicate = criteriaBuilder.or(orList.toArray(orPredicates));
|
||||
Predicate orPredicate = criteriaBuilder.and(orList.toArray(orPredicates));
|
||||
|
||||
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();
|
||||
}
|
||||
return query.where(andPredicate,orPredicate).getRestriction();
|
||||
};
|
||||
// 分页是必须的
|
||||
Sort sortExp = Sort.by(new Sort.Order(Sort.Direction.fromString(order), sort));
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<h1 align="center">HertzBeat</h1>
|
||||
|
||||
> 前端工程
|
||||
|
||||
**面向开发者,易用友好的监控告警系统**
|
||||
**面向开发者,易用友好的高性能监控云服务**
|
||||
|
||||
## 前端本地启动
|
||||
## 本地启动
|
||||
|
||||
### npm 方式
|
||||
1. 需要nodejs npm环境
|
||||
@@ -19,13 +21,13 @@
|
||||
4. 全局安装angular-cli `npm install -g @angular/cli@12 --registry=https://registry.npm.taobao.org`
|
||||
5. 待本地后端启动后,在web-app目录下启动本地前端 `ng serve --open`
|
||||
|
||||
## hertzbeat 编译打包
|
||||
## 编译打包
|
||||
|
||||
1. web-app目录下执行
|
||||
web-app目录下执行
|
||||
|
||||
```ng build --prod --base-href /console/```
|
||||
|
||||
2. manager目录下执行
|
||||
manager目录下执行
|
||||
|
||||
```mvn package```
|
||||
|
||||
|
||||
@@ -90,17 +90,13 @@ export class HeaderSearchComponent implements AfterViewInit, OnDestroy {
|
||||
)
|
||||
.subscribe(value => {
|
||||
// 远程加载搜索数据
|
||||
let searchMonitors$ = this.monitorSvc.searchMonitors(null, value, 9, 0, 10).subscribe(
|
||||
let searchMonitors$ = this.monitorSvc.searchMonitors(value, value, 0, 10).subscribe(
|
||||
message => {
|
||||
this.loading = false;
|
||||
searchMonitors$.unsubscribe();
|
||||
if (message.code === 0) {
|
||||
let page = message.data;
|
||||
if (page.content != undefined) {
|
||||
this.options = page.content;
|
||||
} else {
|
||||
this.options = [];
|
||||
}
|
||||
this.options = page.content;
|
||||
this.cdr.detectChanges();
|
||||
} else {
|
||||
console.warn(message.msg);
|
||||
@@ -122,7 +118,7 @@ export class HeaderSearchComponent implements AfterViewInit, OnDestroy {
|
||||
qBlur(): void {
|
||||
this.focus = false;
|
||||
this.searchToggled = false;
|
||||
this.options = [];
|
||||
this.options.length = 0;
|
||||
this.toggleChangeChange.emit(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
type="text"
|
||||
placeholder="搜索告警内容"
|
||||
nzSize="default"
|
||||
(keyup.enter)="onFilterSearchAlerts()"
|
||||
[(ngModel)]="filterContent"
|
||||
/>
|
||||
<nz-select
|
||||
|
||||
@@ -12,57 +12,31 @@
|
||||
</nz-breadcrumb-item>
|
||||
</nz-breadcrumb>
|
||||
<nz-divider></nz-divider>
|
||||
|
||||
<div>
|
||||
<button nz-button nzType="primary">
|
||||
<a routerLink="/monitors/new" [queryParams]="{ app: app }">
|
||||
<i nz-icon nzType="appstore-add" nzTheme="outline"></i>
|
||||
新增 {{ 'monitor.app.' + app | i18n }}
|
||||
</a>
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onEditMonitor()">
|
||||
<i nz-icon nzType="edit" nzTheme="outline"></i>
|
||||
编辑
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onDeleteMonitors()">
|
||||
<i nz-icon nzType="delete" nzTheme="outline"></i>
|
||||
删除
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onEnableManageMonitors()">
|
||||
<i nz-icon nzType="up-circle" nzTheme="outline"></i>
|
||||
启用监控
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onCancelManageMonitors()">
|
||||
<i nz-icon nzType="down-circle" nzTheme="outline"></i>
|
||||
取消监控
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="sync()" nz-tooltip nzTooltipTitle="刷新">
|
||||
<i nz-icon nzType="sync" nzTheme="outline"></i>
|
||||
</button>
|
||||
|
||||
<button style="margin-right: 25px; float: right" nz-button nzType="primary" (click)="onFilterSearchMonitors()"> 搜索 </button>
|
||||
<input
|
||||
style="margin-right: 5px; float: right; width: 150px; border-radius: 9px; text-align: center"
|
||||
nz-input
|
||||
type="text"
|
||||
placeholder="搜索监控"
|
||||
nzSize="default"
|
||||
(keyup.enter)="onFilterSearchMonitors()"
|
||||
[(ngModel)]="filterContent"
|
||||
/>
|
||||
<nz-select
|
||||
style="margin-right: 10px; float: right; width: 120px"
|
||||
nzAllowClear
|
||||
[nzPlaceHolder]="'监控状态过滤'"
|
||||
[(ngModel)]="filterStatus"
|
||||
>
|
||||
<nz-option nzLabel="全部状态" nzValue="9"></nz-option>
|
||||
<nz-option nzLabel="监控正常" nzValue="1"></nz-option>
|
||||
<nz-option nzLabel="不可用" nzValue="2"></nz-option>
|
||||
<nz-option nzLabel="不可达" nzValue="3"></nz-option>
|
||||
<nz-option nzLabel="未监控" nzValue="0"></nz-option>
|
||||
</nz-select>
|
||||
</div>
|
||||
<button nz-button nzType="primary">
|
||||
<a routerLink="/monitors/new" [queryParams]="{ app: app }">
|
||||
<i nz-icon nzType="appstore-add" nzTheme="outline"></i>
|
||||
新增 {{ 'monitor.app.' + app | i18n }}
|
||||
</a>
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onEditMonitor()">
|
||||
<i nz-icon nzType="edit" nzTheme="outline"></i>
|
||||
编辑
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onDeleteMonitors()">
|
||||
<i nz-icon nzType="delete" nzTheme="outline"></i>
|
||||
删除
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onEnableManageMonitors()">
|
||||
<i nz-icon nzType="up-circle" nzTheme="outline"></i>
|
||||
启用纳管
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onCancelManageMonitors()">
|
||||
<i nz-icon nzType="down-circle" nzTheme="outline"></i>
|
||||
取消纳管
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="sync()" nz-tooltip nzTooltipTitle="刷新">
|
||||
<i nz-icon nzType="sync" nzTheme="outline"></i>
|
||||
</button>
|
||||
|
||||
<nz-table
|
||||
#fixedTable
|
||||
@@ -135,10 +109,10 @@
|
||||
<button nz-button nzType="primary" (click)="onDeleteOneMonitor(data.id)" nz-tooltip nzTooltipTitle="删除监控">
|
||||
<i nz-icon nzType="delete" nzTheme="outline"></i>
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onEnableManageOneMonitor(data.id)" nz-tooltip nzTooltipTitle="启用监控">
|
||||
<button nz-button nzType="primary" (click)="onEnableManageOneMonitor(data.id)" nz-tooltip nzTooltipTitle="启用纳管">
|
||||
<i nz-icon nzType="up-circle" nzTheme="outline"></i>
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onCancelManageOneMonitor(data.id)" nz-tooltip nzTooltipTitle="取消监控">
|
||||
<button nz-button nzType="primary" (click)="onCancelManageOneMonitor(data.id)" nz-tooltip nzTooltipTitle="取消纳管">
|
||||
<i nz-icon nzType="down-circle" nzTheme="outline"></i>
|
||||
</button>
|
||||
</td>
|
||||
|
||||
@@ -30,9 +30,6 @@ export class MonitorListComponent implements OnInit {
|
||||
monitors!: Monitor[];
|
||||
tableLoading: boolean = true;
|
||||
checkedMonitorIds = new Set<number>();
|
||||
// 过滤搜索
|
||||
filterContent!: string;
|
||||
filterStatus: number = 9;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.route.queryParamMap.subscribe(paramMap => {
|
||||
@@ -45,33 +42,6 @@ export class MonitorListComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
onFilterSearchMonitors() {
|
||||
this.tableLoading = true;
|
||||
let filter$ = this.monitorSvc
|
||||
.searchMonitors(this.app, this.filterContent, this.filterStatus, this.pageIndex - 1, this.pageSize)
|
||||
.subscribe(
|
||||
message => {
|
||||
filter$.unsubscribe();
|
||||
this.tableLoading = false;
|
||||
this.checkedAll = false;
|
||||
this.checkedMonitorIds.clear();
|
||||
if (message.code === 0) {
|
||||
let page = message.data;
|
||||
this.monitors = page.content;
|
||||
this.pageIndex = page.number + 1;
|
||||
this.total = page.totalElements;
|
||||
} else {
|
||||
console.warn(message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.tableLoading = false;
|
||||
filter$.unsubscribe();
|
||||
console.error(error.msg);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
sync() {
|
||||
this.loadMonitorTable();
|
||||
}
|
||||
@@ -184,7 +154,7 @@ export class MonitorListComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
this.modal.confirm({
|
||||
nzTitle: '请确认是否批量取消监控!',
|
||||
nzTitle: '请确认是否批量取消纳管!',
|
||||
nzOkText: '确定',
|
||||
nzCancelText: '取消',
|
||||
nzOkDanger: true,
|
||||
@@ -197,7 +167,7 @@ export class MonitorListComponent implements OnInit {
|
||||
let monitors = new Set<number>();
|
||||
monitors.add(monitorId);
|
||||
this.modal.confirm({
|
||||
nzTitle: '请确认是否取消监控!',
|
||||
nzTitle: '请确认是否取消纳管!',
|
||||
nzOkText: '确定',
|
||||
nzCancelText: '取消',
|
||||
nzOkDanger: true,
|
||||
@@ -212,28 +182,28 @@ export class MonitorListComponent implements OnInit {
|
||||
message => {
|
||||
cancelManage$.unsubscribe();
|
||||
if (message.code === 0) {
|
||||
this.notifySvc.success('取消监控成功!', '');
|
||||
this.notifySvc.success('取消纳管成功!', '');
|
||||
this.loadMonitorTable();
|
||||
} else {
|
||||
this.tableLoading = false;
|
||||
this.notifySvc.error('取消监控失败!', message.msg);
|
||||
this.notifySvc.error('取消纳管失败!', message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.tableLoading = false;
|
||||
cancelManage$.unsubscribe();
|
||||
this.notifySvc.error('取消监控失败!', error.msg);
|
||||
this.notifySvc.error('取消纳管失败!', error.msg);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onEnableManageMonitors() {
|
||||
if (this.checkedMonitorIds == null || this.checkedMonitorIds.size === 0) {
|
||||
this.notifySvc.warning('未选中任何待启用监控项!', '');
|
||||
this.notifySvc.warning('未选中任何待启用纳管项!', '');
|
||||
return;
|
||||
}
|
||||
this.modal.confirm({
|
||||
nzTitle: '请确认是否批量启用监控!',
|
||||
nzTitle: '请确认是否批量启用纳管!',
|
||||
nzOkText: '确定',
|
||||
nzCancelText: '取消',
|
||||
nzOkDanger: true,
|
||||
@@ -246,7 +216,7 @@ export class MonitorListComponent implements OnInit {
|
||||
let monitors = new Set<number>();
|
||||
monitors.add(monitorId);
|
||||
this.modal.confirm({
|
||||
nzTitle: '请确认是否启用监控!',
|
||||
nzTitle: '请确认是否启用纳管!',
|
||||
nzOkText: '确定',
|
||||
nzCancelText: '取消',
|
||||
nzOkDanger: true,
|
||||
@@ -261,17 +231,17 @@ export class MonitorListComponent implements OnInit {
|
||||
message => {
|
||||
enableManage$.unsubscribe();
|
||||
if (message.code === 0) {
|
||||
this.notifySvc.success('启用监控成功!', '');
|
||||
this.notifySvc.success('启用纳管成功!', '');
|
||||
this.loadMonitorTable();
|
||||
} else {
|
||||
this.tableLoading = false;
|
||||
this.notifySvc.error('启用监控失败!', message.msg);
|
||||
this.notifySvc.error('启用纳管失败!', message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.tableLoading = false;
|
||||
enableManage$.unsubscribe();
|
||||
this.notifySvc.error('启用监控失败!', error.msg);
|
||||
this.notifySvc.error('启用纳管失败!', error.msg);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -88,28 +88,17 @@ export class MonitorService {
|
||||
return this.http.get<Message<Page<Monitor>>>(monitors_uri, options);
|
||||
}
|
||||
|
||||
public searchMonitors(
|
||||
app: string | null,
|
||||
searchValue: string,
|
||||
status: number,
|
||||
pageIndex: number,
|
||||
pageSize: number
|
||||
): Observable<Message<Page<Monitor>>> {
|
||||
public searchMonitors(monitorName: string, monitorHost: string, pageIndex: number, pageSize: number): Observable<Message<Page<Monitor>>> {
|
||||
pageIndex = pageIndex ? pageIndex : 0;
|
||||
pageSize = pageSize ? pageSize : 8;
|
||||
status = status ? status : 9;
|
||||
// 注意HttpParams是不可变对象 需要保存set后返回的对象为最新对象
|
||||
let httpParams = new HttpParams();
|
||||
httpParams = httpParams.appendAll({
|
||||
name: searchValue,
|
||||
host: searchValue,
|
||||
status: status,
|
||||
name: monitorName,
|
||||
host: monitorHost,
|
||||
pageIndex: pageIndex,
|
||||
pageSize: pageSize
|
||||
});
|
||||
if (app != undefined) {
|
||||
httpParams = httpParams.append('app', app);
|
||||
}
|
||||
const options = { params: httpParams };
|
||||
return this.http.get<Message<Page<Monitor>>>(monitors_uri, options);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user