2 -- Gnucomo database creation script.
5 -- This SQL script creates the initial tables for the Gnucomo database.
6 -- Before running this script with 'psql -f', you should have your
7 -- DBA create the database and give access permissions.
11 CREATE SEQUENCE "action_actionid_seq";
15 "actionid" bigint DEFAULT nextval('"action_actionid_seq"'::text) NOT NULL,
17 "statuscode" character varying(3),
22 COPY "action" FROM stdin;
23 1 Entry in the system NEW This indicates that a notification has been entered into the system.
24 2 Display to user OPN The notification has been displayed to the user. It doesn't mean that the user actually read the notification, but he/she should be aware. For that reason we consider the notification to be OPEN
25 3 Remarks added PEN Remarks have been added to the notification.
26 4 Priority changed manually PEN The priority of the notification has been changed by the user.
27 5 Priority changed automatically PEN The priority of the notification has been changed by the system. This can be the result of an action by the user or an automatical escalation.
28 6 Action taken PEN An action has been taken.
29 7 Assignment to user PEN The notification has been assigned to an user.
30 8 More information or research needed. INV The notification is relevant and will be handled, however more information or research will be needed. For that reason the status has been altered to UNDER INVESTIGATION.
31 9 Make output reference REF The automated output from an object was sent to gnucomo. The input has been identified as a valid reference for the future. For that reason the status is now REFERENCE
32 10 Job output no longer valid CLS By making a newer job output a valid reference, this data has been obsoleted. Since it was a reference once the output isn't interesting anymore and thus the notification can be closed.
33 11 Action taken - please verify CLS An action has been taken and things should have been resolved. Before the notification can be closed a verification has to be done. The new status is now VERIFY.
34 12 Action not verified PEN A check has been done and the results were not good. New verification is needed. The status has been changed back to PEN.
35 13 Action verified CLS A check has been done and the results were approved. The notification has been closed.
36 15 SMS sent OPN An SMS has been sent.
37 14 E-mail sent OPN An e-mail has been sent.
38 16 Fax sent OPN An fax has been sent.
39 17 Log entries shown \N The log entries relevant to the notification have been shown.
40 18 Notification closed CLS The notification has been closed.
41 19 Notification reopend OPN The notification has been reopend.
44 CREATE UNIQUE INDEX action_actionid_key ON "action" USING btree (actionid);
46 CREATE UNIQUE INDEX act_pk ON "action" USING btree (actionid);
48 CREATE UNIQUE INDEX act_actionname ON "action" USING btree (actionname);
50 CREATE INDEX act_statuscode ON "action" USING btree (statuscode);
52 SELECT setval ('"action_actionid_seq"', 19, true);
57 CREATE SEQUENCE "action_user_actionstepid_seq";
59 CREATE TABLE "action_user"
61 "actionstepid" bigint DEFAULT
62 nextval('"action_user_actionstepid_seq"'::text) NOT NULL,
65 "notificationid" bigint,
66 "timestamp" timestamp with time zone,
67 "statuscode" character varying(3),
71 CREATE UNIQUE INDEX action_user_actionstepid_key ON action_user USING btree (actionstepid);
73 CREATE INDEX anu_actionid ON action_user USING btree (actionid);
75 CREATE INDEX anu_username ON action_user USING btree (username);
77 CREATE INDEX anu_notificationid ON action_user USING btree (notificationid);
79 CREATE INDEX anu_timestamp ON action_user USING btree ("timestamp");
81 CREATE INDEX anu_statuscode ON action_user USING btree (statuscode);
83 SELECT setval ('"action_user_actionstepid_seq"', 1, false);
88 CREATE SEQUENCE "log_logid_seq";
92 "logid" bigint DEFAULT nextval('"log_logid_seq"'::text) NOT NULL,
94 "original_filename" text,
96 "object_timestamp" timestamp with time zone,
97 "timestamp" timestamp with time zone,
101 CREATE UNIQUE INDEX log_logid_key ON log USING btree (logid);
103 CREATE INDEX log_objectid ON log USING btree (objectid);
105 CREATE INDEX log_original_filename ON log USING btree (original_filename);
107 CREATE INDEX log_servicecode ON log USING btree (servicecode);
109 CREATE INDEX log_object_timestmap ON log USING btree ("timestamp");
111 CREATE INDEX log_timestmap ON log USING btree ("timestamp");
113 CREATE INDEX log_timestamp ON log USING btree (object_timestamp);
115 SELECT setval ('"log_logid_seq"', 1, false);
120 CREATE TABLE "log_adv"
124 "destination_ip" inet,
125 "mac_address" macaddr,
126 "packetlength" integer,
128 "source_port" integer,
129 "destination_port" integer,
131 "system_username" text,
135 CREATE INDEX loa_logid ON log_adv USING btree (logid);
137 CREATE INDEX loa_source_ip ON log_adv USING btree (source_ip);
139 CREATE INDEX loa_destination_ip ON log_adv USING btree (destination_ip);
141 CREATE INDEX loa_mac_address ON log_adv USING btree (mac_address);
143 CREATE INDEX loa_packetlength ON log_adv USING btree (packetlength);
145 CREATE INDEX loa_protocol ON log_adv USING btree (protocol);
147 CREATE INDEX loa_source_port ON log_adv USING btree (source_port);
149 CREATE INDEX loa_destination_port ON log_adv USING btree (destination_port);
151 CREATE INDEX loa_messageid ON log_adv USING btree (messageid);
153 CREATE INDEX loa_system_username ON log_adv USING btree (system_username);
155 CREATE INDEX loa_networkdevice ON log_adv USING btree (networkdevice);
160 CREATE TABLE "log_notification"
162 "notificationid" bigint,
166 CREATE UNIQUE INDEX lon_pk ON log_notification USING btree (notificationid, logid);
168 CREATE UNIQUE INDEX lon_notificationid ON log_notification USING btree (notificationid);
170 CREATE UNIQUE INDEX lon_logid ON log_notification USING btree (logid);
175 CREATE SEQUENCE "notification_notificationid_seq";
177 CREATE TABLE "notification"
179 "notificationid" bigint DEFAULT
180 nextval('"notification_notificationid_seq"'::text) NOT NULL,
182 "type_of_notificationid" bigint,
183 "timestamp" timestamp with time zone,
184 "statuscode" character varying(3),
186 "escalation_count_timestamp" timestamp with time zone,
187 "repeat_notification_timestamp" timestamp with time zone,
188 "securitylevel_view" integer,
189 "securitylevel_add" integer,
190 "securitylevel_close" integer
193 CREATE UNIQUE INDEX notification_notificationid_key ON notification USING btree (notificationid);
195 CREATE INDEX not_objectid ON notification USING btree (objectid);
197 CREATE INDEX not_type_of_notificationid ON notification USING btree (type_of_notificationid);
199 CREATE INDEX not_timestamp ON notification USING btree ("timestamp");
201 CREATE INDEX not_statuscode ON notification USING btree (statuscode);
203 CREATE INDEX not_priority ON notification USING btree (priority);
205 CREATE INDEX not_escalation_count_timestamp ON notification USING btree (escalation_count_timestamp);
207 CREATE INDEX not_repeat_notification_timesta ON notification USING btree (repeat_notification_timestamp);
209 SELECT setval ('"notification_notificationid_seq"', 1, false);
214 CREATE SEQUENCE "object_objectid_seq";
216 CREATE TABLE "object"
218 "objectid" bigint DEFAULT nextval('"object_objectid_seq"'::text) NOT NULL,
221 "scp_enabled" boolean,
223 "mail_enabled" boolean,
225 "sms_enabled" boolean,
227 "fax_enabled" boolean,
229 "object_description" text,
231 "physical_location" text,
236 CREATE UNIQUE INDEX object_objectid_key ON object USING btree (objectid);
238 CREATE UNIQUE INDEX obj_objectname ON object USING btree (objectname);
240 CREATE UNIQUE INDEX obj_objectcode ON object USING btree (objectcode);
242 CREATE INDEX obj_mail_from ON object USING btree (mail_from);
244 SELECT setval ('"object_objectid_seq"', 1, false);
249 CREATE TABLE "object_issue"
252 "type_of_notificationid" bigint,
253 "default_priority" integer,
254 "escalation" boolean,
255 "escalation_time" time without time zone,
256 "max_priority" integer,
257 "adjust_setting" text
260 CREATE UNIQUE INDEX obj_pk ON object_issue USING btree (objectid, type_of_notificationid);
262 CREATE INDEX obj_objectid ON object_issue USING btree (objectid);
264 CREATE UNIQUE INDEX obj_type_of_notificationid ON object_issue USING btree (type_of_notificationid);
269 CREATE TABLE "object_priority"
272 "priorityid" integer,
276 "repeat_notification" boolean,
277 "interval_for_repeat" time without time zone
280 CREATE UNIQUE INDEX obi_pk ON object_priority USING btree (objectid, priorityid);
282 CREATE INDEX obi_objectid ON object_priority USING btree (objectid);
284 CREATE INDEX obi_priorityid ON object_priority USING btree (priorityid);
289 CREATE TABLE "object_service"
293 "expected_interval" bigint,
294 "last_entry" timestamp with time zone,
295 "default_priority" integer,
296 "maximum_priority" integer,
300 CREATE UNIQUE INDEX obs_pk ON object_service USING btree (objectid, servicecode);
302 CREATE INDEX obs_objectid ON object_service USING btree (objectid);
304 CREATE INDEX obs_servicecode ON object_service USING btree (servicecode);
306 CREATE INDEX obs_accepted ON object_service USING btree (accepted);
311 CREATE TABLE "object_system_user"
314 "system_username" text,
316 "can_be_root" boolean
319 CREATE UNIQUE INDEX osu_pk ON object_system_user USING btree (objectid, system_username);
321 CREATE INDEX osu_objectid ON object_system_user USING btree (objectid);
323 CREATE INDEX osu_system_username ON object_system_user USING btree (system_username);
328 CREATE TABLE "object_user"
332 "security_level" integer
335 CREATE UNIQUE INDEX ous_pk ON object_user USING btree (objectid, username);
337 CREATE INDEX ous_objectid ON object_user USING btree (objectid);
339 CREATE INDEX ous_username ON object_user USING btree (username);
341 CREATE INDEX ous_security_level ON object_user USING btree (security_level);
346 CREATE TABLE "priority"
352 "repeat_notification" boolean,
353 "interval_for_repeat" time without time zone
357 CREATE UNIQUE INDEX pri_pk ON priority USING btree (priority);
362 CREATE TABLE "service"
366 "default_priority" integer,
367 "max_priority" integer
370 CREATE UNIQUE INDEX ser_pk ON service USING btree (servicecode);
372 CREATE UNIQUE INDEX ser_servicename ON service USING btree (servicename);
377 CREATE TABLE "status"
379 "statuscode" character varying(3),
381 "open_notification" boolean,
386 COPY "status" FROM stdin;
387 new new entry t Just detected, but nothing has been done yet
388 opn open notification t The notification has been displayed to a user or a user has been notified. However nothing has been done yet.
389 pen pending t The notification is currently being worked on.
390 ver waiting for verification t The notification has been worked on and is currently awaiting the approval/verification.
391 rej rejected f The notification has been identified as a false postive and was reject. The notification is now closed
392 cls closed f The notification has been closed
393 inv needs investigation t The notification is currently under investigation and is awaiting additional details before one can work on this again.
396 CREATE UNIQUE INDEX sta_pk ON status USING btree (statuscode);
398 CREATE UNIQUE INDEX sta_statusname ON status USING btree (statusname);
400 CREATE INDEX sta_open_notification ON status USING btree (open_notification);
405 CREATE SEQUENCE "type_of_issue_type_of_issue_seq";
407 CREATE TABLE "type_of_issue"
409 "type_of_issueid" bigint DEFAULT
410 nextval('"type_of_issue_type_of_issue_seq"'::text) NOT NULL,
412 "suggested_priority" text,
418 COPY "type_of_issue" FROM stdin;
419 1 manual entry 4 A manual entry of a notification t
422 CREATE UNIQUE INDEX type_of_issue_type_of_issue_key ON type_of_issue USING btree (type_of_issueid);
424 CREATE UNIQUE INDEX toi_name ON type_of_issue USING btree (name);
426 CREATE INDEX toi_active ON type_of_issue USING btree (active);
428 SELECT setval ('"type_of_issue_type_of_issue_seq"', 1, true);
433 CREATE SEQUENCE "unprocessed_l_unprocessedid_seq";
435 CREATE TABLE "unprocessed_log"
437 "unprocessedid" bigint DEFAULT
438 nextval('"unprocessed_l_unprocessedid_seq"'::text) NOT NULL,
443 CREATE UNIQUE INDEX unprocessed_l_unprocessedid_key ON unprocessed_log USING btree (unprocessedid);
445 SELECT setval ('"unprocessed_l_unprocessedid_seq"', 1, false);
450 CREATE TABLE "user_gnucomo"
454 "active_sessionid" bigint,
455 "account_active" boolean,
456 "security_level" integer
459 CREATE UNIQUE INDEX usr_pk ON user_gnucomo USING btree (username);
461 CREATE INDEX usr_active_sessionid ON user_gnucomo USING btree (active_sessionid);