diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index f490571c32..357f4123b8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,17 @@ +2009-10-20 Miguel de Dios + + * pandora_console/operation/menu.php, + pandora_console/godmode/reporting/graphs.php, + pandora_console/godmode/reporting/graph_builder.php: clean debug trace + functions. + * pandora_console/godmode/agentes/module_manager.php, + pandora_console/godmode/alerts/alert_list.php: add the enterprise column + that it has a icon when the alert or module is make for policy. + * pandora_console/godmode/agentes/agent_manager.php: fix bug that when + create a new agent and in the md5 dir has a file with the next name + d41d8cd98f00b204e9800998ecf8427e, that name is a md5 of empty string. When + you has this file, the form take as conf file. + 2009-10-20 Sancho Lerena * include/help/en/help_alert_macros.php: Updated help. diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 3c7f03735a..a89b035243 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -67,10 +67,12 @@ if ($id_agente) { echo ""; echo '
 
'; -// Agent remote configuration editor -$agent_md5 = md5 ($nombre_agente, false); -$filename['md5'] = $config["remote_config"]."/md5/".$agent_md5.".md5"; -$filename['conf'] = $config["remote_config"]."/conf/".$agent_md5.".conf"; +if (!$new_agent) { + // Agent remote configuration editor + $agent_md5 = md5 ($nombre_agente, false); + $filename['md5'] = $config["remote_config"]."/md5/".$agent_md5.".md5"; + $filename['conf'] = $config["remote_config"]."/conf/".$agent_md5.".conf"; +} $disk_conf = (bool) get_parameter ('disk_conf'); @@ -108,10 +110,12 @@ if ($id_agente) { } // Remote configuration available -if (file_exists ($filename['md5'])) { - $table->data[0][1] .= ''; - $table->data[0][1] .= print_image ("images/application_edit.png", true, array ("border" => 0, "title" => __('This agent can be remotely configured'))); - $table->data[0][1] .= ''.print_help_tip (__('You can remotely edit this agent configuration'), true); +if (!$new_agent) { + if (file_exists ($filename['md5'])) { + $table->data[0][1] .= ''; + $table->data[0][1] .= print_image ("images/application_edit.png", true, array ("border" => 0, "title" => __('This agent can be remotely configured'))); + $table->data[0][1] .= ''.print_help_tip (__('You can remotely edit this agent configuration'), true); + } } $table->data[1][0] = __('IP Address'); @@ -189,14 +193,18 @@ $table->data[10][1] .= __('Active').' '.print_radio_button_extended ("disabled", // Remote configuration $table->data[11][0] = __('Remote configuration'); -if (file_exists ($filename['md5'])) { - $table->data[11][1] = date ("F d Y H:i:s", fileatime ($filename['md5'])); - // Delete remote configuration - $table->data[11][1] .= ''; - $table->data[11][1] .= print_image ("images/cross.png", true).''; -} else { - $table->data[11][1] = ''.__('Not available').''; +if (!$new_agent) { + if (file_exists ($filename['md5'])) { + $table->data[11][1] = date ("F d Y H:i:s", fileatime ($filename['md5'])); + // Delete remote configuration + $table->data[11][1] .= ''; + $table->data[11][1] .= print_image ("images/cross.png", true).''; + } + else + $table->data[11][1] = ''.__('Not available').''; } +else + $table->data[11][1] = ''.__('Not available').''; print_table ($table); diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index abc8ea6008..bdbb116a95 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -20,6 +20,7 @@ if (isset ($id_agente)) { } enterprise_include ('godmode/agentes/module_manager.php'); +$isFunctionPolicies = enterprise_include_once ('include/functions_policies.php'); // Create module/type combo echo ''; @@ -140,21 +141,23 @@ if ($modules === false) { $table->width = '95%'; $table->head = array (); $table->head[0] = __('Name'); -/* S stands for "Server" */; -$table->head[1] = __('S'); -$table->head[2] = __('Type'); -$table->head[3] = __('Interval'); -$table->head[4] = __('Description'); -$table->head[5] = __('Max/Min'); -$table->head[6] = __('Action'); +if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) + $table->head[1] = "" . __('P.') . ""; +$table->head[2] = "" . __('S.') . ""; +$table->head[3] = __('Type'); +$table->head[4] = __('Interval'); +$table->head[5] = __('Description'); +$table->head[6] = __('Max/Min'); +$table->head[7] = __('Action'); $table->style = array (); $table->style[0] = 'font-weight: bold'; $table->size = array (); -$table->size[6] = '65px'; +$table->size[2] = '35px'; +$table->size[7] = '65px'; $table->align = array (); -$table->align[1] = 'center'; -$table->align[6] = 'center'; +$table->align[2] = 'left'; +$table->align[7] = 'left'; $table->data = array (); $agent_interval = get_agent_interval ($id_agente); @@ -186,7 +189,10 @@ foreach ($modules as $module) { $data[0] = ''.get_modulegroup_name ($last_modulegroup).''; $i = array_push ($table->data, $data); $table->rowclass[$i - 1] = 'datos3'; - $table->colspan[$i - 1][0] = 7; + if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) + $table->colspan[$i - 1][0] = 8; + else + $table->colspan[$i - 1][0] = 7; $data = array (); } @@ -198,52 +204,65 @@ foreach ($modules as $module) { $data[0] .= $module['nombre']; $data[0] .= ''; + if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { + $policyInfo = isModuleInPolicy($module['id_agente_modulo'], false); + if ($policyInfo === false) + $data[1] = ''; + else { + $img = 'images/policies.png'; + + $data[1] = '' . + print_image($img,true, array('title' => $policyInfo['name_policy'])) . + ''; + } + } + // Module type (by server type ) - $data[1] = ''; + $data[2] = ''; if ($module['id_modulo'] > 0) { - $data[1] = show_server_type ($module['id_modulo']); + $data[2] = show_server_type ($module['id_modulo']); } // This module is initialized ? (has real data) $module_init = get_db_value ('utimestamp', 'tagente_estado', 'id_agente_modulo', $module['id_agente_modulo']); if ($module_init == 0) - $data[1] .= print_image ('images/error.png', true, array ('title' => __('Non initialized module'))); + $data[2] .= print_image ('images/error.png', true, array ('title' => __('Non initialized module'))); // Module type (by data type) - $data[2] = ''; + $data[3] = ''; if ($type) { - $data[2] = print_moduletype_icon ($type, true); + $data[3] = print_moduletype_icon ($type, true); } // Module interval if ($module['module_interval']) { - $data[3] = $module['module_interval']; + $data[4] = $module['module_interval']; } else { - $data[3] = $agent_interval; + $data[4] = $agent_interval; } - $data[4] = substr ($module['descripcion'], 0, 30); + $data[5] = substr ($module['descripcion'], 0, 30); // MAX / MIN values - $data[5] = $module["max"] ? $module["max"] : __('N/A'); - $data[5] .= ' / '.($module["min"] != $module['max']? $module["min"] : __('N/A')); + $data[6] = $module["max"] ? $module["max"] : __('N/A'); + $data[6] .= ' / '.($module["min"] != $module['max']? $module["min"] : __('N/A')); // Delete module - $data[6] = print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true); - $data[6] .= ''; - $data[6] .= print_image ('images/cross.png', true, + $data[7] .= print_image ('images/cross.png', true, array ('title' => __('Delete'))); - $data[6] .= ' '; + $data[7] .= ' '; // Make a data normalization if (isset($numericModules[$type])) { if ($numericModules[$type] === true) { - $data[6] .= ''; - $data[6] .= print_image ('images/chart_curve.png', true, + $data[7] .= ''; + $data[7] .= print_image ('images/chart_curve.png', true, array ('title' => __('Normalize'))); - $data[6] .= ''; + $data[7] .= ''; } } diff --git a/pandora_console/godmode/alerts/alert_list.php b/pandora_console/godmode/alerts/alert_list.php index b06fd1a23f..c6855b7759 100644 --- a/pandora_console/godmode/alerts/alert_list.php +++ b/pandora_console/godmode/alerts/alert_list.php @@ -97,6 +97,7 @@ if (! give_acl ($config['id_user'], 0, "LW")) { require_once ('include/functions_agents.php'); require_once ('include/functions_alerts.php'); +$isFunctionPolicies = enterprise_include ('include/functions_policies.php'); $create_alert = (bool) get_parameter ('create_alert'); $add_action = (bool) get_parameter ('add_action'); @@ -321,22 +322,32 @@ if (! $id_agente) { $table->size[1] = '15%'; $table->size[2] = '20%'; $table->size[3] = '15%'; - $table->size[4] = '50%'; + if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { + $table->size[4] = '20px'; + } + $table->size[5] = '50%'; } else { /* Different sizes or the layout screws up */ $table->size[0] = '20px'; $table->size[2] = '30%'; $table->size[3] = '20%'; - $table->size[4] = '50%'; + if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { + $table->size[4] = '20px'; + } + $table->size[5] = '50%'; } $table->head[2] = __('Module'); $table->head[3] = __('Template'); -$table->head[4] = __('Actions'); -$table->head[5] = ''; +if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { + $table->head[4] = "" . __('P.') . ""; +} +$table->head[5] = __('Actions'); +$table->head[6] = ''; $table->data = array (); $rowPair = true; $iterator = 0; + foreach ($simple_alerts as $alert) { if ($rowPair) $table->rowclass[$iterator] = 'rowPair'; @@ -351,7 +362,8 @@ foreach ($simple_alerts as $alert) { if ($alert['disabled']) { $data[0] .= print_input_image ('enable', 'images/lightbulb_off.png', 1, '', true); $data[0] .= print_input_hidden ('enable_alert', 1, true); - } else { + } + else { $data[0] .= print_input_image ('disable', 'images/lightbulb.png', 1, '', true); $data[0] .= print_input_hidden ('disable_alert', 1, true); } @@ -370,51 +382,64 @@ foreach ($simple_alerts as $alert) { '; $data[3] .= get_alert_template_name ($alert['id_alert_template']); + if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { + $policyInfo = isAlertInPolicy($alert['id_agent_module'], $alert['id_alert_template'], false); + if ($policyInfo === false) + $data[1] = ''; + else { + $img = 'images/policies.png'; + + $data[1] = '' . + print_image($img,true, array('title' => $policyInfo['name_policy'])) . + ''; + } + } + $actions = get_alert_agent_module_actions ($alert['id']); - $data[4] = ''; - $data[4] .= ''; - $data[4] .= print_image ('images/add.png', true); - $data[4] .= ' '.__('Add action'); - $data[4] .= ''; + $data[5] .= ''; + $data[5] .= print_image ('images/add.png', true); + $data[5] .= ' '.__('Add action'); + $data[5] .= ''; - $data[5] = ''; + $data[6] = ''; - $data[5] .= print_input_image ('delete', 'images/cross.png', 1, '', true); - $data[5] .= print_input_hidden ('delete_alert', 1, true); - $data[5] .= print_input_hidden ('id_alert', $alert['id'], true); - $data[5] .= ''; + $data[6] .= print_input_image ('delete', 'images/cross.png', 1, '', true); + $data[6] .= print_input_hidden ('delete_alert', 1, true); + $data[6] .= print_input_hidden ('id_alert', $alert['id'], true); + $data[6] .= ''; array_push ($table->data, $data); } diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index f2412ba0e2..836643e0f2 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -607,13 +607,6 @@ if (isset($module_array)){ echo ""; echo ""; echo ""; - - debugPrint($module_array); - debugPrint($width); - debugPrint($height); - debugPrint($period); - debugPrint($events); - debugPrint($stacked); for ($a=0; $a < count($module_array); $a++){ $id_agentemodulo = $module_array[$a]; diff --git a/pandora_console/godmode/reporting/graphs.php b/pandora_console/godmode/reporting/graphs.php index c7f1b26d6f..00bc627bb7 100644 --- a/pandora_console/godmode/reporting/graphs.php +++ b/pandora_console/godmode/reporting/graphs.php @@ -56,7 +56,7 @@ if ($delete_graph) { echo "

".__('Reporting')." » " . __('Graphs management').'

'; $graphs = get_user_custom_graphs (); -//debugPrint($graphs); + if (! empty ($graphs)) { $table->width = '650px'; $tale->class = 'databox_frame'; diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 02c916bfec..cb2d698693 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -202,7 +202,6 @@ if (give_acl ($config['id_user'], 0, "AR")) { /** * Add the extensions */ - //debugPrint($config['extensions']); foreach($config['extensions'] as $extension) { $operationModeMenu = $extension['operation_menu']; if ($operationModeMenu == null)