forked from QthCN/hmonitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.sql
94 lines (94 loc) · 2.85 KB
/
db.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
DROP DATABASE IF EXISTS hmonitor;
CREATE DATABASE hmonitor;
USE hmonitor;
CREATE TABLE USERS (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(128) NOT NULL UNIQUE,
mail VARCHAR(128) NOT NULL UNIQUE,
phone VARCHAR(128) NOT NULL UNIQUE,
password VARCHAR(1024) NOT NULL,
PRIMARY KEY (id),
KEY (name)
);
CREATE TABLE USERS_TRIGGER_BINDING (
id INT NOT NULL AUTO_INCREMENT,
user_id INT NOT NULL,
trigger_name VARCHAR(256) NOT NULL,
PRIMARY KEY (id),
KEY (user_id),
KEY (trigger_name)
);
CREATE TABLE TRIGGER_EVENTS (
id INT NOT NULL AUTO_INCREMENT,
trigger_name VARCHAR(256) NOT NULL,
hostname VARCHAR(256) NOT NULL,
event VARCHAR(256) NOT NULL,
value VARCHAR(256) NOT NULL,
type VARCHAR(128) NOT NULL DEFAULT 'NORMAL',
last_occur_time TIMESTAMP NOT NULL,
first_occur_time TIMESTAMP NOT NULL,
severity VARCHAR(256) NOT NULL,
occur_amount INT NOT NULL,
status VARCHAR(128) NOT NULL,
PRIMARY KEY (id),
KEY (trigger_name),
KEY (last_occur_time),
KEY (first_occur_time),
KEY (status),
KEY (severity)
);
CREATE TABLE ALERT_MSG (
id INT NOT NULL AUTO_INCREMENT,
mail VARCHAR(128),
phone VARCHAR(128),
trigger_name VARCHAR(256) NOT NULL,
hostname VARCHAR(256) NOT NULL,
send_time TIMESTAMP NOT NULL,
PRIMARY KEY (id),
KEY (send_time),
KEY (trigger_name)
);
CREATE TABLE AUTOFIX_BINDING (
id INT NOT NULL AUTO_INCREMENT,
trigger_name VARCHAR(256) NOT NULL,
auto_fix_script VARCHAR(256) NOT NULL,
change_user VARCHAR(256) NOT NULL,
change_date TIMESTAMP NOT NULL,
PRIMARY KEY (id),
KEY (trigger_name)
);
CREATE TABLE AUTOFIX_LOG (
id INT NOT NULL AUTO_INCREMENT,
trigger_name VARCHAR(256) NOT NULL,
hostname VARCHAR(256) NOT NULL,
script VARCHAR(256) NOT NULL,
begin_time TIMESTAMP NOT NULL,
status VARCHAR(256) NOT NULL,
event_id INT NOT NULL,
comments VARCHAR(4096) NOT NULL DEFAULT "",
PRIMARY KEY (id),
KEY (trigger_name),
KEY (hostname),
KEY (begin_time),
KEY (status)
);
CREATE TABLE ALERT_FILTER (
id INT NOT NULL AUTO_INCREMENT,
trigger_name VARCHAR(256) NOT NULL,
hostname VARCHAR(256) NOT NULL,
begin_time TIMESTAMP NOT NULL,
end_time TIMESTAMP NOT NULL,
filter VARCHAR(256) NOT NULL,
comment VARCHAR(4096) NOT NULL,
PRIMARY KEY (id),
KEY (trigger_name),
KEY (hostname)
);
CREATE TABLE HM_TRIGGER (
id INT NOT NULL AUTO_INCREMENT,
description VARCHAR(256) NOT NULL,
priority INT NOT NULL,
comments VARCHAR(4096) NOT NULL DEFAULT "",
PRIMARY KEY (id),
KEY (description)
);