Coder Social home page Coder Social logo

asurateam / monitor Goto Github PK

View Code? Open in Web Editor NEW
1.3K 164.0 489.0 479.03 MB

The monitoring system, develop their own powerful and flexible configuration

License: Apache License 2.0

Java 30.56% Shell 0.05% CSS 8.92% JavaScript 55.46% HTML 0.11% Python 0.01% Go 4.89%

monitor's People

Contributors

agui35303628 avatar zhaoyun006 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

monitor's Issues

获取到的脚本信息为[]

017-05-19 13:21:31.566 INFO 118040 --- [pool-1-thread-1] c.a.agent.controller.AgentController : 启动监控上报任务计划
jvm 1 | 2017-05-19 13:21:31.566 INFO 118040 --- [pool-1-thread-1] c.a.agent.controller.AgentController : 获取脚本文件
jvm 1 | 2017-05-19 13:21:31.566 INFO 118040 --- [pool-1-thread-1] com.asura.agent.util.FileIoUtil : /home/runtime/monitor/scripts/
jvm 1 | 2017-05-19 13:21:31.566 INFO 118040 --- [pool-1-thread-1] c.a.agent.controller.AgentController : 获取到脚本文件:[]
jvm 1 | 2017-05-19 13:21:33.066 INFO 118040 --- [pool-1-thread-1] c.a.agent.controller.AgentController : 完成监控上报任务计划完成
jvm 1 | 2017-05-19 13:21:33.066 INFO 118040 --- [pool-1-thread-1] c.a.agent.controller.AgentController : 设置脚本信息

呵呵

QQ群不让进还挂个QQ群也是没看懂

mvn报错

跑脚本mvn报错
[INFO] ------------------------------------------------------------------------
[INFO] Building Monitor 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Monitor ---
[INFO] Deleting /opt/monitor-bak/server/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Monitor ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 46 resources
[INFO] Copying 12 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ Monitor ---
[INFO] Compiling 321 source files to /opt/monitor-bak/server/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/util/HttpUtil.java:[5,33] Handler is internal proprietary API and may be removed in a future release
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/util/Base64Util.java:[3,15] BASE64Decoder is internal proprietary API and may be removed in a future release
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/util/Base64Util.java:[4,15] BASE64Encoder is internal proprietary API and may be removed in a future release
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/resource/controller/ResourceReportController.java:[6,31] error: package com.sun.tools.javac.comp does not exist
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/util/HttpUtil.java:[298,58] Handler is internal proprietary API and may be removed in a future release
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/util/Base64Util.java:[33,24] BASE64Encoder is internal proprietary API and may be removed in a future release
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/util/Base64Util.java:[43,16] BASE64Decoder is internal proprietary API and may be removed in a future release
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/util/Base64Util.java:[43,44] BASE64Decoder is internal proprietary API and may be removed in a future release
[INFO] 8 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.258s
[INFO] Finished at: Sun May 14 20:33:57 CST 2017
[INFO] Final Memory: 16M/219M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project Monitor: Compilation failure: Compilation failure:
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/util/HttpUtil.java:[5,33] Handler is internal proprietary API and may be removed in a future release
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/util/Base64Util.java:[3,15] BASE64Decoder is internal proprietary API and may be removed in a future release
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/util/Base64Util.java:[4,15] BASE64Encoder is internal proprietary API and may be removed in a future release
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/resource/controller/ResourceReportController.java:[6,31] error: package com.sun.tools.javac.comp does not exist
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/util/HttpUtil.java:[298,58] Handler is internal proprietary API and may be removed in a future release
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/util/Base64Util.java:[33,24] BASE64Encoder is internal proprietary API and may be removed in a future release
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/util/Base64Util.java:[43,16] BASE64Decoder is internal proprietary API and may be removed in a future release
[ERROR] /opt/monitor-bak/server/src/main/java/com/asura/util/Base64Util.java:[43,44] BASE64Decoder is internal proprietary API and may be removed in a future release
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

这些js有错,求解

static/js/monitor/go.js
static/js/plugins/flot/jquery.flot.js
static/js/plugins/fullcalendar/moment.min.js
static/js/top.js
用eclipse打开有错,求解

新增的监控项,但是在web页面主页的正常项监控中无法看到

我新增了两个对MYSQL TPS 的监控报警,但是web主页上显示的280个,但是点开 正常监控项里面却只显示了202个,少了很多,经查, 并且找赵云确认后,发现原因是是因为返回的json 串格中name和group的格式不对,
groups 不能有. _ -

name 不能有中横线和下划线,可以有点

最终返回的格式为:

[{"status": 2, "name": "YWS.MYSQL.TPS", "messages": "MySQL_TPS 0", "value": 0, "command": "./29", "groups": "MysqlYWSTPS"}]

