Merge remote-tracking branch 'origin/develop' into ent-2441-despliegue-de-agentes-desde-pandora
This commit is contained in:
commit
f7e2023253
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.736-190725
|
||||
Version: 7.0NG.736-190726
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.736-190725"
|
||||
pandora_version="7.0NG.736-190726"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -42,7 +42,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.736';
|
||||
use constant AGENT_BUILD => '190725';
|
||||
use constant AGENT_BUILD => '190726';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.736
|
||||
%define release 190725
|
||||
%define release 190726
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.736
|
||||
%define release 190725
|
||||
%define release 190726
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.736"
|
||||
PI_BUILD="190725"
|
||||
PI_BUILD="190726"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{190725}
|
||||
{190726}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.736(Build 190725)")
|
||||
#define PANDORA_VERSION ("7.0NG.736(Build 190726)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.736(Build 190725))"
|
||||
VALUE "ProductVersion", "(7.0NG.736(Build 190726))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.736-190725
|
||||
Version: 7.0NG.736-190726
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.736-190725"
|
||||
pandora_version="7.0NG.736-190726"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC190725';
|
||||
$build_version = 'PC190726';
|
||||
$pandora_version = 'v7.0NG.736';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.736';
|
||||
$build = '190725';
|
||||
$build = '190726';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.736
|
||||
%define release 190725
|
||||
%define release 190726
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.736
|
||||
%define release 190725
|
||||
%define release 190726
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.736
|
||||
%define release 190725
|
||||
%define release 190726
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.736-190725
|
||||
Version: 7.0NG.736-190726
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.736-190725"
|
||||
pandora_version="7.0NG.736-190726"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -304,6 +304,11 @@ fsnmp /usr/bin/pandorafsnmp
|
|||
|
||||
autocreate_group 10
|
||||
|
||||
# If set to 1, new agents will be added to the group specified by autocreate_group (the group specified by the agent will be used as fallback).
|
||||
# If set to 0, new agents will be added to the group specified by the agent (the group specified by autocreate_group will be used as fallback).
|
||||
|
||||
autocreate_group_force 1
|
||||
|
||||
# Set to 1 if want to autocreate agents with Pandora FMS Data Server,
|
||||
# set to 0 to disable (for security purposes, for example).
|
||||
|
||||
|
|
|
@ -261,6 +261,11 @@ dataserver_threads 2
|
|||
|
||||
autocreate_group 10
|
||||
|
||||
# If set to 1, new agents will be added to the group specified by autocreate_group (the group specified by the agent will be used as fallback).
|
||||
# If set to 0, new agents will be added to the group specified by the agent (the group specified by autocreate_group will be used as fallback).
|
||||
|
||||
autocreate_group_force 1
|
||||
|
||||
# Set to 1 if want to autocreate agents with Pandora FMS Data Server,
|
||||
# set to 0 to disable
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.736";
|
||||
my $pandora_build = "190725";
|
||||
my $pandora_build = "190726";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -333,6 +333,7 @@ sub pandora_load_config {
|
|||
$pa_config->{"snmpget"} = "/usr/bin/snmpget";
|
||||
|
||||
$pa_config->{'autocreate_group'} = -1;
|
||||
$pa_config->{'autocreate_group_force'} = 1;
|
||||
$pa_config->{'autocreate'} = 1;
|
||||
|
||||
# max log size (bytes)
|
||||
|
@ -811,6 +812,9 @@ sub pandora_load_config {
|
|||
elsif ($parametro =~ m/^autocreate_group\s+([0-9*]*)/i) {
|
||||
$pa_config->{'autocreate_group'}= clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^autocreate_group_force\s+([0-1])/i) {
|
||||
$pa_config->{'autocreate_group_force'}= clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^discovery_threads\s+([0-9]*)/i) {
|
||||
$pa_config->{'discovery_threads'}= clean_blank($1);
|
||||
}
|
||||
|
|
|
@ -184,6 +184,7 @@ our @EXPORT = qw(
|
|||
pandora_execute_action
|
||||
pandora_exec_forced_alerts
|
||||
pandora_generate_alerts
|
||||
pandora_get_agent_group
|
||||
pandora_get_config_value
|
||||
pandora_get_credential
|
||||
pandora_get_module_tags
|
||||
|
@ -3190,9 +3191,9 @@ sub pandora_create_agent ($$$$$$$$$$;$$$$$$$$$$) {
|
|||
logger ($pa_config, "Server '$server_name' creating agent '$agent_name' address '$address'.", 10);
|
||||
|
||||
if (!defined($group_id)) {
|
||||
$group_id = $pa_config->{'autocreate_group'};
|
||||
if (! defined (get_group_name ($dbh, $group_id))) {
|
||||
logger($pa_config, "Group id $group_id does not exist (check autocreate_group config token)", 3);
|
||||
$group_id = pandora_get_agent_group($pa_config, $dbh, $agent_name);
|
||||
if ($group_id <= 0) {
|
||||
logger($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': No valid group found.", 3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -3442,6 +3443,47 @@ sub pandora_extended_event($$$$) {
|
|||
);
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Returns a valid group ID to place an agent on success, -1 on error.
|
||||
##########################################################################
|
||||
sub pandora_get_agent_group {
|
||||
my ($pa_config, $dbh, $agent_name, $agent_group, $agent_group_password) = @_;
|
||||
|
||||
my $group_id;
|
||||
my @groups = $pa_config->{'autocreate_group_force'} == 1 ? ($pa_config->{'autocreate_group'}, $agent_group) : ($agent_group, $pa_config->{'autocreate_group'});
|
||||
foreach my $group (@groups) {
|
||||
next unless defined($group);
|
||||
|
||||
# Does the group exist?
|
||||
if ($group eq $pa_config->{'autocreate_group'}) {
|
||||
next if ($group <= 0);
|
||||
$group_id = $group;
|
||||
if (!defined(get_group_name ($dbh, $group_id))) {
|
||||
logger($pa_config, "Group ID " . $group_id . " does not exist.", 10);
|
||||
next;
|
||||
}
|
||||
} else {
|
||||
next if ($group eq '');
|
||||
$group_id = get_group_id ($dbh, $group);
|
||||
if ($group_id <= 0) {
|
||||
logger($pa_config, "Group " . $group . " does not exist.", 10);
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
# Check the group password.
|
||||
my $rc = enterprise_hook('check_group_password', [$dbh, $group_id, $agent_group_password]);
|
||||
if (defined($rc) && $rc != 1) {
|
||||
logger($pa_config, "Agent " . safe_output($agent_name) . " did not send a valid password for group ID $group_id.", 10);
|
||||
next;
|
||||
}
|
||||
|
||||
return $group_id;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
=head2 C<< pandora_update_module_on_error (I<$pa_config>, I<$id_agent_module>, I<$dbh>) >>
|
||||
|
||||
|
|
|
@ -83,6 +83,13 @@ sub new ($$;$) {
|
|||
push(@XML::Parser::Expat::Encoding_Path, $config->{'enc_dir'});
|
||||
}
|
||||
|
||||
if ($config->{'autocreate_group'} > 0 && !defined(get_group_name ($dbh, $config->{'autocreate_group'}))) {
|
||||
my $msg = "Group id " . $config->{'autocreate_group'} . " does not exist (check autocreate_group config token).";
|
||||
logger($config, $msg, 3);
|
||||
print_message($config, $msg, 1);
|
||||
pandora_event ($config, $msg, 0, 0, 0, 0, 0, 'error', 0, $dbh);
|
||||
}
|
||||
|
||||
bless $self, $class;
|
||||
return $self;
|
||||
}
|
||||
|
@ -327,33 +334,10 @@ sub process_xml_data ($$$$$) {
|
|||
|
||||
# Get OS, group and description
|
||||
my $os = pandora_get_os ($dbh, $data->{'os_name'});
|
||||
$group_id = $pa_config->{'autocreate_group'};
|
||||
if (! defined (get_group_name ($dbh, $group_id))) {
|
||||
if (defined ($data->{'group_id'}) && $data->{'group_id'} ne '') {
|
||||
$group_id = $data->{'group_id'};
|
||||
if (! defined (get_group_name ($dbh, $group_id))) {
|
||||
pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': group ID '" . $group_id . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
|
||||
logger($pa_config, "Group ID " . $group_id . " does not exist.", 3);
|
||||
return;
|
||||
}
|
||||
} elsif (defined ($data->{'group'}) && $data->{'group'} ne '') {
|
||||
$group_id = get_group_id ($dbh, $data->{'group'});
|
||||
if (! defined (get_group_name ($dbh, $group_id))) {
|
||||
pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': group '" . safe_output($data->{'group'}) . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
|
||||
logger($pa_config, "Group " . $data->{'group'} . " does not exist.", 3);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': autocreate_group $group_id does not exist. Edit the server configuration file and change it.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
|
||||
logger($pa_config, "Group id $group_id does not exist (check autocreate_group config token).", 3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# Check the group password.
|
||||
my $rc = enterprise_hook('check_group_password', [$dbh, $group_id, $data->{'group_password'}]);
|
||||
if (defined($rc) && $rc != 1) {
|
||||
logger($pa_config, "Agent $agent_name did not send a valid password for group id $group_id.", 10);
|
||||
$group_id = pandora_get_agent_group($pa_config, $dbh, $agent_name, $data->{'group'}, $data->{'group_password'});
|
||||
if ($group_id <= 0) {
|
||||
pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': No valid group found.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
|
||||
logger($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': No valid group found.", 3);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.736";
|
||||
my $pandora_build = "190725";
|
||||
my $pandora_build = "190726";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.736
|
||||
%define release 190725
|
||||
%define release 190726
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.736
|
||||
%define release 190725
|
||||
%define release 190726
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.736"
|
||||
PI_BUILD="190725"
|
||||
PI_BUILD="190726"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.736 PS190725";
|
||||
my $version = "7.0NG.736 PS190726";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.736 PS190725";
|
||||
my $version = "7.0NG.736 PS190726";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue