2011-06-27 Junichi Satoh <junichi@rworks.jp>

* include/functions_ui.php: Added a new function to show max/min
	values for module.
	
	* operation/agentes/estado_monitores.php, 
	operation/agentes/status_monitor.php: Improved to show max/min
	values for module.

	* godmode/agentes/module_manager.php: Modified to use the function,
	ui_print_module_warn_value() to show max/min values for module.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4485 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
jsatoh 2011-06-27 05:56:55 +00:00
parent 95a1ae7c55
commit 5579a457c1
5 changed files with 80 additions and 32 deletions

View File

@ -1,3 +1,15 @@
2011-06-27 Junichi Satoh <junichi@rworks.jp>
* include/functions_ui.php: Added a new function to show max/min
values for module.
* operation/agentes/estado_monitores.php,
operation/agentes/status_monitor.php: Improved to show max/min
values for module.
* godmode/agentes/module_manager.php: Modified to use the function,
ui_print_module_warn_value() to show max/min values for module.
2011-06-27 Junichi Satoh <junichi@rworks.jp> 2011-06-27 Junichi Satoh <junichi@rworks.jp>
* extras/pandoradb_migrate_v3.2_to_v4.0.sql: Added missing INDEX. * extras/pandoradb_migrate_v3.2_to_v4.0.sql: Added missing INDEX.

View File

@ -416,21 +416,7 @@ foreach ($modules as $module) {
$data[5] = ui_print_string_substr ($module["descripcion"], 32, true, 9); $data[5] = ui_print_string_substr ($module["descripcion"], 32, true, 9);
// MAX / MIN values // MAX / MIN values
$data[6] = "<span style='font-size: 8px'>"; $data[6] = ui_print_module_warn_value ($module["max_warning"], $module["min_warning"], $module["max_critical"], $module["min_critical"]);
if ($module["max_warning"] != $module["min_warning"]){
$data[6] .= format_for_graph ($module["max_warning"]) ."/". format_for_graph ($module["min_warning"]);
} else {
$data[6] .= __("N/A");
}
$data[6] .= " - ";
if ($module["max_critical"] != $module["min_critical"]){
$data[6] .= format_for_graph($module["max_critical"]) ."/". format_for_graph ($module["min_critical"]);
} else {
$data[6] .= __("N/A");
}
// Delete module // Delete module
$data[7] = html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true); $data[7] = html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);

View File

