diff --git a/home/docs/help/guide.md b/home/docs/help/guide.md index e3df2b64ac4..5f7af25ac16 100644 --- a/home/docs/help/guide.md +++ b/home/docs/help/guide.md @@ -131,3 +131,7 @@ More details see 👉 [Threshold alarm](alert_threshold)
 👉 [Configure DingDing Robot Notification](alert_dingtalk)
 👉 [Configure FeiShu Robot Notification](alert_feishu)
 👉 [Configure Huawei Cloud SMN Notification](alert_smn)
+ +### Plugins + + 👉 [Plugin](plugin)
\ No newline at end of file diff --git a/home/docs/help/issue.md b/home/docs/help/issue.md index a38ea4385dd..c3dffd147be 100644 --- a/home/docs/help/issue.md +++ b/home/docs/help/issue.md @@ -22,12 +22,12 @@ The hertzbeat installed and deployed by the installation package is not availabl ### Docker Deployment common issues 1. **MYSQL, TDENGINE and HertzBeat are deployed on the same host by Docker,HertzBeat use localhost or 127.0.0.1 connect to the database but fail** -The problems lies in Docker container failed to visit and connect localhost port. Beacuse the docker default network mode is Bridge mode which can't access loacl machine through localhost. +The problems lies in Docker container failed to visit and connect localhost port. Because the docker default network mode is Bridge mode which can't access local machine through localhost. > Solution A:Configure application.yml. Change database connection address from localhost to external IP of the host machine. > Solution B:Use the Host network mode to start Docker, namely making Docker container and hosting share network. `docker run -d --network host .....` 2. **According to the process deploy,visit http://ip:1157/ no interface** -Please refer to the following points to troubleshoot issuess: +Please refer to the following points to troubleshoot issues: > one:Whether the MySQL database and tdengine database as dependent services have been successfully started, whether the corresponding hertzbeat database has been created, and whether the SQL script has been executed. > two:Check whether dependent service, IP account and password configuration is correct in HertzBeat's configuration file `application.yml`. > > three:`docker logs hertzbeat` Check whether the container log has errors. If you haven't solved the issue, report it to the communication group or community. @@ -39,7 +39,7 @@ Please refer to the following points to troubleshoot issuess: ### Package Deployment common issues 1. **According to the process deploy,visit http://ip:1157/ no interface** - Please refer to the following points to troubleshoot issuess: + Please refer to the following points to troubleshoot issues: > one:Whether the MySQL database and tdengine database as dependent services have been successfully started, whether the corresponding hertzbeat database has been created, and whether the SQL script has been executed. > two:Check whether dependent services, IP account and password configuration is correct in HertzBeat's configuration file `hertzbeat/config/application.yml`. > three: Check whether the running log has errors in `hertzbeat/logs/` directory. If you haven't solved the issue, report it to the communication group or community. diff --git a/home/docs/help/plugin.md b/home/docs/help/plugin.md new file mode 100644 index 00000000000..bb362c8adff --- /dev/null +++ b/home/docs/help/plugin.md @@ -0,0 +1,25 @@ +--- +id: plugin +title: Custom plugin +sidebar_label: Custom plugin +--- + +## Custom plugins +### Introduction + +Currently, `Hertzbeat` relies on the `alert` module to notify the user, and then the user can take actions such as sending requests, executing `sql`, executing `shell` scripts, etc. However, this can only be automated manually or by `webhook` to receive the alert message. +However, at present, it is only possible to automate the process by receiving alert messages manually or through a `webhook`. For this reason, `HertzBeat` has added a new `plugin` module, which has a generic interface `Plugin`, which allows users to implement the `alert` method of this interface and receive the `Alert` class as a parameter to customize the operation. +After adding the customized code, you only need to package the `plugin` module, copy it to the `/ext-lib` folder under the installation directory, restart the `HertzBeat` main program, and then you can execute the customized function after the alert, without having to re-package and deploy the whole program by yourself. +Currently, `HertzBeat` only set up the trigger `alert` method after alarm, if you need to set up the trigger method at the time of acquisition, startup program, etc., please mention `Task` in `https://github.com/apache/hertzbeat/issues/new/choose`. + +### Specific uses +1. Pull the master branch code `git clone https://github.com/apache/hertzbeat.git` and locate the `plugin` module's + `Plugin` interface. + ![plugin-1.png](home/static/img/docs/help/plugin-1.png) +2. In the `org.apache.hertzbeat.plugin.impl` directory, create a new interface implementation class, such as `org.apache.hertzbeat.plugin.impl.DemoPluginImpl`, and receive the `Alert` class as a parameter, implement the `alert ` method, the logic is customized by the user, here we simply print the object. + ![plugin-2.png](home/static/img/docs/help/plugin-2.png) +3. Package the `hertzbeat-plugin` module. + ![plugin-3.png](home/static/img/docs/help/plugin-3.png) +4. Copy the packaged `jar` package to the `ext-lib` directory under the installation directory (for `docker` installations, mount the `ext-lib` directory first, then copy it there). + ![plugin-4.png](home/static/img/docs/help/plugin-4.png) +5. Then restart `HertzBeat` to enable the customized post-alert handling policy. diff --git a/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/help/guide.md b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/help/guide.md index 1ca5581e263..79c4ec85e52 100644 --- a/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/help/guide.md +++ b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/help/guide.md @@ -130,3 +130,7 @@ sidebar_label: 帮助入门  👉 [配置钉钉机器人通知](alert_dingtalk)
 👉 [配置飞书机器人通知](alert_feishu)
 👉 [配置华为云SMN通知](alert_smn)
