Merge branch 'feature/ticket#2028-network-map' into develop

This commit is contained in:
Alejandro Gallardo Escobar 2015-03-26 21:22:51 +01:00
commit 12013f8263
3 changed files with 17 additions and 12 deletions

View File

@ -376,7 +376,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
// Get agent modules data
if ($strict_user) {
$modules = tags_get_agent_modules ($agent['id_agente'], $acltags, false, $filter, false);
$modules = tags_get_agent_modules ($agent['id_agente'], false, $acltags, false, $filter, false);
} else {
$modules = agents_get_modules($agent['id_agente'], '*', $filter, true, true);
}
@ -792,7 +792,7 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
// Get agent modules data
if ($strict_user) {
$filter['disabled'] = 0;
$modules = tags_get_agent_modules ($agent['id_agente'], $acltags, false, $filter, false);
$modules = tags_get_agent_modules ($agent['id_agente'], false, $acltags, false, $filter, false);
} else {
$modules = agents_get_modules ($agent['id_agente'], false, array('disabled' => 0), true, false);
}

View File

@ -7862,14 +7862,14 @@ function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $
$id_agent = $counts_info['id_agente'];
$counts_info = array();
$counts_info['normal_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_NORMAL));
$counts_info['warning_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_WARNING));
$counts_info['critical_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_CRITICAL_BAD));
$counts_info['notinit_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_NOT_INIT));
$counts_info['unknown_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_UNKNOWN));
$counts_info['normal_count'] = count(tags_get_agent_modules ($id_agent, false, $acltags, false, $filter, false, AGENT_MODULE_STATUS_NORMAL));
$counts_info['warning_count'] = count(tags_get_agent_modules ($id_agent, false, $acltags, false, $filter, false, AGENT_MODULE_STATUS_WARNING));
$counts_info['critical_count'] = count(tags_get_agent_modules ($id_agent, false, $acltags, false, $filter, false, AGENT_MODULE_STATUS_CRITICAL_BAD));
$counts_info['notinit_count'] = count(tags_get_agent_modules ($id_agent, false, $acltags, false, $filter, false, AGENT_MODULE_STATUS_NOT_INIT));
$counts_info['unknown_count'] = count(tags_get_agent_modules ($id_agent, false, $acltags, false, $filter, false, AGENT_MODULE_STATUS_UNKNOWN));
$counts_info['total_count'] = $counts_info['normal_count'] + $counts_info['warning_count'] + $counts_info['critical_count'] + $counts_info['unknown_count'] + $counts_info['notinit_count'];
$all_agent_modules = tags_get_agent_modules ($id_agent, $acltags, false, $filter);
$all_agent_modules = tags_get_agent_modules ($id_agent, false, $acltags, false, $filter);
if (!empty($all_agent_modules)) {
$mod_clause = "(".implode(',', array_keys($all_agent_modules)).")";

View File

@ -2312,7 +2312,7 @@ function tags_get_all_user_agents ($id_tag = false, $id_user = false, $groups_an
$groups_clause = " AND ".tags_get_acl_tags_module_condition($groups_and_tags, "tagente_modulo");
}
} else {
$groups_clause = " AND tagente.id_grupo IN (".implode(',',$groups_and_tags).")";
$groups_clause = " AND tagente.id_grupo IN (".implode(',', array_keys($groups_and_tags)).")";
}
if (!empty($filter['id_group'])) {
@ -2433,7 +2433,7 @@ function tags_get_all_user_agents ($id_tag = false, $id_user = false, $groups_an
return $user_agents;
}
function tags_get_agent_modules ($id_agent, $groups_and_tags = array(), $fields = false, $filter = false, $return_all_fields = false, $get_filter_status = -1) {
function tags_get_agent_modules ($id_agent, $id_tag = false, $groups_and_tags = array(), $fields = false, $filter = false, $return_all_fields = false, $get_filter_status = -1) {
global $config;
@ -2441,6 +2441,12 @@ function tags_get_agent_modules ($id_agent, $groups_and_tags = array(), $fields
if (empty($id_agent))
return false;
if (empty($id_tag)) {
$tag_filter = "";
} else {
$tag_filter = " AND tagente_modulo.id_agente_modulo IN (SELECT id_agente_modulo FROM ttag_module WHERE id_tag = $id_tag) ";
}
if (!is_array ($fields)) {
$fields = array ();
$fields[0] = "tagente_modulo.id_agente_modulo";
@ -2459,12 +2465,11 @@ function tags_get_agent_modules ($id_agent, $groups_and_tags = array(), $fields
}
$tag_filter = "";
if (!empty($groups_and_tags)) {
$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_agent);
if (isset($groups_and_tags[$agent_group]) && ($groups_and_tags[$agent_group] != '')) {
//~ $tag_filter = " AND ttag_module.id_tag IN (".$groups_and_tags[$agent_group].")";
$tag_filter = " AND tagente_modulo.id_agente_modulo IN (SELECT id_agente_modulo FROM ttag_module WHERE id_tag IN (".$groups_and_tags[$agent_group]."))";
$tag_filter .= " AND tagente_modulo.id_agente_modulo IN (SELECT id_agente_modulo FROM ttag_module WHERE id_tag IN (".$groups_and_tags[$agent_group]."))";
}
}