mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Merge remote-tracking branch 'origin/ent-EDF' into ent-4610-Alertas-de-logs
This commit is contained in:
commit
443eb1168c
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.740-191113
|
Version: 7.0NG.740-191118
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -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.740-191113"
|
pandora_version="7.0NG.740-191118"
|
||||||
|
|
||||||
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
|
||||||
|
@ -55,7 +55,7 @@ my $Sem = undef;
|
|||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.740';
|
use constant AGENT_VERSION => '7.0NG.740';
|
||||||
use constant AGENT_BUILD => '191113';
|
use constant AGENT_BUILD => '191118';
|
||||||
|
|
||||||
# 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;
|
||||||
@ -296,6 +296,77 @@ sub load_libraries() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Erase blank spaces before and after the string
|
||||||
|
################################################################################
|
||||||
|
sub trim {
|
||||||
|
my $string = shift;
|
||||||
|
if (empty($string)){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$string =~ s/\r//g;
|
||||||
|
|
||||||
|
chomp($string);
|
||||||
|
$string =~ s/^\s+//g;
|
||||||
|
$string =~ s/\s+$//g;
|
||||||
|
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Mix hashses
|
||||||
|
################################################################################
|
||||||
|
sub merge_hashes {
|
||||||
|
my $_h1 = shift;
|
||||||
|
my $_h2 = shift;
|
||||||
|
|
||||||
|
if (ref($_h1) ne "HASH") {
|
||||||
|
return \%{$_h2} if (ref($_h2) eq "HASH");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ref($_h2) ne "HASH") {
|
||||||
|
return \%{$_h1} if (ref($_h1) eq "HASH");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ref($_h1) ne "HASH") && (ref($_h2) ne "HASH")) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
my %ret = (%{$_h1}, %{$_h2});
|
||||||
|
|
||||||
|
return \%ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Empty
|
||||||
|
################################################################################
|
||||||
|
sub empty {
|
||||||
|
my $str = shift;
|
||||||
|
|
||||||
|
if (!(defined($str)) ){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(looks_like_number($str)){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ref($str) eq "ARRAY") {
|
||||||
|
return (($#{$str}<0)?1:0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ref($str) eq "HASH") {
|
||||||
|
my @tmp = keys %{$str};
|
||||||
|
return (($#tmp<0)?1:0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($str =~ /^\ *[\n\r]{0,2}\ *$/) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Check a regular expression. Returns 1 if its valid, 0 otherwise.
|
# Check a regular expression. Returns 1 if its valid, 0 otherwise.
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -731,13 +802,6 @@ sub parse_conf_modules($) {
|
|||||||
# Macros
|
# Macros
|
||||||
} elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) {
|
} elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) {
|
||||||
$module->{'macros'}{$1} = $2;
|
$module->{'macros'}{$1} = $2;
|
||||||
# Commands
|
|
||||||
} elsif ($line =~ /^\s*cmd_file\s+(.+)$/) {
|
|
||||||
if (ref ($Conf{'commands'}) ne "HASH") {
|
|
||||||
$Conf{'commands'} = {};
|
|
||||||
}
|
|
||||||
# Initialize empty command hash.
|
|
||||||
$Conf{'commands'}->{$1} = {};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -832,7 +896,21 @@ sub read_config (;$) {
|
|||||||
next if ($line =~ /^module\s*\w*/);
|
next if ($line =~ /^module\s*\w*/);
|
||||||
|
|
||||||
#Configuration token
|
#Configuration token
|
||||||
if ($line =~ /^\s*(\S+)\s+(.*)$/) {
|
if ($line =~ /^\s*(\S+)\s+(.*)$/) {
|
||||||
|
# Reserved keyword.
|
||||||
|
next if ($1 eq "commands");
|
||||||
|
|
||||||
|
if ($1 eq "cmd_file") {
|
||||||
|
# Commands
|
||||||
|
if (ref ($Conf{'commands'}) ne "HASH") {
|
||||||
|
$Conf{'commands'} = {};
|
||||||
|
}
|
||||||
|
# Initialize empty command hash.
|
||||||
|
$Conf{'commands'}->{$2} = {};
|
||||||
|
log_message('setup', "Command required $2");
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
log_message ('setup', "$1 is $2");
|
log_message ('setup', "$1 is $2");
|
||||||
$Conf{$1} = $2;
|
$Conf{$1} = $2;
|
||||||
|
|
||||||
@ -979,6 +1057,7 @@ sub read_config (;$) {
|
|||||||
$Conf{'secondary_server_opts'} = '-x \'' . $Conf{'secondary_server_pwd'} . '\' ' . $Conf{'secondary_server_opts'} if ($Conf{'secondary_server_pwd'} ne '');
|
$Conf{'secondary_server_opts'} = '-x \'' . $Conf{'secondary_server_pwd'} . '\' ' . $Conf{'secondary_server_opts'} if ($Conf{'secondary_server_pwd'} ne '');
|
||||||
$Conf{'secondary_server_opts'} = '-c ' . $Conf{'secondary_server_opts'} if ($Conf{'secondary_server_ssl'} eq '1');
|
$Conf{'secondary_server_opts'} = '-c ' . $Conf{'secondary_server_opts'} if ($Conf{'secondary_server_ssl'} eq '1');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
@ -1289,6 +1368,10 @@ sub check_remote_config () {
|
|||||||
%Collections = ();
|
%Collections = ();
|
||||||
%Conf = %DefaultConf;
|
%Conf = %DefaultConf;
|
||||||
|
|
||||||
|
# Supposed to discard current configuration but not.
|
||||||
|
# Cleanup old commands configuration.
|
||||||
|
$Conf{'commands'} = {};
|
||||||
|
|
||||||
# Reload the new configuration
|
# Reload the new configuration
|
||||||
read_config ();
|
read_config ();
|
||||||
|
|
||||||
@ -1421,7 +1504,7 @@ sub check_collections () {
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Check for remote commands defined.
|
# Check for remote commands defined.
|
||||||
################################################################################
|
################################################################################
|
||||||
sub prepare_remote_commands {
|
sub prepare_commands {
|
||||||
if ($YAML == 0) {
|
if ($YAML == 0) {
|
||||||
log_message(
|
log_message(
|
||||||
'error',
|
'error',
|
||||||
@ -1430,13 +1513,27 @@ sub prepare_remote_commands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Force configuration file read.
|
||||||
|
my @commands = read_config('cmd_file');
|
||||||
|
|
||||||
|
if (empty(\@commands)) {
|
||||||
|
$Conf{'commands'} = {};
|
||||||
|
} else {
|
||||||
|
foreach my $rcmd (@commands) {
|
||||||
|
$Conf{'commands'}->{trim($rcmd)} = {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cleanup old commands. Not registered.
|
||||||
|
cleanup_old_commands();
|
||||||
|
|
||||||
foreach my $ref (keys %{$Conf{'commands'}}) {
|
foreach my $ref (keys %{$Conf{'commands'}}) {
|
||||||
my $file_content;
|
my $file_content;
|
||||||
my $download = 0;
|
my $download = 0;
|
||||||
my $rcmd_file = $ConfDir.'/commands/'.$ref.'.rcmd';
|
my $rcmd_file = $ConfDir.'/commands/'.$ref.'.rcmd';
|
||||||
|
|
||||||
# Check for local .rcmd.done files
|
# Check for local .rcmd.done files
|
||||||
if (-e $Conf{'temporal'}.'/'.$ref.'.rcmd.done') {
|
if (-e $rcmd_file.'.done') {
|
||||||
# Ignore.
|
# Ignore.
|
||||||
delete $Conf{'commands'}->{$ref};
|
delete $Conf{'commands'}->{$ref};
|
||||||
next;
|
next;
|
||||||
@ -1531,19 +1628,101 @@ sub report_command {
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Cleanup unreferenced rcmd and rcmd.done files.
|
||||||
|
################################################################################
|
||||||
|
sub cleanup_old_commands {
|
||||||
|
# Cleanup old .rcmd and .rcmd.done files.
|
||||||
|
my %registered = map { $_.'.rcmd' => 1 } keys %{$Conf{'commands'}};
|
||||||
|
if(opendir(my $dir, $ConfDir.'/commands/')) {
|
||||||
|
while (my $item = readdir($dir)) {
|
||||||
|
|
||||||
|
# Skip other files.
|
||||||
|
next if ($item !~ /\.rcmd$/);
|
||||||
|
|
||||||
|
# Clean .rcmd.done file if its command is not referenced in conf.
|
||||||
|
if (!defined($registered{$item})) {
|
||||||
|
if (-e $ConfDir.'/commands/'.$item) {
|
||||||
|
unlink($ConfDir.'/commands/'.$item);
|
||||||
|
}
|
||||||
|
if (-e $ConfDir.'/commands/'.$item.'.done') {
|
||||||
|
unlink($ConfDir.'/commands/'.$item.'.done');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Close dir.
|
||||||
|
closedir($dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Executes a command using defined timeout.
|
# Executes a command using defined timeout.
|
||||||
################################################################################
|
################################################################################
|
||||||
sub execute_command_timeout {
|
sub execute_command_timeout {
|
||||||
my ($command, $timeout) = @_;
|
my ($cmd, $timeout) = @_;
|
||||||
|
|
||||||
if (!looks_like_number($timeout)) {
|
if (!defined($timeout)
|
||||||
`$command`;
|
|| !looks_like_number($timeout)
|
||||||
} else {
|
|| $timeout <= 0
|
||||||
`$command`;
|
) {
|
||||||
|
`$cmd`;
|
||||||
|
return $?>>8;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $?>>8;
|
my $remaining_timeout = $timeout;
|
||||||
|
|
||||||
|
my $RET;
|
||||||
|
my $output;
|
||||||
|
|
||||||
|
my $pid = open ($RET, "-|");
|
||||||
|
if (!defined($pid)) {
|
||||||
|
# Failed to fork.
|
||||||
|
log_message('error', '[command] Failed to fork.');
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
if ($pid == 0) {
|
||||||
|
# Child.
|
||||||
|
my $ret;
|
||||||
|
eval {
|
||||||
|
local $SIG{ALRM} = sub { die "timeout\n" };
|
||||||
|
alarm $timeout;
|
||||||
|
`$cmd`;
|
||||||
|
alarm 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
my $result = ($?>>8);
|
||||||
|
print $result;
|
||||||
|
|
||||||
|
# Exit child.
|
||||||
|
# Child finishes.
|
||||||
|
exit;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
# Parent waiting.
|
||||||
|
while( --$remaining_timeout > 0 ){
|
||||||
|
if (wait == -1) {
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
# Wait child up to timeout seconds.
|
||||||
|
sleep 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($remaining_timeout > 0) {
|
||||||
|
# Retrieve output from child.
|
||||||
|
$output = do { local $/; <$RET> };
|
||||||
|
$output = $output>>8;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# Timeout expired.
|
||||||
|
return 124;
|
||||||
|
}
|
||||||
|
|
||||||
|
close($RET);
|
||||||
|
|
||||||
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -1552,28 +1731,48 @@ sub execute_command_timeout {
|
|||||||
# $std_files = ' >> /tmp/stdout 2>> /tmp/stderr
|
# $std_files = ' >> /tmp/stdout 2>> /tmp/stderr
|
||||||
################################################################################
|
################################################################################
|
||||||
sub execute_command_block {
|
sub execute_command_block {
|
||||||
my ($commands, $std_files, $timeout) = @_;
|
my ($commands, $std_files, $timeout, $retry) = @_;
|
||||||
|
|
||||||
return 0 unless defined($commands);
|
return 0 unless defined($commands);
|
||||||
|
|
||||||
|
my $retries = $retry;
|
||||||
|
|
||||||
|
$retries = 1 unless looks_like_number($retries) && $retries > 0;
|
||||||
|
|
||||||
my $err_level = 0;
|
my $err_level = 0;
|
||||||
$std_files = '' unless defined ($std_files);
|
$std_files = '' unless defined ($std_files);
|
||||||
|
|
||||||
if (ref($commands) ne "ARRAY") {
|
if (ref($commands) ne "ARRAY") {
|
||||||
return 0 if $commands eq '';
|
return 0 if $commands eq '';
|
||||||
$err_level = execute_command_timeout(
|
|
||||||
"($commands) $std_files",
|
do {
|
||||||
$timeout
|
$err_level = execute_command_timeout(
|
||||||
);
|
"($commands) $std_files",
|
||||||
|
$timeout
|
||||||
|
);
|
||||||
|
|
||||||
|
# Do not retry if success.
|
||||||
|
last if looks_like_number($err_level) && $err_level == 0;
|
||||||
|
} while ((--$retries) > 0);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
foreach my $comm (@{$commands}) {
|
foreach my $comm (@{$commands}) {
|
||||||
next unless defined($comm);
|
next unless defined($comm);
|
||||||
$err_level = execute_command_timeout(
|
$retries = $retry;
|
||||||
"($comm) $std_files",
|
$retries = 1 unless looks_like_number($retries) && $retries > 0;
|
||||||
$timeout
|
|
||||||
);
|
|
||||||
|
|
||||||
|
do {
|
||||||
|
$err_level = execute_command_timeout(
|
||||||
|
"($comm) $std_files",
|
||||||
|
$timeout
|
||||||
|
);
|
||||||
|
|
||||||
|
# Do not retry if success.
|
||||||
|
last if looks_like_number($err_level) && $err_level == 0;
|
||||||
|
|
||||||
|
} while ((--$retries) > 0);
|
||||||
|
|
||||||
|
# Do not continue evaluating block if failed.
|
||||||
last unless ($err_level == 0);
|
last unless ($err_level == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3271,24 +3470,8 @@ while (1) {
|
|||||||
# Check file collections
|
# Check file collections
|
||||||
check_collections () unless ($Conf{'debug'} eq '1');
|
check_collections () unless ($Conf{'debug'} eq '1');
|
||||||
|
|
||||||
if ($Conf{'debug'} ne '1') {
|
# Check scheduled commands
|
||||||
# Check remote commands
|
prepare_commands() unless ($Conf{'debug'} eq '1');
|
||||||
prepare_remote_commands ();
|
|
||||||
|
|
||||||
# Cleanup old .rcmd.done files.
|
|
||||||
my %registered = map { $_.'.rcmd.done' => 1 } keys %{$Conf{'commands'}};
|
|
||||||
if(opendir(my $dir, $ConfDir.'/commands/')) {
|
|
||||||
while (my $item = readdir($dir)) {
|
|
||||||
# Skip other files.
|
|
||||||
next if ($item !~ /\.rcmd\.done$/);
|
|
||||||
|
|
||||||
# Clean .rcmd.done file if its command is not referenced in conf.
|
|
||||||
if (!defined($registered{$item})) {
|
|
||||||
unlink ($item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Launch broker agents
|
# Launch broker agents
|
||||||
@BrokerPid = ();
|
@BrokerPid = ();
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.740
|
%define version 7.0NG.740
|
||||||
%define release 191113
|
%define release 191118
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.740
|
%define version 7.0NG.740
|
||||||
%define release 191113
|
%define release 191118
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.740"
|
PI_VERSION="7.0NG.740"
|
||||||
PI_BUILD="191113"
|
PI_BUILD="191118"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{191113}
|
{191118}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
@ -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.740(Build 191113)")
|
#define PANDORA_VERSION ("7.0NG.740(Build 191118)")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
@ -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.740(Build 191113))"
|
VALUE "ProductVersion", "(7.0NG.740(Build 191118))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.740-191113
|
Version: 7.0NG.740-191118
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -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.740-191113"
|
pandora_version="7.0NG.740-191118"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -218,7 +218,8 @@ function quickShell()
|
|||||||
if (empty($config['gotty_user']) === false
|
if (empty($config['gotty_user']) === false
|
||||||
&& empty($config['gotty_pass']) === false
|
&& empty($config['gotty_pass']) === false
|
||||||
) {
|
) {
|
||||||
$auth_str = $config['gotty_user'].':'.$config['gotty_pass'];
|
$auth_str = io_safe_output($config['gotty_user']);
|
||||||
|
$auth_str .= ':'.io_output_password($config['gotty_pass']);
|
||||||
$gotty_url = $auth_str.'@'.$host.':'.$port;
|
$gotty_url = $auth_str.'@'.$host.':'.$port;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,7 +382,12 @@ function quickShellSettings()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Interface.
|
// Interface.
|
||||||
ui_print_page_header(__('QuickShell settings'));
|
ui_print_page_header(
|
||||||
|
__('QuickShell settings'),
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'quickshell_settings'
|
||||||
|
);
|
||||||
|
|
||||||
if ($changes > 0) {
|
if ($changes > 0) {
|
||||||
$msg = __('%d Updated', $changes);
|
$msg = __('%d Updated', $changes);
|
||||||
@ -442,25 +448,31 @@ function quickShellSettings()
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'label' => __('Gotty user').ui_print_help_tip(
|
'toggle' => true,
|
||||||
__('Optional, set a user to access gotty service'),
|
'toggle_name' => 'Advanced',
|
||||||
true
|
'block_content' => [
|
||||||
),
|
[
|
||||||
'arguments' => [
|
'label' => __('Gotty user').ui_print_help_tip(
|
||||||
'type' => 'text',
|
__('Optional, set a user to access gotty service'),
|
||||||
'name' => 'gotty_user',
|
true
|
||||||
'value' => $config['gotty_user'],
|
),
|
||||||
],
|
'arguments' => [
|
||||||
],
|
'type' => 'text',
|
||||||
[
|
'name' => 'gotty_user',
|
||||||
'label' => __('Gotty password').ui_print_help_tip(
|
'value' => $config['gotty_user'],
|
||||||
__('Optional, set a password to access gotty service'),
|
],
|
||||||
true
|
],
|
||||||
),
|
[
|
||||||
'arguments' => [
|
'label' => __('Gotty password').ui_print_help_tip(
|
||||||
'type' => 'password',
|
__('Optional, set a password to access gotty service'),
|
||||||
'name' => 'gotty_pass',
|
true
|
||||||
'value' => io_output_password($config['gotty_pass']),
|
),
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'password',
|
||||||
|
'name' => 'gotty_pass',
|
||||||
|
'value' => io_output_password($config['gotty_pass']),
|
||||||
|
],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -30,12 +30,16 @@ CREATE TABLE `tremote_command_target` (
|
|||||||
`rcmd_id` bigint unsigned NOT NULL,
|
`rcmd_id` bigint unsigned NOT NULL,
|
||||||
`id_agent` int(10) unsigned NOT NULL,
|
`id_agent` int(10) unsigned NOT NULL,
|
||||||
`utimestamp` int(20) unsigned NOT NULL default 0,
|
`utimestamp` int(20) unsigned NOT NULL default 0,
|
||||||
`stdout` text,
|
`stdout` MEDIUMTEXT,
|
||||||
`stderr` text,
|
`stderr` MEDIUMTEXT,
|
||||||
`errorlevel` int(10) unsigned NOT NULL default 0,
|
`errorlevel` int(10) unsigned NOT NULL default 0,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
FOREIGN KEY (`rcmd_id`) REFERENCES `tremote_command`(`id`)
|
FOREIGN KEY (`rcmd_id`) REFERENCES `tremote_command`(`id`)
|
||||||
ON UPDATE CASCADE ON DELETE CASCADE
|
ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
INSERT INTO `tconfig`(`token`, `value`) VALUES ('welcome_state', -1);
|
||||||
|
|
||||||
|
ALTER TABLE `tcredential_store` MODIFY COLUMN `product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE', 'SAP') default 'CUSTOM';
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -2249,7 +2249,7 @@ CREATE TABLE `tvisual_console_elements_cache` (
|
|||||||
CREATE TABLE IF NOT EXISTS `tcredential_store` (
|
CREATE TABLE IF NOT EXISTS `tcredential_store` (
|
||||||
`identifier` varchar(100) NOT NULL,
|
`identifier` varchar(100) NOT NULL,
|
||||||
`id_group` mediumint(4) unsigned NOT NULL DEFAULT 0,
|
`id_group` mediumint(4) unsigned NOT NULL DEFAULT 0,
|
||||||
`product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE') default 'CUSTOM',
|
`product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE', 'SAP') default 'CUSTOM',
|
||||||
`username` text,
|
`username` text,
|
||||||
`password` text,
|
`password` text,
|
||||||
`extra_1` text,
|
`extra_1` text,
|
||||||
@ -2327,8 +2327,8 @@ CREATE TABLE `tremote_command_target` (
|
|||||||
`rcmd_id` bigint unsigned NOT NULL,
|
`rcmd_id` bigint unsigned NOT NULL,
|
||||||
`id_agent` int(10) unsigned NOT NULL,
|
`id_agent` int(10) unsigned NOT NULL,
|
||||||
`utimestamp` int(20) unsigned NOT NULL default 0,
|
`utimestamp` int(20) unsigned NOT NULL default 0,
|
||||||
`stdout` text,
|
`stdout` MEDIUMTEXT,
|
||||||
`stderr` text,
|
`stderr` MEDIUMTEXT,
|
||||||
`errorlevel` int(10) unsigned NOT NULL default 0,
|
`errorlevel` int(10) unsigned NOT NULL default 0,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
FOREIGN KEY (`rcmd_id`) REFERENCES `tremote_command`(`id`)
|
FOREIGN KEY (`rcmd_id`) REFERENCES `tremote_command`(`id`)
|
||||||
|
77
pandora_console/general/sap_view.php
Normal file
77
pandora_console/general/sap_view.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Credential store
|
||||||
|
*
|
||||||
|
* @category HelperFeedBack
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Help Feedback
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class sap_views.
|
||||||
|
*/
|
||||||
|
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
enterprise_include_once('/include/class/SAPView.class.php');
|
||||||
|
|
||||||
|
$ajaxPage = 'general/sap_view';
|
||||||
|
|
||||||
|
// Control call flow.
|
||||||
|
try {
|
||||||
|
// User access and validation is being processed on class constructor.
|
||||||
|
$sap_views = new SAPView($ajaxPage);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
if (is_ajax()) {
|
||||||
|
echo json_encode(['error' => '[sap_views]'.$e->getMessage() ]);
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
echo '[sap_views]'.$e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop this execution, but continue 'globally'.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ajax controller.
|
||||||
|
if (is_ajax()) {
|
||||||
|
$method = get_parameter('method', '');
|
||||||
|
|
||||||
|
if (method_exists($sap_views, $method) === true) {
|
||||||
|
if ($sap_views->ajaxMethod($method) === true) {
|
||||||
|
$sap_views->{$method}();
|
||||||
|
} else {
|
||||||
|
$sap_views->error('Unavailable method.');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sap_views->error('Method not found. ['.$method.']');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Stop any execution.
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
// Run.
|
||||||
|
$sap_views->run();
|
||||||
|
}
|
@ -486,6 +486,20 @@ if ($id_agente) {
|
|||||||
$agent_wizard['active'] = false;
|
$agent_wizard['active'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$is_sap = agents_get_sap_agents($id_agente);
|
||||||
|
if ($is_sap) {
|
||||||
|
$saptab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=sap_view&page=1&id_agente='.$id_agente.'">'.html_print_image('images/sap_icon.png', true, ['title' => __('SAP view')]).'</a>';
|
||||||
|
|
||||||
|
if ($tab == 'sap_view') {
|
||||||
|
$saptab['active'] = true;
|
||||||
|
} else {
|
||||||
|
$saptab['active'] = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$saptab = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$total_incidents = agents_get_count_incidents($id_agente);
|
$total_incidents = agents_get_count_incidents($id_agente);
|
||||||
|
|
||||||
// Incident tab.
|
// Incident tab.
|
||||||
@ -531,6 +545,7 @@ if ($id_agente) {
|
|||||||
'group' => $grouptab,
|
'group' => $grouptab,
|
||||||
'gis' => $gistab,
|
'gis' => $gistab,
|
||||||
'agent_wizard' => $agent_wizard,
|
'agent_wizard' => $agent_wizard,
|
||||||
|
'sap_view' => $saptab,
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$onheader = [
|
$onheader = [
|
||||||
@ -546,6 +561,8 @@ if ($id_agente) {
|
|||||||
'group' => $grouptab,
|
'group' => $grouptab,
|
||||||
'gis' => $gistab,
|
'gis' => $gistab,
|
||||||
'agent_wizard' => $agent_wizard,
|
'agent_wizard' => $agent_wizard,
|
||||||
|
'sap_view' => $saptab,
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -691,6 +708,12 @@ if ($id_agente) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'sap_view':
|
||||||
|
$tab_description = '- '.__('SAP view');
|
||||||
|
$help_header = 'sap_view';
|
||||||
|
$tab_name = 'SAP View';
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Default.
|
// Default.
|
||||||
break;
|
break;
|
||||||
@ -2346,6 +2369,10 @@ switch ($tab) {
|
|||||||
include 'agent_wizard.php';
|
include 'agent_wizard.php';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'sap_view':
|
||||||
|
include 'general/sap_view.php';
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (enterprise_hook('switch_agent_tab', [$tab])) {
|
if (enterprise_hook('switch_agent_tab', [$tab])) {
|
||||||
// This will make sure that blank pages will have at least some
|
// This will make sure that blank pages will have at least some
|
||||||
|
@ -28,7 +28,7 @@ if (check_acl($config['id_user'], 0, 'AR')
|
|||||||
|| check_acl($config['id_user'], 0, 'PM')
|
|| check_acl($config['id_user'], 0, 'PM')
|
||||||
) {
|
) {
|
||||||
$sub = [];
|
$sub = [];
|
||||||
$sub['godmode/servers/discovery&wiz=main']['text'] = __('Main');
|
$sub['godmode/servers/discovery&wiz=main']['text'] = __('Start');
|
||||||
$sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery';
|
$sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery';
|
||||||
$sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list');
|
$sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list');
|
||||||
$sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist';
|
$sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist';
|
||||||
|
@ -54,7 +54,7 @@ function get_wiz_class($str)
|
|||||||
__('Discovery'),
|
__('Discovery'),
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
'',
|
'discovery',
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
|
@ -773,6 +773,9 @@ class DiscoveryTaskList extends Wizard
|
|||||||
case DISCOVERY_CLOUD_AWS_RDS:
|
case DISCOVERY_CLOUD_AWS_RDS:
|
||||||
return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&sub=rds&page=0';
|
return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&sub=rds&page=0';
|
||||||
|
|
||||||
|
case DISCOVERY_APP_SAP:
|
||||||
|
return 'wiz=app&mode=SAP&page=0';
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if ($task['description'] == 'console_task') {
|
if ($task['description'] == 'console_task') {
|
||||||
return 'wiz=ctask';
|
return 'wiz=ctask';
|
||||||
|
@ -458,6 +458,7 @@ class Wizard
|
|||||||
|
|
||||||
if (is_array($input['block_content']) === true) {
|
if (is_array($input['block_content']) === true) {
|
||||||
$direct = (bool) $input['direct'];
|
$direct = (bool) $input['direct'];
|
||||||
|
$toggle = (bool) $input['toggle'];
|
||||||
|
|
||||||
// Print independent block of inputs.
|
// Print independent block of inputs.
|
||||||
$output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">';
|
$output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">';
|
||||||
@ -471,14 +472,37 @@ class Wizard
|
|||||||
$output .= '<ul class="wizard '.$input['block_class'].'">';
|
$output .= '<ul class="wizard '.$input['block_class'].'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($input['block_content'] as $input) {
|
$html = '';
|
||||||
$output .= $this->printBlock(
|
|
||||||
$input,
|
foreach ($input['block_content'] as $in) {
|
||||||
|
$html .= $this->printBlock(
|
||||||
|
$in,
|
||||||
$return,
|
$return,
|
||||||
(bool) $direct
|
(bool) $direct
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($toggle === true) {
|
||||||
|
$output .= ui_print_toggle(
|
||||||
|
[
|
||||||
|
'name' => (isset($input['toggle_name']) ? $input['toggle_name'] : 'toggle_'.uniqid()),
|
||||||
|
'content' => $html,
|
||||||
|
'title' => $input['toggle_title'],
|
||||||
|
'id' => $input['toggle_id'],
|
||||||
|
'hidden_default' => $input['toggle_hidden_default'],
|
||||||
|
'return' => (isset($input['toggle_return']) ? $input['toggle_return'] : true),
|
||||||
|
'toggle_class' => $input['toggle_toggle_class'],
|
||||||
|
'main_class' => $input['toggle_main_class'],
|
||||||
|
'container_class' => $input['toggle_container_class'],
|
||||||
|
'img_a' => $input['toggle_img_a'],
|
||||||
|
'img_b' => $input['toggle_img_b'],
|
||||||
|
'clean' => (isset($input['toggle_clean']) ? $input['toggle_clean'] : true),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$output .= $html;
|
||||||
|
}
|
||||||
|
|
||||||
// Close block.
|
// Close block.
|
||||||
if (!$direct) {
|
if (!$direct) {
|
||||||
$output .= '</ul>';
|
$output .= '</ul>';
|
||||||
|
BIN
pandora_console/images/sap_icon.png
Normal file
BIN
pandora_console/images/sap_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 324 B |
@ -432,7 +432,7 @@ class CredentialStore extends Wizard
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -866,6 +866,7 @@ class CredentialStore extends Wizard
|
|||||||
'CUSTOM' => __('Custom'),
|
'CUSTOM' => __('Custom'),
|
||||||
'AWS' => __('Aws'),
|
'AWS' => __('Aws'),
|
||||||
'AZURE' => __('Azure'),
|
'AZURE' => __('Azure'),
|
||||||
|
'SAP' => __('SAP'),
|
||||||
// 'GOOGLE' => __('Google'),
|
// 'GOOGLE' => __('Google'),
|
||||||
],
|
],
|
||||||
'selected' => (isset($values['product']) ? $values['product'] : 'CUSTOM'),
|
'selected' => (isset($values['product']) ? $values['product'] : 'CUSTOM'),
|
||||||
@ -900,6 +901,7 @@ class CredentialStore extends Wizard
|
|||||||
case 'GOOGLE':
|
case 'GOOGLE':
|
||||||
// Need further investigation.
|
// Need further investigation.
|
||||||
case 'CUSTOM':
|
case 'CUSTOM':
|
||||||
|
case 'SAP':
|
||||||
$user_label = __('Account ID');
|
$user_label = __('Account ID');
|
||||||
$pass_label = __('Password');
|
$pass_label = __('Password');
|
||||||
$extra1 = false;
|
$extra1 = false;
|
||||||
@ -1038,7 +1040,12 @@ class CredentialStore extends Wizard
|
|||||||
$('#div-extra_2 label').text('<?php echo __('Subscription id'); ?>');
|
$('#div-extra_2 label').text('<?php echo __('Subscription id'); ?>');
|
||||||
$('#div-extra_1').show();
|
$('#div-extra_1').show();
|
||||||
$('#div-extra_2').show();
|
$('#div-extra_2').show();
|
||||||
}
|
} else if ($('#product :selected').val() == "SAP") {
|
||||||
|
$('#div-username label').text('<?php echo __('Account ID.'); ?>');
|
||||||
|
$('#div-password label').text('<?php echo __('Password'); ?>');
|
||||||
|
$('#div-extra_1').hide();
|
||||||
|
$('#div-extra_2').hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,6 +70,7 @@ class Diagnostics extends Wizard
|
|||||||
|
|
||||||
$this->ajaxController = $page;
|
$this->ajaxController = $page;
|
||||||
$this->pdf = $pdf;
|
$this->pdf = $pdf;
|
||||||
|
$this->product_name = io_safe_output(get_product_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -126,7 +127,7 @@ class Diagnostics extends Wizard
|
|||||||
|
|
||||||
// Header.
|
// Header.
|
||||||
ui_print_page_header(
|
ui_print_page_header(
|
||||||
__('Pandora FMS Diagnostic tool'),
|
__('%s Diagnostic tool', $this->product_name),
|
||||||
'images/gm_massive_operations.png',
|
'images/gm_massive_operations.png',
|
||||||
false,
|
false,
|
||||||
'diagnostic_tool_tab',
|
'diagnostic_tool_tab',
|
||||||
@ -190,7 +191,7 @@ class Diagnostics extends Wizard
|
|||||||
foreach ($infoMethods as $key => $method) {
|
foreach ($infoMethods as $key => $method) {
|
||||||
switch ($method) {
|
switch ($method) {
|
||||||
case 'getStatusInfo':
|
case 'getStatusInfo':
|
||||||
$title = __('Info status pandoraFms');
|
$title = __('Info status %s', $this->product_name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'getPHPSetup':
|
case 'getPHPSetup':
|
||||||
@ -219,16 +220,17 @@ class Diagnostics extends Wizard
|
|||||||
|
|
||||||
case 'getTablesFragmentation':
|
case 'getTablesFragmentation':
|
||||||
$title = __(
|
$title = __(
|
||||||
'Tables fragmentation in the Pandora FMS database'
|
'Tables fragmentation in the %s database',
|
||||||
|
$this->product_name
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'getPandoraFMSLogsDates':
|
case 'getPandoraFMSLogsDates':
|
||||||
$title = __('Pandora FMS logs dates');
|
$title = __('%s logs dates', $this->product_name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'getLicenceInformation':
|
case 'getLicenceInformation':
|
||||||
$title = __('Pandora FMS Licence Information');
|
$title = __('%s Licence Information', $this->product_name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'getAttachmentFolder':
|
case 'getAttachmentFolder':
|
||||||
@ -240,7 +242,7 @@ class Diagnostics extends Wizard
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'getServerThreads':
|
case 'getServerThreads':
|
||||||
$title = __('Pandora FMS server threads');
|
$title = __('%s server threads', $this->product_name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'getShowEngine':
|
case 'getShowEngine':
|
||||||
@ -399,11 +401,11 @@ class Diagnostics extends Wizard
|
|||||||
'error' => false,
|
'error' => false,
|
||||||
'data' => [
|
'data' => [
|
||||||
'buildVersion' => [
|
'buildVersion' => [
|
||||||
'name' => __('Pandora FMS Build'),
|
'name' => __('%s Build', $this->product_name),
|
||||||
'value' => $build_version,
|
'value' => $build_version,
|
||||||
],
|
],
|
||||||
'version' => [
|
'version' => [
|
||||||
'name' => __('Pandora FMS Version'),
|
'name' => __('%s Version', $this->product_name),
|
||||||
'value' => $pandora_version,
|
'value' => $pandora_version,
|
||||||
],
|
],
|
||||||
'mr' => [
|
'mr' => [
|
||||||
@ -512,7 +514,7 @@ class Diagnostics extends Wizard
|
|||||||
'error' => false,
|
'error' => false,
|
||||||
'data' => [
|
'data' => [
|
||||||
'countAgents' => [
|
'countAgents' => [
|
||||||
'name' => __('Total agentsy'),
|
'name' => __('Total agents'),
|
||||||
'value' => $countAgents,
|
'value' => $countAgents,
|
||||||
],
|
],
|
||||||
'countModules' => [
|
'countModules' => [
|
||||||
@ -586,7 +588,10 @@ class Diagnostics extends Wizard
|
|||||||
$pandoraDbLastRun = __('Pandora DB has never been executed');
|
$pandoraDbLastRun = __('Pandora DB has never been executed');
|
||||||
if ($dateDbMantenaince !== false) {
|
if ($dateDbMantenaince !== false) {
|
||||||
$difference = ($currentTime - $dateDbMantenaince);
|
$difference = ($currentTime - $dateDbMantenaince);
|
||||||
$pandoraDbLastRun = human_time_comparation($difference);
|
$pandoraDbLastRun = human_time_description_raw(
|
||||||
|
$difference,
|
||||||
|
true
|
||||||
|
);
|
||||||
$pandoraDbLastRun .= ' '.__('Ago');
|
$pandoraDbLastRun .= ' '.__('Ago');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,7 +607,7 @@ class Diagnostics extends Wizard
|
|||||||
'value' => $notInitAgents,
|
'value' => $notInitAgents,
|
||||||
],
|
],
|
||||||
'pandoraDbLastRun' => [
|
'pandoraDbLastRun' => [
|
||||||
'name' => __('PandoraDB Last run'),
|
'name' => __('Pandora DB Last run'),
|
||||||
'value' => $pandoraDbLastRun,
|
'value' => $pandoraDbLastRun,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -671,17 +676,54 @@ class Diagnostics extends Wizard
|
|||||||
$cpuProcessor = 'cat /proc/cpuinfo | grep "processor" | wc -l';
|
$cpuProcessor = 'cat /proc/cpuinfo | grep "processor" | wc -l';
|
||||||
$ramMemTotal = 'cat /proc/meminfo | grep "MemTotal"';
|
$ramMemTotal = 'cat /proc/meminfo | grep "MemTotal"';
|
||||||
|
|
||||||
|
exec(
|
||||||
|
"ifconfig | awk '{ print $2}' | grep -E -o '([0-9]{1,3}[\.]){3}[0-9]{1,3}'",
|
||||||
|
$output
|
||||||
|
);
|
||||||
|
|
||||||
|
$ips = implode(', ', $output);
|
||||||
|
|
||||||
$result = [
|
$result = [
|
||||||
'error' => false,
|
'error' => false,
|
||||||
'data' => [
|
'data' => [
|
||||||
'cpuInfo' => [
|
'cpuInfo' => [
|
||||||
'name' => __('CPU'),
|
'name' => __('CPU'),
|
||||||
'value' => exec($cpuModelName).' x '.exec($cpuProcessor),
|
'value' => exec($cpuModelName).' x '.exec($cpuProcessor),
|
||||||
],
|
],
|
||||||
'ramInfo' => [
|
'ramInfo' => [
|
||||||
'name' => __('RAM'),
|
'name' => __('RAM'),
|
||||||
'value' => exec($ramMemTotal),
|
'value' => exec($ramMemTotal),
|
||||||
],
|
],
|
||||||
|
'osInfo' => [
|
||||||
|
'name' => __('Os'),
|
||||||
|
'value' => exec('uname -a'),
|
||||||
|
],
|
||||||
|
'hostnameInfo' => [
|
||||||
|
'name' => __('Hostname'),
|
||||||
|
'value' => exec('hostname'),
|
||||||
|
],
|
||||||
|
'ipInfo' => [
|
||||||
|
'name' => __('Ip'),
|
||||||
|
'value' => $ips,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$result = [
|
||||||
|
'error' => false,
|
||||||
|
'data' => [
|
||||||
|
'osInfo' => [
|
||||||
|
'name' => __('OS'),
|
||||||
|
'value' => exec('ver'),
|
||||||
|
],
|
||||||
|
'hostnameInfo' => [
|
||||||
|
'name' => __('Hostname'),
|
||||||
|
'value' => exec('hostname'),
|
||||||
|
],
|
||||||
|
'ipInfo' => [
|
||||||
|
'name' => __('Ip'),
|
||||||
|
'value' => exec('ipconfig | findstr IPv4'),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -750,22 +792,6 @@ class Diagnostics extends Wizard
|
|||||||
$message = __('Min. Recommended Value').' 64M';
|
$message = __('Min. Recommended Value').' 64M';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
|
||||||
case 'join_buffer_size':
|
|
||||||
$name = __('Join buffer size');
|
|
||||||
$value = ($item['Value'] / $bytes);
|
|
||||||
$status = (($item['Value'] / $bytes) >= 265) ? 1 : 0;
|
|
||||||
$message = __('Min. Recommended Value 265');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'key_buffer_size':
|
|
||||||
$name = __('Key buffer size');
|
|
||||||
$value = ($item['Value'] / $bytes);
|
|
||||||
$status = (($item['Value'] / $bytes) >= 256) ? 1 : 0;
|
|
||||||
$message = __('Min. Recommended Value').' 256';
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
|
|
||||||
case 'max_allowed_packet':
|
case 'max_allowed_packet':
|
||||||
$name = __('Maximun allowed packet');
|
$name = __('Maximun allowed packet');
|
||||||
$value = ($item['Value'] / $bytes);
|
$value = ($item['Value'] / $bytes);
|
||||||
@ -953,10 +979,10 @@ class Diagnostics extends Wizard
|
|||||||
|
|
||||||
$unit = 'M';
|
$unit = 'M';
|
||||||
|
|
||||||
$pathServerLogs = 'var/log/pandora/pandora_server.log';
|
$pathServerLogs = '/var/log/pandora/pandora_server.log';
|
||||||
$servers = $this->getLogInfo($pathServerLogs);
|
$servers = $this->getLogInfo($pathServerLogs);
|
||||||
|
|
||||||
$pathErrLogs = 'var/log/pandora/pandora_server.error';
|
$pathErrLogs = '/var/log/pandora/pandora_server.error';
|
||||||
$errors = $this->getLogInfo($pathErrLogs);
|
$errors = $this->getLogInfo($pathErrLogs);
|
||||||
|
|
||||||
$pathConsoleLogs = $config['homedir'].'/pandora_console.log';
|
$pathConsoleLogs = $config['homedir'].'/pandora_console.log';
|
||||||
@ -1018,6 +1044,7 @@ class Diagnostics extends Wizard
|
|||||||
$customerKey = db_get_value_sql($sql);
|
$customerKey = db_get_value_sql($sql);
|
||||||
|
|
||||||
// Extract Info license.
|
// Extract Info license.
|
||||||
|
enterprise_include_once('include/functions_license.php');
|
||||||
$license = enterprise_hook('license_get_info');
|
$license = enterprise_hook('license_get_info');
|
||||||
|
|
||||||
// Agent Capacity.
|
// Agent Capacity.
|
||||||
@ -1050,6 +1077,7 @@ class Diagnostics extends Wizard
|
|||||||
WHERE id_tipo_modulo
|
WHERE id_tipo_modulo
|
||||||
BETWEEN 6 AND 18'
|
BETWEEN 6 AND 18'
|
||||||
);
|
);
|
||||||
|
|
||||||
$totalModuleIntervalTime = db_get_value_sql(
|
$totalModuleIntervalTime = db_get_value_sql(
|
||||||
'SELECT SUM(module_interval)
|
'SELECT SUM(module_interval)
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
@ -1060,26 +1088,26 @@ class Diagnostics extends Wizard
|
|||||||
$averageTime = 0;
|
$averageTime = 0;
|
||||||
if ($totalModuleIntervalTime !== false) {
|
if ($totalModuleIntervalTime !== false) {
|
||||||
$averageTime = number_format(
|
$averageTime = number_format(
|
||||||
((int) $totalModuleIntervalTime / (int) $totalNetworkModules),
|
((int) $totalNetworkModules / (int) $totalModuleIntervalTime),
|
||||||
3
|
3
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$moduleNetworkmsg = __(
|
$moduleNetworkmsg = __(
|
||||||
sprintf(
|
sprintf(
|
||||||
'The system is not overloaded (average time %d)',
|
'The system is not overloaded (average time %f)',
|
||||||
$average_time
|
$averageTime
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$moduleNetworkst = 1;
|
$moduleNetworkst = 1;
|
||||||
if ($average_time === 0) {
|
if ($averageTime === 0) {
|
||||||
$moduleNetworkmsg = __('The system has no load');
|
$moduleNetworkmsg = __('The system has no load');
|
||||||
$moduleNetworkst = 0;
|
$moduleNetworkst = 0;
|
||||||
} else if ($averageTime < 180) {
|
} else if ($averageTime > 180) {
|
||||||
$moduleNetworkmsg = __(
|
$moduleNetworkmsg = __(
|
||||||
sprintf(
|
sprintf(
|
||||||
'The system is overloaded (average time %d) and a very fine configuration is required',
|
'The system is overloaded (average time %f) and a very fine configuration is required',
|
||||||
$average_time
|
$averageTime
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$moduleNetworkst = 0;
|
$moduleNetworkst = 0;
|
||||||
@ -1252,37 +1280,47 @@ class Diagnostics extends Wizard
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
$result = [];
|
||||||
return [];
|
$totalServerThreads = 0;
|
||||||
|
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||||
|
$totalServerThreads = shell_exec(
|
||||||
|
'ps -T aux | grep pandora_server | grep -v grep | wc -l'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$totalServerThreads = shell_exec(
|
include_once $config['homedir'].'/include/functions_servers.php';
|
||||||
'ps -T aux | grep pandora_server | grep -v grep | wc -l'
|
$sql = 'SELECT `name`, server_type, threads FROM tserver';
|
||||||
);
|
$servers = db_get_all_rows_sql($sql);
|
||||||
$percentageThreadsRam = shell_exec(
|
|
||||||
"ps axo pmem,cmd | grep pandora_server | awk '{sum+=$1} END {print sum}'"
|
|
||||||
);
|
|
||||||
$percentageThreadsCpu = shell_exec(
|
|
||||||
"ps axo pcpu,cmd | grep pandora_server | awk '{sum+=$1} END {print sum}'"
|
|
||||||
);
|
|
||||||
|
|
||||||
$result = [
|
if (isset($servers) === true && is_array($servers) === true) {
|
||||||
'error' => false,
|
$sum_threads = 0;
|
||||||
'data' => [
|
foreach ($servers as $key => $value) {
|
||||||
'totalServerThreads' => [
|
$result['data']['threads_server_'.$value['server_type']] = [
|
||||||
'name' => __('Total server threads'),
|
'name' => __('Threads').' '.\servers_get_server_string_name(
|
||||||
'value' => $totalServerThreads,
|
$value['server_type']
|
||||||
],
|
),
|
||||||
'percentageThreadsRam' => [
|
'value' => $value['threads'],
|
||||||
'name' => __('Percentage of threads used by the RAM'),
|
];
|
||||||
'value' => $percentageThreadsRam.' %',
|
|
||||||
],
|
$sum_threads += $value['threads'];
|
||||||
'percentageThreadsCpu' => [
|
}
|
||||||
'name' => __('Percentage of threads used by the CPU'),
|
|
||||||
'value' => $percentageThreadsCpu.' %',
|
$result['data']['total_threads'] = [
|
||||||
],
|
'name' => __('Total threads'),
|
||||||
],
|
'value' => $sum_threads,
|
||||||
];
|
'status' => ($sum_threads < $totalServerThreads) ? 2 : 1,
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($sum_threads < $totalServerThreads) {
|
||||||
|
$result['data']['total_threads']['message'] = __(
|
||||||
|
'Current pandora_server running threads'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
__(
|
||||||
|
'There\'s more pandora_server threads than configured, are you running multiple servers simultaneusly?.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return json_encode($result);
|
return json_encode($result);
|
||||||
}
|
}
|
||||||
@ -1315,8 +1353,8 @@ class Diagnostics extends Wizard
|
|||||||
$lenght = strlen($innodb[0]['Status']);
|
$lenght = strlen($innodb[0]['Status']);
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
for ($i = 0; $i < $lenght; $i = ($i + 500)) {
|
for ($i = 0; $i < $lenght; $i = ($i + 300)) {
|
||||||
$str = substr($innodb[0]['Status'], $i, ($i + 500));
|
$str = substr($innodb[0]['Status'], $i, ($i + 300));
|
||||||
$data['showEngine-'.$i] = [
|
$data['showEngine-'.$i] = [
|
||||||
'name' => '',
|
'name' => '',
|
||||||
'value' => '<pre>'.$str.'</pre>',
|
'value' => '<pre>'.$str.'</pre>',
|
||||||
@ -1673,7 +1711,7 @@ class Diagnostics extends Wizard
|
|||||||
'status' => 0,
|
'status' => 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
if (is_file($path) === true) {
|
if (file_exists($path) === true) {
|
||||||
$fileSize = filesize($path);
|
$fileSize = filesize($path);
|
||||||
$sizeServerLog = number_format($fileSize);
|
$sizeServerLog = number_format($fileSize);
|
||||||
$sizeServerLog = (0 + str_replace(',', '', $sizeServerLog));
|
$sizeServerLog = (0 + str_replace(',', '', $sizeServerLog));
|
||||||
@ -1730,7 +1768,17 @@ class Diagnostics extends Wizard
|
|||||||
// of objects, making a post-process of certain fields.
|
// of objects, making a post-process of certain fields.
|
||||||
if (isset($items[$key]['status']) === true) {
|
if (isset($items[$key]['status']) === true) {
|
||||||
$acumValue = $items[$key]['value'];
|
$acumValue = $items[$key]['value'];
|
||||||
if ($items[$key]['status'] === 1) {
|
|
||||||
|
if ($items[$key]['status'] === 2) {
|
||||||
|
$items[$key]['value'] = html_print_image(
|
||||||
|
'images/icono-warning.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('Warning'),
|
||||||
|
'style' => 'width:15px;',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else if ($items[$key]['status'] === 1) {
|
||||||
$items[$key]['value'] = html_print_image(
|
$items[$key]['value'] = html_print_image(
|
||||||
'images/exito.png',
|
'images/exito.png',
|
||||||
true,
|
true,
|
||||||
@ -1872,7 +1920,7 @@ class Diagnostics extends Wizard
|
|||||||
|
|
||||||
$mail_feedback = 'feedback@artica.es';
|
$mail_feedback = 'feedback@artica.es';
|
||||||
$email = $mail_feedback;
|
$email = $mail_feedback;
|
||||||
$subject = 'PandoraFMS Report '.$config['pandora_uid'];
|
$subject = $this->product_name.' Report '.$config['pandora_uid'];
|
||||||
$text = get_parameter('what-happened', '');
|
$text = get_parameter('what-happened', '');
|
||||||
$attachment = get_parameter_switch('include_installation_data', 0);
|
$attachment = get_parameter_switch('include_installation_data', 0);
|
||||||
$email_from = get_parameter_switch('email', '');
|
$email_from = get_parameter_switch('email', '');
|
||||||
|
@ -93,12 +93,13 @@ class HelpFeedBack extends Wizard
|
|||||||
ui_require_css_File('discovery');
|
ui_require_css_File('discovery');
|
||||||
ui_require_css_file('help_feedback');
|
ui_require_css_file('help_feedback');
|
||||||
|
|
||||||
$help_url = get_parameter('url', null);
|
$help_url = get_parameter('b', null);
|
||||||
|
$help_url = base64_decode($help_url);
|
||||||
if ($help_url === null) {
|
if ($help_url === null) {
|
||||||
echo __('Page not found');
|
echo __('Page not found');
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
<iframe width="100%" height="100%" frameBorder="0"
|
<iframe width="100%" height="100%" frameBorder="0" id="h_Viewer"
|
||||||
src="<?php echo $help_url; ?>">
|
src="<?php echo $help_url; ?>">
|
||||||
<?php echo __('Browser not compatible.'); ?>
|
<?php echo __('Browser not compatible.'); ?>
|
||||||
</iframe>
|
</iframe>
|
||||||
@ -143,7 +144,7 @@ class HelpFeedBack extends Wizard
|
|||||||
'block_content' => [
|
'block_content' => [
|
||||||
[
|
[
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'label' => __('Sugesstion'),
|
'label' => __('Suggestion'),
|
||||||
'type' => 'radio_button',
|
'type' => 'radio_button',
|
||||||
'attributes' => 'class="btn"',
|
'attributes' => 'class="btn"',
|
||||||
'name' => 'suggestion',
|
'name' => 'suggestion',
|
||||||
@ -154,7 +155,7 @@ class HelpFeedBack extends Wizard
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'label' => __('Something is not quite right'),
|
'label' => __('Something is wrong'),
|
||||||
'type' => 'radio_button',
|
'type' => 'radio_button',
|
||||||
'attributes' => 'class="btn"',
|
'attributes' => 'class="btn"',
|
||||||
'name' => 'report',
|
'name' => 'report',
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* Pandora build version and version
|
* Pandora build version and version
|
||||||
*/
|
*/
|
||||||
$build_version = 'PC191113';
|
$build_version = 'PC191118';
|
||||||
$pandora_version = 'v7.0NG.740';
|
$pandora_version = 'v7.0NG.740';
|
||||||
|
|
||||||
// Do not overwrite default timezone set if defined.
|
// Do not overwrite default timezone set if defined.
|
||||||
|
@ -537,7 +537,7 @@ define('NODE_GENERIC', 3);
|
|||||||
define('STATUS_OK', 0);
|
define('STATUS_OK', 0);
|
||||||
define('STATUS_ERROR', 1);
|
define('STATUS_ERROR', 1);
|
||||||
|
|
||||||
// Maps (new networkmaps and new visualmaps).
|
// Maps new networkmaps and new visualmaps.
|
||||||
define('MAP_TYPE_NETWORKMAP', 0);
|
define('MAP_TYPE_NETWORKMAP', 0);
|
||||||
define('MAP_TYPE_VISUALMAP', 1);
|
define('MAP_TYPE_VISUALMAP', 1);
|
||||||
|
|
||||||
@ -590,6 +590,7 @@ define('DISCOVERY_CLOUD_AWS_EC2', 6);
|
|||||||
define('DISCOVERY_CLOUD_AWS_RDS', 7);
|
define('DISCOVERY_CLOUD_AWS_RDS', 7);
|
||||||
define('DISCOVERY_CLOUD_AZURE_COMPUTE', 8);
|
define('DISCOVERY_CLOUD_AZURE_COMPUTE', 8);
|
||||||
define('DISCOVERY_DEPLOY_AGENTS', 9);
|
define('DISCOVERY_DEPLOY_AGENTS', 9);
|
||||||
|
define('DISCOVERY_APP_SAP', 10);
|
||||||
|
|
||||||
|
|
||||||
// Discovery types matching definition.
|
// Discovery types matching definition.
|
||||||
|
@ -5416,6 +5416,14 @@ function get_help_info($section_name)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'omnishell':
|
||||||
|
if ($es) {
|
||||||
|
$result .= 'Omnishell&printable=yes';
|
||||||
|
} else {
|
||||||
|
$result .= 'Omnishell&printable=yes';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'module_type_tab':
|
case 'module_type_tab':
|
||||||
if ($es) {
|
if ($es) {
|
||||||
$result .= 'Operacion&printable=yes#Tipos_de_m.C3.B3dulos';
|
$result .= 'Operacion&printable=yes#Tipos_de_m.C3.B3dulos';
|
||||||
@ -5431,6 +5439,22 @@ function get_help_info($section_name)
|
|||||||
$result .= 'GIS&printable=yes#Operation';
|
$result .= 'GIS&printable=yes#Operation';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'quickshell_settings':
|
||||||
|
if ($es) {
|
||||||
|
$result .= 'Configuracion_Consola&printable=yes#Websocket_Engine';
|
||||||
|
} else {
|
||||||
|
$result .= 'Console_Setup&printable=yes#Websocket_engine';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'discovery':
|
||||||
|
if ($es) {
|
||||||
|
$result .= 'Discovery&printable=yes';
|
||||||
|
} else {
|
||||||
|
$result .= 'Discovery&printable=yes';
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -132,6 +132,32 @@ function agents_get_agent_id_by_alias($alias)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return seconds left to contact again with agent.
|
||||||
|
*
|
||||||
|
* @param integer $id_agente Target agent
|
||||||
|
*
|
||||||
|
* @return integer|null Seconds left.
|
||||||
|
*/
|
||||||
|
function agents_get_next_contact_time_left(int $id_agente)
|
||||||
|
{
|
||||||
|
$last_contact = false;
|
||||||
|
|
||||||
|
if ($id_agente > 0) {
|
||||||
|
$last_contact = db_get_value_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT format(intervalo,2) - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto > ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto))) as "val"
|
||||||
|
FROM `tagente`
|
||||||
|
WHERE id_agente = %d ',
|
||||||
|
$id_agente
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $last_contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an agent.
|
* Creates an agent.
|
||||||
*
|
*
|
||||||
@ -3481,3 +3507,66 @@ function agents_get_status_animation($up=true)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if an agent is SAP or or an a agent SAP list.
|
||||||
|
* If function receive false, you will return all SAP agents,
|
||||||
|
* but if you receive an id agent, check if it is a sap agent
|
||||||
|
* and return true or false.
|
||||||
|
*
|
||||||
|
* @param integer $id_agent
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function agents_get_sap_agents($id_agent)
|
||||||
|
{
|
||||||
|
// Available modules.
|
||||||
|
// If you add more modules, please update SAP.pm.
|
||||||
|
$sap_modules = [
|
||||||
|
160 => __('SAP Login OK'),
|
||||||
|
109 => __('SAP Dumps'),
|
||||||
|
111 => __('SAP List lock'),
|
||||||
|
113 => __('SAP Cancel Jobs'),
|
||||||
|
121 => __('SAP Batch input erroneus'),
|
||||||
|
104 => __('SAP Idoc erroneus'),
|
||||||
|
105 => __('SAP IDOC OK'),
|
||||||
|
150 => __('SAP WP without active restart'),
|
||||||
|
151 => __('SAP WP stopped'),
|
||||||
|
102 => __('Average time of SAPGUI response '),
|
||||||
|
180 => __('Dialog response time'),
|
||||||
|
103 => __('Dialog Logged users '),
|
||||||
|
192 => __('SYSFAIL, delivery attempts tRFC wrong entries number'),
|
||||||
|
195 => __('SYSFAIL, queue qRFC INPUT, wrong entries number '),
|
||||||
|
116 => __('Number of Update WPs in error'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$array_agents = [];
|
||||||
|
foreach ($sap_modules as $module => $key) {
|
||||||
|
$array_agents = array_merge(
|
||||||
|
$array_agents,
|
||||||
|
db_get_all_rows_sql(
|
||||||
|
'SELECT ta.id_agente,ta.alias
|
||||||
|
FROM tagente ta
|
||||||
|
INNER JOIN tagente_modulo tam
|
||||||
|
ON tam.id_agente = ta.id_agente
|
||||||
|
WHERE tam.nombre
|
||||||
|
LIKE "%SAP%"
|
||||||
|
GROUP BY ta.id_agente'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$indexed_agents = index_array($array_agents, 'id_agente', false);
|
||||||
|
|
||||||
|
if ($id_agent === false) {
|
||||||
|
return $indexed_agents;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($indexed_agents as $agent => $key) {
|
||||||
|
if ($agent === $id_agent) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -455,6 +455,10 @@ function config_update_config()
|
|||||||
$error_update[] = __('Ipam Ocuppied Manager Warning');
|
$error_update[] = __('Ipam Ocuppied Manager Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!config_update_value('sap_license', get_parameter('sap_license'))) {
|
||||||
|
$error_update[] = __('Deset SAP license');
|
||||||
|
}
|
||||||
|
|
||||||
$inventory_changes_blacklist = get_parameter('inventory_changes_blacklist', []);
|
$inventory_changes_blacklist = get_parameter('inventory_changes_blacklist', []);
|
||||||
if (!config_update_value('inventory_changes_blacklist', implode(',', $inventory_changes_blacklist))) {
|
if (!config_update_value('inventory_changes_blacklist', implode(',', $inventory_changes_blacklist))) {
|
||||||
$error_update[] = __('Inventory changes blacklist');
|
$error_update[] = __('Inventory changes blacklist');
|
||||||
|
@ -4580,7 +4580,7 @@ function events_page_comments($event, $ajax=false)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$comments_array[] = json_decode(io_safe_output($comm), true);
|
$comments_array[] = io_safe_output(json_decode($comm, true));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If comments are not stored in json, the format is old.
|
// If comments are not stored in json, the format is old.
|
||||||
|
@ -1404,14 +1404,19 @@ function ui_print_help_icon(
|
|||||||
}
|
}
|
||||||
|
|
||||||
$url = get_help_info($help_id);
|
$url = get_help_info($help_id);
|
||||||
|
$b = base64_encode($url);
|
||||||
|
|
||||||
|
$help_handler = 'index.php?sec=view&sec2=general/help_feedback';
|
||||||
|
// Needs to use url encoded to avoid anchor lost.
|
||||||
|
$help_handler .= '&b='.$b;
|
||||||
|
$help_handler .= '&pure=1&url='.$url;
|
||||||
$output = html_print_image(
|
$output = html_print_image(
|
||||||
$image,
|
$image,
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'class' => 'img_help',
|
'class' => 'img_help',
|
||||||
'title' => __('Help'),
|
'title' => __('Help'),
|
||||||
'onclick' => "open_help ('".ui_get_full_url('index.php?sec=view&sec2=general/help_feedback&pure=1&url='.$url)."')",
|
'onclick' => "open_help ('".ui_get_full_url($help_handler)."')",
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
],
|
],
|
||||||
false,
|
false,
|
||||||
@ -2915,119 +2920,73 @@ function ui_progress(
|
|||||||
* Generates a progress bar CSS based.
|
* Generates a progress bar CSS based.
|
||||||
* Requires css progress.css
|
* Requires css progress.css
|
||||||
*
|
*
|
||||||
* @param array $progress Progress.
|
* @param array $data With following content:
|
||||||
* @param string $width Width.
|
*
|
||||||
* @param integer $height Height in 'em'.
|
* 'slices' => [
|
||||||
* @param array $color status color.
|
* 'label' => [ // Name of the slice
|
||||||
* @param boolean $return Return or paint (if false).
|
* 'value' => value
|
||||||
* @param boolean $text Text to be displayed,by default progress %.
|
* 'color' => color of the slice.
|
||||||
* @param array $ajax Ajax: [ 'page' => 'page', 'data' => 'data' ] Sample:
|
* ]
|
||||||
* [
|
* ],
|
||||||
* 'page' => 'operation/agentes/ver_agente', Target page.
|
* 'width' => Width
|
||||||
* 'interval' => 100 / $agent["intervalo"], Ask every interval seconds.
|
* 'height' => Height in 'em'
|
||||||
* 'data' => [ Data to be sent to target page.
|
* 'return' => Boolean, return or paint.
|
||||||
* 'id_agente' => $id_agente,
|
|
||||||
* 'refresh_contact' => 1,
|
|
||||||
* ],
|
|
||||||
* ].
|
|
||||||
*
|
*
|
||||||
* @return string HTML code.
|
* @return string HTML code.
|
||||||
*/
|
*/
|
||||||
function ui_progress_extend(
|
function ui_progress_extend(
|
||||||
$progress,
|
array $data
|
||||||
$width='100%',
|
|
||||||
$height='2.5',
|
|
||||||
$color='#82b92e',
|
|
||||||
$return=true,
|
|
||||||
$text='',
|
|
||||||
$ajax=false
|
|
||||||
) {
|
) {
|
||||||
if (!$progress['total']) {
|
if (is_array($data) === false) {
|
||||||
$progress = 0;
|
// Failed.
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$totalW = ($progress['total'] * 100);
|
if (is_array($data['slices']) === false) {
|
||||||
if ($totalW > 100) {
|
// Failed.
|
||||||
$totalW = 100;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($totalW < 0) {
|
if (isset($data['width']) === false) {
|
||||||
$totalW = 0;
|
$data['width'] = '100';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($text)) {
|
if (isset($data['height']) === false) {
|
||||||
$text = $totalW.'%';
|
$data['height'] = '1.3';
|
||||||
|
}
|
||||||
|
|
||||||
|
$total = array_reduce(
|
||||||
|
$data['slices'],
|
||||||
|
function ($carry, $item) {
|
||||||
|
$carry += $item['value'];
|
||||||
|
return $carry;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if ($total == 0) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$badW = (($progress['bad'] * 100 ) / $progress['total']);
|
|
||||||
$goodW = (($progress['good'] * 100 ) / $progress['total']);
|
|
||||||
$unknownW = (($progress['unknown'] * 100 ) / $progress['total']);
|
|
||||||
ui_require_css_file('progress');
|
ui_require_css_file('progress');
|
||||||
$output .= '<div class="progress_main" data-label="total"';
|
|
||||||
$output .= '" style="width: '.$totalW.'%;display:flex; height: '.$height.'em;">';
|
// Main container.
|
||||||
$output .= '<div id="unknow_div" onmouseover="Mouseover()" class="progress_main text_over" data-label="Pending"';
|
$output .= '<div class="progress_main_noborder" ';
|
||||||
$output .= '" style="width: '.$unknownW.'%; height: '.$height.'em; background-color: '.COL_UNKNOWN.'; "></div>';
|
$output .= '" style="width:'.$data['width'].'%;';
|
||||||
$output .= '<div class="progress_main" data-label="Success"';
|
$output .= ' height:'.$data['height'].'em;">';
|
||||||
$output .= '" style="width: '.$goodW.'%; height: '.$height.'em; background-color: '.COL_NORMAL.';"></div>';
|
|
||||||
$output .= '<div class="progress_main" data-label="Error"';
|
foreach ($data['slices'] as $label => $def) {
|
||||||
$output .= '" style="width: '.$badW.'%; height: '.$height.'em; background-color: '.COL_CRITICAL.';"></div>';
|
$width = ($def['value'] * 100 / $total);
|
||||||
|
$output .= '<div class="progress forced_title" ';
|
||||||
|
$output .= ' data-title="'.$label.': '.$def['value'].'" ';
|
||||||
|
$output .= ' data-use_title_for_force_title="1"';
|
||||||
|
$output .= ' style="width:'.$width.'%;';
|
||||||
|
$output .= ' background-color:'.$def['color'].';';
|
||||||
|
$output .= '">';
|
||||||
|
$output .= '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
$output .= '</div>';
|
$output .= '</div>';
|
||||||
|
|
||||||
if ($ajax !== false && is_array($ajax)) {
|
if (!$data['return']) {
|
||||||
$output .= '<script type="text/javascript">
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
function
|
|
||||||
document.getElementById("#unknow_div").onmouseover = function() {
|
|
||||||
document.getElementById("#unknow_div").append( $( "<span> ***</span>" ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
setInterval(() => {
|
|
||||||
last = $(".progress_main").attr("data-label").split(" ")[0]*1;
|
|
||||||
width = $(".progress").width() / $(".progress").parent().width() * 100;
|
|
||||||
width_interval = '.$ajax['interval'].';
|
|
||||||
if (last % 10 == 0) {
|
|
||||||
$.post({
|
|
||||||
url: "'.ui_get_full_url('ajax.php', false, false, false).'",
|
|
||||||
data: {';
|
|
||||||
if (is_array($ajax['data'])) {
|
|
||||||
foreach ($ajax['data'] as $token => $value) {
|
|
||||||
$output .= '
|
|
||||||
'.$token.':"'.$value.'",';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$output .= '
|
|
||||||
page: "'.$ajax['page'].'"
|
|
||||||
},
|
|
||||||
success: function(data) {
|
|
||||||
try {
|
|
||||||
val = JSON.parse(data);
|
|
||||||
$(".progress_main").attr("data-label", val["last_contact"]+" s");
|
|
||||||
$(".progress").width(val["progress"]+"%");
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
$(".progress_text").attr("data-label", (last -1) + " s");
|
|
||||||
if (width < 100) {
|
|
||||||
$(".progress").width((width+width_interval) + "%");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$(".progress_main").attr("data-label", (last -1) + " s");
|
|
||||||
if (width < 100) {
|
|
||||||
$(".progress").width((width+width_interval) + "%");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
});
|
|
||||||
</script>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$return) {
|
|
||||||
echo $output;
|
echo $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3667,6 +3626,7 @@ function ui_print_event_priority(
|
|||||||
* @param string $main_class Main object class.
|
* @param string $main_class Main object class.
|
||||||
* @param string $img_a Image (closed).
|
* @param string $img_a Image (closed).
|
||||||
* @param string $img_b Image (opened).
|
* @param string $img_b Image (opened).
|
||||||
|
* @param string $clean Do not encapsulate with class boxes, clean print.
|
||||||
*
|
*
|
||||||
* @return string HTML.
|
* @return string HTML.
|
||||||
*/
|
*/
|
||||||
@ -3681,7 +3641,8 @@ function ui_toggle(
|
|||||||
$container_class='white-box-content',
|
$container_class='white-box-content',
|
||||||
$main_class='box-shadow white_table_graph',
|
$main_class='box-shadow white_table_graph',
|
||||||
$img_a='images/arrow_down_green.png',
|
$img_a='images/arrow_down_green.png',
|
||||||
$img_b='images/arrow_right_green.png'
|
$img_b='images/arrow_right_green.png',
|
||||||
|
$clean=false
|
||||||
) {
|
) {
|
||||||
// Generate unique Id.
|
// Generate unique Id.
|
||||||
$uniqid = uniqid('');
|
$uniqid = uniqid('');
|
||||||
@ -3697,9 +3658,17 @@ function ui_toggle(
|
|||||||
$original = $img_a;
|
$original = $img_a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$header_class = '';
|
||||||
|
if ($clean === false) {
|
||||||
|
$header_class = 'white_table_graph_header';
|
||||||
|
} else {
|
||||||
|
$main_class = '';
|
||||||
|
$container_class = 'white-box-content-clean';
|
||||||
|
}
|
||||||
|
|
||||||
// Link to toggle.
|
// Link to toggle.
|
||||||
$output = '<div class="'.$main_class.'" id="'.$id.'">';
|
$output = '<div class="'.$main_class.'" id="'.$id.'">';
|
||||||
$output .= '<div class="white_table_graph_header" style="cursor: pointer;" id="tgl_ctrl_'.$uniqid.'">'.html_print_image(
|
$output .= '<div class="'.$header_class.'" style="cursor: pointer;" id="tgl_ctrl_'.$uniqid.'">'.html_print_image(
|
||||||
$original,
|
$original,
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
@ -3767,7 +3736,8 @@ function ui_print_toggle($data)
|
|||||||
(isset($data['container_class']) === true) ? $data['container_class'] : 'white-box-content',
|
(isset($data['container_class']) === true) ? $data['container_class'] : 'white-box-content',
|
||||||
(isset($data['main_class']) === true) ? $data['main_class'] : 'box-shadow white_table_graph',
|
(isset($data['main_class']) === true) ? $data['main_class'] : 'box-shadow white_table_graph',
|
||||||
(isset($data['img_a']) === true) ? $data['img_a'] : 'images/arrow_down_green.png',
|
(isset($data['img_a']) === true) ? $data['img_a'] : 'images/arrow_down_green.png',
|
||||||
(isset($data['img_b']) === true) ? $data['img_b'] : 'images/arrow_right_green.png'
|
(isset($data['img_b']) === true) ? $data['img_b'] : 'images/arrow_right_green.png',
|
||||||
|
(isset($data['clean']) === true) ? $data['clean'] : false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5868,7 +5838,7 @@ function ui_print_comments($comments)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$comments_array[] = json_decode(io_safe_output($comm), true);
|
$comments_array[] = io_safe_output(json_decode($comm, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,6 +439,9 @@ abstract class WebSocketServer
|
|||||||
if ((time() - $this->lastTickTimestamp) > $this->tickInterval) {
|
if ((time() - $this->lastTickTimestamp) > $this->tickInterval) {
|
||||||
$this->lastTickTimestamp = time();
|
$this->lastTickTimestamp = time();
|
||||||
$this->tick();
|
$this->tick();
|
||||||
|
|
||||||
|
// Keep connection with DB active.
|
||||||
|
$this->dbHearthbeat();
|
||||||
}
|
}
|
||||||
|
|
||||||
socket_select($read, $write, $except, 0, $this->timeout);
|
socket_select($read, $write, $except, 0, $this->timeout);
|
||||||
@ -1530,4 +1533,23 @@ abstract class WebSocketServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keeps db connection opened.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function dbHearthbeat()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if (isset($config['dbconnection']) === false
|
||||||
|
|| mysqli_ping($config['dbconnection']) === false
|
||||||
|
) {
|
||||||
|
// Retry connection.
|
||||||
|
db_select_engine();
|
||||||
|
$config['dbconnection'] = db_connect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,38 @@
|
|||||||
height: 20px;
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.element-target-big {
|
||||||
|
width: 100px;
|
||||||
|
margin: 2px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.element-target-big:hover {
|
||||||
|
box-shadow: 0 0 10px -5px #424242;
|
||||||
|
}
|
||||||
|
|
||||||
|
.element-target-big:before {
|
||||||
|
content: attr(data-label);
|
||||||
|
position: relative;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
color: #373737;
|
||||||
|
font-weight: bolder;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
font-size: 1.8em;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
overflow: hidden;
|
||||||
|
font-family: "lato-bolder", "Open Sans", sans-serif;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-target a:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
.status-normal {
|
.status-normal {
|
||||||
background-color: #add570;
|
background-color: #add570;
|
||||||
}
|
}
|
||||||
@ -150,6 +182,12 @@ ul.wizard {
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-class.action-buttons.mw120px.textright.sorting_disabled,
|
||||||
|
.textright {
|
||||||
|
text-align: right;
|
||||||
|
padding-right: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Discovery css global
|
* Discovery css global
|
||||||
*/
|
*/
|
||||||
|
@ -5712,6 +5712,10 @@ div#status_pie {
|
|||||||
padding: 1em;
|
padding: 1em;
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
}
|
}
|
||||||
|
.white-box-content-clean {
|
||||||
|
padding-left: 2em;
|
||||||
|
padding-top: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
.white_table_graph_content {
|
.white_table_graph_content {
|
||||||
border: 1px solid #e2e2e2;
|
border: 1px solid #e2e2e2;
|
||||||
|
@ -4,7 +4,17 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.progress_main_noborder {
|
||||||
|
height: 2.5em;
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
display: inline-block;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
.progress_main:before {
|
.progress_main:before {
|
||||||
content: attr(data-label);
|
content: attr(data-label);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -129,7 +129,7 @@
|
|||||||
<div style='height: 10px'>
|
<div style='height: 10px'>
|
||||||
<?php
|
<?php
|
||||||
$version = '7.0NG.740';
|
$version = '7.0NG.740';
|
||||||
$build = '191113';
|
$build = '191118';
|
||||||
$banner = "v$version Build $build";
|
$banner = "v$version Build $build";
|
||||||
|
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
|
@ -68,14 +68,7 @@ if (is_ajax()) {
|
|||||||
if ($refresh_contact) {
|
if ($refresh_contact) {
|
||||||
$id_agente = get_parameter('id_agente', 0);
|
$id_agente = get_parameter('id_agente', 0);
|
||||||
if ($id_agente > 0) {
|
if ($id_agente > 0) {
|
||||||
$last_contact = db_get_value_sql(
|
$last_contact = agents_get_next_contact_time_left($id_agente);
|
||||||
sprintf(
|
|
||||||
'SELECT format(intervalo,2) - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto > ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto))) as "val"
|
|
||||||
FROM `tagente`
|
|
||||||
WHERE id_agente = %d ',
|
|
||||||
$id_agente
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$progress = agents_get_next_contact($id_agente);
|
$progress = agents_get_next_contact($id_agente);
|
||||||
if ($progress < 0 || $progress > 100) {
|
if ($progress < 0 || $progress > 100) {
|
||||||
|
@ -155,6 +155,8 @@ if (!empty($sub2)) {
|
|||||||
|
|
||||||
enterprise_hook('cluster_menu');
|
enterprise_hook('cluster_menu');
|
||||||
enterprise_hook('aws_menu');
|
enterprise_hook('aws_menu');
|
||||||
|
enterprise_hook('SAP_view');
|
||||||
|
|
||||||
|
|
||||||
if (!empty($sub)) {
|
if (!empty($sub)) {
|
||||||
$menu_operation['estado']['text'] = __('Monitoring');
|
$menu_operation['estado']['text'] = __('Monitoring');
|
||||||
|
@ -30,6 +30,7 @@ if (!$agents || !$searchAgents) {
|
|||||||
echo "<br><div class='nf'>".__('Zero results found')."</div>\n";
|
echo "<br><div class='nf'>".__('Zero results found')."</div>\n";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$table = new StdClass();
|
||||||
$table->cellpadding = 4;
|
$table->cellpadding = 4;
|
||||||
$table->cellspacing = 4;
|
$table->cellspacing = 4;
|
||||||
$table->width = '98%';
|
$table->width = '98%';
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.740
|
%define version 7.0NG.740
|
||||||
%define release 191113
|
%define release 191118
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.740
|
%define version 7.0NG.740
|
||||||
%define release 191113
|
%define release 191118
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.740
|
%define version 7.0NG.740
|
||||||
%define release 191113
|
%define release 191118
|
||||||
%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
|
||||||
|
@ -699,7 +699,7 @@ CREATE TABLE IF NOT EXISTS `tgrupo` (
|
|||||||
CREATE TABLE IF NOT EXISTS `tcredential_store` (
|
CREATE TABLE IF NOT EXISTS `tcredential_store` (
|
||||||
`identifier` varchar(100) NOT NULL,
|
`identifier` varchar(100) NOT NULL,
|
||||||
`id_group` mediumint(4) unsigned NOT NULL DEFAULT 0,
|
`id_group` mediumint(4) unsigned NOT NULL DEFAULT 0,
|
||||||
`product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE') default 'CUSTOM',
|
`product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE', 'SAP') default 'CUSTOM',
|
||||||
`username` text,
|
`username` text,
|
||||||
`password` text,
|
`password` text,
|
||||||
`extra_1` text,
|
`extra_1` text,
|
||||||
@ -3686,8 +3686,8 @@ CREATE TABLE `tremote_command_target` (
|
|||||||
`rcmd_id` bigint unsigned NOT NULL,
|
`rcmd_id` bigint unsigned NOT NULL,
|
||||||
`id_agent` int(10) unsigned NOT NULL,
|
`id_agent` int(10) unsigned NOT NULL,
|
||||||
`utimestamp` int(20) unsigned NOT NULL default 0,
|
`utimestamp` int(20) unsigned NOT NULL default 0,
|
||||||
`stdout` text,
|
`stdout` MEDIUMTEXT,
|
||||||
`stderr` text,
|
`stderr` MEDIUMTEXT,
|
||||||
`errorlevel` int(10) unsigned NOT NULL default 0,
|
`errorlevel` int(10) unsigned NOT NULL default 0,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
FOREIGN KEY (`rcmd_id`) REFERENCES `tremote_command`(`id`)
|
FOREIGN KEY (`rcmd_id`) REFERENCES `tremote_command`(`id`)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-server
|
package: pandorafms-server
|
||||||
Version: 7.0NG.740-191113
|
Version: 7.0NG.740-191118
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -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.740-191113"
|
pandora_version="7.0NG.740-191118"
|
||||||
|
|
||||||
package_cpan=0
|
package_cpan=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -130,9 +130,15 @@ networkserver 1
|
|||||||
|
|
||||||
dataserver 1
|
dataserver 1
|
||||||
|
|
||||||
# Activate (1) Pandora FMS Recon server
|
# Activate (1) Pandora FMS Discovery server
|
||||||
|
|
||||||
reconserver 1
|
discoveryserver 1
|
||||||
|
|
||||||
|
# Discovery SAP (PANDORA FMS ENTERPRISE ONLY)
|
||||||
|
# java /usr/bin/java
|
||||||
|
|
||||||
|
# Discovery SAP utils (PANDORA FMS ENTERPRISE ONLY)
|
||||||
|
# sap_utils /usr/share/pandora_server/util/recon_scripts/SAP
|
||||||
|
|
||||||
# pluginserver : 1 or 0. Set to 1 to activate plugin server with this setup
|
# pluginserver : 1 or 0. Set to 1 to activate plugin server with this setup
|
||||||
|
|
||||||
|
@ -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.740";
|
my $pandora_version = "7.0NG.740";
|
||||||
my $pandora_build = "191113";
|
my $pandora_build = "191118";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
# Setup hash
|
# Setup hash
|
||||||
@ -349,6 +349,12 @@ sub pandora_load_config {
|
|||||||
|
|
||||||
$pa_config->{"fping"} = "/usr/sbin/fping"; # > 5.1SP2
|
$pa_config->{"fping"} = "/usr/sbin/fping"; # > 5.1SP2
|
||||||
|
|
||||||
|
# Discovery SAP
|
||||||
|
$pa_config->{"java"} = "/usr/bin/java";
|
||||||
|
|
||||||
|
# Discovery SAP utils
|
||||||
|
$pa_config->{"sap_utils"} = "/usr/share/pandora_server/util/recon_scripts/SAP";
|
||||||
|
|
||||||
# braa for enterprise snmp server
|
# braa for enterprise snmp server
|
||||||
$pa_config->{"braa"} = "/usr/bin/braa";
|
$pa_config->{"braa"} = "/usr/bin/braa";
|
||||||
|
|
||||||
@ -841,6 +847,12 @@ sub pandora_load_config {
|
|||||||
elsif ($parametro =~ m/^fping\s(.*)/i) {
|
elsif ($parametro =~ m/^fping\s(.*)/i) {
|
||||||
$pa_config->{'fping'}= clean_blank($1);
|
$pa_config->{'fping'}= clean_blank($1);
|
||||||
}
|
}
|
||||||
|
elsif ($parametro =~ m/^java\s(.*)/i) {
|
||||||
|
$pa_config->{'java'}= clean_blank($1);
|
||||||
|
}
|
||||||
|
elsif ($parametro =~ m/^sap_utils\s(.*)/i) {
|
||||||
|
$pa_config->{'sap_utils'}= clean_blank($1);
|
||||||
|
}
|
||||||
elsif ($parametro =~ m/^nmap_timing_template\s+([0-9]*)/i) {
|
elsif ($parametro =~ m/^nmap_timing_template\s+([0-9]*)/i) {
|
||||||
$pa_config->{'nmap_timing_template'}= clean_blank($1);
|
$pa_config->{'nmap_timing_template'}= clean_blank($1);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,25 @@ my $TaskSem :shared;
|
|||||||
use constant {
|
use constant {
|
||||||
OS_OTHER => 10,
|
OS_OTHER => 10,
|
||||||
OS_ROUTER => 17,
|
OS_ROUTER => 17,
|
||||||
OS_SWITCH => 18
|
OS_SWITCH => 18,
|
||||||
|
STEP_SCANNING => 1,
|
||||||
|
STEP_AFT => 2,
|
||||||
|
STEP_TRACEROUTE => 3,
|
||||||
|
STEP_GATEWAY => 4,
|
||||||
|
STEP_STATISTICS => 1,
|
||||||
|
STEP_APP_SCAN => 2,
|
||||||
|
STEP_CUSTOM_QUERIES => 3,
|
||||||
|
DISCOVERY_HOSTDEVICES => 0,
|
||||||
|
DISCOVERY_HOSTDEVICES_CUSTOM => 1,
|
||||||
|
DISCOVERY_CLOUD_AWS => 2,
|
||||||
|
DISCOVERY_APP_VMWARE => 3,
|
||||||
|
DISCOVERY_APP_MYSQL => 4,
|
||||||
|
DISCOVERY_APP_ORACLE => 5,
|
||||||
|
DISCOVERY_CLOUD_AWS_EC2 => 6,
|
||||||
|
DISCOVERY_CLOUD_AWS_RDS => 7,
|
||||||
|
DISCOVERY_CLOUD_AZURE_COMPUTE => 8,
|
||||||
|
DISCOVERY_DEPLOY_AGENTS => 9,
|
||||||
|
DISCOVERY_APP_SAP => 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
@ -196,6 +214,31 @@ sub data_consumer ($$) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($task->{'type'} == DISCOVERY_APP_SAP) {
|
||||||
|
# SAP TASK, retrieve license.
|
||||||
|
$task->{'sap_license'} = pandora_get_config_value(
|
||||||
|
$dbh,
|
||||||
|
'sap_license'
|
||||||
|
);
|
||||||
|
|
||||||
|
# Retrieve credentials for task (optional).
|
||||||
|
if (defined($task->{'auth_strings'})
|
||||||
|
&& $task->{'auth_strings'} ne ''
|
||||||
|
) {
|
||||||
|
my $key = credential_store_get_key(
|
||||||
|
$pa_config,
|
||||||
|
$dbh,
|
||||||
|
$task->{'auth_strings'}
|
||||||
|
);
|
||||||
|
|
||||||
|
# Inside an eval, here it shouln't fail unless bad configured.
|
||||||
|
$task->{'username'} = $key->{'username'};
|
||||||
|
$task->{'password'} = $key->{'password'};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my $recon = new PandoraFMS::Recon::Base(
|
my $recon = new PandoraFMS::Recon::Base(
|
||||||
communities => \@communities,
|
communities => \@communities,
|
||||||
dbh => $dbh,
|
dbh => $dbh,
|
||||||
|
@ -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.740";
|
my $pandora_version = "7.0NG.740";
|
||||||
my $pandora_build = "191113";
|
my $pandora_build = "191118";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||||
|
@ -22,7 +22,7 @@ use constant {
|
|||||||
STEP_TRACEROUTE => 3,
|
STEP_TRACEROUTE => 3,
|
||||||
STEP_GATEWAY => 4,
|
STEP_GATEWAY => 4,
|
||||||
STEP_STATISTICS => 1,
|
STEP_STATISTICS => 1,
|
||||||
STEP_DATABASE_SCAN => 2,
|
STEP_APP_SCAN => 2,
|
||||||
STEP_CUSTOM_QUERIES => 3,
|
STEP_CUSTOM_QUERIES => 3,
|
||||||
DISCOVERY_HOSTDEVICES => 0,
|
DISCOVERY_HOSTDEVICES => 0,
|
||||||
DISCOVERY_HOSTDEVICES_CUSTOM => 1,
|
DISCOVERY_HOSTDEVICES_CUSTOM => 1,
|
||||||
@ -34,6 +34,7 @@ use constant {
|
|||||||
DISCOVERY_CLOUD_AWS_RDS => 7,
|
DISCOVERY_CLOUD_AWS_RDS => 7,
|
||||||
DISCOVERY_CLOUD_AZURE_COMPUTE => 8,
|
DISCOVERY_CLOUD_AZURE_COMPUTE => 8,
|
||||||
DISCOVERY_DEPLOY_AGENTS => 9,
|
DISCOVERY_DEPLOY_AGENTS => 9,
|
||||||
|
DISCOVERY_APP_SAP => 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
# $DEVNULL
|
# $DEVNULL
|
||||||
@ -1440,10 +1441,11 @@ sub cloud_scan($) {
|
|||||||
|
|
||||||
my $type = '';
|
my $type = '';
|
||||||
|
|
||||||
if ($self->{'task_data'}->{'type'} == DISCOVERY_CLOUD_AWS_EC2
|
if ( $self->{'task_data'}->{'type'} == DISCOVERY_CLOUD_AWS_EC2
|
||||||
|| $self->{'task_data'}->{'type'} == DISCOVERY_CLOUD_AWS_RDS) {
|
|| $self->{'task_data'}->{'type'} == DISCOVERY_CLOUD_AWS_RDS) {
|
||||||
$type = 'Aws';
|
$type = 'Aws';
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
# Unrecognized task type.
|
# Unrecognized task type.
|
||||||
call('message', 'Unrecognized task type', 1);
|
call('message', 'Unrecognized task type', 1);
|
||||||
$self->call('update_progress', -1);
|
$self->call('update_progress', -1);
|
||||||
@ -1465,9 +1467,11 @@ sub cloud_scan($) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!$cloudObj) {
|
if (!$cloudObj) {
|
||||||
|
|
||||||
# Failed to initialize, check Cloud credentials or anything.
|
# Failed to initialize, check Cloud credentials or anything.
|
||||||
call('message', 'Unable to initialize PandoraFMS::Recon::Cloud::'.$type, 3);
|
call('message', 'Unable to initialize PandoraFMS::Recon::Cloud::'.$type, 3);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
# Let Cloud object manage scan.
|
# Let Cloud object manage scan.
|
||||||
$cloudObj->scan();
|
$cloudObj->scan();
|
||||||
}
|
}
|
||||||
@ -1479,6 +1483,85 @@ sub cloud_scan($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
##########################################################################
|
||||||
|
# Performs a database scan.
|
||||||
|
##########################################################################
|
||||||
|
sub database_scan($$$) {
|
||||||
|
my ($self, $type, $obj, $global_percent, $targets) = @_;
|
||||||
|
|
||||||
|
my @data;
|
||||||
|
my @modules;
|
||||||
|
|
||||||
|
my $dbObjCfg = $obj->get_config();
|
||||||
|
|
||||||
|
$self->{'summary'}->{'discovered'} += 1;
|
||||||
|
$self->{'summary'}->{'alive'} += 1;
|
||||||
|
|
||||||
|
push @modules,
|
||||||
|
{
|
||||||
|
name => $type . ' connection',
|
||||||
|
type => 'generic_proc',
|
||||||
|
data => 1,
|
||||||
|
description => $type . ' availability'
|
||||||
|
};
|
||||||
|
|
||||||
|
# Analyze.
|
||||||
|
$self->{'step'} = STEP_STATISTICS;
|
||||||
|
$self->{'c_network_percent'} = 30;
|
||||||
|
$self->call('update_progress', $global_percent + (30 / (scalar @$targets)));
|
||||||
|
$self->{'c_network_name'} = $obj->get_host();
|
||||||
|
|
||||||
|
# Retrieve connection statistics.
|
||||||
|
# Retrieve uptime statistics
|
||||||
|
# Retrieve query stats
|
||||||
|
# Retrieve connections
|
||||||
|
# Retrieve innodb
|
||||||
|
# Retrieve cache
|
||||||
|
$self->{'c_network_percent'} = 50;
|
||||||
|
$self->call('update_progress', $global_percent + (50 / (scalar @$targets)));
|
||||||
|
push @modules, $obj->get_statistics();
|
||||||
|
|
||||||
|
# Custom queries.
|
||||||
|
$self->{'step'} = STEP_CUSTOM_QUERIES;
|
||||||
|
$self->{'c_network_percent'} = 80;
|
||||||
|
$self->call('update_progress', $global_percent + (80 / (scalar @$targets)));
|
||||||
|
push @modules, $obj->execute_custom_queries();
|
||||||
|
|
||||||
|
if (defined($dbObjCfg->{'scan_databases'})
|
||||||
|
&& "$dbObjCfg->{'scan_databases'}" eq "1") {
|
||||||
|
|
||||||
|
# Skip database scan in Oracle tasks
|
||||||
|
next if $self->{'type'} == DISCOVERY_APP_ORACLE;
|
||||||
|
|
||||||
|
my $__data = $obj->scan_databases();
|
||||||
|
|
||||||
|
if (ref($__data) eq "ARRAY") {
|
||||||
|
if (defined($dbObjCfg->{'agent_per_database'})
|
||||||
|
&& $dbObjCfg->{'agent_per_database'} == 1) {
|
||||||
|
|
||||||
|
# Agent per database detected.
|
||||||
|
push @data, @{$__data};
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
# Merge modules into engine agent.
|
||||||
|
my @_modules = map {
|
||||||
|
map { $_ }
|
||||||
|
@{$_->{'module_data'}}
|
||||||
|
} @{$__data};
|
||||||
|
|
||||||
|
push @modules, @_modules;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
'modules' => @modules,
|
||||||
|
'data' => @data
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# Perform an Application scan.
|
# Perform an Application scan.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@ -1487,11 +1570,15 @@ sub app_scan($) {
|
|||||||
my ($progress, $step);
|
my ($progress, $step);
|
||||||
|
|
||||||
my $type = '';
|
my $type = '';
|
||||||
|
my $db_scan = 0;
|
||||||
|
|
||||||
|
# APP object initialization.
|
||||||
if ($self->{'task_data'}->{'type'} == DISCOVERY_APP_MYSQL) {
|
if ($self->{'task_data'}->{'type'} == DISCOVERY_APP_MYSQL) {
|
||||||
$type = 'MySQL';
|
$type = 'MySQL';
|
||||||
} elsif ($self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE) {
|
} elsif ($self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE) {
|
||||||
$type = 'Oracle';
|
$type = 'Oracle';
|
||||||
|
} elsif ($self->{'task_data'}->{'type'} == DISCOVERY_APP_SAP) {
|
||||||
|
$type = 'SAP';
|
||||||
} else {
|
} else {
|
||||||
# Unrecognized task type.
|
# Unrecognized task type.
|
||||||
call('message', 'Unrecognized task type', 1);
|
call('message', 'Unrecognized task type', 1);
|
||||||
@ -1505,10 +1592,17 @@ sub app_scan($) {
|
|||||||
my $global_percent = 0;
|
my $global_percent = 0;
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
foreach my $target (@targets) {
|
foreach my $target (@targets) {
|
||||||
|
if ( !defined($target)
|
||||||
|
|| $target eq ''
|
||||||
|
|| $target =~ /^#/) {
|
||||||
|
# Ignore empty target or commented one.
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
my @data;
|
my @data;
|
||||||
my @modules;
|
my @modules;
|
||||||
|
|
||||||
$self->{'step'} = STEP_DATABASE_SCAN;
|
$self->{'step'} = STEP_APP_SCAN;
|
||||||
$self->{'c_network_name'} = $target;
|
$self->{'c_network_name'} = $target;
|
||||||
$self->{'c_network_percent'} = 0;
|
$self->{'c_network_percent'} = 0;
|
||||||
|
|
||||||
@ -1524,16 +1618,25 @@ sub app_scan($) {
|
|||||||
$self->call('update_progress', $global_percent + (10 / (scalar @targets)));
|
$self->call('update_progress', $global_percent + (10 / (scalar @targets)));
|
||||||
|
|
||||||
# Connect to target.
|
# Connect to target.
|
||||||
my $dbObj = PandoraFMS::Recon::Util::enterprise_new(
|
my $obj = PandoraFMS::Recon::Util::enterprise_new(
|
||||||
'PandoraFMS::Recon::Applications::'.$type,
|
'PandoraFMS::Recon::Applications::'.$type,
|
||||||
$self->{'task_data'}
|
{
|
||||||
|
%{$self->{'task_data'}},
|
||||||
|
'target' => $target,
|
||||||
|
'pa_config' => $self->{'pa_config'},
|
||||||
|
'parent' => $self
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (defined($dbObj)) {
|
if (defined($obj)) {
|
||||||
if (!$dbObj->is_connected()) {
|
|
||||||
|
# Verify if object is connected. If cannot connect to current target
|
||||||
|
# return with module.
|
||||||
|
if (!$obj->is_connected()) {
|
||||||
call('message', 'Cannot connect to target ' . $target, 3);
|
call('message', 'Cannot connect to target ' . $target, 3);
|
||||||
$global_percent += $global_step;
|
$global_percent += $global_step;
|
||||||
$self->{'c_network_percent'} = 90;
|
$self->{'c_network_percent'} = 90;
|
||||||
|
|
||||||
# Update progress
|
# Update progress
|
||||||
$self->call('update_progress', $global_percent + (90 / (scalar @targets)));
|
$self->call('update_progress', $global_percent + (90 / (scalar @targets)));
|
||||||
$self->{'summary'}->{'not_alive'} += 1;
|
$self->{'summary'}->{'not_alive'} += 1;
|
||||||
@ -1545,74 +1648,51 @@ sub app_scan($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
my $dbObjCfg = $dbObj->get_config();
|
#
|
||||||
|
# $results is always a hash with:
|
||||||
|
# @modules => 'global' modules.
|
||||||
|
# @data => {
|
||||||
|
# 'agent_data' => {}
|
||||||
|
# 'module_data' => []
|
||||||
|
# }
|
||||||
|
my $results;
|
||||||
|
|
||||||
$self->{'summary'}->{'discovered'} += 1;
|
# Scan connected obj.
|
||||||
$self->{'summary'}->{'alive'} += 1;
|
if ( $self->{'task_data'}->{'type'} == DISCOVERY_APP_MYSQL
|
||||||
|
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE) {
|
||||||
|
|
||||||
push @modules, {
|
# Database.
|
||||||
name => $type . ' connection',
|
$results = $self->database_scan($type, $obj, $global_percent, \@targets);
|
||||||
type => 'generic_proc',
|
|
||||||
data => 1,
|
|
||||||
description => $type . ' availability'
|
|
||||||
};
|
|
||||||
|
|
||||||
# Analyze.
|
} elsif ($self->{'task_data'}->{'type'} == DISCOVERY_APP_SAP) {
|
||||||
$self->{'step'} = STEP_STATISTICS;
|
|
||||||
$self->{'c_network_percent'} = 30;
|
|
||||||
$self->call('update_progress', $global_percent + (30 / (scalar @targets)));
|
|
||||||
$self->{'c_network_name'} = $dbObj->get_host();
|
|
||||||
|
|
||||||
# Retrieve connection statistics.
|
# SAP scan
|
||||||
# Retrieve uptime statistics
|
$results = $obj->scan();
|
||||||
# Retrieve query stats
|
|
||||||
# Retrieve connections
|
|
||||||
# Retrieve innodb
|
|
||||||
# Retrieve cache
|
|
||||||
$self->{'c_network_percent'} = 50;
|
|
||||||
$self->call('update_progress', $global_percent + (50 / (scalar @targets)));
|
|
||||||
push @modules, $dbObj->get_statistics();
|
|
||||||
|
|
||||||
# Custom queries.
|
}
|
||||||
$self->{'step'} = STEP_CUSTOM_QUERIES;
|
|
||||||
$self->{'c_network_percent'} = 80;
|
|
||||||
$self->call('update_progress', $global_percent + (80 / (scalar @targets)));
|
|
||||||
push @modules, $dbObj->execute_custom_queries();
|
|
||||||
|
|
||||||
if (defined($dbObjCfg->{'scan_databases'})
|
# Add results.
|
||||||
&& "$dbObjCfg->{'scan_databases'}" eq "1") {
|
if (ref($results) eq 'HASH') {
|
||||||
# Skip database scan in Oracle tasks
|
if (defined($results->{'modules'})) {
|
||||||
next if $self->{'type'} == DISCOVERY_APP_ORACLE;
|
push @modules, $results->{'modules'};
|
||||||
|
}
|
||||||
|
|
||||||
my $__data = $dbObj->scan_databases();
|
if (defined($results->{'data'})) {
|
||||||
|
push @data, $results->{'data'};
|
||||||
if (ref($__data) eq "ARRAY") {
|
|
||||||
if (defined($dbObjCfg->{'agent_per_database'})
|
|
||||||
&& $dbObjCfg->{'agent_per_database'} == 1) {
|
|
||||||
# Agent per database detected.
|
|
||||||
push @data, @{$__data};
|
|
||||||
} else {
|
|
||||||
# Merge modules into engine agent.
|
|
||||||
my @_modules = map {
|
|
||||||
map { $_ } @{$_->{'module_data'}}
|
|
||||||
} @{$__data};
|
|
||||||
|
|
||||||
push @modules, @_modules;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Put engine agent at the beginning of the list.
|
# Put engine agent at the beginning of the list.
|
||||||
my $version = $dbObj->get_version();
|
my $version = $obj->get_version();
|
||||||
unshift @data,{
|
unshift @data, {
|
||||||
'agent_data' => {
|
'agent_data' => {
|
||||||
'agent_name' => $dbObj->get_agent_name(),
|
'agent_name' => $obj->get_agent_name(),
|
||||||
'os' => $type,
|
'os' => $type,
|
||||||
'os_version' => (defined($version) ? $version : 'Discovery'),
|
'os_version' => (defined($version) ? $version : 'Discovery'),
|
||||||
'interval' => $self->{'task_data'}->{'interval_sweep'},
|
'interval' => $self->{'task_data'}->{'interval_sweep'},
|
||||||
'id_group' => $self->{'task_data'}->{'id_group'},
|
'id_group' => $self->{'task_data'}->{'id_group'},
|
||||||
'address' => $dbObj->get_host(),
|
'address' => $obj->get_host(),
|
||||||
'description' => '',
|
'description' => '',
|
||||||
},
|
},
|
||||||
'module_data' => \@modules,
|
'module_data' => \@modules,
|
||||||
@ -1621,7 +1701,7 @@ sub app_scan($) {
|
|||||||
$self->call('create_agents', \@data);
|
$self->call('create_agents', \@data);
|
||||||
|
|
||||||
# Destroy item.
|
# Destroy item.
|
||||||
undef($dbObj);
|
undef($obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
$global_percent += $global_step;
|
$global_percent += $global_step;
|
||||||
@ -1657,9 +1737,11 @@ sub deploy_scan($) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!$deployer) {
|
if (!$deployer) {
|
||||||
|
|
||||||
# Failed to initialize, check Cloud credentials or anything.
|
# Failed to initialize, check Cloud credentials or anything.
|
||||||
call('message', 'Unable to initialize PandoraFMS::Recon::Deployer', 3);
|
call('message', 'Unable to initialize PandoraFMS::Recon::Deployer', 3);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
# Let deployer object manage scan.
|
# Let deployer object manage scan.
|
||||||
$deployer->scan();
|
$deployer->scan();
|
||||||
}
|
}
|
||||||
@ -1682,13 +1764,16 @@ sub scan($) {
|
|||||||
$self->call('update_progress', 1);
|
$self->call('update_progress', 1);
|
||||||
|
|
||||||
if (defined($self->{'task_data'})) {
|
if (defined($self->{'task_data'})) {
|
||||||
if ($self->{'task_data'}->{'type'} == DISCOVERY_APP_MYSQL
|
if ( $self->{'task_data'}->{'type'} == DISCOVERY_APP_MYSQL
|
||||||
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE) {
|
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE
|
||||||
# Database scan.
|
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_SAP) {
|
||||||
|
|
||||||
|
# Application scan.
|
||||||
return $self->app_scan();
|
return $self->app_scan();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($self->{'task_data'}->{'type'} == DISCOVERY_CLOUD_AWS_RDS) {
|
if ($self->{'task_data'}->{'type'} == DISCOVERY_CLOUD_AWS_RDS) {
|
||||||
|
|
||||||
# Cloud scan.
|
# Cloud scan.
|
||||||
return $self->cloud_scan();
|
return $self->cloud_scan();
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,7 @@ our @EXPORT = qw(
|
|||||||
is_offline
|
is_offline
|
||||||
to_number
|
to_number
|
||||||
clean_blank
|
clean_blank
|
||||||
|
credential_store_get_key
|
||||||
pandora_sendmail
|
pandora_sendmail
|
||||||
pandora_trash_ascii
|
pandora_trash_ascii
|
||||||
enterprise_hook
|
enterprise_hook
|
||||||
@ -487,6 +488,33 @@ sub pandora_daemonize {
|
|||||||
# Pandora other General functions |
|
# Pandora other General functions |
|
||||||
# -------------------------------------------+
|
# -------------------------------------------+
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# SUB credential_store_get_key
|
||||||
|
# Retrieve all information related to target identifier.
|
||||||
|
# param1 - config hash
|
||||||
|
# param2 - dbh link
|
||||||
|
# param3 - string identifier
|
||||||
|
########################################################################
|
||||||
|
sub credential_store_get_key($$$) {
|
||||||
|
my ($pa_config, $dbh, $identifier) = @_;
|
||||||
|
|
||||||
|
my $sql = 'SELECT * FROM tcredential_store WHERE identifier = ?';
|
||||||
|
my $key = PandoraFMS::DB::get_db_single_row($dbh, $sql, $identifier);
|
||||||
|
|
||||||
|
return {
|
||||||
|
'username' => PandoraFMS::Core::pandora_output_password(
|
||||||
|
$pa_config,
|
||||||
|
$key->{'username'}
|
||||||
|
),
|
||||||
|
'password' => PandoraFMS::Core::pandora_output_password(
|
||||||
|
$pa_config,
|
||||||
|
$key->{'password'}
|
||||||
|
),
|
||||||
|
'extra_1' => $key->{'extra_1'},
|
||||||
|
'extra_2' => $key->{'extra_2'},
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# SUB pandora_sendmail
|
# SUB pandora_sendmail
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.740
|
%define version 7.0NG.740
|
||||||
%define release 191113
|
%define release 191118
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.740
|
%define version 7.0NG.740
|
||||||
%define release 191113
|
%define release 191118
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.740"
|
PI_VERSION="7.0NG.740"
|
||||||
PI_BUILD="191113"
|
PI_BUILD="191118"
|
||||||
|
|
||||||
MODE=$1
|
MODE=$1
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
|
@ -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.740 PS191113";
|
my $version = "7.0NG.740 PS191118";
|
||||||
|
|
||||||
# Pandora server configuration
|
# Pandora server configuration
|
||||||
my %conf;
|
my %conf;
|
||||||
|
@ -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.740 PS191113";
|
my $version = "7.0NG.740 PS191118";
|
||||||
|
|
||||||
# save program name for logging
|
# save program name for logging
|
||||||
my $progname = basename($0);
|
my $progname = basename($0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user