2011-05-20 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/db/oracle.php
	include/functions_agents.php
	include/functions_db.php
	include/functions_alerts.php
	pandoradb.oracle.sql
	pandoradb.data.oracle.sql
	godmode/alerts/configure_alert_compound.php
	godmode/alerts/configure_alert_template.php
	godmode/snmpconsole/snmp_alert.php
	godmode/users/configure_user.php
	godmode/reporting/reporting_builder.list_items.php
	godmode/reporting/reporting_builder.php: Several corrections 
	over Console code for Oracle support. 



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4371 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-05-20 10:47:42 +00:00
parent 81e7fb6ddb
commit 1498ad4e8d
13 changed files with 374 additions and 114 deletions

View File

@ -1,3 +1,19 @@
2011-05-20 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/db/oracle.php
include/functions_agents.php
include/functions_db.php
include/functions_alerts.php
pandoradb.oracle.sql
pandoradb.data.oracle.sql
godmode/alerts/configure_alert_compound.php
godmode/alerts/configure_alert_template.php
godmode/snmpconsole/snmp_alert.php
godmode/users/configure_user.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/reporting_builder.php: Several corrections
over Console code for Oracle support.
2011-05-19 Vanessa Gil <vanessa.gil@artica.es>
* operation/agentes/alerts_status.php

View File

