From 958930931e5ffcea9c7d18f3f3d53fea29d1f3c9 Mon Sep 17 00:00:00 2001 From: danielmaya Date: Wed, 3 Oct 2018 10:42:59 +0200 Subject: [PATCH 01/16] Fixed filter group in agents/modules view --- pandora_console/include/functions_agents.php | 4 ++ .../operation/agentes/ver_agente.php | 48 ++----------------- 2 files changed, 9 insertions(+), 43 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 426a5c2e6b..a077f1ef45 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -912,6 +912,10 @@ function agents_get_group_agents ( unset ($search["alias"]); } + if (isset($search['id_os'])) { + $filter[] = "id_os = ". $search['id_os']; + } + if (isset($search['status'])) { switch ($search['status']) { case AGENT_STATUS_NORMAL: diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 49011d540d..05ea2532a1 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -60,21 +60,8 @@ if (is_ajax ()) { $keys_prefix = (string) get_parameter ('keys_prefix', ''); $status_agents = (int)get_parameter('status_agents', AGENT_STATUS_ALL); - if ($id_group > 0) { - $groups = array($id_group); - if ($recursion === 'true' || $recursion == 1 ) { - $groups = array_merge($groups, - groups_get_id_recursive($id_group, true)); - } - } - else { - $groups_orig = users_get_groups(false, $privilege); - $groups = array_keys($groups_orig); - } - // Build filter $filter = array(); - $filter['id_grupo'] = $groups; if (!empty($id_os)) $filter['id_os'] = $id_os; @@ -83,27 +70,7 @@ if (is_ajax ()) { if (!empty($agent_alias)) $filter['alias'] = '%' . $agent_alias . '%'; - switch ($status_agents) { - case AGENT_STATUS_NORMAL: - $filter[] = "(normal_count = total_count)"; - break; - case AGENT_STATUS_WARNING: - $filter[] = "(critical_count = 0 AND warning_count > 0)"; - break; - case AGENT_STATUS_CRITICAL: - $filter[] = "(critical_count > 0)"; - break; - case AGENT_STATUS_UNKNOWN: - $filter[] = "(critical_count = 0 AND warning_count = 0 AND unknown_count > 0)"; - break; - case AGENT_STATUS_NOT_NORMAL: - $filter[] = "(normal_count <> total_count)"; - break; - case AGENT_STATUS_NOT_INIT: - $filter[] = "(notinit_count = total_count)"; - break; - } - $filter['order'] = "alias ASC"; + $filter['status'] = $status_agents; if($cluster_mode){ @@ -141,23 +108,18 @@ if (is_ajax ()) { } } - - // Build fields - $fields = array('id_agente', 'alias'); // Perform search - $agents = db_get_all_rows_filter('tagente', $filter, $fields); + $agents = agents_get_group_agents($id_group,$filter,"lower",false,false,false,'|',$cluster_mode); if (empty($agents)) $agents = array(); - - foreach ($agents as $k => $v) { - $agents[$k] = io_safe_output($v); - } // Add keys prefix if ($keys_prefix !== '') { + $i = 0; foreach ($agents as $k => $v) { - $agents[$keys_prefix . $k] = io_safe_output($v); + $agents[$keys_prefix . $i] = array('id_agente' => $k, 'alias' => io_safe_output($v)); unset($agents[$k]); + $i++; } } From 561bce71ce87b73daaaa5cf56a214c31406aaecd Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Wed, 17 Oct 2018 12:49:11 +0200 Subject: [PATCH 02/16] Changed error and success messages - #2900 --- pandora_console/operation/users/user_edit.php | 46 ++++++++++++++----- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 83b69c85d2..7b7fae2577 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -131,36 +131,58 @@ if (isset ($_GET["modified"]) && !$view_mode) { if ($return) { $return2 = save_pass_history($id, $password_new); } - ui_print_result_message ($return, + /*ui_print_result_message ($return, __('Password successfully updated'), - __('Error updating passwords: %s', $config['auth_error'])); + __('Error updating passwords: %s', $config['auth_error']));*/ } } else { $return = update_user_password ($id, $password_new); - ui_print_result_message ($return, + /*ui_print_result_message ($return, __('Password successfully updated'), - __('Error updating passwords: %s', $config['auth_error'])); + __('Error updating passwords: %s', $config['auth_error']));*/ } } elseif ($password_new !== "NON-INIT") { - ui_print_error_message (__('Passwords didn\'t match or other problem encountered while updating passwords')); + // ui_print_error_message (__('Passwords didn\'t match or other problem encountered while updating passwords')); + $error_msg='Passwords didn\'t match or other problem encountered while updating passwords'; } } + elseif(empty($password_new) && empty($password_confirm)){ + $return=true; + } + elseif(empty($password_new) || empty($password_confirm)){ + $return=false; + } // No need to display "error" here, because when no update is needed (no changes in data) // SQL function returns 0 (FALSE), but is not an error, just no change. Previous error // message could be confussing to the user. - $return = update_user ($id, $upd_info); - if ($return > 0) { - ui_print_result_message ($return, - __('User info successfully updated'), - __('Error updating user info')); + if($return){ + $success_msg = 'Password successfully updated'; + + $return_update_user = update_user ($id, $upd_info); + + if ($return_update_user === false) { + $error_msg='Error updating user info'; + } + elseif($return_update_user == true){ + $success_msg = 'User info successfully updated'; + } + + $user_info = $upd_info; } - - $user_info = $upd_info; + else{ + if(!$error_msg){ + $error_msg='Error updating passwords: '; + } + + $user_auth_error= $config['auth_error']; + } + + ui_print_result_message ($return, $success_msg, $error_msg,$user_auth_error); } // Prints action status for current message From 0b22ab6bfd46e952dc1c541b047e89fb07c81b16 Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Wed, 17 Oct 2018 12:57:02 +0200 Subject: [PATCH 03/16] Minor bug fixed - #2900 --- pandora_console/operation/users/user_edit.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 7b7fae2577..adf7a8ae58 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -146,7 +146,7 @@ if (isset ($_GET["modified"]) && !$view_mode) { } elseif ($password_new !== "NON-INIT") { // ui_print_error_message (__('Passwords didn\'t match or other problem encountered while updating passwords')); - $error_msg='Passwords didn\'t match or other problem encountered while updating passwords'; + $error_msg = __('Passwords didn\'t match or other problem encountered while updating passwords'); } } elseif(empty($password_new) && empty($password_confirm)){ @@ -159,24 +159,24 @@ if (isset ($_GET["modified"]) && !$view_mode) { // No need to display "error" here, because when no update is needed (no changes in data) // SQL function returns 0 (FALSE), but is not an error, just no change. Previous error // message could be confussing to the user. - + if($return){ - $success_msg = 'Password successfully updated'; + $success_msg = __('Password successfully updated'); $return_update_user = update_user ($id, $upd_info); if ($return_update_user === false) { - $error_msg='Error updating user info'; + $error_msg = __('Error updating user info'); } elseif($return_update_user == true){ - $success_msg = 'User info successfully updated'; + $success_msg = __('User info successfully updated'); } $user_info = $upd_info; } else{ if(!$error_msg){ - $error_msg='Error updating passwords: '; + $error_msg = __('Error updating passwords: %s'); } $user_auth_error= $config['auth_error']; From 525caee909df2227f239d44f56c6266831962990 Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Wed, 17 Oct 2018 12:59:37 +0200 Subject: [PATCH 04/16] Fixed a minor mistake in error message - #2900 --- pandora_console/operation/users/user_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index adf7a8ae58..d3b17a2a3e 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -176,7 +176,7 @@ if (isset ($_GET["modified"]) && !$view_mode) { } else{ if(!$error_msg){ - $error_msg = __('Error updating passwords: %s'); + $error_msg = __('Error updating passwords: '); } $user_auth_error= $config['auth_error']; From 8fe82add30d90192f71dc66cfb0bb0fd474252b4 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 30 Oct 2018 17:53:57 +0100 Subject: [PATCH 05/16] ondemand pluginTools, pandora_df inodes, cde functions_api cluster options --- pandora_agents/unix/plugins/pandora_df | 65 +++++++++++++++++--- pandora_console/include/functions_api.php | 9 ++- pandora_server/lib/PandoraFMS/PluginTools.pm | 48 ++++++++------- 3 files changed, 89 insertions(+), 33 deletions(-) diff --git a/pandora_agents/unix/plugins/pandora_df b/pandora_agents/unix/plugins/pandora_df index e03da5dfb4..261e365970 100755 --- a/pandora_agents/unix/plugins/pandora_df +++ b/pandora_agents/unix/plugins/pandora_df @@ -25,12 +25,33 @@ ############################################################################### use strict; +use warnings; # Retrieve information from all filesystems my $all_filesystems = 0; # Regex flag my $regex_mode = 0; +my $inode_mode = 0; + +# Exclusion +my @exclude_fs = (); +my $cmd = undef; + + +sub in_array { + my ($array, $value) = @_; + + if (!defined($value)) { + return 0; + } + + my %params = map { $_ => 1 } @{$array}; + if (exists($params{$value})) { + return 1; + } + return 0; +} sub check_re($$){ my $item = shift; @@ -65,10 +86,24 @@ if ($#ARGV < 0) { $all_filesystems = 1; } -# Check if regex mode is enabled -if ($ARGV[0] eq "-r") { - $regex_mode = 1; - shift @ARGV; +while ($#ARGV >= 0) { + my $param = shift @ARGV; + if ($param eq '-r') { + $regex_mode = 1; + shift @ARGV; + } + elsif ($param eq '-i') { + $inode_mode = 1; + } + elsif ($param eq '-exclude_fs') { + my $_tmp = shift @ARGV; + chomp ($_tmp); + @exclude_fs = split /,/, $_tmp; + } + elsif ($param eq '-custom_cmd') { + $cmd = shift @ARGV; + chomp ($cmd); + } } # Parse command line parameters @@ -90,7 +125,15 @@ if ($onlyexclude) { # Retrieve filesystem information # -P use the POSIX output format for portability -my @df = `df -P`; + + +$cmd = 'df -PT' unless defined($cmd); + +if ($inode_mode > 0) { + $cmd = 'df -PTi'; +} + +my @df = `$cmd`; shift (@df); # No filesystems? Something went wrong. @@ -102,9 +145,13 @@ my %out; # Parse filesystem usage foreach my $row (@df) { my @columns = split (' ', $row); - exit 1 if ($#columns < 4); - if (check_in (\%filesystems,$columns[0]) || ($all_filesystems == 1 && !check_in(\%excluded_filesystems,$columns[0]) )) { - $out{$columns[0]} = $columns[4] ; + exit 1 if ($#columns < 5); + + next if (in_array(\@exclude_fs, $columns[1]) > 0); + + if (check_in (\%filesystems,$columns[0]) + || ($all_filesystems == 1 && !check_in(\%excluded_filesystems,$columns[0])) ){ + $out{$columns[0]} = $columns[5] ; } } @@ -115,7 +162,7 @@ while (my ($filesystem, $use) = each (%out)) { # Print module output print "\n"; - print "\n"; + print " 0 ? 'Inodes:' : '') . $filesystem . "]]>\n"; print "\n"; print "\n"; print "\n"; diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 479929c619..b4195e1d5d 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -10869,12 +10869,17 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) { else db_pandora_audit("Report management", "Failed to create cluster agent $name"); - returnData('string', - array('type' => 'string', 'data' => (int)$id_cluster)); + if ($id_cluster !== false) + returnData('string', + array('type' => 'string', 'data' => (int)$id_cluster)); + else + returnError('error_set_new_cluster', __('Failed to create cluster.')); } else { returnError('error_set_new_cluster', __('Agent name cannot be empty.')); return; } + + return; } function api_set_add_cluster_agent($thrash1, $thrash2, $other, $thrash3) { diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index 44a16037e7..9269297334 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -1905,16 +1905,18 @@ sub snmp_walk { $timeout = $snmp->{timeout}; } + $snmp->{extra} = '' unless defined $snmp->{extra}; + if ( defined ($snmp->{version} ) && (($snmp->{version} eq "1") || ($snmp->{version} eq "2") || ($snmp->{version} eq "2c"))) { if (defined $snmp->{port}){ - $cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -c $snmp->{community} $snmp->{host}:$snmp->{port} $snmp->{oid}"; + $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -c $snmp->{community} $snmp->{host}:$snmp->{port} $snmp->{oid}"; } else { - $cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -c $snmp->{community} $snmp->{host} $snmp->{oid}"; + $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -c $snmp->{community} $snmp->{host} $snmp->{oid}"; } } @@ -1925,42 +1927,42 @@ sub snmp_walk { # $securityLevel = (noAuthNoPriv|authNoPriv|authPriv); # unauthenticated request - # Ex. snmpwalk -t $timeout -On -v 3 -n "" -u noAuthUser -l noAuthNoPriv test.net-snmp.org sysUpTime + # Ex. snmpwalk -t $timeout $snmp->{extra} -On -v 3 -n "" -u noAuthUser -l noAuthNoPriv test.net-snmp.org sysUpTime # authenticated request - # Ex. snmpwalk -t $timeout -On -v 3 -n "" -u MD5User -a MD5 -A "The Net-SNMP Demo Password" -l authNoPriv test.net-snmp.org sysUpTime + # Ex. snmpwalk -t $timeout $snmp->{extra} -On -v 3 -n "" -u MD5User -a MD5 -A "The Net-SNMP Demo Password" -l authNoPriv test.net-snmp.org sysUpTime # authenticated and encrypted request - # Ex. snmpwalk -t $timeout -On -v 3 -n "" -u MD5DESUser -a MD5 -A "The Net-SNMP Demo Password" -x DES -X "The Net-SNMP Demo Password" -l authPriv test.net-snmp.org system + # Ex. snmpwalk -t $timeout $snmp->{extra} -On -v 3 -n "" -u MD5DESUser -a MD5 -A "The Net-SNMP Demo Password" -x DES -X "The Net-SNMP Demo Password" -l authPriv test.net-snmp.org system if ($snmp->{securityLevel} =~ /^noAuthNoPriv$/i){ # Unauthenticated request if (defined $snmp->{port}){ - $cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}"; + $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}"; } else { - $cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}"; + $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}"; } } elsif ($snmp->{securityLevel} =~ /^authNoPriv$/i){ # Authenticated request if (defined $snmp->{port}){ - $cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}"; + $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}"; } else { - $cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}"; + $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}"; } } elsif ($snmp->{securityLevel} =~ /^authPriv$/i){ # Authenticated and encrypted request if (defined $snmp->{port}){ - $cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host}:$snmp->{port} $snmp->{oid}"; + $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host}:$snmp->{port} $snmp->{oid}"; } else { - $cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host} $snmp->{oid}"; + $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host} $snmp->{oid}"; } } } @@ -2016,16 +2018,18 @@ sub snmp_get { $timeout = $snmp->{timeout}; } + $snmp->{extra} = '' unless defined $snmp->{extra}; + if ( defined ($snmp->{version} ) && (($snmp->{version} eq "1") || ($snmp->{version} eq "2") || ($snmp->{version} eq "2c"))) { if (defined $snmp->{port}){ - $cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -c $snmp->{community} $snmp->{host}:$snmp->{port} $snmp->{oid}"; + $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -c $snmp->{community} $snmp->{host}:$snmp->{port} $snmp->{oid}"; } else { - $cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -c $snmp->{community} $snmp->{host} $snmp->{oid}"; + $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -c $snmp->{community} $snmp->{host} $snmp->{oid}"; } } @@ -2036,42 +2040,42 @@ sub snmp_get { # $securityLevel = (noAuthNoPriv|authNoPriv|authPriv); # unauthenticated request - # Ex. snmpget -r $retries -t $timeout -On -v 3 -n "" -u noAuthUser -l noAuthNoPriv test.net-snmp.org sysUpTime + # Ex. snmpget -r $retries -t $timeout $snmp->{extra} -On -v 3 -n "" -u noAuthUser -l noAuthNoPriv test.net-snmp.org sysUpTime # authenticated request - # Ex. snmpget -r $retries -t $timeout -On -v 3 -n "" -u MD5User -a MD5 -A "The Net-SNMP Demo Password" -l authNoPriv test.net-snmp.org sysUpTime + # Ex. snmpget -r $retries -t $timeout $snmp->{extra} -On -v 3 -n "" -u MD5User -a MD5 -A "The Net-SNMP Demo Password" -l authNoPriv test.net-snmp.org sysUpTime # authenticated and encrypted request - # Ex. snmpget -r $retries -t $timeout -On -v 3 -n "" -u MD5DESUser -a MD5 -A "The Net-SNMP Demo Password" -x DES -X "The Net-SNMP Demo Password" -l authPriv test.net-snmp.org system + # Ex. snmpget -r $retries -t $timeout $snmp->{extra} -On -v 3 -n "" -u MD5DESUser -a MD5 -A "The Net-SNMP Demo Password" -x DES -X "The Net-SNMP Demo Password" -l authPriv test.net-snmp.org system if ($snmp->{securityLevel} =~ /^noAuthNoPriv$/i){ # Unauthenticated request if (defined $snmp->{port}){ - $cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}"; + $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}"; } else { - $cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}"; + $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}"; } } elsif ($snmp->{securityLevel} =~ /^authNoPriv$/i){ # Authenticated request if (defined $snmp->{port}){ - $cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}"; + $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}"; } else { - $cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}"; + $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}"; } } elsif ($snmp->{securityLevel} =~ /^authPriv$/i){ # Authenticated and encrypted request if (defined $snmp->{port}){ - $cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host}:$snmp->{port} $snmp->{oid}"; + $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host}:$snmp->{port} $snmp->{oid}"; } else { - $cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host} $snmp->{oid}"; + $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host} $snmp->{oid}"; } } } From 3d99ef48aa28ad4a0557b9f741d38ea7662cb06e Mon Sep 17 00:00:00 2001 From: samucarc Date: Mon, 5 Nov 2018 13:05:34 +0100 Subject: [PATCH 06/16] Fixed ACLs in monitoring View and agent detail --- .../operation/agentes/estado_agente.php | 4 ++-- .../operation/agentes/group_view.php | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 20d3f18a47..d37cc9396c 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -623,7 +623,7 @@ foreach ($agents as $agent) { $data[0] = '
'; $data[0] .= ''; - $data[0] .= ' '.$agent["alias"].''; + $data[0] .= ' '.$agent["alias"].''; $data[0] .= ''; if ($agent['quiet']) { @@ -642,7 +642,7 @@ foreach ($agents as $agent) { $data[0] .= ''.__('View').''; } else{ - $data[0] .= ''.__('View').''; + $data[0] .= ''.__('View').''; } if (check_acl ($config['id_user'], $agent["id_grupo"], "AW")) { diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php index 0406fe2e56..640de2010c 100644 --- a/pandora_console/operation/agentes/group_view.php +++ b/pandora_console/operation/agentes/group_view.php @@ -343,7 +343,7 @@ if (!empty($result_groups)) { href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_']. "&status=" . AGENT_STATUS_NORMAL ."'>"; } else { $link = ""; + href='index.php?sec=view&sec2=operation/agentes/estado_agente&group_id=".$data['_id_']."&status=" . AGENT_STATUS_NORMAL ."'>"; } if (($data["_id_"] == 0) && ($agents_ok != 0)) { echo $link . $agents_ok . ""; @@ -361,7 +361,7 @@ if (!empty($result_groups)) { href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_']. "&status=" . AGENT_STATUS_WARNING ."'>"; } else { $link = ""; + href='index.php?sec=view&sec2=operation/agentes/estado_agente&group_id=".$data['_id_']."&status=" . AGENT_STATUS_WARNING ."'>"; } if (($data["_id_"] == 0) && ($agents_warning != 0)) { echo $link . $agents_warning . ""; @@ -394,10 +394,10 @@ if (!empty($result_groups)) { echo ""; if (!isset($data['_is_tag_'])) { $link = ""; + href='index.php?sec=view&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_UNKNOWN . "'>"; } else { $link = ""; + href='index.php?sec=view&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_UNKNOWN . "'>"; } if (($data["_id_"] == 0) && ($monitor_unknown != 0)) { echo $link . $monitor_unknown . ""; @@ -411,10 +411,10 @@ if (!empty($result_groups)) { echo ""; if (!isset($data['_is_tag_'])) { $link = ""; + href='index.php?sec=view&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_NOT_INIT . "'>"; } else { $link = ""; + href='index.php?sec=view&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_NOT_INIT . "'>"; } if (($data["_id_"] == 0) && ($monitor_not_init != 0)) { echo $link . $monitor_not_init . ""; @@ -428,10 +428,10 @@ if (!empty($result_groups)) { echo ""; if (!isset($data['_is_tag_'])) { $link = ""; + href='index.php?sec=view&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_NORMAL . "'>"; } else { $link = ""; + href='index.php?sec=view&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_NORMAL . "'>"; } if (($data["_id_"] == 0) && ($monitor_ok != 0)) { echo $link . $monitor_ok . ""; @@ -445,10 +445,10 @@ if (!empty($result_groups)) { echo ""; if (!isset($data['_is_tag_'])) { $link = ""; + href='index.php?sec=view&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_WARNING . "'>"; } else { $link = ""; + href='index.php?sec=view&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_WARNING . "'>"; } if (($data["_id_"] == 0) && ($monitor_warning != 0)) { echo $link . $monitor_warning . ""; @@ -462,10 +462,10 @@ if (!empty($result_groups)) { echo ""; if (!isset($data['_is_tag_'])) { $link = ""; + href='index.php?sec=view&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "'>"; } else { $link = ""; + href='index.php?sec=view&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "'>"; } if (($data["_id_"] == 0) && ($monitor_critical != 0)) { echo $link . $monitor_critical . ""; From 3ffad9fda8b6791974eb5e65fcb26071f352989a Mon Sep 17 00:00:00 2001 From: artica Date: Tue, 6 Nov 2018 00:01:27 +0100 Subject: [PATCH 07/16] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 289b8b1f9b..d5eeee3aa8 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.728-181105 +Version: 7.0NG.728-181106 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 010cb163c0..338346e526 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.728-181105" +pandora_version="7.0NG.728-181106" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 887c34d7bc..8d09b5aba0 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.728'; -use constant AGENT_BUILD => '181105'; +use constant AGENT_BUILD => '181106'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index d2d905cf00..44990eb41a 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.728 -%define release 181105 +%define release 181106 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 7a78083631..75be646a86 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.728 -%define release 181105 +%define release 181106 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 02c19aefad..f97b451224 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.728" -PI_BUILD="181105" +PI_BUILD="181106" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index acc8ff58d7..98dfb1c792 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{181105} +{181106} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 2e5dc6c9f6..10f3862934 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.728(Build 181105)") +#define PANDORA_VERSION ("7.0NG.728(Build 181106)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 43940311be..b1171d87ff 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.728(Build 181105))" + VALUE "ProductVersion", "(7.0NG.728(Build 181106))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 1cb69595a8..6fc76510cf 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.728-181105 +Version: 7.0NG.728-181106 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 511f280e6f..45d5e8c753 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.728-181105" +pandora_version="7.0NG.728-181106" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 03f7597930..520628013c 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC181105'; +$build_version = 'PC181106'; $pandora_version = 'v7.0NG.728'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 4d38f1dc62..e3c52e260f 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 0705b08824..efe455ece1 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.728 -%define release 181105 +%define release 181106 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 7fd2c37eae..06a74ee346 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.728 -%define release 181105 +%define release 181106 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index e5f3bb604c..83d5919345 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.728" -PI_BUILD="181105" +PI_BUILD="181106" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 1106c500b9..a1dfe6c27c 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.728 PS181105"; +my $version = "7.0NG.728 PS181106"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index f755c6f0bd..9f7e650e13 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.728 PS181105"; +my $version = "7.0NG.728 PS181106"; # save program name for logging my $progname = basename($0); From 9448111927d0cb2337a719c3e979c3281a6c3e89 Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Tue, 6 Nov 2018 11:14:12 +0100 Subject: [PATCH 08/16] Fixed SQL query - #2973 --- pandora_console/include/ajax/module.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index d39ca49178..5c5908460f 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -602,12 +602,13 @@ if ($list_modules) { AND delete_pending = 0 AND disabled = 0 AND $status_filter_sql + AND $status_module_group_filter $tags_sql AND tagente_estado.estado != $monitor_filter - GROUP BY tagente_modulo.id_agente_modulo "; - $count_modules = db_get_all_rows_sql('SELECT COUNT(*)' . $sql_condition); + $count_modules = db_get_all_rows_sql('SELECT COUNT(DISTINCT tagente_modulo.id_agente_modulo)' . $sql_condition); + if (isset($count_modules[0])) $count_modules = reset($count_modules[0]); else @@ -615,7 +616,9 @@ if ($list_modules) { //Get monitors/modules // Get all module from agent - $sql_modules_info = 'SELECT tagente_estado.*, tagente_modulo.*, tmodule_group.*' . $sql_condition; + $sql_modules_info = "SELECT tagente_estado.*, tagente_modulo.*, tmodule_group.* + $sql_condition + GROUP BY tagente_modulo.id_agente_modulo ORDER BY $order_sql"; if ($monitors_change_filter) { $limit = " LIMIT " . $config['block_size'] . " OFFSET 0"; From 6ede68bf8da49789127202e10f9dcfa935642168 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Tue, 6 Nov 2018 13:10:44 +0100 Subject: [PATCH 09/16] Fixed delete menu on main page dashboards --- pandora_console/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/index.php b/pandora_console/index.php index 1fc6e932ed..9111aec168 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -452,6 +452,7 @@ if (! isset ($config['id_user'])) { $id_dashboard_select = db_get_value('id', 'tdashboard', 'name', $home_url); $_GET['id_dashboard_select'] = $id_dashboard_select; + $_GET['d_from_main_page'] = 1; break; case 'Visual console': $_GET["sec"] = "network"; @@ -1057,9 +1058,8 @@ else { $_GET['sec2'] = 'general/logon_ok'; break; case 'Dashboard': - $dashboard_from_main_page = 1; $id_dashboard = db_get_value('id', 'tdashboard', 'name', $home_url); - $str = 'sec=reporting&sec2='.ENTERPRISE_DIR.'/dashboard/main_dashboard&id='.$id_dashboard; + $str = 'sec=reporting&sec2='.ENTERPRISE_DIR.'/dashboard/main_dashboard&id='.$id_dashboard.'&d_from_main_page=1'; parse_str($str, $res); foreach ($res as $key => $param) { $_GET[$key] = $param; From 26a4880f64e4d32662a7311b1258564ca9a5ab82 Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Tue, 6 Nov 2018 13:49:47 +0100 Subject: [PATCH 10/16] Removed duplicated code - #3021 --- pandora_console/include/functions_reporting_html.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 7f92495e89..bf06493b79 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -480,8 +480,8 @@ function reporting_html_SLA($table, $item, $mini) { $row[] = $sla['module']; if(is_numeric($sla['dinamic_text'])){ - $row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " . - sla_truncate($sla['min'], $config['graph_precision']); + $row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " . + sla_truncate($sla['min'], $config['graph_precision']); } else{ $row[] = $sla['dinamic_text']; @@ -489,14 +489,6 @@ function reporting_html_SLA($table, $item, $mini) { $row[] = round($sla['sla_limit'], 2) . "%"; if (!$hide_notinit_agent) { - if(is_numeric($sla['dinamic_text'])){ - $row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " . - sla_truncate($sla['min'], $config['graph_precision']); - } - else{ - $row[] = $sla['dinamic_text']; - } - $row[] = round($sla['sla_limit'], 2) . "%"; if (reporting_sla_is_not_init_from_array($sla)) { $row[] = '' . From df8c5e8bf9d087c55d6364aadf4f9eb71e184ef0 Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Tue, 6 Nov 2018 13:52:03 +0100 Subject: [PATCH 11/16] Fixed bug in deleted policies --- pandora_console/include/functions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index cfb25ce516..ff2ce52deb 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1377,7 +1377,7 @@ function is_management_allowed($hkey = '') { global $config; return ( (is_metaconsole() && $config["centralized_management"]) || (!is_metaconsole() && !$config["centralized_management"]) - || (!is_metaconsole() && $config["centralized_management"]) && $hkey == hash('sha256', db_get_value ('value', 'tupdate_settings', 'token', 'customer_key'))); + || (!is_metaconsole() && $config["centralized_management"]) && $hkey == generate_hash_to_api()); } /** @@ -3388,4 +3388,8 @@ function validate_csrf_code() { return isset($code) && isset($_SESSION['csrf_code']) && $_SESSION['csrf_code'] == $code; } + +function generate_hash_to_api(){ + hash('sha256', db_get_value ('value', 'tupdate_settings', '`key`', 'customer_key')); + } ?> From 919a800a0afe1964ec96b41eabdba9edf2b810e1 Mon Sep 17 00:00:00 2001 From: vgilc Date: Tue, 6 Nov 2018 16:41:15 +0100 Subject: [PATCH 12/16] Revert "Merge branch '2677-No-se-elimina-parent-id-entre-modulos-del-mismo-agente' into 'develop'" This reverts merge request !1727 --- pandora_server/util/pandora_db.pl | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index a1dfe6c27c..1224467b1a 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -292,22 +292,12 @@ sub pandora_purgedb ($$) { # Delete pending modules log_message ('PURGE', "Deleting pending delete modules (data table).", ''); - my @deleted_modules = get_db_rows ($dbh, 'SELECT id_agente_modulo FROM tagente_modulo WHERE delete_pending = 1'); - my @all_modules = get_db_rows ($dbh, 'SELECT id_agente_modulo, parent_module_id FROM tagente_modulo'); foreach my $module (@deleted_modules) { my $buffer = 1000; my $id_module = $module->{'id_agente_modulo'}; - - foreach my $m (@all_modules) { - my $id_parent = $m->{'parent_module_id'}; - my $id_module_fetched = $m->{'id_agente_modulo'}; - if ($id_parent == $id_module) { - db_do ($dbh, 'UPDATE tagente_modulo SET parent_module_id=0 WHERE id_agente_modulo=?', $id_module_fetched); - } - } - + log_message ('', "."); while(1) { From a80c7e493e71dc46c52706a59ba2a634e4de49ec Mon Sep 17 00:00:00 2001 From: samucarc Date: Tue, 6 Nov 2018 16:42:03 +0100 Subject: [PATCH 13/16] Added check for the creation of planned downtimes by pandora manage --- pandora_console/include/functions_api.php | 3 ++- .../include/functions_planned_downtimes.php | 21 +++++++++++++++++++ pandora_server/util/pandora_manage.pl | 6 +++--- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 479929c619..7eb03e7248 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -5411,7 +5411,8 @@ function api_set_planned_downtimes_created ($id, $thrash1, $other, $thrash3) { 'periodically_day_to' => $other['data'][14], 'type_downtime' => $other['data'][15], 'type_execution' => $other['data'][16], - 'type_periodicity' => $other['data'][17] + 'type_periodicity' => $other['data'][17], + 'id_user' => $other['data'][18] ); $returned = planned_downtimes_created($values); diff --git a/pandora_console/include/functions_planned_downtimes.php b/pandora_console/include/functions_planned_downtimes.php index 67f9ec9f29..6e5ac261a2 100644 --- a/pandora_console/include/functions_planned_downtimes.php +++ b/pandora_console/include/functions_planned_downtimes.php @@ -666,6 +666,7 @@ function planned_downtimes_stop ($downtime) { function planned_downtimes_created ($values) { global $config; + $check_id_user = (bool) db_get_value ('id_user', 'tusuario', 'id_user', $values['id_user']); $check_group = (bool) db_get_value ('id_grupo', 'tgrupo', 'id_grupo', $values['id_group']); $check = (bool) db_get_value ('name', 'tplanned_downtime', 'name', $values['name']); @@ -703,6 +704,26 @@ function planned_downtimes_created ($values) { 'message' => __('Not created. Error inserting data') . ". " . __('The end day must be higher than the start day')); } + else if ($values['type_downtime'] !== 'quiet' && $values['type_downtime'] !== 'disable_agents' && $values['type_downtime'] !== 'disable_agents_alerts') { + return array('return' => false, + 'message' => __('Not created. Error inserting data') . ". " + . __('The downtime must be quiet, disable_agents or disable_agents_alerts')); + } + else if ($values['type_execution'] !== 'periodically' && $values['type_execution'] !== 'once' ) { + return array('return' => false, + 'message' => __('Not created. Error inserting data') . ". " + . __('The execution must be once or periodically')); + } + else if ($values['type_periodicity'] !== 'weekly' && $values['type_periodicity'] !== 'monthly' ) { + return array('return' => false, + 'message' => __('Not created. Error inserting data') . ". " + . __('The periodicity must be weekly or monthly')); + } + else if (!$check_id_user){ + return array('return' => false, + 'message' => __('Not created. Error inserting data') . ". " + . __('User not exist')); + } else if (!$check_group && $values['id_group'] != 0) { return array('return' => false, 'message' => __('Not created. Error inserting data') . ". " diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index f755c6f0bd..57b0c05a63 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -112,7 +112,7 @@ sub help_screen{ help_screen_line('--delete_group', '', 'Delete an agent group'); help_screen_line('--update_group', '','[ ]', 'Update an agent group'); help_screen_line('--stop_downtime', '', 'Stop a planned downtime'); - help_screen_line('--create_downtime', " \n\t \n\t ", 'Create a planned downtime'); + help_screen_line('--create_downtime', " \n\t \n\t ", 'Create a planned downtime'); help_screen_line('--add_item_planned_downtime', " ", 'Add a items planned downtime'); help_screen_line('--get_all_planned_downtimes', ' [ ]', 'Get all planned downtime'); help_screen_line('--get_planned_downtimes_items', ' [ ]', 'Get all items of planned downtimes'); @@ -4095,7 +4095,7 @@ sub cli_policy_add_agent() { sub cli_create_planned_downtime() { my $name = @ARGV[2]; - my @todo = @ARGV[3..20]; + my @todo = @ARGV[3..21]; my $other = join('|', @todo); my $result = api_call(\%conf,'set', 'planned_downtimes_created', $name, undef, "$other"); @@ -6035,7 +6035,7 @@ sub pandora_manage_main ($$$) { cli_add_tag_to_module(); } elsif ($param eq '--create_downtime') { - param_check($ltotal, 19); + param_check($ltotal, 20); cli_create_planned_downtime(); } elsif ($param eq '--add_item_downtime') { From 343b4767be176d8b9bb85df139d419817a17c751 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Tue, 6 Nov 2018 18:23:21 +0100 Subject: [PATCH 14/16] Create collections folder like a symlink --- pandora_agents/unix/pandora_agent.redhat.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 44990eb41a..f2931aa918 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -95,7 +95,8 @@ if [ ! -e /etc/pandora/plugins ]; then fi if [ ! -e /etc/pandora/collections ]; then - mkdir -p /etc/pandora/collections + mkdir -p /usr/share/pandora_agent/collections + ln -s /usr/share/pandora_agent/collections /etc/pandora fi mkdir -p /var/spool/pandora/data_out From a01f79d2946262803ccc5846f2644e3ea10c4afd Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 7 Nov 2018 00:01:31 +0100 Subject: [PATCH 15/16] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index d5eeee3aa8..d8a59d59fa 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.728-181106 +Version: 7.0NG.728-181107 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 338346e526..ebb375fe3e 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.728-181106" +pandora_version="7.0NG.728-181107" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 8d09b5aba0..441e17be68 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.728'; -use constant AGENT_BUILD => '181106'; +use constant AGENT_BUILD => '181107'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 44990eb41a..630e7b300c 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.728 -%define release 181106 +%define release 181107 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 75be646a86..e2f73164e0 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.728 -%define release 181106 +%define release 181107 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index f97b451224..4d0681308b 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.728" -PI_BUILD="181106" +PI_BUILD="181107" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 98dfb1c792..3f81cad599 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{181106} +{181107} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 10f3862934..f10c37fcb5 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.728(Build 181106)") +#define PANDORA_VERSION ("7.0NG.728(Build 181107)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index b1171d87ff..7c9bb1089b 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.728(Build 181106))" + VALUE "ProductVersion", "(7.0NG.728(Build 181107))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 6fc76510cf..fc3260ea0b 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.728-181106 +Version: 7.0NG.728-181107 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 45d5e8c753..da5ac719b2 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.728-181106" +pandora_version="7.0NG.728-181107" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 520628013c..116b8dd7ab 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC181106'; +$build_version = 'PC181107'; $pandora_version = 'v7.0NG.728'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index e3c52e260f..34ba93c3bc 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index efe455ece1..c78b5b6463 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.728 -%define release 181106 +%define release 181107 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 06a74ee346..3d7aa00b75 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.728 -%define release 181106 +%define release 181107 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 83d5919345..fdd3b1f433 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.728" -PI_BUILD="181106" +PI_BUILD="181107" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 1224467b1a..3082ff8d46 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.728 PS181106"; +my $version = "7.0NG.728 PS181107"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 9f7e650e13..562e1e3989 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.728 PS181106"; +my $version = "7.0NG.728 PS181107"; # save program name for logging my $progname = basename($0); From 2a616e1448b08c427222ab3cb4411628e267bd35 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Wed, 7 Nov 2018 12:29:37 +0100 Subject: [PATCH 16/16] fixed agent name and go to agent edition links in meta tree view --- pandora_console/include/functions_treeview.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index e9b64c15f5..20d1f577bc 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -522,7 +522,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals $hashdata = $user.$pwd_deserialiced['auth_token']; $hashdata = md5($hashdata); - $url = "//" . $server_data["server_url"] . "/index.php?" . + $url = $server_data["server_url"] . "/index.php?" . "sec=estado&" . "sec2=operation/agentes/ver_agente&" . "id_agente=" . $agent["id_agente"] . "&" . @@ -608,7 +608,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals $go_to_agent = '