473 Star 1.3K Fork 546

monkeyk7 / HeartBeat

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

HeartBeat

心跳检测各类应用服务器(如Tomcat,Jetty),WEB服务器(如 Apache,Nginx), Socket服务器(TCP/UDP协议)的SpringBoot应用程序.

如何实现?

  1. 使用HttpClient对指定的服务器(application-instance) URL 按频率(10秒,20秒...) 发起请求并记录响应的信息(连接耗时,是否连接成功,是否有异常,响应数据包大小), 若检测到不正常(响应码不是200,抛出异常...)时则发送邮件(或其他提醒方式)给指定的地址,当检测恢复正常时也发送提醒邮件(或其他提醒方式).
  2. 使用Socket连接指定的服务器(network-instance) IP 端口并记录响应的信息(连接耗时,是否连接成功,是否有异常,响应数据包大小), 若检测到不正常(连接耗时,连接失败,有异常...)时则发送邮件(或其他提醒方式)给指定的地址,当检测恢复正常时也发送提醒邮件(或其他提醒方式).

同时提供各类实时提醒方式接口,如邮件(已实现),短信, 钉钉机器人(已实现), 微信等(可自定义扩展其他实时提醒方式).

使用的框架及版本

  • JDK - OpenJdk 17
  • Spring Boot - 3.1.5
  • Flat UI
  • Maven - 3.6.0

下载

从0.3版本开始, 每一个版本的下载文件都在项目的 'dist' 目录. 注意: 从v3.0.0开始不再提供dist安装包, 请使用maven自行在本地打包编译或访问 releases 下载.

特点

  • 无侵入,独立部署,资源占用可控
  • 可同时监测多个应用服务器
  • 请求方式支持GET,POST; URL支持http与https, 可指定请求content-type, 添加请求参数(固定参数或随机参数)
  • 可实现对Socket(TCP/UDP协议)服务器的监测
  • 可对各实例进行分组, 方便管理(v3.0.0开始提供)
  • 添加安全设置,可控制用户注册,设定用户权限等
  • 提醒方式及时,多样(提供接口可扩展自定义的提醒方式)

运行环境

  • OpenJdk 17 +
  • MySql 5.7 +

在线测试

https://andaily.com/hb/ (v2.0.0版本)
提示:仅用于测试,不要加生产监控实例

如何使用?

  1. 项目是Maven管理的, 需要在电脑上安装maven(开发用的版本号为3.6.0), MySql(开发用的版本号为5.7)
  2. 下载(或clone)项目到本地
  3. 创建MySQL数据库(默认数据库名:heart_beat), 并运行相应的SQL脚本(脚本文件位于others/database目录),
    运行脚本的顺序: HeartBeat.ddl -> quartz_mysql_innodb.sql -> initial-db.ddl(该ddl会创建初始管理员账号/密码:hb/Heart_beat7)
  4. 修改 application.properties(位于src/main/resources目录)中的数据库连接信息(包括username, password等)
    NOTE: 在initial-db.ddl中默认初始化邮件配置服务, 推荐将邮件配置更换为自己的邮件服务(邮件配置用管理员登录后在'系统'菜单中进入)
  5. 将本地项目导入到IDE(如Intellij IDEA)中,直接运行 HeartBeatApplication.java 启动类
    另: 也可通过maven package命令将项目编译为jar文件(hb.jar), 使用 java -jar hb.jar --spring.config.location=application.properties 命令运行(注意 application.properties 的路径要正确)
  6. HeartBeat运行后, 初次登录可使用默认管理员账号/密码:hb/Heart_beat7, 若失败, 需要在数据库中运行初始SQL脚本文件initial-db.ddl(others/database目录), 密码存储使用不可逆加密方式.

开发计划

