2013-03-05 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_modules.php: improved the style.
	
	* include/functions_reporting.php: fixed into the function
	"reporting_get_agentmodule_sla_array" when have one data of a
	module.
	
	Fixes: #3606811




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7789 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-03-05 18:04:33 +00:00
parent 93859b2e54
commit 49aab4ac15
3 changed files with 40 additions and 11 deletions

View File

@ -1,3 +1,13 @@
2013-03-05 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php: improved the style.
* include/functions_reporting.php: fixed into the function
"reporting_get_agentmodule_sla_array" when have one data of a
module.
Fixes: #3606811
2013-03-05 Sergio Martin <sergio.martin@artica.es>
* pandoradb_data.sql
@ -9,6 +19,16 @@
and Process inventory change types to black list in default
SQL data script for bug 3606111
2013-03-05 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php: improved the style.
* include/functions_reporting.php: fixed into the function
"reporting_get_agentmodule_sla_array" when have one data of a
module.
Fixes: #3606811
2013-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/snmp_explorer.php: improved the code style.

View File

@ -1280,7 +1280,7 @@ function modules_get_previous_data ($id_agent_module, $utimestamp = 0, $string =
AND utimestamp >= %d
ORDER BY utimestamp DESC',
$id_agent_module, $utimestamp, $utimestamp - SECONDS_2DAY);
return db_get_row_sql ($sql, true);
}

View File

@ -667,6 +667,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
$interval_data = array ();
}
// Indexing data
$interval_data_indexed = array();
foreach($interval_data as $idata) {
@ -697,7 +698,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
array ('id_agentmodule' => $id_agent_module,
"utimestamp <= $datelimit",
'order' => 'utimestamp DESC'));
if(isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') {
if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') {
$start_unknown = true;
}
else {
@ -707,7 +708,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
//-----------------Set limits of the interval-----------------------
// If the starting of the graph is unknown we set it
if($start_unknown) {
if ($start_unknown) {
$interval_data_indexed[$datelimit]['data'] = 0;
$interval_data_indexed[$datelimit]['status'] = 4;
}
@ -726,13 +727,14 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
// Get next data (This adds data before the interval of the report)
$next_data = modules_get_next_data ($id_agent_module, $date);
if ($next_data !== false) {
$interval_data_indexed[$date]['data'] = $previous_data['datos'];
}
else if (count ($interval_data_indexed) > 0) {
// Propagate the last known data to the end of the interval (if there is no module data at the end point)
ksort($interval_data_indexed);
$last_data = array_pop($interval_data_indexed);
$last_data = end($interval_data_indexed);
$interval_data_indexed[$date] = $last_data;
}
@ -759,8 +761,8 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
$interval_data_indexed[$date_downtime['date_from']]['status'] = 5;
$last_downtime_data = false;
foreach($interval_data_indexed as $idi_timestamp => $idi) {
if($idi_timestamp != $date_downtime['date_from'] && $idi_timestamp != $date_downtime['date_to'] &&
foreach ($interval_data_indexed as $idi_timestamp => $idi) {
if ($idi_timestamp != $date_downtime['date_from'] && $idi_timestamp != $date_downtime['date_to'] &&
$idi_timestamp >= $date_downtime['date_from'] && $idi_timestamp <= $date_downtime['date_to']) {
$last_downtime_data = $idi['data'];
unset($interval_data_indexed[$idi_timestamp]);
@ -768,7 +770,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
}
// Set the last data of the interval as limit
if($last_downtime_data !== false) {
if ($last_downtime_data !== false) {
$interval_data_indexed[$date_downtime['date_to']]['data'] = $last_downtime_data;
}// If there arent data into the downtime, set unknown
else {
@ -3147,7 +3149,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table->colspan[0][1] = 2;
$next_row = 1;
if ($content["description"] != ""){
if ($content["description"] != "") {
$table->colspan[$next_row][0] = 3;
$next_row++;
$data_desc = array();
@ -3213,9 +3215,16 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
}
//Get the array of the sla values
$data_sla = reporting_get_agentmodule_sla_array ($sla['id_agent_module'], $content['period'],
$sla['sla_min'], $sla['sla_max'], $report['datetime'], $content, $content['time_from'],
$content['time_to']);
$data_sla = reporting_get_agentmodule_sla_array (
$sla['id_agent_module'],
$content['period'],
$sla['sla_min'],
$sla['sla_max'],
$report['datetime'],
$content,
$content['time_from'],
$content['time_to']);
if ($data_sla == false) {
$data_sla = array();