diff --git a/extras/deploy-scripts/pandora_agent_deploy.sh b/extras/deploy-scripts/pandora_agent_deploy.sh new file mode 100644 index 0000000000..cb58e4092b --- /dev/null +++ b/extras/deploy-scripts/pandora_agent_deploy.sh @@ -0,0 +1,168 @@ +#!/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" +yellow="\e[0;33m" +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 +} + +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" + +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}Checking compatible OS... ${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/ &>> $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' +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 + + +#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 diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 092348f5cb..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-210415 +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 f85da39764..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-210415" +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 8ba4c19f8a..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 => '210415'; +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 5bb5168e74..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 210415 +%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 1bc2e0a0a1..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 210415 +%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 240a646ac6..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="210415" +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 43b3793fb3..822343050f 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210415} +{210419} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index ef49d178ca..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 210415)") +#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 7cac310f11..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 210415))" + 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 533ccc5147..d9fbc2f5dd 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-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 4d11da420a..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-210415" +pandora_version="7.0NG.753-210419" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/mr/46.sql b/pandora_console/extras/mr/46.sql index 2d0c2a8a84..833e1a7a49 100644 --- a/pandora_console/extras/mr/46.sql +++ b/pandora_console/extras/mr/46.sql @@ -1,5 +1,6 @@ START TRANSACTION; +ALTER TABLE `tgrupo` ADD COLUMN `max_agents` int(10) NOT NULL DEFAULT 0; ALTER TABLE `tagent_custom_fields` MODIFY COLUMN `combo_values` TEXT NOT NULL DEFAULT ''; ALTER TABLE `treport_content` MODIFY `external_source` MEDIUMTEXT; ALTER TABLE `treport_content_template` MODIFY `external_source` MEDIUMTEXT; 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 b0d6a00048..bfb3d93c8d 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 @@ -2869,6 +2869,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 63b9e03131..6440ce70e0 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,6 +231,9 @@ if ($create_agent) { if ($alias == '') { $agent_creation_error = __('No agent alias specified'); $agent_created_ok = 0; + } 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 { if ($alias_as_name) { $sql = 'SELECT nombre FROM tagente WHERE nombre = "'.$alias.'"'; @@ -1034,6 +1039,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, 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')); } else { diff --git a/pandora_console/godmode/groups/configure_group.php b/pandora_console/godmode/groups/configure_group.php index 0d45f381e4..b06ae97b25 100644 --- a/pandora_console/godmode/groups/configure_group.php +++ b/pandora_console/godmode/groups/configure_group.php @@ -1,16 +1,32 @@ '; @@ -224,6 +242,10 @@ $i++; // $table->data[10][0] = __('Skin'); // $table->data[10][1] = skins_print_select($config['id_user'], 'skin', $skin, '', __('None'), 0, true); // } +$table->data[$i][0] = __('Max agents allowed').' '.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 { @@ -241,6 +263,7 @@ if (isset($config['metaconsole_node_id']) && $config['metaconsole_node_id'] > 0) echo '
'; html_print_table($table); echo '
'; + 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); @@ -331,5 +354,8 @@ function parent_changed () { $(document).ready (function () { $('#icon').change (icon_changed); $('#id_parent').change (parent_changed); + $('#button-button_back').on('click', function(){ + window.location = ''; + }); }); diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 15cb01edf3..c71ad1a9fe 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -387,6 +387,7 @@ if (($create_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true)) $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'); @@ -411,6 +412,7 @@ if (($create_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true)) 'propagate' => $propagate, 'other' => $other, 'password' => io_safe_input($group_pass), + 'max_agents' => $max_agents, ]; $result = db_process_sql_insert('tgrupo', $values); @@ -444,6 +446,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)) { @@ -477,6 +480,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/config_process.php b/pandora_console/include/config_process.php index f3ac229799..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 = 'PC210415'; +$build_version = 'PC210419'; $pandora_version = 'v7.0NG.753'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index a40bf0bab5..c0f27fa0a6 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -1,27 +1,38 @@ evento( + sprintf( + 'Agent cannot be %sd due to the maximum agent limit for group %s', + $action, + $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_SYSTEM); + $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; +} + + /** * Return the list of agents for a planned downtime * @@ -3866,7 +3948,7 @@ function agents_get_last_status_change($id_agent) * * @return array */ -function get_planned_downtime_agents_list($id_downtime, $filter_cond, $id_groups_str) +function get_planned_downtime_agents_list($id_downtime, $filter_cond, $id_groups_str):array { $agents = []; diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index d653f707a0..03dba95653 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -1479,6 +1479,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, true, 'update') === 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); @@ -1680,6 +1686,8 @@ 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, 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.'); } else if ($server_name === false) { @@ -8403,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); @@ -8482,7 +8491,8 @@ 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( 'tgrupo', @@ -8495,7 +8505,8 @@ 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] ); diff --git a/pandora_console/include/lib/Event.php b/pandora_console/include/lib/Event.php index 69f7d372b6..e09b4ace20 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 { @@ -185,28 +182,26 @@ class Event extends Entity */ public function save() { - global $config; - - if (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) { + 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']] ); } 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; diff --git a/pandora_console/install.php b/pandora_console/install.php index eb331b781f..418761d439 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
data[1][1] .= '
'.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; diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index 0cd6d5a4f2..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 210415 +%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 2e3a08f9d1..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 210415 +%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 c0df69a0e1..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 210415 +%define release 210419 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index df81d3094b..3e4b5b0605 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -723,6 +723,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; diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index 6cff9ca95c..418b041e77 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-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 2bcc2f474e..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-210415" +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 7da99dcd16..5e21733895 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 = "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 5fd5c293c5..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 = "210415"; +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 045e69b862..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 210415 +%define release 210419 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index dad510161b..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 210415 +%define release 210419 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 230bc58247..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="210415" +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 678e493a0e..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 PS210415"; +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 1070976276..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 PS210415"; +my $version = "7.0NG.753 PS210419"; # save program name for logging my $progname = basename($0);