就可以解决了

自己写的脚本的监控项,可以在首页控制台看到报警信息,但是无法实现邮件报警

我自己写了一个监控数据库TPS 的Python脚本,脚本如下:
#!/bin/env python

-- encoding: utf-8 --

import time
import os
import sys
import json
import re
import thread

mysql_stat_list = []

class MySQLMonitorInfo():
def init(self, host, port, user, password):
self.host = host
self.port = port
self.user = user
self.password = password

def stat_info(self):
    m = "mysql -umonitor -pmonitor -e 'SHOW GLOBAL STATUS'  "
    data = os.popen(m).readlines()

    Str_string = {}
    for d in data:
        ds = d.replace("  ", "").replace("\t", " ").split(" ")
        Str_string[ds[0]] = ds[1].strip()
    return Str_string

    # 获取差值

5 秒

def get_d_value(key, data1, data2):
try:
data = (int(data2.get(key, 0)) - int(data1.get(key, 0))) / 5
except Exception:
data = 0
return data

def get_data(host, tid):
try:
# 如果加密码的话就调用远程机器
conn = MySQLMonitorInfo(host, int(sys.argv[2]), sys.argv[3], sys.argv[4])
except Exception:
# 本地无密码操作
conn = MySQLMonitorInfo("", "", "", "")
stat_info = conn.stat_info()
time.sleep(5)
stat_info_2 = conn.stat_info()

monitor_keys = [
    ('Com_select', 'COUNTER'),
    ('Qcache_hits', 'COUNTER'),
    ('Com_insert', 'COUNTER'),
    ('Com_update', 'COUNTER'),
    ('Com_delete', 'COUNTER'),
    ('Com_replace', 'COUNTER'),
    ('MySQL_QPS', 'COUNTER'),
    ('MySQL_TPS', 'COUNTER'),
    ('Innodb_buffer_pool_read_requests', 'COUNTER'),
    ('Innodb_buffer_pool_reads', 'COUNTER'),
    ('Innodb_buffer_pool_pages_flushed', 'COUNTER'),

    ('ReadWrite_ratio', 'GAUGE'),
    ('Innodb_buffer_read_hit_ratio', 'GAUGE'),
    ('Innodb_buffer_pool_pages_free', 'GAUGE'),
    ('Innodb_buffer_pool_pages_dirty', 'GAUGE'),
    ('Innodb_buffer_pool_pages_data', 'GAUGE'),

    ('Bytes_received', 'COUNTER'),
    ('Bytes_sent', 'COUNTER'),
    ('Innodb_rows_deleted', 'COUNTER'),
    ('Innodb_rows_inserted', 'COUNTER'),
    ('Innodb_rows_read', 'COUNTER'),
    ('Innodb_rows_updated', 'COUNTER'),
    ('Innodb_os_log_fsyncs', 'COUNTER'),
    ('Innodb_os_log_written', 'COUNTER'),
    ('Created_tmp_disk_tables', 'COUNTER'),
    ('Created_tmp_tables', 'COUNTER'),
    ('Connections', 'COUNTER'),
    ('Innodb_log_waits', 'COUNTER'),
    ('Slow_queries', 'COUNTER'),
    ('Binlog_cache_disk_use', 'COUNTER')
]
select = get_d_value("Com_select", stat_info, stat_info_2)
update = get_d_value("Com_update", stat_info, stat_info_2)
delete = get_d_value("Com_delete", stat_info, stat_info_2)
insert = get_d_value("Com_insert", stat_info, stat_info_2)
replace = get_d_value("replace", stat_info, stat_info_2)
Innodb_buffer_pool_read_requests = get_d_value("Innodb_buffer_pool_read_requests", stat_info, stat_info_2)

for _key, falcon_type in monitor_keys:
    if _key == 'MySQL_QPS':
        _value = select + get_d_value("Qcache_hits", stat_info, stat_info_2)
    elif _key == 'MySQL_TPS':
        _value = insert + update + delete + replace
    elif _key == 'Innodb_buffer_read_hit_ratio':
        try:
            _value = round((Innodb_buffer_pool_read_requests - get_d_value("Innodb_buffer_pool_reads", stat_info,
                                                                           stat_info_2)) / Innodb_buffer_pool_read_requests * 100,
                           3)
        except ZeroDivisionError:
            _value = 0
    elif _key == 'ReadWrite_ratio':
        try:
            _value = round((select + get_d_value("Qcache_hits", stat_info, stat_info_2)) / (
                insert + update + delete + replace), 2)
        except ZeroDivisionError:
            _value = 0
    else:
        if falcon_type == "COUNTER":
            _value = get_d_value(_key, stat_info, stat_info_2)
        else:
            _value = int(stat_info.get(_key, 0))

    result = {
        'name': '%s' % (_key.replace("_", ".")),
        'groups': "MysqlNew",
        'value': _value,
        'status': 1,
        'command': sys.argv[0],
        'messages': "%s %s" % (_key, _value),
    }
    if host and "local" not in host:
        result["ip"] = host
    # print("111")
    # print(result)
    # print("2222")
    if result['name'] == 'MySQL.TPS' and result['value'] >= 10:
        # print(result)
        result['status'] = 2
        print(
        json.dumps([result]))
    # mysql_stat_list.append(result)
    elif result['name'] == 'MySQL.TPS' and result['value'] < 10:
        result['status'] = 1
        print(
        json.dumps([result]))

