Skip to content

Commit

Permalink
bugfix greptime query error and add practice blog (#949)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsun28 committed Jan 16, 2024
1 parent a5f74b7 commit cebc9d8
Show file tree
Hide file tree
Showing 23 changed files with 476 additions and 56 deletions.
74 changes: 74 additions & 0 deletions home/blog/2023-05-09-hertzbeat-v1.3.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
title: Open source real-time monitoring tool HertzBeat v1.3.1 released
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, practice]
keywords: [open source monitoring system, alerting system, Linux monitoring]
---

Website: hertzbeat.com | tancloud.cn


![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/a9629ef5bb6e486cacddb899f1495c6e~tplv-k3u1fbpfcp-zoom-1.image)



### What is HertzBeat?

> HertzBeat is an open source real-time monitoring and alerting tool with powerful custom monitoring capabilities and no Agent required.
> It supports monitoring of application services, database, operating system, middleware, cloud native, network and other metrics, and threshold alert notification in one step.
> Support more liberal threshold rules (calculation expressions), `email` `Discord` `Slack` `Telegram` `Pegging` `WeChat` `FlyBook` `SMS` `Webhook` and other ways to timely delivery.
> We have made the protocol specifications such as `Http,Jmx,Ssh,Snmp,Jdbc` configurable so that you can simply configure `YML` to use these protocols to customize the collection of any metrics you want.
> Do you believe that you can immediately adapt a new monitoring type such as K8s or Docker just by defining YML?

![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/4236e748f5ac4352b7cf4bb65ccf97aa~tplv-k3u1fbpfcp-zoom-1.image)


**Github: https://github.com/dromara/hertzbeat**

**Gitee: https://gitee.com/dromara/hertzbeat**

### v1.3.1 release is here

Hi guys! Major release. HertzBeat v1.3.1 is coming. **So excited that more than 30 friends have contributed this version.**.
We support **greptimeDB, tedngine3.0 and opengauss influxdb** to store to metrics data.
New feature **monitoring export and import by excel json yaml** , **alert silence**, **new monitoring template** and more.
Support monitoring EulerOS metrics and SpringBoot3 metrics. Fixed several bugs, imporved document and improved the overall stable usability.

Let's Try Now!

Only one docker command is needed to install and experience hertzbeat:
`docker run -d -p 1157:1157 --name hertzbeat tancloud/hertzbeat`

## Upgrade Note⚠️.

If use tdengine before, please upgrade tdengine to 3.0+

Please Run SQL Script When Upgrade.
```
ALTER table hzb_alert_define modify field varchar(255) default null;
COMMIT;
```

----

## ⛄ Supported

- Site Monitor, Port Availability, Http Api, Ping Connectivity, Jvm, SiteMap Full Site, Ssl Certificate, SpringBoot, FTP Server
- Mysql, PostgreSQL, MariaDB, Redis, ElasticSearch, SqlServer, Oracle, MongoDB, Damon, OpenGauss, ClickHouse, IoTDB, Redis Cluster
- Linux, Ubuntu, CentOS, Windows
- Tomcat, Nacos, Zookeeper, RabbitMQ, Flink, Kafka, ShenYu, DynamicTp, Jetty, ActiveMQ
- Kubernetes, Docker
- Huawei Switch, HPE Switch, TP-LINK Switch, Cisco Switch
- and more for your custom monitoring.
- Notifications support `Discord` `Slack` `Telegram` `Mail` `Pinning` `WeChat` `FlyBook` `SMS` `Webhook`.

----

**Github: https://github.com/dromara/hertzbeat**
**Gitee: https://gitee.com/dromara/hertzbeat**
133 changes: 133 additions & 0 deletions home/blog/2023-05-11-greptimedb-store.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
---
title: GreptimeDB & HertzBeat, 使用开源时序数据库 GreptimeDB 存储开源实时监控 HertzBeat 的度量数据
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, practice]
keywords: [开源监控系统, 开源时序数据库, HertzBeat, GreptimeDB]
---

## 使用开源时序数据库 GreptimeDB 存储开源实时监控 HertzBeat 的度量数据

### 什么是 GreptimeDB

