- Added MIB browser
[public/netxms.git] / sql / schema.in
CommitLineData
6c9e7d36
VK
1/*
2** System configuration table
b51c8c91 3** ex: syntax=sql
6c9e7d36 4*/
cbcaf8c8 5
feea53fd 6CREATE TABLE config
cbcaf8c8 7(
9e6c6d05
VK
8 name varchar(64) not null,
9 value varchar(255),
10 PRIMARY KEY(name)
cbcaf8c8
VK
11);
12
13
b6a77d6d
VK
14/*
15** This table contains information about currently locked tables
16** or subsystems
17*/
18
feea53fd 19CREATE TABLE locks
b6a77d6d
VK
20(
21 component_id integer not null,
22 component_name varchar(64),
23 lock_status integer not null,
24 owner_info varchar(255), // Information about current lock owner, may be empty
25 PRIMARY KEY(component_id)
26);
27
28
6c9e7d36
VK
29/*
30** Users
31*/
9b057805 32
feea53fd 33CREATE TABLE users
9b057805
VK
34(
35 id integer not null,
36 name varchar(64) not null,
4c57296d 37 password varchar(48),
f806ed94 38 access integer,
057f9dfb 39 flags integer,
00c79c7b
VK
40 full_name varchar(127),
41 description varchar(255),
9b057805
VK
42 PRIMARY KEY(id)
43);
44
45
6c9e7d36
VK
46/*
47** User groups
48*/
f806ed94 49
feea53fd 50CREATE TABLE user_groups
f806ed94
VK
51(
52 id integer not null,
53 name varchar(64) not null,
54 access integer,
057f9dfb 55 flags integer,
00c79c7b 56 description varchar(255),
f806ed94
VK
57 PRIMARY KEY(id)
58);
59
60
6c9e7d36
VK
61/*
62** Users to groups mapping
63*/
f806ed94 64
feea53fd 65CREATE TABLE user_group_members
f806ed94
VK
66(
67 group_id integer not null,
68 user_id integer not null,
057f9dfb 69 PRIMARY KEY(group_id,user_id)
f806ed94
VK
70);
71
72
6c9e7d36
VK
73/*
74** Nodes to be added
75*/
49826a80 76
feea53fd 77CREATE TABLE new_nodes
49826a80
VK
78(
79 id integer not null,
80 ip_addr integer not null,
81 ip_netmask integer not null,
82 discovery_flags integer not null
83);
84
85
6c9e7d36
VK
86/*
87** Nodes information
88*/
cbcaf8c8 89
feea53fd 90CREATE TABLE nodes
cbcaf8c8 91(
9e6c6d05 92 id integer not null,
cbcaf8c8
VK
93 name varchar(64),
94 status integer,
49826a80 95 is_deleted integer not null,
cbcaf8c8 96 primary_ip integer,
49826a80
VK
97 is_snmp integer,
98 is_agent integer,
99 is_bridge integer,
100 is_router integer,
83f01fdf 101 is_local_mgmt integer,
49826a80 102 snmp_version integer,
a713e82e 103 community varchar(32),
e5c63a9b 104 snmp_oid varchar(255),
49826a80 105 discovery_flags integer,
a713e82e
VK
106 auth_method integer,
107 secret varchar(64),
108 agent_port integer,
109 status_poll_type integer,
f806ed94 110 inherit_access_rights integer,
9e6c6d05
VK
111 PRIMARY KEY(id)
112);
113
114
6c9e7d36
VK
115/*
116** Subnets
117*/
cbcaf8c8 118
feea53fd 119CREATE TABLE subnets
cbcaf8c8 120(
9e6c6d05 121 id integer not null,
cbcaf8c8
VK
122 name varchar(64),
123 status integer,
49826a80 124 is_deleted integer not null,
cbcaf8c8 125 ip_addr integer,
9e6c6d05
VK
126 ip_netmask integer,
127 PRIMARY KEY(id)
cbcaf8c8
VK
128);
129
130
6c9e7d36
VK
131/*
132** Nodes' interfaces
133*/
cbcaf8c8 134
feea53fd 135CREATE TABLE interfaces
cbcaf8c8 136(
9e6c6d05 137 id integer not null,
cbcaf8c8 138 name varchar(64),
49826a80
VK
139 status integer,
140 is_deleted integer,
141 node_id integer not null,
cbcaf8c8
VK
142 ip_addr integer,
143 ip_netmask integer,
49826a80
VK
144 if_type integer,
145 if_index integer,
b51c8c91 146 PRIMARY KEY(id)
cbcaf8c8
VK
147);
148
149
6c9e7d36
VK
150/*
151** Nodes to subnets mapping
152*/
cbcaf8c8 153
a713e82e 154CREATE TABLE nsmap
cbcaf8c8 155(
49826a80
VK
156 subnet_id integer not null,
157 node_id integer not null,
c98d2ec7 158 PRIMARY KEY(subnet_id,node_id)
cbcaf8c8
VK
159);
160
161
6c9e7d36
VK
162/*
163** Objects' ACLs
164*/
f806ed94 165
feea53fd 166CREATE TABLE acl
f806ed94
VK
167(
168 object_id integer not null,
169 user_id integer not null,
170 access_rights integer not null,
c98d2ec7 171 PRIMARY KEY(object_id,user_id)
f806ed94
VK
172);
173
174
6c9e7d36
VK
175/*
176** Data collection items
177*/
cbcaf8c8 178
feea53fd 179CREATE TABLE items
cbcaf8c8 180(
2fa71464 181 item_id integer not null,
b2581e52 182 node_id integer not null,
2fa71464 183 name varchar(255) not null,
cbcaf8c8 184 description varchar(255),
6c9e7d36 185 source integer, // 0 for internal or 1 for native agent or 2 for SNMP
cbcaf8c8
VK
186 datatype integer,
187 polling_interval integer,
b2581e52 188 retention_time integer,
2fa71464 189 status integer, // ACTIVE, DISABLED or NOT_SUPPORTED
c98d2ec7 190 PRIMARY KEY(item_id)
cbcaf8c8
VK
191);
192
193
6c9e7d36
VK
194/*
195** Events configuration
196*/
cbcaf8c8 197
feea53fd 198CREATE TABLE events
cbcaf8c8 199(
59f88625 200 event_id integer not null,
3c468b80 201 name varchar(64) not null, // Short event name
cbcaf8c8 202 severity integer,
c1142e46 203 flags integer,
6c9e7d36
VK
204 message varchar(255), // Message template
205 description DT_TEXT,
c98d2ec7 206 PRIMARY KEY(event_id)
cbcaf8c8
VK
207);
208
209
6c9e7d36
VK
210/*
211** Event log
212*/
cbcaf8c8 213
feea53fd 214CREATE TABLE event_log
cbcaf8c8
VK
215(
216 event_id integer,
217 timestamp integer,
6c9e7d36 218 source integer, // Source object ID
cbcaf8c8 219 severity integer,
c98d2ec7 220 message varchar(255)
cbcaf8c8
VK
221);
222
223
6c9e7d36
VK
224/*
225** Actions on events
226*/
cbcaf8c8 227
feea53fd 228CREATE TABLE actions
cbcaf8c8 229(
b03374f5 230 action_id integer not null,
b6a77d6d
VK
231 action_type integer,
232 email_addr varchar(255),
233 email_subject varchar(255),
234 // Field "action_data" holds message text for e-mail actions or
235 // command line for external command execution actions
236 action_data TEXT,
b03374f5 237 PRIMARY KEY(action_id)
cbcaf8c8 238);
69cc295f
VK
239
240
6c9e7d36
VK
241/*
242** Node groups
243*/
69cc295f 244
feea53fd 245CREATE TABLE node_groups
69cc295f
VK
246(
247 id integer not null,
3c468b80
VK
248 name varchar(64),
249 description varchar(255),
69cc295f
VK
250 PRIMARY KEY(id)
251);
252
253
6c9e7d36
VK
254/*
255** Event groups
256*/
69cc295f 257
feea53fd 258CREATE TABLE event_groups
69cc295f
VK
259(
260 id integer not null,
3c468b80
VK
261 name varchar(64),
262 description varchar(255),
69cc295f
VK
263 PRIMARY KEY(id)
264);
265
266
6c9e7d36
VK
267/*
268** Node group members
269*/
69cc295f 270
feea53fd 271CREATE TABLE node_group_members
69cc295f
VK
272(
273 group_id integer not null,
274 node_id integer not null,
3c468b80 275 PRIMARY KEY(group_id,node_id)
69cc295f
VK
276);
277
278
6c9e7d36
VK
279/*
280** Event group members
281*/
69cc295f 282
feea53fd 283CREATE TABLE event_group_members
69cc295f
VK
284(
285 group_id integer not null,
286 event_id integer not null,
3c468b80 287 PRIMARY KEY(group_id,event_id)
69cc295f
VK
288);
289
290
6c9e7d36
VK
291/*
292** Event processing policy
293*/
69cc295f 294
feea53fd 295CREATE TABLE event_policy
69cc295f 296(
6c9e7d36 297 id integer not null, // Rule number
b6a77d6d 298 flags integer not null,
69cc295f
VK
299 comments varchar(255),
300 PRIMARY KEY(id)
301);
302
feea53fd 303CREATE TABLE policy_source_list
69cc295f
VK
304(
305 rule_id integer not null,
69cc295f 306 object_id integer not null,
3c468b80 307 PRIMARY KEY(rule_id,object_id)
69cc295f
VK
308);
309
feea53fd 310CREATE TABLE policy_event_list
69cc295f
VK
311(
312 rule_id integer not null,
69cc295f 313 event_id integer not null,
b6a77d6d
VK
314 PRIMARY KEY(rule_id,event_id)
315);
316
feea53fd 317CREATE TABLE policy_action_list
b6a77d6d
VK
318(
319 rule_id integer not null,
320 action_id integer not null,
321 PRIMARY KEY(rule_id,action_id)
69cc295f 322);
54f0de5b
VK
323
324
325/*
326** Deleted objects
327*/
328
feea53fd 329CREATE TABLE deleted_objects
54f0de5b
VK
330(
331 object_id integer not null,
332 object_class integer,
333 name varchar(64),
334 ip_addr integer,
335 ip_netmask integer,
336 PRIMARY KEY(object_id)
337);
59f88625
VK
338
339
340/*
341** Threshold checking rules
342*/
343
feea53fd 344CREATE TABLE thresholds
59f88625
VK
345(
346 threshold_id integer not null,
347 item_id integer not null,
348 fire_value varchar(255),
349 rearm_value varchar(255),
2fa71464
VK
350 check_function integer,
351 check_operation integer,
352 parameter_1 integer,
353 parameter_2 integer,
59f88625
VK
354 event_code integer,
355 PRIMARY KEY(threshold_id)
356);
2fa71464
VK
357
358
359/*
360** Data collection templates
361*/
362
feea53fd 363CREATE TABLE dct
2fa71464
VK
364(
365 template_id integer not null,
366 name varchar(255),
367 PRIMARY KEY(template_id)
368);
369
370
371/*
372** Items in data collection templates
373*/
374
feea53fd 375CREATE TABLE dct_items
2fa71464
VK
376(
377 template_id integer not null,
378 item_id integer not null,
379 name varchar(255),
380 description varchar(255),
381 source integer, // 0 for internal or 1 for native agent or 2 for SNMP
382 datatype integer,
383 polling_interval integer,
384 retention_time integer,
385 PRIMARY KEY(template_id,item_id)
386);
387
388
389/*
390** Mapping hosts to templates
391*/
392
feea53fd 393CREATE TABLE dct_host_map
2fa71464
VK
394(
395 template_id integer not null,
396 node_id integer not null,
397 PRIMARY KEY(template_id,node_id)
398);