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

* pandoradb.sql, pandoradb.postgreSQL.sql,
	extras/pandoradb_migrate_v3.2_to_v4.0.sql: changed the default value for
	zero/null date "0000-00-00 00:00:00" to "01-01-1970 00:00:00".

	* include/functions_graph.php,include/db/postgresql.php,
	include/functions_modules.php, include/functions_agents.php,
	operation/agentes/alerts_status.php,
	operation/agentes/estado_generalagente.php,
	operation/agentes/estado_agente.php, operation/agentes/exportdata.php,
	operation/agentes/ver_agente.php, operation/servers/view_server.php,
	operation/gis_maps/ajax.php, godmode/db/db_sanity.php,
	godmode/agentes/agent_template.php,
	godmode/agentes/module_manager_editor_network.php,
	godmode/agentes/configurar_agente.php, godmode/servers/plugin.php,
	godmode/snmpconsole/snmp_alert.php: small fixeds for the support the
	PostgreSQL engine.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4306 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-05-05 15:20:49 +00:00
parent 1efe08c12e
commit e242298137
21 changed files with 191 additions and 80 deletions

View File

@ -1,3 +1,21 @@
2011-05-05 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.sql, pandoradb.postgreSQL.sql,
extras/pandoradb_migrate_v3.2_to_v4.0.sql: changed the default value for
zero/null date "0000-00-00 00:00:00" to "01-01-1970 00:00:00".
* include/functions_graph.php,include/db/postgresql.php,
include/functions_modules.php, include/functions_agents.php,
operation/agentes/alerts_status.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/exportdata.php,
operation/agentes/ver_agente.php, operation/servers/view_server.php,
operation/gis_maps/ajax.php, godmode/db/db_sanity.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/configurar_agente.php, godmode/servers/plugin.php,
godmode/snmpconsole/snmp_alert.php: small fixeds for the support the
PostgreSQL engine.
2011-05-04 Vanessa Gil <vanessa.gil@artica.es>
* operation/agentes/estado_agente.php: Fixed error on list of agents

View File

@ -88,3 +88,20 @@ ALTER TABLE `tsesion` CHANGE `ID_sesion` `id_sesion` bigint(20) unsigned NOT NUL
ALTER TABLE `tsesion` CHANGE `ID_usuario` `id_usuario` varchar(60) NOT NULL default '0';
ALTER TABLE `tsesion` CHANGE `IP_origen` `ip_origen` varchar(100) NOT NULL default '';
-- -----------------------------------------------------
-- Change the value "0000-00-00 00:00:00" that Pandora use as zero or null date value
-- for the value "01-01-1970 00:00:00".
-- -----------------------------------------------------
UPDATE `tagente` SET `ultimo_contacto` = "01-01-1970 00:00:00" WHERE `ultimo_contacto` = "0000-00-00 00:00:00";
UPDATE `tagente` SET `ultimo_contacto_remoto` = "01-01-1970 00:00:00" WHERE `ultimo_contacto_remoto` = "0000-00-00 00:00:00";
UPDATE `tagente_estado` SET `timestamp` = "01-01-1970 00:00:00" WHERE `timestamp` = "0000-00-00 00:00:00";
UPDATE `tagente_estado` SET `last_try` = "01-01-1970 00:00:00" WHERE `last_try` = "0000-00-00 00:00:00";
UPDATE `talert_snmp` SET `last_fired` = "01-01-1970 00:00:00" WHERE `last_fired` = "0000-00-00 00:00:00";
UPDATE `tevento` SET `timestamp` = "01-01-1970 00:00:00" WHERE `timestamp` = "0000-00-00 00:00:00";
UPDATE `tincidencia` SET `inicio` = "01-01-1970 00:00:00" WHERE `inicio` = "0000-00-00 00:00:00";
UPDATE `tincidencia` SET `cierre` = "01-01-1970 00:00:00" WHERE `cierre` = "0000-00-00 00:00:00";
UPDATE `tserver` SET `laststart` = "01-01-1970 00:00:00" WHERE `laststart` = "0000-00-00 00:00:00";
UPDATE `tserver` SET `keepalive` = "01-01-1970 00:00:00" WHERE `keepalive` = "0000-00-00 00:00:00";
UPDATE `ttrap` SET `timestamp` = "01-01-1970 00:00:00" WHERE `timestamp` = "0000-00-00 00:00:00";
UPDATE `tnews` SET `timestamp` = "01-01-1970 00:00:00" WHERE `timestamp` = "0000-00-00 00:00:00";
UPDATE `tserver_export` SET `timestamp` = "01-01-1970 00:00:00" WHERE `timestamp` = "0000-00-00 00:00:00";

