2011-07-13 Sergio Martin <sergio.martin@artica.es>
* godmode/agentes/module_manager_editor_prediction.php godmode/agentes/configurar_agente.php: Added interface and calls to enterprise functions for synthetic modules git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4551 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
dff4221747
commit
d82723b61b
|
@ -1,3 +1,9 @@
|
||||||
|
2011-07-13 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
|
* godmode/agentes/module_manager_editor_prediction.php
|
||||||
|
godmode/agentes/configurar_agente.php: Added interface and calls
|
||||||
|
to enterprise functions for synthetic modules
|
||||||
|
|
||||||
2011-07-12 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
2011-07-12 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||||
|
|
||||||
* include/help/en/help_timesource.php
|
* include/help/en/help_timesource.php
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
enterprise_include ('godmode/agentes/configurar_agente.php');
|
enterprise_include ('godmode/agentes/configurar_agente.php');
|
||||||
|
enterprise_include ('include/functions_modules.php');
|
||||||
include_once($config['homedir'] . "/include/functions_agents.php");
|
include_once($config['homedir'] . "/include/functions_agents.php");
|
||||||
|
|
||||||
check_login ();
|
check_login ();
|
||||||
|
@ -605,7 +606,7 @@ if ($update_module || $create_module) {
|
||||||
// Services are an enterprise feature,
|
// Services are an enterprise feature,
|
||||||
// so we got the parameters using this function.
|
// so we got the parameters using this function.
|
||||||
|
|
||||||
enterprise_hook ('get_service_parameters');
|
enterprise_hook ('get_service_synthetic_parameters');
|
||||||
|
|
||||||
$agent_name = (string) get_parameter('agent_name',agents_get_name ($id_agente));
|
$agent_name = (string) get_parameter('agent_name',agents_get_name ($id_agente));
|
||||||
|
|
||||||
|
@ -650,6 +651,12 @@ if ($update_module || $create_module) {
|
||||||
$ff_event = (int) get_parameter ('ff_event');
|
$ff_event = (int) get_parameter ('ff_event');
|
||||||
$unit = (string) get_parameter('unit');
|
$unit = (string) get_parameter('unit');
|
||||||
$id_tag = (array) get_parameter('id_tag_selected');
|
$id_tag = (array) get_parameter('id_tag_selected');
|
||||||
|
$serialize_ops = (string) get_parameter('serialize_ops');
|
||||||
|
|
||||||
|
if($prediction_module != 0) {
|
||||||
|
unset($serialize_ops);
|
||||||
|
modules_delete_synthetic_operations($id_agent_module);
|
||||||
|
}
|
||||||
|
|
||||||
$active_snmp_v3 = get_parameter('active_snmp_v3');
|
$active_snmp_v3 = get_parameter('active_snmp_v3');
|
||||||
if ($active_snmp_v3) {
|
if ($active_snmp_v3) {
|
||||||
|
@ -714,6 +721,10 @@ if ($update_module) {
|
||||||
"Fail to try update module '$name' for agent ".$agent["nombre"]);
|
"Fail to try update module '$name' for agent ".$agent["nombre"]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if(enterprise_hook('modules_is_synthetic')) {
|
||||||
|
enterprise_hook('modules_create_synthetic_operations', array($id_agent_module, $serialize_ops));
|
||||||
|
}
|
||||||
|
|
||||||
echo '<h3 class="suc">'.__('Module successfully updated').'</h3>';
|
echo '<h3 class="suc">'.__('Module successfully updated').'</h3>';
|
||||||
$id_agent_module = false;
|
$id_agent_module = false;
|
||||||
$edit_module = false;
|
$edit_module = false;
|
||||||
|
@ -794,6 +805,10 @@ if ($create_module) {
|
||||||
"Fail to try added module '$name' for agent ".$agent["nombre"]);
|
"Fail to try added module '$name' for agent ".$agent["nombre"]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if(enterprise_hook('modules_is_synthetic')) {
|
||||||
|
enterprise_hook('modules_create_synthetic_operations', array($id_agent_module, $serialize_ops));
|
||||||
|
}
|
||||||
|
|
||||||
echo '<h3 class="suc">'.__('Module added successfully').'</h3>';
|
echo '<h3 class="suc">'.__('Module added successfully').'</h3>';
|
||||||
$id_agent_module = false;
|
$id_agent_module = false;
|
||||||
$edit_module = false;
|
$edit_module = false;
|
||||||
|
|
|
@ -26,6 +26,8 @@ $custom_integer_2 = get_parameter ('custom_integer_2', 0);
|
||||||
$sql = 'SELECT * FROM tagente_modulo WHERE id_agente_modulo = '.$id_agente_modulo;
|
$sql = 'SELECT * FROM tagente_modulo WHERE id_agente_modulo = '.$id_agente_modulo;
|
||||||
$row = db_get_row_sql($sql);
|
$row = db_get_row_sql($sql);
|
||||||
$is_service = false;
|
$is_service = false;
|
||||||
|
$is_synthetic = false;
|
||||||
|
$is_synthetic_avg = false;
|
||||||
if ($row !== false && is_array($row)) {
|
if ($row !== false && is_array($row)) {
|
||||||
$prediction_module = $row['prediction_module'];
|
$prediction_module = $row['prediction_module'];
|
||||||
$custom_integer_2 = $row ['custom_integer_2'];
|
$custom_integer_2 = $row ['custom_integer_2'];
|
||||||
|
@ -34,6 +36,20 @@ if ($row !== false && is_array($row)) {
|
||||||
if ($service_select > 0) {
|
if ($service_select > 0) {
|
||||||
$is_service = true;
|
$is_service = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
$first_op = explode('_', reset(array_keys($ops)));
|
||||||
|
|
||||||
|
if(isset($first_op[1]) && $first_op[1] == 'avg') {
|
||||||
|
$is_synthetic_avg = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$is_synthetic = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$service_select = 0;
|
$service_select = 0;
|
||||||
|
@ -53,12 +69,19 @@ $data = array ();
|
||||||
$data[0] = __('Source module');
|
$data[0] = __('Source module');
|
||||||
$data[0] .= ui_print_help_icon ('prediction_source_module', true);
|
$data[0] .= ui_print_help_icon ('prediction_source_module', true);
|
||||||
$data[1] = '';
|
$data[1] = '';
|
||||||
// Services are an Enterprise feature.
|
// Services and Synthetic are an Enterprise feature.
|
||||||
$module_service_selector = enterprise_hook('get_module_service_selector', array($is_service));
|
$module_service_synthetic_selector = enterprise_hook('get_module_service_synthetic_selector', array($is_service, $is_synthetic, $is_synthetic_avg));
|
||||||
if ($module_service_selector !== ENTERPRISE_NOT_HOOK) {
|
if ($module_service_synthetic_selector !== ENTERPRISE_NOT_HOOK) {
|
||||||
$data[1] = $module_service_selector;
|
$data[1] = $module_service_synthetic_selector;
|
||||||
|
|
||||||
|
$table_simple->colspan['module_service_synthetic_selector'][1] = 3;
|
||||||
|
push_table_simple ($data, 'module_service_synthetic_selector');
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data[0] = '';
|
||||||
}
|
}
|
||||||
$data[1] .= '<div id="module_data" style="top:1em; float:left; width:50%;">';
|
|
||||||
|
$data[1] = '<div id="module_data" style="top:1em; float:left; width:50%;">';
|
||||||
$data[1] .= html_print_label(__("Agent"),'agent_name', true)."<br/>";
|
$data[1] .= html_print_label(__("Agent"),'agent_name', true)."<br/>";
|
||||||
$sql = "SELECT id_agente, nombre FROM tagente";
|
$sql = "SELECT id_agente, nombre FROM tagente";
|
||||||
// TODO: ACL Filter
|
// TODO: ACL Filter
|
||||||
|
@ -88,33 +111,29 @@ $data[1] .= html_print_select ($periods, 'custom_integer_2', $custom_integer_2,
|
||||||
$data[1] .= html_print_input_hidden ('id_agente', $id_agente, true);
|
$data[1] .= html_print_input_hidden ('id_agente', $id_agente, true);
|
||||||
$data[1] .= '</div>';
|
$data[1] .= '</div>';
|
||||||
|
|
||||||
// Services are an Enterprise feature.
|
|
||||||
$selector_form = enterprise_hook('get_selector_form', array($is_service, $service_select));
|
|
||||||
if ($selector_form !== ENTERPRISE_NOT_HOOK) {
|
|
||||||
$data[1] .= $selector_form;
|
|
||||||
}
|
|
||||||
|
|
||||||
$table_simple->colspan['prediction_module'][1] = 3;
|
$table_simple->colspan['prediction_module'][1] = 3;
|
||||||
|
|
||||||
push_table_simple ($data, 'prediction_module');
|
push_table_simple ($data, 'prediction_module');
|
||||||
|
|
||||||
// Synthetic modules are an Enterprise feature.
|
// Services are an Enterprise feature.
|
||||||
$data = array();
|
$selector_form = enterprise_hook('get_selector_form', array($service_select));
|
||||||
$synthetic_selector = enterprise_hook ('get_synthetic_module_selector', array($is_service));
|
if ($selector_form !== ENTERPRISE_NOT_HOOK) {
|
||||||
if ($synthetic_selector !== ENTERPRISE_NOT_HOOK) {
|
$data = array();
|
||||||
$data[0] = __('Synthetic module');
|
$data[0] = '';
|
||||||
$data[1] = $synthetic_selector;
|
$data[1] = $selector_form;
|
||||||
$table_simple->colspan['synthetic_selector'][1] = 3;
|
|
||||||
push_table_simple ($data, 'synthetic_selector');
|
$table_simple->colspan['service_module'][1] = 3;
|
||||||
|
push_table_simple ($data, 'service_module');
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array();
|
// Synthetic modules are an Enterprise feature.
|
||||||
$synthetic_module_form = enterprise_hook ('get_synthetic_module_form');
|
$synthetic_module_form = enterprise_hook ('get_synthetic_module_form');
|
||||||
if ($synthetic_module_form !== ENTERPRISE_NOT_HOOK) {
|
if ($synthetic_module_form !== ENTERPRISE_NOT_HOOK) {
|
||||||
|
$data = array();
|
||||||
$data[0] = '';
|
$data[0] = '';
|
||||||
$data[1] = $synthetic_module_form;
|
$data[1] = $synthetic_module_form;
|
||||||
$table_simple->colspan['synthetic_module_form'][1] = 3;
|
|
||||||
push_table_simple ($data, 'synthetic_module_form');
|
$table_simple->colspan['synthetic_module'][1] = 3;
|
||||||
|
push_table_simple ($data, 'synthetic_module');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Removed common useless parameter */
|
/* Removed common useless parameter */
|
||||||
|
@ -123,8 +142,10 @@ unset ($table_advanced->data[2][2]);
|
||||||
unset ($table_advanced->data[2][3]);
|
unset ($table_advanced->data[2][3]);
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {agent_module_autocomplete ("#text_agent_name", "#id_agente", "#prediction_module")});
|
$(document).ready(function() {
|
||||||
|
agent_module_autocomplete ("#text_agent_name", "#id_agente", "#prediction_module");
|
||||||
|
|
||||||
<?php enterprise_hook('print_services_javascript'); ?>
|
<?php enterprise_hook('setup_services_synth', array($is_service, $is_synthetic, $is_synthetic_avg, $ops)); ?>
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue