Merge remote-tracking branch 'origin/develop' into ent-3595-discovery-fase-2

Former-commit-id: 1e68380f62f61e9ac895a0c2bade2e6c8f5b589f
This commit is contained in:
fbsanchez 2019-03-05 18:56:14 +01:00
commit c03631ec9b
34 changed files with 198 additions and 65 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.732-190301 Version: 7.0NG.732-190305
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.732-190301" pandora_version="7.0NG.732-190305"
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.732'; use constant AGENT_VERSION => '7.0NG.732';
use constant AGENT_BUILD => '190301'; use constant AGENT_BUILD => '190305';
# 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.732 %define version 7.0NG.732
%define release 190301 %define release 190305
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.732 %define version 7.0NG.732
%define release 190301 %define release 190305
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.732" PI_VERSION="7.0NG.732"
PI_BUILD="190301" PI_BUILD="190305"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{190301} {190305}
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.732(Build 190301)") #define PANDORA_VERSION ("7.0NG.732(Build 190305)")
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.732(Build 190301))" VALUE "ProductVersion", "(7.0NG.732(Build 190305))"
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.732-190301 Version: 7.0NG.732-190305
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.732-190301" pandora_version="7.0NG.732-190305"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -0,0 +1,113 @@
<html>
<head>
<style>
#alert_messages_na{
-moz-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
z-index:2;
position:fixed;
width:700px;
background:white;
left:50%;
top:20%;
margin-left:-350px;
}
.modalheade{
text-align:center;
width:100%;
height:37px;
left:0px;
background-color:#82b92e;
}
.modalheadertex{
color:white;
position:relative;
font-family:Nunito;
font-size:13pt;
top:8px;
}
.modalconten{
color:black;
background:white;
}
.modalcontentim{
float:left;
margin-left:30px;
margin-top:30px;
margin-bottom:30px;
}
.modalcontenttex{
float:left;
text-align:justify;
color:black;
font-size: 9.5pt;
line-height:13pt;
margin-top:40px;
width:430px;
margin-left:30px;
}
.modalwikibutto{
cursor:pointer;
text-align:center;
margin-right:45px;
float:right;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
margin-bottom:30px;
border-radius: 3px;
width:170px;
height:30px;
border: 1px solid #82b92e;
margin-top:8%;
background-color:#82b92e;
}
.modalwikibuttontex{
color:#ffffff;
font-family:Nunito;
font-size:10pt;
position:relative;
top:6px;
}
#opacity{
background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%;
}
</style>
</head>
<body>
<div id="alert_messages_na">
<div class='modalheade'>
<span class='modalheadertex'>
<?php echo __('Database error'); ?>
</span>
</div>
<div class='modalconten'>
<img class='modalcontentim' src='<?php echo $config['homeurl']; ?>/images/mysqlerr.png'>
<div class='modalcontenttex'>
<?php
echo __('Failure to connect to Database server, please check the configuration file config.php or contact system administrator if you need assistance.');
?>
</div>
</div>
<a href='https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Configuration' target='_blank'>
<div class='modalwikibutto cerrar'>
<span class='modalwikibuttontex'> <?php echo __('Documentation'); ?></span>
</div>
</a>
</div>
<div id="opacity"></div>
</body>
</html>

View File

