Merge remote-tracking branch 'origin/develop' into 2611-Cache_de_vista_de_arbol_y_vista_de_grupos

This commit is contained in:
daniel 2018-08-31 10:56:04 +02:00
commit e5fec6b303
47 changed files with 390 additions and 405 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.726-180827 Version: 7.0NG.726-180831
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.726-180827" pandora_version="7.0NG.726-180831"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.726'; use constant AGENT_VERSION => '7.0NG.726';
use constant AGENT_BUILD => '180827'; use constant AGENT_BUILD => '180831';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.726 %define version 7.0NG.726
%define release 180827 %define release 180831
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.726 %define version 7.0NG.726
%define release 180827 %define release 180831
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.726" PI_VERSION="7.0NG.726"
PI_BUILD="180827" PI_BUILD="180831"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{180827} {180831}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.726(Build 180827)") #define PANDORA_VERSION ("7.0NG.726(Build 180831)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.726(Build 180827))" VALUE "ProductVersion", "(7.0NG.726(Build 180831))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.726-180827 Version: 7.0NG.726-180831
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.726-180827" pandora_version="7.0NG.726-180831"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -128,43 +128,20 @@ function mainModuleGroups() {
require_once($config['homedir'] . "/include/functions_users.php"); require_once($config['homedir'] . "/include/functions_users.php");
//The big query //The big query
switch ($config["dbtype"]) { $sql = "SELECT COUNT(id_agente) AS count, case utimestamp when 0 then 5 else estado end as estado
case "mysql": FROM tagente_estado
$sql = "SELECT COUNT(id_agente) AS count, case utimestamp when 0 then 5 else estado end as estado WHERE id_agente IN
FROM tagente_estado (SELECT id_agente
WHERE id_agente IN FROM tagente ta LEFT JOIN tagent_secondary_group tasg
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND disabled IS FALSE) ON ta.id_agente = tasg.id_agent
AND id_agente_modulo IN WHERE (ta.id_grupo = %d OR tasg.id_group = %d) AND disabled IS FALSE
(SELECT id_agente_modulo )
FROM tagente_modulo AND id_agente_modulo IN
WHERE id_module_group = %d AND disabled IS FALSE AND delete_pending IS FALSE) (SELECT id_agente_modulo
GROUP BY estado"; FROM tagente_modulo
break; WHERE id_module_group = %d AND disabled IS FALSE AND delete_pending IS FALSE)
case "postgresql": GROUP BY estado";
$sql = "SELECT COUNT(id_agente) AS count,
case utimestamp when 0 then 5 else estado end as estado
FROM tagente_estado
WHERE id_agente IN
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND disabled = 0)
AND id_agente_modulo IN
(SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_module_group = %d AND disabled = 0 AND delete_pending = 0)
GROUP BY estado, utimestamp";
break;
case "oracle":
$sql = "SELECT COUNT(id_agente) AS count, (case when utimestamp = 0 then 5 else estado end) AS estado
FROM tagente_estado
WHERE id_agente IN
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND (disabled IS NOT NULL AND disabled <> 0))
AND id_agente_modulo IN
(SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_module_group = %d AND (disabled IS NOT NULL AND disabled <> 0) AND (delete_pending IS NOT NULL AND delete_pending <> 0))
GROUP BY (case when utimestamp = 0 then 5 else estado end)";
break;
}
ui_print_page_header (__("Combined table of agent group and module group"), "images/module_group.png", false, "", false, ''); ui_print_page_header (__("Combined table of agent group and module group"), "images/module_group.png", false, "", false, '');
ui_print_info_message ( array('no_close'=>true, 'message'=> ui_print_info_message ( array('no_close'=>true, 'message'=>
@ -207,7 +184,7 @@ function mainModuleGroups() {
foreach ($modelGroups as $idModelGroup => $modelGroup) { foreach ($modelGroups as $idModelGroup => $modelGroup) {
$fired = false; $fired = false;
$query = sprintf($sql, $idAgentGroup, $idModelGroup); $query = sprintf($sql, $idAgentGroup, $idAgentGroup, $idModelGroup);
$rowsDB = db_get_all_rows_sql ($query); $rowsDB = db_get_all_rows_sql ($query);

View File

@ -0,0 +1 @@
ALTER TABLE treport_content ADD COLUMN `recursion` TINYINT(1) default NULL;

View File

@ -1337,6 +1337,7 @@ ALTER TABLE treport_content ADD COLUMN `lapse_calc` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300'; ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300';
ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0'; ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0'; ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmodule_relationship` -- Table `tmodule_relationship`

View File

@ -258,10 +258,7 @@ if(!$new_agent){
} }
} }
$groups = users_get_groups ($config["id_user"], "AR",false); $groups = users_get_groups ($config["id_user"], "AR",false);
$agents = agents_get_group_agents (array_keys ($groups));
$modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo $modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = " . $id_parent); WHERE id_agente = " . $id_parent);
@ -378,28 +375,6 @@ if (enterprise_installed()) {
true, // Return HTML (not echo) true, // Return HTML (not echo)
true // Multiple selection true // Multiple selection
); );
}
// Custom ID
$table->data[0][0] = __('Custom ID');
$table->data[0][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true);
$table->data[1][0] = __('Parent');
$params = array();
$params['return'] = true;
$params['show_helptip'] = true;
$params['input_name'] = 'id_parent';
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent_parent';
$params['hidden_input_idagent_value'] = $id_parent;
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
$params['selectbox_id'] = 'cascade_protection_module';
$params['javascript_is_function_select'] = true;
$params['cascade_protection'] = true;
$table->data[1][1] = ui_print_agent_autocomplete_input($params);
$table->data[1][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). "&nbsp;" . ui_print_help_icon("cascade_protection", true);
$table->data[1][1] .= "&nbsp;&nbsp;" . __('Module') . "&nbsp;" . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true);
//safe operation mode //safe operation mode
if($id_agente){ if($id_agente){
@ -418,27 +393,6 @@ if($id_agente){
$table->data[2][1] .= "&nbsp;&nbsp;" . __('Module') . "&nbsp;" . html_print_select ($safe_mode_modules, "safe_mode_module", $safe_mode_module, "", "", 0, true); $table->data[2][1] .= "&nbsp;&nbsp;" . __('Module') . "&nbsp;" . html_print_select ($safe_mode_modules, "safe_mode_module", $safe_mode_module, "", "", 0, true);
} }
// Learn mode / Normal mode
$table->data[3][0] = __('Module definition') .
ui_print_help_icon("module_definition", true);
$table->data[3][1] = __('Learning mode') . ' ' .
html_print_radio_button_extended ("modo", 1, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
'style="margin-right: 40px;"', true);
$table->data[3][1] .= __('Normal mode') . ' ' .
html_print_radio_button_extended ("modo", 0, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
'style="margin-right: 40px;"', true);
$table->data[3][1] .= __('Autodisable mode') . ' ' .
html_print_radio_button_extended ("modo", 2, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
'style="margin-right: 40px;"', true);
// Status (Disabled / Enabled)
$table->data[4][0] = __('Status');
$table->data[4][1] = __('Disabled') . ' ' .
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
$table->data[4][1] .= __('Active') . ' ' .
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
// Remote configuration // Remote configuration
$table->data[5][0] = __('Remote configuration'); $table->data[5][0] = __('Remote configuration');
@ -467,6 +421,80 @@ if (!$new_agent) {
else else
$table->data[5][1] = '<em>' . __('Not available') . '</em>'; $table->data[5][1] = '<em>' . __('Not available') . '</em>';
$cps_array[-1] = __('Disabled');
if($cps > 0){
$cps_array[$cps] = __('Enabled');
}
else{
$cps_inc = 0;
if($id_agente){
$cps_inc = service_agents_cps($id_agente);
}
$cps_array[$cps_inc] = __('Enabled');
}
$table->data[6][0] = __('Cascade protection services');
$table->data[6][0] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
$table->data[6][1] = html_print_select($cps_array, 'cps', $cps, '', '', 0, true);
}
// Custom ID
$table->data[0][0] = __('Custom ID');
$table->data[0][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true);
$table->data[1][0] = __('Parent');
$params = array();
$params['return'] = true;
$params['show_helptip'] = true;
$params['input_name'] = 'id_parent';
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent_parent';
$params['hidden_input_idagent_value'] = $id_parent;
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
$params['selectbox_id'] = 'cascade_protection_module';
$params['javascript_is_function_select'] = true;
$params['cascade_protection'] = true;
$table->data[1][1] = ui_print_agent_autocomplete_input($params);
if (enterprise_installed()) {
$table->data[1][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). "&nbsp;" . ui_print_help_icon("cascade_protection", true);
}
$table->data[1][1] .= "&nbsp;&nbsp;" . __('Module') . "&nbsp;" . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true);
// Learn mode / Normal mode
$table->data[3][0] = __('Module definition') .
ui_print_help_icon("module_definition", true);
$table->data[3][1] = __('Learning mode') . ' ' .
html_print_radio_button_extended ("modo", 1, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
'style="margin-right: 40px;"', true);
$table->data[3][1] .= __('Normal mode') . ' ' .
html_print_radio_button_extended ("modo", 0, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
'style="margin-right: 40px;"', true);
$table->data[3][1] .= __('Autodisable mode') . ' ' .
html_print_radio_button_extended ("modo", 2, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
'style="margin-right: 40px;"', true);
// Status (Disabled / Enabled)
$table->data[4][0] = __('Status');
$table->data[4][1] = __('Disabled') . ' ' .
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
$table->data[4][1] .= __('Enabled') . ' ' .
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
if (enterprise_installed()) {
$table->data[4][2] = __('Url address');
$table->data[4][3] = html_print_input_text ('url_description',
$url_description, '', 45, 255, true);
}else{
$table->data[5][0] = __('Url address');
$table->data[5][1] = html_print_input_text ('url_description',
$url_description, '', 45, 255, true);
}
$table->data[5][2] = __('Quiet');
$table->data[5][3] .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true);
$table->data[5][3] = html_print_checkbox('quiet', 1, $quiet, true);
$listIcons = gis_get_array_list_icons(); $listIcons = gis_get_array_list_icons();
$arraySelectIcon = array(); $arraySelectIcon = array();
@ -512,30 +540,6 @@ if ($config['activate_gis']) {
$update_gis_data, false, '', 'style="margin-right: 40px;"', true); $update_gis_data, false, '', 'style="margin-right: 40px;"', true);
} }
$table->data[4][2] = __('Url address');
$table->data[4][3] = html_print_input_text ('url_description',
$url_description, '', 45, 255, true);
$table->data[5][2] = __('Quiet');
$table->data[5][3] .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true);
$table->data[5][3] = html_print_checkbox('quiet', 1, $quiet, true);
$cps_array[-1] = __('Disabled');
if($cps > 0){
$cps_array[$cps] = __('Enabled');
}
else{
$cps_inc = 0;
if($id_agente){
$cps_inc = service_agents_cps($id_agente);
}
$cps_array[$cps_inc] = __('Enabled');
}
$table->data[6][0] = __('Cascade protection services');
$table->data[6][0] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
$table->data[6][1] = html_print_select($cps_array, 'cps', $cps, '', '', 0, true);
ui_toggle(html_print_table ($table, true), __('Advanced options')); ui_toggle(html_print_table ($table, true), __('Advanced options'));
unset($table); unset($table);
@ -601,8 +605,8 @@ echo clippy_context_help("modules_not_learning_mode");
echo "</span>"; echo "</span>";
if ($id_agente) { if ($id_agente) {
echo '<div class="action-buttons" style="width: ' . $table->width . '">';
html_print_submit_button (__('Update'), 'updbutton', false, html_print_submit_button (__('Update'), 'updbutton', false,
'class="sub upd"'); 'class="sub upd"');
html_print_input_hidden ('update_agent', 1); html_print_input_hidden ('update_agent', 1);

View File

@ -343,6 +343,7 @@ if($os != 0){
$search_sql .= " AND id_os = " . $os; $search_sql .= " AND id_os = " . $os;
} }
$user_groups_to_sql = "";
// Show only selected groups // Show only selected groups
if ($ag_group > 0) { if ($ag_group > 0) {
$ag_groups = array(); $ag_groups = array();
@ -350,100 +351,39 @@ if ($ag_group > 0) {
if ($recursion) { if ($recursion) {
$ag_groups = groups_get_id_recursive($ag_group, true); $ag_groups = groups_get_id_recursive($ag_group, true);
} }
$user_groups_to_sql = implode (",", $ag_groups);
switch ($config["dbtype"]) { } else {
case "mysql":
$sql = sprintf ('SELECT *
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s, %s %s
LIMIT %d, %d',
implode (",", $ag_groups), $search_sql, $order['field'],$order['order'], $order['field2'], $order['order'], $offset, $config["block_size"]);
break;
case "postgresql":
$sql = sprintf ('SELECT *
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s, %s %s
LIMIT %d OFFSET %d',
implode (",", $ag_groups), $search_sql, $order['field'],$order['order'], $order['field2'], $order['order'], $config["block_size"], $offset);
break;
case "oracle":
$set = array ();
$set['limit'] = $config["block_size"];
$set['offset'] = $offset;
$sql = sprintf ('SELECT *
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s, %s %s',
implode (",", $ag_groups), $search_sql, $order['field'],$order['order'], $order['field2'], $order['order']);
$sql = oracle_recode_query ($sql, $set);
break;
}
$sql_total = sprintf ('SELECT COUNT(*)
FROM tagente
WHERE id_grupo IN (%s)
%s',
implode (",", $ag_groups), $search_sql);
$total_agents = db_get_sql ($sql_total);
}
else {
// Concatenate AW and AD permisions to get all the possible groups where the user can manage // Concatenate AW and AD permisions to get all the possible groups where the user can manage
$user_groupsAW = users_get_groups ($config['id_user'], 'AW'); $user_groupsAW = users_get_groups ($config['id_user'], 'AW');
$user_groupsAD = users_get_groups ($config['id_user'], 'AD'); $user_groupsAD = users_get_groups ($config['id_user'], 'AD');
$user_groups = $user_groupsAW + $user_groupsAD; $user_groups = $user_groupsAW + $user_groupsAD;
$user_groups_to_sql = implode (',', array_keys ($user_groups));
$sql = sprintf ('SELECT COUNT(*)
FROM tagente
WHERE id_grupo IN (%s)
%s',
implode (',', array_keys ($user_groups)),
$search_sql);
$total_agents = db_get_sql ($sql);
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ('SELECT *
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s, %s %s
LIMIT %d, %d',
implode (',', array_keys ($user_groups)),
$search_sql, $order['field'],$order['order'], $order['field2'], $order['order'], $offset, $config["block_size"]);
break;
case "postgresql":
$sql = sprintf ('SELECT *
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s, %s %s
LIMIT %d OFFSET %d',
implode (',', array_keys ($user_groups)),
$search_sql, $order['field'],$order['order'], $order['field2'], $order['order'], $config["block_size"], $offset);
break;
case "oracle":
$set = array ();
$set['limit'] = $config["block_size"];
$set['offset'] = $offset;
$sql = sprintf ('SELECT *
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s, %s %s',
implode (',', array_keys ($user_groups)),
$search_sql, $order['field'],$order['order'], $order['field2'], $order['order']);
$sql = oracle_recode_query ($sql, $set);
break;
}
} }
$sql = sprintf ('SELECT COUNT(DISTINCT(tagente.id_agente))
FROM tagente LEFT JOIN tagent_secondary_group tasg
ON tagente.id_agente = tasg.id_agent
WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))
%s',
$user_groups_to_sql, $user_groups_to_sql,
$search_sql);
$total_agents = db_get_sql ($sql);
$sql = sprintf ('SELECT *
FROM tagente LEFT JOIN tagent_secondary_group tasg
ON tagente.id_agente = tasg.id_agent
WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))
%s
GROUP BY tagente.id_agente
ORDER BY %s %s, %s %s
LIMIT %d, %d',
$user_groups_to_sql, $user_groups_to_sql,
$search_sql,
$order['field'], $order['order'], $order['field2'], $order['order'],
$offset, $config["block_size"]);
$agents = db_get_all_rows_sql ($sql); $agents = db_get_all_rows_sql ($sql);
// Delete rnum row generated by oracle_recode_query() function // Delete rnum row generated by oracle_recode_query() function
@ -494,13 +434,15 @@ if ($agents !== false) {
} }
/* End Update tagente.remote 0/1 with remote agent function return */ /* End Update tagente.remote 0/1 with remote agent function return */
$id_grupo = $agent["id_grupo"]; $all_groups = agents_get_all_groups_agent($agent["id_agente"], $agent["id_grupo"]);
$check_aw = check_acl_one_of_groups ($config["id_user"], $all_groups, "AW");
$check_ad = check_acl_one_of_groups ($config["id_user"], $all_groups, "AD");
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']); $cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
if (! check_acl ($config["id_user"], $id_grupo, "AW", $agent['id_agente']) && ! check_acl ($config["id_user"], $id_grupo, "AD", $agent['id_agente'])) // Do not show the agent if there is not enough permissions
continue; if (!$check_aw && !$check_ad) continue;
if ($color == 1) { if ($color == 1) {
$tdcolor = "datos"; $tdcolor = "datos";
@ -526,7 +468,7 @@ if ($agents !== false) {
echo '<span class="left">'; echo '<span class="left">';
echo "<strong>"; echo "<strong>";
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { if ($check_aw) {
$main_tab = 'main'; $main_tab = 'main';
} }
else { else {
@ -574,7 +516,7 @@ if ($agents !== false) {
} }
echo '</span><div class="left actions" style="visibility: hidden; clear: left">'; echo '</span><div class="left actions" style="visibility: hidden; clear: left">';
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { if ($check_aw) {
if($agent["id_os"] == 100){ if($agent["id_os"] == 100){
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']); $cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.__('Edit').'</a>'; echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.__('Edit').'</a>';
@ -640,7 +582,7 @@ if ($agents !== false) {
// Group icon and name // Group icon and name
echo "<td class='$tdcolor' align='left' valign='middle'>" . ui_print_group_icon ($id_grupo, true)."</td>"; echo "<td class='$tdcolor' align='left' valign='middle'>" . ui_print_group_icon ($agent["id_grupo"], true)."</td>";
// Description // Description
echo "<td class='".$tdcolor."f9'>" . echo "<td class='".$tdcolor."f9'>" .
ui_print_truncate_text($agent["comentarios"], 'description', true, true, true, '[&hellip;]', 'font-size: 6.5pt;')."</td>"; ui_print_truncate_text($agent["comentarios"], 'description', true, true, true, '[&hellip;]', 'font-size: 6.5pt;')."</td>";
@ -679,7 +621,7 @@ if ($agents !== false) {
echo html_print_image('images/lightbulb.png', true, array('alt' => __('Disable agent'), 'title' => __('Disable agent'))) ."</a>"; echo html_print_image('images/lightbulb.png', true, array('alt' => __('Disable agent'), 'title' => __('Disable agent'))) ."</a>";
} }
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { if ($check_aw) {
echo "&nbsp;&nbsp;<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente& echo "&nbsp;&nbsp;<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
borrar_agente=".$agent["id_agente"]."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'"; borrar_agente=".$agent["id_agente"]."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";

View File

@ -426,9 +426,12 @@ switch ($action) {
$description = $item['description']; $description = $item['description'];
$period = $item['period']; $period = $item['period'];
$group = $item['id_group']; $group = $item['id_group'];
$recursion = $item['recursion'];
break; break;
case 'event_report_agent': case 'event_report_agent':
case 'event_report_group': case 'event_report_group':
$recursion = $item['recursion'];
break;
case 'event_report_module': case 'event_report_module':
$description = $item['description']; $description = $item['description'];
$period = $item['period']; $period = $item['period'];
@ -477,12 +480,14 @@ switch ($action) {
case 'group_report': case 'group_report':
$description = $item['description']; $description = $item['description'];
$group = $item['id_group']; $group = $item['id_group'];
$recursion = $item['recursion'];
break; break;
case 'network_interfaces_report': case 'network_interfaces_report':
$description = $item['description']; $description = $item['description'];
$group = $item['id_group']; $group = $item['id_group'];
$period = $item['period']; $period = $item['period'];
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0; $fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
$recursion = $item['recursion'];
break; break;
case 'top_n': case 'top_n':
$description = $item['description']; $description = $item['description'];
@ -521,6 +526,7 @@ switch ($action) {
$es = json_decode($item['external_source'], true); $es = json_decode($item['external_source'], true);
$id_agents = $es['id_agents']; $id_agents = $es['id_agents'];
$selection_a_m = get_parameter('selection'); $selection_a_m = get_parameter('selection');
$recursion = $item['recursion'];
if ((count($es['module']) == 1) && ($es['module'][0] == 0)) { if ((count($es['module']) == 1) && ($es['module'][0] == 0)) {
$module = ""; $module = "";
@ -538,6 +544,7 @@ switch ($action) {
$date = $es['date']; $date = $es['date'];
$inventory_modules = $es['inventory_modules']; $inventory_modules = $es['inventory_modules'];
$id_agents = $es['id_agents']; $id_agents = $es['id_agents'];
$recursion = $item['recursion'];
$idAgent = $es['id_agents']; $idAgent = $es['id_agents'];
$idAgentModule = $inventory_modules; $idAgentModule = $inventory_modules;
@ -549,6 +556,7 @@ switch ($action) {
$es = json_decode($item['external_source'], true); $es = json_decode($item['external_source'], true);
$inventory_modules = $es['inventory_modules']; $inventory_modules = $es['inventory_modules'];
$id_agents = $es['id_agents']; $id_agents = $es['id_agents'];
$recursion = $item['recursion'];
break; break;
case 'agent_configuration': case 'agent_configuration':
@ -557,6 +565,7 @@ switch ($action) {
case 'group_configuration': case 'group_configuration':
$group = $item['id_group']; $group = $item['id_group'];
$recursion = $item['recursion'];
break; break;
case 'netflow_area': case 'netflow_area':
@ -609,6 +618,7 @@ switch ($action) {
break; break;
} }
$urlForm = $config['homeurl'] . $urlForm = $config['homeurl'] .
'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=' . $actionParameter . '&id_report=' . $idReport; 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=' . $actionParameter . '&id_report=' . $idReport;
@ -914,7 +924,7 @@ You can of course remove the warnings, that's why we include the source and do n
html_print_select_groups($config['id_user'], html_print_select_groups($config['id_user'],
"RM", true, 'combo_group', $group, ''); "RM", true, 'combo_group', $group, '');
echo "&nbsp;&nbsp;&nbsp;".__('Recursion').html_print_checkbox('recursion', 1, 0, true); echo "&nbsp;&nbsp;&nbsp;".__('Recursion').html_print_checkbox('recursion', 1, $recursion, true);
?> ?>
</td> </td>
@ -1760,6 +1770,9 @@ function print_SLA_list($width, $action, $idItem = null) {
$itemsSLA = db_get_all_rows_filter( $itemsSLA = db_get_all_rows_filter(
'treport_content_sla_combined', 'treport_content_sla_combined',
array('id_report_content' => $idItem)); array('id_report_content' => $idItem));
if ($itemsSLA === false) { if ($itemsSLA === false) {
$itemsSLA = array(); $itemsSLA = array();
} }
@ -1971,6 +1984,9 @@ function print_General_list($width, $action, $idItem = null, $type = 'general')
$itemsGeneral = db_get_all_rows_filter( $itemsGeneral = db_get_all_rows_filter(
'treport_content_item', 'treport_content_item',
array('id_report_content' => $idItem)); array('id_report_content' => $idItem));
if ($itemsGeneral === false) { if ($itemsGeneral === false) {
$itemsGeneral = array(); $itemsGeneral = array();
} }

View File

@ -940,17 +940,22 @@ switch ($action) {
$report = db_get_row_filter('treport', $report = db_get_row_filter('treport',
array('id_report' => $idReport)); array('id_report' => $idReport));
$reportName = $report['name']; $reportName = $report['name'];
$idGroupReport = $report['id_group']; $idGroupReport = $report['id_group'];
$description = $report['description']; $description = $report['description'];
$good_format = false; $good_format = false;
switch ($action) { switch ($action) {
case 'update': case 'update':
$values = array(); $values = array();
$values['id_report'] = $idReport; $values['id_report'] = $idReport; //---------------------------------------------------
//$values['name'] = (string) get_parameter('name'); //$values['name'] = (string) get_parameter('name');
$values['description'] = get_parameter('description'); $values['description'] = get_parameter('description');
$values['type'] = get_parameter('type', null); $values['type'] = get_parameter('type', null);
$values['recursion'] = get_parameter('recursion', null);
$label = get_parameter('label', ''); $label = get_parameter('label', '');
//Add macros name //Add macros name
@ -1290,6 +1295,7 @@ switch ($action) {
} }
break; break;
case 'save': case 'save':
$values = array(); $values = array();
$values['id_report'] = $idReport; $values['id_report'] = $idReport;
$values['type'] = get_parameter('type', null); $values['type'] = get_parameter('type', null);
@ -1303,6 +1309,7 @@ switch ($action) {
$items_label['id_agent'] = get_parameter('id_agent'); $items_label['id_agent'] = get_parameter('id_agent');
$items_label['id_agent_module'] = get_parameter('id_agent_module'); $items_label['id_agent_module'] = get_parameter('id_agent_module');
$name_it = (string) get_parameter('name'); $name_it = (string) get_parameter('name');
$values['recursion'] = get_parameter('recursion', null);
$values['name'] = reporting_label_macro($items_label, $name_it); $values['name'] = reporting_label_macro($items_label, $name_it);
// Support for projection graph, prediction date and SLA reports // Support for projection graph, prediction date and SLA reports

View File

@ -686,8 +686,8 @@ $table_chars->data[$row][1] = html_print_select($options_full_escale, 'full_scal
$row++; $row++;
$table_chars->data[$row][0] = __('Soft graphs:'); $table_chars->data[$row][0] = __('Show only average');
$table_chars->data[$row][0] .= ui_print_help_tip(__('This option may cause performance issues'), true); $table_chars->data[$row][0] .= ui_print_help_tip(__('If enabled, the module graphs will only show the average value, otherwise it will show three sets of data showing maximums, averages and minimums.'), true);
$options_soft_graphs = array(); $options_soft_graphs = array();
$options_soft_graphs[0] = __('Standard mode'); $options_soft_graphs[0] = __('Standard mode');

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC180827'; $build_version = 'PC180831';
$pandora_version = 'v7.0NG.726'; $pandora_version = 'v7.0NG.726';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -842,11 +842,18 @@ function agents_get_group_agents (
users_get_groups(false, "AR", true, false, (array)$id_group)); users_get_groups(false, "AR", true, false, (array)$id_group));
} }
} }
// Search for primary and secondary groups
if (!empty($id_group)) { if (!empty($id_group)) {
$filter['id_grupo'] = $id_group; $filter[] = '(' . db_format_array_where_clause_sql(
array(
'id_group' => $id_group,
'id_grupo' => $id_group
),
'OR'
) . ')';
} }
if ($search === true) { if ($search === true) {
//No added search. Show both disabled and non-disabled //No added search. Show both disabled and non-disabled
} }
@ -959,8 +966,8 @@ function agents_get_group_agents (
$filter['order'] = 'alias'; $filter['order'] = 'alias';
if (is_metaconsole()) { if (is_metaconsole()) {
$table_name = 'tmetaconsole_agent'; $table_name = 'tmetaconsole_agent LEFT JOIN tmetaconsole_agent_secondary_group ON ta.id_agente = tasg.id_agent';
$fields = array( $fields = array(
'id_tagente AS id_agente', 'id_tagente AS id_agente',
'alias', 'alias',
@ -968,16 +975,16 @@ function agents_get_group_agents (
); );
} }
else { else {
$table_name = 'tagente'; $table_name = 'tagente LEFT JOIN tagent_secondary_group ON id_agente=id_agent';
$fields = array( $fields = array(
'id_agente', 'id_agente',
'alias' 'alias'
); );
} }
$result = db_get_all_rows_filter($table_name, $filter, $fields); $result = db_get_all_rows_filter($table_name, $filter, $fields);
if ($result === false) if ($result === false)
return array (); //Return an empty array return array (); //Return an empty array
@ -985,7 +992,6 @@ function agents_get_group_agents (
foreach ($result as $row) { foreach ($result as $row) {
if (!isset($row["id_agente"]) || !isset($row["alias"])) if (!isset($row["id_agente"]) || !isset($row["alias"]))
continue; continue;
if ($serialized && isset($row["id_server"])) { if ($serialized && isset($row["id_server"])) {
$key = $row["id_server"] . $separator . $row["id_agente"]; $key = $row["id_server"] . $separator . $row["id_agente"];
} elseif ($force_serialized) { } elseif ($force_serialized) {

View File

@ -2294,19 +2294,4 @@ function config_prepare_session() {
ini_set("post_max_size", $config["max_file_size"]); ini_set("post_max_size", $config["max_file_size"]);
ini_set("upload_max_filesize", $config["max_file_size"]); ini_set("upload_max_filesize", $config["max_file_size"]);
} }
function config_update_value_in_db ($token, $value) {
$inserted_value = db_get_value('value', 'tconfig', '`token`', $token);
if ($inserted_value === false) {
return db_process_sql_insert(
'tconfig',
array('value' => $value, 'token' => $token)
) !== false;
}
else {
return db_process_sql_update(
'tconfig', array('value' => $value), array('token' => $token)
) !== false;
}
}
?> ?>

View File

@ -1206,19 +1206,7 @@ function groups_get_agents_counter ($group, $agent_filter = array(), $module_fil
$groups_clause = "AND ta.id_grupo IN ($group_str)"; $groups_clause = "AND ta.id_grupo IN ($group_str)";
$tags_clause = ""; $tags_clause = "";
if ($strict_user && !empty($groups_and_tags)) {
foreach ($groups as $group_id) {
if (isset($groups_and_tags[$group_id]) && !empty($groups_and_tags[$group_id])) {
$tags_str = $groups_and_tags[$group_id];
$tags_clause .= " AND (ta.grupo <> $group_id
OR (ta.grupo = $group_id
AND tam.id_agente_modulo NOT IN (SELECT id_agente_modulo
FROM ttag_module
WHERE id_tag NOT IN ($tags_str) )))";
}
}
}
$agent_name_filter = ""; $agent_name_filter = "";
$agent_status = AGENT_STATUS_ALL; $agent_status = AGENT_STATUS_ALL;
if (!empty($agent_filter)) { if (!empty($agent_filter)) {
@ -1662,22 +1650,10 @@ function groups_get_monitors_counter ($group, $agent_filter = array(), $module_f
} }
$group_str = implode (",", $groups); $group_str = implode (",", $groups);
$groups_clause = "AND ta.id_grupo IN ($group_str)"; $groups_clause = "AND (ta.id_grupo IN ($group_str) OR tasg.id_group IN ($group_str))";
$tags_clause = ""; $tags_clause = "";
if ($strict_user && !empty($groups_and_tags)) {
foreach ($groups as $group_id) {
if (isset($groups_and_tags[$group_id]) && !empty($groups_and_tags[$group_id])) {
$tags_str = $groups_and_tags[$group_id];
$tags_clause .= " AND (ta.grupo <> $group_id
OR (ta.grupo = $group_id
AND tam.id_agente_modulo NOT IN (SELECT id_agente_modulo
FROM ttag_module
WHERE id_tag NOT IN ($tags_str) )))";
}
}
}
$agent_name_filter = ""; $agent_name_filter = "";
$agents_clause = ""; $agents_clause = "";
if (!empty($agent_filter)) { if (!empty($agent_filter)) {
@ -1775,36 +1751,38 @@ function groups_get_monitors_counter ($group, $agent_filter = array(), $module_f
$modules_clause $modules_clause
INNER JOIN tagente ta INNER JOIN tagente ta
ON tam.id_agente = ta.id_agente ON tam.id_agente = ta.id_agente
LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent
AND ta.disabled = 0 AND ta.disabled = 0
$agent_name_filter $agent_name_filter
$agents_clause $agents_clause
$groups_clause
WHERE tam.disabled = 0 WHERE tam.disabled = 0
$module_name_filter $module_name_filter
$groups_clause
$tags_clause"; $tags_clause";
} }
else { else {
$status_columns_array = array(); $status_columns_array = array();
foreach ($module_status_array as $status) { foreach ($status_array as $status) {
switch ($status) { switch ($status) {
case AGENT_MODULE_STATUS_CRITICAL_ALERT: case AGENT_MODULE_STATUS_CRITICAL_ALERT:
case AGENT_MODULE_STATUS_CRITICAL_BAD: case AGENT_MODULE_STATUS_CRITICAL_BAD:
$status_columns_array[] = 'ta.critical_count'; $status_columns_array['critical'] = 'critical_count';
break; break;
case AGENT_MODULE_STATUS_WARNING_ALERT: case AGENT_MODULE_STATUS_WARNING_ALERT:
case AGENT_MODULE_STATUS_WARNING: case AGENT_MODULE_STATUS_WARNING:
$status_columns_array[] = 'ta.warning_count'; $status_columns_array['warn'] = 'warning_count';
break; break;
case AGENT_MODULE_STATUS_UNKNOWN: case AGENT_MODULE_STATUS_UNKNOWN:
$status_columns_array[] = 'ta.unknown_count'; $status_columns_array['unk'] = 'unknown_count';
break; break;
case AGENT_MODULE_STATUS_NO_DATA: case AGENT_MODULE_STATUS_NO_DATA:
case AGENT_MODULE_STATUS_NOT_INIT: case AGENT_MODULE_STATUS_NOT_INIT:
$status_columns_array[] = 'ta.notinit_count'; $status_columns_array['notinit'] = 'notinit_count';
break; break;
case AGENT_MODULE_STATUS_NORMAL_ALERT: case AGENT_MODULE_STATUS_NORMAL_ALERT:
case AGENT_MODULE_STATUS_NORMAL: case AGENT_MODULE_STATUS_NORMAL:
$status_columns_array[] = 'ta.normal_count'; $status_columns_array['normal'] = 'normal_count';
break; break;
default: default:
// The type doesn't exist // The type doesn't exist
@ -1816,13 +1794,16 @@ function groups_get_monitors_counter ($group, $agent_filter = array(), $module_f
$status_columns_str = implode(",", $status_columns_array); $status_columns_str = implode(",", $status_columns_array);
$sql = "SELECT SUM($status_columns_str) $sql = "SELECT SUM($status_columns_str) FROM
FROM tagente ta (SELECT DISTINCT(ta.id_agente), $status_columns_str
FROM tagente ta LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent
WHERE ta.disabled = 0 WHERE ta.disabled = 0
$agent_name_filter $agent_name_filter
$agents_clause $agents_clause
$groups_clause $groups_clause
$tags_clause"; $tags_clause
) AS t1";
} }
$count = (int) db_get_sql ($sql); $count = (int) db_get_sql ($sql);

View File

@ -2869,7 +2869,7 @@ function reporting_alert_get_fired($id_agent_module, $id_alert_template_module,
if (empty($firedTimes)) { if (empty($firedTimes)) {
$firedTimes = array(); $firedTimes = array();
$firedTimes[0]['timestamp'] = '----------------------------'; $firedTimes[0]['timestamp'] = null;
} }
foreach ($firedTimes as $fireTime) { foreach ($firedTimes as $fireTime) {
@ -3010,7 +3010,10 @@ function reporting_alert_report_group($report, $content) {
(int) $report["datetime"]); (int) $report["datetime"]);
$module_actions["actions"] = $data_action; $module_actions["actions"] = $data_action;
if ($module_actions["template_fired"][0] !== null)
$data_row['alerts'][$ntemplates] = $module_actions; $data_row['alerts'][$ntemplates] = $module_actions;
else
$data_row = null;
$ntemplates++; $ntemplates++;
} }
@ -3127,7 +3130,10 @@ function reporting_alert_report_agent($report, $content) {
(int) $report["datetime"]); (int) $report["datetime"]);
$module_actions["actions"] = $data_action; $module_actions["actions"] = $data_action;
if ($module_actions["template_fired"][0] !== null)
$data_row['alerts'][$ntemplates] = $module_actions; $data_row['alerts'][$ntemplates] = $module_actions;
else
$data_row = null;
$ntemplates++; $ntemplates++;
} }
@ -3248,7 +3254,10 @@ function reporting_alert_report_module($report, $content) {
(int) $report["datetime"]); (int) $report["datetime"]);
$module_actions["actions"] = $data_action; $module_actions["actions"] = $data_action;
if ($module_actions["template_fired"][0] !== null)
$data_row['alerts'][$ntemplates] = $module_actions; $data_row['alerts'][$ntemplates] = $module_actions;
else
$data_row = null;
$ntemplates++; $ntemplates++;
} }
@ -6993,89 +7002,57 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
} }
if (!empty($group_array)) { if (!empty($group_array)) {
// FOR THE FUTURE: Split the groups into groups with tags restrictions and groups without it // Get monitor NOT INIT, except disabled AND async modules
// To calculate in the light way the non tag restricted and in the heavy way the others $data["monitor_not_init"] += (int) groups_get_not_init_monitors ($group_array, array(), array(), false, false, true);
/*
$group_restricted_data = tags_get_acl_tags($config['id_user'], $group_array, $access, 'data');
$tags_restricted_groups = array_keys($group_restricted_data);
$no_tags_restricted_groups = $group_array; // Get monitor OK, except disabled and non-init
foreach ($no_tags_restricted_groups as $k => $v) { $data["monitor_ok"] += (int) groups_get_normal_monitors ($group_array, array(), array(), false, false, true);
if (in_array($v, $tags_restricted_groups)) {
unset($no_tags_restricted_groups[$k]);
}
}
*/
if (!empty($group_array)) { // Get monitor CRITICAL, except disabled and non-init
// Get monitor NOT INIT, except disabled AND async modules $data["monitor_critical"] += (int) groups_get_critical_monitors ($group_array, array(), array(), false, false, true);
$data["monitor_not_init"] += (int) groups_get_not_init_monitors ($group_array, array(), array(), false, false, true);
// Get monitor OK, except disabled and non-init
$data["monitor_ok"] += (int) groups_get_normal_monitors ($group_array, array(), array(), false, false, true);
// Get monitor CRITICAL, except disabled and non-init
$data["monitor_critical"] += (int) groups_get_critical_monitors ($group_array, array(), array(), false, false, true);
// Get monitor WARNING, except disabled and non-init
$data["monitor_warning"] += (int) groups_get_warning_monitors ($group_array, array(), array(), false, false, true);
// Get monitor UNKNOWN, except disabled and non-init
$data["monitor_unknown"] += (int) groups_get_unknown_monitors ($group_array, array(), array(), false, false, true);
// Get alerts configured, except disabled
$data["monitor_alerts"] += groups_monitor_alerts ($group_array) ;
// Get alert configured currently FIRED, except disabled
$data["monitor_alerts_fired"] += groups_monitor_fired_alerts ($group_array);
// Calculate totals using partial counts from above
// Get TOTAL non-init modules, except disabled ones and async modules
$data["total_not_init"] += $data["monitor_not_init"];
// Get TOTAL agents in a group // Get monitor WARNING, except disabled and non-init
$data["total_agents"] += (int) groups_get_total_agents ($group_array, array(), array(), false, false, true); $data["monitor_warning"] += (int) groups_get_warning_monitors ($group_array, array(), array(), false, false, true);
// Get Agents OK
$data["agent_ok"] += (int) groups_get_normal_agents ($group_array, array(), array(), false, false, true);
// Get Agents Warning
$data["agent_warning"] += (int) groups_get_warning_agents ($group_array, array(), array(), false, false, true);
// Get Agents Critical
$data["agent_critical"] += (int) groups_get_critical_agents ($group_array, array(), array(), false, false, true);
// Get Agents Unknown
$data["agent_unknown"] += (int) groups_get_unknown_agents ($group_array, array(), array(), false, false, true);
// Get Agents Not init
$data["agent_not_init"] += (int) groups_get_not_init_agents ($group_array, array(), array(), false, false, true);
}
// Get monitor UNKNOWN, except disabled and non-init
$data["monitor_unknown"] += (int) groups_get_unknown_monitors ($group_array, array(), array(), false, false, true);
// Get alerts configured, except disabled
$data["monitor_alerts"] += groups_monitor_alerts ($group_array) ;
// Get alert configured currently FIRED, except disabled
$data["monitor_alerts_fired"] += groups_monitor_fired_alerts ($group_array);
// Calculate totals using partial counts from above
// Get TOTAL non-init modules, except disabled ones and async modules
$data["total_not_init"] += $data["monitor_not_init"];
// Get TOTAL agents in a group
$data["total_agents"] += (int) groups_get_total_agents ($group_array, array(), array(), false, false, true);
// Get Agents OK
$data["agent_ok"] += (int) groups_get_normal_agents ($group_array, array(), array(), false, false, true);
// Get Agents Warning
$data["agent_warning"] += (int) groups_get_warning_agents ($group_array, array(), array(), false, false, true);
// Get Agents Critical
$data["agent_critical"] += (int) groups_get_critical_agents ($group_array, array(), array(), false, false, true);
// Get Agents Unknown
$data["agent_unknown"] += (int) groups_get_unknown_agents ($group_array, array(), array(), false, false, true);
// Get Agents Not init
$data["agent_not_init"] += (int) groups_get_not_init_agents ($group_array, array(), array(), false, false, true);
// Get total count of monitors for this group, except disabled. // Get total count of monitors for this group, except disabled.
$data["monitor_checks"] = $data["monitor_not_init"] + $data["monitor_unknown"] + $data["monitor_warning"] + $data["monitor_critical"] + $data["monitor_ok"]; $data["monitor_checks"] += $data["monitor_not_init"] + $data["monitor_unknown"] + $data["monitor_warning"] + $data["monitor_critical"] + $data["monitor_ok"];
// Calculate not_normal monitors
$data["monitor_not_normal"] += $data["monitor_checks"] - $data["monitor_ok"];
} }
// Get total count of monitors for this group, except disabled.
$data["monitor_checks"] = $data["monitor_not_init"] + $data["monitor_unknown"] + $data["monitor_warning"] + $data["monitor_critical"] + $data["monitor_ok"];
/*
Monitor health (percentage)
Data health (percentage)
Global health (percentage)
Module sanity (percentage)
Alert level (percentage)
Server Sanity 0% Uninitialized modules
*/
} }
// Calculate not_normal monitors
$data["monitor_not_normal"] += $data["monitor_checks"] - $data["monitor_ok"];
if ($data["monitor_unknown"] > 0 && $data["monitor_checks"] > 0) { if ($data["monitor_unknown"] > 0 && $data["monitor_checks"] > 0) {
$data["monitor_health"] = format_numeric (100 - ($data["monitor_not_normal"] / ($data["monitor_checks"] / 100)), 1); $data["monitor_health"] = format_numeric (100 - ($data["monitor_not_normal"] / ($data["monitor_checks"] / 100)), 1);
} }

View File

@ -166,7 +166,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
'bars_graph', 'bars_graph',
'clock'); 'clock');
$form_items['label_row']['html'] = $form_items['label_row']['html'] =
'<td align="left" valign="top" style="">' . __('Label') . ' '<td align="left" valign="top" style="">' . __('Label') . ui_print_help_icon ('macros_visual_maps', true) . '
<div id="label_box_arrow" style="text-align:center;width:120px;height:110px;margin-top:50px;"> <div id="label_box_arrow" style="text-align:center;width:120px;height:110px;margin-top:50px;">
<span>Label position</span> <span>Label position</span>

View File

@ -0,0 +1,19 @@
<?php
/**
* @package Include/help/en
*/
?>
<h1>Visual console's macros</h1>
It is possible to enter a macro in the text box when editing an element of the visual console.
<br /><br />
List of visual console's macros:
<ul>
<li>_date_: Displays the date using the local PHP format. </li>
<li>_time_: Displays the time using the local PHP format. </li>
<li>_agent_: Displays the alias of the selected agent. </li>
<li>_module_: Displays the name of the selected module. </li>
<li>_agentdescription_: Displays the description of the selected agent. </li>
<li>_address_: Displays the ip address of the selected agent. </li>
<li>_moduledescription_: Displays the description of the selected module. </li>
</ul>

View File

@ -0,0 +1,19 @@
<?php
/**
* @package Include/help/es
*/
?>
<h1>Macros de consolas visuales</h1>
Es posible introducir una macro en el cuadro de texto al editar un elemento de la consola visual.
<br /><br />
Lista de macros de consolas visuales:
<ul>
<li>_date_ : Muestra la fecha usando el formato local del PHP.</li>
<li>_time_ : Muestra la hora usando el formato local del PHP.</li>
<li>_agent_ : Muestra el alias del agente seleccionado.</li>
<li>_module_ : Muestra el nombre del módulo seleccionado.</li>
<li>_agentdescription_ : Muestra la descripción del agente seleccionado.</li>
<li>_address_ : Muestra la dirección ip del agente seleccionado.</li>
<li>_moduledescription_ : Muestra la descripción del módulo seleccionado.</li>
</ul>

View File

@ -33958,7 +33958,7 @@ msgid "Cluster type"
msgstr "" msgstr ""
#: ../../enterprise/godmode/reporting/cluster_builder.main.php:258 #: ../../enterprise/godmode/reporting/cluster_builder.main.php:258
msgid "Ative - Active" msgid "Active - Active"
msgstr "" msgstr ""
#: ../../enterprise/godmode/reporting/cluster_builder.main.php:259 #: ../../enterprise/godmode/reporting/cluster_builder.main.php:259

View File

@ -34245,7 +34245,7 @@ msgid "Cluster type"
msgstr "" msgstr ""
#: ../../enterprise/godmode/reporting/cluster_builder.main.php:258 #: ../../enterprise/godmode/reporting/cluster_builder.main.php:258
msgid "Ative - Active" msgid "Active - Active"
msgstr "" msgstr ""
#: ../../enterprise/godmode/reporting/cluster_builder.main.php:259 #: ../../enterprise/godmode/reporting/cluster_builder.main.php:259

View File

@ -33343,7 +33343,7 @@ msgid "Cluster type"
msgstr "クラスタタイプ" msgstr "クラスタタイプ"
#: ../../enterprise/godmode/reporting/cluster_builder.main.php:258 #: ../../enterprise/godmode/reporting/cluster_builder.main.php:258
msgid "Ative - Active" msgid "Active - Active"
msgstr "アクティブ - アクティブ" msgstr "アクティブ - アクティブ"
#: ../../enterprise/godmode/reporting/cluster_builder.main.php:259 #: ../../enterprise/godmode/reporting/cluster_builder.main.php:259

View File

@ -202,9 +202,9 @@ $process_login = false;
// Update user password // Update user password
$change_pass = get_parameter_post('renew_password', 0); $change_pass = get_parameter_post('renew_password', 0);
if ($change_pass == 1) {
if ($change_pass == 1) {
$password_old = (string) get_parameter_post ('old_password', ''); $password_old = (string) get_parameter_post ('old_password', '');
$password_new = (string) get_parameter_post ('new_password', ''); $password_new = (string) get_parameter_post ('new_password', '');
$password_confirm = (string) get_parameter_post ('confirm_new_password', ''); $password_confirm = (string) get_parameter_post ('confirm_new_password', '');

View File

@ -71,7 +71,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.726'; $version = '7.0NG.726';
$build = '180827'; $build = '180831';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -42,6 +42,8 @@ $enterpriseHook = enterprise_include('mobile/include/enterprise.class.php');
$enterpriseHook = enterprise_include('mobile/operation/dashboard.php'); $enterpriseHook = enterprise_include('mobile/operation/dashboard.php');
$enterpriseHook = enterprise_include('mobile/operation/home.php'); $enterpriseHook = enterprise_include('mobile/operation/home.php');
$is_mobile=true;
if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) { if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) {
$query = ''; $query = '';
if (sizeof ($_REQUEST)) if (sizeof ($_REQUEST))
@ -116,6 +118,13 @@ if ($action != "ajax") {
} }
} }
if ($user->isLogged()) {
if (file_exists ("../enterprise/load_enterprise.php")) {
include_once ("../enterprise/load_enterprise.php");
}
}
switch ($action) { switch ($action) {
case 'ajax': case 'ajax':
$parameter1 = $system->getRequest('parameter1', false); $parameter1 = $system->getRequest('parameter1', false);
@ -169,6 +178,11 @@ switch ($action) {
break; break;
case 'login': case 'login':
if ($user->login() && $user->isLogged()) { if ($user->login() && $user->isLogged()) {
if (file_exists ("../enterprise/load_enterprise.php")) {
include_once ("../enterprise/load_enterprise.php");
}
if ($user->isWaitingDoubleAuth()) { if ($user->isWaitingDoubleAuth()) {
if ($user->validateDoubleAuthCode()) { if ($user->validateDoubleAuthCode()) {
// Logged. Refresh the page // Logged. Refresh the page
@ -192,6 +206,12 @@ switch ($action) {
break; break;
case 'double_auth': case 'double_auth':
if ($user->isLogged()) { if ($user->isLogged()) {
if (file_exists ("../enterprise/load_enterprise.php")) {
include_once ("../enterprise/load_enterprise.php");
}
if ($user->validateDoubleAuthCode()) { if ($user->validateDoubleAuthCode()) {
$user_language = get_user_language ($system->getConfig('id_user')); $user_language = get_user_language ($system->getConfig('id_user'));
if (file_exists ('../include/languages/'.$user_language.'.mo')) { if (file_exists ('../include/languages/'.$user_language.'.mo')) {
@ -358,4 +378,8 @@ switch ($action) {
} }
break; break;
} }
?> ?>

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.726 %define version 7.0NG.726
%define release 180827 %define release 180831
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.726 %define version 7.0NG.726
%define release 180827 %define release 180831
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -1289,6 +1289,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`lapse` int(11) UNSIGNED NOT NULL default '300', `lapse` int(11) UNSIGNED NOT NULL default '300',
`visual_format` tinyint(1) UNSIGNED NOT NULL default '0', `visual_format` tinyint(1) UNSIGNED NOT NULL default '0',
`hide_no_data` tinyint(1) default 0, `hide_no_data` tinyint(1) default 0,
`recursion` tinyint(1) default NULL,
PRIMARY KEY(`id_rc`), PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.726-180827 Version: 7.0NG.726-180831
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.726-180827" pandora_version="7.0NG.726-180831"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.726"; my $pandora_version = "7.0NG.726";
my $pandora_build = "180827"; my $pandora_build = "180831";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -1624,16 +1624,19 @@ sub pandora_process_module ($$$$$$$$$;$) {
my $save = ($module->{'history_data'} == 1 && ($agent_status->{'datos'} ne $processed_data || $last_try < ($utimestamp - 86400))) ? 1 : 0; my $save = ($module->{'history_data'} == 1 && ($agent_status->{'datos'} ne $processed_data || $last_try < ($utimestamp - 86400))) ? 1 : 0;
db_do ($dbh, 'UPDATE tagente_estado # Never update tagente_estado when processing out-of-order data.
SET datos = ?, estado = ?, known_status = ?, last_status = ?, last_known_status = ?, if ($utimestamp >= $last_try) {
status_changes = ?, utimestamp = ?, timestamp = ?, db_do ($dbh, 'UPDATE tagente_estado
id_agente = ?, current_interval = ?, running_by = ?, SET datos = ?, estado = ?, known_status = ?, last_status = ?, last_known_status = ?,
last_execution_try = ?, last_try = ?, last_error = ?, status_changes = ?, utimestamp = ?, timestamp = ?,
ff_start_utimestamp = ? id_agente = ?, current_interval = ?, running_by = ?,
WHERE id_agente_modulo = ?', $processed_data, $status, $status, $new_status, $new_status, $status_changes, last_execution_try = ?, last_try = ?, last_error = ?,
$current_utimestamp, $timestamp, $module->{'id_agente'}, $current_interval, $server_id, ff_start_utimestamp = ?
$utimestamp, ($save == 1) ? $timestamp : $agent_status->{'last_try'}, $last_error, $ff_start_utimestamp, $module->{'id_agente_modulo'}); WHERE id_agente_modulo = ?', $processed_data, $status, $status, $new_status, $new_status, $status_changes,
$current_utimestamp, $timestamp, $module->{'id_agente'}, $current_interval, $server_id,
$utimestamp, ($save == 1) ? $timestamp : $agent_status->{'last_try'}, $last_error, $ff_start_utimestamp, $module->{'id_agente_modulo'});
}
# Save module data. Async and log4x modules are not compressed. # Save module data. Async and log4x modules are not compressed.
if ($module_type =~ m/(async)|(log4x)/ || $save == 1) { if ($module_type =~ m/(async)|(log4x)/ || $save == 1) {
save_module_data ($data_object, $module, $module_type, $utimestamp, $dbh); save_module_data ($data_object, $module, $module_type, $utimestamp, $dbh);
@ -4650,6 +4653,9 @@ sub pandora_group_statistics ($$) {
# Get all groups # Get all groups
my @groups = get_db_rows ($dbh, 'SELECT id_grupo FROM tgrupo'); my @groups = get_db_rows ($dbh, 'SELECT id_grupo FROM tgrupo');
my $table = is_metaconsole($pa_config) ? 'tmetaconsole_agent' : 'tagente'; my $table = is_metaconsole($pa_config) ? 'tmetaconsole_agent' : 'tagente';
my $sec_table = is_metaconsole($pa_config)
? 'tmetaconsole_agent_secondary_group'
: 'tagent_secondary_group';
# For each valid group get the stats: Simple uh? # For each valid group get the stats: Simple uh?
foreach my $group_row (@groups) { foreach my $group_row (@groups) {
@ -4658,30 +4664,49 @@ sub pandora_group_statistics ($$) {
# NOTICE - Calculations done here MUST BE the same than used in PHP code to have # NOTICE - Calculations done here MUST BE the same than used in PHP code to have
# the same criteria. PLEASE, double check any changes here and in functions_groups.php # the same criteria. PLEASE, double check any changes here and in functions_groups.php
$agents_unknown = get_db_value ($dbh, "SELECT COUNT(*) FROM $table WHERE disabled=0 AND critical_count=0 AND warning_count=0 AND unknown_count>0 AND id_grupo=?", $group); $agents_unknown = get_db_value ($dbh, "SELECT COUNT(DISTINCT(id_agente))
FROM $table LEFT JOIN $sec_table ON id_agente=id_agent
WHERE disabled=0 AND critical_count=0 AND warning_count=0 AND unknown_count>0 AND (id_grupo=? OR id_group=?)", $group, $group);
$agents_unknown = 0 unless defined ($agents_unknown); $agents_unknown = 0 unless defined ($agents_unknown);
$agents = get_db_value ($dbh, "SELECT COUNT(*) FROM $table WHERE id_grupo = $group AND disabled=0"); $agents = get_db_value ($dbh, "SELECT COUNT(DISTINCT(id_agente))
FROM $table LEFT JOIN $sec_table ON id_agente=id_agent
WHERE(id_grupo=$group OR id_group=$group) AND disabled=0");
$agents = 0 unless defined ($agents); $agents = 0 unless defined ($agents);
$modules = get_db_value ($dbh, "SELECT SUM(total_count) FROM $table WHERE disabled=0 AND id_grupo=?", $group); $modules = get_db_value ($dbh, "SELECT SUM(total_count) FROM
(
SELECT DISTINCT(id_agente), total_count
FROM $table LEFT JOIN $sec_table ON id_agente=id_agent
WHERE disabled=0 AND (id_grupo=? OR id_group=?)
) AS t1", $group, $group);
$modules = 0 unless defined ($modules); $modules = 0 unless defined ($modules);
$normal = get_db_value ($dbh, "SELECT COUNT(*) FROM $table WHERE disabled=0 AND critical_count=0 AND warning_count=0 AND unknown_count=0 AND normal_count>0 AND id_grupo=?", $group); $normal = get_db_value ($dbh, "SELECT COUNT(DISTINCT(id_agente))
FROM $table LEFT JOIN $sec_table ON id_agente=id_agent
WHERE disabled=0 AND critical_count=0 AND warning_count=0 AND unknown_count=0 AND normal_count>0 AND (id_grupo=? OR id_group=?)", $group, $group);
$normal = 0 unless defined ($normal); $normal = 0 unless defined ($normal);
$critical = get_db_value ($dbh, "SELECT COUNT(*) FROM $table WHERE disabled=0 AND critical_count>0 AND id_grupo=?", $group); $critical = get_db_value ($dbh, "SELECT COUNT(DISTINCT(id_agente))
FROM $table LEFT JOIN $sec_table ON id_agente=id_agent
WHERE disabled=0 AND critical_count>0 AND (id_grupo=? OR id_group=?)", $group, $group);
$critical = 0 unless defined ($critical); $critical = 0 unless defined ($critical);
$warning = get_db_value ($dbh, "SELECT COUNT(*) FROM $table WHERE disabled=0 AND critical_count=0 AND warning_count>0 AND id_grupo=?", $group); $warning = get_db_value ($dbh, "SELECT COUNT(DISTINCT(id_agente))
FROM $table LEFT JOIN $sec_table ON id_agente=id_agent
WHERE disabled=0 AND critical_count=0 AND warning_count>0 AND (id_grupo=? OR id_group=?)", $group, $group);
$warning = 0 unless defined ($warning); $warning = 0 unless defined ($warning);
$unknown = get_db_value ($dbh, "SELECT COUNT(*) FROM $table WHERE disabled=0 AND critical_count=0 AND warning_count=0 AND unknown_count>0 AND id_grupo=?", $group); $unknown = get_db_value ($dbh, "SELECT COUNT(DISTINCT(id_agente))
FROM $table LEFT JOIN $sec_table ON id_agente=id_agent
WHERE disabled=0 AND critical_count=0 AND warning_count=0 AND unknown_count>0 AND (id_grupo=? OR id_group=?)", $group, $group);
$unknown = 0 unless defined ($unknown); $unknown = 0 unless defined ($unknown);
$non_init = get_db_value ($dbh, "SELECT COUNT(*) FROM $table WHERE disabled=0 AND total_count=notinit_count AND id_grupo=?", $group); $non_init = get_db_value ($dbh, "SELECT COUNT(DISTINCT(id_agente))
FROM $table LEFT JOIN $sec_table ON id_agente=id_agent
WHERE disabled=0 AND total_count=notinit_count AND (id_grupo=? OR id_group=?)", $group, $group);
$non_init = 0 unless defined ($non_init); $non_init = 0 unless defined ($non_init);
# Total alert count not available on the meta console. # Total alert count not available on the meta console.
if ($table eq 'tagente') { if ($table eq 'tagente') {
$alerts = get_db_value ($dbh, "SELECT COUNT(talert_template_modules.id) $alerts = get_db_value ($dbh, "SELECT COUNT(talert_template_modules.id)

View File

@ -153,7 +153,7 @@ sub data_consumer ($$) {
return unless defined $agent; return unless defined $agent;
# Use the smallest timeout # Use the smallest timeout
my $timeout = (($plugin->{'max_timeout'} < $pa_config->{'plugin_timeout'}) && $pa_config->{'max_timeout'}) ? my $timeout = (($plugin->{'max_timeout'} < $pa_config->{'plugin_timeout'}) && $plugin->{'max_timeout'}) ?
$plugin->{'max_timeout'} : $pa_config->{'plugin_timeout'}; $plugin->{'max_timeout'} : $pa_config->{'plugin_timeout'};
# Setting default timeout if is invalid # Setting default timeout if is invalid

View File

@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.726"; my $pandora_version = "7.0NG.726";
my $pandora_build = "180827"; my $pandora_build = "180831";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.726 %define version 7.0NG.726
%define release 180827 %define release 180831
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.726 %define version 7.0NG.726
%define release 180827 %define release 180831
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.726" PI_VERSION="7.0NG.726"
PI_BUILD="180827" PI_BUILD="180831"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.726 PS180827"; my $version = "7.0NG.726 PS180831";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.726 PS180827"; my $version = "7.0NG.726 PS180831";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);