Merge remote-tracking branch 'origin/develop' into 1827-Graficas_TIP_eje_x_no_mantiene_ratio
Conflicts: pandora_console/include/functions_graph.php pandora_console/include/styles/pandora.css
This commit is contained in:
commit
123d49d604
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
"name": "__MSG_name__",
|
||||
"version": "1.0",
|
||||
"version": "2.0",
|
||||
"manifest_version": 2,
|
||||
"description": "__MSG_description__",
|
||||
"description": "Pandora FMS Event viewer Chrome extension",
|
||||
"homepage_url": "http://pandorafms.com",
|
||||
"browser_action": {
|
||||
"default_title": "__MSG_default_title__",
|
||||
"default_icon": "images/icon.png",
|
||||
"default_popup": "popup.html"
|
||||
},
|
||||
},
|
||||
"background": {
|
||||
"page": "background.html"
|
||||
},
|
||||
|
|
|
@ -56,6 +56,7 @@ AGENT_WIN_RC_FILE="$CODEHOME/pandora_agents/win32/versioninfo.rc"
|
|||
SATELLITE_FILE="$PANDHOME_ENT/satellite_server/satellite_server.pl"
|
||||
PERL_PLUGIN_FILES="$PANDHOME_ENT/pandora_plugins/NGINX/nginx_requests_queued.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Sybase/sybase_plugin.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/JMX/pandora_plugin_jmx.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/MarkLogic/pandora_marklogic.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Apache/pandora_apache.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Oracle/Database/pandora_oracle.pl \
|
||||
|
@ -66,6 +67,7 @@ $PANDHOME_ENT/pandora_plugins/Informix/informix.pl \
|
|||
$PANDHOME_ENT/pandora_plugins/Ruckus/ruckus.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/UX/pandora_ux.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/JMX/pandora_plugin_jmx.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/MySQL/pandora_mysql.pl \
|
||||
$PANDHOME_ENT/pandora_server/util/plugin/vmware-plugin.pl "
|
||||
PLUGIN_LIB_FILE="$CODEHOME/pandora_server/lib/PandoraFMS/PluginTools.pm"
|
||||
|
||||
|
|
Binary file not shown.
|
@ -102,7 +102,7 @@ my $SERVICE_NAME="Tentacle Server";
|
|||
my $SERVICE_PARAMS=join(' ', @ARGV);
|
||||
|
||||
# Program version
|
||||
our $VERSION = '0.6.1';
|
||||
our $VERSION = '0.6.2';
|
||||
|
||||
# IPv4 address to listen on
|
||||
my @t_addresses = ('0', '0.0.0.0');
|
||||
|
@ -217,6 +217,7 @@ sub print_help {
|
|||
print ("\t-d\t\tRun as daemon.\n");
|
||||
print ("\t-e cert\t\tOpenSSL certificate file. Enables SSL.\n");
|
||||
print ("\t-f ca_cert\tVerify that the peer certificate is signed by a ca.\n");
|
||||
print ("\t-F config_file\tConfiguration file full path.\n");
|
||||
print ("\t-h\t\tShow help.\n");
|
||||
print ("\t-I\t\tEnable insecure operations (file listing and moving).\n");
|
||||
print ("\t-i\t\tFilters.\n");
|
||||
|
@ -278,11 +279,13 @@ sub daemonize {
|
|||
################################################################################
|
||||
sub parse_options {
|
||||
my %opts;
|
||||
my $CONF = {};
|
||||
my $token_value;
|
||||
my $tmp;
|
||||
my @t_addresses_tmp;
|
||||
|
||||
# Get options
|
||||
if (getopts ('a:b:c:de:f:g:hIi:k:l:m:op:qr:s:S:t:TvVwx:', \%opts) == 0 || defined ($opts{'h'})) {
|
||||
if (getopts ('a:b:c:de:f:F:g:hIi:k:l:m:op:qr:s:S:t:TvVwx:', \%opts) == 0 || defined ($opts{'h'})) {
|
||||
print_help ();
|
||||
exit 1;
|
||||
}
|
||||
|
@ -304,10 +307,16 @@ sub parse_options {
|
|||
}
|
||||
}
|
||||
|
||||
# Configuration file
|
||||
if (defined($opts{'F'})) {
|
||||
parse_config_file($opts{'F'}, $CONF);
|
||||
}
|
||||
|
||||
# Address
|
||||
if (defined ($opts{'a'})) {
|
||||
$token_value = get_config_value($opts{'a'}, $CONF->{'addresses'});
|
||||
if (defined ($token_value)) {
|
||||
@t_addresses = ();
|
||||
@t_addresses_tmp = split(/,/, $opts{'a'});
|
||||
@t_addresses_tmp = split(/,/, $token_value);
|
||||
|
||||
foreach my $t_address (@t_addresses_tmp) {
|
||||
$t_address =~ s/^ *(.*?) *$/$1/;
|
||||
|
@ -323,15 +332,17 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Maximum simultaneous connections
|
||||
if (defined ($opts{'c'})) {
|
||||
$t_max_conn = $opts{'c'};
|
||||
$token_value = get_config_value($opts{'c'}, $CONF->{'max_connections'});
|
||||
if (defined ($token_value)) {
|
||||
$t_max_conn = $token_value;
|
||||
if ($t_max_conn !~ /^\d+$/ || $t_max_conn < 1) {
|
||||
error ("Invalid number of maximum simultaneous connections.");
|
||||
}
|
||||
}
|
||||
|
||||
# Run as daemon
|
||||
if (defined ($opts{'d'})) {
|
||||
$token_value = get_config_value($opts{'d'}, $CONF->{'daemon'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
if ($^ eq 'MSWin32') {
|
||||
error ("-d flag not available for this OS.");
|
||||
}
|
||||
|
@ -340,11 +351,12 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Enable SSL
|
||||
if (defined ($opts{'e'})) {
|
||||
$token_value = get_config_value($opts{'e'}, $CONF->{'ssl_cert'});
|
||||
if (defined ($token_value)) {
|
||||
|
||||
require IO::Socket::SSL;
|
||||
|
||||
$t_ssl_cert = $opts{'e'};
|
||||
$t_ssl_cert = $token_value;
|
||||
if (! -f $t_ssl_cert) {
|
||||
error ("File $t_ssl_cert does not exist.");
|
||||
}
|
||||
|
@ -353,21 +365,24 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Verify peer certificate
|
||||
if (defined ($opts{'f'})) {
|
||||
$t_ssl_ca = $opts{'f'};
|
||||
$token_value = get_config_value($opts{'f'}, $CONF->{'ssl_ca'});
|
||||
if (defined ($token_value)) {
|
||||
$t_ssl_ca = $token_value;
|
||||
if (! -f $t_ssl_ca) {
|
||||
error ("File $t_ssl_ca does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
# Insecure mode
|
||||
if (defined ($opts{'I'})) {
|
||||
$token_value = get_config_value($opts{'I'}, $CONF->{'insecure'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
$t_insecure = 1;
|
||||
}
|
||||
|
||||
# Filters (regexp:dir;regexp:dir...)
|
||||
if (defined ($opts{'i'})) {
|
||||
my @filters = split (';', $opts{'i'});
|
||||
$token_value = get_config_value($opts{'i'}, $CONF->{'filters'});
|
||||
if (defined ($token_value)) {
|
||||
my @filters = split (';', $token_value);
|
||||
foreach my $filter (@filters) {
|
||||
my ($regexp, $dir) = split (':', $filter);
|
||||
next unless defined ($regexp) && defined ($dir);
|
||||
|
@ -381,51 +396,58 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# SSL private key file
|
||||
if (defined ($opts{'k'})) {
|
||||
$t_ssl_key = $opts{'k'};
|
||||
$token_value = get_config_value($opts{'k'}, $CONF->{'ssl_key'});
|
||||
if (defined ($token_value)) {
|
||||
$t_ssl_key = $token_value;
|
||||
if (! -f $t_ssl_key) {
|
||||
error ("File $t_ssl_key does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
# Maximum file size
|
||||
if (defined ($opts{'m'})) {
|
||||
$t_max_size = $opts{'m'};
|
||||
$token_value = get_config_value($opts{'m'}, $CONF->{'max_size'});
|
||||
if (defined ($token_value)) {
|
||||
$t_max_size = $token_value;
|
||||
if ($t_max_size !~ /^\d+$/ || $t_max_size < 1) {
|
||||
error ("Invalid maximum file size.");
|
||||
}
|
||||
}
|
||||
|
||||
# File overwrite
|
||||
if (defined ($opts{'o'})) {
|
||||
$token_value = get_config_value($opts{'o'}, $CONF->{'overwrite'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
$t_overwrite = 1;
|
||||
}
|
||||
|
||||
# Port
|
||||
if (defined ($opts{'p'})) {
|
||||
$t_port = $opts{'p'};
|
||||
$token_value = get_config_value($opts{'p'}, $CONF->{'port'});
|
||||
if (defined ($token_value)) {
|
||||
$t_port = $token_value;
|
||||
if ($t_port !~ /^\d+$/ || $t_port < 1 || $t_port > 65535) {
|
||||
error ("Port $t_port is not valid.");
|
||||
}
|
||||
}
|
||||
|
||||
# Quiet mode
|
||||
if (defined ($opts{'q'})) {
|
||||
$token_value = get_config_value($opts{'q'}, $CONF->{'quiet'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
$t_quiet = 1;
|
||||
}
|
||||
|
||||
# Retries
|
||||
if (defined ($opts{'r'})) {
|
||||
$t_retries = $opts{'r'};
|
||||
$token_value = get_config_value($opts{'r'}, $CONF->{'retries'});
|
||||
if (defined ($token_value)) {
|
||||
$t_retries = $token_value;
|
||||
if ($t_retries !~ /^\d+$/ || $t_retries < 1) {
|
||||
error ("Invalid number of retries for network operations.");
|
||||
}
|
||||
}
|
||||
|
||||
# Storage directory
|
||||
if (defined ($opts{'s'})) {
|
||||
$token_value = get_config_value($opts{'s'}, $CONF->{'directory'});
|
||||
if (defined ($token_value)) {
|
||||
|
||||
$t_directory = $opts{'s'};
|
||||
$t_directory = $token_value;
|
||||
|
||||
# Check that directory exists
|
||||
if (! -d $t_directory) {
|
||||
|
@ -444,25 +466,36 @@ sub parse_options {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (! defined($opts{'b'})) {
|
||||
$token_value = get_config_value($opts{'b'}, $CONF->{'proxy_ip'});
|
||||
if (! defined($token_value)) {
|
||||
print_help ();
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
# Timeout
|
||||
if (defined ($opts{'t'})) {
|
||||
$t_timeout = $opts{'t'};
|
||||
$token_value = get_config_value($opts{'t'}, $CONF->{'timeout'});
|
||||
if (defined ($token_value)) {
|
||||
$t_timeout = $token_value;
|
||||
if ($t_timeout !~ /^\d+$/ || $t_timeout < 1) {
|
||||
error ("Invalid timeout for network operations.");
|
||||
}
|
||||
}
|
||||
|
||||
# Read verbose from config file
|
||||
if (defined($CONF->{'verbose'})) {
|
||||
if ($CONF->{'verbose'} eq "1") {
|
||||
$t_log = 1;
|
||||
} elsif ($CONF->{'verbose'} eq "2") {
|
||||
$t_log = 1;
|
||||
$t_log_hard = 1;
|
||||
}
|
||||
}
|
||||
# Be verbose
|
||||
if (defined ($opts{'v'})) {
|
||||
$t_log = 1;
|
||||
$t_log_hard = 0;
|
||||
}
|
||||
|
||||
# Be verbose hard
|
||||
if (defined ($opts{'V'})) {
|
||||
$t_log = 1;
|
||||
|
@ -470,18 +503,21 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# SSL private key password
|
||||
if (defined ($opts{'w'})) {
|
||||
$token_value = get_config_value($opts{'w'}, $CONF->{'ssl_password'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
$t_ssl_pwd = ask_passwd ("Enter private key file password: ", "Enter private key file password again for confirmation: ");
|
||||
}
|
||||
|
||||
# Server password
|
||||
if (defined ($opts{'x'})) {
|
||||
$t_pwd = $opts{'x'};
|
||||
$token_value = get_config_value($opts{'x'}, $CONF->{'password'});
|
||||
if (defined ($token_value)) {
|
||||
$t_pwd = $token_value;
|
||||
}
|
||||
|
||||
#Proxy IP address
|
||||
if (defined ($opts{'b'})) {
|
||||
$t_proxy_ip = $opts{'b'};
|
||||
$token_value = get_config_value($opts{'b'}, $CONF->{'proxy_ip'});
|
||||
if (defined ($token_value)) {
|
||||
$t_proxy_ip = $token_value;
|
||||
if ($t_proxy_ip !~ /^[a-zA-Z\.]+$/ && ($t_proxy_ip !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/
|
||||
|| $1 < 0 || $1 > 255 || $2 < 0 || $2 > 255
|
||||
|| $3 < 0 || $3 > 255 || $4 < 0 || $4 > 255) &&
|
||||
|
@ -491,15 +527,17 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Proxy Port
|
||||
if (defined ($opts{'g'})) {
|
||||
$t_proxy_port = $opts{'g'};
|
||||
$token_value = get_config_value($opts{'g'}, $CONF->{'proxy_port'});
|
||||
if (defined ($token_value)) {
|
||||
$t_proxy_port = $token_value;
|
||||
if ($t_proxy_port !~ /^\d+$/ || $t_proxy_port < 1 || $t_proxy_port > 65535) {
|
||||
error ("Proxy port $t_port is not valid.");
|
||||
}
|
||||
}
|
||||
|
||||
# TCP wrappers support
|
||||
if (defined ($opts{'T'})) {
|
||||
$token_value = get_config_value($opts{'T'}, $CONF->{'use_libwrap'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
if ($t_libwrap_installed) {
|
||||
$t_use_libwrap = 1;
|
||||
} else {
|
||||
|
@ -531,9 +569,76 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Get the config file
|
||||
if (defined ($opts{'l'})) {
|
||||
$log_file = $opts{'l'};
|
||||
$token_value = get_config_value($opts{'l'}, $CONF->{'log_file'});
|
||||
if (defined ($token_value)) {
|
||||
$log_file = $token_value;
|
||||
}
|
||||
|
||||
# No command lines config values
|
||||
|
||||
# Get the block size
|
||||
if (defined ($CONF->{'block_size'})) {
|
||||
if ($t_port !~ /^\d+$/ || $t_port < 1) {
|
||||
error ("Invalid block size: " . $CONF->{'block_size'} . ".");
|
||||
}
|
||||
$t_block_size = $CONF->{'block_size'};
|
||||
}
|
||||
|
||||
# Configuration file invalid chars
|
||||
if (defined ($CONF->{'invalid_chars'})) {
|
||||
$t_invalid_chars = $CONF->{'invalid_chars'};
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB parse_config_file
|
||||
## Get all options from a config file.
|
||||
################################################################################
|
||||
sub parse_config_file {
|
||||
my ($config_file, $CONF) = @_;
|
||||
|
||||
# File should be writable
|
||||
if (! -r $config_file) {
|
||||
print "Configuration file $config_file is not readable.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
# Open the file
|
||||
my $FH;
|
||||
if (! open ($FH, "< $config_file")) {
|
||||
print "Cannot open configuration file $config_file.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
# Read the file and only get the well formed lines
|
||||
while (<$FH>) {
|
||||
my $buffer_line = $_;
|
||||
if ($buffer_line =~ /^[a-zA-Z]/){ # begins with letters
|
||||
if ($buffer_line =~ m/([\w\-\_\.]+)\s+(.*)/){
|
||||
$CONF->{$1} = $2 unless $2 eq "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close ($FH);
|
||||
return;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB parse_config_file
|
||||
## Search in command line options and config hash from configuration file
|
||||
## to get a value (command line is a priority)
|
||||
################################################################################
|
||||
sub get_config_value {
|
||||
my ($cmd_value, $conf_value, $bool) = @_;
|
||||
$bool = 0 unless defined($bool);
|
||||
|
||||
return $cmd_value if defined($cmd_value);
|
||||
# The boolean type value is 1 or undef (0 should be translated like undefP)
|
||||
if ($bool && defined($conf_value)) {
|
||||
return undef if ($conf_value ne "1");
|
||||
}
|
||||
return $conf_value;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
@ -929,14 +1034,14 @@ sub recv_file {
|
|||
# Check file name
|
||||
if ($base_name =~ /[$t_invalid_chars]/) {
|
||||
print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " has an invalid file name");
|
||||
send_data ("SEND ERR\n");
|
||||
send_data ("SEND ERR (invalid file name)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
# Check file size, empty files are not allowed
|
||||
if ($size < 1 || $size > $t_max_size) {
|
||||
print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " is too big");
|
||||
send_data ("SEND ERR\n");
|
||||
send_data ("SEND ERR (file is too big)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -946,7 +1051,7 @@ sub recv_file {
|
|||
# Check if file exists
|
||||
if (-f $file && $t_overwrite == 0) {
|
||||
print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " already exists");
|
||||
send_data ("SEND ERR\n");
|
||||
send_data ("SEND ERR (file already exists)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -979,7 +1084,7 @@ sub send_file {
|
|||
# Check file name
|
||||
if ($base_name =~ /[$t_invalid_chars]/) {
|
||||
print_log ("Requested file '$base_name' from " . $t_client_socket->sockhost () . " has an invalid file name");
|
||||
send_data ("RECV ERR\n");
|
||||
send_data ("RECV ERR (file has an invalid file name)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -989,7 +1094,7 @@ sub send_file {
|
|||
# Check if file exists
|
||||
if (! -f $file) {
|
||||
print_log ("Requested file '$file' from " . $t_client_socket->sockhost () . " does not exist");
|
||||
send_data ("RECV ERR\n");
|
||||
send_data ("RECV ERR (file does not exist)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.722-180423
|
||||
Version: 7.0NG.722-180510
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.722-180423"
|
||||
pandora_version="7.0NG.722-180510"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -42,7 +42,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.722';
|
||||
use constant AGENT_BUILD => '180423';
|
||||
use constant AGENT_BUILD => '180510';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.722
|
||||
%define release 180423
|
||||
%define release 180510
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.722
|
||||
%define release 180423
|
||||
%define release 180510
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.722"
|
||||
PI_BUILD="180423"
|
||||
PI_BUILD="180510"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -102,7 +102,7 @@ my $SERVICE_NAME="Tentacle Server";
|
|||
my $SERVICE_PARAMS=join(' ', @ARGV);
|
||||
|
||||
# Program version
|
||||
our $VERSION = '0.6.1';
|
||||
our $VERSION = '0.6.2';
|
||||
|
||||
# IPv4 address to listen on
|
||||
my @t_addresses = ('0', '0.0.0.0');
|
||||
|
@ -217,6 +217,7 @@ sub print_help {
|
|||
print ("\t-d\t\tRun as daemon.\n");
|
||||
print ("\t-e cert\t\tOpenSSL certificate file. Enables SSL.\n");
|
||||
print ("\t-f ca_cert\tVerify that the peer certificate is signed by a ca.\n");
|
||||
print ("\t-F config_file\tConfiguration file full path.\n");
|
||||
print ("\t-h\t\tShow help.\n");
|
||||
print ("\t-I\t\tEnable insecure operations (file listing and moving).\n");
|
||||
print ("\t-i\t\tFilters.\n");
|
||||
|
@ -278,11 +279,13 @@ sub daemonize {
|
|||
################################################################################
|
||||
sub parse_options {
|
||||
my %opts;
|
||||
my $CONF = {};
|
||||
my $token_value;
|
||||
my $tmp;
|
||||
my @t_addresses_tmp;
|
||||
|
||||
# Get options
|
||||
if (getopts ('a:b:c:de:f:g:hIi:k:l:m:op:qr:s:S:t:TvVwx:', \%opts) == 0 || defined ($opts{'h'})) {
|
||||
if (getopts ('a:b:c:de:f:F:g:hIi:k:l:m:op:qr:s:S:t:TvVwx:', \%opts) == 0 || defined ($opts{'h'})) {
|
||||
print_help ();
|
||||
exit 1;
|
||||
}
|
||||
|
@ -304,10 +307,16 @@ sub parse_options {
|
|||
}
|
||||
}
|
||||
|
||||
# Configuration file
|
||||
if (defined($opts{'F'})) {
|
||||
parse_config_file($opts{'F'}, $CONF);
|
||||
}
|
||||
|
||||
# Address
|
||||
if (defined ($opts{'a'})) {
|
||||
$token_value = get_config_value($opts{'a'}, $CONF->{'addresses'});
|
||||
if (defined ($token_value)) {
|
||||
@t_addresses = ();
|
||||
@t_addresses_tmp = split(/,/, $opts{'a'});
|
||||
@t_addresses_tmp = split(/,/, $token_value);
|
||||
|
||||
foreach my $t_address (@t_addresses_tmp) {
|
||||
$t_address =~ s/^ *(.*?) *$/$1/;
|
||||
|
@ -323,15 +332,17 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Maximum simultaneous connections
|
||||
if (defined ($opts{'c'})) {
|
||||
$t_max_conn = $opts{'c'};
|
||||
$token_value = get_config_value($opts{'c'}, $CONF->{'max_connections'});
|
||||
if (defined ($token_value)) {
|
||||
$t_max_conn = $token_value;
|
||||
if ($t_max_conn !~ /^\d+$/ || $t_max_conn < 1) {
|
||||
error ("Invalid number of maximum simultaneous connections.");
|
||||
}
|
||||
}
|
||||
|
||||
# Run as daemon
|
||||
if (defined ($opts{'d'})) {
|
||||
$token_value = get_config_value($opts{'d'}, $CONF->{'daemon'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
if ($^ eq 'MSWin32') {
|
||||
error ("-d flag not available for this OS.");
|
||||
}
|
||||
|
@ -340,11 +351,12 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Enable SSL
|
||||
if (defined ($opts{'e'})) {
|
||||
$token_value = get_config_value($opts{'e'}, $CONF->{'ssl_cert'});
|
||||
if (defined ($token_value)) {
|
||||
|
||||
require IO::Socket::SSL;
|
||||
|
||||
$t_ssl_cert = $opts{'e'};
|
||||
$t_ssl_cert = $token_value;
|
||||
if (! -f $t_ssl_cert) {
|
||||
error ("File $t_ssl_cert does not exist.");
|
||||
}
|
||||
|
@ -353,21 +365,24 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Verify peer certificate
|
||||
if (defined ($opts{'f'})) {
|
||||
$t_ssl_ca = $opts{'f'};
|
||||
$token_value = get_config_value($opts{'f'}, $CONF->{'ssl_ca'});
|
||||
if (defined ($token_value)) {
|
||||
$t_ssl_ca = $token_value;
|
||||
if (! -f $t_ssl_ca) {
|
||||
error ("File $t_ssl_ca does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
# Insecure mode
|
||||
if (defined ($opts{'I'})) {
|
||||
$token_value = get_config_value($opts{'I'}, $CONF->{'insecure'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
$t_insecure = 1;
|
||||
}
|
||||
|
||||
# Filters (regexp:dir;regexp:dir...)
|
||||
if (defined ($opts{'i'})) {
|
||||
my @filters = split (';', $opts{'i'});
|
||||
$token_value = get_config_value($opts{'i'}, $CONF->{'filters'});
|
||||
if (defined ($token_value)) {
|
||||
my @filters = split (';', $token_value);
|
||||
foreach my $filter (@filters) {
|
||||
my ($regexp, $dir) = split (':', $filter);
|
||||
next unless defined ($regexp) && defined ($dir);
|
||||
|
@ -381,51 +396,58 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# SSL private key file
|
||||
if (defined ($opts{'k'})) {
|
||||
$t_ssl_key = $opts{'k'};
|
||||
$token_value = get_config_value($opts{'k'}, $CONF->{'ssl_key'});
|
||||
if (defined ($token_value)) {
|
||||
$t_ssl_key = $token_value;
|
||||
if (! -f $t_ssl_key) {
|
||||
error ("File $t_ssl_key does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
# Maximum file size
|
||||
if (defined ($opts{'m'})) {
|
||||
$t_max_size = $opts{'m'};
|
||||
$token_value = get_config_value($opts{'m'}, $CONF->{'max_size'});
|
||||
if (defined ($token_value)) {
|
||||
$t_max_size = $token_value;
|
||||
if ($t_max_size !~ /^\d+$/ || $t_max_size < 1) {
|
||||
error ("Invalid maximum file size.");
|
||||
}
|
||||
}
|
||||
|
||||
# File overwrite
|
||||
if (defined ($opts{'o'})) {
|
||||
$token_value = get_config_value($opts{'o'}, $CONF->{'overwrite'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
$t_overwrite = 1;
|
||||
}
|
||||
|
||||
# Port
|
||||
if (defined ($opts{'p'})) {
|
||||
$t_port = $opts{'p'};
|
||||
$token_value = get_config_value($opts{'p'}, $CONF->{'port'});
|
||||
if (defined ($token_value)) {
|
||||
$t_port = $token_value;
|
||||
if ($t_port !~ /^\d+$/ || $t_port < 1 || $t_port > 65535) {
|
||||
error ("Port $t_port is not valid.");
|
||||
}
|
||||
}
|
||||
|
||||
# Quiet mode
|
||||
if (defined ($opts{'q'})) {
|
||||
$token_value = get_config_value($opts{'q'}, $CONF->{'quiet'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
$t_quiet = 1;
|
||||
}
|
||||
|
||||
# Retries
|
||||
if (defined ($opts{'r'})) {
|
||||
$t_retries = $opts{'r'};
|
||||
$token_value = get_config_value($opts{'r'}, $CONF->{'retries'});
|
||||
if (defined ($token_value)) {
|
||||
$t_retries = $token_value;
|
||||
if ($t_retries !~ /^\d+$/ || $t_retries < 1) {
|
||||
error ("Invalid number of retries for network operations.");
|
||||
}
|
||||
}
|
||||
|
||||
# Storage directory
|
||||
if (defined ($opts{'s'})) {
|
||||
$token_value = get_config_value($opts{'s'}, $CONF->{'directory'});
|
||||
if (defined ($token_value)) {
|
||||
|
||||
$t_directory = $opts{'s'};
|
||||
$t_directory = $token_value;
|
||||
|
||||
# Check that directory exists
|
||||
if (! -d $t_directory) {
|
||||
|
@ -444,25 +466,36 @@ sub parse_options {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (! defined($opts{'b'})) {
|
||||
$token_value = get_config_value($opts{'b'}, $CONF->{'proxy_ip'});
|
||||
if (! defined($token_value)) {
|
||||
print_help ();
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
# Timeout
|
||||
if (defined ($opts{'t'})) {
|
||||
$t_timeout = $opts{'t'};
|
||||
$token_value = get_config_value($opts{'t'}, $CONF->{'timeout'});
|
||||
if (defined ($token_value)) {
|
||||
$t_timeout = $token_value;
|
||||
if ($t_timeout !~ /^\d+$/ || $t_timeout < 1) {
|
||||
error ("Invalid timeout for network operations.");
|
||||
}
|
||||
}
|
||||
|
||||
# Read verbose from config file
|
||||
if (defined($CONF->{'verbose'})) {
|
||||
if ($CONF->{'verbose'} eq "1") {
|
||||
$t_log = 1;
|
||||
} elsif ($CONF->{'verbose'} eq "2") {
|
||||
$t_log = 1;
|
||||
$t_log_hard = 1;
|
||||
}
|
||||
}
|
||||
# Be verbose
|
||||
if (defined ($opts{'v'})) {
|
||||
$t_log = 1;
|
||||
$t_log_hard = 0;
|
||||
}
|
||||
|
||||
# Be verbose hard
|
||||
if (defined ($opts{'V'})) {
|
||||
$t_log = 1;
|
||||
|
@ -470,18 +503,21 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# SSL private key password
|
||||
if (defined ($opts{'w'})) {
|
||||
$token_value = get_config_value($opts{'w'}, $CONF->{'ssl_password'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
$t_ssl_pwd = ask_passwd ("Enter private key file password: ", "Enter private key file password again for confirmation: ");
|
||||
}
|
||||
|
||||
# Server password
|
||||
if (defined ($opts{'x'})) {
|
||||
$t_pwd = $opts{'x'};
|
||||
$token_value = get_config_value($opts{'x'}, $CONF->{'password'});
|
||||
if (defined ($token_value)) {
|
||||
$t_pwd = $token_value;
|
||||
}
|
||||
|
||||
#Proxy IP address
|
||||
if (defined ($opts{'b'})) {
|
||||
$t_proxy_ip = $opts{'b'};
|
||||
$token_value = get_config_value($opts{'b'}, $CONF->{'proxy_ip'});
|
||||
if (defined ($token_value)) {
|
||||
$t_proxy_ip = $token_value;
|
||||
if ($t_proxy_ip !~ /^[a-zA-Z\.]+$/ && ($t_proxy_ip !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/
|
||||
|| $1 < 0 || $1 > 255 || $2 < 0 || $2 > 255
|
||||
|| $3 < 0 || $3 > 255 || $4 < 0 || $4 > 255) &&
|
||||
|
@ -491,15 +527,17 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Proxy Port
|
||||
if (defined ($opts{'g'})) {
|
||||
$t_proxy_port = $opts{'g'};
|
||||
$token_value = get_config_value($opts{'g'}, $CONF->{'proxy_port'});
|
||||
if (defined ($token_value)) {
|
||||
$t_proxy_port = $token_value;
|
||||
if ($t_proxy_port !~ /^\d+$/ || $t_proxy_port < 1 || $t_proxy_port > 65535) {
|
||||
error ("Proxy port $t_port is not valid.");
|
||||
}
|
||||
}
|
||||
|
||||
# TCP wrappers support
|
||||
if (defined ($opts{'T'})) {
|
||||
$token_value = get_config_value($opts{'T'}, $CONF->{'use_libwrap'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
if ($t_libwrap_installed) {
|
||||
$t_use_libwrap = 1;
|
||||
} else {
|
||||
|
@ -531,9 +569,76 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Get the config file
|
||||
if (defined ($opts{'l'})) {
|
||||
$log_file = $opts{'l'};
|
||||
$token_value = get_config_value($opts{'l'}, $CONF->{'log_file'});
|
||||
if (defined ($token_value)) {
|
||||
$log_file = $token_value;
|
||||
}
|
||||
|
||||
# No command lines config values
|
||||
|
||||
# Get the block size
|
||||
if (defined ($CONF->{'block_size'})) {
|
||||
if ($t_port !~ /^\d+$/ || $t_port < 1) {
|
||||
error ("Invalid block size: " . $CONF->{'block_size'} . ".");
|
||||
}
|
||||
$t_block_size = $CONF->{'block_size'};
|
||||
}
|
||||
|
||||
# Configuration file invalid chars
|
||||
if (defined ($CONF->{'invalid_chars'})) {
|
||||
$t_invalid_chars = $CONF->{'invalid_chars'};
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB parse_config_file
|
||||
## Get all options from a config file.
|
||||
################################################################################
|
||||
sub parse_config_file {
|
||||
my ($config_file, $CONF) = @_;
|
||||
|
||||
# File should be writable
|
||||
if (! -r $config_file) {
|
||||
print "Configuration file $config_file is not readable.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
# Open the file
|
||||
my $FH;
|
||||
if (! open ($FH, "< $config_file")) {
|
||||
print "Cannot open configuration file $config_file.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
# Read the file and only get the well formed lines
|
||||
while (<$FH>) {
|
||||
my $buffer_line = $_;
|
||||
if ($buffer_line =~ /^[a-zA-Z]/){ # begins with letters
|
||||
if ($buffer_line =~ m/([\w\-\_\.]+)\s+(.*)/){
|
||||
$CONF->{$1} = $2 unless $2 eq "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close ($FH);
|
||||
return;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB parse_config_file
|
||||
## Search in command line options and config hash from configuration file
|
||||
## to get a value (command line is a priority)
|
||||
################################################################################
|
||||
sub get_config_value {
|
||||
my ($cmd_value, $conf_value, $bool) = @_;
|
||||
$bool = 0 unless defined($bool);
|
||||
|
||||
return $cmd_value if defined($cmd_value);
|
||||
# The boolean type value is 1 or undef (0 should be translated like undefP)
|
||||
if ($bool && defined($conf_value)) {
|
||||
return undef if ($conf_value ne "1");
|
||||
}
|
||||
return $conf_value;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
@ -929,14 +1034,14 @@ sub recv_file {
|
|||
# Check file name
|
||||
if ($base_name =~ /[$t_invalid_chars]/) {
|
||||
print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " has an invalid file name");
|
||||
send_data ("SEND ERR\n");
|
||||
send_data ("SEND ERR (invalid file name)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
# Check file size, empty files are not allowed
|
||||
if ($size < 1 || $size > $t_max_size) {
|
||||
print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " is too big");
|
||||
send_data ("SEND ERR\n");
|
||||
send_data ("SEND ERR (file is too big)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -946,7 +1051,7 @@ sub recv_file {
|
|||
# Check if file exists
|
||||
if (-f $file && $t_overwrite == 0) {
|
||||
print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " already exists");
|
||||
send_data ("SEND ERR\n");
|
||||
send_data ("SEND ERR (file already exists)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -979,7 +1084,7 @@ sub send_file {
|
|||
# Check file name
|
||||
if ($base_name =~ /[$t_invalid_chars]/) {
|
||||
print_log ("Requested file '$base_name' from " . $t_client_socket->sockhost () . " has an invalid file name");
|
||||
send_data ("RECV ERR\n");
|
||||
send_data ("RECV ERR (file has an invalid file name)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -989,7 +1094,7 @@ sub send_file {
|
|||
# Check if file exists
|
||||
if (! -f $file) {
|
||||
print_log ("Requested file '$file' from " . $t_client_socket->sockhost () . " does not exist");
|
||||
send_data ("RECV ERR\n");
|
||||
send_data ("RECV ERR (file does not exist)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{180423}
|
||||
{180510}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.722(Build 180423)")
|
||||
#define PANDORA_VERSION ("7.0NG.722(Build 180510)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.722(Build 180423))"
|
||||
VALUE "ProductVersion", "(7.0NG.722(Build 180510))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -5,6 +5,7 @@ WORKDIR /pandorafms/pandora_console
|
|||
|
||||
ADD pandoradb.sql /docker-entrypoint-initdb.d
|
||||
ADD pandoradb_data.sql /docker-entrypoint-initdb.d
|
||||
RUN chown mysql /docker-entrypoint-initdb.d
|
||||
|
||||
ENV MYSQL_DATABASE=pandora
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.722-180423
|
||||
Version: 7.0NG.722-180510
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.722-180423"
|
||||
pandora_version="7.0NG.722-180510"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -45,13 +45,14 @@ RUN yum install -y \
|
|||
php-zip \
|
||||
nmap \
|
||||
net-snmp-utils \
|
||||
mod_ssl \
|
||||
xprobe2
|
||||
|
||||
#Clone the repo
|
||||
RUN git clone -b develop https://github.com/pandorafms/pandorafms.git /tmp/pandorafms
|
||||
|
||||
#Exposing ports for: HTTP, SNMP Traps, Tentacle protocol
|
||||
EXPOSE 80 162/udp 41121
|
||||
EXPOSE 80 162/udp 443 41121
|
||||
|
||||
# Simple startup script to avoid some issues observed with container restart
|
||||
ADD docker_entrypoint.sh /entrypoint.sh
|
||||
|
|
|
@ -46,8 +46,19 @@ if (isset ($_GET["loginhash"])) {
|
|||
}
|
||||
}
|
||||
|
||||
$public_hash = get_parameter('hash', false);
|
||||
|
||||
// Check user
|
||||
//check_login ();
|
||||
if ($public_hash === false) {
|
||||
check_login();
|
||||
} else {
|
||||
enterprise_include_once('include/functions_dashboard.php');
|
||||
if (dashboard_check_public_hash($public_hash) === false) {
|
||||
db_pandora_audit("Invalid public hash", "Trying to access public dashboard");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
define ('AJAX', true);
|
||||
|
||||
|
|
|
@ -14,8 +14,10 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
include_once('include/graphs/fgraph.php');
|
||||
include_once('include/functions_snmp_browser.php');
|
||||
global $config;
|
||||
|
||||
include_once($config['homedir'] . '/include/graphs/fgraph.php');
|
||||
include_once($config['homedir'] . '/include/functions_snmp_browser.php');
|
||||
|
||||
function pandora_realtime_graphs () {
|
||||
global $config;
|
||||
|
@ -25,8 +27,11 @@ function pandora_realtime_graphs () {
|
|||
$action = get_parameter('action', 'list');
|
||||
|
||||
$onheader = array();
|
||||
|
||||
ui_print_page_header (__("Realtime graphs"), "images/extensions.png", false, "", false, $onheader);
|
||||
|
||||
$hide_header = get_parameter('hide_header', 0);
|
||||
if (!$hide_header) {
|
||||
ui_print_page_header (__("Realtime graphs"), "images/extensions.png", false, "", false, $onheader);
|
||||
}
|
||||
|
||||
$chart[time()]['graph'] = '0';
|
||||
$interactive_graph = true;
|
||||
|
@ -69,26 +74,40 @@ function pandora_realtime_graphs () {
|
|||
$graph = get_parameter('graph', 'cpu_load');
|
||||
$refresh = get_parameter('refresh', '1000');
|
||||
|
||||
$data['graph'] = __('Graph') . ' ' . html_print_select ($graph_fields, 'graph', $graph, '', '', 0, true);
|
||||
if ($graph != 'snmp_module') {
|
||||
$data['graph'] = __('Graph') . ' ' . html_print_select ($graph_fields, 'graph', $graph, '', '', 0, true);
|
||||
}
|
||||
|
||||
$refresh_fields[1000] = human_time_description_raw(1, true, 'large');
|
||||
$refresh_fields[5000] = human_time_description_raw(5, true, 'large');
|
||||
$refresh_fields[10000] = human_time_description_raw(10, true, 'large');
|
||||
$refresh_fields[30000] = human_time_description_raw(30, true, 'large');
|
||||
|
||||
if ($graph == 'snmp_module') {
|
||||
$agent_alias = get_parameter('agent_alias', '');
|
||||
$module_name = get_parameter('module_name', '');
|
||||
$module_incremental = get_parameter ('incremental', 0);
|
||||
$data['module_info'] = "$agent_alias: <b>$module_name</b>";
|
||||
|
||||
// Append all the hidden in this cell
|
||||
$data['module_info'] .= html_print_input_hidden ('incremental', $module_incremental, true);
|
||||
$data['module_info'] .= html_print_select (
|
||||
array('snmp_module' => '-'), 'graph', 'snmp_module', '', '', 0, true, false, true, '', false, 'display: none;'
|
||||
);
|
||||
}
|
||||
$data['refresh'] = __('Refresh interval') . ' ' . html_print_select ($refresh_fields, 'refresh', $refresh, '', '', 0, true);
|
||||
$data['incremental'] = __('Incremental') . ' ' . html_print_checkbox ('incremental', 1, 0, true);
|
||||
if ($graph != 'snmp_module') {
|
||||
$data['incremental'] = __('Incremental') . ' ' . html_print_checkbox ('incremental', 1, 0, true);
|
||||
}
|
||||
$data['reset'] = html_print_button(__('Clear graph'), 'reset', false, 'clearGraph()', 'class="sub delete" style="margin-top:0px;"', true);
|
||||
$table->data[] = $data;
|
||||
|
||||
|
||||
if ($graph == 'snmp_interface') {
|
||||
$snmp_address = '';
|
||||
$snmp_community = '';
|
||||
$snmp_oid = '';
|
||||
$snmp_ver = '1';
|
||||
$snmp_inc = false;
|
||||
|
||||
|
||||
if ($graph == 'snmp_interface' || $graph == 'snmp_module') {
|
||||
$snmp_address = get_parameter('snmp_address', '');
|
||||
$snmp_community = get_parameter('snmp_community', '');
|
||||
$snmp_oid = get_parameter('snmp_oid', '');
|
||||
$snmp_ver = get_parameter('snmp_ver', '');
|
||||
|
||||
$data = array();
|
||||
|
||||
$data['snmp_address'] = __('Target IP') . ' ' . html_print_input_text ('ip_target', $snmp_address, '', 50, 255, true);
|
||||
|
@ -111,12 +130,21 @@ function pandora_realtime_graphs () {
|
|||
$data['snmp_ver'] = __('Version') . ' ' . html_print_select ($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true);
|
||||
$data['snmp_ver'] .= ' ' . html_print_button (__('SNMP walk'), 'snmp_walk', false, 'snmpBrowserWindow()', 'class="sub next"', true);
|
||||
$table->colspan[2]['snmp_ver'] = 2;
|
||||
|
||||
|
||||
$table->data[] = $data;
|
||||
|
||||
|
||||
// Hide some options in snmp_module graphs
|
||||
if ($graph == 'snmp_module') {
|
||||
$table->rowstyle[1] = "display: none;";
|
||||
$table->rowstyle[2] = "display: none;";
|
||||
}
|
||||
snmp_browser_print_container (false, '100%', '60%', 'none');
|
||||
}
|
||||
|
||||
// Print the relative path to AJAX calls:
|
||||
html_print_input_hidden('rel_path', get_parameter('rel_path', ''));
|
||||
|
||||
// Print the form
|
||||
echo '<form id="realgraph" method="post">';
|
||||
html_print_table($table);
|
||||
echo '</form>';
|
||||
|
@ -125,9 +153,9 @@ function pandora_realtime_graphs () {
|
|||
html_print_input_hidden ('custom_action', urlencode (base64_encode(' <a href="javascript:setOID()"><img src="' . ui_get_full_url("images") . '/input_filter.disabled.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false);
|
||||
html_print_input_hidden ('incremental_base', '0');
|
||||
|
||||
echo '<script type="text/javascript" src="extensions/realtime_graphs/realtime_graphs.js"></script>';
|
||||
echo '<script type="text/javascript" src="include/javascript/pandora_snmp_browser.js"></script>';
|
||||
echo '<link rel="stylesheet" type="text/css" href="extensions/realtime_graphs/realtime_graphs.css"></style>';
|
||||
echo '<script type="text/javascript" src="'.ui_get_full_url("extensions/realtime_graphs/realtime_graphs.js").'"></script>';
|
||||
echo '<script type="text/javascript" src="'.ui_get_full_url("include/javascript/pandora_snmp_browser.js").'"></script>';
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.ui_get_full_url("extensions/realtime_graphs/realtime_graphs.css").'"></style>';
|
||||
|
||||
// Store servers timezone offset to be retrieved from js
|
||||
set_js_value('timezone_offset', date('Z', time()));
|
||||
|
|
|
@ -59,6 +59,7 @@ switch($graph) {
|
|||
$data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ print $3 }'");
|
||||
break;
|
||||
case 'snmp_interface':
|
||||
case 'snmp_module':
|
||||
$snmp_address = $_POST['snmp_address'];
|
||||
$snmp_community = $_POST['snmp_community'];
|
||||
$snmp_ver = $_POST['snmp_ver'];
|
||||
|
|
|
@ -37,7 +37,7 @@ var plot = $.plot("#" + id, data, options);
|
|||
|
||||
|
||||
var refresh = parseInt($('#refresh').val());
|
||||
var incremental = $('#checkbox-incremental').is(':checked');
|
||||
var incremental = $('#checkbox-incremental').is(':checked') || $('#hidden-incremental').val() == 1;
|
||||
var incremental_base = 0;
|
||||
var last_inc = 0;
|
||||
var to;
|
||||
|
@ -58,9 +58,11 @@ function refresh_graph () {
|
|||
postvars['snmp_address'] = $('#text-ip_target').val();
|
||||
|
||||
postvars['refresh'] = refresh;
|
||||
|
||||
|
||||
var rel_path = $("#hidden-rel_path").val();
|
||||
|
||||
$.ajax({
|
||||
url: "extensions/realtime_graphs/ajax.php",
|
||||
url: rel_path + "extensions/realtime_graphs/ajax.php",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: postvars,
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE tcluster DROP FOREIGN KEY tcluster_ibfk_1;
|
||||
|
||||
ALTER TABLE tcluster_agent DROP FOREIGN KEY tcluster_agent_ibfk_1;
|
||||
|
||||
ALTER TABLE tcluster_agent DROP FOREIGN KEY tcluster_agent_ibfk_2;
|
||||
|
||||
COMMIT;
|
|
@ -1509,9 +1509,7 @@ create table IF NOT EXISTS `tcluster`(
|
|||
`description` text not null default '',
|
||||
`group` int(10) unsigned NOT NULL default '0',
|
||||
`id_agent` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_agent`) REFERENCES tagente(`id_agente`)
|
||||
ON UPDATE CASCADE
|
||||
PRIMARY KEY (`id`)
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
|
@ -1539,8 +1537,6 @@ create table IF NOT EXISTS `tcluster_agent`(
|
|||
`id_cluster` int unsigned not null,
|
||||
`id_agent` int(10) unsigned not null,
|
||||
PRIMARY KEY (`id_cluster`,`id_agent`),
|
||||
FOREIGN KEY (`id_agent`) REFERENCES tagente(`id_agente`)
|
||||
ON UPDATE CASCADE,
|
||||
FOREIGN KEY (`id_cluster`) REFERENCES tcluster(`id`)
|
||||
ON UPDATE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
|
@ -568,7 +568,7 @@ if ($agents !== false) {
|
|||
|
||||
echo '</span><div class="left actions" style="visibility: hidden; clear: left">';
|
||||
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
|
||||
if($agent["id_os"] == 21){
|
||||
if($agent["id_os"] == 100){
|
||||
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
|
||||
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.__('Edit').'</a>';
|
||||
echo ' | ';
|
||||
|
@ -580,7 +580,7 @@ if ($agents !== false) {
|
|||
echo ' | ';
|
||||
}
|
||||
}
|
||||
if($agent["id_os"] != 21){
|
||||
if($agent["id_os"] != 100){
|
||||
echo '<a href="index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=module&
|
||||
id_agente='.$agent["id_agente"].'">'.__('Modules').'</a>';
|
||||
|
@ -592,7 +592,7 @@ if ($agents !== false) {
|
|||
id_agente='.$agent["id_agente"].'">'.__('Alerts').'</a>';
|
||||
echo ' | ';
|
||||
|
||||
if($agent["id_os"] == 21){
|
||||
if($agent["id_os"] == 100){
|
||||
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id='.$cluster['id'].'">'.__('View').'</a>';
|
||||
}
|
||||
else{
|
||||
|
@ -650,7 +650,7 @@ if ($agents !== false) {
|
|||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
||||
enable_agent=".$agent["id_agente"]."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
||||
|
||||
if($agent["id_os"] != 21){
|
||||
if($agent["id_os"] != 100){
|
||||
echo ">";
|
||||
}
|
||||
else{
|
||||
|
@ -662,7 +662,7 @@ if ($agents !== false) {
|
|||
else {
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
||||
disable_agent=".$agent["id_agente"]."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
||||
if($agent["id_os"] != 21){
|
||||
if($agent["id_os"] != 100){
|
||||
echo ">";
|
||||
}
|
||||
else{
|
||||
|
@ -676,11 +676,11 @@ if ($agents !== false) {
|
|||
echo " <a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
||||
borrar_agente=".$agent["id_agente"]."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
||||
|
||||
if($agent["id_os"] != 21){
|
||||
if($agent["id_os"] != 100){
|
||||
echo ' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
}
|
||||
else{
|
||||
echo ' onClick="if (!confirm(\' '.__('You are going to delete a cluster agent. Are you sure?').'\')) return false;">';
|
||||
echo ' onClick="if (!confirm(\' '.__('WARNING! - You are going to delete a cluster agent. Are you sure?').'\')) return false;">';
|
||||
}
|
||||
|
||||
echo html_print_image('images/cross.png', true, array("border" => '0')) . "</a>";
|
||||
|
|
|
@ -103,24 +103,9 @@ if ($module_service_synthetic_selector !== ENTERPRISE_NOT_HOOK) {
|
|||
$data[0] = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$data[1] = '<div id="module_data" style="top:1em; float:left; width:50%;">';
|
||||
$data[1] .= html_print_label(__("Agent"),'agent_name', true)."<br/>";
|
||||
|
||||
$params = array();
|
||||
$params['return'] = true;
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'agent_name';
|
||||
$params['value'] = $agent_name;
|
||||
$params['javascript_is_function_select'] = true;
|
||||
$params['selectbox_id'] = 'prediction_module';
|
||||
$params['none_module_text'] = __('Select Module');
|
||||
$params['use_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_id'] = 'hidden-id_agente';
|
||||
$data[1] .= ui_print_agent_autocomplete_input($params);
|
||||
|
||||
// Get module and agent of the target prediction module
|
||||
if (!empty($prediction_module)) {
|
||||
$id_agente_clean = modules_get_agentmodule_agent($prediction_module);
|
||||
|
@ -131,6 +116,19 @@ else {
|
|||
$id_agente_clean = $id_agente;
|
||||
$agent_name_clean = $agent_name;
|
||||
}
|
||||
$agent_alias = agents_get_alias($id_agente_clean);
|
||||
|
||||
$params = array();
|
||||
$params['return'] = true;
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'agent_name';
|
||||
$params['value'] = $agent_alias;
|
||||
$params['javascript_is_function_select'] = true;
|
||||
$params['selectbox_id'] = 'prediction_module';
|
||||
$params['none_module_text'] = __('Select Module');
|
||||
$params['use_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_id'] = 'hidden-id_agente_module_prediction';
|
||||
$data[1] .= ui_print_agent_autocomplete_input($params);
|
||||
|
||||
$data[1] .= html_print_label(__("Module"),'prediction_module',true);
|
||||
if ($id_agente) {
|
||||
|
@ -154,7 +152,7 @@ $periods [1] = __('Monthly');
|
|||
$periods [2] = __('Daily');
|
||||
$data[1] .= html_print_select ($periods, 'custom_integer_2', $custom_integer_2, '', '', 0, true);
|
||||
|
||||
$data[1] .= html_print_input_hidden ('id_agente', $id_agente, true);
|
||||
$data[1] .= html_print_input_hidden ('id_agente_module_prediction', $id_agente, true);
|
||||
$data[1] .= '</div>';
|
||||
|
||||
$table_simple->colspan['prediction_module'][1] = 3;
|
||||
|
|
|
@ -404,7 +404,8 @@ if (!empty($groups)) {
|
|||
|
||||
$symbolBranchs = ' symbol_branch_' . $group['parent'];
|
||||
|
||||
$data = groups_get_group_to_list($group, $groups_count, $symbolBranchs);
|
||||
$has_children = isset($sons[$group['id_grupo']]);
|
||||
$data = groups_get_group_to_list($group, $groups_count, $symbolBranchs, $has_children);
|
||||
array_push ($table->data, $data);
|
||||
$table->rowstyle[$iterator] = '';
|
||||
if ($group['id_grupo'] != 0) {
|
||||
|
|
|
@ -35,7 +35,6 @@ var img_handler_end;
|
|||
function toggle_advance_options_palette(close) {
|
||||
if ($("#advance_options").css('display') == 'none') {
|
||||
$("#advance_options").css('display', '');
|
||||
$("#advance_options *").css('display', '');
|
||||
}
|
||||
else {
|
||||
$("#advance_options").css('display', 'none');
|
||||
|
|
|
@ -123,6 +123,15 @@ switch ($action) {
|
|||
'image_height' => $image_height
|
||||
);
|
||||
break;
|
||||
case 'WMS':
|
||||
$url = get_parameter('url');
|
||||
$layers = get_parameter('layers');
|
||||
$mapConnectionData = array(
|
||||
'type' => 'WMS',
|
||||
'url' => $url,
|
||||
'layers' => $layers
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
//TODO VALIDATE PARAMETERS
|
||||
|
@ -168,6 +177,7 @@ $table->data = array();
|
|||
$types["OSM"] = __('Open Street Maps');
|
||||
$types["Gmap"] = __('Google Maps');
|
||||
$types["Static_Image"] = __('Static Image');
|
||||
$types["WMS"] = __('WMS Server');
|
||||
$table->data[0][0] = __('Type') . ":";
|
||||
$table->data[0][1] = html_print_select($types, 'sel_type', $mapConnection_type, "selMapConnectionType();", __('Please select the connection type'), 0, true);
|
||||
|
||||
|
@ -184,6 +194,7 @@ $bb_bottom = '';
|
|||
$bb_top = '';
|
||||
$image_width = '';
|
||||
$image_height = '';
|
||||
$layers = '';
|
||||
if ($mapConnectionData != null) {
|
||||
switch ($mapConnection_type) {
|
||||
case 'OSM':
|
||||
|
@ -202,6 +213,10 @@ if ($mapConnectionData != null) {
|
|||
$image_width= $mapConnectionData['image_width'];
|
||||
$image_height= $mapConnectionData['image_height'];
|
||||
break;
|
||||
case 'WMS':
|
||||
$mapConnectionDataUrl = $mapConnectionData['url'];
|
||||
$layers = $mapConnectionData['layers'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Open Street Map Connection
|
||||
|
@ -260,6 +275,27 @@ $optionsConnectionImageTable = '<table class="databox" border="0" cellpadding="4
|
|||
'<td>'. html_print_input_text ('image_height', $image_height, '', 25, 25, true) . '</td>' .
|
||||
'</tr>' .
|
||||
'</table>';
|
||||
|
||||
// WMS Server Connection
|
||||
$optionsConnectionWMSTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%">' .
|
||||
'<tr class="row_0">' .
|
||||
'<td>' . __("WMS Server URL") . '</td>' .
|
||||
'<td>' .
|
||||
'<input id="type" type="hidden" name="type" value="WMS" />' .
|
||||
html_print_input_text('url', $mapConnectionDataUrl, '', 90, 255, true) .
|
||||
'</td>' .
|
||||
'</tr>' .
|
||||
'<tr class="row_1">' .
|
||||
'<td>' .
|
||||
__("Layers") .
|
||||
ui_print_help_tip (__('Enter a single element or a comma separated list'), true) .
|
||||
'</td>' .
|
||||
'<td>' .
|
||||
html_print_input_text('layers', $layers, '', 90, 255, true) .
|
||||
'</td>' .
|
||||
'</tr>' .
|
||||
'</table>';
|
||||
|
||||
if ($mapConnectionData != null) {
|
||||
switch ($mapConnection_type) {
|
||||
case 'OSM':
|
||||
|
@ -271,6 +307,9 @@ if ($mapConnectionData != null) {
|
|||
case 'Static_Image':
|
||||
$optionsConnectionTypeTable = $optionsConnectionImageTable;
|
||||
break;
|
||||
case 'WMS':
|
||||
$optionsConnectionTypeTable = $optionsConnectionWMSTable;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,6 +473,8 @@ function refreshMapViewSecondStep() {
|
|||
objBaseLayers[0]['bb_top'] = $('input[name=bb_top]').val();
|
||||
objBaseLayers[0]['image_width'] = $('input[name=image_width]').val();
|
||||
objBaseLayers[0]['image_height'] = $('input[name=image_height]').val();
|
||||
// type WMS
|
||||
objBaseLayers[0]['layers'] = $('input[name=layers]').val();
|
||||
|
||||
arrayControls = null;
|
||||
arrayControls = Array('Navigation', 'PanZoom', 'MousePosition');
|
||||
|
@ -487,6 +528,9 @@ function selMapConnectionType() {
|
|||
case 'Static_Image':
|
||||
$('#form_map_connection_type').html('<?php echo $optionsConnectionImageTable; ?>').hide();
|
||||
break;
|
||||
case 'WMS':
|
||||
$('#form_map_connection_type').html('<?php echo $optionsConnectionWMSTable; ?>').hide();
|
||||
break;
|
||||
default:
|
||||
$('#form_map_connection_type').html('').hide();
|
||||
break;
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 527 B |
|
@ -234,7 +234,8 @@ if ($get_graphs){
|
|||
$height = 300;
|
||||
}
|
||||
$table .= "<div style='width: 90%'><h4>".$graph[0]['name']."</h4><hr></div>";
|
||||
$table .= graphic_combined_module($modules,
|
||||
$table .= graphic_combined_module(
|
||||
$modules,
|
||||
$weights,
|
||||
$value['time_lapse'],
|
||||
1000,
|
||||
|
@ -261,7 +262,7 @@ if ($get_graphs){
|
|||
$labels,
|
||||
false,
|
||||
false,
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
$value['fullscale']
|
||||
|
|
|
@ -1083,6 +1083,10 @@ if ($list_modules) {
|
|||
$url = 'include/procesos.php?agente='.$module["id_agente_modulo"];
|
||||
$win_handle=dechex(crc32($module["id_agente_modulo"].$module["nombre"]));
|
||||
|
||||
// Try to display the SNMP module realtime graph
|
||||
$rt_button .= get_module_realtime_link_graph($module);
|
||||
if (!empty($rt_button)) $data[8] = $rt_button . " ";
|
||||
|
||||
# Show events for boolean modules by default.
|
||||
if ($graph_type == 'boolean') {
|
||||
$draw_events = 1;
|
||||
|
@ -1099,9 +1103,8 @@ if ($list_modules) {
|
|||
base64_encode($module["nombre"]))) . "&" .
|
||||
"refresh=" . SECONDS_10MINUTES . "&" .
|
||||
"draw_events=$draw_events', 'day_".$win_handle."')";
|
||||
|
||||
if(!is_snapshot_data($module['datos'])){
|
||||
$data[8] .= '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a> ';
|
||||
if(!is_snapshot_data($module['datos'])){
|
||||
$data[8] .= '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a> ';
|
||||
}
|
||||
$server_name = '';
|
||||
$data[8] .= "<a href='javascript: " .
|
||||
|
|
|
@ -15,6 +15,14 @@
|
|||
|
||||
global $config;
|
||||
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
|
||||
db_pandora_audit("ACL Violation", "Trying to access update Management");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
require_once($config['homedir'] . "/include/functions_update_manager.php");
|
||||
require_once($config['homedir'] . "/include/functions_graph.php");
|
||||
enterprise_include_once("include/functions_update_manager.php");
|
||||
|
|
|
@ -116,7 +116,7 @@ if ($correctLogin) {
|
|||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where id_agente = '.$id);
|
||||
|
||||
if($id_os == 21){
|
||||
if($id_os == 100){
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ if ($correctLogin) {
|
|||
|
||||
html_debug($id_os);
|
||||
|
||||
if($id_os == 21){
|
||||
if($id_os == 100){
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ if ($correctLogin) {
|
|||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where id_agente = (select id_agente from tagente_modulo where id_agente_modulo ='.$id.')');
|
||||
|
||||
if($id_os == 21){
|
||||
if($id_os == 100){
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC180423';
|
||||
$build_version = 'PC180510';
|
||||
$pandora_version = 'v7.0NG.722';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -1330,12 +1330,13 @@ function agents_get_name ($id_agent, $case = "none") {
|
|||
* @return string Alias of the given agent.
|
||||
*/
|
||||
function agents_get_alias ($id_agent, $case = 'none') {
|
||||
if(is_metaconsole()){
|
||||
global $config;
|
||||
if($config['dbconnection_cache'] == null && is_metaconsole()){
|
||||
$alias = (string) db_get_value ('alias', 'tmetaconsole_agent', 'id_tagente', (int) $id_agent);
|
||||
} else {
|
||||
$alias = (string) db_get_value ('alias', 'tagente', 'id_agente', (int) $id_agent);
|
||||
}
|
||||
|
||||
|
||||
switch ($case) {
|
||||
case 'upper':
|
||||
return mb_strtoupper($alias, 'UTF-8');
|
||||
|
|
|
@ -10271,7 +10271,7 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
|
|||
|
||||
$id_parent_modulo = db_process_sql('select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent[0]['id_agent'].' and nombre = "Cluster status"');
|
||||
|
||||
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval from tagente_modulo where nombre = "'.$element["name"].'" limit 1');
|
||||
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval from tagente_modulo where nombre = "'.io_safe_input($element["name"]).'" limit 1');
|
||||
|
||||
$get_module_type_value = $get_module_type[0]['id_tipo_modulo'];
|
||||
|
||||
|
@ -10302,6 +10302,8 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
|
|||
|
||||
$id_module = modules_create_agent_module($values_module['id_agente'],$values_module['nombre'],$values_module);
|
||||
|
||||
$launch_cluster = db_process_sql('update tagente_modulo set flag = 1 where custom_integer_1 = '.$element["id_cluster"].' and nombre = "Cluster status"');
|
||||
|
||||
if ($tcluster_module !== false){
|
||||
db_pandora_audit("Report management", "Module #".$element["name"]." assigned to cluster #".$element["id_cluster"]);
|
||||
}
|
||||
|
@ -10319,7 +10321,7 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
|
|||
|
||||
$tcluster_balanced_module = db_process_sql_insert('tcluster_item',array('name'=>$element["name"],'id_cluster'=>$element["id_cluster"],'item_type'=>"AP",'is_critical'=>$element["is_critical"]));
|
||||
|
||||
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval from tagente_modulo where nombre = "'.$element["name"].'" limit 1');
|
||||
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval from tagente_modulo where nombre = "'.io_safe_input($element["name"]).'" limit 1');
|
||||
|
||||
$get_module_type_value = $get_module_type[0]['id_tipo_modulo'];
|
||||
|
||||
|
@ -10369,6 +10371,8 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
|
|||
);
|
||||
|
||||
$id_module = modules_create_agent_module($values_module['id_agente'],$values_module['nombre'],$values_module);
|
||||
|
||||
$launch_cluster = db_process_sql('update tagente_modulo set flag = 1 where custom_integer_1 = '.$element["id_cluster"].' and nombre = "Cluster status"');
|
||||
|
||||
if ($tcluster_balanced_module !== false){
|
||||
db_pandora_audit("Report management", "Module #".$element["name"]." assigned to cluster #".$element["id_cluster"]);
|
||||
|
@ -10614,4 +10618,22 @@ function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thras
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
function api_get_cluster_status($id_cluster, $trash1, $trash2, $returnType) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = "select estado from tagente_estado INNER JOIN tagente_modulo ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo and tagente_modulo.nombre = 'Cluster status' and tagente_modulo.id_agente = (select id_agent from tcluster where id = ".$id_cluster.")";
|
||||
|
||||
$value = db_get_value_sql($sql);
|
||||
|
||||
if ($value === false) {
|
||||
returnError('id_not_found', $returnType);
|
||||
}
|
||||
|
||||
$data = array('type' => 'string', 'data' => $value);
|
||||
|
||||
returnData($returnType, $data);
|
||||
}
|
||||
|
||||
?>
|
|
@ -92,28 +92,27 @@ function extensions_is_extension ($page) {
|
|||
*
|
||||
* @param bool $enterprise
|
||||
*/
|
||||
function extensions_get_extensions ($enterprise = false) {
|
||||
|
||||
$dir = EXTENSIONS_DIR;
|
||||
$master_dir = ENTERPRISE_DIR . '/' . EXTENSIONS_DIR;
|
||||
function extensions_get_extensions ($enterprise = false, $rel_path = '') {
|
||||
|
||||
$dir = $rel_path . EXTENSIONS_DIR;
|
||||
$master_dir = $rel_path . ENTERPRISE_DIR . '/' . EXTENSIONS_DIR;
|
||||
$handle = false;
|
||||
if ($enterprise) {
|
||||
$dir = ENTERPRISE_DIR . '/' . EXTENSIONS_DIR;
|
||||
$dir = $rel_path . ENTERPRISE_DIR . '/' . EXTENSIONS_DIR;
|
||||
if (defined("METACONSOLE")) {
|
||||
$dir = '../' . EXTENSIONS_DIR;
|
||||
$master_dir = '../' . EXTENSIONS_DIR;
|
||||
$dir = $rel_path . '../' . EXTENSIONS_DIR;
|
||||
$master_dir = $rel_path . '../' . EXTENSIONS_DIR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (defined("METACONSOLE")) {
|
||||
$dir = '../../' . $dir;
|
||||
$master_dir = '../' . EXTENSIONS_DIR;
|
||||
$dir = $rel_path . '../../' . $dir;
|
||||
$master_dir = $rel_path . '../' . EXTENSIONS_DIR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (file_exists ($dir))
|
||||
$handle = @opendir ($dir);
|
||||
|
||||
if (empty ($handle))
|
||||
return;
|
||||
|
||||
|
@ -148,11 +147,22 @@ function extensions_get_extensions ($enterprise = false) {
|
|||
|
||||
/* Load extensions in enterprise directory */
|
||||
if (! $enterprise && file_exists ($master_dir))
|
||||
return array_merge ($extensions, extensions_get_extensions (true));
|
||||
return array_merge ($extensions, extensions_get_extensions (true, $rel_path));
|
||||
|
||||
return $extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if an extension is enabled
|
||||
*
|
||||
* @param string Extension name (ended with .php)
|
||||
* @return True if enabled
|
||||
*/
|
||||
function extensions_is_enabled_extension($name) {
|
||||
global $config;
|
||||
return isset($config['extensions'][$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get disabled open and enterprise extensions
|
||||
*/
|
||||
|
|
|
@ -118,6 +118,10 @@ function gis_print_map($idDiv, $iniZoom, $latCenter, $lonCenter, $baselayers, $c
|
|||
case 'Gmap':
|
||||
echo "baselayer['gmap_type'] = '" . $baselayer['gmap_type'] . "';";
|
||||
break;
|
||||
case 'WMS':
|
||||
echo "baselayer['url'] = '" . $baselayer['url'] . "';";
|
||||
echo "baselayer['layers'] = '" . $baselayer['layers'] . "';";
|
||||
break;
|
||||
}
|
||||
|
||||
echo "baselayerList.push(baselayer);";
|
||||
|
@ -1035,6 +1039,10 @@ function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $c
|
|||
$baselayers[0]['image_width'] = $conectionData['image_width'];
|
||||
$baselayers[0]['image_height'] = $conectionData['image_height'];
|
||||
break;
|
||||
case 'WMS':
|
||||
$baselayers[0]['url'] = $conectionData['url'];
|
||||
$baselayers[0]['layers'] = $conectionData['layers'];
|
||||
break;
|
||||
}
|
||||
|
||||
if ($gmap_layer === true) {
|
||||
|
|
|
@ -1073,7 +1073,7 @@ function graph_get_formatted_date($timestamp, $format1, $format2) {
|
|||
* @param int Show alerts in graph (set to 1)
|
||||
* @param int Pure mode (without titles) (set to 1)
|
||||
* @param int Date to start of getting info.
|
||||
* @param mixed If is a projection graph this parameter will be module data with prediction data (the projection)
|
||||
* @param mixed If is a projection graph this parameter will be module data with prediction data (the projection)
|
||||
* or false in other case.
|
||||
* @param array List of names for the items. Should have the same size as the module list.
|
||||
* @param array List of units for the items. Should have the same size as the module list.
|
||||
|
@ -1084,12 +1084,42 @@ function graph_get_formatted_date($timestamp, $format1, $format2) {
|
|||
*
|
||||
* @return Mixed
|
||||
*/
|
||||
function graphic_combined_module ( $module_list, $weight_list, $period, $width, $height, $title, $unit_name,
|
||||
$show_events = 0, $show_alerts = 0, $pure = 0, $stacked = 0, $date = 0, $only_image = false, $homeurl = '',
|
||||
$ttl = 1, $projection = false, $prediction_period = false, $backgroundColor = 'white', $name_list = array(),
|
||||
$unit_list = array(), $show_last = true, $show_max = true, $show_min = true, $show_avg = true, $labels = array(),
|
||||
$dashboard = false, $vconsole = false, $percentil = null, $from_interface = false, $id_widget_dashboard=false,
|
||||
$fullscale = false, $summatory = 0, $average = 0, $modules_series = 0 ) {
|
||||
function graphic_combined_module (
|
||||
$module_list,
|
||||
$weight_list,
|
||||
$period,
|
||||
$width,
|
||||
$height,
|
||||
$title,
|
||||
$unit_name,
|
||||
$show_events = 0,
|
||||
$show_alerts = 0,
|
||||
$pure = 0,
|
||||
$stacked = 0,
|
||||
$date = 0,
|
||||
$only_image = false,
|
||||
$homeurl = '',
|
||||
$ttl = 1,
|
||||
$projection = false,
|
||||
$prediction_period = false,
|
||||
$background_color = 'white',
|
||||
$name_list = array(),
|
||||
$unit_list = array(),
|
||||
$show_last = true,
|
||||
$show_max = true,
|
||||
$show_min = true,
|
||||
$show_avg = true,
|
||||
$labels = array(),
|
||||
$dashboard = false,
|
||||
$vconsole = false,
|
||||
$percentil = null,
|
||||
$from_interface = false,
|
||||
$id_widget_dashboard=false,
|
||||
$fullscale = false,
|
||||
$summatory = 0,
|
||||
$average = 0,
|
||||
$modules_series = 0
|
||||
) {
|
||||
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
|
|
@ -2122,7 +2122,7 @@ function groups_agent_disabled ($group_array) {
|
|||
* @return mixed Row with html_print_table format
|
||||
*
|
||||
*/
|
||||
function groups_get_group_to_list($group, $groups_count, &$symbolBranchs) {
|
||||
function groups_get_group_to_list($group, $groups_count, &$symbolBranchs, $has_children = false) {
|
||||
$tabulation = str_repeat(' ', $group['deep']);
|
||||
|
||||
if ($group['id_grupo'] == 0) {
|
||||
|
@ -2160,11 +2160,16 @@ function groups_get_group_to_list($group, $groups_count, &$symbolBranchs) {
|
|||
'id_group=' . $group['id_grupo'] . '">' . html_print_image("images/config.png", true, array("alt" => __('Edit'), "title" => __('Edit'), "border" => '0'));
|
||||
//Check if there is only a group to unable delete it
|
||||
if ($groups_count > 2) {
|
||||
$confirm_message = __('Are you sure?');
|
||||
if ($has_children) {
|
||||
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group') . ". " . $confirm_message;
|
||||
}
|
||||
|
||||
$data[5] .= ' ' .
|
||||
'<a href="index.php?sec=gagente&' .
|
||||
'sec2=godmode/groups/group_list&' .
|
||||
'id_group=' . $group['id_grupo'] . '&' .
|
||||
'delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("alt" => __('Delete'), "border" => '0'));
|
||||
'delete_group=1" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">' . html_print_image("images/cross.png", true, array("alt" => __('Delete'), "border" => '0'));
|
||||
}
|
||||
else {
|
||||
$data[5] .= ' ' .
|
||||
|
@ -2193,7 +2198,9 @@ function groups_print_group_sons($group, $sons, &$branch_classes, $groups_count,
|
|||
foreach($sons[$group['id_grupo']] as $key => $g) {
|
||||
$symbolBranchs .= ' symbol_branch_' . $g['parent'];
|
||||
|
||||
$data = groups_get_group_to_list($g, $groups_count, $symbolBranchs);
|
||||
$has_children = isset($sons[$g['id_grupo']]);
|
||||
|
||||
$data = groups_get_group_to_list($g, $groups_count, $symbolBranchs, $has_children);
|
||||
array_push ($table->data, $data);
|
||||
|
||||
$branch_classes[$g['id_grupo']] = $branch_classes[$g['parent']] . ' branch_' . $g['parent'];
|
||||
|
|
|
@ -2683,4 +2683,62 @@ function recursive_get_dt_from_modules_tree (&$f_modules, $modules, $deep) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the button with the link to open realtime stats into a new window
|
||||
* Only to native (not satellite discovered) snmp modules.
|
||||
*
|
||||
* @param array With all the module info
|
||||
* @return string All the HTML code to paint the button
|
||||
*/
|
||||
function get_module_realtime_link_graph ($module) {
|
||||
global $config;
|
||||
|
||||
// Sometimes some parameters are renamed
|
||||
if (!isset($module['id_tipo_modulo'])) $module['id_tipo_modulo'] = $module['module_type'];
|
||||
if (!isset($module['nombre'])) $module['nombre'] = $module['module_name'];
|
||||
|
||||
// Avoid to show on metaconsole
|
||||
if (is_metaconsole()) return '';
|
||||
// Realtime graph is an extension and it should be enabled
|
||||
if (!extensions_is_enabled_extension("realtime_graphs.php")) return '';
|
||||
// Only to remote_snmp, remote_snmp_proc. snmp_snmp_inc
|
||||
if ($module['id_tipo_modulo'] != 15 && $module['id_tipo_modulo'] != 16 && $module['id_tipo_modulo'] != 18) {
|
||||
return '';
|
||||
}
|
||||
// Only version 1, 2 and 2c
|
||||
if ($module['tcp_send'] != "1" && $module['tcp_send'] != "2" && $module['tcp_send'] != "2c") {
|
||||
return '';
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'graph' => 'snmp_module',
|
||||
'agent_alias' => modules_get_agentmodule_agent_alias($module['id_agente_modulo']),
|
||||
'module_name' => $module['nombre'],
|
||||
'snmp_address' => $module['ip_target'],
|
||||
'snmp_community' => $module['snmp_community'],
|
||||
'snmp_oid' => $module['snmp_oid'],
|
||||
'snmp_ver' => $module['tcp_send'],
|
||||
'hide_header' => 1,
|
||||
'rel_path' => '../../'
|
||||
);
|
||||
// Incremental type
|
||||
if ($module['id_tipo_modulo'] == 16) $params['incremental'] = 1;
|
||||
$link = "operation/agentes/realtime_win.php?";
|
||||
foreach ($params as $p_key => $p_value) {
|
||||
$link .= "$p_key=" . urlencode(io_safe_output($p_value)) . "&";
|
||||
}
|
||||
$link = substr($link, 0, -1);
|
||||
|
||||
$win_handle = "realtime_" . dechex(crc32($module["id_agente_modulo"].$module["nombre"]));
|
||||
|
||||
$link_button = '<a href="javascript:winopeng_var(\''.$link.'\',\''.$win_handle.'\', 850, 480)">' .
|
||||
html_print_image(
|
||||
"images/realtime_shortcut.png",
|
||||
true,
|
||||
array("border" => '0', "alt" => "", 'title' => __('Realtime SNMP graph'))
|
||||
) .
|
||||
'</a>';
|
||||
|
||||
return $link_button;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1815,7 +1815,8 @@ if (empty($list_networkmaps))
|
|||
$table->data[1][0] = '';
|
||||
$table->data[1][1] =
|
||||
html_print_button(__('Add agent node'), '', false,
|
||||
'add_agent_node();', 'class="sub"', true);
|
||||
'add_agent_node();', 'class="sub"', true) . html_print_image('images/error_red.png', true,
|
||||
array('id' => 'error_red', 'style' => 'vertical-align: bottom;display: none;', 'class' => 'forced_title', 'alt' => 'Esto es una prueba', 'data-title' => 'data-use_title_for_force_title:1'), false);
|
||||
|
||||
$add_agent_node_html = html_print_table($table, true);
|
||||
ui_toggle($add_agent_node_html, __('Add agent node'),
|
||||
|
|
|
@ -879,7 +879,7 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
}
|
||||
$i++;
|
||||
}
|
||||
$data['sla_value'] = reporting_sla_get_compliance_from_array($data) * 100;
|
||||
$data['sla_value'] = reporting_sla_get_compliance_from_array($data);
|
||||
$data['sla_fixed'] = sla_truncate($data['sla_value'], $config['graph_precision'] );
|
||||
}
|
||||
else{
|
||||
|
@ -895,8 +895,8 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
$data['checks_error'] = $sla_array['checks_error'];
|
||||
$data['checks_unknown'] = $sla_array['checks_unknown'];
|
||||
$data['checks_not_init'] = $sla_array['checks_not_init'];
|
||||
$data['sla_value'] = $sla_array['SLA'] * 100;
|
||||
$data['sla_fixed'] = $sla_array['sla_fixed'] * 100;
|
||||
$data['sla_value'] = $sla_array['SLA'];
|
||||
$data['sla_fixed'] = $sla_array['sla_fixed'];
|
||||
}
|
||||
|
||||
//checks whether or not it meets the SLA
|
||||
|
@ -5846,7 +5846,7 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
$raw_graph[$i]['utimestamp'] = $value_sla['date_to'] - $value_sla['date_from'];
|
||||
$i++;
|
||||
}
|
||||
$data['sla_value'] = reporting_sla_get_compliance_from_array($data) * 100;
|
||||
$data['sla_value'] = reporting_sla_get_compliance_from_array($data);
|
||||
$data['sla_fixed'] = sla_truncate($data['sla_value'], $config['graph_precision'] );
|
||||
}
|
||||
else{
|
||||
|
@ -5862,7 +5862,7 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
$data['checks_error'] = $sla_array['checks_error'];
|
||||
$data['checks_unknown'] = $sla_array['checks_unknown'];
|
||||
$data['checks_not_init'] = $sla_array['checks_not_init'];
|
||||
$data['sla_value'] = $sla_array['SLA'] * 100;
|
||||
$data['sla_value'] = $sla_array['SLA'];
|
||||
}
|
||||
|
||||
//checks whether or not it meets the SLA
|
||||
|
@ -5891,6 +5891,8 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
$dataslice['order'] = $data['sla_value'];
|
||||
$dataslice['checks_total'] = $data['checks_total'];
|
||||
$dataslice['checks_ok'] = $data['checks_ok'];
|
||||
$dataslice['time_total'] = $data['time_total'];
|
||||
$dataslice['time_not_init']= $data['time_not_init'];
|
||||
$dataslice['sla_status'] = $data['sla_status'];
|
||||
$dataslice['sla_value'] = $data['sla_value'];
|
||||
|
||||
|
@ -10991,13 +10993,36 @@ function reporting_label_macro ($item, $label) {
|
|||
* @brief Calculates the SLA compliance value given an sla array
|
||||
*
|
||||
* @param Array With keys time_ok, time_error, time_downtime and time_unknown
|
||||
* @return SLA Return the compliance value.
|
||||
*/
|
||||
function reporting_sla_get_compliance_from_array ($sla_array) {
|
||||
$time_compliance = $sla_array['time_ok'] + $sla_array['time_unknown'] + $sla_array['time_downtime'];
|
||||
$time_total_working = $time_compliance + $sla_array['time_error'];
|
||||
return $time_compliance == 0
|
||||
? 0
|
||||
: $time_compliance/$time_total_working;
|
||||
: ($time_compliance/$time_total_working) * 100;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Calculates if an SLA array is not init
|
||||
*
|
||||
* @param Array With keys time_ok, time_error, time_downtime and time_unknown
|
||||
* @return bool True if not init
|
||||
*/
|
||||
function reporting_sla_is_not_init_from_array($sla_array) {
|
||||
if ($sla_array["time_total"] == 0) return false;
|
||||
return $sla_array["time_not_init"] == $sla_array["time_total"];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Calculates if an SLA array is ignored
|
||||
*
|
||||
* @param Array With keys time_ok, time_error, time_downtime and time_unknown
|
||||
* @return bool True if igonred time
|
||||
*/
|
||||
function reporting_sla_is_ignored_from_array($sla_array) {
|
||||
if ($sla_array["time_total"] > 0) return false;
|
||||
return $sla_array["time_not_init"] == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -485,14 +485,19 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$row[] = $sla['dinamic_text'];
|
||||
}
|
||||
$row[] = round($sla['sla_limit'], 2) . "%";
|
||||
|
||||
if ($sla['sla_value_unknown']) {
|
||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
|
||||
|
||||
if (reporting_sla_is_not_init_from_array($sla)) {
|
||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">' .
|
||||
__('N/A') . '</span>';
|
||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
|
||||
__('Unknown') . '</span>';
|
||||
}
|
||||
elseif ($sla['sla_status']) {
|
||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">' .
|
||||
__('Not init') . '</span>';
|
||||
} elseif (reporting_sla_is_ignored_from_array($sla)) {
|
||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_IGNORED.';">' .
|
||||
__('N/A') . '</span>';
|
||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_IGNORED.';">' .
|
||||
__('No data') . '</span>';
|
||||
// Normal calculation
|
||||
} elseif ($sla['sla_status']) {
|
||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
|
||||
sla_truncate($sla['sla_value'], $config['graph_precision']) . "%" . '</span>';
|
||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
|
||||
|
@ -2564,24 +2569,36 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
|||
$table1->width = '99%';
|
||||
$table1->data = array ();
|
||||
foreach ($item['charts'] as $chart) {
|
||||
switch ($chart['sla_status']) {
|
||||
case REPORT_STATUS_ERR:
|
||||
$color = COL_CRITICAL;
|
||||
break;
|
||||
case REPORT_STATUS_OK:
|
||||
$color = COL_NORMAL;
|
||||
break;
|
||||
default:
|
||||
$color = COL_UNKNOWN;
|
||||
break;
|
||||
$checks_resume = '';
|
||||
$sla_value = '';
|
||||
if (reporting_sla_is_not_init_from_array($chart)) {
|
||||
$color = COL_NOTINIT;
|
||||
$sla_value = __('Not init');
|
||||
} elseif (reporting_sla_is_ignored_from_array($chart)) {
|
||||
$color = COL_IGNORED;
|
||||
$sla_value = __('No data');
|
||||
} else {
|
||||
switch ($chart['sla_status']) {
|
||||
case REPORT_STATUS_ERR:
|
||||
$color = COL_CRITICAL;
|
||||
break;
|
||||
case REPORT_STATUS_OK:
|
||||
$color = COL_NORMAL;
|
||||
break;
|
||||
default:
|
||||
$color = COL_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
$sla_value = sla_truncate($chart['sla_value'], $config['graph_precision']) . '%';
|
||||
$checks_resume = "(" . $chart['checks_ok'] . "/" . $chart['checks_total'] . ")";
|
||||
}
|
||||
$table1->data[] = array(
|
||||
$chart['agent'] . "<br />" . $chart['module'],
|
||||
$chart['chart'],
|
||||
"<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>" .
|
||||
sla_truncate($chart['sla_value'], $config['graph_precision']) . '%' .
|
||||
$sla_value .
|
||||
'</span>',
|
||||
"(" . $chart['checks_ok'] . "/" . $chart['checks_total'] . ")"
|
||||
$checks_resume
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -576,16 +576,17 @@ function snmp_browser_print_container ($return = false, $width = '100%', $height
|
|||
enterprise_include_once ('include/functions_satellite.php');
|
||||
|
||||
$rows = get_proxy_servers();
|
||||
foreach ($rows as $row) {
|
||||
if ($row['server_type'] != 13) {
|
||||
$s_type = " (Standard)";
|
||||
if ($rows !== false) {
|
||||
foreach ($rows as $row) {
|
||||
if ($row['server_type'] != 13) {
|
||||
$s_type = " (Standard)";
|
||||
}
|
||||
else {
|
||||
$s_type = " (Satellite)";
|
||||
}
|
||||
$servers_to_exec[$row['id_server']] = $row['name'] . $s_type;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$s_type = " (Satellite)";
|
||||
}
|
||||
|
||||
$servers_to_exec[$row['id_server']] = $row['name'] . $s_type;
|
||||
}
|
||||
}
|
||||
$table->data[1][1] = '<strong>' . __('Server to execute') . '</strong> ';
|
||||
$table->data[1][1] .= html_print_select($servers_to_exec, 'server_to_exec', '', '', '', '', true);
|
||||
|
|
|
@ -719,10 +719,10 @@ function tags_get_acl_tags($id_user, $id_group, $access = 'AR',
|
|||
function tags_get_acl_tags_module_condition($acltags, $modules_table = '') {
|
||||
if (!empty($modules_table))
|
||||
$modules_table .= '.';
|
||||
|
||||
|
||||
$condition = '';
|
||||
$group_conditions = array();
|
||||
|
||||
|
||||
// The acltags array contains the groups with the acl propagation applied
|
||||
// after the changes done into the 'tags_get_user_groups_and_tags' function.
|
||||
foreach ($acltags as $group_id => $group_tags) {
|
||||
|
@ -733,8 +733,9 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table = '') {
|
|||
AND ttmc.id_tag IN (%s)',
|
||||
is_array($group_tags) ? implode(',', $group_tags) : $group_tags);
|
||||
}
|
||||
|
||||
$agent_condition = sprintf('SELECT tamc.id_agente_modulo
|
||||
// FIXME: Not properly way to increse performance
|
||||
if(enterprise_hook('agents_is_using_secondary_groups')){
|
||||
$agent_condition = sprintf('SELECT tamc.id_agente_modulo
|
||||
FROM tagente_modulo tamc
|
||||
%s
|
||||
INNER JOIN tagente tac
|
||||
|
@ -743,10 +744,21 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table = '') {
|
|||
ON tasg.id_agent = tac.id_agente
|
||||
WHERE (tac.id_grupo = %d OR tasg.id_group = %d)',
|
||||
$tag_join, $group_id, $group_id);
|
||||
}
|
||||
else{
|
||||
$agent_condition = sprintf('SELECT tamc.id_agente_modulo
|
||||
FROM tagente_modulo tamc
|
||||
%s
|
||||
INNER JOIN tagente tac
|
||||
ON tamc.id_agente = tac.id_agente
|
||||
AND tac.id_grupo = %d',
|
||||
$tag_join, $group_id);
|
||||
}
|
||||
|
||||
$sql_condition = sprintf('(%sid_agente_modulo IN (%s))', $modules_table, $agent_condition);
|
||||
|
||||
|
||||
$group_conditions[] = $sql_condition;
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
@ -859,7 +871,13 @@ function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group
|
|||
// Tags condition (The module has at least one of the restricted tags)
|
||||
$tags_condition = '';
|
||||
if (empty($group_tags)) {
|
||||
$tags_condition = "id_grupo = ".$group_id . " OR id_group = " . $group_id;
|
||||
// FIXME: Not properly way to increse performance
|
||||
if(enterprise_hook('agents_is_using_secondary_groups')){
|
||||
$tags_condition = "id_grupo = ".$group_id . " OR id_group = " . $group_id;
|
||||
}
|
||||
else{
|
||||
$tags_condition = "id_grupo = ".$group_id;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!is_array($group_tags)) {
|
||||
|
|
|
@ -623,7 +623,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
|||
if ( $user_access_node && check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
|
||||
$go_to_agent = '<div style="text-align: right;">';
|
||||
|
||||
if($agent["id_os"] != 21){
|
||||
if($agent["id_os"] != 100){
|
||||
$go_to_agent .= '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
|
||||
$go_to_agent .= html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
|
||||
}
|
||||
|
|
|
@ -654,7 +654,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
$form_items_advance['position_row']['items'] = array('static_graph',
|
||||
'percentile_bar', 'percentile_item', 'module_graph',
|
||||
'simple_value', 'label', 'icon', 'datos', 'box_item',
|
||||
'auto_sla_graph', 'bars_graph','clock');
|
||||
'auto_sla_graph', 'bars_graph','clock', 'donut_graph');
|
||||
$form_items_advance['position_row']['html'] = '
|
||||
<td align="left">' . __('Position') . '</td>
|
||||
<td align="left">(' . html_print_input_text('left', '0', '', 3, 5, true) .
|
||||
|
@ -684,7 +684,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
'group_item', 'static_graph',
|
||||
'percentile_bar', 'percentile_item', 'module_graph',
|
||||
'simple_value', 'label', 'icon', 'datos', 'auto_sla_graph',
|
||||
'bars_graph');
|
||||
'bars_graph', 'donut_graph');
|
||||
$form_items_advance['parent_row']['html'] = '<td align="left">' .
|
||||
__('Parent') . '</td>
|
||||
<td align="left">' .
|
||||
|
@ -696,7 +696,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
$form_items_advance['map_linked_row']['items'] = array(
|
||||
'group_item', 'static_graph', 'percentile_bar',
|
||||
'percentile_item', 'module_graph', 'simple_value',
|
||||
'icon', 'label', 'datos');
|
||||
'icon', 'label', 'datos', 'donut_graph');
|
||||
$form_items_advance['map_linked_row']['html'] = '<td align="left">'.
|
||||
__('Map linked') . '</td>' .
|
||||
'<td align="left">' . html_print_select_from_sql (
|
||||
|
@ -732,7 +732,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
$form_items_advance['element_group_row']['items'] = array(
|
||||
'group_item', 'static_graph', 'percentile_bar',
|
||||
'percentile_item', 'module_graph', 'simple_value',
|
||||
'icon', 'label', 'datos');
|
||||
'icon', 'label', 'datos', 'donut_graph');
|
||||
$form_items_advance['element_group_row']['html'] = '<td align="left">'.
|
||||
__('Restrict access to group') . '</td>' .
|
||||
'<td align="left">' .
|
||||
|
|
|
@ -248,6 +248,7 @@ function flot_area_graph (
|
|||
$array_events_alerts = json_encode($array_events_alerts);
|
||||
|
||||
// Javascript code
|
||||
if ($font_size == '') $font_size = '\'\'';
|
||||
$return .= "<script type='text/javascript'>";
|
||||
$return .= "$(document).ready( function () {";
|
||||
$return .= "pandoraFlotArea(" .
|
||||
|
|
|
@ -111,15 +111,22 @@ function set_center(id) {
|
|||
|
||||
function get_relations(node_param) {
|
||||
var return_links = [];
|
||||
var links_id_db = [];
|
||||
|
||||
jQuery.each(graph.links, function (i, link_each) {
|
||||
if (node_param.id == link_each.source.id) {
|
||||
return_links.push(link_each);
|
||||
}
|
||||
else if (node_param.id == link_each.target.id) {
|
||||
return_links.push(link_each);
|
||||
if (node_param.id == link_each.source.id || node_param.id == link_each.target.id) {
|
||||
if(links_id_db.length > 0){
|
||||
if(links_id_db.indexOf(link_each.id_db) == -1){
|
||||
return_links.push(link_each);
|
||||
links_id_db.push(link_each.id_db);
|
||||
}
|
||||
} else {
|
||||
return_links.push(link_each);
|
||||
links_id_db.push(link_each.id_db);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return return_links;
|
||||
}
|
||||
|
||||
|
@ -1098,6 +1105,10 @@ function add_agent_node(agents) {
|
|||
draw_elements_graph();
|
||||
init_drag_and_drop();
|
||||
set_positions_graph();
|
||||
} else {
|
||||
$("#error_red").show();
|
||||
$("#error_red").attr("data-title","The agent is already added on the networkmap");
|
||||
$("#error_red").attr("data-use_title_for_force_title","1");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -139,7 +139,7 @@ function js_printMap(id_div, initial_zoom, center_latitude, center_longitude, ob
|
|||
|
||||
map.events.on({"zoomend": EventZoomEnd});
|
||||
map.events.on({"mouseup": EventZoomEnd});
|
||||
|
||||
|
||||
//Define the maps layer
|
||||
for (var baselayerIndex in objBaseLayers) {
|
||||
if (isInt(baselayerIndex)) {
|
||||
|
@ -217,6 +217,29 @@ function js_printMap(id_div, initial_zoom, center_latitude, center_longitude, ob
|
|||
);
|
||||
map.addLayer(baseLayer);
|
||||
break;
|
||||
case 'WMS':
|
||||
// http://<server>/geoserver/wms
|
||||
// ?bbox=-130,24,-66,50
|
||||
// &styles=population
|
||||
// &Format=application/openlayers
|
||||
// &request=GetMap
|
||||
// &layers=topp:states
|
||||
// &width=550
|
||||
// &height=250
|
||||
// &srs=EPSG:4326
|
||||
var layer = new OpenLayers.Layer.WMS(
|
||||
objBaseLayers[baselayerIndex]['name'],
|
||||
objBaseLayers[baselayerIndex]['url'],
|
||||
{
|
||||
layers: objBaseLayers[baselayerIndex]['layers'],
|
||||
format: "image/png"
|
||||
},
|
||||
{
|
||||
numZoomLevels: objBaseLayers[baselayerIndex]['num_zoom_levels']
|
||||
}
|
||||
);
|
||||
map.addLayer(layer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1562,4 +1562,68 @@ function round_with_decimals (value, multiplier = 1) {
|
|||
return Math.round(value * multiplier) / multiplier;
|
||||
}
|
||||
return round_with_decimals (value, multiplier * 10);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
$("body").append('<div id="event_delete_confirm_dialog"><h4>' + '<?php echo __('Are you sure?'); ?>' + '</h4></div>');
|
||||
$("#event_delete_confirm_dialog").dialog({
|
||||
resizable: false,
|
||||
draggable: false,
|
||||
modal: true,
|
||||
height: 280,
|
||||
width: 330,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
||||
});
|
||||
*/
|
||||
|
||||
/**
|
||||
* Display a confirm dialog box
|
||||
*
|
||||
* @param string Text to display
|
||||
* @param string Ok button text
|
||||
* @param string Cancel button text
|
||||
* @param function Callback to action when ok button is pressed
|
||||
*/
|
||||
function display_confirm_dialog (
|
||||
message = '',
|
||||
ok_text = '',
|
||||
cancel_text = '',
|
||||
ok_function = function () {}
|
||||
) {
|
||||
// Clean function to close the dialog
|
||||
var clean_function = function () {
|
||||
$("#pandora_confirm_dialog_text").hide();
|
||||
$("#pandora_confirm_dialog_text").remove();
|
||||
}
|
||||
|
||||
// Modify the ok function to close the dialog too
|
||||
var ok_function_clean = function () {
|
||||
ok_function();
|
||||
clean_function();
|
||||
}
|
||||
|
||||
// Display the dialog
|
||||
$("body").append('<div id="pandora_confirm_dialog_text"><h3>' + message + '</h3></div>');
|
||||
$("#pandora_confirm_dialog_text").dialog({
|
||||
resizable: false,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
dialogClass: "pandora_confirm_dialog",
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
closeOnEscape: true,
|
||||
modal: true,
|
||||
buttons: {
|
||||
Cancel: clean_function,
|
||||
"Confirm": ok_function_clean
|
||||
}
|
||||
});
|
||||
}
|
|
@ -316,6 +316,10 @@ function configure_modules_form () {
|
|||
$("#text-max_critical").attr ("value", (data["max_critical"] == 0) ? 0 : data["max_critical"]);
|
||||
$("#text-str_critical").attr ("value", data["str_critical"]);
|
||||
$("#text-ff_event").attr ("value", (data["min_ff_event"] == 0) ? 0 : data["min_ff_event"]);
|
||||
$("input[name=each_ff][value=" + data["each_ff"] + "]").prop('checked', true);
|
||||
$("#text-ff_event_normal").attr ("value", (data["min_ff_event_normal"] == 0) ? 0 : data["min_ff_event_normal"]);
|
||||
$("#text-ff_event_warning").attr ("value", (data["min_ff_event_warning"] == 0) ? 0 : data["min_ff_event_warning"]);
|
||||
$("#text-ff_event_critical").attr ("value", (data["min_ff_event_critical"] == 0) ? 0 : data["min_ff_event_critical"]);
|
||||
$("#text-post_process").attr("value", (data["post_process"] == 0) ? 0 : data["post_process"]);
|
||||
$("#text-unit").attr("value", (data["unit"] == '') ? '' : data["unit"]);
|
||||
$("#text-critical_inverse").attr ("value", (data["critical_inverse"] == 0) ? 0 : data["critical_inverse"]);
|
||||
|
|
|
@ -4545,7 +4545,6 @@ form ul.form_flex li ul li{
|
|||
width: 85%;
|
||||
height:100%;
|
||||
float:left;
|
||||
|
||||
}
|
||||
|
||||
.status_animation {
|
||||
|
@ -4574,7 +4573,6 @@ form ul.form_flex li ul li{
|
|||
width: 15%;
|
||||
height:100%;
|
||||
float:left;
|
||||
|
||||
}
|
||||
|
||||
#last_contact_date {
|
||||
|
@ -4584,9 +4582,9 @@ form ul.form_flex li ul li{
|
|||
margin-left:5%;
|
||||
text-align:center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#last_contact_date_text {
|
||||
|
@ -4612,9 +4610,9 @@ form ul.form_flex li ul li{
|
|||
width: 90%;
|
||||
height:100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.events_bar {
|
||||
|
@ -4629,8 +4627,26 @@ form ul.form_flex li ul li{
|
|||
}
|
||||
|
||||
/*
|
||||
.tickLabel {
|
||||
.yAxis.y1Axis > .tickLabel {
|
||||
white-space: nowrap;
|
||||
line-height: 1.05em!important;
|
||||
width: auto!important;
|
||||
}
|
||||
*/
|
||||
|
||||
.pandora_confirm_dialog .ui-dialog-buttonset {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
margin-left: 10px;
|
||||
float: none !important;
|
||||
}
|
||||
|
||||
.pandora_confirm_dialog .ui-dialog-buttonset button{
|
||||
flex: 50%;
|
||||
}
|
||||
|
||||
#pandora_confirm_dialog_text h3{
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
@ -555,12 +555,15 @@ if (! isset ($config['id_user'])) {
|
|||
exit ("</html>");
|
||||
}
|
||||
}
|
||||
if($home_page != 'Visual console'){
|
||||
header("Location: ".$config['homeurl']."index.php?sec=".$_GET["sec"]."&sec2=".$_GET["sec2"]);
|
||||
// Form the url
|
||||
$query_params_redirect = $_GET;
|
||||
// Visual console do not want sec2
|
||||
if($home_page == 'Visual console') unset($query_params_redirect["sec2"]);
|
||||
$redirect_url = '?1=1';
|
||||
foreach ($query_params_redirect as $key => $value) {
|
||||
$redirect_url .= '&'.safe_url_extraclean($key).'='.safe_url_extraclean($value);
|
||||
}
|
||||
else{
|
||||
header("Location: ".$config['homeurl']."index.php?sec=".$_GET["sec"]);
|
||||
}
|
||||
header("Location: ".$config['homeurl']."index.php".$redirect_url);
|
||||
}
|
||||
// Hash login process
|
||||
elseif (isset ($_GET["loginhash"])) {
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.722';
|
||||
$build = '180423';
|
||||
$build = '180510';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -641,7 +641,7 @@ foreach ($agents as $agent) {
|
|||
|
||||
$data[0] .= '<div class="agentleft_' . $agent["id_agente"] . '" style="visibility: hidden; clear: left;">';
|
||||
|
||||
if($agent["id_os"] == 21){
|
||||
if($agent["id_os"] == 100){
|
||||
$data[0] .= '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id='.$cluster['id'].'">'.__('View').'</a>';
|
||||
}
|
||||
else{
|
||||
|
@ -651,7 +651,7 @@ foreach ($agents as $agent) {
|
|||
if (check_acl ($config['id_user'], $agent["id_grupo"], "AW")) {
|
||||
$data[0] .= ' | ';
|
||||
|
||||
if($agent["id_os"] == 21){
|
||||
if($agent["id_os"] == 100){
|
||||
$data[0] .= '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.__('Edit').'</a>';
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -87,6 +87,13 @@ $interface_traffic_modules = array(
|
|||
<script type='text/javascript' src='../../include/javascript/jquery-1.9.0.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/jquery.jquery-ui-1.10.0.custom.js'></script>
|
||||
<?php
|
||||
if ($config['flash_charts']) {
|
||||
//Include the javascript for the js charts library
|
||||
include_once($config["homedir"] . '/include/graphs/functions_flot.php');
|
||||
echo include_javascript_dependencies_flot_graph(true, "../");
|
||||
}
|
||||
?>
|
||||
<script type='text/javascript'>
|
||||
<!--
|
||||
window.onload = function() {
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2018 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.
|
||||
|
||||
|
||||
if (! isset($_SESSION['id_usuario'])) {
|
||||
session_start();
|
||||
//session_write_close();
|
||||
}
|
||||
|
||||
// Global & session management
|
||||
require_once ('../../include/config.php');
|
||||
require_once ($config['homedir'] . '/include/auth/mysql.php');
|
||||
require_once ($config['homedir'] . '/include/functions.php');
|
||||
require_once ($config['homedir'] . '/include/functions_db.php');
|
||||
require_once ($config['homedir'] . '/include/functions_reporting.php');
|
||||
require_once ($config['homedir'] . '/include/functions_graph.php');
|
||||
require_once ($config['homedir'] . '/include/functions_modules.php');
|
||||
require_once ($config['homedir'] . '/include/functions_agents.php');
|
||||
require_once ($config['homedir'] . '/include/functions_tags.php');
|
||||
require_once ($config['homedir'] . '/include/functions_extensions.php');
|
||||
check_login ();
|
||||
|
||||
// Metaconsole connection to the node
|
||||
$server_id = (int) get_parameter("server");
|
||||
if (is_metaconsole() && !empty($server_id)) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
|
||||
// Error connecting
|
||||
if (metaconsole_connect($server) !== NOERR) {
|
||||
echo "<html>";
|
||||
echo "<body>";
|
||||
ui_print_error_message(__('There was a problem connecting with the node'));
|
||||
echo "</body>";
|
||||
echo "</html>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$user_language = get_user_language ($config['id_user']);
|
||||
if (file_exists ('../../include/languages/'.$user_language.'.mo')) {
|
||||
$l10n = new gettext_reader (new CachedFileReader ('../../include/languages/'.$user_language.'.mo'));
|
||||
$l10n->load_tables();
|
||||
}
|
||||
|
||||
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css"/>';
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<?php
|
||||
// Parsing the refresh before sending any header
|
||||
$refresh = (int) get_parameter ("refresh", -1);
|
||||
if ($refresh > 0) {
|
||||
$query = ui_get_url_refresh (false);
|
||||
echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />';
|
||||
}
|
||||
?>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Pandora FMS Realtime Module Graph</title>
|
||||
<link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../include/styles/jquery-ui-1.10.0.custom.css" type="text/css" />
|
||||
<script type='text/javascript' src='../../include/javascript/pandora.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/jquery-1.9.0.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/jquery.jquery-ui-1.10.0.custom.js'></script>
|
||||
<?php
|
||||
//Include the javascript for the js charts library
|
||||
include_once($config["homedir"] . '/include/graphs/functions_flot.php');
|
||||
include_javascript_dependencies_flot_graph();
|
||||
?>
|
||||
</head>
|
||||
<body bgcolor="#ffffff" style='background:#ffffff;'>
|
||||
<?php
|
||||
$config['extensions'] = extensions_get_extensions (false, '../../');
|
||||
if (!extensions_is_enabled_extension("realtime_graphs.php")) {
|
||||
ui_print_error_message(__('Realtime extension is not enabled.'));
|
||||
return;
|
||||
} else {
|
||||
include_once('../../extensions/realtime_graphs.php');
|
||||
}
|
||||
pandora_realtime_graphs();
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
// Echo the script tags of the datepicker and the timepicker
|
||||
// Modify the user language cause the ui.datepicker language files use - instead _
|
||||
$custom_user_language = str_replace('_', '-', $user_language);
|
||||
ui_require_jquery_file("ui.datepicker-" . $custom_user_language, "include/javascript/i18n/", true);
|
||||
ui_include_time_picker(true);
|
||||
?>
|
|
@ -125,7 +125,7 @@ else {
|
|||
if (((int)$ag_group !== 0) && (check_acl ($config['id_user'], $id_ag_group, 'AR'))) {
|
||||
$sql_conditions_group = sprintf (
|
||||
' AND (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))',
|
||||
$user_groups, $user_groups
|
||||
$ag_group, $ag_group
|
||||
);
|
||||
}
|
||||
elseif ($user_groups != '') {
|
||||
|
@ -753,7 +753,11 @@ switch ($config['dbtype']) {
|
|||
tagente.id_grupo AS id_group,
|
||||
tagente.id_agente AS id_agent,
|
||||
tagente_modulo.id_tipo_modulo AS module_type,
|
||||
tagente_modulo.module_interval,
|
||||
tagente_modulo.module_interval,
|
||||
tagente_modulo.tcp_send,
|
||||
tagente_modulo.ip_target,
|
||||
tagente_modulo.snmp_community,
|
||||
tagente_modulo.snmp_oid,
|
||||
tagente_estado.datos,
|
||||
tagente_estado.estado,
|
||||
tagente_modulo.min_warning,
|
||||
|
@ -1272,12 +1276,11 @@ if (!empty($result)) {
|
|||
$graph_params_str = http_build_query($graph_params);
|
||||
|
||||
$link = 'winopeng(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\')';
|
||||
|
||||
$data[7] = '';
|
||||
|
||||
|
||||
$data[7] = get_module_realtime_link_graph($row);
|
||||
|
||||
if(!is_snapshot_data($row['datos'])){
|
||||
|
||||
$data[7] = '<a href="javascript:'.$link.'">' . html_print_image('images/chart_curve.png', true, array('border' => '0', 'alt' => '')) . '</a>';
|
||||
$data[7] .= '<a href="javascript:'.$link.'">' . html_print_image('images/chart_curve.png', true, array('border' => '0', 'alt' => '')) . '</a>';
|
||||
}
|
||||
$data[7] .= '<a href="javascript: ' .
|
||||
'show_module_detail_dialog(' .
|
||||
|
|
|
@ -666,8 +666,12 @@ else {
|
|||
|
||||
if ($i != 0 && $allow_action) {
|
||||
//Actions
|
||||
$data[$i] = '';
|
||||
|
||||
$data[$i] = '<a href="javascript:" onclick="show_event_dialog(' . $event["id_evento"] . ', '.$group_rep.');">';
|
||||
$data[$i] .= html_print_input_hidden('event_title_'.$event["id_evento"], "#".$event["id_evento"]." - " . strip_tags(io_safe_output($event["evento"])), true);
|
||||
$data[$i] .= html_print_image ("images/eye.png", true,
|
||||
array ("title" => __('Show more')));
|
||||
$data[$i] .= '</a>';
|
||||
|
||||
if(!$readonly) {
|
||||
// Validate event
|
||||
if (($event["estado"] != 1) && (tags_checks_event_acl ($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'], $childrens_ids))) {
|
||||
|
@ -676,6 +680,13 @@ else {
|
|||
$data[$i] .= html_print_image ("images/ok.png", true,
|
||||
array ("title" => __('Validate event')));
|
||||
$data[$i] .= '</a>';
|
||||
// Display the go to in progress status button
|
||||
if ($event["estado"] != 2) {
|
||||
$data[$i] .= '<a href="javascript:validate_event_advanced('.$event["id_evento"].', 2)" id="in-progress-'.$event["id_evento"].'">';
|
||||
$data[$i] .= html_print_image ("images/hourglass.png", true,
|
||||
array ("title" => __('Change to in progress status')));
|
||||
$data[$i] .= '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Delete event
|
||||
|
@ -688,18 +699,19 @@ else {
|
|||
$data[$i] .= '</a>';
|
||||
}
|
||||
else {
|
||||
$data[$i] .= html_print_image ("images/cross.disabled.png", true,
|
||||
array ("title" => __('Is not allowed delete events in process'))).' ';
|
||||
$data[$i] .= html_print_image (
|
||||
"images/cross.disabled.png",
|
||||
true,
|
||||
array (
|
||||
"title" => __('Is not allowed delete events in process'),
|
||||
"id" => "delete-" . $event['id_evento']
|
||||
)
|
||||
);
|
||||
$data[$i] .= ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data[$i] .= '<a href="javascript:" onclick="show_event_dialog(' . $event["id_evento"] . ', '.$group_rep.');">';
|
||||
$data[$i] .= html_print_input_hidden('event_title_'.$event["id_evento"], "#".$event["id_evento"]." - " . strip_tags(io_safe_output($event["evento"])), true);
|
||||
$data[$i] .= html_print_image ("images/eye.png", true,
|
||||
array ("title" => __('Show more')));
|
||||
$data[$i] .= '</a>';
|
||||
|
||||
|
||||
$table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3;';
|
||||
|
||||
$i++;
|
||||
|
|
|
@ -873,41 +873,45 @@ $(document).ready( function() {
|
|||
"html"
|
||||
);
|
||||
});
|
||||
|
||||
$("a.delete_event").click (function () {
|
||||
confirmation = confirm("<?php echo __('Are you sure?'); ?>");
|
||||
if (!confirmation) {
|
||||
return;
|
||||
}
|
||||
meta = $('#hidden-meta').val();
|
||||
history_var = $('#hidden-history').val();
|
||||
|
||||
$tr = $(this).parents ("tr");
|
||||
id = this.id.split ("-").pop ();
|
||||
|
||||
$("#delete_cross_"+id).attr ("src", "images/spinner.gif");
|
||||
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
"delete_event" : 1,
|
||||
"id" : id,
|
||||
"similars" : <?php echo ($group_rep ? 1 : 0) ?>,
|
||||
"meta" : meta,
|
||||
"history" : history_var
|
||||
},
|
||||
function (data, status) {
|
||||
if (data == "ok") {
|
||||
$tr.remove ();
|
||||
$('#show_message_error').html('<h3 class="suc"> <?php echo __('Successfully delete'); ?> </h3>');
|
||||
}
|
||||
else
|
||||
$('#show_message_error').html('<h3 class="error"> <?php echo __('Error deleting event'); ?> </h3>');
|
||||
},
|
||||
"html"
|
||||
|
||||
$("td").on('click', 'a.delete_event', function () {
|
||||
var click_element = this;
|
||||
display_confirm_dialog(
|
||||
"<?php echo __('Are you sure?'); ?>",
|
||||
"<?php echo __('Confirm'); ?>",
|
||||
"<?php echo __('Cancel'); ?>",
|
||||
function () {
|
||||
meta = $('#hidden-meta').val();
|
||||
history_var = $('#hidden-history').val();
|
||||
|
||||
$tr = $(click_element).parents ("tr");
|
||||
id = click_element.id.split ("-").pop ();
|
||||
|
||||
$("#delete_cross_"+id).attr ("src", "images/spinner.gif");
|
||||
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
"delete_event" : 1,
|
||||
"id" : id,
|
||||
"similars" : <?php echo ($group_rep ? 1 : 0) ?>,
|
||||
"meta" : meta,
|
||||
"history" : history_var
|
||||
},
|
||||
function (data, status) {
|
||||
if (data == "ok") {
|
||||
$tr.remove ();
|
||||
$('#show_message_error').html('<h3 class="suc"> <?php echo __('Successfully delete'); ?> </h3>');
|
||||
}
|
||||
else
|
||||
$('#show_message_error').html('<h3 class="error"> <?php echo __('Error deleting event'); ?> </h3>');
|
||||
},
|
||||
"html"
|
||||
);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
function toggleDiv (divid) {
|
||||
if (document.getElementById(divid).style.display == 'none') {
|
||||
document.getElementById(divid).style.display = 'block';
|
||||
|
@ -940,6 +944,11 @@ function validate_event_advanced(id, new_status) {
|
|||
$tr = $('#validate-'+id).parents ("tr");
|
||||
|
||||
var grouped = $('#group_rep').val();
|
||||
|
||||
// Get images url
|
||||
var hourglass_image = "<?php echo ui_get_full_url("images/hourglass.png", false, false, false); ?>";
|
||||
var cross_disabled_image = "<?php echo ui_get_full_url("images/cross.disabled.png", false, false, false); ?>";
|
||||
var cross_image = "<?php echo ui_get_full_url("images/cross.png", false, false, false); ?>";
|
||||
|
||||
var similar_ids;
|
||||
similar_ids = $('#hidden-similar_ids_'+id).val();
|
||||
|
@ -964,31 +973,46 @@ function validate_event_advanced(id, new_status) {
|
|||
// Change status description
|
||||
$("#status_row_"+id).html(<?php echo "'" . __('Event validated') . "'"; ?>);
|
||||
|
||||
// Change state image
|
||||
// Change delete icon
|
||||
$("#delete-"+id).remove();
|
||||
$("#validate-"+id).parent().append('<a class="delete_event" href="javascript:" id="delete-' + id + '"></a>');
|
||||
$("#delete-"+id).append("<img src='" + cross_image + "' />");
|
||||
$("#delete-"+id + " img").attr ("id", "delete_cross_" + id);
|
||||
$("#delete-"+id + " img").attr ("data-title", <?php echo "'" . __('Delete event') . "'"; ?>);
|
||||
$("#delete-"+id + " img").attr ("alt", <?php echo "'" . __('Delete event') . "'"; ?>);
|
||||
$("#delete-"+id + " img").attr ("data-use_title_for_force_title", 1);
|
||||
$("#delete-"+id + " img").attr ("class", "forced_title");
|
||||
|
||||
// Change other buttons actions
|
||||
$("#validate-"+id).css("display", "none");
|
||||
$("#in-progress-"+id).css("display", "none");
|
||||
$("#status_img_"+id).attr ("src", "images/tick.png");
|
||||
$("#status_img_"+id).attr ("title", <?php echo "'" . __('Event validated') . "'"; ?>);
|
||||
$("#status_img_"+id).attr ("alt", <?php echo "'" . __('Event validated') . "'"; ?>);
|
||||
$("#status_img_"+id).attr ("data-title", <?php echo "'" . __('Event in process') . "'"; ?>);
|
||||
$("#status_img_"+id).attr ("alt", <?php echo "'" . __('Event in process') . "'"; ?>);
|
||||
$("#status_img_"+id).attr ("data-use_title_for_force_title", 1);
|
||||
$("#status_img_"+id).attr ("class", "forced_title");
|
||||
} // In process
|
||||
else if (new_status == 2) {
|
||||
// Change status description
|
||||
$("#status_row_"+id).html(<?php echo "'" . __('Event in process') . "'"; ?>);
|
||||
|
||||
// Remove delete link (if event is not grouped and there is more than one event)
|
||||
if (grouped == 1) {
|
||||
if (parseInt($("#count_event_group_"+id).text()) <= 1) {
|
||||
$("#delete-"+id).replaceWith('<img alt="' + <?php echo "'" . __('Is not allowed delete events in process') . "'"; ?> + '" title="' + <?php echo "'" . __('Is not allowed delete events in process') . "'"; ?> + '" src="images/cross.disabled.png">');
|
||||
}
|
||||
}
|
||||
else { // Remove delete link (if event is not grouped)
|
||||
$("#delete-"+id).replaceWith('<img alt="' + <?php echo "'" . __('Is not allowed delete events in process') . "'"; ?> + '" title="' + <?php echo "'" . __('Is not allowed delete events in process') . "'"; ?> + '" src="images/cross.disabled.png">');
|
||||
}
|
||||
|
||||
// Change state image
|
||||
$("#status_img_"+id).attr ("src", "images/hourglass.png");
|
||||
$("#status_img_"+id).attr ("title", <?php echo "'" . __('Event in process') . "'"; ?>);
|
||||
$("#status_img_"+id).attr ("src", hourglass_image);
|
||||
$("#status_img_"+id).attr ("data-title", <?php echo "'" . __('Event in process') . "'"; ?>);
|
||||
$("#status_img_"+id).attr ("alt", <?php echo "'" . __('Event in process') . "'"; ?>);
|
||||
|
||||
$("#status_img_"+id).attr ("data-use_title_for_force_title", 1);
|
||||
$("#status_img_"+id).attr ("class", "forced_title");
|
||||
|
||||
// Change the actions buttons
|
||||
$("#delete-"+id).remove();
|
||||
$("#in-progress-"+id).remove();
|
||||
// Format the new disabled delete icon.
|
||||
$("#validate-"+id).parent().append("<img id='delete-" + id + "' src='" + cross_disabled_image + "' />");
|
||||
$("#delete-"+id).attr ("data-title", <?php echo "'" . __('Is not allowed delete events in process') . "'"; ?>);
|
||||
$("#delete-"+id).attr ("alt", <?php echo "'" . __('Is not allowed delete events in process') . "'"; ?>);
|
||||
$("#delete-"+id).attr ("data-use_title_for_force_title", 1);
|
||||
$("#delete-"+id).attr ("class", "forced_title");
|
||||
|
||||
// Remove row due to new state
|
||||
if (($("#status").val() == 0)
|
||||
|| ($("#status").val() == 1)) {
|
||||
|
|
|
@ -87,7 +87,9 @@ switch ($config["dbtype"]) {
|
|||
case "postgresql":
|
||||
case "oracle":
|
||||
$sql = "SELECT *
|
||||
FROM tevento
|
||||
FROM tevento te
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON te.id_grupo = tasg.id_group
|
||||
WHERE 1=1 ".$sql_post."
|
||||
ORDER BY utimestamp DESC";
|
||||
break;
|
||||
|
@ -97,9 +99,9 @@ $now = date ("Y-m-d");
|
|||
|
||||
// Show contentype header
|
||||
Header ("Content-type: text/txt");
|
||||
header ('Content-Disposition: attachment; filename="pandora_export_event'.$now.'.txt"');
|
||||
header ('Content-Disposition: attachment; filename="pandora_export_event'.$now.'.csv"');
|
||||
|
||||
echo "timestamp, agent, group, event, status, user, event_type, severity";
|
||||
echo "timestamp, agent, group, event, status, user, event_type, severity, id";
|
||||
echo chr (13);
|
||||
|
||||
$new = true;
|
||||
|
@ -126,6 +128,8 @@ while ($event = db_get_all_row_by_steps_sql($new, $result, $sql)) {
|
|||
echo io_safe_output($event["event_type"]);
|
||||
echo ",";
|
||||
echo $event["criticity"];
|
||||
echo ",";
|
||||
echo $event["id_evento"];
|
||||
echo chr (13);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -96,6 +96,10 @@ if ($confMap !== false) {
|
|||
$baselayers[$num_baselayer]['image_width'] = $decodeJSON['image_width'];
|
||||
$baselayers[$num_baselayer]['image_height'] = $decodeJSON['image_height'];
|
||||
break;
|
||||
case 'WMS':
|
||||
$baselayers[$num_baselayer]['url'] = $decodeJSON['url'];
|
||||
$baselayers[$num_baselayer]['layers'] = $decodeJSON['layers'];
|
||||
break;
|
||||
}
|
||||
$num_baselayer++;
|
||||
if ($mapC['default_map_connection'] == 1) {
|
||||
|
@ -203,11 +207,7 @@ if ($layers != false) {
|
|||
// Resize GIS map on fullscreen
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$().ready(function() {
|
||||
|
||||
var new_height = $(document).height();
|
||||
$("#map").css("height", new_height - 60);
|
||||
$("svg[id*=OpenLayers]").css("height", new_height - 60);
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#map").css("height", $(document).height() - 100);
|
||||
});
|
||||
</script>
|
|
@ -77,6 +77,10 @@ if ($confMap !== false) {
|
|||
$baselayers[$num_baselayer]['image_width'] = $decodeJSON['image_width'];
|
||||
$baselayers[$num_baselayer]['image_height'] = $decodeJSON['image_height'];
|
||||
break;
|
||||
case 'WMS':
|
||||
$baselayers[$num_baselayer]['url'] = $decodeJSON['url'];
|
||||
$baselayers[$num_baselayer]['layers'] = $decodeJSON['layers'];
|
||||
break;
|
||||
}
|
||||
$num_baselayer++;
|
||||
if ($mapC['default_map_connection'] == 1) {
|
||||
|
@ -157,12 +161,12 @@ $buttons[]['text'] = ' ' . __('Show agents by state: ') .
|
|||
ui_print_page_header(__('Map') . " » " . __('Map') . " " . $map['map_name'],
|
||||
"images/op_gis.png", false, "", false, $buttons);
|
||||
|
||||
if ($config["pure"] == 0) {
|
||||
echo "<div id='map' style='width: 100%; height: 500px; border: 1px solid black;' ></div>";
|
||||
}
|
||||
else {
|
||||
echo "<div id='map' style='position:absolute; top:40px; z-index:100; width: 100%; height: 500px; min-height:500px; border: 1px solid black;' ></div>";
|
||||
}
|
||||
$map_inline_style = "width: 100%; min-height:500px; height: calc(100vh - 80px);";
|
||||
$map_inline_style .= $config["pure"]
|
||||
? "position:absolute; top: 80px; left: 0px;"
|
||||
: "border: 1px solid black;";
|
||||
|
||||
echo '<div id="map" style="' . $map_inline_style . '" />';
|
||||
|
||||
gis_print_map('map', $map['zoom_level'], $map['initial_latitude'],
|
||||
$map['initial_longitude'], $baselayers, $controls);
|
||||
|
@ -234,18 +238,11 @@ if ($layers != false) {
|
|||
gis_activate_ajax_refresh($layers, $timestampLastOperation);
|
||||
}
|
||||
|
||||
// Resize GIS map on fullscreen
|
||||
if ($config["pure"] != 0) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$().ready(function() {
|
||||
|
||||
var new_height = $(document).height();
|
||||
$("#map").css("height", new_height - 60);
|
||||
$("svg[id*=OpenLayers]").css("height", new_height - 60);
|
||||
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var $map = $("#map");
|
||||
$map.css("height", "calc(100vh - " + $map.offset().top + "px - 20px)");
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.722
|
||||
%define release 180423
|
||||
%define release 180510
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.722
|
||||
%define release 180423
|
||||
%define release 180510
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -3048,9 +3048,7 @@ create table IF NOT EXISTS `tcluster`(
|
|||
`description` text not null default '',
|
||||
`group` int(10) unsigned NOT NULL default '0',
|
||||
`id_agent` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_agent`) REFERENCES tagente(`id_agente`)
|
||||
ON UPDATE CASCADE
|
||||
PRIMARY KEY (`id`)
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
|
@ -3078,8 +3076,6 @@ create table IF NOT EXISTS `tcluster_agent`(
|
|||
`id_cluster` int unsigned not null,
|
||||
`id_agent` int(10) unsigned not null,
|
||||
PRIMARY KEY (`id_cluster`,`id_agent`),
|
||||
FOREIGN KEY (`id_agent`) REFERENCES tagente(`id_agente`)
|
||||
ON UPDATE CASCADE,
|
||||
FOREIGN KEY (`id_cluster`) REFERENCES tcluster(`id`)
|
||||
ON UPDATE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.722-180423
|
||||
Version: 7.0NG.722-180510
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.722-180423"
|
||||
pandora_version="7.0NG.722-180510"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -69,6 +69,7 @@ then
|
|||
mkdir -p temp_package/etc/init.d/
|
||||
mkdir -p temp_package/lib/systemd/system/
|
||||
mkdir -p temp_package/etc/pandora/
|
||||
mkdir -p temp_package/etc/tentacle/
|
||||
mkdir -p temp_package/var/spool/pandora/data_in
|
||||
chmod 770 temp_package/var/spool/pandora/data_in
|
||||
mkdir -p temp_package/var/spool/pandora/data_in/conf
|
||||
|
@ -82,6 +83,7 @@ then
|
|||
chmod 770 temp_package/var/spool/pandora/data_in/trans
|
||||
mkdir -p temp_package/var/log/pandora/
|
||||
mkdir -p temp_package/usr/share/pandora_server/conf/
|
||||
mkdir -p temp_package/usr/share/tentacle_server/conf/
|
||||
mkdir -p temp_package/usr/lib/perl5/
|
||||
mkdir -p temp_package/usr/share/man/man1/
|
||||
mkdir -p temp_package/etc/logrotate.d/
|
||||
|
@ -90,7 +92,8 @@ then
|
|||
cp -aRf bin/pandora_exec temp_package/usr/bin/pandora_exec.server
|
||||
cp -aRf bin/tentacle_server temp_package/usr/bin/
|
||||
|
||||
cp -aRf conf/* temp_package/usr/share/pandora_server/conf/
|
||||
cp -aRf conf/pandora_* temp_package/usr/share/pandora_server/conf/
|
||||
cp -aRf conf/tentacle_* temp_package/usr/share/tentacle_server/conf/
|
||||
cp -aRf util temp_package/usr/share/pandora_server/
|
||||
cp -aRf lib/* temp_package/usr/lib/perl5/
|
||||
cp -aRf AUTHORS COPYING README temp_package/usr/share/pandora_server/
|
||||
|
|
|
@ -71,7 +71,7 @@ chown -R pandora:www-data /var/spool/pandora/
|
|||
echo "Creating setup directory in /etc/pandora"
|
||||
mkdir /etc/pandora 2> /dev/null
|
||||
|
||||
#Check if exist old conf file
|
||||
#Check if exist old conf files
|
||||
if [ ! -e /etc/pandora/pandora_server.conf ]
|
||||
then
|
||||
cp /usr/share/pandora_server/conf/pandora_server.conf.new /etc/pandora/pandora_server.conf
|
||||
|
@ -80,6 +80,14 @@ else
|
|||
cp /usr/share/pandora_server/conf/pandora_server.conf.new /etc/pandora/pandora_server.conf.new
|
||||
echo "Skipping creation of pandora_server.conf: there is already one."
|
||||
fi
|
||||
if [ ! -e /etc/tentacle/tentacle_server.conf ]
|
||||
then
|
||||
cp /usr/share/tentacle_server/conf/tentacle_server.conf.new /etc/tentacle/tentacle_server.conf
|
||||
chmod 664 /etc/tentacle/tentacle_server.conf
|
||||
else
|
||||
cp /usr/share/tentacle_server/conf/tentacle_server.conf.new /etc/tentacle/tentacle_server.conf.new
|
||||
echo "Skipping creation of tentacle_server.conf: there is already one."
|
||||
fi
|
||||
|
||||
echo "Enabling start-up pandora & tentacle server daemons";
|
||||
if [ -x `command -v systemctl` ]; then
|
||||
|
|
|
@ -102,7 +102,7 @@ my $SERVICE_NAME="Tentacle Server";
|
|||
my $SERVICE_PARAMS=join(' ', @ARGV);
|
||||
|
||||
# Program version
|
||||
our $VERSION = '0.6.1';
|
||||
our $VERSION = '0.6.2';
|
||||
|
||||
# IPv4 address to listen on
|
||||
my @t_addresses = ('0', '0.0.0.0');
|
||||
|
@ -217,6 +217,7 @@ sub print_help {
|
|||
print ("\t-d\t\tRun as daemon.\n");
|
||||
print ("\t-e cert\t\tOpenSSL certificate file. Enables SSL.\n");
|
||||
print ("\t-f ca_cert\tVerify that the peer certificate is signed by a ca.\n");
|
||||
print ("\t-F config_file\tConfiguration file full path.\n");
|
||||
print ("\t-h\t\tShow help.\n");
|
||||
print ("\t-I\t\tEnable insecure operations (file listing and moving).\n");
|
||||
print ("\t-i\t\tFilters.\n");
|
||||
|
@ -278,11 +279,13 @@ sub daemonize {
|
|||
################################################################################
|
||||
sub parse_options {
|
||||
my %opts;
|
||||
my $CONF = {};
|
||||
my $token_value;
|
||||
my $tmp;
|
||||
my @t_addresses_tmp;
|
||||
|
||||
# Get options
|
||||
if (getopts ('a:b:c:de:f:g:hIi:k:l:m:op:qr:s:S:t:TvVwx:', \%opts) == 0 || defined ($opts{'h'})) {
|
||||
if (getopts ('a:b:c:de:f:F:g:hIi:k:l:m:op:qr:s:S:t:TvVwx:', \%opts) == 0 || defined ($opts{'h'})) {
|
||||
print_help ();
|
||||
exit 1;
|
||||
}
|
||||
|
@ -304,10 +307,16 @@ sub parse_options {
|
|||
}
|
||||
}
|
||||
|
||||
# Configuration file
|
||||
if (defined($opts{'F'})) {
|
||||
parse_config_file($opts{'F'}, $CONF);
|
||||
}
|
||||
|
||||
# Address
|
||||
if (defined ($opts{'a'})) {
|
||||
$token_value = get_config_value($opts{'a'}, $CONF->{'addresses'});
|
||||
if (defined ($token_value)) {
|
||||
@t_addresses = ();
|
||||
@t_addresses_tmp = split(/,/, $opts{'a'});
|
||||
@t_addresses_tmp = split(/,/, $token_value);
|
||||
|
||||
foreach my $t_address (@t_addresses_tmp) {
|
||||
$t_address =~ s/^ *(.*?) *$/$1/;
|
||||
|
@ -323,15 +332,17 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Maximum simultaneous connections
|
||||
if (defined ($opts{'c'})) {
|
||||
$t_max_conn = $opts{'c'};
|
||||
$token_value = get_config_value($opts{'c'}, $CONF->{'max_connections'});
|
||||
if (defined ($token_value)) {
|
||||
$t_max_conn = $token_value;
|
||||
if ($t_max_conn !~ /^\d+$/ || $t_max_conn < 1) {
|
||||
error ("Invalid number of maximum simultaneous connections.");
|
||||
}
|
||||
}
|
||||
|
||||
# Run as daemon
|
||||
if (defined ($opts{'d'})) {
|
||||
$token_value = get_config_value($opts{'d'}, $CONF->{'daemon'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
if ($^ eq 'MSWin32') {
|
||||
error ("-d flag not available for this OS.");
|
||||
}
|
||||
|
@ -340,11 +351,12 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Enable SSL
|
||||
if (defined ($opts{'e'})) {
|
||||
$token_value = get_config_value($opts{'e'}, $CONF->{'ssl_cert'});
|
||||
if (defined ($token_value)) {
|
||||
|
||||
require IO::Socket::SSL;
|
||||
|
||||
$t_ssl_cert = $opts{'e'};
|
||||
$t_ssl_cert = $token_value;
|
||||
if (! -f $t_ssl_cert) {
|
||||
error ("File $t_ssl_cert does not exist.");
|
||||
}
|
||||
|
@ -353,21 +365,24 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Verify peer certificate
|
||||
if (defined ($opts{'f'})) {
|
||||
$t_ssl_ca = $opts{'f'};
|
||||
$token_value = get_config_value($opts{'f'}, $CONF->{'ssl_ca'});
|
||||
if (defined ($token_value)) {
|
||||
$t_ssl_ca = $token_value;
|
||||
if (! -f $t_ssl_ca) {
|
||||
error ("File $t_ssl_ca does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
# Insecure mode
|
||||
if (defined ($opts{'I'})) {
|
||||
$token_value = get_config_value($opts{'I'}, $CONF->{'insecure'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
$t_insecure = 1;
|
||||
}
|
||||
|
||||
# Filters (regexp:dir;regexp:dir...)
|
||||
if (defined ($opts{'i'})) {
|
||||
my @filters = split (';', $opts{'i'});
|
||||
$token_value = get_config_value($opts{'i'}, $CONF->{'filters'});
|
||||
if (defined ($token_value)) {
|
||||
my @filters = split (';', $token_value);
|
||||
foreach my $filter (@filters) {
|
||||
my ($regexp, $dir) = split (':', $filter);
|
||||
next unless defined ($regexp) && defined ($dir);
|
||||
|
@ -381,51 +396,58 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# SSL private key file
|
||||
if (defined ($opts{'k'})) {
|
||||
$t_ssl_key = $opts{'k'};
|
||||
$token_value = get_config_value($opts{'k'}, $CONF->{'ssl_key'});
|
||||
if (defined ($token_value)) {
|
||||
$t_ssl_key = $token_value;
|
||||
if (! -f $t_ssl_key) {
|
||||
error ("File $t_ssl_key does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
# Maximum file size
|
||||
if (defined ($opts{'m'})) {
|
||||
$t_max_size = $opts{'m'};
|
||||
$token_value = get_config_value($opts{'m'}, $CONF->{'max_size'});
|
||||
if (defined ($token_value)) {
|
||||
$t_max_size = $token_value;
|
||||
if ($t_max_size !~ /^\d+$/ || $t_max_size < 1) {
|
||||
error ("Invalid maximum file size.");
|
||||
}
|
||||
}
|
||||
|
||||
# File overwrite
|
||||
if (defined ($opts{'o'})) {
|
||||
$token_value = get_config_value($opts{'o'}, $CONF->{'overwrite'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
$t_overwrite = 1;
|
||||
}
|
||||
|
||||
# Port
|
||||
if (defined ($opts{'p'})) {
|
||||
$t_port = $opts{'p'};
|
||||
$token_value = get_config_value($opts{'p'}, $CONF->{'port'});
|
||||
if (defined ($token_value)) {
|
||||
$t_port = $token_value;
|
||||
if ($t_port !~ /^\d+$/ || $t_port < 1 || $t_port > 65535) {
|
||||
error ("Port $t_port is not valid.");
|
||||
}
|
||||
}
|
||||
|
||||
# Quiet mode
|
||||
if (defined ($opts{'q'})) {
|
||||
$token_value = get_config_value($opts{'q'}, $CONF->{'quiet'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
$t_quiet = 1;
|
||||
}
|
||||
|
||||
# Retries
|
||||
if (defined ($opts{'r'})) {
|
||||
$t_retries = $opts{'r'};
|
||||
$token_value = get_config_value($opts{'r'}, $CONF->{'retries'});
|
||||
if (defined ($token_value)) {
|
||||
$t_retries = $token_value;
|
||||
if ($t_retries !~ /^\d+$/ || $t_retries < 1) {
|
||||
error ("Invalid number of retries for network operations.");
|
||||
}
|
||||
}
|
||||
|
||||
# Storage directory
|
||||
if (defined ($opts{'s'})) {
|
||||
$token_value = get_config_value($opts{'s'}, $CONF->{'directory'});
|
||||
if (defined ($token_value)) {
|
||||
|
||||
$t_directory = $opts{'s'};
|
||||
$t_directory = $token_value;
|
||||
|
||||
# Check that directory exists
|
||||
if (! -d $t_directory) {
|
||||
|
@ -444,25 +466,36 @@ sub parse_options {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (! defined($opts{'b'})) {
|
||||
$token_value = get_config_value($opts{'b'}, $CONF->{'proxy_ip'});
|
||||
if (! defined($token_value)) {
|
||||
print_help ();
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
# Timeout
|
||||
if (defined ($opts{'t'})) {
|
||||
$t_timeout = $opts{'t'};
|
||||
$token_value = get_config_value($opts{'t'}, $CONF->{'timeout'});
|
||||
if (defined ($token_value)) {
|
||||
$t_timeout = $token_value;
|
||||
if ($t_timeout !~ /^\d+$/ || $t_timeout < 1) {
|
||||
error ("Invalid timeout for network operations.");
|
||||
}
|
||||
}
|
||||
|
||||
# Read verbose from config file
|
||||
if (defined($CONF->{'verbose'})) {
|
||||
if ($CONF->{'verbose'} eq "1") {
|
||||
$t_log = 1;
|
||||
} elsif ($CONF->{'verbose'} eq "2") {
|
||||
$t_log = 1;
|
||||
$t_log_hard = 1;
|
||||
}
|
||||
}
|
||||
# Be verbose
|
||||
if (defined ($opts{'v'})) {
|
||||
$t_log = 1;
|
||||
$t_log_hard = 0;
|
||||
}
|
||||
|
||||
# Be verbose hard
|
||||
if (defined ($opts{'V'})) {
|
||||
$t_log = 1;
|
||||
|
@ -470,18 +503,21 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# SSL private key password
|
||||
if (defined ($opts{'w'})) {
|
||||
$token_value = get_config_value($opts{'w'}, $CONF->{'ssl_password'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
$t_ssl_pwd = ask_passwd ("Enter private key file password: ", "Enter private key file password again for confirmation: ");
|
||||
}
|
||||
|
||||
# Server password
|
||||
if (defined ($opts{'x'})) {
|
||||
$t_pwd = $opts{'x'};
|
||||
$token_value = get_config_value($opts{'x'}, $CONF->{'password'});
|
||||
if (defined ($token_value)) {
|
||||
$t_pwd = $token_value;
|
||||
}
|
||||
|
||||
#Proxy IP address
|
||||
if (defined ($opts{'b'})) {
|
||||
$t_proxy_ip = $opts{'b'};
|
||||
$token_value = get_config_value($opts{'b'}, $CONF->{'proxy_ip'});
|
||||
if (defined ($token_value)) {
|
||||
$t_proxy_ip = $token_value;
|
||||
if ($t_proxy_ip !~ /^[a-zA-Z\.]+$/ && ($t_proxy_ip !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/
|
||||
|| $1 < 0 || $1 > 255 || $2 < 0 || $2 > 255
|
||||
|| $3 < 0 || $3 > 255 || $4 < 0 || $4 > 255) &&
|
||||
|
@ -491,15 +527,17 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Proxy Port
|
||||
if (defined ($opts{'g'})) {
|
||||
$t_proxy_port = $opts{'g'};
|
||||
$token_value = get_config_value($opts{'g'}, $CONF->{'proxy_port'});
|
||||
if (defined ($token_value)) {
|
||||
$t_proxy_port = $token_value;
|
||||
if ($t_proxy_port !~ /^\d+$/ || $t_proxy_port < 1 || $t_proxy_port > 65535) {
|
||||
error ("Proxy port $t_port is not valid.");
|
||||
}
|
||||
}
|
||||
|
||||
# TCP wrappers support
|
||||
if (defined ($opts{'T'})) {
|
||||
$token_value = get_config_value($opts{'T'}, $CONF->{'use_libwrap'}, 1);
|
||||
if (defined ($token_value)) {
|
||||
if ($t_libwrap_installed) {
|
||||
$t_use_libwrap = 1;
|
||||
} else {
|
||||
|
@ -531,9 +569,76 @@ sub parse_options {
|
|||
}
|
||||
|
||||
# Get the config file
|
||||
if (defined ($opts{'l'})) {
|
||||
$log_file = $opts{'l'};
|
||||
$token_value = get_config_value($opts{'l'}, $CONF->{'log_file'});
|
||||
if (defined ($token_value)) {
|
||||
$log_file = $token_value;
|
||||
}
|
||||
|
||||
# No command lines config values
|
||||
|
||||
# Get the block size
|
||||
if (defined ($CONF->{'block_size'})) {
|
||||
if ($t_port !~ /^\d+$/ || $t_port < 1) {
|
||||
error ("Invalid block size: " . $CONF->{'block_size'} . ".");
|
||||
}
|
||||
$t_block_size = $CONF->{'block_size'};
|
||||
}
|
||||
|
||||
# Configuration file invalid chars
|
||||
if (defined ($CONF->{'invalid_chars'})) {
|
||||
$t_invalid_chars = $CONF->{'invalid_chars'};
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB parse_config_file
|
||||
## Get all options from a config file.
|
||||
################################################################################
|
||||
sub parse_config_file {
|
||||
my ($config_file, $CONF) = @_;
|
||||
|
||||
# File should be writable
|
||||
if (! -r $config_file) {
|
||||
print "Configuration file $config_file is not readable.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
# Open the file
|
||||
my $FH;
|
||||
if (! open ($FH, "< $config_file")) {
|
||||
print "Cannot open configuration file $config_file.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
# Read the file and only get the well formed lines
|
||||
while (<$FH>) {
|
||||
my $buffer_line = $_;
|
||||
if ($buffer_line =~ /^[a-zA-Z]/){ # begins with letters
|
||||
if ($buffer_line =~ m/([\w\-\_\.]+)\s+(.*)/){
|
||||
$CONF->{$1} = $2 unless $2 eq "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close ($FH);
|
||||
return;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB parse_config_file
|
||||
## Search in command line options and config hash from configuration file
|
||||
## to get a value (command line is a priority)
|
||||
################################################################################
|
||||
sub get_config_value {
|
||||
my ($cmd_value, $conf_value, $bool) = @_;
|
||||
$bool = 0 unless defined($bool);
|
||||
|
||||
return $cmd_value if defined($cmd_value);
|
||||
# The boolean type value is 1 or undef (0 should be translated like undefP)
|
||||
if ($bool && defined($conf_value)) {
|
||||
return undef if ($conf_value ne "1");
|
||||
}
|
||||
return $conf_value;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
@ -929,14 +1034,14 @@ sub recv_file {
|
|||
# Check file name
|
||||
if ($base_name =~ /[$t_invalid_chars]/) {
|
||||
print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " has an invalid file name");
|
||||
send_data ("SEND ERR\n");
|
||||
send_data ("SEND ERR (invalid file name)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
# Check file size, empty files are not allowed
|
||||
if ($size < 1 || $size > $t_max_size) {
|
||||
print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " is too big");
|
||||
send_data ("SEND ERR\n");
|
||||
send_data ("SEND ERR (file is too big)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -946,7 +1051,7 @@ sub recv_file {
|
|||
# Check if file exists
|
||||
if (-f $file && $t_overwrite == 0) {
|
||||
print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " already exists");
|
||||
send_data ("SEND ERR\n");
|
||||
send_data ("SEND ERR (file already exists)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -979,7 +1084,7 @@ sub send_file {
|
|||
# Check file name
|
||||
if ($base_name =~ /[$t_invalid_chars]/) {
|
||||
print_log ("Requested file '$base_name' from " . $t_client_socket->sockhost () . " has an invalid file name");
|
||||
send_data ("RECV ERR\n");
|
||||
send_data ("RECV ERR (file has an invalid file name)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -989,7 +1094,7 @@ sub send_file {
|
|||
# Check if file exists
|
||||
if (! -f $file) {
|
||||
print_log ("Requested file '$file' from " . $t_client_socket->sockhost () . " does not exist");
|
||||
send_data ("RECV ERR\n");
|
||||
send_data ("RECV ERR (file does not exist)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,75 @@
|
|||
##########################################################################
|
||||
# Tentacle Server Parameters
|
||||
# See https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Tentacle
|
||||
# for protocol description.
|
||||
# Tentacle have IANA assigned port tpc/41121 as official port.
|
||||
##########################################################################
|
||||
|
||||
# [-a] IPv4 address to listen on. Several IPs cam be selected separating if by comma.
|
||||
addresses 0.0.0.0
|
||||
|
||||
# [-p] Port to listen on
|
||||
port 41121
|
||||
|
||||
# [-c] Maximum number of simultaneous connections
|
||||
# max_connections 10
|
||||
|
||||
# [-d] Run as daemon. 1 true, 0 false
|
||||
daemon 1
|
||||
|
||||
# [-i] Enable insecure mode
|
||||
# insecure 0
|
||||
|
||||
# Filters (regexp:dir;regexp:dir...)
|
||||
filters .*\.conf:conf;.*\.md5:md5;.*\.zip:collections;.*\.lock:trans
|
||||
|
||||
# [-m] Maximum file size allowed by the server in bytes
|
||||
#max_size 2000000
|
||||
|
||||
# [-o] Accept files with a repeated name
|
||||
# overwrite 0
|
||||
|
||||
# [-q] Do not output error messages.
|
||||
# quiet 0
|
||||
|
||||
# [-r] Number of retries for socket read/write operations
|
||||
# retries 3
|
||||
|
||||
# [-s] Storage directory
|
||||
directory /var/spool/pandora/data_in
|
||||
|
||||
# [-b] Address to proxy client requests to
|
||||
# proxy_ip 127.0.0.1
|
||||
|
||||
# [-g] Port to proxy client requests to
|
||||
# proxy_port 41121
|
||||
|
||||
# [-t] Timeout for socket read/write operations in seconds
|
||||
# timeout 1
|
||||
|
||||
# [-v and -V] Verbose level
|
||||
# 0: Do not display any informative messages
|
||||
# 1: Display only important messages [-v]
|
||||
# 2: Display all messages [-V]
|
||||
# verbose 0
|
||||
|
||||
# [-l] Log file
|
||||
log_file /dev/null
|
||||
|
||||
# [-x] Server password
|
||||
# password PASSWORD
|
||||
|
||||
# [-e] SSL certificate file full path
|
||||
# ssl_cert /path/to/ssl/cert
|
||||
|
||||
# [-f] SSL CA file full path
|
||||
# ssl_ca /path/to/ssl/ca
|
||||
|
||||
# [-k] SSL private key file
|
||||
# ssl_key /path/to/private/key/file
|
||||
|
||||
# [-w] SSL password. Set to 1 to ask for password by command line
|
||||
# ssl_password 0
|
||||
|
||||
# [-T] Use libwrap library (Authen::Libwrap perl module)
|
||||
# use_libwrap 0
|
|
@ -43,7 +43,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.722";
|
||||
my $pandora_build = "180423";
|
||||
my $pandora_build = "180510";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -31,7 +31,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.722";
|
||||
my $pandora_build = "180423";
|
||||
my $pandora_build = "180510";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.722
|
||||
%define release 180423
|
||||
%define release 180510
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -48,6 +48,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||
mkdir -p $RPM_BUILD_ROOT%{_bindir}/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/pandora/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/tentacle/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/conf
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/md5
|
||||
|
@ -81,6 +82,7 @@ rm -f $RPM_BUILD_ROOT%{prefix}/pandora_server/util/recon_scripts/PandoraFMS
|
|||
|
||||
install -m 0644 util/pandora_server_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_server
|
||||
install -m 0640 conf/pandora_server.conf.new $RPM_BUILD_ROOT%{_sysconfdir}/pandora/pandora_server.conf.new
|
||||
install -m 0640 conf/tentacle_server.conf.new $RPM_BUILD_ROOT%{_sysconfdir}/tentacle/tentacle_server.conf.new
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d
|
||||
chmod 0750 $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d
|
||||
|
@ -119,8 +121,8 @@ if [ "$1" = 1 ]; then
|
|||
echo " "
|
||||
fi
|
||||
|
||||
# This will avoid pandora_server.conf overwritting on UPGRADES.
|
||||
|
||||
# This will avoid confi files overwritting on UPGRADES.
|
||||
# Main configuration file
|
||||
if [ ! -e "/etc/pandora/pandora_server.conf" ]
|
||||
then
|
||||
echo "Creating a new version of Pandora FMS Server config file at /etc/pandora/pandora_server.conf"
|
||||
|
@ -130,6 +132,12 @@ else
|
|||
echo "An existing version of pandora_server.conf is found."
|
||||
cat /etc/pandora/pandora_server.conf > /etc/pandora/pandora_server.conf.old
|
||||
fi
|
||||
# Tentacle server
|
||||
if [ ! -e "/etc/tentacle/tentacle_server.conf" ]
|
||||
then
|
||||
echo "Creating a new version of Tentacle Server config file at /etc/tentacle/tentacle_server.conf"
|
||||
cat /etc/tentacle/tentacle_server.conf.new > /etc/tentacle/tentacle_server.conf
|
||||
fi
|
||||
|
||||
echo "Don't forget to start Tentacle Server daemon if you want to receive"
|
||||
echo "data using tentacle"
|
||||
|
@ -175,6 +183,9 @@ exit 0
|
|||
%defattr(600,root,root)
|
||||
/etc/pandora/pandora_server.conf.new
|
||||
|
||||
%defattr(664,root,root)
|
||||
/etc/tentacle/tentacle_server.conf.new
|
||||
|
||||
%defattr(-,pandora,apache,2770)
|
||||
%{_localstatedir}/spool/pandora
|
||||
%{_localstatedir}/spool/pandora/data_in
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.722
|
||||
%define release 180423
|
||||
%define release 180510
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -54,6 +54,7 @@ mkdir -p $RPM_BUILD_ROOT/usr/bin/
|
|||
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/init.d/
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/tentacle/
|
||||
mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in
|
||||
mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/conf
|
||||
mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/md5
|
||||
|
@ -62,6 +63,7 @@ mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/netflow
|
|||
mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/trans
|
||||
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
|
||||
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/
|
||||
mkdir -p $RPM_BUILD_ROOT%{prefix}/tentacle/conf/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/lib/perl5/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
|
||||
|
||||
|
@ -70,8 +72,10 @@ cp -aRf bin/pandora_server $RPM_BUILD_ROOT/usr/bin/
|
|||
cp -aRf bin/pandora_exec $RPM_BUILD_ROOT/usr/bin/
|
||||
cp -aRf bin/tentacle_server $RPM_BUILD_ROOT/usr/bin/
|
||||
|
||||
cp -aRf conf/* $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/
|
||||
cp -aRf conf/pandora_* $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/
|
||||
cp -aRf conf/pandora_server.conf.new $RPM_BUILD_ROOT/etc/pandora/
|
||||
cp -aRf conf/tentacle_* $RPM_BUILD_ROOT%{prefix}/tentacle/conf/
|
||||
cp -aRf conf/tentacle_server.conf.new $RPM_BUILD_ROOT/etc/tentacle/
|
||||
cp -aRf util $RPM_BUILD_ROOT%{prefix}/pandora_server/
|
||||
cp -aRf lib/* $RPM_BUILD_ROOT/usr/lib/perl5/
|
||||
cp -aRf AUTHORS COPYING README $RPM_BUILD_ROOT%{prefix}/pandora_server/
|
||||
|
@ -112,6 +116,8 @@ if [ ! -d /etc/pandora ] ; then
|
|||
mkdir -p /etc/pandora
|
||||
fi
|
||||
|
||||
# Avoid to overwrite config files on upgrades
|
||||
# Main configuration files
|
||||
if [ ! -e "/etc/pandora/pandora_server.conf" ]
|
||||
then
|
||||
echo "Creating a new version of Pandora FMS Server config file at /etc/pandora/pandora_server.conf"
|
||||
|
@ -121,6 +127,12 @@ else
|
|||
echo "An existing version of pandora_server.conf is found."
|
||||
cat /etc/pandora/pandora_server.conf > /etc/pandora/pandora_server.conf.old
|
||||
fi
|
||||
# Tentacle config files
|
||||
if [ ! -e "/etc/tentacle/tentacle_server.conf" ]
|
||||
then
|
||||
echo "Creating a new version of Tentacle Server config file at /etc/tentacle/tentacle_server.conf"
|
||||
cat /etc/tentacle/tentacle_server.conf.new > /etc/tentacle/tentacle_server.conf
|
||||
fi
|
||||
|
||||
echo "Don't forget to start Tentacle Server daemon if you want to receive"
|
||||
echo "data using tentacle"
|
||||
|
@ -152,6 +164,7 @@ rm -Rf %{prefix}pandora_server
|
|||
rm -Rf /var/log/pandora
|
||||
rm -Rf /usr/lib/perl5/PandoraFMS/
|
||||
rm -Rf /etc/pandora/pandora_server.conf*
|
||||
rm -Rf /etc/tentacle/tentacle_server.conf*
|
||||
rm -Rf /var/spool/pandora
|
||||
rm -Rf /etc/init.d/pandora_server /etc/init.d/tentacle_serverd
|
||||
rm -Rf /usr/bin/pandora_exec /usr/bin/pandora_server /usr/bin/tentacle_server
|
||||
|
@ -174,6 +187,7 @@ rm -Rf /usr/share/man/man1/tentacle_server.1.gz
|
|||
%defattr(755,pandora,root,755)
|
||||
/usr/lib/perl5/PandoraFMS/
|
||||
%{prefix}/pandora_server
|
||||
%{prefix}/tentacle
|
||||
/var/log/pandora
|
||||
|
||||
%defattr(-,pandora,www,2770)
|
||||
|
@ -188,6 +202,9 @@ rm -Rf /usr/share/man/man1/tentacle_server.1.gz
|
|||
%defattr(-,pandora,root,750)
|
||||
/etc/pandora
|
||||
|
||||
%defattr(-,pandora,root,754)
|
||||
/etc/tentacle
|
||||
|
||||
%defattr(644,pandora,root)
|
||||
/usr/share/man/man1/pandora_server.1.gz
|
||||
/usr/share/man/man1/tentacle_server.1.gz
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.722"
|
||||
PI_BUILD="180423"
|
||||
PI_BUILD="180510"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
@ -27,6 +27,9 @@ TENTACLE_SERVER=/etc/init.d/tentacle_serverd
|
|||
PANDORA_CFG_FILE=$PANDORA_CFG_DIR/pandora_server.conf
|
||||
PANDORA_CFG_FILE_DIST=conf/pandora_server.conf.new
|
||||
PANDORA_INIT_SCRIPT=util/pandora_server
|
||||
TENTACLE_CFG_DIR=/etc/tentacle
|
||||
TENTACLE_CFG_FILE=$TENTACLE_CFG_DIR/tentacle_server.conf
|
||||
TENTACLE_CFG_FILE_DIST=conf/tentacle_server.conf.new
|
||||
TENTACLE_INIT_SCRIPT=util/tentacle_serverd
|
||||
PERL=perl
|
||||
MANDIR=$PREFIX/share/man/man1
|
||||
|
@ -91,6 +94,8 @@ set_global_vars () {
|
|||
PANDORA_CFG_FILE=$PANDORA_CFG_DIR/pandora_server.conf
|
||||
PANDORA_CFG_FILE_DIST=$DISTRO/pandora_server.conf.new
|
||||
PANDORA_INIT_SCRIPT=$DISTRO/pandora_server
|
||||
TENTACLE_CFG_DIR=$PREFIX/etc/tentacle
|
||||
TENTACLE_CFG_FILE=$TENTACLE_CFG_DIR/tentacle_server.conf
|
||||
TENTACLE_INIT_SCRIPT=$DISTRO/tentacle_server
|
||||
MANDIR=$PREFIX/man/man1
|
||||
INITDIR=$PREFIX/etc/rc.d
|
||||
|
@ -103,6 +108,8 @@ set_global_vars () {
|
|||
PANDORA_HOME=$PREFIX/share/pandora_server
|
||||
PANDORA_CFG_DIR=$PREFIX/etc/pandora
|
||||
PANDORA_SERVER=/etc/rc.d/pandora_server
|
||||
TENTACLE_CFG_DIR=$PREFIX/etc/tentacle
|
||||
TENTACLE_CFG_FILE=$TENTACLE_CFG_DIR/tentacle_server.conf
|
||||
TENTACLE_SERVER=/etc/rc.d/tentacle_server
|
||||
PANDORA_CFG_FILE=$PANDORA_CFG_DIR/pandora_server.conf
|
||||
PANDORA_CFG_FILE_DIST=$DISTRO/pandora_server.conf.new
|
||||
|
@ -361,6 +368,19 @@ install () {
|
|||
then
|
||||
# tentacle_server is already installed by "make install"
|
||||
install_startup_script -s 80 $TENTACLE_INIT_SCRIPT
|
||||
|
||||
# Create the directory to locate the Tentacle configuration file
|
||||
echo "Creating setup Tentacle directory in $TENTACLE_CFG_DIR"
|
||||
mkdir -p $DESTDIR$TENTACLE_CFG_DIR 2> /dev/null
|
||||
if [ -f "$DESTDIR$TENTACLE_CFG_FILE" ]
|
||||
then
|
||||
echo cp $TENTACLE_CFG_FILE_DIST $DESTDIR$TENTACLE_CFG_DIR
|
||||
cp $TENTACLE_CFG_FILE_DIST $DESTDIR$TENTACLE_CFG_DIR
|
||||
else
|
||||
echo cp $TENTACLE_CFG_FILE_DIST $DESTDIR$TENTACLE_CFG_FILE
|
||||
cp $TENTACLE_CFG_FILE_DIST $DESTDIR$TENTACLE_CFG_FILE
|
||||
chmod 774 $DESTDIR$TENTACLE_CFG_FILE
|
||||
fi
|
||||
|
||||
echo "Installing Tentacle Server manual"
|
||||
cp man/man1/tentacle_server.1.gz $DESTDIR$MANDIR
|
||||
|
@ -457,6 +477,8 @@ uninstall () {
|
|||
rm -Rf $DESTDIR$PANDORA_LOG 2> /dev/null
|
||||
rm -f $DESTDIR$PANDORA_CFG_FILE 2> /dev/null
|
||||
rm -f "$DESTDIR$PANDORA_CFG_FILE.new" 2> /dev/null
|
||||
rm -f $DESTDIR$TENTACLE_CFG_FILE 2> /dev/null
|
||||
rm -f "$DESTDIR$TENTACLE_CFG_FILE.new" 2> /dev/null
|
||||
rm -f $DESTDIR$PANDORA_SERVER 2> /dev/null
|
||||
rm -f $DESTDIR$PREFIX/bin/pandora_server 2> /dev/null
|
||||
rm -f $DESTDIR$PREFIX/bin/pandora_exec 2> /dev/null
|
||||
|
|
|
@ -33,7 +33,7 @@ use PandoraFMS::Tools;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.722 PS180423";
|
||||
my $version = "7.0NG.722 PS180510";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.722 PS180423";
|
||||
my $version = "7.0NG.722 PS180510";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
@ -135,6 +135,7 @@ sub help_screen{
|
|||
help_screen_line('--delete_cluster', '<id_cluster>', 'Deleting cluster');
|
||||
help_screen_line('--delete_cluster_agent', '<id_agent> <id_cluster>', 'Deleting cluster agent');
|
||||
help_screen_line('--delete_cluster_item', '<id_item>', 'Deleting cluster item');
|
||||
help_screen_line('--get_cluster_status', '<id_cluster>', 'Getting cluster status');
|
||||
print "\nMODULES:\n\n" unless $param ne '';
|
||||
help_screen_line('--create_data_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <definition_file> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout> <warning_inverse> <critical_inverse>\n\t <critical_instructions> <warning_instructions> <unknown_instructions>]", 'Add data server module to agent');
|
||||
help_screen_line('--create_web_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <retries> <requests> <agent_browser_id> <auth_server> <auth_realm> <definition_file>\n\t <proxy_url> <proxy_auth_login> <proxy_auth_password> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout> <warning_inverse> <critical_inverse>\n\t <critical_instructions> <warning_instructions> <unknown_instructions>].\n\t The valid data types are web_data, web_proc, web_content_data or web_content_string", 'Add web server module to agent');
|
||||
|
@ -6112,7 +6113,10 @@ sub pandora_manage_main ($$$) {
|
|||
param_check($ltotal, 1, 0);
|
||||
cli_delete_cluster_item();
|
||||
}
|
||||
|
||||
elsif ($param eq '--get_cluster_status') {
|
||||
param_check($ltotal, 1, 0);
|
||||
cli_cluster_status();
|
||||
}
|
||||
elsif ($param eq '--migration_agent_queue') {
|
||||
param_check($ltotal, 4, 1);
|
||||
cli_migration_agent_queue();
|
||||
|
@ -6687,3 +6691,22 @@ sub cli_delete_cluster_item() {
|
|||
print "\n0\n";
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# get cluster status.
|
||||
# Related option: --get_cluster_status
|
||||
##############################################################################
|
||||
|
||||
sub cli_get_cluster_status() {
|
||||
my ($id) = @ARGV[2..2];
|
||||
|
||||
# Call the API.
|
||||
my $result = api_call( $conf, 'get', 'cluster_status', $id);
|
||||
|
||||
if( defined($result) && "$result" ne "" ){
|
||||
print "\n1\n";
|
||||
}
|
||||
else{
|
||||
print "\n0\n";
|
||||
}
|
||||
}
|
|
@ -57,7 +57,7 @@ function get_pid {
|
|||
# in a "strech" term, ps aux don't report more than COLUMNS
|
||||
# characters and this will not work.
|
||||
COLUMNS=300
|
||||
TENTACLE_PID=`ps -Af | grep "$TENTACLE_PATH$TENTACLE_DAEMON" | grep "$TENTACLE_PORT" | grep -v grep | tail -1 | awk '{ print $2 }'`
|
||||
TENTACLE_PID=`ps -Af | grep "$TENTACLE_PATH$TENTACLE_DAEMON" | grep "$TENTACLE_CONFIG_FILE" | grep -v grep | tail -1 | awk '{ print $2 }'`
|
||||
echo $TENTACLE_PID
|
||||
}
|
||||
|
||||
|
@ -71,18 +71,12 @@ function get_all_pid {
|
|||
echo $TENTACLE_PID
|
||||
}
|
||||
|
||||
# Pandora server settings
|
||||
PANDORA_SERVER_PATH="/var/spool/pandora/data_in"
|
||||
|
||||
# Tentacle server settings
|
||||
TENTACLE_DAEMON="tentacle_server"
|
||||
TENTACLE_PATH="/usr/bin"
|
||||
TENTACLE_USER="pandora"
|
||||
|
||||
TENTACLE_ADDR="0.0.0.0"
|
||||
TENTACLE_PORT="41121"
|
||||
TENTACLE_EXT_OPTS="-i.*\.conf:conf;.*\.md5:md5;.*\.zip:collections;.*\.lock:trans"
|
||||
TENTACLE_LOG_FILE="/dev/null"
|
||||
TENTACLE_CONFIG_FILE="/etc/tentacle/tentacle_server.conf"
|
||||
TENTACLE_EXT_OPTS=""
|
||||
|
||||
# Set umask to 0002, because group MUST have access to write files to
|
||||
# use remote file management on Pandora FMS Enterprise.
|
||||
|
@ -90,7 +84,7 @@ TENTACLE_LOG_FILE="/dev/null"
|
|||
umask 0007
|
||||
|
||||
# Main script
|
||||
TENTACLE_OPTS="-a $TENTACLE_ADDR -p $TENTACLE_PORT -s $PANDORA_SERVER_PATH $TENTACLE_EXT_OPTS -d -l $TENTACLE_LOG_FILE -v"
|
||||
TENTACLE_OPTS="-F $TENTACLE_CONFIG_FILE $TENTACLE_EXT_OPTS"
|
||||
|
||||
# Fix TENTACLE_PATH
|
||||
case "$TENTACLE_PATH" in
|
||||
|
@ -114,7 +108,8 @@ case "$1" in
|
|||
echo "Tentacle Server is already running with PID $TENTACLE_PID"
|
||||
rc_exit # running start on a service already running
|
||||
fi
|
||||
|
||||
|
||||
# Init the tentacle process
|
||||
sudo -u $TENTACLE_USER ${TENTACLE_PATH}$TENTACLE_DAEMON $TENTACLE_OPTS
|
||||
sleep 1
|
||||
|
||||
|
@ -124,7 +119,7 @@ case "$1" in
|
|||
rc_status -v
|
||||
else
|
||||
echo "Tentacle Server could not be started."
|
||||
echo "Verify that port $TENTACLE_PORT is not used."
|
||||
echo "Verify that Tentacle port is not used."
|
||||
rc_failed 7 # program not running
|
||||
fi
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ After=network-online.target
|
|||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/usr/bin/tentacle_server -a 0.0.0.0 -p 41121 -s /var/spool/pandora/data_in -i.*\.conf:conf;.*\.md5:md5;.*\.zip:collections -d
|
||||
ExecStart=/usr/bin/tentacle_server -F /etc/tentacle/tentacle_server.conf
|
||||
User=pandora
|
||||
|
||||
[Install]
|
||||
|
|
Loading…
Reference in New Issue