@ -1264,6 +1264,36 @@ function ui_print_moduletype_icon ($id_moduletype, $return = false) {
"title" => $type["descripcion"])); "title" => $type["descripcion"]));
} }
/**
* Print module max/min values for warning/critical state
*
* @param float Max value for warning state
* @param float Min value for warning state
* @param float Max value for critical state
* @param float Min value for critical state
*
* @return string HTML string
*/
function ui_print_module_warn_value ($max_warning, $min_warning, $max_critical, $min_critical) {
$data = "<span style='font-size: 8px' title='" . __("Warning") . ": " . __("Max") . $max_warning . "/" . __("Min") . $min_warning . " - " . __("Critical") . ": " . __("Max") . $max_critical . "/" . __("Min") . $min_critical . "'>";
if ($max_warning != $min_warning) {
$data .= format_for_graph($max_warning) ."/". format_for_graph ($min_warning);
} else {
$data .= __("N/A");
}
$data .= " - ";
if ($max_critical != $min_critical){
$data .= format_for_graph($max_critical) ."/". format_for_graph ($min_critical);
} else {
$data .= __("N/A");
}
$data .= "</span>";
return $data;
}
/** /**
* Format a file size from bytes to a human readable meassure. * Format a file size from bytes to a human readable meassure.
* *

View File

@ -220,11 +220,12 @@ $table->head[4] = __('Description');
$table->head[5] = __('Status') . ' ' . $table->head[5] = __('Status') . ' ' .
'<a href="' . $url . '&sort_field=status&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up")) . '</a>' . '<a href="' . $url . '&sort_field=status&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=status&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>'; '<a href="' . $url . '&sort_field=status&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>';
$table->head[6] = __('Data') . ' ' . $table->head[6] = __('Warn');
$table->head[7] = __('Data') . ' ' .
'<a href="' . $url . '&sort_field=data&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up")) . '</a>' . '<a href="' . $url . '&sort_field=data&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=data&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . '</a>'; '<a href="' . $url . '&sort_field=data&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . '</a>';
$table->head[7] = __('Graph'); $table->head[8] = __('Graph');
$table->head[8] = __('Last contact') . ' ' . $table->head[9] = __('Last contact') . ' ' .
'<a href="' . $url . '&sort_field=last_contact&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '</a>' . '<a href="' . $url . '&sort_field=last_contact&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=last_contact&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . '</a>'; '<a href="' . $url . '&sort_field=last_contact&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . '</a>';
@ -398,10 +399,12 @@ foreach ($modules as $module) {
} }
} }
$data[6] = $salida; $data[6] = ui_print_module_warn_value ($module["max_warning"], $module["min_warning"], $module["max_critical"], $module["min_critical"]);
$data[7] = $salida;
$graph_type = return_graphtype ($module["id_tipo_modulo"]); $graph_type = return_graphtype ($module["id_tipo_modulo"]);
$data[7] = " "; $data[8] = " ";
if ($module['history_data'] == 1){ if ($module['history_data'] == 1){
$nombre_tipo_modulo = modules_get_moduletype_name ($module["id_tipo_modulo"]); $nombre_tipo_modulo = modules_get_moduletype_name ($module["id_tipo_modulo"]);
$handle = "stat".$nombre_tipo_modulo."_".$module["id_agente_modulo"]; $handle = "stat".$nombre_tipo_modulo."_".$module["id_agente_modulo"];
@ -411,18 +414,18 @@ foreach ($modules as $module) {
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&amp;period=86400&amp;id=".$module["id_agente_modulo"]."&amp;label=".base64_encode($module["nombre"])."&amp;refresh=600','day_".$win_handle."')"; $link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&amp;period=86400&amp;id=".$module["id_agente_modulo"]."&amp;label=".base64_encode($module["nombre"])."&amp;refresh=600','day_".$win_handle."')";
// if ($nombre_tipo_modulo != "log4x") // if ($nombre_tipo_modulo != "log4x")
$data[7] .= '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a>'; $data[8] .= '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a>';
$data[7] .= "&nbsp;<a href='index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=$id_agente&tab=data_view&amp;period=86400&amp;id=".$module["id_agente_modulo"]."'>" . html_print_image('images/binary.png', true, array("border" => '0', "alt" => "")) . "</a>"; $data[8] .= "&nbsp;<a href='index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=$id_agente&tab=data_view&amp;period=86400&amp;id=".$module["id_agente_modulo"]."'>" . html_print_image('images/binary.png', true, array("border" => '0', "alt" => "")) . "</a>";
} }
if ($module['estado'] == 3) { if ($module['estado'] == 3) {
$data[8] = '<span class="redb">'; $data[9] = '<span class="redb">';
} }
else { else {
$data[8] = '<span>'; $data[9] = '<span>';
} }
$data[8] .= ui_print_timestamp ($module["utimestamp"], true); $data[9] .= ui_print_timestamp ($module["utimestamp"], true);
$data[8] .= '</span>'; $data[9] .= '</span>';
array_push ($table->data, $data); array_push ($table->data, $data);
$rowIndex++; $rowIndex++;

View File

@ -260,6 +260,10 @@ switch ($config["dbtype"]) {
tagente_modulo.module_interval, tagente_modulo.module_interval,
tagente_estado.datos, tagente_estado.datos,
tagente_estado.estado, tagente_estado.estado,
tagente_modulo.min_warning,
tagente_modulo.max_warning,
tagente_modulo.min_critical,
tagente_modulo.max_critical,
tagente_estado.utimestamp AS utimestamp".$sql." LIMIT ".$offset.",".$config["block_size"]; tagente_estado.utimestamp AS utimestamp".$sql." LIMIT ".$offset.",".$config["block_size"];
break; break;
case "postgresql": case "postgresql":
@ -276,6 +280,10 @@ switch ($config["dbtype"]) {
tagente_modulo.module_interval, tagente_modulo.module_interval,
tagente_estado.datos, tagente_estado.datos,
tagente_estado.estado, tagente_estado.estado,
tagente_modulo.min_warning,
tagente_modulo.max_warning,
tagente_modulo.min_critical,
tagente_modulo.max_critical,
tagente_estado.utimestamp AS utimestamp".$sql." LIMIT " . $config["block_size"] . " OFFSET " . $offset; tagente_estado.utimestamp AS utimestamp".$sql." LIMIT " . $config["block_size"] . " OFFSET " . $offset;
break; break;
case "oracle": case "oracle":
@ -294,6 +302,10 @@ switch ($config["dbtype"]) {
tagente_modulo.module_interval, tagente_modulo.module_interval,
tagente_estado.datos, tagente_estado.datos,
tagente_estado.estado, tagente_estado.estado,
tagente_modulo.min_warning,
tagente_modulo.max_warning,
tagente_modulo.min_critical,
tagente_modulo.max_critical,
tagente_estado.utimestamp AS utimestamp".$sql; tagente_estado.utimestamp AS utimestamp".$sql;
$sql = oracle_recode_query ($sql, $set); $sql = oracle_recode_query ($sql, $set);
break; break;
@ -343,11 +355,14 @@ $table->align[5] = "center";
$table->head[6] = __('Graph'); $table->head[6] = __('Graph');
$table->align[6] = "center"; $table->align[6] = "center";
$table->head[7] = __('Data'); $table->head[7] = __('Warn');
$table->align[7] = "left"; $table->align[7] = "left";
$table->head[8] = __('Timestamp'); $table->head[8] = __('Data');
$table->align[8] = "right"; $table->align[8] = "left";
$table->head[9] = __('Timestamp');
$table->align[9] = "right";
$rowPair = true; $rowPair = true;
$iterator = 0; $iterator = 0;
@ -454,10 +469,12 @@ foreach ($result as $row) {
$data[6] .= "&nbsp;<a href='index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=".$row["id_agent"]."&amp;tab=data_view&period=86400&amp;id=".$row["id_agente_modulo"]."'>" . html_print_image('images/binary.png', true, array("style" => '0', "alt" => '')) . "</a>"; $data[6] .= "&nbsp;<a href='index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=".$row["id_agent"]."&amp;tab=data_view&period=86400&amp;id=".$row["id_agente_modulo"]."'>" . html_print_image('images/binary.png', true, array("style" => '0', "alt" => '')) . "</a>";
} }
$data[7] = ui_print_module_warn_value($row['max_warning'], $row['min_warning'], $row['max_critical'], $row['min_critical']);
if (is_numeric($row["datos"])) if (is_numeric($row["datos"]))
$data[7] = format_numeric($row["datos"]); $data[8] = format_numeric($row["datos"]);
else else
$data[7] = "<span title='".$row['datos']."' style='white-space: nowrap;'>".substr(io_safe_output($row["datos"]),0,12)."</span>"; $data[8] = "<span title='".$row['datos']."' style='white-space: nowrap;'>".substr(io_safe_output($row["datos"]),0,12)."</span>";
if ($row["module_interval"] > 0) if ($row["module_interval"] > 0)
$interval = $row["module_interval"]; $interval = $row["module_interval"];
@ -469,7 +486,7 @@ foreach ($result as $row) {
} else { } else {
$option = array (); $option = array ();
} }
$data[8] = ui_print_timestamp ($row["utimestamp"], true, $option); $data[9] = ui_print_timestamp ($row["utimestamp"], true, $option);
array_push ($table->data, $data); array_push ($table->data, $data);
} }