View File

@ -84,7 +84,7 @@ if (isset ($_POST["template_id"])) {
$values = array(
'id_agente_modulo' => $id_agente_modulo,
'datos' => 0,
'timestamp' => '0000-00-00 00:00:00',
'timestamp' => '01-01-1970 00:00:00',
'estado' => 0,
'id_agente' => $id_agente,
'utimestamp' => 0);

View File

@ -548,7 +548,7 @@ if ($update_module || $create_module) {
// where are very big and PHP uses scientific notation, p.e:
// 1.23E-10 is 0.000000000123
$post_process = (string) get_parameter ('post_process');
$post_process = (string) get_parameter ('post_process', 0.0);
$prediction_module = (int) get_parameter ('prediction_module');
$max_timeout = (int) get_parameter ('max_timeout');
$min = (int) get_parameter_post ("min");
@ -906,17 +906,20 @@ if ($updateGIS) {
// -----------------------------------
// Load page depending on tab selected
// -----------------------------------
switch ($tab) {
case "main":
require ("agent_manager.php");
break;
case "module":
if ($id_agent_module || $edit_module) {
require ("module_manager_editor.php");
}
else {
require ("module_manager.php");
}
break;
case "alert":
/* Because $id_agente is set, it will show only agent alerts */

View File

@ -19,8 +19,11 @@ $disabledBecauseInPolicy = false;
$disabledTextBecauseInPolicy = '';
$page = get_parameter('page', '');
if (strstr($page, "policy_modules") === false) {
if ($config['enterprise_installed'])
if ($config['enterprise_installed']) {
$disabledBecauseInPolicy = isModuleInPolicy($id_agent_module) && isModuleLinked($id_agent_module);
}
else
$disabledBecauseInPolicy = false;
if ($disabledBecauseInPolicy)
@ -32,7 +35,8 @@ define ('ID_NETWORK_COMPONENT_TYPE', 2);
if (empty ($update_module_id)) {
/* Function in module_manager_editor_common.php */
add_component_selection (ID_NETWORK_COMPONENT_TYPE);
} else {
}
else {
/* TODO: Print network component if available */
}
@ -55,7 +59,9 @@ $data = array ();
$data[0] = __('SNMP community');
$adopt = false;
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && isset($id_agent_module)) {
$adopt = isModuleAdopt($id_agent_module);
}
if (!$adopt) {
$data[1] = html_print_input_text ('snmp_community', $snmp_community, '', 15, 60, true, $disabledBecauseInPolicy);
@ -145,6 +151,15 @@ if (!isset($id_agent_module)) {
$snmp3_auth_method = '';
$snmp3_security_level = '';
}
else if ($id_agent_module === false) {
$snmp3_auth_user = '';
$snmp3_auth_pass = '';
$snmp_version = 1;
$snmp3_privacy_method = '';
$snmp3_privacy_pass = '';
$snmp3_auth_method = '';
$snmp3_security_level = '';
}
$data = array();
$data[0] = __('Auth user');

View File

@ -47,7 +47,7 @@ if ($sanity == 1) {
WHERE id_agente_modulo = $id_agente_modulo";
$total = db_get_sql ($sql);
if ($total == 0) {
$sql = "INSERT INTO tagente_estado (id_agente_modulo, datos, timestamp, estado, id_agente, last_try, utimestamp, current_interval, running_by, last_execution_try) VALUE ($id_agente_modulo, 0, '0000-00-00 00:00:00', 0, 100, $id_agente, '0000-00-00 00:00:00', 0, 0, 0)";
$sql = "INSERT INTO tagente_estado (id_agente_modulo, datos, timestamp, estado, id_agente, last_try, utimestamp, current_interval, running_by, last_execution_try) VALUE ($id_agente_modulo, 0, '01-01-1970 00:00:00', 0, 100, $id_agente, '01-01-1970 00:00:00', 0, 0, 0)";
echo "Inserting module $id_agente_modulo in state table <br>";
db_process_sql ($sql);
}

View File

@ -224,7 +224,7 @@ else {
}
// If not edition or insert, then list available plugins
$rows = db_get_sql('SELECT * FROM tplugin ORDER BY name');
$rows = db_get_all_rows_sql('SELECT * FROM tplugin ORDER BY name');
if ($rows !== false) {
echo '<table width="730" cellspacing="4" cellpadding="4" class="databox">';

View File

@ -304,7 +304,7 @@ if (isset ($_GET["update_alert"])) {
$data[4] = $row["description"];
$data[5] = $row["times_fired"];
if ($row["last_fired"] != "0000-00-00 00:00:00") {
if ($row["last_fired"] != "01-01-1970 00:00:00") {
$data[6] = $row["last_fired"];
} else {
$data[6] = __('Never');

View File

@ -381,18 +381,37 @@ function postgresql_db_get_value_filter ($field, $table, $filter, $where_join =
/* Avoid limit and offset if given */
unset ($filter['limit']);
unset ($filter['offset']);
$sql = sprintf ("SELECT \"%s\" FROM \"%s\" WHERE %s LIMIT 1",
if (strstr($field, "(") === false) {
//It is a field.
$field = '"' . $field . '"';
$is_a_function = false;
}
else {
//It is a function.
$is_a_function = true;
}
$sql = sprintf ("SELECT %s FROM \"%s\" WHERE %s LIMIT 1",
$field, $table,
db_format_array_where_clause_sql ($filter, $where_join));
$result = db_get_all_rows_sql ($sql);
if ($result === false)
return false;
$fieldClean = str_replace('`', '', $field);
if (!$is_a_function) {
$fieldClean = str_replace('"', '', $field);
$fieldClean = str_replace('`', '', $fieldClean);
}
else {
//Extract the name of function.
$temp = explode('(', $field);
$fieldClean = strtolower(trim($temp[0]));
}
return $result[0][$fieldClean];
}

View File

@ -171,6 +171,7 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
else {
$id_agent = (array) $id_agent;
$id_modules = array_keys (get_agent_modules ($id_agent, false, array('delete_pending' => 0)));
if (empty ($id_modules))
return array ();
@ -217,6 +218,7 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
WHERE id_agent_module in (%s) %s %s %s",
$selectText, $subQuery, $where, $filter, $orderbyText);
}
$alerts = db_get_all_rows_sql ($sql);
if ($alerts === false)
@ -770,7 +772,7 @@ function get_group_agents ($id_group = 0, $search = false, $case = "lower", $noA
$search_sql .= ' AND (nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%")';
break;
case "postgresql":
$search_sql .= ' AND (nombre COLLATE utf8_general_ci LIKE \'%'.$string.'%\' OR direccion LIKE \'%'.$string.'%\')';
$search_sql .= ' AND (nombre LIKE \'%'.$string.'%\' OR direccion LIKE \'%'.$string.'%\')';
break;
case "oracle":
$search_sql .= ' AND (UPPER(nombre) LIKE UPPER(\'%'.$string.'%\') OR direccion LIKE upper(\'%'.$string.'%\'))';
@ -787,7 +789,7 @@ function get_group_agents ($id_group = 0, $search = false, $case = "lower", $noA
$search_sql .= ' AND nombre COLLATE utf8_general_ci LIKE "' . $name . '" ';
break;
case "postgresql":
$search_sql .= ' AND nombre COLLATE utf8_general_ci LIKE \'' . $name . '\' ';
$search_sql .= ' AND nombre LIKE \'' . $name . '\' ';
break;
case "oracle":
$search_sql .= ' AND nombre LIKE UPPER("' . $name . '") ';
@ -917,7 +919,7 @@ function get_agent_modules ($id_agent = null, $details = false, $filter = false,
}
$where .= ' AND delete_pending = 0 ';
if (! empty ($filter)) {
$where .= ' AND ';
if (is_array ($filter)) {
@ -943,9 +945,11 @@ function get_agent_modules ($id_agent = null, $details = false, $filter = false,
else {
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
array_push ($fields, $field.' = "'.$value.'"');
break;
case "postgresql":
array_push ($fields, $field.' = \''.$value.'\'');
break;
case "oracle":
if (is_int ($value) ||is_float ($value)||is_double ($value))
array_push ($fields, $field.' = '.$value.'');
@ -990,9 +994,10 @@ function get_agent_modules ($id_agent = null, $details = false, $filter = false,
$where);
break;
}
$result = db_get_all_rows_sql ($sql);
if (empty ($result)) {
return array ();
}

View File

@ -733,7 +733,8 @@ function graph_event_module2 ($width = 300, $height = 200, $id_agent) {
FROM tevento, tagente_modulo
WHERE id_agentmodule = id_agente_modulo
AND disabled = 0 AND tevento.id_agente = %d
GROUP BY id_agentmodule LIMIT %d', $id_agent, $max_items);
GROUP BY id_agentmodule, nombre LIMIT %d', $id_agent, $max_items);
$events = db_get_all_rows_sql ($sql);
if ($events === false) {
if (! $graphic_type) {

View File

@ -225,36 +225,48 @@ function create_agent_module ($id_agent, $name, $values = false, $disableACL = f
return false;
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
case "mysql":
$result = db_process_sql_insert ('tagente_estado',
array ('id_agente_modulo' => $id_agent_module,
'datos' => 0,
'timestamp' => '0000-00-00 00:00:00',
'estado' => 0,
'id_agente' => (int) $id_agent,
'utimestamp' => 0,
'status_changes' => 0,
'last_status' => 0
));
array ('id_agente_modulo' => $id_agent_module,
'datos' => 0,
'timestamp' => '01-01-1970 00:00:00',
'estado' => 0,
'id_agente' => (int) $id_agent,
'utimestamp' => 0,
'status_changes' => 0,
'last_status' => 0
));
break;
case "postgresql":
$result = db_process_sql_insert ('tagente_estado',
array ('id_agente_modulo' => $id_agent_module,
'datos' => 0,
'timestamp' => null,
'estado' => 0,
'id_agente' => (int) $id_agent,
'utimestamp' => 0,
'status_changes' => 0,
'last_status' => 0
));
break;
case "oracle":
$result = db_process_sql_insert ('tagente_estado',
array ('id_agente_modulo' => $id_agent_module,
'datos' => 0,
'timestamp' => 'to_date(0000-00-00 00:00:00, \'YYYY-MM-DD HH24:MI:SS\')',
'estado' => 0,
'id_agente' => (int) $id_agent,
'utimestamp' => 0,
'status_changes' => 0,
'last_status' => 0
));
array ('id_agente_modulo' => $id_agent_module,
'datos' => 0,
'timestamp' => 'to_date(01-01-1970 00:00:00, \'YYYY-MM-DD HH24:MI:SS\')',
'estado' => 0,
'id_agente' => (int) $id_agent,
'utimestamp' => 0,
'status_changes' => 0,
'last_status' => 0
));
break;
}
if ($result === false) {
db_process_sql_delete ('tagente_modulo',
array ('id_agente_modulo' => $id_agent_module));
return false;
}

View File

@ -42,7 +42,7 @@ $alert_validate = (bool) get_parameter ('alert_validate', 0);
$tab = get_parameter_get ("tab", null);
$url = 'index.php?sec='.$sec.'&sec2='.$sec2.'&refr='.$config["refr"].'&filter='.$filter.'&filter_standby='.$filter_standby.'&ag_group='.$id_group;
if ($flag_alert == 1 && check_acl($config['id_user'], $id_group, "AW")) {
forceExecution($id_group);
}
@ -212,11 +212,14 @@ if($filter_standby == 'standby_on') {
}else {
$filter_alert['disabled'] = $filter;
}
$alerts['alerts_simple'] = agents_get_alerts_simple ($agents, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup);
$countAlertsSimple = agents_get_alerts_simple ($agents, $filter, false, $whereAlertSimple, false, false, $idGroup, true);
$alerts['alerts_combined'] = agents_get_alerts_compound($agents, $filter, $options_combined, $idGroup, false, $whereAlertCombined);
$countAlertsCombined = agents_get_alerts_compound($agents, $filter, false, $idGroup, true, $whereAlertCombined);
if ($tab != null) {
$url = $url.'&tab='.$tab;
}

View File

@ -48,15 +48,30 @@ if (is_ajax ()) {
$filter_groups = '';
$filter_groups = implode(',', array_keys($usr_groups));
$sql = sprintf ("SELECT t1.id, t1.name,
(SELECT COUNT(t2.id)
FROM talert_templates AS t2
WHERE t2.id = %d
AND t2.id_alert_action = t1.id) as 'sort_order'
FROM talert_actions AS t1
WHERE id_group IN (%s)
ORDER BY sort_order DESC", $id_template, $filter_groups);
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ("SELECT t1.id, t1.name,
(SELECT COUNT(t2.id)
FROM talert_templates AS t2
WHERE t2.id = %d
AND t2.id_alert_action = t1.id) as 'sort_order'
FROM talert_actions AS t1
WHERE id_group IN (%s)
ORDER BY sort_order DESC", $id_template, $filter_groups);
break;
case "oracle":
case "postgresql":
$sql = sprintf ("SELECT t1.id, t1.name,
(SELECT COUNT(t2.id)
FROM talert_templates AS t2
WHERE t2.id = %d
AND t2.id_alert_action = t1.id) as sort_order
FROM talert_actions AS t1
WHERE id_group IN (%s)
ORDER BY sort_order DESC", $id_template, $filter_groups);
break;
}
$rows = db_get_all_rows_sql($sql);

View File

@ -158,7 +158,7 @@ ui_print_timestamp ($agent["ultimo_contacto"]);
echo " / ";
if ($agent["ultimo_contacto_remoto"] == "0000-00-00 00:00:00") {
if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
echo __('Never');
} else {
echo $agent["ultimo_contacto_remoto"];

View File

@ -38,9 +38,11 @@ if (is_ajax ()) {
$filter = array ();
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
break;
case "postgresql":
$filter[] = '(nombre LIKE \'%'.$string.'%\' OR direccion LIKE \'%'.$string.'%\' OR comentarios LIKE \'%'.$string.'%\')';
break;
case "oracle":
$filter[] = '(UPPER(nombre) LIKE UPPER(\'%'.$string.'%\') OR UPPER(direccion) LIKE UPPER(\'%'.$string.'%\') OR UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))';
break;

View File

@ -187,7 +187,7 @@ if (is_ajax ()) {
$agent_modules = get_agent_modules ($id_agent,
($fields != '' ? explode (',', $fields) : "*"),
($filter != '' ? $filter : false), $indexed);
foreach($agent_modules as $key => $module) {
$agent_modules[$key]['nombre'] = safe_output($module['nombre']);
}

View File

@ -180,7 +180,7 @@ switch ($opt) {
$returnJSON['content'] .= __('Group').': ' . ui_print_group_icon ($row["id_grupo"], true).'&nbsp;(<strong>'.groups_get_name ($row["id_grupo"]).'</strong>)<br />';
$returnJSON['content'] .= __('Agent Version').': '.$row["agent_version"].'<br />';
$returnJSON['content'] .= __('Last contact') . ": ";
if ($row["ultimo_contacto_remoto"] == "0000-00-00 00:00:00") {
if ($row["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
$returnJSON['content'] .=__('Never') ." <br />";
}
else {

View File

@ -61,6 +61,7 @@ $table->head[6] = __('T/Q') . ui_print_help_tip (__("Threads / Queued modules cu
$table->head[7] = __('Updated');
$table->data = array ();
foreach ($servers as $server) {
$data = array ();
$data[0] = '<span title="'.$server['version'].'">'.$server['name'].'</span>';

View File

@ -49,13 +49,13 @@ CREATE TABLE "tagente" (
"direccion" varchar(100) default NULL,
"comentarios" varchar(255) default '',
"id_grupo" INTEGER NOT NULL default 0,
"ultimo_contacto" TIMESTAMP without time zone default NULL,
"ultimo_contacto" TIMESTAMP without time zone default '01-01-1970 00:00:00',
"modo" SMALLINT NOT NULL default 0,
"intervalo" INTEGER NOT NULL default 300,
"id_os" INTEGER default 0,
"os_version" varchar(100) default '',
"agent_version" varchar(100) default '',
"ultimo_contacto_remoto" TIMESTAMP without time zone default NULL,
"ultimo_contacto_remoto" TIMESTAMP without time zone default '01-01-1970 00:00:00',
"disabled" SMALLINT NOT NULL default 0,
"id_parent" INTEGER default 0,
"custom_id" varchar(255) default '',
@ -113,10 +113,10 @@ CREATE TABLE "tagente_estado" (
"id_agente_estado" SERIAL NOT NULL PRIMARY KEY,
"id_agente_modulo" INTEGER NOT NULL default 0,
"datos" text NOT NULL default '',
"timestamp" TIMESTAMP without time zone default NULL,
"timestamp" TIMESTAMP without time zone default '01-01-1970 00:00:00',
"estado" INTEGER NOT NULL default 0,
"id_agente" INTEGER NOT NULL default 0,
"last_try" TIMESTAMP without time zone default NULL,
"last_try" TIMESTAMP without time zone default '01-01-1970 00:00:00',
"utimestamp" BIGINT NOT NULL default 0,
"current_interval" INTEGER NOT NULL default 0,
"running_by" INTEGER default 0,
@ -212,7 +212,7 @@ CREATE TABLE "talert_snmp" (
"oid" varchar(255) NOT NULL default '',
"time_threshold" INTEGER NOT NULL default 0,
"times_fired" SMALLINT NOT NULL default 0,
"last_fired" TIMESTAMP without time zone default NULL,
"last_fired" TIMESTAMP without time zone default '01-01-1970 00:00:00',
"max_alerts" INTEGER NOT NULL default 1,
"min_alerts" INTEGER NOT NULL default 1,
"internal_counter" INTEGER NOT NULL default 0,
@ -375,7 +375,7 @@ CREATE TABLE "tevento" (
"id_usuario" varchar(100) NOT NULL default '0',
"id_grupo" INTEGER NOT NULL default 0,
"estado" INTEGER NOT NULL default 0,
"timestamp" TIMESTAMP without time zone default NULL,
"timestamp" TIMESTAMP without time zone default '01-01-1970 00:00:00',
"evento" text NOT NULL default '',
"utimestamp" BIGINT NOT NULL default 0,
"event_type" type_tevento_event default 'unknown',
@ -405,8 +405,8 @@ CREATE TABLE "tgrupo" (
CREATE TABLE "tincidencia" (
"id_incidencia" BIGSERIAL NOT NULL PRIMARY KEY,
"inicio" TIMESTAMP without time zone default NULL,
"cierre" TIMESTAMP without time zone default NULL,
"inicio" TIMESTAMP without time zone default '01-01-1970 00:00:00',
"cierre" TIMESTAMP without time zone default '01-01-1970 00:00:00',
"titulo" text NOT NULL default '',
"descripcion" text NOT NULL,
"id_usuario" varchar(60) NOT NULL default '',
@ -569,8 +569,8 @@ CREATE TABLE "tserver" (
"name" varchar(100) NOT NULL default '',
"ip_address" varchar(100) NOT NULL default '',
"status" INTEGER NOT NULL default 0,
"laststart" TIMESTAMP without time zone default NULL,
"keepalive" TIMESTAMP without time zone default NULL,
"laststart" TIMESTAMP without time zone default '01-01-1970 00:00:00',
"keepalive" TIMESTAMP without time zone default '01-01-1970 00:00:00',
"snmp_server" INTEGER NOT NULL default 0,
"network_server" INTEGER NOT NULL default 0,
"data_server" INTEGER NOT NULL default 0,
@ -615,7 +615,7 @@ CREATE TABLE "tsesion" (
"ip_origen" varchar(100) NOT NULL default '',
"accion" varchar(100) NOT NULL default '',
"descripcion" text NOT NULL default '',
"fecha" TIMESTAMP without time zone default NULL,
"fecha" TIMESTAMP without time zone default '01-01-1970 00:00:00',
"utimestamp" BIGINT NOT NULL default 0
);
CREATE INDEX "tsesion_utimestamp_idx" ON "tsesion"("utimestamp");
@ -641,7 +641,7 @@ CREATE TABLE "ttrap" (
"alerted" SMALLINT NOT NULL default 0,
"status" SMALLINT NOT NULL default 0,
"id_usuario" varchar(150) default '',
"timestamp" TIMESTAMP without time zone default NULL,
"timestamp" TIMESTAMP without time zone default '01-01-1970 00:00:00',
"priority" INTEGER NOT NULL default 2
);
@ -677,7 +677,7 @@ CREATE TABLE "tnews" (
"author" varchar(255) NOT NULL DEFAULT '',
"subject" varchar(255) NOT NULL DEFAULT '',
"text" TEXT NOT NULL,
"timestamp" TIMESTAMP without time zone default NULL
"timestamp" TIMESTAMP without time zone default '01-01-1970 00:00:00'
);
CREATE TABLE "tgraph" (
@ -852,7 +852,7 @@ CREATE TABLE "tserver_export_data" (
"module_name" varchar(100) NOT NULL default '',
"module_type" varchar(100) NOT NULL default '',
"data" varchar(255) default NULL,
"timestamp" TIMESTAMP without time zone default NULL
"timestamp" TIMESTAMP without time zone default '01-01-1970 00:00:00'
);
CREATE TABLE "tplanned_downtime" (
@ -886,7 +886,7 @@ CREATE TABLE "tgis_data_history" (
--timestamp on wich the agente started to be in this position
"start_timestamp" TIMESTAMP without time zone DEFAULT CURRENT_TIMESTAMP,
--timestamp on wich the agent was placed for last time on this position
"end_timestamp" TIMESTAMP without time zone default NULL,
"end_timestamp" TIMESTAMP without time zone default '01-01-1970 00:00:00',
--description of the region correoponding to this placemnt
"description" TEXT DEFAULT NULL,
-- 0 to show that the position cames from the agent, 1 to show that the position was established manualy

View File

@ -44,13 +44,13 @@ CREATE TABLE IF NOT EXISTS `tagente` (
`direccion` varchar(100) default NULL,
`comentarios` varchar(255) default '',
`id_grupo` int(10) unsigned NOT NULL default '0',
`ultimo_contacto` datetime NOT NULL default '0000-00-00 00:00:00',
`ultimo_contacto` datetime NOT NULL default '01-01-1970 00:00:00',
`modo` tinyint(1) NOT NULL default '0',
`intervalo` int(11) unsigned NOT NULL default '300',
`id_os` int(10) unsigned default '0',
`os_version` varchar(100) default '',
`agent_version` varchar(100) default '',
`ultimo_contacto_remoto` datetime default '0000-00-00 00:00:00',
`ultimo_contacto_remoto` datetime default '01-01-1970 00:00:00',
`disabled` tinyint(2) NOT NULL default '0',
`id_parent` int(10) unsigned default '0',
`custom_id` varchar(255) default '',
@ -110,7 +110,7 @@ CREATE TABLE `tagente_estado` (
`id_agente_estado` int(10) unsigned NOT NULL auto_increment,
`id_agente_modulo` int(10) NOT NULL default '0',
`datos` text NOT NULL default '',
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`timestamp` datetime NOT NULL default '01-01-1970 00:00:00',
`estado` int(4) NOT NULL default '0',
`id_agente` int(10) NOT NULL default '0',
`last_try` datetime default NULL,
@ -213,7 +213,7 @@ CREATE TABLE IF NOT EXISTS `talert_snmp` (
`oid` varchar(255) NOT NULL default '',
`time_threshold` int(11) NOT NULL default '0',
`times_fired` int(2) unsigned NOT NULL default '0',
`last_fired` datetime NOT NULL default '0000-00-00 00:00:00',
`last_fired` datetime NOT NULL default '01-01-1970 00:00:00',
`max_alerts` int(11) NOT NULL default '1',
`min_alerts` int(11) NOT NULL default '1',
`internal_counter` int(2) unsigned NOT NULL default '0',
@ -412,7 +412,7 @@ CREATE TABLE IF NOT EXISTS `tevento` (
`id_usuario` varchar(100) NOT NULL default '0',
`id_grupo` mediumint(4) NOT NULL default '0',
`estado` tinyint(3) unsigned NOT NULL default '0',
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`timestamp` datetime NOT NULL default '01-01-1970 00:00:00',
`evento` text NOT NULL default '',
`utimestamp` bigint(20) NOT NULL default '0',
`event_type` enum('unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal') default 'unknown',
@ -445,8 +445,8 @@ CREATE TABLE IF NOT EXISTS `tgrupo` (
CREATE TABLE IF NOT EXISTS `tincidencia` (
`id_incidencia` bigint(6) unsigned zerofill NOT NULL auto_increment,
`inicio` datetime NOT NULL default '0000-00-00 00:00:00',
`cierre` datetime NOT NULL default '0000-00-00 00:00:00',
`inicio` datetime NOT NULL default '01-01-1970 00:00:00',
`cierre` datetime NOT NULL default '01-01-1970 00:00:00',
`titulo` text NOT NULL default '',
`descripcion` text NOT NULL,
`id_usuario` varchar(60) NOT NULL default '',
@ -627,8 +627,8 @@ CREATE TABLE IF NOT EXISTS `tserver` (
`name` varchar(100) NOT NULL default '',
`ip_address` varchar(100) NOT NULL default '',
`status` int(11) NOT NULL default '0',
`laststart` datetime NOT NULL default '0000-00-00 00:00:00',
`keepalive` datetime NOT NULL default '0000-00-00 00:00:00',
`laststart` datetime NOT NULL default '01-01-1970 00:00:00',
`keepalive` datetime NOT NULL default '01-01-1970 00:00:00',
`snmp_server` tinyint(3) unsigned NOT NULL default '0',
`network_server` tinyint(3) unsigned NOT NULL default '0',
`data_server` tinyint(3) unsigned NOT NULL default '0',
@ -674,7 +674,7 @@ CREATE TABLE IF NOT EXISTS `tsesion` (
`ip_origen` varchar(100) NOT NULL default '',
`accion` varchar(100) NOT NULL default '',
`descripcion` text NOT NULL default '',
`fecha` datetime NOT NULL default '0000-00-00 00:00:00',
`fecha` datetime NOT NULL default '01-01-1970 00:00:00',
`utimestamp` bigint(20) unsigned NOT NULL default '0',
PRIMARY KEY (`id_sesion`),
KEY `idx_utimestamp` (`utimestamp`),
@ -704,7 +704,7 @@ CREATE TABLE IF NOT EXISTS `ttrap` (
`alerted` smallint(6) NOT NULL default '0',
`status` smallint(6) NOT NULL default '0',
`id_usuario` varchar(150) default '',
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`timestamp` datetime NOT NULL default '01-01-1970 00:00:00',
`priority` tinyint(4) unsigned NOT NULL default '2',
PRIMARY KEY (`id_trap`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -939,7 +939,7 @@ CREATE TABLE IF NOT EXISTS `tserver_export_data` (
`module_name` varchar(100) NOT NULL default '',
`module_type` varchar(100) NOT NULL default '',
`data` varchar(255) default NULL,
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`timestamp` datetime NOT NULL default '01-01-1970 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;