1 Star 0 Fork 548

newman2018 / HeartBeat

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

#HeartBeat

心跳检测各类应用服务器(如Tomcat,Jetty),WEB服务器(如 Apache,Nginx) 的JAVA WEB应用程序.

如何实现?
使用HttpClient对指定的服务器(application-instance) URL 按频率(10秒,20秒...) 发起请求并记录响应的信息(连接耗时,是否连接成功,是否有异常,响应数据包大小), 若检测到不正常(响应码不是200,抛出异常...)时则发送邮件给指定的地址,当检测恢复正常时也发送提醒邮件.
将来会添加更多的实时提醒方式接口,如微信,短信

使用的框架及版本

  • JDK - 1.7
  • Spring Framework - 3.2.2.RELEASE
  • Quartz - 2.2.1
  • Hibernate - 4.1.7.Final
  • HttpClient - 4.3.5
  • Flat UI
  • Maven - 3.1.0
  • TestNG - 6.1.1 (Unit Test)

下载

从0.3版本开始, 每一个版本的下载文件都在项目的 'dist' 目录.

特点

  • 无侵入,独立部署
  • 可同时监测多个应用服务器
  • 请求方式支持GET,POST; URL支持http与https, 可指定请求content-type, 添加请求参数(固定参数或随机参数)
  • 添加安全设置,可控制用户注册,设定用户权限等
  • 使用简洁,灵活
  • 提醒方式及时,多样(目前已实现邮件提醒,微信提醒;将来会加入短信提醒等)

运行环境

  • JRE 1.7 +
  • MySql 5.5 +
  • Tomcat 7 +

在线测试

http://andaily.com/hb/

如何使用?

  1. 项目是Maven管理的, 需要在电脑上安装maven(开发用的版本号为3.1.0), MySql(开发用的版本号为5.5)
  2. 下载(或clone)项目到本地
  3. 创建MySQL数据库(默认数据库名:heart_beat), 并运行相应的SQL脚本(脚本文件位于others/database目录),
    运行脚本的顺序: HeartBeat.ddl -> quartz_mysql_innodb.sql -> initial-db.ddl(该ddl会创建初始管理员账号/密码:hb/heart_beat)
  4. 修改HeartBeat.properties(位于src/main/resources目录)中的数据库连接信息(包括username, password等)
    NOTE: 为了确保能收到提醒邮件,请将配置文件中的 mail.develop.address 配置为你的邮件地址; 若在生产环境,请将 mail.develop.environment 值修改为 false (true表示为开发环境)
  5. 将本地项目导入到IDE(如Intellij IDEA)中,配置Tomcat(或类似的servlet运行服务器), 并启动Tomcat(默认端口为8080)
    另: 也可通过maven package命令将项目编译为war文件(HeartBeat.war), 将war放在Tomcat中并启动(注意: 这种方式需要将HeartBeat.properties加入到classpath中并正确配置数据库连接信息).
    或直接在项目的'dist'目录下载完整版安装包.
  6. HeartBeat运行后, 初次登录可使用默认管理员账号/密码:hb/heart_beat, 若失败, 需要在数据库中运行初始SQL脚本文件initial-db.ddl(others/database目录), 账号密码使用MD5加密.

如何通过微信接收监控信息

  1. 通过微信扫描二维码 或添加公众号 qiuchang8; 在关注后绑定在 http://andaily.com/hb/ 中注册的账号(一个账号可以绑定多个微信号)
  2. 在添加或修改Instance 时勾选上需要接收监控信息的微信号并保存; 待有心跳检测不正常时发提示信息到微信

注意: 由于昨天(2015-08-06)发现项目默认发送邮件地址no-reply-hb@andaily.com被人非法使用导致该邮箱被禁用了(因为安全检测发现非法的IP登录),若发现邮件发送不正常, 请将默认的邮件地址配置修改为你自己的邮件配置信息(位于HeartBeat.properties文件中),不要再使用默认的no-reply-hb@andaily.com邮箱.

邮件配置说明

HeartBeat项目使用的邮件服务器使用SSL连接, 所以在配置邮件(javaMailSender, HeartBeat.xml文件)时, 使用了SSL连接配置,包括mail.smtp.authmail.smtp.socketFactory.class;
若在使用中配置邮件后不工作, 请检查配置(如使用的邮件服务器是否支持SSL)并编写单元测试来测试邮件发送能正常工作(项目的邮件单元测试在 MailTransmitterTest.java 文件中, 记得将测试的emailAddress设置为自己邮箱).
另: 强烈建议使用SSL连接邮件服务器

在项目的配置文件HeartBeat.properties中, 可配置邮件为开发环境或生产环境,具体参数为mail.develop.environmentmail.develop.address, 若将mail.develop.environment = true为生产环境, false为开发环境; 开发环境时的邮件只为 发给mail.develop.address配置的邮箱,不会发给真正的邮件接收者; 生产环境时mail.develop.address配置不启作用.


开发计划

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

  • Version: 1.0.1 [planning]
    Date: 2017-07-10 / ---

    1. Fix issue #7 MenuBUGFix

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

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

    4. 添加Socket TCP/IP的监控


  • 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

程序运行主要截图

小提示: 截图不是最新版本, 可访问在线测试 http://andaily.com/hb/ 查看最新功能
  1. Monitoring
    hb

  2. Instance - Monitoring details
    hb

  3. Instance - Overview
    hb

  4. Instance - Create
    hb

  5. Monitoring-Log
    hb

  6. Monitoring-Reminder-Log
    hb

  7. Search
    hb



捐助
支付宝: monkeyking1987@126.com (**钊)

  • 曹晓舟 -- 18元 (2017-02-19)


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.

简介

心跳检测应用服务器(如Tomcat,Jetty)的JAVA 微服务应用程序 展开 收起
Java
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

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

搜索帮助

14c37bed 8189591 565d56ea 8189591