From 26a788b2e9ebb391087116c773dde49a46080372 Mon Sep 17 00:00:00 2001
From: Jose Gonzalez <jose.gonzalez@artica.es>
Date: Tue, 26 Jan 2021 12:35:08 +0100
Subject: [PATCH 01/22] Added control for max agents in groups

---
 pandora_console/extras/mr/46.sql              |  5 ++
 .../pandoradb_migrate_6.0_to_7.0.mysql.sql    |  6 ++
 .../godmode/agentes/configurar_agente.php     |  5 ++
 .../godmode/groups/configure_group.php        | 50 +++++++++---
 pandora_console/godmode/groups/group_list.php |  4 +
 pandora_console/include/functions_agents.php  | 77 +++++++++++++++----
 pandora_console/include/functions_api.php     |  8 ++
 pandora_console/pandoradb.sql                 |  1 +
 8 files changed, 129 insertions(+), 27 deletions(-)
 create mode 100644 pandora_console/extras/mr/46.sql

diff --git a/pandora_console/extras/mr/46.sql b/pandora_console/extras/mr/46.sql
new file mode 100644
index 0000000000..c5fb00cd7e
--- /dev/null
+++ b/pandora_console/extras/mr/46.sql
@@ -0,0 +1,5 @@
+START TRANSACTION;
+
+ALTER TABLE tgrupo ADD COLUMN max_agents int(10) NOT NULL DEFAULT 0;
+
+COMMIT;
\ No newline at end of file
diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
index 8c204943db..88d0e9ecc3 100644
--- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
+++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
@@ -2828,6 +2828,12 @@ UPDATE twidget SET description='Show a visual console' WHERE class_name='MapsMad
 UPDATE twidget SET description='Clock' WHERE class_name='ClockWidget';
 UPDATE twidget SET description='Group status' WHERE class_name='SystemGroupStatusWidget';
 
+--
+-- Modifies tgrupo table.
+--
+
+ALTER TABLE tgrupo ADD COLUMN max_agents int(10) NOT NULL DEFAULT 0;
+
 -- ----------------------------------------------------------------------
 -- Table `tnode_relations`
 -- ----------------------------------------------------------------------
diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php
index 72fc0ef125..e53b908691 100644
--- a/pandora_console/godmode/agentes/configurar_agente.php
+++ b/pandora_console/godmode/agentes/configurar_agente.php
@@ -229,6 +229,9 @@ if ($create_agent) {
     if ($alias == '') {
         $agent_creation_error = __('No agent alias specified');
         $agent_created_ok = 0;
+    } else if (group_allow_more_agents($grupo) === false) {
+        $agent_creation_error = __('Agent cannot be created due to the maximum agent limit for this group');
+        $agent_created_ok = 0;
     } else {
         if ($alias_as_name) {
             $sql = 'SELECT nombre FROM tagente WHERE nombre = "'.$alias.'"';
@@ -947,6 +950,8 @@ if ($update_agent) {
 
     if ($grupo <= 0) {
         ui_print_error_message(__('The group id %d is incorrect.', $grupo));
+    } else if (group_allow_more_agents($grupo) === false) {
+        ui_print_error_message(__('Agent cannot be updated due to the maximum agent limit for this group'));
     } else if ($exists_ip) {
         ui_print_error_message(__('Duplicate main IP address'));
     } else {
diff --git a/pandora_console/godmode/groups/configure_group.php b/pandora_console/godmode/groups/configure_group.php
index 019a981578..c4ce2361c5 100644
--- a/pandora_console/godmode/groups/configure_group.php
+++ b/pandora_console/godmode/groups/configure_group.php
@@ -1,16 +1,32 @@
 <?php
+/**
+ * Configure agent groups.
+ *
+ * @category   Agents group management.
+ * @package    Pandora FMS
+ * @subpackage User interface.
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
 
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation for version 2.
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
+// Begin.
 global $config;
 
 check_login();
@@ -27,7 +43,7 @@ require_once $config['homedir'].'/include/functions_groups.php';
 require_once $config['homedir'].'/include/functions_users.php';
 enterprise_include_once('meta/include/functions_agents_meta.php');
 
-// Init vars
+// Default values.
 $icon = '';
 $name = '';
 $id_parent = 0;
@@ -39,6 +55,7 @@ $skin = 0;
 $contact = '';
 $other = '';
 $description = '';
+$max_agents = 0;
 
 $create_group = (bool) get_parameter('create_group');
 $id_group = (int) get_parameter('id_group');
@@ -62,6 +79,7 @@ if ($id_group) {
         $description = $group['description'];
         $contact = $group['contact'];
         $other = $group['other'];
+        $max_agents = $group['max_agents'];
     } else {
         ui_print_error_message(__('There was a problem loading group'));
         echo '</table>';
@@ -223,6 +241,10 @@ if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK && !defined('METACONSOLE')) {
     $table->data[9][1] = skins_print_select($config['id_user'], 'skin', $skin, '', __('None'), 0, true);
 }
 
+$table->data[$i][0] = __('Max agents allowed').'&nbsp;'.ui_print_help_tip(__('Set the maximum of agents allowed for this group. 0 is unlimited.'), true);
+$table->data[$i][1] = html_print_input_text('max_agents', $max_agents, '', 10, 255, true);
+$i++;
+
 if (defined('METACONSOLE')) {
     $sec = 'advanced';
 } else {
@@ -240,6 +262,7 @@ if (isset($config['metaconsole_node_id']) && $config['metaconsole_node_id'] > 0)
 echo '<form name="grupo" method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/group_list&pure='.$config['pure'].'"'.$confirm_bottom.' >';
 html_print_table($table);
 echo '<div class="action-buttons" style="width: '.$table->width.'">';
+    html_print_button(__('Back'), 'button_back', false, '', 'class="sub cancel"');
 if ($id_group) {
     html_print_input_hidden('update_group', 1);
     html_print_input_hidden('id_group', $id_group);
@@ -330,5 +353,8 @@ function parent_changed () {
 $(document).ready (function () {
     $('#icon').change (icon_changed);
     $('#id_parent').change (parent_changed);
+    $('#button-button_back').on('click', function(){
+        window.location = '<?php echo ui_get_full_url('index.php?sec='.$sec.'&sec2=godmode/groups/group_list'); ?>';
+    });
 });
 </script>
diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php
index ad6eb27adf..4bb170f2a4 100644
--- a/pandora_console/godmode/groups/group_list.php
+++ b/pandora_console/godmode/groups/group_list.php
@@ -367,6 +367,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
     $description = (string) get_parameter('description');
     $contact = (string) get_parameter('contact');
     $other = (string) get_parameter('other');
+    $max_agents = (int) get_parameter('max_agents', 0);
     $check = db_get_value('nombre', 'tgrupo', 'nombre', $name);
     $propagate = (bool) get_parameter('propagate');
 
@@ -391,6 +392,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
                     'propagate'   => $propagate,
                     'other'       => $other,
                     'password'    => io_safe_input($group_pass),
+                    'max_agents'  => $max_agents,
                 ];
 
                 $result = db_process_sql_insert('tgrupo', $values);
@@ -424,6 +426,7 @@ if ($update_group) {
     $description = (string) get_parameter('description');
     $contact = (string) get_parameter('contact');
     $other = (string) get_parameter('other');
+    $max_agents = (int) get_parameter('max_agents', 0);
 
     $aviable_name = true;
     if (preg_match('/script/i', $name)) {
@@ -457,6 +460,7 @@ if ($update_group) {
                     'propagate'   => $propagate,
                     'other'       => $other,
                     'password'    => io_safe_input($group_pass),
+                    'max_agents'  => $max_agents,
                 ];
 
                 $result = db_process_sql_update(
diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php
index 8be043fb98..7d605c7746 100644
--- a/pandora_console/include/functions_agents.php
+++ b/pandora_console/include/functions_agents.php
@@ -1,22 +1,32 @@
 <?php
-
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the  GNU Lesser 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.
-
 /**
- * @package    Include
- * @subpackage Agents
+ * Agents Functions.
+ *
+ * @category   Agents functions.
+ * @package    Pandora FMS
+ * @subpackage User interface.
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
  */
 
+// Begin.
 require_once $config['homedir'].'/include/functions.php';
 require_once $config['homedir'].'/include/functions_modules.php';
 require_once $config['homedir'].'/include/functions_users.php';
@@ -231,6 +241,25 @@ function agents_create_agent(
             $values['direccion'] = $ip_address;
     }
 
+    // Check if group has limit or overrides the agent limit.
+    if (group_allow_more_agents($id_group) === false) {
+        // Capture the group name.
+        $groupName = db_get_value(
+            'nombre',
+            'tgrupo',
+            ['id_grupo' => $id_group]
+        );
+        // Notice this issue.
+        db_pandora_audit(
+            'Agent management',
+            sprintf(
+                'Agent cannot be created due to the maximum agent limit for group "%s"',
+                $groupName
+            )
+        );
+        return false;
+    }
+
     $id_agent = db_process_sql_insert('tagente', $values);
     if ($id_agent === false) {
         return false;
@@ -3800,3 +3829,21 @@ function agents_get_last_status_change($id_agent)
 
     return $row['last_status_change'];
 }
+
+
+/**
+ * Checks if group allow more agents due itself limitation.
+ *
+ * @param  integer $id_group Id of the group
+ * @return boolean True if allow more agents.
+ */
+function group_allow_more_agents(int $id_group):bool
+{
+    $groupMaxAgents   = (int) db_get_value('max_agents', 'tgrupo', sprintf('id_grupo = %d', $id_group));
+    $groupCountAgents = (int) db_get_num_rows(sprintf('SELECT nombre FROM tagente WHERE id_grupo = "%s"', $id_group));
+
+    // If `max_agents` is not defined or the count of agents in the group is below of max agents allowed.
+    $output = ($groupMaxAgents === 0 || $groupCountAgents < $groupMaxAgents);
+
+    return $output;
+}
diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index 1afd3f8431..5b1a5e7af3 100644
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -1359,6 +1359,12 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
         return;
     }
 
+    // Check if group allow more agents or have limit stablished.
+    if (group_allow_more_agents($idGroup) === false) {
+        returnError('Agent cannot be updated due to the maximum agent limit for this group');
+        return;
+    }
+
     // Check selected parent
     if ($idParent != 0) {
         $parentCheck = agents_check_access_agent($idParent);
@@ -1561,6 +1567,8 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
         returnError('agent_name_exist', 'The name of agent yet exist in DB.');
     } else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) {
         returnError('id_grupo_not_exist', 'The group don`t exist.');
+    } else if (group_allow_more_agents($grupo) === false) {
+        returnError('Agent cannot be created due to the maximum agent limit for this group');
     } else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$id_os) === false) {
         returnError('id_os_not_exist', 'The OS don`t exist.');
     } else if ($server_name === false) {
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index 090e87fd2e..cef80ffcdf 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -722,6 +722,7 @@ CREATE TABLE IF NOT EXISTS `tgrupo` (
 	`contact` text,
 	`other` text,
 	`password` varchar(45) default '',
+	`max_agents` int(10) unsigned NOT NULL default '0',
  	PRIMARY KEY  (`id_grupo`),
  	KEY `parent_index` (`parent`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

From 4f88d5ed160657674235686a0421c6eaa2419c76 Mon Sep 17 00:00:00 2001
From: rafael <rafael.ameijeiras@pandorafms.com>
Date: Fri, 19 Feb 2021 22:05:27 +0100
Subject: [PATCH 02/22] agent installer cloud v1

---
 extras/deploy-scripts/pandora_agent_deploy.sh | 137 ++++++++++++++++++
 1 file changed, 137 insertions(+)
 create mode 100644 extras/deploy-scripts/pandora_agent_deploy.sh

diff --git a/extras/deploy-scripts/pandora_agent_deploy.sh b/extras/deploy-scripts/pandora_agent_deploy.sh
new file mode 100644
index 0000000000..bb62c0d8a9
--- /dev/null
+++ b/extras/deploy-scripts/pandora_agent_deploy.sh
@@ -0,0 +1,137 @@
+#!/bin/bash
+
+#export PANDORA_SERVER_IP='newdemos.artica.es' && curl -sSL http://firefly.artica.es/projects/pandora_deploy_agent.sh | bash
+
+# define variables
+PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
+S_VERSION='2021012801'
+LOGFILE="/tmp/pandora-agent-deploy-$(date +%F).log"
+
+# Ansi color code variables
+red="\e[0;91m"
+green="\e[0;92m"
+bold="\e[1m"
+cyan="\e[0;36m"
+reset="\e[0m"
+
+# Functions
+
+execute_cmd () {
+    local cmd="$1"
+    local msg="$2"
+
+    echo -e "${cyan}$msg...${reset}"
+    $cmd &>> $LOGFILE
+    if [ $? -ne 0 ]; then
+        echo -e "${red}Fail${reset}"
+        [[ $3 ]] && echo "$3 "
+        echo "Error installing Pandora FMS Agent for detailed error please check log: $LOGFILE"
+        rm -rf $HOME/pandora_deploy_tmp &>> $LOGFILE
+        exit 1
+    else
+        echo -e "\e[1A\e ${cyan}$msg...${reset} ${green}OK${reset}"
+        return 0
+    fi
+}
+
+check_cmd_status () {
+    if [ $? -ne 0 ]; then
+        echo -e "${red}Fail${reset}"
+        [ "$1" ] && echo "$1"
+        echo "Error installing Pandora FMS Agent for detailed error please check log: $LOGFILE"
+        rm -rf $HOME/pandora_deploy_tmp/*.rpm* &>> $LOGFILE
+        exit 1
+    else
+        echo -e "${green}OK${reset}"
+        return 0
+    fi
+}
+
+check_repo_connection () {
+    execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection"
+    execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo"
+}
+
+check_root_permissions () {
+    echo -en "${cyan}Checking root account... ${reset}"
+    if [ "$(whoami)" != "root" ]; then
+        echo -e "${red}Fail${reset}"
+        echo "Please use a root account or sudo for installing PandoraFMS"
+        echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
+        exit 1
+
+    else
+        echo -e "${green}OK${reset}"
+    fi
+}
+
+## Main
+echo "Starting PandoraFMS Agent deployment ver. $S_VERSION"
+
+execute_cmd  "[ $PANDORA_SERVER_IP ]" 'Check Server IP Address' 'Please define env variable PANDORA_SERVER_IP'
+
+# Check OS.
+OS=$([[ $(grep '^ID_LIKE=' /etc/os-release) ]] && grep ^ID_LIKE= /etc/os-release | cut -d '=' -f2 | tr -d '"' || grep ^ID= /etc/os-release | cut -d '=' -f2 | tr -d '"')
+
+[[ $OS == 'rhel fedora' ]] &&  OS_RELEASE=$OS
+[[ $OS == 'debian' ]] &&  OS_RELEASE=$OS
+
+# initialice logfile
+execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE"
+echo "Community installer version: $S_VERSION" >> $LOGFILE
+
+# Pre checks
+echo -en "${cyan}Loading pandoradb.sql to $DBNAME database...${reset}"
+[[ $OS_RELEASE ]]
+check_cmd_status "Error not compatible OS, $OS"
+
+# Root permisions
+check_root_permissions
+
+# Connectivity
+check_repo_connection
+
+# Execute tools check
+execute_cmd "grep --version" 'Checking needed tools: grep'
+execute_cmd "sed --version" 'Checking needed tools: sed'
+
+# Creating working directory
+rm -rf $HOME/pandora_deploy_tmp/*.rpm* &>> $LOGFILE
+mkdir $HOME/pandora_deploy_tmp &>> $LOGFILE
+execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace:  $HOME/pandora_deploy_tmp"
+
+# Downloading and installing packages
+
+if [[ $OS_RELEASE == 'rhel fedora' ]]; then
+    yum install -y perl wget curl perl-Sys-Syslog unzip &>> $LOGFILE 
+    echo -e "${cyan}Instaling agent dependencies...${reset}" ${green}OK${reset}
+    
+    yum install -y http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm &>> $LOGFILE
+    echo -e "${cyan}Instaling Pandora FMS agent...${reset}" ${green}OK${reset}
+fi
+
+if [[ $OS_RELEASE == 'debian' ]]; then
+    execute_cmd "apt update" 'Updating repos'
+    execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Instaling agent dependencies' 
+    execute_cmd 'wget http://firefly.artica.es/pandorafms/latest/Debian_Ubuntu/pandorafms.agent_unix_7.0NG.deb' 'Downloading Pandora FMS agent dependencies'
+    execute_cmd 'apt install -y ./pandorafms.agent_unix_7.0NG.deb' 'Installing Pandora FMS agent'
+    pip3 install psutil &>> $LOGFILE 
+fi
+
+# Configuring Agente
+
+[[ $PANDORA_SERVER_IP ]] && sed -i "s/^server_ip.*$/server_ip $PANDORA_SERVER_IP/g" $PANDORA_AGENT_CONF 
+[[ $PANDORA_REMOTE_CONFIG ]] && sed -i "s/^remote_config.*$/remote_config $PANDORA_REMOTE_CONFIG/g" $PANDORA_AGENT_CONF 
+[[ $PANDORA_GROUP ]] && sed -i "s/^group.*$/group $PANDORA_GROUP/g" $PANDORA_AGENT_CONF
+[[ $PANDORA_DEBUG ]] && sed -i "s/^debug.*$/debug $PANDORA_DEBUG/g" $PANDORA_AGENT_CONF
+[[ $PANDORA_AGENT_NAME ]] && sed -i "s/^#agent_name.*$/agent_name $PANDORA_AGENT_NAME/g" $PANDORA_AGENT_CONF
+[[ $PANDORA_AGENT_ALIAS ]] && sed -i "s/^#agent_alias.*$/agent_alias $PANDORA_AGENT_ALIAS/g" $PANDORA_AGENT_CONF
+[[ $PANDORA_SECONDARY_GROUPS ]] && sed -i "s/^# secondary_groups.*$/secondary_groups $PANDORA_SECONDARY_GROUPS/g" $PANDORA_AGENT_CONF
+[[ $TIMEZONE ]] && ln -sfn /usr/share/zoneinfo/$TIMEZONE /etc/localtime
+
+
+
+#Starting pandora agent daemon.
+execute_cmd '/etc/init.d/pandora_agent_daemon restart' 'Starting Pandora Agent'
+
+echo -e "${green}PandoraFMS Agent installed and running, sending data to: $PANDORA_SERVER_IP${reset}"
\ No newline at end of file

From 029863807ef86cf78396935b0988662e9b54e13b Mon Sep 17 00:00:00 2001
From: rafael <rafael.ameijeiras@pandorafms.com>
Date: Tue, 23 Feb 2021 21:36:59 +0100
Subject: [PATCH 03/22] adding autodiscovery bin installation for x86 and x64

---
 extras/deploy-scripts/pandora_agent_deploy.sh | 35 +++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/extras/deploy-scripts/pandora_agent_deploy.sh b/extras/deploy-scripts/pandora_agent_deploy.sh
index bb62c0d8a9..998a41e232 100644
--- a/extras/deploy-scripts/pandora_agent_deploy.sh
+++ b/extras/deploy-scripts/pandora_agent_deploy.sh
@@ -12,6 +12,7 @@ red="\e[0;91m"
 green="\e[0;92m"
 bold="\e[1m"
 cyan="\e[0;36m"
+yellow="\e[0;33m"
 reset="\e[0m"
 
 # Functions
@@ -65,6 +66,14 @@ check_root_permissions () {
     fi
 }
 
+install_autodiscover () {
+    local arch=$1
+    wget https://pandorafms.com/library/wp-content/uploads/2020/04/autodiscover-linux.zip
+    unzip autodiscover-linux.zip
+    chmod +x $arch/autodiscover 
+    mv -f $arch/autodiscover /etc/pandora/plugins/autodiscover
+}
+
 ## Main
 echo "Starting PandoraFMS Agent deployment ver. $S_VERSION"
 
@@ -96,7 +105,7 @@ execute_cmd "grep --version" 'Checking needed tools: grep'
 execute_cmd "sed --version" 'Checking needed tools: sed'
 
 # Creating working directory
-rm -rf $HOME/pandora_deploy_tmp/*.rpm* &>> $LOGFILE
+rm -rf $HOME/pandora_deploy_tmp/ &>> $LOGFILE
 mkdir $HOME/pandora_deploy_tmp &>> $LOGFILE
 execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace:  $HOME/pandora_deploy_tmp"
 
@@ -115,7 +124,6 @@ if [[ $OS_RELEASE == 'debian' ]]; then
     execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Instaling agent dependencies' 
     execute_cmd 'wget http://firefly.artica.es/pandorafms/latest/Debian_Ubuntu/pandorafms.agent_unix_7.0NG.deb' 'Downloading Pandora FMS agent dependencies'
     execute_cmd 'apt install -y ./pandorafms.agent_unix_7.0NG.deb' 'Installing Pandora FMS agent'
-    pip3 install psutil &>> $LOGFILE 
 fi
 
 # Configuring Agente
@@ -130,8 +138,31 @@ fi
 [[ $TIMEZONE ]] && ln -sfn /usr/share/zoneinfo/$TIMEZONE /etc/localtime
 
 
+#installing autodiscover
+
+arch=$(uname -m)
+case $arch in
+
+  x86_64)
+    execute_cmd 'install_autodiscover x86_64' "installing service autodiscover on $arch" 'Error unable to install autodiscovery'
+    ;;
+
+  x86)
+    execute_cmd 'install_autodiscover x84' "installing service autodiscover on $arch" 'Error unable to install autodiscovery'
+    ;;
+
+  armv7l)
+    echo -e "${cyan}Skiping autodiscover installation arch $arch not suported${reset}"
+    ;;
+
+  *)
+    echo -e "${yellow}Skiping autodiscover installation arch $arch not suported${reset}"
+    ;;
+esac
 
 #Starting pandora agent daemon.
 execute_cmd '/etc/init.d/pandora_agent_daemon restart' 'Starting Pandora Agent'
+cd
+execute_cmd 'rm -rf $HOME/pandora_deploy_tmp' 'Cleaning up temporay files'
 
 echo -e "${green}PandoraFMS Agent installed and running, sending data to: $PANDORA_SERVER_IP${reset}"
\ No newline at end of file

From 141daec1ab91986a637e2a28dc42e5903957ab4f Mon Sep 17 00:00:00 2001
From: Jose Gonzalez <jose.gonzalez@artica.es>
Date: Mon, 12 Apr 2021 10:42:13 +0200
Subject: [PATCH 04/22] Missed value for add

---
 pandora_console/include/functions_api.php | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index c3fd03ffeb..b7916ea9e1 100644
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -8411,6 +8411,7 @@ function api_set_create_group($id, $thrash1, $other, $thrash3)
     $values['custom_id'] = $safe_other_data[5];
     $values['contact'] = $safe_other_data[6];
     $values['other'] = $safe_other_data[7];
+    $values['max_agents'] = $safe_other_data[8];
 
     $id_group = groups_create_group($group_name, $values);
 

From 3b4927e9b02b55eac054e7c4545fbe2c0e9cda8f Mon Sep 17 00:00:00 2001
From: Jose Gonzalez <jose.gonzalez@artica.es>
Date: Mon, 12 Apr 2021 13:20:21 +0200
Subject: [PATCH 05/22] Fixed missed params to update max_agents

---
 pandora_console/include/functions_api.php | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index b7916ea9e1..3d13edb12d 100644
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -8492,6 +8492,7 @@ function api_set_update_group($id_group, $thrash2, $other, $thrash3)
     $custom_id = $other['data'][6];
     $contact = $other['data'][7];
     $other = $other['data'][8];
+    $maxAgents = $other['data'][9];
 
     $return = db_process_sql_update(
         'tgrupo',
@@ -8505,6 +8506,7 @@ function api_set_update_group($id_group, $thrash2, $other, $thrash3)
             'custom_id'   => $custom_id,
             'contact'     => $contact,
             'other'       => $other,
+            'max_agents'  => $maxAgents,
         ],
         ['id_grupo' => $id_group]
     );

From 3396af66b09d9e1bc5d7043fe4520553d6b4c3a0 Mon Sep 17 00:00:00 2001
From: Calvo <luis.calvo@artica.es>
Date: Wed, 14 Apr 2021 09:26:19 +0200
Subject: [PATCH 06/22] Agent conf ip selector visual fix

---
 pandora_console/include/styles/pandora.css | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index dddc1cf180..2b5377fd12 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -5450,6 +5450,10 @@ table.info_table.policy_sub_table {
   min-width: 100px;
 }
 
+div.label_select_child_left > span {
+  width: 100% !important;
+}
+
 .label_select_child_right {
   width: 20%;
   min-width: 140px;

From f684cef4914842de3c75f751357351ee42dd0c39 Mon Sep 17 00:00:00 2001
From: Jose Gonzalez <jose.gonzalez@artica.es>
Date: Wed, 14 Apr 2021 12:16:28 +0200
Subject: [PATCH 07/22] Changed audit log for event and refactor

---
 pandora_console/include/functions_agents.php | 25 +++++++++++++-------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php
index 170ec2d8ec..30277db94e 100644
--- a/pandora_console/include/functions_agents.php
+++ b/pandora_console/include/functions_agents.php
@@ -213,11 +213,13 @@ function agents_create_agent(
     $values=false,
     $alias_as_name=false
 ) {
-    if (empty($name)) {
+    global $config;
+
+    if (empty($name) === true) {
         return false;
     }
 
-    if (empty($id_group) && (int) $id_group != 0) {
+    if (empty($id_group) === true && (int) $id_group !== 0) {
         return false;
     }
 
@@ -226,11 +228,11 @@ function agents_create_agent(
         $interval = false;
     }
 
-    if (empty($interval)) {
+    if (empty($interval) === true) {
         return false;
     }
 
-    if (! is_array($values)) {
+    if (is_array($values) === false) {
         $values = [];
     }
 
@@ -239,7 +241,7 @@ function agents_create_agent(
     $values['id_grupo'] = $id_group;
     $values['intervalo'] = $interval;
 
-    if (!empty($ip_address)) {
+    if (empty($ip_address) === false) {
             $values['direccion'] = $ip_address;
     }
 
@@ -252,12 +254,17 @@ function agents_create_agent(
             ['id_grupo' => $id_group]
         );
         // Notice this issue.
-        db_pandora_audit(
-            'Agent management',
+        events_create_event(
             sprintf(
                 'Agent cannot be created due to the maximum agent limit for group "%s"',
                 $groupName
-            )
+            ),
+            $id_group,
+            0,
+            EVENT_NEW,
+            $config['id_user'],
+            EVENTS_NEW_AGENT,
+            EVENT_CRIT_WARNING
         );
         return false;
     }
@@ -268,7 +275,7 @@ function agents_create_agent(
     }
 
     // Create address for this agent in taddress.
-    if (!empty($ip_address)) {
+    if (empty($ip_address) === false) {
         agents_add_address($id_agent, $ip_address);
     }
 

From ff177c544dfda1fba4a05cff2a6d2419f424f8ae Mon Sep 17 00:00:00 2001
From: Jose Gonzalez <jose.gonzalez@artica.es>
Date: Thu, 15 Apr 2021 12:00:00 +0200
Subject: [PATCH 08/22] Modified and adapted Event class

---
 pandora_console/include/lib/Event.php | 32 ++++++++++++++++-----------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/pandora_console/include/lib/Event.php b/pandora_console/include/lib/Event.php
index 69f7d372b6..9fca537463 100644
--- a/pandora_console/include/lib/Event.php
+++ b/pandora_console/include/lib/Event.php
@@ -60,18 +60,15 @@ class Event extends Entity
      */
     public function __construct(?int $event_id=null)
     {
-        $table = 'tevento';
-        if ((bool) \is_metaconsole() === true) {
-            $table = 'tmetaconsole_event';
-        }
+        $this->table = ((bool) \is_metaconsole() === true) ? 'tmetaconsole_event' : 'tevento';
 
         if ($event_id === 0) {
-            parent::__construct($table);
+            parent::__construct($this->table);
         } else if (is_numeric($event_id) === true) {
-            parent::__construct($table, ['id_evento' => $event_id]);
+            parent::__construct($this->table, ['id_evento' => $event_id]);
         } else {
             // Empty skel.
-            parent::__construct($table);
+            parent::__construct($this->table);
         }
 
         try {
@@ -187,7 +184,7 @@ class Event extends Entity
     {
         global $config;
 
-        if (isset($config['centralized_management']) === true
+        if (is_metaconsole() === false && isset($config['centralized_management']) === true
             && (bool) $config['centralized_management'] === true
         ) {
             throw new \Exception(
@@ -195,18 +192,27 @@ class Event extends Entity
             );
         }
 
+        $values = $this->fields;
+        // Clean null fields.
+        foreach ($values as $k => $v) {
+            hd('"'.$k.'" "'.$v.'"', true);
+            if ($v === null) {
+                unset($values[$k]);
+            }
+        }
+
         if ($this->id_evento === null) {
             // New.
             return db_process_sql_insert(
-                'tgrupo',
-                $this->fields
+                $this->table,
+                $values
             );
         } else if ($this->fields['id_evento'] > 0) {
             // Update.
             return db_process_sql_update(
-                'tgrupo',
-                $this->fields,
-                ['id_evento' => $this->fields['id_evento']]
+                $this->table,
+                $values,
+                ['id_evento' => $values['id_evento']]
             );
         }
 

From a69666aad97d115692e668659d5e16fa273e298e Mon Sep 17 00:00:00 2001
From: Jose Gonzalez <jose.gonzalez@artica.es>
Date: Thu, 15 Apr 2021 12:00:32 +0200
Subject: [PATCH 09/22] Added Event class

---
 pandora_console/include/functions_agents.php | 35 ++++++++++++++------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php
index 30277db94e..3b2255d9ef 100644
--- a/pandora_console/include/functions_agents.php
+++ b/pandora_console/include/functions_agents.php
@@ -32,6 +32,7 @@ require_once $config['homedir'].'/include/functions_modules.php';
 require_once $config['homedir'].'/include/functions_users.php';
 
 use PandoraFMS\Enterprise\RCMDFile as RCMDFile;
+use PandoraFMS\Event;
 
 
 /**
@@ -251,21 +252,33 @@ function agents_create_agent(
         $groupName = db_get_value(
             'nombre',
             'tgrupo',
-            ['id_grupo' => $id_group]
+            'id_grupo',
+            $id_group
         );
-        // Notice this issue.
-        events_create_event(
+
+        // Generate new event.
+        $evt = new Event;
+        $evt->evento(
             sprintf(
-                'Agent cannot be created due to the maximum agent limit for group "%s"',
+                'Agent cannot be created due to the maximum agent limit for group %s',
                 $groupName
-            ),
-            $id_group,
-            0,
-            EVENT_NEW,
-            $config['id_user'],
-            EVENTS_NEW_AGENT,
-            EVENT_CRIT_WARNING
+            )
         );
+        $evt->id_grupo($id_group);
+        $evt->id_source_event(0);
+        $evt->id_agente(0);
+        $evt->estado(EVENT_NO_VALIDATED);
+        $evt->id_agentmodule(0);
+        $evt->id_usuario($config['id_user']);
+        $evt->event_type(EVENTS_NEW_AGENT);
+        $evt->criticity(EVENT_CRIT_WARNING);
+        $evt->timestamp(date('Y-m-d H:i:s'));
+        $evt->utimestamp(time());
+        $evt->data(0);
+        $evt->source('agent_creation');
+        // Save the event.
+        $evt->save();
+
         return false;
     }
 

From 8021b53763b58ea0cb7f7276be0ae3139d6963c6 Mon Sep 17 00:00:00 2001
From: "alejandro.campos@artica.es" <alejandro.campos@artica.es>
Date: Thu, 15 Apr 2021 13:46:28 +0200
Subject: [PATCH 10/22] fixed bug on integria api calls

---
 .../incidents/dashboard_detail_integriaims_incident.php       | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php b/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php
index be9c357331..93182c9a05 100644
--- a/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php
+++ b/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php
@@ -159,7 +159,7 @@ if ($upload_file && ($_FILES['userfile']['name'] != '')) {
 
         $filecontent = base64_encode(file_get_contents($_FILES['userfile']['tmp_name']));
 
-        $result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'attach_file', [$incident_id, $filename, $filesize, $filedescription, $filecontent]);
+        $result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'attach_file', [$incident_id, $filename, $filesize, $filedescription, $filecontent], false, '', ';');
 
         // API method returns '0' string if success.
         $file_added = ($result_api_call === '0') ? true : false;
@@ -322,7 +322,7 @@ $table_comments_section->data[1][1] .= '<div class="w100p right">'.html_print_su
 
 // Upload comment. If ticket is closed, this action cannot be performed.
 if ($upload_comment && $array_get_incidents[6] != 7) {
-    $result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'create_workunit', [$incident_id, $comment_description, '0.00', 0, 1, '0']);
+    $result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'create_workunit', [$incident_id, $comment_description, '0.00', 0, 1, '0'], false, '', ';');
 
     // API method returns id of new comment if success.
     $comment_added = ($result_api_call >= '0') ? true : false;

From 3d3beca727d29f02e410c56b041e0b6dbad88ad3 Mon Sep 17 00:00:00 2001
From: Jose Gonzalez <jose.gonzalez@artica.es>
Date: Thu, 15 Apr 2021 15:06:48 +0200
Subject: [PATCH 11/22] Added feature of generate event

---
 .../godmode/agentes/configurar_agente.php     |  6 +-
 pandora_console/include/functions_agents.php  | 77 +++++++++++--------
 2 files changed, 47 insertions(+), 36 deletions(-)

diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php
index 1eefb9ec25..be6c1d941d 100644
--- a/pandora_console/godmode/agentes/configurar_agente.php
+++ b/pandora_console/godmode/agentes/configurar_agente.php
@@ -37,6 +37,8 @@ require_once $config['homedir'].'/include/functions_cron.php';
 ui_require_javascript_file('encode_decode_base64');
 ui_require_css_file('agent_manager');
 
+use PandoraFMS\Event;
+
 check_login();
 
 // Get tab parameter to check ACL in each tabs.
@@ -229,7 +231,7 @@ if ($create_agent) {
     if ($alias == '') {
         $agent_creation_error = __('No agent alias specified');
         $agent_created_ok = 0;
-    } else if (group_allow_more_agents($grupo) === false) {
+    } else if (group_allow_more_agents($grupo, true) === false) {
         $agent_creation_error = __('Agent cannot be created due to the maximum agent limit for this group');
         $agent_created_ok = 0;
     } else {
@@ -1037,7 +1039,7 @@ if ($update_agent) {
 
     if ($grupo <= 0) {
         ui_print_error_message(__('The group id %d is incorrect.', $grupo));
-    } else if (group_allow_more_agents($grupo) === false) {
+    } else if (group_allow_more_agents($grupo, true) === false) {
         ui_print_error_message(__('Agent cannot be updated due to the maximum agent limit for this group'));
     } else if ($exists_ip) {
         ui_print_error_message(__('Duplicate main IP address'));
diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php
index 3b2255d9ef..b12b16d76d 100644
--- a/pandora_console/include/functions_agents.php
+++ b/pandora_console/include/functions_agents.php
@@ -247,38 +247,7 @@ function agents_create_agent(
     }
 
     // Check if group has limit or overrides the agent limit.
-    if (group_allow_more_agents($id_group) === false) {
-        // Capture the group name.
-        $groupName = db_get_value(
-            'nombre',
-            'tgrupo',
-            'id_grupo',
-            $id_group
-        );
-
-        // Generate new event.
-        $evt = new Event;
-        $evt->evento(
-            sprintf(
-                'Agent cannot be created due to the maximum agent limit for group %s',
-                $groupName
-            )
-        );
-        $evt->id_grupo($id_group);
-        $evt->id_source_event(0);
-        $evt->id_agente(0);
-        $evt->estado(EVENT_NO_VALIDATED);
-        $evt->id_agentmodule(0);
-        $evt->id_usuario($config['id_user']);
-        $evt->event_type(EVENTS_NEW_AGENT);
-        $evt->criticity(EVENT_CRIT_WARNING);
-        $evt->timestamp(date('Y-m-d H:i:s'));
-        $evt->utimestamp(time());
-        $evt->data(0);
-        $evt->source('agent_creation');
-        // Save the event.
-        $evt->save();
-
+    if (group_allow_more_agents($id_group, true) === false) {
         return false;
     }
 
@@ -3909,18 +3878,58 @@ function agents_get_last_status_change($id_agent)
 /**
  * Checks if group allow more agents due itself limitation.
  *
- * @param integer $id_group Id of the group.
+ * @param integer $id_group      Id of the group.
+ * @param boolean $generateEvent If true and the check fails, will generate an event.
  *
  * @return boolean True if allow more agents.
  */
-function group_allow_more_agents(int $id_group):bool
+function group_allow_more_agents(int $id_group, bool $generateEvent=false):bool
 {
+    global $config;
+
     $groupMaxAgents   = (int) db_get_value('max_agents', 'tgrupo', sprintf('id_grupo = %d', $id_group));
     $groupCountAgents = (int) db_get_num_rows(sprintf('SELECT nombre FROM tagente WHERE id_grupo = "%s"', $id_group));
 
     // If `max_agents` is not defined or the count of agents in the group is below of max agents allowed.
     $output = ($groupMaxAgents === 0 || $groupCountAgents < $groupMaxAgents);
 
+    if ($output === false && $generateEvent === true) {
+        // Get the group name.
+        $groupName = db_get_value(
+            'nombre',
+            'tgrupo',
+            'id_grupo',
+            $id_group
+        );
+        // New event.
+        $evt = new Event;
+        // Set parameters.
+        $evt->evento(
+            sprintf(
+                'Agent cannot be created due to the maximum agent limit for group %s',
+                $groupName
+            )
+        );
+        $evt->id_grupo($id_group);
+        $evt->id_agente(0);
+        $evt->id_agentmodule(0);
+        $evt->id_usuario($config['id_user']);
+        $evt->estado(EVENT_STATUS_NEW);
+        $evt->event_type(EVENTS_ERROR);
+        $evt->criticity(EVENT_CRIT_WARNING);
+        $evt->timestamp(date('Y-m-d H:i:s'));
+        $evt->utimestamp(time());
+        $evt->data(0);
+        $evt->source('agent_creation');
+        // Any fields are only available in meta.
+        if (is_metaconsole() === true) {
+            $evt->id_source_event(0);
+        }
+
+        // Save the event.
+        $evt->save();
+    }
+
     return $output;
 }
 

From a6936f16d509445875f7e8af23b5f22e4acf1ef4 Mon Sep 17 00:00:00 2001
From: Jose Gonzalez <jose.gonzalez@artica.es>
Date: Thu, 15 Apr 2021 15:50:10 +0200
Subject: [PATCH 12/22] Cleaned event create control for centralized management

---
 pandora_console/include/lib/Event.php | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/pandora_console/include/lib/Event.php b/pandora_console/include/lib/Event.php
index 9fca537463..e09b4ace20 100644
--- a/pandora_console/include/lib/Event.php
+++ b/pandora_console/include/lib/Event.php
@@ -182,20 +182,9 @@ class Event extends Entity
      */
     public function save()
     {
-        global $config;
-
-        if (is_metaconsole() === false && isset($config['centralized_management']) === true
-            && (bool) $config['centralized_management'] === true
-        ) {
-            throw new \Exception(
-                'error, cannot save in centralized management environment.'
-            );
-        }
-
         $values = $this->fields;
         // Clean null fields.
         foreach ($values as $k => $v) {
-            hd('"'.$k.'" "'.$v.'"', true);
             if ($v === null) {
                 unset($values[$k]);
             }

From 93d70da8226a2b10b0d04220520a3afdf8396ff4 Mon Sep 17 00:00:00 2001
From: Jose Gonzalez <jose.gonzalez@artica.es>
Date: Thu, 15 Apr 2021 21:20:34 +0200
Subject: [PATCH 13/22] Modified function

---
 pandora_console/include/functions_agents.php | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php
index b12b16d76d..e8a84cb3a0 100644
--- a/pandora_console/include/functions_agents.php
+++ b/pandora_console/include/functions_agents.php
@@ -247,7 +247,7 @@ function agents_create_agent(
     }
 
     // Check if group has limit or overrides the agent limit.
-    if (group_allow_more_agents($id_group, true) === false) {
+    if (group_allow_more_agents($id_group, true, 'create') === false) {
         return false;
     }
 
@@ -3880,11 +3880,15 @@ function agents_get_last_status_change($id_agent)
  *
  * @param integer $id_group      Id of the group.
  * @param boolean $generateEvent If true and the check fails, will generate an event.
+ * @param string  $action        Action for perform (only if generateEvent is true).
  *
  * @return boolean True if allow more agents.
  */
-function group_allow_more_agents(int $id_group, bool $generateEvent=false):bool
-{
+function group_allow_more_agents(
+    int $id_group,
+    bool $generateEvent=false,
+    string $action='create'
+):bool {
     global $config;
 
     $groupMaxAgents   = (int) db_get_value('max_agents', 'tgrupo', sprintf('id_grupo = %d', $id_group));
@@ -3906,7 +3910,8 @@ function group_allow_more_agents(int $id_group, bool $generateEvent=false):bool
         // Set parameters.
         $evt->evento(
             sprintf(
-                'Agent cannot be created due to the maximum agent limit for group %s',
+                'Agent cannot be %sd due to the maximum agent limit for group %s',
+                $action,
                 $groupName
             )
         );

From 0e12402469c23a47dd3f68cfe966973ff5af1d5b Mon Sep 17 00:00:00 2001
From: Jose Gonzalez <jose.gonzalez@artica.es>
Date: Thu, 15 Apr 2021 21:20:59 +0200
Subject: [PATCH 14/22] Fixed message issue

---
 pandora_console/godmode/agentes/configurar_agente.php | 4 ++--
 pandora_console/include/functions_api.php             | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php
index be6c1d941d..6440ce70e0 100644
--- a/pandora_console/godmode/agentes/configurar_agente.php
+++ b/pandora_console/godmode/agentes/configurar_agente.php
@@ -231,7 +231,7 @@ if ($create_agent) {
     if ($alias == '') {
         $agent_creation_error = __('No agent alias specified');
         $agent_created_ok = 0;
-    } else if (group_allow_more_agents($grupo, true) === false) {
+    } else if (group_allow_more_agents($grupo, true, 'create') === false) {
         $agent_creation_error = __('Agent cannot be created due to the maximum agent limit for this group');
         $agent_created_ok = 0;
     } else {
@@ -1039,7 +1039,7 @@ if ($update_agent) {
 
     if ($grupo <= 0) {
         ui_print_error_message(__('The group id %d is incorrect.', $grupo));
-    } else if (group_allow_more_agents($grupo, true) === false) {
+    } else if (group_allow_more_agents($grupo, true, 'update') === false) {
         ui_print_error_message(__('Agent cannot be updated due to the maximum agent limit for this group'));
     } else if ($exists_ip) {
         ui_print_error_message(__('Duplicate main IP address'));
diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index 3d13edb12d..0151da4980 100644
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -1480,7 +1480,7 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
     }
 
     // Check if group allow more agents or have limit stablished.
-    if (group_allow_more_agents($idGroup) === false) {
+    if (group_allow_more_agents($idGroup, true, 'update') === false) {
         returnError('Agent cannot be updated due to the maximum agent limit for this group');
         return;
     }
@@ -1686,7 +1686,7 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
         returnError('The agent name already exists in DB.');
     } else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) {
         returnError('The group does not exist.');
-    } else if (group_allow_more_agents($grupo) === false) {
+    } else if (group_allow_more_agents($grupo, true, 'create') === false) {
         returnError('Agent cannot be created due to the maximum agent limit for this group');
     } else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$id_os) === false) {
         returnError('The OS does not exist.');

From f585e4469208b57086046ff9c7465a03080aa3e3 Mon Sep 17 00:00:00 2001
From: artica <artica.devel@gmail.com>
Date: Fri, 16 Apr 2021 01:00:41 +0200
Subject: [PATCH 15/22] Auto-updated build strings.

---
 pandora_agents/unix/DEBIAN/control             | 2 +-
 pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +-
 pandora_agents/unix/pandora_agent              | 2 +-
 pandora_agents/unix/pandora_agent.redhat.spec  | 2 +-
 pandora_agents/unix/pandora_agent.spec         | 2 +-
 pandora_agents/unix/pandora_agent_installer    | 2 +-
 pandora_agents/win32/installer/pandora.mpi     | 2 +-
 pandora_agents/win32/pandora.cc                | 2 +-
 pandora_agents/win32/versioninfo.rc            | 2 +-
 pandora_console/DEBIAN/control                 | 2 +-
 pandora_console/DEBIAN/make_deb_package.sh     | 2 +-
 pandora_console/include/config_process.php     | 2 +-
 pandora_console/install.php                    | 2 +-
 pandora_console/pandora_console.redhat.spec    | 2 +-
 pandora_console/pandora_console.rhel7.spec     | 2 +-
 pandora_console/pandora_console.spec           | 2 +-
 pandora_server/DEBIAN/control                  | 2 +-
 pandora_server/DEBIAN/make_deb_package.sh      | 2 +-
 pandora_server/lib/PandoraFMS/Config.pm        | 2 +-
 pandora_server/lib/PandoraFMS/PluginTools.pm   | 2 +-
 pandora_server/pandora_server.redhat.spec      | 2 +-
 pandora_server/pandora_server.spec             | 2 +-
 pandora_server/pandora_server_installer        | 2 +-
 pandora_server/util/pandora_db.pl              | 2 +-
 pandora_server/util/pandora_manage.pl          | 2 +-
 25 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index 092348f5cb..bf3b610c4a 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-agent-unix
-Version: 7.0NG.753-210415
+Version: 7.0NG.753-210416
 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 f85da39764..b42fd73989 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.753-210415"
+pandora_version="7.0NG.753-210416"
 
 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 8ba4c19f8a..4fc52e225c 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -1015,7 +1015,7 @@ my $Sem = undef;
 my $ThreadSem = undef;
 
 use constant AGENT_VERSION => '7.0NG.753';
-use constant AGENT_BUILD => '210415';
+use constant AGENT_BUILD => '210416';
 
 # 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 5bb5168e74..5e824d09d3 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     7.0NG.753
-%define release     210415
+%define release     210416
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index 1bc2e0a0a1..b91cdf791f 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     7.0NG.753
-%define release     210415
+%define release     210416
 
 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 240a646ac6..0a071ed2c4 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -10,7 +10,7 @@
 # **********************************************************************
 
 PI_VERSION="7.0NG.753"
-PI_BUILD="210415"
+PI_BUILD="210416"
 OS_NAME=`uname -s`
 
 FORCE=0
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index 43b3793fb3..6fcffcfca2 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
 {}
 
 Version
-{210415}
+{210416}
 
 ViewReadme
 {Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index ef49d178ca..6a2d833df5 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.753(Build 210415)")
+#define PANDORA_VERSION ("7.0NG.753(Build 210416)")
 
 string pandora_path;
 string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index 7cac310f11..10e1f59b92 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
       VALUE "LegalCopyright", "Artica ST"
       VALUE "OriginalFilename", "PandoraAgent.exe"
       VALUE "ProductName", "Pandora FMS Windows Agent"
-      VALUE "ProductVersion", "(7.0NG.753(Build 210415))"
+      VALUE "ProductVersion", "(7.0NG.753(Build 210416))"
       VALUE "FileVersion", "1.0.0.0"
     END
   END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index 533ccc5147..757d0ed840 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-console
-Version: 7.0NG.753-210415
+Version: 7.0NG.753-210416
 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 4d11da420a..41372da8bf 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.753-210415"
+pandora_version="7.0NG.753-210416"
 
 package_pear=0
 package_pandora=1
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index f3ac229799..408d0ad274 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -20,7 +20,7 @@
 /**
  * Pandora build version and version
  */
-$build_version = 'PC210415';
+$build_version = 'PC210416';
 $pandora_version = 'v7.0NG.753';
 
 // Do not overwrite default timezone set if defined.
diff --git a/pandora_console/install.php b/pandora_console/install.php
index eb331b781f..bae7440160 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -129,7 +129,7 @@
         <div style='height: 10px'>
             <?php
             $version = '7.0NG.753';
-            $build = '210415';
+            $build = '210416';
             $banner = "v$version Build $build";
 
             error_reporting(0);
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index 0cd6d5a4f2..f761b62d57 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.753
-%define release     210415
+%define release     210416
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec
index 2e3a08f9d1..5101220519 100644
--- a/pandora_console/pandora_console.rhel7.spec
+++ b/pandora_console/pandora_console.rhel7.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.753
-%define release     210415
+%define release     210416
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index c0df69a0e1..73b7ad2d7c 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.753
-%define release     210415
+%define release     210416
 %define httpd_name      httpd
 # User and Group under which Apache is running
 %define httpd_name  apache2
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index 6cff9ca95c..279509cc84 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-server
-Version: 7.0NG.753-210415
+Version: 7.0NG.753-210416
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index 2bcc2f474e..48b3455bb6 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/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.753-210415"
+pandora_version="7.0NG.753-210416"
 
 package_cpan=0
 package_pandora=1
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index 134305f8ab..9342eba562 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -45,7 +45,7 @@ our @EXPORT = qw(
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "7.0NG.753";
-my $pandora_build = "210415";
+my $pandora_build = "210416";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 # Setup hash
diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm
index 5fd5c293c5..126f5e80a5 100644
--- a/pandora_server/lib/PandoraFMS/PluginTools.pm
+++ b/pandora_server/lib/PandoraFMS/PluginTools.pm
@@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "7.0NG.753";
-my $pandora_build = "210415";
+my $pandora_build = "210416";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 our %EXPORT_TAGS = ( 'all' => [ qw() ] );
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index 045e69b862..42e7622402 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     7.0NG.753
-%define release     210415
+%define release     210416
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index dad510161b..5ed1cbc2e6 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     7.0NG.753
-%define release     210415
+%define release     210416
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer
index 230bc58247..bfde3737be 100755
--- a/pandora_server/pandora_server_installer
+++ b/pandora_server/pandora_server_installer
@@ -9,7 +9,7 @@
 # **********************************************************************
 
 PI_VERSION="7.0NG.753"
-PI_BUILD="210415"
+PI_BUILD="210416"
 
 MODE=$1
 if [ $# -gt 1 ]; then
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index 678e493a0e..09888d1b0a 100755
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -35,7 +35,7 @@ use PandoraFMS::Config;
 use PandoraFMS::DB;
 
 # version: define current version
-my $version = "7.0NG.753 PS210415";
+my $version = "7.0NG.753 PS210416";
 
 # Pandora server configuration
 my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index 1070976276..467ca47972 100755
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -36,7 +36,7 @@ use Encode::Locale;
 Encode::Locale::decode_argv;
 
 # version: define current version
-my $version = "7.0NG.753 PS210415";
+my $version = "7.0NG.753 PS210416";
 
 # save program name for logging
 my $progname = basename($0);

From 494666244d611bc7654f6cad487cbb8122af342d Mon Sep 17 00:00:00 2001
From: Jose Gonzalez <jose.gonzalez@artica.es>
Date: Fri, 16 Apr 2021 09:10:38 +0200
Subject: [PATCH 16/22] Fixed stupid bug

---
 pandora_console/include/functions_api.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index 0151da4980..03dba95653 100644
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -8491,7 +8491,7 @@ function api_set_update_group($id_group, $thrash2, $other, $thrash3)
     $disabled = $other['data'][5];
     $custom_id = $other['data'][6];
     $contact = $other['data'][7];
-    $other = $other['data'][8];
+    $otherData = $other['data'][8];
     $maxAgents = $other['data'][9];
 
     $return = db_process_sql_update(
@@ -8505,7 +8505,7 @@ function api_set_update_group($id_group, $thrash2, $other, $thrash3)
             'disabled'    => $disabled,
             'custom_id'   => $custom_id,
             'contact'     => $contact,
-            'other'       => $other,
+            'other'       => $otherData,
             'max_agents'  => $maxAgents,
         ],
         ['id_grupo' => $id_group]

From 40055c595aa339f1dd2312e96d54d49a9c514a89 Mon Sep 17 00:00:00 2001
From: "rafael.ameijeiras" <rafael.ameijeiras@artica.es>
Date: Fri, 16 Apr 2021 09:40:03 +0200
Subject: [PATCH 17/22] change, print message

---
 extras/deploy-scripts/pandora_agent_deploy.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/extras/deploy-scripts/pandora_agent_deploy.sh b/extras/deploy-scripts/pandora_agent_deploy.sh
index 998a41e232..cb58e4092b 100644
--- a/extras/deploy-scripts/pandora_agent_deploy.sh
+++ b/extras/deploy-scripts/pandora_agent_deploy.sh
@@ -90,7 +90,7 @@ execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer act
 echo "Community installer version: $S_VERSION" >> $LOGFILE
 
 # Pre checks
-echo -en "${cyan}Loading pandoradb.sql to $DBNAME database...${reset}"
+echo -en "${cyan}Checking compatible OS... ${reset}"
 [[ $OS_RELEASE ]]
 check_cmd_status "Error not compatible OS, $OS"
 

From 8e503086a20030e844817215487e8efa2ca80cff Mon Sep 17 00:00:00 2001
From: Jose Gonzalez <jose.gonzalez@artica.es>
Date: Fri, 16 Apr 2021 09:51:11 +0200
Subject: [PATCH 18/22] Event type changed

---
 pandora_console/include/functions_agents.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php
index e8a84cb3a0..c0f27fa0a6 100644
--- a/pandora_console/include/functions_agents.php
+++ b/pandora_console/include/functions_agents.php
@@ -3920,7 +3920,7 @@ function group_allow_more_agents(
         $evt->id_agentmodule(0);
         $evt->id_usuario($config['id_user']);
         $evt->estado(EVENT_STATUS_NEW);
-        $evt->event_type(EVENTS_ERROR);
+        $evt->event_type(EVENTS_SYSTEM);
         $evt->criticity(EVENT_CRIT_WARNING);
         $evt->timestamp(date('Y-m-d H:i:s'));
         $evt->utimestamp(time());

From 2732c6db1c38f5b621af67ab32ff14f1628f3072 Mon Sep 17 00:00:00 2001
From: "alejandro.campos@artica.es" <alejandro.campos@artica.es>
Date: Fri, 16 Apr 2021 11:22:29 +0200
Subject: [PATCH 19/22] fixed bug in api call

---
 .../incidents/dashboard_detail_integriaims_incident.php         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php b/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php
index 93182c9a05..c4d7cb8617 100644
--- a/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php
+++ b/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php
@@ -322,7 +322,7 @@ $table_comments_section->data[1][1] .= '<div class="w100p right">'.html_print_su
 
 // Upload comment. If ticket is closed, this action cannot be performed.
 if ($upload_comment && $array_get_incidents[6] != 7) {
-    $result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'create_workunit', [$incident_id, $comment_description, '0.00', 0, 1, '0'], false, '', ';');
+    $result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'create_workunit', [$incident_id, $comment_description, '0.00', 0, 1, '0'], false, '', '|;|');
 
     // API method returns id of new comment if success.
     $comment_added = ($result_api_call >= '0') ? true : false;

From 9ec945fa3c84ddb68b5a4769d8f845e1058adb49 Mon Sep 17 00:00:00 2001
From: artica <artica.devel@gmail.com>
Date: Sat, 17 Apr 2021 01:00:15 +0200
Subject: [PATCH 20/22] Auto-updated build strings.

---
 pandora_agents/unix/DEBIAN/control             | 2 +-
 pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +-
 pandora_agents/unix/pandora_agent              | 2 +-
 pandora_agents/unix/pandora_agent.redhat.spec  | 2 +-
 pandora_agents/unix/pandora_agent.spec         | 2 +-
 pandora_agents/unix/pandora_agent_installer    | 2 +-
 pandora_agents/win32/installer/pandora.mpi     | 2 +-
 pandora_agents/win32/pandora.cc                | 2 +-
 pandora_agents/win32/versioninfo.rc            | 2 +-
 pandora_console/DEBIAN/control                 | 2 +-
 pandora_console/DEBIAN/make_deb_package.sh     | 2 +-
 pandora_console/include/config_process.php     | 2 +-
 pandora_console/install.php                    | 2 +-
 pandora_console/pandora_console.redhat.spec    | 2 +-
 pandora_console/pandora_console.rhel7.spec     | 2 +-
 pandora_console/pandora_console.spec           | 2 +-
 pandora_server/DEBIAN/control                  | 2 +-
 pandora_server/DEBIAN/make_deb_package.sh      | 2 +-
 pandora_server/lib/PandoraFMS/Config.pm        | 2 +-
 pandora_server/lib/PandoraFMS/PluginTools.pm   | 2 +-
 pandora_server/pandora_server.redhat.spec      | 2 +-
 pandora_server/pandora_server.spec             | 2 +-
 pandora_server/pandora_server_installer        | 2 +-
 pandora_server/util/pandora_db.pl              | 2 +-
 pandora_server/util/pandora_manage.pl          | 2 +-
 25 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index bf3b610c4a..c45b162f6f 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-agent-unix
-Version: 7.0NG.753-210416
+Version: 7.0NG.753-210417
 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 b42fd73989..ec8bce488b 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.753-210416"
+pandora_version="7.0NG.753-210417"
 
 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 4fc52e225c..096712d551 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -1015,7 +1015,7 @@ my $Sem = undef;
 my $ThreadSem = undef;
 
 use constant AGENT_VERSION => '7.0NG.753';
-use constant AGENT_BUILD => '210416';
+use constant AGENT_BUILD => '210417';
 
 # 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 5e824d09d3..38ae039275 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     7.0NG.753
-%define release     210416
+%define release     210417
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index b91cdf791f..04f4221946 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     7.0NG.753
-%define release     210416
+%define release     210417
 
 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 0a071ed2c4..af4aa88bcc 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -10,7 +10,7 @@
 # **********************************************************************
 
 PI_VERSION="7.0NG.753"
-PI_BUILD="210416"
+PI_BUILD="210417"
 OS_NAME=`uname -s`
 
 FORCE=0
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index 6fcffcfca2..004141ddde 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
 {}
 
 Version
-{210416}
+{210417}
 
 ViewReadme
 {Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index 6a2d833df5..cb7373cc77 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.753(Build 210416)")
+#define PANDORA_VERSION ("7.0NG.753(Build 210417)")
 
 string pandora_path;
 string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index 10e1f59b92..bba7150c26 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
       VALUE "LegalCopyright", "Artica ST"
       VALUE "OriginalFilename", "PandoraAgent.exe"
       VALUE "ProductName", "Pandora FMS Windows Agent"
-      VALUE "ProductVersion", "(7.0NG.753(Build 210416))"
+      VALUE "ProductVersion", "(7.0NG.753(Build 210417))"
       VALUE "FileVersion", "1.0.0.0"
     END
   END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index 757d0ed840..2ea2b80f3f 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-console
-Version: 7.0NG.753-210416
+Version: 7.0NG.753-210417
 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 41372da8bf..1d9c8cde9e 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.753-210416"
+pandora_version="7.0NG.753-210417"
 
 package_pear=0
 package_pandora=1
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 408d0ad274..a00dc54a8f 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -20,7 +20,7 @@
 /**
  * Pandora build version and version
  */
-$build_version = 'PC210416';
+$build_version = 'PC210417';
 $pandora_version = 'v7.0NG.753';
 
 // Do not overwrite default timezone set if defined.
diff --git a/pandora_console/install.php b/pandora_console/install.php
index bae7440160..03b45b1045 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -129,7 +129,7 @@
         <div style='height: 10px'>
             <?php
             $version = '7.0NG.753';
-            $build = '210416';
+            $build = '210417';
             $banner = "v$version Build $build";
 
             error_reporting(0);
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index f761b62d57..9435704ba4 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.753
-%define release     210416
+%define release     210417
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec
index 5101220519..ebedb90b54 100644
--- a/pandora_console/pandora_console.rhel7.spec
+++ b/pandora_console/pandora_console.rhel7.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.753
-%define release     210416
+%define release     210417
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index 73b7ad2d7c..56f9d93a27 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.753
-%define release     210416
+%define release     210417
 %define httpd_name      httpd
 # User and Group under which Apache is running
 %define httpd_name  apache2
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index 279509cc84..260efc4ad1 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-server
-Version: 7.0NG.753-210416
+Version: 7.0NG.753-210417
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index 48b3455bb6..12c1232731 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/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.753-210416"
+pandora_version="7.0NG.753-210417"
 
 package_cpan=0
 package_pandora=1
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index 9342eba562..143e54db1d 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -45,7 +45,7 @@ our @EXPORT = qw(
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "7.0NG.753";
-my $pandora_build = "210416";
+my $pandora_build = "210417";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 # Setup hash
diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm
index 126f5e80a5..02be8222d3 100644
--- a/pandora_server/lib/PandoraFMS/PluginTools.pm
+++ b/pandora_server/lib/PandoraFMS/PluginTools.pm
@@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "7.0NG.753";
-my $pandora_build = "210416";
+my $pandora_build = "210417";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 our %EXPORT_TAGS = ( 'all' => [ qw() ] );
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index 42e7622402..4d24a6e3e7 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     7.0NG.753
-%define release     210416
+%define release     210417
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index 5ed1cbc2e6..f27ba4bbf6 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     7.0NG.753
-%define release     210416
+%define release     210417
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer
index bfde3737be..80de1ff0d8 100755
--- a/pandora_server/pandora_server_installer
+++ b/pandora_server/pandora_server_installer
@@ -9,7 +9,7 @@
 # **********************************************************************
 
 PI_VERSION="7.0NG.753"
-PI_BUILD="210416"
+PI_BUILD="210417"
 
 MODE=$1
 if [ $# -gt 1 ]; then
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index 09888d1b0a..cd371f4f1a 100755
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -35,7 +35,7 @@ use PandoraFMS::Config;
 use PandoraFMS::DB;
 
 # version: define current version
-my $version = "7.0NG.753 PS210416";
+my $version = "7.0NG.753 PS210417";
 
 # Pandora server configuration
 my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index 467ca47972..6d12bfa5dc 100755
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -36,7 +36,7 @@ use Encode::Locale;
 Encode::Locale::decode_argv;
 
 # version: define current version
-my $version = "7.0NG.753 PS210416";
+my $version = "7.0NG.753 PS210417";
 
 # save program name for logging
 my $progname = basename($0);

From 1030ef052a443779542170d3211b1224a98862fc Mon Sep 17 00:00:00 2001
From: artica <artica.devel@gmail.com>
Date: Sun, 18 Apr 2021 01:00:13 +0200
Subject: [PATCH 21/22] Auto-updated build strings.

---
 pandora_agents/unix/DEBIAN/control             | 2 +-
 pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +-
 pandora_agents/unix/pandora_agent              | 2 +-
 pandora_agents/unix/pandora_agent.redhat.spec  | 2 +-
 pandora_agents/unix/pandora_agent.spec         | 2 +-
 pandora_agents/unix/pandora_agent_installer    | 2 +-
 pandora_agents/win32/installer/pandora.mpi     | 2 +-
 pandora_agents/win32/pandora.cc                | 2 +-
 pandora_agents/win32/versioninfo.rc            | 2 +-
 pandora_console/DEBIAN/control                 | 2 +-
 pandora_console/DEBIAN/make_deb_package.sh     | 2 +-
 pandora_console/include/config_process.php     | 2 +-
 pandora_console/install.php                    | 2 +-
 pandora_console/pandora_console.redhat.spec    | 2 +-
 pandora_console/pandora_console.rhel7.spec     | 2 +-
 pandora_console/pandora_console.spec           | 2 +-
 pandora_server/DEBIAN/control                  | 2 +-
 pandora_server/DEBIAN/make_deb_package.sh      | 2 +-
 pandora_server/lib/PandoraFMS/Config.pm        | 2 +-
 pandora_server/lib/PandoraFMS/PluginTools.pm   | 2 +-
 pandora_server/pandora_server.redhat.spec      | 2 +-
 pandora_server/pandora_server.spec             | 2 +-
 pandora_server/pandora_server_installer        | 2 +-
 pandora_server/util/pandora_db.pl              | 2 +-
 pandora_server/util/pandora_manage.pl          | 2 +-
 25 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index c45b162f6f..a9067d3e62 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-agent-unix
-Version: 7.0NG.753-210417
+Version: 7.0NG.753-210418
 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 ec8bce488b..d238c8b352 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.753-210417"
+pandora_version="7.0NG.753-210418"
 
 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 096712d551..fcda710945 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -1015,7 +1015,7 @@ my $Sem = undef;
 my $ThreadSem = undef;
 
 use constant AGENT_VERSION => '7.0NG.753';
-use constant AGENT_BUILD => '210417';
+use constant AGENT_BUILD => '210418';
 
 # 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 38ae039275..99888986c2 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     7.0NG.753
-%define release     210417
+%define release     210418
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index 04f4221946..fb567e37a7 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     7.0NG.753
-%define release     210417
+%define release     210418
 
 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 af4aa88bcc..465792816f 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -10,7 +10,7 @@
 # **********************************************************************
 
 PI_VERSION="7.0NG.753"
-PI_BUILD="210417"
+PI_BUILD="210418"
 OS_NAME=`uname -s`
 
 FORCE=0
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index 004141ddde..347d03f827 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
 {}
 
 Version
-{210417}
+{210418}
 
 ViewReadme
 {Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index cb7373cc77..f231057501 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.753(Build 210417)")
+#define PANDORA_VERSION ("7.0NG.753(Build 210418)")
 
 string pandora_path;
 string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index bba7150c26..274f550035 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
       VALUE "LegalCopyright", "Artica ST"
       VALUE "OriginalFilename", "PandoraAgent.exe"
       VALUE "ProductName", "Pandora FMS Windows Agent"
-      VALUE "ProductVersion", "(7.0NG.753(Build 210417))"
+      VALUE "ProductVersion", "(7.0NG.753(Build 210418))"
       VALUE "FileVersion", "1.0.0.0"
     END
   END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index 2ea2b80f3f..ab8c99100e 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-console
-Version: 7.0NG.753-210417
+Version: 7.0NG.753-210418
 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 1d9c8cde9e..da2c4d920c 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.753-210417"
+pandora_version="7.0NG.753-210418"
 
 package_pear=0
 package_pandora=1
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index a00dc54a8f..23244cbc78 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -20,7 +20,7 @@
 /**
  * Pandora build version and version
  */
-$build_version = 'PC210417';
+$build_version = 'PC210418';
 $pandora_version = 'v7.0NG.753';
 
 // Do not overwrite default timezone set if defined.
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 03b45b1045..b013c798d8 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -129,7 +129,7 @@
         <div style='height: 10px'>
             <?php
             $version = '7.0NG.753';
-            $build = '210417';
+            $build = '210418';
             $banner = "v$version Build $build";
 
             error_reporting(0);
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index 9435704ba4..e4e47047df 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.753
-%define release     210417
+%define release     210418
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec
index ebedb90b54..972cd3f76e 100644
--- a/pandora_console/pandora_console.rhel7.spec
+++ b/pandora_console/pandora_console.rhel7.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.753
-%define release     210417
+%define release     210418
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index 56f9d93a27..ebdf9a3fae 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.753
-%define release     210417
+%define release     210418
 %define httpd_name      httpd
 # User and Group under which Apache is running
 %define httpd_name  apache2
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index 260efc4ad1..7ac4a3659d 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-server
-Version: 7.0NG.753-210417
+Version: 7.0NG.753-210418
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index 12c1232731..c1b74df0a3 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/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.753-210417"
+pandora_version="7.0NG.753-210418"
 
 package_cpan=0
 package_pandora=1
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index 143e54db1d..4dd828a03f 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -45,7 +45,7 @@ our @EXPORT = qw(
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "7.0NG.753";
-my $pandora_build = "210417";
+my $pandora_build = "210418";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 # Setup hash
diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm
index 02be8222d3..b3eeb74b91 100644
--- a/pandora_server/lib/PandoraFMS/PluginTools.pm
+++ b/pandora_server/lib/PandoraFMS/PluginTools.pm
@@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "7.0NG.753";
-my $pandora_build = "210417";
+my $pandora_build = "210418";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 our %EXPORT_TAGS = ( 'all' => [ qw() ] );
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index 4d24a6e3e7..f4a086dcda 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     7.0NG.753
-%define release     210417
+%define release     210418
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index f27ba4bbf6..89e06beee8 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     7.0NG.753
-%define release     210417
+%define release     210418
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer
index 80de1ff0d8..83cb384a69 100755
--- a/pandora_server/pandora_server_installer
+++ b/pandora_server/pandora_server_installer
@@ -9,7 +9,7 @@
 # **********************************************************************
 
 PI_VERSION="7.0NG.753"
-PI_BUILD="210417"
+PI_BUILD="210418"
 
 MODE=$1
 if [ $# -gt 1 ]; then
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index cd371f4f1a..c4dc824d69 100755
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -35,7 +35,7 @@ use PandoraFMS::Config;
 use PandoraFMS::DB;
 
 # version: define current version
-my $version = "7.0NG.753 PS210417";
+my $version = "7.0NG.753 PS210418";
 
 # Pandora server configuration
 my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index 6d12bfa5dc..644e6682a1 100755
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -36,7 +36,7 @@ use Encode::Locale;
 Encode::Locale::decode_argv;
 
 # version: define current version
-my $version = "7.0NG.753 PS210417";
+my $version = "7.0NG.753 PS210418";
 
 # save program name for logging
 my $progname = basename($0);

From 08abb25fc4c42b6eb86808a4b150d027633c4319 Mon Sep 17 00:00:00 2001
From: artica <artica.devel@gmail.com>
Date: Mon, 19 Apr 2021 01:00:13 +0200
Subject: [PATCH 22/22] Auto-updated build strings.

---
 pandora_agents/unix/DEBIAN/control             | 2 +-
 pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +-
 pandora_agents/unix/pandora_agent              | 2 +-
 pandora_agents/unix/pandora_agent.redhat.spec  | 2 +-
 pandora_agents/unix/pandora_agent.spec         | 2 +-
 pandora_agents/unix/pandora_agent_installer    | 2 +-
 pandora_agents/win32/installer/pandora.mpi     | 2 +-
 pandora_agents/win32/pandora.cc                | 2 +-
 pandora_agents/win32/versioninfo.rc            | 2 +-
 pandora_console/DEBIAN/control                 | 2 +-
 pandora_console/DEBIAN/make_deb_package.sh     | 2 +-
 pandora_console/include/config_process.php     | 2 +-
 pandora_console/install.php                    | 2 +-
 pandora_console/pandora_console.redhat.spec    | 2 +-
 pandora_console/pandora_console.rhel7.spec     | 2 +-
 pandora_console/pandora_console.spec           | 2 +-
 pandora_server/DEBIAN/control                  | 2 +-
 pandora_server/DEBIAN/make_deb_package.sh      | 2 +-
 pandora_server/lib/PandoraFMS/Config.pm        | 2 +-
 pandora_server/lib/PandoraFMS/PluginTools.pm   | 2 +-
 pandora_server/pandora_server.redhat.spec      | 2 +-
 pandora_server/pandora_server.spec             | 2 +-
 pandora_server/pandora_server_installer        | 2 +-
 pandora_server/util/pandora_db.pl              | 2 +-
 pandora_server/util/pandora_manage.pl          | 2 +-
 25 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index a9067d3e62..e7789654f0 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-agent-unix
-Version: 7.0NG.753-210418
+Version: 7.0NG.753-210419
 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 d238c8b352..7aa48a8295 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.753-210418"
+pandora_version="7.0NG.753-210419"
 
 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 fcda710945..9d502de306 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -1015,7 +1015,7 @@ my $Sem = undef;
 my $ThreadSem = undef;
 
 use constant AGENT_VERSION => '7.0NG.753';
-use constant AGENT_BUILD => '210418';
+use constant AGENT_BUILD => '210419';
 
 # 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 99888986c2..6ac114a1da 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     7.0NG.753
-%define release     210418
+%define release     210419
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index fb567e37a7..4baacc6b6c 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     7.0NG.753
-%define release     210418
+%define release     210419
 
 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 465792816f..6c715d6c47 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -10,7 +10,7 @@
 # **********************************************************************
 
 PI_VERSION="7.0NG.753"
-PI_BUILD="210418"
+PI_BUILD="210419"
 OS_NAME=`uname -s`
 
 FORCE=0
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index 347d03f827..822343050f 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
 {}
 
 Version
-{210418}
+{210419}
 
 ViewReadme
 {Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index f231057501..2731c1b7e9 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.753(Build 210418)")
+#define PANDORA_VERSION ("7.0NG.753(Build 210419)")
 
 string pandora_path;
 string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index 274f550035..4981a970f7 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
       VALUE "LegalCopyright", "Artica ST"
       VALUE "OriginalFilename", "PandoraAgent.exe"
       VALUE "ProductName", "Pandora FMS Windows Agent"
-      VALUE "ProductVersion", "(7.0NG.753(Build 210418))"
+      VALUE "ProductVersion", "(7.0NG.753(Build 210419))"
       VALUE "FileVersion", "1.0.0.0"
     END
   END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index ab8c99100e..d9fbc2f5dd 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-console
-Version: 7.0NG.753-210418
+Version: 7.0NG.753-210419
 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 da2c4d920c..63f9fa4fe7 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.753-210418"
+pandora_version="7.0NG.753-210419"
 
 package_pear=0
 package_pandora=1
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 23244cbc78..ad230689e2 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -20,7 +20,7 @@
 /**
  * Pandora build version and version
  */
-$build_version = 'PC210418';
+$build_version = 'PC210419';
 $pandora_version = 'v7.0NG.753';
 
 // Do not overwrite default timezone set if defined.
diff --git a/pandora_console/install.php b/pandora_console/install.php
index b013c798d8..418761d439 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -129,7 +129,7 @@
         <div style='height: 10px'>
             <?php
             $version = '7.0NG.753';
-            $build = '210418';
+            $build = '210419';
             $banner = "v$version Build $build";
 
             error_reporting(0);
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index e4e47047df..5b21df56ad 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.753
-%define release     210418
+%define release     210419
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec
index 972cd3f76e..38ae3caa79 100644
--- a/pandora_console/pandora_console.rhel7.spec
+++ b/pandora_console/pandora_console.rhel7.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.753
-%define release     210418
+%define release     210419
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index ebdf9a3fae..09ee46a7f3 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.753
-%define release     210418
+%define release     210419
 %define httpd_name      httpd
 # User and Group under which Apache is running
 %define httpd_name  apache2
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index 7ac4a3659d..418b041e77 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-server
-Version: 7.0NG.753-210418
+Version: 7.0NG.753-210419
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index c1b74df0a3..fe278f852d 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/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.753-210418"
+pandora_version="7.0NG.753-210419"
 
 package_cpan=0
 package_pandora=1
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index 4dd828a03f..47afc0f92f 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -45,7 +45,7 @@ our @EXPORT = qw(
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "7.0NG.753";
-my $pandora_build = "210418";
+my $pandora_build = "210419";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 # Setup hash
diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm
index b3eeb74b91..cc9f290fa0 100644
--- a/pandora_server/lib/PandoraFMS/PluginTools.pm
+++ b/pandora_server/lib/PandoraFMS/PluginTools.pm
@@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "7.0NG.753";
-my $pandora_build = "210418";
+my $pandora_build = "210419";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 our %EXPORT_TAGS = ( 'all' => [ qw() ] );
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index f4a086dcda..f81c95d8be 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     7.0NG.753
-%define release     210418
+%define release     210419
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index 89e06beee8..19d5ab6baf 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     7.0NG.753
-%define release     210418
+%define release     210419
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer
index 83cb384a69..29cda4a3dd 100755
--- a/pandora_server/pandora_server_installer
+++ b/pandora_server/pandora_server_installer
@@ -9,7 +9,7 @@
 # **********************************************************************
 
 PI_VERSION="7.0NG.753"
-PI_BUILD="210418"
+PI_BUILD="210419"
 
 MODE=$1
 if [ $# -gt 1 ]; then
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index c4dc824d69..eff8f307cc 100755
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -35,7 +35,7 @@ use PandoraFMS::Config;
 use PandoraFMS::DB;
 
 # version: define current version
-my $version = "7.0NG.753 PS210418";
+my $version = "7.0NG.753 PS210419";
 
 # Pandora server configuration
 my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index 644e6682a1..d8ad80e417 100755
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -36,7 +36,7 @@ use Encode::Locale;
 Encode::Locale::decode_argv;
 
 # version: define current version
-my $version = "7.0NG.753 PS210418";
+my $version = "7.0NG.753 PS210419";
 
 # save program name for logging
 my $progname = basename($0);