+ +### 插件 + + 👉 [插件](plugin)
diff --git a/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/help/plugin.md b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/help/plugin.md new file mode 100644 index 00000000000..1d5758b702c --- /dev/null +++ b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/help/plugin.md @@ -0,0 +1,25 @@ +--- +id: plugin +title: 自定义插件 +sidebar_label: 自定义插件 +--- + +## 自定义插件 +### 简介 + +当前`Hertzbeat`在使用时,主要依赖`alert`模块对用户进行通知,然后用户采取一些措施如发送请求、执行`sql`、执行`shell`脚本等。 +但目前只能通过手动或者`webhook`接收告警信息进行自动化处理。基于此,`HertzBeat`新增了`plugin`模块,该模块有一个通用接口`Plugin`,用户可以自己实现这个接口的`alert`方法,接收`Alert`类作为参数进行自定义操作。 +用户添加自定义代码后,只需要对`plugin`模块进行打包,拷贝到安装目录下`/ext-lib`文件夹中,重启`HertzBeat`主程序,即可实现告警后执行自定义功能,无需自己重新打包部署整个程序。 +目前,`HertzBeat`只在告警后设置了触发`alert`方法,如需在采集、启动程序等时机设置触发方法,请在`https://github.com/apache/hertzbeat/issues/new/choose` 提`Task`。 + +### 具体使用 +1. 拉取主分支代码 `git clone https://github.com/apache/hertzbeat.git` ,定位到`plugin`模块的 + `Plugin`接口。 + ![plugin-1.png](home/static/img/docs/help/plugin-1.png) +2. 在`org.apache.hertzbeat.plugin.impl`目录下, 新建一个接口实现类,如`org.apache.hertzbeat.plugin.impl.DemoPluginImpl`,在实现类中接收`Alert`类作为参数,实现`alert`方法,逻辑由用户自定义,这里我们简单打印一下对象。 + ![plugin-2.png](home/static/img/docs/help/plugin-2.png) +3. 打包`hertzbeat-plugin`模块。 + ![plugin-3.png](home/static/img/docs/help/plugin-3.png) +4. 将打包后的`jar`包,拷贝到安装目录下的`ext-lib`目录下(若为`docker`安装则先将`ext-lib`目录挂载出来,再拷贝到该目录下) + ![plugin-4.png](home/static/img/docs/help/plugin-4.png) +5. 然后重启`HertzBeat`,即可实现自定义告警后处理策略。 \ No newline at end of file diff --git a/home/sidebars.json b/home/sidebars.json index c80dc3bfa13..bc7655c4d50 100755 --- a/home/sidebars.json +++ b/home/sidebars.json @@ -309,7 +309,8 @@ "help/alert_smn" ] }, - "help/issue" + "help/issue", + "help/plugin" ] }, { diff --git a/home/static/img/docs/help/plugin-1.png b/home/static/img/docs/help/plugin-1.png new file mode 100644 index 00000000000..7a7a451dba0 Binary files /dev/null and b/home/static/img/docs/help/plugin-1.png differ diff --git a/home/static/img/docs/help/plugin-2.png b/home/static/img/docs/help/plugin-2.png new file mode 100644 index 00000000000..c9b74e3d183 Binary files /dev/null and b/home/static/img/docs/help/plugin-2.png differ diff --git a/home/static/img/docs/help/plugin-3.png b/home/static/img/docs/help/plugin-3.png new file mode 100644 index 00000000000..cd0fe9dbe2e Binary files /dev/null and b/home/static/img/docs/help/plugin-3.png differ diff --git a/home/static/img/docs/help/plugin-4.png b/home/static/img/docs/help/plugin-4.png new file mode 100644 index 00000000000..fb7413c77ae Binary files /dev/null and b/home/static/img/docs/help/plugin-4.png differ