Merge remote-tracking branch 'origin/develop' into 2162-filtrado-de-interfaces-en-dynamic-snmp

This commit is contained in:
fbsanchez 2018-05-21 10:57:01 +02:00
commit 6821ae9178
138 changed files with 2724 additions and 960 deletions
extras
pandora_agents
pandora_console

View File

@ -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"
},

View File

@ -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 \
@ -67,6 +68,7 @@ $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/SNMP/dynamic_snmp.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"

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721, AIX version
# Version 7.0NG.722, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721, FreeBSD Version
# Version 7.0NG.722, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721, HP-UX Version
# Version 7.0NG.722, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721, GNU/Linux
# Version 7.0NG.722, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721, GNU/Linux
# Version 7.0NG.722, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721, Solaris Version
# Version 7.0NG.722, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.721
# Version 7.0NG.722
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -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;
}

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.721, AIX version
# Version 7.0NG.722, AIX version
# General Parameters
# ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.721
# Version 7.0NG.722
# FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.721, HPUX Version
# Version 7.0NG.722, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721
# Version 7.0NG.722
# Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721
# Version 7.0NG.722
# Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721
# Version 7.0NG.722
# Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.721, Solaris version
# Version 7.0NG.722, Solaris version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721, AIX version
# Version 7.0NG.722, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.721-180411
Version: 7.0NG.722-180521
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.721-180411"
pandora_version="7.0NG.722-180521"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721, GNU/Linux
# Version 7.0NG.722, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721, FreeBSD Version
# Version 7.0NG.722, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721, HP-UX Version
# Version 7.0NG.722, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721, GNU/Linux
# Version 7.0NG.722, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721, GNU/Linux
# Version 7.0NG.722, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721, NetBSD Version
# Version 7.0NG.722, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.721, Solaris Version
# Version 7.0NG.722, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -41,8 +41,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.721';
use constant AGENT_BUILD => '180411';
use constant AGENT_VERSION => '7.0NG.722';
use constant AGENT_BUILD => '180521';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.721
%define release 180411
%define version 7.0NG.722
%define release 180521
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.721
%define release 180411
%define version 7.0NG.722
%define release 180521
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.721"
PI_BUILD="180411"
PI_VERSION="7.0NG.722"
PI_BUILD="180521"
OS_NAME=`uname -s`
FORCE=0

View File

@ -201,6 +201,8 @@ sub get_software_module_data ($$) {
$module{'program'} =~ s/;/,/g;
$module{'version'} =~ s/;/,/g;
$module{'description'} =~ s/;/,/g;
# Replace ellipsis character to avoid encoding errors
$module{'description'} =~ s/…/.../g;
$module{'_keys'} = ['program', 'version','description'];
push (@{$modules->{$name}}, \%module);
}

View File

@ -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;
}

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas
# Version 7.0NG.721
# Version 7.0NG.722
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v7.0NG.721}
{Pandora FMS Windows Agent v7.0NG.722}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{180411}
{180521}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.721(Build 180411)")
#define PANDORA_VERSION ("7.0NG.722(Build 180521)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.721(Build 180411))"
VALUE "ProductVersion", "(7.0NG.722(Build 180521))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.721-180411
Version: 7.0NG.722-180521
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.721-180411"
pandora_version="7.0NG.722-180521"
package_pear=0
package_pandora=1

View File

@ -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

View File

@ -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);

View File

@ -83,7 +83,7 @@ function mainAgentsAlerts() {
}
}
$refr = get_parameter('refr', 30); // By default 30 seconds
$refr = (int) get_parameter('refr', 30); // By default 30 seconds
$show_modules = (bool) get_parameter ("show_modules",0);
$group_id = get_parameter('group_id', 0);
$offset = get_parameter('offset', 0);

View File

