Merge branch 'master' of gitee.com:dromara/hertzbeat into master
This commit is contained in:
@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.usthe.common.util.CommonConstants.MONITOR_NOT_EXIST_CODE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
@@ -94,6 +95,7 @@ public class AlertDefineController {
|
||||
public ResponseEntity<Message<List<AlertDefineMonitorBind>>> getAlertDefineMonitorsBind(
|
||||
@ApiParam(value = "告警定义ID", example = "6565463543") @PathVariable("alertDefineId") long alertDefineId) {
|
||||
List<AlertDefineMonitorBind> defineBinds = alertDefineService.getBindAlertDefineMonitors(alertDefineId);
|
||||
defineBinds = defineBinds.stream().filter(item -> item.getMonitor() != null).collect(Collectors.toList());
|
||||
return ResponseEntity.ok(new Message<>(defineBinds));
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.NotFound;
|
||||
import org.hibernate.annotations.NotFoundAction;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -58,5 +60,6 @@ public class AlertDefineMonitorBind {
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "monitor_id", referencedColumnName = "id", insertable = false, updatable = false)
|
||||
@NotFound(action = NotFoundAction.IGNORE)
|
||||
private Monitor monitor;
|
||||
}
|
||||
|
||||
70
home/blog/2022-02-17-hertzbeat.md
Normal file
70
home/blog/2022-02-17-hertzbeat.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
title: 裸辞后我做了个开源监控告警系统
|
||||
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.com](https://hertzBeat.com) | [tancloud.cn](https://tancloud.cn)**
|
||||
**仓库: [https://github.com/dromara/hertzbeat](https://github.com/dromara/hertzbeat) | [https://gitee.com/dromara/hertzbeat](https://gitee.com/dromara/hertzbeat)**
|
||||
|
||||
大家好,这里自荐一个我全职开发的监控告警项目-HertzBeat赫兹跳动,欢迎大家了解试用。
|
||||
|
||||
毕业后也投入很多业余时间也做了一些开源项目 [Sureness](https://github.com/dromara/sureness) , [Bootshiro](https://gitee.com/tomsun28/bootshiro) , [Issues-translate-action](https://github.com/usthe/issues-translate-action) ,
|
||||
当时上班有空就回答网友问题,下班回家写开源代码,远程帮人看问题(大年30也看过😂),还总感觉时间不够用,当时想如果不去上班能做自己热爱的该多好,开源或者技术上能帮助别人感觉是作为程序员的一种成就感吧。
|
||||
既然想做开源为啥不能全职去做呢,想着年轻就要折腾,何况还是自己很想做的。于是乎21年底放弃激励裸辞开始全职开源了,也是第一次全职创业(虽然大概率失败,但搏一搏,单车变摩托🤓)
|
||||
自己在APM领域做了多年,当然这次创业加开源的方向也就是老本行监控系统,我们开发一个支持多种监控指标(更多监控类型指标正在适配中),拥有自定义监控,支持阈值告警通知等功能,面向开发者友好的开源监控项目-HertzBeat赫兹跳动。
|
||||
为了感谢老婆大人的全力支持,hertzbeat服务端口默认为**1157**(遥遥无期)-老婆叫尧尧,我个人希望未来的宝宝叫午期(没有话语权可能性不大😂)
|
||||
想到很多开发者和团队拥有云上资源,可能只需要使用监控服务而并不想部署繁杂的监控系统(往往有时候那套监控系统比我们自身服务消耗的服务器资源还多😅),我们也提供了可以直接登陆使用的SAAS云监控版本-[TanCloud探云](https://console.tancloud.cn)。
|
||||
希望老铁们多多支持了解试用点赞,非常感谢。
|
||||
|
||||
|
||||
### 介绍下HertzBeat
|
||||
|
||||
> HertzBeat赫兹跳动 是一个支持网站,API,PING,端口,全站,数据库等监控类型,拥有易用友好的可视化操作界面的开源监控告警项目。
|
||||
|
||||
目前还在开发初期,后面会支持更多的监控类型。数据库,操作系统,云原生,中间件,应用服务等等通用的软件监控都计划安排上。
|
||||
在监控领域,监控需求指标啊这些往往千奇百怪,作为一个面向开发者的开源软件,[自定义监控](https://hertzbeat.com/docs/advanced/extend-point) 肯定是要安排上的,大家可以只通过配置YML文件就可以自定义需要的监控类型和指标,来满足常见的个性化需求。
|
||||
HertzBeat 也是模块化的,`manager, collector, scheduler, warehouse, alerter` 各个模块解耦合,方便理解上手和定制开发。
|
||||
我们也提供了更自由化的告警阈值配置,阈值触发表达式,三种告警级别,触发次数配置,支持告警通知模版,邮件webhook等方式告警通知,实时感知业务状态。
|
||||
更多功能欢迎登陆 HertzBeat 的 [云环境TanCloud](https://console.tancloud.cn) https://console.tancloud.cn 试用发现。
|
||||
项目正在快速迭代中,欢迎参与加入进来我们一起共建项目开源生态。
|
||||
|
||||
**关于HertzBeat的云SAAS环境TanCloud - https://console.tancloud.cn**
|
||||
|
||||
我们很多开发者都会有自己的服务器,博客网站,数据库,云服务等云上资源。对于我们开发者或者中小团队,如何去花最小的精力去监控我们的云上资源,它们挂了或者异常能及时通知给我们进行处理,我感觉是值得探究的。
|
||||
如果是去自己部署一套监控系统在服务器上自己用,抛开学习成本和时间成本,往往有时候,那套监控系统比我们的自身网站消耗的服务器资源还大,这让原本紧张的服务器资源就更紧张了。
|
||||
|
||||
对此,我们提供了一个SAAS云监控服务,我们开发者或者中小团队个人无需再为了监控自己的网站等云上资源,而去部署一套繁琐的监控系统。
|
||||
[登陆即可免费开始使用](https://console.tancloud.cn) https://console.tancloud.cn。目前云环境功能还在快速迭代中,租户,权限等功能都会安排上,欢迎试用提需求提意见。
|
||||
|
||||
|
||||
|
||||
老铁们可以通过演示视频来直观了解功能: 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哦,灰常感谢,弯腰!!
|
||||
如果有老哥老妹觉得不错可以投入,欢迎加入进来我们一起搞哦,现在急需懂前端,后台,运维的老哥老妹你了。
|
||||
@@ -52,6 +52,6 @@ sidebar_label: Docker方式部署
|
||||
- tancloud/hertzbeat:latest : 使用拉取的HertzBeat官方发布的应用镜像来启动容器
|
||||
|
||||
5. 开始探索HertzBeat
|
||||
浏览器访问 http://ip:1157/console 开始使用HertzBeat进行监控告警。
|
||||
浏览器访问 http://ip:1157/console 开始使用HertzBeat进行监控告警。默认账户密码 admin/admin
|
||||
|
||||
**HAVE FUN**
|
||||
|
||||
@@ -50,6 +50,6 @@ sidebar_label: 安装包方式部署
|
||||
$ ./startup.sh
|
||||
```
|
||||
5. 开始探索HertzBeat
|
||||
浏览器访问 http://ip:1157/console 开始使用HertzBeat进行监控告警。
|
||||
浏览器访问 http://ip:1157/console 开始使用HertzBeat进行监控告警。默认账户密码 admin/admin
|
||||
|
||||
**HAVE FUN**
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
<properties>
|
||||
<mysql.version>8.0.16</mysql.version>
|
||||
<snake.yaml.version>1.26</snake.yaml.version>
|
||||
<sureness-core.version>1.0.5</sureness-core.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -103,7 +102,7 @@
|
||||
<dependency>
|
||||
<groupId>com.usthe.sureness</groupId>
|
||||
<artifactId>spring-boot-starter-sureness</artifactId>
|
||||
<version>1.0.6.beta1</version>
|
||||
<version>1.0.7</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ public class DispatchAlarm {
|
||||
//构建邮件模版
|
||||
String process = mailService.buildHTMLTemplate(alert);
|
||||
//设置邮件内容模版
|
||||
messageHelper.setText(process,true);
|
||||
messageHelper.setText(process,true);
|
||||
javaMailSender.send(mimeMessage);
|
||||
}catch (Exception e){
|
||||
log.error("[邮箱告警] error,Exception information={}",e.getMessage());
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
## -- sureness.yml document dataSource-- ##
|
||||
## -- sureness.yml文本数据源 -- ##
|
||||
|
||||
# load api resource which need be protected, config role who can access these resource.
|
||||
# resources that are not configured are also authenticated and protected by default, but not authorized
|
||||
# eg: /api/v2/host===post===[role2,role3,role4] means /api/v2/host===post can be access by role2,role3,role4
|
||||
# eg: /api/v1/getSource3===get===[] means /api/v1/getSource3===get can not be access by any role
|
||||
# 加载到匹配字典的资源,也就是需要被保护的,设置了所支持角色访问的资源
|
||||
# 没有配置的资源也默认被认证保护,但不鉴权
|
||||
# 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]
|
||||
|
||||
# load api resource which do not need protected, means them need be excluded.
|
||||
# these api resource can be access by everyone
|
||||
# 需要被过滤保护的资源,不认证鉴权直接访问
|
||||
# /api/v1/source3===get 表示 /api/v1/source3===get 可以被任何人访问 无需登录认证鉴权
|
||||
excludedResource:
|
||||
- /account/auth/**===*
|
||||
- /===get
|
||||
@@ -28,11 +28,11 @@ excludedResource:
|
||||
- /v2/api-docs===get
|
||||
- /v3/api-docs===get
|
||||
|
||||
# account info
|
||||
# there are three account: admin, root, tom
|
||||
# eg: admin has [role1,role2] ROLE, unencrypted password is admin, encrypted password is 0192023A7BBD73250516F069DF18B500
|
||||
# eg: root has role1, unencrypted password is 23456
|
||||
# eg: tom has role3, unencrypted password is 32113
|
||||
# 用户账户信息
|
||||
# 下面有 admin root tom三个账户
|
||||
# eg: admin 拥有[role1,role2]角色,明文密码为admin,加盐密码为0192023A7BBD73250516F069DF18B500
|
||||
# eg: root 拥有[role1],密码为明文23456
|
||||
# eg: tom 拥有[role3],密码为明文32113
|
||||
account:
|
||||
- appId: admin
|
||||
credential: admin
|
||||
|
||||
@@ -36,6 +36,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 ">
|
||||
<includes>
|
||||
<include>application.yml</include>
|
||||
<include>logback-spring.xml</include>
|
||||
<include>sureness.yml</include>
|
||||
</includes>
|
||||
<filtered>true</filtered>
|
||||
<outputDirectory>${file.separator}config</outputDirectory>
|
||||
|
||||
@@ -11,4 +11,4 @@ echo "start pull and stop and replace hertzbeat container"
|
||||
docker pull registry.cn-hangzhou.aliyuncs.com/tomsun28/hertzbeat:"$TAG"
|
||||
docker stop hertzbeat
|
||||
docker rm hertzbeat
|
||||
docker run -d -p 11157:1157 --name hertzbeat registry.cn-hangzhou.aliyuncs.com/tomsun28/hertzbeat:"$TAG"
|
||||
docker run -d -p 11157:1157 -v /home/ubuntu/hertzbeat/application.yml:/opt/hertzbeat/config/application.yml --name hertzbeat registry.cn-hangzhou.aliyuncs.com/tomsun28/hertzbeat:"$TAG"
|
||||
49
script/sureness.yml
Normal file
49
script/sureness.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
## -- 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 root tom三个账户
|
||||
# eg: admin 拥有[role1,role2]角色,明文密码为admin,加盐密码为0192023A7BBD73250516F069DF18B500
|
||||
# eg: root 拥有[role1],密码为明文23456
|
||||
# eg: tom 拥有[role3],密码为明文32113
|
||||
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]
|
||||
@@ -4,16 +4,16 @@
|
||||
<div class="top">
|
||||
<div class="head">
|
||||
<img class="logo" src="./assets/logo.svg" alt="" />
|
||||
<span class="title">探云</span>
|
||||
<span class="title">HertzBeat</span>
|
||||
</div>
|
||||
<div class="desc">易用友好的高性能监控云服务</div>
|
||||
<div class="desc">TanCloud-易用友好的高性能监控云服务</div>
|
||||
</div>
|
||||
<router-outlet></router-outlet>
|
||||
<global-footer [links]="links">
|
||||
Copyright
|
||||
<i class="anticon anticon-copyright"></i> 2021
|
||||
<a href="https://tancloud.cn" target="_blank">探云 tancloud.cn | </a>
|
||||
<a href="https://tancloud.cn" target="_blank">赫兹跳动 hertzbeat.com</a>
|
||||
<a href="https://hertzbeat.com" target="_blank">赫兹跳动 hertzbeat.com</a>
|
||||
</global-footer>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@ export class NoticeReceiver {
|
||||
// 通知信息方式: 0-手机短信 1-邮箱 2-webhook 3-微信公众号
|
||||
type: number = 1;
|
||||
phone!: string;
|
||||
email!: number;
|
||||
email!: string;
|
||||
hookUrl!: string;
|
||||
wechatId!: string;
|
||||
creator!: string;
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
(nzOnCancel)="onManageReceiverModalCancel()"
|
||||
(nzOnOk)="onManageReceiverModalOk()"
|
||||
nzMaskClosable="false"
|
||||
nzWidth="60%"
|
||||
nzWidth="40%"
|
||||
[nzOkLoading]="isManageReceiverModalOkLoading"
|
||||
>
|
||||
<div *nzModalContent class="-inner-content">
|
||||
@@ -216,7 +216,7 @@
|
||||
(nzOnCancel)="onManageRuleModalCancel()"
|
||||
(nzOnOk)="onManageRuleModalOk()"
|
||||
nzMaskClosable="false"
|
||||
nzWidth="60%"
|
||||
nzWidth="40%"
|
||||
[nzOkLoading]="isManageRuleModalOkLoading"
|
||||
>
|
||||
<div *nzModalContent class="-inner-content">
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
<nz-tab [nzTitle]="'app.login.tab-login-credentials' | i18n">
|
||||
<nz-alert *ngIf="error" [nzType]="'error'" [nzMessage]="error" [nzShowIcon]="true" class="mb-lg"></nz-alert>
|
||||
<nz-form-item>
|
||||
<nz-form-control nzErrorTip="Please enter username: admin or user">
|
||||
<nz-form-control nzErrorTip="请输入用户名">
|
||||
<nz-input-group nzSize="large" nzPrefixIcon="user">
|
||||
<input nz-input formControlName="userName" placeholder="username: admin or user" />
|
||||
<input nz-input formControlName="userName" placeholder="请输入用户名" />
|
||||
</nz-input-group>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-control nzErrorTip="Please enter password">
|
||||
<nz-form-control nzErrorTip="请输入密码">
|
||||
<nz-input-group nzSize="large" nzPrefixIcon="lock">
|
||||
<input nz-input type="password" formControlName="password" placeholder="password: admin" />
|
||||
<input nz-input type="password" formControlName="password" placeholder="请输入密码" />
|
||||
</nz-input-group>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
|
||||
Reference in New Issue
Block a user