2011-07-14 Sergio Martin <sergio.martin@artica.es>
* godmode/agentes/module_manager_editor_prediction.php godmode/agentes/configurar_agente.php: Changed the fields system on prediction modules to use 'prediction_module' as flag 1 to modules, 2 to services and 3 to synthetic, and the custom_integer_1 to module or service id (unused in synth) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4560 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
8607818525
commit
2795f57d0d
|
@ -1,3 +1,11 @@
|
|||
2011-07-14 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* godmode/agentes/module_manager_editor_prediction.php
|
||||
godmode/agentes/configurar_agente.php: Changed the fields
|
||||
system on prediction modules to use 'prediction_module' as
|
||||
flag 1 to modules, 2 to services and 3 to synthetic, and
|
||||
the custom_integer_1 to module or service id (unused in synth)
|
||||
|
||||
2011-07-13 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* extras/pandoradb_migrate_v3.2_to_v4.0.sql
|
||||
|
|
|
@ -583,7 +583,7 @@ if ($update_module || $create_module) {
|
|||
// 1.23E-10 is 0.000000000123
|
||||
|
||||
$post_process = (string) get_parameter ('post_process', 0.0);
|
||||
$prediction_module = (int) get_parameter ('prediction_module');
|
||||
$prediction_module = 1;
|
||||
$max_timeout = (int) get_parameter ('max_timeout');
|
||||
$min = (int) get_parameter_post ("min");
|
||||
$max = (int) get_parameter ('max');
|
||||
|
@ -600,7 +600,7 @@ if ($update_module || $create_module) {
|
|||
$custom_string_1 = (string) get_parameter ('custom_string_1');
|
||||
$custom_string_2 = (string) get_parameter ('custom_string_2');
|
||||
$custom_string_3 = (string) get_parameter ('custom_string_3');
|
||||
$custom_integer_1 = (int) get_parameter ('custom_integer_1');
|
||||
$custom_integer_1 = (int) get_parameter ('prediction_module');
|
||||
$custom_integer_2 = (int) get_parameter ('custom_integer_2');
|
||||
|
||||
// Services are an enterprise feature,
|
||||
|
@ -653,7 +653,7 @@ if ($update_module || $create_module) {
|
|||
$id_tag = (array) get_parameter('id_tag_selected');
|
||||
$serialize_ops = (string) get_parameter('serialize_ops');
|
||||
|
||||
if($prediction_module != 0) {
|
||||
if($prediction_module < 3) {
|
||||
unset($serialize_ops);
|
||||
modules_delete_synthetic_operations($id_agent_module);
|
||||
}
|
||||
|
@ -710,8 +710,13 @@ if ($update_module) {
|
|||
'min_ff_event' => $ff_event,
|
||||
'unit' => $unit);
|
||||
|
||||
$result = modules_update_agent_module ($id_agent_module,
|
||||
$values, false, $id_tag);
|
||||
if($prediction_module == 3 && $serialize_ops == '') {
|
||||
$result = false;
|
||||
}
|
||||
else {
|
||||
$result = modules_update_agent_module ($id_agent_module,
|
||||
$values, false, $id_tag);
|
||||
}
|
||||
|
||||
if ($result === false) {
|
||||
echo '<h3 class="error">'.__('There was a problem updating module').'</h3>';
|
||||
|
@ -721,10 +726,9 @@ if ($update_module) {
|
|||
"Fail to try update module '$name' for agent ".$agent["nombre"]);
|
||||
}
|
||||
else {
|
||||
if(enterprise_hook('modules_is_synthetic')) {
|
||||
if($prediction_module == 3) {
|
||||
enterprise_hook('modules_create_synthetic_operations', array($id_agent_module, $serialize_ops));
|
||||
}
|
||||
|
||||
echo '<h3 class="suc">'.__('Module successfully updated').'</h3>';
|
||||
$id_agent_module = false;
|
||||
$edit_module = false;
|
||||
|
@ -794,8 +798,12 @@ if ($create_module) {
|
|||
'min_ff_event' => $ff_event,
|
||||
'unit' => $unit
|
||||
);
|
||||
|
||||
$id_agent_module = modules_create_agent_module ($id_agente, $name, $values, false, $id_tag);
|
||||
if($prediction_module == 3 && $serialize_ops == '') {
|
||||
$id_agent_module = false;
|
||||
}
|
||||
else {
|
||||
$id_agent_module = modules_create_agent_module ($id_agente, $name, $values, false, $id_tag);
|
||||
}
|
||||
|
||||
if ($id_agent_module === false) {
|
||||
echo '<h3 class="error">'.__('There was a problem adding module').'</h3>';
|
||||
|
@ -805,7 +813,7 @@ if ($create_module) {
|
|||
"Fail to try added module '$name' for agent ".$agent["nombre"]);
|
||||
}
|
||||
else {
|
||||
if(enterprise_hook('modules_is_synthetic')) {
|
||||
if($prediction_module == 3) {
|
||||
enterprise_hook('modules_create_synthetic_operations', array($id_agent_module, $serialize_ops));
|
||||
}
|
||||
|
||||
|
|
|
@ -33,27 +33,35 @@ if ($row !== false && is_array($row)) {
|
|||
$prediction_module = $row['prediction_module'];
|
||||
$custom_integer_2 = $row ['custom_integer_2'];
|
||||
// Services are an Enterprise feature.
|
||||
$service_select = $row['custom_integer_1'];
|
||||
if ($service_select > 0) {
|
||||
$is_service = true;
|
||||
}
|
||||
$custom_integer_1 = $row['custom_integer_1'];
|
||||
|
||||
if($prediction_module == 0 && $id_agente_modulo != 0) {
|
||||
$ops_json = enterprise_hook('modules_get_synthetic_operations', array($id_agente_modulo));
|
||||
$ops = json_decode($ops_json, true);
|
||||
switch($prediction_module) {
|
||||
case 2:
|
||||
$is_service = true;
|
||||
$custom_integer_2 = 0;
|
||||
break;
|
||||
case 3:
|
||||
$ops_json = enterprise_hook('modules_get_synthetic_operations', array($id_agente_modulo));
|
||||
$ops = json_decode($ops_json, true);
|
||||
|
||||
$first_op = explode('_', reset(array_keys($ops)));
|
||||
|
||||
if(isset($first_op[1]) && $first_op[1] == 'avg') {
|
||||
$is_synthetic_avg = true;
|
||||
}
|
||||
else {
|
||||
$is_synthetic = true;
|
||||
}
|
||||
$first_op = explode('_', reset(array_keys($ops)));
|
||||
|
||||
if(isset($first_op[1]) && $first_op[1] == 'avg') {
|
||||
$is_synthetic_avg = true;
|
||||
}
|
||||
else {
|
||||
$is_synthetic = true;
|
||||
}
|
||||
|
||||
$custom_integer_1 = 0;
|
||||
$custom_integer_2 = 0;
|
||||
break;
|
||||
default:
|
||||
$prediction_module = $custom_integer_1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$service_select = 0;
|
||||
$custom_integer_1 = 0;
|
||||
}
|
||||
if (strstr($page, "policy_modules") === false) {
|
||||
if ($config['enterprise_installed'])
|
||||
|
@ -95,11 +103,11 @@ $data[1] .= html_print_label(__("Module"),'prediction_module',true);
|
|||
if($id_agente) {
|
||||
$sql = "SELECT id_agente_modulo, nombre
|
||||
FROM tagente_modulo
|
||||
WHERE history_data = 1 AND id_agente = ".$id_agente;
|
||||
$data[1] .= html_print_select_from_sql($sql, 'prediction_module', $prediction_module, false, __('Select Module'), 0, true, false, true, $is_service);
|
||||
WHERE delete_pending = 0 AND history_data = 1 AND id_agente = ".$id_agente;
|
||||
$data[1] .= html_print_select_from_sql($sql, 'prediction_module', $prediction_module, false, __('Select Module'), 0, true);
|
||||
}
|
||||
else {
|
||||
$data[1] .= '<select id="prediction_module" name="prediction_module" disabled="disabled"><option value="0">Select an Agent first</option></select>';
|
||||
$data[1] .= '<select id="prediction_module" name="custom_integer_1" disabled="disabled"><option value="0">Select an Agent first</option></select>';
|
||||
}
|
||||
|
||||
$data[1] .= html_print_label(__("Period"), 'custom_integer_2', true)."<br/>";
|
||||
|
@ -116,7 +124,7 @@ $table_simple->colspan['prediction_module'][1] = 3;
|
|||
push_table_simple ($data, 'prediction_module');
|
||||
|
||||
// Services are an Enterprise feature.
|
||||
$selector_form = enterprise_hook('get_selector_form', array($service_select));
|
||||
$selector_form = enterprise_hook('get_selector_form', array($custom_integer_1));
|
||||
if ($selector_form !== ENTERPRISE_NOT_HOOK) {
|
||||
$data = array();
|
||||
$data[0] = '';
|
||||
|
|
Loading…
Reference in New Issue