-
Notifications
You must be signed in to change notification settings - Fork 50
/
partitions.sql
230 lines (210 loc) · 10.7 KB
/
partitions.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
DROP TABLE IF EXISTS `nagios_servicechecks`;
CREATE TABLE IF NOT EXISTS `nagios_servicechecks` (
`servicecheck_id` INT(11) NOT NULL AUTO_INCREMENT,
`instance_id` SMALLINT(6) NOT NULL DEFAULT '0',
`service_object_id` INT(11) NOT NULL DEFAULT '0',
`check_type` SMALLINT(6) NOT NULL DEFAULT '0',
`current_check_attempt` SMALLINT(6) NOT NULL DEFAULT '0',
`max_check_attempts` SMALLINT(6) NOT NULL DEFAULT '0',
`state` SMALLINT(6) NOT NULL DEFAULT '0',
`state_type` SMALLINT(6) NOT NULL DEFAULT '0',
`start_time` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
`start_time_usec` INT(11) NOT NULL DEFAULT '0',
`end_time` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
`end_time_usec` INT(11) NOT NULL DEFAULT '0',
`command_object_id` INT(11) NOT NULL DEFAULT '0',
`command_args` VARCHAR(255)
COLLATE utf8mb4_general_ci DEFAULT '',
`command_line` VARCHAR(255)
COLLATE utf8mb4_general_ci DEFAULT '',
`timeout` SMALLINT(6) NOT NULL DEFAULT '0',
`early_timeout` SMALLINT(6) NOT NULL DEFAULT '0',
`execution_time` DOUBLE NOT NULL DEFAULT '0',
`latency` DOUBLE NOT NULL DEFAULT '0',
`return_code` SMALLINT(6) NOT NULL DEFAULT '0',
`output` VARCHAR(4096)
COLLATE utf8mb4_general_ci,
`long_output` TEXT COLLATE utf8mb4_general_ci,
`perfdata` VARCHAR(4096)
COLLATE utf8mb4_general_ci,
PRIMARY KEY (`servicecheck_id`, `start_time`),
KEY `start_time` (`start_time`),
KEY `instance_id` (`instance_id`),
KEY `service_object_id` (`service_object_id`),
INDEX (start_time)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
COMMENT ='Historical service checks'
PARTITION BY RANGE ( TO_DAYS(start_time) ) (
PARTITION p_max VALUES LESS THAN ( MAXVALUE )
);
-- mysql> show create table itnovum_workshop.nagios_servicechecks\G
DROP TABLE IF EXISTS `nagios_hostchecks`;
CREATE TABLE IF NOT EXISTS `nagios_hostchecks` (
`hostcheck_id` INT(11) NOT NULL AUTO_INCREMENT,
`instance_id` SMALLINT(6) NOT NULL DEFAULT '0',
`host_object_id` INT(11) NOT NULL DEFAULT '0',
`check_type` SMALLINT(6) NOT NULL DEFAULT '0',
`is_raw_check` SMALLINT(6) NOT NULL DEFAULT '0',
`current_check_attempt` SMALLINT(6) NOT NULL DEFAULT '0',
`max_check_attempts` SMALLINT(6) NOT NULL DEFAULT '0',
`state` SMALLINT(6) NOT NULL DEFAULT '0',
`state_type` SMALLINT(6) NOT NULL DEFAULT '0',
`start_time` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
`start_time_usec` INT(11) NOT NULL DEFAULT '0',
`end_time` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
`end_time_usec` INT(11) NOT NULL DEFAULT '0',
`command_object_id` INT(11) NOT NULL DEFAULT '0',
`command_args` VARCHAR(255)
COLLATE utf8mb4_general_ci DEFAULT '',
`command_line` VARCHAR(255)
COLLATE utf8mb4_general_ci DEFAULT '',
`timeout` SMALLINT(6) NOT NULL DEFAULT '0',
`early_timeout` SMALLINT(6) NOT NULL DEFAULT '0',
`execution_time` DOUBLE NOT NULL DEFAULT '0',
`latency` DOUBLE NOT NULL DEFAULT '0',
`return_code` SMALLINT(6) NOT NULL DEFAULT '0',
`output` VARCHAR(4096)
CHARACTER SET utf8mb4 DEFAULT '',
`long_output` TEXT CHARACTER SET utf8mb4,
`perfdata` VARCHAR(4096)
COLLATE utf8mb4_general_ci DEFAULT '',
PRIMARY KEY (`hostcheck_id`, `start_time`),
KEY `start_time` (`start_time`),
KEY `host_object_id` (`host_object_id`)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
COMMENT ='Historical host checks'
PARTITION BY RANGE ( TO_DAYS(start_time) ) (
PARTITION p_max VALUES LESS THAN ( MAXVALUE )
);
-- mysql> show create table itnovum_workshop.nagios_hostchecks\G
DROP TABLE IF EXISTS `nagios_statehistory`;
CREATE TABLE IF NOT EXISTS `nagios_statehistory` (
`statehistory_id` INT(11) NOT NULL AUTO_INCREMENT,
`instance_id` SMALLINT(6) NOT NULL DEFAULT '0',
`state_time` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
`state_time_usec` INT(11) NOT NULL DEFAULT '0',
`object_id` INT(11) NOT NULL DEFAULT '0',
`state_change` SMALLINT(6) NOT NULL DEFAULT '0',
`state` SMALLINT(6) NOT NULL DEFAULT '0',
`state_type` SMALLINT(6) NOT NULL DEFAULT '0',
`current_check_attempt` SMALLINT(6) NOT NULL DEFAULT '0',
`max_check_attempts` SMALLINT(6) NOT NULL DEFAULT '0',
`last_state` SMALLINT(6) NOT NULL DEFAULT '-1',
`last_hard_state` SMALLINT(6) NOT NULL DEFAULT '-1',
`output` VARCHAR(4096)
COLLATE utf8mb4_general_ci DEFAULT '',
`long_output` TEXT COLLATE utf8mb4_general_ci,
PRIMARY KEY (`statehistory_id`, `state_time`),
KEY `object_id` (`object_id`)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
COMMENT ='Historical host and service state changes'
PARTITION BY RANGE ( TO_DAYS(state_time) ) (
PARTITION p_max VALUES LESS THAN ( MAXVALUE )
);
-- mysql> show create table itnovum_workshop.nagios_statehistory\G
DROP TABLE IF EXISTS `nagios_logentries`;
CREATE TABLE IF NOT EXISTS `nagios_logentries` (
`logentry_id` INT(11) NOT NULL AUTO_INCREMENT,
`instance_id` INT(11) NOT NULL DEFAULT '0',
`logentry_time` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
`entry_time` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
`entry_time_usec` INT(11) NOT NULL DEFAULT '0',
`logentry_type` INT(11) NOT NULL DEFAULT '0',
`logentry_data` VARCHAR(255)
COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`realtime_data` SMALLINT(6) NOT NULL DEFAULT '0',
`inferred_data_extracted` SMALLINT(6) NOT NULL DEFAULT '0',
PRIMARY KEY (`logentry_id`, `entry_time`),
UNIQUE KEY `instance_id` (`instance_id`, `logentry_time`, `entry_time`, `entry_time_usec`),
KEY `logentry_time` (`logentry_time`)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
COMMENT ='Historical record of log entries'
PARTITION BY RANGE ( TO_DAYS(entry_time) ) (
PARTITION p_max VALUES LESS THAN ( MAXVALUE )
);
-- mysql> show create table itnovum_workshop.nagios_logentries\G
DROP TABLE IF EXISTS `nagios_notifications`;
CREATE TABLE IF NOT EXISTS `nagios_notifications` (
`notification_id` INT(11) NOT NULL AUTO_INCREMENT,
`instance_id` SMALLINT(6) NOT NULL DEFAULT '0',
`notification_type` SMALLINT(6) NOT NULL DEFAULT '0',
`notification_reason` SMALLINT(6) NOT NULL DEFAULT '0',
`object_id` INT(11) NOT NULL DEFAULT '0',
`start_time` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
`start_time_usec` INT(11) NOT NULL DEFAULT '0',
`end_time` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
`end_time_usec` INT(11) NOT NULL DEFAULT '0',
`state` SMALLINT(6) NOT NULL DEFAULT '0',
`output` VARCHAR(4096)
COLLATE utf8mb4_general_ci DEFAULT '',
`long_output` TEXT COLLATE utf8mb4_general_ci,
`escalated` SMALLINT(6) NOT NULL DEFAULT '0',
`contacts_notified` SMALLINT(6) NOT NULL DEFAULT '0',
PRIMARY KEY (`notification_id`, `start_time`),
KEY `top10` (`object_id`, `start_time`, `contacts_notified`),
KEY `start_time` (`start_time`)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
COMMENT ='Historical record of host and service notifications'
PARTITION BY RANGE ( TO_DAYS(start_time) ) (
PARTITION p_max VALUES LESS THAN ( MAXVALUE )
);
-- mysql> show create table itnovum_workshop.nagios_notifications\G
DROP TABLE IF EXISTS `nagios_contactnotifications`;
CREATE TABLE IF NOT EXISTS `nagios_contactnotifications` (
`contactnotification_id` INT(11) NOT NULL AUTO_INCREMENT,
`instance_id` SMALLINT(6) NOT NULL DEFAULT '0',
`notification_id` INT(11) NOT NULL DEFAULT '0',
`contact_object_id` INT(11) NOT NULL DEFAULT '0',
`start_time` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
`start_time_usec` INT(11) NOT NULL DEFAULT '0',
`end_time` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
`end_time_usec` INT(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`contactnotification_id`, `start_time`),
KEY `start_time` (`start_time`)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
COMMENT ='Historical record of contact notifications'
PARTITION BY RANGE ( TO_DAYS(start_time) ) (
PARTITION p_max VALUES LESS THAN ( MAXVALUE )
);
-- mysql> show create table itnovum_workshop.nagios_contactnotifications\G
DROP TABLE IF EXISTS `nagios_contactnotificationmethods`;
CREATE TABLE IF NOT EXISTS `nagios_contactnotificationmethods` (
`contactnotificationmethod_id` INT(11) NOT NULL AUTO_INCREMENT,
`instance_id` SMALLINT(6) NOT NULL DEFAULT '0',
`contactnotification_id` INT(11) NOT NULL DEFAULT '0',
`start_time` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
`start_time_usec` INT(11) NOT NULL DEFAULT '0',
`end_time` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
`end_time_usec` INT(11) NOT NULL DEFAULT '0',
`command_object_id` INT(11) NOT NULL DEFAULT '0',
`command_args` VARCHAR(1000)
COLLATE utf8mb4_general_ci DEFAULT '',
PRIMARY KEY (`contactnotificationmethod_id`, `start_time`),
KEY `start_time` (`start_time`)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
COMMENT ='Historical record of contact notification methods'
PARTITION BY RANGE ( TO_DAYS(start_time) ) (
PARTITION p_max VALUES LESS THAN ( MAXVALUE )
);
-- mysql> show create table itnovum_workshop.nagios_contactnotificationmethods\G