From 77fc16b690026feb65048de65113e7f1cada727d Mon Sep 17 00:00:00 2001 From: enriquecd Date: Thu, 25 Jan 2018 20:01:03 +0100 Subject: [PATCH] Inprove view and fix wizard - #1748 --- .../godmode/reporting/cluster_builder.php | 22 +- .../godmode/reporting/cluster_list.php | 7 +- .../godmode/reporting/cluster_view_2.php | 194 ++++++++++++++---- 3 files changed, 175 insertions(+), 48 deletions(-) diff --git a/pandora_console/godmode/reporting/cluster_builder.php b/pandora_console/godmode/reporting/cluster_builder.php index 754c602da8..217555c742 100644 --- a/pandora_console/godmode/reporting/cluster_builder.php +++ b/pandora_console/godmode/reporting/cluster_builder.php @@ -80,12 +80,14 @@ if ($add_cluster) { 'id_modulo' => 5, 'prediction_module' => 5, 'id_agente' =>$id_agent, - 'custom_integer_1' =>$id_cluster + 'custom_integer_1' =>$id_cluster, + 'id_tipo_modulo' => 3, + 'descripcion' => 'Cluster module' ); $id_module = modules_create_agent_module($values_module['id_agente'],$values_module['nombre'],$values_module); - $id_module = db_process_sql_insert('tagente_modulo', $values_module); + // $id_module = db_process_sql_insert('tagente_modulo', $values_module); if ($id_cluster !== false) db_pandora_audit("Report management", "Create cluster #$id_cluster"); @@ -177,6 +179,10 @@ elseif ($step == 3) { $id_parent_modulo = db_process_sql('select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent[0]['id_agent'].' and nombre = "Cluster status"'); + $get_module_type = db_process_sql('select id_tipo_modulo from tagente_modulo where nombre = "'.$value.'" limit 1'); + + $get_module_type_value = $get_module_type[0]['id_tipo_modulo']; + $values_module = array( 'nombre' => $value, 'id_modulo' => 5, @@ -184,7 +190,9 @@ elseif ($step == 3) { 'id_agente' => $id_agent[0]['id_agent'], 'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'], 'custom_integer_1' =>$id_cluster, - 'custom_integer_2' =>$tcluster_module + 'custom_integer_2' =>$tcluster_module, + 'id_tipo_modulo' =>$get_module_type_value, + 'descripcion' => 'Cluster module' ); @@ -297,6 +305,10 @@ elseif ($step == 3) { $tcluster_balanced_module = db_process_sql_insert('tcluster_item',array('name'=>$value,'id_cluster'=>$id_cluster,'item_type'=>"AP")); + $get_module_type = db_process_sql('select id_tipo_modulo from tagente_modulo where nombre = "'.$value.'" limit 1'); + + $get_module_type_value = $get_module_type[0]['id_tipo_modulo']; + $values_module = array( 'nombre' => $value, 'id_modulo' => 5, @@ -304,7 +316,9 @@ elseif ($step == 3) { 'id_agente' => $id_agent[0]['id_agent'], 'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'], 'custom_integer_1' => $id_cluster, - 'custom_integer_2' => $tcluster_balanced_module + 'custom_integer_2' => $tcluster_balanced_module, + 'id_tipo_modulo' => $get_module_type_value, + 'descripcion' => 'Cluster module' ); // $id_module = db_process_sql_insert('tagente_modulo', $values_module); diff --git a/pandora_console/godmode/reporting/cluster_list.php b/pandora_console/godmode/reporting/cluster_list.php index 25a248408a..e7c3857f1e 100644 --- a/pandora_console/godmode/reporting/cluster_list.php +++ b/pandora_console/godmode/reporting/cluster_list.php @@ -102,7 +102,7 @@ ui_pagination (count($clusters)); $cluster_module = db_process_sql('select id_agente_modulo from tagente_modulo where id_agente = (select id_agent from tcluster where id = '.$cluster['id'].') and nombre = "Cluster status"'); - $cluster_module_status = modules_get_status($cluster_module[0]['id_agente_modulo']); + $cluster_module_status = modules_get_agentmodule_last_status($cluster_module[0]['id_agente_modulo']); //cluster module status - close @@ -121,6 +121,11 @@ ui_pagination (count($clusters)); $data[5] = '
'; + break; + case 4: + + $data[5] = '
'; + break; case 5: diff --git a/pandora_console/godmode/reporting/cluster_view_2.php b/pandora_console/godmode/reporting/cluster_view_2.php index 47d41bfeeb..c7e7c27cd7 100644 --- a/pandora_console/godmode/reporting/cluster_view_2.php +++ b/pandora_console/godmode/reporting/cluster_view_2.php @@ -31,90 +31,198 @@ ui_print_page_header ( __("Cluster detail").' ยป '.clusters_get_name($id_cluster -echo ""; +echo "
"; echo ""; - echo ""; + echo ""; echo ""; echo ""; - echo ""; echo ""; echo "
"; - echo "
"; + echo "
"; + echo "
"; echo "
"; - - - echo ""; - - echo "
"; + echo "
"; echo "
".__('CLUSTER STATUS')."
"; - echo "
"; + + $cluster_module = db_process_sql('select id_agente_modulo from tagente_modulo where id_agente = (select id_agent from tcluster where id = '.$id_cluster.') and nombre = "Cluster status"'); + + $cluster_module_status = modules_get_agentmodule_last_status($cluster_module[0]['id_agente_modulo']); + + switch ($cluster_module_status) { + case 1: + + echo "
"; + + break; + case 2: + + echo "
"; + + break; + case 4: + + echo "
"; + + break; + case 3: + + echo "
"; + + break; + case 5: + + echo "
"; + + break; + case 0: + + echo "
"; + + break; + + default: + + break; + } - echo "
"; + echo "
"; echo "
".__('Balanced modules')."
"; - echo "
"; + echo "
"; $balanced_modules_in = items_get_cluster_items_id_name($id_cluster,'AP'); foreach ($balanced_modules_in as $key => $value) { $cluster_module = db_process_sql('select id_agente_modulo from tagente_modulo where custom_integer_2 = '.$key); - html_debug($cluster_module[0]['id_agente_modulo']); - - $cluster_module_status = modules_get_status($cluster_module[0]['id_agente_modulo']); - - - html_debug(modules_get_status($cluster_module_status)); - - - echo "
"; - + $cluster_module_status = modules_get_agentmodule_last_status($cluster_module[0]['id_agente_modulo']); + + echo "
"; + if($cluster_module_status == 5){ - echo ''.$value; + echo '
'.ui_print_truncate_text($value, 40,false).'
'; } else{ - echo ''.$value; + echo '
'.ui_print_truncate_text($value, 40,false).'
'; } - echo "
"; + echo '
'; } - - // - // $cluster_module_status = modules_get_status($cluster_module[0]['id_agente_modulo']); - - // html_debug($balanced_modules_in); - echo "
"; echo "
"; echo "
"; - echo "
"; - // - // echo "
".__('LAST UPDATE')."
"; - // echo "
88 Hours 88 Min 88 sec ago
"; - - echo "
"; - - - + echo "
"; + + $last_update = db_process_sql('select timestamp from tagente_estado where id_agente_modulo = '.$cluster_module[0]['id_agente_modulo']); + + $last_update_value = $last_update[0]['timestamp']; + + echo "
".__('LAST UPDATE')."
"; + echo "
".$last_update_value."
"; + + echo "
"; + + echo "
".__('Common modules')."
"; + + echo "
"; + + $modules_in = items_get_cluster_items_id_name($id_cluster,'AA'); + + foreach ($modules_in as $key => $value) { + $cluster_module = db_process_sql('select id_agente_modulo from tagente_modulo where custom_integer_2 = '.$key); + + $cluster_module_status = modules_get_agentmodule_last_status($cluster_module[0]['id_agente_modulo']); + + echo "
"; + + if($cluster_module_status == 5){ + echo '
'.ui_print_truncate_text($value, 40,false).'
'; + } + else{ + echo '
'.ui_print_truncate_text($value, 40,false).'
'; + } + + echo '
'; + + } + + echo "
"; + + echo "
"; + + echo "
"; + + echo "
"; + + $id_agent = db_process_sql('select id_agent from tcluster where id = '.$id_cluster); + + $id_agent_value = $id_agent[0]['id_agent']; + + $table = new stdClass(); + $table->id = 'agent_details'; + $table->width = '100%'; + $table->cellspacing = 0; + $table->cellpadding = 0; + $table->class = 'agents'; + $table->style = array_fill(0, 3, 'vertical-align: top;'); + + $data = array(); + $data[0][0] = html_print_table($table_agent, true); + $data[0][0] .= + '
+ ' . + '' . + '
' . + __('Events (24h)') . + '

' . + graph_graphic_agentevents ($id_agent_value, 450, 40, SECONDS_1DAY, '', true, true) . + '
'; + + $table->style[0] = 'width:100%; vertical-align:top;'; + $data[0][1] = html_print_table($table_contact, true); + $data[0][1] .= empty($table_data->data) ? + '' : + '
' . html_print_table($table_data, true); + $data[0][1] .= !isset($table_incident) ? + '' : + '
' . html_print_table($table_incident, true); + + $table->rowspan[1][0] = 0; + + $table->data = $data; + $table->rowclass[] = ''; + + $table->cellstyle[1][0] = 'text-align:center;'; + + html_print_table($table); + $data2[1][0] = !isset($table_interface) ? + '' : + html_print_table($table_interface, true); + $table->data = $data2; + $table->styleTable = ''; + html_print_table($table); + + unset($table); + + echo "
"; + echo "
+ echo "
"; - -echo 'El estado del modulo del cluster '.clusters_get_name($id_cluster).' es '.agents_get_status(40); - ?> \ No newline at end of file