Compare commits
5 Commits
feature_Ad
...
feature#ro
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2026d0e34f | ||
|
|
39d31ad196 | ||
|
|
70c31f1db7 | ||
|
|
589d178586 | ||
|
|
7c54bf0203 |
@@ -62,6 +62,8 @@
|
||||
- 如果您不想部署而是直接使用,我们提供SAAS监控云-[TanCloud探云](https://console.tancloud.cn),即刻 **[登录注册](https://console.tancloud.cn)** 免费使用。
|
||||
- 如果您是想将HertzBeat部署到内网环境搭建监控系统,请参考下面的 [部署文档](https://hertzbeat.com/docs/start/quickstart) 进行操作。
|
||||
|
||||
安装部署视频教程: [HertzBeat安装部署-BiliBili](https://www.bilibili.com/video/BV1GY41177YL)
|
||||
|
||||
### 🐵 依赖服务部署
|
||||
|
||||
> HertzBeat最少依赖于 关系型数据库[MYSQL5+](https://www.mysql.com/) 和 时序性数据库[TDengine2+](https://www.taosdata.com/getting-started)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.usthe.alert;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 数据仓储配置属性
|
||||
*
|
||||
* @author tom
|
||||
* @date 2021/11/24 10:38
|
||||
*/
|
||||
@@ -12,11 +14,22 @@ import org.springframework.stereotype.Component;
|
||||
@ConfigurationProperties(prefix = "alerter")
|
||||
public class AlerterProperties {
|
||||
|
||||
private String consoleUrl = "https://console.tancloud.cn";
|
||||
|
||||
public String getConsoleUrl() {
|
||||
return consoleUrl;
|
||||
}
|
||||
|
||||
public void setConsoleUrl(String url) {
|
||||
this.consoleUrl = url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据入口配置属性
|
||||
*/
|
||||
private EntranceProperties entrance;
|
||||
|
||||
|
||||
public EntranceProperties getEntrance() {
|
||||
return entrance;
|
||||
}
|
||||
@@ -25,6 +38,7 @@ public class AlerterProperties {
|
||||
this.entrance = entrance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 数据入口配置属性
|
||||
* 入口可以是从kafka rabbitmq rocketmq等消息中间件获取数据
|
||||
@@ -98,4 +112,5 @@ public class AlerterProperties {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
18
home/docs/help/alert_console.md
Normal file
18
home/docs/help/alert_console.md
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
id: alert_console
|
||||
title: 告警模板中自定义的控制台地址
|
||||
sidebar_label: 告警模板登录台地址
|
||||
---
|
||||
|
||||
> 阈值触发后发送告警信息,通过钉钉/企业微信/飞书机器人通知或者使用邮箱通知的时候,告警内容中有登录控制台的详情链接
|
||||
|
||||
|
||||
### 自定义设置
|
||||
|
||||
在我们的启动配置文件application.yml中,找到下面的配置
|
||||
```yml
|
||||
alerter:
|
||||
console-url: #这里就是我们的自定义控制台地址
|
||||
```
|
||||
|
||||
默认值是赫兹跳动的官方控制台地址
|
||||
@@ -6,6 +6,8 @@ sidebar_label: Docker方式部署
|
||||
|
||||
> 推荐使用docker部署HertzBeat
|
||||
|
||||
安装部署视频教程: [HertzBeat安装部署-BiliBili](https://www.bilibili.com/video/BV1GY41177YL)
|
||||
|
||||
1. 下载安装Docker环境
|
||||
Docker 工具自身的下载请参考 [Docker官网文档](https://docs.docker.com/get-docker/)。
|
||||
安装完毕后终端查看Docker版本是否正常输出。
|
||||
@@ -47,71 +49,101 @@ sidebar_label: Docker方式部署
|
||||
|
||||
```yaml
|
||||
|
||||
resourceRole:
|
||||
- /account/auth/refresh===post===[role1,role2,role3,role4]
|
||||
resourceRole:
|
||||
- /account/auth/refresh===post===[admin,user,guest]
|
||||
- /apps/**===get===[admin,user,guest]
|
||||
- /monitor/**===get===[admin,user,guest]
|
||||
- /monitor/**===post===[admin,user]
|
||||
- /monitor/**===put===[admin,user]
|
||||
- /monitor/**===delete==[admin]
|
||||
- /monitors/**===get===[admin,user,guest]
|
||||
- /monitors/**===post===[admin,user]
|
||||
- /monitors/**===put===[admin,user]
|
||||
- /monitors/**===delete===[admin]
|
||||
- /alert/**===get===[admin,user,guest]
|
||||
- /alert/**===post===[admin,user]
|
||||
- /alert/**===put===[admin,user]
|
||||
- /alert/**===delete===[admin]
|
||||
- /alerts/**===get===[admin,user,guest]
|
||||
- /alerts/**===post===[admin,user]
|
||||
- /alerts/**===put===[admin,user]
|
||||
- /alerts/**===delete===[admin]
|
||||
- /notice/**===get===[admin,user,guest]
|
||||
- /notice/**===post===[admin,user]
|
||||
- /notice/**===put===[admin,user]
|
||||
- /notice/**===delete===[admin]
|
||||
- /summary/**===get===[admin,user,guest]
|
||||
- /summary/**===post===[admin,user]
|
||||
- /summary/**===put===[admin,user]
|
||||
- /summary/**===delete===[admin]
|
||||
|
||||
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
|
||||
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-resources/**===get
|
||||
- /v2/api-docs===get
|
||||
- /v3/api-docs===get
|
||||
# swagger ui 资源
|
||||
- /swagger-resources/**===get
|
||||
- /v2/api-docs===get
|
||||
- /v3/api-docs===get
|
||||
|
||||
account:
|
||||
- appId: admin
|
||||
credential: admin
|
||||
role: [admin,user]
|
||||
- appId: tom
|
||||
credential: tom@123
|
||||
role: [user]
|
||||
- appId: guest
|
||||
credential: guest
|
||||
role: [guest]
|
||||
- appId: lili
|
||||
# 注意 Digest认证不支持加盐加密的密码账户
|
||||
# 加盐加密的密码,通过 MD5(password+salt)计算
|
||||
# 此账户的原始密码为 lili
|
||||
credential: 1A676730B0C7F54654B0E09184448289
|
||||
salt: 123
|
||||
role: [guest]
|
||||
|
||||
# 用户账户信息
|
||||
# 下面有 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 三个账户
|
||||
# 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]
|
||||
# 用户账户信息
|
||||
# 下面有 admin tom lili 三个账户
|
||||
# eg: admin 拥有[admin,user]角色,密码为admin
|
||||
# eg: tom 拥有[user],密码为tom@123
|
||||
# eg: lili 拥有[guest],明文密码为lili, 加盐密码为1A676730B0C7F54654B0E09184448289
|
||||
account:
|
||||
- appId: admin
|
||||
credential: admin
|
||||
role: [admin,user]
|
||||
- appId: tom
|
||||
credential: tom@123
|
||||
role: [user]
|
||||
- appId: guest
|
||||
credential: guest
|
||||
role: [guest]
|
||||
- appId: lili
|
||||
# 注意 Digest认证不支持加盐加密的密码账户
|
||||
# 加盐加密的密码,通过 MD5(password+salt)计算
|
||||
# 此账户的原始密码为 lili
|
||||
credential: 1A676730B0C7F54654B0E09184448289
|
||||
salt: 123
|
||||
role: [guest]
|
||||
|
||||
```
|
||||
|
||||
6. 启动HertzBeat Docker容器
|
||||
|
||||
@@ -5,6 +5,8 @@ sidebar_label: MYSQL安装初始化
|
||||
---
|
||||
MYSQL是一款值得信赖的关系型数据库,HertzBeat使用其存储监控信息,告警信息,配置信息等结构化关系数据。
|
||||
|
||||
安装部署视频教程: [HertzBeat安装部署-BiliBili](https://www.bilibili.com/video/BV1GY41177YL)
|
||||
|
||||
> 如果您已有MYSQL环境,可直接跳到SQL脚本执行那一步。
|
||||
|
||||
### 通过Docker方式安装MYSQL
|
||||
|
||||
@@ -3,7 +3,9 @@ id: package-deploy
|
||||
title: 通过安装包安装HertzBeat
|
||||
sidebar_label: 安装包方式部署
|
||||
---
|
||||
> HertzBeat支持在Linux Windows Mac系统安装运行,CPU支持X64/ARM64。由于安装包自身不包含JAVA运行环境,需您提前准备JAVA运行环境。
|
||||
> HertzBeat支持在Linux Windows Mac系统安装运行,CPU支持X86/ARM64。由于安装包自身不包含JAVA运行环境,需您提前准备JAVA运行环境。
|
||||
|
||||
安装部署视频教程: [HertzBeat安装部署-BiliBili](https://www.bilibili.com/video/BV1GY41177YL)
|
||||
|
||||
1. 安装JAVA运行环境-可参考[官方网站](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
|
||||
要求:JDK8+(已验证JDK8)
|
||||
@@ -49,25 +51,30 @@ sidebar_label: 安装包方式部署
|
||||
修改sureness.yml的如下**部分参数**:**[注意⚠️sureness配置的其它默认参数需保留]**
|
||||
|
||||
```yaml
|
||||
# 用户账户信息
|
||||
# 下面有 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]
|
||||
|
||||
# 用户账户信息
|
||||
# 下面有 admin tom lili 三个账户
|
||||
# eg: admin 拥有[admin,user]角色,密码为admin
|
||||
# eg: tom 拥有[user],密码为tom@123
|
||||
# eg: lili 拥有[guest],明文密码为lili, 加盐密码为1A676730B0C7F54654B0E09184448289
|
||||
account:
|
||||
- appId: admin
|
||||
credential: admin
|
||||
role: [admin,user]
|
||||
- appId: tom
|
||||
credential: tom@123
|
||||
role: [user]
|
||||
- appId: guest
|
||||
credential: guest
|
||||
role: [guest]
|
||||
- appId: lili
|
||||
# 注意 Digest认证不支持加盐加密的密码账户
|
||||
# 加盐加密的密码,通过 MD5(password+salt)计算
|
||||
# 此账户的原始密码为 lili
|
||||
credential: 1A676730B0C7F54654B0E09184448289
|
||||
salt: 123
|
||||
role: [guest]
|
||||
|
||||
```
|
||||
|
||||
5. 部署启动
|
||||
|
||||
@@ -9,6 +9,8 @@ sidebar_label: 快速开始
|
||||
- 如果您不想部署而是直接使用,我们提供SAAS监控云-[TanCloud探云](https://console.tancloud.cn),即刻[登录注册](https://console.tancloud.cn)免费使用。
|
||||
- 如果您是想将HertzBeat部署到内网环境搭建监控系统,请参考下面的部署文档进行操作。
|
||||
|
||||
安装部署视频教程: [HertzBeat安装部署-BiliBili](https://www.bilibili.com/video/BV1GY41177YL)
|
||||
|
||||
### 🐵 依赖服务部署
|
||||
|
||||
> HertzBeat最少依赖于 关系型数据库[MYSQL5+](https://www.mysql.com/) 和 时序性数据库[TDengine2+](https://www.taosdata.com/getting-started)
|
||||
|
||||
@@ -5,8 +5,11 @@ sidebar_label: TDengine安装初始化
|
||||
---
|
||||
TDengine是一款国产的开源物联网时序型数据库,我们使用其替换了InfluxDb,来存储采集到的监控指标数据。
|
||||
|
||||
安装部署视频教程: [HertzBeat安装部署-BiliBili](https://www.bilibili.com/video/BV1GY41177YL)
|
||||
|
||||
> 如果您已有TDengine环境,可直接跳到创建数据库实例那一步。
|
||||
|
||||
|
||||
### 通过Docker方式安装TDengine
|
||||
> 可参考官方网站[安装教程](https://www.taosdata.com/docs/cn/v2.0/getting-started/docker)
|
||||
1. 下载安装Docker环境
|
||||
|
||||
14
home/i18n/en/docusaurus-plugin-content-blog/options.json
Normal file
14
home/i18n/en/docusaurus-plugin-content-blog/options.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"title": {
|
||||
"message": "Blog",
|
||||
"description": "The title for the blog used in SEO"
|
||||
},
|
||||
"description": {
|
||||
"message": "Blog",
|
||||
"description": "The description for the blog used in SEO"
|
||||
},
|
||||
"sidebar.title": {
|
||||
"message": "Recent posts",
|
||||
"description": "The label for the left sidebar"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.usthe.manager.component.alerter;
|
||||
|
||||
import com.usthe.alert.AlerterDataQueue;
|
||||
import com.usthe.alert.AlerterProperties;
|
||||
import com.usthe.alert.AlerterWorkerPool;
|
||||
import com.usthe.common.util.CommonUtil;
|
||||
import com.usthe.common.entity.alerter.Alert;
|
||||
@@ -24,6 +25,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.ResourceAccessException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -48,6 +50,8 @@ public class DispatchAlarm {
|
||||
private JavaMailSender javaMailSender;
|
||||
private RestTemplate restTemplate;
|
||||
private MailService mailService;
|
||||
@Resource
|
||||
private AlerterProperties alerterProperties;
|
||||
|
||||
@Value("${spring.mail.username}")
|
||||
private String emailFromUser;
|
||||
@@ -177,13 +181,13 @@ public class DispatchAlarm {
|
||||
"\n所属监控ID :" + alert.getMonitorId() +
|
||||
"\n所属监控名称 :" + alert.getMonitorName() +
|
||||
"\n告警级别 :" + CommonUtil.transferAlertPriority(alert.getPriority()) +
|
||||
"\n内容详情 : " + alert.getContent();
|
||||
"\n内容详情 : " + alert.getContent() + "\n";
|
||||
flyBookContent.setText(text);
|
||||
contents1.add(flyBookContent);
|
||||
FlyBookWebHookDto.FlyBookContent bookContent = new FlyBookWebHookDto.FlyBookContent();
|
||||
bookContent.setTag("a");
|
||||
bookContent.setText("登入控制台");
|
||||
bookContent.setHref("https://www.tancloud.cn");
|
||||
bookContent.setHref(alerterProperties.getConsoleUrl());
|
||||
contents1.add(bookContent);
|
||||
contents.add(contents1);
|
||||
zhCn.setTitle("[TanCloud探云告警通知]");
|
||||
@@ -214,14 +218,16 @@ public class DispatchAlarm {
|
||||
private void sendDingTalkRobotAlert(NoticeReceiver receiver, Alert alert) {
|
||||
DingTalkWebHookDto dingTalkWebHookDto = new DingTalkWebHookDto();
|
||||
DingTalkWebHookDto.MarkdownDTO markdownDTO = new DingTalkWebHookDto.MarkdownDTO();
|
||||
String content = "#### [TanCloud探云告警通知]\n##### **告警目标对象** : " +
|
||||
StringBuilder content = new StringBuilder();
|
||||
content.append("#### [TanCloud探云告警通知]\n##### **告警目标对象** : " +
|
||||
alert.getTarget() + "\n " +
|
||||
"##### **所属监控ID** : " + alert.getMonitorId() + "\n " +
|
||||
"##### **所属监控名称** : " + alert.getMonitorName() + "\n " +
|
||||
"##### **告警级别** : " +
|
||||
CommonUtil.transferAlertPriority(alert.getPriority()) + "\n " +
|
||||
"##### **内容详情** : " + alert.getContent();
|
||||
markdownDTO.setText(content);
|
||||
"##### **内容详情** : " + alert.getContent());
|
||||
content.append("[点击跳转查看详情](" + alerterProperties.getConsoleUrl() + ")");
|
||||
markdownDTO.setText(content.toString());
|
||||
markdownDTO.setTitle("TanCloud探云告警通知");
|
||||
dingTalkWebHookDto.setMarkdown(markdownDTO);
|
||||
String webHookUrl = DingTalkWebHookDto.WEBHOOK_URL + receiver.getAccessToken();
|
||||
@@ -261,8 +267,10 @@ public class DispatchAlarm {
|
||||
content.append("告警级别 : <font color=\"comment\">")
|
||||
.append(CommonUtil.transferAlertPriority(alert.getPriority())).append("</font>\n");
|
||||
}
|
||||
content.append("内容详情 : ").append(alert.getContent());
|
||||
content.append("内容详情 : ").append(alert.getContent() + "\n");
|
||||
content.append("[点击跳转查看详情](" + alerterProperties.getConsoleUrl() + ")");
|
||||
markdownDTO.setContent(content.toString());
|
||||
//TODO 增加控制台地址登录可控制
|
||||
weWorkWebHookDTO.setMarkdown(markdownDTO);
|
||||
String webHookUrl = WeWorkWebHookDto.WEBHOOK_URL + receiver.getWechatId();
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.usthe.manager.service.impl;
|
||||
|
||||
import com.usthe.alert.AlerterProperties;
|
||||
import com.usthe.common.entity.alerter.Alert;
|
||||
import com.usthe.common.util.CommonUtil;
|
||||
import com.usthe.manager.service.MailService;
|
||||
@@ -11,6 +12,7 @@ import org.thymeleaf.context.Context;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* Mailbox sending service interface implementation class
|
||||
* 邮箱发送服务接口实现类
|
||||
*
|
||||
* @author 花城
|
||||
@@ -23,16 +25,20 @@ public class MailServiceImpl implements MailService {
|
||||
|
||||
@Resource
|
||||
private TemplateEngine templateEngine;
|
||||
@Resource
|
||||
private AlerterProperties alerterProperties;
|
||||
|
||||
@Override
|
||||
public String buildAlertHtmlTemplate(final Alert alert) {
|
||||
// Introduce thymeleaf context parameters to render pages
|
||||
// 引入thymeleaf上下文参数渲染页面
|
||||
Context context = new Context();
|
||||
context.setVariable("target",alert.getTarget());
|
||||
context.setVariable("monitorId",alert.getMonitorId());
|
||||
context.setVariable("monitorName",alert.getMonitorName());
|
||||
context.setVariable("target", alert.getTarget());
|
||||
context.setVariable("monitorId", alert.getMonitorId());
|
||||
context.setVariable("monitorName", alert.getMonitorName());
|
||||
context.setVariable("priority", CommonUtil.transferAlertPriority(alert.getPriority()));
|
||||
context.setVariable("content",alert.getContent());
|
||||
context.setVariable("content", alert.getContent());
|
||||
context.setVariable("consoleUrl", alerterProperties.getConsoleUrl());
|
||||
return templateEngine.process("mailAlarm", context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,3 +69,8 @@ warehouse:
|
||||
url: jdbc:TAOS-RS://localhost:6041/hertzbeat
|
||||
username: root
|
||||
password: taosdata
|
||||
|
||||
#自定义告警控制台地址
|
||||
alerter:
|
||||
#这里就是我们的自定义控制台地址
|
||||
console-url: https://console.tancloud.cn
|
||||
|
||||
@@ -2,10 +2,35 @@
|
||||
|
||||
# 加载到匹配字典的资源,也就是需要被保护的,设置了所支持角色访问的资源
|
||||
# 没有配置的资源也默认被认证保护,但不鉴权
|
||||
# eg: /api/v1/source1===get===[role2] 表示 /api/v2/host===post 这条资源支持 role2 这一种角色访问
|
||||
# eg: /api/v1/source1===get===[admin] 表示 /api/v2/host===post 这条资源支持 admin 这一种角色访问
|
||||
# eg: /api/v1/source2===get===[] 表示 /api/v1/source2===get 这条资源不支持任何角色访问
|
||||
resourceRole:
|
||||
- /account/auth/refresh===post===[role1,role2,role3,role4]
|
||||
- /account/auth/refresh===post===[admin,user,guest]
|
||||
- /apps/**===get===[admin,user,guest]
|
||||
- /monitor/**===get===[admin,user,guest]
|
||||
- /monitor/**===post===[admin,user]
|
||||
- /monitor/**===put===[admin,user]
|
||||
- /monitor/**===delete==[admin]
|
||||
- /monitors/**===get===[admin,user,guest]
|
||||
- /monitors/**===post===[admin,user]
|
||||
- /monitors/**===put===[admin,user]
|
||||
- /monitors/**===delete===[admin]
|
||||
- /alert/**===get===[admin,user,guest]
|
||||
- /alert/**===post===[admin,user]
|
||||
- /alert/**===put===[admin,user]
|
||||
- /alert/**===delete===[admin]
|
||||
- /alerts/**===get===[admin,user,guest]
|
||||
- /alerts/**===post===[admin,user]
|
||||
- /alerts/**===put===[admin,user]
|
||||
- /alerts/**===delete===[admin]
|
||||
- /notice/**===get===[admin,user,guest]
|
||||
- /notice/**===post===[admin,user]
|
||||
- /notice/**===put===[admin,user]
|
||||
- /notice/**===delete===[admin]
|
||||
- /summary/**===get===[admin,user,guest]
|
||||
- /summary/**===post===[admin,user]
|
||||
- /summary/**===put===[admin,user]
|
||||
- /summary/**===delete===[admin]
|
||||
|
||||
# 需要被过滤保护的资源,不认证鉴权直接访问
|
||||
# /api/v1/source3===get 表示 /api/v1/source3===get 可以被任何人访问 无需登录认证鉴权
|
||||
@@ -31,20 +56,23 @@ excludedResource:
|
||||
|
||||
# 用户账户信息
|
||||
# 下面有 admin tom lili 三个账户
|
||||
# eg: admin 拥有[role1,role2]角色,密码为admin
|
||||
# eg: tom 拥有[role1,role2,role3],密码为tom@123
|
||||
# eg: lili 拥有[role1,role2],明文密码为lili, 加盐密码为1A676730B0C7F54654B0E09184448289
|
||||
# eg: admin 拥有[admin,user]角色,密码为admin
|
||||
# eg: tom 拥有[user],密码为tom@123
|
||||
# eg: lili 拥有[guest],明文密码为lili, 加盐密码为1A676730B0C7F54654B0E09184448289
|
||||
account:
|
||||
- appId: admin
|
||||
credential: admin
|
||||
role: [role1,role2]
|
||||
role: [admin,user]
|
||||
- appId: tom
|
||||
credential: tom@123
|
||||
role: [role1,role2,role3]
|
||||
role: [user]
|
||||
- appId: guest
|
||||
credential: guest
|
||||
role: [guest]
|
||||
- appId: lili
|
||||
# 注意 Digest认证不支持加盐加密的密码账户
|
||||
# 加盐加密的密码,通过 MD5(password+salt)计算
|
||||
# 此账户的原始密码为 lili
|
||||
credential: 1A676730B0C7F54654B0E09184448289
|
||||
salt: 123
|
||||
role: [role1,role2]
|
||||
role: [guest]
|
||||
|
||||
@@ -700,7 +700,7 @@
|
||||
<span style="font-family:Arial, Verdana; font-size:14px;color:#FFFFFF;"><a
|
||||
target="_blank"
|
||||
style="color:#FFFFFF;text-decoration:none;"
|
||||
href="https://console.tancloud.cn"
|
||||
th:href="${consoleUrl}"
|
||||
data-link-type="web">登入控制台</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -2,10 +2,35 @@
|
||||
|
||||
# 加载到匹配字典的资源,也就是需要被保护的,设置了所支持角色访问的资源
|
||||
# 没有配置的资源也默认被认证保护,但不鉴权
|
||||
# eg: /api/v1/source1===get===[role2] 表示 /api/v2/host===post 这条资源支持 role2 这一种角色访问
|
||||
# eg: /api/v1/source1===get===[admin] 表示 /api/v2/host===post 这条资源支持 admin 这一种角色访问
|
||||
# eg: /api/v1/source2===get===[] 表示 /api/v1/source2===get 这条资源不支持任何角色访问
|
||||
resourceRole:
|
||||
- /account/auth/refresh===post===[role1,role2,role3,role4]
|
||||
- /account/auth/refresh===post===[admin,user,guest]
|
||||
- /apps/**===get===[admin,user,guest]
|
||||
- /monitor/**===get===[admin,user,guest]
|
||||
- /monitor/**===post===[admin,user]
|
||||
- /monitor/**===put===[admin,user]
|
||||
- /monitor/**===delete==[admin]
|
||||
- /monitors/**===get===[admin,user,guest]
|
||||
- /monitors/**===post===[admin,user]
|
||||
- /monitors/**===put===[admin,user]
|
||||
- /monitors/**===delete===[admin]
|
||||
- /alert/**===get===[admin,user,guest]
|
||||
- /alert/**===post===[admin,user]
|
||||
- /alert/**===put===[admin,user]
|
||||
- /alert/**===delete===[admin]
|
||||
- /alerts/**===get===[admin,user,guest]
|
||||
- /alerts/**===post===[admin,user]
|
||||
- /alerts/**===put===[admin,user]
|
||||
- /alerts/**===delete===[admin]
|
||||
- /notice/**===get===[admin,user,guest]
|
||||
- /notice/**===post===[admin,user]
|
||||
- /notice/**===put===[admin,user]
|
||||
- /notice/**===delete===[admin]
|
||||
- /summary/**===get===[admin,user,guest]
|
||||
- /summary/**===post===[admin,user]
|
||||
- /summary/**===put===[admin,user]
|
||||
- /summary/**===delete===[admin]
|
||||
|
||||
# 需要被过滤保护的资源,不认证鉴权直接访问
|
||||
# /api/v1/source3===get 表示 /api/v1/source3===get 可以被任何人访问 无需登录认证鉴权
|
||||
@@ -31,20 +56,23 @@ excludedResource:
|
||||
|
||||
# 用户账户信息
|
||||
# 下面有 admin tom lili 三个账户
|
||||
# eg: admin 拥有[role1,role2]角色,密码为admin
|
||||
# eg: tom 拥有[role1,role2,role3],密码为tom@123
|
||||
# eg: lili 拥有[role1,role2],明文密码为lili, 加盐密码为1A676730B0C7F54654B0E09184448289
|
||||
# eg: admin 拥有[admin,user]角色,密码为admin
|
||||
# eg: tom 拥有[user],密码为tom@123
|
||||
# eg: lili 拥有[guest],明文密码为lili, 加盐密码为1A676730B0C7F54654B0E09184448289
|
||||
account:
|
||||
- appId: admin
|
||||
credential: admin
|
||||
role: [role1,role2]
|
||||
role: [admin,user]
|
||||
- appId: tom
|
||||
credential: tom
|
||||
role: [role1,role2,role3]
|
||||
credential: tom@123
|
||||
role: [user]
|
||||
- appId: guest
|
||||
credential: guest
|
||||
role: [guest]
|
||||
- appId: lili
|
||||
# 注意 Digest认证不支持加盐加密的密码账户
|
||||
# 加盐加密的密码,通过 MD5(password+salt)计算
|
||||
# 此账户的原始密码为 lili
|
||||
credential: 1A676730B0C7F54654B0E09194448289
|
||||
credential: 1A676730B0C7F54654B0E09184448289
|
||||
salt: 123
|
||||
role: [role1,role2]
|
||||
role: [guest]
|
||||
|
||||
@@ -26,6 +26,8 @@ services:
|
||||
container_name: tdengine
|
||||
hostname: tdengine
|
||||
restart: always
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- "6030-6049:6030-6049"
|
||||
- "6030-6049:6030-6049/udp"
|
||||
|
||||
@@ -2,10 +2,35 @@
|
||||
|
||||
# 加载到匹配字典的资源,也就是需要被保护的,设置了所支持角色访问的资源
|
||||
# 没有配置的资源也默认被认证保护,但不鉴权
|
||||
# eg: /api/v1/source1===get===[role2] 表示 /api/v2/host===post 这条资源支持 role2 这一种角色访问
|
||||
# eg: /api/v1/source1===get===[admin] 表示 /api/v2/host===post 这条资源支持 admin 这一种角色访问
|
||||
# eg: /api/v1/source2===get===[] 表示 /api/v1/source2===get 这条资源不支持任何角色访问
|
||||
resourceRole:
|
||||
- /account/auth/refresh===post===[role1,role2,role3,role4]
|
||||
- /account/auth/refresh===post===[admin,user,guest]
|
||||
- /apps/**===get===[admin,user,guest]
|
||||
- /monitor/**===get===[admin,user,guest]
|
||||
- /monitor/**===post===[admin,user]
|
||||
- /monitor/**===put===[admin,user]
|
||||
- /monitor/**===delete==[admin]
|
||||
- /monitors/**===get===[admin,user,guest]
|
||||
- /monitors/**===post===[admin,user]
|
||||
- /monitors/**===put===[admin,user]
|
||||
- /monitors/**===delete===[admin]
|
||||
- /alert/**===get===[admin,user,guest]
|
||||
- /alert/**===post===[admin,user]
|
||||
- /alert/**===put===[admin,user]
|
||||
- /alert/**===delete===[admin]
|
||||
- /alerts/**===get===[admin,user,guest]
|
||||
- /alerts/**===post===[admin,user]
|
||||
- /alerts/**===put===[admin,user]
|
||||
- /alerts/**===delete===[admin]
|
||||
- /notice/**===get===[admin,user,guest]
|
||||
- /notice/**===post===[admin,user]
|
||||
- /notice/**===put===[admin,user]
|
||||
- /notice/**===delete===[admin]
|
||||
- /summary/**===get===[admin,user,guest]
|
||||
- /summary/**===post===[admin,user]
|
||||
- /summary/**===put===[admin,user]
|
||||
- /summary/**===delete===[admin]
|
||||
|
||||
# 需要被过滤保护的资源,不认证鉴权直接访问
|
||||
# /api/v1/source3===get 表示 /api/v1/source3===get 可以被任何人访问 无需登录认证鉴权
|
||||
@@ -23,7 +48,7 @@ excludedResource:
|
||||
- /**/*.ttf===get
|
||||
- /**/*.png===get
|
||||
- /**/*.gif===get
|
||||
- /**/*.png===*
|
||||
- /**/*.png===*
|
||||
# swagger ui 资源
|
||||
- /swagger-resources/**===get
|
||||
- /v2/api-docs===get
|
||||
@@ -31,20 +56,23 @@ excludedResource:
|
||||
|
||||
# 用户账户信息
|
||||
# 下面有 admin tom lili 三个账户
|
||||
# eg: admin 拥有[role1,role2]角色,密码为admin
|
||||
# eg: tom 拥有[role1,role2,role3],密码为tom@123
|
||||
# eg: lili 拥有[role1,role2],明文密码为lili, 加盐密码为1A676730B0C7F54654B0E09184448289
|
||||
# eg: admin 拥有[admin,user]角色,密码为admin
|
||||
# eg: tom 拥有[user],密码为tom@123
|
||||
# eg: lili 拥有[guest],明文密码为lili, 加盐密码为1A676730B0C7F54654B0E09184448289
|
||||
account:
|
||||
- appId: admin
|
||||
credential: admin
|
||||
role: [role1,role2]
|
||||
role: [admin,user]
|
||||
- appId: tom
|
||||
credential: tom@123
|
||||
role: [role1,role2,role3]
|
||||
role: [user]
|
||||
- appId: guest
|
||||
credential: guest
|
||||
role: [guest]
|
||||
- appId: lili
|
||||
# 注意 Digest认证不支持加盐加密的密码账户
|
||||
# 加盐加密的密码,通过 MD5(password+salt)计算
|
||||
# 此账户的原始密码为 lili
|
||||
credential: 1A676730B0C7F54654B0E09184448289
|
||||
salt: 123
|
||||
role: [role1,role2]
|
||||
role: [guest]
|
||||
|
||||
@@ -26,8 +26,8 @@ const CODE_MESSAGE: { [key: number]: string } = {
|
||||
202: '一个请求已经进入后台排队(异步任务)。',
|
||||
204: '删除数据成功。',
|
||||
400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
|
||||
401: '用户没有权限(令牌、用户名、密码错误)。',
|
||||
403: '用户无权限访问此资源。',
|
||||
401: '用户认证信息异常。',
|
||||
403: '用户无此操作权限。',
|
||||
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
|
||||
406: '请求的格式不可得。',
|
||||
409: '请求与服务器端目标资源的当前状态相冲突',
|
||||
@@ -65,7 +65,11 @@ export class DefaultInterceptor implements HttpInterceptor {
|
||||
private checkStatus(ev: HttpResponseBase): void {
|
||||
const errorText = CODE_MESSAGE[ev.status] || ev.statusText;
|
||||
console.warn(` ${ev.status}: ${ev.url}`, errorText);
|
||||
this.notification.error(` ${ev.status}: ${ev.url}`, errorText);
|
||||
if (ev.status == 403) {
|
||||
this.notification.error(` ${ev.status}: ${errorText}`, '');
|
||||
} else {
|
||||
this.notification.error(` ${ev.status}: ${ev.url}`, errorText);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,7 +54,7 @@ export class HeaderNotifyComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
let loadAlerts$ = this.alertSvc.searchAlerts(0, undefined, undefined, 0, 5).subscribe(
|
||||
let loadAlerts$ = this.alertSvc.loadAlerts(0, undefined, undefined, 0, 5).subscribe(
|
||||
message => {
|
||||
loadAlerts$.unsubscribe();
|
||||
if (message.code === 0) {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<i nz-icon nzType="sync" nzTheme="outline"></i>
|
||||
</button>
|
||||
|
||||
<button style="margin-right: 25px; float: right" nz-button nzType="primary" (click)="onFilterSearchAlerts()">
|
||||
<button style="margin-right: 25px; float: right" nz-button nzType="primary" (click)="loadAlertsTable()">
|
||||
{{ 'common.search' | i18n }}
|
||||
</button>
|
||||
<input
|
||||
@@ -39,7 +39,7 @@
|
||||
type="text"
|
||||
[placeholder]="'alert.center.search' | i18n"
|
||||
nzSize="default"
|
||||
(keyup.enter)="onFilterSearchAlerts()"
|
||||
(keyup.enter)="loadAlertsTable()"
|
||||
[(ngModel)]="filterContent"
|
||||
/>
|
||||
<nz-select
|
||||
|
||||
@@ -36,13 +36,16 @@ export class AlertCenterComponent implements OnInit {
|
||||
this.loadAlertsTable();
|
||||
}
|
||||
|
||||
onFilterSearchAlerts() {
|
||||
sync() {
|
||||
this.loadAlertsTable();
|
||||
}
|
||||
|
||||
loadAlertsTable() {
|
||||
this.tableLoading = true;
|
||||
let filterAlerts$ = this.alertSvc
|
||||
.searchAlerts(this.filterStatus, this.filterPriority, this.filterContent, this.pageIndex - 1, this.pageSize)
|
||||
let alertsInit$ = this.alertSvc
|
||||
.loadAlerts(this.filterStatus, this.filterPriority, this.filterContent, this.pageIndex - 1, this.pageSize)
|
||||
.subscribe(
|
||||
message => {
|
||||
filterAlerts$.unsubscribe();
|
||||
this.tableLoading = false;
|
||||
this.checkedAll = false;
|
||||
this.checkedAlertIds.clear();
|
||||
@@ -54,44 +57,16 @@ export class AlertCenterComponent implements OnInit {
|
||||
} else {
|
||||
console.warn(message.msg);
|
||||
}
|
||||
alertsInit$.unsubscribe();
|
||||
},
|
||||
error => {
|
||||
this.tableLoading = false;
|
||||
filterAlerts$.unsubscribe();
|
||||
alertsInit$.unsubscribe();
|
||||
console.error(error.msg);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
sync() {
|
||||
this.loadAlertsTable();
|
||||
}
|
||||
|
||||
loadAlertsTable() {
|
||||
this.tableLoading = true;
|
||||
let alertsInit$ = this.alertSvc.getAlerts(this.pageIndex - 1, this.pageSize).subscribe(
|
||||
message => {
|
||||
this.tableLoading = false;
|
||||
this.checkedAll = false;
|
||||
this.checkedAlertIds.clear();
|
||||
if (message.code === 0) {
|
||||
let page = message.data;
|
||||
this.alerts = page.content;
|
||||
this.pageIndex = page.number + 1;
|
||||
this.total = page.totalElements;
|
||||
} else {
|
||||
console.warn(message.msg);
|
||||
}
|
||||
alertsInit$.unsubscribe();
|
||||
},
|
||||
error => {
|
||||
this.tableLoading = false;
|
||||
alertsInit$.unsubscribe();
|
||||
console.error(error.msg);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onDeleteAlerts() {
|
||||
if (this.checkedAlertIds == null || this.checkedAlertIds.size === 0) {
|
||||
this.notifySvc.warning(this.i18nSvc.fanyi('alert.center.notify.no-delete'), '');
|
||||
|
||||
@@ -347,7 +347,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
alertsDealLoading: boolean = true;
|
||||
|
||||
refreshAlertContentList(): void {
|
||||
let alertsInit$ = this.alertSvc.getAlerts(0, 4).subscribe(
|
||||
let alertsInit$ = this.alertSvc.loadAlerts(undefined, undefined, undefined, 0, 4).subscribe(
|
||||
message => {
|
||||
if (message.code === 0) {
|
||||
let page = message.data;
|
||||
|
||||
@@ -16,22 +16,7 @@ const alerts_status_uri = '/alerts/status';
|
||||
export class AlertService {
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
public getAlerts(pageIndex: number, pageSize: number): Observable<Message<Page<Alert>>> {
|
||||
pageIndex = pageIndex ? pageIndex : 0;
|
||||
pageSize = pageSize ? pageSize : 8;
|
||||
// 注意HttpParams是不可变对象 需要保存set后返回的对象为最新对象
|
||||
let httpParams = new HttpParams();
|
||||
httpParams = httpParams.appendAll({
|
||||
sort: 'id',
|
||||
order: 'desc',
|
||||
pageIndex: pageIndex,
|
||||
pageSize: pageSize
|
||||
});
|
||||
const options = { params: httpParams };
|
||||
return this.http.get<Message<Page<Alert>>>(alerts_uri, options);
|
||||
}
|
||||
|
||||
public searchAlerts(
|
||||
public loadAlerts(
|
||||
status: number | undefined,
|
||||
priority: number | undefined,
|
||||
content: string | undefined,
|
||||
|
||||
Reference in New Issue
Block a user