2014-07-17 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_groups.php: added parameter to avoid the check
	the propagation in the function "groups_get_childrens".
	
	* include/functions_networkmap.php,
	operation/agentes/networkmap.php,
	operation/agentes/networkmap.topology.php: added feature to show the
	agents in subgroups (or not).
	
	INCIDENT: #1018




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10341 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2014-07-17 14:28:59 +00:00
parent a3cb1f7e26
commit b4c9a92ecc
5 changed files with 48 additions and 13 deletions

View File

@ -1,3 +1,15 @@
2014-07-17 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_groups.php: added parameter to avoid the check
the propagation in the function "groups_get_childrens".
* include/functions_networkmap.php,
operation/agentes/networkmap.php,
operation/agentes/networkmap.topology.php: added feature to show the
agents in subgroups (or not).
INCIDENT: #1018
2014-07-14 Vanessa Gil <vanessa.gil@artica.es>
* godmode/admin_access_log.php

View File

@ -236,7 +236,7 @@ function groups_check_used($idGroup) {
* @param integer $parent The id_group parent to search the childrens.
* @param array $groups The groups, its for optimize the querys to DB.
*/
function groups_get_childrens($parent, $groups = null) {
function groups_get_childrens($parent, $groups = null, $onlyPropagate = false) {
if (empty($groups)) {
$groups = db_get_all_rows_in_table('tgrupo');
}
@ -248,7 +248,7 @@ function groups_get_childrens($parent, $groups = null) {
continue;
}
if ($group['propagate']) {
if ($group['propagate'] || $onlyPropagate) {
if ($group['parent'] == $parent) {
$return = $return + array($group['id_grupo'] => $group) + groups_get_childrens($group['id_grupo'], $groups);
}

View File

@ -233,7 +233,8 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
$simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0,
$zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0,
$id_networkmap = 0, $show_snmp_modules = 0, $cut_names = true,
$relative = false, $text_filter = '', $l2_network = false, $ip_mask = null) {
$relative = false, $text_filter = '', $l2_network = false, $ip_mask = null,
$dont_show_subgroups = false) {
global $config;
@ -262,7 +263,20 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
}
if ($group >= 1) {
$filter['id_grupo'] = $group;
if ($dont_show_subgroups)
$filter['id_grupo'] = $group;
else {
$childrens = groups_get_childrens($group, null, true);
if (!empty($childrens)) {
$childrens = array_keys($childrens);
$filter['id_grupo'] = $childrens;
$filter['id_grupo'][] = $group;
}
else {
$filter['id_grupo'] = $group;
}
}
//Order by id_parent ascendant for to avoid the bugs
//because the first agents to process in the next
@ -589,7 +603,13 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
}
// Generate a dot graph definition for graphviz with groups
function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0, $zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0, $modwithalerts = 0, $module_group = 0, $hidepolicymodules = 0, $depth = 'all', $id_networkmap = 0, $dont_show_subgroups = 0, $text_filter = '') {
function networkmap_generate_dot_groups ($pandora_name, $group = 0,
$simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0,
$zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0,
$modwithalerts = 0, $module_group = 0, $hidepolicymodules = 0,
$depth = 'all', $id_networkmap = 0, $dont_show_subgroups = 0,
$text_filter = '') {
global $config;
$parents = array();
@ -682,7 +702,8 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0,
// Get agents data
$agents = agents_get_agents ($filter,
array ('id_grupo, nombre, id_os, id_agente,
normal_count, warning_count, critical_count, unknown_count, total_count, notinit_count'));
normal_count, warning_count, critical_count,
unknown_count, total_count, notinit_count'));
if ($agents === false)
$agents = array();

View File

@ -230,14 +230,14 @@ if (check_acl ($config['id_user'], 0, "AW")) {
$buttons['addmap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;add_networkmap=1&amp;tab='.$activeTab.'&amp;pure='.$pure.'">' .
html_print_image("images/add_mc.png", true, array ("title" => __('Add map'))) .'</a>');
if (!$nomaps && $id_networkmap != 0) {
$buttons['deletemap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;id_networkmap='.$id_networkmap.'&amp;delete_networkmap=1&amp;tab='.$activeTab.'&amp;pure='.$pure.'">' .
html_print_image("images/delete_mc.png", true, array ("title" => __('Delete map'))) .'</a>');
$buttons['savemap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=network&amp;' .
'text' => '<a href="index.php?sec=network&amp;' .
'sec2=operation/agentes/networkmap&amp;' .
'id_networkmap=' . $id_networkmap . '&amp;' .
'save_networkmap=1&amp;' .
@ -320,7 +320,7 @@ $options_form = '<form action="index.php?sec=network&amp;sec2=operation/agentes/
unset($table);
$table->width = '95%';
$table->width = '98%';
$table->class = 'databox';
$table->data = array();
$table->data[0][] = __('Name:') . '&nbsp;' .
@ -329,7 +329,9 @@ $table->data[0][] = __('Group:') . '&nbsp;' .
html_print_select_groups(false, 'AR', false, 'group', $group, '', 'All', 0, true);
if ($activeTab == 'groups' || $activeTab == 'policies') {
$table->data[0][] = __('Module group') . '&nbsp;' .
html_print_select_from_sql ('SELECT id_mg, name FROM tmodule_group', 'module_group', $module_group, '', 'All', 0, true);
html_print_select_from_sql ('
SELECT id_mg, name
FROM tmodule_group', 'module_group', $module_group, '', 'All', 0, true);
}
if ($activeTab == 'topology') {
@ -411,7 +413,7 @@ if ($activeTab != 'dinamic') {
$table->data[2][] = __('Free text for search (*):') . '&nbsp;' .
html_print_input_text('text_filter', $text_filter, '', 30, 100, true);
if ($activeTab == 'groups') {
if (($activeTab == 'groups') || ($activeTab == 'topology')) {
$table->data[2][] = __('Don\'t show subgroups:') .
ui_print_help_tip(__('Only run with it is filter for any group'), true) .
'&nbsp;' .

View File

@ -39,7 +39,7 @@ if (!isset($text_filter)) {
$graph = networkmap_generate_dot(__('Pandora FMS'), $group, $simple,
$font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen,
$pure, $id_networkmap, $show_snmp_modules, true, true,
$text_filter, $l2_network);
$text_filter, $l2_network, null, $dont_show_subgroups);
if ($graph === false) {
ui_print_error_message (__('Map could not be generated'));