2012-11-14 Ramon Novoa <rnovoa@artica.es>
* include/functions_modules.php, pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql, extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql, extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql, extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, godmode/agentes/agent_template.php, godmode/agentes/module_manager.php, godmode/agentes/agent_manager.php: Added support for server-side module status calculation. * godmode/agentes/configurar_agente.php: Show 'None' when no server is selected for an agent. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7148 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
5731186287
commit
c13a86afe8
|
@ -1,3 +1,20 @@
|
|||
2012-11-14 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* include/functions_modules.php,
|
||||
pandoradb.sql,
|
||||
pandoradb.postgreSQL.sql,
|
||||
pandoradb.oracle.sql,
|
||||
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
|
||||
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
|
||||
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
|
||||
godmode/agentes/agent_template.php,
|
||||
godmode/agentes/module_manager.php,
|
||||
godmode/agentes/agent_manager.php: Added support for server-side
|
||||
module status calculation.
|
||||
|
||||
* godmode/agentes/configurar_agente.php: Show 'None' when no server is
|
||||
selected for an agent.
|
||||
|
||||
2012-11-13 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/reporting/reporting_builder.php,
|
||||
|
|
|
@ -58,6 +58,13 @@ ALTER TABLE `tincidencia` ADD COLUMN `id_agent` int(10) unsigned NULL default 0;
|
|||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `tagente` ADD COLUMN `url_address` mediumtext NULL;
|
||||
ALTER TABLE `tagente` ADD COLUMN `quiet` tinyint(1) NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `tagente` ADD COLUMN `normal_count` bigint(20) unsigned NOT NULL default '0';
|
||||
ALTER TABLE `tagente` ADD COLUMN `warning_count` bigint(20) unsigned NOT NULL default '0';
|
||||
ALTER TABLE `tagente` ADD COLUMN `critical_count` bigint(20) unsigned NOT NULL default '0';
|
||||
ALTER TABLE `tagente` ADD COLUMN `unknown_count` bigint(20) unsigned NOT NULL default '0';
|
||||
ALTER TABLE `tagente` ADD COLUMN `notinit_count` bigint(20) unsigned NOT NULL default '0';
|
||||
ALTER TABLE `tagente` ADD COLUMN `critical_count` bigint(20) unsigned NOT NULL default '0';
|
||||
ALTER TABLE `tagente` ADD COLUMN `total_count` bigint(20) unsigned NOT NULL default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `talert_special_days`
|
||||
|
|
|
@ -77,6 +77,12 @@ ALTER TABLE tincidencia ADD (id_agent NUMBER(10,0) default 0 NULL);
|
|||
-- -----------------------------------------------------
|
||||
ALTER TABLE tagente ADD (url_address CLOB default '' NULL);
|
||||
ALTER TABLE tagente ADD (quiet NUMBER(5, 0) default 0 NOT NULL);
|
||||
ALTER TABLE tagente ADD (normal_count NUMBER(20, 0) default 0 NOT NULL);
|
||||
ALTER TABLE tagente ADD (warning_count NUMBER(20, 0) default 0 NOT NULL);
|
||||
ALTER TABLE tagente ADD (critical_count NUMBER(20, 0) default 0 NOT NULL);
|
||||
ALTER TABLE tagente ADD (unknown_count NUMBER(20, 0) default 0 NOT NULL);
|
||||
ALTER TABLE tagente ADD (notinit_count NUMBER(20, 0) default 0 NOT NULL);
|
||||
ALTER TABLE tagente ADD (total_count NUMBER(20, 0) default 0 NOT NULL);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table talert_special_days
|
||||
|
|
|
@ -71,6 +71,12 @@ ALTER TABLE "tincidencia" ADD COLUMN "id_agent" INTEGER NULL DEFAULT 0;
|
|||
-- -----------------------------------------------------
|
||||
ALTER TABLE "tagente" ADD COLUMN "url_address" text NULL default '';
|
||||
ALTER TABLE "tagente" ADD COLUMN "quiet" SMALLINT NOT NULL default 0;
|
||||
ALTER TABLE "tagente" ADD COLUMN "normal_count" INTEGER NOT NULL default 0;
|
||||
ALTER TABLE "tagente" ADD COLUMN "warning_count" INTEGER NOT NULL default 0;
|
||||
ALTER TABLE "tagente" ADD COLUMN "critical_count" INTEGER NOT NULL default 0;
|
||||
ALTER TABLE "tagente" ADD COLUMN "unknown_count" INTEGER NOT NULL default 0;
|
||||
ALTER TABLE "tagente" ADD COLUMN "notinit_count" INTEGER NOT NULL default 0;
|
||||
ALTER TABLE "tagente" ADD COLUMN "total_count" INTEGER NOT NULL default 0;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table "talert_special_days"
|
||||
|
|
|
@ -213,12 +213,9 @@ $table->data[5][1] .= ui_print_os_icon ($id_os, false, true);
|
|||
$table->data[5][1] .= '</span>';
|
||||
|
||||
// Network server
|
||||
$none = '';
|
||||
if ($server_name == '' && $id_agente)
|
||||
$none = __('None');
|
||||
$table->data[6][0] = __('Server');
|
||||
$table->data[6][1] = html_print_select (servers_get_names (),
|
||||
'server_name', $server_name, '', $none, 0, true);
|
||||
'server_name', $server_name, '', __('None'), 0, true);
|
||||
|
||||
// Description
|
||||
$table->data[7][0] = __('Description');
|
||||
|
|
|
@ -105,6 +105,9 @@ if (isset ($_POST["template_id"])) {
|
|||
'id_agente' => $id_agente,
|
||||
'utimestamp' => 0);
|
||||
db_process_sql_insert('tagente_estado', $values);
|
||||
|
||||
// Update module status count
|
||||
db_process_sql ('UPDATE tagente SET total_count=total_count+1, notinit_count=notinit_count+1 WHERE id_agente=' . (int)$id_agente);
|
||||
}
|
||||
else {
|
||||
echo '<h3 class="error">'.__('Error adding module').'</h3>';
|
||||
|
|
|
@ -1036,7 +1036,7 @@ if ($create_module) {
|
|||
// =================
|
||||
if ($delete_module) { // DELETE agent module !
|
||||
$id_borrar_modulo = (int) get_parameter_get ("delete_module",0);
|
||||
$module_data = db_get_row ('tagente_modulo', 'id_agente_modulo', $id_borrar_modulo);
|
||||
$module_data = db_get_row_sql ('SELECT * FROM tagente_modulo, tagente_estado WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_modulo.id_agente_modulo=' . $id_borrar_modulo);
|
||||
$id_grupo = (int) agents_get_agent_group($id_agente);
|
||||
|
||||
if (! check_acl ($config["id_user"], $id_grupo, "AW")) {
|
||||
|
@ -1069,8 +1069,23 @@ if ($delete_module) { // DELETE agent module !
|
|||
'disabled' => 1,
|
||||
'delete_pending' => 1);
|
||||
$result = db_process_sql_update('tagente_modulo', $values, array('id_agente_modulo' => $id_borrar_modulo));
|
||||
if ($result === false)
|
||||
if ($result === false) {
|
||||
$error++;
|
||||
} else {
|
||||
// Update module status count
|
||||
if ($module_data['utimestamp'] == 0) {
|
||||
db_process_sql ('UPDATE tagente SET notinit_count=notinit_count-1 WHERE id_agente=' . $module_data['id_agente']);
|
||||
} else if ($module_data['estado'] == 0) {
|
||||
db_process_sql ('UPDATE tagente SET normal_count=normal_count-1 WHERE id_agente=' . $module_data['id_agente']);
|
||||
} else if ($module_data['estado'] == 1) {
|
||||
db_process_sql ('UPDATE tagente SET critical_count=critical_count-1 WHERE id_agente=' . $module_data['id_agente']);
|
||||
} else if ($module_data['estado'] == 2) {
|
||||
db_process_sql ('UPDATE tagente SET warning_count=warning_count-1 WHERE id_agente=' . $module_data['id_agente']);
|
||||
} else if ($module_data['estado'] == 3) {
|
||||
db_process_sql ('UPDATE tagente SET unknown_count=unknown_count-1 WHERE id_agente=' . $module_data['id_agente']);
|
||||
}
|
||||
db_process_sql ('UPDATE tagente SET total_count=total_count-1 WHERE id_agente=' . $module_data['id_agente']);
|
||||
}
|
||||
|
||||
$result = db_process_sql_delete('tagente_estado', array('id_agente_modulo' => $id_borrar_modulo));
|
||||
if ($result === false)
|
||||
|
|
|
@ -132,9 +132,27 @@ if ($multiple_delete) {
|
|||
// error. NOTICE that we don't delete all data here, just marking for deletion
|
||||
// and delete some simple data.
|
||||
$status = '';
|
||||
$module = db_get_row_sql ('SELECT * FROM tagente_modulo, tagente_estado WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_modulo.id_agente_modulo=' . (int)$id_agent_module_del);
|
||||
if (db_process_sql("UPDATE tagente_modulo
|
||||
SET nombre = 'pendingdelete', disabled = 1, delete_pending = 1 WHERE id_agente_modulo = ".$id_agent_module_del, "affected_rows", '', true, $status, false) === false)
|
||||
SET nombre = 'pendingdelete', disabled = 1, delete_pending = 1 WHERE id_agente_modulo = ".$id_agent_module_del, "affected_rows", '', true, $status, false) === false) {
|
||||
$error++;
|
||||
} else {
|
||||
// Update module status count
|
||||
if ($module !== false) {
|
||||
if ($module['utimestamp'] == 0) {
|
||||
db_process_sql ('UPDATE tagente SET notinit_count=notinit_count-1 WHERE id_agente=' . $module['id_agente']);
|
||||
} else if ($module['estado'] == 0) {
|
||||
db_process_sql ('UPDATE tagente SET normal_count=normal_count-1 WHERE id_agente=' . $module['id_agente']);
|
||||
} else if ($module['estado'] == 1) {
|
||||
db_process_sql ('UPDATE tagente SET critical_count=critical_count-1 WHERE id_agente=' . $module['id_agente']);
|
||||
} else if ($module['estado'] == 2) {
|
||||
db_process_sql ('UPDATE tagente SET warning_count=warning_count-1 WHERE id_agente=' . $module['id_agente']);
|
||||
} else if ($module['estado'] == 3) {
|
||||
db_process_sql ('UPDATE tagente SET unknown_count=unknown_count-1 WHERE id_agente=' . $module['id_agente']);
|
||||
}
|
||||
db_process_sql ('UPDATE tagente SET total_count=total_count-1 WHERE id_agente=' . $module['id_agente']);
|
||||
}
|
||||
}
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
|
@ -610,4 +628,4 @@ html_print_input_hidden ('multiple_delete', 1);
|
|||
html_print_submit_button (__('Delete'), 'multiple_delete', false, 'class="sub delete"');
|
||||
echo '</div>';
|
||||
echo '</form>'
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -197,6 +197,9 @@ function modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent
|
|||
function modules_delete_agent_module ($id_agent_module) {
|
||||
if (!$id_agent_module)
|
||||
return false;
|
||||
|
||||
// Read module data
|
||||
$module = db_get_row_sql ('SELECT * FROM tagente_modulo, tagente_estado WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_modulo.id_agente_modulo=' . (int)$id_agent_module);
|
||||
|
||||
$where = array ('id_agent_module' => $id_agent_module);
|
||||
|
||||
|
@ -214,6 +217,20 @@ function modules_delete_agent_module ($id_agent_module) {
|
|||
$where);
|
||||
db_process_sql_delete('ttag_module', $where);
|
||||
|
||||
// Update module status count
|
||||
if ($module['utimestamp'] == 0) {
|
||||
db_process_sql ('UPDATE tagente SET notinit_count=notinit_count-1 WHERE id_agente=' . $module['id_agente']);
|
||||
} else if ($module['estado'] == 0) {
|
||||
db_process_sql ('UPDATE tagente SET normal_count=normal_count-1 WHERE id_agente=' . $module['id_agente']);
|
||||
} else if ($module['estado'] == 1) {
|
||||
db_process_sql ('UPDATE tagente SET critical_count=critical_count-1 WHERE id_agente=' . $module['id_agente']);
|
||||
} else if ($module['estado'] == 2) {
|
||||
db_process_sql ('UPDATE tagente SET warning_count=warning_count-1 WHERE id_agente=' . $module['id_agente']);
|
||||
} else if ($module['estado'] == 3) {
|
||||
db_process_sql ('UPDATE tagente SET unknown_count=unknown_count-1 WHERE id_agente=' . $module['id_agente']);
|
||||
}
|
||||
db_process_sql ('UPDATE tagente SET total_count=total_count-1 WHERE id_agente=' . $module['id_agente']);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -366,7 +383,10 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
|||
|
||||
return ERR_DB;
|
||||
}
|
||||
|
||||
|
||||
// Update module status count
|
||||
db_process_sql ('UPDATE tagente SET total_count=total_count+1, notinit_count=notinit_count+1 WHERE id_agente=' . (int)$id_agent);
|
||||
|
||||
return $id_agent_module;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,13 @@ CREATE TABLE tagente (
|
|||
--set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and don\'t update it
|
||||
update_gis_data NUMBER(5, 0) DEFAULT 1 NOT NULL,
|
||||
url_address CLOB DEFAULT '' NULL,
|
||||
quiet NUMBER(5, 0) default 0 NOT NULL
|
||||
quiet NUMBER(5, 0) default 0 NOT NULL,
|
||||
normal_count NUMBER(20, 0) default 0 NOT NULL,
|
||||
warning_count NUMBER(20, 0) default 0 NOT NULL,
|
||||
critical_count NUMBER(20, 0) default 0 NOT NULL,
|
||||
unknown_count NUMBER(20, 0) default 0 NOT NULL,
|
||||
notinit_count NUMBER(20, 0) default 0 NOT NULL,
|
||||
total_count NUMBER(20, 0) default 0 NOT NULL
|
||||
);
|
||||
CREATE INDEX tagente_nombre_idx ON tagente(nombre);
|
||||
CREATE INDEX tagente_direccion_idx ON tagente(direccion);
|
||||
|
|
|
@ -77,7 +77,13 @@ CREATE TABLE "tagente" (
|
|||
--set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and don\'t update it
|
||||
"update_gis_data" SMALLINT NOT NULL DEFAULT 1,
|
||||
"url_address" TEXT NULL default '',
|
||||
"quiet" SMALLINT NOT NULL default 0
|
||||
"quiet" SMALLINT NOT NULL default 0,
|
||||
"normal_count" INTEGER NOT NULL default 0,
|
||||
"warning_count" INTEGER NOT NULL default 0,
|
||||
"critical_count" INTEGER NOT NULL default 0,
|
||||
"unknown_count" INTEGER NOT NULL default 0,
|
||||
"notinit_count" INTEGER NOT NULL default 0,
|
||||
"total_count" INTEGER NOT NULL default 0
|
||||
);
|
||||
CREATE INDEX "tagente_nombre_idx" ON "tagente"("nombre");
|
||||
CREATE INDEX "tagente_direccion_idx" ON "tagente"("direccion");
|
||||
|
|
|
@ -71,6 +71,12 @@ CREATE TABLE IF NOT EXISTS `tagente` (
|
|||
`update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' ,
|
||||
`url_address` mediumtext NULL,
|
||||
`quiet` tinyint(1) NOT NULL default '0',
|
||||
`normal_count` bigint(20) unsigned NOT NULL default '0',
|
||||
`warning_count` bigint(20) unsigned NOT NULL default '0',
|
||||
`critical_count` bigint(20) unsigned NOT NULL default '0',
|
||||
`unknown_count` bigint(20) unsigned NOT NULL default '0',
|
||||
`notinit_count` bigint(20) unsigned NOT NULL default '0',
|
||||
`total_count` bigint(20) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id_agente`),
|
||||
KEY `nombre` (`nombre`),
|
||||
KEY `direccion` (`direccion`),
|
||||
|
|
Loading…
Reference in New Issue