Added the function 'modules_is_disable_agent' and fixed the show disabled agents in reports into items 'general' 'sla'.
(cherry picked from commit cf9c53f220
)
This commit is contained in:
parent
b58bd83523
commit
2646d92b86
|
@ -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_users.php');
|
||||||
include_once($config['homedir'] . '/include/functions_tags.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) {
|
function modules_is_disable_type_event($id_agent_module = false, $type_event = false) {
|
||||||
if ($id_agent_module === false) {
|
if ($id_agent_module === false) {
|
||||||
switch ($type_event) {
|
switch ($type_event) {
|
||||||
|
|
|
@ -1886,7 +1886,7 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if (!is_array($id_group)){
|
if (!is_array($id_group)) {
|
||||||
$my_group = $id_group;
|
$my_group = $id_group;
|
||||||
$id_group = array();
|
$id_group = array();
|
||||||
$id_group[0] = $my_group;
|
$id_group[0] = $my_group;
|
||||||
|
@ -1903,7 +1903,7 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
|
||||||
|
|
||||||
foreach ($children as $sub) {
|
foreach ($children as $sub) {
|
||||||
// If the group is quering previously, we ingore it
|
// If the group is quering previously, we ingore it
|
||||||
if (!in_array($sub['id_grupo'],$covered_groups)){
|
if (!in_array($sub['id_grupo'],$covered_groups)) {
|
||||||
array_push($covered_groups, $sub['id_grupo']);
|
array_push($covered_groups, $sub['id_grupo']);
|
||||||
array_push($group_array, $sub['id_grupo']);
|
array_push($group_array, $sub['id_grupo']);
|
||||||
}
|
}
|
||||||
|
@ -1912,7 +1912,7 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
|
||||||
|
|
||||||
// Add id of this group to create the clause
|
// Add id of this group to create the clause
|
||||||
// If the group is quering previously, we ingore it
|
// If the group is quering previously, we ingore it
|
||||||
if (!in_array($group,$covered_groups)){
|
if (!in_array($group,$covered_groups)) {
|
||||||
array_push($covered_groups, $group);
|
array_push($covered_groups, $group);
|
||||||
array_push($group_array, $group);
|
array_push($group_array, $group);
|
||||||
}
|
}
|
||||||
|
@ -4097,7 +4097,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($downtime_malformed) {
|
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);
|
__('Go to the planned downtimes section to solve this') . ".", '', true);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -4141,10 +4142,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
|
//Get the sla_value in % and store it on $sla_value
|
||||||
$sla_value = reporting_get_agentmodule_sla ($sla['id_agent_module'], $content['period'],
|
$sla_value = reporting_get_agentmodule_sla(
|
||||||
$sla['sla_min'], $sla['sla_max'], $report["datetime"], $content, $content['time_from'],
|
$sla['id_agent_module'], $content['period'],
|
||||||
$content['time_to']);
|
$sla['sla_min'], $sla['sla_max'],
|
||||||
|
$report["datetime"], $content,
|
||||||
|
$content['time_from'], $content['time_to']);
|
||||||
|
|
||||||
if (($config ['metaconsole'] == 1) && defined('METACONSOLE')) {
|
if (($config ['metaconsole'] == 1) && defined('METACONSOLE')) {
|
||||||
//Restore db connection
|
//Restore db connection
|
||||||
|
@ -4152,7 +4159,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
}
|
}
|
||||||
|
|
||||||
//Do not show right modules if 'only_display_wrong' is active
|
//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[] = $sla;
|
||||||
$sla_showed_values[] = $sla_value;
|
$sla_showed_values[] = $sla_value;
|
||||||
|
@ -5369,7 +5380,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
switch ($group_by_agent) {
|
switch ($group_by_agent) {
|
||||||
//0 means not group by agent
|
//0 means not group by agent
|
||||||
case 0:
|
case 0:
|
||||||
$sql = sprintf("SELECT id_agent_module,
|
$sql = sprintf("
|
||||||
|
SELECT id_agent_module,
|
||||||
server_name, operation
|
server_name, operation
|
||||||
FROM treport_content_item
|
FROM treport_content_item
|
||||||
WHERE id_report_content = %d",
|
WHERE id_report_content = %d",
|
||||||
|
@ -5412,6 +5424,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']);
|
$mod_name = modules_get_agentmodule_name ($row['id_agent_module']);
|
||||||
$ag_name = modules_get_agentmodule_agent_name ($row['id_agent_module']);
|
$ag_name = modules_get_agentmodule_agent_name ($row['id_agent_module']);
|
||||||
|
|
||||||
|
@ -5603,6 +5619,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']);
|
$agent_name = modules_get_agentmodule_agent_name ($g['id_agent_module']);
|
||||||
$module_name = modules_get_agentmodule_name ($g['id_agent_module']);
|
$module_name = modules_get_agentmodule_name ($g['id_agent_module']);
|
||||||
|
|
Loading…
Reference in New Issue