2011-03-18 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* pandoradb.oracle.sql
        pandoradb.data.oracle.sql: First version of pandora's DB schema and data for 
	Oracle DBMS.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4109 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-03-18 13:23:12 +00:00
parent b2e96fa8f2
commit 7a3afcbd81
3 changed files with 1429 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2011-03-18 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* pandoradb.oracle.sql
pandoradb.data.oracle.sql: First version of pandora's DB schema and data for
Oracle DBMS.
2011-03-17 Raul Mateos <raulofpandora@gmail.com>
* extensions/dbmanager.php, extensions/pandora_logs.php, general/*.php,

View File

@ -0,0 +1,578 @@
-- Pandora FMS - the Flexible Monitoring System
-- ============================================
-- Copyright (c) 2011 Artica Soluciones Tecnologicas, http://www.artica.es
-- Please see http://www.pandorafms.org for full contribution list
-- This program is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License
-- as published by the Free Software Foundation for version 2.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-- Database Data for Pandora FMS 4.0dev
-- PLEASE NO NOT USE MULTILINE COMMENTS
-- Because Pandora Installer don't understand them
-- and fails creating database !!!
SET ESCAPE \
-- Dumping data for table talert_commands
--
BEGIN
LOCK TABLE talert_commands IN EXCLUSIVE MODE;
INSERT INTO talert_commands VALUES (1,'eMail','Internal type', 'This alert send an email using internal Pandora FMS Server SMTP capabilities (defined in each server, using:\r\n_field1_ as destination email address, and\r\n_field2_ as subject for message. \r\n_field3_ as text of message.', 1);
INSERT INTO talert_commands VALUES (2,'Internal Audit','Internal type','This alert save alert in Pandora interal audit system. Fields are static and only _field1_ is used.', 1);
INSERT INTO talert_commands VALUES (3,'Pandora FMS Event','Internal type','This alert create an special event into Pandora FMS event manager.', 1);
INSERT INTO talert_commands VALUES (4,'Pandora FMS Alertlog','echo _timestamp_ pandora _agent_ _data_ _field1_ _field2_ >> /var/log/pandora/pandora_alert.log','This is a default alert to write alerts in a standard ASCII plaintext log file in /var/log/pandora/pandora_alert.log\r\n', 0);
INSERT INTO talert_commands VALUES (5,'SNMP Trap','/usr/bin/snmptrap -v 1 -c trap_public 192.168.0.4 1.1.1.1.1.1.1.1 _agent_ _field1_','Send a SNMPTRAP to 192.168.0.4. Please review config and adapt to your needs, this is only a sample, not functional itself.', 0);
INSERT INTO talert_commands VALUES (6,'Syslog','logger -p daemon.alert Pandora Alert _agent_ _data_ _field1_ _field2_','Uses field1 and field2 to generate Syslog alert in facility daemon with "alert" level.', 0);
INSERT INTO talert_commands VALUES (7,'Sound Alert','/usr/bin/play /usr/share/sounds/alarm.wav','', 0);
INSERT INTO talert_commands VALUES (8,'Jabber Alert','echo _field3_ | sendxmpp -r _field1_ --chatroom _field2_','Send jabber alert to chat room in a predefined server (configure first .sendxmpprc file). Uses field3 as text message, field1 as useralias for source message, and field2 for chatroom name', 0);
INSERT INTO talert_commands VALUES (9,'SMS','sendsms _field1_ _field2_','Send SMS using the Pandora FMS standard SMS device, using smstools. Uses field2 as text message, field1 as destination phone (include international prefix!)', 0);
COMMIT;
END;
/
--
-- Dumping data for table tconfig
--
BEGIN
LOCK TABLE tconfig IN EXCLUSIVE MODE;
INSERT INTO tconfig (token, value) VALUES ('language','en_GB');
INSERT INTO tconfig (token, value) VALUES ('block_size','20');
INSERT INTO tconfig (token, value) VALUES ('days_purge','60');
INSERT INTO tconfig (token, value) VALUES ('days_compact','15');
INSERT INTO tconfig (token, value) VALUES ('graph_res','5');
INSERT INTO tconfig (token, value) VALUES ('step_compact','1');
INSERT INTO tconfig (token, value) VALUES ('db_scheme_version','4.0-dev');
INSERT INTO tconfig (token, value) VALUES ('db_scheme_build','PD110122');
INSERT INTO tconfig (token, value) VALUES ('show_unknown','0');
INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1');
INSERT INTO tconfig (token, value) VALUES ('style','pandora');
INSERT INTO tconfig (token, value) VALUES ('remote_config', '/var/spool/pandora/data_in');
INSERT INTO tconfig (token, value) VALUES ('graph_color1', '#38B800');
INSERT INTO tconfig (token, value) VALUES ('graph_color2', '#42D100');
INSERT INTO tconfig (token, value) VALUES ('graph_color3', '#89FF09');
INSERT INTO tconfig (token, value) VALUES ('sla_period', '604800');
INSERT INTO tconfig (token, value) VALUES ('trap2agent', '0');
INSERT INTO tconfig (token, value) VALUES ('date_format', 'F j, Y, g:i a');
INSERT INTO tconfig (token, value) VALUES ('event_view_hr', 8);
INSERT INTO tconfig (token, value) VALUES ('loginhash_pwd', ' ');
INSERT INTO tconfig (token, value) VALUES ('trap2agent', 0);
INSERT INTO tconfig (token, value) VALUES ('prominent_time', 0);
INSERT INTO tconfig (token, value) VALUES ('timesource', 'system');
INSERT INTO tconfig (token, value) VALUES ('realtimestats', '1');
INSERT INTO tconfig (token, value) VALUES ('stats_interval', '60');
INSERT INTO tconfig (token, value) VALUES ('activate_gis', '0');
INSERT INTO tconfig (token, value) VALUES ('timezone', 'Europe/Berlin');
INSERT INTO tconfig (token, value) VALUES ('string_purge', 7);
INSERT INTO tconfig (token, value) VALUES ('audit_purge', 15);
INSERT INTO tconfig (token, value) VALUES ('trap_purge', 7);
INSERT INTO tconfig (token, value) VALUES ('event_purge', 15);
INSERT INTO tconfig (token, value) VALUES ('gis_purge', 15);
INSERT INTO tconfig (token, value) VALUES ('sound_alert', 'include/sounds/air_shock_alarm.wav');
INSERT INTO tconfig (token, value) VALUES ('sound_critical', 'include/sounds/Star_Trek_emergency_simulation.wav');
INSERT INTO tconfig (token, value) VALUES ('sound_warning', 'include/sounds/negativebeep.wav');
COMMIT;
END;
/
--
-- Dumping data for table "tconfig_os"
--
BEGIN
LOCK TABLE tconfig_os IN EXCLUSIVE MODE;
INSERT INTO tconfig_os VALUES (1,'Linux','Linux: All versions','so_linux.png');
INSERT INTO tconfig_os VALUES (2,'Solaris','Sun Solaris','so_solaris.png');
INSERT INTO tconfig_os VALUES (3,'AIX','IBM AIX','so_aix.png');
INSERT INTO tconfig_os VALUES (4,'BSD','OpenBSD, FreeBSD and Others','so_bsd.png');
INSERT INTO tconfig_os VALUES (5,'HP-UX','HP-UX Unix OS','so_hpux.png');
INSERT INTO tconfig_os VALUES (7,'Cisco','CISCO IOS','so_cisco.png');
INSERT INTO tconfig_os VALUES (8,'MacOS','MAC OS','so_mac.png');
INSERT INTO tconfig_os VALUES (9,'Windows','Microsoft Windows OS','so_win.png');
INSERT INTO tconfig_os VALUES (10,'Other','Other SO','so_other.png');
INSERT INTO tconfig_os VALUES (11,'Network','Pandora FMS Network Agent','network.png');
INSERT INTO tconfig_os VALUES (12,'Web Server','Web Server/Application','network.png');
INSERT INTO tconfig_os VALUES (13,'Octopods','Octopods Pandora FMS Hardware Agent','network.png');
INSERT INTO tconfig_os VALUES (14,'Embedded','Embedded device running a Pandora FMS agent','embedded.png');
INSERT INTO tconfig_os VALUES (15,'Android','Android agent','android.png');
COMMIT;
END;
/
--
-- Dumping data for table "tgrupo"
--
BEGIN
LOCK TABLE tgrupo IN EXCLUSIVE MODE;
INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id) VALUES (2,'Servers','server_database',0,0,0,'');
INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id) VALUES (4,'Firewalls','firewall',0,0,0,'');
INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id) VALUES (8,'Databases','database_gear',0,0,0,'');
INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id) VALUES (9,'Network','transmit',0,0,0,'');
INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id) VALUES (10,'Unknown','world',0,0,0,'');
INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id) VALUES (11,'Workstations','computer',0,0,0,'');
INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id) VALUES (12,'Applications','applications',0,0,0,'');
INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id) VALUES (13,'Web','world',0,0,0,'');
COMMIT;
END;
/
--
-- Dumping data for table "tlanguage"
--
BEGIN
LOCK TABLE tlanguage IN EXCLUSIVE MODE;
INSERT INTO tlanguage VALUES ('en_GB','English');
INSERT INTO tlanguage VALUES ('es','Español');
INSERT INTO tlanguage VALUES ('ar','العربية');
INSERT INTO tlanguage VALUES ('ast','Asturianu');
INSERT INTO tlanguage VALUES ('bn', 'বাংলা');
INSERT INTO tlanguage VALUES ('ca','Catalá');
INSERT INTO tlanguage VALUES ('cs','Česky');
INSERT INTO tlanguage VALUES ('da','Dansk');
INSERT INTO tlanguage VALUES ('de','Deutch');
INSERT INTO tlanguage VALUES ('eu','Euskara');
INSERT INTO tlanguage VALUES ('el','Ελληνικά');
INSERT INTO tlanguage VALUES ('fi','Suomi');
INSERT INTO tlanguage VALUES ('fr','Français');
INSERT INTO tlanguage VALUES ('gl','Galego');
INSERT INTO tlanguage VALUES ('he','עברית');
INSERT INTO tlanguage VALUES ('hi','हिन्दी');
INSERT INTO tlanguage VALUES ('hu','Magyar');
INSERT INTO tlanguage VALUES ('it','Italiano');
INSERT INTO tlanguage VALUES ('ja','日本語');
INSERT INTO tlanguage VALUES ('ko','한국어');
INSERT INTO tlanguage VALUES ('nl','Nederlands');
INSERT INTO tlanguage VALUES ('pl','Polski');
INSERT INTO tlanguage VALUES ('pt_BR','Português-Brasil');
INSERT INTO tlanguage VALUES ('pt','Português');
INSERT INTO tlanguage VALUES ('ro','Română');
INSERT INTO tlanguage VALUES ('ru','Русский');
INSERT INTO tlanguage VALUES ('sk','Slovenčina');
INSERT INTO tlanguage VALUES ('sl','Slovenščina');
INSERT INTO tlanguage VALUES ('sv','Svenska');
INSERT INTO tlanguage VALUES ('te','తెలుగు');
INSERT INTO tlanguage VALUES ('tr','Türkçe');
INSERT INTO tlanguage VALUES ('uk','Українська');
INSERT INTO tlanguage VALUES ('zh_CN','简化字');
INSERT INTO tlanguage VALUES ('zh_TW','簡化字');
COMMIT;
END;
/
--
-- Dumping data for table "tlink"
--
BEGIN
LOCK TABLE tlink IN EXCLUSIVE MODE;
INSERT INTO tlink VALUES (1,'Pandora FMS Manual','https://openideas.info/wiki/index.php?title=Pandora');
INSERT INTO tlink VALUES (2,'Pandora FMS','http://pandorafms.org');
INSERT INTO tlink VALUES (3,'Report a bug','{https://sourceforge.net/tracker/?func=add\&amp;group_id=155200\&amp;atid=794852}');
INSERT INTO tlink VALUES (4,'Suggest new feature','http://sourceforge.net/tracker/?group_id=155200\&amp;atid=794855');
INSERT INTO tlink VALUES (5,'Module library','http://pandorafms.org/?sec=community\&amp;sec2=repository\&amp;lng=es');
INSERT INTO tlink VALUES (6,'Commercial support','http://pandorafms.com');
COMMIT;
END;
--
-- Dumping data for table "tmodule_group"
--
BEGIN
LOCK TABLE tmodule_group IN EXCLUSIVE MODE;
INSERT INTO tmodule_group VALUES (1,'General');
INSERT INTO tmodule_group VALUES (2,'Networking');
INSERT INTO tmodule_group VALUES (3,'Application');
INSERT INTO tmodule_group VALUES (4,'System');
INSERT INTO tmodule_group VALUES (5,'Miscellaneous');
INSERT INTO tmodule_group VALUES (6,'Performance');
INSERT INTO tmodule_group VALUES (7,'Database');
INSERT INTO tmodule_group VALUES (8,'Enviromental');
INSERT INTO tmodule_group VALUES (9,'Users');
COMMIT;
END;
/
--
-- Dumping data for table "torigen"
--
BEGIN
LOCK TABLE torigen IN EXCLUSIVE MODE;
INSERT INTO torigen VALUES ('Operating System event');
INSERT INTO torigen VALUES ('Firewall records');
INSERT INTO torigen VALUES ('Database event');
INSERT INTO torigen VALUES ('Application data');
INSERT INTO torigen VALUES ('Logfiles');
INSERT INTO torigen VALUES ('Other data source');
INSERT INTO torigen VALUES ('Pandora FMS Event');
INSERT INTO torigen VALUES ('User report');
INSERT INTO torigen VALUES ('Unknown source');
COMMIT;
END;
/
--
-- Dumping data for table "ttipo_modulo"
--
-- Identifiers 30 and 31 are reserved for Enterprise data types
BEGIN
LOCK TABLE ttipo_modulo IN EXCLUSIVE MODE;
INSERT INTO ttipo_modulo VALUES (1,'generic_data',0,'Generic numeric','mod_data.png');
INSERT INTO ttipo_modulo VALUES (2,'generic_proc',1,'Generic boolean','mod_proc.png');
INSERT INTO ttipo_modulo VALUES (3,'generic_data_string',2,'Generic string','mod_string.png');
INSERT INTO ttipo_modulo VALUES (4,'generic_data_inc',0,'Generic numeric incremental','mod_data_inc.png');
INSERT INTO ttipo_modulo VALUES (6,'remote_icmp_proc',4,'Remote ICMP network agent, boolean data','mod_icmp_proc.png');
INSERT INTO ttipo_modulo VALUES (7,'remote_icmp',3,'Remote ICMP network agent (latency)','mod_icmp_data.png');
INSERT INTO ttipo_modulo VALUES (8,'remote_tcp',3,'Remote TCP network agent, numeric data','mod_tcp_data.png');
INSERT INTO ttipo_modulo VALUES (9,'remote_tcp_proc',4,'Remote TCP network agent, boolean data','mod_tcp_proc.png');
INSERT INTO ttipo_modulo VALUES (10,'remote_tcp_string',5,'Remote TCP network agent, alphanumeric data','mod_tcp_string.png');
INSERT INTO ttipo_modulo VALUES (11,'remote_tcp_inc',3,'Remote TCP network agent, incremental data','mod_tcp_inc.png');
INSERT INTO ttipo_modulo VALUES (15,'remote_snmp',3,'Remote SNMP network agent, numeric data','mod_snmp_data.png');
INSERT INTO ttipo_modulo VALUES (16,'remote_snmp_inc',3,'Remote SNMP network agent, incremental data','mod_snmp_inc.png');
INSERT INTO ttipo_modulo VALUES (17,'remote_snmp_string',5,'Remote SNMP network agent, alphanumeric data','mod_snmp_string.png');
INSERT INTO ttipo_modulo VALUES (18,'remote_snmp_proc',4,'Remote SNMP network agent, boolean data','mod_snmp_proc.png');
INSERT INTO ttipo_modulo VALUES (21,'async_proc', 7, 'Asyncronous proc data', 'mod_async_proc.png');
INSERT INTO ttipo_modulo VALUES (22,'async_data', 6, 'Asyncronous numeric data', 'mod_async_data.png');
INSERT INTO ttipo_modulo VALUES (23,'async_string', 8, 'Asyncronous string data', 'mod_async_string.png');
INSERT INTO ttipo_modulo VALUES (24,'log4x',0,'Log4x','mod_log4x.png');
INSERT INTO ttipo_modulo VALUES (100,'keep_alive',-1,'KeepAlive','mod_keepalive.png');
COMMIT;
END;
/
-- Categoria field is used to segregate several types
-- (plugin, agents, network) on their data
-- types, could be used or could be avoided and use directly primary key (id_tipo)
--
-- Dumping data for table "tusuario"
--
BEGIN
LOCK TABLE tusuario IN EXCLUSIVE MODE;
INSERT INTO tusuario (id_user, fullname, firstname, lastname, middlename, password, comments, last_connect, registered, email, phone, is_admin) VALUES
('admin', 'Pandora', 'Pandora', 'Admin', ' ', '1da7ee7d45b96d0e1f45ee4ee23da560', 'Admin Pandora', 1232642121, 0, 'admin@example.com', '555-555-5555', 1);
COMMIT;
END;
/
--
-- Dumping data for table "tusuario_perfil"
--
BEGIN
LOCK TABLE tusuario_perfil IN EXCLUSIVE MODE;
INSERT INTO tusuario_perfil VALUES (1,'admin',5,0,'admin');
COMMIT;
END;
/
--
-- Dumping data for table "tperfil"
--
BEGIN
LOCK TABLE tperfil IN EXCLUSIVE MODE;
INSERT INTO tperfil VALUES (1,'Operator&#x20;&#40;Read&#41;',0,1,0,1,0,0,0,0,0,0);
INSERT INTO tperfil VALUES (2,'Operator&#x20;&#40;Write&#41;',1,1,0,1,0,0,0,0,0,0);
INSERT INTO tperfil VALUES (3,'Chief&#x20;Operator',1,1,1,1,0,0,0,0,1,0);
INSERT INTO tperfil VALUES (4,'Group&#x20;coordinator',1,1,1,1,1,1,1,0,0,0);
INSERT INTO tperfil VALUES (5,'Pandora&#x20;Administrator',1,1,1,1,1,1,1,1,1,1);
COMMIT;
END;
/
--
-- Dumping data for table "tnews"
--
BEGIN
LOCK TABLE tnews IN EXCLUSIVE MODE;
INSERT INTO tnews (id_news, author, subject, text, timestamp) VALUES (1,'admin','Welcome to Pandora FMS 3.2!','This is the new Pandora FMS Console. A lot of new features have been added since last version. Please read the documentation about it, and feel free to test any option.\r\n\r\nThe Pandora FMS Team.',current_timestamp);
INSERT INTO tnews (id_news, author, subject, text, timestamp) VALUES (2,'admin','New GIS Feature','Try our new GIS representation, activate GIS in Setup to see new available options.',current_timestamp);
COMMIT;
END;
/
--
-- Dumping data for table "tmodule"
--
BEGIN
LOCK TABLE tmodule IN EXCLUSIVE MODE;
INSERT INTO tmodule VALUES (1,'Agent&#x20;module');
INSERT INTO tmodule VALUES (2,'Network&#x20;module');
INSERT INTO tmodule VALUES (4,'Plugin&#x20;module');
INSERT INTO tmodule VALUES (5,'Prediction&#x20;module');
INSERT INTO tmodule VALUES (6,'WMI&#x20;module');
COMMIT;
END;
/
--
-- Dumping data for table "tnetwork_component"
--
BEGIN
LOCK TABLE tnetwork_component IN EXCLUSIVE MODE;
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (1,'OS Total process','Total process in Operating System (UNIX MIB)',13,15,0,0,180,0,' ',' ','public','HOST-RESOURCES-MIB::hrSystemProcesses.0 ',4,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (2,'OS CPU Load (1 min)','CPU Load in Operating System (UNIX MIB)',13,15,0,0,180,0,' ',' ','public','UCD-SNMP-MIB::laLoad.1',4,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (3,'Sysname','Get name of system using SNMP standard MIB',1,17,0,0,900,0,' ',' ','public','.1.3.6.1.2.1.1.1.0',1,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (4,'OS Users','Active users in Operating System (UNIX MIB)',13,15,0,0,180,0,' ',' ','public','HOST-RESOURCES-MIB::hrSystemNumUsers.0',4,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (11,'Catalyst CPU Usage (5min)','Cisco Catalyst Switches CPU Usage. Taken from ftp://ftp.cisco.com/pub/mibs/oid/OLD-CISCO-CPU-MIB.oid',2,15,0,0,180,0,' ',' ','public','1.3.6.1.4.1.9.2.1.58',4,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (22,'HSRP Status','Get status of HSRP',2,18,0,0,180,0,' ',' ','public','1.3.6.1.4.1.9.9.106.1.2.1.1.15.12.106',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (24,'NIC #1 status','Status of NIC#1',10,18,0,0,180,0,' ',' ','public','.1.3.6.1.2.1.2.2.1.8.1',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (25,'NIC #2 status','Status of NIC #2',10,18,0,0,180,0,' ',' ','public','.1.3.6.1.2.1.2.2.1.8.2',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (26,'NIC #3 status','Status of NIC #3',10,18,0,0,180,0,' ',' ','public','.1.3.6.1.2.1.2.2.1.8.3',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (27,'NIC #1 outOctects','Output throughtput on Interface #1',10,16,0,0,180,0,' ',' ','public','.1.3.6.1.2.1.2.2.1.16.1',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (28,'NIC #2 outOctects','Output troughtput on interface #2',10,16,0,0,180,0,' ',' ','public','.1.3.6.1.2.1.2.2.1.16.2',1,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (29,'NIC #3 outOctects','Output troughtput on Interface #3',10,16,0,0,180,0,' ',' ','public','.1.3.6.1.2.1.2.2.1.16.3',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (30,'NIC #1 inOctects','Input troughtput on Interface #1',10,16,0,0,180,0,' ',' ','public','.1.3.6.1.2.1.2.2.1.10.1',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (31,'NIC #2 inOctects','Input throughtput for interface #2',10,16,0,0,180,0,' ','NULL','public','.1.3.6.1.2.1.2.2.1.10.2',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (32,'NIC #3 inOctects','Input throught on interface #3',10,16,0,0,180,0,' ',' ','public','.1.3.6.1.2.1.2.2.1.10.3',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (34,'Host Alive','Check if host is alive using ICMP ping check.',10,6,0,0,120,0,' ',' ',' ',' ',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (36,'Host Latency','Get host network latency in miliseconds, using ICMP.',10,7,0,0,180,0,' ',' ',' ',' ',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (37,'Check HTTP Server','Test APACHE2 HTTP service remotely (Protocol response, not only openport)',10,9,0,0,300,80,'GET / HTTP/1.0^M^M','HTTP/1.1 200 OK',' ',' ',3,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (38,'Check FTP Server','Check FTP protocol, not only check port.',10,9,0,0,300,21,'QUIT','220',' ',' ',3,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (39,'Check SSH Server','Checks port 22 is opened',10,9,0,0,300,22,' ',' ',' ',' ',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (40,'Check Telnet server','Check telnet port',10,9,0,0,300,23,' ',' ',' ',' ',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (41,'Check SMTP server','Check if SMTP port it&#039;s open',10,9,0,0,300,25,' ',' ',' ',' ',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (42,'Check POP3 server','Check POP3 port.',10,9,0,0,300,110,' ',' ',' ',' ',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (43,'NIC #7 outOctects','Get outcoming octects from NIC #7',10,16,0,0,180,0,' ',' ','public','.1.3.6.1.2.1.2.2.1.16.7',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (44,'NIC #7 inOctects','Get incoming octects from NIC #7',10,16,0,0,180,0,' ',' ','public','.1.3.6.1.2.1.2.2.1.10.7',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (45,'NIC #4 Status','Get status of NIC #4',10,18,0,0,180,0,' ',' ','public','.1.3.6.1.2.1.2.2.1.8.4',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (46,'NIC #5 Status','Get status of NIC #5',10,18,0,0,180,0,' ',' ','public','.1.3.6.1.2.1.2.2.1.8.5',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (47,'NIC #6 Status','Get status of NIC #6',10,18,0,0,180,0,' ',' ','public','.1.3.6.1.2.1.2.2.1.8.6',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (48,'NIC #7 Status','Get status of NIC #7',10,18,0,0,180,0,' ',' ','public','.1.3.6.1.2.1.2.2.1.8.7',2,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (49,'OS CPU Load (5 min)','CPU load on a 5 min average interval. UCD-SNMP Mib (Usually for all Linux and some UNIX)',13,15,0,0,180,0,' ',' ','public','UCD-SNMP-MIB::laLoad.2',4,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (50,'System Description','Get system description (all mibs).',1,17,0,0,9000,0,' ',' ','public','SNMPv2-MIB::sysDescr.0',4,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (51,'OS Raw Interrupts','Get system raw interrupts from SO',13,16,0,0,180,0,' ',' ','public','UCD-SNMP-MIB::ssRawInterrupts.0',4,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (52,'OS IO Signals sent','IO Signals sent by Kernel',13,16,0,0,180,0,' ',' ','public','UCD-SNMP-MIB::ssIOSent.0',4,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (53,'System Uptime','Sistem uptime in timeticks',1,15,0,0,180,0,' ',' ','public','HOST-RESOURCES-MIB::hrSystemUptime.0',4,2);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo) VALUES (176,'Catalyst Free Mem','Taken from ftp://ftp.cisco.com/pub/mibs/oid/OLD-CISCO-MEMORY-MIB.oid',2,15,0,0,180,0,' ',' ','public','1.3.6.1.4.1.9.2.1.8',4,2);
-- WMI components
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo, plugin_user, max_timeout) VALUES (200, 'CPU load', 'CPU0 load average', 14, 1, 100, 0, 300, 1, ' ', ' ', ' ', 'SELECT LoadPercentage from Win32_Processor WHERE DeviceID = \&quot;CPU0\&quot;', 1, 6, 'Administrator', 10);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo, plugin_user, max_timeout) VALUES (201, 'Free RAM', 'Available RAM memory in bytes', 14, 1, 0, 0, 300, 0, ' ', ' ', ' ', 'SELECT AvailableBytes from Win32_PerfRawData_PerfOS_Memory', 1, 6, 'Administrator', 10);
INSERT INTO tnetwork_component (id_nc, name, description, id_group, type, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, id_module_group, id_modulo, plugin_user, max_timeout) VALUES (202, 'Windows version', 'Operating system version', 14, 3, 0, 0, 300, 1, ' ', ' ', ' ', 'SELECT Caption FROM Win32_OperatingSystem', 1, 6, 'Administrator', 10);
COMMIT;
END;
/
--
-- Dumping data for table "tnetwork_component_group"
--
BEGIN
LOCK TABLE tnetwork_component_group IN EXCLUSIVE MODE;
INSERT INTO tnetwork_component_group (id_sg, name, parent) VALUES (1,'General group',0);
INSERT INTO tnetwork_component_group (id_sg, name, parent) VALUES (2,'Cisco MIBs',10);
INSERT INTO tnetwork_component_group (id_sg, name, parent) VALUES (5,'UNIX MIBs',12);
INSERT INTO tnetwork_component_group (id_sg, name, parent) VALUES (10,'Network Management',0);
INSERT INTO tnetwork_component_group (id_sg, name, parent) VALUES (11,'Microsoft Windows MIB',12);
INSERT INTO tnetwork_component_group (id_sg, name, parent) VALUES (12,'Operating Systems',0);
INSERT INTO tnetwork_component_group (id_sg, name, parent) VALUES (13,'UCD Mibs (Linux, UCD-SNMP)',12);
INSERT INTO tnetwork_component_group (id_sg, name, parent) VALUES (14,'WMI',12);
COMMIT;
END;
/
--
-- Dumping data for table "Network profile"
--
BEGIN
LOCK TABLE tnetwork_profile IN EXCLUSIVE MODE;
INSERT INTO tnetwork_profile (id_np, name, description) VALUES (1,'Basic Network Monitoring','This includes basic SNMP, ICMP, and TCP checks.');
INSERT INTO tnetwork_profile (id_np, name, description) VALUES (2,'Basic Monitoring','Only ICMP check');
INSERT INTO tnetwork_profile (id_np, name, description) VALUES (3,'Basic DMZ Server monitoring','This group of network checks, checks for default services located on DMZ servers...');
INSERT INTO tnetwork_profile (id_np, name, description) VALUES (4,'Full SNMP Monitoring','');
INSERT INTO tnetwork_profile (id_np, name, description) VALUES (5,'Linux Server','Full Monitoring of a Linux server services.');
INSERT INTO tnetwork_profile (id_np, name, description) VALUES (6,'Basic WMI monitoring','Basic monitoring of a Windows host.');
COMMIT;
END;
/
--
-- Dumping data for table "tnetwork_profile_component"
--
BEGIN
LOCK TABLE tnetwork_profile_component IN EXCLUSIVE MODE;
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (24,1);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (25,1);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (27,1);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (28,1);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (30,1);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (31,1);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (34,1);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (39,1);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (34,2);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (34,3);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (37,3);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (39,3);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (38,3);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (24,3);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (3,4);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (24,4);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (25,4);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (26,4);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (27,4);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (28,4);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (29,4);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (30,4);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (31,4);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (32,4);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (45,4);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (46,4);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (47,4);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (48,4);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (3,5);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (50,5);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (53,5);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (24,5);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (30,5);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (27,5);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (34,5);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (1,5);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (2,5);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (49,5);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (4,5);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (51,5);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (52,5);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (39,5);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (200,6);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (201,6);
INSERT INTO tnetwork_profile_component (id_nc, id_np) VALUES (202,6);
COMMIT;
END;
/
-- GIS
BEGIN
LOCK TABLE tgis_map IN EXCLUSIVE MODE;
INSERT INTO tgis_map VALUES (1,'Sample',-3.708187,40.42056,0,16,'',-3.708187,40.42056,0,0,1);
COMMIT;
END;
/
BEGIN
LOCK TABLE tgis_map_connection IN EXCLUSIVE MODE;
INSERT INTO tgis_map_connection VALUES (1,'OpenStreetMap','OSM','{\"type\":\"OSM\",\"url\":\"http://tile.openstreetmap.org/${z}/${x}/${y}.png\"}',19,16,-3.708187,40.42056,0,-3.708187,40.42056,0,0);
COMMIT;
END;
/
-- This table is commented because table name length is more 30 chars. TODO: Change it's name
--BEGIN
--LOCK TABLE tgis_map_has_tgis_map_connection IN EXCLUSIVE MODE;
--INSERT INTO tgis_map_has_tgis_map_connection VALUES (1,1,'2010-03-01 09:46:48',1);
--COMMIT;
--END;
--/
BEGIN
LOCK TABLE tgis_map_layer IN EXCLUSIVE MODE;
INSERT INTO tgis_map_layer VALUES (1,'Group All',1,0,1,0);
COMMIT;
END;
/
-- example alert template
BEGIN
LOCK TABLE talert_commands IN EXCLUSIVE MODE;
INSERT INTO talert_commands VALUES (10,'Remote\&#x20;agent\&#x20;control','/usr/share/pandora_server/udp_client.pl _address_ 41122 \&quot;_field1_\&quot;','This command is used to send commands to the Pandora FMS agents with the UDP server enabled. The UDP server is used to order agents (Windows and UNIX) to \&quot;refresh\&quot; the agent execution: that means, to force the agent to execute and send data to s',0);
COMMIT;
END;
/
BEGIN
LOCK TABLE talert_actions IN EXCLUSIVE MODE;
INSERT INTO talert_actions VALUES (1,'Mail&#x20;to&#x20;XXX',1,'yourmail@domain.es','[PANDORA] Alert from agent _agent_ on module _module_','',0,0);
INSERT INTO talert_actions VALUES (2,'Restart&#x20;agent',10,'REFRESH AGENT','','',0,0);
COMMIT;
END;
/
BEGIN
LOCK TABLE talert_templates IN EXCLUSIVE MODE;
INSERT INTO talert_templates VALUES (1,'Critical&#x20;condition','This is a generic alert template to fire on condition CRITICAL',1,'','','Hello, this is an automated email coming from Pandora FMS\r\n\r\nThis alert has been fired because a CRITICAL condition in one of your monitored items:\r\n\r\nAgent : _agent_\r\nModule: _module_\r\nModule description: _moduledescription_\r\nTimestamp _timestamp_\r\nCurrent value: _data_\r\n\r\nThanks for your time.\r\n\r\nBest regards\r\nPandora FMS\r\n','critical','',1,0.00,0.00,86400,1,0,to_date('12:00:00','hh24:mi:ss'),to_date('12:00:00','hh24:mi:ss'),1,1,1,1,1,1,1,1,'[PANDORA] Alert RECOVERED for CRITICAL status on _agent_ / _module_','Hello, this is an automated email coming from Pandora FMS\r\n\r\nThis alert has been RECOVERED from a CRITICAL condition in one of your monitored items:\r\n\r\nAgent : _agent_\r\nModule: _module_\r\nModule description: _moduledescription_\r\nTimestamp _timestamp_\r\nCurrent value: _data_\r\n\r\nThanks for your time.\r\n\r\nBest regards\r\nPandora FMS\r\n',4,0);
INSERT INTO talert_templates VALUES (2,'Manual&#x20;alert','This is a template used to fire manual alerts, condition defined here never will be executed. Use this template to assign to your actions/commands used to do remote management (Agent restart, execute commands on server, etc).',NULL,'','',' ','max_min','',1,0.00,1.00,86400,1,0,to_date('12:00:00','hh24:mi:ss'),to_date('12:00:00','hh24:mi:ss'),1,1,1,1,1,1,1,0,' ',' ',1,0);
INSERT INTO talert_templates VALUES (3,'Warning&#x20;condition','This&#x20;is&#x20;a&#x20;generic&#x20;alert&#x20;template&#x20;to&#x20;fire&#x20;on&#x20;WARNING&#x20;condition.',1,'','','Hello,&#x20;this&#x20;is&#x20;an&#x20;automated&#x20;email&#x20;coming&#x20;from&#x20;Pandora&#x20;FMS&#x0d;&#x0a;&#x0d;&#x0a;This&#x20;alert&#x20;has&#x20;been&#x20;fired&#x20;because&#x20;a&#x20;WARNING&#x20;condition&#x20;in&#x20;one&#x20;of&#x20;your&#x20;monitored&#x20;items:&#x0d;&#x0a;&#x0d;&#x0a;Agent&#x20;:&#x20;_agent_&#x0d;&#x0a;Module:&#x20;_module_&#x0d;&#x0a;Module&#x20;description:&#x20;_moduledescription_&#x0d;&#x0a;Timestamp&#x20;_timestamp_&#x0d;&#x0a;Current&#x20;value:&#x20;_data_&#x0d;&#x0a;&#x0d;&#x0a;Thanks&#x20;for&#x20;your&#x20;time.&#x0d;&#x0a;&#x0d;&#x0a;Best&#x20;regards&#x0d;&#x0a;Pandora&#x20;FMS&#x0d;&#x0a;','warning','',1,0.00,0.00,86400,1,0,to_date('12:00:00','hh24:mi:ss'),to_date('12:00:00','hh24:mi:ss'),1,1,1,1,1,1,1,1,'[PANDORA]&#x20;Alert&#x20;RECOVERED&#x20;for&#x20;WARNING&#x20;status&#x20;on&#x20;_agent_&#x20;/&#x20;_module_','Hello,&#x20;this&#x20;is&#x20;an&#x20;automated&#x20;email&#x20;coming&#x20;from&#x20;Pandora&#x20;FMS&#x0d;&#x0a;&#x0d;&#x0a;This&#x20;alert&#x20;has&#x20;been&#x20;RECOVERED&#x20;from&#x20;a&#x20;WARNING&#x20;condition&#x20;in&#x20;one&#x20;of&#x20;your&#x20;monitored&#x20;items:&#x0d;&#x0a;&#x0d;&#x0a;Agent&#x20;:&#x20;_agent_&#x0d;&#x0a;Module:&#x20;_module_&#x0d;&#x0a;Module&#x20;description:&#x20;_moduledescription_&#x0d;&#x0a;Timestamp&#x20;_timestamp_&#x0d;&#x0a;Current&#x20;value:&#x20;_data_&#x0d;&#x0a;&#x0d;&#x0a;Thanks&#x20;for&#x20;your&#x20;time.&#x0d;&#x0a;&#x0d;&#x0a;Best&#x20;regards&#x0d;&#x0a;Pandora&#x20;FMS&#x0d;&#x0a;',3,0);
COMMIT;
END;
/
-- treport_custom_sql Data
BEGIN
LOCK TABLE treport_custom_sql IN EXCLUSIVE MODE;
INSERT INTO treport_custom_sql (id, name, sql) VALUES (1, 'Monitoring&#x20;Report&#x20;Agent', 'select&#x20;direccion,&#x20;nombre,&#x20;comentarios,&#x20;&#40;select&#x20;nombre&#x20;from&#x20;tgrupo&#x20;where&#x20;tgrupo.id_grupo&#x20;=&#x20;tagente.id_grupo&#41;&#x20;as&#x20;"group"&#x20;from&#x20;tagente;');
INSERT INTO treport_custom_sql (id, name, sql) VALUES (2, 'Monitoring&#x20;Report&#x20;Modules', 'select&#x20;&#40;select&#x20;tagente.nombre&#x20;from&#x20;tagente&#x20;where&#x20;tagente.id_agente&#x20;=&#x20;tagente_modulo.id_agente&#41;&#x20;as&#x20;agent_name,&#x20;nombre&#x20;,&#x20;&#40;select&#x20;tmodule_group.name&#x20;from&#x20;tmodule_group&#x20;where&#x20;tmodule_group.id_mg&#x20;=&#x20;tagente_modulo.id_module_group&#41;&#x20;as&#x20;module_group,&#x20;module_interval&#x20;from&#x20;tagente_modulo&#x20;where&#x20;delete_pending&#x20;=&#x20;0&#x20;order&#x20;by&#x20;agent_name;');
INSERT INTO treport_custom_sql (id, name, sql) VALUES (3, 'Monitoring&#x20;Report&#x20;Alerts', 'select&#x20;t1.nombre&#x20;as&#x20;agent_name,&#x20;t2.nombre&#x20;as&#x20;module_name,&#x20;&#40;select&#x20;talert_templates.name&#x20;from&#x20;talert_templates&#x20;where&#x20;talert_templates.id&#x20;=&#x20;t3.id_alert_template&#41;&#x20;as&#x20;template,&#x20;&#40;select&#x20;group_concat&#40;t02.name&#41;&#x20;from&#x20;talert_template_module_actions&#x20;as&#x20;t01&#x20;inner&#x20;join&#x20;talert_actions&#x20;as&#x20;t02&#x20;on&#x20;t01.id_alert_action&#x20;=&#x20;t02.id&#x20;where&#x20;t01.id_alert_template_module&#x20;=&#x20;t3.id&#x20;group&#x20;by&#x20;t01.id_alert_template_module&#41;&#x20;as&#x20;actions&#x20;from&#x20;tagente&#x20;as&#x20;t1&#x20;inner&#x20;join&#x20;tagente_modulo&#x20;as&#x20;t2&#x20;on&#x20;t1.id_agente&#x20;=&#x20;t2.id_agente&#x20;inner&#x20;join&#x20;talert_template_modules&#x20;as&#x20;t3&#x20;on&#x20;t2.id_agente_modulo&#x20;=&#x20;t3.id_agent_module&#x20;order&#x20;by&#x20;agent_name,&#x20;module_name;');
COMMIT;
END;
/
-- procedure to insert more than 4000 chars into a string
CREATE OR REPLACE PROCEDURE treport_custom_sql_insert (IDX IN NUMBER, NAME IN VARCHAR2, SQL_TXT IN VARCHAR2, FLAG IN NUMBER) AS g_nclob NCLOB; BEGIN if FLAG = 0 then insert into treport_custom_sql values (IDX, NAME, empty_clob()) returning SQL into g_nclob; dbms_lob.write(g_nclob, length (SQL_TXT), 1, SQL_TXT); else select SQL into g_nclob from treport_custom_sql where ID = IDX for update; dbms_lob.writeappend( g_nclob, length(SQL_TXT), SQL_TXT); end if; END;
/
EXEC treport_custom_sql_insert(4, 'Group&#x20;view', 'select&#x20;t1.nombre,&#x20;&#40;select&#x20;count&#40;t3.id_agente&#41;&#x20;from&#x20;tagente&#x20;as&#x20;t3&#x20;where&#x20;t1.id_grupo&#x20;=',0);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','&#x20;t3.id_grupo&#41;&#x20;as&#x20;agents,&#x20;&#40;SELECT&#x20;COUNT&#40;t4.id_agente&#41;&#x20;FROM&#x20;tagente&#x20;as&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','t4&#x20;WHERE&#x20;t4.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;t4.disabled&#x20;=&#x20;0&#x20;AND&#x20;t4.ultimo_contacto&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','\&lt;&#x20;NOW&#40;&#41;&#x20;-&#x20;&#40;intervalo&#x20;/',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','&#x20;&#40;1/2&#41;&#41;&#41;&#x20;as&#x20;agent_unknown,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,',1);
EXEC treport_custom_sql_insert(4,'Group&#x20;view','&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','AND&#x20;tagente.id_agente&#x20;=&#x20;tagente_estado.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;utimestamp&#x20;\&gt;&#x20;0&#x20;AND&#x20;tagente_modulo.id_tipo_modulo&#x20;NOT&#x20;IN&#40;21,22,23,24,100&#41;&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','AND&#x20;&#40;UNIX_TIMESTAMP&#40;NOW&#40;&#41;&#41;&#x20;-',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','&#x20;tagente_estado.utimestamp&#41;&#x20;\&gt;=&#x20;&#40;tagente_estado.current_interval&#x20;/',1);
EXEC treport_custom_sql_insert(4,'Group&#x20;view','&#x20;&#40;1/2&#41;&#41;&#41;&#x20;as&#x20;monitor_unknow,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente.id_agente&#x20;=&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','tagente_estado.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','AND&#x20;tagente_modulo.id_tipo_modulo&#x20;NOT&#x20;IN&#x20;&#40;21,22,23,24&#41;&#x20;AND&#x20;utimestamp&#x20;=&#x20;0&#41;&#x20;as&#x20;monitor_no_init,&#x20;&#40;SELECT&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente_estado.id_agente&#x20;=&#x20;tagente.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;estado&#x20;=&#x20;0&#x20;AND&#x20;&#40;&#40;UNIX_TIMESTAMP&#40;NOW&#40;&#41;&#41;&#x20;-',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','&#x20;tagente_estado.utimestamp&#41;&#x20;\&lt;&#x20;&#40;tagente_estado.current_interval&#x20;/',1);
EXEC treport_custom_sql_insert(4,'Group&#x20;view','&#x20;&#40;1/2&#41;&#41;&#x20;OR&#x20;&#40;tagente_modulo.id_tipo_modulo&#x20;IN&#40;21,22,23,24,100&#41;&#41;&#41;&#x20;AND&#x20;&#40;utimestamp&#x20;\&gt;&#x20;0&#x20;OR&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','&#40;tagente_modulo.id_tipo_modulo&#x20;IN&#40;21,22,23,24&#41;&#41;&#41;&#41;&#x20;as&#x20;monitor_ok,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','FROM&#x20;tagente_estado,&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','tagente_estado.id_agente&#x20;=&#x20;tagente.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','#x20;=&#x20;0&#x20;AND&#x20;estado&#x20;=&#x20;1&#x20;AND&#x20;&#40;&#40;UNIX_TIMESTAMP&#40;NOW&#40;&#41;&#41;&#x20;-',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','&#x20;tagente_estado.utimestamp&#41;&#x20;\&lt;&#x20;&#40;tagente_estado.current_interval&#x20;/',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','&#x20;&#40;1/2&#41;&#41;&#x20;OR&#x20;&#40;tagente_modulo.id_tipo_modulo&#x20;IN&#40;21,22,23,24,100&#41;&#41;&#41;&#x20;AND&#x20;utimestamp&#x20;\&gt;&#x20;0&#41;&#x20;as&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','monitor_critical,&#x20;&#40;SELECT&#x20;COUNT&#40;talert_template_modules.id&#41;&#x20;FROM&#x20;talert_template_modules,&#x20;tagente_modulo,&#x20;tagente_estado,&#x20;tagente&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente_modulo.id_agente&#x20;=&#x20;tagente.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;talert_template_modules.id_agent_module&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;times_fired&#x20;\&gt;&#x20;0&#41;&#x20;as&#x20;monitor_alert_fired&#x20;from&#x20;tgrupo&#x20;as&#x20;t1&#x20;where&#x20;0&#x20;',1);
EXEC treport_custom_sql_insert(4, 'Group&#x20;view','\&lt;&#x20;&#40;select&#x20;count&#40;t2.id_agente&#41;&#x20;from&#x20;tagente&#x20;as&#x20;t2&#x20;where&#x20;t1.id_grupo&#x20;=&#x20;t2.id_grupo&#41;',1);
COMMIT;

View File

@ -253,7 +253,8 @@ CREATE TABLE talert_commands (
CREATE SEQUENCE talert_commands_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER talert_commands_inc BEFORE INSERT ON talert_commands REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT talert_commands_s.nextval INTO :NEW.ID FROM dual; END; /
CREATE OR REPLACE TRIGGER talert_commands_inc BEFORE INSERT ON talert_commands REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT talert_commands_s.nextval INTO :NEW.ID FROM dual; END;
/
CREATE TABLE talert_actions (
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
@ -452,7 +453,8 @@ CREATE TABLE tconfig (
CREATE SEQUENCE tconfig_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tconfig_inc BEFORE INSERT ON tconfig REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tconfig_s.nextval INTO :NEW.ID_CONFIG FROM dual; END; /
CREATE OR REPLACE TRIGGER tconfig_inc BEFORE INSERT ON tconfig REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tconfig_s.nextval INTO :NEW.ID_CONFIG FROM dual; END;
/
CREATE TABLE tconfig_os (
id_os NUMBER(10, 0) NOT NULL PRIMARY KEY,
@ -463,7 +465,8 @@ CREATE TABLE tconfig_os (
CREATE SEQUENCE tconfig_os_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tconfig_os_inc BEFORE INSERT ON tconfig_os REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tconfig_os_s.nextval INTO :NEW.ID_OS FROM dual; END; /
CREATE OR REPLACE TRIGGER tconfig_os_inc BEFORE INSERT ON tconfig_os REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tconfig_os_s.nextval INTO :NEW.ID_OS FROM dual; END;
/
CREATE TABLE tevento (
id_evento NUMBER(19, 0) NOT NULL PRIMARY KEY,
@ -506,7 +509,8 @@ CREATE TABLE tgrupo (
CREATE SEQUENCE tgrupo_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tgrupo_inc BEFORE INSERT ON tgrupo REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tgrupo_s.nextval INTO :NEW.ID_GRUPO FROM dual; END; /
CREATE OR REPLACE TRIGGER tgrupo_inc BEFORE INSERT ON tgrupo REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tgrupo_s.nextval INTO :NEW.ID_GRUPO FROM dual; END;
/
CREATE TABLE tincidencia (
id_incidencia NUMBER(19, 0) NOT NULL PRIMARY KEY,
@ -564,3 +568,841 @@ CREATE SEQUENCE tmensajes_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tmensajes_inc BEFORE INSERT ON tmensajes REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tmensajes_s.nextval INTO :NEW.ID_MENSAJE FROM dual; END; /
CREATE TABLE tmodule_group (
id_mg NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(150) default '' NOT NULL
);
CREATE SEQUENCE tmodule_group_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tmodule_group_inc BEFORE INSERT ON tmodule_group REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tmodule_group_s.nextval INTO :NEW.ID_MG FROM dual; END; /
CREATE TABLE tnetwork_component (
id_nc NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(80) NOT NULL,
description VARCHAR2(250) default NULL,
id_group NUMBER(10, 0) default 1 NOT NULL,
type NUMBER(10, 0) default 6 NOT NULL,
max NUMBER(10, 0) default 0 NOT NULL,
min NUMBER(19, 0) default 0 NOT NULL,
module_interval NUMBER(19, 0) default 0 NOT NULL,
tcp_port NUMBER(10, 0) default 0 NOT NULL,
tcp_send NCLOB NOT NULL,
tcp_rcv NCLOB NOT NULL,
snmp_community VARCHAR2(255) default 'NULL' NOT NULL,
snmp_oid VARCHAR2(400) NOT NULL,
id_module_group NUMBER(10, 0) default 0 NOT NULL,
id_modulo NUMBER(10, 0) default 0 NOT NULL,
id_plugin NUMBER(10, 0) default 0,
plugin_user NCLOB default '',
plugin_pass NCLOB default '',
plugin_parameter NCLOB,
max_timeout NUMBER(10, 0) default 0,
history_data NUMBER(5, 0) default 1,
min_warning BINARY_DOUBLE default 0,
max_warning BINARY_DOUBLE default 0,
min_critical BINARY_DOUBLE default 0,
max_critical BINARY_DOUBLE default 0,
min_ff_event NUMBER(10, 0) default 0,
custom_string_1 NCLOB default '',
custom_string_2 NCLOB default '',
custom_string_3 NCLOB default '',
custom_integer_1 INTEGER default 0,
custom_integer_2 INTEGER default 0,
post_process BINARY_DOUBLE default 0
);
CREATE SEQUENCE tnetwork_component_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tnetwork_component_inc BEFORE INSERT ON tnetwork_component REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tnetwork_component_s.nextval INTO :NEW.ID_NC FROM dual; END; /
CREATE TABLE tnetwork_component_group (
id_sg NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(200) default '' NOT NULL,
parent NUMBER(19, 0) default 0 NOT NULL
);
CREATE TABLE tnetwork_profile (
id_np NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '' NOT NULL,
description VARCHAR2(250) default ''
);
CREATE SEQUENCE tnetwork_profile_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tnetwork_profile_inc BEFORE INSERT ON tnetwork_profile REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tnetwork_profile_s.nextval INTO :NEW.ID_NP FROM dual; END; /
CREATE TABLE tnetwork_profile_component (
id_nc NUMBER(19, 0) default 0 NOT NULL,
id_np NUMBER(19, 0) default 0 NOT NULL
);
CREATE INDEX tnetwork_profile_id_np_idx ON tnetwork_profile_component(id_np);
CREATE TABLE tnota (
id_nota NUMBER(19, 0) NOT NULL PRIMARY KEY,
id_incident NUMBER(19, 0) NOT NULL,
id_usuario VARCHAR2(100) default '0' NOT NULL,
timestamp TIMESTAMP default CURRENT_TIMESTAMP,
nota NCLOB NOT NULL
);
CREATE INDEX tnota_id_incident_idx ON tnota(id_incident);
CREATE TABLE torigen (
origen VARCHAR2(100) default '' NOT NULL
);
CREATE TABLE tperfil (
id_perfil NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(60) default '' NOT NULL,
incident_edit NUMBER(5, 0) default 0 NOT NULL,
incident_view NUMBER(5, 0) default 0 NOT NULL,
incident_management NUMBER(5, 0) default 0 NOT NULL,
agent_view NUMBER(5, 0) default 0 NOT NULL,
agent_edit NUMBER(5, 0) default 0 NOT NULL,
alert_edit NUMBER(5, 0) default 0 NOT NULL,
user_management NUMBER(5, 0) default 0 NOT NULL,
db_management NUMBER(5, 0) default 0 NOT NULL,
alert_management NUMBER(5, 0) default 0 NOT NULL,
pandora_management NUMBER(5, 0) default 0 NOT NULL
);
CREATE SEQUENCE tperfil_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tperfil_inc BEFORE INSERT ON tperfil REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tperfil_s.nextval INTO :NEW.ID_PERFIL FROM dual; END; /
CREATE TABLE trecon_script (
id_recon_script NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '',
description NCLOB default NULL,
script VARCHAR2(250) default ''
);
CREATE SEQUENCE trecon_script_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER trecon_script_inc BEFORE INSERT ON trecon_script REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT trecon_script_s.nextval INTO :NEW.ID_RECON_SCRIPT FROM dual; END; /
CREATE TABLE trecon_task (
id_rt NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '' NOT NULL,
description VARCHAR2(250) default '' NOT NULL,
subnet VARCHAR2(64) default '' NOT NULL,
id_network_profile NUMBER(10, 0) default 0 NOT NULL,
create_incident NUMBER(10, 0) default 0 NOT NULL,
id_group NUMBER(10, 0) default 1 NOT NULL,
utimestamp NUMBER(19, 0) default 0 NOT NULL,
status NUMBER(10, 0) default 0 NOT NULL,
interval_sweep NUMBER(10, 0) default 0 NOT NULL,
id_recon_server NUMBER(10, 0) default 0 NOT NULL,
id_os NUMBER(10, 0) default 0 NOT NULL,
recon_ports VARCHAR2(250) default '' NOT NULL,
snmp_community VARCHAR2(64) default 'public' NOT NULL,
id_recon_script NUMBER(10, 0),
field1 VARCHAR2(250) default '' NOT NULL,
field2 VARCHAR2(250) default '' NOT NULL,
field3 VARCHAR2(250) default '' NOT NULL,
field4 VARCHAR2(250) default '' NOT NULL
);
CREATE INDEX trecon_task_id_rec_serv_idx ON trecon_task(id_recon_server);
CREATE SEQUENCE trecon_task_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER trecon_task_inc BEFORE INSERT ON trecon_task REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT trecon_task_s.nextval INTO :NEW.ID_RT FROM dual; END trecon_task_inc;
/
CREATE TABLE tserver (
id_server NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '' NOT NULL,
ip_address VARCHAR2(100) default '' NOT NULL,
status NUMBER(10, 0) default 0 NOT NULL,
laststart TIMESTAMP default NULL,
keepalive TIMESTAMP default NULL,
snmp_server NUMBER(10, 0) default 0 NOT NULL,
network_server NUMBER(10, 0) default 0 NOT NULL,
data_server NUMBER(10, 0) default 0 NOT NULL,
master NUMBER(10, 0) default 0 NOT NULL,
checksum NUMBER(10, 0) default 0 NOT NULL,
description VARCHAR2(255) default NULL,
recon_server NUMBER(10, 0) default 0 NOT NULL,
version VARCHAR2(20) default '' NOT NULL,
plugin_server NUMBER(10, 0) default 0 NOT NULL,
prediction_server NUMBER(10, 0) default 0 NOT NULL,
wmi_server NUMBER(10, 0) default 0 NOT NULL,
export_server NUMBER(10, 0) default 0 NOT NULL,
server_type NUMBER(10, 0) default 0 NOT NULL,
queued_modules NUMBER(10, 0) default 0 NOT NULL,
threads NUMBER(10, 0) default 0 NOT NULL,
lag_time NUMBER(10, 0) default 0 NOT NULL,
lag_modules NUMBER(10, 0) default 0 NOT NULL,
total_modules_running NUMBER(10, 0) default 0 NOT NULL,
my_modules NUMBER(10, 0) default 0 NOT NULL,
stat_utimestamp NUMBER(19, 0) default 0 NOT NULL
);
CREATE INDEX tserver_name_idx ON tserver(name);
CREATE INDEX tserver_keepalive_idx ON tserver(keepalive);
CREATE INDEX tserver_status_idx ON tserver(status);
CREATE SEQUENCE tserver_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tserver_inc BEFORE INSERT ON tserver REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tserver_s.nextval INTO :NEW.ID_SERVER FROM dual; END tserver_inc;
/
-- server types:
-- 0 data
-- 1 network
-- 2 snmp trap console
-- 3 recon
-- 4 plugin
-- 5 prediction
-- 6 wmi
-- 7 export
-- 8 inventory
-- 9 web
-- TODO: drop 2.x xxxx_server fields, unused since server_type exists.
CREATE TABLE tsesion (
ID_sesion NUMBER(19, 0) NOT NULL PRIMARY KEY,
ID_usuario VARCHAR2(60) default '0' NOT NULL,
IP_origen VARCHAR2(100) default '' NOT NULL,
accion VARCHAR2(100) default '' NOT NULL,
descripcion NCLOB default '' NOT NULL,
fecha TIMESTAMP default NULL,
utimestamp NUMBER(19, 0) default 0 NOT NULL
);
CREATE INDEX tsesion_utimestamp_idx ON tsesion(utimestamp);
CREATE INDEX tsesion_ID_usuario_idx ON tsesion(ID_usuario);
CREATE SEQUENCE tsesion_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tsesion_inc BEFORE INSERT ON tsesion REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tsesion_s.nextval INTO :NEW.ID_SESION FROM dual; END tsesion_inc;
/
CREATE TABLE ttipo_modulo (
id_tipo NUMBER(10, 0) NOT NULL PRIMARY KEY,
nombre VARCHAR2(100) default '' NOT NULL,
categoria NUMBER(10, 0) default 0 NOT NULL,
descripcion VARCHAR2(100) default '' NOT NULL,
icon VARCHAR2(100) default NULL
);
CREATE SEQUENCE ttipo_modulo_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER ttipo_modulo_inc BEFORE INSERT ON ttipo_modulo REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT ttipo_modulo_s.nextval INTO :NEW.ID_TIPO FROM dual; END ttipo_modulo_inc;
/
CREATE TABLE ttrap (
id_trap NUMBER(19, 0) NOT NULL PRIMARY KEY,
source VARCHAR2(50) default '' NOT NULL,
oid NCLOB default '' NOT NULL,
oid_custom NCLOB default '',
type NUMBER(10, 0) default 0 NOT NULL,
type_custom VARCHAR2(100) default '',
value NCLOB default '',
value_custom NCLOB default '',
alerted NUMBER(5, 0) default 0 NOT NULL,
status NUMBER(5, 0) default 0 NOT NULL,
id_usuario VARCHAR2(150) default '',
timestamp TIMESTAMP default NULL,
priority NUMBER(5, 0) default 2 NOT NULL
);
CREATE SEQUENCE ttrap_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER ttrap_inc BEFORE INSERT ON ttrap REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT ttrap_s.nextval INTO :NEW.ID_TRAP FROM dual; END ttrap_inc;
/
CREATE TABLE tusuario (
id_user VARCHAR2(60) NOT NULL PRIMARY KEY,
fullname VARCHAR2(255) NOT NULL,
firstname VARCHAR2(255) NOT NULL,
lastname VARCHAR2(255) NOT NULL,
middlename VARCHAR2(255) default '' NOT NULL,
password VARCHAR2(45) default NULL,
comments VARCHAR2(200) default NULL,
last_connect NUMBER(19, 0) default 0 NOT NULL,
registered NUMBER(19, 0) default 0 NOT NULL,
email VARCHAR2(100) default NULL,
phone VARCHAR2(100) default NULL,
is_admin NUMBER(5, 0) default 0 NOT NULL,
language VARCHAR2(10) default NULL,
timezone VARCHAR2(50) default '',
block_size NUMBER(10, 0) default 20 NOT NULL,
flash_chart NUMBER(10, 0) default 1 NOT NULL
);
CREATE TABLE tusuario_perfil (
id_up NUMBER(19, 0) NOT NULL PRIMARY KEY,
id_usuario VARCHAR2(100) default '' NOT NULL,
id_perfil NUMBER(10, 0) default 0 NOT NULL,
id_grupo NUMBER(10, 0) default 0 NOT NULL,
assigned_by VARCHAR2(100) default '' NOT NULL
);
CREATE SEQUENCE tusuario_perfil_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tusuario_perfil_inc BEFORE INSERT ON tusuario_perfil REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tusuario_perfil_s.nextval INTO :NEW.ID_UP FROM dual; END tusuario_perfil_inc;
/
CREATE TABLE tnews (
id_news NUMBER(10, 0) NOT NULL PRIMARY KEY,
author VARCHAR2(255) DEFAULT '' NOT NULL,
subject VARCHAR2(255) DEFAULT '' NOT NULL,
text NCLOB NOT NULL,
timestamp TIMESTAMP default NULL
);
CREATE SEQUENCE tnews_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tnews_inc BEFORE INSERT ON tnews REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tnews_s.nextval INTO :NEW.ID_NEWS FROM dual; END tnews_inc;
/
CREATE TABLE tgraph (
id_graph NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_user VARCHAR2(100) default '' NOT NULL,
name VARCHAR2(150) default '' NOT NULL,
description NCLOB NOT NULL,
period NUMBER(10, 0) default 0 NOT NULL,
width NUMBER(10, 0) default 0 NOT NULL,
height NUMBER(10, 0) default 0 NOT NULL,
private NUMBER(5, 0) default 0 NOT NULL,
events NUMBER(5, 0) default 0 NOT NULL,
stacked NUMBER(5, 0) default 0 NOT NULL,
id_group NUMBER(19, 0) default 0 NOT NULL
);
CREATE SEQUENCE tgraph_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tgraph_inc BEFORE INSERT ON tgraph REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tgraph_s.nextval INTO :NEW.ID_GRAPH FROM dual; END tgraph_inc;
/
CREATE TABLE tgraph_source (
id_gs NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_graph NUMBER(19, 0) default 0 NOT NULL,
id_agent_module NUMBER(19, 0) default 0 NOT NULL,
weight BINARY_DOUBLE default 0
);
CREATE SEQUENCE tgraph_source_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tgraph_source_inc BEFORE INSERT ON tgraph_source REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tgraph_source_s.nextval INTO :NEW.ID_GS FROM dual; END tgraph_source_inc;
/
CREATE TABLE treport (
id_report NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_user VARCHAR2(100) default '' NOT NULL,
name VARCHAR2(150) default '' NOT NULL,
description NCLOB NOT NULL,
private NUMBER(5, 0) default 0 NOT NULL,
id_group NUMBER(19, 0) default 0 NOT NULL,
custom_logo VARCHAR2(200) default NULL,
header NCLOB default NULL,
first_page NCLOB default NULL,
footer NCLOB default NULL,
custom_font VARCHAR2(200) default NULL
);
CREATE SEQUENCE treport_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER treport_inc BEFORE INSERT ON treport REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT treport_s.nextval INTO :NEW.ID_REPORT FROM dual; END treport_inc;
/
-- -----------------------------------------------------
-- Table "treport_content"
-- -----------------------------------------------------
CREATE TABLE treport_content (
id_rc NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_report NUMBER(10, 0) default 0 NOT NULL REFERENCES treport(id_report) ON DELETE CASCADE,
id_gs NUMBER(10, 0) default NULL,
id_agent_module NUMBER(19, 0) default NULL,
type VARCHAR2(30) default 'simple_graph',
period NUMBER(19, 0) default 0 NOT NULL,
"order" NUMBER(19, 0) default 0 NOT NULL,
description NCLOB,
id_agent NUMBER(19, 0) default 0 NOT NULL,
text NCLOB default NULL,
external_source NCLOB default NULL,
treport_custom_sql_id NUMBER(10, 0) default 0,
header_definition NCLOB default NULL,
column_separator NCLOB default NULL,
line_separator NCLOB default NULL,
time_from TIMESTAMP default to_date('00:00:00','hh24:mi:ss'), -- use to_char(time_from, 'hh24:mi:ss') function to retrieve info
time_to TIMESTAMP default to_date('00:00:00','hh24:mi:ss'), -- use to_char(time_to, 'hh24:mi:ss') function to retrieve info
monday NUMBER(5, 0) default 1 NOT NULL,
tuesday NUMBER(5, 0) default 1 NOT NULL,
wednesday NUMBER(5, 0) default 1 NOT NULL,
thursday NUMBER(5, 0) default 1 NOT NULL,
friday NUMBER(5, 0) default 1 NOT NULL,
saturday NUMBER(5, 0) default 1 NOT NULL,
sunday NUMBER(5, 0) default 1 NOT NULL,
only_display_wrong NUMBER(5, 0) default 0 NOT NULL
);
CREATE SEQUENCE treport_content_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER treport_content_inc BEFORE INSERT ON treport_content REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT treport_content_s.nextval INTO :NEW.ID_RC FROM dual; END treport_content_inc;
/
-- on update trigger
CREATE OR REPLACE TRIGGER treport_content_update AFTER UPDATE OF ID_REPORT ON treport FOR EACH ROW BEGIN UPDATE treport_content SET ID_RC = :NEW.ID_REPORT WHERE ID_RC = :OLD.ID_REPORT; END;
/
CREATE TABLE treport_content_sla_combined (
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_report_content NUMBER(10, 0) NOT NULL REFERENCES treport_content(id_rc) ON DELETE CASCADE,
id_agent_module NUMBER(10, 0) NOT NULL REFERENCES tagente_modulo(id_agente_modulo) ON DELETE CASCADE,
sla_max BINARY_DOUBLE default 0 NOT NULL,
sla_min BINARY_DOUBLE default 0 NOT NULL,
sla_limit BINARY_DOUBLE default 0 NOT NULL
);
CREATE SEQUENCE treport_cont_sla_c_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER treport_content_sla_comb_inc BEFORE INSERT ON treport_content REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT treport_cont_sla_c_s.nextval INTO :NEW.ID_RC FROM dual; END treport_content_sla_comb_inc;
/
-- on update trigger
CREATE OR REPLACE TRIGGER treport_cont_sla_comb_update AFTER UPDATE OF ID_RC ON treport_content FOR EACH ROW BEGIN UPDATE treport_content_sla_combined SET ID_REPORT_CONTENT = :NEW.ID_RC WHERE ID_REPORT_CONTENT = :OLD.ID_RC; END;
/
-- on update trigger 1
CREATE OR REPLACE TRIGGER treport_cont_sla_comb_update1 AFTER UPDATE OF ID_AGENTE_MODULO ON tagente_modulo FOR EACH ROW BEGIN UPDATE treport_content_sla_combined SET ID_AGENT_MODULE = :NEW.ID_AGENTE_MODULO WHERE ID_AGENT_MODULE = :OLD.ID_AGENTE_MODULO; END;
/
CREATE TABLE treport_custom_sql (
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(150) default '' NOT NULL,
sql NCLOB default NULL
);
CREATE SEQUENCE treport_custom_sql_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER treport_custom_sql_inc BEFORE INSERT ON treport_custom_sql REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT treport_custom_sql_s.nextval INTO :NEW.ID FROM dual; END treport_custom_sql_inc;
/
CREATE TABLE tlayout (
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
name varchar(50) NOT NULL,
id_group NUMBER(10, 0) NOT NULL,
background varchar(200) NOT NULL,
fullscreen NUMBER(5, 0) default 0 NOT NULL,
height NUMBER(10, 0) default 0 NOT NULL,
width NUMBER(10, 0) default 0 NOT NULL
);
CREATE SEQUENCE tlayout_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tlayout_inc BEFORE INSERT ON tlayout REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tlayout_s.nextval INTO :NEW.ID FROM dual; END tlayout_inc;
/
CREATE TABLE tlayout_data (
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_layout NUMBER(10, 0) default 0 NOT NULL,
pos_x NUMBER(10, 0) default 0 NOT NULL,
pos_y NUMBER(10, 0) default 0 NOT NULL,
height NUMBER(10, 0) default 0 NOT NULL,
width NUMBER(10, 0) default 0 NOT NULL,
label VARCHAR2(200) DEFAULT '',
image VARCHAR2(200) DEFAULT '',
type NUMBER(5, 0) default 0 NOT NULL,
period NUMBER(10, 0) default 3600 NOT NULL,
id_agente_modulo NUMBER(19, 0) default 0 NOT NULL,
id_agent NUMBER(10, 0) default 0 NOT NULL,
id_layout_linked NUMBER(10, 0) default 0 NOT NULL,
parent_item NUMBER(10, 0) default 0 NOT NULL,
label_color varchar(20) DEFAULT '',
no_link_color NUMBER(5, 0) default 0 NOT NULL
);
CREATE SEQUENCE tlayout_data_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tlayout_data_inc BEFORE INSERT ON tlayout_data REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tlayout_data_s.nextval INTO :NEW.ID FROM dual; END tlayout_data_inc;
/
CREATE TABLE tplugin (
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(200) NOT NULL,
description NCLOB,
max_timeout NUMBER(10, 0) default 0 NOT NULL,
execute VARCHAR2(250) NOT NULL,
net_dst_opt VARCHAR2(50) default '',
net_port_opt VARCHAR2(50) default '',
user_opt VARCHAR2(50) default '',
pass_opt VARCHAR2(50) default '',
plugin_type NUMBER(5, 0) default 0 NOT NULL
);
CREATE SEQUENCE tplugin_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tplugin_inc BEFORE INSERT ON tplugin REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tplugin_s.nextval INTO :NEW.ID FROM dual; END tplugin_inc;
/
CREATE TABLE tmodule (
id_module NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '' NOT NULL
);
CREATE SEQUENCE tmodule_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tmodule_inc BEFORE INSERT ON tmodule REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tmodule_s.nextval INTO :NEW.ID_MODULE FROM dual; END tmodule_inc;
/
CREATE TABLE tserver_export (
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '' NOT NULL,
preffix VARCHAR2(100) default '' NOT NULL,
interval NUMBER(10, 0) default 300 NOT NULL,
ip_server VARCHAR2(100) default '' NOT NULL,
connect_mode VARCHAR2(20) default 'local',
id_export_server NUMBER(10, 0) default NULL ,
"user" VARCHAR2(100) default '' NOT NULL,
pass VARCHAR2(100) default '' NOT NULL,
port NUMBER(10, 0) default 0 NOT NULL,
directory VARCHAR2(100) default '' NOT NULL,
options VARCHAR2(100) default '' NOT NULL,
--Number of hours of diference with the server timezone
timezone_offset NUMBER(5, 0) default 0 NOT NULL,
CONSTRAINT tserver_export_conn_mode_cons CHECK (connect_mode IN ('tentacle', 'ssh', 'local'))
);
CREATE SEQUENCE tserver_export_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tserver_export_inc BEFORE INSERT ON tserver_export REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tserver_export_s.nextval INTO :NEW.ID FROM dual; END tserver_export_inc;
/
-- id_export_server is real pandora fms export server process that manages this server
-- id is the "destination" server to export
CREATE TABLE tserver_export_data (
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_export_server NUMBER(10, 0) default 0 NOT NULL,
agent_name VARCHAR2(100) default '' NOT NULL,
module_name VARCHAR2(100) default '' NOT NULL,
module_type VARCHAR2(100) default '' NOT NULL,
data VARCHAR2(255) default NULL,
timestamp TIMESTAMP default NULL
);
CREATE SEQUENCE tserver_export_data_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tserver_export_data_inc BEFORE INSERT ON tserver_export_data REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tserver_export_data_s.nextval INTO :NEW.ID FROM dual; END tserver_export_data_inc;
/
CREATE TABLE tplanned_downtime (
id NUMBER(19, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) NOT NULL,
description NCLOB NOT NULL,
date_from NUMBER(19, 0) default 0 NOT NULL,
date_to NUMBER(19, 0) default 0 NOT NULL,
executed NUMBER(5, 0) default 0 NOT NULL,
id_group NUMBER(19, 0) default 0 NOT NULL
);
CREATE SEQUENCE tplanned_downtime_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tplanned_downtime_inc BEFORE INSERT ON tplanned_downtime REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tplanned_downtime_s.nextval INTO :NEW.ID FROM dual; END tplanned_downtime_inc;
/
CREATE TABLE tplanned_downtime_agents (
id NUMBER(19, 0) NOT NULL PRIMARY KEY,
id_agent NUMBER(19, 0) default 0 NOT NULL,
id_downtime NUMBER(19, 0) default 0 NOT NULL
);
CREATE SEQUENCE tplanned_downtime_agents_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tplanned_downtime_agents_inc BEFORE INSERT ON tplanned_downtime_agents REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tplanned_downtime_agents_s.nextval INTO :NEW.ID FROM dual; END tplanned_downtime_agents_inc;
/
-- GIS extension Tables
-- -----------------------------------------------------
-- Table "tgis_data_history"
-- -----------------------------------------------------
--Table to store historical GIS information of the agents
CREATE TABLE tgis_data_history (
--key of the table
id_tgis_data NUMBER(10, 0) NOT NULL PRIMARY KEY,
longitude BINARY_DOUBLE NOT NULL,
latitude BINARY_DOUBLE NOT NULL,
altitude BINARY_DOUBLE NOT NULL,
--timestamp on wich the agente started to be in this position
start_timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
--timestamp on wich the agent was placed for last time on this position
end_timestamp TIMESTAMP default NULL,
--description of the region correoponding to this placemnt
description NCLOB DEFAULT NULL,
-- 0 to show that the position cames from the agent, 1 to show that the position was established manualy
manual_placement NUMBER(5, 0) default 0 NOT NULL,
-- Number of data packages received with this position from the start_timestampa to the_end_timestamp
number_of_packages NUMBER(10, 0) default 1 NOT NULL,
--reference to the agent
tagente_id_agente NUMBER(10, 0) NOT NULL
);
CREATE INDEX tgis_data_history_start_t_idx ON tgis_data_history(start_timestamp);
CREATE INDEX tgis_data_history_end_t_idx ON tgis_data_history(end_timestamp);
CREATE SEQUENCE tgis_data_history_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tgis_data_history_inc BEFORE INSERT ON tgis_data_history REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tgis_data_history_s.nextval INTO :NEW.ID_TGIS_DATA FROM dual; END tgis_data_history_inc;
/
-- -----------------------------------------------------
-- Table "tgis_data_status"
-- -----------------------------------------------------
--Table to store last GIS information of the agents
CREATE TABLE tgis_data_status (
--Reference to the agent
tagente_id_agente NUMBER(10, 0) NOT NULL REFERENCES tagente(id_agente) ON DELETE CASCADE, --ON UPDATE NO ACTION is implicit on Oracle DBMS
--Last received longitude
current_longitude BINARY_DOUBLE NOT NULL,
--Last received latitude
current_latitude BINARY_DOUBLE NOT NULL,
--Last received altitude
current_altitude BINARY_DOUBLE NOT NULL,
--Reference longitude to see if the agent has moved
stored_longitude BINARY_DOUBLE NOT NULL,
--Reference latitude to see if the agent has moved
stored_latitude BINARY_DOUBLE NOT NULL,
--Reference altitude to see if the agent has moved
stored_altitude BINARY_DOUBLE DEFAULT NULL,
--Number of data packages received with this position since start_timestampa
number_of_packages NUMBER(10, 0) default 1 NOT NULL,
--Timestamp on wich the agente started to be in this position
start_timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
--0 to show that the position cames from the agent, 1 to show that the position was established manualy
manual_placement NUMBER(5, 0) default 0 NOT NULL,
--description of the region correoponding to this placemnt
description NCLOB NULL,
PRIMARY KEY(tagente_id_agente)
);
CREATE INDEX tgis_data_status_start_t_idx ON tgis_data_status(start_timestamp);
-- -----------------------------------------------------
-- Table "tgis_map"
-- -----------------------------------------------------
--Table containing information about a gis map
CREATE TABLE tgis_map (
--table identifier
id_tgis_map NUMBER(10, 0) NOT NULL PRIMARY KEY,
--Name of the map
map_name VARCHAR2(63) NOT NULL,
--longitude of the center of the map when it\'s loaded
initial_longitude BINARY_DOUBLE DEFAULT NULL,
--latitude of the center of the map when it\'s loaded
initial_latitude BINARY_DOUBLE DEFAULT NULL,
--altitude of the center of the map when it\'s loaded
initial_altitude BINARY_DOUBLE DEFAULT NULL,
--Zoom level to show when the map is loaded.
zoom_level NUMBER(5, 0) default 1 NOT NULL,
--path on the server to the background image of the map
map_background VARCHAR2(127) DEFAULT NULL,
--default longitude for the agents placed on the map
default_longitude BINARY_DOUBLE DEFAULT NULL,
--default latitude for the agents placed on the map
default_latitude BINARY_DOUBLE DEFAULT NULL,
--default altitude for the agents placed on the map
default_altitude DOUBLE PRECISION DEFAULT NULL,
--Group that owns the map
group_id NUMBER(10, 0) default 0 NOT NULL,
--1 if this is the default map, 0 in other case
default_map NUMBER(5, 0) default 0 NOT NULL
);
CREATE INDEX tgis_map_tagente_map_name_idx ON tgis_map(map_name);
CREATE SEQUENCE tgis_map_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tgis_map_inc BEFORE INSERT ON tgis_map REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tgis_map_s.nextval INTO :NEW.ID_TGIS_MAP FROM dual; END tgis_map_inc;
/
-- -----------------------------------------------------
-- Table "tgis_map_connection"
-- -----------------------------------------------------
--Table to store the map connection information
CREATE TABLE tgis_map_connection (
--table id
id_tmap_connection NUMBER(10, 0) NOT NULL PRIMARY KEY,
--Name of the connection (name of the base layer)
conection_name VARCHAR2(45) DEFAULT NULL,
--Type of map server to connect
connection_type VARCHAR2(45) DEFAULT NULL,
--connection information (this can probably change to fit better the possible connection parameters)
conection_data NCLOB DEFAULT NULL,
--Number of zoom levels available
num_zoom_levels NUMBER(5, 0) DEFAULT NULL,
--Default Zoom Level for the connection
default_zoom_level NUMBER(5, 0) default 16 NOT NULL,
--default longitude for the agents placed on the map
default_longitude BINARY_DOUBLE DEFAULT NULL,
--default latitude for the agents placed on the map
default_latitude BINARY_DOUBLE DEFAULT NULL,
--default altitude for the agents placed on the map
default_altitude BINARY_DOUBLE DEFAULT NULL,
--longitude of the center of the map when it\'s loaded
initial_longitude BINARY_DOUBLE DEFAULT NULL,
--latitude of the center of the map when it\'s loaded
initial_latitude BINARY_DOUBLE DEFAULT NULL,
--altitude of the center of the map when it\'s loaded
initial_altitude BINARY_DOUBLE DEFAULT NULL,
--Group that owns the map
group_id NUMBER(10, 0) default 0 NOT NULL
);
CREATE SEQUENCE tgis_map_connection_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tgis_map_connection_inc BEFORE INSERT ON tgis_map_connection REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tgis_map_connection_s.nextval INTO :NEW.ID_TMAP_CONNECTION FROM dual; END tgis_map_connection_inc;
/
-- -----------------------------------------------------
-- Table "tgis_map_has_tgis_map_connection"
-- -----------------------------------------------------
-- This table is commented because table name length is more 30 chars. TODO: Change it's name
--Table to asociate a connection to a gis map
--CREATE TABLE tgis_map_has_tgis_map_connection (
--reference to tgis_map
-- tgis_map_id_tgis_map NUMBER(10, 0) NOT NULL REFERENCES tgis_map(id_tgis_map) ON DELETE CASCADE,
--reference to tgis_map_connection
-- tgis_map_connection_id_tmap_connection NUMBER(10, 0) NOT NULL REFERENCES tgis_map_connection (id_tmap_connection) ON DELETE CASCADE,
--Last Modification Time of the Connection
-- modification_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
--Flag to mark the default map connection of a map
-- default_map_connection NUMBER(5, 0) default 0 NOT NULL,
-- PRIMARY KEY (tgis_map_id_tgis_map, tgis_map_connection_id_tmap_connection)
--);
--CREATE INDEX tgis_map_has_tgis_map_connection_map_tgis_map_id_tgis_map_idx ON tgis_map_has_tgis_map_connection(tgis_map_id_tgis_map);
--CREATE INDEX tgis_map_has_tgis_map_connection_map_tgis_map_connection_id_tmap_connection_idx ON tgis_map_has_tgis_map_connection(tgis_map_connection_id_tmap_connection);
--This trigger is for tranlate "on update CURRENT_TIMESTAMP" of MySQL.
--CREATE OR REPLACE TRIGGER tgis_map_has_tgis_map_connection_ts BEFORE UPDATE ON tgis_map_has_tgis_map_connection FOR EACH ROW BEGIN select CURRENT_TIMESTAMP into :NEW.MODIFICATION_TIME from dual; END;
--/
-- -----------------------------------------------------
-- Table "tgis_map_layer"
-- -----------------------------------------------------
--Table containing information about the map layers
CREATE TABLE tgis_map_layer (
--table id
id_tmap_layer NUMBER(10, 0) NOT NULL PRIMARY KEY,
--Name of the layer
layer_name VARCHAR2(45) NOT NULL,
--True if the layer must be shown
view_layer NUMBER(5, 0) default 1 NOT NULL,
--Number of order of the layer in the layer stack, bigger means upper on the stack.\n
layer_stack_order NUMBER(5, 0) default 0 NOT NULL,
--reference to the map containing the layer
tgis_map_id_tgis_map NUMBER(10, 0) default 0 NOT NULL REFERENCES tgis_map(id_tgis_map) ON DELETE CASCADE,
--reference to the group shown in the layer
tgrupo_id_grupo NUMBER(19, 0) NOT NULL
);
CREATE SEQUENCE tgis_map_layer_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tgis_map_layer_inc BEFORE INSERT ON tgis_map_layer REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tgis_map_layer_s.nextval INTO :NEW.ID_TMAP_LAYER FROM dual; END tgis_map_layer_inc;
/
-- -----------------------------------------------------
-- Table "tgis_map_layer_has_tagente"
-- -----------------------------------------------------
--Table to define wich agents are shown in a layer
CREATE TABLE tgis_map_layer_has_tagente (
tgis_map_layer_id_tmap_layer NUMBER(10, 0) NOT NULL REFERENCES tgis_map_layer(id_tmap_layer) ON DELETE CASCADE,
tagente_id_agente NUMBER(10, 0) NOT NULL REFERENCES tagente(id_agente) ON DELETE CASCADE,
PRIMARY KEY (tgis_map_layer_id_tmap_layer, tagente_id_agente)
);
CREATE INDEX tgis_map_layer_has_tagente_idx ON tgis_map_layer_has_tagente(tgis_map_layer_id_tmap_layer);
CREATE INDEX tgis_map_layer_has_tagent1_idx ON tgis_map_layer_has_tagente(tagente_id_agente);
-- -----------------------------------------------------
-- Table "tgroup_stat"
-- -----------------------------------------------------
--Table to store global system stats per group
CREATE TABLE tgroup_stat (
id_group NUMBER(10, 0) default 0 NOT NULL PRIMARY KEY,
modules NUMBER(10, 0) default 0 NOT NULL,
normal NUMBER(10, 0) default 0 NOT NULL,
critical NUMBER(10, 0) default 0 NOT NULL,
warning NUMBER(10, 0) default 0 NOT NULL,
unknown NUMBER(10, 0) default 0 NOT NULL,
"non-init" NUMBER(10, 0) default 0 NOT NULL,
alerts NUMBER(10, 0) default 0 NOT NULL,
alerts_fired NUMBER(10, 0) default 0 NOT NULL,
agents NUMBER(10, 0) default 0 NOT NULL,
agents_unknown NUMBER(10, 0) default 0 NOT NULL,
utimestamp NUMBER(10, 0) default 0 NOT NULL
);
-- -----------------------------------------------------
-- Table "tnetwork_map"
-- -----------------------------------------------------
CREATE TABLE tnetwork_map (
id_networkmap NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_user VARCHAR2(60) NOT NULL,
name VARCHAR2(100) NOT NULL,
type VARCHAR2(20) NOT NULL,
layout VARCHAR2(20) NOT NULL,
nooverlap NUMBER(5, 0) default 0 NOT NULL,
simple NUMBER(5, 0) default 0 NOT NULL,
regenerate NUMBER(5, 0) default 1 NOT NULL,
font_size NUMBER(10, 0) default 12 NOT NULL,
id_group NUMBER(10, 0) default 0 NOT NULL,
id_module_group NUMBER(10, 0) default 0 NOT NULL,
id_policy NUMBER(10, 0) default 0 NOT NULL,
depth VARCHAR2(20) NOT NULL,
only_modules_with_alerts NUMBER(10, 0) default 0 NOT NULL,
hide_policy_modules SMALLINT default 0 NOT NULL,
zoom BINARY_DOUBLE default 1,
distance_nodes BINARY_DOUBLE default 2.5,
center NUMBER(10, 0) default 0 NOT NULL,
contracted_nodes NCLOB
);
CREATE SEQUENCE tnetwork_map_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tnetwork_map_inc BEFORE INSERT ON tnetwork_map REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tnetwork_map_s.nextval INTO :NEW.ID_NETWORKMAP FROM dual; END tnetwork_map_inc;
/
-- -----------------------------------------------------
-- Table "tsnmp_filter"
-- -----------------------------------------------------
CREATE TABLE tsnmp_filter (
id_snmp_filter NUMBER(10, 0) NOT NULL PRIMARY KEY,
description VARCHAR2(255) default '',
filter VARCHAR2(255) default ''
);
CREATE SEQUENCE tsnmp_filter_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tsnmp_filter_inc BEFORE INSERT ON tsnmp_filter REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tsnmp_filter_s.nextval INTO :NEW.ID_SNMP_FILTER FROM dual; END tsnmp_filter_inc;
/
-- -----------------------------------------------------
-- Table "tagent_custom_fields"
-- -----------------------------------------------------
CREATE TABLE tagent_custom_fields (
id_field NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(45) default '' NOT NULL,
display_on_front NUMBER(5, 0) default 0 NOT NULL
);
CREATE SEQUENCE tagent_custom_fields_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tagent_custom_fields_inc BEFORE INSERT ON tagent_custom_fields REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tagent_custom_fields_s.nextval INTO :NEW.ID_FIELD FROM dual; END tagent_custom_fields_inc;
/
-- -----------------------------------------------------
-- Table "tagent_custom_data"
-- -----------------------------------------------------
CREATE TABLE tagent_custom_data (
id_field NUMBER(10, 0) NOT NULL REFERENCES tagent_custom_fields(id_field) ON DELETE CASCADE,
id_agent NUMBER(10, 0) NOT NULL REFERENCES tagente(id_agente) ON DELETE CASCADE,
description NCLOB default '',
PRIMARY KEY (id_field, id_agent)
);
-- on update trigger
CREATE OR REPLACE TRIGGER tagent_custom_data_update AFTER UPDATE OF ID_FIELD ON tagent_custom_fields FOR EACH ROW BEGIN UPDATE tagent_custom_data SET ID_FIELD = :NEW.ID_FIELD WHERE ID_FIELD = :OLD.ID_FIELD; END;
/
-- on update trigger 1
CREATE OR REPLACE TRIGGER tagent_custom_data_update1 AFTER UPDATE OF ID_AGENTE ON tagente FOR EACH ROW BEGIN UPDATE tagent_custom_data SET ID_AGENT = :NEW.ID_AGENTE WHERE ID_AGENT = :OLD.ID_AGENTE; END;
/