Fixed the function 'events_create_event' for oracle databases

This commit is contained in:
Alejandro Gallardo Escobar 2015-05-25 19:53:20 +02:00
parent 163fcd1e09
commit 23b199d7cd
1 changed files with 7 additions and 12 deletions

View File

@ -739,8 +739,7 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data,
server_id)
VALUES (%d, %d, "%s", CURRENT_TIMESTAMP, %d,
ceil((sysdate - to_date(\'19700101000000\',\'YYYYMMDDHH24MISS\')) * (' . SECONDS_1DAY . ')),
VALUES (%d, %d, "%s", CURRENT_TIMESTAMP, %d, UNIX_TIMESTAMP,
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s",
"%s", "%s", %d)',
$id_agent, $id_group, $event, $status, $id_user,
@ -761,8 +760,7 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data)
VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()),
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s",
"%s", "%s")',
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s")',
$id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,
@ -777,24 +775,21 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
unknown_instructions, source, tags, custom_data)
VALUES (%d, %d, "%s", NOW(), %d,
ceil(date_part(\'epoch\', CURRENT_TIMESTAMP)), "%s",
"%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s",
"%s")',
"%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s")',
$id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data);
break;
case "oracle":
$sql = sprintf ('
INSERT INTO ' . $table_events . ' (id_agente, id_grupo, evento,
$sql = sprintf ("
INSERT INTO " . $table_events . " (id_agente, id_grupo, evento,
timestamp, estado, utimestamp, id_usuario,
event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data)
VALUES (%d, %d, "%s", CURRENT_TIMESTAMP, %d,
ceil((sysdate - to_date(\'19700101000000\',\'YYYYMMDDHH24MISS\')) * (' . SECONDS_1DAY . ')),
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s",
"%s", "%s")',
VALUES (%d, %d, '%s', CURRENT_TIMESTAMP, %d, UNIX_TIMESTAMP,
'%s', '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s')",
$id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,