Added the function 'modules_is_disable_agent' and fixed the show disabled agents in reports into items 'general' 'sla'.
This commit is contained in:
parent
dc1dc7012c
commit
cf9c53f220
|
@ -23,6 +23,20 @@ include_once($config['homedir'] . "/include/functions_agents.php");
|
|||
include_once($config['homedir'] . '/include/functions_users.php');
|
||||
include_once($config['homedir'] . '/include/functions_tags.php');
|
||||
|
||||
function modules_is_disable_agent($id_agent_module) {
|
||||
$sql = "
|
||||
SELECT disabled
|
||||
FROM tagente
|
||||
WHERE id_agente IN (
|
||||
SELECT id_agente
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente_modulo = " . (int)$id_agent_module . ")";
|
||||
|
||||
$disabled = db_get_value_sql($sql);
|
||||
|
||||
return (bool)$disabled;
|
||||
}
|
||||
|
||||
function modules_is_disable_type_event($id_agent_module = false, $type_event = false) {
|
||||
if ($id_agent_module === false) {
|
||||
switch ($type_event) {
|
||||
|
|
|
@ -4048,7 +4048,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
}
|
||||
|
||||
if ($downtime_malformed) {
|
||||
$info_malformed = ui_print_error_message(__('This item is affected by a malformed planned downtime') . ". " .
|
||||
$info_malformed = ui_print_error_message(
|
||||
__('This item is affected by a malformed planned downtime') . ". " .
|
||||
__('Go to the planned downtimes section to solve this') . ".", '', true);
|
||||
|
||||
$data = array();
|
||||
|
@ -4092,10 +4093,16 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
}
|
||||
}
|
||||
|
||||
if (modules_is_disable_agent($sla['id_agent_module'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//Get the sla_value in % and store it on $sla_value
|
||||
$sla_value = reporting_get_agentmodule_sla ($sla['id_agent_module'], $content['period'],
|
||||
$sla['sla_min'], $sla['sla_max'], $report["datetime"], $content, $content['time_from'],
|
||||
$content['time_to']);
|
||||
$sla_value = reporting_get_agentmodule_sla(
|
||||
$sla['id_agent_module'], $content['period'],
|
||||
$sla['sla_min'], $sla['sla_max'],
|
||||
$report["datetime"], $content,
|
||||
$content['time_from'], $content['time_to']);
|
||||
|
||||
if (($config ['metaconsole'] == 1) && defined('METACONSOLE')) {
|
||||
//Restore db connection
|
||||
|
@ -4103,7 +4110,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
}
|
||||
|
||||
//Do not show right modules if 'only_display_wrong' is active
|
||||
if ($content['only_display_wrong'] == 1 && $sla_value >= $sla['sla_limit']) continue;
|
||||
if ($content['only_display_wrong'] == 1 &&
|
||||
$sla_value >= $sla['sla_limit']) {
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$sla_showed[] = $sla;
|
||||
$sla_showed_values[] = $sla_value;
|
||||
|
@ -5322,7 +5333,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
switch ($group_by_agent) {
|
||||
//0 means not group by agent
|
||||
case 0:
|
||||
$sql = sprintf("SELECT id_agent_module,
|
||||
$sql = sprintf("
|
||||
SELECT id_agent_module,
|
||||
server_name, operation
|
||||
FROM treport_content_item
|
||||
WHERE id_report_content = %d",
|
||||
|
@ -5365,6 +5377,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
}
|
||||
}
|
||||
|
||||
if (modules_is_disable_agent($row['id_agent_module'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$mod_name = modules_get_agentmodule_name ($row['id_agent_module']);
|
||||
$ag_name = modules_get_agentmodule_agent_name ($row['id_agent_module']);
|
||||
|
||||
|
@ -5556,6 +5572,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
}
|
||||
}
|
||||
|
||||
if (modules_is_disable_agent($g['id_agent_module'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$agent_name = modules_get_agentmodule_agent_name ($g['id_agent_module']);
|
||||
$module_name = modules_get_agentmodule_name ($g['id_agent_module']);
|
||||
|
|
Loading…
Reference in New Issue