66 Star 165 Fork 71

TL / AsuraMonitor

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

monitor

运维工作中自己开发的监控系统,功能强大灵活
系统安装简单,配置简单,相比zabbix, nagios,cacti,小米监控等都使用相当简单。只需要会写脚本,语言不限就可以实现任意监控需求。
系统安装简单,配置简单

1、数据采集免配置: agent自发现、agent主动推送, 任何数据自定义脚本
2、可扩展性, 扩展简单,随时扩,随心扩
3、历史数据查询, 可以秒级返回全年数据趋势图, 多个指标数据, 趋势图更明晰:
3天 7天,15天,30天,60天,90天,120天,180天,240天,360天时间段趋势
4、架构设计高可用: 整个系统无核心单点,所涉及到的
负载均衡(nginx, haproxy, lvs)都可以用来负载server端, mysql(无数据压力,不做数据存储),
redis(需要高可用配置,推荐使用Codis),
共享存储设备(本地磁盘,nfs,mfs等).
5、任何数据图像实时查看,历史查看功能
6、针对统一系统,基础监控无需添加配置,自动添加(比如cpu,负载,磁盘使用率,网络流量,ss状态信息等,都可以自定义实现)
7、报警组配置,支持微信,钉钉,手机,邮件功能(微信,钉钉需要单独处理,不是人都有的)
8、分布式监控,每个装agent的都是一个监控系统,除配置外(配置只能在server端完成)
9、自定义数据上报时间,最低5秒上报一次数据
10、不同server性能对比,更简单,更清晰
11、支持图像搜索,主机名,ip地址搜索图像
12、图像收藏功能,常用的直接在收藏列表点开查看
13、支持ldap认证登陆
14、支持任何指标数据多条件筛选排序,资源使用情况一目了然

欢迎加入 阿修罗监控系统 QQ群 149469467

整体架构
image

监控大盘

image
报警信息查看
image
图像展示
image
大图显示
image
多维数据显示(任何机器任何数据组合对比)
image

image

image
指标排序功能
image
图像搜索功能
image
指标聚合功能,单指标多服务器,平均和求和
image
图像收藏功能
image
系统概览
image
报警统计
image
指标报警分析报表
image
监控添加页面
image
脚本添加页面
image

特别注意:本系统不能在公网开放,只能在私有网络运行,避免数据泄露或篡改


系统组成部分:


1、java环境, jdk1.7
2、tomcat
3、redis
4、mysql数据库
5、mvn
6、agent

运行系统 Centos 6.5
为方便使用,软件包tools/下面已集成mvn, java, redis,tomcat工具,直接可以使用, 无需自行下载

准备工作:


1、mysql准备好,将cmdb.sql 导入到数据库
对需要链接的服务器进行授权
mysql>source cmdb.sql mysql>grant select,update,insert,delete on cmdb.* to monitor@你的ip地址 identified by "aZkl299feM";
mysql>flush privileges;
请绑定host os.dbm.com 到你的数据库的地址
ping os.dbm.com 看是否能解析到你的数据库IP地址
如果要修改域名请在安装完成后修改 /home/runtime/tomcat_8081/webapps/ROOT/WEB-INF/classes/jdbc.properties 替换成你自己的域名
2、准备一个redis服务
请绑定host os.redis.com到你的redis地址
ping os.redis.com 看是否能解析到你的redis的IP地址
如果要修改域名请在安装完成后修改 /home/runtime/tomcat_8081/webapps/ROOT/WEB-INF/classes/system.properties 替换成你自己的域名
3、修改对应的环境变量
4、绑定本机hostname到你的ip地址
5、本系统强制依赖时间,请保证所有服务器时间一致

安装步骤:


1、安装mysql数据库
2、安装jdk7
3、安装redis服务
4、安装tomcat
5、安装mvn
Mysql库请使用utf8字符集
其中redis, tomcat, mvn,jdk7 可以直接使用tools里面的包, 安装程序统一部署到 /home/runtime 目录
详情查看deploy.sh脚本

目录结构:
#ls /home/runtime
jdk7 tomcat_8081 redis maven 数据库自行配置即可

agent安装配置

6、安装agent