if len(sys.argv) > 4:
for host in sys.argv[1].split(","):
thread.start_new_thread(get_data, (host, 1))
time.sleep(5.1)
else:
get_data("", "")
print
json.dumps(mysql_stat_list)

逻辑是当TPS >=10 的时候就触发报警--- 返回的json 中status=2,如果TPS <10 status=1。

现在已经实现了数据上报,并且可以在server端看到报警信息,但是不能触发邮件的报警,

我已经配置了监控项,和单机监控,并且配置了报警组,邮件smtp也正常,赵云大神帮我测试了redis读写是可以发出邮件的,但是为什么我自己的脚本,可以在web上反馈到报警信息,但是就是无法触发邮件报警。!!! @zhaoyun006 帮我解决下! QQ: 天堂向左,北京向右

数据导入mysql5.7报错

[Err] 1136 - Column count doesn't match value count at row 1
[Err] INSERT INTO cmdb_resource_network VALUES (3,'10.16.25','2016-08-15 13:53:47','','',NULL,24,'25段生产环境');
[Err] 1231 - Variable 'time_zone' can't be set to the value of 'NULL'
[Err] /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE /;
[Err] 1231 - Variable 'sql_mode' can't be set to the value of 'NULL'
[Err] /
!40101 SET SQL_MODE=@OLD_SQL_MODE /;
[Err] 1231 - Variable 'foreign_key_checks' can't be set to the value of 'NULL'
[Err] /
!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS /;
[Err] 1231 - Variable 'unique_checks' can't be set to the value of 'NULL'
[Err] /
!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS /;
[Err] 1231 - Variable 'character_set_client' can't be set to the value of 'NULL'
[Err] /
!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT /;
[Err] 1231 - Variable 'collation_connection' can't be set to the value of 'NULL'
[Err] /
!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION /;
[Err] 1231 - Variable 'sql_notes' can't be set to the value of 'NULL'
[Err] /
!40111 SET SQL_NOTES=@OLD_SQL_NOTES /;
[Err] 1060 - Duplicate column name 'vlan'
[Err] /
*

  • 2017-04-04
    */
    alter table cmdb_resource_network add vlan varchar(10) comment "网络所在vlan";
    [Err] 1050 - Table 'cmdb_graph_quartz' already exists
    [Err] CREATE TABLE cmdb_graph_quartz (
    name varchar(200) DEFAULT NULL COMMENT '只要名字在,就不执行,等于一个锁',
    ip_address varchar(32) DEFAULT NULL COMMENT '哪个ip地址添加的',
    create_time bigint(20) DEFAULT NULL COMMENT '添加时间'
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    [Msg] Finished - Unsuccessfully

agent 一直在获取连接

agent配置完成之后log显示一直在获取连接
[pool-1-thread-1] com.asura.agent.util.RedisUtil : get monitor_cache_push_server
[pool-1-thread-1] com.asura.agent.util.RedisUtil : 获取链接...

登录权限问题

现在这套监控想要查看机器性能监控 不需要帐号密码的,虽然放在内网,但是一般监控给予主管级别看的,如果没设置查看监控需要帐号密码这样只要知道地址就可以随意看机器状况

关于报警的设置问题

1.报警的具体设置步骤是怎么个流程?
2.关于“报警通道消息配置“页面,配置好后,点上面的“X”按钮关闭不掉,要怎么操作这个关闭?保存页面成功后,再次查看编辑页面的内容,发现“是否开启认证”的勾选项没勾选起来,即这个“是否开启认证”没保存成功,这个是否需要改下?
3.页面中的删除按钮目前都不能操作,这个功能已关闭?

部署后不能正常启动tomcat

tomcat启动时报以下错误信息:
严重: The web application [] appears to have started a thread named [Thread-229] but has failed to stop it. This is very likely to create a memory leak.

原因是部署后jdbc.properties配置文件的数据库连接被修改为jdbc:mysql://.server:3306/cmdb?useUnicode=true&characterEncoding=UTF-8
导致不能正常连接数据库

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.