diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index f6d790481a..d486a605e4 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.718-180131 +Version: 7.0NG.718-180210 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 bda0341e92..2e3f6c5373 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.718-180131" +pandora_version="7.0NG.718-180210" 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 a995a728d6..8eaa741f39 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.718'; -use constant AGENT_BUILD => '180131'; +use constant AGENT_BUILD => '180210'; # 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 44412eb00c..7aad5339d5 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.718 -%define release 180131 +%define release 180210 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 c0e75c3639..910d86b492 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.718 -%define release 180131 +%define release 180210 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 65a0d45d80..253f1685e8 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.718" -PI_BUILD="180131" +PI_BUILD="180210" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 33624f4878..6b603e149c 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{180131} +{180210} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index f2947e24ba..9d9c2180af 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.718(Build 180131)") +#define PANDORA_VERSION ("7.0NG.718(Build 180210)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 8633fb3c68..c28fb062f8 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.718(Build 180131))" + VALUE "ProductVersion", "(7.0NG.718(Build 180210))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 0421daef3c..3d95155c78 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.718-180131 +Version: 7.0NG.718-180210 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 67e3e6764a..b8869661dd 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.718-180131" +pandora_version="7.0NG.718-180210" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/mr/12.sql b/pandora_console/extras/mr/12.sql new file mode 100644 index 0000000000..052ae9950e --- /dev/null +++ b/pandora_console/extras/mr/12.sql @@ -0,0 +1,44 @@ +START TRANSACTION; + +ALTER TABLE tcontainer_item ADD COLUMN type_graph tinyint(1) unsigned default '0'; + +ALTER TABLE tlayout_data ADD COLUMN `clock_animation` varchar(60) NOT NULL default "analogic_1"; +ALTER TABLE tlayout_data ADD COLUMN `time_format` varchar(60) NOT NULL default "time"; +ALTER TABLE tlayout_data ADD COLUMN `timezone` varchar(60) NOT NULL default "Europe/Madrid"; + +create table IF NOT EXISTS tcluster( + id int unsigned not null auto_increment, + name tinytext not null default '', + cluster_type enum('AA','AP') not null default 'AA', + description text not null default '', + group int(10) unsigned NOT NULL default '0', + id_agent int(10) unsigned NOT NULL, + PRIMARY KEY (id), + FOREIGN KEY (id_agent) REFERENCES tagente(id_agente) + ON UPDATE CASCADE +) engine=InnoDB DEFAULT CHARSET=utf8; + +create table IF NOT EXISTS tcluster_item( + id int unsigned not null auto_increment, + name tinytext not null default '', + item_type enum('AA','AP') not null default 'AA', + critical_limit int unsigned NOT NULL default '0', + warning_limit int unsigned NOT NULL default '0', + is_critical tinyint(2) unsigned NOT NULL default '0', + id_cluster int unsigned, + PRIMARY KEY (id), + FOREIGN KEY (id_cluster) REFERENCES tcluster(id) + ON DELETE SET NULL ON UPDATE CASCADE +) engine=InnoDB DEFAULT CHARSET=utf8; + +create table IF NOT EXISTS tcluster_agent( + id_cluster int unsigned not null, + id_agent int(10) unsigned not null, + PRIMARY KEY (id_cluster,id_agent), + FOREIGN KEY (id_agent) REFERENCES tagente(id_agente) + ON UPDATE CASCADE, + FOREIGN KEY (id_cluster) REFERENCES tcluster(id) + ON UPDATE CASCADE +) engine=InnoDB DEFAULT CHARSET=utf8; + +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 ec97615a55..1a86b10541 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 @@ -1159,10 +1159,10 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned; INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); -INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 11); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 12); UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; -INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '718'); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '719'); -- --------------------------------------------------------------------- -- Table `tplanned_downtime_agents` @@ -1248,6 +1248,9 @@ ALTER TABLE tlayout_data ADD COLUMN `show_statistics` tinyint(2) NOT NULL defaul ALTER TABLE tlayout_data ADD COLUMN `element_group` int(10) NOT NULL default '0'; ALTER TABLE tlayout_data ADD COLUMN `id_layout_linked_weight` int(10) NOT NULL default '0'; ALTER TABLE tlayout_data ADD COLUMN `show_on_top` tinyint(1) NOT NULL default '0'; +ALTER TABLE tlayout_data ADD COLUMN `clock_animation` varchar(60) NOT NULL default "analogic_1"; +ALTER TABLE tlayout_data ADD COLUMN `time_format` varchar(60) NOT NULL default "time"; +ALTER TABLE tlayout_data ADD COLUMN `timezone` varchar(60) NOT NULL default "Europe/Madrid"; -- --------------------------------------------------------------------- -- Table `tagent_custom_fields` @@ -1411,6 +1414,7 @@ CREATE TABLE IF NOT EXISTS `tcontainer_item` ( `agent` varchar(100) NOT NULL default '', `module` varchar(100) NOT NULL default '', `id_tag` integer(10) unsigned NOT NULL DEFAULT 0, + `type_graph` tinyint(1) unsigned NOT NULL DEFAULT 0, `fullscale` tinyint(1) UNSIGNED NOT NULL default 0, PRIMARY KEY(`id_ci`), FOREIGN KEY (`id_container`) REFERENCES tcontainer(`id_container`) @@ -1482,3 +1486,50 @@ ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL defaul -- --------------------------------------------------------------------- SELECT max(unified_filters_id) INTO @max FROM tsnmp_filter; UPDATE tsnmp_filter tsf,(SELECT @max:= @max) m SET tsf.unified_filters_id = @max:= @max + 1 where tsf.unified_filters_id=0; + +-- --------------------------------------------------------------------- +-- Table `tcluster` +-- --------------------------------------------------------------------- + +create table IF NOT EXISTS `tcluster`( + `id` int unsigned not null auto_increment, + `name` tinytext not null default '', + `cluster_type` enum('AA','AP') not null default 'AA', + `description` text not null default '', + `group` int(10) unsigned NOT NULL default '0', + `id_agent` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + FOREIGN KEY (`id_agent`) REFERENCES tagente(`id_agente`) + ON UPDATE CASCADE +) engine=InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `tcluster_item` +-- --------------------------------------------------------------------- + +create table IF NOT EXISTS `tcluster_item`( + `id` int unsigned not null auto_increment, + `name` tinytext not null default '', + `item_type` enum('AA','AP') not null default 'AA', + `critical_limit` int unsigned NOT NULL default '0', + `warning_limit` int unsigned NOT NULL default '0', + `is_critical` tinyint(2) unsigned NOT NULL default '0', + `id_cluster` int unsigned, + PRIMARY KEY (`id`), + FOREIGN KEY (`id_cluster`) REFERENCES tcluster(`id`) + ON DELETE SET NULL ON UPDATE CASCADE +) engine=InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `tcluster_agent` +-- --------------------------------------------------------------------- + +create table IF NOT EXISTS `tcluster_agent`( + `id_cluster` int unsigned not null, + `id_agent` int(10) unsigned not null, + PRIMARY KEY (`id_cluster`,`id_agent`), + FOREIGN KEY (`id_agent`) REFERENCES tagente(`id_agente`) + ON UPDATE CASCADE, + FOREIGN KEY (`id_cluster`) REFERENCES tcluster(`id`) + ON UPDATE CASCADE +) engine=InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/general/firts_task/cluster_builder.php b/pandora_console/general/firts_task/cluster_builder.php new file mode 100644 index 0000000000..eb2e8d0e71 --- /dev/null +++ b/pandora_console/general/firts_task/cluster_builder.php @@ -0,0 +1,56 @@ + +true, 'message'=> __('There are no clusters defined yet.') ) ); +?> + +
+
+ __('Clusters')));?> +
+
+

