2013-08-02 Miguel de Dios <miguel.dedios@artica.es>

* include/graphs/functions_gd.php, include/graphs/fgraph.php,
	include/functions.php, include/functions_graph.php,
	include/functions_visual_map.php,
	include/ajax/visual_console_builder.ajax.php,
	operation/visual_console/render_view.php: a lot of fixes in the
	visualmap.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8622 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-08-02 10:53:50 +00:00
parent b6ae3efc27
commit feedc7c8ba
8 changed files with 154 additions and 56 deletions

View File

@ -1,3 +1,12 @@
2013-08-02 Miguel de Dios <miguel.dedios@artica.es>
* include/graphs/functions_gd.php, include/graphs/fgraph.php,
include/functions.php, include/functions_graph.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
operation/visual_console/render_view.php: a lot of fixes in the
visualmap.
2013-08-02 Sergio Martin <sergio.martin@artica.es> 2013-08-02 Sergio Martin <sergio.martin@artica.es>
* include/functions_modules.php: Fix modules and * include/functions_modules.php: Fix modules and

View File

@ -234,26 +234,26 @@ switch ($action) {
} }
switch ($status) { switch ($status) {
case 1: case VISUAL_MAP_STATUS_CRITICAL_BAD:
//Critical (BAD) //Critical (BAD)
$colorStatus = "#ff0000"; $colorStatus = COL_CRITICAL;
break; break;
case 4: case VISUAL_MAP_STATUS_CRITICAL_ALERT:
//Critical (ALERT) //Critical (ALERT)
$colorStatus = "#ff8800"; $colorStatus = COL_ALERTFIRED;
break; break;
case 0: case VISUAL_MAP_STATUS_NORMAL:
//Normal (OK) //Normal (OK)
$colorStatus = "#00ff00"; $colorStatus = COL_NORMAL;
break; break;
case 2: case VISUAL_MAP_STATUS_WARNING:
//Warning //Warning
$colorStatus = "#ffff00"; $colorStatus = COL_WARNING;
break; break;
case 3: case VISUAL_MAP_STATUS_UNKNOWN:
//Unknown //Unknown
default: default:
$colorStatus = "#5A5AFF"; $colorStatus = COL_UNKNOWN;
// Default is Grey (Other) // Default is Grey (Other)
break; break;
} }

View File