> [GreptimeDB](https://github.com/GreptimeTeam/greptimedb) 是一款开源、分布式、云原生时序数据库,融合时序数据处理和分析。
- 完善的生态系统,支持大量开放协议,与 MySQL/PostreSQL/PromQL/OpenTSDB 等兼容,学习成本低,开箱即用。
- 时序、分析混合负载,支持高并发的读/写;原生支持 PromQL, 支持 SQL/Python 进行强大的库内分析。
- 高效存储与计算,通过对象存储和高数据压缩率实现超低的存储成本。内置数据分析解决方案,避免将数据复制到外部数据仓库。
- 分布式、高可靠与高可用,通过解耦的云原生架构,轻松独立地扩展每个模块。通过可配置的副本和自动的故障转移机制,确保数据的可靠性和可用性。

Cloud: **[GreptimePlay](https://greptime.com/playground)**

### 什么是 HertzBeat

> [HertzBeat](https://github.com/dromara/hertzbeat) 一个拥有强大自定义监控能力,无需 Agent 的开源实时监控告警工具。
-**监控+告警+通知** All in one,支持对应用服务,数据库,操作系统,中间件,云原生,网络等监控,阈值告警通知一步到位。
- 更自由化的阈值规则(计算表达式),`邮件` `Discord` `Slack` `Telegram` `钉钉` `微信` `飞书` `短信` `Webhook` 等方式及时送达。
-`Http,Jmx,Ssh,Snmp,Jdbc`等协议规范可配置化,只需在浏览器配置`YML`监控模版就能使用这些协议去自定义采集想要的指标。

> `HertzBeat`的强大自定义,多类型支持,易扩展,低耦合,希望能帮助开发者和中小团队快速搭建自有监控系统。
Cloud: **[TanCloud](https://console.tancloud.cn/)**

### GreptimeDB & HertzBeat

> 下面内容我们会通过一步一步的形式演示 HertzBeat 如何结合 GreptimeDB 作为存储端来存储收集到的指标数据。
#### 安装部署 GreptimeDB

具体可以参考 [官方文档](https://docs.greptime.com/getting-started/overview#docker)

1. Docker 安装 GreptimeDB

```shell
$ docker run -p 4000-4004:4000-4004 \
-p 4242:4242 -v "$(pwd)/greptimedb:/tmp/greptimedb" \
--name greptime \
greptime/greptimedb:0.2.0 standalone start \
--http-addr 0.0.0.0:4000 \
--rpc-addr 0.0.0.0:4001
```

- `-v "$(pwd)/greptimedb:/tmp/greptimedb"` 为 greptimeDB 数据目录本地持久化挂载,建议将`$(pwd)/greptimedb`替换为您想指定存放的实际本地目录

2. 使用```$ docker ps | grep greptime```查看 GreptimeDB 是否启动成功


#### 安装部署 HertzBeat

具体可以参考 [官方文档](https://hertzbeat.com/zh-cn/docs/start/docker-deploy)

1. Docker 安装 HertzBeat

```shell
$ docker run -d -p 1157:1157 \
-e LANG=zh_CN.UTF-8 \
-e TZ=Asia/Shanghai \
-v /opt/data:/opt/hertzbeat/data \
-v /opt/application.yml:/opt/hertzbeat/config/application.yml \
--restart=always \
--name hertzbeat tancloud/hertzbeat
```

- `-v /opt/data:/opt/hertzbeat/data` : (可选,数据持久化)重要⚠️ 挂载H2数据库文件到本地主机,保证数据不会因为容器的创建删除而丢失

- `-v /opt/application.yml:/opt/hertzbeat/config/application.yml` : 挂载自定义本地配置文件到容器中,即使用本地配置文件覆盖容器配置文件。

注意⚠️ 本地挂载配置文件 `application.yml` 需提前存在,文件完整内容见项目仓库[/script/application.yml](https://github.com/dromara/hertzbeat/raw/master/script/application.yml)

2. 浏览器访问 http://ip:1157/ 默认账户密码 admin/hertzbeat,查看 HertzBeat 是否启动成功。

#### 配置使用 GreptimeDB 存储 HertzBeat 监控指标度量数据

1. 修改 HertzBeat 端配置文件

修改挂载到本地的 HertzBeat 配置文件 [application.yml](https://github.com/dromara/hertzbeat/raw/master/script/application.yml), 安装包模式下修改 `hertzbeat/config/application.yml`

**修改里面的`warehouse.store.jpa.enabled`参数为`false`, 配置里面的`warehouse.store.greptime`数据源参数,URL账户密码,并启用`enabled``true`**

```yaml
warehouse:
store:
# 关闭默认JPA
jpa:
enabled: false
greptime:
enabled: true
endpoint: localhost:4001
```
2. 重启 HertzBeat
```shell
$ docker restart hertzbeat
```

#### 观察验证效果

1. 浏览器访问 HertzBeat http://ip:1157/ 默认账户密码 admin/hertzbeat
2. 使用 HertzBeat 添加应用监控,比如网站监控,Linux监控,Mysql监控
3. 监控采集几个周期之后,查看 GreptimeDB 数据库是否存储指标度量数据,HertzBeat 指标数据图表数据是否展示正常。

直接上图哇:

![1](/img/blog/greptime-1.png)

![1](/img/blog/greptime-2.png)

![1](/img/blog/greptime-3.png)

## 小结

这篇文章带我们体验了如何使用开源时序数据库 GreptimeDB 存储开源实时监控 HertzBeat 的指标度量数据,总的来看两款开源产品上手是非常简单的,关键是如果嫌麻烦不想部署他俩都还有云服务😂让你折腾。
作为特性 [HertzBeat支持GreptimeDB](https://github.com/dromara/hertzbeat/pull/834) 的开发者之一,在实际适配使用过程中,GreptimeDB的丝滑原生SDK和类似关系数据库的SQL,让我们从其它时序数据库 `TDengine, IotDB, InfluxDB` 切换过去还是非常容易,体验丝滑的。

GreptimeDB Github: https://github.com/GreptimeTeam/greptimedb
HertzBeat Github: https://github.com/dromara/hertzbeat

**最后就是欢迎大家一定要多多了解,多多使用,多多提意见,多多ISSUE,多多PR,多多Star支持这俩没出来多久希望得到呵护的开源牛牛不怕困难 一颗小星星哦!做开源,我们是蒸(真)的,爱心💗**

感谢此特性 [HertzBeat支持GreptimeDB](https://github.com/dromara/hertzbeat/pull/834) 的贡献者们 @zqr10159, @fengjiachun, @killme2008, @tomsun28
1 change: 1 addition & 0 deletions home/docs/others/developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ sidebar_label: Contributors
<td align="center" valign="top" width="14.28%"><a href="https://blog.gcdd.top/"><img src="https://avatars.githubusercontent.com/u/26523525?v=4?s=100" width="100px;" alt="进击的阿晨"/><br /><sub><b>进击的阿晨</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=gcdd1993" title="Code">💻</a> <a href="#design-gcdd1993" title="Design">🎨</a> <a href="https://github.com/dromara/hertzbeat/issues?q=author%3Agcdd1993" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/TJxiaobao"><img src="https://avatars.githubusercontent.com/u/85919258?v=4?s=100" width="100px;" alt="铁甲小宝"/><br /><sub><b>铁甲小宝</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/issues?q=author%3ATJxiaobao" title="Bug reports">🐛</a> <a href="https://github.com/dromara/hertzbeat/commits?author=TJxiaobao" title="Code">💻</a> <a href="https://github.com/dromara/hertzbeat/commits?author=TJxiaobao" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/cuipiheqiuqiu"><img src="https://avatars.githubusercontent.com/u/76642201?v=4?s=100" width="100px;" alt="cuipiheqiuqiu"/><br /><sub><b>cuipiheqiuqiu</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=cuipiheqiuqiu" title="Code">💻</a> <a href="https://github.com/dromara/hertzbeat/commits?author=cuipiheqiuqiu" title="Tests">⚠️</a> <a href="#design-cuipiheqiuqiu" title="Design">🎨</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/hudongdong129"><img src="https://avatars.githubusercontent.com/u/34374227?v=4?s=100" width="100px;" alt="hudongdong129"/><br /><sub><b>hudongdong129</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=hudongdong129" title="Code">💻</a> <a href="https://github.com/dromara/hertzbeat/commits?author=hudongdong129" title="Tests">⚠️</a> <a href="https://github.com/dromara/hertzbeat/commits?author=hudongdong129" title="Documentation">📖</a></td>
</tr>
</tbody>
</table>
Expand Down
9 changes: 4 additions & 5 deletions home/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ module.exports = {
position: 'left',
to: 'blog/',
},
{
label: 'discuss',
position: 'left',
to: 'docs/others/contact',
},
{
label: 'developer',
position: 'left',
Expand All @@ -110,6 +105,10 @@ module.exports = {
label: 'about',
position: 'left',
items: [
{
label: 'discuss',
to: 'docs/others/contact',
},
{
label: 'contributing',
to: 'docs/others/contributing',
Expand Down
8 changes: 8 additions & 0 deletions home/i18n/en/docusaurus-plugin-content-docs/current.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,13 @@
"sidebar.docs.category.cloud-native": {
"message": "CloudNative",
"description": "The label for category cloud-native in sidebar docs"
},
"sidebar.docs.link.Cloud Service": {
"message": "Cloud Service",
"description": "The label for link Cloud Service in sidebar docs, linking to https://console.tancloud.cn"
},
"sidebar.docs.link.Install via HuaweiCloud": {
"message": "Install via HuaweiCloud",
"description": "The label for link Install via HuaweiCloud in sidebar docs, linking to https://marketplace.huaweicloud.com/contents/0477015c-ad63-4522-a308-816861769f0a#productid=OFFI863735781612109824"
}
}
8 changes: 8 additions & 0 deletions home/i18n/en/docusaurus-theme-classic/navbar.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,13 @@
"item.label.enterprise": {
"message": "Enterprise",
"description": "Navbar item with label enterprise"
},
"item.label.开源之夏": {
"message": "OSPP",
"description": "Navbar item with label 开源之夏"
},
"item.label.华为云开源活动": {
"message": "HuaweiCloud Event",
"description": "Navbar item with label 华为云开源活动"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: 50天36位贡献者,开源实时监控工具 HertzBeat v1.3.1 发布
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, practice]
keywords: [open source monitoring system, alerting system, Linux monitoring]
---

官网: hertzbeat.com | tancloud.cn


![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/a9629ef5bb6e486cacddb899f1495c6e~tplv-k3u1fbpfcp-zoom-1.image)



### What is HertzBeat?

> HertzBeat赫兹跳动 是一个拥有强大自定义监控能力,无需 Agent 的开源实时监控告警工具。
> **监控+告警+通知** 为一体,支持对应用服务,数据库,操作系统,中间件,云原生,网络等指标监控,阈值告警通知一步到位。
> 支持更自由化的阈值规则(计算表达式),`邮件` `Discord` `Slack` `Telegram` `钉钉` `微信` `飞书` `短信` `Webhook` 等方式及时送达。
> 我们将`Http,Jmx,Ssh,Snmp,Jdbc`等协议规范可配置化,您只需配置`YML`就能使用这些协议去自定义采集任何您想要的指标。
> 您相信只需定义YML就能立刻适配一款K8s或Docker等新的监控类型吗?

![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/4236e748f5ac4352b7cf4bb65ccf97aa~tplv-k3u1fbpfcp-zoom-1.image)


**Github: https://github.com/dromara/hertzbeat**

**Gitee: https://gitee.com/dromara/hertzbeat**

### v1.3.1 来了

嗨,伙计们,重磅更新,HertzBeat v1.3.1发布啦!很激动这个版本有超三十位小伙伴们一起贡献。
这个版本我们支持**greptimeDB, tedgine3.0和opengauss influxdb**来存储度量数据。
新功能**监控导出和导入支持excel json yaml****告警静默功能****新的监控模板**和更多。
支持监控EulerOS指标和SpringBoot3指标。修复若干BUG,完善了文档,重构了代码,提高了整体的稳定可用性还有更多新功能欢迎探索!快来体验下吧!

只需要一条docker命令即可安装体验hertzbeat :
`docker run -d -p 1157:1157 --name hertzbeat tancloud/hertzbeat`

## 升级注意⚠️.

若之前使用的TDengine时序数据库,需升级至TDengine3.0+


需要执行SQL升级脚本
```
ALTER table hzb_alert_define modify field varchar(255) default null;
COMMIT;
```

----

## ⛄ 已支持

> 我们将监控采集类型(mysql,jvm,k8s)都定义为yml监控模版,用户可以导入这些模版来支持对应类型的监控!
> 欢迎大家一起贡献你使用过程中自定义的通用监控类型监控模版。
- Website, Port Telnet, Http Api, Ping Connect, Jvm, SiteMap, Ssl Certificate, SpringBoot2, FTP Server, SpringBoot3
- Mysql, PostgreSQL, MariaDB, Redis, ElasticSearch, SqlServer, Oracle, MongoDB, DM, OpenGauss, ClickHouse, IoTDB, Redis Cluster, Redis Sentinel
- Linux, Ubuntu, CentOS, Windows, EulerOS
- Tomcat, Nacos, Zookeeper, RabbitMQ, Flink, Kafka, ShenYu, DynamicTp, Jetty, ActiveMQ
- Kubernetes, Docker
- CiscoSwitch, HpeSwitch, HuaweiSwitch, TpLinkSwitch, H3cSwitch
- 和更多自定义监控模版。
- 通知支持 Discord Slack Telegram 邮件 钉钉 微信 飞书 短信 Webhook。

----

**Github: https://github.com/dromara/hertzbeat**
**Gitee: https://gitee.com/dromara/hertzbeat**
Loading

0 comments on commit cebc9d8

Please sign in to comment.