@ -14,7 +14,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
$refr = get_parameter('refresh', 0); // By default 30 seconds
$refr = (int) get_parameter('refresh', 0); // By default 30 seconds
function mainAgentsModules() {
global $config;
@ -62,7 +62,7 @@ function mainAgentsModules() {
$updated_time = $updated_info;
$modulegroup = get_parameter('modulegroup', 0);
$refr = get_parameter('refresh', 0); // By default 30 seconds
$refr = (int) get_parameter('refresh', 0); // By default 30 seconds
$recursion = get_parameter('recursion', 0);
$group_id = (int)get_parameter('group_id', 0);

View File

@ -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') . '&nbsp;&nbsp;' . html_print_select ($graph_fields, 'graph', $graph, '', '', 0, true);
if ($graph != 'snmp_module') {
$data['graph'] = __('Graph') . '&nbsp;&nbsp;' . 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') . '&nbsp;&nbsp;' . html_print_select ($refresh_fields, 'refresh', $refresh, '', '', 0, true);
$data['incremental'] = __('Incremental') . '&nbsp;&nbsp;' . html_print_checkbox ('incremental', 1, 0, true);
if ($graph != 'snmp_module') {
$data['incremental'] = __('Incremental') . '&nbsp;&nbsp;' . 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') . '&nbsp;&nbsp;' . html_print_input_text ('ip_target', $snmp_address, '', 50, 255, true);
@ -111,12 +130,21 @@ function pandora_realtime_graphs () {
$data['snmp_ver'] = __('Version') . '&nbsp;&nbsp;' . html_print_select ($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true);
$data['snmp_ver'] .= '&nbsp;&nbsp;' . 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('&nbsp;<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()));

View File

@ -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'];

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -461,14 +461,9 @@ config_check();
<?php
if ($_GET["refr"]) {
$_get_refr = strip_tags($_GET["refr"]);
?>
refr_time = parseInt("<?php echo $_get_refr; ?>");
if (isNaN(refr_time)) {
refr_time = 0;
}
t = new Date();
var refr_time = <?php echo (int) get_parameter("refr", 0); ?>;
var t = new Date();
t.setTime (t.getTime () +
parseInt(<?php echo $config["refr"] * 1000; ?>));
$("#refrcounter").countdown ({until: t,

View File

@ -17,171 +17,170 @@
global $config;
require_once ($config["homedir"] . '/include/functions_graph.php');
require_once($config["homedir"] . '/include/functions_graph.php');
check_login ();
check_login();
$enterprise_include = enterprise_include_once('godmode/admin_access_logs.php');
if (! check_acl ($config['id_user'], 0, "PM")) {
db_pandora_audit( "ACL Violation",
"Trying to access event viewer");
require ("general/noaccess.php");
if (! check_acl($config['id_user'], 0, "PM")) {
db_pandora_audit("ACL Violation", "Trying to access audit view");
require("general/noaccess.php");
exit;
}
ui_print_page_header (__('Pandora audit')." &raquo; ".__('Review Logs'), "images/gm_log.png", false, "", true );
ui_print_page_header(__('Pandora audit') . " &raquo; " . __('Review Logs'), "images/gm_log.png", false, "", true);
$offset = get_parameter ("offset", 0);
$tipo_log = get_parameter ("tipo_log", 'all');
$user_filter = get_parameter('user_filter', 'all');
$filter_text = get_parameter('filter_text', '');
$filter_hours_old = get_parameter('filter_hours_old', 24);
$filter_ip = get_parameter('filter_ip', '');
$offset = (int) get_parameter("offset");
$filter_type = (string) get_parameter("filter_type");
$filter_user = (string) get_parameter("filter_user");
$filter_text = (string) get_parameter("filter_text");
$filter_period = get_parameter("filter_period", null);
$filter_period = ($filter_period !== null) ? (int) $filter_period : 24;
$filter_ip = (string) get_parameter("filter_ip");
echo "<table width='100%' border='0' cellspacing='4' cellpadding='4' class='databox filters'>";
echo '<tr><td class="datost">';
echo '<div style="float: left; width: 400px;">';
echo '<b>'.__('Filter').'</b><br><br>';
$filter_query = "&filter_type=" . $filter_type
. "&filter_user=" . $filter_user
. "&filter_text=" . $filter_text
. "&filter_period=" . $filter_period
. "&filter_ip=" . $filter_ip;
$rows = db_get_all_rows_sql ("SELECT DISTINCT(accion)
FROM tsesion");
if (empty ($rows)) {
$rows = array ();
}
$actions = array ();
foreach ($rows as $row) {
$actions[$row["accion"]] = $row["accion"];
}
echo '<form name="query_sel" method="post" action="index.php?sec=glog&sec2=godmode/admin_access_logs">';
$table = null;
$table->width = '100%';
$table = new stdClass();
$table->class = "databox filters";
$table->cellstyle = array();
$table->cellstyle[0] = array();
$table->cellstyle[1] = array();
$table->cellstyle[0][0] = "text-align: right;";
$table->cellstyle[0][1] = "text-align: left;";
$table->cellstyle[0][2] = "text-align: right;";
$table->cellstyle[0][3] = "text-align: left;";
$table->cellstyle[0][4] = "text-align: right;";
$table->cellstyle[0][5] = "text-align: left;";
$table->cellstyle[1][0] = "text-align: right;";
$table->cellstyle[1][1] = "text-align: left;";
$table->cellstyle[1][2] = "text-align: right;";
$table->cellstyle[1][3] = "text-align: left;";
$table->cellstyle[1][5] = "text-align: right;";
$table->data = array();
$table->data[0][0] = __('Action');
$table->data[0][1] = html_print_select ($actions, 'tipo_log', $tipo_log, '', __('All'), 'all', true);
$table->data[1][0] = __('User');
$table->data[1][1] = html_print_select_from_sql('SELECT id_user, id_user AS text FROM tusuario', 'user_filter', $user_filter, '', __('All'), 'all', true);
$table->data[2][0] = __('Free text for search (*)');
$table->data[2][1] = html_print_input_text('filter_text', $filter_text, __('Free text for search (*)'), 20, 40, true);
$table->data[3][0] = __('Max. hours old');
$table->data[3][1] = html_print_input_text('filter_hours_old', $filter_hours_old, __('Max. hours old'), 3, 6, true);
$table->data[4][0] = __('IP');
$table->data[4][1] = html_print_input_text('filter_ip', $filter_ip, __('IP'), 15, 15, true);
$table->data[5][0] = '';
$table->data[5][1] = html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search" style="float: right;"', true);
html_print_table($table);
echo '</form>';
echo '</div>';
echo '<div style="float: right; width: 300px;">';
echo graphic_user_activity(300, 140);
$data = array();
echo '</div>';
echo '<div style="clear:both;">&nbsp;</div>';
echo '</td></tr></table>';
$data[0] = "<b>" . __('Search') . "</b>";
$data[1] = html_print_input_text("filter_text", $filter_text, __("Free text for search (*)"), 20, 40, true);
$data[2] = "<b>" . __("Max. hours old") . "</b>";
$data[3] = html_print_input_text("filter_period", $filter_period, __("Max. hours old"), 3, 6, true);
$data[4] = "<b>" . __("IP") . "</b>";
$data[5] = html_print_input_text("filter_ip", $filter_ip, __("IP"), 15, 15, true);
$filter = 'WHERE 1 = 1';
$table->data[0] = $data;
$data = array();
if ($tipo_log != 'all') {
$filter .= sprintf (" AND accion = '%s'", $tipo_log);
}
switch ($config['dbtype']) {
case "mysql":
if ($user_filter != 'all') {
$filter .= sprintf(' AND id_usuario = "%s"', $user_filter);
}
$filter .= ' AND (accion LIKE "%' . $filter_text . '%" OR descripcion LIKE "%' . $filter_text . '%")';
if ($filter_ip != '') {
$filter .= sprintf(' AND ip_origen LIKE "%s"', $filter_ip);
}
break;
case "postgresql":
case "oracle":
if ($user_filter != 'all') {
$filter .= sprintf(' AND id_usuario = \'%s\'', $user_filter);
}
$filter .= ' AND (accion LIKE \'%' . $filter_text . '%\' OR descripcion LIKE \'%' . $filter_text . '%\')';
if ($filter_ip != '') {
$filter .= sprintf(' AND ip_origen LIKE \'%s\'', $filter_ip);
}
break;
$actions_sql = "SELECT DISTINCT(accion), accion AS text FROM tsesion";
$data[0] = "<b>" . __("Action") . "</b>";
$data[1] = html_print_select_from_sql($actions_sql, "filter_type", $filter_type, "", __("All"), "", true);
$users_sql = "SELECT id_user, id_user AS text FROM tusuario";
$data[2] = "<b>" . __("User") . "</b>";
$data[3] = html_print_select_from_sql($users_sql, "filter_user", $filter_user, "", __("All"), "", true);
$data[4] = "";
$data[5] = html_print_submit_button(__("Filter"), "filter", false, 'class="sub search"', true);
$table->data[1] = $data;
$form = '<form name="query_sel" method="post" action="index.php?sec=glog&sec2=godmode/admin_access_logs">';
$form .= html_print_table($table, true);
$form .= '</form>';
ui_toggle($form, __("Filter"), "", false);
// ui_toggle(graphic_user_activity(400, 150), __("Chart"));
$filter = "1=1";
if (!empty($filter_type)) {
$filter .= sprintf (" AND accion = '%s'", $filter_type);
}
if ($filter_hours_old != 0) {
if (!empty($filter_user)) {
$filter .= sprintf(" AND id_usuario = '%s'", $filter_user);
}
if (!empty($filter_text)) {
$filter .= " AND (accion LIKE '%'" . $filter_text . "'%' OR descripcion LIKE '%'" . $filter_text . "'%')";
}
if (!empty($filter_ip)) {
$filter .= sprintf(" AND ip_origen LIKE '%'", $filter_ip);
}
if (!empty($filter_period)) {
switch ($config["dbtype"]) {
case "mysql":
$filter .= ' AND fecha >= DATE_ADD(NOW(), INTERVAL -' . $filter_hours_old . ' HOUR)';
$filter .= ' AND fecha >= DATE_ADD(NOW(), INTERVAL -' . $filter_period . ' HOUR)';
break;
case "postgresql":
$filter .= ' AND fecha >= NOW() - INTERVAL \'' . $filter_hours_old . ' HOUR \'';
$filter .= ' AND fecha >= NOW() - INTERVAL \'' . $filter_period . ' HOUR \'';
break;
case "oracle":
$filter .= ' AND fecha >= (SYSTIMESTAMP - INTERVAL \'' . $filter_hours_old . '\' HOUR)';
$filter .= ' AND fecha >= (SYSTIMESTAMP - INTERVAL \'' . $filter_period . '\' HOUR)';
break;
}
}
$sql = "SELECT COUNT(*) FROM tsesion " . $filter;
$count = db_get_sql ($sql);
$url = "index.php?sec=godmode&sec2=godmode/admin_access_logs&tipo_log=".$tipo_log."&user_filter=".$user_filter."&filter_text=".$filter_text."&filter_hours_old=".$filter_hours_old."&filter_ip=".$filter_ip;
ui_pagination ($count, $url);
$count_sql = sprintf("SELECT COUNT(*) FROM tsesion WHERE %s", $filter);
$count = (int) db_get_value_sql($count_sql);
$url = "index.php?sec=godmode&sec2=godmode/admin_access_logs" . $filter_query;
ui_pagination($count, $url);
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ("SELECT *
$sql = sprintf(
"SELECT *
FROM tsesion
%s
WHERE %s
ORDER BY fecha DESC
LIMIT %d, %d", $filter, $offset, $config["block_size"]);
LIMIT %d, %d",
$filter, $offset, $config["block_size"]
);
break;
case "postgresql":
$sql = sprintf ("SELECT *
$sql = sprintf(
"SELECT *
FROM tsesion
%s
WHERE %s
ORDER BY fecha DESC
LIMIT %d OFFSET %d", $filter, $config["block_size"], $offset);
LIMIT %d OFFSET %d",
$filter, $config["block_size"], $offset
);
break;
case "oracle":
$set = array();
$set['limit'] = $config["block_size"];
$set['offset'] = $offset;
$sql = sprintf ("SELECT *
$sql = sprintf(
"SELECT *
FROM tsesion
%s
ORDER BY fecha DESC", $filter);
$result = oracle_recode_query ($sql, $set);
WHERE %s
ORDER BY fecha DESC",
$filter
);
$result = oracle_recode_query($sql, $set);
break;
}
$result = db_get_all_rows_sql ($sql);
// Delete rnum row generated by oracle_recode_query() function
if (($config["dbtype"] == 'oracle') && ($result !== false)) {
for ($i=0; $i < count($result); $i++) {
unset($result[$i]['rnum']);
}
}
if (empty ($result)) {
$result = array ();
}
$result = db_get_all_rows_sql($sql);
if (empty($result)) $result = array();
$table = new stdClass();
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = '100%';
$table->class = "databox data";
$table->size = array ();
$table->data = array ();
$table->head = array ();
$table->size = array();
$table->data = array();
$table->head = array();
$table->align = array();
$table->rowclass = array();
@ -192,9 +191,6 @@ $table->head[3] = __('Source IP');
$table->head[4] = __('Comments');
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
$table->head[5] = enterprise_hook('tableHeadEnterpriseAudit', array('title1'));
}
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
$table->head[6] = enterprise_hook('tableHeadEnterpriseAudit', array('title2'));
}
@ -204,106 +200,54 @@ $table->size[3] = 100;
$table->size[4] = 200;
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
$table->size[5] = enterprise_hook('tableHeadEnterpriseAudit', array('size1'));
}
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
$table->size[6] = enterprise_hook('tableHeadEnterpriseAudit', array('size2'));
}
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
$table->align[5] = enterprise_hook('tableHeadEnterpriseAudit', array('align'));
}
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
$table->align[6] = enterprise_hook('tableHeadEnterpriseAudit', array('align2'));
}
$table->colspan = array();
$table->rowstyle = array();
$rowPair = true;
$iterator = 0;
// Get data
foreach ($result as $row) {
if ($rowPair)
$table->rowclass[$iterator] = 'rowPair';
else
$table->rowclass[$iterator] = 'rowOdd';
$rowPair = !$rowPair;
$iterator++;
$table->rowclass[] = $rowPair ? "rowPair" : "rowOdd";
$rowPair = !$rowPair;
$data = array ();
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
$data[0] = $row["id_usuario"];
break;
case "oracle":
$data[0] = $row["id_usuario"];
break;
}
$data[1] = ui_print_session_action_icon ($row['accion'], true);
$data[1] .= $row["accion"];
$data[2] = ui_print_help_tip($row['fecha'], true) . ui_print_timestamp($row['utimestamp'], true);
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
$data[3] = $row["ip_origen"];
break;
case "oracle":
$data[3] = $row["ip_origen"];
break;
}
$data[4] = io_safe_output($row["descripcion"]);
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
$data[5] = enterprise_hook('cell1EntepriseAudit', array($row['id_sesion']));
break;
case "oracle":
$data[5] = enterprise_hook('cell1EntepriseAudit', array($row['id_sesion']));
break;
}
}
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
$data[6] = enterprise_hook('cell2EntepriseAudit', array($row['id_sesion']));
break;
case "oracle":
$data[6] = enterprise_hook('cell2EntepriseAudit', array($row['id_sesion']));
break;
}
}
array_push ($table->data, $data);
$data = array();
$data[0] = $row["id_usuario"];
$data[1] = ui_print_session_action_icon($row["accion"], true) . $row["accion"];
$data[2] = ui_print_help_tip($row["fecha"], true) . ui_print_timestamp($row["utimestamp"], true);
$data[3] = $row["ip_origen"];
$data[4] = $row["descripcion"];
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
rowEnterpriseAudit($table, $iterator, $row['id_sesion']);
break;
case "oracle":
rowEnterpriseAudit($table, $iterator, $row['id_sesion']);
break;
}
$data[5] = enterprise_hook("cell1EntepriseAudit", array($row["id_sesion"]));
$data[6] = enterprise_hook("cell2EntepriseAudit", array($row["id_sesion"]));
}
$table->data[] = $data;
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
rowEnterpriseAudit($table, $iterator, $row["id_sesion"]);
}
}
html_print_table ($table);
html_print_table($table);
echo '<div style="width: '.$table->width.'" class="action-buttons">';
echo '<a href="' .
ui_get_full_url(false, false, false, false) . 'index.php?sec=gextensions&sec2=godmode/audit_log_csv&tipo_log='.$tipo_log.'&user_filter='.$user_filter.'&filter_text='.$filter_text.'&filter_hours_old='.$filter_hours_old.'&filter_ip='.$filter_ip.'"'.
'>' .
html_print_button (__('Export to CSV '), 'export_csv', false, '', 'class=sub upd', true, false). '</a>';
$csv_url = ui_get_full_url(false, false, false, false) . 'index.php?sec=gextensions&sec2=godmode/audit_log_csv' . $filter_query;
echo '<a href="' . $csv_url . '">'
. html_print_button(__("Export to CSV"), "export_csv", false, "", "class=sub upd", true, false)
. '</a>';
echo '</div>';
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
enterprise_hook('enterpriseAuditFooter');
}
?>

