diff --git a/README.md b/README.md index 2a6c68fc2b..4d00713cd4 100644 --- a/README.md +++ b/README.md @@ -6,37 +6,43 @@ With more than 50,000 customer installations across the five continents, Pandora Pandora FMS gives you the agility to find and solve problems quickly, scaling them so they can be derived from any source, on-premise, multi cloud or both of them mixed. Now you have that capability across your entire IT stack and analytics to find any problem, even the ones that are hard to find. -Thanks to more than 500 plugins available, you can control and manage any application and technology, from SAP, Oracle, Lotus, Citrix or Jboss to VMware, AWS, SQL Server, Redhat, Websphere, etc. - ### Support -For community support you can visit our forums at https://pandorafms.com/community/ and if you need commercial information or/and professional support visit https://pandorafms.com +For community support you can visit our forums at https://pandorafms.com/community/ + +Pandora FMS has a "commercial" solution, with different features, oriented to companies that do not want to spend time using open source solutions, but closed packaged products, with periodic updates and professional support. Its name is Pandora FMS Enterprise, and you can find more information about it at https://pandorafms.com. ### How to install Pandora FMS -Installing Pandora FMS is a very easy task. Please visit our wiki and follow all the steps described for a quick and proper installation. https://pandorafms.com/manual/en/documentation/02_installation/01_installing +Installing Pandora FMS from sources is a complex task. Please visit our wiki and follow all the steps described for a proper installation. https://pandorafms.com/manual/ ### What is Pandora FMS? -Pandora FMS is a monitoring application to watch systems and applications that allows to know the status of any element of the business systems. Pandora FMS watches your hardware, software, your multilayer system and, of course, your OS. Pandora FMS can detect if a network interface is down or the movement of any NASDAQ new technology market value. If you wish, Pandora FMS can send a SMS message when your system or your application fails or when Google stock value drops below 330 US\$. Pandora FMS will fit your systems and requirements, because it has been designed to be open, modular, multiplattform and easy to customize. +Pandora FMS is an open source monitoring application whose origin dates back to 2004. It integrates in the same application the monitoring of different infrastructure elements: networks, applications, servers, web, and other specific data sources such as logs, WMI, Netflow or SNMP traps. -### Other things Pandora FMS can do +It allows you to supervise systems and applications of all types, through remote monitoring or with software agents installed on the equipment to be monitored. -Pandora FMS is a monitoring tool that not only measures if a parameter is right or wrong. Pandora FMS can quantify the state (right or wrong), or store a value (numeric or alphanumeric) for months if necessary. Pandora FMS can measure performances, compare values among different systems and set alarms over thresholds. Pandora FMS works against a Database so it can generate reports, statistics, SLA and meausre anything: OS, applications and hardware systems, such as firewalls, proxies, Databases, web servers, VPN, routers, switches, processes, services, [remote accesses to servers](https://pandorafms.com/server-monitoring/), etc. Everything integrated in an open and distributed architecture. Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks. +Pandora FMS monitors your hardware, software, your multilayer system and, of course, your operating system. Pandora FMS can detect if a network interface is down or the movement of the market value of any new NASDAQ technology. If desired, Pandora FMS can send an SMS message when your system or application fails or when the value of Tesla's stock drops below \$180. Pandora FMS will adapt to your systems and requirements, because it has been designed to be open, modular, multiplatform and easy to customize. + +Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks. + +Pandora FMS is a monitoring tool that not only measures if a parameter is right or wrong. Pandora FMS can quantify the state (right or wrong), or store a value (numeric or alphanumeric) for months if necessary. Pandora FMS can measure performances, compare values among different systems and set alarms over thresholds. Pandora FMS works against a MySQL Database so it can generate reports, statistics, SLA and measure anything. ### Main features - Network monitoring -- WMI monitoring -- Agent monitoring (for all OS) -- Graphical reporting, based on it's own SQL backend +- Server monitoring (using agents for Windows, Linux, Mac, BSD and legacy Unix) +- SSH/WMI remote monitorin. +- Graphical reporting, based on SQL backend - SLA, and ITIL KPI metrics on reporting - Status & Performance monitoring - GIS tracking and viewing - Inventory management (Local and remote) +- Netflow support +- Centralized log collection. - User defined visual console screens and Dashboards WYSIWYG - Very high capacity (Thousands of devices) -- Multiuser, several levels of ACL management. +- Multitenant, several levels of ACL management. ### Screenshots diff --git a/extras/bin/gotty b/extras/bin/gotty deleted file mode 100755 index 1a1de33cf6..0000000000 Binary files a/extras/bin/gotty and /dev/null differ diff --git a/extras/docker/centos8/base/Dockerfile b/extras/docker/centos8/base/Dockerfile index eac2152d3c..a45080629f 100644 --- a/extras/docker/centos8/base/Dockerfile +++ b/extras/docker/centos8/base/Dockerfile @@ -92,12 +92,10 @@ RUN dnf install -y --setopt=tsflags=nodocs \ php-yaml \ libzstd \ openldap-clients \ - http://firefly.artica.es/centos8/chromium-110.0.5481.177-1.el7.x86_64.rpm \ - http://firefly.artica.es/centos8/chromium-common-110.0.5481.177-1.el7.x86_64.rpm \ + chromium \ http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ - http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \ - http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm - + http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm + RUN mkdir -p /run/php-fpm/ ; chown -R root:apache /run/php-fpm/ # Not installed perl-Net-Telnet gtk-update-icon-cach ghostscript-fonts diff --git a/extras/docker/centos8/build_image_el8.sh b/extras/docker/centos8/build_image_el8.sh index d4abd11eb8..c31be67d00 100755 --- a/extras/docker/centos8/build_image_el8.sh +++ b/extras/docker/centos8/build_image_el8.sh @@ -64,7 +64,7 @@ wget $oconsoleurl wget $oserverurl if [ "$BASEBUILD" == 1 ] ; then - docker pull centos:8 + docker pull rockylinux:8 # Open Base image echo "building Base el8 image" cd $DOCKER_PATH/base @@ -77,11 +77,11 @@ else fi if [ "$DBBUILD" == 1 ] ; then - docker pull percona:5.7 + docker pull percona:8.0 # Percona image echo "building Percona image" - cd $OPEN/extras/docker/percona - docker build -t $PERCONA_IMAGE:latest -f $OPEN/extras/docker/percona/Dockerfile $OPEN/extras/docker/percona + cd $OPEN/extras/docker/percona/8.0 + docker build -t $PERCONA_IMAGE:latest -f $OPEN/extras/docker/percona/8.0/Dockerfile $OPEN/extras/docker/percona/8.0/ echo -e ">>>> \n" fi diff --git a/extras/docker/centos8/docker-compose.yml b/extras/docker/centos8/docker-compose.yml index 37df7251f5..06f5cf1c31 100644 --- a/extras/docker/centos8/docker-compose.yml +++ b/extras/docker/centos8/docker-compose.yml @@ -8,6 +8,8 @@ services: image: pandorafms/pandorafms-percona-base restart: always #command: ["mysqld", "--innodb-buffer-pool-size=900M"] + cap_add: + - SYS_NICE # CAP_SYS_NICE environment: MYSQL_ROOT_PASSWORD: pandora MYSQL_DATABASE: pandora diff --git a/extras/docker/percona/Dockerfile b/extras/docker/percona/5.7/Dockerfile similarity index 100% rename from extras/docker/percona/Dockerfile rename to extras/docker/percona/5.7/Dockerfile diff --git a/extras/docker/percona/8.0/Dockerfile b/extras/docker/percona/8.0/Dockerfile new file mode 100644 index 0000000000..ae8f544c7a --- /dev/null +++ b/extras/docker/percona/8.0/Dockerfile @@ -0,0 +1,11 @@ +#docker build -t pandorafms/pandorafms-percona-base:80 . +#docker tag pandorafms/pandorafms-percona-base:80 pandorafms/pandorafms-percona-base:latest +#docker push pandorafms/pandorafms-percona-base:80 + + +FROM percona:8.0 +ADD pandora.cnf /etc/my.cnf.d/ +USER root +RUN chown mysql:mysql /etc/my.cnf.d/pandora.cnf +USER mysql +EXPOSE 3306 diff --git a/extras/docker/percona/8.0/compose/docker-compose.yml b/extras/docker/percona/8.0/compose/docker-compose.yml new file mode 100644 index 0000000000..293efb63a2 --- /dev/null +++ b/extras/docker/percona/8.0/compose/docker-compose.yml @@ -0,0 +1,20 @@ +# Use root/example as user/password credentials +# este compose incluye la base de datos en otro docker y levanta aplicacion y DB juntos +version: '3.1' + +services: + db: + image: pandorafms/pandorafms-percona-base:80 + restart: always + command: ["mysqld", "--innodb-buffer-pool-size=1G"] + cap_add: + - SYS_NICE # CAP_SYS_NICE + environment: + MYSQL_ROOT_PASSWORD: pandora + MYSQL_DATABASE: pandora + MYSQL_USER: pandora + MYSQL_PASSWORD: pandora + networks: + - pandora +networks: + pandora: \ No newline at end of file diff --git a/extras/docker/percona/8.0/pandora.cnf b/extras/docker/percona/8.0/pandora.cnf new file mode 100644 index 0000000000..802b181b61 --- /dev/null +++ b/extras/docker/percona/8.0/pandora.cnf @@ -0,0 +1,39 @@ +# copy this file to /etc/my.cnf.d/pandora.cnf directory inside the container to set the onfiguration + +[mysqld] +datadir=/var/lib/mysql +user=mysql +character-set-server=utf8mb4 +skip-character-set-client-handshake +# Disabling symbolic-links is recommended to prevent assorted security risks +symbolic-links=0 +# Mysql optimizations for Pandora FMS +# Please check the documentation in http://pandorafms.com for better results + +max_allowed_packet = 64M +innodb_lock_wait_timeout = 90 +innodb_file_per_table +innodb_flush_log_at_trx_commit = 0 +innodb_flush_method = O_DIRECT +innodb_log_file_size = 64M +innodb_log_buffer_size = 16M +innodb_io_capacity = 300 +thread_cache_size = 8 +thread_stack = 256K +max_connections = 100 + +key_buffer_size=4M +read_buffer_size=128K +read_rnd_buffer_size=128K +sort_buffer_size=128K +join_buffer_size=4M + +# legacy compatibility +default_authentication_plugin=mysql_native_password +log_error_suppression_list='MY-013360' + +skip-log-bin + +sql_mode="" + + \ No newline at end of file diff --git a/extras/docker/percona/8.0/run_docker b/extras/docker/percona/8.0/run_docker new file mode 100644 index 0000000000..3757a78d4a --- /dev/null +++ b/extras/docker/percona/8.0/run_docker @@ -0,0 +1,6 @@ +docker run --name pandora-percona \ +-e MYSQL_ROOT_PASSWORD=pandora \ +-e MYSQL_DATABASE=pandora \ +-e MYSQL_USER=pandora \ +-e MYSQL_PASSWORD=pandora \ +-d pandora_percona:80 diff --git a/extras/scripts/mail_transfer/PandoraFMS_mail_transfer.en.odt b/extras/scripts/mail_transfer/PandoraFMS_mail_transfer.en.odt deleted file mode 100644 index 9e9bf58549..0000000000 Binary files a/extras/scripts/mail_transfer/PandoraFMS_mail_transfer.en.odt and /dev/null differ diff --git a/extras/scripts/mail_transfer/PandoraFMS_mail_transfer.es.odt b/extras/scripts/mail_transfer/PandoraFMS_mail_transfer.es.odt deleted file mode 100644 index 6460a512b7..0000000000 Binary files a/extras/scripts/mail_transfer/PandoraFMS_mail_transfer.es.odt and /dev/null differ diff --git a/extras/scripts/mail_transfer/config_file.conf b/extras/scripts/mail_transfer/config_file.conf deleted file mode 100644 index 6169ee2a77..0000000000 --- a/extras/scripts/mail_transfer/config_file.conf +++ /dev/null @@ -1,33 +0,0 @@ -########################################### -### SMTP DATA -########################################### - -smtp_user devtest@artica.es -smtp_pass pass1212 -smtp_hostname mail.artica.es - -########################################### -### POP3 DATA -########################################### - -pop3_user devtest@artica.es -pop3_pass pass1212 -pop3_hostname mail.artica.es - -# Enable or disable SSL. 1 means Enabled, 0 Disabled -pop3_ssl 0 - -# SSL port -pop3_ssl_port 995 - -########################################### -### TO SEND INFO -########################################### -# Email receiver where to send the email -receiver_email devtest@artica.es - -########################################### -### PATH TO SAVE THE ATTACHED FILE -########################################### -# Desired path where the attached file will be stored -pathtosave /tmp/ diff --git a/extras/scripts/mail_transfer/mail_transfer.pl b/extras/scripts/mail_transfer/mail_transfer.pl deleted file mode 100755 index 096979b9eb..0000000000 --- a/extras/scripts/mail_transfer/mail_transfer.pl +++ /dev/null @@ -1,318 +0,0 @@ -#!/usr/bin/perl -########################################################################## -# Pandora FMS Mail Transfer -# This is a tool for transfering Pandora FMS data files by mail (SMTP/POP) -########################################################################## -# Copyright (c) 2011-2023 Pandora FMS -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; version 2 -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -########################################################################## - -use strict; -use warnings; -use Net::SMTP; -use Mail::POP3Client; -use MIME::Parser; -$| = 1; - -# GLOBAL VARIABLES - -my $boundary='frontier'; - -####### FUNCTIONS ####### - -######################################################################## -## SUB check_args -## Checks the command line arguments given at the function call. -######################################################################## -sub check_args(){ - my $num_args = $#ARGV + 1; - my $action = $ARGV[0]; - my $conf_file = $ARGV[1]; - my $filename = $ARGV[2]; - my $error = "Usage: mail_transfer.pl {send|receive conf_file [FILE]}\n"; - my $error_conf_file = "conf_file does not exist or is not readable\n"; - my $error_filename = "File to send does not exist or is not readable\n"; - - if (($num_args < 2) || (($action ne "send") && ($action ne "receive"))) { - die $error; - } elsif ((!(-e $conf_file)) || (!(-r $conf_file))) { - die $error_conf_file; - } elsif (($action eq "send") && ((!(-e $filename)) || (!(-r $filename)))) { - die $error_filename; - } -} - -######################################################################## -## SUB parse_conf -## Reads the entire conf file and stores all the information given -######################################################################## -sub parse_conf ($$) { - - my $conf_file = $_[0]; - my $conf_hash = $_[1]; - - open (CONF, $conf_file); - my $line; - - while () - { - $line = $_; - # Get the smtp user - if ($line =~ /^smtp_user\s([a-zA-Z0-9\.\_\-\@]+)/) { - $conf_hash -> {smtp_user} = $1; - } - # Get the smtp pass - elsif ($line =~ /^smtp_pass\s(.+)/) { - $conf_hash -> {smtp_pass} = $1; - } - # Get the smtp hostname - elsif ($line =~ /^smtp_hostname\s([a-zA-Z0-9\.\_\-\@]+)/) { - $conf_hash -> {smtp_hostname} = $1; - } - # Get the pop3 user - elsif ($line =~ /^pop3_user\s([a-zA-Z0-9\.\_\-\@]+)/) { - $conf_hash -> {pop3_user} = $1; - } - # Get the pop3 pass - elsif ($line =~ /^pop3_pass\s(.+)/) { - $conf_hash -> {pop3_pass} = $1; - } - # Get the pop3 hostname - elsif ($line =~ /^pop3_hostname\s([a-zA-Z0-9\.\_\-\@]+)/) { - $conf_hash -> {pop3_hostname} = $1; - } - # Get the pop3 ssl flag to know if it's enabled or not - elsif ($line =~ /^pop3_ssl\s(0|1)/) { - $conf_hash -> {pop3_ssl} = $1; - } - # Get the pop3 ssl port - elsif ($line =~ /^pop3_ssl_port\s([0-9]{1,5})/) { - $conf_hash -> {pop3_ssl_port} = $1; - } - # Get the path where to save the attached file - elsif ($line =~ /^pathtosave\s(.+)/) { - $conf_hash -> {pathtosave} = $1; - } - # Get the receiver's email where to send the attached file - elsif ($line =~ /^receiver_email\s([a-zA-Z0-9\.\_\-\@]+)/) { - $conf_hash -> {receiver_email} = $1; - } - } - close CONF; -} - -######################################################################## -## SUB send_mail -## Sends an attachement file via email using smtp -######################################################################## -sub send_mail($) { - - my $conf_hash = $_[0]; - my $smtp; - my $attachment = $conf_hash -> {filename}; - - # Get the filename in case the full path was given - # Split the full path with '/', the last item will be the filename - my @file_path = split ('/', $attachment); - - # Get the array's last position with '-1' index - my $attach_file = $file_path[-1]; - - my $host = $conf_hash -> {smtp_hostname}; - my $from = $conf_hash -> {smtp_user}; - my $password = $conf_hash -> {smtp_pass}; - my $to = $conf_hash -> {receiver_email}; - - open(DATA, $attachment) || die("mail_transfer.pl: ERROR: Could not open the file $attach_file"); - my @xml = ; - close(DATA); - - $smtp = Net::SMTP->new($host, - Hello => $host, - Timeout => 30, - Debug => 0, - ) || die("mail_trasfer.pl: ERROR: Could not connect to $host"); - - $smtp->auth($from, $password); - $smtp->mail($from); - $smtp->to($to); - $smtp->data(); - $smtp->datasend("To: $to\n"); - $smtp->datasend("From: $from\n"); - $smtp->datasend("Subject: Pandora mail transfer\n"); - $smtp->datasend("MIME-Version: 1.0\n"); - $smtp->datasend("Content-Type: application/text; name=" . $attach_file . "\n"); - $smtp->datasend("Content-Disposition: attachment; filename=" . $attach_file . "\n"); - $smtp->datasend("Content-type: multipart/mixed boundary=" . $boundary . "\n"); - $smtp->datasend("\n"); - $smtp->datasend("@xml\n"); - $smtp->dataend() || print "mail_transfer.pl: ERROR: Data end failed: $!"; - $smtp->quit; -} - -######################################################################## -## SUB receive_mail -## Fetch the last email with 'Pandora mail transfer' as subject and -## download the attached file into the specified folder -######################################################################## -sub receive_mail ($) { - - my $conf_hash = $_[0]; - my $user = $conf_hash -> {pop3_user}; - my $password = $conf_hash -> {pop3_pass}; - my $host = $conf_hash -> {pop3_hostname}; - my $ssl = $conf_hash -> {pop3_ssl}; - my $ssl_port = $conf_hash -> {pop3_ssl_port}; - my $pathtosave = $conf_hash -> {pathtosave}; - my $pop3; - - if ($ssl == 1){ - $pop3 = new Mail::POP3Client( - USER => $user, - PASSWORD => $password, - HOST => $host, - USESSL => 1, - PORT => $ssl_port, - DEBUG => 0 - ) or die "mail_transfer.pl: Connection failed\n"; - } else { - $pop3 = new Mail::POP3Client( - USER => $user, - PASSWORD => $password, - HOST => $host, - USESSL => 0, - PORT => 110, - DEBUG => 0 - ) or die "mail_transfer.pl: Connection failed\n"; - } - - my $tot_msg = $pop3->Count(); - - if ($tot_msg == 0){ - print "No more emails avalaible\n"; - return (0); # End program - } - elsif ($tot_msg eq '0E0'){ - print "No new emails available\n"; - return (0); - } - else{ - printf "There are $tot_msg messages \n\n"; - } - - # the list of valid file extensions. we do extensions, not - # mime-types, because they're easier to understand from - # an end-user perspective (no research is required). - - my $valid_exts = "txt xml data"; - my %msg_ids; # used to keep track of seen emails. - - # create a subdirectory if does not exist - #print "Using directory '$pathtosave' for newly downloaded files.\n"; - if (!(-d $pathtosave)) { - mkdir($pathtosave, 0777) or die "mail_transfer.pl: Error creating output directory\n"; - } - - # get the message to feed to MIME::Parser. - my $msg = $pop3->HeadAndBody($tot_msg); - my $header = $pop3->Head($tot_msg); - - if (($header !~ /Subject:\sPandora\smail\stransfer/) || ($header !~ /boundary=$boundary/)) { - print "Deleting message not valid\n"; - - # delete current email - $pop3->Delete($tot_msg); - - # clean up and close the connection. - $pop3->Close; - - return -1; - - } - - # create a MIME::Parser object to - # extract any attachments found within. - my $parser = new MIME::Parser; - - $parser->output_dir($pathtosave); - my $entity = $parser->parse_data($msg); - - # extract our mime parts and go through each one. - my @parts = $entity->parts; - - foreach my $part (@parts) { - - # determine the path to the file in question. - my $path = ($part->bodyhandle) ? $part->bodyhandle->path : undef; - - # move on if it's not defined, - # else figure out the extension. - next unless $path; - $path =~ /\w+\.([^.]+)$/; - my $ext = $1; - next unless $ext; - - # we continue only if our extension is correct. - my $continue; $continue++ if $valid_exts =~ /$ext/i; - - # delete the blasted thing. - unless ($valid_exts =~ /$ext/) { - print " Removing unwanted filetype ($ext): $path\n"; - unlink $path or print " > Error removing file at $path: $!."; - next; # move on to the next attachment or message. - } - - # a valid file type. yummy! - print " Keeping valid file: $path.\n"; - } - - # delete current email - $pop3->Delete($tot_msg); - - # clean up and close the connection. - $pop3->Close; -} - - -####### MAIN ####### - -# Check the given command line arguments -check_args(); - -# Once checked store them -my $action = $ARGV[0]; -my $conf_file = $ARGV[1]; -my $filename = $ARGV[2]; - -# If the action is 'send', store the 'file_to_send' -my %conf_hash; -if ($action eq "send") { - $conf_hash {filename} = $filename; -} - -# Parse the config file -parse_conf($conf_file, \%conf_hash); - -# Call 'send_mail' function in its case -if ($action eq "send") { - send_mail(\%conf_hash); -} - -# Or call the 'receive_mail' function. -my $returncode = 1; - -if ($action eq "receive") { - while ($returncode != 0) { - $returncode = receive_mail(\%conf_hash); - } -} diff --git a/extras/scripts/mail_transfer/readme.txt b/extras/scripts/mail_transfer/readme.txt deleted file mode 100644 index 4ef166a44b..0000000000 --- a/extras/scripts/mail_transfer/readme.txt +++ /dev/null @@ -1,106 +0,0 @@ -Pandora Mail Transfer -====================== - -1st Edition , 3 May 2011 - -(c) Pandora FMS 2005-2023 -(c) Juan Manuel Ramon -(c) Javier Lanz - -Description ------------ - -Pandora Mail Transfer is a tool for sending and receiving xml files via email. -This script sends through a SMTP server, to the desired address, an email with an attached file. -Is able as well to fetch via POP3 that mail and its attached file. -It's designed to be used with an specific email account, so every time the script is called in “receive” mode, all emails on that account will be deleted. Do not use this script in a personal account because all your emails will be deleted. - -This script is designed to send only text files, no binary files. - -It's only possible to send .data, .txt, or .xml files. - -Requisites ----------- - -In order to be able to use this application, it's a must having the following Perl's CPAN packages installed in your system: - - Mail::POP3Client - MIME::Parser - Authen::SASL - Net::SMTP; - -To install these libraries with CPAN, for example Mail::POP3Client: - - cpan install Mail::POP3Client - -To use the program under Windows, you will need to compile with a compiler like ActiveState PERL. The ActiveState environment allows as well to install CPAN modules easily. - -Previous the script execution, it's a must having a configuration file, in which the mail server connection parameters will be defined. - -Below it's shown a configuration file example, in which the necessary fields for the proper use of the mail transfer script are detailed. - -Sample configuration file -------------------------- - -########################################### -### SMTP DATA -########################################### - -smtp_user username@domain.com -smtp_pass pass -smtp_hostname mailserver.domain.com -########################################### -### POP3 DATA -########################################### -pop3_user username@domain.com -pop3_pass pass -pop3_hostname mailserver.domain.com -# Enable or disable SSL. 1 means Enabled , 0 Disabled -pop3_ssl 0 -# SSL port -pop3_ssl_port 995 -########################################### -### TO SEND INFO -########################################### -# Email receiver where to send the email -receiver_email desired.mail@domain.com -########################################### -### PATH TO SAVE THE ATTACHED FILE -########################################### -# Desired path where the attached file will be stored -pathtosave /path/to/save/attached - - -Pandora mail transfer execution -------------------------------- - -The proper way of executing the script should be according to... - - ./mail_transfer [file_to_send] - -Where the meaning of the fields are: - - could be 'send' or 'receive' - - configuration file, explained above, contains every necessary data for sending and receiving emails. - -[file_to_send] desired xml file to send (Only necessary in case of action = 'send') - -Execution examples: - - ./mail_transfer send config_file.conf textfile.txt - - ./mail_transfer receive config_file.conf - -Restrictions ------------- - -SSL Protocol - -In this first version, SSL protocol is only implemented for the mail reception, not for sending. -Another related SSL Protocol restriction is the email erasing once read and downloaded to disk. In case of using SSL, deleting is not possible, on the other hand, if it's not used, the read mail will be properly deleted from the server once download to disk. - -Attached file - -There is a wee bug not fixed yet about the attached file name. If this one contains special characters such as '(' ')' '\' and more, while downloading from the server, it will be saved to disk with a different file name, probably wrong, although its content will be the right one. Thus, it's recommended not to use special characters in the file name. - diff --git a/extras/scripts/webserver/PandoraFMS_Monitorizacion_Webserver.odt b/extras/scripts/webserver/PandoraFMS_Monitorizacion_Webserver.odt deleted file mode 100644 index 6558b35d4e..0000000000 Binary files a/extras/scripts/webserver/PandoraFMS_Monitorizacion_Webserver.odt and /dev/null differ diff --git a/extras/scripts/webserver/pandora_webserver.pl b/extras/scripts/webserver/pandora_webserver.pl deleted file mode 100755 index 3749ca52fc..0000000000 --- a/extras/scripts/webserver/pandora_webserver.pl +++ /dev/null @@ -1,664 +0,0 @@ -#!/usr/bin/perl -# Pandora FMS Agent Plugin for SunONE -# (c) Pandora FMS 2011 -# v2, 1 Sep 2011 -# ------------------------------------------------------------------------ - -use strict; -use warnings; - -use IO::Socket::INET; - -# OS and OS version -my $OS = $^O; - - -# Load on Win32 only -if ($OS eq "MSWin32"){ - - # Check dependencies - eval 'local $SIG{__DIE__}; use Win32::OLE("in");'; - if ($@) { - print "Error loading Win32::Ole library. Cannot continue\n"; - exit; - } - - use constant wbemFlagReturnImmediately => 0x10; - use constant wbemFlagForwardOnly => 0x20; -} - -my %plugin_setup; # This stores plugin parameters -my $archivo_cfg = $ARGV[0]; - -my $volume_items = 0; -my $log_items = 0; -my $webcheck_items = 0; -my $process_items = 0; - - -# FLUSH in each IO -$| = 1; - -# ---------------------------------------------------------------------------- -# This cleans DOS-like line and cleans ^M character. VERY Important when you process .conf edited from DOS -# ---------------------------------------------------------------------------- - -sub parse_dosline ($){ - my $str = $_[0]; - - $str =~ s/\r//g; - return $str; -} - -# ---------------------------------------------------------------------------- -# Strips blank likes -# ---------------------------------------------------------------------------- - -sub trim ($){ - my $string = shift; - $string =~ s/^\s+//; - $string =~ s/\s+$//; - return $string; -} - - -# ---------------------------------------------------------------------------- -# clean_blank -# -# This function return a string without blankspaces, given a simple text string -# ---------------------------------------------------------------------------- - -sub clean_blank($){ - my $input = $_[0]; - $input =~ s/[\s\r\n]*//g; - return $input; -} - -# ---------------------------------------------------------------------------- -# print_module -# -# This function return a pandora FMS valid module fiven name, type, value, description -# ---------------------------------------------------------------------------- - -sub print_module ($$$$){ - my $MODULE_NAME = $_[0]; - my $MODULE_TYPE = $_[1]; - my $MODULE_VALUE = $_[2]; - my $MODULE_DESC = $_[3]; - - # If not a string type, remove all blank spaces! - if ($MODULE_TYPE !~ m/string/){ - $MODULE_VALUE = clean_blank($MODULE_VALUE); - } - - print "\n"; - print "$MODULE_NAME\n"; - print "$MODULE_TYPE\n"; - print "\n"; - print "\n"; - print "\n"; - -} - - -# ---------------------------------------------------------------------------- -# load_external_setup -# -# Load external file containing configuration -# ---------------------------------------------------------------------------- -sub load_external_setup ($); # Declaration due a recursive call to itself on includes -sub load_external_setup ($){ - - my $archivo_cfg = $_[0]; - my $buffer_line; - my @config_file; - my $parametro = ""; - - # Collect items from config file and put in an array - if (! open (CFG, "< $archivo_cfg")) { - print "[ERROR] Error opening configuration file $archivo_cfg: $!.\n"; - exit 1; - } - - while (){ - $buffer_line = parse_dosline ($_); - # Parse configuration file, this is specially difficult because can contain SQL code, with many things - if ($buffer_line !~ /^\#/){ # begins with anything except # (for commenting) - if ($buffer_line =~ m/(.+)\s(.*)/){ - push @config_file, $buffer_line; - } - } - } - close (CFG); - - # Some plugin setup default options - - $plugin_setup{"logparser"}="/etc/pandora/plugins/grep_log"; - $plugin_setup{"timeout"} = 5; - $plugin_setup{"apache_stats"} = ""; - - foreach (@config_file){ - $parametro = $_; - - if ($parametro =~ m/^include\s(.*)/i) { - load_external_setup ($1); - } - - if ($parametro =~ m/^logparser\s(.*)/i) { - $plugin_setup{"logparser"}=$1; - - } - - if ($parametro =~ m/^timeout\s(.*)/i) { - $plugin_setup{"timeout"}=clean_blank($1); - - } - - # Log check - if ($parametro =~ m/^log\s(.*)/i) { - $plugin_setup{"log"}->[$log_items]=$1; - $log_items++; - } - - # Volume check - if ($parametro =~ m/^volume\s(.*)/i) { - $plugin_setup{"volume"}->[$volume_items]=$1; - $volume_items++; - } - - # Webcheck - if ($parametro =~ m/^webcheck\s(.*)/i) { - $plugin_setup{"webcheck"}->[$webcheck_items]=$1; - $webcheck_items++; - } - - # Processcheck - if ($parametro =~ m/^process\s(.*)/i) { - $plugin_setup{"process"}->[$process_items]=$1; - $process_items++; - } - - # Apachestats - if ($parametro =~ m/^apache_stats\s(.*)/i) { - $plugin_setup{"apache_stats"}=$1; - } - - } -} - - -# ---------------------------------------------------------------------------- -# http_check -# -# This function recives something like 0.0.0.0:80 / 200 OK -# to check a HTTP response, given Host:PORT, URL and Search string -# Return 0 if not, and 1 if found -# ---------------------------------------------------------------------------- - -sub http_check ($$$$$){ - my $name = $_[0]; - my $host = $_[1]; - my $port = $_[2]; - my $query_string = $_[3]; - my $search_string = $_[4]; - - - my $tcp_send = "GET $query_string HTTP/1.0\n\n"; - my $temp; my $match = 0; - - my $sock = new IO::Socket::INET ( - PeerAddr => $host, - PeerPort => $port, - Proto => 'tcp', - Timeout=> $plugin_setup{"timeout"}, - Blocking=>1 ); # Non block gives non-accurate results. We need to be SURE about this results :( - - if (!$sock){ - print_module("web_$name", "generic_proc", 0, "HTTP Check on $host for $query_string"); - return; - } - - # Send data - $sock->autoflush(1); - - $tcp_send =~ s/\^M/\r\n/g; - # Replace Carriage return and line feed - - print $sock $tcp_send; - my @buffer = <$sock>; - - # Search on buffer - foreach (@buffer) { - if ($_ =~ /$search_string/){ - $match = 1; - last; - } - } - $sock->close; - - print_module ("web_$name", "generic_proc", $match, "HTTP Check on $host for $query_string"); - - return; - -} - - -# ---------------------------------------------------------------------------- -# apache_stats -# -# This function uses mod_status from apache to get information -# Given Instance, Host:PORT, URL (usually should be /server-status) -# ---------------------------------------------------------------------------- - -sub apache_stats ($$$$){ - my $name = $_[0]; - my $host = $_[1]; - my $port = $_[2]; - my $query_string = $_[3]; - - if ($query_string eq ""){ - $query_string = "/"; - } - - my $tcp_send = "GET $query_string HTTP/1.0\n\n"; - my $temp; my $match = 0; - - # First at all, check response on apache (200 OK) - - http_check ("Apache_Status_$name", $host, $port, $query_string, "200 OK"); - - my $sock = new IO::Socket::INET ( - PeerAddr => $host, - PeerPort => $port, - Proto => 'tcp', - Timeout=> $plugin_setup{"timeout"}, - Blocking=>1 ); # Non block gives non-accurate results. We need to be SURE about this results :( - - if (!$sock){ - return; - } - - # Send data - $sock->autoflush(1); - - $tcp_send =~ s/\^M/\r\n/g; - # Replace Carriage return and line feed - - print $sock $tcp_send; - my @buffer = <$sock>; - - # Search on buffer - foreach (@buffer) { - - if ($_ =~ /Restart Time: ([aA-zZ]+\,\s[0-9]{2}\-[aA-zZ]{3}\-[0-9]{4}\s[0-9]{2}\:[0-9]{2}\:[0-9]{2}\s[aA-zZ]+)/ ) { - print_module ("apache_restart_time_$name", "generic_data_string", $1, "" ); - } - - if ($_ =~ /Server uptime: ([aA-zZ 0-9]+)/) { - print_module ("apache_server_uptime_$name", "generic_data_string", $1, "" ); - } - - if ($_ =~ /Total accesses: ([0-9]+)/ ) { - print_module ("apache_accesses_$name", "generic_data_inc", $1, "" ); - } - - if ($_ =~ /Total Traffic: ([0-9]+)/ ) { - print_module ("apache_total_traffic_$name", "generic_data_inc", $1, "" ); - } - - if ($_ =~ /([0-9]+\.[0-9]+)\%\sCPU\sload/ ){ - print_module ("apache_CPU_Load_$name", "generic_data", $1, "" ); - } - - if ($_ =~ /CPU Usage\: u([\.0-9]*)/ ){ - print_module ("apache_CPU_User_Load_$name", "generic_data", $1, "" ); - } - - if ($_ =~ /CPU Usage\: u[\.0-9]* s([\.0-9]*)/ ){ - print_module ("apache_CPU_System_Load_$name", "generic_data", $1, "" ); - } - - if ($_ =~ /([\.0-9]+)\srequests\/sec/){ - print_module ("apache_Req/Sec_$name", "generic_data", $1, "" ); - } - - if ($_ =~ /([0-9]+)\sB\/second/) { - print_module ("apache_B/Sec_$name", "generic_data_inc", $1, "" ); - } - - if ($_ =~ /([0-9]+)\skB\/request/) { - print_module ("apache_KB/Request_$name", "generic_data_inc", $1, "" ); - } - - if ($_ =~ /([0-9]+)\srequests\scurrently/) { - print_module ("apache_request_currently_$name", "generic_data", $1, "" ); - } - - if ($_ =~ /([0-9]+)\sidle\sworkers/) { - print_module ("apache_idle_workers_$name", "generic_data", $1, "" ); - } - - } - $sock->close; - - return; - -} - - -# ---------------------------------------------------------------------------- -# alert_log -# -# Do a call to alertlog plugin and output the result -# Receives logfile, and module name -# ---------------------------------------------------------------------------- - -sub alert_log($$$){ - my $alertlog = $_[0]; - my $module_name = $_[1]; - my $log_expression = $_[2]; - - my $plugin_call = ""; - # Call to logparser - - if ($OS eq "MSWin32") { - $plugin_call = $plugin_setup{"logparser"}. " $alertlog $module_name $log_expression"; - } else { - $plugin_call = $plugin_setup{"logparser"}. " $alertlog $module_name $log_expression 2> /dev/null"; - } - - my $output = `$plugin_call`; - - if ($output ne ""){ - print $output; - } else { - print_module($module_name, "async_string", "", "Alertlog for $alertlog ($log_expression)"); - } - -} - -# ---------------------------------------------------------------------------- -# spare_system_disk_win -# -# This function return % free disk on Windows, using WMI call -# ---------------------------------------------------------------------------- - -sub spare_system_disk_win ($$){ - - my $name = $_[0]; - my $volume = $_[1]; - - - my $computer = "localhost"; - my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or return; - my $colItems = $objWMIService->ExecQuery("SELECT * from CIM_LogicalDisk WHERE Name = '$volume'", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); - - foreach my $objItem (in $colItems) { - my $data = ($objItem->{"FreeSpace"} / $objItem->{"Size"}) * 100; - print_module("Volume_$volume" . "_" . "$name", "generic_data", "$data", "Free disk on $volume"); - return; - } -} - -# ---------------------------------------------------------------------------- -# spare_system_disk -# -# Check free space on volume -# Receives volume name and instance -# ---------------------------------------------------------------------------- - -sub spare_system_disk ($$) { - my $name = $_[0]; - my $vol = $_[1]; - - - if ($vol eq ""){ - return; - } - - # This is a posix call, should be the same on all systems ! - my $output = `df -kP | grep "$vol\$" | awk '{ print \$5 }' | tr -d "%"`; - my $disk_space = 100 - $output; - print_module("Volume_$vol" . "_" . "$name", "generic_data", $disk_space, "% of volume free"); -} - -# ---------------------------------------------------------------------------- -# process_status_unix -# -# Generates a pandora module about the running status of a given process -# ---------------------------------------------------------------------------- - -sub process_status_unix ($$){ - my $proc = $_[0]; - my $proc_name = $_[1]; - - if ($proc eq ""){ - return; - } - - my $data = trim (`ps aux | grep "$proc" | grep -v grep | wc -l`); - print_module("Process_$proc_name", "generic_proc", $data, "Status of process $proc"); -} - - -# ---------------------------------------------------------------------------- -# process_status_win -# -# Generates a pandora module about the running status of a given process -# ---------------------------------------------------------------------------- - -sub process_status_win ($$){ - my $proc = $_[0]; - my $proc_name = $_[1]; - - if ($proc eq ""){ - return; - } - - my $computer = "localhost"; - my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or return; - my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_Process WHERE Caption = '$proc'", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); - - foreach my $objItem (in $colItems) { - - if ($objItem->{"Caption"} eq $proc){ - print_module("Process_$proc_name", "generic_proc", 1, "Status of process $proc"); - return; - } else { - print_module("Process_$proc_name", "generic_proc", 0, "Status of process $proc"); - return; - } - } - - # no matches, process is not running - print_module("Process_$proc_name", "generic_proc", 0, "Status of process $proc"); - -} - -# ---------------------------------------------------------------------------- -# process_mem_win -# -# Generates a Pandora FMS about memory usage of a given process "pepito.exe" -# only works with EXACT names. -# ---------------------------------------------------------------------------- - -sub process_mem_win ($$){ - my $proc = $_[0]; - my $proc_name = $_[1]; - - if ($proc eq ""){ - return; - } - - my $computer = "localhost"; - my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or return; - my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_Process WHERE Caption = '$proc'", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); - - foreach my $objItem (in $colItems) { - - if ($objItem->{"Caption"} eq $proc){ - print_module("Process_MEM_$proc_name", "generic_data", $objItem->{"WorkingSetSize"}, "Memory in bytes of process $proc"); - } else { - return; - } - } -} - -# ---------------------------------------------------------------------------- -# process_mem_unix -# -# Generates a Pandora FMS about memory usage of a given process -# ---------------------------------------------------------------------------- - -sub process_mem_unix ($$){ - my $vol = $_[0]; - my $proc_name = $_[1]; - - if ($vol eq ""){ - return; - } - - my $data = `ps aux | grep "$vol" | grep -v grep | awk '{ print \$6 }'`; - my @data2 = split ("\n", $data), - my $tot = 0; - - foreach (@data2){ - $tot = $tot + $_; - } - print_module("Proc_MEM_$proc_name", "generic_data", $tot, "Memory used (in bytes) for process $vol"); -} - -# ---------------------------------------------------------------------------- -# process_cpu_unix -# -# Generates a Pandora FMS about memory usage of a given process -# ---------------------------------------------------------------------------- -sub process_cpu_unix ($$) { - my $vol = $_[0]; - my $proc_name = $_[1]; - - if ($vol eq ""){ - return; - } - - my $data = `ps aux | grep "$vol" | grep -v grep | awk '{ print \$3 }'`; - my @data2 = split ("\n", $data), - my $tot = 0; - - foreach (@data2){ - $tot = $tot + $_; - } - print_module("Proc_CPU_$proc_name", "generic_data", $tot, "CPU (%) used for process $vol"); -} - -#-------------------------------------------------------------------------------- -#-------------------------------------------------------------------------------- -# MAIN PROGRAM -# ------------------------------------------------------------------------------- -#-------------------------------------------------------------------------------- - -# Parse external configuration file - -# Load config file from command line -if ($#ARGV == -1 ){ - print "I need at least one parameter: Complete path to external configuration file \n"; - exit; -} - -# Check for file -if ( ! -f $archivo_cfg ) { - printf "\n [ERROR] Cannot open configuration file at $archivo_cfg. \n\n"; - exit 1; -} - -load_external_setup ($archivo_cfg); - -# Check for logparser, if not ready, skip all log check -if ( ! -f $plugin_setup{"logparser"} ) { - # Create a dummy check module with and advise warning - if ($log_items > 0) { - print_module("Error: Log parser not found", "async_string", 0, "Log parser not found, please check your configuration file and set it"); - } - $log_items =0; -} - - - - -# Webchecks -if ($webcheck_items > 0){ - my $ax; - - for ($ax=0; $ax < $webcheck_items; $ax++){ - - my ($name, $host, $port, $url, $string) = split (";",$plugin_setup{"webcheck"}[$ax]); - http_check ($name, $host, $port, $url, $string); - } -} - -# Check individual defined volumes -if ($volume_items > 0){ - my $ax; - - for ($ax=0; $ax < $volume_items; $ax++){ - my ($name, $volume) = split (";",$plugin_setup{"volume"}[$ax]); - if ($OS eq "MSWin32"){ - spare_system_disk_win ($name, $volume); - } else { - spare_system_disk ($name, $volume); - } - } -} - -# Check individual defined logs -if ($log_items > 0){ - my $ax; - - for ($ax=0; $ax < $log_items; $ax++){ - my ($logfile, $name, $expression) = split (";",$plugin_setup{"log"}[$ax]); - - # Verify proper valid values here or skip - if (!defined($logfile)){ - next; - } - - if (!defined($name)){ - next; - } - - if (!defined($expression)){ - next; - } - - alert_log ($logfile, $name, $expression); - } -} - - -# Check individual defined process -if ($process_items > 0){ - my $ax; - - for ($ax=0; $ax < $process_items; $ax++){ - - my ($name, $process) = split (";",$plugin_setup{"process"}[$ax]); - - if ($OS eq "MSWin32") { - process_status_win ($process, $name); - process_mem_win ($process, $name); - } else { - process_status_unix ($process, $name); - process_mem_unix ($process, $name); - process_cpu_unix ($process, $name); - } - } -} - -# Apache stats - -if ($plugin_setup{"apache_stats"} ne "") { - my ($name, $host, $port, $url) = split (";",$plugin_setup{"apache_stats"}); - apache_stats ($name, $host, $port, $url); -} - - diff --git a/pandora_agents/pc/Linux/pandora_agent.conf b/pandora_agents/pc/Linux/pandora_agent.conf index 45c7eb54bb..eb73fa06a3 100644 --- a/pandora_agents/pc/Linux/pandora_agent.conf +++ b/pandora_agents/pc/Linux/pandora_agent.conf @@ -311,4 +311,4 @@ module_plugin pandora_df #module_type log #module_regexp /var/log/messages #module_pattern .* -#module_end \ No newline at end of file +#module_end diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index c6c1a5d4ba..776895016f 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.776-240415 +Version: 7.0NG.776-240426 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 5a5ba493a4..d903d734ff 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.776-240415" +pandora_version="7.0NG.776-240426" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 716b7a33d3..11d3fbc342 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1039,7 +1039,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.776'; -use constant AGENT_BUILD => '240415'; +use constant AGENT_BUILD => '240426'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index bc946945ea..da92e682d5 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.776 -%define release 240415 +%define release 240426 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec index 7b3b86bf3e..d3ae159f29 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.776 -%define release 240415 +%define release 240426 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec index 0ea18b9521..a4921ff03a 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.776 -%define release 240415 +%define release 240426 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.spec b/pandora_agents/unix/pandora_agent.redhat_bin.spec index 8ec99fa455..9de653ff61 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.776 -%define release 240415 +%define release 240426 Summary: Pandora FMS Linux agent, binary version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 67d4db51aa..8c2d015bd3 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.776 -%define release 240415 +%define release 240426 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index bb68b0547e..f534ae2797 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.776" -PI_BUILD="240415" +PI_BUILD="240426" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/unix/plugins/autodiscover b/pandora_agents/unix/plugins/autodiscover old mode 100644 new mode 100755 index 01b9bd3d96..ca0f1be293 --- a/pandora_agents/unix/plugins/autodiscover +++ b/pandora_agents/unix/plugins/autodiscover @@ -22,12 +22,19 @@ try: from subprocess import PIPE from subprocess import DEVNULL from subprocess import getstatusoutput + import signal except ModuleNotFoundError as err: print("{} error: {}. Exiting...".format(argv[0], err), file=stderr) exit(1) module_list = [] -VERSION = "1.2" +VERSION = "1.3" + +# Define a function to handle the SIGTERM signal +def sigterm_handler(signum, frame): + print("Received SIGTERM signal. Cleaning up...") + sys.exit(0) +signal.signal(signal.SIGTERM, sigterm_handler) def win_service(servicelist, option=False, memcpu=False): @@ -74,7 +81,7 @@ def win_service(servicelist, option=False, memcpu=False): def lnx_service(services_list, memcpu=False): """Creates modules for Linux servers""" modules = [] - sysctl = getstatusoutput("command -v systemctl")[0] + sysctl = getstatusoutput("systemd-notify --booted")[0] servic = getstatusoutput("command -v service")[0] for srvc in services_list: status = None diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 915940c8f4..df2184c9de 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{240415} +{240426} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 8361ccfafc..4a92ac6038 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.776 Build 240415") +#define PANDORA_VERSION ("7.0NG.776 Build 240426") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 02a4d1a9e5..4c6daf186a 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Pandora FMS" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.776(Build 240415))" + VALUE "ProductVersion", "(7.0NG.776(Build 240426))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index a29cfd48d9..2764e03eec 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.776-240415 +Version: 7.0NG.776-240426 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 85a218609f..6aba46a7f2 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.776-240415" +pandora_version="7.0NG.776-240426" package_pear=0 package_pandora=1 diff --git a/pandora_console/api/v2/public/swagger.json b/pandora_console/api/v2/public/swagger.json index c432271fef..0b7acb3284 100644 --- a/pandora_console/api/v2/public/swagger.json +++ b/pandora_console/api/v2/public/swagger.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "title": "API Pandora FMS", - "description": "

This is the new API framework for Pandora FMS.

\n

The old API is deprecated but still functional, and not all old endpoints are supported in the new API, but new endpoints will be added in each release.

\n

Using this web interface, you can play around and see how it works each endpoint interactively.

\n\nMore useful links:\n\n* Pandora FMS Licence \n* Pandora FMS Official Support \n* Pandora FMS Community \n* Vulnerability Disclosure Policy \n* Pandora FMS FAQ ", + "description": "

This is the new API framework for Pandora FMS.

\n

The old API is deprecated but still functional, and not all old endpoints are supported in the new API, but new endpoints will be added in each release.

\n

Using this web interface, you can play around and see how it works each endpoint interactively.

\n\nMore useful links:\n\n * Pandora FMS Licence \n * Pandora FMS Official Support \n * Pandora FMS Community \n * Vulnerability Disclosure Policy \n * Pandora FMS FAQ ", "version": "0.0.1" }, "servers": [ @@ -1791,6 +1791,46 @@ ] } }, + "/user/{idUser}/login": { + "get": { + "tags": ["Users"], + "summary": "show user when login process", + "operationId": "1b50ee1984a43d87d69342174571775c", + "parameters": [ + { + "$ref": "#/components/parameters/parameterIdUser" + }, + { + "$ref": "#/components/parameters/parameterIdUserPass" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/ResponseUser" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, "/user/list": { "post": { "tags": ["Users"], @@ -4038,6 +4078,16 @@ "default": 1 } }, + "parameterIdUserPass": { + "name": "password", + "in": "query", + "description": "User password", + "required": true, + "schema": { + "type": "string", + "default": null + } + }, "parameterIdUser": { "name": "idUser", "in": "path", diff --git a/pandora_console/extensions/db_status.php b/pandora_console/extensions/db_status.php index 456e97be54..6fc5085e5b 100755 --- a/pandora_console/extensions/db_status.php +++ b/pandora_console/extensions/db_status.php @@ -50,10 +50,7 @@ function extension_db_status() } ui_print_info_message( - __('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.') - ); - ui_print_info_message( - __('At the moment the checks is for MySQL/MariaDB.') + ' - '.__('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.').'
'.' - '.__('At the moment the checks is for MySQL/MariaDB.').'
'.' - '.__('User must have Select, Drop, Create and References privileges.') ); echo "
"; @@ -164,61 +161,109 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d $db_name = explode(' ', $db_name); $db_name = $db_name[0]; - if ($config['mysqli'] === true) { - $connection_test = mysqli_connect($db_host, $db_user, $db_password); - } else { - $connection_test = mysql_connect($db_host, $db_user, $db_password); + if (!$db_host) { + ui_print_error_message(__('A host must be provided')); + return; + } + + if (!$db_name) { + ui_print_error_message(__('A DB name must be provided')); + return; + } + + try { + if ($config['mysqli']) { + $connection_test = mysqli_connect($db_host, $db_user, $db_password); + } else { + $connection_test = mysql_connect($db_host, $db_user, $db_password); + } + } catch (Exception $e) { + $connection_test = false; } if (!$connection_test) { - ui_print_error_message( - __('Unsuccessful connected to the DB') - ); - } else { - if ($config['mysqli'] === true) { + ui_print_error_message(__('Unsuccessful connected to the DB')); + return; + } + + try { + $query = "SELECT IF(EXISTS(SELECT 1 FROM information_schema.SCHEMATA WHERE schema_name = '$db_name'), 'true', 'false') AS result"; + if ($config['mysqli']) { + $exist_db = mysqli_fetch_assoc(mysqli_query($connection_test, $query))['result']; + } else { + $exist_db = mysql_fetch_assoc(mysqli_query($connection_test, $query))['result']; + } + } catch (Exception $e) { + ui_print_error_message(__("There was a problem during verification of the existence of the `$db_name` table")); + return; + } + + if ($exist_db == 'true') { + ui_print_error_message(__("The testing DB `$db_name` already exists")); + return; + } + + if (check_drop_privileges($connection_test) == 0) { + return; + } + + try { + if ($config['mysqli']) { $create_db = mysqli_query($connection_test, "CREATE DATABASE `$db_name`"); } else { $create_db = mysql_query("CREATE DATABASE `$db_name`"); } - - if (!$create_db) { - ui_print_error_message( - __('Unsuccessful created the testing DB') - ); - } else { - if ($config['mysqli'] === true) { - mysqli_select_db($connection_test, $db_name); - } else { - mysql_select_db($db_name, $connection_test); - } - - $install_tables = extension_db_status_execute_sql_file( - $config['homedir'].'/pandoradb.sql', - $connection_test - ); - - if (!$install_tables) { - ui_print_error_message( - __('Unsuccessful installed tables into the testing DB') - ); - } else { - extension_db_check_tables_differences( - $connection_test, - $connection_system, - $db_name, - $config['dbname'] - ); - } - - if ($config['mysqli'] === true) { - mysqli_select_db($connection_test, $db_name); - mysqli_query($connection_test, "DROP DATABASE IF EXISTS `$db_name`"); - } else { - mysql_select_db($db_name, $connection_test); - mysql_query("DROP DATABASE IF EXISTS `$db_name`", $connection_test); - } - } + } catch (Exception $e) { + $connection_test = false; } + + if (!$create_db) { + ui_print_error_message(__('Unsuccessful created the testing DB')); + return; + } + + if (check_ref_privileges($connection_test) == 0) { + drop_database($connection_test, $db_name); + ui_print_error_message(__('Unable to create references with the provided user please check its privileges')); + return; + } + + if (check_explain_privileges($connection_test) == 0) { + drop_database($connection_test, $db_name); + ui_print_error_message(__('Unable to explain with the provided user please check its privileges')); + return; + } + + try { + if ($config['mysqli'] === true) { + mysqli_select_db($connection_test, $db_name); + } else { + mysql_select_db($db_name, $connection_test); + } + } catch (Exception $e) { + drop_database($connection_test, $db_name); + ui_print_error_message(__('There was an error selecting the DB')); + return; + } + + $install_tables = extension_db_status_execute_sql_file( + $config['homedir'].'/pandoradb.sql', + $connection_test + ); + + if (!$install_tables) { + ui_print_error_message(__('Unsuccessful installed tables into the testing DB')); + return; + } + + extension_db_check_tables_differences( + $connection_test, + $connection_system, + $db_name, + $config['dbname'] + ); + + drop_database($connection_test, $db_name); } @@ -296,25 +341,19 @@ function extension_db_check_tables_differences( if ($config['mysqli'] === true) { mysqli_select_db($connection_test, $db_name_test); $result = mysqli_query($connection_test, 'SHOW CREATE TABLE '.$table); - $tables_test = []; - while ($row = mysql_fetch_array($result)) { - ui_print_info_message( - __('You can execute this SQL query for to fix.').'
'.'
'.$row[1].'
' - ); - } - + $create_query = mysqli_fetch_assoc($result)['Create Table']; mysqli_free_result($result); + ui_print_info_message( + __('You can execute this SQL query for to fix.').'
'.'
'.$create_query.'
' + ); } else { mysql_select_db($db_name_test, $connection_test); $result = mysql_query('SHOW CREATE TABLE '.$table, $connection_test); - $tables_test = []; - while ($row = mysql_fetch_array($result)) { - ui_print_info_message( - __('You can execute this SQL query for to fix.').'
'.'
'.$row[1].'
' - ); - } - + $create_query = mysqli_fetch_assoc($result)['Create Table']; mysql_free_result($result); + ui_print_info_message( + __('You can execute this SQL query for to fix.').'
'.'
'.$create_query.'
' + ); } } } @@ -489,19 +528,16 @@ function extension_db_status_execute_sql_file($url, $connection) $query .= $sql_line; if (preg_match("/;[\040]*\$/", $sql_line)) { if ($config['mysqli'] === true) { - if (!$result = mysqli_query($connection, $query)) { - echo mysqli_error(); - // Uncomment for debug - echo "
$query
"; - return 0; - } + $result = mysqli_query($connection, $query); } else { - if (!$result = mysql_query($query, $connection)) { - echo mysql_error(); - // Uncomment for debug - echo "
$query
"; - return 0; - } + $result = mysql_query($query, $connection); + } + + if (!$result) { + echo mysqli_error($connection); + // Uncomment for debug + echo "
$query
"; + return 0; } $query = ''; @@ -516,5 +552,200 @@ function extension_db_status_execute_sql_file($url, $connection) } +function check_explain_privileges($connection) +{ + global $config; + $has_privileges = 1; + + $explain_check = 'EXPLAIN tb1'; + + $create_tb1 = 'CREATE TABLE tb1 ( + id INT AUTO_INCREMENT PRIMARY KEY + )'; + + drop_database($connection, 'pandora_tmp_privilege_check'); + + try { + if ($config['mysqli']) { + mysqli_query($connection, 'CREATE DATABASE `pandora_tmp_privilege_check`'); + } else { + mysql_query('CREATE DATABASE `pandora_tmp_privilege_check`', $connection); + } + } catch (Exception $e) { + ui_print_error_message(__('There was an error creating the DB during reference check')); + return 0; + } + + try { + if ($config['mysqli'] === true) { + mysqli_select_db($connection, 'pandora_tmp_privilege_check'); + } else { + mysql_select_db('reference_check', $connection); + } + } catch (Exception $e) { + ui_print_error_message(__('There was an error selecting the DB during reference check')); + return 0; + } + + try { + if ($config['mysqli'] === true) { + $result = mysqli_query($connection, $create_tb1); + } else { + $result = mysql_query($create_tb1, $connection); + } + + if (!$result) { + throw new Exception('Error on explain check: '.$connection->error); + } + + if ($config['mysqli'] === true) { + $result = mysqli_query($connection, $explain_check); + } else { + $result = mysql_query($explain_check, $connection); + } + + if (!$result) { + throw new Exception('Error on explain check: '.$connection->error); + } + } catch (Exception $e) { + $has_privileges = 0; + } finally { + drop_database($connection, 'pandora_tmp_privilege_check'); + return $has_privileges; + } +} + + +function check_drop_privileges($connection) +{ + global $config; + $has_privileges = 1; + + try { + if ($config['mysqli']) { + $create_db = mysqli_query($connection, 'CREATE DATABASE IF NOT EXISTS`pandora_tmp_privilege_check`'); + } else { + $create_db = mysql_query('CREATE DATABASE IF NOT EXISTS `pandora_tmp_privilege_check`', $connection); + } + } catch (Exception $e) { + $error_message = $e->getMessage(); + } + + if (!$create_db) { + if (stripos($error_message, 'access denied for user') !== false) { + preg_match("/'.+?'\@'.+?'/", $error_message, $error_user); + $error_user = $error_user[0]; + ui_print_error_message(__('Unable to create databases with the provided user please check its privileges')); + return 0; + } + + ui_print_error_message(__('There was an error creating the DB during drop check')); + return 0; + } + + try { + if ($config['mysqli'] === true) { + mysqli_select_db($connection, 'pandora_tmp_privilege_check'); + } else { + mysql_select_db('reference_check', $connection); + } + } catch (Exception $e) { + ui_print_error_message(__('There was an error selecting the DB during drop check')); + return 0; + } + + try { + drop_database($connection, 'pandora_tmp_privilege_check'); + } catch (Exception $e) { + $has_privileges = 0; + ui_print_error_message( + __('Unable to drop databases with the provided user please check its privileges.').'
'.__('Test databases may have been left over due to lack of drop privileges.') + ); + } finally { + return $has_privileges; + } +} + + +function check_ref_privileges($connection) +{ + global $config; + $has_privileges = 1; + + drop_database($connection, 'pandora_tmp_privilege_check'); + + $create_tb1 = 'CREATE TABLE tb1 ( + id INT AUTO_INCREMENT PRIMARY KEY + )'; + + $create_tb2 = 'CREATE TABLE tb2 ( + id INT AUTO_INCREMENT PRIMARY KEY, + id_tb1 INT, + FOREIGN KEY (id_tb1) REFERENCES tb2(id) + )'; + + try { + if ($config['mysqli']) { + mysqli_query($connection, 'CREATE DATABASE `pandora_tmp_privilege_check`'); + } else { + mysql_query('CREATE DATABASE `pandora_tmp_privilege_check`', $connection); + } + } catch (Exception $e) { + ui_print_error_message(__('There was an error creating the DB during reference check')); + return 0; + } + + try { + if ($config['mysqli'] === true) { + mysqli_select_db($connection, 'pandora_tmp_privilege_check'); + } else { + mysql_select_db('reference_check', $connection); + } + } catch (Exception $e) { + ui_print_error_message(__('There was an error selecting the DB during reference check')); + return 0; + } + + try { + if ($config['mysqli'] === true) { + $result = mysqli_query($connection, $create_tb1); + } else { + $result = mysql_query($create_tb1, $connection); + } + + if (!$result) { + throw new Exception('Error on reference check: '.$connection->error); + } + + if ($config['mysqli'] === true) { + $result = mysqli_query($connection, $create_tb2); + } else { + $result = mysql_query($create_tb2, $connection); + } + + if (!$result) { + throw new Exception('Error on reference check: '.$connection->error); + } + } catch (Exception $e) { + $has_privileges = 0; + } finally { + drop_database($connection, 'pandora_tmp_privilege_check'); + return $has_privileges; + } +} + + +function drop_database($connection, $database) +{ + global $config; + + if ($config['mysqli'] === true) { + mysqli_query($connection, "DROP DATABASE IF EXISTS `$database`"); + } else { + mysql_query("DROP DATABASE IF EXISTS `$database`", $connection); + } +} + + extensions_add_godmode_function('extension_db_status'); extensions_add_godmode_menu_option(__('DB Schema check'), 'DM', 'gextensions', null, 'v1r1', 'gdbman'); diff --git a/pandora_console/extensions/realtime_graphs.php b/pandora_console/extensions/realtime_graphs.php index 77b660fd1c..bf466f001d 100644 --- a/pandora_console/extensions/realtime_graphs.php +++ b/pandora_console/extensions/realtime_graphs.php @@ -81,30 +81,34 @@ function pandora_realtime_graphs() $table->style = []; $table->data = []; - $graph_fields['cpu_load'] = __('%s Server CPU', get_product_name()); - $graph_fields['pending_packets'] = __( - 'Pending packages from %s Server', - get_product_name() - ); - $graph_fields['disk_io_wait'] = __( - '%s Server Disk IO Wait', - get_product_name() - ); - $graph_fields['apache_load'] = __( - '%s Server Apache load', - get_product_name() - ); - $graph_fields['mysql_load'] = __( - '%s Server MySQL load', - get_product_name() - ); - $graph_fields['server_load'] = __( - '%s Server load', - get_product_name() - ); + $graph = get_parameter('graph', 'snmp_interface'); + if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { + $graph = get_parameter('graph', 'cpu_load'); + $graph_fields['cpu_load'] = __('%s Server CPU', get_product_name()); + $graph_fields['pending_packets'] = __( + 'Pending packages from %s Server', + get_product_name() + ); + $graph_fields['disk_io_wait'] = __( + '%s Server Disk IO Wait', + get_product_name() + ); + $graph_fields['apache_load'] = __( + '%s Server Apache load', + get_product_name() + ); + $graph_fields['mysql_load'] = __( + '%s Server MySQL load', + get_product_name() + ); + $graph_fields['server_load'] = __( + '%s Server load', + get_product_name() + ); + } + $graph_fields['snmp_interface'] = __('SNMP Interface throughput'); - $graph = get_parameter('graph', 'cpu_load'); $refresh = get_parameter('refresh', '1000'); if ($graph != 'snmp_module') { diff --git a/pandora_console/extensions/realtime_graphs/ajax.php b/pandora_console/extensions/realtime_graphs/ajax.php index 1482540f91..4d1d2e816f 100644 --- a/pandora_console/extensions/realtime_graphs/ajax.php +++ b/pandora_console/extensions/realtime_graphs/ajax.php @@ -27,7 +27,7 @@ switch ($graph) { if ($os == 'windows') { $data = exec('wmic cpu get loadpercentage|find /I /V "Loadpercentage" | findstr /r "[0-9]" '); } else { - $data = exec("top -bn 2 -d 0.01 | grep '^Cpu' | tail -n 1 | awk '{ print $2+$4+$6 }'"); + $data = exec("top -bn 2 -d 0.01 | grep 'Cpu' | tail -n 1 | awk '{ print $2+$4+$6 }'"); } break; @@ -55,7 +55,8 @@ switch ($graph) { if ($os == 'windows') { $data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(httpd)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."'); } else { - $data = exec("ps aux | grep apache2 | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'"); + $apache = exec('ps aux | grep apache2 | grep -v safe | grep -v grep && echo 1 || echo 0') == 1 ? 'apache2' : 'apache'; + $data = exec("ps aux | grep $apache | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'"); } break; @@ -63,7 +64,7 @@ switch ($graph) { if ($os == 'windows') { $data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(pandora_server)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."'); } else { - $data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ print $3 }'"); + $data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ sum+=$3 } END { print sum }'"); } break; diff --git a/pandora_console/extras/delete_files/delete_files.txt b/pandora_console/extras/delete_files/delete_files.txt index 91943a5994..7319ddee4b 100644 --- a/pandora_console/extras/delete_files/delete_files.txt +++ b/pandora_console/extras/delete_files/delete_files.txt @@ -1749,3 +1749,6 @@ enterprise/include/class/SAP.app.php enterprise/include/class/VMware.app.php enterprise/include/class/DatabaseHA.class.php enterprise/godmode/servers/HA_cluster.php +enterprise/godmode/setup/edit_skin.php +enterprise/godmode/setup/setup_skins.php +enterprise/include/functions_skins.php \ No newline at end of file diff --git a/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini b/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini index 2fcd79a8ce..c4b4591ce2 100644 --- a/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini +++ b/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini @@ -1,4 +1,4 @@ -pandorafms.vmware=a272ee00a9b5f201bb708bef72bbe276 +pandorafms.vmware=3d1785e1baa07db0a40b9e47bb30472c pandorafms.mysql=33d470c7492214d4b384ed307e81adf4 pandorafms.vmware=1deafce1d55d3574645d8b136104e9ad pandorafms.mysql=ca7dd8b80a1a03a25eb0fb077818ad63 diff --git a/pandora_console/extras/mr/68.sql b/pandora_console/extras/mr/68.sql index b27f4ee495..fc08eb8b12 100644 --- a/pandora_console/extras/mr/68.sql +++ b/pandora_console/extras/mr/68.sql @@ -64,7 +64,7 @@ ALTER TABLE `tmerge_queries` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_09 -- Update version for plugin oracle UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle'; -- Update version for plugin oracle -UPDATE `tdiscovery_apps` SET `version` = '1.3' WHERE `short_name` = 'pandorafms.vmware'; +UPDATE `tdiscovery_apps` SET `version` = '1.4' WHERE `short_name` = 'pandorafms.vmware'; ALTER TABLE `tevent_sound` MODIFY COLUMN `name` text NULL; ALTER TABLE `tevent_sound` MODIFY COLUMN `sound` text NULL; diff --git a/pandora_console/extras/mr/69.sql b/pandora_console/extras/mr/69.sql index e3c0cebe1c..f21e7ae942 100644 --- a/pandora_console/extras/mr/69.sql +++ b/pandora_console/extras/mr/69.sql @@ -1,6 +1,12 @@ START TRANSACTION; -DROP TABLE tskin; +-- Remove column id_usuario_destino from tmensajes -- +SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tmensajes' AND COLUMN_NAME='id_usuario_destino' AND table_schema = DATABASE()); +SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tmensajes` DROP COLUMN `id_usuario_destino`', 'SELECT ""'); +prepare stmt from @sqlstmt; +execute stmt; + +DROP TABLE IF EXISTS tskin; ALTER TABLE tfavmenu_user CONVERT TO CHARACTER SET UTF8MB4; ALTER TABLE tfiles_repo CONVERT TO CHARACTER SET UTF8MB4; @@ -7712,6 +7718,8 @@ UPDATE `twelcome_tip` SET url = 'https://pandorafms.com/manual/!current/start?id DELETE FROM tconfig WHERE `token` = 'legacy_database_ha'; +UPDATE tncm_script SET `content` = 'sleep:1 capture:export\n\r exit\n\r' where `content` = 'sleep:1 capture:system resource print\n\r exit\n\r'; + -- Add new columns in tdeployment_hosts ALTER TABLE `tdeployment_hosts` ADD COLUMN `deploy_method` ENUM('SSH', 'HTTP', 'HTTPS') DEFAULT 'SSH'; ALTER TABLE `tdeployment_hosts` ADD COLUMN `deploy_port` INT UNSIGNED NOT NULL DEFAULT 22; @@ -7723,7 +7731,7 @@ UPDATE SET `tdeployment_hosts`.`deploy_method` = 'HTTP', `tdeployment_hosts`.`deploy_port` = 5985, - `tdeployment_hosts`.`temp_folder` = 'C:\Widnows\Temp' + `tdeployment_hosts`.`temp_folder` = 'C:\Windows\Temp' WHERE `tdeployment_hosts`.`id_os` = `tconfig_os`.`id_os` AND `tconfig_os`.`name` = 'Windows' AND `tdeployment_hosts`.`deployed` = 0; @@ -7746,6 +7754,11 @@ ALTER TABLE `tdeployment_hosts` DROP COLUMN `arch`; -- Update all deployment recon tasks port UPDATE `trecon_task` SET `field4` = 41121 WHERE `type` = 9; +-- Update execution in proxmox discovery plugin +SET @short_name = 'pandorafms.proxmox'; +SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name; +UPDATE `tdiscovery_apps_executions` SET `execution` = ''_exec1_' --conf '_tempfileProxmox_'' WHERE `id_app` = @id_app; + INSERT INTO `tconfig` (`token`, `value`) VALUES ('JWT_signature', 1); DELETE FROM tconfig WHERE `token` = 'loginhash_pwd'; diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 2d3d95a77e..a396964166 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -52,7 +52,7 @@ echo sprintf('
', $menuTypeClass); } // ======= Servers List =============================================== - if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) { + if ((bool) check_acl($config['id_user'], 0, 'PM') !== false) { $servers = []; $servers_info = servers_get_info(); diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 649e730155..ad1cf0f380 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -386,52 +386,32 @@ if ($access_console_node === true) { $menu_godmode['galertas']['sub'] = $sub; } - if ((bool) check_acl($config['id_user'], 0, 'AW') === true || (bool) check_acl($config['id_user'], 0, 'PM') === true) { + if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { // Servers. $menu_godmode['gservers']['text'] = __('Servers'); $menu_godmode['gservers']['sec2'] = 'godmode/servers/modificar_server'; $menu_godmode['gservers']['id'] = 'god-servers'; - $sub = []; - - if ((bool) check_acl($config['id_user'], 0, 'AW') === true) { - $sub['godmode/servers/modificar_server']['text'] = __('Manage servers'); - $sub['godmode/servers/modificar_server']['id'] = 'Manage_servers'; - } - - if ((bool) check_acl($config['id_user'], 0, 'PM') === true - || is_user_admin($config['id_user']) === true - ) { - $sub['godmode/consoles/consoles']['text'] = __('Manage consoles'); - $sub['godmode/consoles/consoles']['id'] = 'Manage consoles'; - } - + $sub['godmode/servers/modificar_server']['text'] = __('Manage servers'); + $sub['godmode/servers/modificar_server']['id'] = 'Manage_servers'; + $sub['godmode/consoles/consoles']['text'] = __('Manage consoles'); + $sub['godmode/consoles/consoles']['id'] = 'Manage consoles'; // This subtabs are only for Pandora Admin. - if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { - enterprise_hook('ha_cluster'); - - $sub['godmode/servers/plugin']['text'] = __('Plugins'); - $sub['godmode/servers/plugin']['id'] = 'Plugins'; - - $sub['godmode/servers/plugin_registration']['text'] = __('Register Plugin'); - $sub['godmode/servers/plugin_registration']['id'] = 'register_plugin'; - - enterprise_hook('export_target_submenu'); - - enterprise_hook('manage_satellite_submenu'); - } - + enterprise_hook('ha_cluster'); + $sub['godmode/servers/plugin']['text'] = __('Plugins'); + $sub['godmode/servers/plugin']['id'] = 'Plugins'; + $sub['godmode/servers/plugin_registration']['text'] = __('Register Plugin'); + $sub['godmode/servers/plugin_registration']['id'] = 'register_plugin'; + enterprise_hook('export_target_submenu'); + enterprise_hook('manage_satellite_submenu'); $menu_godmode['gservers']['sub'] = $sub; - } - if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { // Setup. $menu_godmode['gsetup']['text'] = __('Settings'); $menu_godmode['gsetup']['sec2'] = 'general'; $menu_godmode['gsetup']['id'] = 'god-setup'; $sub = []; - // Options Setup. $sub['general']['text'] = __('System Settings'); $sub['general']['id'] = 'Setup'; @@ -457,41 +437,31 @@ if ($access_console_node === true) { $sub2['godmode/setup/setup§ion=vis']['text'] = __('Visual styles'); $sub2['godmode/setup/setup§ion=vis']['refr'] = 0; - if ((bool) check_acl($config['id_user'], 0, 'AW') === true) { - if ((bool) $config['activate_netflow'] === true) { - $sub2['godmode/setup/setup§ion=net']['text'] = __('Netflow'); - $sub2['godmode/setup/setup§ion=net']['refr'] = 0; - } + if ((bool) $config['activate_netflow'] === true) { + $sub2['godmode/setup/setup§ion=net']['text'] = __('Netflow'); + $sub2['godmode/setup/setup§ion=net']['refr'] = 0; + } - if ((bool) $config['activate_sflow'] === true) { - $sub2['godmode/setup/setup§ion=sflow']['text'] = __('Sflow'); - $sub2['godmode/setup/setup§ion=sflow']['refr'] = 0; - } + if ((bool) $config['activate_sflow'] === true) { + $sub2['godmode/setup/setup§ion=sflow']['text'] = __('Sflow'); + $sub2['godmode/setup/setup§ion=sflow']['refr'] = 0; } $sub2['godmode/setup/setup§ion=pandorarc']['text'] = __('Pandora RC'); $sub2['godmode/setup/setup§ion=pandorarc']['refr'] = 0; - $sub2['godmode/setup/setup§ion=ITSM']['text'] = __('ITSM'); $sub2['godmode/setup/setup§ion=ITSM']['refr'] = 0; - enterprise_hook('module_library_submenu'); - $sub2['godmode/setup/setup§ion=notifications']['text'] = __('Notifications'); $sub2['godmode/setup/setup§ion=notifications']['refr'] = 0; - $sub2['godmode/setup/setup§ion=quickshell']['text'] = __('QuickShell'); $sub2['godmode/setup/setup§ion=quickshell']['refr'] = 0; - $sub2['godmode/setup/setup§ion=external_tools']['text'] = __('External Tools'); $sub2['godmode/setup/setup§ion=external_tools']['refr'] = 0; - $sub2['godmode/setup/setup§ion=welcome_tips']['text'] = __('Welcome Tips'); $sub2['godmode/setup/setup§ion=welcome_tips']['refr'] = 0; - $sub2['godmode/setup/setup§ion=demo_data']['text'] = __('Demo data'); $sub2['godmode/setup/setup§ion=demo_data']['refr'] = 0; - if ((bool) $config['activate_gis'] === true) { $sub2['godmode/setup/setup§ion=gis']['text'] = __('Map conections GIS'); } @@ -503,6 +473,13 @@ if ($access_console_node === true) { enterprise_hook('translate_string_submenu'); $menu_godmode['gsetup']['sub'] = $sub; + } else if ((bool) check_acl($config['id_user'], 0, 'AW') === true) { + $menu_godmode['gservers']['text'] = __('Servers'); + $menu_godmode['gservers']['sec2'] = 'godmode/servers/modificar_server'; + $menu_godmode['gservers']['id'] = 'god-servers'; + $sub = []; + enterprise_hook('manage_satellite_submenu'); + $menu_godmode['gservers']['sub'] = $sub; } } diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index d7cd12e08f..945739bc74 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -52,6 +52,11 @@ if (! check_acl($config['id_user'], 0, 'RW') exit; } +// Get pandora black theme. +if ($config['style'] === 'pandora_black') { + html_print_input_hidden('selected_style_theme', 'pandora_black'); +} + $meta = false; if (($config['metaconsole'] == 1) && (defined('METACONSOLE'))) { $meta = true; @@ -2338,7 +2343,7 @@ if (is_metaconsole() === true) { if ($idAgent) { $sql = 'SELECT id_agente_modulo, nombre FROM tagente_modulo - WHERE id_agente = "'.$idAgent['id_agent'].'" AND delete_pending = 0'; + WHERE id_agente = "'.$idAgent.'" AND delete_pending = 0'; if ($meta) { $connection = metaconsole_get_connection($server_name); @@ -6190,7 +6195,12 @@ $(document).ready (function () { }); }); - defineTinyMCE('#textarea_render_definition'); + var consoleStyle = $("#hidden-selected_style_theme").val(); + if (consoleStyle == "pandora_black") { + defineTinyMCEDark('#textarea_render_definition'); + } else { + defineTinyMCE('#textarea_render_definition'); + } $("#checkbox-select_by_group").change(function () { var select_by_group = $('#checkbox-select_by_group').prop('checked'); diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 9681d79102..b9395323b8 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1328,6 +1328,25 @@ switch ($action) { ], true ); + } else if (check_acl($config['id_user'], 0, 'RR')) { + $tablePagination = ui_pagination( + $total_reports, + $url, + $offset, + $pagination, + true, + 'offset', + $show_count + ); + + echo html_print_action_buttons( + '', + [ + 'type' => 'form_action', + 'right_content' => $tablePagination, + ], + true + ); } return; @@ -2407,7 +2426,7 @@ switch ($action) { $values['top_n_value'] = get_parameter('max_items'); $values['server_name'] = get_parameter('combo_server_sql'); - if ($sql !== '') { + if ($sql !== '' && $sql !== null) { // Replaces possible macros to check the validity of the query $macros_sql = $sql; $macros_sql = str_replace('_start_date_', '0', $macros_sql); @@ -3357,7 +3376,7 @@ switch ($action) { $values['server_name'] = get_parameter('combo_server_sql'); - if ($sql !== '') { + if ($sql !== '' && $sql !== null) { // Replaces possible macros to check the validity of the query $macros_sql = $sql; $macros_sql = str_replace('_start_date_', '0', $macros_sql); diff --git a/pandora_console/godmode/reporting/visual_console_builder.elements.php b/pandora_console/godmode/reporting/visual_console_builder.elements.php index bd96be794b..f03b26cc9d 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.elements.php +++ b/pandora_console/godmode/reporting/visual_console_builder.elements.php @@ -114,6 +114,7 @@ foreach ($all_images as $image_file) { $table = new stdClass(); $table->width = '100%'; $table->class = 'databox filter-table-adv'; +$table->styleTable = 'min-width: 900px; table-layout:fixed;'; $table->head = []; $table->head['icon'] = ''; @@ -122,8 +123,7 @@ $table->head[1] = __('Image').'
'.__('Module').' / '.__('Custom graph'); $table->head[2] = __('Width x Height
Max value'); $table->head[3] = __('Position').'
'.__('Period'); $table->head[4] = __('Parent').'
'.__('Map linked'); -$table->head[5] = ''; -$table->head[5] .= '   '.html_print_checkbox( +$table->head[5] = html_print_checkbox( 'head_multiple_delete', '', false, @@ -133,41 +133,66 @@ $table->head[5] .= '   '.html_print_checkbox( ); $table->head[5] .= '   '.__('A.').''; -$table->size = []; -$table->size['icon'] = '1%'; -$table->size[0] = '28%'; -$table->size[1] = ''; -$table->size[2] = '25%'; -$table->size[3] = '27%'; -$table->size[4] = '7%'; -$table->size[5] = '15%'; - +$table->headstyle = []; +$table->headstyle['icon'] = 'text-align:left; width: 1%;'; +$table->headstyle[0] = 'text-align:left; width: 19%;'; +$table->headstyle[1] = 'text-align:left; width: 19%;'; +$table->headstyle[2] = 'text-align:left; width: 19%;'; +$table->headstyle[3] = 'text-align:left; width: 19%;'; +$table->headstyle[4] = 'text-align:left; width: 19%;'; +$table->headstyle[5] = 'text-align:right; width: 4%;'; $table->align = []; - -if (!defined('METACONSOLE')) { - $table->headstyle[0] = 'text-align:left;'; - $table->headstyle[1] = 'text-align:left'; - $table->headstyle[2] = 'text-align:left'; - $table->headstyle[3] = 'text-align:left'; - $table->headstyle[4] = 'text-align:left'; - $table->headstyle[5] = 'text-align:left'; - $table->align[0] = 'left'; - $table->align[1] = 'left'; - $table->align[2] = 'left'; - $table->align[3] = 'left'; - $table->align[4] = 'left'; - $table->align[5] = 'left'; -} +$table->align[0] = 'left'; +$table->align[1] = 'left'; +$table->align[2] = 'left'; +$table->align[3] = 'left'; +$table->align[4] = 'left'; +$table->align[5] = 'right'; $table->data = []; -// Background +// Background. $table->data[0]['icon'] = ''; -$table->data[0][0] = '
'.__('Background').'
'; -$table->data[0][1] = '
'.html_print_select($backgrounds_list, 'background', $visualConsole['background'], '', 'None', '', true, false, true, '', false, 'width: 120px;').'
'; -$table->data[0][2] = '
'.html_print_input_text('width', $visualConsole['width'], '', 3, 5, true).' x '.html_print_input_text('height', $visualConsole['height'], '', 3, 5, true).'
'; -$table->data[0][3] = $table->data[0][4] = $table->data[0][5] = ''; +$table->data[0][0] = '
'.__('Background').'
'; +$table->data[0][1] = '
'; +$table->data[0][1] .= html_print_select( + $backgrounds_list, + 'background', + $visualConsole['background'], + '', + 'None', + '', + true, + false, + true, + '', + false, + 'width: 100%;' +); +$table->data[0][1] .= '
'; +$table->data[0][2] = '
'; +$table->data[0][2] .= html_print_input_text( + 'width', + $visualConsole['width'], + '', + 3, + 5, + true +); +$table->data[0][2] .= 'x'; +$table->data[0][2] .= html_print_input_text( + 'height', + $visualConsole['height'], + '', + 3, + 5, + true +); +$table->data[0][2] .= '
'; +$table->data[0][3] = ''; +$table->data[0][4] = ''; +$table->data[0][5] = ''; $i = 1; $layoutDatas = db_get_all_rows_field_filter( @@ -186,7 +211,7 @@ $x = 0; foreach ($layoutDatas as $layoutData) { $idLayoutData = $layoutData['id']; - // line between rows + // Line between rows. $table->data[$i][0] = '
'; $table->colspan[$i][0] = '8'; @@ -208,7 +233,7 @@ foreach ($layoutDatas as $layoutData) { true, [ 'title' => __('Percentile Bar'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); break; @@ -219,7 +244,7 @@ foreach ($layoutDatas as $layoutData) { true, [ 'title' => __('Percentile Bubble'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); break; @@ -231,7 +256,7 @@ foreach ($layoutDatas as $layoutData) { true, [ 'title' => __('Percentile'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); break; @@ -413,7 +438,7 @@ foreach ($layoutDatas as $layoutData) { break; default: - if (enterprise_installed()) { + if (enterprise_installed() === true) { $table->data[($i + 1)]['icon'] = enterprise_visual_map_print_list_element('icon', $layoutData); } else { $table->data[($i + 1)]['icon'] = ''; @@ -421,26 +446,27 @@ foreach ($layoutDatas as $layoutData) { break; } - - // First row - // Label + // Label. switch ($layoutData['type']) { case ICON: case BOX_ITEM: case NETWORK_LINK: case LINE_ITEM: - // hasn't the label. + // Hasn't the label. $table->data[($i + 1)][0] = ''; break; default: - $table->data[($i + 1)][0] = ''.html_print_input_hidden('label_'.$idLayoutData, $layoutData['label'], true).''.__('Edit label').''.''; + $table->data[($i + 1)][0] = ''; + $table->data[($i + 1)][0] .= html_print_input_hidden('label_'.$idLayoutData, $layoutData['label'], true); + $table->data[($i + 1)][0] .= ''; + $table->data[($i + 1)][0] .= __('Edit label'); + $table->data[($i + 1)][0] .= ''; break; } - - // Image + // Image. switch ($layoutData['type']) { case STATIC_GRAPH: case ICON: @@ -458,7 +484,7 @@ foreach ($layoutDatas as $layoutData) { true, '', false, - 'width: 120px' + 'width: 100%' ); break; @@ -467,47 +493,102 @@ foreach ($layoutDatas as $layoutData) { break; } + // Position. + $readonly = false; + if ($layoutData['type'] == NETWORK_LINK || $layoutData['type'] == LINE_ITEM) { + $readonly = true; + } - - // Width and height + // Width and height. switch ($layoutData['type']) { - case NETWORK_LINK: - case LINE_ITEM: - // hasn't the width and height. - $table->data[($i + 1)][2] = ''; - break; - case COLOR_CLOUD: - $table->data[($i + 1)][2] = html_print_input_text('width_'.$idLayoutData, $layoutData['width'], '', 2, 5, true).' x '.html_print_input_text('height_'.$idLayoutData, $layoutData['width'], '', 2, 5, true); + $table->data[($i + 1)][2] = '
'; + $table->data[($i + 1)][2] .= html_print_input_text( + 'width_'.$idLayoutData, + $layoutData['width'], + '', + 2, + 5, + true + ); + $table->data[($i + 1)][2] .= 'x'; + $table->data[($i + 1)][2] .= html_print_input_text( + 'height_'.$idLayoutData, + $layoutData['width'], + '', + 2, + 5, + true + ); + $table->data[($i + 1)][2] .= '
'; break; case CIRCULAR_PROGRESS_BAR: case CIRCULAR_INTERIOR_PROGRESS_BAR: case PERCENTILE_BUBBLE: case PERCENTILE_BAR: - $table->data[($i + 1)][2] = html_print_input_text('width_'.$idLayoutData, $layoutData['width'], '', 2, 5, true); + $table->data[($i + 1)][2] = '
'; + $table->data[($i + 1)][2] .= html_print_input_text( + 'width_'.$idLayoutData, + $layoutData['width'], + '', + 2, + 5, + true + ); + $table->data[($i + 1)][2] .= '
'; break; default: - $table->data[($i + 1)][2] = html_print_input_text('width_'.$idLayoutData, $layoutData['width'], '', 2, 5, true).' x '.html_print_input_text('height_'.$idLayoutData, $layoutData['height'], '', 2, 5, true); + $table->data[($i + 1)][2] = '
'; + $table->data[($i + 1)][2] .= html_print_input_text( + 'width_'.$idLayoutData, + $layoutData['width'], + '', + 2, + 5, + true, + $readonly + ); + $table->data[($i + 1)][2] .= 'x'; + $table->data[($i + 1)][2] .= html_print_input_text( + 'height_'.$idLayoutData, + $layoutData['height'], + '', + 2, + 5, + true, + $readonly + ); + $table->data[($i + 1)][2] .= '
'; break; } - // Position - switch ($layoutData['type']) { - case NETWORK_LINK: - case LINE_ITEM: - // hasn't the width and height. - $table->data[($i + 1)][3] = ''; - break; + $table->data[($i + 1)][3] = '
'; + $table->data[($i + 1)][3] .= '('; + $table->data[($i + 1)][3] .= html_print_input_text( + 'left_'.$idLayoutData, + $layoutData['pos_x'], + '', + 2, + 5, + true, + $readonly + ); + $table->data[($i + 1)][3] .= ','; + $table->data[($i + 1)][3] .= html_print_input_text( + 'top_'.$idLayoutData, + $layoutData['pos_y'], + '', + 2, + 5, + true, + $readonly + ); + $table->data[($i + 1)][3] .= ')'; + $table->data[($i + 1)][3] .= '
'; - default: - $table->data[($i + 1)][3] = '( '.html_print_input_text('left_'.$idLayoutData, $layoutData['pos_x'], '', 2, 5, true).' , '.html_print_input_text('top_'.$idLayoutData, $layoutData['pos_y'], '', 2, 5, true).' )'; - break; - } - - - // Parent + // Parent. switch ($layoutData['type']) { case BOX_ITEM: case NETWORK_LINK: @@ -517,39 +598,57 @@ foreach ($layoutDatas as $layoutData) { break; default: - $table->data[($i + 1)][4] = html_print_select( + $table->data[($i + 1)][4] = '
'.html_print_select( $parents, 'parent_'.$idLayoutData, $layoutData['parent_item'], '', __('None'), 0, - true - ); + true, + false, + true, + '', + false, + 'width: 100%;' + ).'
'; + break; } - // Delete row button - if (!defined('METACONSOLE')) { - $url_delete = 'index.php?'.'sec=network&'.'sec2=godmode/reporting/visual_console_builder&'.'tab='.$activeTab.'&'.'action=delete&'.'id_visual_console='.$visualConsole['id'].'&'.'id_element='.$idLayoutData; - } else { - $url_delete = 'index.php?'.'operation=edit_visualmap&'.'sec=screen&'.'sec2=screens/screens&'.'action=visualmap&'.'pure='.(int) get_parameter('pure', 0).'&'.'tab=list_elements&'.'action2=delete&'.'id_visual_console='.$visualConsole['id'].'&'.'id_element='.$idLayoutData; + // Delete row button. + $url_delete = 'index.php?sec=network&sec2=godmode/reporting/visual_console_builder'; + $url_delete .= '&tab='.$activeTab.'&action=delete'; + $url_delete .= '&id_visual_console='.$visualConsole['id'].'&id_element='.$idLayoutData; + if (is_metaconsole() === true) { + $url_delete = 'index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap'; + $url_delete .= '&pure='.(int) get_parameter('pure', 0); + $url_delete .= '&tab=list_elements&action2=delete'; + $url_delete .= '&id_visual_console='.$visualConsole['id'].'&id_element='.$idLayoutData; } - $table->data[($i + 1)][5] = ''; + $table->data[($i + 1)][5] = '
'; $table->data[($i + 1)][5] .= html_print_checkbox('multiple_delete_items', $idLayoutData, false, true); - $table->data[($i + 1)][5] .= ''.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).''; + $table->data[($i + 1)][5] .= ''; + $table->data[($i + 1)][5] .= html_print_image( + 'images/delete.svg', + true, + ['class' => 'main_menu_icon invert_filter'] + ); + $table->data[($i + 1)][5] .= ''; $table->data[($i + 1)][5] .= html_print_input_hidden('updated_'.$idLayoutData, '0', true); $table->data[($i + 1)][5] .= html_print_input_hidden('rowtype_'.$idLayoutData, $layoutData['type'], true); + $table->data[($i + 1)][5] .= '
'; - // Second row + // Second row. $table->data[($i + 2)]['icon'] = ''; - - // Agent + // Agent. switch ($layoutData['type']) { case GROUP_ITEM: $own_info = get_user_info($config['id_user']); - if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'PM')) { + if ((bool) $own_info['is_admin'] === false + && (bool) check_acl($config['id_user'], 0, 'PM') === false + ) { $return_all_group = false; } else { $return_all_group = true; @@ -564,7 +663,12 @@ foreach ($layoutDatas as $layoutData) { '', '', 0, - true + true, + false, + false, + '', + false, + 'width:100%' ); break; @@ -579,24 +683,25 @@ foreach ($layoutDatas as $layoutData) { default: $cell_content_enterprise = false; - if (enterprise_installed()) { + if (enterprise_installed() === true) { $cell_content_enterprise = enterprise_visual_map_print_list_element('agent', $layoutData); } if ($cell_content_enterprise === false) { $params = []; $params['return'] = true; - $params['show_helptip'] = true; + $params['show_helptip'] = false; $params['size'] = 20; $params['input_name'] = 'agent_'.$idLayoutData; $params['javascript_is_function_select'] = true; $params['selectbox_id'] = 'module_'.$idLayoutData; - if (defined('METACONSOLE')) { + if (is_metaconsole() === true) { $params['javascript_ajax_page'] = '../../ajax.php'; $params['disabled_javascript_on_blur_function'] = true; $params['print_input_id_server'] = true; - $params['input_id_server_id'] = $params['input_id_server_name'] = 'id_server_id_'.$idLayoutData; + $params['input_id_server_id'] = 'id_server_id_'.$idLayoutData; + $params['input_id_server_name'] = 'id_server_id_'.$idLayoutData; $params['input_id_server_value'] = $layoutData['id_metaconsole']; $params['metaconsole_enabled'] = true; $params['print_hidden_input_idagent'] = true; @@ -616,7 +721,7 @@ foreach ($layoutDatas as $layoutData) { $params['value'] = db_get_value('alias', 'tagente', 'id_agente', $layoutData['id_agent']); } - if ($layoutData['id_custom_graph'] != 0) { + if ((int) $layoutData['id_custom_graph'] !== 0) { $table->data[($i + 2)][0] = __('Custom graph'); } else { $table->data[($i + 2)][0] = ui_print_agent_autocomplete_input($params); @@ -627,8 +732,7 @@ foreach ($layoutDatas as $layoutData) { break; } - - // Module + // Module. switch ($layoutData['type']) { case ICON: case LABEL: @@ -642,21 +746,21 @@ foreach ($layoutDatas as $layoutData) { default: if ($layoutData['id_layout_linked'] != 0) { - // It is a item that links with other visualmap + // It is a item that links with other visualmap. $table->data[($i + 2)][1] = ''; break; } $cell_content_enterprise = false; - if (enterprise_installed()) { + if (enterprise_installed() === true) { $cell_content_enterprise = enterprise_visual_map_print_list_element('module', $layoutData); } if ($cell_content_enterprise === false) { - if (!defined('METACONSOLE')) { + if (is_metaconsole() === false) { $modules = agents_get_modules($layoutData['id_agent']); } else { - if ($layoutData['id_agent'] != 0) { + if ((int) $layoutData['id_agent'] !== 0) { $server = db_get_row('tmetaconsole_setup', 'id', $layoutData['id_metaconsole']); if (metaconsole_connect($server) == NOERR) { $modules = agents_get_modules($layoutData['id_agent']); @@ -668,7 +772,7 @@ foreach ($layoutDatas as $layoutData) { $modules = io_safe_output($modules); if ($layoutData['id_custom_graph'] != 0) { - if (is_metaconsole()) { + if (is_metaconsole() === true) { $graphs = []; $graphs = metaconsole_get_custom_graphs(true); $table->data[($i + 2)][1] = html_print_select( @@ -678,7 +782,12 @@ foreach ($layoutDatas as $layoutData) { '', __('None'), 0, - true + true, + false, + true, + '', + false, + 'width:100%' ); } else { $table->data[($i + 2)][1] = html_print_select_from_sql( @@ -688,7 +797,11 @@ foreach ($layoutDatas as $layoutData) { '', __('None'), 0, - true + true, + false, + true, + false, + 'width:100%' ); } } else { @@ -704,7 +817,7 @@ foreach ($layoutDatas as $layoutData) { true, '', false, - 'width: 120px' + 'width: 100%' ); } } else { @@ -713,16 +826,17 @@ foreach ($layoutDatas as $layoutData) { break; } - // Empty + // Empty. $table->data[($i + 2)][2] = ''; - // Period + // Period. switch ($layoutData['type']) { case MODULE_GRAPH: case SIMPLE_VALUE_MAX: case SIMPLE_VALUE_MIN: case SIMPLE_VALUE_AVG: - $table->data[($i + 2)][3] = html_print_extended_select_for_time( + $table->data[($i + 2)][3] .= '
'; + $table->data[($i + 2)][3] .= html_print_extended_select_for_time( 'period_'.$idLayoutData, $layoutData['period'], '', @@ -731,6 +845,7 @@ foreach ($layoutDatas as $layoutData) { 10, true ); + $table->data[($i + 2)][3] .= '
'; break; default: @@ -738,7 +853,7 @@ foreach ($layoutDatas as $layoutData) { break; } - // Map linked + // Map linked. switch ($layoutData['type']) { case NETWORK_LINK: case LINE_ITEM: @@ -761,9 +876,8 @@ foreach ($layoutDatas as $layoutData) { true, false, true, - '', false, - 'width: 120px' + 'width:100%' ); break; } diff --git a/pandora_console/godmode/servers/modificar_server.php b/pandora_console/godmode/servers/modificar_server.php index e4c5d7aa09..43ab316364 100644 --- a/pandora_console/godmode/servers/modificar_server.php +++ b/pandora_console/godmode/servers/modificar_server.php @@ -34,7 +34,7 @@ require_once $config['homedir'].'/include/functions_graph.php'; check_login(); -if (! check_acl($config['id_user'], 0, 'AW')) { +if (! check_acl($config['id_user'], 0, 'PM') && ((bool) check_acl($config['id_user'], 0, 'AW') === true && $_GET['server_remote'] === null)) { db_pandora_audit( AUDIT_LOG_ACL_VIOLATION, 'Trying to access Server Management' @@ -286,19 +286,21 @@ if (isset($_GET['server']) === true) { $id_server ); - $buttons = ''; + $buttons = []; // Buttons. - $buttons = [ - 'standard_editor' => [ - 'active' => false, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('Standard editor')]).'', - ], - 'advanced_editor' => [ - 'active' => false, - 'text' => ''.html_print_image('images/pen.png', true, ['title' => __('Advanced editor')]).'', - ], - ]; + if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { + $buttons = [ + 'standard_editor' => [ + 'active' => false, + 'text' => ''.html_print_image('images/list.png', true, ['title' => __('Standard editor')]).'', + ], + 'advanced_editor' => [ + 'active' => false, + 'text' => ''.html_print_image('images/pen.png', true, ['title' => __('Advanced editor')]).'', + ], + ]; + } if ($server_type === SERVER_TYPE_ENTERPRISE_SATELLITE) { $buttons['agent_editor'] = [ diff --git a/pandora_console/godmode/servers/servers.build_table.php b/pandora_console/godmode/servers/servers.build_table.php index bbd77f7b14..1ce497131f 100644 --- a/pandora_console/godmode/servers/servers.build_table.php +++ b/pandora_console/godmode/servers/servers.build_table.php @@ -28,7 +28,9 @@ // Begin. require_once 'include/functions_clippy.php'; -require_once 'pending_alerts_list.php'; +if ((bool) check_acl($config['id_user'], 0, 'LM') === true) { + include 'pending_alerts_list.php'; +} global $config; diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 348f98b31d..d3b0a497ba 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -597,7 +597,7 @@ if (enterprise_installed() === true) { $config['custom_splash_login'], '', __('Default'), - 'default', + 'default.png', true, false, true, @@ -1301,10 +1301,9 @@ $table_chars->data[$row][] = html_print_label_input_block( 'content' => html_print_div( [ 'class' => '', - 'content' => __('Area').' '.html_print_radio_button( + 'content' => __('Area').' '.html_print_checkbox_switch( 'type_module_charts', 'area', - '', $config['type_module_charts'] == 'area', true ), @@ -1313,10 +1312,9 @@ $table_chars->data[$row][] = html_print_label_input_block( ).html_print_div( [ 'class' => '', - 'content' => __('Line').' '.html_print_radio_button( + 'content' => __('Line').' '.html_print_checkbox_switch( 'type_module_charts', 'line', - '', $config['type_module_charts'] != 'area', true ), diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index f2aa2b1890..c0fef7bec0 100755 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -786,7 +786,7 @@ if ($create_alert || $update_alert) { 2, 2, $custom_value, - 'class="w100p" required="required"', + 'class="w100p"', true ) ); @@ -806,7 +806,7 @@ if ($create_alert || $update_alert) { 255, true, false, - true + false ) ); echo ''; diff --git a/pandora_console/godmode/users/configure_token.php b/pandora_console/godmode/users/configure_token.php index 6b2f796edf..45cc887b4d 100644 --- a/pandora_console/godmode/users/configure_token.php +++ b/pandora_console/godmode/users/configure_token.php @@ -122,7 +122,7 @@ $table->data[1][1] = html_print_input_text( 50, 255, true -); +).html_print_input_hidden('today_date', date('Y-m-d'), true); $table->data[1][2] = __('Expiration Time'); $table->data[1][3] = html_print_input_text( @@ -132,9 +132,9 @@ $table->data[1][3] = html_print_input_text( 50, 255, true -); +).html_print_input_hidden('today_time', date('H:i:s'), true); -echo ''; +echo ''; html_print_table($table); @@ -143,7 +143,7 @@ $actionButtons = []; if (empty($id_token) === true) { $actionButtons[] = html_print_submit_button( __('Create'), - 'crt', + 'next', false, ['icon' => 'wand'], true @@ -152,7 +152,7 @@ if (empty($id_token) === true) { } else { $actionButtons[] = html_print_submit_button( __('Update'), - 'upd', + 'next', false, ['icon' => 'update'], true @@ -201,4 +201,41 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript closeText: '' }); }); + + function errordate() { + confirmDialog({ + title: "", + message: "", + hideCancelButton: true, + }); + } + + $('#button-next').on('click', function() { + event.preventDefault(); + var date = $('#text-date-expiration').val(); + var time = date+' '+$('#text-time-expiration').val(); + if (date !== '' && $('#text-time-expiration').val() !== '') { + if (date < $('#hidden-today_date').val() || time < $('#hidden-today_date').val()+' '+$('#hidden-today_time').val()) { + errordate(); + } else{ + $('#form_token').submit(); + } + } else if (date !== '' && time === ' ') { + if (date < $('#hidden-today_date').val()) { + errordate(); + } else{ + $('#form_token').submit(); + } + } else if (date === '' && time !== ' ') { + errordate(); + } else if (date !== '' && $('#text-time-expiration').val() === '') { + if (date < $('#hidden-today_date').val()) { + errordate(); + } else{ + $('#form_token').submit(); + } + }else { + $('#form_token').submit(); + } + }) diff --git a/pandora_console/godmode/users/token_list.php b/pandora_console/godmode/users/token_list.php index f8c198e3b1..27d93076b9 100644 --- a/pandora_console/godmode/users/token_list.php +++ b/pandora_console/godmode/users/token_list.php @@ -77,10 +77,13 @@ if ($create_token === true || $update_token === true) { $expirationDate = get_parameter('date-expiration', null); $expirationTime = get_parameter('time-expiration', null); $validity = null; + if (empty($expirationDate) === false) { $validity = $expirationDate; if (empty($expirationTime) === false) { $validity .= ' '.$expirationTime; + } else { + $validity .= ' 23:59:59'; } } diff --git a/pandora_console/include/ajax/alert_list.ajax.php b/pandora_console/include/ajax/alert_list.ajax.php index 23b8197297..a213541ee7 100644 --- a/pandora_console/include/ajax/alert_list.ajax.php +++ b/pandora_console/include/ajax/alert_list.ajax.php @@ -331,7 +331,7 @@ if ($show_update_action_menu) { false, '', false, - false + true ); $data .= ''; $data .= ''; diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 86787142d4..37fac4ccac 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -1929,13 +1929,13 @@ if (check_login()) { ); } - + // Search module name. if (empty($search) === false) { - $where .= ' AND tagente_modulo.nombre LIKE "%%'.$search.'%%"'; + $where .= ' AND tagente_modulo.nombre LIKE "%%'.io_safe_output($search).'%%"'; } if (empty($search_agent) === false) { - $where .= ' AND tagente.alias LIKE "%%'.$search_agent.'%%"'; + $where .= ' AND tagente.alias LIKE "%%'.io_safe_output($search_agent).'%%"'; } if (str_contains($status, '6') === true) { diff --git a/pandora_console/include/class/CalendarManager.class.php b/pandora_console/include/class/CalendarManager.class.php index b5ef6456a7..4c15b6f874 100644 --- a/pandora_console/include/class/CalendarManager.class.php +++ b/pandora_console/include/class/CalendarManager.class.php @@ -210,6 +210,17 @@ class CalendarManager if ($op === 'edit' && $action === '') { $tab = 'list_edit'; + $buttons['list_edit'] = [ + 'active' => false, + 'text' => ''.html_print_image( + 'images/edit.svg', + true, + [ + 'title' => __('Edit calendar'), + 'class' => 'main_menu_icon invert_filter', + ] + ).'', + ]; } $buttons[$tab]['active'] = true; diff --git a/pandora_console/include/class/ExtensionsDiscovery.class.php b/pandora_console/include/class/ExtensionsDiscovery.class.php index 9c9affaf77..c38fc95b06 100644 --- a/pandora_console/include/class/ExtensionsDiscovery.class.php +++ b/pandora_console/include/class/ExtensionsDiscovery.class.php @@ -234,18 +234,18 @@ class ExtensionsDiscovery extends Wizard url_str = `'.__('here').'`; } - var markup = "