diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index fa05d5d435..974753c5c0 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1935,27 +1935,41 @@ function events_page_details ($event, $server = "") { } $table_details->data[] = $data; - $data = array(); - $data[0] = '
'.__('Graph').'
'; - $module_module_type = -1; - if (isset($module["module_type"])) { - $module_module_type = $module["module_type"]; + if (check_acl($config['id_user'], $agent['id_grupo'], "RR")) { + $data = array(); + $data[0] = '
'.__('Graph').'
'; + + $module_type = -1; + if (isset($module["module_type"])) { + $module_type = $module["module_type"]; + } + $graph_type = return_graphtype ($module_type); + $url = ui_get_full_url("operation/agentes/stat_win.php", false, false, false); + $handle = dechex(crc32($module["id_agente_modulo"].$module["nombre"])); + $win_handle = "day_$handle"; + + $graph_params = array( + "type" => $graph_type, + "period" => SECONDS_1DAY, + "id" => $module["id_agente_modulo"], + "label" => rawurlencode(urlencode(base64_encode($module["nombre"]))), + "refresh" => SECONDS_10MINUTES + ); + + if (defined('METACONSOLE')) { + // Set the server id + $graph_params["server"] = $server["id"]; + } + + $graph_params_str = http_build_query($graph_params); + + $link = "winopeng('$url?$graph_params_str','$win_handle')"; + + $data[1] = ''; + $data[1] .= html_print_image('images/chart_curve.png',true); + $data[1] .= ''; + $table_details->data[] = $data; } - $graph_type = return_graphtype ($module_module_type); - - $win_handle=dechex(crc32($module["id_agente_modulo"] . - $module["nombre"])); - - $module_module_name = ''; - if (isset($module["module_name"])) { - $module_module_name = $module["module_name"]; - } - $link ="winopeng('" . $serverstring . "operation/agentes/stat_win.php?type=" . $graph_type."&period=86400&id=" . $module["id_agente_modulo"] . "&label=" . rawurlencode(urlencode(base64_encode($module_module_name))) . $hashstring . "&refresh=600','day_".$win_handle."')"; - - $data[1] = ''; - $data[1] .= html_print_image('images/chart_curve.png',true); - $data[1] .= ''; - $table_details->data[] = $data; } $data = array(); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 06d001b310..8f58184070 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -804,26 +804,26 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png"); + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); if ($compare === 'separated') { return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend, - $long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, - $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl, + $long_index, ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl, $series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false, $series_suffix_str, $menu, $backgroundColor). '
'. area_graph($flash_chart, $chart_prev, $width, $height/2, $color_prev, $legend_prev, - $long_index_prev, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, - $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl, + $long_index_prev, ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl, $series_type_prev, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false, $series_suffix_str, $menu, $backgroundColor); } else { // Color commented not to restrict serie colors return area_graph($flash_chart, $chart, $width, $height, $color, $legend, - $long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, - $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl, + $long_index, ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl, $series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false, $series_suffix_str, $menu, $backgroundColor); } @@ -1320,7 +1320,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png")); + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); //Work around for fixed the agents name with huge size chars. @@ -1365,8 +1365,8 @@ function graphic_combined_module ($module_list, $weight_list, $period, case CUSTOM_GRAPH_AREA: return area_graph($flash_charts, $graph_values, $width, $height, $color, $module_name_list, $long_index, - ui_get_full_url("images/image_problem.opaque.png"), "", - "", $homeurl, $water_mark, $config['fontpath'], + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $homeurl, $water_mark, $config['fontpath'], $fixed_font_size, "", $ttl, array(), array(), 0, 0, '', false, '', true, $background_color); break; @@ -1374,22 +1374,22 @@ function graphic_combined_module ($module_list, $weight_list, $period, case CUSTOM_GRAPH_STACKED_AREA: return stacked_area_graph($flash_charts, $graph_values, $width, $height, $color, $module_name_list, $long_index, - ui_get_full_url("images/image_problem.opaque.png"), "", - "", $water_mark, $config['fontpath'], $fixed_font_size, + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], $fixed_font_size, "", $ttl, $homeurl, $background_color); break; case CUSTOM_GRAPH_LINE: return line_graph($flash_charts, $graph_values, $width, $height, $color, $module_name_list, $long_index, - ui_get_full_url("images/image_problem.opaque.png"), "", - "", $water_mark, $config['fontpath'], $fixed_font_size, + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], $fixed_font_size, "", $ttl, $homeurl, $background_color); break; case CUSTOM_GRAPH_STACKED_LINE: return stacked_line_graph($flash_charts, $graph_values, $width, $height, $color, $module_name_list, $long_index, - ui_get_full_url("images/image_problem.opaque.png"), "", - "", $water_mark, $config['fontpath'], $fixed_font_size, + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], $fixed_font_size, "", $ttl, $homeurl, $background_color); break; } @@ -1455,15 +1455,15 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0, $return = } $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png")); + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); if ($empty_data) { $out = graph_nodata_image($width, $height); } else { - $out = area_graph($config['flash_charts'], $data, $width, $height, - null, null, null, ui_get_full_url("images/image_problem.opaque.png"), "", "", ui_get_full_url(false, false, false, false), - $water_mark, + $out = area_graph($config['flash_charts'], $data, $width, $height, null, null, null, + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", ui_get_full_url(false, false, false, false), $water_mark, $config['fontpath'], $config['font_size'], "", 1, array(), array(), 0, 0, '', false, '', false); } @@ -1553,7 +1553,7 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re array_walk($data, 'truncate_negatives'); $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png")); + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); $colors = array(COL_CRITICAL, COL_WARNING, COL_NORMAL, COL_UNKNOWN); @@ -1566,8 +1566,8 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re } $out = pie2d_graph($config['flash_charts'], $data, $width, $height, - __("other"), - ui_get_full_url(false), '', $config['fontpath'], $config['font_size'], 1, "hidden", $colors); + __("other"), ui_get_full_url(false, false, false, false), '', + $config['fontpath'], $config['font_size'], 1, "hidden", $colors); if ($return) { return $out; @@ -1635,11 +1635,10 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) { } $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png")); + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); return pie3d_graph($config['flash_charts'], $data, $width, $height, __("other"), - '', $water_mark, - $config['fontpath'], $config['font_size'], 1, "bottom"); + '', $water_mark, $config['fontpath'], $config['font_size'], 1, "bottom"); } function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value_text = false, $color = false, $options = false) { @@ -1736,8 +1735,7 @@ function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek 5 => COL_NOTINIT); return slicesbar_graph($data, $period, $width, $height, $colors, - $config['fontpath'], - $round_corner, $home_url, $ttl); + $config['fontpath'], $round_corner, $home_url, $ttl); } /** @@ -1947,7 +1945,7 @@ function grafico_db_agentes_purge ($id_agent, $width = 380, $height = 300) { $water_mark = array( 'file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png") + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false) ); return pie3d_graph($config['flash_charts'], $data, $width, $height, @@ -1979,11 +1977,10 @@ function grafico_db_agentes_paquetes($width = 380, $height = 300) { } $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png")); + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); return hbar_graph($config['flash_charts'], $data, $width, $height, array(), - $legend, "", "", true, "", - $water_mark, + $legend, "", "", true, "", $water_mark, $config['fontpath'], $config['font_size'], false); } @@ -2040,8 +2037,8 @@ function graph_db_agentes_modulos($width, $height) { } $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png")); - + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); + return hbar_graph($config['flash_charts'], $data, $width, $height, array(), array(), "", "", true, "", @@ -2087,8 +2084,11 @@ function graphic_user_activity ($width = 350, $height = 230) { $data[$login['id_usuario']] = $login['n_incidents']; } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); + return pie3d_graph($config['flash_charts'], $data, $width, $height, - __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png", + __('Other'), '', $water_mark, $config['fontpath'], $config['font_size']); } @@ -2122,8 +2122,11 @@ function grafico_incidente_prioridad () { __('Very serious') => $data_tmp[4], __('Maintenance') => $data_tmp[5]); + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); + return pie3d_graph($config['flash_charts'], $data, 320, 200, - __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png", + __('Other'), '', $water_mark, $config['fontpath'], $config['font_size']); } @@ -2157,8 +2160,11 @@ function graph_incidents_status () { $data[__("Invalid")]++; } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); + return pie3d_graph($config['flash_charts'], $data, 370, 180, - __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png", + __('Other'), '', $water_mark, $config['fontpath'], $config['font_size']); } @@ -2195,8 +2201,11 @@ function graphic_incident_group () { $data[__('All')] = $incidents_all; } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); + return pie3d_graph($config['flash_charts'], $data, 320, 200, - __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png", + __('Other'), '', $water_mark, $config['fontpath'], $config['font_size']); } @@ -2234,8 +2243,11 @@ function graphic_incident_user () { $data[$name] = $incident['n_incidents']; } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); + return pie3d_graph($config['flash_charts'], $data, 320, 200, - __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png", + __('Other'), '', $water_mark, $config['fontpath'], $config['font_size']); } @@ -2282,8 +2294,11 @@ function graphic_incident_source($width = 320, $height = 200) { $data[$origin['origen']] = $origin['n_incident']; } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); + return pie3d_graph($config['flash_charts'], $data, $width, $height, - __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png", + __('Other'), '', $water_mark, $config['fontpath'], $config['font_size']); } @@ -2305,7 +2320,7 @@ function graph_events_validated($width = 300, $height = 200, $url = "", $meta = } $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false, false)); + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); echo pie3d_graph( true, $data_graph, $width, $height, __("other"), "", @@ -2446,7 +2461,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta = arsort($data); $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false, false)); + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); return pie3d_graph($config['flash_charts'], $data, $width, $height, __('Other'), '', $water_mark, @@ -2518,7 +2533,7 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200) { $water_mark = array( 'file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png")); + 'url' => ui_get_full_url("/images/logo_vertical_water.png", false, false, false)); return pie3d_graph($config['flash_charts'], $data, $width, $height, __('Other'), '', $water_mark, @@ -2574,7 +2589,7 @@ function grafico_eventos_usuario ($width, $height) { $water_mark = array( 'file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png")); + 'url' => ui_get_full_url("/images/logo_vertical_water.png", false, false, false)); return pie3d_graph($config['flash_charts'], $data, $width, $height, __('Other'), '', $water_mark, @@ -2654,19 +2669,17 @@ function graph_custom_sql_graph ($id, $width, $height, $type = 'sql_graph_vbar', } $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png")); + 'url' => ui_get_full_url("/images/logo_vertical_water.png", false, false, false)); switch ($type) { case 'sql_graph_vbar': // vertical bar return vbar_graph($flash_charts, $data, $width, $height, array(), - array(), "", "", $homeurl, - $water_mark, + array(), "", "", $homeurl, $water_mark, $config['fontpath'], $config['font_size'], false, $ttl); break; case 'sql_graph_hbar': // horizontal bar return hbar_graph($flash_charts, $data, $width, $height, array(), - array(), "", "", true, $homeurl, - $water_mark, + array(), "", "", true, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], false, $ttl); break; case 'sql_graph_pie': // Pie @@ -3245,25 +3258,25 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, } $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png")); + 'url' => ui_get_full_url("/images/logo_vertical_water.png", false, false, false)); if ($compare === 'separated') { return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend, - $long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, - $water_mark, + $long_index, ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, 1, $series_type, $chart_extra_data, 0, 0, $adapt_key, false, $series_suffix_str, $menu). '
'. area_graph($flash_chart, $chart_prev, $width, $height/2, $color_prev, $legend_prev, - $long_index_prev, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, - $water_mark, + $long_index_prev, ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, 1, $series_type_prev, $chart_extra_data_prev, 0, 0, $adapt_key, false, $series_suffix_str, $menu); } else { return area_graph($flash_chart, $chart, $width, $height, $color, $legend, - $long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, - $water_mark, + $long_index, ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, 1, $series_type, $chart_extra_data, 0, 0, $adapt_key, false, $series_suffix_str, $menu); } @@ -3336,11 +3349,12 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $unit = } $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png")); + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); return area_graph($flash_chart, $chart, $width, $height, array (), $sources, - array (), "images/image_problem.opaque.png", "", $unit, $homeurl, + array (), ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", $unit, $homeurl, $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size'], $unit, 2); } @@ -3414,12 +3428,12 @@ function graph_netflow_total_area ($data, $period, $width, $height, $unit = '', } $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png")); + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); $legend = array (__('Max.') . ' ' . format_numeric($max) . ' ' . __('Min.') . ' ' . format_numeric($min) . ' ' . __('Avg.') . ' ' . format_numeric ($avg)); return area_graph($flash_chart, $chart, $width, $height, array (), $legend, - array (), ui_get_full_url("images/image_problem.opaque.png"), "", "", $homeurl, - $water_mark, + array (), ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl); } @@ -3453,8 +3467,11 @@ function graph_netflow_aggregate_pie ($data, $aggregate, $ttl = 1, $only_image = $flash_chart = false; } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); + return pie3d_graph($flash_chart, $values, 370, 200, - __('Other'), $config['homeurl'], $config['homedir'] . "/images/logo_vertical_water.png", + __('Other'), $config['homeurl'], $water_mark, $config['fontpath'], $config['font_size'], $ttl); } @@ -3760,7 +3777,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, } $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png")); + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); return area_graph($flash_chart, $chart, $width, $height, $color, $legend, array(), '', "", $unit, $homeurl, diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index dc8974f297..a3f6d7ee33 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -484,30 +484,23 @@ function treeview_printTable($id_agente, $server_data = array()) { $table->data = array(); foreach ($network_interfaces as $interface_name => $interface) { - if (!empty($interface['traffic'])) { + if (!empty($interface['traffic']) && check_acl($config['id_user'], $agent["id_grupo"], "RR")) { $params = array( 'interface_name' => $interface_name, 'agent_id' => $id_agente, 'traffic_module_in' => $interface['traffic']['in'], 'traffic_module_out' => $interface['traffic']['out'] ); + + if (defined('METACONSOLE') && !empty($server_id)) + $params["server"] = $server_id; + $params_json = json_encode($params); $params_encoded = base64_encode($params_json); + $url = ui_get_full_url("operation/agentes/interface_traffic_graph_win.php", false, false, false); + $graph_url = "$url?params=$params_encoded"; $win_handle = dechex(crc32($interface['status_module_id'].$interface_name)); - $graph_url = ''; - if (!defined('METACONSOLE')) { - $graph_url = $config['homeurl'] . - "operation/agentes/interface_traffic_graph_win.php?" . - "params=$params_encoded"; - } - else if (!empty($server_data)) { - $graph_url = ui_meta_get_url_console_child( - $server_data, null, null, null, null, - "operation/agentes/interface_traffic_graph_win.php?" . - "params=$params_encoded"); - } - $graph_link = "" . html_print_image("images/chart_curve.png", true, array("title" => __('Interface traffic'))) . ""; } diff --git a/pandora_console/operation/agentes/interface_traffic_graph_win.php b/pandora_console/operation/agentes/interface_traffic_graph_win.php index 7ae7178194..2806369664 100644 --- a/pandora_console/operation/agentes/interface_traffic_graph_win.php +++ b/pandora_console/operation/agentes/interface_traffic_graph_win.php @@ -29,23 +29,27 @@ require_once ($config['homedir'] . '/include/functions_graph.php'); require_once ($config['homedir'] . '/include/functions_custom_graphs.php'); require_once ($config['homedir'] . '/include/functions_modules.php'); -// Hash login process -if (! isset ($config['id_user']) && get_parameter("loginhash", 0)) { - $loginhash_data = get_parameter("loginhash_data", ""); - $loginhash_user = str_rot13(get_parameter("loginhash_user", "")); - - if ($config["loginhash_pwd"] != "" && $loginhash_data == md5($loginhash_user.$config["loginhash_pwd"])) { - db_logon ($loginhash_user, $_SERVER['REMOTE_ADDR']); - $_SESSION['id_usuario'] = $loginhash_user; - $config["id_user"] = $loginhash_user; - - $hash_connection_data = true; - } - -} - check_login(); +$params_json = base64_decode((string) get_parameter('params')); +$params = json_decode($params_json, true); + +// Metaconsole connection to the node +$server_id = (int) (isset($params['server']) ? $params['server'] : 0); +if (!empty($server_id) && function_exists("metaconsole_get_connection_by_id")) { + $server = metaconsole_get_connection_by_id($server_id); + + // Error connecting + if (metaconsole_connect($server) !== NOERR) { + echo ""; + echo ""; + ui_print_error_message(__('There was a problem connecting with the node')); + echo ""; + echo ""; + exit; + } +} + $user_language = get_user_language($config['id_user']); if (file_exists ('../../include/languages/'.$user_language.'.mo')) { $l10n = new gettext_reader (new CachedFileReader ('../../include/languages/'.$user_language.'.mo')); @@ -54,9 +58,6 @@ if (file_exists ('../../include/languages/'.$user_language.'.mo')) { echo ''; -$params_json = base64_decode((string) get_parameter('params')); -$params = json_decode($params_json, true); - $interface_name = (string) $params['interface_name']; $agent_id = (int) $params['agent_id']; $interface_traffic_modules = array( @@ -106,6 +107,25 @@ $interface_traffic_modules = array( '; $side_layer_params['body_text'] .= html_print_input_hidden("params", base64_encode($params_json), true); - if (isset($hash_connection_data)) { - $side_layer_params['body_text'] .= - html_print_input_hidden("loginhash", "auto", true); - $side_layer_params['body_text'] .= - html_print_input_hidden("loginhash_data", $loginhash_data, true); - $side_layer_params['body_text'] .= - html_print_input_hidden("loginhash_user", - str_rot13($loginhash_user), true); - } - // FORM TABLE $table = html_get_predefined_table('transparent', 2); diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index 206678bf92..498c37036b 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -21,32 +21,32 @@ if (! isset($_SESSION['id_usuario'])) { // Global & session management require_once ('../../include/config.php'); -require_once ('../../include/auth/mysql.php'); +require_once ($config['homedir'] . '/include/auth/mysql.php'); require_once ($config['homedir'] . '/include/functions.php'); require_once ($config['homedir'] . '/include/functions_db.php'); require_once ($config['homedir'] . '/include/functions_reporting.php'); require_once ($config['homedir'] . '/include/functions_graph.php'); require_once ($config['homedir'] . '/include/functions_modules.php'); - -// Hash login process -if (! isset ($config['id_user']) && get_parameter("loginhash", 0)) { - $loginhash_data = get_parameter("loginhash_data", ""); - $loginhash_user = str_rot13(get_parameter("loginhash_user", "")); - - if ($config["loginhash_pwd"] != "" - && $loginhash_data == md5($loginhash_user.$config["loginhash_pwd"])) { - - db_logon ($loginhash_user, $_SERVER['REMOTE_ADDR']); - $_SESSION['id_usuario'] = $loginhash_user; - $config["id_user"] = $loginhash_user; - - $hash_connection_data = true; - } - -} +require_once ($config['homedir'] . '/include/functions_agents.php'); check_login (); +// Metaconsole connection to the node +$server_id = (int) get_parameter("server"); +if (!empty($server_id) && function_exists("metaconsole_get_connection_by_id")) { + $server = metaconsole_get_connection_by_id($server_id); + + // Error connecting + if (metaconsole_connect($server) !== NOERR) { + echo ""; + echo ""; + ui_print_error_message(__('There was a problem connecting with the node')); + echo ""; + echo ""; + exit; + } +} + $user_language = get_user_language ($config['id_user']); if (file_exists ('../../include/languages/'.$user_language.'.mo')) { $l10n = new gettext_reader (new CachedFileReader ('../../include/languages/'.$user_language.'.mo')); @@ -101,22 +101,36 @@ $label = base64_decode(get_parameter('label', '')); '; - $params['body_text'] .= html_print_input_hidden ("id", $id, true); - $params['body_text'] .= html_print_input_hidden ("label", $label); - - if (isset($hash_connection_data)) { - $params['body_text'] .= - html_print_input_hidden("loginhash", "auto", true); - $params['body_text'] .= - html_print_input_hidden("loginhash_data", $loginhash_data, true); - $params['body_text'] .= - html_print_input_hidden("loginhash_user", - str_rot13($loginhash_user), true); - } - $params['body_text'] .= html_print_input_hidden ("id", $id, true); $params['body_text'] .= html_print_input_hidden ("label", $label, true); + if (!empty($server_id)) + $params['body_text'] .= html_print_input_hidden ("server", $server_id, true); + if (isset($_GET["type"])) { $type = get_parameter_get ("type"); $params['body_text'] .= html_print_input_hidden ("type", $type, true); @@ -401,39 +405,3 @@ $label = base64_decode(get_parameter('label', '')); }); $('#checkbox-time_compare_overlapped').click(function() { $('#checkbox-time_compare_separated').removeAttr('checked'); - }); - - - - var show_overview = false; - var height_window; - var width_window; - $(document).ready(function() { - height_window = $(window).height(); - width_window = $(window).width(); - }); - - $("*").filter(function() { - if (typeof(this.id) == "string") - return this.id.match(/menu_overview_graph.*/); - else - return false; - }).click(function() { - if (show_overview) { - window.resizeTo(width_window + 20, height_window + 50); - } - else { - window.resizeTo(width_window + 20, height_window + 200); - } - show_overview = !show_overview; - - }); - - - forced_title_callback(); - diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 685f451c97..68cb718cc6 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -885,6 +885,7 @@ else { foreach ($result_server as $result_element_key => $result_element_value) { + $result_server[$result_element_key]['server_id'] = $server["id"]; $result_server[$result_element_key]['server_name'] = $server["server_name"]; $result_server[$result_element_key]['server_url'] = $server["server_url"]."/"; $result_server[$result_element_key]['hashdata'] = $hashdata; @@ -1182,21 +1183,30 @@ foreach ($result as $row) { $data[7] = ""; - if ($row['history_data'] == 1) { + if ($row['history_data'] == 1 && check_acl($config['id_user'], $row['id_group'], "RR")) { $graph_type = return_graphtype ($row["module_type"]); - $nombre_tipo_modulo = modules_get_moduletype_name ($row["module_type"]); - $handle = "stat".$nombre_tipo_modulo."_".$row["id_agente_modulo"]; - $url = 'include/procesos.php?agente='.$row["id_agente_modulo"]; - $win_handle=dechex(crc32($row["id_agente_modulo"].$row["module_name"])); + $url = ui_get_full_url("operation/agentes/stat_win.php", false, false, false); + $handle = dechex(crc32($row["id_agente_modulo"].$row["module_name"])); + $win_handle = "day_$handle"; - if (defined('METACONSOLE')) - $link ="winopeng('" . - $row['server_url'] . "operation/agentes/stat_win.php?" . - "type=$graph_type&period=86400&loginhash=auto&loginhash_data=" . $row["hashdata"] . "&loginhash_user=" . str_rot13($row["user"]) . "&id=".$row["id_agente_modulo"]."&label=".rawurlencode(urlencode(base64_encode($row["module_name"])))."&refresh=600','day_".$win_handle."')"; - else - $link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$row["id_agente_modulo"]."&label=".rawurlencode(urlencode(base64_encode($row["module_name"])))."&refresh=600','day_".$win_handle."')"; + $graph_params = array( + "type" => $graph_type, + "period" => SECONDS_1DAY, + "id" => $row["id_agente_modulo"], + "label" => rawurlencode(urlencode(base64_encode($row["module_name"]))), + "refresh" => SECONDS_10MINUTES + ); + + if (defined('METACONSOLE') && isset($row["server_id"])) { + // Set the server id + $graph_params["server"] = $row["server_id"]; + } + + $graph_params_str = http_build_query($graph_params); + + $link = "winopeng('$url?$graph_params_str','$win_handle')"; $data[7] = '' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . ''; diff --git a/pandora_console/operation/tree.php b/pandora_console/operation/tree.php index 955d88ee81..2b9e25efb1 100755 --- a/pandora_console/operation/tree.php +++ b/pandora_console/operation/tree.php @@ -384,68 +384,62 @@ if (is_ajax ()) { echo " "; echo str_replace('img', 'img style="vertical-align: middle;"', servers_show_type ($row['id_modulo'])); echo " "; - $graph_type = return_graphtype ($row["id_tipo_modulo"]); - $win_handle=dechex(crc32($row["id_agente_modulo"] . $row["nombre"])); - if (defined ('METACONSOLE')) { - $console_url = $server['server_url'] . '/'; - } - else { - $console_url = ''; - } + $id_group = (int) db_get_value("id_grupo", "tagente", "id_agente", $row["id_agente"]); - - //Icon and link to the Module graph. - if (defined('METACONSOLE')) { - $url_module_graph = ui_meta_get_url_console_child( - $server, null, null, null, null, - "operation/agentes/stat_win.php?" . - "type=$graph_type&" . - "period=86400&" . - "id=" . $row["id_agente_modulo"] . "&" . - "label=" . rawurlencode(urlencode(base64_encode($row["nombre"]))) . "&" . - "refresh=600"); - } - else { - $url_module_graph = $console_url . - "operation/agentes/stat_win.php?" . - "type=$graph_type&" . - "period=86400&" . - "id=" . $row["id_agente_modulo"] . "&" . - "label=" . rawurlencode(urlencode(base64_encode($row["nombre"]))) . "&" . - "refresh=600"; - } - $link ="winopeng('" . $url_module_graph . "','day_".$win_handle."')"; - echo '' . html_print_image ("images/chart_curve.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) . ''; - - - echo " "; - - - //Icon and link to the Module data. - if (defined('METACONSOLE')) { + if (check_acl($config['id_user'], $id_group, "RR")) { + $graph_type = return_graphtype ($row["id_tipo_modulo"]); + $url = ui_get_full_url("operation/agentes/stat_win.php", false, false, false); + $handle = dechex(crc32($row["id_agente_modulo"].$row["nombre"])); + $win_handle = "day_$handle"; - $url_module_data = ui_meta_get_url_console_child( - $server, - "estado", "operation/agentes/ver_agente", - "id_agente=" . $row['id_agente'] . "&" . - "tab=data_view&" . - "period=86400&" . - "id=" . $row["id_agente_modulo"]); + $graph_params = array( + "type" => $graph_type, + "period" => SECONDS_1DAY, + "id" => $row["id_agente_modulo"], + "label" => rawurlencode(urlencode(base64_encode($row["nombre"]))), + "refresh" => SECONDS_10MINUTES + ); + + if (defined('METACONSOLE')) { + // Set the server id + $graph_params["server"] = $server["id"]; + } + + $graph_params_str = http_build_query($graph_params); + + $link = "winopeng('$url?$graph_params_str','$win_handle')"; + echo '' . html_print_image ("images/chart_curve.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) . ''; + + + echo " "; + + + //Icon and link to the Module data. + if (defined('METACONSOLE')) { + + $url_module_data = ui_meta_get_url_console_child( + $server, + "estado", "operation/agentes/ver_agente", + "id_agente=" . $row['id_agente'] . "&" . + "tab=data_view&" . + "period=86400&" . + "id=" . $row["id_agente_modulo"]); + } + else { + $url_module_data = $console_url . + "index.php?" . + "sec=estado&" . + "sec2=operation/agentes/ver_agente&" . + "id_agente=" . $row['id_agente'] . "&" . + "tab=data_view&" . + "period=86400&" . + "id=" . $row["id_agente_modulo"]; + } + echo "". html_print_image ("images/binary.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) . ""; + + echo " "; } - else { - $url_module_data = $console_url . - "index.php?" . - "sec=estado&" . - "sec2=operation/agentes/ver_agente&" . - "id_agente=" . $row['id_agente'] . "&" . - "tab=data_view&" . - "period=86400&" . - "id=" . $row["id_agente_modulo"]; - } - echo "". html_print_image ("images/binary.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) . ""; - - echo " "; $nmodule_alerts = db_get_value_sql(sprintf("SELECT count(*) FROM talert_template_modules WHERE id_agent_module = %s", $row["id_agente_modulo"]));