@ -1779,7 +1779,8 @@ function can_user_access_node () {
$userinfo = get_user_info ($config['id_user']); $userinfo = get_user_info ($config['id_user']);
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
return $userinfo["is_admin"] == 1 ? 1 : $userinfo["metaconsole_access_node"]; return $userinfo["is_admin"] == 1 ? 1 :
$userinfo["metaconsole_access_node"];
} }
else { else {
return 1; return 1;

View File

@ -1501,7 +1501,8 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value_text = false, $color = false, $options = false) { function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value_text = false, $color = false, $options = false) {
global $config; global $config;
$out_of_lim_str = __("Out of limits"); $out_of_lim_str = io_safe_output(__("Out of limits"));
$title = ""; $title = "";
if ($value_text === false) { if ($value_text === false) {
@ -1547,7 +1548,7 @@ function progress_bubble($progress, $width, $height, $title = '', $mode = 1, $va
if (defined('METACONSOLE')) if (defined('METACONSOLE'))
$hack_metaconsole = '../../'; $hack_metaconsole = '../../';
$out_of_lim_str = __("Out of limits"); $out_of_lim_str = io_safe_output(__("Out of limits"));
$title = ""; $title = "";
if ($value_text === false) { if ($value_text === false) {

View File

@ -74,25 +74,25 @@ function visual_map_print_item($layoutData) {
switch ($status) { switch ($status) {
case VISUAL_MAP_STATUS_CRITICAL_BAD: case VISUAL_MAP_STATUS_CRITICAL_BAD:
//Critical (BAD) //Critical (BAD)
$colorStatus = "#ff0000"; $colorStatus = COL_CRITICAL;
break; break;
case VISUAL_MAP_STATUS_CRITICAL_ALERT: case VISUAL_MAP_STATUS_CRITICAL_ALERT:
//Critical (ALERT) //Critical (ALERT)
$colorStatus = "#ff8800"; $colorStatus = COL_ALERTFIRED;
break; break;
case VISUAL_MAP_STATUS_NORMAL: case VISUAL_MAP_STATUS_NORMAL:
//Normal (OK) //Normal (OK)
$colorStatus = "#00ff00"; $colorStatus = COL_NORMAL;
break; break;
case VISUAL_MAP_STATUS_WARNING: case VISUAL_MAP_STATUS_WARNING:
//Warning //Warning
$colorStatus = "#ffff00"; $colorStatus = COL_WARNING;
break; break;
case VISUAL_MAP_STATUS_UNKNOWN: case VISUAL_MAP_STATUS_UNKNOWN:
default: default:
//Unknown //Unknown
// Default is Blue (Other) // Default is Blue (Other)
$colorStatus = "#5A5AFF"; $colorStatus = COL_UNKNOWN;
break; break;
} }
@ -1039,9 +1039,11 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo '<div style="left: 0px; top: 0px; text-align: center; z-index: '.$z_index.'; '.($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '').' position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">'; echo '<div style="left: 0px; top: 0px; text-align: center; z-index: '.$z_index.'; '.($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '').' position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
if ($show_links) { if ($show_links) {
if (!empty($layout_data['id_agent'])
&& empty($layout_data['id_layout_linked'])) {
if (!empty($layout_data['id_agent']) && empty($layout_data['id_layout_linked'])) { if ($layout_data['enable_link']
if ($layout_data['enable_link']) { && can_user_access_node()) {
$id_service = false; $id_service = false;
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
@ -1055,25 +1057,46 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
if (!empty($id_service)) { if (!empty($id_service)) {
//Link to an service page //Link to an service page
echo '<a href="'.$config['homeurl'].'index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' . if (empty($layout_data['id_metaconsole'])) {
$id_service . '&offset=0">'; $url = $config['homeurl'] .
'index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0';
}
else {
$server = db_get_row('tmetaconsole_setup',
'id', $layout_data['id_metaconsole']);
$url = $server["server_url"] . "/" .
'index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0';
}
} }
else if ($layout_data['id_agente_modulo'] != 0) { else if ($layout_data['id_agente_modulo'] != 0) {
// Link to an module // Link to an module
echo '<a href="'.$config['homeurl'].'/index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;id_module=' . $layout_data['id_agente_modulo'] . '">';
}
else {
if (empty($layout_data['id_metaconsole'])) { if (empty($layout_data['id_metaconsole'])) {
$url = $config['homeurl'] . 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=' . $layout_data['id_agent']; $url = $config['homeurl'] .
'index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;id_module=' . $layout_data['id_agente_modulo'];
} }
else { else {
$url = ui_meta_get_url_console_child( $url = ui_meta_get_url_console_child(
$layout_data['id_metaconsole'], $layout_data['id_metaconsole'],
"estado", "operation/agentes/ver_agente&amp;id_agente=" . $layout_data['id_agent']); "estado", "operation/agentes/ver_agente&amp;id_agente=" . $layout_data['id_agent']);
} }
// Link to an agent
echo '<a href="' . $url . '">';
} }
else {
// Link to an agent
if (empty($layout_data['id_metaconsole'])) {
$url = $config['homeurl'] .
'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=' . $layout_data['id_agent'];
}
else {
$url = ui_meta_get_url_console_child(
$layout_data['id_metaconsole'],
"estado", "operation/agentes/ver_agente&amp;id_agente=" . $layout_data['id_agent']);
}
}
echo '<a href="' . $url . '">';
} }
} }
elseif ($layout_data['id_layout_linked'] > 0) { elseif ($layout_data['id_layout_linked'] > 0) {
@ -1167,6 +1190,8 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo "</a>"; echo "</a>";
break; break;
case LABEL: case LABEL:
$z_index = 4; $z_index = 4;
if ($resizedMap) if ($resizedMap)
@ -1189,6 +1214,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
if ($endTagA) echo "</a>"; if ($endTagA) echo "</a>";
echo "</div>"; echo "</div>";
break; break;
case ICON: case ICON:
$z_index = 4; $z_index = 4;
if ($resizedMap) if ($resizedMap)
@ -1255,6 +1283,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo "</div>"; echo "</div>";
break; break;
case SIMPLE_VALUE: case SIMPLE_VALUE:
case SIMPLE_VALUE_MAX: case SIMPLE_VALUE_MAX:
case SIMPLE_VALUE_MIN: case SIMPLE_VALUE_MIN:
@ -1290,6 +1321,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$endTagA = false; $endTagA = false;
if ($show_links) { if ($show_links) {
//Extract id service if it is a prediction module. //Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1', $id_service = db_get_value_filter('custom_integer_1',
@ -1297,16 +1329,25 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
array('id_agente_modulo' => $layout_data['id_agente_modulo'], array('id_agente_modulo' => $layout_data['id_agente_modulo'],
'prediction_module' => 1)); 'prediction_module' => 1));
if ($id_service === false) { if (!empty($id_service) && can_user_access_node()) {
$id_service = 0;
}
if ($id_service != 0) {
if ($layout_data['enable_link']) { if ($layout_data['enable_link']) {
//Link to an service page //Link to an service page
if (!empty($layout_data['id_metaconsole'])) {
$server = db_get_row('tmetaconsole_setup',
'id', $layout_data['id_metaconsole']);
echo '<a href="' .
$server["server_url"] . "/" .
'index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
}
else {
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' . echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">'; $id_service . '&offset=0">';
}
$endTagA = true; $endTagA = true;
} }
@ -1462,6 +1503,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo '</div>'; echo '</div>';
break; break;
case PERCENTILE_BAR: case PERCENTILE_BAR:
case PERCENTILE_BUBBLE: case PERCENTILE_BUBBLE:
@ -1510,15 +1554,18 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo "<br>"; echo "<br>";
if ($show_links) { if ($show_links) {
if (!empty($layout_data['id_agent']) && empty($layout_data['id_layout_linked'])) { if (!empty($layout_data['id_agent'])
&& empty($layout_data['id_layout_linked'])) {
if ($layout_data['enable_link']) { if ($layout_data['enable_link']
&& can_user_access_node()) {
//Extract id service if it is a prediction module. //Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1', $id_service = db_get_value_filter('custom_integer_1',
'tagente_modulo', 'tagente_modulo',
array('id_agente_modulo' => $layout_data['id_agente_modulo'], array(
'id_agente_modulo' => $layout_data['id_agente_modulo'],
'prediction_module' => 1)); 'prediction_module' => 1));
if ($id_service === false) { if ($id_service === false) {
@ -1527,14 +1574,37 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
if ($id_service != 0) { if ($id_service != 0) {
//Link to an service page //Link to an service page
if (!empty($layout_data['id_metaconsole'])) {
$server = db_get_row('tmetaconsole_setup',
'id', $layout_data['id_metaconsole']);
echo '<a href="' .
$server["server_url"] . "/" .
'index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
}
else {
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' . echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">'; $id_service . '&offset=0">';
}
$endTagA = true; $endTagA = true;
} }
else if ($layout_data['id_agente_modulo'] != 0) { else if ($layout_data['id_agente_modulo'] != 0) {
// Link to an module // Link to an module
if (!empty($layout_data['id_metaconsole'])) {
$server = db_get_row('tmetaconsole_setup',
'id', $layout_data['id_metaconsole']);
echo '<a href="' .
$server["server_url"] .
'/index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;id_module=' . $layout_data['id_agente_modulo'] . '">';
}
else {
echo '<a href="'.$config['homeurl'].'/index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;id_module=' . $layout_data['id_agente_modulo'] . '">'; echo '<a href="'.$config['homeurl'].'/index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;id_module=' . $layout_data['id_agente_modulo'] . '">';
} }
$endTagA = true;
}
else { else {
// Link to an agent // Link to an agent
if (empty($layout_data['id_metaconsole'])) { if (empty($layout_data['id_metaconsole'])) {
@ -1602,6 +1672,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo '</div>'; echo '</div>';
break; break;
case MODULE_GRAPH: case MODULE_GRAPH:
if ($resizedMap) { if ($resizedMap) {
$layout_data['width'] = $layout_data['width'] =
@ -1622,7 +1695,10 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$endTagA = false; $endTagA = false;
if ($show_links) { if ($show_links) {
if (($layout_data['id_layout_linked'] == "") || ($layout_data['id_layout_linked'] == 0)) { if ((
($layout_data['id_layout_linked'] == "")
|| ($layout_data['id_layout_linked'] == 0))
&& can_user_access_node()) {
if ($layout_data['enable_link']) { if ($layout_data['enable_link']) {
@ -1638,9 +1714,20 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
if ($id_service != 0) { if ($id_service != 0) {
//Link to an service page //Link to an service page
if (!empty($layout_data['id_metaconsole'])) {
$server = db_get_row('tmetaconsole_setup',
'id', $layout_data['id_metaconsole']);
echo '<a href="' .
$server["server_url"] .
'/index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
}
else {
echo '<a href="'.$config['homeurl'].'/index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' . echo '<a href="'.$config['homeurl'].'/index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">'; $id_service . '&offset=0">';
} }
}
else { else {
if (empty($layout_data['id_metaconsole'])) { if (empty($layout_data['id_metaconsole'])) {
echo '<a href="'.$config['homeurl'].'/index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;id_module=' . $layout_data['id_agente_modulo'] . '">'; echo '<a href="'.$config['homeurl'].'/index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;id_module=' . $layout_data['id_agente_modulo'] . '">';

View File

@ -65,7 +65,7 @@ switch($graph_type) {
$height = get_parameter('height'); $height = get_parameter('height');
$progress = get_parameter('progress'); $progress = get_parameter('progress');
$out_of_lim_str = get_parameter('out_of_lim_str', false); $out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false));
$out_of_lim_image = get_parameter('out_of_lim_image', false); $out_of_lim_image = get_parameter('out_of_lim_image', false);
$font = get_parameter('font'); $font = get_parameter('font');
@ -86,7 +86,7 @@ switch($graph_type) {
$height = get_parameter('height'); $height = get_parameter('height');
$progress = get_parameter('progress'); $progress = get_parameter('progress');
$out_of_lim_str = get_parameter('out_of_lim_str', false); $out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false));
$out_of_lim_image = get_parameter('out_of_lim_image', false); $out_of_lim_image = get_parameter('out_of_lim_image', false);
$font = get_parameter('font'); $font = get_parameter('font');

View File

@ -162,7 +162,7 @@ function gd_histogram ($width, $height, $mode, $data, $max_value, $font, $title,
// *************************************************************************** // ***************************************************************************
function gd_progress_bubble ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10, $value_text = '', $colorRGB = '') { function gd_progress_bubble ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10, $value_text = '', $colorRGB = '') {
if ($out_of_lim_str === false) { if ($out_of_lim_str === false) {
$out_of_lim_str = __("Out of limits"); $out_of_lim_str = io_safe_output(__("Out of limits"));
} }
if ($out_of_lim_image === false) { if ($out_of_lim_image === false) {
@ -254,7 +254,7 @@ function gd_progress_bubble ($width, $height, $progress, $title, $font, $out_of_
function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10, $value_text = '', $colorRGB = '') { function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10, $value_text = '', $colorRGB = '') {
if ($out_of_lim_str === false) { if ($out_of_lim_str === false) {
$out_of_lim_str = __("Out of limits"); $out_of_lim_str = io_safe_output(__("Out of limits"));
} }
if ($out_of_lim_image === false) { if ($out_of_lim_image === false) {