2012-02-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php: cleaned source code style, and fixed the show graphs in "top_n" report item, now it is static graph and show a as text of bars (or pie pieces) the agent name and module for more clear and when you have same agents with distints modules, now the graph don't group by agent. Fixes: #3483852 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5573 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
fb8d05d3e8
commit
9c5fe01bde
|
@ -1,3 +1,13 @@
|
||||||
|
2012-02-13 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/functions_reporting.php: cleaned source code style, and fixed the
|
||||||
|
show graphs in "top_n" report item, now it is static graph and show a as
|
||||||
|
text of bars (or pie pieces) the agent name and module for more clear and
|
||||||
|
when you have same agents with distints modules, now the graph don't group
|
||||||
|
by agent.
|
||||||
|
|
||||||
|
Fixes: #3483852
|
||||||
|
|
||||||
2012-02-13 Sergio Martin <sergio.martin@artica.es>
|
2012-02-13 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* include/graphs/functions_pchart.php
|
* include/graphs/functions_pchart.php
|
||||||
|
|
|
@ -552,7 +552,8 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_valu
|
||||||
$previous_status = 0;
|
$previous_status = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$previous_status = 0;
|
$previous_status = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -723,12 +724,15 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
|
|
||||||
if ($previous_value < 0) {// 4 for the Unknown value
|
if ($previous_value < 0) {// 4 for the Unknown value
|
||||||
$previous_status = 4;
|
$previous_status = 4;
|
||||||
} elseif ((($previous_value > ($min_value - $percent)) && ($previous_value < ($min_value + $percent))) ||
|
}
|
||||||
|
elseif ((($previous_value > ($min_value - $percent)) && ($previous_value < ($min_value + $percent))) ||
|
||||||
(($previous_value > ($max_value - $percent)) && ($previous_value < ($max_value + $percent)))) {//2 when value is within the edges
|
(($previous_value > ($max_value - $percent)) && ($previous_value < ($max_value + $percent)))) {//2 when value is within the edges
|
||||||
$previous_status = 2;
|
$previous_status = 2;
|
||||||
} elseif (($previous_value >= ($min_value + $percent)) && ($previous_value <= ($max_value - $percent))) { //1 when value is OK
|
}
|
||||||
|
elseif (($previous_value >= ($min_value + $percent)) && ($previous_value <= ($max_value - $percent))) { //1 when value is OK
|
||||||
$previous_status = 1;
|
$previous_status = 1;
|
||||||
} elseif (($previous_value <= ($min_value - $percent)) || ($previous_value >= ($max_value + $percent))) { //3 when value is Wrong
|
}
|
||||||
|
elseif (($previous_value <= ($min_value - $percent)) || ($previous_value >= ($max_value + $percent))) { //3 when value is Wrong
|
||||||
$previous_status = 3;
|
$previous_status = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,12 +750,15 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
$value = $data['datos'];
|
$value = $data['datos'];
|
||||||
if ($value < 0) {// 4 for the Unknown value
|
if ($value < 0) {// 4 for the Unknown value
|
||||||
$status = 4;
|
$status = 4;
|
||||||
} elseif ((($value > ($min_value - $percent)) && ($value < ($min_value + $percent))) ||
|
}
|
||||||
|
elseif ((($value > ($min_value - $percent)) && ($value < ($min_value + $percent))) ||
|
||||||
(($value > ($max_value - $percent)) && ($value < ($max_value + $percent)))) { //2 when value is within the edges
|
(($value > ($max_value - $percent)) && ($value < ($max_value + $percent)))) { //2 when value is within the edges
|
||||||
$status = 2;
|
$status = 2;
|
||||||
} elseif (($value >= ($min_value + $percent)) && ($value <= ($max_value - $percent))) { //1 when value is OK
|
}
|
||||||
|
elseif (($value >= ($min_value + $percent)) && ($value <= ($max_value - $percent))) { //1 when value is OK
|
||||||
$status = 1;
|
$status = 1;
|
||||||
} elseif (($value <= ($min_value - $percent)) || ($value >= ($max_value + $percent))) { //3 when value is Wrong
|
}
|
||||||
|
elseif (($value <= ($min_value - $percent)) || ($value >= ($max_value + $percent))) { //3 when value is Wrong
|
||||||
$status = 3;
|
$status = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1071,13 +1078,15 @@ function reporting_get_group_stats ($id_group = 0) {
|
||||||
|
|
||||||
if ($data["monitor_unknown"] > 0 && $data["monitor_checks"] > 0) {
|
if ($data["monitor_unknown"] > 0 && $data["monitor_checks"] > 0) {
|
||||||
$data["monitor_health"] = format_numeric (100 - ($data["monitor_unknown"] / ($data["monitor_checks"] / 100)), 1);
|
$data["monitor_health"] = format_numeric (100 - ($data["monitor_unknown"] / ($data["monitor_checks"] / 100)), 1);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$data["monitor_health"] = 100;
|
$data["monitor_health"] = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($data["monitor_not_init"] > 0 && $data["monitor_checks"] > 0) {
|
if ($data["monitor_not_init"] > 0 && $data["monitor_checks"] > 0) {
|
||||||
$data["module_sanity"] = format_numeric (100 - ($data["monitor_not_init"] / ($data["monitor_checks"] / 100)), 1);
|
$data["module_sanity"] = format_numeric (100 - ($data["monitor_not_init"] / ($data["monitor_checks"] / 100)), 1);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$data["module_sanity"] = 100;
|
$data["module_sanity"] = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1097,7 +1106,8 @@ function reporting_get_group_stats ($id_group = 0) {
|
||||||
|
|
||||||
if ($data["monitor_bad"] > 0 && $data["monitor_checks"] > 0) {
|
if ($data["monitor_bad"] > 0 && $data["monitor_checks"] > 0) {
|
||||||
$data["global_health"] = format_numeric (100 - ($data["monitor_bad"] / ($data["monitor_checks"] / 100)), 1);
|
$data["global_health"] = format_numeric (100 - ($data["monitor_bad"] / ($data["monitor_checks"] / 100)), 1);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$data["global_health"] = 100;
|
$data["global_health"] = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2443,6 +2453,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$sla_value = reporting_get_agentmodule_sla ($sla['id_agent_module'], $content['period'],
|
$sla_value = reporting_get_agentmodule_sla ($sla['id_agent_module'], $content['period'],
|
||||||
$sla['sla_min'], $sla['sla_max'], $report["datetime"], $content, $content['time_from'],
|
$sla['sla_min'], $sla['sla_max'], $report["datetime"], $content, $content['time_from'],
|
||||||
$content['time_to']);
|
$content['time_to']);
|
||||||
|
|
||||||
//Fill the array data_graph for the pie graph
|
//Fill the array data_graph for the pie graph
|
||||||
if ($sla_value === false) {
|
if ($sla_value === false) {
|
||||||
$data_graph[__('Unknown')]++;
|
$data_graph[__('Unknown')]++;
|
||||||
|
@ -3621,8 +3632,15 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$data_pie_graph = array();
|
$data_pie_graph = array();
|
||||||
$data_hbar = array();
|
$data_hbar = array();
|
||||||
foreach ($data_top as $dt) {
|
foreach ($data_top as $dt) {
|
||||||
$data_hbar[$agent_name[$i]]['g'] = $dt;
|
$item_name = '';
|
||||||
$data_pie_graph[$agent_name[$i]] = $dt;
|
$item_name =
|
||||||
|
ui_print_truncate_text($agent_name[$i], 12, false, true, false, "...") .
|
||||||
|
' - ' .
|
||||||
|
ui_print_truncate_text($module_name[$i], 12, false, true, false, "...");
|
||||||
|
|
||||||
|
$data_hbar[$item_name]['g'] = $dt;
|
||||||
|
$data_pie_graph[$item_name] = $dt;
|
||||||
|
|
||||||
if ($show_graph == 0 || $show_graph == 1) {
|
if ($show_graph == 0 || $show_graph == 1) {
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = printSmallFont($agent_name[$i]);
|
$data[0] = printSmallFont($agent_name[$i]);
|
||||||
|
@ -3639,8 +3657,14 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$data_pie_graph = array();
|
$data_pie_graph = array();
|
||||||
$data_hbar = array();
|
$data_hbar = array();
|
||||||
foreach ($agent_name as $an) {
|
foreach ($agent_name as $an) {
|
||||||
$data_pie_graph[$an] = $data_top[$i];
|
$item_name = '';
|
||||||
$data_hbar[$an]['g'] = $data_top[$i];
|
$item_name =
|
||||||
|
ui_print_truncate_text($agent_name[$i], 12, false, true, false, "...") .
|
||||||
|
' - ' .
|
||||||
|
ui_print_truncate_text($module_name[$i], 12, false, true, false, "...");
|
||||||
|
|
||||||
|
$data_pie_graph[$item_name] = $data_top[$i];
|
||||||
|
$data_hbar[$item_name]['g'] = $data_top[$i];
|
||||||
if ($show_graph == 0 || $show_graph == 1) {
|
if ($show_graph == 0 || $show_graph == 1) {
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = printSmallFont($an);
|
$data[0] = printSmallFont($an);
|
||||||
|
@ -3663,8 +3687,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$table->colspan[3][0] = 3;
|
$table->colspan[3][0] = 3;
|
||||||
$data = array();
|
$data = array();
|
||||||
if ($show_graph == 1 || $show_graph == 2) {
|
if ($show_graph == 1 || $show_graph == 2) {
|
||||||
$data[0] = pie3d_graph($config['flash_charts'], $data_pie_graph,
|
$data[0] = pie3d_graph(false, $data_pie_graph,
|
||||||
600, 150, __("other"),"", $config['homedir'] . "/images/logo_vertical_water.png",
|
600, 190, __("other"),"", $config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
$config['fontpath'], $config['font_size']);
|
$config['fontpath'], $config['font_size']);
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
@ -3672,7 +3696,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$table->colspan[4][0] = 3;
|
$table->colspan[4][0] = 3;
|
||||||
$height = count($data_pie_graph)*20+35;
|
$height = count($data_pie_graph)*20+35;
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = hbar_graph($config['flash_charts'], $data_hbar, 600, $height, array(), array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png", '', '', true, 1, true);
|
$data[0] = hbar_graph(false, $data_hbar, 600, $height, array(), array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png", '', '', true, 1, true);
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
}
|
}
|
||||||
|
@ -3683,7 +3707,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
do {
|
do {
|
||||||
$min = $data_top_values['data_top'][$i];
|
$min = $data_top_values['data_top'][$i];
|
||||||
$i++;
|
$i++;
|
||||||
} while ($min === false && $i < count($data_top_values));
|
}
|
||||||
|
while ($min === false && $i < count($data_top_values));
|
||||||
$max = $min;
|
$max = $min;
|
||||||
$avg = 0;
|
$avg = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue