diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php
index ea0c0b165f..1511e1f78d 100644
--- a/pandora_console/include/functions_groups.php
+++ b/pandora_console/include/functions_groups.php
@@ -1172,13 +1172,10 @@ function groups_agent_unknown ($group_array) {
return $count > 0 ? $count : 0;
}
-// Get ok agents by using the status code in modules.
-
-function groups_agent_ok ($group_array) {
+function groups_agent_total($group_array) {
if (empty ($group_array)) {
return 0;
-
}
else if (!is_array ($group_array)) {
$group_array = array($group_array);
@@ -1187,7 +1184,34 @@ function groups_agent_ok ($group_array) {
$group_clause = implode (",", $group_array);
$group_clause = "(" . $group_clause . ")";
- $count = db_get_sql ("SELECT COUNT(*) FROM tagente WHERE tagente.disabled=0 AND normal_count=total_count AND id_grupo IN $group_clause");
+ $count = db_get_sql ("SELECT COUNT(*)
+ FROM tagente
+ WHERE tagente.disabled = 0
+ AND id_grupo IN $group_clause");
+
+ return $count > 0 ? $count : 0;
+}
+
+// Get ok agents by using the status code in modules.
+
+function groups_agent_ok ($group_array) {
+
+ if (empty ($group_array)) {
+ return 0;
+ }
+ else if (!is_array ($group_array)) {
+ $group_array = array($group_array);
+ }
+
+ $group_clause = implode (",", $group_array);
+ $group_clause = "(" . $group_clause . ")";
+
+ $count = db_get_sql ("SELECT COUNT(*)
+ FROM tagente
+ WHERE tagente.disabled = 0
+ AND normal_count = total_count
+ AND (notinit_count != 0)
+ AND id_grupo IN $group_clause");
return $count > 0 ? $count : 0;
}
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index c34770600c..b664a60340 100644
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -7749,7 +7749,7 @@ function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $
$out = '';
// Depend the type of object, the stats will refer agents, modules...
- switch($type) {
+ switch ($type) {
case 'agent':
$template_title['total_count'] = __('%d Total modules');
$template_title['normal_count'] = __('%d Normal modules');
@@ -7764,6 +7764,7 @@ function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $
$template_title['critical_count'] = __('%d Critical agents');
$template_title['warning_count'] = __('%d Warning agents');
$template_title['unknown_count'] = __('%d Unknown agents');
+ $template_title['not_init_count'] = __('%d not init agents');
$template_title['fired_count'] = __('%d Fired alerts');
break;
}
@@ -7797,6 +7798,13 @@ function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $
$stats[] = array('name' => 'unknown_count', 'count' => $unknown_count, 'title' => sprintf($template_title['unknown_count'], $unknown_count));
}
+ if (isset($counts_info['not_init_count'])) {
+ $not_init_count = $counts_info['not_init_count'];
+ $stats[] = array('name' => 'not_init_count',
+ 'count' => $not_init_count,
+ 'title' => sprintf($template_title['not_init_count'], $not_init_count));
+ }
+
if (isset($counts_info['fired_count'])) {
$fired_count = $counts_info['fired_count'];
$stats[] = array('name' => 'fired_count', 'count' => $fired_count, 'title' => sprintf($template_title['fired_count'], $fired_count));
@@ -7826,6 +7834,8 @@ function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $
$out .= ' ' . $separator . ' ' . $warning_count . '';
if (isset($unknown_count) && $unknown_count > 0)
$out .= ' ' . $separator . ' ' . $unknown_count . '';
+ if (isset($not_init_count) && $not_init_count > 0)
+ $out .= ' ' . $separator . ' ' . $not_init_count . '';
if (isset($normal_count) && $normal_count > 0)
$out .= ' ' . $separator . ' ' . $normal_count . '';
diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php
index 3c8ba46c52..de0ab8fb88 100755
--- a/pandora_console/include/functions_treeview.php
+++ b/pandora_console/include/functions_treeview.php
@@ -477,9 +477,7 @@ function treeview_printTree($type) {
if (! defined ('METACONSOLE')) {
-
$list = treeview_getData ($type);
-
}
else {
$servers = db_get_all_rows_sql ("
@@ -568,11 +566,13 @@ function treeview_printTree($type) {
'total_count' => $item['_num_ok_'] +
$item['_num_critical_'] +
$item['_num_warning_'] +
- $item['_num_unknown_'],
+ $item['_num_unknown_'] +
+ $item['_num_not_init_'],
'normal_count' => $item['_num_ok_'],
'critical_count' => $item['_num_critical_'],
'warning_count' => $item['_num_warning_'],
- 'unknown_count' => $item['_num_unknown_']);
+ 'unknown_count' => $item['_num_unknown_'],
+ 'not_init_count' => $item['_num_not_init_']);
reporting_tiny_stats($counts_info, false, $type);
@@ -599,21 +599,21 @@ function treeview_getData ($type) {
$search_free = get_parameter('search_free', '');
$select_status = get_parameter('status', -1);
$search_group = get_parameter('search_group', 0);
-
+
if ($search_group) {
$avariableGroups[$search_group] = groups_get_name($search_group);
- } else {
+ }
+ else {
$avariableGroups = users_get_groups ();
}
//Get all groups
//$avariableGroups = users_get_groups ();
-
+
//Get all groups with agents
$full_groups = db_get_all_rows_sql("
SELECT DISTINCT id_grupo
- FROM tagente
- WHERE total_count > 0");
+ FROM tagente");
if ($full_groups === false) {
return array ();
@@ -627,10 +627,12 @@ function treeview_getData ($type) {
// We only want groups with agents, so we need the intesect of both arrays.
// Not for policies, we need all groups
- if ($type != 'policies')
- $avariableGroups = array_intersect_key($avariableGroups, $fgroups);
+ if ($type != 'policies') {
+ $avariableGroups = array_intersect_key($avariableGroups,
+ $fgroups);
+ }
- $avariableGroupsIds = implode(',',array_keys($avariableGroups));
+ $avariableGroupsIds = implode(',', array_keys($avariableGroups));
if ($avariableGroupsIds == '') {
$avariableGroupsIds == -1;
}
@@ -692,6 +694,19 @@ function treeview_getData ($type) {
unset($avariableGroups[$id_group]);
}
break;
+ case NOT_INIT:
+ foreach ($avariableGroups as $group_name) {
+ $id_group = db_get_value_sql('
+ SELECT id_grupo
+ FROM tgrupo
+ WHERE nombre ="' . $group_name . '"');
+
+ $num_not_init = groups_agent_not_init($id_group);
+
+ if ($num_not_init <= 0)
+ unset($avariableGroups[$id_group]);
+ }
+ break;
}
// If there are not groups display error and return
@@ -902,7 +917,8 @@ function treeview_getData ($type) {
array_push($list, array('id' => 0, 'name' => 'No policy'));
}
else {
- $sql = "SELECT DISTINCT tpolicies.id,
+ $sql = "
+ SELECT DISTINCT tpolicies.id,
tpolicies.name
FROM tpolicies, tpolicy_modules, tagente_estado,
tagente, tagente_modulo
@@ -929,7 +945,8 @@ function treeview_getData ($type) {
case NORMAL:
foreach ($list as $policy_element) {
- $policy_agents_ok = policies_agents_ok($policy_element['id']);
+ $policy_agents_ok =
+ policies_agents_ok($policy_element['id']);
if ($policy_agents_ok <= 0)
unset($list[$element]);
@@ -1104,7 +1121,9 @@ function treeview_getData ($type) {
$list[$key]['_id_'] = $id;
$list[$key]['_name_'] = $item['nombre'];
$list[$key]['_iconImg_'] = html_print_image ("images/groups_small/" . groups_get_icon($item['id_grupo']).".png", true, array ("style" => 'vertical-align: middle;'));
+ $list[$key]['_num_total_'] = groups_agent_total($id);
$list[$key]['_num_ok_'] = groups_agent_ok($id);
+ $list[$key]['_num_not_init_'] = groups_agent_not_init($id);
$list[$key]['_num_critical_'] = groups_agent_critical($id);
$list[$key]['_num_warning_'] = groups_agent_warning($id);
$list[$key]['_num_unknown_'] = groups_agent_unknown ($id);
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index 478d4fc569..cd0072f6df 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -955,6 +955,10 @@ tr.disabled_row_user * {
color: #808080;
font-weight: bold;
}
+.blue {
+ color: #5AB7E5;
+ font-weight: bold;
+}
.redb, .greenb, td.datos_id, td.datos2_id, f9b {
font-weight: bold;
}
diff --git a/pandora_console/operation/tree.php b/pandora_console/operation/tree.php
old mode 100644
new mode 100755
index 1db0716535..ed798ae47e
--- a/pandora_console/operation/tree.php
+++ b/pandora_console/operation/tree.php
@@ -19,6 +19,8 @@ define('NORMAL', 0);
define('WARNING', 2);
define('CRITICAL', 1);
define('UNKNOWN', 3);
+define('NOT_INIT', 5);
+
global $config;
@@ -562,7 +564,13 @@ switch ($activeTab) {
}
if (! defined ('METACONSOLE')) {
- $onheader = array('tag' => $tags_tab, 'os' => $os_tab, 'group' => $group_tab, 'module_group' => $module_group_tab, 'policies' => $policies_tab, 'module' => $module_tab);
+ $onheader = array('tag' => $tags_tab,
+ 'os' => $os_tab,
+ 'group' => $group_tab,
+ 'module_group' => $module_group_tab,
+ 'policies' => $policies_tab,
+ 'module' => $module_tab);
+
ui_print_page_header(
__('Tree view') . " - " . __('Sort the agents by ') . $order,
"images/extensions.png",
@@ -570,7 +578,9 @@ if (! defined ('METACONSOLE')) {
}
else {
- ui_meta_add_breadcrumb(array('link' => 'index.php?sec=monitoring&sec2=operation/tree', 'text' => __('Tree View')));
+ ui_meta_add_breadcrumb(array(
+ 'link' => 'index.php?sec=monitoring&sec2=operation/tree',
+ 'text' => __('Tree View')));
ui_meta_print_page_header($nav_bar);
$img_style = array ("class" => "top", "width" => 16);
@@ -585,14 +595,16 @@ else {
if (!in_array($activeTab, $allowed_tabs)) {
db_pandora_audit("HACK Attempt",
- "Trying to access to not allowed tab on tree view");
+ "Trying to access to not allowed tab on tree view");
include ("general/noaccess.php");
+
exit;
}
// End of tab check
$group_tab = array('text' => ""
- . html_print_image ("images/group.png", true, array ("title" => __('Groups'))) . "",
+ . html_print_image ("images/group.png", true,
+ array ("title" => __('Groups'))) . "",
'active' => $activeTab == "group");
$subsections['group'] = $group_tab;
@@ -600,7 +612,8 @@ else {
if ($config['enable_tags_tree']) {
$tags_tab = array(
'text' => "" .
- html_print_image ("images/tag.png", true, array ("title" => __('Tags'))) . "",
+ html_print_image ("images/tag.png", true,
+ array ("title" => __('Tags'))) . "",
'active' => $activeTab == "tag");
$subsections['tag'] = $tags_tab;
@@ -644,6 +657,7 @@ $fields[NORMAL] = __('Normal');
$fields[WARNING] = __('Warning');
$fields[CRITICAL] = __('Critical');
$fields[UNKNOWN] = __('Unknown');
+$fields[NOT_INIT] = __('Not init');
html_print_select ($fields, "status", $select_status);