Merge remote-tracking branch 'origin/develop' into ent-2441-despliegue-de-agentes-desde-pandora
This commit is contained in:
commit
1445740e2c
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.736-190723
|
||||
Version: 7.0NG.736-190725
|
||||
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-190723"
|
||||
pandora_version="7.0NG.736-190725"
|
||||
|
||||
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 => '190723';
|
||||
use constant AGENT_BUILD => '190725';
|
||||
|
||||
# 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 190723
|
||||
%define release 190725
|
||||
|
||||
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 190723
|
||||
%define release 190725
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.736"
|
||||
PI_BUILD="190723"
|
||||
PI_BUILD="190725"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{190723}
|
||||
{190725}
|
||||
|
||||
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 190723)")
|
||||
#define PANDORA_VERSION ("7.0NG.736(Build 190725)")
|
||||
|
||||
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 190723))"
|
||||
VALUE "ProductVersion", "(7.0NG.736(Build 190725))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.736-190723
|
||||
Version: 7.0NG.736-190725
|
||||
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-190723"
|
||||
pandora_version="7.0NG.736-190725"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC190723';
|
||||
$build_version = 'PC190725';
|
||||
$pandora_version = 'v7.0NG.736';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -1210,12 +1210,12 @@ function events_get_all(
|
|||
|
||||
$server_join = '';
|
||||
if (is_metaconsole()) {
|
||||
$server_join = ' LEFT JOIN tmetaconsole_setup ts
|
||||
ON ts.id = te.server_id';
|
||||
$server_join = ' INNER JOIN tmetaconsole_setup ts
|
||||
ON ts.id = te.server_id AND ts.server_name = ta.server_name';
|
||||
if (!empty($filter['server_id'])) {
|
||||
$server_join = sprintf(
|
||||
' LEFT JOIN tmetaconsole_setup ts
|
||||
ON ts.id = te.server_id AND ts.id= %d',
|
||||
' INNER JOIN tmetaconsole_setup ts
|
||||
ON ts.id = te.server_id AND ts.server_name = ta.server_name AND ts.id= %d',
|
||||
$filter['server_id']
|
||||
);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.736';
|
||||
$build = '190723';
|
||||
$build = '190725';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.736
|
||||
%define release 190723
|
||||
%define release 190725
|
||||
|
||||
# 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 190723
|
||||
%define release 190725
|
||||
|
||||
# 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 190723
|
||||
%define release 190725
|
||||
%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-190723
|
||||
Version: 7.0NG.736-190725
|
||||
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-190723"
|
||||
pandora_version="7.0NG.736-190725"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -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 = "190723";
|
||||
my $pandora_build = "190725";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -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 = "190723";
|
||||
my $pandora_build = "190725";
|
||||
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 190723
|
||||
%define release 190725
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.736
|
||||
%define release 190723
|
||||
%define release 190725
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.736"
|
||||
PI_BUILD="190723"
|
||||
PI_BUILD="190725"
|
||||
|
||||
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 PS190723";
|
||||
my $version = "7.0NG.736 PS190725";
|
||||
|
||||
# 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 PS190723";
|
||||
my $version = "7.0NG.736 PS190725";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
@ -284,19 +284,94 @@ sub api_call($$$;$$$$) {
|
|||
return $content;
|
||||
}
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Update token conf file agent
|
||||
###############################################################################
|
||||
sub update_conf_txt ($$$$) {
|
||||
my ($conf, $agent_name, $token, $value) = @_;
|
||||
|
||||
# Read the conf of each agent.
|
||||
my $conf_file_txt = enterprise_hook(
|
||||
'read_agent_conf_file',
|
||||
[
|
||||
$conf,
|
||||
$agent_name
|
||||
]
|
||||
);
|
||||
|
||||
# Check if there is agent conf.
|
||||
if(!$conf_file_txt){
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $updated = 0;
|
||||
my $txt_content = "";
|
||||
|
||||
my @lines = split /\n/, $conf_file_txt;
|
||||
|
||||
foreach my $line (@lines) {
|
||||
if ($line =~ /^\s*$token\s/ || $line =~ /^#$token\s/ || $line =~ /^#\s$token\s/) {
|
||||
$txt_content .= $token.' '.$value."\n";
|
||||
$updated = 1;
|
||||
} else {
|
||||
$txt_content .= $line."\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($updated == 0) {
|
||||
$txt_content .= "\n$token $value\n";
|
||||
}
|
||||
|
||||
# Write the conf.
|
||||
my $result = enterprise_hook(
|
||||
'write_agent_conf_file',
|
||||
[
|
||||
$conf,
|
||||
$agent_name,
|
||||
$txt_content
|
||||
]
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Disable a entire group
|
||||
###############################################################################
|
||||
sub pandora_disable_group ($$$) {
|
||||
my ($conf, $dbh, $group) = @_;
|
||||
|
||||
my @agents_bd = [];
|
||||
my $result = 0;
|
||||
|
||||
if ($group == 0){
|
||||
# Extract all the names of the pandora agents if it is for all = 0.
|
||||
@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente');
|
||||
|
||||
# Update bbdd.
|
||||
db_do ($dbh, "UPDATE tagente SET disabled = 1");
|
||||
}
|
||||
else {
|
||||
# Extract all the names of the pandora agents if it is for group.
|
||||
@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente WHERE id_grupo = ?', $group);
|
||||
|
||||
# Update bbdd.
|
||||
db_do ($dbh, "UPDATE tagente SET disabled = 1 WHERE id_grupo = $group");
|
||||
}
|
||||
exit;
|
||||
|
||||
foreach my $name_agent (@agents_bd) {
|
||||
# Check the standby field I put it to 0.
|
||||
my $new_conf = update_conf_txt(
|
||||
$conf,
|
||||
$name_agent->{'nombre'},
|
||||
'standby',
|
||||
'1'
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
@ -305,13 +380,35 @@ sub pandora_disable_group ($$$) {
|
|||
sub pandora_enable_group ($$$) {
|
||||
my ($conf, $dbh, $group) = @_;
|
||||
|
||||
my @agents_bd = [];
|
||||
my $result = 0;
|
||||
|
||||
if ($group == 0){
|
||||
db_do ($dbh, "UPDATE tagente SET disabled = 0");
|
||||
# Extract all the names of the pandora agents if it is for all = 0.
|
||||
@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente');
|
||||
|
||||
# Update bbdd.
|
||||
$result = db_do ($dbh, "UPDATE tagente SET disabled = 0");
|
||||
}
|
||||
else {
|
||||
db_do ($dbh, "UPDATE tagente SET disabled = 0 WHERE id_grupo = $group");
|
||||
# Extract all the names of the pandora agents if it is for group.
|
||||
@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente WHERE id_grupo = ?', $group);
|
||||
|
||||
# Update bbdd.
|
||||
$result = db_do ($dbh, "UPDATE tagente SET disabled = 0 WHERE id_grupo = $group");
|
||||
}
|
||||
exit;
|
||||
|
||||
foreach my $name_agent (@agents_bd) {
|
||||
# Check the standby field I put it to 0.
|
||||
my $new_conf = update_conf_txt(
|
||||
$conf,
|
||||
$name_agent->{'nombre'},
|
||||
'standby',
|
||||
'0'
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
|
Loading…
Reference in New Issue