@ -43,7 +43,7 @@ if (is_ajax()) {
if ($type_auth != 'mysql') { if ($type_auth != 'mysql') {
// Fallback to local authentication // Fallback to local authentication
$row = []; $row = [];
$row['name'] = __('Fallback to local authentication').ui_print_help_tip(__('Enable this option if you want to fallback to local authentication when remote (ldap etc...) authentication failed.'), true); $row['name'] = __('Fallback to local authentication').ui_print_help_tip(__('Enable this option if you want to fallback to local authentication when remote (ldap etc...) authentication failed. Only available when \'Save password\' is enabled.'), true);
$row['control'] = html_print_checkbox_switch('fallback_local_auth', 1, $config['fallback_local_auth'], true); $row['control'] = html_print_checkbox_switch('fallback_local_auth', 1, $config['fallback_local_auth'], true);
$table->data['fallback_local_auth'] = $row; $table->data['fallback_local_auth'] = $row;

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC190301'; $build_version = 'PC190305';
$pandora_version = 'v7.0NG.732'; $pandora_version = 'v7.0NG.732';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -45,6 +45,7 @@ function mysql_connect_db($host=null, $db=null, $user=null, $pass=null, $port=nu
if ($config['mysqli']) { if ($config['mysqli']) {
$connect_id = mysqli_connect($host, $user, $pass, $db, $port); $connect_id = mysqli_connect($host, $user, $pass, $db, $port);
if (mysqli_connect_errno() > 0) { if (mysqli_connect_errno() > 0) {
include 'general/mysqlerr.php';
return false; return false;
} }

View File

@ -82,17 +82,25 @@ function agents_get_agent_id_by_alias($alias)
/** /**
* Creates an agent * Creates an agent.
* *
* @param string Agent name. * @param string $name Agent name.
* @param string Group to be included. * @param string $id_group Group to be included.
* @param int Agent interval * @param integer $interval Agent interval.
* @param string Agent IP * @param string $ip_address Agent IP.
* @param mixed $values Other tagente fields.
* @param boolean $alias_as_name True to not assign an alias as name.
* *
* @return integer New agent id if created. False if it could not be created. * @return integer New agent id if created. False if it could not be created.
*/ */
function agents_create_agent($name, $id_group, $interval, $ip_address, $values=false) function agents_create_agent(
{ $name,
$id_group,
$interval,
$ip_address,
$values=false,
$alias_as_name=false
) {
if (empty($name)) { if (empty($name)) {
return false; return false;
} }
@ -101,7 +109,7 @@ function agents_create_agent($name, $id_group, $interval, $ip_address, $values=f
return false; return false;
} }
// Check interval greater than zero // Check interval greater than zero.
if ($interval < 0) { if ($interval < 0) {
$interval = false; $interval = false;
} }
@ -115,7 +123,7 @@ function agents_create_agent($name, $id_group, $interval, $ip_address, $values=f
} }
$values['alias'] = $name; $values['alias'] = $name;
$values['nombre'] = hash('sha256', $name.'|'.$ip_address.'|'.time().'|'.sprintf('%04d', rand(0, 10000))); $values['nombre'] = ($alias_as_name === false) ? hash('sha256', $name.'|'.$ip_address.'|'.time().'|'.sprintf('%04d', rand(0, 10000))) : $name;
$values['id_grupo'] = $id_group; $values['id_grupo'] = $id_group;
$values['intervalo'] = $interval; $values['intervalo'] = $interval;
@ -128,12 +136,12 @@ function agents_create_agent($name, $id_group, $interval, $ip_address, $values=f
return false; return false;
} }
// Create address for this agent in taddress // Create address for this agent in taddress.
if (!empty($ip_address)) { if (!empty($ip_address)) {
agents_add_address($id_agent, $ip_address); agents_add_address($id_agent, $ip_address);
} }
db_pandora_audit('Agent management', "New agent '$name' created"); db_pandora_audit('Agent management', 'New agent '.$name.' created');
return $id_agent; return $id_agent;
} }

View File

@ -2272,35 +2272,29 @@ function events_page_responses($event, $childrens_ids=[])
/** /**
* Replace macros in the target of a response and return it. * Replace macros in the target of a response and return it.
* If server_id > 0, is a metaconsole query. * If server_id > 0, it's a metaconsole query.
* *
* @param integer $event_id Event_id. * @param integer $event_id Event identifier.
* @param integer $response_id Response_id. * @param integer $response_id Event response identifier.
* @param integer $server_id Server_id. * @param integer $server_id Node identifier (for metaconsole).
* @param boolean $history History. * @param boolean $history Use the history database or not.
* *
* @return string Target. * @return string The response text with the macros applied.
*/ */
function events_get_response_target( function events_get_response_target(
$event_id, int $event_id,
$response_id, int $response_id,
$server_id, int $server_id=0,
$history=false bool $history=false
) { ) {
global $config; global $config;
$event_response = db_get_row('tevent_response', 'id', $response_id); // If server_id > 0, it's a metaconsole query.
$meta = $server_id > 0;
if ($server_id > 0) {
$meta = true;
} else {
$meta = false;
}
$event_table = events_get_events_table($meta, $history); $event_table = events_get_events_table($meta, $history);
$event = db_get_row($event_table, 'id_evento', $event_id); $event = db_get_row($event_table, 'id_evento', $event_id);
$event_response = db_get_row('tevent_response', 'id', $response_id);
$target = io_safe_output($event_response['target']); $target = io_safe_output($event_response['target']);
// Substitute each macro. // Substitute each macro.
@ -2317,7 +2311,7 @@ function events_get_response_target(
} }
$ip = db_get_value_filter('direccion', $agente_table_name, $filter); $ip = db_get_value_filter('direccion', $agente_table_name, $filter);
// If agent has not an ip, display N/A. // If agent has not an IP, display N/A.
if ($ip === false) { if ($ip === false) {
$ip = __('N/A'); $ip = __('N/A');
} }
@ -2499,6 +2493,11 @@ function events_get_response_target(
} }
} }
// This will replace the macro with the current logged user.
if (strpos($target, '_current_user_') !== false) {
$target = str_replace('_current_user_', $config['id_user'], $target);
}
return $target; return $target;
} }

View File

@ -534,9 +534,10 @@ function planned_downtimes_migrate_malformed_downtimes_copy_items($original_down
/** /**
* Stop a planned downtime. * Stop a planned downtime.
* *
* @param array Planned downtime data. * @param array $downtime Planned downtime data.
* *
* @return mixes False on error or an array with the result and a message of the operation. * @return mixed False on error or an array with the result and a message of
* the operation.
*/ */
function planned_downtimes_stop($downtime) function planned_downtimes_stop($downtime)
{ {
@ -566,7 +567,9 @@ function planned_downtimes_stop($downtime)
case 'periodically': case 'periodically':
return false; return false;
break; default:
// Nothing to do.
break;
} }
$message .= ui_print_result_message( $message .= ui_print_result_message(
@ -593,7 +596,7 @@ function planned_downtimes_stop($downtime)
true true
); );
// Reenabled the Agents or Modules or alerts...depends of type // Reenabled the Agents or Modules or alerts...depends of type.
switch ($downtime['type_downtime']) { switch ($downtime['type_downtime']) {
case 'quiet': case 'quiet':
$agents = db_get_all_rows_filter( $agents = db_get_all_rows_filter(
@ -658,7 +661,10 @@ function planned_downtimes_stop($downtime)
foreach ($agents as $agent) { foreach ($agents as $agent) {
$result = db_process_sql_update( $result = db_process_sql_update(
'tagente', 'tagente',
['disabled' => 0], [
'disabled' => 0,
'update_module_count' => 1,
],
['id_agente' => $agent['id_agent']] ['id_agente' => $agent['id_agent']]
); );
@ -702,6 +708,10 @@ function planned_downtimes_stop($downtime)
} }
} }
break; break;
default:
// Nothing to do.
break;
} }
$message .= ui_print_info_message( $message .= ui_print_info_message(

View File

@ -748,7 +748,7 @@ function flot_slicesbar_graph(
if ($widgets) { if ($widgets) {
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width.'px; height: '.$height."px;'></div>"; $return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width.'px; height: '.$height."px;'></div>";
} else { } else {
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width.'%; height: '.$height."px;'></div>"; $return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width.'px; height: '.$height."px;'></div>";
} }
} }

View File

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

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.732 %define version 7.0NG.732
%define release 190301 %define release 190305
# 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.732 %define version 7.0NG.732
%define release 190301 %define release 190305
%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

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.732-190301 Version: 7.0NG.732-190305
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.732-190301" pandora_version="7.0NG.732-190305"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -306,7 +306,7 @@ sub pandora_server_tasks ($) {
if (($counter % 30) == 0) { if (($counter % 30) == 0) {
# Update module status and fired alert counts # Update module status and fired alert counts
my @agents = get_db_rows ($dbh, 'SELECT id_agente, nombre, update_module_count, update_alert_count, update_secondary_groups FROM tagente WHERE disabled = 0 AND (update_module_count=1 OR update_alert_count=1 OR update_secondary_groups=1)'); my @agents = get_db_rows ($dbh, 'SELECT id_agente, nombre, update_module_count, update_alert_count, update_secondary_groups FROM tagente WHERE (update_module_count=1 OR update_alert_count=1 OR update_secondary_groups=1)');
foreach my $agent (@agents) { foreach my $agent (@agents) {
logger ($pa_config, "Updating module status and fired alert counts for agent " . $agent->{'nombre'}, 10); logger ($pa_config, "Updating module status and fired alert counts for agent " . $agent->{'nombre'}, 10);

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.732"; my $pandora_version = "7.0NG.732";
my $pandora_build = "190301"; my $pandora_build = "190305";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -1820,7 +1820,8 @@ sub pandora_planned_downtime_set_disabled_elements($$$) {
WHERE tp.id_agent = ta.id_agente AND tp.id_downtime = ?',$downtime->{'id'}); WHERE tp.id_agent = ta.id_agente AND tp.id_downtime = ?',$downtime->{'id'});
db_do($dbh,'UPDATE tagente ta, tplanned_downtime_agents tpa db_do($dbh,'UPDATE tagente ta, tplanned_downtime_agents tpa
SET ta.disabled = 1 WHERE tpa.id_agent = ta.id_agente AND SET ta.disabled = 1, ta.update_module_count = 1
WHERE tpa.id_agent = ta.id_agente AND
tpa.id_downtime = ?',$downtime->{'id'}); tpa.id_downtime = ?',$downtime->{'id'});
} else { } else {
@ -1857,7 +1858,8 @@ sub pandora_planned_downtime_unset_disabled_elements($$$) {
if ($only_alerts == 0) { if ($only_alerts == 0) {
db_do($dbh,'UPDATE tagente ta, tplanned_downtime_agents tpa db_do($dbh,'UPDATE tagente ta, tplanned_downtime_agents tpa
set ta.disabled = 0 WHERE tpa.id_agent = ta.id_agente AND set ta.disabled = 0, ta.update_module_count = 1
WHERE tpa.id_agent = ta.id_agente AND
tpa.manually_disabled = 0 AND tpa.id_downtime = ?',$downtime->{'id'}); tpa.manually_disabled = 0 AND tpa.id_downtime = ?',$downtime->{'id'});
} else { } else {
my @downtime_agents = get_db_rows($dbh, 'SELECT * my @downtime_agents = get_db_rows($dbh, 'SELECT *

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.732"; my $pandora_version = "7.0NG.732";
my $pandora_build = "190301"; my $pandora_build = "190305";
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.732 %define version 7.0NG.732
%define release 190301 %define release 190305
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.732 %define version 7.0NG.732
%define release 190301 %define release 190305
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.732" PI_VERSION="7.0NG.732"
PI_BUILD="190301" PI_BUILD="190305"
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.732 PS190301"; my $version = "7.0NG.732 PS190305";
# 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.732 PS190301"; my $version = "7.0NG.732 PS190305";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);