View File

@ -497,6 +497,8 @@ if ($agents !== false) {
$id_grupo = $agent["id_grupo"];
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
if (! check_acl ($config["id_user"], $id_grupo, "AW", $agent['id_agente']) && ! check_acl ($config["id_user"], $id_grupo, "AD", $agent['id_agente']))
continue;
@ -566,22 +568,38 @@ if ($agents !== false) {
echo '</span><div class="left actions" style="visibility: hidden; clear: left">';
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
echo '<a href="index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=main&
id_agente='.$agent["id_agente"].'">'.__('Edit').'</a>';
echo ' | ';
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 ' | ';
}
else{
echo '<a href="index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=main&
id_agente='.$agent["id_agente"].'">'.__('Edit').'</a>';
echo ' | ';
}
}
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>';
echo ' | ';
}
echo '<a href="index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=alert&
id_agente='.$agent["id_agente"].'">'.__('Alerts').'</a>';
echo ' | ';
echo '<a href="index.php?sec=estado
if($agent["id_os"] == 100){
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id='.$cluster['id'].'">'.__('View').'</a>';
}
else{
echo '<a href="index.php?sec=estado
&sec2=operation/agentes/ver_agente
&id_agente='.$agent["id_agente"].'">'.__('View').'</a>';
}
echo '</div>';
echo "</td>";
@ -630,19 +648,41 @@ if ($agents !== false) {
if ($agent['disabled']) {
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''>".
html_print_image('images/lightbulb_off.png', true, array('alt' => __('Enable agent'), 'title' => __('Enable agent'))) ."</a>";
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"] != 100){
echo ">";
}
else{
echo ' onClick="if (!confirm(\' '.__('You are going to enable a cluster agent. Are you sure?').'\')) return false;">';
}
echo html_print_image('images/lightbulb_off.png', true, array('alt' => __('Enable agent'), 'title' => __('Enable agent'))) ."</a>";
}
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'>".
html_print_image('images/lightbulb.png', true, array('alt' => __('Disable agent'), 'title' => __('Disable agent'))) ."</a>";
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"] != 100){
echo ">";
}
else{
echo ' onClick="if (!confirm(\' '.__('You are going to disable a cluster agent. Are you sure?').'\')) return false;">';
}
echo html_print_image('images/lightbulb.png', true, array('alt' => __('Disable agent'), 'title' => __('Disable agent'))) ."</a>";
}
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
echo "&nbsp;&nbsp;<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'";
echo ' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
if($agent["id_os"] != 100){
echo ' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
}
else{
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>";
}

View File

@ -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;

View File

@ -141,6 +141,12 @@ echo '<form class="add_alert_form" method="post">';
html_print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if($id_cluster){
echo "<input onclick='window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");' type=button style='float:right;margin-left:20px;' name='store' class='sub upd' value='".__('Finish and view cluster')."'>";
}
html_print_submit_button (__('Add alert'), 'add', false, 'class="sub wand"');
html_print_input_hidden ('create_alert', 1);
echo '</div></form>';

View File