+


'; + + echo __('Depending on how they provide that service, we can find two types:').'

'; + + echo __('Clusters to balance the service load: these are active - active (A/A) mode clusters. It means that all the nodes (or machines that compose it) are working. They must be working because if one stops working, it will overload the others.').'

'; + + echo __('Clusters to guarantee service: these are active - passive (A/P) mode clusters. It means that one of the nodes (or machines that make up the cluster) will be running (primary) and another won\'t (secondary). When the primary goes down, the secondary must take over and give the service instead. Although many of the elements of this cluster are active-passive, it will also have active elements in both of them that indicate that the passive node is "online", so that in the case of a service failure in the master, the active node collects this information.'); + + ?>

+
+ +
+
+
\ No newline at end of file diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index 290e44f262..7a99ae494c 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -102,12 +102,11 @@ echo '
'; echo 'pandora_console'; } echo '
'; - echo '
' + ); + } + else if(values['label_position'] == 'down'){ + item = $('
' + + '' + + '
' + values['label'] + '
' + + '
' + ); + } + else if(values['label_position'] == 'left'){ + item = $('
' + + '' + + '
' + values['label'] + '
' + + '
' + ); + } + else if(values['label_position'] == 'right'){ + item = $('
' + + '' + + '
' + values['label'] + '
' + + '
' + ); + } + + setClock(id_data, values); + break; case 'simple_value': sizeStyle = ''; @@ -3422,7 +3564,7 @@ function createItem(type, values, id_data) { break; case 'icon': if ((values['width'] == 0) || (values['height'] == 0)) { - if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + if(values['naturalWidth'] == null || values['naturalWidth'] > 150 || values['naturalWidth'] > 150){ sizeStyle = 'width: ' + '70' + 'px; height: ' + '70' + 'px;'; imageSize = 'width="' + '70' + '" height="' + '70' + '"'; } @@ -3527,6 +3669,10 @@ function insertDB(type, values) { success: function (data) { if (data['correct']) { id = data['id_data']; + if((type === 'group_item') || (type === 'icon') || (type === 'static_graph')){ + values['naturalWidth'] = $('#preview > img')[0].naturalWidth; + values['naturalHeight'] = $('#preview > img')[0].naturalHeight; + } createItem(type, values, id); addItemSelectParents(id, data['text']); //Reload all events for the item and new item. @@ -3623,6 +3769,7 @@ function updateDB_visual(type, idElement , values, event, top, left) { case 'icon': case 'module_graph': case 'bars_graph': + case 'clock': case 'auto_sla_graph': case 'donut_graph': @@ -3866,7 +4013,12 @@ function copyDB(idItem) { values = data['values']; type = data['type']; id = data['id_data']; - + + if((type === 'group_item') || (type === 'icon') || (type === 'static_graph')){ + values['naturalWidth'] = $('#image_'+idItem).prop('naturalWidth'); + values['naturalHeight'] = $('#image_'+idItem).prop('naturalHeight'); + } + createItem(type, values, id); addItemSelectParents(id, data['text']); @@ -4111,6 +4263,15 @@ function eventsItems(drag) { activeToolboxButton('delete_item', true); activeToolboxButton('show_grid', false); } + if ($(divParent).hasClass('clock')) { + creationItem = null; + selectedItem = 'clock'; + idItem = $(divParent).attr('id'); + activeToolboxButton('copy_item', true); + activeToolboxButton('edit_item', true); + activeToolboxButton('delete_item', true); + activeToolboxButton('show_grid', false); + } if ($(divParent).hasClass('handler_start')) { idItem = $(divParent).attr('id') .replace("handler_start_", ""); @@ -4295,6 +4456,9 @@ function eventsItems(drag) { if ($(event.target).hasClass('icon')) { selectedItem = 'icon'; } + if ($(event.target).hasClass('clock')) { + selectedItem = 'clock'; + } if ($(event.target).hasClass('handler_start')) { selectedItem = 'handler_start'; } @@ -4617,6 +4781,10 @@ function click_button_toolbox(id) { toolbuttonActive = creationItem = 'icon'; toggle_item_palette(); break; + case 'clock': + toolbuttonActive = creationItem = 'clock'; + toggle_item_palette(); + break; case 'group_item': toolbuttonActive = creationItem = 'group_item'; toggle_item_palette(); @@ -4658,6 +4826,7 @@ function click_button_toolbox(id) { activeToolboxButton('simple_value', false); activeToolboxButton('label', false); activeToolboxButton('icon', false); + activeToolboxButton('clock', false); activeToolboxButton('service', false); activeToolboxButton('group_item', false); activeToolboxButton('auto_sla_graph', false); @@ -4691,6 +4860,7 @@ function click_button_toolbox(id) { activeToolboxButton('simple_value', true); activeToolboxButton('label', true); activeToolboxButton('icon', true); + activeToolboxButton('clock', true); activeToolboxButton('group_item', true); activeToolboxButton('auto_sla_graph', true); activeToolboxButton('donut_graph', true); @@ -4744,6 +4914,7 @@ function click_button_toolbox(id) { } break; } + $('.ColorPickerDivSample').css('background-color',"black"); } function showPreview(image) { diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 8f25bdb3a4..479269af08 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -248,6 +248,18 @@ if(enterprise_installed()) { $row++; } +if(enterprise_installed()) { + $table_styles->data[$row][0] = __('Docs URL (login)'); + $table_styles->data[$row][1] = html_print_input_text ('custom_docs_url', $config["custom_docs_url"], '', 50, 50, true); + $row++; +} + +if(enterprise_installed()) { + $table_styles->data[$row][0] = __('Support URL (login)'); + $table_styles->data[$row][1] = html_print_input_text ('custom_support_url', $config["custom_support_url"], '', 50, 50, true); + $row++; +} + $table_styles->data[$row][0] = __('Disable logo in graphs'); $table_styles->data[$row][1] = __('Yes') . ' ' . html_print_radio_button_extended ('fixed_graph', 1, '', $config["fixed_graph"], $open, '','',true) . @@ -475,8 +487,8 @@ if (!enterprise_installed()) { $disabled_graph_precision = true; } -$table_chars->data[$row][0] = __('Data precision for reports'); -$table_chars->data[$row][0] .= ui_print_help_tip(__('Number of decimals shown in reports. It must be a number between 0 and 5'), true); +$table_chars->data[$row][0] = __('Data precision for reports and visual consoles'); +$table_chars->data[$row][0] .= ui_print_help_tip(__('Number of decimals shown in reports and visual consoles. It must be a number between 0 and 5'), true); $table_chars->data[$row][1] = html_print_input_text ('graph_precision', $config["graph_precision"], '', 5, 5, true, $disabled_graph_precision, false, "onChange=\"change_precision()\""); $row++; diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index afd33b961e..37291e2ce3 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -152,7 +152,7 @@ if ($create_user) { } $values = array (); - $id = (string) get_parameter ('id_user'); + $values['id_user'] = (string) get_parameter ('id_user'); $values['fullname'] = (string) get_parameter ('fullname'); $values['firstname'] = (string) get_parameter ('firstname'); $values['lastname'] = (string) get_parameter ('lastname'); @@ -220,15 +220,14 @@ if ($create_user) { $new_user = true; } else { - $info = 'FullName: ' . $values['fullname'] . ' Firstname: ' . $values['firstname'] . - ' Lastname: ' . $values['lastname'] . ' Email: ' . $values['email'] . - ' Phone: ' . $values['phone'] . ' Comments: ' . $values['comments'] . - ' Is_admin: ' . $values['is_admin'] . - ' Language: ' . $values['language'] . - ' Block size: ' . $values['block_size'] . ' Interactive Charts: ' . $values['flash_chart']; - + $info = + '{"Id_user":"' . $values['id_user'] . '","FullName":"' . $values['fullname'] . '","Firstname":"'. $values['firstname'] .'","Lastname":"'. $values['lastname'] . '","Email":"' . $values['email'] . '","Phone":"' . $values['phone'] . '","Comments":"' . $values['comments'] .'","Is_admin":"' . $values['is_admin'] .'","Language":"' . $values['language'] . '","Block size":"' . $values['block_size'] . '","Interactive Charts":"' . $values['flash_chart'].'"'; + if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { - $info .= ' Skin: ' . $values['id_skin']; + $info .= ',"Skin":"' . $values['id_skin'].'"}'; + } + else{ + $info .= '}'; } switch ($config['dbtype']) { @@ -278,6 +277,7 @@ if ($create_user) { if ($update_user) { $values = array (); + $values['id_user'] = (string) get_parameter ('id_user'); $values['fullname'] = (string) get_parameter ('fullname'); $values['firstname'] = (string) get_parameter ('firstname'); $values['lastname'] = (string) get_parameter ('lastname'); @@ -362,21 +362,40 @@ if ($update_user) { } } else { - $info = 'FullName: ' . $values['fullname'] . ' Firstname: ' . $values['firstname'] . - ' Lastname: ' . $values['lastname'] . ' Email: ' . $values['email'] . - ' Phone: ' . $values['phone'] . ' Comments: ' . $values['comments'] . - ' Is_admin: ' . $values['is_admin'] . - ' Language: ' . $values['language'] . - ' Block size: ' . $values['block_size'] . ' Flash Chats: ' . $values['flash_chart'] . - ' Section: ' . $values['section']; + + $has_skin = false; + $has_wizard = false; + + $info = '{"id_user":"'.$values['id_user'].'", + "FullName":"' . $values['fullname'] .'", + "Firstname":"' . $values['firstname'] .'", + "Lastname":"' . $values['lastname'] . '", + "Email":"' . $values['email'] . '", + "Phone":"' . $values['phone'] . '", + "Comments":"' . $values['comments'] . '", + "Is_admin":"' . $values['is_admin'] . '", + "Language":"' . $values['language'] . '", + "Block size":"' . $values['block_size'] . '", + "Flash Chats":"' . $values['flash_chart'] . '", + "Section":"' . $values['section'].'"'; if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { - $info .= ' Skin: ' . $values['id_skin']; + $info .= ',"Skin":"' . $values['id_skin'].'"'; + $has_skin = true; } if(enterprise_installed() && defined('METACONSOLE')) { - $info .= ' Wizard access: ' . $values['metaconsole_access']; + $info .= ',"Wizard access":"' . $values['metaconsole_access'].'"}'; + $has_wizard = true; } + elseif($has_skin){ + $info .= '}'; + } + + if(!$has_skin && !$has_wizard){ + $info .= '}'; + } + db_pandora_audit("User management", "Updated user ".io_safe_input($id), false, false, $info); diff --git a/pandora_console/images/clock-tab.disabled.png b/pandora_console/images/clock-tab.disabled.png new file mode 100644 index 0000000000..cd889bc875 Binary files /dev/null and b/pandora_console/images/clock-tab.disabled.png differ diff --git a/pandora_console/images/clock-tab.png b/pandora_console/images/clock-tab.png new file mode 100644 index 0000000000..0a0cbee9db Binary files /dev/null and b/pandora_console/images/clock-tab.png differ diff --git a/pandora_console/images/console/signes/clock.png b/pandora_console/images/console/signes/clock.png new file mode 100644 index 0000000000..b226abd1e9 Binary files /dev/null and b/pandora_console/images/console/signes/clock.png differ diff --git a/pandora_console/images/console/signes/digital-clock.png b/pandora_console/images/console/signes/digital-clock.png new file mode 100644 index 0000000000..97a6f9349d Binary files /dev/null and b/pandora_console/images/console/signes/digital-clock.png differ diff --git a/pandora_console/images/firts_task/icono-cluster-activo.png b/pandora_console/images/firts_task/icono-cluster-activo.png new file mode 100644 index 0000000000..49720af75d Binary files /dev/null and b/pandora_console/images/firts_task/icono-cluster-activo.png differ diff --git a/pandora_console/images/networkmap/so_cluster.png b/pandora_console/images/networkmap/so_cluster.png new file mode 100644 index 0000000000..e515c9e7a8 Binary files /dev/null and b/pandora_console/images/networkmap/so_cluster.png differ diff --git a/pandora_console/images/os_icons/so_big_icons/so_cluster.png b/pandora_console/images/os_icons/so_big_icons/so_cluster.png new file mode 100644 index 0000000000..4b85e5f049 Binary files /dev/null and b/pandora_console/images/os_icons/so_big_icons/so_cluster.png differ diff --git a/pandora_console/images/os_icons/so_cluster.png b/pandora_console/images/os_icons/so_cluster.png new file mode 100644 index 0000000000..5f76cd1615 Binary files /dev/null and b/pandora_console/images/os_icons/so_cluster.png differ diff --git a/pandora_console/images/os_icons/so_cluster_small.png b/pandora_console/images/os_icons/so_cluster_small.png new file mode 100644 index 0000000000..8f5a3c9c5f Binary files /dev/null and b/pandora_console/images/os_icons/so_cluster_small.png differ diff --git a/pandora_console/include/ajax/graph.ajax.php b/pandora_console/include/ajax/graph.ajax.php index 33effe1f83..75499d6e13 100644 --- a/pandora_console/include/ajax/graph.ajax.php +++ b/pandora_console/include/ajax/graph.ajax.php @@ -159,6 +159,9 @@ if ($get_graphs){ if($period > 1){ $value['time_lapse'] = $period; } + + $type_graph = ($value['type_graph'])? "line" : "area"; + switch ($value['type']) { case 'simple_graph': if ($contador > 0) { @@ -195,9 +198,8 @@ if ($get_graphs){ null, false, false, - 'area', - $value['fullscale'] - ); + $type_graph, + $value['fullscale']); $contador --; } // $table .= "
"; @@ -339,9 +341,8 @@ if ($get_graphs){ null, false, false, - 'area', - $value['fullscale'] - ); + $type_graph, + $value['fullscale']); $contador --; } } diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 3c5d64a437..e22a4ca266 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -283,6 +283,14 @@ if ($get_module_detail) { if ($attr[1] != "modules_format_data") { $data[] = date('d F Y h:i:s A', $row['utimestamp']); } + elseif(is_snapshot_data($row[$attr[0]])){ + if($config['command_snapshot']){ + $data[] = ""; + } + else{ + $data[] = "".wordwrap(io_safe_input($row[$attr[0]]),60,"
\n",true)."
"; + } + } elseif (($config['command_snapshot'] == '0') && (preg_match ("/[\n]+/i", $row[$attr[0]]))) { // Its a single-data, multiline data (data snapshot) ? @@ -342,21 +350,11 @@ if ($get_module_detail) { $data[] = 'No data'; } else { - if(is_snapshot_data($row[$attr[0]])){ - if($config['command_snapshot']){ - $data[] = ""; - } - else{ - $data[] = "".wordwrap(io_safe_input($row[$attr[0]]),60,"
\n",true)."
"; - } - } - else{ - $data_macro = modules_get_unit_macro($row[$attr[0]],$unit); - if($data_macro){ - $data[] = $data_macro; - } else { - $data[] = $row[$attr[0]]; - } + $data_macro = modules_get_unit_macro($row[$attr[0]],$unit); + if($data_macro){ + $data[] = $data_macro; + } else { + $data[] = $row[$attr[0]]; } } } @@ -472,6 +470,7 @@ if ($list_modules) { $access = ($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR'); $id_agente = $id_agent = (int)get_parameter('id_agente', 0); + $show_notinit = (int)get_parameter('show_notinit', 0); $url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agent; $selectTypeUp = ''; $selectTypeDown = ''; @@ -592,6 +591,13 @@ if ($list_modules) { if (!empty($status_text_monitor)) { $status_text_monitor_sql .= $status_text_monitor . '%'; } + + if(!$show_notinit){ + $monitor_filter = AGENT_MODULE_STATUS_NO_DATA; + } + else{ + $monitor_filter = -15; + } //Count monitors/modules switch ($config["dbtype"]) { @@ -610,7 +616,7 @@ if ($list_modules) { AND tagente_estado.estado != %d AND tagente_modulo.%s ORDER BY tagente_modulo.id_module_group , %s %s", - $id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, + $id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql, $tags_sql, $monitor_filter, $status_module_group_filter, $order['field'], $order['order']); break; case "postgresql": @@ -632,7 +638,7 @@ if ($list_modules) { tagente_modulo.nombre ORDER BY tagente_modulo.id_module_group , %s %s", $id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql, - $tags_sql, AGENT_MODULE_STATUS_NO_DATA,$status_module_group_filter,$order['field'], + $tags_sql, $monitor_filter,$status_module_group_filter,$order['field'], $order['order']); break; case "oracle": @@ -650,7 +656,7 @@ if ($list_modules) { AND tagente_estado.estado != %d AND tagente_modulo.%s ORDER BY tagente_modulo.id_module_group , %s %s - ", $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, + ", $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, $monitor_filter, $status_module_group_filter,$order['field'], $order['order']); break; } @@ -679,7 +685,7 @@ if ($list_modules) { AND tagente_estado.estado != %d AND tagente_modulo.%s ORDER BY tmodule_group.name , %s %s", - $id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, + $id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql, $tags_sql, $monitor_filter, $status_module_group_filter, $order['field'], $order['order']); break; @@ -698,7 +704,7 @@ if ($list_modules) { AND tagente_estado.estado != %d AND tagente_modulo.%s ORDER BY tmodule_group.name , %s %s", - $id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, + $id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql, $tags_sql, $monitor_filter, $status_module_group_filter, $order['field'], $order['order']); break; // If Dbms is Oracle then field_list in sql statement has to be recoded. See oracle_list_all_field_table() @@ -721,7 +727,7 @@ if ($list_modules) { AND tagente_estado.estado != %d AND tagente_modulo.%s ORDER BY tmodule_group.name , %s %s - ", $id_agente, $status_text_monitor_sql, $tags_sql, $status_filter_sql, AGENT_MODULE_STATUS_NO_DATA, + ", $id_agente, $status_text_monitor_sql, $tags_sql, $status_filter_sql, $monitor_filter, $status_module_group_filter, $order['field'], $order['order']); break; } diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 05e6f7fc4c..461c20298a 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -102,7 +102,7 @@ $parent = get_parameter('parent', null); $map_linked = get_parameter('map_linked', null); $map_linked_weight = get_parameter('map_linked_weight', null); $element_group = get_parameter('element_group', null); -$width_percentile = get_parameter('width_percentile', null); +$width_percentile = get_parameter('width_percentile', 0); $bars_graph_height = get_parameter('bars_graph_height', null); $max_percentile = get_parameter('max_percentile', null); $height_module_graph = get_parameter('height_module_graph', null); @@ -145,6 +145,10 @@ $type_graph = get_parameter('type_graph', 'area'); $label_position = get_parameter('label_position', 'down'); $show_statistics = get_parameter('show_statistics', 0); +$clock_animation = get_parameter('clock_animation', 'analogic_1'); +$time_format = get_parameter('time_format', 'time'); +$timezone = get_parameter('timezone', 'Europe/Madrid'); + switch ($action) { case 'get_font': $return = array(); @@ -735,6 +739,23 @@ switch ($action) { $values['width'] = $width; } + break; + case 'clock': + if ($clock_animation !== null) { + $values['clock_animation'] = $clock_animation; + } + if ($time_format !== null) { + $values['time_format'] = $time_format; + } + if ($timezone !== null) { + $values['timezone'] = $timezone; + } + if ($width !== null) { + $values['width'] = $width_percentile; + } + if ($fill_color !== null) { + $values['fill_color'] = $fill_color; + } break; default: if (enterprise_installed()) { @@ -782,6 +803,13 @@ switch ($action) { unset($values['width']); unset($values['id_agent']); break; + case 'clock': + unset($values['clock_animation']); + unset($values['time_format']); + unset($values['timezone']); + unset($values['fill_color']); + unset($values['width']); + break; case 'box_item': unset($values['border_width']); unset($values['border_color']); @@ -843,6 +871,7 @@ switch ($action) { case 'simple_value': case 'label': case 'icon': + case 'clock': case 'auto_sla_graph': case 'donut_graph': $elementFields = db_get_row_filter('tlayout_data', @@ -945,6 +974,9 @@ switch ($action) { $elementFields['width_module_graph'] = $elementFields['width']; $elementFields['height_module_graph'] = $elementFields['height']; break; + case 'clock': + $elementFields['width_percentile'] = $elementFields['width']; + break; case 'bars_graph': $elementFields['width_percentile'] = $elementFields['width']; $elementFields['bars_graph_height'] = $elementFields['height']; @@ -1120,6 +1152,14 @@ switch ($action) { $values['border_color'] = $grid_color; $values['id_agent'] = $id_agent_string; break; + case 'clock': + $values['type'] = CLOCK; + $values['width'] = $width_percentile; + $values['clock_animation'] = $clock_animation; + $values['fill_color'] = $fill_color; + $values['time_format'] = $time_format; + $values['timezone'] = $timezone; + break; case 'auto_sla_graph': $values['type'] = AUTO_SLA_GRAPH; $values['period'] = $event_max_time_row; @@ -1183,7 +1223,7 @@ switch ($action) { } break; } - + $idData = db_process_sql_insert('tlayout_data', $values); $return = array(); diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 0c92c75b67..6d1ce48f62 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC180131'; +$build_version = 'PC180210'; $pandora_version = 'v7.0NG.718'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index cc89ce8a0a..cb0069cf10 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -201,6 +201,7 @@ define('CIRCULAR_PROGRESS_BAR', 15); define('CIRCULAR_INTERIOR_PROGRESS_BAR', 16); define('DONUT_GRAPH', 17); define('BARS_GRAPH', 18); +define('CLOCK', 19); //Some styles define('MIN_WIDTH', 300); define('MIN_HEIGHT', 120); @@ -315,12 +316,15 @@ define ('MODULE_PLUGIN', 4); define ('MODULE_PREDICTION', 5); define ('MODULE_WMI', 6); define ('MODULE_WEB', 7); -define ('MODULE_WUX', 8); +define ('MODULE_WUX', 8); /* Type of Modules of Prediction */ define ('MODULE_PREDICTION_SERVICE', 2); define ('MODULE_PREDICTION_SYNTHETIC', 3); define ('MODULE_PREDICTION_NETFLOW', 4); +define ('MODULE_PREDICTION_CLUSTER', 5); +define ('MODULE_PREDICTION_CLUSTER_AA', 6); +define ('MODULE_PREDICTION_CLUSTER_AP', 7); /* SNMP CONSTANTS */ define('SNMP_DIR_MIBS', "attachment/mibs"); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 5dceaa9387..2557ae3db2 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1810,7 +1810,7 @@ function check_acl($id_user, $id_group, $access, $onlyOneGroup = false) { } if ($id_group != 0 || $onlyOneGroup === true) { - $groups_list_acl = users_get_groups ($id_user, 'AR', false, true, null); + $groups_list_acl = users_get_groups ($id_user, $access, false, true, null); } else{ $groups_list_acl = get_users_acl($id_user); @@ -2143,18 +2143,7 @@ function is_image_data ($data) { * Looks for two or more carriage returns. */ function is_snapshot_data ($data) { - - // TODO IDEA: In the future, we can set a variable in setup - // to define how many \n must have a snapshot to define it's - // a snapshot. I think two or three is a good value anyway. - - $temp = array(); - $count = preg_match_all ("/\n/", $data, $temp); - - if ( ($count > 2) || (is_image_data($data)) ) - return 1; - else - return 0; + return is_image_data($data); } /** @@ -2775,6 +2764,12 @@ function register_pass_change_try ($id_user, $success) { $values['success'] = $success; db_process_sql_insert('treset_pass_history', $values); } + +function isJson($string) { + json_decode($string); + return (json_last_error() == JSON_ERROR_NONE); +} + /** * returns true or false if it is a valid ip * checking ipv4 and ipv6 or resolves the name dns diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index 577dfe82f1..6c1938e4d8 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -1746,11 +1746,22 @@ function get_group_alerts($id_group, $filter = '', $options = false, $filter .= ''; break; } + + //WHEN SELECT ALL TAGS TO FILTER ALERTS + + $modules_tags = count(db_process_sql('select * from ttag')); + + $modules_user_tags = count(explode(",", $tag)); + + if($modules_tags != $modules_user_tags){ + if ($tag) { + $filter .= ' AND (id_agent_module IN (SELECT id_agente_modulo FROM ttag_module WHERE id_tag IN ('.$tag.')))'; + } - if ($tag) { - $filter .= ' AND (id_agent_module IN (SELECT id_agente_modulo FROM ttag_module WHERE id_tag IN ('.$tag.')))'; } - + + //WHEN SELECT ALL TAGS TO FILTER ALERTS + if($action_filter){ $filter .= ' AND (talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions where id_alert_action = '.$action_filter.'))'; } diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 71dd08e199..c817482f96 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -512,6 +512,11 @@ function config_update_config () { $error_update[] = __('Custom title2 login'); if (!config_update_value ('login_background', (string) get_parameter ('login_background'))) $error_update[] = __('Login background'); + + if (!config_update_value ('custom_docs_url', (string) get_parameter ('custom_docs_url'))) + $error_update[] = __('Custom Docs url'); + if (!config_update_value ('custom_support_url', (string) get_parameter ('custom_support_url'))) + $error_update[] = __('Custom support url'); if (!config_update_value ('meta_custom_logo', (string) get_parameter ('meta_custom_logo'))) $error_update[] = __('Custom logo metaconsole'); @@ -525,6 +530,11 @@ function config_update_config () { $error_update[] = __('Custom title2 login metaconsole'); if (!config_update_value ('meta_login_background', (string) get_parameter ('meta_login_background'))) $error_update[] = __('Login background metaconsole'); + + if (!config_update_value ('meta_custom_docs_url', (string) get_parameter ('meta_custom_docs_url'))) + $error_update[] = __('Custom Docs url'); + if (!config_update_value ('meta_custom_support_url', (string) get_parameter ('meta_custom_support_url'))) + $error_update[] = __('Custom support url'); if (!config_update_value ('vc_refr', get_parameter('vc_refr'))) $error_update[] = __('Default interval for refresh on Visual Console'); @@ -1185,6 +1195,22 @@ function config_process_config () { if (!isset ($config["custom_title2_login"])) { config_update_value ('custom_title2_login', __('NEXT GENERATION')); } + + if (!isset ($config["custom_docs_url"])) { + config_update_value ('custom_docs_url', 'http://wiki.pandorafms.com/'); + } + + if (!isset ($config["custom_support_url"])) { + config_update_value ('custom_support_url', 'https://support.artica.es'); + } + + if (!isset ($config["meta_custom_docs_url"])) { + config_update_value ('meta_custom_docs_url', 'http://wiki.pandorafms.com/index.php?title=Main_Page'); + } + + if (!isset ($config["meta_custom_support_url"])) { + config_update_value ('meta_custom_support_url', 'https://support.artica.es'); + } if (!isset ($config["meta_custom_logo"])) { config_update_value ('meta_custom_logo', 'logo_pandora_metaconsola.png'); diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 14353cc48b..31cfde5fa7 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -2283,7 +2283,7 @@ function events_page_details ($event, $server = "") { $data = array(); $data[0] = __('Instructions'); - $data[1] = events_display_instructions ($event['event_type'], $events, true); + $data[1] = events_display_instructions ($event['event_type'], $event, true); $table_details->data[] = $data; $data = array(); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 4156dca4ed..3eac34d8b1 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2046,23 +2046,47 @@ function graphic_combined_module ($module_list, $weight_list, $period, } foreach ($module_list as $key => $value) { - $agent_name = io_safe_output( modules_get_agentmodule_agent_name ($value) ); - $alias = db_get_value ("alias","tagente","nombre",$agent_name); - $module_name = io_safe_output( modules_get_agentmodule_name ($value) ); - - if ($flash_charts){ - $module_name_list[$key] = '' . $alias . " / " . $module_name. ''; + if (is_metaconsole()) { + $server = metaconsole_get_connection_by_id ($value['server']); + metaconsole_connect($server); + $value = $value['module']; } - else{ - $module_name_list[$key] = $alias . " / " . $module_name; + if ($labels[$value] != ''){ + $module_name_list[$key] = $labels[$value]; + } + else { + $agent_name = io_safe_output( modules_get_agentmodule_agent_name ($value) ); + $alias = db_get_value ("alias","tagente","nombre",$agent_name); + $module_name = io_safe_output( modules_get_agentmodule_name ($value) ); + + if ($flash_charts){ + $module_name_list[$key] = '' . $alias . " / " . $module_name. ''; + } + else{ + $module_name_list[$key] = $alias . " / " . $module_name; + } + } + if (is_metaconsole()) { + metaconsole_restore_db(); } } if (!is_null($percentil) && $percentil) { foreach ($module_list as $key => $value) { + if (is_metaconsole()) { + $server = metaconsole_get_connection_by_id ($value['server']); + metaconsole_connect($server); + $value = $value['module']; + } + $agent_name = io_safe_output( modules_get_agentmodule_agent_name ($value) ); $alias = db_get_value ("alias","tagente","nombre",$agent_name); $module_name = io_safe_output( modules_get_agentmodule_name ($value) ); + + if (is_metaconsole()) { + metaconsole_restore_db(); + } + $module_name_list['percentil'.$key] = __('Percentile %dº', $config['percentil']) . __(' of module ') . $agent_name .' / ' . $module_name . ' (' . $percentil_result[$key][0] . ' ' . $unit . ') '; $series_type[$key] = 'line'; } @@ -2465,42 +2489,46 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts, $p foreach ($module_list as $key_module => $value_module) { if (!is_null($percentil) && $percentil) { - $array_percentil = array(); + $array_percentil = array(); } - $previous_data = modules_get_previous_data ($value_module, $datelimit); - $data_uncompress = db_uncompress_module_data($value_module, $datelimit, $date); + if (is_metaconsole()) { + $server = metaconsole_get_connection_by_id ($value_module['server']); + metaconsole_connect($server); + $previous_data = modules_get_previous_data ($value_module['module'], $datelimit); + $data_uncompress = db_uncompress_module_data($value_module['module'], $datelimit, $date); + metaconsole_restore_db(); + } + else{ + $previous_data = modules_get_previous_data ($value_module, $datelimit); + $data_uncompress = db_uncompress_module_data($value_module, $datelimit, $date); + } foreach ($data_uncompress as $key_data => $value_data) { foreach ($value_data['data'] as $k => $v) { - if($flash_charts) { - $real_date = date("Y M d H:i:s", $v['utimestamp']); - } - else{ - $real_date = $v['utimestamp']; - } - + $real_date = $v['utimestamp']; + if(!isset($v['datos'])){ - $v['datos'] = $previous_data; + $v['datos'] = $previous_data; } else{ - $previous_data = $v['datos']; + $previous_data = $v['datos']; } if (!is_null($percentil) && $percentil) { - $array_percentil[] = $v['datos']; + $array_percentil[] = $v['datos']; } - + $data_all[$real_date][$key_module] = $v['datos']; } } if (!is_null($percentil) && $percentil) { - $percentil_value = get_percentile($config['percentil'], $array_percentil); - $percentil_result[$key_module] = array_fill (0, count($data_all), $percentil_value); - if(count($data_all) > $count_data_all){ - $count_data_all = count($data_all); - } + $percentil_value = get_percentile($config['percentil'], $array_percentil); + $percentil_result[$key_module] = array_fill (0, count($data_all), $percentil_value); + if(count($data_all) > $count_data_all){ + $count_data_all = count($data_all); + } } } @@ -2512,25 +2540,34 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts, $p } } - $data_prev = array(); - + $data_prev = array(); + $data_all_rev = array(); ksort($data_all); + foreach ($data_all as $key => $value) { - foreach ($module_list as $key_module => $value_module) { - if(!isset($value[$key_module])){ - $data_all[$key][$key_module] = $data_prev[$key_module]; - } - else{ - $data_prev[$key_module] = $value[$key_module]; - } + if($flash_charts) { + $real_date = date("Y M d H:i:s", $key); } + else{ + $real_date = $key; + } + + foreach ($module_list as $key_module => $value_module) { + if(!isset($value[$key_module])){ + $data_all[$key][$key_module] = $data_prev[$key_module]; + } + else{ + $data_prev[$key_module] = $value[$key_module]; + } + } + $data_all_rev[$real_date] = $data_all[$key]; } if (!is_null($percentil) && $percentil) { - $data_all['percentil'] = $percentil_result; + $data_all_rev['percentil'] = $percentil_result; } - return $data_all; + return $data_all_rev; } /** diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 0822169265..b940072a6a 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -1649,6 +1649,11 @@ function modules_is_unit_macro($macro) { return false; } +function modules_get_last_contact ($id_agentmodule) { + return db_get_value ('utimestamp', 'tagente_estado', + 'id_agente_modulo', $id_agentmodule); +} + /** * Get the current value of an agent module. * diff --git a/pandora_console/include/functions_os.php b/pandora_console/include/functions_os.php index 8862b87db7..f9f7e407ec 100755 --- a/pandora_console/include/functions_os.php +++ b/pandora_console/include/functions_os.php @@ -74,4 +74,8 @@ function os_get_os() { return $op_systems; } + +function os_get_icon($id_os) { + return db_get_value ('icon_name', 'tconfig_os', 'id_os', (int) $id_os); +} ?> diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php index 622814ef7f..20238c8b23 100644 --- a/pandora_console/include/functions_tags.php +++ b/pandora_console/include/functions_tags.php @@ -1432,8 +1432,12 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags = array(), $c AND id_perfil IN ( SELECT id_perfil FROM tperfil - WHERE ".get_acl_column($access)." = 1) - AND id_grupo = ".$id_group; + WHERE ".get_acl_column($access)." = 1)"; + + if(isset($id_group)){ + $sql .= "AND id_grupo = ".$id_group; + } + $user_has_perm_without_tags = db_get_all_rows_sql ($sql); if ($user_has_perm_without_tags) { diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index 1909a88e46..2bea03cd42 100755 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -140,6 +140,9 @@ function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGro } function get_group_ancestors($group_id, $groups) { + if($group_id == 0) { + return 0; + } if (!isset($groups[$group_id])) { return null; @@ -151,17 +154,13 @@ function get_group_ancestors($group_id, $groups) { return $group_id; } - if ($parent == 0) { - return 0; - } - $r = get_group_ancestors($parent, $groups); if (is_array($r)) { - $r = array_merge(array($parent), $r); + $r = array_merge(array($group_id), $r); } else { - $r = array($parent, $r); + $r = array($group_id, $r); } return $r; @@ -300,8 +299,7 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup } foreach ($groups as $group) { - $parents = get_group_ancestors($group["id_grupo"],$groups); - + $parents = get_group_ancestors($group["parent"],$groups); if (is_array($parents)) { foreach ($parents as $parent) { if ( (isset($forest_acl[$parent])) && ($groups[$parent]["propagate"] == 1)) { @@ -325,7 +323,6 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup } } } - // Update the group cache. $group_cache[$id_user] = $forest_acl; } @@ -403,13 +400,13 @@ function old_users_get_groups ($id_user = false, $privilege = "AR", $returnAllGr // Admin. if (is_user_admin($id_user)) { $groups = db_get_all_rows_sql ("SELECT * FROM tgrupo ORDER BY nombre"); - } + } // Per-group permissions. else { $query = sprintf("SELECT tgrupo.*, tperfil.*, tusuario_perfil.tags FROM tgrupo, tusuario_perfil, tperfil WHERE (tgrupo.id_grupo = tusuario_perfil.id_grupo OR tusuario_perfil.id_grupo = 0) AND tusuario_perfil.id_perfil = tperfil.id_perfil - AND tusuario_perfil.id_usuario = '%s' ORDER BY nombre", $id_user); + AND tusuario_perfil.id_usuario = '%s' ORDER BY tgrupo.nombre", $id_user); $groups = db_get_all_rows_sql ($query); // Get children groups. diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 1efe60b615..fbb0327986 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -112,6 +112,9 @@ function visual_map_print_item($mode = "read", $layoutData, $fill_color = $layoutData['fill_color']; $label_position = $layoutData['label_position']; $show_on_top = $layoutData['show_on_top']; + $clock_animation = $layoutData['clock_animation']; + $time_format = $layoutData['time_format']; + $timezone = $layoutData['timezone']; if($show_on_top){ $show_on_top_index = 10; @@ -154,6 +157,35 @@ function visual_map_print_item($mode = "read", $layoutData, else { $tableheight0 = $height; } + + if ($layoutData['width'] == 0){ + switch($type) { + case 19: + if($layoutData['clock_animation'] == 'analogic_1'){ + $himg = '200'; + $wimg ='200'; + } + else{ + $himg = '60'; + $wimg ='200'; + } + break; + } + } + else{ + switch($type) { + case 19: + if($layoutData['clock_animation'] == 'analogic_1'){ + $himg = $width; + $wimg = $width; + } + else{ + $himg = $width/3.9; + $wimg = $width; + } + break; + } + } if ($layoutData['width'] == 0 || $layoutData['height'] == 0) { switch($type) { @@ -1426,6 +1458,125 @@ function visual_map_print_item($mode = "read", $layoutData, case BOX_ITEM: $z_index = 1; break; + case CLOCK: + if ((get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap')) { + if($width == 0){ + if ($layoutData['id_metaconsole'] != 0) { + if($layoutData['clock_animation'] == 'analogic_1'){ + $img = ''; + } + else{ + + if($layoutData['time_format'] = 'time'){ + $img = ''; + } + else{ + $img = ''; + } + } + } + else{ + if($layoutData['clock_animation'] == 'analogic_1'){ + $img = ''; + } + else{ + + if($layoutData['time_format'] == 'time'){ + $img = ''; + } + else{ + $img = ''; + } + } + } + } + else{ + if ($layoutData['id_metaconsole'] != 0) { + + if($layoutData['clock_animation'] == 'analogic_1'){ + $img = ''; + } + else{ + + if($layoutData['time_format'] == 'time'){ + $img = ''; + } + else{ + $img = ''; + } + + } + + } + else{ + if($layoutData['clock_animation'] == 'analogic_1'){ + $img = ''; + } + else{ + if($layoutData['time_format'] == 'time'){ + $img = ''; + } + else{ + $img = ''; + } + } + } + } + } + else{ + if($layoutData['clock_animation'] == 'analogic_1'){ + + if ($width == 0) { + if ($layoutData['label_position']=='left') { + $img = '
' .print_clock_analogic_1 ($layoutData['time_format'], $layoutData['timezone'],$layoutData['clock_animation'],$layoutData['width'],$layoutData['height'],$layoutData['id'],$layoutData['fill_color']).'
'; + } + elseif ($layoutData['label_position']=='right') { + $img = '
' . print_clock_analogic_1 ($layoutData['time_format'], $layoutData['timezone'],$layoutData['clock_animation'],$layoutData['width'],$layoutData['height'],$layoutData['id'],$layoutData['fill_color']).'
'; + } + else { + $img = '
' . print_clock_analogic_1 ($layoutData['time_format'], $layoutData['timezone'],$layoutData['clock_animation'],$layoutData['width'],$layoutData['height'],$layoutData['id'],$layoutData['fill_color']).'
'; + } + } + else{ + if ($layoutData['label_position']=='left') { + $img = '
' . print_clock_analogic_1 ($layoutData['time_format'], $layoutData['timezone'],$layoutData['clock_animation'],$layoutData['width'],$layoutData['height'],$layoutData['id'],$layoutData['fill_color']).'
'; + } + elseif ($layoutData['label_position']=='right') { + $img = '
' .print_clock_analogic_1 ($layoutData['time_format'], $layoutData['timezone'],$layoutData['clock_animation'],$layoutData['width'],$layoutData['height'],$layoutData['id'],$layoutData['fill_color']).'
'; + } + else { + $img ='
' . print_clock_analogic_1 ($layoutData['time_format'], $layoutData['timezone'],$layoutData['clock_animation'],$layoutData['width'],$layoutData['height'],$layoutData['id'],$layoutData['fill_color']).'
'; + } + } + + } + elseif($layoutData['clock_animation'] == 'digital_1'){ + + if ($width == 0) { + if ($layoutData['label_position']=='left') { + $img = '
' .print_clock_digital_1 ($layoutData['time_format'], $layoutData['timezone'],$layoutData['clock_animation'],$layoutData['width'],$layoutData['height'],$layoutData['id'],$layoutData['fill_color']).'
'; + } + elseif ($layoutData['label_position']=='right') { + $img = '
' . print_clock_digital_1 ($layoutData['time_format'], $layoutData['timezone'],$layoutData['clock_animation'],$layoutData['width'],$layoutData['height'],$layoutData['id'],$layoutData['fill_color']).'
'; + } + else { + $img = '
' . print_clock_digital_1 ($layoutData['time_format'], $layoutData['timezone'],$layoutData['clock_animation'],$layoutData['width'],$layoutData['height'],$layoutData['id'],$layoutData['fill_color']).'
'; + } + } + else{ + if ($layoutData['label_position']=='left') { + $img = '
' . print_clock_digital_1 ($layoutData['time_format'], $layoutData['timezone'],$layoutData['clock_animation'],$layoutData['width'],$layoutData['height'],$layoutData['id'],$layoutData['fill_color']).'
'; + } + elseif ($layoutData['label_position']=='right') { + $img = '
' .print_clock_digital_1 ($layoutData['time_format'], $layoutData['timezone'],$layoutData['clock_animation'],$layoutData['width'],$layoutData['height'],$layoutData['id'],$layoutData['fill_color']).'
'; + } + else { + $img ='
' . print_clock_digital_1 ($layoutData['time_format'], $layoutData['timezone'],$layoutData['clock_animation'],$layoutData['width'],$layoutData['height'],$layoutData['id'],$layoutData['fill_color']).'
'; + } + } + } + } + break; case AUTO_SLA_GRAPH: if ((get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap')) { if($width == 0 || $height == 0){ @@ -1517,6 +1668,9 @@ function visual_map_print_item($mode = "read", $layoutData, case ICON: $class .= "icon"; break; + case CLOCK: + $class .= "clock"; + break; case BOX_ITEM: $class .= "box_item"; break; @@ -1585,6 +1739,68 @@ function visual_map_print_item($mode = "read", $layoutData, case STATIC_GRAPH: case GROUP_ITEM: + + if (! defined ('METACONSOLE')) { + } + else { + // For each server defined and not disabled: + $servers = db_get_all_rows_sql ('SELECT * + FROM tmetaconsole_setup + WHERE disabled = 0'); + if ($servers === false) + $servers = array(); + + $result = array(); + $count_modules = 0; + foreach ($servers as $server) { + // If connection was good then retrieve all data server + if (metaconsole_connect($server) == NOERR) + $connection = true; + else + $connection = false; + + $result_server = db_get_all_rows_sql ($sql); + + if (!empty($result_server)) { + + // Create HASH login info + $pwd = $server['auth_token']; + $auth_serialized = json_decode($pwd,true); + + if (is_array($auth_serialized)) { + $pwd = $auth_serialized['auth_token']; + $api_password = $auth_serialized['api_password']; + $console_user = $auth_serialized['console_user']; + $console_password = $auth_serialized['console_password']; + } + + $user = $config['id_user']; + $user_rot13 = str_rot13($config['id_user']); + $hashdata = $user.$pwd; + $hashdata = md5($hashdata); + $url_hash = '&' . + 'loginhash=auto&' . + 'loginhash_data=' . $hashdata . '&' . + 'loginhash_user=' . $user_rot13; + + foreach ($result_server as $result_element_key => $result_element_value) { + + $result_server[$result_element_key]['server_id'] = $server['id']; + $result_server[$result_element_key]['server_name'] = $server['server_name']; + $result_server[$result_element_key]['server_url'] = $server['server_url'].'/'; + $result_server[$result_element_key]['hashdata'] = $hashdata; + $result_server[$result_element_key]['user'] = $config['id_user']; + + $count_modules++; + + } + + $result = array_merge($result, $result_server); + } + + } + } + if (($layoutData['image'] != null && $layoutData['image'] != 'none') || $layoutData['show_statistics'] == 1) { @@ -1608,7 +1824,7 @@ function visual_map_print_item($mode = "read", $layoutData, if (!modules_is_boolean($layoutData['id_agente_modulo'])) { $img_style_title .= "
" . __("Last value: ") - . remove_right_zeros(number_format($value, $config['graph_precision'])); + . remove_right_zeros(number_format($value, $config['graph_precision'])).$unit_text; } } @@ -1781,6 +1997,13 @@ function visual_map_print_item($mode = "read", $layoutData, echo io_safe_output($text); } + if (! defined ('METACONSOLE')) { + } + else { + metaconsole_restore_db(); + } + + break; case PERCENTILE_BAR: @@ -1958,6 +2181,19 @@ function visual_map_print_item($mode = "read", $layoutData, echo $img; + if ($layoutData['label_position']=='down') { + echo io_safe_output($text); + } + elseif($layoutData['label_position']=='left' || $layoutData['label_position']=='right') { + echo io_safe_output($text); + } + break; + case CLOCK: + if ($layoutData['label_position']=='up') { + echo io_safe_output($text); + } + echo $img; + if ($layoutData['label_position']=='down') { echo io_safe_output($text); } @@ -3390,18 +3626,24 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter if ($returnAllGroup) { $groups = users_get_groups ($id_user, 'VR', true, true); } else { - if(!empty($filter['group'])) { - $permissions_group = users_get_groups ($id_user, 'VR', false, true); - if(empty($permissions_group)){ - $permissions_group = users_get_groups ($id_user, 'VM', false, true); - } - $groups = array_intersect_key($filter['group'], $permissions_group); - } else { - $groups = users_get_groups ($id_user, 'VR', false, true); - if(empty($groups)) { - $groups = users_get_groups ($id_user, 'VM', false, true); + if(users_is_admin($id_user)){ + $groups = users_get_groups ($id_user, 'VR', true, true); + } + else{ + if(!empty($filter['group'])) { + $permissions_group = users_get_groups ($id_user, 'VR', false, true); + if(empty($permissions_group)){ + $permissions_group = users_get_groups ($id_user, 'VM', false, true); + } + $groups = array_intersect_key($filter['group'], $permissions_group); + } else { + $groups = users_get_groups ($id_user, 'VR', false, true); + if(empty($groups)) { + $groups = users_get_groups ($id_user, 'VM', false, true); + } } } + unset($filter['group']); } @@ -3422,7 +3664,6 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter } $layouts = db_get_all_rows_filter ('tlayout', $where); - if ($layouts == false) return array (); @@ -3662,6 +3903,10 @@ function visual_map_create_internal_name_item($label = null, $type, $image, $age case MODULE_GRAPH: $text = __('Module graph'); break; + case 'clock': + case CLOCK: + $text = __('Clock'); + break; case 'bars_graph': case BARS_GRAPH: $text = __('Bars graph'); @@ -3810,6 +4055,9 @@ function visual_map_type_in_js($type) { case ICON: return 'icon'; break; + case CLOCK: + return 'clock'; + break; case SIMPLE_VALUE_MAX: return 'simple_value'; break; diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index c19dad87df..c9e8074dc1 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -59,6 +59,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { a text to replace '(_VALUE_)' and the value of the module will be printed at the end."), true), 'label' => __('Label'), 'icon' => __('Icon'), + 'clock' => __('Clock'), 'group_item' => __('Group'), 'box_item' => __('Box'), 'line_item' => __('Line')); @@ -136,11 +137,11 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['fill_color_row'] = array(); - $form_items['fill_color_row']['items'] = array('datos', 'box_item'); + $form_items['fill_color_row']['items'] = array('datos', 'box_item','clock'); $form_items['fill_color_row']['html'] = '' . __('Fill color') . '' . '' . - html_print_input_text_extended ('fill_color', '#ffffff', + html_print_input_text_extended ('fill_color', '#000000', 'text-fill_color', '', 7, 7, false, '', 'class="fill_color"', true) . ''; @@ -162,7 +163,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { 'datos', 'group_item', 'auto_sla_graph', - 'bars_graph'); + 'bars_graph', + 'clock'); $form_items['label_row']['html'] = '' . __('Label') . ' @@ -203,6 +205,45 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { ' . html_print_select ($images_list, 'image', '', 'showPreview(this.value);', 'None', 'none', true) . ''; + + $form_items['clock_animation_row'] = array(); + $form_items['clock_animation_row']['items'] = array('clock'); + $form_items['clock_animation_row']['html'] = '' . + __('Clock animation') . ' + '. html_print_select ( + array ('analogic_1' => __('Simple analogic'), + 'digital_1' => __('Simple digital')), + 'clock_animation', '', '', 0, 'analogic_1', true, false, false) . ''; + + $form_items['timeformat_row'] = array(); + $form_items['timeformat_row']['items'] = array('clock'); + $form_items['timeformat_row']['html'] = '' . + __('Time format') . ' + '. html_print_select ( + array ('time' => __('Only time'), + 'timedate' => __('Time and date')), + 'time_format', '', '', 0, 'time', true, false, false) . ''; + + $zone_name = array('Africa' => __('Africa'), 'America' => __('America'), 'Antarctica' => __('Antarctica'), 'Arctic' => __('Arctic'), 'Asia' => __('Asia'), 'Atlantic' => __('Atlantic'), 'Australia' => __('Australia'), 'Europe' => __('Europe'), 'Indian' => __('Indian'), 'Pacific' => __('Pacific'), 'UTC' => __('UTC')); + $zone_selected = 'Europe'; + + $timezones = timezone_identifiers_list(); + foreach ($timezones as $timezone) { + if (strpos($timezone, $zone_selected) !== false) { + $timezone_n[$timezone] = $timezone; + } + } + + + $form_items['timezone_row'] = array(); + $form_items['timezone_row']['items'] = array('clock'); + $form_items['timezone_row']['html'] = '' . + __('Time zone') . ' + '. + html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone();', '', '', true). + "  ". html_print_select($timezone_n, 'timezone','', '', '', '', true). + ''; + $form_items['enable_link_row'] = array(); @@ -454,7 +495,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['percentile_bar_row_1'] = array(); - $form_items['percentile_bar_row_1']['items'] = array('percentile_bar', 'percentile_item', 'datos', 'donut_graph', 'bars_graph'); + $form_items['percentile_bar_row_1']['items'] = array('percentile_bar', 'percentile_item', 'datos', 'donut_graph', 'bars_graph','clock'); $form_items['percentile_bar_row_1']['html'] = '' . __('Width') . ' ' . html_print_input_text('width_percentile', 0, '', 3, 5, true) . ''; @@ -613,7 +654,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items_advance['position_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', 'simple_value', 'label', 'icon', 'datos', 'box_item', - 'auto_sla_graph', 'bars_graph'); + 'auto_sla_graph', 'bars_graph','clock'); $form_items_advance['position_row']['html'] = ' ' . __('Position') . ' (' . html_print_input_text('left', '0', '', 3, 5, true) . @@ -788,6 +829,25 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { }); + + function show_timezone () { + zone = $("#zone").val(); + + $.ajax({ + type: "POST", + url: "ajax.php", + data: "page=godmode/setup/setup&select_timezone=1&zone=" + zone, + dataType: "json", + success: function(data) { + $("#timezone").empty(); + jQuery.each (data, function (id, value) { + timezone = value; + var timezone_country = timezone.replace (/^.*\//g, ""); + $("select[name='timezone']").append($("