Merge branch 'ent-10008-Gestion-de-busquedas-en-la-vista-de-agentes-y-mejora-de-las-busquedas' of brutus.artica.es:artica/pandorafms into ent-10008-Gestion-de-busquedas-en-la-vista-de-agentes-y-mejora-de-las-busquedas

This commit is contained in:
alejandro.campos@artica.es 2023-03-01 16:10:30 +01:00
commit fd13b376a5
63 changed files with 892 additions and 517 deletions

View File

@ -9,7 +9,7 @@
# RedHat 8.5 # RedHat 8.5
#Constants #Constants
S_VERSION='202302081' S_VERSION='202302201'
LOGFILE="/tmp/deploy-ext-db-$(date +%F).log" LOGFILE="/tmp/deploy-ext-db-$(date +%F).log"
@ -275,6 +275,8 @@ EO_CONFIG_F
if [ "$MYVER" -eq '80' ] ; then if [ "$MYVER" -eq '80' ] ; then
sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf
sed -i -e "s/#skip-log-bin/skip-log-bin/g" /etc/my.cnf sed -i -e "s/#skip-log-bin/skip-log-bin/g" /etc/my.cnf
sed -i -e "s/character-set-server=utf8/character-set-server=utf8mb4/g" /etc/my.cnf
fi fi
execute_cmd "systemctl restart mysqld" "Configuring database engine" execute_cmd "systemctl restart mysqld" "Configuring database engine"

View File

@ -4,6 +4,7 @@
############################################################################################################## ##############################################################################################################
## Tested versions ## ## Tested versions ##
# Ubuntu 22.04.1 # Ubuntu 22.04.1
# Ubuntu 22.04.2
#avoid promps #avoid promps
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
@ -16,7 +17,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
WORKDIR=/opt/pandora/deploy WORKDIR=/opt/pandora/deploy
S_VERSION='202302081' S_VERSION='202302201'
LOGFILE="/tmp/deploy-ext-db-$(date +%F).log" LOGFILE="/tmp/deploy-ext-db-$(date +%F).log"
rm -f $LOGFILE &> /dev/null # remove last log before start rm -f $LOGFILE &> /dev/null # remove last log before start
@ -181,7 +182,7 @@ cat > /etc/mysql/my.cnf << EOF_DB
[mysqld] [mysqld]
datadir=/var/lib/mysql datadir=/var/lib/mysql
user=mysql user=mysql
character-set-server=utf8 character-set-server=utf8mb4
skip-character-set-client-handshake skip-character-set-client-handshake
# Disabling symbolic-links is recommended to prevent assorted security risks # Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0 symbolic-links=0
@ -196,7 +197,7 @@ innodb_flush_log_at_trx_commit = 0
innodb_flush_method = O_DIRECT innodb_flush_method = O_DIRECT
innodb_log_file_size = 64M innodb_log_file_size = 64M
innodb_log_buffer_size = 16M innodb_log_buffer_size = 16M
innodb_io_capacity = 100 innodb_io_capacity = 300
thread_cache_size = 8 thread_cache_size = 8
thread_stack = 256K thread_stack = 256K
max_connections = 100 max_connections = 100

View File

@ -431,7 +431,7 @@ execute_cmd "curl -LSs --output pandorafms_agent_linux-7.0NG.noarch.rpm ${PANDOR
execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages" execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages"
# Copy gotty utility # Copy gotty utility
execute_cmd "wget https://pandorafms.com/library/wp-content/uploads/2019/11/gotty_linux_amd64.tar.gz" 'Dowloading gotty util' execute_cmd "wget https://firefly.pandorafms.com/pandorafms/utils/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util' execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'

View File

@ -5,7 +5,7 @@
## Tested versions ## ## Tested versions ##
# Centos 8.4, 8.5 # Centos 8.4, 8.5
# Rocky 8.4, 8.5, 8.6, 8.7 # Rocky 8.4, 8.5, 8.6, 8.7
# Almalinuz 8.4, 8.5 # Almalinux 8.4, 8.5
# RedHat 8.5 # RedHat 8.5
#Constants #Constants
@ -14,7 +14,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='202301251' S_VERSION='202302201'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables # define default variables
@ -107,6 +107,17 @@ check_root_permissions () {
fi fi
} }
installing_docker () {
#Installing docker for debug
echo "Start installig docker" &>> "$LOGFILE"
dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo &>> "$LOGFILE"
dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin &>> "$LOGFILE"
systemctl disable --now docker &>> "$LOGFILE"
systemctl disable docker.socket --now &>> "$LOGFILE"
echo "End installig docker" &>> "$LOGFILE"
}
## Main ## Main
echo "Starting PandoraFMS Community deployment EL8 ver. $S_VERSION" echo "Starting PandoraFMS Community deployment EL8 ver. $S_VERSION"
@ -207,6 +218,7 @@ else
execute_cmd "dnf config-manager --set-enabled powertools" "Configuring Powertools" execute_cmd "dnf config-manager --set-enabled powertools" "Configuring Powertools"
fi fi
execute_cmd "installing_docker" "Installing Docker for debug"
#Installing wget #Installing wget
execute_cmd "dnf install -y wget" "Installing wget" execute_cmd "dnf install -y wget" "Installing wget"
@ -454,7 +466,7 @@ innodb_flush_log_at_trx_commit = 0
innodb_flush_method = O_DIRECT innodb_flush_method = O_DIRECT
innodb_log_file_size = 64M innodb_log_file_size = 64M
innodb_log_buffer_size = 16M innodb_log_buffer_size = 16M
innodb_io_capacity = 100 innodb_io_capacity = 300
thread_cache_size = 8 thread_cache_size = 8
thread_stack = 256K thread_stack = 256K
max_connections = 100 max_connections = 100
@ -483,6 +495,7 @@ EO_CONFIG_F
if [ "$MYVER" -eq '80' ] ; then if [ "$MYVER" -eq '80' ] ; then
sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf
sed -i -e "s/#skip-log-bin/skip-log-bin/g" /etc/my.cnf sed -i -e "s/#skip-log-bin/skip-log-bin/g" /etc/my.cnf
sed -i -e "s/character-set-server=utf8/character-set-server=utf8mb4/g" /etc/my.cnf
fi fi
execute_cmd "systemctl restart mysqld" "Configuring database engine" execute_cmd "systemctl restart mysqld" "Configuring database engine"
@ -517,7 +530,7 @@ execute_cmd "curl -LSs --output pandorafms_agent_linux-7.0NG.noarch.rpm ${PANDOR
execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages" execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages"
# Copy gotty utility # Copy gotty utility
execute_cmd "wget https://pandorafms.com/library/wp-content/uploads/2019/11/gotty_linux_amd64.tar.gz" 'Dowloading gotty util' execute_cmd "wget https://firefly.pandorafms.com/pandorafms/utils/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util' execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
@ -743,7 +756,7 @@ execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
cat > /etc/issue.net << EOF_banner cat > /etc/issue.net << EOF_banner
Welcome to Pandora FMS appliance on CentOS Welcome to Pandora FMS appliance on RHEL/Rocky Linux 8
------------------------------------------ ------------------------------------------
Go to Public http://$ipplublic/pandora_console$to to login web console Go to Public http://$ipplublic/pandora_console$to to login web console
$(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to Local http://"$1"/pandora_console to login web console"}') $(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to Local http://"$1"/pandora_console to login web console"}')

View File

@ -4,6 +4,7 @@
############################################################################################################## ##############################################################################################################
## Tested versions ## ## Tested versions ##
# Ubuntu 22.04.1 # Ubuntu 22.04.1
# Ubuntu 22.04.2
#avoid promps #avoid promps
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
@ -16,7 +17,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
WORKDIR=/opt/pandora/deploy WORKDIR=/opt/pandora/deploy
S_VERSION='202301251' S_VERSION='202302201'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
rm -f $LOGFILE &> /dev/null # remove last log before start rm -f $LOGFILE &> /dev/null # remove last log before start
@ -106,6 +107,21 @@ check_root_permissions () {
fi fi
} }
installing_docker () {
#Installing docker for debug
echo "Start installig docker" &>> "$LOGFILE"
mkdir -m 0755 -p /etc/apt/keyrings &>> "$LOGFILE"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --yes --dearmor -o /etc/apt/keyrings/docker.gpg &>> "$LOGFILE"
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list &>> "$LOGFILE"
apt update -y &>> "$LOGFILE"
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin &>> "$LOGFILE"
systemctl disable docker --now &>> "$LOGFILE"
systemctl disable docker.socket --now &>> "$LOGFILE"
echo "End installig docker" &>> "$LOGFILE"
}
## Main ## Main
echo "Starting PandoraFMS Community deployment Ubuntu 22.04 ver. $S_VERSION" echo "Starting PandoraFMS Community deployment Ubuntu 22.04 ver. $S_VERSION"
@ -173,7 +189,7 @@ execute_cmd "cd $WORKDIR" "Moving to workdir: $WORKDIR"
## Install utils ## Install utils
execute_cmd "apt update" "Updating repos" execute_cmd "apt update" "Updating repos"
execute_cmd "apt install -y net-tools vim curl wget software-properties-common apt-transport-https" "Installing utils" execute_cmd "apt install -y net-tools vim curl wget software-properties-common apt-transport-https ca-certificates gnupg lsb-release" "Installing utils"
#Installing Apache and php-fpm #Installing Apache and php-fpm
[ -e "/etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list" ] || execute_cmd "add-apt-repository ppa:ondrej/php -y" "Enable ppa:ondrej/php repo" [ -e "/etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list" ] || execute_cmd "add-apt-repository ppa:ondrej/php -y" "Enable ppa:ondrej/php repo"
@ -221,7 +237,8 @@ systemctl restart php$PHPVER-fpm &>> "$LOGFILE"
php$PHPVER-xml \ php$PHPVER-xml \
php$PHPVER-yaml \ php$PHPVER-yaml \
libnet-telnet-perl \ libnet-telnet-perl \
whois" whois \
cron"
execute_cmd "apt install -y $console_dependencies" "Installing Pandora FMS Console dependencies" execute_cmd "apt install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
# Server dependencies # Server dependencies
@ -254,10 +271,13 @@ server_dependencies=" \
libnet-telnet-perl \ libnet-telnet-perl \
libjson-perl \ libjson-perl \
libencode-perl \ libencode-perl \
cron \
libgeo-ip-perl \ libgeo-ip-perl \
openjdk-8-jdk " openjdk-8-jdk "
execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies" execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
execute_cmd "installing_docker" "Installing Docker for debug"
# wmic and pandorawmic # wmic and pandorawmic
execute_cmd "curl -O https://firefly.artica.es/pandorafms/utils/bin/wmic" "Downloading wmic" execute_cmd "curl -O https://firefly.artica.es/pandorafms/utils/bin/wmic" "Downloading wmic"
execute_cmd "curl -O https://firefly.artica.es/pandorafms/utils/bin/pandorawmic" "Downloading pandorawmic" execute_cmd "curl -O https://firefly.artica.es/pandorafms/utils/bin/pandorawmic" "Downloading pandorawmic"
@ -393,7 +413,7 @@ cat > /etc/mysql/my.cnf << EOF_DB
[mysqld] [mysqld]
datadir=/var/lib/mysql datadir=/var/lib/mysql
user=mysql user=mysql
character-set-server=utf8 character-set-server=utf8mb4
skip-character-set-client-handshake skip-character-set-client-handshake
# Disabling symbolic-links is recommended to prevent assorted security risks # Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0 symbolic-links=0
@ -408,7 +428,7 @@ innodb_flush_log_at_trx_commit = 0
innodb_flush_method = O_DIRECT innodb_flush_method = O_DIRECT
innodb_log_file_size = 64M innodb_log_file_size = 64M
innodb_log_buffer_size = 16M innodb_log_buffer_size = 16M
innodb_io_capacity = 100 innodb_io_capacity = 300
thread_cache_size = 8 thread_cache_size = 8
thread_stack = 256K thread_stack = 256K
max_connections = 100 max_connections = 100
@ -477,7 +497,7 @@ check_cmd_status "Error installing PandoraFMS Agent"
# Copy gotty utility # Copy gotty utility
cd $WORKDIR &>> "$LOGFILE" cd $WORKDIR &>> "$LOGFILE"
execute_cmd "wget https://pandorafms.com/library/wp-content/uploads/2019/11/gotty_linux_amd64.tar.gz" 'Dowloading gotty util' execute_cmd "wget https://firefly.pandorafms.com/pandorafms/utils/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util' execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
@ -731,10 +751,15 @@ systemctl enable pandora_server &>> "$LOGFILE"
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server" execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
systemctl enable tentacle_serverd &>> "$LOGFILE" systemctl enable tentacle_serverd &>> "$LOGFILE"
# Enabling condole cron # Enabling console cron
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron" execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
# Enabling pandoradb cron
execute_cmd "echo 'enabling pandoradb cron' >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS pandoradb cron"
echo "@hourly root bash -c /etc/cron.hourly/pandora_db" >> /etc/crontab
## Enabling agent adn configuring Agente ## Enabling agent adn configuring Agente
sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF &>> "$LOGFILE" sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF &>> "$LOGFILE"
execute_cmd "/etc/init.d/pandora_agent_daemon start" "Starting PandoraFSM Agent" execute_cmd "/etc/init.d/pandora_agent_daemon start" "Starting PandoraFSM Agent"
@ -748,7 +773,7 @@ sed --follow-symlinks -i -e "s/^openssl_conf = openssl_init/#openssl_conf = open
cat > /etc/issue.net << EOF_banner cat > /etc/issue.net << EOF_banner
Welcome to Pandora FMS appliance on CentOS Welcome to Pandora FMS appliance on Ubuntu
------------------------------------------ ------------------------------------------
Go to Public http://$ipplublic/pandora_console$to to login web console Go to Public http://$ipplublic/pandora_console$to to login web console
$(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to Local http://"$1"/pandora_console to login web console"}') $(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to Local http://"$1"/pandora_console to login web console"}')

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.769-230222 Version: 7.0NG.769-230228
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -1023,7 +1023,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.769'; use constant AGENT_VERSION => '7.0NG.769';
use constant AGENT_BUILD => '230222'; use constant AGENT_BUILD => '230228';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230222 %define release 230228
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230222 %define release 230228
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.769" PI_VERSION="7.0NG.769"
PI_BUILD="230222" PI_BUILD="230228"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{230222} {230228}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.769 Build 230222") #define PANDORA_VERSION ("7.0NG.769 Build 230228")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.769-230222 Version: 7.0NG.769-230228
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -227,7 +227,7 @@ function dbmgr_extension_main()
'dbport' => $node->dbport(), 'dbport' => $node->dbport(),
'dbname' => $node->dbname(), 'dbname' => $node->dbname(),
'dbuser' => $node->dbuser(), 'dbuser' => $node->dbuser(),
'dbpass' => $node->dbpass(), 'dbpass' => io_output_password($node->dbpass()),
] ]
); );
$error = ''; $error = '';