1、使用mvn打包, 打包完成后,将target/agent.jar 记录,稍后会用到
2、程序运行环境在tools/monitor.tar.bz2, 解压到 /home/runtime/目录
3、将tools里面的jdk7解压并改名为 /home/runtime/monitor/java/ 目录
4、修改agent配置文件,将所有v.asura.com替换为你的服务端的地址,为方便后期负载,尽量使用nginx等负载设备, 使用域名形式配置
修改redis.server 和server端使用的redis一致
5、将刚才的 agent.jar 复制到 /home/runtime/monitor/lib/ 目录
cp -v agent.jar /home/runtime/monitor/lib/
6、启动 cd /home/runtime/monitor/bin; sh agent start
7、查看日志 tail -f /home/runtime/monitor/logs/agent.log
系统登录 系统默认密码用户名为 admin admin
登录后请修改密码
如果需要ldap登录,需要修改配置文件进行配置ldap服务信息

配置流程


因系统调用了hostname, 所以请将你的主机名和ip地址做下绑定
示例:
cat /etc/hosts
10.1.1.1 localhost.localhost
10.1.1.1 web_xx_xx

1、配置资源信息
点击 资源信息->资源配置 配置下列资源数据
该模块主要是记录资源数据
1、机房配置(可选)
2、机柜配置(可选)
3、环境配置
4、业务线配置
5、管理员配置
6、服务器类型配置
7、服务类型配置
8、系统类型配置
以上配置只为第9条准备
9、服务器配置
2、配置告警相关配置
点击 监控分析->监控配置->告警发送配置 配置下列信息
注意:发送报警只对组发送
1、配置联系组
2、配置联系人
3、消息通道配置
消息通道配置默认有邮件和手机的配置模板,自行修改即可
3、其他更多配置,需要大家共享
4、欢迎共享监控脚本
监控脚本输出为json格式:
示例:
[
{
"name":"",
"groups":"",
"status":"",
"ip":"",
"messages":"",
"value":"",
"command":"",
}
]
name 为指标名字比如 system.load.min1 | system.memrory.used | system.io.r_s.vda
groups 为指标所在的组,一个组里放相关的指标, 比如所有cpu指标都放在cpu组里
status 脚本逻辑执行返回状态,
1为正常, 2为危险,
3为警告, 4为未知,
在报警时只有状态为2发送报警,其他状态不发送报警,在监控全局可以看到该状态

ip 可选, 默认脚本返回json没有ip字段,系统会按请求到数据上报的客户端地址记录ip地址
messges 报警信息,可选, 在发送报警时发送的信息,自定义想写啥写啥,就是你的报警内容中会出现的文字
value 程序采集指标结果,为数字类型,不能为空
command 可选
任何一个脚本只要能返回这样的一个json格式的数据,就可以配到监控脚本,开始监控你的系统了
上传一个CPU类型的数据采集返回值:
[{"status": "1", "name": "system.cpu.user", "messages": "system.cpu.user 5.67", "value": "5.67", "command": "7", "groups": "cpu"}, {"status": "1", "name": "system.cpu.nice", "messages": "system.cpu.nice 0.00", "value": "0.00", "command": "7", "groups": "cpu"}, {"status": "1", "name": "system.cpu.system", "messages": "system.cpu.system 1.08", "value": "1.08", "command": "7", "groups": "cpu"}, {"status": "1", "name": "system.cpu.iowait", "messages": "system.cpu.iowait 0.58", "value": "0.58", "command": "7", "groups": "cpu"}, {"status": "1", "name": "system.cpu.steal", "messages": "system.cpu.steal 0.00", "value": "0.00", "command": "7", "groups": "cpu"}, {"status": "1", "name": "system.cpu.idle", "messages": "system.cpu.idle 92.66", "value": "92.66", "command": "7", "groups": "cpu"}]

配置完以上信息基本就可以跑演示版本了

演示步骤:
1、首先在服务端访问 curl http://127.0.0.1:8081/monitor/configure/cache/all 初始化缓存信息
2、启动agent 启动agent后,稍等一会就可以看到一个演示版本了

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: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) 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 (d) 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 {yyyy} {name of copyright owner} 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.

简介

AsuraMonitor是一个功能强大、灵活的监控系统。系统安装简单,配置简单,相比zabbix, nagios,cacti,小米监控等都使用相当简单。只需要会写脚本,语言不限就可以实现任意监控需求。项目主页: 展开 收起
Java
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

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

搜索帮助

14c37bed 8189591 565d56ea 8189591