diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index c104f867eb..2faa6189f3 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.760-220318 +Version: 7.0NG.760-220321 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 51a877b552..74f9570fbc 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.760-220318" +pandora_version="7.0NG.760-220321" 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 0a3c69e139..00159dc03d 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.760'; -use constant AGENT_BUILD => '220318'; +use constant AGENT_BUILD => '220321'; # 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 f88da41fcf..aea889208a 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.760 -%define release 220318 +%define release 220321 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 a25b2becc9..a80ef18ea6 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.760 -%define release 220318 +%define release 220321 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 f0f48a4f04..2671bfd029 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.760" -PI_BUILD="220318" +PI_BUILD="220321" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 136f60476b..969df14750 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{220318} +{220321} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 9409b970c1..5123080916 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.760 Build 220318") +#define PANDORA_VERSION ("7.0NG.760 Build 220321") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 9a4f535899..d4cbe28b85 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.760(Build 220318))" + VALUE "ProductVersion", "(7.0NG.760(Build 220321))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 095280db25..c393e4e752 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.760-220318 +Version: 7.0NG.760-220321 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 d6be5cbe87..16644151fa 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.760-220318" +pandora_version="7.0NG.760-220321" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/mr/53.sql b/pandora_console/extras/mr/53.sql index cbf408f5f2..dfb7976a91 100644 --- a/pandora_console/extras/mr/53.sql +++ b/pandora_console/extras/mr/53.sql @@ -1,5 +1,7 @@ START TRANSACTION; +ALTER TABLE `tipam_vlan` ADD COLUMN `custom_id` bigint(20) unsigned DEFAULT NULL; + UPDATE `tuser_task` SET `parameters` = 'a:3:{i:0;a:2:{s:11:"description";s:11:"Description";s:4:"type";s:4:"text";}i:1;a:3:{s:11:"description";s:20:"Save to disk in path";s:4:"type";s:6:"string";s:13:"default_value";s:21:"_%_ATTACHMENT_PATH_%_";}i:2;a:3:{s:11:"description";s:14:"Active backups";s:4:"type";s:6:"number";s:13:"default_value";i:3;}}' WHERE `function_name` = 'cron_task_do_backup'; CREATE TABLE IF NOT EXISTS `tbackup` ( @@ -14,4 +16,4 @@ CREATE TABLE IF NOT EXISTS `tbackup` ( ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; -COMMIT; \ No newline at end of file +COMMIT; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index fc13615116..31b3e5936a 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 = 'PC220318'; +$build_version = 'PC220321'; $pandora_version = 'v7.0NG.760'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 6733be09ae..1eb5a1e34b 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -4166,11 +4166,24 @@ function events_get_response_target( } // Parse the event custom data. - if (!empty($event['custom_data'])) { + if (empty($event['custom_data']) === false) { $custom_data = json_decode(base64_decode($event['custom_data'])); foreach ($custom_data as $key => $value) { $target = str_replace('_customdata_'.$key.'_', $value, $target); } + + if (strpos($target, '_customdata_json_') !== false) { + $target = str_replace('_customdata_json_', json_encode($custom_data), $target); + } + + if (strpos($target, '_customdata_text_') !== false) { + $text = ''; + foreach ($custom_data as $key => $value) { + $text .= $key.': '.$value.PHP_EOL; + } + + $target = str_replace('_customdata_text_', $text, $target); + } } // This will replace the macro with the current logged user. diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 34c4cd38bd..5b0a3e6f55 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -4139,7 +4139,7 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0) if ($critical_percentage >= $status_data['linked_layout_status_as_service_critical'] && $critical_percentage !== 0) { return VISUAL_MAP_STATUS_CRITICAL_BAD; - } else if ($critical_percentage >= $status_data['linked_layout_status_as_service_warning'] && $warning_percentage !== 0) { + } else if ($warning_percentage >= $status_data['linked_layout_status_as_service_warning'] && $warning_percentage !== 0) { return VISUAL_MAP_STATUS_WARNING; } else { return VISUAL_MAP_STATUS_NORMAL; diff --git a/pandora_console/include/lib/Dashboard/Widgets/module_icon.php b/pandora_console/include/lib/Dashboard/Widgets/module_icon.php index bbc408925a..cb3d8086e8 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/module_icon.php +++ b/pandora_console/include/lib/Dashboard/Widgets/module_icon.php @@ -399,7 +399,10 @@ class ModuleIconWidget extends Widget 'class' => 'flex-row flex-end w100p', 'direct' => 1, 'block_content' => [ - ['label' => $image], + [ + 'label' => $image, + 'arguments' => ['type' => 'image-item'], + ], ], ]; diff --git a/pandora_console/include/lib/Dashboard/Widgets/module_status.php b/pandora_console/include/lib/Dashboard/Widgets/module_status.php index c0e2f4e78d..0a0fe65615 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/module_status.php +++ b/pandora_console/include/lib/Dashboard/Widgets/module_status.php @@ -389,7 +389,10 @@ class ModuleStatusWidget extends Widget 'class' => 'flex-row flex-end w100p', 'direct' => 1, 'block_content' => [ - ['label' => $image], + [ + 'label' => $image, + 'arguments' => ['type' => 'image-item'], + ], ], ]; diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php index 45a78b8320..27b400db97 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php @@ -537,7 +537,10 @@ final class Group extends Item 'class' => 'flex-row flex-end w100p', 'direct' => 1, 'block_content' => [ - ['label' => $images], + [ + 'label' => $images, + 'arguments' => ['type' => 'image-item'], + ], ], ]; diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/Icon.php b/pandora_console/include/rest-api/models/VisualConsole/Items/Icon.php index d4b9aef5ef..a4d5600dc4 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/Icon.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Icon.php @@ -190,7 +190,10 @@ final class Icon extends Item 'class' => 'flex-row flex-end w100p', 'direct' => 1, 'block_content' => [ - ['label' => $images], + [ + 'label' => $images, + 'arguments' => ['type' => 'image-item'], + ], ], ]; diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php b/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php index 53e39de06b..2bc262103a 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php @@ -351,7 +351,10 @@ final class StaticGraph extends Item 'class' => 'flex-row flex-end w100p', 'direct' => 1, 'block_content' => [ - ['label' => $images], + [ + 'label' => $images, + 'arguments' => ['type' => 'image-item'], + ], ], ]; diff --git a/pandora_console/install.php b/pandora_console/install.php index 22de8dd896..e9083fd827 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
SUPER::new($config, ALERTSERVER, \&PandoraFMS::AlertServer::data_producer, \&PandoraFMS::AlertServer::data_consumer, $dbh); - bless $self, $class; - return $self; + bless $self, $class; + return $self; } ################################################################################ @@ -91,6 +91,24 @@ sub data_producer ($) { my @tasks; my @rows; + + my $n_servers = get_db_value($dbh, + 'SELECT COUNT(*) FROM `tserver` WHERE `server_type` = ? AND `status` = 1', + ALERTSERVER + ); + + my $i = 0; + my %servers = map { $_->{'name'} => $i++; } get_db_rows($dbh, + 'SELECT `name` FROM `tserver` WHERE `server_type` = ? AND `status` = 1 ORDER BY `name` ASC', + ALERTSERVER + ); + + if ($n_servers eq 0) { + $n_servers = 1; + } + + # Retrieve alerts to be evaluated. + my $server_type_id = $servers{$pa_config->{'servername'}}; # Make a local copy of locked alerts. $AlertSem->down (); @@ -98,9 +116,14 @@ sub data_producer ($) { $AlertSem->up (); # Check the execution queue. - if (pandora_is_master($pa_config) == 1) { - @rows = get_db_rows ($dbh, 'SELECT id, utimestamp FROM talert_execution_queue ORDER BY utimestamp ASC'); - } + my $sql = sprintf( + 'SELECT id, utimestamp FROM talert_execution_queue + WHERE `id` %% %d = %d ORDER BY utimestamp ASC', + $n_servers, + $server_type_id + ); + + @rows = get_db_rows($dbh, $sql); # Queue alerts. foreach my $row (@rows) { diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index c5f4a7d6d8..48c7d2cfc8 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -46,7 +46,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.760"; -my $pandora_build = "220318"; +my $pandora_build = "220321"; 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 fe2fc7bfb7..da734602d7 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.760"; -my $pandora_build = "220318"; +my $pandora_build = "220321"; 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 9c23f14d2f..cccec2066c 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.760 -%define release 220318 +%define release 220321 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 1805edc3c2..370a5d2ae6 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.760 -%define release 220318 +%define release 220321 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 937166bb48..0850b98a62 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.760" -PI_BUILD="220318" +PI_BUILD="220321" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index ed06bed992..f85b4a05a4 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.760 Build 220318"; +my $version = "7.0NG.760 Build 220321"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index b699e4ae49..f42ff39a93 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.760 Build 220318"; +my $version = "7.0NG.760 Build 220321"; # save program name for logging my $progname = basename($0);