You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
rition/docs/rition.sql

103 lines
4.0 KiB

/*
Navicat Premium Data Transfer
Source Server : mysql
Source Server Type : MySQL
Source Server Version : 80027 (8.0.27)
Source Host : 127.0.0.1:3306
Source Schema : rition
Target Server Type : MySQL
Target Server Version : 80027 (8.0.27)
File Encoding : 65001
Date: 08/05/2024 10:15:09
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for alert
-- ----------------------------
DROP TABLE IF EXISTS `alert`;
CREATE TABLE `alert` (
`id` bigint NOT NULL,
`instance_id` varchar(64) NOT NULL COMMENT '出现警告的实例id',
`rule` bigint NOT NULL COMMENT '触发的规则',
`time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '警告出现的时间',
`status` tinyint NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx_instance` (`instance_id`),
KEY `idx_rule` (`rule`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ----------------------------
-- Table structure for contract
-- ----------------------------
DROP TABLE IF EXISTS `contract`;
CREATE TABLE `contract` (
`id` bigint NOT NULL,
`instance_id` varchar(64) NOT NULL COMMENT '绑定的实例',
`contract` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '联系方式',
`type` tinyint NOT NULL COMMENT '联系方式类型',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`status` tinyint NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx_id` (`id`),
KEY `idx_instance` (`instance_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ----------------------------
-- Table structure for ecs
-- ----------------------------
DROP TABLE IF EXISTS `ecs`;
CREATE TABLE `ecs` (
`id` varchar(128) NOT NULL COMMENT '实例id',
`name` varchar(255) NOT NULL COMMENT '主机名称',
`ip` varchar(15) NOT NULL COMMENT '主机绑定分配的ip',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`status` tinyint NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx_id` (`id`),
KEY `idx_ip` (`ip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ----------------------------
-- Table structure for record
-- ----------------------------
DROP TABLE IF EXISTS `record`;
CREATE TABLE `record` (
`id` bigint NOT NULL,
`instance_id` varchar(64) NOT NULL COMMENT '实例id',
`metric_data` json NOT NULL COMMENT '监控指标值,使用json格式存储',
`time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`status` tinyint NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx_id` (`id`),
KEY `idx_time` (`time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ----------------------------
-- Table structure for rule
-- ----------------------------
DROP TABLE IF EXISTS `rule`;
CREATE TABLE `rule` (
`id` bigint NOT NULL COMMENT '规则id',
`instance_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '规则对应的实例id',
`expression` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '需要计算的指标项或者表达式',
`condition` tinyint NOT NULL COMMENT '触发条件',
`threshold` varchar(32) NOT NULL COMMENT '阈值',
`trigger` tinyint NOT NULL COMMENT '触发方法,实时计算或定时计算',
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '规则描述',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`status` tinyint NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx_instance` (`instance_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
SET FOREIGN_KEY_CHECKS = 1;