fixed SLA weekly hourly and monthly
Former-commit-id: 9c04c8f55b080d6d12f3b3868e7d96660db76470
This commit is contained in:
parent
392c0d0bff
commit
df85b0f700
|
@ -11436,33 +11436,35 @@ function reporting_sla_is_ignored_from_array($sla_array)
|
|||
*
|
||||
* @return integer Status
|
||||
*/
|
||||
function reporting_sla_get_status_period($sla_times, $priority_mode=REPORT_PRIORITY_MODE_OK)
|
||||
{
|
||||
if ($sla_times['time_error'] > 0) {
|
||||
function reporting_sla_get_status_period(
|
||||
$sla,
|
||||
$priority_mode=REPORT_PRIORITY_MODE_OK
|
||||
) {
|
||||
if ($sla['time_error'] > 0) {
|
||||
return REPORT_STATUS_ERR;
|
||||
}
|
||||
|
||||
if ($priority_mode == REPORT_PRIORITY_MODE_OK && $sla_times['time_ok'] > 0) {
|
||||
if ($priority_mode == REPORT_PRIORITY_MODE_OK && $sla['time_ok'] > 0) {
|
||||
return REPORT_STATUS_OK;
|
||||
}
|
||||
|
||||
if ($sla_times['time_out'] > 0) {
|
||||
if ($sla['time_out'] > 0) {
|
||||
return REPORT_STATUS_IGNORED;
|
||||
}
|
||||
|
||||
if ($sla_times['time_downtime'] > 0) {
|
||||
if ($sla['time_downtime'] > 0) {
|
||||
return REPORT_STATUS_DOWNTIME;
|
||||
}
|
||||
|
||||
if ($sla_times['time_unknown'] > 0) {
|
||||
if ($sla['time_unknown'] > 0) {
|
||||
return REPORT_STATUS_UNKNOWN;
|
||||
}
|
||||
|
||||
if ($sla_times['time_not_init'] > 0) {
|
||||
if ($sla['time_not_init'] > 0) {
|
||||
return REPORT_STATUS_NOT_INIT;
|
||||
}
|
||||
|
||||
if ($sla_times['time_ok'] > 0) {
|
||||
if ($sla['time_ok'] > 0) {
|
||||
return REPORT_STATUS_OK;
|
||||
}
|
||||
|
||||
|
@ -11470,6 +11472,44 @@ function reporting_sla_get_status_period($sla_times, $priority_mode=REPORT_PRIOR
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Given a period, get the SLA status
|
||||
* of the period compare with sla_limit.
|
||||
*
|
||||
* @param Array An array with all times to calculate the SLA.
|
||||
* @param int Limit SLA pass for user.
|
||||
* Only used for monthly, weekly And hourly report.
|
||||
*
|
||||
* @return integer Status
|
||||
*/
|
||||
function reporting_sla_get_status_period_compliance(
|
||||
$sla,
|
||||
$sla_limit
|
||||
) {
|
||||
if ($sla['time_unknown'] == $sla['time_total']) {
|
||||
return REPORT_STATUS_UNKNOWN;
|
||||
}
|
||||
|
||||
if ($sla['time_not_init'] == $sla['time_total']) {
|
||||
return REPORT_STATUS_NOT_INIT;
|
||||
}
|
||||
|
||||
if ($sla['time_downtime'] == $sla['time_total']) {
|
||||
return REPORT_STATUS_DOWNTIME;
|
||||
}
|
||||
|
||||
if ($sla['SLA'] >= $sla_limit) {
|
||||
return REPORT_STATUS_OK;
|
||||
}
|
||||
|
||||
if ($sla['SLA'] < $sla_limit) {
|
||||
return REPORT_STATUS_ERR;
|
||||
}
|
||||
|
||||
return REPORT_STATUS_IGNORED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Translate the status to the color to graph_sla_slicebar function
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue