forked from ccfos/nightingale
-
Notifications
You must be signed in to change notification settings - Fork 0
/
n9e_mon.sql
286 lines (267 loc) · 13.5 KB
/
n9e_mon.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
set names utf8;
drop database if exists n9e_mon;
create database n9e_mon;
use n9e_mon;
CREATE TABLE `node` (
`id` int unsigned not null AUTO_INCREMENT,
`pid` int unsigned not null,
`name` varchar(64) not null,
`path` varchar(255) not null,
`leaf` int(1) not null,
`note` varchar(128) not null default '',
PRIMARY KEY (`id`),
KEY (`path`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `endpoint` (
`id` int unsigned not null AUTO_INCREMENT,
`ident` varchar(255) not null,
`alias` varchar(255) not null default '',
PRIMARY KEY (`id`),
UNIQUE KEY (`ident`),
KEY (`alias`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `node_endpoint` (
`node_id` int unsigned not null,
`endpoint_id` int unsigned not null,
KEY(`node_id`),
KEY(`endpoint_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
create table `maskconf` (
`id` int unsigned not null auto_increment,
`nid` int unsigned not null,
`metric` varchar(255) not null,
`tags` varchar(255) not null default '',
`cause` varchar(255) not null default '',
`user` varchar(32) not null default 'operate user',
`btime` bigint not null default 0 comment 'begin time',
`etime` bigint not null default 0 comment 'end time',
primary key (`id`),
key(`nid`)
) engine=innodb default charset=utf8;
create table `maskconf_endpoints` (
`id` int unsigned not null auto_increment,
`mask_id` int unsigned not null,
`endpoint` varchar(255) not null,
primary key (`id`),
key(`mask_id`)
) engine=innodb default charset=utf8;
create table `screen` (
`id` int unsigned not null auto_increment,
`node_id` int unsigned not null comment 'service tree node id',
`name` varchar(255) not null,
`last_updator` varchar(64) not null default '',
`last_updated` timestamp not null default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
primary key (`id`),
key(`node_id`)
) engine=innodb default charset=utf8;
create table `screen_subclass` (
`id` int unsigned not null auto_increment,
`screen_id` int unsigned not null,
`name` varchar(255) not null,
`weight` int not null default 0,
primary key (`id`),
key(`screen_id`)
) engine=innodb default charset=utf8;
create table `chart` (
`id` int unsigned not null auto_increment,
`subclass_id` int unsigned not null,
`configs` varchar(8192),
`weight` int not null default 0,
primary key (`id`),
key(`subclass_id`)
) engine=innodb default charset=utf8;
create table `tmp_chart` (
`id` int unsigned not null auto_increment,
`configs` varchar(8192),
`creator` varchar(64) not null,
`last_updated` timestamp not null default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
primary key (`id`)
) engine=innodb default charset=utf8;
create table `event_cur` (
`id` bigint(20) unsigned not null AUTO_INCREMENT comment 'id',
`sid` bigint(20) unsigned not null default 0 comment 'sid',
`sname` varchar(255) not null default '' comment 'name, 报警通知名称',
`node_path` varchar(255) not null default '' comment 'node path',
`nid` int unsigned not null default '0' comment 'node id',
`endpoint` varchar(255) not null default '' comment 'endpoint',
`endpoint_alias` varchar(255) not null default '' comment 'endpoint alias',
`priority` tinyint(4) not null default 2 comment '优先级',
`event_type` varchar(45) not null default '' comment 'alert|recovery',
`category` tinyint(4) not null default 2 comment '1阈值 2智能',
`status` int(10) not null default 0 comment 'event status',
`detail` text comment 'counter points pred_points 详情',
`hashid` varchar(128) not null default '' comment 'sid+counter hash',
`etime` bigint(20) not null default 0 comment 'event ts',
`value` varchar(255) not null default '' comment '当前值',
`users` varchar(512) not null default '[]' comment 'notify users',
`groups` varchar(512) not null default '[]' comment 'notify groups',
`info` varchar(512) not null default '' comment 'strategy info',
`ignore_alert` int(2) not null default 0 comment 'ignore event',
`claimants` varchar(512) not null default '[]' comment 'claimants',
`need_upgrade` int(2) not null default 0 comment 'need upgrade',
`alert_upgrade` text comment 'alert upgrade',
`created` DATETIME not null default '1971-1-1 00:00:00' comment 'created',
KEY `idx_id` (`id`),
KEY `idx_sid` (`sid`),
KEY `idx_hashid` (`hashid`),
KEY `idx_node_path` (`node_path`),
KEY `idx_etime` (`etime`)
) engine=innodb default charset=utf8 comment 'event';
create table `event` (
`id` bigint(20) unsigned not null AUTO_INCREMENT comment 'id',
`sid` bigint(20) unsigned not null default 0 comment 'sid',
`sname` varchar(255) not null default '' comment 'name, 报警通知名称',
`node_path` varchar(255) not null default '' comment 'node path',
`nid` int unsigned not null default '0' comment 'node id',
`endpoint` varchar(255) not null default '' comment 'endpoint',
`endpoint_alias` varchar(255) not null default '' comment 'endpoint alias',
`priority` tinyint(4) not null default 2 comment '优先级',
`event_type` varchar(45) not null default '' comment 'alert|recovery',
`category` tinyint(4) not null default 2 comment '1阈值 2智能',
`status` int(10) not null default 0 comment 'event status',
`detail` text comment 'counter points pred_points 详情',
`hashid` varchar(128) not null default '' comment 'sid+counter hash',
`etime` bigint(20) not null default 0 comment 'event ts',
`value` varchar(255) not null default '' comment '当前值',
`users` varchar(512) not null default '[]' comment 'notify users',
`groups` varchar(512) not null default '[]' comment 'notify groups',
`info` varchar(512) not null default '' comment 'strategy info',
`need_upgrade` int(2) not null default 0 comment 'need upgrade',
`alert_upgrade` text not null comment 'alert upgrade',
`created` DATETIME not null default '1971-1-1 00:00:00' comment 'created',
PRIMARY KEY (`id`),
KEY `idx_id` (`id`),
KEY `idx_sid` (`sid`),
KEY `idx_hashid` (`hashid`),
KEY `idx_node_path` (`node_path`),
KEY `idx_etime` (`etime`),
KEY `idx_event_type` (`event_type`),
KEY `idx_status` (`status`)
) engine=innodb default charset=utf8 comment 'event';
CREATE TABLE `stra` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL COMMENT 'strategy name',
`category` int(1) NOT NULL COMMENT '1 机器 2业务',
`nid` int(10) NOT NULL COMMENT '服务树节点id',
`excl_nid` varchar(255) NOT NULL COMMENT '被排除的服务树叶子节点id',
`alert_dur` int(4) NOT NULL COMMENT '单位秒,持续异常n秒则产生异常event',
`recovery_dur` int(4) NOT NULL DEFAULT 0 COMMENT '单位秒,持续正常n秒则产生恢复event,0表示立即产生恢复event',
`exprs` varchar(1024) NOT NULL DEFAULT '' COMMENT '规则表达式',
`tags` varchar(1024) DEFAULT '' COMMENT 'tags过滤',
`enable_stime` varchar(6) NOT NULL DEFAULT '00:00' COMMENT '策略生效开始时间',
`enable_etime` varchar(6) NOT NULL DEFAULT '23:59' COMMENT '策略生效终止时间',
`enable_days_of_week` varchar(1024) NOT NULL DEFAULT '[0,1,2,3,4,5,6]' COMMENT '策略生效日期',
`converge` varchar(45) NOT NULL DEFAULT '' COMMENT 'n秒最多报m次警',
`recovery_notify` int(1) NOT NULL DEFAULT 1 COMMENT '1 发送恢复通知 0不发送恢复通知',
`priority` int(1) NOT NULL DEFAULT 3 COMMENT '告警等级',
`notify_group` varchar(255) NOT NULL DEFAULT '' COMMENT '告警通知组',
`notify_user` varchar(255) NOT NULL DEFAULT '' COMMENT '告警通知人',
`callback` varchar(1024) NOT NULL DEFAULT '' COMMENT 'callback url',
`creator` varchar(64) NOT NULL COMMENT '创建者',
`created` timestamp NOT NULL DEFAULT '1971-01-01 00:00:00' COMMENT 'created',
`last_updator` varchar(64) NOT NULL DEFAULT '',
`last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`need_upgrade` int(2) not null default 0 comment 'need upgrade',
`alert_upgrade` text comment 'alert upgrade',
PRIMARY KEY (`id`),
KEY `idx_nid` (`nid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `stra_log` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`sid` bigint(20) NOT NULL DEFAULT '0' COMMENT 'collect id',
`action` varchar(255) NOT NULL DEFAULT '' COMMENT '动作 update, delete',
`body` text COMMENT '修改之前采集的内容',
`creator` varchar(255) NOT NULL DEFAULT '1971-01-01 00:00:00' COMMENT 'creator',
`created` timestamp NOT NULL DEFAULT '1971-01-01 00:00:00' COMMENT 'created',
PRIMARY KEY (`id`),
KEY `idx_sid` (`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `port_collect` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`collect_type` varchar(64) NOT NULL DEFAULT 'PORT' COMMENT 'type',
`nid` int(10) NOT NULL COMMENT '服务树节点id',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name',
`tags` varchar(255) NOT NULL DEFAULT '' COMMENT 'tags',
`port` int(11) NOT NULL DEFAULT '0' COMMENT 'port',
`step` int(11) NOT NULL DEFAULT '0' COMMENT '采集周期',
`timeout` int(11) NOT NULL DEFAULT '0' COMMENT 'connect time',
`comment` varchar(512) NOT NULL DEFAULT '' COMMENT 'comment',
`creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'creator',
`created` datetime NOT NULL COMMENT 'created',
`last_updator` varchar(255) NOT NULL DEFAULT '' COMMENT 'last_updator',
`last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'last_updated',
PRIMARY KEY (`id`),
KEY `idx_nid` (`nid`),
KEY `idx_collect_type` (`collect_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'port collect';
CREATE TABLE `proc_collect` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`nid` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'nid',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name',
`tags` varchar(255) NOT NULL DEFAULT '' COMMENT 'tags',
`collect_type` varchar(64) NOT NULL DEFAULT 'PROC' COMMENT 'type',
`collect_method` varchar(64) NOT NULL DEFAULT 'name' COMMENT '采集方式',
`target` varchar(255) NOT NULL DEFAULT '' COMMENT '采集对象',
`step` int(11) NOT NULL DEFAULT '0' COMMENT '采集周期',
`comment` varchar(512) NOT NULL DEFAULT '' COMMENT 'comment',
`creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'creator',
`created` datetime NOT NULL COMMENT 'created',
`last_updator` varchar(255) NOT NULL DEFAULT '' COMMENT 'last_updator',
`last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_nid` (`nid`),
KEY `idx_collect_type` (`collect_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'proc collect';
CREATE TABLE `log_collect` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`nid` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'nid',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name',
`tags` varchar(255) NOT NULL DEFAULT '' COMMENT 'tags',
`collect_type` varchar(64) NOT NULL DEFAULT 'PROC' COMMENT 'type',
`step` int(11) NOT NULL DEFAULT '0' COMMENT '采集周期',
`file_path` varchar(255) NOT NULL DEFAULT '' COMMENT 'file path',
`time_format` varchar(128) NOT NULL DEFAULT '' COMMENT 'time format',
`pattern` varchar(1024) NOT NULL DEFAULT '' COMMENT 'pattern',
`func` varchar(64) NOT NULL DEFAULT '' COMMENT 'func',
`degree` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'degree',
`func_type` varchar(64) NOT NULL DEFAULT '' COMMENT 'func_type',
`aggregate` varchar(64) NOT NULL DEFAULT '' COMMENT 'aggr',
`unit` varchar(64) NOT NULL DEFAULT '' COMMENT 'unit',
`zero_fill` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'zero fill',
`comment` varchar(512) NOT NULL DEFAULT '' COMMENT 'comment',
`creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'creator',
`created` datetime NOT NULL COMMENT 'created',
`last_updator` varchar(255) NOT NULL DEFAULT '' COMMENT 'last_updator',
`last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_nid` (`nid`),
KEY `idx_collect_type` (`collect_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'log collect';
CREATE TABLE `plugin_collect` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`nid` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'nid',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name',
`collect_type` varchar(64) NOT NULL DEFAULT 'PROC' COMMENT 'type',
`step` int(11) NOT NULL DEFAULT '0' COMMENT '采集周期',
`file_path` varchar(255) NOT NULL COMMENT 'file_path',
`params` varchar(255) NOT NULL COMMENT 'params',
`comment` varchar(512) NOT NULL DEFAULT '' COMMENT 'comment',
`creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'creator',
`created` datetime NOT NULL COMMENT 'created',
`last_updator` varchar(128) NOT NULL DEFAULT '' COMMENT 'last_updator',
`last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_nid` (`nid`),
KEY `idx_collect_type` (`collect_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'plugin collect';
CREATE TABLE `collect_hist` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`cid` bigint(20) NOT NULL DEFAULT '0' COMMENT 'collect id',
`collect_type` varchar(255) NOT NULL DEFAULT '' COMMENT '采集的种类 log,port,proc,plugin',
`action` varchar(255) NOT NULL DEFAULT '' COMMENT '动作 update, delete',
`body` text COMMENT '修改之前采集的内容',
`creator` varchar(255) NOT NULL DEFAULT '1971-01-01 00:00:00' COMMENT 'creator',
`created` datetime NOT NULL DEFAULT '1971-01-01 00:00:00' COMMENT 'created',
PRIMARY KEY (`id`),
KEY `idx_cid` (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'hist';