Minor changes
[public/netxms.git] / sql / schema.sql
CommitLineData
cbcaf8c8
VK
1--
2-- System configuration table
3--
4
49826a80 5CREATE TABLE Config
cbcaf8c8 6(
9e6c6d05
VK
7 name varchar(64) not null,
8 value varchar(255),
9 PRIMARY KEY(name)
cbcaf8c8
VK
10);
11
12
9b057805
VK
13--
14-- Users
15--
16
17CREATE TABLE Users
18(
19 id integer not null,
20 name varchar(64) not null,
21 password varchar(64),
22 PRIMARY KEY(id)
23);
24
25
49826a80
VK
26--
27-- Nodes to be added
28--
29
30CREATE TABLE NewNodes
31(
32 id integer not null,
33 ip_addr integer not null,
34 ip_netmask integer not null,
35 discovery_flags integer not null
36);
37
38
cbcaf8c8
VK
39--
40-- Nodes information
41--
42
49826a80 43CREATE TABLE Nodes
cbcaf8c8 44(
9e6c6d05 45 id integer not null,
cbcaf8c8
VK
46 name varchar(64),
47 status integer,
49826a80 48 is_deleted integer not null,
cbcaf8c8 49 primary_ip integer,
49826a80
VK
50 is_snmp integer,
51 is_agent integer,
52 is_bridge integer,
53 is_router integer,
83f01fdf 54 is_local_mgmt integer,
49826a80 55 snmp_version integer,
a713e82e 56 community varchar(32),
e5c63a9b 57 snmp_oid varchar(255),
49826a80 58 discovery_flags integer,
a713e82e
VK
59 auth_method integer,
60 secret varchar(64),
61 agent_port integer,
62 status_poll_type integer,
9e6c6d05
VK
63 PRIMARY KEY(id)
64);
65
66
cbcaf8c8
VK
67--
68-- Subnets
69--
70
49826a80 71CREATE TABLE Subnets
cbcaf8c8 72(
9e6c6d05 73 id integer not null,
cbcaf8c8
VK
74 name varchar(64),
75 status integer,
49826a80 76 is_deleted integer not null,
cbcaf8c8 77 ip_addr integer,
9e6c6d05
VK
78 ip_netmask integer,
79 PRIMARY KEY(id)
cbcaf8c8
VK
80);
81
82
83--
84-- Nodes' interfaces
85--
86
a713e82e 87CREATE TABLE Interfaces
cbcaf8c8 88(
9e6c6d05 89 id integer not null,
cbcaf8c8 90 name varchar(64),
49826a80
VK
91 status integer,
92 is_deleted integer,
93 node_id integer not null,
cbcaf8c8
VK
94 ip_addr integer,
95 ip_netmask integer,
49826a80
VK
96 if_type integer,
97 if_index integer,
98 PRIMARY KEY(id),
99 KEY(node_id)
cbcaf8c8
VK
100);
101
102
103--
104-- Nodes to subnets mapping
105--
106
a713e82e 107CREATE TABLE nsmap
cbcaf8c8 108(
49826a80
VK
109 subnet_id integer not null,
110 node_id integer not null,
25e01e36 111 KEY (subnet_id)
cbcaf8c8
VK
112);
113
114
115--
116-- Data collection items
117--
118
b2581e52 119CREATE TABLE Items
cbcaf8c8 120(
9e6c6d05 121 id integer not null,
b2581e52 122 node_id integer not null,
cbcaf8c8
VK
123 name varchar(255),
124 description varchar(255),
b2581e52 125 source integer, -- 0 for SNMP or 1 for native agent
cbcaf8c8
VK
126 datatype integer,
127 polling_interval integer,
b2581e52
VK
128 retention_time integer,
129 PRIMARY KEY(id),
130 KEY(node_id)
cbcaf8c8
VK
131);
132
133
134--
135-- Collected data
136--
137
138create table IDATA
139(
140 item_id integer not null,
141 timestamp integer,
142 val_integer integer,
cbcaf8c8
VK
143 val_string varchar(255)
144);
145
146
147--
148-- Events configuration
149--
150
b36b6578 151CREATE TABLE Events
cbcaf8c8 152(
9e6c6d05 153 id integer not null,
cbcaf8c8 154 severity integer,
c1142e46 155 flags integer,
cbcaf8c8 156 message varchar(255), -- Message template
b36b6578
VK
157 description blob,
158 PRIMARY KEY(id)
cbcaf8c8
VK
159);
160
161
162--
163-- Event log
164--
165
c1142e46 166CREATE TABLE EventLog
cbcaf8c8
VK
167(
168 event_id integer,
169 timestamp integer,
c1142e46 170 source integer, -- Source object ID
cbcaf8c8 171 severity integer,
c1142e46
VK
172 message varchar(255),
173 KEY(event_id),
174 KEY(timestamp)
cbcaf8c8
VK
175);
176
177
178--
179-- Actions on events
180--
181
9e6c6d05 182CREATE TABLE ACTIONS
cbcaf8c8 183(
9e6c6d05 184 id integer not null,
cbcaf8c8 185 type integer,
9e6c6d05
VK
186 command varchar(255),
187 PRIMARY KEY(id)
cbcaf8c8 188);
cbcaf8c8 189