mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
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
|
* @return integer Status
|
||||||
*/
|
*/
|
||||||
function reporting_sla_get_status_period($sla_times, $priority_mode=REPORT_PRIORITY_MODE_OK)
|
function reporting_sla_get_status_period(
|
||||||
{
|
$sla,
|
||||||
if ($sla_times['time_error'] > 0) {
|
$priority_mode=REPORT_PRIORITY_MODE_OK
|
||||||
|
) {
|
||||||
|
if ($sla['time_error'] > 0) {
|
||||||
return REPORT_STATUS_ERR;
|
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;
|
return REPORT_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sla_times['time_out'] > 0) {
|
if ($sla['time_out'] > 0) {
|
||||||
return REPORT_STATUS_IGNORED;
|
return REPORT_STATUS_IGNORED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sla_times['time_downtime'] > 0) {
|
if ($sla['time_downtime'] > 0) {
|
||||||
return REPORT_STATUS_DOWNTIME;
|
return REPORT_STATUS_DOWNTIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sla_times['time_unknown'] > 0) {
|
if ($sla['time_unknown'] > 0) {
|
||||||
return REPORT_STATUS_UNKNOWN;
|
return REPORT_STATUS_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sla_times['time_not_init'] > 0) {
|
if ($sla['time_not_init'] > 0) {
|
||||||
return REPORT_STATUS_NOT_INIT;
|
return REPORT_STATUS_NOT_INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sla_times['time_ok'] > 0) {
|
if ($sla['time_ok'] > 0) {
|
||||||
return REPORT_STATUS_OK;
|
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
|
* @brief Translate the status to the color to graph_sla_slicebar function
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user