从 0.5版本开始将项目的所有计划的开发内容列出来, 方便大家跟进, 也欢迎你加入.
项目的开发管理使用开源项目 andaily-developer.

  • Version: 3.0.1 [planning]
    Date: --- / ---

    1. #20 加一个根据http返回结果来决定请求状态

    2. 实例特定时间段允许断开

    3. 增加提醒消息支持 syslog


  • Version: 3.0.0 [finished]
    Date: 2023-11-16 / 2024-01-09

    1. 升级JDK, SpringBoot等基础版本, log升级使用logback框架

    2. 添加Socket TCP,UDP的监控

    3. 实例分组与查询

    4. 邮件配置界面化,更灵活(不在配置文件中写固定)

    5. 提供报警信息的对外发送插件扩展(可支持机器人通知等)


  • Version: 2.0.1 [finished]
    Date: 2018-03-03 / 2023-10-19

    1. #I1BWP8 支持使用代理proxy

    2. 请求方式支持PUT,DELETE


  • Version: 2.0.0 [finished]
    Date: 2018-01-29 / 2018-02-22

    1. 使用 SprintBoot 重构项目


  • Version: 1.0.1 [finished]
    Date: 2017-07-10 / 2018-01-20

    1. Fix issue #7 MenuBUGFix

    2. 实例列表增加更多搜索条件

    3. #20 加一个根据http返回结果来决定请求状态(CANCELED)

    4. 添加Socket TCP/IP的监控(CANCELED)


  • Version: 1.0.0 [finished]
    Date: 2016-11-18 / 2017-07-09

    1. (104) - 添加发送短信提醒(CANCELED)

    2. (165) - 添加更多监控时间,如2分钟,3分钟,5分钟,10分钟,半小时,1小时

    3. (166) - Fix 设置多次失败后在提醒时的错误,以及恢复后的提醒

    4. (168) - 增加设置定期清理一段时间(默认为30天)前的监控日志记录,防止frequency_monitor_log表太大导致查询慢

    5. 修复未登录时不能查看到私有实例的日志

    6. Fixed Issue #26 关于邮件发送次数的问题


  • Version: 0.5 [finished]
    Date: 2016-05-01 / 2016-08-15

    1. (70) - Why set archived = 1 in mysql application_instance table(Fix issue #6)

    2. (83) - 对于注册的用户, 登录后只能管理自己 创建的instances

    3. (112) - #12 请求参数BUG(设置Url参数时未进行非空验证)

    4. (104) - 添加发送短信提醒(CANCELED)

    5. (105) - 添加发送微信提醒

    6. (147) - 支持国际化, 中英文

    7. (148) - 在检测链接状态的时候,不要发现一次链接故障的时候就马上发邮件通知,这个过程可能因为网络故障(如常见的:丢包、dns故障)而出现问题, 可以增加一个判断参数,当连续发现n次有故障时再去发邮箱等信息通知!

    8. (156) - 优化数据库,以及连接, 提高性能,页面响应速度

    9. (157) - 实例添加一个字段 是否私有, 若私有则只有自己登录后才能查看


Change-Log

  1. 2014-10-17 ---- Initial project

  2. 2015-02-13 ---- Move development to coding.net

  3. 2015-03-01 ---- Back to OSC and update documents; Add 0.1 branch

  4. 2015-03-14 ---- Monitoring log add response data size;Add list of monitoring reminder logs; Update page styles; Add 0.2 branch

  5. 2015-03-15 ---- 0.3 branch is developing

  6. 2015-04-02 ---- Add 0.3 branch and publish it

  7. 2015-04-06 ---- 0.4 branch is developing

  8. 2015-05-01 ---- Publish 0.4 version

  9. 2016-01-09 ---- Deploy war to Test-Server(http://andaily.com/hb/)

  10. 2016-05-01 ---- Start to developing 0.5 version

  11. 2016-07-30 ---- Publish 0.5-beta1 version

  12. 2016-08-15 ---- Publish 0.5-beta2 version

  13. 2016-11-18 ---- Publish 0.5 version and add 1.0.0 planning

  14. 2017-07-09 ---- Publish 1.0.0 version

  15. 2018-01-29 ---- Start Spring-Boot 2.0.0 development

  16. 2018-02-22 ---- Publish 2.0.0 version

  17. 2023-11-16 ---- Start v3.0.0 development

  18. 2024-01-09 ---- Publish v3.0.0 version



捐助


支付宝: monkeyking1987@126.com (**钊)
  • 曹晓舟 -- 18元 (2017-02-19)


更多...

More Open-Source projects see https://andaily.com/my_projects.html
From andaily.com
Email sz@monkeyk.com
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2014 monkeyk7 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

心跳检测应用服务器(支持协议HTTP/UDP/TCP)的JAVA 微服务应用程序 展开 收起
Apache-2.0
取消

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/mkk/HeartBeat.git
git@gitee.com:mkk/HeartBeat.git
mkk
HeartBeat
HeartBeat
3.0.0

搜索帮助