@ -95,6 +95,8 @@ function print_alert_compound_steps ($step, $id) {
}
function update_compound ($step) {
global $config;
$id = (int) get_parameter ('id');
if (empty ($id))
@ -138,20 +140,40 @@ function update_compound ($step) {
$min_alerts = (int) get_parameter ('min_alerts');
if ($threshold == -1)
$threshold = (int) get_parameter ('other_threshold');
$values = array ('monday' => $monday,
'tuesday' => $tuesday,
'wednesday' => $wednesday,
'thursday' => $thursday,
'friday' => $friday,
'saturday' => $saturday,
'sunday' => $sunday,
'time_from' => $time_from,
'time_to' => $time_to,
'time_threshold' => $threshold,
'max_alerts' => $max_alerts,
'min_alerts' => $min_alerts
);
switch ($config['dbtype']){
case "mysql":
case "postgresql":
$values = array ('monday' => $monday,
'tuesday' => $tuesday,
'wednesday' => $wednesday,
'thursday' => $thursday,
'friday' => $friday,
'saturday' => $saturday,
'sunday' => $sunday,
'time_from' => $time_from,
'time_to' => $time_to,
'time_threshold' => $threshold,
'max_alerts' => $max_alerts,
'min_alerts' => $min_alerts
);
break;
case "oracle":
$values = array ('monday' => $monday,
'tuesday' => $tuesday,
'wednesday' => $wednesday,
'thursday' => $thursday,
'friday' => $friday,
'saturday' => $saturday,
'sunday' => $sunday,
'time_from' => "#to_date('" . $time_from . "', 'hh24:mi:ss')",
'time_to' => "#to_date('" . $time_to . "', 'hh24:mi:ss')",
'time_threshold' => $threshold,
'max_alerts' => $max_alerts,
'min_alerts' => $min_alerts
);
break;
}
$result = alerts_update_alert_compound ($id, $values);
@ -355,8 +377,18 @@ if ($step == 2) {
5, 7, true);
$table->data[4][0] = __('Actions');
$table->data[4][1] = html_print_select_from_sql ('SELECT id, name FROM talert_actions ORDER BY name',
'action', '', '', __('Select'), 0, true, false, false).' ';
switch ($config['dbtype']){
case "mysql":
case "postgresql":
$table->data[4][1] = html_print_select_from_sql ('SELECT id, name FROM talert_actions ORDER BY name',
'action', '', '', __('Select'), 0, true, false, false).' ';
break;
case "oracle":
$table->data[4][1] = html_print_select_from_sql ('SELECT id, dbms_lob.substr(name,4000,1) as name FROM talert_actions ORDER BY dbms_lob.substr(name,4000,1)',
'action', '', '', __('Select'), 0, true, false, false).' ';
break;
}
$table->data[4][1] .= html_print_button (__('Add'), 'add_action', false, '',
'class="sub next"', true);
$table->data[4][1] .= '<br />';

View File

@ -161,6 +161,8 @@ function print_alert_template_steps ($step, $id) {
}
function update_template ($step) {
global $config;
$id = (int) get_parameter ('id');
if (empty ($id))
@ -213,25 +215,47 @@ function update_template ($step) {
if (empty ($default_action)) {
$default_action = NULL;
}
$values = array ('monday' => $monday,
'tuesday' => $tuesday,
'wednesday' => $wednesday,
'thursday' => $thursday,
'friday' => $friday,
'saturday' => $saturday,
'sunday' => $sunday,
'time_from' => $time_from,
'time_to' => $time_to,
'time_threshold' => $threshold,
'id_alert_action' => $default_action,
'field1' => $field1,
'field2' => $field2,
'field3' => $field3,
'max_alerts' => $max_alerts,
'min_alerts' => $min_alerts
);
switch ($config['dbtype']){
case "mysql":
case "postgresql":
$values = array ('monday' => $monday,
'tuesday' => $tuesday,
'wednesday' => $wednesday,
'thursday' => $thursday,
'friday' => $friday,
'saturday' => $saturday,
'sunday' => $sunday,
'time_from' => $time_from,
'time_to' => $time_to,
'time_threshold' => $threshold,
'id_alert_action' => $default_action,
'field1' => $field1,
'field2' => $field2,
'field3' => $field3,
'max_alerts' => $max_alerts,
'min_alerts' => $min_alerts
);
break;
case "oracle":
$values = array ('monday' => $monday,
'tuesday' => $tuesday,
'wednesday' => $wednesday,
'thursday' => $thursday,
'friday' => $friday,
'saturday' => $saturday,
'sunday' => $sunday,
'time_from' => "#to_date('" . $time_from . "','hh24:mi:ss')",
'time_to' => "#to_date('" . $time_to . "','hh24:mi:ss')",
'time_threshold' => $threshold,
'id_alert_action' => $default_action,
'field1' => $field1,
'field2' => $field2,
'field3' => $field3,
'max_alerts' => $max_alerts,
'min_alerts' => $min_alerts
);
break;
}
$result = alerts_update_alert_template ($id, $values);
}
elseif ($step == 3) {
@ -307,14 +331,29 @@ if ($create_template) {
$priority = (int) get_parameter ('priority');
$id_group = get_parameter ("id_group");
$values = array ('description' => $description,
'value' => $value,
'max_value' => $max,
'min_value' => $min,
'id_group' => $id_group,
'matches_value' => $matches,
'priority' => $priority);
switch ($config['dbtype']){
case "mysql":
case "postgresql":
$values = array ('description' => $description,
'value' => $value,
'max_value' => $max,
'min_value' => $min,
'id_group' => $id_group,
'matches_value' => $matches,
'priority' => $priority);
break;
case "oracle":
$values = array ('description' => $description,
'value' => $value,
'max_value' => $max,
'min_value' => $min,
'id_group' => $id_group,
'matches_value' => $matches,
'priority' => $priority,
'field3' => ' ',
'field3_recovery' => ' ');
break;
}
$result = alerts_create_alert_template ($name, $type, $values);
if ($result) {
@ -457,7 +496,15 @@ if ($step == 2) {
$table->data[4][0] = __('Default action');
$usr_groups = implode(',', array_keys(users_get_groups($config['id_user'], 'LM', true)));
$sql_query = sprintf('SELECT id, name FROM talert_actions WHERE id_group IN (%s) ORDER BY name', $usr_groups);
switch ($config['dbtype']){
case "mysql":
case "postgresql":
$sql_query = sprintf('SELECT id, name FROM talert_actions WHERE id_group IN (%s) ORDER BY name', $usr_groups);
break;
case "oracle":
$sql_query = sprintf('SELECT id, dbms_lob.substr(name,4000,1) as nombre FROM talert_actions WHERE id_group IN (%s) ORDER BY dbms_lob.substr(name,4000,1)', $usr_groups);
break;
}
$table->data[4][1] = html_print_select_from_sql ($sql_query,
'default_action', $default_action, '', __('None'), 0,
true, false, false).ui_print_help_tip (__('In case you fill any Field 1, Field 2 or Field 3 above, those will replace the corresponding fields of this associated "Default action".'), true);

View File

@ -26,19 +26,37 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
include_once($config['homedir'] . "/include/functions_agents.php");
//FORM FILTER
$rows = db_get_all_rows_sql('
SELECT t5.nombre, t5.id_agente
FROM
(
SELECT t1.*, id_agente
FROM treport_content AS t1
LEFT JOIN tagente_modulo AS t2
ON t1.id_agent_module = id_agente_modulo
) AS t4
INNER JOIN tagente AS t5
ON (t4.id_agent = t5.id_agente OR t4.id_agente = t5.id_agente)
WHERE t4.id_report = ' . $idReport);
switch ($config['dbtype']){
case "mysql":
case "postgresql":
$rows = db_get_all_rows_sql('
SELECT t5.nombre, t5.id_agente
FROM
(
SELECT t1.*, id_agente
FROM treport_content AS t1
LEFT JOIN tagente_modulo AS t2
ON t1.id_agent_module = id_agente_modulo
) AS t4
INNER JOIN tagente AS t5
ON (t4.id_agent = t5.id_agente OR t4.id_agente = t5.id_agente)
WHERE t4.id_report = ' . $idReport);
break;
case "oracle":
$rows = db_get_all_rows_sql('
SELECT t5.nombre, t5.id_agente
FROM
(
SELECT t1.*, id_agente
FROM treport_content t1
LEFT JOIN tagente_modulo t2
ON t1.id_agent_module = id_agente_modulo
) t4
INNER JOIN tagente t5
ON (t4.id_agent = t5.id_agente OR t4.id_agente = t5.id_agente)
WHERE t4.id_report = ' . $idReport);
break;
}
if ($rows === false) {
$rows = array();
}
@ -48,12 +66,25 @@ foreach ($rows as $row) {
$agents[$row['id_agente']] = $row['nombre'];
}
$rows = db_get_all_rows_sql('
SELECT t1.id_agent_module, t2.nombre
FROM treport_content AS t1
INNER JOIN tagente_modulo AS t2
ON t1.id_agent_module = t2.id_agente_modulo
WHERE t1.id_report = ' . $idReport);
switch ($config['dbtype']){
case "mysql":
case "postgresql":
$rows = db_get_all_rows_sql('
SELECT t1.id_agent_module, t2.nombre
FROM treport_content AS t1
INNER JOIN tagente_modulo AS t2
ON t1.id_agent_module = t2.id_agente_modulo
WHERE t1.id_report = ' . $idReport);
break;
case "oracle":
$rows = db_get_all_rows_sql('
SELECT t1.id_agent_module, t2.nombre
FROM treport_content t1
INNER JOIN tagente_modulo t2
ON t1.id_agent_module = t2.id_agente_modulo
WHERE t1.id_report = ' . $idReport);
break;
}
if ($rows === false) {
$rows = array();
}
@ -143,8 +174,10 @@ switch ($config["dbtype"]) {
$set['offset'] = $offset;
$items = oracle_recode_query ('SELECT * FROM treport_content WHERE ' . $where . ' AND id_report = ' . $idReport . ' ORDER BY "order"', $set, 'AND', false);
// Delete rnum row generated by oracle_recode_query() function
for ($i=0; $i < count($items); $i++) {
unset($items[$i]['rnum']);
if ($items !== false){
for ($i=0; $i < count($items); $i++) {
unset($items[$i]['rnum']);
}
}
break;
}

View File

@ -232,7 +232,21 @@ switch ($action) {
$values['id_gs'] = get_parameter('id_custom_graph');
$values['text'] = get_parameter('text');
$values['id_agent_module'] = get_parameter('id_agent_module');
$values['only_display_wrong'] = get_parameter('checkbox_only_display_wrong');
switch ($config['dbtype']){
case "mysql":
case "postgresql":
$values['only_display_wrong'] = get_parameter('checkbox_only_display_wrong');
break;
case "oracle":
$only_display_wrong_tmp = get_parameter('checkbox_only_display_wrong');
if (empty($only_display_wrong_tmp)){
$values['only_display_wrong'] = 0;
}
else{
$values['only_display_wrong'] = $only_display_wrong_tmp;
}
break;
}
$values['monday'] = get_parameter('monday', 0);
$values['tuesday'] = get_parameter('tuesday', 0);
$values['wednesday'] = get_parameter('wednesday', 0);
@ -240,12 +254,21 @@ switch ($action) {
$values['friday'] = get_parameter('friday', 0);
$values['saturday'] = get_parameter('saturday', 0);
$values['sunday'] = get_parameter('sunday', 0);
$values['time_from'] = get_parameter('time_from');
$values['time_to'] = get_parameter('time_to');
$values['group_by_agent'] = get_parameter ('checkbox_row_group_by_agent');
$values['show_resume'] = get_parameter ('checkbox_show_resume');
$values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown');
$values['top_n'] = get_parameter('radiobutton_max_min_avg');
switch ($config['dbtype']){
case "mysql":
case "postgresql":
$values['time_from'] = get_parameter('time_from');
$values['time_to'] = get_parameter('time_to');
break;
case "oracle":
$values['time_from'] = '#to_date(\'' . get_parameter('time_from') . '\',\'hh24:mi\')';
$values['time_to'] = '#to_date(\'' . get_parameter('time_to') . '\', \'hh24:mi\')';
break;
}
$values['group_by_agent'] = get_parameter ('checkbox_row_group_by_agent',0);
$values['show_resume'] = get_parameter ('checkbox_show_resume',0);
$values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown',0);
$values['top_n'] = get_parameter('radiobutton_max_min_avg',0);
$values['top_n_value'] = get_parameter('quantity');
$values['exception_condition'] = get_parameter('radiobutton_exception_condition');
$values['exception_condition_value'] = get_parameter('exception_condition_value');
@ -292,7 +315,7 @@ switch ($action) {
case "postgresql":
case "oracle":
$max = db_get_all_rows_sql('SELECT max("order") AS max
FROM treport_content WHERE id_report = ' . $idReport . ';');
FROM treport_content WHERE id_report = ' . $idReport);
break;
}
if ($max === false) {

View File

@ -164,8 +164,17 @@ if (isset ($_GET["update_alert"])) {
$fields[$row["id"]] = $row["name"];
}
html_print_select_from_sql ('SELECT id, name FROM talert_actions ORDER BY name',
"alert_type", $alert_type, '', '', 0, false, false, false);
switch ($config['dbtype']){
case "mysql":
case "postgresql":
html_print_select_from_sql ('SELECT id, name FROM talert_actions ORDER BY name',
"alert_type", $alert_type, '', '', 0, false, false, false);
break;
case "oracle":
html_print_select_from_sql ('SELECT id, dbms_lob.substr(name,4000,1) as name FROM talert_actions ORDER BY dbms_lob.substr(name,4000,1)',
"alert_type", $alert_type, '', '', 0, false, false, false);
break;
}
echo '</td></tr>';
// Description

View File

@ -98,13 +98,13 @@ if ($create_user) {
$values['email'] = (string) get_parameter ('email');
$values['phone'] = (string) get_parameter ('phone');
$values['comments'] = (string) get_parameter ('comments');
$values['is_admin'] = get_parameter ('is_admin', 0);
$values['is_admin'] = (int) get_parameter ('is_admin', 0);
$values['language'] = get_parameter ('language', $config["language"]);
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
$values['id_skin'] = get_parameter ('skin', 0);
$values['id_skin'] = (int) get_parameter ('skin', 0);
}
$values['block_size'] = get_parameter ('block_size', $config["block_size"]);
$values['flash_chart'] = get_parameter ('flash_charts', $config["flash_charts"]);
$values['block_size'] = (int) get_parameter ('block_size', $config["block_size"]);
$values['flash_chart'] = (int) get_parameter ('flash_charts', $config["flash_charts"]);
if ($id == '') {
ui_print_error_message (__('User ID cannot be empty'));
@ -139,7 +139,16 @@ if ($create_user) {
$info .= ' Skin: ' . $values['id_skin'];
}
$result = create_user($id, $password_new, $values);
switch ($config['dbtype']){
case "mysql":
case "postgresql":
$result = create_user($id, $password_new, $values);
break;
case "oracle":
$result = db_process_sql('/INSERT INTO tusuario (fullname, firstname, lastname, email, phone, comments, is_admin, language, id_skin, block_size, flash_chart, id_user, password, last_connect, registered) VALUES (\'' . $values['fullname'] . '\',\'\',\'\',\'\',\'\',\'\',' . $values['is_admin'] . ',\'' . $values['language'] .'\',' . $values['id_skin'] . ',' . $values['block_size'] . ',' . $values['flash_chart'] . ',\'' . $id . '\',\'' . $password_new . '\',0,\'' . get_system_time () . '\')');
break;
}
db_pandora_audit("User management",
"Created user ".io_safe_input($id), false, false, $info);

View File

@ -237,7 +237,7 @@ function oracle_db_process_sql($sql, $rettype = "affected_rows", $dbconnection =
}
// Prevent execution of insert_id stored procedure
else if ($type[0] == '/INSERT'){
$query = oci_parse($dbconnection, substr($sql,1));
$query = oci_parse($config['dbconnection'], substr($sql,1));
}
else{
$query = oci_parse($config['dbconnection'], $sql);
@ -812,8 +812,10 @@ function oracle_recode_query ($sql, $values, $join = 'AND', $return = true) {
}
else{
$result = oracle_db_process_sql($result);
for ($i=0; $i < count($result); $i++) {
unset($result[$i]['RNUM']);
if ($result !== false){
for ($i=0; $i < count($result); $i++) {
unset($result[$i]['RNUM']);
}
}
return $result;
}
@ -1080,10 +1082,14 @@ function oracle_db_format_array_to_update_sql ($values) {
else {
/* String */
if (isset ($value[0]) && $value[0] == '`')
/* Don't round with quotes if it references a field */
$sql = sprintf ("%s = %s", $field, str_replace('`', '', $value));
else
$sql = sprintf ("%s = '%s'", $field, $value);
/* Don't round with quotes if it references a field */
$sql = sprintf ("%s = %s", $field, str_replace('`', '', $value));
else if (substr($value, 0,1) == '#'){
$sql = sprintf ("%s = %s", $field, substr($value,1));
}
else{
$sql = sprintf ("%s = '%s'", $field, $value);
}
}
array_push ($fields, $sql);
}

View File

@ -807,7 +807,7 @@ function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower
$search_sql .= ' AND nombre COLLATE utf8_general_ci LIKE \'' . $name . '\' ';
break;
case "oracle":
$search_sql .= ' AND nombre LIKE UPPER("' . $name . '") ';
$search_sql .= ' AND UPPER(nombre) LIKE UPPER(\'' . $name . '\') ';
break;
}
@ -962,13 +962,29 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
}
if ($value[0] == '%') {
array_push ($fields, $field.' LIKE "'.$value.'"');
switch ($config['dbtype']){
case "mysql":
case "postgresql":
array_push ($fields, $field.' LIKE "'.$value.'"');
break;
case "oracle":
array_push ($fields, $field.' LIKE \''.$value.'\'');
break;
}
}
else if ($operatorDistin) {
array_push($fields, $field.' <> ' . substr($value, 2));
}
else if (substr($value, -1) == '%') {
array_push ($fields, $field.' LIKE "'.$value.'"');
switch ($config['dbtype']){
case "mysql":
case "postgresql":
array_push ($fields, $field.' LIKE "'.$value.'"');
break;
case "oracle":
array_push ($fields, $field.' LIKE \''.$value.'\'');
break;
}
}
else {
switch ($config["dbtype"]) {
@ -995,10 +1011,29 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
}
if (empty ($details)) {
$details = "nombre";
switch ($config['dbtype']){
case "mysql":
case "postgresql":
$details = "nombre";
break;
case "oracle":
$details = "dbms_lob.substr(nombre,4000,1) as nombre";
}
}
else {
$details = io_safe_input ($details);
else {
if ($config['dbtype'] == 'oracle'){
$details_new = array();
foreach ($details as $detail){
if ($detail == 'nombre')
$details_new[] = 'dbms_lob.substr(nombre,4000,1) as nombre';
else
$details_new[] = $detail;
}
html_debug_print($details_new,"/tmp/prueba.txt");
$details = io_safe_input ($details_new);
}
else
$details = io_safe_input ($details);
}
switch ($config["dbtype"]) {

View File

@ -552,11 +552,26 @@ function alerts_get_alert_templates ($filter = false, $fields = false) {
* @return mixed Selected alert template or false if something goes wrong.
*/
function alerts_get_alert_template ($id_alert_template) {
global $config;
$id_alert_template = safe_int ($id_alert_template, 1);
if (empty ($id_alert_template))
return false;
return db_get_row ('talert_templates', 'id', $id_alert_template);
switch ($config['dbtype']){
case "mysql":
case "postgresql":
return db_get_row ('talert_templates', 'id', $id_alert_template);
break;
case "oracle":
$fields_select = db_get_all_rows_sql('SELECT column_name FROM user_tab_columns WHERE table_name = \'TALERT_TEMPLATES\' AND column_name NOT IN (\'TIME_FROM\',\'TIME_TO\')');
foreach ($fields_select as $field_select){
$select_field[] = $field_select['column_name'];
}
$select_stmt = implode(',', $select_field);
return db_get_row_sql("SELECT $select_stmt, to_char(time_from, 'hh24:mi:ss') as time_from, to_char(time_to, 'hh24:mi:ss') as time_to FROM talert_templates");
break;
}
}
/**
@ -1234,6 +1249,8 @@ function alerts_compound_operations () {
* @return Id of the alert compound of false is something goes wrong.
*/
function alerts_create_alert_compound ($name, $id_agent, $values = false) {
global $config;
if (empty ($name))
return false;
if (! is_array ($values))
@ -1241,6 +1258,12 @@ function alerts_create_alert_compound ($name, $id_agent, $values = false) {
$values['name'] = $name;
$values['id_agent'] = (int) $id_agent;
switch($config['dbtype']){
case "oracle":
$values['field3_recovery'] = ' ';
break;
}
return @db_process_sql_insert ('talert_compound', $values);
}
@ -1325,7 +1348,22 @@ function alerts_get_alert_compounds ($filter = false, $fields = false) {
* @return Result set of the selected alert compound or false is something goes wrong.
*/
function alerts_get_alert_compound ($id_alert_compound) {
return db_get_row ('talert_compound', 'id', $id_alert_compound);
global $config;
switch ($config['dbtype']){
case "mysql":
case "postgresql":
return db_get_row ('talert_compound', 'id', $id_alert_compound);
break;
case "oracle":
$fields_select = db_get_all_rows_sql('SELECT column_name FROM user_tab_columns WHERE table_name = \'TALERT_COMPOUND\' AND column_name NOT IN (\'TIME_FROM\',\'TIME_TO\')');
foreach ($fields_select as $field_select){
$select_field[] = $field_select['column_name'];
}
$select_stmt = implode(',', $select_field);
return db_get_row_sql("SELECT $select_stmt, to_char(time_from, 'hh24:mi:ss') as time_from, to_char(time_to, 'hh24:mi:ss') as time_to FROM talert_compound");
break;
}
}
/**

View File

@ -127,13 +127,25 @@ function db_pandora_audit($accion, $descripcion, $user_id = false, $ip = false,
$accion = io_safe_input($accion);
$descripcion = io_safe_input($descripcion);
$values = array('id_usuario' => $id,
'accion' => $accion,
'ip_origen' => $ip,
'descripcion' => $descripcion,
'fecha' => date('Y-m-d H:i:s'),
'utimestamp' => time());
switch ($config['dbtype']){
case "mysql":
case "postgresql":
$values = array('id_usuario' => $id,
'accion' => $accion,
'ip_origen' => $ip,
'descripcion' => $descripcion,
'fecha' => date('Y-m-d H:i:s'),
'utimestamp' => time());
break;
case "oracle":
$values = array('id_usuario' => $id,
'accion' => $accion,
'ip_origen' => $ip,
'descripcion' => $descripcion,
'fecha' => '#to_date(\'' . date('Y-m-d H:i:s') . '\',\'YYYY-MM-DD HH24:MI:SS\')',
'utimestamp' => time());
break;
}
$id_audit = db_process_sql_insert('tsesion', $values);
enterprise_include_once('include/functions_audit.php');

View File

@ -512,15 +512,15 @@ END;;
CREATE OR REPLACE PROCEDURE treport_custom_sql_insert (IDX IN NUMBER, NAME IN VARCHAR2, SQL_TXT IN VARCHAR2, FLAG IN NUMBER) AS g_nclob CLOB; 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;;
BEGIN
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);
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;t3&#x20;where&#x20;t1.id_grupo&#x20;=',0);
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);
treport_custom_sql_insert(4, 'Group&#x20;view','&#x20;t3.id_grupo&#41;&#x20;agents,&#x20;&#40;SELECT&#x20;COUNT&#40;t4.id_agente&#41;&#x20;FROM&#x20;tagente&#x20;',1);
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);
treport_custom_sql_insert(4, 'Group&#x20;view','&lt;&#x20;NOW&#40;&#41;&#x20;-&#x20;&#40;intervalo&#x20;/',1);
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);
treport_custom_sql_insert(4, 'Group&#x20;view','&#x20;&#40;1/2&#41;&#41;&#41;&#x20;agent_unknown,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,',1);
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);
@ -532,13 +532,13 @@ treport_custom_sql_insert(4, 'Group&#x20;view','AND&#x20;&#40;UNIX_TIMESTAMP&#40
treport_custom_sql_insert(4, 'Group&#x20;view','&#x20;tagente_estado.utimestamp&#41;&#x20;&gt;=&#x20;&#40;tagente_estado.current_interval&#x20;/',1);
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);
treport_custom_sql_insert(4,'Group&#x20;view','&#x20;&#40;1/2&#41;&#41;&#41;&#x20;monitor_unknow,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,',1);
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);
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);
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);
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;monitor_no_init,&#x20;&#40;SELECT&#x20;',1);
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);
@ -550,7 +550,7 @@ treport_custom_sql_insert(4, 'Group&#x20;view','&#x20;tagente_estado.utimestamp&
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);
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);
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;monitor_ok,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;',1);
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);
@ -560,7 +560,7 @@ treport_custom_sql_insert(4, 'Group&#x20;view','#x20;=&#x20;0&#x20;AND&#x20;esta
treport_custom_sql_insert(4, 'Group&#x20;view','&#x20;tagente_estado.utimestamp&#41;&#x20;&lt;&#x20;&#40;tagente_estado.current_interval&#x20;/',1);
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);
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;',1);
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);
@ -568,8 +568,8 @@ treport_custom_sql_insert(4, 'Group&#x20;view','WHERE&#x20;tagente.id_grupo&#x20
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);
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);
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;monitor_alert_fired&#x20;from&#x20;tgrupo&#x20;t1&#x20;where&#x20;0&#x20;',1);
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);
treport_custom_sql_insert(4, 'Group&#x20;view','&lt;&#x20;&#40;select&#x20;count&#40;t2.id_agente&#41;&#x20;from&#x20;tagente&#x20;t2&#x20;where&#x20;t1.id_grupo&#x20;=&#x20;t2.id_grupo&#41;',1);
COMMIT;
END;;

View File

@ -812,8 +812,8 @@ CREATE OR REPLACE TRIGGER ttrap_inc BEFORE INSERT ON ttrap REFERENCING NEW AS NE
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,
firstname VARCHAR2(255),
lastname VARCHAR2(255),
middlename VARCHAR2(255) default '',
password VARCHAR2(45) default NULL,
comments VARCHAR2(200) default NULL,