@ -159,8 +159,14 @@ else {
$form_filter .= "</form>";
if ( defined("METACONSOLE"))
echo "<br>";
if(!$id_cluster){
ui_toggle($form_filter, __('Alert control filter'), __('Toggle filter(s)'));
}
else{
unset($form_filter);
}
ui_toggle($form_filter, __('Alert control filter'), __('Toggle filter(s)'));
$simple_alerts = array();
@ -736,7 +742,7 @@ if (isset($dont_display_alert_create_bttn))
if ($dont_display_alert_create_bttn)
$display_create = false;
if ($display_create && (check_acl ($config['id_user'], 0, "LW") || check_acl ($config['id_user'], $template_group, "LM"))) {
if ($display_create && (check_acl ($config['id_user'], 0, "LW") || check_acl ($config['id_user'], $template_group, "LM")) && !$id_cluster) {
echo '<div class="action-buttons" style="width: ' . $table->width . '">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">';
html_print_submit_button (__('Create'), 'crtbtn', false, 'class="sub next"');

View File

@ -143,6 +143,20 @@ if ($delete_alert) {
$messageAction = ui_print_result_message ($result,
__('Successfully deleted'), __('Could not be deleted'), '', true);
$id_cluster = db_get_all_rows_sql('select id,cluster_type from tcluster where id_agent = '.$id_agente);
if($id_cluster){
if($id_cluster[0]['cluster_type'] == 'AA'){
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=5&update=1&message_delete_alert='.$result);
}
else{
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=7&update=1&message_delete_alert='.$result);
}
}
}
if ($add_action) {
@ -211,6 +225,20 @@ if ($delete_action) {
$messageAction = ui_print_result_message ($result,
__('Successfully deleted'), __('Could not be deleted'), '', true);
$id_cluster = db_get_all_rows_sql('select id,cluster_type from tcluster where id_agent = '.$id_agente);
if($id_cluster){
if($id_cluster[0]['cluster_type'] == 'AA'){
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=5&update=1&message_delete_action='.$result);
}
else{
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=7&update=1&message_delete_action='.$result);
}
}
}
if ($enable_alert) {
@ -228,6 +256,19 @@ if ($enable_alert) {
$messageAction = ui_print_result_message ($result,
__('Successfully enabled'), __('Could not be enabled'), '', true);
$id_cluster = db_get_all_rows_sql('select id,cluster_type from tcluster where id_agent = '.$id_agente);
if($id_cluster){
if($id_cluster[0]['cluster_type'] == 'AA'){
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=5&update=1&message_enable_alert='.$result);
}
else{
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=7&update=1&message_enable_alert='.$result);
}
}
}
if ($disable_alert) {
@ -245,6 +286,20 @@ if ($disable_alert) {
$messageAction = ui_print_result_message ($result,
__('Successfully disabled'), __('Could not be disabled'), '', true);
$id_cluster = db_get_all_rows_sql('select id,cluster_type from tcluster where id_agent = '.$id_agente);
if($id_cluster){
if($id_cluster[0]['cluster_type'] == 'AA'){
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=5&update=1&message_disable_alert='.$result);
}
else{
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=7&update=1&message_disable_alert='.$result);
}
}
}
if ($standbyon_alert) {
@ -262,6 +317,19 @@ if ($standbyon_alert) {
$messageAction = ui_print_result_message ($result,
__('Successfully set standby'), __('Could not be set standby'), '', true);
$id_cluster = db_get_all_rows_sql('select id,cluster_type from tcluster where id_agent = '.$id_agente);
if($id_cluster){
if($id_cluster[0]['cluster_type'] == 'AA'){
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=5&update=1&message_standbyon='.$result);
}
else{
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=7&update=1&message_standbyon='.$result);
}
}
}
if ($standbyoff_alert) {
@ -279,6 +347,19 @@ if ($standbyoff_alert) {
$messageAction = ui_print_result_message ($result,
__('Successfully set off standby'), __('Could not be set off standby'), '', true);
$id_cluster = db_get_all_rows_sql('select id,cluster_type from tcluster where id_agent = '.$id_agente);
if($id_cluster){
if($id_cluster[0]['cluster_type'] == 'AA'){
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=5&update=1&message_standbyoff='.$result);
}
else{
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=7&update=1&message_standbyoff='.$result);
}
}
}
if ($id_agente) {

View File

@ -12,22 +12,19 @@
$ownDir = dirname(__FILE__) . '/';
$ownDir = str_replace("\\", "/", $ownDir);
require_once ($ownDir.'../include/config.php');
require_once($ownDir . "../include/config.php");
require_once($config["homedir"] . "/include/functions.php");
require_once($config["homedir"] . "/include/functions_db.php");
require_once($config["homedir"] . "/include/auth/mysql.php");
global $config;
require_once ($config["homedir"]."/include/functions.php");
require_once ($config["homedir"]."/include/functions_db.php");
require_once ($config["homedir"]."/include/auth/mysql.php");
error_reporting(E_ALL);
ini_set("display_errors", 1);
if (! isset ($_SESSION["id_usuario"])) {
session_start ();
session_write_close ();
if (! isset($_SESSION["id_usuario"])) {
session_start();
session_write_close();
}
// Login check
if (!isset($_SESSION["id_usuario"])) {
$config['id_user'] = null;
@ -36,94 +33,56 @@ else {
$config['id_user'] = $_SESSION["id_usuario"];
}
if (!check_login()) {
db_pandora_audit("ACL Violation", "Trying to access graph builder");
include ($config["homedir"]."/general/noaccess.php");
return;
}
check_login();
if (! check_acl ($config['id_user'], 0, "PM")) {
db_pandora_audit( "ACL Violation",
"Trying to access event viewer");
require ("general/noaccess.php");
if (! check_acl($config['id_user'], 0, "PM")) {
db_pandora_audit("ACL Violation", "Trying to access audit CSV export");
require("general/noaccess.php");
exit;
}
$tipo_log = get_parameter ("tipo_log", 'all');
$user_filter = get_parameter('user_filter', 'all');
$filter_text = get_parameter('filter_text', '');
$filter_hours_old = get_parameter('filter_hours_old', 24);
$filter_ip = get_parameter('filter_ip', '');
$filter_type = (string) get_parameter("filter_type");
$filter_user = (string) get_parameter("filter_user");
$filter_text = (string) get_parameter("filter_text");
$filter_period = get_parameter("filter_period", null);
$filter_period = ($filter_period !== null) ? (int) $filter_period : 24;
$filter_ip = (string) get_parameter("filter_ip");
$filter = 'WHERE 1 = 1';
$filter = "1=1";
if ($tipo_log != 'all') {
$filter .= " AND accion = '$tipo_log'";
}
switch ($config['dbtype']) {
case "mysql":
if ($user_filter != 'all') {
$filter .= sprintf(' AND id_usuario = "%s"', $user_filter);
}
$filter .= ' AND (accion LIKE "%' . $filter_text . '%" OR descripcion LIKE "%' . $filter_text . '%")';
if ($filter_ip != '') {
$filter .= sprintf(' AND ip_origen LIKE "%s"', $filter_ip);
}
break;
case "postgresql":
case "oracle":
if ($user_filter != 'all') {
$filter .= sprintf(' AND id_usuario = \'%s\'', $user_filter);
}
$filter .= ' AND (accion LIKE \'%' . $filter_text . '%\' OR descripcion LIKE \'%' . $filter_text . '%\')';
if ($filter_ip != '') {
$filter .= sprintf(' AND ip_origen LIKE \'%s\'', $filter_ip);
}
break;
if (!empty($filter_type)) {
$filter .= sprintf (" AND accion = '%s'", $filter_type);
}
if ($filter_hours_old != 0) {
if (!empty($filter_user)) {
$filter .= sprintf(" AND id_usuario = '%s'", $filter_user);
}
if (!empty($filter_text)) {
$filter .= " AND (accion LIKE '%'" . $filter_text . "'%' OR descripcion LIKE '%'" . $filter_text . "'%')";
}
if (!empty($filter_ip)) {
$filter .= sprintf(" AND ip_origen LIKE '%'", $filter_ip);
}
if (!empty($filter_period)) {
switch ($config["dbtype"]) {
case "mysql":
$filter .= ' AND fecha >= DATE_ADD(NOW(), INTERVAL -' . $filter_hours_old . ' HOUR)';
$filter .= ' AND fecha >= DATE_ADD(NOW(), INTERVAL -' . $filter_period . ' HOUR)';
break;
case "postgresql":
$filter .= ' AND fecha >= NOW() - INTERVAL \'' . $filter_hours_old . ' HOUR \'';
$filter .= ' AND fecha >= NOW() - INTERVAL \'' . $filter_period . ' HOUR \'';
break;
case "oracle":
$filter .= ' AND fecha >= (SYSTIMESTAMP - INTERVAL \'' . $filter_hours_old . '\' HOUR)';
$filter .= ' AND fecha >= (SYSTIMESTAMP - INTERVAL \'' . $filter_period . '\' HOUR)';
break;
}
}
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ("SELECT *
FROM tsesion
%s
ORDER BY fecha DESC", $filter);
break;
case "postgresql":
$sql = sprintf ("SELECT *
FROM tsesion
%s
ORDER BY fecha DESC", $filter);
break;
case "oracle":
$sql = sprintf ("SELECT *
FROM tsesion
%s
ORDER BY fecha DESC", $filter);
$result = oracle_recode_query ($sql, $set);
break;
}
$sql = sprintf( "SELECT * FROM tsesion WHERE %s ORDER BY fecha DESC", $filter);
$result = db_get_all_rows_sql($sql);
$result = db_get_all_rows_sql ($sql);
print_audit_csv ($result);
print_audit_csv($result);
?>

View File

@ -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) {

View File

@ -130,6 +130,7 @@ switch ($action) {
$show_in_same_row = 0;
$show_in_landscape = 0;
$hide_notinit_agents = 0;
$priority_mode = REPORT_PRIORITY_MODE_OK;
$server_name = '';
$server_id = 0;
$dyn_height = 230;
@ -272,6 +273,9 @@ switch ($action) {
$time_from = $item['time_from'];
$time_to = $item['time_to'];
$show_graph = $item['show_graph'];
$priority_mode = isset($style['priority_mode'])
? $style['priority_mode']
: REPORT_PRIORITY_MODE_OK;
// 'top_n' filed will be reused for SLA sort option
$sla_sorted_by = $item['top_n'];
$period = $item['period'];
@ -1589,6 +1593,33 @@ You can of course remove the warnings, that's why we include the source and do n
</td>
</tr>
<tr id="row_priority_mode" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Priority mode');?></td>
<td>
<?php
echo __('Priority ok mode').'<span style="margin-left:5px;"></span>';
html_print_radio_button (
'priority_mode',
REPORT_PRIORITY_MODE_OK,
'',
$priority_mode == REPORT_PRIORITY_MODE_OK,
''
);
echo ('<span style="margin:30px;"></span>');
echo __('Priority unknown mode').'<span style="margin-left:5px;"></span>';
html_print_radio_button (
'priority_mode',
REPORT_PRIORITY_MODE_UNKNOWN,
'',
$priority_mode == REPORT_PRIORITY_MODE_UNKNOWN,
''
);
?>
</td>
</tr>
<tr id="row_filter_search" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Free search');?></td>
<td>
@ -2801,6 +2832,7 @@ function chooseType() {
$("#row_visual_format").hide();
$("#row_show_in_landscape").hide();
$('#row_hide_notinit_agents').hide();
$('#row_priority_mode').hide();
$("#row_module_group").hide();
$("#row_servers").hide();
$("#row_sort").hide();
@ -2946,6 +2978,7 @@ function chooseType() {
$("#sla_list").show();
$("#row_working_time").show();
$("#row_historical_db_check").hide();
$("#row_priority_mode").show();
break;
case 'module_histogram_graph':
@ -2963,6 +2996,7 @@ function chooseType() {
$("#sla_list").show();
$("#row_working_time").show();
$("#row_sort").show();
$("#row_priority_mode").show();
$("#row_historical_db_check").hide();
break;

View File

@ -1212,6 +1212,7 @@ switch ($action) {
$style['show_in_same_row'] = get_parameter('show_in_same_row', 0);
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
$style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0);
$style['priority_mode'] = get_parameter('priority_mode', REPORT_PRIORITY_MODE_OK);
$style['dyn_height'] = get_parameter('dyn_height', 230);
switch ($values['type']) {
@ -1552,6 +1553,7 @@ switch ($action) {
$style['show_in_same_row'] = get_parameter('show_in_same_row', 0);
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
$style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0);
$style['priority_mode'] = get_parameter('priority_mode', REPORT_PRIORITY_MODE_OK);
$style['dyn_height'] = get_parameter('dyn_height', 230);
switch ($values['type']) {

View File

@ -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');
@ -3763,6 +3762,8 @@ function updateDB_visual(type, idElement , values, event, top, left) {
set_static_graph_status(idElement, values['image']);
}
}
$("#" + idElement).css('left', left + 'px');
$("#" + idElement).css('top', top + 'px');
break;
case 'percentile_item':
case 'simple_value':
@ -3849,8 +3850,8 @@ function updateDB_visual(type, idElement , values, event, top, left) {
function updateDB(type, idElement , values, event) {
metaconsole = $("input[name='metaconsole']").val();
var top = 0;
var left = 0;
var top = typeof(values.top) != 'undefined' ? values.top : 0;
var left = typeof(values.left) != 'undefined' ? values.left : 0;
action = "update";

View File

@ -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

(image error) Size: 527 B

Binary file not shown.

After

(image error) Size: 184 B

View File

@ -225,7 +225,7 @@ if ($get_graphs){
$homeurl = ui_get_full_url(false, false, false, false);
$graph_conf = db_get_row('tgraph', 'id_graph', $value['id_graph']);
if($graph_conf['stacked'] == 4 || $graph_conf['stacked'] == 9){
$height = 50;
} else if ($graph_conf['stacked'] == 5){
@ -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,
$graph_conf['percentil'] == 1,
false,
false,
$value['fullscale']

View File

@ -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 . "&nbsp;&nbsp;";
# 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"]))) . "&amp;" .
"refresh=" . SECONDS_10MINUTES . "&amp;" .
"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> &nbsp;&nbsp;';
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> &nbsp;&nbsp;';
}
$server_name = '';
$data[8] .= "<a href='javascript: " .

View File

@ -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");

View File

@ -105,8 +105,64 @@ if ($correctLogin) {
}
else {
$function_name = 'api_' . $op . '_' . $op2;
if ($op == "set" && $id){
switch ($op2) {
case "update_agent":
case "add_module_in_conf":
case "update_module_in_conf":
case "delete_module_in_conf":
$id_os = db_get_value_sql('select id_os from tagente where id_agente = '.$id);
if($id_os == 100){
returnError('not_allowed_operation_cluster', $returnType);
return false;
}
break;
case "create_network_module":
case "create_plugin_module":
case "create_data_module":
case "create_synthetic_module":
case "create_snmp_module":
case "delete_module":
case "delete_agent":
$id_os = db_get_value_sql('select id_os from tagente where nombre = "'.$id.'"');
html_debug($id_os);
if($id_os == 100){
returnError('not_allowed_operation_cluster', $returnType);
return false;
}
break;
case "update_network_module":
case "update_plugin_module":
case "update_data_module":
case "update_snmp_module":
$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 == 100){
returnError('not_allowed_operation_cluster', $returnType);
return false;
}
break;
default:
// break;
}
}
}
// Check if the function exists
if (function_exists($function_name)) {
if (!DEBUG) {

View File

@ -154,6 +154,15 @@ function process_user_login_local ($login, $pass, $api = false) {
// We get DB nick to put in PHP Session variable,
// to avoid problems with case-sensitive usernames.
// Thanks to David Muñiz for Bug discovery :)
$filter = array("id_usuario" => $login);
$user_profile = db_get_row_filter ("tusuario_perfil", $filter);
if(!users_is_admin($login) && !$user_profile){
$mysql_cache["auth_error"] = "User does not have any profile";
$config["auth_error"] = "User does not have any profile";
return false;
}
return $row["id_user"];
}
else {
@ -340,7 +349,7 @@ function process_user_login_remote ($login, $pass, $api = false) {
$attributes = $ldap_adv_perm['groups_ldap'];
foreach ($attributes as $attr) {
$attr = explode('=',$attr);
$attr = explode('=', $attr, 2);
if(in_array($attr[1],$sr[$attr[0]])) {
$permissions[$i]["profile"] = $ldap_adv_perm['profile'];
$permissions[$i]["groups"] = $ldap_adv_perm['group'];

View File

@ -22,8 +22,8 @@
/**
* Pandora build version and version
*/
$build_version = 'PC180411';
$pandora_version = 'v7.0NG.721';
$build_version = 'PC180521';
$pandora_version = 'v7.0NG.722';
// Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get();

View File

@ -129,6 +129,8 @@ define('COL_WARNING_DARK', '#FFB900');
define('COL_NORMAL', '#80BA27');
define('COL_NOTINIT', '#3BA0FF');
define('COL_UNKNOWN', '#B2B2B2');
define('COL_DOWNTIME', '#976DB1');
define('COL_IGNORED', '#DDD');
define('COL_ALERTFIRED', '#FFA631');
define('COL_MINOR', '#F099A2');
define('COL_MAJOR', '#C97A4A');

View File

@ -2162,6 +2162,18 @@ function is_snapshot_data ($data) {
return is_image_data($data);
}
/**
* Check if text is too long to put it into a black screen
*
* @param string Data value
* @return bool True if black window should be displayed
*/
function is_text_to_black_string ($data) {
if (is_image_data($data)) return false;
// Consider large text if data is greater than 200 characters
return ((int)strlen($data)) > 200;
}
/**
* Create an invisible div with a provided ID and value to
* can retrieve it from javascript with function get_php_value(name)
@ -2289,6 +2301,10 @@ function get_news($arguments) {
$limit = get_argument ('limit', $arguments, 99999999);
$id_group = array_keys(users_get_groups($id_user, false, true));
// Empty groups
if (empty($id_group)) return array();
$id_group = implode(',',$id_group);
$current_datetime = date('Y-m-d H:i:s', time());
$modal = (int) $modal;

View File

@ -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');

View File

@ -84,6 +84,10 @@ function returnError($typeError, $returnType = 'string') {
returnData($returnType,
array('type' => 'string', 'data' => __('Id does not exist in BD.')));
break;
case 'not_allowed_operation_cluster':
returnData($returnType,
array('type' => 'string', 'data' => __('This operation can not be used in cluster elements.')));
break;
default:
returnData("string",
array('type' => 'string', 'data' => __($returnType)));
@ -10142,6 +10146,335 @@ function api_set_metaconsole_synch($keys) {
}
function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
global $config;
if (defined ('METACONSOLE')) {
return;
}
$name = $other['data'][0];
$cluster_type = $other['data'][1];
$description = $other['data'][2];
$idGroup = $other['data'][3];
$server_name = db_process_sql('select name from tserver where server_type=5 limit 1');
$server_name_agent = $server_name[0]['name'];
$values_agent = array(
'nombre' => $name,
'alias' => $name,
'comentarios' => $description,
'id_grupo' => $idGroup,
'id_os' => 100,
'server_name' => $server_name_agent
);
if (trim($name) != "") {
// $id_agent = db_process_sql_insert('tagente',$values_agent);
$id_agent = agents_create_agent($values_agent['nombre'],$values_agent['id_grupo'],300,'127.0.0.1',$values_agent);
// Create cluster
$values_cluster = array(
'name' => $name,
'cluster_type' => $cluster_type,
'description' => $description,
'group' => $idGroup,
'id_agent' => $id_agent
);
$id_cluster = db_process_sql_insert('tcluster', $values_cluster);
$values_module = array(
'nombre' => 'Cluster status',
'id_modulo' => 5,
'prediction_module' => 5,
'id_agente' =>$id_agent,
'custom_integer_1' =>$id_cluster,
'id_tipo_modulo' => 1,
'descripcion' => 'Cluster status information module',
'min_warning' => 1,
'min_critical' => 2
);
$id_module = modules_create_agent_module($values_module['id_agente'],$values_module['nombre'],$values_module);
if ($id_cluster !== false)
db_pandora_audit("Report management", "Create cluster #$id_cluster");
else
db_pandora_audit("Report management", "Fail try to create cluster");
if ($id_agent !== false)
db_pandora_audit("Report management", "Create cluster #$id_agent");
else
db_pandora_audit("Report management", "Fail try to create agent");
returnData('string',
array('type' => 'string', 'data' => (int)((bool)$id_cluster)));
}
}
function api_set_add_cluster_agent($thrash1, $thrash2, $other, $thrash3) {
$array_json = json_decode(base64_decode(io_safe_output($other['data'][0])), true);
if(!empty($array_json)){
$results = false;
foreach ($array_json as $key => $element) {
if($element['id'] == 0){
continue;
}
$tcluster_agent = db_process_sql('insert into tcluster_agent values ('.$element["id"].','.$element["id_agent"].')');
}
if($result && !$results){
$results = $result;
}
}
if($tcluster_agent){
returnData('string', array('type' => 'string', 'data' => 1));
} else {
returnError('error_add_cluster_element', __('Error adding elements to cluster'));
}
}
function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3) {
$array_json = json_decode(base64_decode(io_safe_output($other['data'][0])), true);
if(!empty($array_json)){
$results = false;
}
//
foreach ($array_json as $key => $element) {
//
if($element["type"] == "AA"){
//
$tcluster_module = db_process_sql_insert('tcluster_item',array('name'=>$element["name"],'id_cluster'=>$element["id_cluster"],'critical_limit'=>$element["critical_limit"],'warning_limit'=>$element["warning_limit"]));
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$element["id_cluster"]);
$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 = "'.io_safe_input($element["name"]).'" limit 1');
$get_module_type_value = $get_module_type[0]['id_tipo_modulo'];
$get_module_description_value = $get_module_type[0]['descripcion'];
$get_module_warning_value = $get_module_type[0]['min_warning'];
$get_module_critical_value = $get_module_type[0]['min_critical'];
$get_module_interval_value = $get_module_type[0]['module_interval'];
$values_module = array(
'nombre' => $element["name"],
'id_modulo' => 0,
'prediction_module' => 6,
'id_agente' => $id_agent[0]['id_agent'],
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'],
'custom_integer_1' =>$element["id_cluster"],
'custom_integer_2' =>$tcluster_module,
'id_tipo_modulo' =>1,
'descripcion' => $get_module_description_value,
'min_warning' => $element["warning_limit"],
'min_critical' => $element["critical_limit"],
'tcp_port' => 1,
'module_interval' => $get_module_interval_value
);
$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"]);
}
else{
db_pandora_audit("Report management", "Fail try to assign module to cluster");
}
}
elseif ($element["type"] == "AP") {
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$element["id_cluster"]);
$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"');
$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 = "'.io_safe_input($element["name"]).'" limit 1');
$get_module_type_value = $get_module_type[0]['id_tipo_modulo'];
$get_module_description_value = $get_module_type[0]['descripcion'];
$get_module_warning_value = $get_module_type[0]['min_warning'];
$get_module_critical_value = $get_module_type[0]['min_critical'];
$get_module_interval_value = $get_module_type[0]['module_interval'];
$get_module_type_nombre = db_process_sql('select nombre from ttipo_modulo where id_tipo = '.$get_module_type_value);
$get_module_type_nombre_value = $get_module_type_nombre[0]['nombre'];
if(strpos($get_module_type_nombre_value,'inc') != false){
$get_module_type_value_normal = 4;
}
elseif (strpos($get_module_type_nombre_value,'proc') != false) {
$get_module_type_value_normal = 2;
}
elseif (strpos($get_module_type_nombre_value,'data') != false) {
$get_module_type_value_normal = 1;
}
elseif (strpos($get_module_type_nombre_value,'string') != false) {
$get_module_type_value_normal = 3;
}
else{
$get_module_type_value_normal = 1;
}
$values_module = array(
'nombre' => $element["name"],
'id_modulo' => 5,
'prediction_module' => 7,
'id_agente' => $id_agent[0]['id_agent'],
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'],
'custom_integer_1' => $element["id_cluster"],
'custom_integer_2' => $tcluster_balanced_module,
'id_tipo_modulo' => $get_module_type_value_normal,
'descripcion' => $get_module_description_value,
'min_warning' => $get_module_warning_value,
'min_critical' => $get_module_critical_value,
'tcp_port' => $element["is_critical"],
'module_interval' => $get_module_interval_value
);
$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"]);
}
else{
db_pandora_audit("Report management", "Fail try to assign module to cluster");
}
}
}
if($result && !$results){
$results = $result;
}
if($id_module){
returnData('string', array('type' => 'string', 'data' => 1));
} else {
returnError('error_add_cluster_element', __('Error adding elements to cluster'));
}
}
function api_set_delete_cluster($id, $thrash1, $thrast2, $thrash3) {
global $config;
if (defined ('METACONSOLE')) {
return;
}
$temp_id_cluster = db_process_sql('select id_agent from tcluster where id ='.$id);
$tcluster_modules_delete_get = db_process_sql('select id_agente_modulo from tagente_modulo where custom_integer_1 = '.$id);
foreach ($tcluster_modules_delete_get as $key => $value) {
$tcluster_modules_delete_get_values[] = $value['id_agente_modulo'];
}
$tcluster_modules_delete = modules_delete_agent_module($tcluster_modules_delete_get_values);
$tcluster_items_delete = db_process_sql('delete from tcluster_item where id_cluster = '.$id);
$tcluster_agents_delete = db_process_sql('delete from tcluster_agent where id_cluster = '.$id);
$tcluster_delete = db_process_sql('delete from tcluster where id = '.$id);
$tcluster_agent_delete = agents_delete_agent($temp_id_cluster[0]['id_agent']);
if (!$tcluster_modules_delete || !$tcluster_items_delete || !$tcluster_agents_delete || !$tcluster_delete || !$tcluster_agent_delete)
returnError('error_delete', 'Error in delete operation.');
else
returnData('string', array('type' => 'string', 'data' => __('Correct Delete')));
}
function api_set_delete_cluster_agent($thrash1, $thrast2, $other, $thrash3) {
global $config;
if (defined ('METACONSOLE')) {
return;
}
$id_agent = $other['data'][0];
$id_cluster = $other['data'][1];
$tcluster_agent_delete = db_process_sql('delete from tcluster_agent where id_agent = '.$id_agent.' and id_cluster = '.$id_cluster);
if (!$tcluster_agent_delete)
returnError('error_delete', 'Error in delete operation.');
else
returnData('string', array('type' => 'string', 'data' => __('Correct Delete')));
}
function api_set_delete_cluster_item($id, $thrash1, $thrast2, $thrast3) {
global $config;
if (defined ('METACONSOLE')) {
return;
}
$delete_module_aa_get = db_process_sql('select id_agente_modulo from tagente_modulo where custom_integer_2 = '.$id);
$delete_module_aa_get_result = modules_delete_agent_module($delete_module_aa_get[0]['id_agente_modulo']);
$delete_item = db_process_sql('delete from tcluster_item where id = '.$id);
if (!$delete_item)
returnError('error_delete', 'Error in delete operation.');
else
returnData('string', array('type' => 'string', 'data' => __('Correct Delete')));
}
function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thrash4) {
if (isset ($id_template)) {
@ -10285,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);
}
?>

View File

@ -20,7 +20,13 @@
*/
require_once ('include/functions_graph.php');
function folder_get_folders(){
$folders = io_safe_output(db_get_all_rows_in_table ('tcontainer','parent, name'));
$folders = io_safe_output(db_get_all_rows_filter (
'tcontainer',
array (
'id_group' => array_keys(users_get_groups()),
'order' => 'parent, name'
)
));
$ordered_folders = array();
foreach ($folders as $folder) {

View File

@ -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
*/

View File

@ -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);";
@ -196,55 +200,45 @@ function gis_make_layer($name, $visible = true, $dot = null, $idLayer = null, $p
layer.events.on({
"featureselected": function(e) {
if (e.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
var feature = e.feature;
var featureData = feature.data;
var long_lat = featureData.long_lat;
var popup;
var img_src = null;
var featureData = e.feature.data;
var img_src = "<?php echo ui_get_full_url('images/spinner.gif', false, false, false, false); ?>";
var $details = $('<div />');
$details
.prop("id", 'cloudContent_' + featureData.id)
.css("text-align", "center")
.html('<img src="' + img_src + '" />')
.dialog({
title: "<?php echo __('Agent'); ?> #" + featureData.id,
resizable: true,
draggable: true,
modal: true,
overlay: {
opacity: 0.5,
background: "black"
},
close: function () {
$details.remove();
}
});
jQuery.ajax ({
url: "<?php echo ui_get_full_url('ajax.php', false, false, false, false); ?>",
data: {
page: "include/ajax/skins.ajax",
get_image_path: 1,
img_src: "images/spinner.gif"
page: "operation/gis_maps/ajax",
opt: featureData.type,
id: featureData.id,
hash: "<?php echo $hash; ?>",
id_user: "<?php echo $config['id_user']; ?>",
map_id: <?php echo (int)$id_map; ?>
},
type: 'GET',
dataType: 'html',
type: "GET",
dataType: "json",
success: function (data) {
img_src = data;
popup = new OpenLayers.Popup.FramedCloud('cloud00',
long_lat,
null,
'<div class="cloudContent' + featureData.id + '" style="text-align: center;">' + img_src + '</div>',
null,
true,
function () { popup.destroy(); });
feature.popup = popup;
map.addPopup(popup);
jQuery.ajax ({
url: "<?php echo ui_get_full_url('ajax.php', false, false, false, false); ?>",
data: {
page: "operation/gis_maps/ajax",
opt: featureData.type,
id: featureData.id,
hash: "<?php echo $hash; ?>",
id_user: "<?php echo $config['id_user']; ?>",
map_id: <?php echo (int)$id_map; ?>
},
type: "GET",
dataType: 'json',
success: function (data) {
if (data.correct) {
$('.cloudContent' + featureData.id).css('text-align', 'left');
$('.cloudContent' + featureData.id).html(data.content);
popup.updateSize();
}
}
});
if (data.correct) {
$details.css("text-align", "left").html(data.content);
}
}
});
}
@ -1045,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) {

View File

@ -1117,15 +1117,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, $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) {
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;
@ -2843,9 +2870,9 @@ function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek
2 => COL_WARNING,
3 => COL_CRITICAL,
4 => COL_UNKNOWN,
5 => "#ff8400",//COL_MINOR,
5 => COL_DOWNTIME,
6 => COL_NOTINIT,
7 => "#ddd");//COL_MAJOR);
7 => COL_IGNORED);
return slicesbar_graph($data, $period, $width, $height, $colors,
$config['fontpath'], $round_corner, $home_url, $ttl);
@ -3986,7 +4013,7 @@ function graph_custom_sql_graph ($id, $width, $height,
$config['font_size'],
"",
$ttl,
$config['homeurl'],
$homeurl,
"white",
false,
false,
@ -4010,7 +4037,7 @@ function graph_custom_sql_graph ($id, $width, $height,
$config['font_size'],
false,
$ttl,
$config['homeurl'],
$homeurl,
'white',
'black'
);

View File

@ -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('&nbsp;&nbsp;&nbsp;&nbsp;', $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] .= '&nbsp;&nbsp;' .
'<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] .= '&nbsp;&nbsp;' .
@ -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'];

View File

@ -798,7 +798,7 @@ function html_print_extended_select_for_post_process($name, $selected = '',
function html_print_extended_select_for_time ($name, $selected = '',
$script = '', $nothing = '', $nothing_value = '0', $size = false,
$return = false, $select_style = false, $unique_name = true, $class='',
$readonly = false, $custom_fields = false,$style_icon = '') {
$readonly = false, $custom_fields = false,$style_icon = '',$no_change = false) {
global $config;
$admin = is_user_admin($config['id_user']);
@ -808,6 +808,9 @@ function html_print_extended_select_for_time ($name, $selected = '',
$fields = get_periods();
}
if($no_change){
$fields['-2'] = __('No change');
}
if ( ! $selected ) {
foreach( $fields as $t_key => $t_value){

View File

@ -396,7 +396,7 @@ function __ ($string /*, variable arguments */) {
return $tranlateString;
}
}
elseif (enterprise_installed &&
elseif (enterprise_installed() &&
isset($config['translate_string_extension_installed']) &&
$config['translate_string_extension_installed'] == 1 &&
array_key_exists('translate_string.php', $extensions)) {

View File

@ -2684,4 +2684,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;
}
?>

View File

@ -836,7 +836,7 @@ function networkmap_links_to_js_links($relations, $nodes_graph) {
$item['source'] = $node['id'];
}
}
if (($item['target'] == -1) && ($item['source'] == -1) && $relation['parent_type'] == 1 && $relation['child_type'] == 1) {
if ((($item['target'] == -1) || ($item['source'] == -1)) && $relation['parent_type'] == 1 && $relation['child_type'] == 1) {
continue;
}
@ -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'),

View File

@ -39,6 +39,21 @@ include_once($config['homedir'] . "/include/functions_ui.php");
include_once($config['homedir'] . "/include/functions_netflow.php");
include_once($config['homedir'] . "/include/functions_os.php");
/////////////////////////////////////////////////////////
// CONSTANTS DEFINITIONS //
/////////////////////////////////////////////////////////
// Priority modes
define ('REPORT_PRIORITY_MODE_OK', 1);
define ('REPORT_PRIORITY_MODE_UNKNOWN', 2);
// Status
define ('REPORT_STATUS_ERR', 0);
define ('REPORT_STATUS_OK', 1);
define ('REPORT_STATUS_UNKNOWN', 2);
define ('REPORT_STATUS_NOT_INIT', 3);
define ('REPORT_STATUS_DOWNTIME', 4);
define ('REPORT_STATUS_IGNORED', 5);
function reporting_user_can_see_report($id_report, $id_user = null) {
global $config;
@ -748,7 +763,7 @@ function reporting_SLA($report, $content, $type = 'dinamic',
$content['time_from'],
$content['time_to'],
$slice
);
);
if ($metaconsole_on) {
@ -804,7 +819,7 @@ function reporting_SLA($report, $content, $type = 'dinamic',
$data['min'] = $sla['sla_min'];
$data['sla_limit'] = $sla['sla_limit'];
$data['dinamic_text'] = $dinamic_text;
if(isset($sla_array[0])){
$data['time_total'] = 0;
$data['time_ok'] = 0;
@ -864,7 +879,7 @@ function reporting_SLA($report, $content, $type = 'dinamic',
}
$i++;
}
$data['sla_value'] = ($data['time_ok']/($data['time_ok']+$data['time_error']))*100;
$data['sla_value'] = reporting_sla_get_compliance_from_array($data);
$data['sla_fixed'] = sla_truncate($data['sla_value'], $config['graph_precision'] );
}
else{
@ -881,6 +896,7 @@ function reporting_SLA($report, $content, $type = 'dinamic',
$data['checks_unknown'] = $sla_array['checks_unknown'];
$data['checks_not_init'] = $sla_array['checks_not_init'];
$data['sla_value'] = $sla_array['SLA'];
$data['sla_fixed'] = $sla_array['sla_fixed'];
}
//checks whether or not it meets the SLA
@ -4662,7 +4678,7 @@ function sla_fixed_worktime($wt_start, $wt_end, $worktime = null, $planned_downt
$return["wt_valid"] = 1;
$return["interval"] = $wt_end - $wt_start;
if ( (!isset($wt_start)) || (!isset($wt_end)) || ($wt_start > $wt_end)) {
if ( (!isset($wt_start)) || (!isset($wt_end)) || ($wt_start > $wt_end) || ($wt_start > time())) {
$return["wt_valid"] = 0;
$return["interval"] = 0;
}
@ -5317,7 +5333,6 @@ function reporting_advanced_sla ($id_agent_module, $time_from = null, $time_to =
// Add downtime interval as OK in inclusion mode
$total_checks++;
$ok_checks++;
$time_in_ok += $wt_check["downtime_interval"];
$time_total += $wt_check["downtime_interval"];
$time_in_down += $wt_check["downtime_interval"];
}
@ -5366,14 +5381,7 @@ function reporting_advanced_sla ($id_agent_module, $time_from = null, $time_to =
$return["checks_not_init"] = $not_init_checks;
// SLA
if (($time_in_error+$time_in_ok) == 0) {
$return["SLA"] = 0;
}
else {
$return["SLA"] = (($time_in_ok/($time_in_error+$time_in_ok))*100);
}
// SLA
$return["SLA"] = reporting_sla_get_compliance_from_array($return);
$return["SLA_fixed"] = sla_truncate($return["SLA"], $config['graph_precision']);
// Time ranges
@ -5491,7 +5499,7 @@ function reporting_availability($report, $content, $date=false, $time=false) {
$row = array();
$text = "";
$row['data'] = reporting_advanced_sla(
$item['id_agent_module'],
$report["datetime"] - $content['period'],
@ -5689,6 +5697,8 @@ function reporting_availability_graph($report, $content, $pdf=false) {
$total_result_SLA = 'ok';
$sla_showed = array();
$sla_showed_values = array();
$priority_mode = $content['style']['priority_mode'];
foreach ($slas as $sla) {
$server_name = $sla ['server_name'];
@ -5755,7 +5765,7 @@ function reporting_availability_graph($report, $content, $pdf=false) {
$content['time_from'],
$content['time_to'],
$slice
);
);
if ($metaconsole_on) {
@ -5839,42 +5849,12 @@ function reporting_availability_graph($report, $content, $pdf=false) {
$data['checks_not_init'] += $value_sla['checks_not_init'];
// generate raw data for graph
if ($value_sla['time_total'] != 0) {
if ($value_sla['time_error'] > 0) { // ERR
$raw_graph[$i]['data'] = 3;
}
elseif ($value_sla['time_unknown'] > 0) { // UNKNOWN
$raw_graph[$i]['data'] = 4;
}
elseif ($value_sla['time_not_init'] == $value_sla['time_total']) { // NOT INIT
$raw_graph[$i]['data'] = 6;
}
else {
$raw_graph[$i]['data'] = 1;
}
}
else {
$raw_graph[$i]['data'] = 7;
}
$period = reporting_sla_get_status_period($value_sla, $priority_mode);
$raw_graph[$i]['data'] = reporting_translate_sla_status_for_graph($period);
$raw_graph[$i]['utimestamp'] = $value_sla['date_to'] - $value_sla['date_from'];
if (isset($planned_downtimes)) {
foreach($planned_downtimes as $pd){
if( ($value_sla['date_from'] >= $pd['date_from'])
&& ($value_sla['date_to'] <= $pd['date_to']) ) {
$raw_graph[$i]['data'] = 5; // in scheduled downtime
break;
}
}
}
$i++;
}
if (($data['time_ok']+$data['time_error']) > 0 ) {
$data['sla_value'] = ($data['time_ok']/($data['time_ok']+$data['time_error']))*100;
}
else {
$data['sla_value'] = 0;
}
$data['sla_value'] = reporting_sla_get_compliance_from_array($data);
$data['sla_fixed'] = sla_truncate($data['sla_value'], $config['graph_precision'] );
}
else{
@ -5919,6 +5899,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'];
@ -11025,4 +11007,92 @@ function reporting_label_macro ($item, $label) {
return $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) * 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;
}
/**
* @brief Given a period, get the SLA status of the period.
*
* @param Array An array with all times to calculate the SLA
* @param int Priority mode. Setting this parameter to REPORT_PRIORITY_MODE_OK
* and there is no critical in this period, return an OK without look for
* not init, downtimes, unknown and others...
*
* @return int Status
*/
function reporting_sla_get_status_period($sla_times, $priority_mode = REPORT_PRIORITY_MODE_OK) {
if ($sla_times['time_error'] > 0) {
return REPORT_STATUS_ERR;
}
if ($priority_mode == REPORT_PRIORITY_MODE_OK && $sla_times['time_ok'] > 0) {
return REPORT_STATUS_OK;
}
if ($sla_times['time_out'] > 0) {
return REPORT_STATUS_IGNORED;
}
if ($sla_times['time_downtime'] > 0) {
return REPORT_STATUS_DOWNTIME;
}
if ($sla_times['time_unknown'] > 0) {
return REPORT_STATUS_UNKNOWN;
}
if ($sla_times['time_not_init'] > 0) {
return REPORT_STATUS_NOT_INIT;
}
if ($sla_times['time_ok'] > 0) {
return REPORT_STATUS_OK;
}
return REPORT_STATUS_IGNORED;
}
/**
* @brief Translate the status to the color to graph_sla_slicebar function
*
* @param int The status in number
* @return int The index of color array to graph_sla_slicebar function
*/
function reporting_translate_sla_status_for_graph ($status) {
$sts = array (
REPORT_STATUS_ERR => 3,
REPORT_STATUS_OK => 1,
REPORT_STATUS_UNKNOWN => 4,
REPORT_STATUS_NOT_INIT => 6,
REPORT_STATUS_DOWNTIME => 5,
REPORT_STATUS_IGNORED => 7
);
return $sts[$status];
}
?>

View File

@ -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.';">' .
@ -535,7 +540,7 @@ function reporting_html_SLA($table, $item, $mini) {
$row2[] = '--';
if($sla['time_downtime'] != 0)
$row2[] = '<span style="color: #ff8400;">' . human_time_description_raw($sla['time_downtime'], true) . '</span>';
$row2[] = '<span style="color: '.COL_DOWNTIME .';">' . human_time_description_raw($sla['time_downtime'], true) . '</span>';
else
$row2[] = '--';
@ -614,7 +619,7 @@ function reporting_html_SLA($table, $item, $mini) {
$row2[] = '--';
if($sla['time_downtime'] != 0)
$row2[] = '<span style="color: #ff8400;">' . human_time_description_raw($sla['time_downtime'], true) . '</span>';
$row2[] = '<span style="color: '.COL_DOWNTIME .';">'. human_time_description_raw($sla['time_downtime'], true) . '</span>';
else
$row2[] = '--';
@ -693,7 +698,7 @@ function reporting_html_SLA($table, $item, $mini) {
$table1->data[0][7] = '<span>'.__('Not Init'). '</span>';
$table1->size[8] = '2%';
$table1->data[0][8] = '<img src ="'. $src .'images/square_orange.png">';
$table1->data[0][8] = '<img src ="'. $src .'images/square_violet.png">';
$table1->size[9] = '14%';
$table1->data[0][9] = '<span>'.__('Downtimes'). '</span>';
@ -2427,7 +2432,7 @@ function reporting_html_availability(&$table, $item) {
else
$table_row[] = '--';
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'], $config['graph_precision']). '%</span>';
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'] * 100, $config['graph_precision']). '%</span>';
$table_row2 = array();
$table_row2[] = $row['agent'];
@ -2473,7 +2478,7 @@ function reporting_html_availability(&$table, $item) {
else
$table_row[] = '--';
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'], $config['graph_precision']). '%</span>';
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'] * 100, $config['graph_precision']). '%</span>';
$table_row2 = array();
$table_row2[] = $row['agent'];
@ -2563,27 +2568,40 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
$table1 = new stdClass();
$table1->width = '99%';
$table1->data = array ();
if (!$hide_notinit_agent) {
foreach ($item['charts'] as $chart) {
$table1->data[] = array(
$chart['agent'] . "<br />" . $chart['module'],
$chart['chart'],
"<span style = 'font: bold 2em Arial, Sans-serif;'>" . sla_truncate($chart['sla_value'], $config['graph_precision']) . '%</span>',
"(" . $chart['checks_ok'] . "/" . $chart['checks_total'] . ")"
);
}
}
else{
foreach ($item['charts'] as $chart) {
$the_first_men_time = get_agent_first_time(io_safe_output($chart['agent']));
if ($item['date']['to'] > $the_first_men_time) {
$table1->data[] = array(
$chart['agent'] . "<br />" . $chart['module'],
$chart['chart']);
foreach ($item['charts'] as $chart) {
$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_value .
'</span>',
$checks_resume
);
}
if($item['type'] == 'availability_graph'){
//table_legend_graphs;
@ -2612,7 +2630,7 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
$table2->data[0][7] = '<span>'.__('Not Init'). '</span>';
$table2->size[8] = '2%';
$table2->data[0][8] = '<img src ="'. $src .'images/square_orange.png">';
$table2->data[0][8] = '<img src ="'. $src .'images/square_violet.png">';
$table2->size[9] = '14%';
$table2->data[0][9] = '<span>'.__('Downtimes'). '</span>';

View File

@ -561,8 +561,8 @@ function snmp_browser_print_container ($return = false, $width = '100%', $height
$table->data[0][2] = '<strong>'.__('Starting OID').'</strong> &nbsp;&nbsp;';
$table->data[0][2] .= html_print_input_text ('starting_oid', '.1.3.6.1.2', '', 25, 0, true);
$table->data[0][3] = '<strong>' . __('Version') . '</strong> &nbsp;&nbsp;';
$table->data[0][3] .= html_print_select (
$table->data[1][0] = '<strong>' . __('Version') . '</strong> &nbsp;&nbsp;';
$table->data[1][0] .= html_print_select (
array ('1' => 'v. 1',
'2' => 'v. 2',
'2c' => 'v. 2c',
@ -576,21 +576,22 @@ 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[0][4] = '<strong>' . __('Server to execute') . '</strong> &nbsp;&nbsp;';
$table->data[0][4] .= html_print_select($servers_to_exec, 'server_to_exec', '', '', '', '', true);
$table->data[1][1] = '<strong>' . __('Server to execute') . '</strong> &nbsp;&nbsp;';
$table->data[1][1] .= html_print_select($servers_to_exec, 'server_to_exec', '', '', '', '', true);
$table->data[0][5] = html_print_button(__('Browse'), 'browse', false, 'snmpBrowse()', 'class="sub search" style="margin-top:0px;"', true);
$table->data[1][2] = html_print_button(__('Browse'), 'browse', false, 'snmpBrowse()', 'class="sub search" style="margin-top:0px;"', true);
// SNMP v3 options
$table3 = new stdClass();

View File

@ -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)) {

View File

@ -622,8 +622,17 @@ 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;">';
$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);
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);
}
else{
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$id_agente);
$go_to_agent .= '<a target=_blank href="' . $console_url . 'index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1='.$id_agente.'">';
$go_to_agent .= html_print_submit_button (__('Edit cluster'), 'upd_button', false, 'class="sub config"', true);
}
$go_to_agent .= '</a>';
$go_to_agent .= '</div>';

View File

@ -3814,12 +3814,11 @@ function ui_print_module_string_value($value, $id_agente_module,
if ($is_web_content_string) {
$value = io_safe_input($value);
}
$is_snapshot = is_snapshot_data($value);
if (($config['command_snapshot']) && ($is_snapshot)) {
$is_large_image = is_text_to_black_string ($value);
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
$handle = "snapshot" . "_" . $id_agente_module;
$url = 'include/procesos.php?agente=' . $id_agente_module;
$win_handle = dechex(crc32($handle));
@ -3828,7 +3827,7 @@ function ui_print_module_string_value($value, $id_agente_module,
"id=" . $id_agente_module .
"&refr=" . $current_interval .
"&label=" . rawurlencode(urlencode(io_safe_output($module_name))) . "','" . $win_handle . "', 700,480)";
if (is_image_data($value)) {
if ($is_snapshot) {
$salida = '<a href="javascript:' . $link . '">' .
html_print_image("images/photo.png", true,
array("border" => '0',

View File

@ -247,8 +247,7 @@ function visual_map_print_item($mode = "read", $layoutData,
if (!isset($layoutData['status_calculated'])) {
$layoutData['status_calculated'] =
visual_map_get_status_element($layoutData);
$layoutData['status_calculated'] = visual_map_get_status_element($layoutData);
}
$status = $layoutData['status_calculated'];
@ -812,50 +811,6 @@ function visual_map_print_item($mode = "read", $layoutData,
switch ($type) {
case STATIC_GRAPH:
case GROUP_ITEM:
//Enter the correct img if the graph has a module selected or not
if ($type == STATIC_GRAPH) {
//Module
if ($layoutData['id_agente_modulo'] != 0) {
$module_status = db_get_sql ('SELECT estado
FROM tagente_estado
WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']);
switch($module_status) {
case AGENT_STATUS_NORMAL:
$layoutData['status_calculated'] = AGENT_STATUS_NORMAL;
break;
case AGENT_MODULE_STATUS_WARNING:
$layoutData['status_calculated'] = AGENT_STATUS_WARNING;
break;
case AGENT_STATUS_CRITICAL:
$layoutData['status_calculated'] = AGENT_STATUS_CRITICAL;
break;
case AGENT_MODULE_STATUS_NO_DATA:
default:
$layoutData['status_calculated'] = AGENT_STATUS_UNKNOWN;
break;
}
}
//No module
else if ($layoutData['id_agent'] != 0) {
$agent = db_get_row ("tagente", "id_agente", $layoutData['id_agent']);
if ($agent['total_count'] == 0 || $agent['total_count'] == $agent['notinit_count']) {
$layoutData['status_calculated'] = AGENT_STATUS_UNKNOWN;
}
else if ($agent['critical_count'] > 0) {
$layoutData['status_calculated'] = AGENT_STATUS_CRITICAL;
}
else if ($agent['warning_count'] > 0) {
$layoutData['status_calculated'] = AGENT_STATUS_WARNING;
}
else if ($agent['unknown_count'] > 0) {
$layoutData['status_calculated'] = AGENT_STATUS_UNKNOWN;
}
else {
$layoutData['status_calculated'] = AGENT_STATUS_NORMAL;
}
}
}
if ($layoutData['image'] != null) {
$img = visual_map_get_image_status_element($layoutData,
$layoutData['status_calculated']);
@ -3210,7 +3165,18 @@ function visual_map_get_status_element($layoutData) {
else {
switch ($layoutData["type"]) {
case STATIC_GRAPH:
//Enter the correct img if the graph has a module selected or not
// Open metaconsole connection
if ($layoutData['id_metaconsole'] != 0) {
//Metaconsole db connection
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layoutData['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
//Enter the correct img if the graph has a module selected or not
//Module
if ($layoutData['id_agente_modulo'] != 0) {
$module_status = db_get_sql ('SELECT estado
@ -3257,15 +3223,7 @@ function visual_map_get_status_element($layoutData) {
}
$status = $layoutData['status_calculated'];
if ($layoutData['id_metaconsole'] != 0) {
//Metaconsole db connection
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layoutData['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
// Close metaconsole connection
if ($layoutData['id_metaconsole'] != 0) {
//Restore db connection
metaconsole_restore_db();
@ -3783,9 +3741,6 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0, $elements_in_
$data["id_agente_modulo"] == 0 &&
$data["id_agent"] == 0) ||
$data['type'] != 0){
if($data['type'] == 0){
$temp_total = VISUAL_MAP_STATUS_UNKNOWN;
}
continue;
}

View File

@ -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">' .

View File

@ -1930,6 +1930,8 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
}
}
// Get only two decimals
formatted =round_with_decimals(formatted, 100)
return '<div class='+font+' style="font-size:'+font_size+'pt;">'+formatted+'</div>';
}

View File

@ -182,7 +182,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
global $config;
include_javascript_dependencies_flot_graph();
// include_javascript_dependencies_flot_graph();
$menu = (int)$menu;
// Get a unique identifier to graph
@ -497,6 +497,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
// Javascript code
if ($font_size == '') $font_size = '\'\'';
$return .= "<script type='text/javascript'>";
$return .= "$(document).ready( function () {";
$return .= "pandoraFlotArea(" .
@ -557,7 +558,7 @@ function flot_pie_chart ($values, $labels, $width, $height, $water_mark,
$font = '', $font_size = 8, $legend_position = '', $colors = '',
$hide_labels = false) {
include_javascript_dependencies_flot_graph();
// include_javascript_dependencies_flot_graph();
$series = sizeof($values);
if (($series != sizeof ($labels)) || ($series == 0) ) {
@ -613,7 +614,7 @@ function flot_custom_pie_chart ($flash_charts, $graph_values,
global $config;
///TODO
include_javascript_dependencies_flot_graph();
// include_javascript_dependencies_flot_graph();
$total_modules = $graph_values['total_modules'];
unset($graph_values['total_modules']);
@ -673,7 +674,7 @@ function flot_custom_pie_chart ($flash_charts, $graph_values,
function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = '', $font_size = 7, $background_color = "white", $tick_color = "white", $val_min=null, $val_max=null) {
global $config;
include_javascript_dependencies_flot_graph();
// include_javascript_dependencies_flot_graph();
$return = '';
@ -773,7 +774,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font =
function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark, $homedir, $font, $font_size, $from_ux, $from_wux, $background_color = 'white', $tick_color = 'white') {
global $config;
include_javascript_dependencies_flot_graph();
// include_javascript_dependencies_flot_graph();
$stacked_str = '';
$multicolor = false;
@ -872,7 +873,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '', $stat_win = false, $id_agent = 0, $full_legend_date = array()) {
global $config;
include_javascript_dependencies_flot_graph();
// include_javascript_dependencies_flot_graph();
$stacked_str = 'stack: stack,';

View File

@ -1494,14 +1494,6 @@ function print_phases_donut (recipient, phases) {
}
}
function round_with_decimals (value, multiplier = 1) {
if ((value * multiplier) == 0) return 0;
if ((value * multiplier) >= 1) {
return Math.round(value * multiplier) / multiplier;
}
return round_with_decimals (value, multiplier * 10);
}
function progress_bar_d3 (recipient, percentile, width, height, color, unit, label, label_color) {
var startPercent = 0;
var endPercent = parseInt(percentile) / 100;

View File

@ -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;
}
@ -206,7 +213,7 @@ function update_fictional_node(id_db_node) {
graph.nodes[i].networkmap_id = networkmap_to_link;
$("#id_node_" + i + networkmap_id + " title").html(name);
$("#id_node_" + i + networkmap_id + " tspan").html(name);
$("#id_node_" + i + networkmap_id + " tspan").html(ellipsize(name, 30));
}
});
@ -244,7 +251,7 @@ function update_node_name(id_db_node) {
graph.nodes[i]['raw_text'] = data['raw_text'];
$("#id_node_" + i + networkmap_id + " title").html(data['raw_text']);
$("#id_node_" + i + networkmap_id + " tspan").html(data['raw_text']);
$("#id_node_" + i + networkmap_id + " tspan").html(ellipsize(data['raw_text'], 30));
}
});
@ -766,7 +773,7 @@ function edit_node(data_node, dblClick) {
$("#dialog_node_edit")
.dialog("option", "title",
dialog_node_edit_title.replace("%s", node_selected['text'])); // It doesn't eval the possible XSS so it's ok
dialog_node_edit_title.replace("%s", ellipsize(node_selected['text'], 40))); // It doesn't eval the possible XSS so it's ok
$("#dialog_node_edit").dialog("open");
if (node_selected.id_agent == undefined || node_selected.id_agent == -2) {
@ -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");
}
}
});
@ -3647,7 +3658,7 @@ function draw_elements_graph() {
.append("tspan")
.attr("style", "font-size: " + font_size + "px !important; font-family:Verdana; text-align:center; text-anchor:middle; fill:#000000")
.text(function (d) {
return d.text;
return ellipsize(d.text, 30);
})
.classed('dragable_node', true) //own dragable
.on("click", selected_node)

View File

@ -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;
}
}
}

View File

@ -1551,4 +1551,86 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
}
}
}
}
function round_with_decimals (value, multiplier = 1) {
// Return non numeric types without modification
if (typeof(value) !== "number") return value;
if ((value * multiplier) == 0) return 0;
if ((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
}
});
}
function ellipsize (str, max, ellipse) {
if (max == null) max = 140;
if (ellipse == null) ellipse = "…";
return str.trim().length > max ? str.substr(0, max).trim() + ellipse : str;
}

View File

@ -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"]);

Some files were not shown because too many files have changed in this diff Show More