2013-04-22 Miguel de Dios <miguel.dedios@artica.es>

* mobile/operation/events.php, mobile/operation/module_graph.php,
	mobile/operation/modules.php, mobile/operation/agent.php,
	mobile/include/ui.class.php: some fixes.
	
	* include/functions_reporting.php, include/functions_groups.php,
	include/functions_graph.php: some fixes.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8025 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-04-22 15:51:37 +00:00
parent 8579aed0a8
commit 185a0a67aa
9 changed files with 66 additions and 46 deletions

View File

@ -1,3 +1,12 @@
2013-04-22 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/module_graph.php,
mobile/operation/modules.php, mobile/operation/agent.php,
mobile/include/ui.class.php: some fixes.
* include/functions_reporting.php, include/functions_groups.php,
include/functions_graph.php: some fixes.
2013-04-22 Sergio Martin <sergio.martin@artica.es>
* include/styles/pandora.css

View File

@ -2372,7 +2372,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
for ($i = 0; $i < $interval; $i++) {
$bottom = $datelimit + ($periodtime * $i);
if (! $graphic_type) {
if($config['flash_charts']) {
if ($config['flash_charts']) {
$name = date('H:i', $bottom);
}
else {
@ -2409,7 +2409,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
break;
}
}
else{
else {
$data[$cont]['utimestamp'] = $periodtime;
$data[$cont]['data'] = 1;
}
@ -2417,7 +2417,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
}
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
// Draw slicebar graph
if ($config['flash_charts']) {
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
@ -2434,7 +2434,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
}
}
if($return) {
if ($return) {
return $out;
}
else {
@ -2607,7 +2607,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$event_value = 0;
$alert_value = 0;
$unknown_value = 0;
$event_ids = array();
$alert_ids = array();
while (isset ($events[$k]) &&
@ -2631,7 +2631,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
}
$k++;
}
if($is_unknown) {
$unknown_value++;
}
@ -2730,12 +2730,12 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
}
}
//Boolean graph doesn't have min!!!
/*if (!$avg_only) {
$chart[$timestamp]['min'.$series_suffix] = 0;
}*/
if(!empty($event_ids)) {
$chart_extra_data[count($chart)-1]['events'] = implode(',',$event_ids);
}
@ -2747,7 +2747,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
// Get min, max and avg (less efficient but centralized for all modules and reports)
$graph_stats = get_statwin_graph_statistics($chart, $series_suffix);
// Fix event and alert scale
foreach ($chart as $timestamp => $chart_data) {
if ($show_events) {
@ -2766,7 +2766,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
}
}
}
///////////////////////////////////////////////////
// Set the title and time format
if ($period <= SECONDS_6HOURS) {
@ -2812,7 +2812,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
}
else {
$legend['sum'.$series_suffix] = __('Data').$series_suffix_str.': '.__('Last').': '.$graph_stats['sum']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['sum']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['sum']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['sum']['min'].' '.$unit;
}
//$legend['baseline'.$series_suffix] = __('Baseline').$series_suffix_str;
/////////////////////////////////////////////////////////////////////////////////////////
@ -2848,7 +2848,7 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
global $long_index;
global $series_type;
global $chart_extra_data;
$series_suffix_str = '';
if ($compare !== false) {
$series_suffix = '2';
@ -3066,7 +3066,7 @@ 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"));
$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,
@ -3098,12 +3098,12 @@ function graph_netflow_aggregate_pie ($data, $aggregate, $ttl = 1, $only_image =
}
$i++;
}
$flash_chart = $config['flash_charts'];
if ($only_image) {
$flash_chart = false;
}
return pie3d_graph($flash_chart, $values, 320, 200,
__('Other'), $config['homeurl'], $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size'], $ttl);
@ -3829,7 +3829,7 @@ function grafico_modulo_log4x_format_x_axis ( $number , $decimals=2, $dec_point=
function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point=".", $thousands_sep=",")
{
switch($number) {
switch ($number) {
case 6:
return "FATAL";
break;
@ -3855,13 +3855,18 @@ function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point=
}
function graph_nodata_image($width = 300, $height = 110, $type = 'area') {
$image = ui_get_full_url('images/image_problem_' . $type . '.png', false, false, false);
$text_div = '<div class="nodata_text">' . __('No data to show') . '</div>';
$image_div = '<div class="nodata_container" style="background-image: url(\'' . $image . '\');">' . $text_div . '</div>';
$div = '<div style="width:' . $width . 'px; height:' . $height . 'px;">' . $image_div . '</div>';
$image = ui_get_full_url('images/image_problem_' . $type . '.png',
false, false, false);
$text_div = '<div class="nodata_text">' .
__('No data to show') . '</div>';
$image_div = '<div class="nodata_container" style="background-image: url(\'' . $image . '\');">' .
$text_div . '</div>';
$div = '<div style="width:' . $width . 'px; height:' . $height . 'px;">' .
$image_div . '</div>';
return $div;
}
?>

View File

@ -703,6 +703,10 @@ function groups_get_group_row_data($id_group, $group_all, $group, &$printed_grou
$row['group_icon'] = html_print_image("images/groups_small/" . $icon . ".png",
true, false, true);
if (!isset($html)) {
$html = false;
}
//Update network group
if ($html) {
echo "<td class='group_view_data' style='text-align: center; vertica-align: middle;'>";
@ -730,7 +734,7 @@ function groups_get_group_row_data($id_group, $group_all, $group, &$printed_grou
$row[__('Agents')] = "<a class='link_count' href='index.php?page=agents&id_group=" . $id_group . "'>";
$row[__('Agents')] .= $data["total_agents"];
$row[__('Agents')] .= "</a>";
// Agents unknown
$row[__('Agents unknown')] = "<a class='link_count' href='index.php?page=agents&id_group=" . $id_group . "&status=3'>";
$row[__('Agents unknown')] .= $data["agents_unknown"];

View File

@ -1037,8 +1037,8 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
$tdata[2] = $tdata[3] = '';
$table_mbs->rowclass[] = '';
$table_mbs->data[] = $tdata;
if($data["monitor_checks"] > 0) {
if ($data["monitor_checks"] > 0) {
$tdata = array();
$table_mbs->colspan[count($table_mbs->data)][0] = 4;
$table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;';
@ -1061,7 +1061,7 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) {
// Alerts table
$table_sum = html_get_predefined_table();
$tdata = array();
$table_sum->colspan[count($table_sum->data)][0] = 2;
$table_sum->colspan[count($table_sum->data)][2] = 2;
@ -1071,20 +1071,20 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) {
$tdata[2] = '<span class="med_data" style="color: #666">' . __('Alert level') . '</span>';
$table_sum->rowclass[] = '';
$table_sum->data[] = $tdata;
$tdata = array();
$table_sum->colspan[count($table_sum->data)][0] = 2;
$table_sum->colspan[count($table_sum->data)][2] = 2;
$table_sum->cellstyle[count($table_sum->data)][0] = 'text-align: center;';
$table_sum->cellstyle[count($table_sum->data)][2] = 'text-align: center;';
if($data["monitor_checks"] > 0) {
if ($data["monitor_checks"] > 0) {
$tdata[0] = '<div style="margin: auto; width: ' . $graph_width . 'px;">' . graph_agent_status (false, $graph_width, $graph_height, true, true) . '</div>';
}
else {
$tdata[2] = html_print_image('images/image_problem.png', true, array('width' => $graph_width));
}
if($data["monitor_alerts"] > 0) {
if ($data["monitor_alerts"] > 0) {
$tdata[2] = '<div style="margin: auto; width: ' . $graph_width . 'px;">' . graph_alert_status ($data["monitor_alerts"], $data["monitor_alerts_fired"], $graph_width, $graph_height, true, true) . '</div>';
}
else {
@ -1155,7 +1155,7 @@ function reporting_get_stats_users($data) {
if (check_acl ($config['id_user'], 0, "UM")) {
$urls['defined_users'] = "index.php?sec=gusuarios&amp;sec2=godmode/users/user_list";
}
else{
else {
$urls['defined_users'] = 'javascript:';
}

View File

@ -827,8 +827,8 @@ class Table {
$html .= "</tr>\n";
}
$html .= "</table>\n";
$html .= "</tbody>\n";
$html .= "</table>\n";
return $html;
}

View File

@ -89,7 +89,7 @@ class Agent {
if ($this->agent['disabled']) {
$agent_name = "<em>" . $agent_name . "</em>" . ui_print_help_tip(__('Disabled'), true);
}
else if ($agent['quiet']) {
else if ($this->agent['quiet']) {
$agent_name = "<em>" . $agent_name . "&nbsp;" . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "</em>";
}
else {
@ -98,7 +98,7 @@ class Agent {
$addresses = agents_get_addresses($this->id);
$address = agents_get_address($id_agente);
$address = agents_get_address($this->id);
foreach ($addresses as $k => $add) {
if($add == $address) {
unset($addresses[$k]);
@ -111,7 +111,7 @@ class Agent {
}
$last_contant = '<b>' . __('Last contact') . ' / ' . __('Remote') . '</b>&nbsp;'
.ui_print_timestamp ($agent["ultimo_contacto"], true);
.ui_print_timestamp ($this->agent["ultimo_contacto"], true);
$description =
empty($agent["comentarios"]) ? '<em>' . __('N/A') . '</em>' : $this->agent["comentarios"];
@ -130,7 +130,7 @@ class Agent {
$graph_js = ob_get_clean();
$html = $graph_js . $html;
$html .= "<b>" . __('Events (24h)') . "</b><br />";
$html .= graph_graphic_agentevents ($id_agente, 250, 15, 86400, '', true);
$html .= graph_graphic_agentevents ($this->id, 250, 15, 86400, '', true);
$ui->contentGridAddCell($html);
$ui->contentEndGrid();

View File

@ -212,16 +212,17 @@ class Events {
"width" => 12,
"height" => 12,
"title" => $event_criticity));
$event["criticity"] .= ' '.$event_criticity;
$event["criticity"] .= ' ' . $event_criticity;
if ($event['estado'] == 1) {
$user_ack = db_get_value('fullname', 'tusuario', 'id_user', $event['id_usuario']);
if(empty($user_ack)) {
if (empty($user_ack)) {
$user_ack = $event['id_usuario'];
}
$date_ack = date ($system->getConfig("date_format"), $event['ack_utimestamp']);
$event["acknowledged_by"] = $user_ack.' ('.$date_ack.')';
$event["acknowledged_by"] = $user_ack .
' (' . $date_ack . ')';
}
else {
$event["acknowledged_by"] = '<i>'.__('N/A').'</i>';
@ -277,7 +278,7 @@ class Events {
public function disabledColumns($columns = null) {
if (!empty($columns)) {
foreach ($columns as $column) {
unset($this->columns[$column]);
$this->columns[$column] = 1;
}
}
}
@ -650,8 +651,8 @@ class Events {
$sql_post = " AND id_grupo = " . $this->group;
}
if ($this->id_agente > 0) {
$sql_post = " AND id_agente = " . $this->id_agente;
if ($this->id_agent > 0) {
$sql_post = " AND id_agente = " . $this->id_agent;
}
//--------------------------------------------------------------
@ -1006,7 +1007,7 @@ class Events {
if (!empty($this->status))
$status = events_get_status($this->status);
$type = "";
if (!empty($this->empty))
if (!empty($this->type))
$type = get_event_types($this->type);
$severity = "";
if ($this->severity != -1)

View File

@ -116,6 +116,7 @@ class ModuleGraph {
$urlImage = ui_get_full_url(false);
$time_compare = false;
if ($this->time_compare_separated) {
$time_compare = 'separated';
}
@ -177,7 +178,7 @@ class ModuleGraph {
}
break;
case 'log4x':
$graph .= grafico_modulo_log4x ($this->id,
$graph = grafico_modulo_log4x ($this->id,
$this->period, $this->draw_events,
$this->width, $this->height,
$label, $unit_name, $this->draw_alerts,

View File

@ -90,7 +90,7 @@ class Modules {
public function disabledColumns($columns = null) {
if (!empty($columns)) {
foreach ($columns as $column) {
unset($this->columns[$column]);
$this->columns[$column] = 0;
}
}
}
@ -532,7 +532,7 @@ class Modules {
$ui->contentAddHtml($table->getHTML());
}
else {
$html .= $table->getHTML();
$html = $table->getHTML();
return $html;
}