2009-05-27 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/configurar_agente.php: Use pandora functions to create and update modules. Some fixes when these operations could not be done so the editor appears again. Fixes #2762316 * godmode/agentes/module_manager_editor.php: Some patches to work better with configurar_agente.php * include/functions_modules.php: Avoid setting an empty name on update_agent_module() git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1711 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
6803432b1e
commit
1ca3064760
|
@ -1,3 +1,15 @@
|
||||||
|
2009-05-27 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
|
* godmode/agentes/configurar_agente.php: Use pandora functions to
|
||||||
|
create and update modules. Some fixes when these operations could
|
||||||
|
not be done so the editor appears again. Fixes #2762316
|
||||||
|
|
||||||
|
* godmode/agentes/module_manager_editor.php: Some patches to work
|
||||||
|
better with configurar_agente.php
|
||||||
|
|
||||||
|
* include/functions_modules.php: Avoid setting an empty name on
|
||||||
|
update_agent_module()
|
||||||
|
|
||||||
2009-05-27 Esteban Sanchez <estebans@artica.es>
|
2009-05-27 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
* reporting/fgraph.php: Do not short agent name on
|
* reporting/fgraph.php: Do not short agent name on
|
||||||
|
|
|
@ -33,9 +33,11 @@ if (! give_acl ($config["id_user"], $group, "AW")) {
|
||||||
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
|
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
|
||||||
"Trying to access agent manager");
|
"Trying to access agent manager");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
exit;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_once ('include/functions_modules.php');
|
||||||
|
|
||||||
// Get passed variables
|
// Get passed variables
|
||||||
$tab = get_parameter ('tab', 'main');
|
$tab = get_parameter ('tab', 'main');
|
||||||
$alerttype = get_parameter ('alerttype');
|
$alerttype = get_parameter ('alerttype');
|
||||||
|
@ -372,8 +374,8 @@ if ($update_module || $create_module) {
|
||||||
$post_process = (float) get_parameter ('post_process');
|
$post_process = (float) get_parameter ('post_process');
|
||||||
$prediction_module = (int) get_parameter ('prediction_module');
|
$prediction_module = (int) get_parameter ('prediction_module');
|
||||||
$max_timeout = (int) get_parameter ('max_timeout');
|
$max_timeout = (int) get_parameter ('max_timeout');
|
||||||
$minvalue = (int) get_parameter_post ("min");
|
$min = (int) get_parameter_post ("min");
|
||||||
$maxvalue = (int) get_parameter ('max');
|
$max = (int) get_parameter ('max');
|
||||||
$interval = (int) get_parameter ('module_interval', $intervalo);
|
$interval = (int) get_parameter ('module_interval', $intervalo);
|
||||||
$id_prediction_module = (int) get_parameter ('id_prediction_module');
|
$id_prediction_module = (int) get_parameter ('id_prediction_module');
|
||||||
$id_plugin = (int) get_parameter ('id_plugin');
|
$id_plugin = (int) get_parameter ('id_plugin');
|
||||||
|
@ -405,12 +407,12 @@ if ($update_module || $create_module) {
|
||||||
if ($update_module) {
|
if ($update_module) {
|
||||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||||
|
|
||||||
$result = process_sql_update ('tagente_modulo',
|
$result = update_agent_module ($id_agent_module,
|
||||||
array ('descripcion' => $description,
|
array ('descripcion' => $description,
|
||||||
'id_module_group' => $id_module_group,
|
'id_module_group' => $id_module_group,
|
||||||
'nombre' => $name,
|
'nombre' => $name,
|
||||||
'max' => $maxvalue,
|
'max' => $max,
|
||||||
'min' => $minvalue,
|
'min' => $min,
|
||||||
'module_interval' => $interval,
|
'module_interval' => $interval,
|
||||||
'tcp_port' => $tcp_port,
|
'tcp_port' => $tcp_port,
|
||||||
'tcp_send' => $tcp_send,
|
'tcp_send' => $tcp_send,
|
||||||
|
@ -434,12 +436,11 @@ if ($update_module) {
|
||||||
'max_warning' => $max_warning,
|
'max_warning' => $max_warning,
|
||||||
'min_critical' => $min_critical,
|
'min_critical' => $min_critical,
|
||||||
'max_critical' => $max_critical,
|
'max_critical' => $max_critical,
|
||||||
'min_ff_event' => $ff_event
|
'min_ff_event' => $ff_event));
|
||||||
),
|
|
||||||
'id_agente_modulo = '.$id_agent_module);
|
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
echo '<h3 class="error">'.__('There was a problem updating module').'</h3>';
|
echo '<h3 class="error">'.__('There was a problem updating module').'</h3>';
|
||||||
|
$edit_module = true;
|
||||||
} else {
|
} else {
|
||||||
echo '<h3 class="suc">'.__('Module successfully updated').'</h3>';
|
echo '<h3 class="suc">'.__('Module successfully updated').'</h3>';
|
||||||
$id_agent_module = false;
|
$id_agent_module = false;
|
||||||
|
@ -458,13 +459,11 @@ if ($create_module) {
|
||||||
|
|
||||||
$id_module = (int) get_parameter ('id_module');
|
$id_module = (int) get_parameter ('id_module');
|
||||||
|
|
||||||
$id_agent_module = process_sql_insert ('tagente_modulo',
|
$id_agent_module = create_agent_module ($id_agente, $name,
|
||||||
array ('id_agente' => $id_agente,
|
array ('id_tipo_modulo' => $id_module_type,
|
||||||
'id_tipo_modulo' => $id_module_type,
|
|
||||||
'nombre' => $name,
|
|
||||||
'descripcion' => $description,
|
'descripcion' => $description,
|
||||||
'max' => $maxvalue,
|
'max' => $max,
|
||||||
'min' => $minvalue,
|
'min' => $min,
|
||||||
'snmp_oid' => $snmp_oid,
|
'snmp_oid' => $snmp_oid,
|
||||||
'snmp_community' => $snmp_community,
|
'snmp_community' => $snmp_community,
|
||||||
'id_module_group' => $id_module_group,
|
'id_module_group' => $id_module_group,
|
||||||
|
@ -495,19 +494,9 @@ if ($create_module) {
|
||||||
if ($id_agent_module === false) {
|
if ($id_agent_module === false) {
|
||||||
echo '<h3 class="error">'.__('There was a problem adding module').'</h3>';
|
echo '<h3 class="error">'.__('There was a problem adding module').'</h3>';
|
||||||
$edit_module = true;
|
$edit_module = true;
|
||||||
|
$moduletype = $id_module;
|
||||||
} else {
|
} else {
|
||||||
$result = 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' => $id_agente,
|
|
||||||
'utimestamp' => 0, 'status_changes' => 0,
|
|
||||||
'last_status' => 0
|
|
||||||
));
|
|
||||||
if ($result !== false) {
|
|
||||||
echo '<h3 class="suc">'.__('Module added successfully').'</h3>';
|
echo '<h3 class="suc">'.__('Module added successfully').'</h3>';
|
||||||
} else {
|
|
||||||
echo '<h3 class="error">'.__('Module added successfully').' - '.__('Status init unsuccessful').'</h3>';
|
|
||||||
}
|
|
||||||
$id_agent_module = false;
|
$id_agent_module = false;
|
||||||
$edit_module = false;
|
$edit_module = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,6 +113,7 @@ if ($id_agent_module) {
|
||||||
$max_critical = $module['max_critical'];
|
$max_critical = $module['max_critical'];
|
||||||
$ff_event = $module['min_ff_event'];
|
$ff_event = $module['min_ff_event'];
|
||||||
} else {
|
} else {
|
||||||
|
if (!isset ($moduletype)) {
|
||||||
$moduletype = (string) get_parameter ('moduletype');
|
$moduletype = (string) get_parameter ('moduletype');
|
||||||
|
|
||||||
// Clean up specific network modules fields
|
// Clean up specific network modules fields
|
||||||
|
@ -150,6 +151,7 @@ if ($id_agent_module) {
|
||||||
$max_critical = 0;
|
$max_critical = 0;
|
||||||
$ff_event = 0;
|
$ff_event = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch ($moduletype) {
|
switch ($moduletype) {
|
||||||
case "dataserver":
|
case "dataserver":
|
||||||
|
|
|
@ -108,6 +108,8 @@ function delete_agent_module ($id_agent_module) {
|
||||||
function update_agent_module ($id, $values) {
|
function update_agent_module ($id, $values) {
|
||||||
if (! is_array ($values))
|
if (! is_array ($values))
|
||||||
return false;
|
return false;
|
||||||
|
if (! isset ($values['nombre']) && empty ($values['nombre']))
|
||||||
|
return false;
|
||||||
|
|
||||||
return (@process_sql_update ('tagente_modulo', $values,
|
return (@process_sql_update ('tagente_modulo', $values,
|
||||||
array ('id_agente_modulo' => (int) $id)) !== false);
|
array ('id_agente_modulo' => (int) $id)) !== false);
|
||||||
|
|
Loading…
Reference in New Issue