Improved some SLA functions to stop the calculations when the module id is invalid
This commit is contained in:
parent
062332253e
commit
0da3544361
|
@ -413,6 +413,9 @@ function reporting_get_agentmodule_data_sum ($id_agent_module, $period=0, $date
|
||||||
function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) {
|
function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
if (empty($id_agent_module))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Initialize variables
|
// Initialize variables
|
||||||
if (empty ($date)) {
|
if (empty ($date)) {
|
||||||
$date = get_system_time ();
|
$date = get_system_time ();
|
||||||
|
@ -579,6 +582,9 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_valu
|
||||||
function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) {
|
function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
if (empty($id_agent_module))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Initialize variables
|
// Initialize variables
|
||||||
if (empty ($date)) {
|
if (empty ($date)) {
|
||||||
$date = get_system_time ();
|
$date = get_system_time ();
|
||||||
|
@ -885,6 +891,9 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
function reporting_get_planned_downtimes_intervals ($id_agent_module, $start_date, $end_date, $check_services = false) {
|
function reporting_get_planned_downtimes_intervals ($id_agent_module, $start_date, $end_date, $check_services = false) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
if (empty($id_agent_module))
|
||||||
|
return false;
|
||||||
|
|
||||||
require_once ($config['homedir'] . '/include/functions_planned_downtimes.php');
|
require_once ($config['homedir'] . '/include/functions_planned_downtimes.php');
|
||||||
|
|
||||||
$malformed_planned_downtimes = planned_downtimes_get_malformed();
|
$malformed_planned_downtimes = planned_downtimes_get_malformed();
|
||||||
|
@ -907,7 +916,7 @@ function reporting_get_planned_downtimes_intervals ($id_agent_module, $start_dat
|
||||||
) tpdr
|
) tpdr
|
||||||
ORDER BY tpdr.id";
|
ORDER BY tpdr.id";
|
||||||
|
|
||||||
$downtimes = @db_get_all_rows_sql($sql_downtime);
|
$downtimes = db_get_all_rows_sql($sql_downtime);
|
||||||
|
|
||||||
if ($downtimes == false) {
|
if ($downtimes == false) {
|
||||||
$downtimes = array();
|
$downtimes = array();
|
||||||
|
@ -1248,7 +1257,7 @@ function reporting_get_planned_downtimes ($start_date, $end_date, $id_agent_modu
|
||||||
OR (date_from <= '$end_date' AND date_to >= '$end_date')))";
|
OR (date_from <= '$end_date' AND date_to >= '$end_date')))";
|
||||||
}
|
}
|
||||||
|
|
||||||
$downtimes = @db_get_all_rows_sql($sql_downtime);
|
$downtimes = db_get_all_rows_sql($sql_downtime);
|
||||||
if ($downtimes == false) {
|
if ($downtimes == false) {
|
||||||
$downtimes = array();
|
$downtimes = array();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue