异常监控平台--- SQL


 

异常监控平台--- SQL


 

一,【前言】

     这里异常监控平台, 主要是收集业务系统的日志信息, 日志信息收集最好的就是 Elasticsearch, 这是一个类数据库东西,专业永远搜集和存储业务系统的日志的,是一个主要以索引方式存储,查找的数据库,速度非常的快, 实时性非常的高.

    这你就有疑问了, 有了 ES, 还要 SQL 干嘛? SQL 是异常监控平台的一下基本数据配置,需要借用 mysql 来存储异常参数,这些参数在系统中需用用到.

 


二,【详情】

  目前数据库名称uamp; 一共用到三张表,strategyconfig( 策略配置表); alarmconfig(告警配置表); abnormalkey(异常关键字表)

 

   具体的 SQL 源码和字段如下:

DROP DATABASE IF EXISTS uamp;
create DATABASE uamp  default character set utf8 collate utf8_general_ci;
use uamp;

DROP TABLE IF EXISTS strategy_config;
create table strategy_config
(
  id bigint auto_increment primary key,
  strategy_name varchar(100) default '策略名称' not null comment '策略名称',
  warning_time int default 0 null comment '警告时间',
  warn_num int default 0 null comment '警告阈值',
  warn_num_unit int default 0 null comment '0:"",1:个,2:ms ,3:%',
  grave_warning_time int default 0 null comment '严重时间',
  grave_warn_num int default 0 null comment '严重警告阈值',
  warn_relation int default 0 null comment '1:大于,2:等于,3:小于,4:包含',
  group_type int default 0 null comment '1:总体,2:实例',
  rate_num int default 0 null comment '1:触发条件,0:无条件触发',
  ignore_exceptins varchar(1000)  null comment '忽略异常',
  created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP  COMMENT '创建时间',
  modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP   COMMENT '修改时间'
)comment '策略配置';


DROP TABLE IF EXISTS alarm_config;
create table alarm_config
(
  id bigint auto_increment primary key,
  warn_strategy_id bigint not null,
  warn_type int default 1 not null comment '1:钉钉,2:邮件,3:短信',
  monitor_subject varchar(100) not null comment '项目名称',
  monitor_subject_desc varchar(100) comment '项目别名',
  receive_group_name varchar(1000) not null,
  receive_group varchar(1000) not null,
  priority int default 1 null comment '0:master,1:正常',
  created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP  COMMENT '创建时间',
  modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP   COMMENT '修改时间'
)comment '警报表';


DROP TABLE IF EXISTS abnormal_key;
CREATE TABLE abnormal_key
(
  id bigint auto_increment PRIMARY KEY,
  alarm_config_id bigint NOT NULL comment '警报表Id',
  keyword VARCHAR(100) NOT NULL comment '异常关键字',
  status INT DEFAULT 1 NOT NULL comment '1:开启2:废弃',
  remark VARCHAR(100) comment '备注',
  created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP  COMMENT '创建时间',
  modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP   COMMENT '修改时间'
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '关键字配置';

 



三,【小结】                                          

 

  孔圣人曰:”玉不琢,不成器; 人不学,不知道!”当年导师说过:”不怕不知道, 就怕不知道.” 了解到自己的不足,去学习,去成长,去进步, 让自己有成就感就不是在荒度人生.

 

 

 

 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值