[SLA] Fixed full not init and ignored availability and SLA reports
This commit is contained in:
parent
ec61441587
commit
71d5be46a6
|
@ -5899,6 +5899,8 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
||||||
$dataslice['order'] = $data['sla_value'];
|
$dataslice['order'] = $data['sla_value'];
|
||||||
$dataslice['checks_total'] = $data['checks_total'];
|
$dataslice['checks_total'] = $data['checks_total'];
|
||||||
$dataslice['checks_ok'] = $data['checks_ok'];
|
$dataslice['checks_ok'] = $data['checks_ok'];
|
||||||
|
$dataslice['time_total'] = $data['time_total'];
|
||||||
|
$dataslice['time_not_init']= $data['time_not_init'];
|
||||||
$dataslice['sla_status'] = $data['sla_status'];
|
$dataslice['sla_status'] = $data['sla_status'];
|
||||||
$dataslice['sla_value'] = $data['sla_value'];
|
$dataslice['sla_value'] = $data['sla_value'];
|
||||||
|
|
||||||
|
@ -11009,6 +11011,7 @@ function reporting_label_macro ($item, $label) {
|
||||||
* @brief Calculates the SLA compliance value given an sla array
|
* @brief Calculates the SLA compliance value given an sla array
|
||||||
*
|
*
|
||||||
* @param Array With keys time_ok, time_error, time_downtime and time_unknown
|
* @param Array With keys time_ok, time_error, time_downtime and time_unknown
|
||||||
|
* @return SLA Return the compliance value.
|
||||||
*/
|
*/
|
||||||
function reporting_sla_get_compliance_from_array ($sla_array) {
|
function reporting_sla_get_compliance_from_array ($sla_array) {
|
||||||
$time_compliance = $sla_array['time_ok'] + $sla_array['time_unknown'] + $sla_array['time_downtime'];
|
$time_compliance = $sla_array['time_ok'] + $sla_array['time_unknown'] + $sla_array['time_downtime'];
|
||||||
|
@ -11018,6 +11021,28 @@ function reporting_sla_get_compliance_from_array ($sla_array) {
|
||||||
: $time_compliance/$time_total_working;
|
: $time_compliance/$time_total_working;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculates if an SLA array is not init
|
||||||
|
*
|
||||||
|
* @param Array With keys time_ok, time_error, time_downtime and time_unknown
|
||||||
|
* @return bool True if not init
|
||||||
|
*/
|
||||||
|
function reporting_sla_is_not_init_from_array($sla_array) {
|
||||||
|
if ($sla_array["time_total"] == 0) return false;
|
||||||
|
return $sla_array["time_not_init"] == $sla_array["time_total"];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculates if an SLA array is ignored
|
||||||
|
*
|
||||||
|
* @param Array With keys time_ok, time_error, time_downtime and time_unknown
|
||||||
|
* @return bool True if igonred time
|
||||||
|
*/
|
||||||
|
function reporting_sla_is_ignored_from_array($sla_array) {
|
||||||
|
if ($sla_array["time_total"] > 0) return false;
|
||||||
|
return $sla_array["time_not_init"] == 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Given a period, get the SLA status of the period.
|
* @brief Given a period, get the SLA status of the period.
|
||||||
*
|
*
|
||||||
|
|
|
@ -486,13 +486,18 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
}
|
}
|
||||||
$row[] = round($sla['sla_limit'], 2) . "%";
|
$row[] = round($sla['sla_limit'], 2) . "%";
|
||||||
|
|
||||||
if ($sla['sla_value_unknown']) {
|
if (reporting_sla_is_not_init_from_array($sla)) {
|
||||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">' .
|
||||||
__('N/A') . '</span>';
|
__('N/A') . '</span>';
|
||||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">' .
|
||||||
__('Unknown') . '</span>';
|
__('Not init') . '</span>';
|
||||||
}
|
} elseif (reporting_sla_is_ignored_from_array($sla)) {
|
||||||
elseif ($sla['sla_status']) {
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_IGNORED.';">' .
|
||||||
|
__('N/A') . '</span>';
|
||||||
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_IGNORED.';">' .
|
||||||
|
__('No data') . '</span>';
|
||||||
|
// Normal calculation
|
||||||
|
} elseif ($sla['sla_status']) {
|
||||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
|
||||||
sla_truncate($sla['sla_value'], $config['graph_precision']) . "%" . '</span>';
|
sla_truncate($sla['sla_value'], $config['graph_precision']) . "%" . '</span>';
|
||||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
|
||||||
|
@ -2564,6 +2569,15 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
||||||
$table1->width = '99%';
|
$table1->width = '99%';
|
||||||
$table1->data = array ();
|
$table1->data = array ();
|
||||||
foreach ($item['charts'] as $chart) {
|
foreach ($item['charts'] as $chart) {
|
||||||
|
$checks_resume = '';
|
||||||
|
$sla_value = '';
|
||||||
|
if (reporting_sla_is_not_init_from_array($chart)) {
|
||||||
|
$color = COL_NOTINIT;
|
||||||
|
$sla_value = __('Not init');
|
||||||
|
} elseif (reporting_sla_is_ignored_from_array($chart)) {
|
||||||
|
$color = COL_IGNORED;
|
||||||
|
$sla_value = __('No data');
|
||||||
|
} else {
|
||||||
switch ($chart['sla_status']) {
|
switch ($chart['sla_status']) {
|
||||||
case REPORT_STATUS_ERR:
|
case REPORT_STATUS_ERR:
|
||||||
$color = COL_CRITICAL;
|
$color = COL_CRITICAL;
|
||||||
|
@ -2575,13 +2589,16 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
||||||
$color = COL_UNKNOWN;
|
$color = COL_UNKNOWN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
$sla_value = sla_truncate($chart['sla_value'], $config['graph_precision']) . '%';
|
||||||
|
$checks_resume = "(" . $chart['checks_ok'] . "/" . $chart['checks_total'] . ")";
|
||||||
|
}
|
||||||
$table1->data[] = array(
|
$table1->data[] = array(
|
||||||
$chart['agent'] . "<br />" . $chart['module'],
|
$chart['agent'] . "<br />" . $chart['module'],
|
||||||
$chart['chart'],
|
$chart['chart'],
|
||||||
"<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>" .
|
"<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>" .
|
||||||
sla_truncate($chart['sla_value'], $config['graph_precision']) . '%' .
|
$sla_value .
|
||||||
'</span>',
|
'</span>',
|
||||||
"(" . $chart['checks_ok'] . "/" . $chart['checks_total'] . ")"
|
$checks_resume
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue