-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from patrickpr/v1.1
version 1.0.2 merge
- Loading branch information
Showing
29 changed files
with
1,147 additions
and
487 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
CREATE TABLE #PREFIX#db_config ( | ||
id serial NOT NULL, | ||
name character varying(100) NOT NULL, | ||
value text, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
INSERT INTO #PREFIX#db_config (name,value) VALUES ('db_version',2); | ||
|
||
CREATE OR REPLACE FUNCTION unix_timestamp(timestamp with time zone) RETURNS bigint AS ' | ||
SELECT EXTRACT(EPOCH FROM $1)::bigint AS result | ||
' LANGUAGE sql; | ||
|
||
CREATE TABLE #PREFIX#mib_cache ( | ||
id serial NOT NULL, | ||
oid character varying(256) NOT NULL, | ||
mib character varying(256) NOT NULL, | ||
name character varying(512) NOT NULL, | ||
type character varying(256) DEFAULT NULL, | ||
textual_convention character varying(256) DEFAULT NULL, | ||
display_hint character varying(256) DEFAULT NULL, | ||
syntax character varying(256) DEFAULT NULL, | ||
type_enum text, | ||
description text, | ||
PRIMARY KEY (id) | ||
) ; | ||
|
||
CREATE TABLE #PREFIX#mib_cache_trap_object ( | ||
id serial NOT NULL, | ||
trap_id bigint NOT NULL, | ||
object_id bigint NOT NULL, | ||
PRIMARY KEY (id), | ||
CONSTRAINT fk_object_id_obj FOREIGN KEY (object_id) | ||
REFERENCES #PREFIX#mib_cache (id) | ||
ON UPDATE CASCADE | ||
ON DELETE CASCADE, | ||
CONSTRAINT FK_trap_id_obj FOREIGN KEY (trap_id) | ||
REFERENCES #PREFIX#mib_cache (id) | ||
ON DELETE CASCADE | ||
ON UPDATE CASCADE | ||
) ; | ||
|
||
CREATE TYPE trapstate AS ENUM | ||
('done', 'waiting', 'unknown', 'error'); | ||
|
||
CREATE TABLE #PREFIX#received ( | ||
id serial NOT NULL, | ||
source_ip character varying(45) DEFAULT NULL, | ||
source_port integer DEFAULT NULL, | ||
destination_ip character varying(45) DEFAULT NULL, | ||
destination_port integer DEFAULT NULL, | ||
trap_oid character varying(256) DEFAULT NULL, | ||
date_received TIMESTAMPTZ NOT NULL, | ||
status trapstate NOT NULL DEFAULT 'waiting', | ||
trap_name character varying(256) DEFAULT NULL, | ||
source_name character varying(256) DEFAULT NULL, | ||
trap_name_mib character varying(100) DEFAULT NULL, | ||
process_time float DEFAULT '0', | ||
status_detail character varying(256) DEFAULT NULL, | ||
PRIMARY KEY (id) | ||
) ; | ||
|
||
CREATE TABLE #PREFIX#received_data ( | ||
id serial NOT NULL, | ||
oid character varying(256) DEFAULT NULL, | ||
value character varying(1024) DEFAULT NULL, | ||
trap_id bigint NOT NULL, | ||
oid_name character varying(256) DEFAULT NULL, | ||
oid_name_mib character varying(100) DEFAULT NULL, | ||
PRIMARY KEY (id), | ||
CONSTRAINT FK_trap_id FOREIGN KEY (trap_id) | ||
REFERENCES #PREFIX#received (id) | ||
ON DELETE CASCADE | ||
) ; | ||
|
||
CREATE TABLE #PREFIX#rules ( | ||
id serial NOT NULL, | ||
ip4 character varying(20) DEFAULT NULL, | ||
ip6 character varying(42) DEFAULT NULL, | ||
trap_oid character varying(256) NOT NULL, | ||
host_name character varying(256) DEFAULT NULL, | ||
host_group_name character varying(256) DEFAULT NULL, | ||
rule text, | ||
action_match smallint NOT NULL DEFAULT '-1', | ||
action_nomatch smallint NOT NULL DEFAULT '-1', | ||
service_name character varying(256) NOT NULL, | ||
revert_ok bigint NOT NULL DEFAULT '3600', | ||
display_nok text, | ||
display text, | ||
created TIMESTAMPTZ DEFAULT NULL, | ||
modified TIMESTAMPTZ DEFAULT NULL, | ||
modifier character varying(100) DEFAULT NULL, | ||
num_match bigint DEFAULT '0', | ||
num_match_nok bigint DEFAULT NULL, | ||
comment text, | ||
rule_type integer DEFAULT NULL, | ||
PRIMARY KEY (id) | ||
) ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
CREATE TABLE `#PREFIX#db_config` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`name` varchar(100) NOT NULL, | ||
`value` mediumtext, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; | ||
|
||
INSERT INTO #PREFIX#db_config (`name`,`value`) VALUES ('db_version',2); | ||
|
||
CREATE TABLE #PREFIX#mib_cache ( | ||
id int(11) NOT NULL AUTO_INCREMENT, | ||
oid varchar(256) NOT NULL, | ||
mib varchar(256) NOT NULL, | ||
name varchar(512) NOT NULL, | ||
type varchar(256) DEFAULT NULL, | ||
textual_convention varchar(256) DEFAULT NULL, | ||
display_hint varchar(256) DEFAULT NULL, | ||
syntax varchar(256) DEFAULT NULL, | ||
type_enum text, | ||
description text, | ||
PRIMARY KEY (id) | ||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; | ||
|
||
CREATE TABLE #PREFIX#mib_cache_trap_object ( | ||
id int(12) NOT NULL AUTO_INCREMENT, | ||
trap_id int(11) NOT NULL, | ||
object_id int(11) NOT NULL, | ||
PRIMARY KEY (id), | ||
KEY FK_trap_id_obj_idx (trap_id), | ||
KEY FK_object_id_obj_idx (object_id), | ||
CONSTRAINT FK_object_id_obj FOREIGN KEY (object_id) REFERENCES #PREFIX#mib_cache (id) ON DELETE CASCADE ON UPDATE CASCADE, | ||
CONSTRAINT FK_trap_id_obj FOREIGN KEY (trap_id) REFERENCES #PREFIX#mib_cache (id) ON DELETE CASCADE ON UPDATE CASCADE | ||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; | ||
|
||
CREATE TABLE `#PREFIX#received` ( | ||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | ||
`source_ip` varchar(45) DEFAULT NULL, | ||
`source_port` smallint(5) unsigned DEFAULT NULL, | ||
`destination_ip` varchar(45) DEFAULT NULL, | ||
`destination_port` smallint(5) unsigned DEFAULT NULL, | ||
`trap_oid` varchar(256) DEFAULT NULL, | ||
`date_received` datetime NOT NULL, | ||
`status` enum('done','waiting','unknown','error') NOT NULL DEFAULT 'waiting', | ||
`trap_name` varchar(256) DEFAULT NULL, | ||
`source_name` varchar(256) DEFAULT NULL, | ||
`trap_name_mib` varchar(100) DEFAULT NULL, | ||
`process_time` float DEFAULT '0', | ||
`status_detail` varchar(256) DEFAULT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; | ||
|
||
CREATE TABLE `#PREFIX#received_data` ( | ||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | ||
`oid` varchar(256) DEFAULT NULL, | ||
`value` varchar(1024) DEFAULT NULL, | ||
`trap_id` int(11) unsigned NOT NULL, | ||
`oid_name` varchar(256) DEFAULT NULL, | ||
`oid_name_mib` varchar(100) DEFAULT NULL, | ||
PRIMARY KEY (`id`), | ||
KEY `FK_trap_id_idx` (`trap_id`), | ||
CONSTRAINT `FK_trap_id` FOREIGN KEY (`trap_id`) REFERENCES `#PREFIX#received` (`id`) ON DELETE CASCADE | ||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; | ||
|
||
CREATE TABLE `#PREFIX#rules` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`ip4` varchar(20) DEFAULT NULL, | ||
`ip6` varchar(42) DEFAULT NULL, | ||
`trap_oid` varchar(256) NOT NULL, | ||
`host_name` varchar(256) DEFAULT NULL, | ||
`host_group_name` varchar(256) DEFAULT NULL, | ||
`rule` text, | ||
`action_match` tinyint(5) NOT NULL DEFAULT '-1', | ||
`action_nomatch` tinyint(5) NOT NULL DEFAULT '-1', | ||
`service_name` varchar(256) NOT NULL, | ||
`revert_ok` int(11) NOT NULL DEFAULT '3600', | ||
`display_nok` text, | ||
`display` text, | ||
`created` datetime DEFAULT NULL, | ||
`modified` datetime DEFAULT NULL, | ||
`modifier` varchar(100) DEFAULT NULL, | ||
`num_match` int(16) DEFAULT '0', | ||
`num_match_nok` int(16) DEFAULT NULL, | ||
`comment` text, | ||
`rule_type` int(8) DEFAULT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#MESSAGE : This upgrade will drop all mib cache table. You will have to do a mib database update in status&mibs -> MIB Management -> Update. | ||
#PRE-SCRIPT : | ||
#POST-SCRIPT : | ||
|
||
DROP TABLE #PREFIX#mib_cache_syntax; | ||
DROP TABLE #PREFIX#mib_cache_tc; | ||
DROP TABLE #PREFIX#mib_cache_trap_object; | ||
DROP TABLE #PREFIX#mib_cache; | ||
|
||
CREATE TABLE #PREFIX#mib_cache ( | ||
id serial NOT NULL, | ||
oid character varying(256) NOT NULL, | ||
mib character varying(256) NOT NULL, | ||
name character varying(512) NOT NULL, | ||
type character varying(256) DEFAULT NULL, | ||
textual_convention character varying(256) DEFAULT NULL, | ||
display_hint character varying(256) DEFAULT NULL, | ||
syntax character varying(256) DEFAULT NULL, | ||
type_enum text, | ||
description text, | ||
PRIMARY KEY (id) | ||
) ; | ||
|
||
CREATE TABLE #PREFIX#mib_cache_trap_object ( | ||
id serial NOT NULL, | ||
trap_id bigint NOT NULL, | ||
object_id bigint NOT NULL, | ||
PRIMARY KEY (id), | ||
CONSTRAINT fk_object_id_obj FOREIGN KEY (object_id) | ||
REFERENCES #PREFIX#mib_cache (id) | ||
ON UPDATE CASCADE | ||
ON DELETE CASCADE, | ||
CONSTRAINT FK_trap_id_obj FOREIGN KEY (trap_id) | ||
REFERENCES #PREFIX#mib_cache (id) | ||
ON DELETE CASCADE | ||
ON UPDATE CASCADE | ||
) ; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#MESSAGE : This upgrade will drop all mib cache table. You will have to do a mib database update in status&mibs -> MIB Management -> Update. | ||
#PRE-SCRIPT : | ||
#POST-SCRIPT : | ||
|
||
DROP TABLE #PREFIX#mib_cache_syntax; | ||
DROP TABLE #PREFIX#mib_cache_tc; | ||
DROP TABLE #PREFIX#mib_cache_trap_object; | ||
DROP TABLE #PREFIX#mib_cache; | ||
|
||
CREATE TABLE #PREFIX#mib_cache ( | ||
id int(11) NOT NULL AUTO_INCREMENT, | ||
oid varchar(256) NOT NULL, | ||
mib varchar(256) NOT NULL, | ||
name varchar(512) NOT NULL, | ||
type varchar(256) DEFAULT NULL, | ||
textual_convention varchar(256) DEFAULT NULL, | ||
display_hint varchar(256) DEFAULT NULL, | ||
syntax varchar(256) DEFAULT NULL, | ||
type_enum text, | ||
description text, | ||
PRIMARY KEY (id) | ||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; | ||
|
||
CREATE TABLE #PREFIX#mib_cache_trap_object ( | ||
id int(12) NOT NULL AUTO_INCREMENT, | ||
trap_id int(11) NOT NULL, | ||
object_id int(11) NOT NULL, | ||
PRIMARY KEY (id), | ||
KEY FK_trap_id_obj_idx (trap_id), | ||
KEY FK_object_id_obj_idx (object_id), | ||
CONSTRAINT FK_object_id_obj FOREIGN KEY (object_id) REFERENCES #PREFIX#mib_cache (id) ON DELETE CASCADE ON UPDATE CASCADE, | ||
CONSTRAINT FK_trap_id_obj FOREIGN KEY (trap_id) REFERENCES #PREFIX#mib_cache (id) ON DELETE CASCADE ON UPDATE CASCADE | ||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.