2011-03-02 Miguel de Dios <miguel.dedios@artica.es>

* pandoradb.data.postgreSQL.sql: fixed the serial values.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4052 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-03-02 17:24:33 +00:00
parent 9d5f594f1c
commit 6d71a2c284
2 changed files with 24 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2011-03-02 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.data.postgreSQL.sql: fixed the serial values.
2011-03-02 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_ui.php: Added missing variable initialization in function

View File

@ -33,6 +33,7 @@ INSERT INTO "talert_commands" VALUES (6,'Syslog','logger -p daemon.alert Pandora
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);
SELECT setval('talert_commands_id_seq', (SELECT (SELECT MAX(id) FROM talert_commands)));
--
-- Dumping data for table "tconfig"
@ -99,6 +100,7 @@ INSERT INTO "tconfig_os" VALUES
(14,'Embedded','Embedded device running a Pandora FMS agent','embedded.png'),
(15,'Android','Android agent','android.png');
COMMIT WORK;
SELECT setval('tconfig_os_id_os_seq', (SELECT (SELECT MAX(id_os) FROM tconfig_os)));
--
-- Dumping data for table "tgrupo"
@ -116,6 +118,7 @@ VALUES
(12,'Applications','applications',0,0,0,''),
(13,'Web','world',0,0,0,'');
COMMIT WORK;
SELECT setval('tgrupo_id_grupo_seq', (SELECT (SELECT MAX(id_grupo) FROM tgrupo)));
--
-- Dumping data for table "tlanguage"
@ -171,6 +174,7 @@ INSERT INTO "tlink" VALUES
(5,'Module library','http://pandorafms.org/?sec=community&amp;sec2=repository&amp;lng=es'),
(6,'Commercial support','http://pandorafms.com');
COMMIT WORK;
SELECT setval('tlink_id_link_seq', (SELECT (SELECT MAX(id_link) FROM tlink)));
--
-- Dumping data for table "tmodule_group"
@ -188,6 +192,7 @@ INSERT INTO "tmodule_group" VALUES
(8,'Enviromental'),
(9,'Users');
COMMIT WORK;
SELECT setval('tmodule_group_id_mg_seq', (SELECT (SELECT MAX(id_mg) FROM tmodule_group)));
--
-- Dumping data for table "torigen"
@ -228,6 +233,7 @@ INSERT INTO "ttipo_modulo" VALUES
(23,'async_string', 8, 'Asyncronous string data', 'mod_async_string.png'),
(24,'log4x',0,'Log4x','mod_log4x.png'),
(100,'keep_alive',-1,'KeepAlive','mod_keepalive.png');
SELECT setval('ttipo_modulo_id_tipo_seq', (SELECT (SELECT MAX(id_tipo) FROM ttipo_modulo)));
-- Categoria field is used to segregate several types
-- (plugin, agents, network) on their data
@ -243,20 +249,24 @@ INSERT INTO "tusuario" ("id_user", "fullname", "firstname", "lastname", "middlen
-- Dumping data for table "tusuario_perfil"
--
INSERT INTO "tusuario_perfil" VALUES (1,'admin',5,0,'admin');
SELECT setval('tusuario_perfil_id_up_seq', (SELECT (SELECT MAX(id_up) FROM tusuario_perfil)));
--
-- Dumping data for table "tperfil"
--
INSERT INTO "tperfil" VALUES (1,'Operator&#x20;&#40;Read&#41;',0,1,0,1,0,0,0,0,0,0),(2,'Operator&#x20;&#40;Write&#41;',1,1,0,1,0,0,0,0,0,0),(3,'Chief&#x20;Operator',1,1,1,1,0,0,0,0,1,0),(4,'Group&#x20;coordinator',1,1,1,1,1,1,1,0,0,0),(5,'Pandora&#x20;Administrator',1,1,1,1,1,1,1,1,1,1);
SELECT setval('tperfil_id_perfil_seq', (SELECT (SELECT MAX(id_perfil) FROM tperfil)));
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.',NOW()),
(2,'admin','New GIS Feature','Try our new GIS representation, activate GIS in Setup to see new available options.',NOW());
SELECT setval('tnews_id_news_seq', (SELECT (SELECT MAX(id_news) FROM tnews)));
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');
SELECT setval('tmodule_id_module_seq', (SELECT (SELECT MAX(id_module) FROM tmodule)));
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);
@ -298,6 +308,7 @@ INSERT INTO "tnetwork_component" ("id_nc", "name", "description", "id_group", "t
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);
SELECT setval('tnetwork_component_id_nc_seq', (SELECT (SELECT MAX(id_nc) FROM tnetwork_component)));
--
-- Dumping data for table "tnetwork_component_group"
@ -310,6 +321,7 @@ INSERT INTO "tnetwork_component_group" ("id_sg", "name", "parent") VALUES (11,'M
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);
SELECT setval('tnetwork_component_group_id_sg_seq', (SELECT (SELECT MAX(id_sg) FROM tnetwork_component_group)));
-- Network profile
INSERT INTO "tnetwork_profile" ("id_np", "name", "description") VALUES (1,'Basic Network Monitoring','This includes basic SNMP, ICMP, and TCP checks.');
@ -318,6 +330,7 @@ INSERT INTO "tnetwork_profile" ("id_np", "name", "description") VALUES (3,'Basic
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.');
SELECT setval('tnetwork_profile_id_np_seq', (SELECT (SELECT MAX(id_np) FROM tnetwork_profile)));
INSERT INTO "tnetwork_profile_component" ("id_nc", "id_np") VALUES (24,1);
INSERT INTO "tnetwork_profile_component" ("id_nc", "id_np") VALUES (25,1);
@ -367,23 +380,29 @@ INSERT INTO "tnetwork_profile_component" ("id_nc", "id_np") VALUES (202,6);
-- GIS Data
INSERT INTO "tgis_map" VALUES (1,'Sample',-3.708187,40.42056,0,16,'',-3.708187,40.42056,0,0,1);
SELECT setval('tgis_map_id_tgis_map_seq', (SELECT (SELECT MAX(id_tgis_map) FROM tgis_map)));
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);
SELECT setval('tgis_map_connection_id_tmap_connection_seq', (SELECT (SELECT MAX(id_tmap_connection) FROM tgis_map_connection)));
INSERT INTO "tgis_map_has_tgis_map_connection" VALUES (1,1,'2010-03-01 09:46:48',1);
INSERT INTO "tgis_map_layer" VALUES (1,'Group All',1,0,1,0);
SELECT setval('tgis_map_layer_id_tmap_layer_seq', (SELECT (SELECT MAX(id_tmap_layer) FROM tgis_map_layer)));
-- example alert template
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);
SELECT setval('talert_commands_id_seq', (SELECT (SELECT MAX(id) FROM talert_commands)));
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);
SELECT setval('talert_actions_id_seq', (SELECT (SELECT MAX(id) FROM talert_actions)));
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,'12:00:00','12:00:00',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,'12:00:00','12:00:00',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,'12:00:00','12:00:00',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);
SELECT setval('talert_templates_id_seq', (SELECT (SELECT MAX(id) FROM talert_templates)));
-- treport_custom_sql Data
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;');
INSERT INTO "treport_custom_sql" ("id", "name", "sql") VALUES (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;=&#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;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;&lt;&#x20;NOW&#40;&#41;&#x20;-&#x20;&#40;intervalo&#x20;/&#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,&#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;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;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;AND&#x20;&#40;UNIX_TIMESTAMP&#40;NOW&#40;&#41;&#41;&#x20;-&#x20;tagente_estado.utimestamp&#41;&#x20;&gt;=&#x20;&#40;tagente_estado.current_interval&#x20;/&#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,&#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;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;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;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;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.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;-&#x20;tagente_estado.utimestamp&#41;&#x20;&lt;&#x20;&#40;tagente_estado.current_interval&#x20;/&#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;&#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;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;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&#x20;=&#x20;0&#x20;AND&#x20;estado&#x20;=&#x20;1&#x20;AND&#x20;&#40;&#40;UNIX_TIMESTAMP&#40;NOW&#40;&#41;&#41;&#x20;-&#x20;tagente_estado.utimestamp&#41;&#x20;&lt;&#x20;&#40;tagente_estado.current_interval&#x20;/&#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;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;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;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;=&#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;&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;');
SELECT setval('treport_custom_sql_id_seq', (SELECT (SELECT MAX(id) FROM treport_custom_sql)));