View File

@ -15,4 +15,7 @@ CREATE TABLE IF NOT EXISTS `tagent_filter` (
PRIMARY KEY (`id_filter`) PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE INDEX agente_modulo_estado ON tevento (estado, id_agentmodule);
CREATE INDEX idx_disabled ON talert_template_modules (disabled);
COMMIT; COMMIT;

View File

@ -0,0 +1,5 @@
START TRANSACTION;
INSERT INTO `treport_custom_sql` (`name`, `sql`) VALUES ('Agent&#x20;safe&#x20;mode&#x20;not&#x20;enable', 'select&#x20;alias&#x20;from&#x20;tagente&#x20;where&#x20;safe_mode_module&#x20;=&#x20;0');
COMMIT;

View File

@ -89,8 +89,7 @@ $password_fields = [];
// If there are $macros, we create the form fields // If there are $macros, we create the form fields
if (!empty($macros)) { if (!empty($macros)) {
$macros = json_decode($macros, true); $macros = json_decode(io_safe_output($macros), true);
foreach ($macros as $k => $m) { foreach ($macros as $k => $m) {
$data = []; $data = [];
$data[0] = $m['desc']; $data[0] = $m['desc'];

View File

@ -391,7 +391,7 @@ foreach ($actions as $action) {
$data = []; $data = [];
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.$action['name'].'</a>'; $data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'&offset='.$offset.'">'.$action['name'].'</a>';
if ($action['id_group'] == 0 && $can_edit_all == false) { if ($action['id_group'] == 0 && $can_edit_all == false) {
$data[0] .= ui_print_help_tip(__('You cannot edit this action, You don\'t have the permission to edit All group.'), true); $data[0] .= ui_print_help_tip(__('You cannot edit this action, You don\'t have the permission to edit All group.'), true);
} }
@ -467,7 +467,7 @@ if (isset($data)) {
if (is_management_allowed() === true) { if (is_management_allowed() === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'&offset='.$offset.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
html_print_input_hidden('create_alert', 1); html_print_input_hidden('create_alert', 1);
echo '</form>'; echo '</form>';

View File

@ -795,15 +795,15 @@ foreach ($commands as $command) {
); );
$data['action'] = ''; $data['action'] = '';
$table->cellclass[]['action'] = 'action_buttons'; $table->cellclass[]['action'] = 'action_buttons';
$offset_delete = ($offset >= ($total_commands - 1)) ? ($offset - $limit) : $offset;
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group. // (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.
if ($is_management_allowed === true && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) { if ($is_management_allowed === true && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
if (is_user_admin($config['id_user']) === true) { if (is_user_admin($config['id_user']) === true) {
$data['action'] = '<span class="inline_flex">'; $data['action'] = '<span class="inline_flex">';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'" $data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'&offset='.$offset.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true, ['class' => 'invert_filter']).'</a>'; onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true, ['class' => 'invert_filter']).'</a>';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'" $data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'&offset='.$offset_delete.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>'; onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>';
$data['action'] .= '</span>'; $data['action'] .= '</span>';
} }

View File

@ -352,7 +352,8 @@ if ($search_string) {
$filter[] = "(name LIKE '%".$search_string."%' OR description LIKE '%".$search_string."%' OR value LIKE '%".$search_string."%')"; $filter[] = "(name LIKE '%".$search_string."%' OR description LIKE '%".$search_string."%' OR value LIKE '%".$search_string."%')";
} }
$filter['offset'] = (int) get_parameter('offset'); $offset = (int) get_parameter('offset');
$filter['offset'] = $offset;
$filter['limit'] = (int) $config['block_size']; $filter['limit'] = (int) $config['block_size'];
if (!is_user_admin($config['id_user'])) { if (!is_user_admin($config['id_user'])) {
$filter['id_group'] = array_keys(users_get_groups(false, 'LM')); $filter['id_group'] = array_keys(users_get_groups(false, 'LM'));
@ -420,7 +421,7 @@ foreach ($templates as $template) {
&& check_acl($config['id_user'], $template['id_group'], 'LM') && check_acl($config['id_user'], $template['id_group'], 'LM')
) { ) {
$table->cellclass[][4] = 'action_buttons'; $table->cellclass[][4] = 'action_buttons';
$data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'" class="float-left inline_line">'; $data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'&offset='.$offset.'" class="float-left inline_line">';
$data[4] .= html_print_input_hidden('duplicate_template', 1, true); $data[4] .= html_print_input_hidden('duplicate_template', 1, true);
$data[4] .= html_print_input_hidden('source_id', $template['id'], true); $data[4] .= html_print_input_hidden('source_id', $template['id'], true);
$data[4] .= html_print_input_image( $data[4] .= html_print_input_image(

View File

@ -372,8 +372,9 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
); );
} }
$offset = (int) get_parameter('offset', 0);
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&pure='.$pure.'&offset='.$offset.'">';
$table_html = html_print_table($table, true); $table_html = html_print_table($table, true);
echo $table_html; echo $table_html;

View File

@ -1147,9 +1147,10 @@ if ($step == 2) {
echo ui_get_using_system_timezone_warning(); echo ui_get_using_system_timezone_warning();
} }
$offset = (int) get_parameter('offset');
// If it's the last step it will redirect to template lists. // If it's the last step it will redirect to template lists.
if ($step >= LAST_STEP) { if ($step >= LAST_STEP) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_templates&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_templates&pure='.$pure.'&offset='.$offset.'">';
} else { } else {
echo '<form method="post">'; echo '<form method="post">';
} }

View File

@ -40,6 +40,7 @@ $custom_id = '';
$create_group = (bool) get_parameter('create_group'); $create_group = (bool) get_parameter('create_group');
$id_group = (int) get_parameter('id_group'); $id_group = (int) get_parameter('id_group');
$offset = (int) get_parameter('offset', 0);
if ($id_group) { if ($id_group) {
$group = db_get_row('tmodule_group', 'id_mg', $id_group); $group = db_get_row('tmodule_group', 'id_mg', $id_group);
@ -70,9 +71,9 @@ $table->data[0][1] = html_print_input_text('name', $name, '', 35, 100, true);
echo '</span>'; echo '</span>';
if (is_metaconsole()) { if (is_metaconsole()) {
echo '<form name="grupo" method="post" action="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group">'; echo '<form name="grupo" method="post" action="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&offset='.$offset.'">';
} else { } else {
echo '<form name="grupo" method="post" action="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list">'; echo '<form name="grupo" method="post" action="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&offset='.$offset.'">';
} }
html_print_table($table); html_print_table($table);

View File

@ -262,18 +262,18 @@ if (empty($groups) === false) {
} }
$table->data = []; $table->data = [];
$offset_delete = ($offset >= $total_groups - 1) ? ($offset - $config['block_size']) : $offset;
foreach ($groups as $id_group) { foreach ($groups as $id_group) {
$data = []; $data = [];
$data[0] = $id_group['id_mg']; $data[0] = $id_group['id_mg'];
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
$data[1] = '<strong><a href="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group&id_group='.$id_group['id_mg'].'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>'; $data[1] = '<strong><a href="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group&id_group='.$id_group['id_mg'].'&offset='.$offset.'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>';
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>'; $data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1&offset='.$offset_delete.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
} else { } else {
$table->cellclass[][2] = 'action_buttons'; $table->cellclass[][2] = 'action_buttons';
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>'; $data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1&offset='.$offset_delete.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
} }
} else { } else {
$data[1] = '<strong>'; $data[1] = '<strong>';

View File

@ -2094,46 +2094,21 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
switch ($field) { switch ($field) {
case 'id_plugin': case 'id_plugin':
if ($value != 0) { if ($value != 0) {
$value_field_1 = get_parameter('_field1_', ''); for ($i = 0; $i <= 15; $i++) {
$value_field_1_desc = get_parameter('desc_field1_', ''); $value_field = get_parameter('_field'.$i.'_', '');
$value_field_desc = get_parameter('desc_field'.$i.'_', '');
$value_field_2 = get_parameter('_field2_', ''); if ($value_field_desc != '') {
$value_field_2_desc = get_parameter('desc_field2_', ''); $values['macros'][$i] = [
'macro' => '_field'.$i.'_',
$value_field_3 = get_parameter('_field3_', ''); 'desc' => io_safe_input($value_field_desc),
$value_field_3_desc = get_parameter('desc_field3_', ''); 'help' => io_safe_input($value_field_desc),
'value' => $value_field,
$value_field_4 = get_parameter('_field4_', ''); ];
$value_field_4_desc = get_parameter('desc_field4_', '');
$value_field_5 = get_parameter('_field5_', '');
$value_field_5_desc = get_parameter('desc_field5_', '');
$values['macros'] = '{"1":{"macro":"_field1_","desc":"'.io_safe_input($value_field_1_desc).'","help":"'.io_safe_input($value_field_1_desc).'","value":"'.$value_field_1.'"}';
if ($value_field_2_desc != '') {
$values['macros'] .= ',"2":{"macro":"_field2_","desc":"'.io_safe_input($value_field_2_desc).'","help":"'.io_safe_input($value_field_2_desc).'","value":"'.$value_field_2.'"}';
if ($value_field_3_desc != '') {
$values['macros'] .= ',"3":{"macro":"_field3_","desc":"'.io_safe_input($value_field_3_desc).'","help":"'.io_safe_input($value_field_3_desc).'","value":"'.$value_field_3.'"}';
if ($value_field_4_desc != '') {
$values['macros'] .= ',"4":{"macro":"_field4_","desc":"'.io_safe_input($value_field_4_desc).'","help":"'.io_safe_input($value_field_4_desc).'","value":"'.$value_field_4.'"}';
if ($value_field_5_desc != '') {
$values['macros'] .= ',"5":{"macro":"_field5_","desc":"'.io_safe_input($value_field_5_desc).'","help":"'.io_safe_input($value_field_5_desc).'","value":"'.$value_field_5.'"}';
} else {
$values['macros'] .= '}';
}
} else {
$values['macros'] .= '}';
}
} else {
$values['macros'] .= '}';
} }
} else {
$values['macros'] .= '}';
} }
$values['macros'] = json_encode($values['macros']);
$values[$field] = $value;
} }
break; break;
@ -2260,7 +2235,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
// Apply at All agents (within valid groups). // Apply at All agents (within valid groups).
$modules = db_get_all_rows_sql( $modules = db_get_all_rows_sql(
sprintf( sprintf(
'SELECT tam.id_agente_modulo, tam.id_tipo_modulo 'SELECT tam.id_agente_modulo, tam.id_tipo_modulo,tam.macros, tam.id_plugin
FROM tagente_modulo tam INNER JOIN tagente ta FROM tagente_modulo tam INNER JOIN tagente ta
ON ta.id_agente = tam.id_agente ON ta.id_agente = tam.id_agente
WHERE ta.id_grupo IN (%s) %s;', WHERE ta.id_grupo IN (%s) %s;',
@ -2277,6 +2252,8 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
[ [
'id_agente_modulo', 'id_agente_modulo',
'id_tipo_modulo', 'id_tipo_modulo',
'macros',
'id_plugin',
] ]
); );
} else { } else {
@ -2289,6 +2266,8 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
[ [
'id_agente_modulo', 'id_agente_modulo',
'id_tipo_modulo', 'id_tipo_modulo',
'macros',
'id_plugin',
] ]
); );
} }
@ -2346,6 +2325,23 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
} }
} }
if ($module['macros'] && $module['id_plugin'] == $values['id_plugin']) {
$module_macros = json_decode($module['macros'], true);
$values_macros = json_decode($values['macros'], true);
foreach ($values_macros as $k => $value_macro) {
foreach ($module_macros as $s => $module_macro) {
if ($value_macro['macro'] == $module_macro['macro'] && $value_macro['value'] !== '') {
$module_macros[$s]['value'] = $value_macro['value'];
$module_macros[$s]['desc'] = $value_macro['desc'];
$module_macros[$s]['help'] = $value_macro['help'];
}
}
}
$values['macros'] = json_encode($module_macros);
}
$result = modules_update_agent_module( $result = modules_update_agent_module(
$module['id_agente_modulo'], $module['id_agente_modulo'],
$values, $values,

View File

@ -597,9 +597,10 @@ if ((bool) $id !== false || $new_component
$search_id_group = (int) get_parameter('search_id_group'); $search_id_group = (int) get_parameter('search_id_group');
$search_string = (string) get_parameter('search_string'); $search_string = (string) get_parameter('search_string');
$offset = (int) get_parameter('offset');
$url = ui_get_url_refresh( $url = ui_get_url_refresh(
[ [
'offset' => false, 'offset' => $offset,
'search_string' => $search_string, 'search_string' => $search_string,
'search_id_group' => $search_id_group, 'search_id_group' => $search_id_group,
'id' => $id, 'id' => $id,
@ -607,7 +608,7 @@ $url = ui_get_url_refresh(
true, true,
false false
); );
$name_url = 'index.php?sec=templates&sec2=godmode/modules/manage_network_components';
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters';
@ -712,8 +713,9 @@ $total_components = network_components_get_network_components(
'COUNT(*) AS total' 'COUNT(*) AS total'
); );
$total_components = $total_components[0]['total']; $total_components = $total_components[0]['total'];
ui_pagination($total_components, $url); $offset_delete = ($offset >= ($total_components - 1)) ? ($offset - $config['block_size']) : $offset;
$filter['offset'] = (int) get_parameter('offset'); ui_pagination($total_components, $name_url);
$filter['offset'] = $offset;
$filter['limit'] = (int) $config['block_size']; $filter['limit'] = (int) $config['block_size'];
$components = network_components_get_network_components( $components = network_components_get_network_components(
false, false,
@ -791,7 +793,7 @@ foreach ($components as $component) {
true true
); );
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&pure='.$pure.'">'; $data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&pure='.$pure.'&offset='.$offset.'">';
$data[0] .= io_safe_output($component['name']); $data[0] .= io_safe_output($component['name']);
$data[0] .= '</a>'; $data[0] .= '</a>';
} else { } else {
@ -855,7 +857,7 @@ foreach ($components as $component) {
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
$table->cellclass[][6] = 'action_buttons'; $table->cellclass[][6] = 'action_buttons';
$data[6] = '<a class="inline_line float-left" href="'.$url.'&search_id_group='.$search_id_group.'search_string='.$search_string.'&duplicate_network_component=1&source_id='.$component['id_nc'].'">'.html_print_image( $data[6] = '<a class="inline_line float-left" href="'.$url.'&search_id_group='.$search_id_group.'search_string='.$search_string.'&duplicate_network_component=1&source_id='.$component['id_nc'].'&offset='.$offset.'">'.html_print_image(
'images/copy.png', 'images/copy.png',
true, true,
[ [
@ -864,7 +866,7 @@ foreach ($components as $component) {
'class' => 'invert_filter', 'class' => 'invert_filter',
] ]
).'</a>'; ).'</a>';
$data[6] .= '<a href="'.$url.'&delete_component=1&id='.$component['id_nc'].'&search_id_group='.$search_id_group.'search_string='.$search_string.'" onclick="if (! confirm (\''.__('Are you sure?').'\')) return false" >'.html_print_image( $data[6] .= '<a href="'.$url.'&delete_component=1&id='.$component['id_nc'].'&search_id_group='.$search_id_group.'search_string='.$search_string.'&offset='.$offset_delete.'" onclick="if (! confirm (\''.__('Are you sure?').'\')) return false" >'.html_print_image(
'images/cross.png', 'images/cross.png',
true, true,
[ [
@ -887,7 +889,7 @@ if (isset($data) === true) {
html_print_table($table); html_print_table($table);
ui_pagination( ui_pagination(
$total_components, $total_components,
$url, $name_url,
0, 0,
0, 0,
false, false,

View File

@ -992,7 +992,7 @@ if (($create != '') || ($view != '')) {
echo '<div id="deploy_messages" class="invisible">'; echo '<div id="deploy_messages" class="invisible">';
} }
// The '%s' will be replaced in the javascript code of the function 'show_locked_dialog' // The '%s' will be replaced in the javascript code of the function 'show_locked_dialog'.
echo "<div id='dialog_locked' title='".__('List of modules and components created by "%s" ')."' class='invisible left'>"; echo "<div id='dialog_locked' title='".__('List of modules and components created by "%s" ')."' class='invisible left'>";
echo '</div>'; echo '</div>';
@ -1003,50 +1003,49 @@ ui_require_javascript_file('pandora_modules');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
var locked = <?php echo (int) json_encode((int) $locked); ?>; var locked = <?php echo (int) json_encode((int) $locked); ?>;
function update_preview() { function update_preview() {
var command = $('#form_execute').val(); var command = $('#form_execute').val();
var parameters = $('#form_parameters').val(); var parameters = $('#form_parameters').val();
var i = 1; var i = 1;
while (1) { while (1) {
if ($('#text-field' + i + '_value').val() == undefined) { if ($('#text-field' + i + '_value').val() == undefined) {
break; break;
} }
if ($('#text-field'+i+'_value').val() != '') { if ($('#text-field'+i+'_value').val() != '') {
parameters = parameters parameters = parameters
.replace('_field' + i + '_', .replace('_field' + i + '_',
$('#text-field' + i + '_value').val()); $('#text-field' + i + '_value').val());
} }
i++; i++;
} }
$('#command_preview').html(_.escape(command) + ' ' + _.escape(parameters)); $('#command_preview').html(_.escape(command) + ' ' + _.escape(parameters));
} }
function show_locked_dialog(id_plugin, plugin_name) { function show_locked_dialog(id_plugin, plugin_name) {
var parameters = {}; var parameters = {};
parameters['page'] = "godmode/servers/plugin"; parameters['page'] = "godmode/servers/plugin";
parameters["get_list_modules_and_component_locked_plugin"] = 1; parameters["get_list_modules_and_component_locked_plugin"] = 1;
parameters["id_plugin"] = id_plugin; parameters["id_plugin"] = id_plugin;
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>", url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
data: parameters, data: parameters,
dataType: "html", dataType: "html",
success: function(data) { success: function(data) {
var title = $("#dialog_locked").prop('title').replace(/%s/, plugin_name); var title = 'List of modules and components created by "'+ plugin_name +'"';
$("#dialog_locked") $("#dialog_locked")
.prop('title', title)
.html(data) .html(data)
.dialog ({ .dialog ({
title: title,
resizable: true, resizable: true,
draggable: true, draggable: true,
modal: true, modal: true,
@ -1061,8 +1060,7 @@ ui_require_javascript_file('pandora_modules');
} }
}); });
} }
$(document).ready(function() { $(document).ready(function() {
// Add macro // Add macro
var add_macro_click_event = function (event) { var add_macro_click_event = function (event) {
@ -1092,34 +1090,34 @@ ui_require_javascript_file('pandora_modules');
update_preview(); update_preview();
} }
$('div#delete_macro_button>a').click(delete_macro_click_event); $('div#delete_macro_button>a').click(delete_macro_click_event);
update_preview(); update_preview();
$('.command_component').keyup(function() { $('.command_component').keyup(function() {
update_preview(); update_preview();
}); });
}); });
var add_macro_click_locked_event = function (event) { var add_macro_click_locked_event = function (event) {
var message = '<?php echo __('Some modules or components are using the plugin'); ?>.' var message = '<?php echo __('Some modules or components are using the plugin'); ?>.'
+ '\n' + '<?php echo __('The modules or components should be updated manually or using the bulk operations for plugins after this change'); ?>.' + '\n' + '<?php echo __('The modules or components should be updated manually or using the bulk operations for plugins after this change'); ?>.'
+ '\n' + '\n'
+ '\n' + '<?php echo __('Are you sure you want to perform this action?'); ?>'; + '\n' + '<?php echo __('Are you sure you want to perform this action?'); ?>';
if (!confirm(message)) { if (!confirm(message)) {
event.stopImmediatePropagation(); event.stopImmediatePropagation();
event.preventDefault(); event.preventDefault();
} }
} }
var macros_click_locked_event = function (event) { var macros_click_locked_event = function (event) {
alert("<?php echo __('The plugin macros cannot be updated because some modules or components are using the plugin'); ?>"); alert("<?php echo __('The plugin macros cannot be updated because some modules or components are using the plugin'); ?>");
} }
if (locked) { if (locked) {
$('a#add_macro_btn').click(add_macro_click_locked_event); $('a#add_macro_btn').click(add_macro_click_locked_event);
} }
</script> </script>

View File

@ -151,6 +151,11 @@ if ($update_config == 1 && $config['history_db_enabled'] == 1) {
} }
} }
$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control']));
$total_agents = db_get_value('count(*)', 'tagente');
$disable_agentaccess = ($total_agents >= 200 && $config['agentaccess'] == 0) ? true : false;
$table_status = new StdClass(); $table_status = new StdClass();
$table_status->width = '100%'; $table_status->width = '100%';
$table_status->class = 'databox filters'; $table_status->class = 'databox filters';
@ -261,104 +266,140 @@ $table->data[1][1] = html_print_input(
[ [
'type' => 'number', 'type' => 'number',
'size' => 5, 'size' => 5,
'max' => 99999, 'max' => $performance_variables_control['event_purge']->max,
'name' => 'event_purge', 'name' => 'event_purge',
'value' => $config['event_purge'], 'value' => $config['event_purge'],
'return' => true, 'return' => true,
'min' => ((((bool) $config['history_event_enabled'] === true) && $config['history_event_days'] > 0) ? $config['history_event_days'] + 1 : null), 'min' => $performance_variables_control['event_purge']->min,
'style' => 'width:43px', 'style' => 'width:43px',
] ]
); );
$table->data[2][0] = __('Max. days before delete traps'); $table->data[2][0] = __('Max. days before delete traps');
$table->data[2][1] = html_print_input_text( $table->data[2][1] = html_print_input(
'trap_purge', [
$config['trap_purge'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['trap_purge']->max,
5, 'name' => 'trap_purge',
true 'value' => $config['trap_purge'],
'return' => true,
'min' => $performance_variables_control['trap_purge']->min,
'style' => 'width:43px',
]
); );
$table->data[3][0] = __('Max. days before delete audit events'); $table->data[3][0] = __('Max. days before delete audit events');
$table->data[3][1] = html_print_input_text( $table->data[3][1] = html_print_input(
'audit_purge', [
$config['audit_purge'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['audit_purge']->max,
5, 'name' => 'audit_purge',
true 'value' => $config['audit_purge'],
'return' => true,
'min' => $performance_variables_control['audit_purge']->min,
'style' => 'width:43px',
]
); );
$table->data[4][0] = __('Max. days before delete string data'); $table->data[4][0] = __('Max. days before delete string data');
$table->data[4][1] = html_print_input_text( $table->data[4][1] = html_print_input(
'string_purge', [
$config['string_purge'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['string_purge']->max,
5, 'name' => 'string_purge',
true 'value' => $config['string_purge'],
'return' => true,
'min' => $performance_variables_control['string_purge']->min,
'style' => 'width:43px',
]
); );
$table->data[5][0] = __('Max. days before delete GIS data'); $table->data[5][0] = __('Max. days before delete GIS data');
$table->data[5][1] = html_print_input_text( $table->data[5][1] = html_print_input(
'gis_purge', [
$config['gis_purge'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['gis_purge']->max,
5, 'name' => 'gis_purge',
true 'value' => $config['gis_purge'],
'return' => true,
'min' => $performance_variables_control['gis_purge']->min,
'style' => 'width:43px',
]
); );
$table->data[6][0] = __('Max. days before purge'); $table->data[6][0] = __('Max. days before purge');
$table->data[6][1] = html_print_input_text( $table->data[6][1] = html_print_input(
'days_purge', [
$config['days_purge'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['days_purge']->max,
5, 'name' => 'days_purge',
true 'value' => $config['days_purge'],
'return' => true,
'min' => $performance_variables_control['days_purge']->min,
'style' => 'width:43px',
]
); );
$table->data[7][0] = __('Max. days before compact data'); $table->data[7][0] = __('Max. days before compact data');
$table->data[7][1] = html_print_input_text( $table->data[7][1] = html_print_input(
'days_compact', [
$config['days_compact'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['days_compact']->max,
5, 'name' => 'days_compact',
true 'value' => $config['days_compact'],
'return' => true,
'min' => $performance_variables_control['days_compact']->min,
'style' => 'width:43px',
]
); );
$table->data[8][0] = __('Max. days before delete unknown modules'); $table->data[8][0] = __('Max. days before delete unknown modules');
$table->data[8][1] = html_print_input_text( $table->data[8][1] = html_print_input(
'days_delete_unknown', [
$config['days_delete_unknown'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['days_delete_unknown']->max,
5, 'name' => 'days_delete_unknown',
true 'value' => $config['days_delete_unknown'],
'return' => true,
'min' => $performance_variables_control['days_delete_unknown']->min,
'style' => 'width:43px',
]
); );
$table->data[9][0] = __('Max. days before delete not initialized modules'); $table->data[9][0] = __('Max. days before delete not initialized modules');
$table->data[9][1] = html_print_input_text( $table->data[9][1] = html_print_input(
'days_delete_not_initialized', [
$config['days_delete_not_initialized'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['days_delete_not_initialized']->max,
5, 'name' => 'days_delete_not_initialized',
true 'value' => $config['days_delete_not_initialized'],
'return' => true,
'min' => $performance_variables_control['days_delete_not_initialized']->min,
'style' => 'width:43px',
]
); );
$table->data[10][0] = __('Max. days before delete autodisabled agents'); $table->data[10][0] = __('Max. days before delete autodisabled agents');
$table->data[10][1] = html_print_input_text( $table->data[10][1] = html_print_input(
'days_autodisable_deletion', [
$config['days_autodisable_deletion'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['days_autodisable_deletion']->max,
5, 'name' => 'days_autodisable_deletion',
true 'value' => $config['days_autodisable_deletion'],
'return' => true,
'min' => $performance_variables_control['days_autodisable_deletion']->min,
'style' => 'width:43px',
]
); );
$table->data[11][0] = __('Retention period of past special days'); $table->data[11][0] = __('Retention period of past special days');
@ -499,13 +540,17 @@ $table->data[] = [
$table->data[] = [ $table->data[] = [
__('Max. days before delete old network matrix data'), __('Max. days before delete old network matrix data'),
html_print_input_text( html_print_input(
'delete_old_network_matrix', [
$config['delete_old_network_matrix'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['delete_old_network_matrix']->max,
5, 'name' => 'delete_old_network_matrix',
true 'value' => $config['delete_old_network_matrix'],
'return' => true,
'min' => $performance_variables_control['delete_old_network_matrix']->min,
'style' => 'width:43px',
]
), ),
]; ];
@ -519,13 +564,30 @@ $table_other->size[0] = '70%';
$table_other->size[1] = '30%'; $table_other->size[1] = '30%';
$i = 0; $i = 0;
$table_other->data[$i][0] = __('Item limit for realtime reports'); $table_other->data[$i][0] = __('Item limit for realtime reports');
$table_other->data[$i++][1] = html_print_input_text( $table_other->data[$i++][1] = html_print_input(
'report_limit', [
$config['report_limit'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['report_limit']->max,
5, 'name' => 'report_limit',
true 'value' => $config['report_limit'],
'return' => true,
'min' => $performance_variables_control['report_limit']->min,
'style' => 'width:43px',
]
);
$table_other->data[$i][0] = __('Limit of events per query');
$table_other->data[$i++][1] = html_print_input(
[
'type' => 'number',
'size' => 5,
'max' => 10000,
'name' => 'events_per_query',
'value' => $config['events_per_query'],
'return' => true,
'style' => 'width:50px',
]
); );
$table_other->data[$i][0] = __('Compact interpolation in hours (1 Fine-20 bad)'); $table_other->data[$i][0] = __('Compact interpolation in hours (1 Fine-20 bad)');
@ -549,13 +611,17 @@ $intervals[SECONDS_2WEEK] = __('2 weeks');
$intervals[SECONDS_1MONTH] = __('Last month'); $intervals[SECONDS_1MONTH] = __('Last month');
$table_other->data[$i][0] = __('Default hours for event view'); $table_other->data[$i][0] = __('Default hours for event view');
$table_other->data[$i++][1] = html_print_input_text( $table_other->data[$i++][1] = html_print_input(
'event_view_hr', [
$config['event_view_hr'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['event_view_hr']->max,
5, 'name' => 'event_view_hr',
true 'value' => $config['event_view_hr'],
'return' => true,
'min' => $performance_variables_control['event_view_hr']->min,
'style' => 'width:43px',
]
); );
$table_other->data[$i][0] = __('Use realtime statistics'); $table_other->data[$i][0] = __('Use realtime statistics');
@ -577,7 +643,7 @@ $table_other->data[$i++][1] = html_print_input_text(
); );
$table_other->data[$i][0] = __('Use agent access graph'); $table_other->data[$i][0] = __('Use agent access graph');
$table_other->data[$i++][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true); $table_other->data[$i++][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true, $disable_agentaccess);
$table_other->data[$i][0] = __('Max. recommended number of files in attachment directory'); $table_other->data[$i][0] = __('Max. recommended number of files in attachment directory');
$table_other->data[$i++][1] = html_print_input_text( $table_other->data[$i++][1] = html_print_input_text(
@ -593,23 +659,33 @@ $table_other->data[$i][0] = __('Delete not init modules');
$table_other->data[$i++][1] = html_print_checkbox_switch('delete_notinit', 1, $config['delete_notinit'], true); $table_other->data[$i++][1] = html_print_checkbox_switch('delete_notinit', 1, $config['delete_notinit'], true);
$table_other->data[$i][0] = __('Big Operation Step to purge old data'); $table_other->data[$i][0] = __('Big Operation Step to purge old data');
$table_other->data[$i++][1] = html_print_input_text( $table_other->data[$i++][1] = html_print_input(
'big_operation_step_datos_purge', [
$config['big_operation_step_datos_purge'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['big_operation_step_datos_purge']->max,
5, 'name' => 'big_operation_step_datos_purge',
true 'value' => $config['big_operation_step_datos_purge'],
'return' => true,
'min' => $performance_variables_control['big_operation_step_datos_purge']->min,
'style' => 'width:50px',
]
); );
$table_other->data[$i][0] = __('Small Operation Step to purge old data'); $table_other->data[$i][0] = __('Small Operation Step to purge old data');
$table_other->data[$i++][1] = html_print_input_text( $table_other->data[$i++][1] = html_print_input(
'small_operation_step_datos_purge', [
$config['small_operation_step_datos_purge'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['small_operation_step_datos_purge']->max,
5, 'name' => 'small_operation_step_datos_purge',
true 'value' => $config['small_operation_step_datos_purge'],
'return' => true,
'min' => $performance_variables_control['small_operation_step_datos_purge']->min,
'style' => 'width:50px',
]
); );
$table_other->data[$i][0] = __('Graph container - Max. Items'); $table_other->data[$i][0] = __('Graph container - Max. Items');
@ -633,13 +709,17 @@ $table_other->data[$i++][1] = html_print_input_text(
); );
$table_other->data[$i][0] = __('Row limit in csv log'); $table_other->data[$i][0] = __('Row limit in csv log');
$table_other->data[$i++][1] = html_print_input_text( $table_other->data[$i++][1] = html_print_input(
'row_limit_csv', [
$config['row_limit_csv'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['row_limit_csv']->max,
10, 'name' => 'row_limit_csv',
true 'value' => $config['row_limit_csv'],
'return' => true,
'min' => $performance_variables_control['row_limit_csv']->min,
'style' => 'width:63px',
]
); );
$table_other->data[$i][0] = __('SNMP walk binary'); $table_other->data[$i][0] = __('SNMP walk binary');

View File

@ -47,6 +47,8 @@ if (is_ajax()) {
exit(); exit();
} }
$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control']));
$table = new StdClass(); $table = new StdClass();
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->id = 'setup_general'; $table->id = 'setup_general';
@ -512,13 +514,17 @@ $table->data[$i++][1] = html_print_checkbox_switch(
); );
$table->data[$i][0] = __('Limit for bulk operations'); $table->data[$i][0] = __('Limit for bulk operations');
$table->data[$i++][1] = html_print_input_text( $table->data[$i++][1] = html_print_input(
'limit_parameters_massive', [
$config['limit_parameters_massive'], 'type' => 'number',
'', 'size' => 5,
10, 'max' => $performance_variables_control['limit_parameters_massive']->max,
10, 'name' => 'limit_parameters_massive',
true 'value' => $config['limit_parameters_massive'],
'return' => true,
'min' => $performance_variables_control['limit_parameters_massive']->min,
'style' => 'width:50px',
]
); );
$table->data[$i][0] = __('Include agents manually disabled'); $table->data[$i][0] = __('Include agents manually disabled');

View File

@ -53,6 +53,8 @@ $row = 0;
echo '<form id="form_setup" method="post">'; echo '<form id="form_setup" method="post">';
html_print_input_hidden('update_config', 1); html_print_input_hidden('update_config', 1);
$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control']));
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// BEHAVIOUR CONFIGURATION // BEHAVIOUR CONFIGURATION
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@ -64,7 +66,18 @@ $table_behaviour->size[0] = '50%';
$table_behaviour->data = []; $table_behaviour->data = [];
$table_behaviour->data[$row][0] = __('Block size for pagination'); $table_behaviour->data[$row][0] = __('Block size for pagination');
$table_behaviour->data[$row][1] = html_print_input_text('block_size', $config['global_block_size'], '', 5, 5, true); $table_behaviour->data[$row][1] = html_print_input(
[
'type' => 'number',
'size' => 5,
'max' => $performance_variables_control['block_size']->max,
'name' => 'block_size',
'value' => $config['global_block_size'],
'return' => true,
'min' => $performance_variables_control['block_size']->min,
'style' => 'width:50px',
]
);
$row++; $row++;
$values = []; $values = [];
@ -823,16 +836,19 @@ if (enterprise_installed() === false) {
} }
$table_chars->data[$row][0] = __('Data precision'); $table_chars->data[$row][0] = __('Data precision');
$table_chars->data[$row][1] = html_print_input_text( $table_chars->data[$row][1] = html_print_input(
'graph_precision', [
$config['graph_precision'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['graph_precision']->max,
5, 'name' => 'graph_precision',
true, 'value' => $config['graph_precision'],
$disabled_graph_precision, 'return' => true,
false, 'min' => $performance_variables_control['graph_precision']->min,
'onChange="change_precision()"' 'style' => 'width:50px',
($disabled_graph_precision) ? 'readonly' : '' => 'readonly',
'onchange' => 'change_precision()',
]
); );
$row++; $row++;
@ -841,17 +857,21 @@ if (isset($config['short_module_graph_data']) === false) {
} }
$table_chars->data[$row][0] = __('Data precision in graphs'); $table_chars->data[$row][0] = __('Data precision in graphs');
$table_chars->data[$row][1] = html_print_input_text( $table_chars->data[$row][1] = html_print_input(
'short_module_graph_data', [
$config['short_module_graph_data'], 'type' => 'number',
'', 'size' => 5,
5, 'max' => $performance_variables_control['short_module_graph_data']->max,
5, 'name' => 'short_module_graph_data',
true, 'value' => $config['short_module_graph_data'],
$disabled_graph_precision, 'return' => true,
false, 'min' => $performance_variables_control['short_module_graph_data']->min,
'onChange="change_precision()"' 'style' => 'width:50px',
($disabled_graph_precision) ? 'readonly' : '' => 'readonly',
'onchange' => 'change_precision()',
]
); );
$row++; $row++;
$table_chars->data[$row][0] = __( $table_chars->data[$row][0] = __(

View File

@ -207,14 +207,14 @@ if (empty($tag_name) === false) {
// If the user has filtered the view. // If the user has filtered the view.
$filter_performed = !empty($filter); $filter_performed = !empty($filter);
$offset = (int) get_parameter('offset');
$filter['offset'] = (int) get_parameter('offset'); $filter['offset'] = $offset;
$filter['limit'] = (int) $config['block_size']; $filter['limit'] = (int) $config['block_size'];
// Statements for pagination. // Statements for pagination.
$url = ui_get_url_refresh(); $url = 'index.php?sec=gusuarios&sec2=godmode/tag/tag';
$total_tags = tags_get_tag_count($filter); $total_tags = tags_get_tag_count($filter);
$offset_delete = ($offset >= ($total_tags - 1)) ? ($offset - $config['block_size']) : $offset;
$result = tags_search_tag(false, $filter); $result = tags_search_tag(false, $filter);
// Filter form. // Filter form.
@ -392,7 +392,7 @@ if (empty($result) === false) {
] ]
); );
$data[6] .= '</a>'; $data[6] .= '</a>';
$data[6] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/tag/tag&delete_tag='.$tag['id_tag'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image( $data[6] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/tag/tag&delete_tag='.$tag['id_tag'].'&offset='.$offset_delete.'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image(
'images/cross.png', 'images/cross.png',
true, true,
[ [

View File

@ -816,7 +816,7 @@ foreach ($info as $user_id => $user_info) {
$toDoClass = 'filter_none'; $toDoClass = 'filter_none';
} }
$data[6] = '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'" class="inline">'; $data[6] = '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'&offset='.$offset.'" class="inline">';
$data[6] .= html_print_input_hidden( $data[6] .= html_print_input_hidden(
'id', 'id',
$user_info['id_user'], $user_info['id_user'],
@ -874,7 +874,8 @@ foreach ($info as $user_id => $user_info) {
&& $user_info['id_user'] != $config['id_user'] && $user_info['id_user'] != $config['id_user']
&& isset($user_info['not_delete']) === false && isset($user_info['not_delete']) === false
) { ) {
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'" class="inline">'; $offset_delete = ($offset >= count($info) - 1) ? ($offset - $config['block_size']) : $offset;
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'&offset='.$offset_delete.'" class="inline">';
$data[6] .= html_print_input_hidden( $data[6] .= html_print_input_hidden(
'delete_user', 'delete_user',
$user_info['id_user'], $user_info['id_user'],

View File

@ -955,29 +955,42 @@ class DiscoveryTaskList extends HTML
) )
) { ) {
if ($ipam === true) { if ($ipam === true) {
$data[9] .= '<a href="'.ui_get_full_url( if (empty($tipam_task_id) === false) {
sprintf( $data[9] .= '<a href="'.ui_get_full_url(
'index.php?sec=gextensions&sec2=enterprise/tools/ipam/ipam&action=edit&id=%d', sprintf(
$tipam_task_id 'index.php?sec=gextensions&sec2=enterprise/tools/ipam/ipam&action=edit&id=%d',
) $tipam_task_id
).'">'.html_print_image( )
'images/config.png', ).'">'.html_print_image(
true, 'images/config.png',
[ true,
'title' => __('Edit task'), [
'class' => 'invert_filter', 'title' => __('Edit task'),
] 'class' => 'invert_filter',
).'</a>'; ]
$data[9] .= '<a href="'.ui_get_full_url( ).'</a>';
'index.php?sec=gextensions&sec2=enterprise/tools/ipam/ipam&action=delete&id='.$tipam_task_id $data[9] .= '<a href="'.ui_get_full_url(
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image( 'index.php?sec=gextensions&sec2=enterprise/tools/ipam/ipam&action=delete&id='.$tipam_task_id
'images/cross.png', ).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
true, 'images/cross.png',
[ true,
'title' => __('Delete task'), [
'class' => 'invert_filter', 'title' => __('Delete task'),
] 'class' => 'invert_filter',
).'</a>'; ]
).'</a>';
} else {
$data[9] .= '<a href="'.ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
'images/cross.png',
true,
[
'title' => __('Delete task'),
'class' => 'invert_filter',
]
).'</a>';
}
} else { } else {
// Check if is a H&D, Cloud or Application or IPAM. // Check if is a H&D, Cloud or Application or IPAM.
$data[9] .= '<a href="'.ui_get_full_url( $data[9] .= '<a href="'.ui_get_full_url(

View File

@ -96,7 +96,10 @@ class AuditLog extends HTML
// Datatables list. // Datatables list.
try { try {
$columns = [ $columns = [
'id_usuario', [
'text' => 'id_usuario',
'class' => 'w50px',
],
'accion', 'accion',
'fecha', 'fecha',
'ip_origen', 'ip_origen',
@ -116,11 +119,11 @@ class AuditLog extends HTML
$columns, $columns,
[ [
'text' => 'security', 'text' => 'security',
'class' => 'w80px action_buttons show_security_info', 'class' => 'w50px action_buttons show_security_info',
], ],
[ [
'text' => 'action', 'text' => 'action',
'class' => 'w80px action_buttons show_extended_info', 'class' => 'w50px action_buttons show_extended_info',
] ]
); );
@ -199,16 +202,28 @@ class AuditLog extends HTML
[ [
'label' => __('Free search').ui_print_help_tip(__('Search filter by User, Action, Date, Source IP or Comments fields content'), true), 'label' => __('Free search').ui_print_help_tip(__('Search filter by User, Action, Date, Source IP or Comments fields content'), true),
'type' => 'text', 'type' => 'text',
'class' => 'w200px', 'class' => 'w150px',
'id' => 'filter_text', 'id' => 'filter_text',
'name' => 'filter_text', 'name' => 'filter_text',
], ],
[ [
'label' => __('Max. hours old'), 'label' => __('Max. hours old'),
'type' => 'text', 'type' => 'select',
'class' => 'w100px', 'class' => 'w20px',
'id' => 'filter_period', 'select2_enable' => true,
'name' => 'filter_period', 'sort' => false,
'selected' => 168,
'fields' => [
24 => __('1 day'),
168 => __('7 days'),
360 => __('15 days'),
744 => __('1 month'),
2160 => __('3 months'),
4320 => __('6 months'),
8760 => __('1 Year'),
],
'id' => 'filter_period',
'name' => 'filter_period',
], ],
[ [
'label' => __('IP'), 'label' => __('IP'),
@ -223,7 +238,7 @@ class AuditLog extends HTML
'nothing' => __('All'), 'nothing' => __('All'),
'nothing_value' => '-1', 'nothing_value' => '-1',
'sql' => 'SELECT DISTINCT(accion), accion AS text FROM tsesion', 'sql' => 'SELECT DISTINCT(accion), accion AS text FROM tsesion',
'class' => 'mw250px', 'class' => 'mw200px',
'id' => 'filter_type', 'id' => 'filter_type',
'name' => 'filter_type', 'name' => 'filter_type',
], ],
@ -235,7 +250,7 @@ class AuditLog extends HTML
'sql' => 'SELECT id_user, id_user AS text FROM tusuario UNION SELECT "SYSTEM" 'sql' => 'SELECT id_user, id_user AS text FROM tusuario UNION SELECT "SYSTEM"
AS id_user, "SYSTEM" AS text UNION SELECT "N/A" AS id_user, "SYSTEM" AS text UNION SELECT "N/A"
AS id_user, "N/A" AS text', AS id_user, "N/A" AS text',
'class' => 'mw250px', 'class' => 'mw200px',
'id' => 'filter_user', 'id' => 'filter_user',
'name' => 'filter_user', 'name' => 'filter_user',
], ],
@ -346,9 +361,12 @@ class AuditLog extends HTML
).ui_print_timestamp($tmp->utimestamp, true); ).ui_print_timestamp($tmp->utimestamp, true);
if (enterprise_installed() === true) { if (enterprise_installed() === true) {
$tmp->security = enterprise_hook('cell1EntepriseAudit', [$tmp->id_sesion]); $extendedInfo = enterprise_hook('rowEnterpriseAudit', [$tmp->id_sesion]);
$tmp->action = enterprise_hook('cell2EntepriseAudit', []); if (empty($extendedInfo) === false) {
$tmp->extendedInfo = enterprise_hook('rowEnterpriseAudit', [$tmp->id_sesion]); $tmp->security = enterprise_hook('cell1EntepriseAudit', [$tmp->id_sesion]);
$tmp->action = enterprise_hook('cell2EntepriseAudit', []);
$tmp->extendedInfo = $extendedInfo;
}
} }
$carry[] = $tmp; $carry[] = $tmp;

View File

@ -248,6 +248,11 @@ class ConsoleSupervisor
$this->checkAuditLogOldLocation(); $this->checkAuditLogOldLocation();
/*
* Check if performance variables are corrects
*/
$this->checkPerformanceVariables();
/* /*
* Checks if sync queue is longer than limits. * Checks if sync queue is longer than limits.
* NOTIF.SYNCQUEUE.LENGTH * NOTIF.SYNCQUEUE.LENGTH
@ -258,14 +263,21 @@ class ConsoleSupervisor
$this->checkSyncQueueStatus(); $this->checkSyncQueueStatus();
} }
/* /*
* Checkc agent missing libraries. * Check number of agents is equals and more than 200.
* NOTIF.AGENT.LIBRARY * NOTIF.ACCESSSTASTICS.PERFORMANCE
*/ */
$this->checkAccessStatisticsPerformance();
/*
* Checkc agent missing libraries.
* NOTIF.AGENT.LIBRARY
*/
if ((bool) enterprise_installed() === true) { if ((bool) enterprise_installed() === true) {
$this->checkLibaryError(); $this->checkLibaryError();
} }
} }
@ -517,6 +529,11 @@ class ConsoleSupervisor
$this->checkAuditLogOldLocation(); $this->checkAuditLogOldLocation();
/*
* Check if performance variables are corrects
*/
$this->checkPerformanceVariables();
/* /*
* Checks if sync queue is longer than limits. * Checks if sync queue is longer than limits.
* NOTIF.SYNCQUEUE.LENGTH * NOTIF.SYNCQUEUE.LENGTH
@ -527,13 +544,107 @@ class ConsoleSupervisor
$this->checkSyncQueueStatus(); $this->checkSyncQueueStatus();
} }
/*
* Check number of agents is equals and more than 200.
* NOTIF.ACCESSSTASTICS.PERFORMANCE
*/
$this->checkAccessStatisticsPerformance();
/* /*
* Checkc agent missing libraries. * Checkc agent missing libraries.
* NOTIF.AGENT.LIBRARY * NOTIF.AGENT.LIBRARY
*/ */
if ((bool) enterprise_installed() === true) { if ((bool) enterprise_installed() === true) {
$this->checkLibaryError(); $this->checkLibaryError();
} }
}
/**
* Check if performance variables are corrects
*
* @return void
*/
public function checkPerformanceVariables()
{
global $config;
$names = [
'event_purge' => 'Max. days before events are deleted',
'trap_purge' => 'Max. days before traps are deleted',
'audit_purge' => 'Max. days before audited events are deleted',
'string_purge' => 'Max. days before string data is deleted',
'gis_purge' => 'Max. days before GIS data is deleted',
'days_purge' => 'Max. days before purge',
'days_compact' => 'Max. days before data is compacted',
'days_delete_unknown' => 'Max. days before unknown modules are deleted',
'days_delete_not_initialized' => 'Max. days before delete not initialized modules',
'days_autodisable_deletion' => 'Max. days before autodisabled agents are deleted',
'delete_old_network_matrix' => 'Max. days before delete old network matrix data',
'report_limit' => 'Item limit for real-time reports',
'event_view_hr' => 'Default hours for event view',
'big_operation_step_datos_purge' => 'Big Operation Step to purge old data',
'small_operation_step_datos_purge' => 'Small Operation Step to purge old data',
'row_limit_csv' => 'Row limit in csv log',
'limit_parameters_massive' => 'Limit for bulk operations',
'block_size' => 'Block size for pagination',
'short_module_graph_data' => 'Data precision',
'graph_precision' => 'Data precision in graphs',
];
$variables = (array) json_decode(io_safe_output($config['performance_variables_control']));
foreach ($variables as $variable => $values) {
if (empty($config[$variable]) === true || $config[$variable] === '') {
continue;
}
$message = '';
$limit_value = '';
if ($config[$variable] > $values->max) {
$message = 'Check the setting of %s, a value greater than %s is not recommended';
$limit_value = $values->max;
}
if ($config[$variable] < $values->min) {
$message = 'Check the setting of %s, a value less than %s is not recommended';
$limit_value = $values->min;
}
if ($limit_value !== '' && $message !== '') {
if (is_metaconsole() === true) {
$this->notify(
[
'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable,
'title' => __('Incorrect config value'),
'message' => __(
$message,
$names[$variable],
$limit_value
),
'url' => '__url__index.php?sec=advanced&sec2=advanced/metasetup',
]
);
} else {
$this->notify(
[
'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable,
'title' => __('Incorrect config value'),
'message' => __(
$message,
$names[$variable],
$limit_value
),
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup',
]
);
}
}
}
} }
@ -548,6 +659,34 @@ class ConsoleSupervisor
} }
/**
* Check number of agents and disable agentaccess token if number
* is equals and more than 200.
*
* @return void
*/
public function checkAccessStatisticsPerformance()
{
$total_agents = db_get_value('count(*)', 'tagente');
if ($total_agents >= 200) {
db_process_sql_update('tconfig', ['value' => 0], ['token' => 'agentaccess']);
$this->notify(
[
'type' => 'NOTIF.ACCESSSTASTICS.PERFORMANCE',
'title' => __('Access statistics performance'),
'message' => __(
'Usage of agent access statistics IS NOT RECOMMENDED on systems with more than 200 agents due performance penalty'
),
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=perf',
]
);
} else {
$this->cleanNotifications('NOTIF.ACCESSSTASTICS.PERFORMANCE');
}
}
/** /**
* Update targets for given notification using object targets. * Update targets for given notification using object targets.
* *

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC230222'; $build_version = 'PC230228';
$pandora_version = 'v7.0NG.769'; $pandora_version = 'v7.0NG.769';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -11071,20 +11071,55 @@ function api_set_event_validate_filter($trash1, $trash2, $other, $trash3)
function api_set_validate_events($id_event, $trash1, $other, $return_type, $user_in_db) function api_set_validate_events($id_event, $trash1, $other, $return_type, $user_in_db)
{ {
$text = $other['data']; $node_int = 0;
if ($other['type'] == 'string') {
returnError('Parameter error.');
return;
} else if ($other['type'] == 'array') {
$text = $other['data'][0];
if (is_metaconsole() === true) {
if (isset($other['data'][1]) === true
&& empty($other['data'][1]) === false
) {
$node_int = $other['data'][1];
}
}
}
// Set off the standby mode when close an event try {
$event = events_get_event($id_event); if (is_metaconsole() === true
alerts_agent_module_standby($event['id_alert_am'], 0); && (int) $node_int > 0
) {
$node = new Node($node_int);
$node->connect();
}
$result = events_change_status($id_event, EVENT_VALIDATE); // Set off the standby mode when close an event
$event = events_get_event($id_event);
alerts_agent_module_standby($event['id_alert_am'], 0);
$result = events_change_status($id_event, EVENT_VALIDATE);
if ($result) {
if (!empty($text)) { if (!empty($text)) {
// Set the comment for the validation // Set the comment for the validation
events_comment($id_event, $text); events_comment($id_event, $text);
} }
} catch (\Exception $e) {
if (is_metaconsole() === true
&& $node_int > 0
) {
$node->disconnect();
}
$result = false;
} finally {
if (is_metaconsole() === true
&& $node_int > 0
) {
$node->disconnect();
}
}
if ($result) {
returnData( returnData(
'string', 'string',
[ [

View File

@ -844,6 +844,10 @@ function config_update_config()
$error_update[] = __('Item limit for realtime reports)'); $error_update[] = __('Item limit for realtime reports)');
} }
if (config_update_value('events_per_query', (int) get_parameter('events_per_query'), true) === false) {
$error_update[] = __('Limit of events per query');
}
if (config_update_value('step_compact', (int) get_parameter('step_compact'), true) === false) { if (config_update_value('step_compact', (int) get_parameter('step_compact'), true) === false) {
$error_update[] = __('Compact interpolation in hours (1 Fine-20 bad)'); $error_update[] = __('Compact interpolation in hours (1 Fine-20 bad)');
} }
@ -1982,6 +1986,10 @@ function config_process_config()
config_update_value('report_limit', 100); config_update_value('report_limit', 100);
} }
if (!isset($config['events_per_query'])) {
config_update_value('events_per_query', 5000);
}
if (!isset($config['loginhash_pwd'])) { if (!isset($config['loginhash_pwd'])) {
config_update_value('loginhash_pwd', io_input_password((rand(0, 1000) * rand(0, 1000)).'pandorahash')); config_update_value('loginhash_pwd', io_input_password((rand(0, 1000) * rand(0, 1000)).'pandorahash'));
} }
@ -2289,6 +2297,96 @@ function config_process_config()
config_update_value('2Fa_auth', ''); config_update_value('2Fa_auth', '');
} }
if (isset($config['performance_variables_control']) === false) {
config_update_value(
'performance_variables_control',
json_encode(
[
'event_purge' => [
'max' => 45,
'min' => 1,
],
'trap_purge' => [
'max' => 45,
'min' => 1,
],
'audit_purge' => [
'max' => 365,
'min' => 7,
],
'string_purge' => [
'max' => 365,
'min' => 7,
],
'gis_purge' => [
'max' => 365,
'min' => 7,
],
'days_purge' => [
'max' => 365,
'min' => 7,
],
'days_compact' => [
'max' => 365,
'min' => 0,
],
'days_delete_unknown' => [
'max' => 90,
'min' => 0,
],
'days_delete_not_initialized' => [
'max' => 90,
'min' => 0,
],
'days_autodisable_deletion' => [
'max' => 90,
'min' => 0,
],
'delete_old_network_matrix' => [
'max' => 30,
'min' => 1,
],
'report_limit' => [
'max' => 500,
'min' => 1,
],
'event_view_hr' => [
'max' => 360,
'min' => 1,
],
'big_operation_step_datos_purge' => [
'max' => 10000,
'min' => 100,
],
'small_operation_step_datos_purge' => [
'max' => 10000,
'min' => 100,
],
'row_limit_csv' => [
'max' => 1000000,
'min' => 1,
],
'limit_parameters_massive' => [
'max' => 2000,
'min' => 100,
],
'block_size' => [
'max' => 200,
'min' => 10,
],
'short_module_graph_data' => [
'max' => 20,
'min' => 1,
],
'graph_precision' => [
'max' => 5,
'min' => 1,
],
]
)
);
}
if (isset($config['agent_wizard_defaults']) === false) { if (isset($config['agent_wizard_defaults']) === false) {
config_update_value( config_update_value(
'agent_wizard_defaults', 'agent_wizard_defaults',

View File

@ -2018,7 +2018,7 @@ function events_change_status(
// Update ack info if the new status is validated. // Update ack info if the new status is validated.
$ack_utimestamp = 0; $ack_utimestamp = 0;
$ack_user = $config['id_user']; $ack_user = $config['id_user'];
if ((int) $new_status === EVENT_STATUS_VALIDATED) { if ((int) $new_status === EVENT_STATUS_VALIDATED || (int) $new_status === EVENT_STATUS_INPROCESS) {
$ack_utimestamp = time(); $ack_utimestamp = time();
} }
@ -4814,7 +4814,7 @@ function events_page_general($event)
$data = []; $data = [];
$data[0] = __('Acknowledged by'); $data[0] = __('Acknowledged by');
if ($event['estado'] == 1) { if ($event['estado'] == 1 || $event['estado'] == 2) {
if (empty($event['id_usuario']) === true) { if (empty($event['id_usuario']) === true) {
$user_ack = __('Autovalidated'); $user_ack = __('Autovalidated');
} else { } else {
@ -4948,7 +4948,7 @@ function events_page_general_acknowledged($event_id)
global $config; global $config;
$Acknowledged = ''; $Acknowledged = '';
$event = db_get_row('tevento', 'id_evento', $event_id); $event = db_get_row('tevento', 'id_evento', $event_id);
if ($event !== false && $event['estado'] == 1) { if ($event !== false && ($event['estado'] == 1 || $event['estado'] == 2)) {
$user_ack = db_get_value( $user_ack = db_get_value(
'fullname', 'fullname',
'tusuario', 'tusuario',

View File

@ -159,6 +159,8 @@ function notifications_get_subtypes(?string $source=null)
'NOTIF.SERVER.STATUS', 'NOTIF.SERVER.STATUS',
'NOTIF.SERVER.QUEUE', 'NOTIF.SERVER.QUEUE',
'NOTIF.SERVER.MASTER', 'NOTIF.SERVER.MASTER',
'NOTIF.ACCESSSTASTICS.PERFORMANCE',
'NOTIF.VARIABLES.PERFORMANCE',
], ],
]; ];

View File

@ -696,6 +696,8 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=reporting&sec2=operation/cluster/cluster&op=update&id='.$cluster->id().'">'; $go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=reporting&sec2=operation/cluster/cluster&op=update&id='.$cluster->id().'">';
$go_to_agent .= html_print_submit_button(__('Go to cluster edition'), 'upd_button', false, 'class="sub config"', true); $go_to_agent .= html_print_submit_button(__('Go to cluster edition'), 'upd_button', false, 'class="sub config"', true);
} else { } else {
$go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.$ent.'&status_hierachy_mode_sent=1&moduletype=dataserver&edit_module=1&updbutton=Create&sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente=2">';
$go_to_agent .= html_print_submit_button(__('Go to module creation'), 'upd_button', false, 'class="sub config"', true);
$go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$ent.'">'; $go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$ent.'">';
$go_to_agent .= html_print_submit_button(__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true); $go_to_agent .= html_print_submit_button(__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
} }

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'> <div style='padding-bottom: 50px'>
<?php <?php
$version = '7.0NG.769'; $version = '7.0NG.769';
$build = '230222'; $build = '230228';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -1471,6 +1471,12 @@ if (!empty($result)) {
$table->align[11] = 'left'; $table->align[11] = 'left';
} }
if (check_acl($config['id_user'], 0, 'AR')) {
$actions_list = true;
$table->head[12] = __('Actions');
$table->align[12] = 'left';
}
$id_type_web_content_string = db_get_value( $id_type_web_content_string = db_get_value(
'id_tipo', 'id_tipo',
'ttipo_modulo', 'ttipo_modulo',
@ -1591,31 +1597,6 @@ if (!empty($result)) {
if (in_array('data_type', $show_fields) || is_metaconsole()) { if (in_array('data_type', $show_fields) || is_metaconsole()) {
$data[2] = html_print_image('images/'.modules_show_icon_type($row['module_type']), true, ['class' => 'invert_filter']); $data[2] = html_print_image('images/'.modules_show_icon_type($row['module_type']), true, ['class' => 'invert_filter']);
$agent_groups = is_metaconsole() ? $row['groups_in_server'] : agents_get_all_groups_agent($row['id_agent'], $row['id_group']); $agent_groups = is_metaconsole() ? $row['groups_in_server'] : agents_get_all_groups_agent($row['id_agent'], $row['id_group']);
if (check_acl_one_of_groups($config['id_user'], $agent_groups, 'AW')) {
$show_edit_icon = true;
if (defined('METACONSOLE')) {
if (!can_user_access_node()) {
$show_edit_icon = false;
}
$url_edit_module = $row['server_url'].'index.php?'.'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'id_agente='.$row['id_agent'].'&'.'tab=module&'.'id_agent_module='.$row['id_agente_modulo'].'&'.'edit_module=1'.'&loginhash=auto&loginhash_data='.$row['hashdata'].'&loginhash_user='.str_rot13($row['user']);
} else {
$url_edit_module = 'index.php?'.'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'id_agente='.$row['id_agent'].'&'.'tab=module&'.'id_agent_module='.$row['id_agente_modulo'].'&'.'edit_module=1';
}
if ($show_edit_icon) {
$table->cellclass[][2] = 'action_buttons';
$data[2] .= '<a href="'.$url_edit_module.'">'.html_print_image(
'images/config.png',
true,
[
'alt' => '0',
'border' => '',
'title' => __('Edit'),
]
).'</a>';
}
}
} }
if (in_array('module_name', $show_fields) || is_metaconsole()) { if (in_array('module_name', $show_fields) || is_metaconsole()) {
@ -2091,6 +2072,39 @@ if (!empty($result)) {
$data[11] = ui_print_timestamp($row['utimestamp'], true, $option); $data[11] = ui_print_timestamp($row['utimestamp'], true, $option);
} }
if (check_acl_one_of_groups($config['id_user'], $agent_groups, 'AW')) {
if (defined('METACONSOLE')) {
$url_edit_module = $row['server_url'].'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&';
$url_edit_module .= 'loginhash=auto&id_agente='.$row['id_agent'];
$url_edit_module .= '&tab=module&id_agent_module='.$row['id_agente_modulo'].'&edit_module=1&';
$url_edit_module .= 'loginhash_data='.$row['hashdata'].'&loginhash_user='.str_rot13($row['user']);
$url_delete_module = $row['server_url'].'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente';
$url_delete_module .= '&id_agente='.$row['id_agent'].'&delete_module='.$row['id_agente_modulo'];
$table->cellclass[][2] = 'action_buttons';
$data[12] .= '<a href="'.$url_edit_module.'">'.html_print_image(
'images/config.png',
true,
[
'alt' => '0',
'border' => '',
'title' => __('Edit'),
]
).'</a>';
$onclick = 'onclick="javascript: if (!confirm(\''.__('Are you sure to delete?').'\')) return false;';
$data[12] .= '<a href="'.$url_delete_module.'" '.$onclick.'" target="_blank">'.html_print_image(
'images/delete.png',
true,
[
'alt' => '0',
'border' => '',
'title' => __('Delete'),
]
).'</a>';
}
}
array_push($table->data, $data); array_push($table->data, $data);
} }

View File

@ -239,6 +239,13 @@ $server_id = get_parameter(
($filter['server_id'] ?? '') ($filter['server_id'] ?? '')
); );
if (empty($id_agent) === true) {
$id_agent = get_parameter(
'id_agent',
($filter['id_agent'] ?? '')
);
}
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$servers = metaconsole_get_servers(); $servers = metaconsole_get_servers();
if (is_array($servers) === true) { if (is_array($servers) === true) {

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230222 %define release 230228
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230222 %define release 230228
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230222 %define release 230228
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -557,7 +557,8 @@ CREATE TABLE IF NOT EXISTS `talert_template_modules` (
FOREIGN KEY (`id_alert_template`) REFERENCES talert_templates(`id`) FOREIGN KEY (`id_alert_template`) REFERENCES talert_templates(`id`)
ON DELETE CASCADE ON UPDATE CASCADE, ON DELETE CASCADE ON UPDATE CASCADE,
UNIQUE (`id_agent_module`, `id_alert_template`, `id_policy_alerts`), UNIQUE (`id_agent_module`, `id_alert_template`, `id_policy_alerts`),
INDEX force_execution (`force_execution`) INDEX force_execution (`force_execution`),
INDEX idx_disabled (disabled)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- ----------------------------------------------------- -- -----------------------------------------------------
@ -719,7 +720,8 @@ CREATE TABLE IF NOT EXISTS `tevento` (
PRIMARY KEY (`id_evento`), PRIMARY KEY (`id_evento`),
KEY `idx_agente` (`id_agente`), KEY `idx_agente` (`id_agente`),
KEY `idx_agentmodule` (`id_agentmodule`), KEY `idx_agentmodule` (`id_agentmodule`),
KEY `idx_utimestamp` USING BTREE (`utimestamp`) KEY `idx_utimestamp` USING BTREE (`utimestamp`),
INDEX `agente_modulo_estado`(`estado`, `id_agentmodule`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- Criticity: 0 - Maintance (grey) -- Criticity: 0 - Maintance (grey)
-- Criticity: 1 - Informational (blue) -- Criticity: 1 - Informational (blue)

View File

@ -1165,6 +1165,7 @@ INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (1, 'Monitoring&#x
INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (2, 'Monitoring&#x20;Report&#x20;Modules', 'select&#x20;&#40;select&#x20;tagente.alias&#x20;from&#x20;tagente&#x20;where&#x20;tagente.id_agente&#x20;=&#x20;tagente_modulo.id_agente&#41;&#x20;as&#x20;agent_nombre,&#x20;nombre&#x20;,&#x20;&#40;select&#x20;tmodule_group.name&#x20;from&#x20;tmodule_group&#x20;where&#x20;tmodule_group.id_mg&#x20;=&#x20;tagente_modulo.id_module_group&#41;&#x20;as&#x20;module_group,&#x20;module_interval&#x20;from&#x20;tagente_modulo&#x20;where&#x20;delete_pending&#x20;=&#x20;0&#x20;order&#x20;by&#x20;nombre;'); INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (2, 'Monitoring&#x20;Report&#x20;Modules', 'select&#x20;&#40;select&#x20;tagente.alias&#x20;from&#x20;tagente&#x20;where&#x20;tagente.id_agente&#x20;=&#x20;tagente_modulo.id_agente&#41;&#x20;as&#x20;agent_nombre,&#x20;nombre&#x20;,&#x20;&#40;select&#x20;tmodule_group.name&#x20;from&#x20;tmodule_group&#x20;where&#x20;tmodule_group.id_mg&#x20;=&#x20;tagente_modulo.id_module_group&#41;&#x20;as&#x20;module_group,&#x20;module_interval&#x20;from&#x20;tagente_modulo&#x20;where&#x20;delete_pending&#x20;=&#x20;0&#x20;order&#x20;by&#x20;nombre;');
INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (3, 'Monitoring&#x20;Report&#x20;Alerts', 'select&#x20;t1.alias&#x20;as&#x20;agent_name,&#x20;t2.nombre&#x20;as&#x20;module_name,&#x20;&#40;select&#x20;talert_templates.name&#x20;from&#x20;talert_templates&#x20;where&#x20;talert_templates.id&#x20;=&#x20;t3.id_alert_template&#41;&#x20;as&#x20;template,&#x20;&#40;select&#x20;group_concat&#40;t02.name&#41;&#x20;from&#x20;talert_template_module_actions&#x20;as&#x20;t01&#x20;inner&#x20;join&#x20;talert_actions&#x20;as&#x20;t02&#x20;on&#x20;t01.id_alert_action&#x20;=&#x20;t02.id&#x20;where&#x20;t01.id_alert_template_module&#x20;=&#x20;t3.id&#x20;group&#x20;by&#x20;t01.id_alert_template_module&#41;&#x20;as&#x20;actions&#x20;from&#x20;tagente&#x20;as&#x20;t1&#x20;inner&#x20;join&#x20;tagente_modulo&#x20;as&#x20;t2&#x20;on&#x20;t1.id_agente&#x20;=&#x20;t2.id_agente&#x20;inner&#x20;join&#x20;talert_template_modules&#x20;as&#x20;t3&#x20;on&#x20;t2.id_agente_modulo&#x20;=&#x20;t3.id_agent_module&#x20;order&#x20;by&#x20;agent_name,&#x20;module_name;'); INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (3, 'Monitoring&#x20;Report&#x20;Alerts', 'select&#x20;t1.alias&#x20;as&#x20;agent_name,&#x20;t2.nombre&#x20;as&#x20;module_name,&#x20;&#40;select&#x20;talert_templates.name&#x20;from&#x20;talert_templates&#x20;where&#x20;talert_templates.id&#x20;=&#x20;t3.id_alert_template&#41;&#x20;as&#x20;template,&#x20;&#40;select&#x20;group_concat&#40;t02.name&#41;&#x20;from&#x20;talert_template_module_actions&#x20;as&#x20;t01&#x20;inner&#x20;join&#x20;talert_actions&#x20;as&#x20;t02&#x20;on&#x20;t01.id_alert_action&#x20;=&#x20;t02.id&#x20;where&#x20;t01.id_alert_template_module&#x20;=&#x20;t3.id&#x20;group&#x20;by&#x20;t01.id_alert_template_module&#41;&#x20;as&#x20;actions&#x20;from&#x20;tagente&#x20;as&#x20;t1&#x20;inner&#x20;join&#x20;tagente_modulo&#x20;as&#x20;t2&#x20;on&#x20;t1.id_agente&#x20;=&#x20;t2.id_agente&#x20;inner&#x20;join&#x20;talert_template_modules&#x20;as&#x20;t3&#x20;on&#x20;t2.id_agente_modulo&#x20;=&#x20;t3.id_agent_module&#x20;order&#x20;by&#x20;agent_name,&#x20;module_name;');
INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (4, 'Group&#x20;view', 'select&#x20;t1.nombre,&#x20;&#40;select&#x20;count&#40;t3.id_agente&#41;&#x20;from&#x20;tagente&#x20;as&#x20;t3&#x20;where&#x20;t1.id_grupo&#x20;=&#x20;t3.id_grupo&#41;&#x20;as&#x20;agents,&#x20;&#40;SELECT&#x20;COUNT&#40;t4.id_agente&#41;&#x20;FROM&#x20;tagente&#x20;as&#x20;t4&#x20;WHERE&#x20;t4.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;t4.disabled&#x20;=&#x20;0&#x20;AND&#x20;t4.ultimo_contacto&#x20;&lt;&#x20;NOW&#40;&#41;&#x20;-&#x20;&#40;intervalo&#x20;/&#x20;&#40;1/2&#41;&#41;&#41;&#x20;as&#x20;agent_unknown,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente.id_agente&#x20;=&#x20;tagente_estado.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;utimestamp&#x20;&gt;&#x20;0&#x20;AND&#x20;tagente_modulo.id_tipo_modulo&#x20;NOT&#x20;IN&#40;21,22,23,24,100&#41;&#x20;AND&#x20;&#40;UNIX_TIMESTAMP&#40;NOW&#40;&#41;&#41;&#x20;-&#x20;tagente_estado.utimestamp&#41;&#x20;&gt;=&#x20;&#40;tagente_estado.current_interval&#x20;/&#x20;&#40;1/2&#41;&#41;&#41;&#x20;as&#x20;monitor_unknow,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente.id_agente&#x20;=&#x20;tagente_estado.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente_modulo.id_tipo_modulo&#x20;NOT&#x20;IN&#x20;&#40;21,22,23,24&#41;&#x20;AND&#x20;utimestamp&#x20;=&#x20;0&#41;&#x20;as&#x20;monitor_no_init,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente_estado.id_agente&#x20;=&#x20;tagente.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;estado&#x20;=&#x20;0&#x20;AND&#x20;&#40;&#40;UNIX_TIMESTAMP&#40;NOW&#40;&#41;&#41;&#x20;-&#x20;tagente_estado.utimestamp&#41;&#x20;&lt;&#x20;&#40;tagente_estado.current_interval&#x20;/&#x20;&#40;1/2&#41;&#41;&#x20;OR&#x20;&#40;tagente_modulo.id_tipo_modulo&#x20;IN&#40;21,22,23,24,100&#41;&#41;&#41;&#x20;AND&#x20;&#40;utimestamp&#x20;&gt;&#x20;0&#x20;OR&#x20;&#40;tagente_modulo.id_tipo_modulo&#x20;IN&#40;21,22,23,24&#41;&#41;&#41;&#41;&#x20;as&#x20;monitor_ok,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente_estado.id_agente&#x20;=&#x20;tagente.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;estado&#x20;=&#x20;1&#x20;AND&#x20;&#40;&#40;UNIX_TIMESTAMP&#40;NOW&#40;&#41;&#41;&#x20;-&#x20;tagente_estado.utimestamp&#41;&#x20;&lt;&#x20;&#40;tagente_estado.current_interval&#x20;/&#x20;&#40;1/2&#41;&#41;&#x20;OR&#x20;&#40;tagente_modulo.id_tipo_modulo&#x20;IN&#40;21,22,23,24,100&#41;&#41;&#41;&#x20;AND&#x20;utimestamp&#x20;&gt;&#x20;0&#41;&#x20;as&#x20;monitor_critical,&#x20;&#40;SELECT&#x20;COUNT&#40;talert_template_modules.id&#41;&#x20;FROM&#x20;talert_template_modules,&#x20;tagente_modulo,&#x20;tagente_estado,&#x20;tagente&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente_modulo.id_agente&#x20;=&#x20;tagente.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;talert_template_modules.id_agent_module&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;times_fired&#x20;&gt;&#x20;0&#41;&#x20;as&#x20;monitor_alert_fired&#x20;from&#x20;tgrupo&#x20;as&#x20;t1&#x20;where&#x20;0&#x20;&lt;&#x20;&#40;select&#x20;count&#40;t2.id_agente&#41;&#x20;from&#x20;tagente&#x20;as&#x20;t2&#x20;where&#x20;t1.id_grupo&#x20;=&#x20;t2.id_grupo&#41;'); INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (4, 'Group&#x20;view', 'select&#x20;t1.nombre,&#x20;&#40;select&#x20;count&#40;t3.id_agente&#41;&#x20;from&#x20;tagente&#x20;as&#x20;t3&#x20;where&#x20;t1.id_grupo&#x20;=&#x20;t3.id_grupo&#41;&#x20;as&#x20;agents,&#x20;&#40;SELECT&#x20;COUNT&#40;t4.id_agente&#41;&#x20;FROM&#x20;tagente&#x20;as&#x20;t4&#x20;WHERE&#x20;t4.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;t4.disabled&#x20;=&#x20;0&#x20;AND&#x20;t4.ultimo_contacto&#x20;&lt;&#x20;NOW&#40;&#41;&#x20;-&#x20;&#40;intervalo&#x20;/&#x20;&#40;1/2&#41;&#41;&#41;&#x20;as&#x20;agent_unknown,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente.id_agente&#x20;=&#x20;tagente_estado.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;utimestamp&#x20;&gt;&#x20;0&#x20;AND&#x20;tagente_modulo.id_tipo_modulo&#x20;NOT&#x20;IN&#40;21,22,23,24,100&#41;&#x20;AND&#x20;&#40;UNIX_TIMESTAMP&#40;NOW&#40;&#41;&#41;&#x20;-&#x20;tagente_estado.utimestamp&#41;&#x20;&gt;=&#x20;&#40;tagente_estado.current_interval&#x20;/&#x20;&#40;1/2&#41;&#41;&#41;&#x20;as&#x20;monitor_unknow,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente.id_agente&#x20;=&#x20;tagente_estado.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente_modulo.id_tipo_modulo&#x20;NOT&#x20;IN&#x20;&#40;21,22,23,24&#41;&#x20;AND&#x20;utimestamp&#x20;=&#x20;0&#41;&#x20;as&#x20;monitor_no_init,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente_estado.id_agente&#x20;=&#x20;tagente.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;estado&#x20;=&#x20;0&#x20;AND&#x20;&#40;&#40;UNIX_TIMESTAMP&#40;NOW&#40;&#41;&#41;&#x20;-&#x20;tagente_estado.utimestamp&#41;&#x20;&lt;&#x20;&#40;tagente_estado.current_interval&#x20;/&#x20;&#40;1/2&#41;&#41;&#x20;OR&#x20;&#40;tagente_modulo.id_tipo_modulo&#x20;IN&#40;21,22,23,24,100&#41;&#41;&#41;&#x20;AND&#x20;&#40;utimestamp&#x20;&gt;&#x20;0&#x20;OR&#x20;&#40;tagente_modulo.id_tipo_modulo&#x20;IN&#40;21,22,23,24&#41;&#41;&#41;&#41;&#x20;as&#x20;monitor_ok,&#x20;&#40;SELECT&#x20;COUNT&#40;tagente_estado.id_agente_estado&#41;&#x20;FROM&#x20;tagente_estado,&#x20;tagente,&#x20;tagente_modulo&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente_estado.id_agente&#x20;=&#x20;tagente.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;estado&#x20;=&#x20;1&#x20;AND&#x20;&#40;&#40;UNIX_TIMESTAMP&#40;NOW&#40;&#41;&#41;&#x20;-&#x20;tagente_estado.utimestamp&#41;&#x20;&lt;&#x20;&#40;tagente_estado.current_interval&#x20;/&#x20;&#40;1/2&#41;&#41;&#x20;OR&#x20;&#40;tagente_modulo.id_tipo_modulo&#x20;IN&#40;21,22,23,24,100&#41;&#41;&#41;&#x20;AND&#x20;utimestamp&#x20;&gt;&#x20;0&#41;&#x20;as&#x20;monitor_critical,&#x20;&#40;SELECT&#x20;COUNT&#40;talert_template_modules.id&#41;&#x20;FROM&#x20;talert_template_modules,&#x20;tagente_modulo,&#x20;tagente_estado,&#x20;tagente&#x20;WHERE&#x20;tagente.id_grupo&#x20;=&#x20;t1.id_grupo&#x20;AND&#x20;tagente_modulo.id_agente&#x20;=&#x20;tagente.id_agente&#x20;AND&#x20;tagente_estado.id_agente_modulo&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;tagente_modulo.disabled&#x20;=&#x20;0&#x20;AND&#x20;tagente.disabled&#x20;=&#x20;0&#x20;AND&#x20;talert_template_modules.id_agent_module&#x20;=&#x20;tagente_modulo.id_agente_modulo&#x20;AND&#x20;times_fired&#x20;&gt;&#x20;0&#41;&#x20;as&#x20;monitor_alert_fired&#x20;from&#x20;tgrupo&#x20;as&#x20;t1&#x20;where&#x20;0&#x20;&lt;&#x20;&#40;select&#x20;count&#40;t2.id_agente&#41;&#x20;from&#x20;tagente&#x20;as&#x20;t2&#x20;where&#x20;t1.id_grupo&#x20;=&#x20;t2.id_grupo&#41;');
INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (5, 'Agent&#x20;safe&#x20;mode&#x20;not&#x20;enable', 'select&#x20;alias&#x20;from&#x20;tagente&#x20;where&#x20;safe_mode_module&#x20;=&#x20;0');
-- trecon scripts -- trecon scripts
INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (1, 'Discovery.Application.VMware', 'Discovery&#x20;Application&#x20;script&#x20;to&#x20;monitor&#x20;VMware&#x20;technologies&#x20;&#40;ESXi,&#x20;VCenter,&#x20;VSphere&#41;', '/usr/share/pandora_server/util/recon_scripts/vmware-plugin.pl', '{"1":{"macro":"_field1_","desc":"Configuration&#x20;file","help":"","value":"","hide":""}}'); INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (1, 'Discovery.Application.VMware', 'Discovery&#x20;Application&#x20;script&#x20;to&#x20;monitor&#x20;VMware&#x20;technologies&#x20;&#40;ESXi,&#x20;VCenter,&#x20;VSphere&#41;', '/usr/share/pandora_server/util/recon_scripts/vmware-plugin.pl', '{"1":{"macro":"_field1_","desc":"Configuration&#x20;file","help":"","value":"","hide":""}}');

View File

@ -1,7 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import gspread import gspread
import argparse import argparse,json,sys
from oauth2client.service_account import ServiceAccountCredentials from oauth2client.service_account import ServiceAccountCredentials
from pprint import pprint from pprint import pprint
from os import remove
import base64
__author__ = "Alejandro Sánchez Carrion" __author__ = "Alejandro Sánchez Carrion"
__copyright__ = "Copyright 2022, PandoraFMS" __copyright__ = "Copyright 2022, PandoraFMS"
@ -15,33 +21,61 @@ Version = {__version__}
Manual execution Manual execution
python3 pandora_googlesheets.py --cred <file credentials> --row <number-row> --column <number-column> python3 pandora_googlesheets.py --creds_json/creds_base64 <file credentials> --name <name document> --sheet <name-sheet> --cell <Number cell> --row <number-row> --column <number-column>
""" """
parser = argparse.ArgumentParser(description= info, formatter_class=argparse.RawTextHelpFormatter) parser = argparse.ArgumentParser(description= info, formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('--cred', help='') parser.add_argument('--creds_json', help='To authenticate with a json file.')
parser.add_argument('--name', help='') parser.add_argument('--creds_base64', help='To authenticate with a file that includes the credentials for base64 authentication.')
parser.add_argument('--row', help='',type=int) parser.add_argument('--name', help='Name of the google sheets document.')
parser.add_argument('--column', help='',type=int) parser.add_argument('--cell', help='To collect the value of a cell.')
parser.add_argument('--row', help='To collect the value of a row.',type=int)
parser.add_argument('--column', help='To collect the value of a column.',type=int)
parser.add_argument('--sheet', help='To indicate the name of the document sheet, put it in quotation marks and count spaces and capital letters.',type=str)
args = parser.parse_args() args = parser.parse_args()
scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"] scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"]
creds = ServiceAccountCredentials.from_json_keyfile_name(args.cred, scope)
## authenticate with file json input
if args.creds_json is not None and args.creds_base64 == None:
creds = ServiceAccountCredentials.from_json_keyfile_name(args.creds_json, scope)
## authenticate with base64 input
elif args.creds_base64 is not None and args.creds_json== None:
## base64 to json
text=base64.b64decode(args.creds_base64).decode('utf-8')
with open("cred.json", "w") as outfile:
outfile.write(text)
creds = ServiceAccountCredentials.from_json_keyfile_name("cred.json", scope)
remove("cred.json")
else:
print("You need to use the --creds_json or creds_base 64 parameter to authenticate. You can only select one.")
sys.exit()
client = gspread.authorize(creds) client = gspread.authorize(creds)
sheet = client.open(args.name).sheet1 # Open the spreadhseet sheet = client.open(args.name) # Open the spreadhseet
worksheet = sheet.worksheet(args.sheet) # Open worksheet
data = sheet.get_all_records() # Get a list of all records if args.cell is not None and args.row==None and args.column==None :
if args.row is not None and args.column==None: val = worksheet.acell(args.cell).value
row = sheet.row_values(args.row) # Get a specific row
print(row) elif args.row is not None and args.column==None and args.cell == None:
elif args.row ==None and args.column is not None:
col = sheet.col_values(args.column) # Get a specific column val = worksheet.row_values(args.row) # Get a specific row
print(col)
elif args.row is not None and args.column is not None: elif args.column is not None and args.row== None and args.cell == None:
cell = sheet.cell(args.row,args.column).value # Get the value of a specific cell
print(cell) val = worksheet.col_values(args.column) # Get a specific column
else:
print("To search for data in a cell use the --cell parameter, for data in a column --column and in a row --row, only one of these parameters can be used at a time.")
sys.exit()
print(val)

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.769-230222 Version: 7.0NG.769-230228
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.769-230222" pandora_version="7.0NG.769-230228"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -42,9 +42,6 @@ use PandoraFMS::PredictionServer;
use PandoraFMS::WebServer; use PandoraFMS::WebServer;
use PandoraFMS::InventoryServer; use PandoraFMS::InventoryServer;
# Constants for Win32 services.
use constant WIN32_SERVICE_STOPPED => 0x01;
use constant WIN32_SERVICE_RUNNING => 0x04;
# Global vars # Global vars
my %Config :shared; my %Config :shared;
@ -255,7 +252,6 @@ sub pandora_crash () {
print_message (\%Config, " Error description:\n", 0); print_message (\%Config, " Error description:\n", 0);
print_message (\%Config, $full_error, 0); print_message (\%Config, $full_error, 0);
callback_stop() if ($^O eq 'MSWin32' && defined($Config{'win32_service'}));
} }
######################################################################################## ########################################################################################
@ -510,135 +506,6 @@ sub pandora_server_tasks ($) {
db_disconnect($dbh); db_disconnect($dbh);
} }
################################################################################
## Install the Windows service.
################################################################################
sub win32_install_service() {
# Load Win32::Daemon.
eval "use Win32::Daemon";
die($@) if ($@);
# Configure and install the service.
my $service_path = $0;
my $service_params = "-S run \"" . $Config{'pandora_path'} ."\"";
my %service_hash = (
machine => '',
name => 'PANDORAFMSSRV',
display => 'Pandora FMS Server',
path => $service_path,
user => '',
pwd => '',
description => 'Pandora FMS Server http://pandorafms.com/',
parameters => $service_params
);
if (Win32::Daemon::CreateService(\%service_hash)) {
print "Successfully added.\n";
exit 0;
} else {
print "Failed to add service: " . Win32::FormatMessage(Win32::Daemon::GetLastError()) . "\n";
exit 1;
}
}
################################################################################
## Install the Windows service.
################################################################################
sub win32_uninstall_service() {
# Load Win32::Daemon.
eval "use Win32::Daemon";
die($@) if ($@);
# Uninstall the service.
if (Win32::Daemon::DeleteService('', 'PANDORAFMSSRV')) {
print "Successfully deleted.\n";
exit 0;
} else {
print "Failed to delete service: " . Win32::FormatMessage(Win32::Daemon::GetLastError()) . "\n";
exit 1;
}
}
################################################################################
## Windows service callback function for the running event.
################################################################################
sub callback_running {
if (Win32::Daemon::State() == WIN32_SERVICE_RUNNING) {
}
}
################################################################################
## Windows service callback function for the start event.
################################################################################
sub callback_start {
no strict;
# Accept_connections ();
my $thr = threads->create(\&main);
if (!defined($thr)) {
Win32::Daemon::State(WIN32_SERVICE_STOPPED);
Win32::Daemon::StopService();
return;
}
$thr->detach();
Win32::Daemon::State(WIN32_SERVICE_RUNNING);
}
################################################################################
## Windows service callback function for the stop event.
################################################################################
sub callback_stop {
$RUN = 0;
Win32::Daemon::State(WIN32_SERVICE_STOPPED);
Win32::Daemon::StopService();
}
################################################################################
# Run as a Windows service.
################################################################################
sub win32_service_run() {
# Load Win32::Daemon.
eval "use Win32::Daemon";
die($@) if ($@);
# Run the Pandora FMS Server as a Windows service.
Win32::Daemon::RegisterCallbacks({
start => \&callback_start,
running => \&callback_running,
stop => \&callback_stop,
});
Win32::Daemon::StartService();
}
################################################################################
## Parse command line options.
################################################################################
sub parse_service_options ($) {
my $config = shift;
# Sanity checks.
return unless defined($config->{'win32_service'});
die ("[ERROR] Windows services are only available on Win32.\n\n") if ($^O ne 'MSWin32');
# Win32 service management.
eval "use Win32::Daemon";
die($@) if ($@);
if ($config->{'win32_service'} eq 'install') {
win32_install_service();
} elsif ($config->{'win32_service'} eq 'uninstall') {
win32_uninstall_service();
} elsif ($config->{'win32_service'} eq 'run') {
} else {
die("[ERROR] Unknown action: " . $config->{'win32_service'});
}
}
################################################################ ################################################################
################################################################ ################################################################
## Main. ## Main.
@ -967,17 +834,9 @@ $SIG{'ALRM'} = 'IGNORE';
pandora_init(\%Config, pandora_get_initial_product_name() . ' Server'); pandora_init(\%Config, pandora_get_initial_product_name() . ' Server');
pandora_load_config (\%Config); pandora_load_config (\%Config);
# Parse command line options.
parse_service_options(\%Config);
# Run as a regular process. # Run as a regular process.
if (!defined($Config{'win32_service'})) { main();
main();
}
# Run as a Windows service.
else {
win32_service_run();
}
################################################################################ ################################################################################
# Kill any scripts started by the Pandora FMS Server that are still running. # Kill any scripts started by the Pandora FMS Server that are still running.

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.769"; my $pandora_version = "7.0NG.769";
my $pandora_build = "230222"; my $pandora_build = "230228";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash
@ -64,7 +64,6 @@ sub help_screen {
print " -d : Debug mode activated. Writes extensive information in the logfile \n"; print " -d : Debug mode activated. Writes extensive information in the logfile \n";
print " -D : Daemon mode (runs in background)\n"; print " -D : Daemon mode (runs in background)\n";
print " -P <file> : Store PID to file.\n"; print " -P <file> : Store PID to file.\n";
print " -S <install|uninstall|run>: Manage the win32 service.\n";
print " -h : This screen. Shows a little help screen \n"; print " -h : This screen. Shows a little help screen \n";
print " \n"; print " \n";
exit; exit;
@ -111,9 +110,6 @@ sub pandora_init {
elsif ($parametro =~ m/-D\z/) { elsif ($parametro =~ m/-D\z/) {
$pa_config->{"daemon"}=1; $pa_config->{"daemon"}=1;
} }
elsif ($parametro =~ m/^-S\z/i) {
$pa_config->{'win32_service'}= clean_blank($ARGV[$ax+1]);
}
else { else {
($pa_config->{"pandora_path"} = $parametro); ($pa_config->{"pandora_path"} = $parametro);
} }

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.769"; my $pandora_version = "7.0NG.769";
my $pandora_build = "230222"; my $pandora_build = "230228";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230222 %define release 230228
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230222 %define release 230228
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.769" PI_VERSION="7.0NG.769"
PI_BUILD="230222" PI_BUILD="230228"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.769 Build 230222"; my $version = "7.0NG.769 Build 230228";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.769 Build 230222"; my $version = "7.0NG.769 Build 230228";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);