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