merge develop

This commit is contained in:
fbsanchez 2020-03-26 14:43:57 +01:00
commit 452f5253e2
225 changed files with 25772 additions and 1872 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.744-200310 Version: 7.0NG.744-200326
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.744-200310" pandora_version="7.0NG.744-200326"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -55,7 +55,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.744'; use constant AGENT_VERSION => '7.0NG.744';
use constant AGENT_BUILD => '200310'; use constant AGENT_BUILD => '200326';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.744 %define version 7.0NG.744
%define release 200310 %define release 200326
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.744 %define version 7.0NG.744
%define release 200310 %define release 200326
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.744" PI_VERSION="7.0NG.744"
PI_BUILD="200310" PI_BUILD="200326"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -612,6 +612,12 @@ sub get_steps {
$desc = 'Step unreachable'; $desc = 'Step unreachable';
} }
my $name = $preffix . $host;
if (defined $previous && $name eq $previous) {
next;
}
push @modules, { push @modules, {
name => $preffix . $host, name => $preffix . $host,
type => "generic_data", type => "generic_data",
@ -710,6 +716,12 @@ sub get_steps {
$desc = 'Step unreachable'; $desc = 'Step unreachable';
} }
my $name = $preffix . $host;
if (defined $previous && $name eq $previous) {
next;
}
push @modules, { push @modules, {
name => $preffix . $host, name => $preffix . $host,
type => "generic_data", type => "generic_data",

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{200310} {200326}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.744(Build 200310)") #define PANDORA_VERSION ("7.0NG.744(Build 200326)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.744(Build 200310))" VALUE "ProductVersion", "(7.0NG.744(Build 200326))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.744-200310 Version: 7.0NG.744-200326
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.744-200310" pandora_version="7.0NG.744-200326"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -71,21 +71,8 @@ if (isset($_GET['loginhash'])) {
} }
} }
$public_hash = get_parameter('hash', false);
// Check user. // Check user.
if ($public_hash == false) { check_login();
check_login();
} else {
enterprise_include_once('include/functions_dashboard.php');
if (dashboard_check_public_hash($public_hash) === false) {
db_pandora_audit('Invalid public hash', 'Trying to access public dashboard');
include 'general/noaccess.php';
exit;
}
}
// Enterprise support. // Enterprise support.
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {

View File

@ -2,4 +2,14 @@ START TRANSACTION;
ALTER TABLE tagente_modulo MODIFY COLUMN `custom_string_1` MEDIUMTEXT; ALTER TABLE tagente_modulo MODIFY COLUMN `custom_string_1` MEDIUMTEXT;
ALTER TABLE `twidget_dashboard` ADD COLUMN `position` TEXT NOT NULL default '';
ALTER TABLE `tagente_estado` ADD COLUMN `last_status_change` bigint(20) NOT NULL default '0';
UPDATE `tconfig` SET `value`='policy,agent,data_type,module_name,server_type,interval,status,last_status_change,graph,warn,data,timestamp' WHERE `token` = 'status_monitor_fields';
ALTER TABLE `talert_templates` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
ALTER TABLE `tevent_alert` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
ALTER TABLE `talert_snmp` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
COMMIT; COMMIT;

View File

@ -666,6 +666,7 @@ CREATE TABLE IF NOT EXISTS `tevent_alert` (
ALTER TABLE `tevent_alert` ADD COLUMN `special_days` tinyint(1) default 0; ALTER TABLE `tevent_alert` ADD COLUMN `special_days` tinyint(1) default 0;
ALTER TABLE `tevent_alert` MODIFY COLUMN `time_threshold` int(10) NOT NULL default 86400; ALTER TABLE `tevent_alert` MODIFY COLUMN `time_threshold` int(10) NOT NULL default 86400;
ALTER TABLE `tevent_alert` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `tevent_alert_action` -- Table `tevent_alert_action`
@ -1239,6 +1240,7 @@ ALTER TABLE talert_templates ADD COLUMN `field12_recovery` TEXT NOT NULL DEFAULT
ALTER TABLE talert_templates ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_templates` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `talert_snmp` -- Table `talert_snmp`
@ -1248,6 +1250,7 @@ ALTER TABLE talert_snmp ADD COLUMN `al_field12` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field13` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_snmp ADD COLUMN `al_field13` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field14` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_snmp ADD COLUMN `al_field14` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_snmp ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_snmp` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
ALTER TABLE `talert_snmp` MODIFY COLUMN `al_field11` text NOT NULL, ALTER TABLE `talert_snmp` MODIFY COLUMN `al_field11` text NOT NULL,
MODIFY COLUMN `al_field12` text NOT NULL, MODIFY COLUMN `al_field12` text NOT NULL,
MODIFY COLUMN `al_field13` text NOT NULL, MODIFY COLUMN `al_field13` text NOT NULL,
@ -1284,6 +1287,7 @@ ALTER TABLE `tagente_estado` MODIFY COLUMN `datos` mediumtext NOT NULL,
MODIFY COLUMN `last_known_status` tinyint(4) NULL DEFAULT '0', MODIFY COLUMN `last_known_status` tinyint(4) NULL DEFAULT '0',
MODIFY COLUMN `last_dynamic_update` bigint(20) NOT NULL DEFAULT '0', MODIFY COLUMN `last_dynamic_update` bigint(20) NOT NULL DEFAULT '0',
MODIFY COLUMN `last_unknown_update` bigint(20) NOT NULL DEFAULT '0'; MODIFY COLUMN `last_unknown_update` bigint(20) NOT NULL DEFAULT '0';
ALTER TABLE `tagente_estado` ADD COLUMN `last_status_change` bigint(20) NOT NULL DEFAULT '0';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `talert_actions` -- Table `talert_actions`
@ -1338,13 +1342,13 @@ ALTER TABLE `tmap` MODIFY COLUMN `id_user` varchar(250) NOT NULL DEFAULT '';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); 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 ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 36); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 37);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '744'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '745');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields'; UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password'; DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
@ -1638,7 +1642,8 @@ UPDATE `tmetaconsole_agent` SET tmetaconsole_agent.alias = tmetaconsole_agent.no
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `twidget_dashboard` -- Table `twidget_dashboard`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE twidget_dashboard MODIFY options LONGTEXT NOT NULL default ""; ALTER TABLE `twidget_dashboard` MODIFY `options` LONGTEXT NOT NULL default "";
ALTER TABLE `twidget_dashboard` ADD COLUMN `position` TEXT NOT NULL default "";
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `trecon_task` -- Table `trecon_task`

View File

@ -180,7 +180,7 @@ if ($config['menu_type'] == 'classic') {
break; break;
case 'Dashboard': case 'Dashboard':
$_GET['sec2'] = 'enterprise/dashboard/main_dashboard'; $_GET['sec2'] = 'operation/dashboard/dashboard';
break; break;
case 'Visual console': case 'Visual console':
@ -779,9 +779,7 @@ if ($config['menu_type'] == 'classic') {
} }
} }
$new_dashboard = get_parameter('new_dashboard', 0); if ($_GET['sec2'] == 'operation/dashboard/dashboard' && $new_dashboard) {
if ($_GET['sec2'] == 'enterprise/dashboard/main_dashboard' && $new_dashboard) {
$do_refresh = false; $do_refresh = false;
} }
} }

View File

@ -160,21 +160,21 @@ echo '<div class="login_page">';
echo '<a href="'.$logo_link.'">'; echo '<a href="'.$logo_link.'">';
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
if (!isset($config['custom_logo_login'])) { if (!isset($config['custom_logo_login'])) {
html_print_image('images/custom_logo_login/login_logo.png', false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true); html_print_image(ui_get_full_url('images/custom_logo_login/login_logo.png'), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
} else { } else {
html_print_image('images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true); html_print_image(ui_get_full_url('images/custom_logo_login/'.$config['custom_logo_login']), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
} }
} else if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { } else if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
if (!isset($config['custom_logo_login'])) { if (!isset($config['custom_logo_login'])) {
html_print_image('enterprise/images/custom_logo_login/login_logo_v7.png', false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true); html_print_image(ui_get_full_url('enterprise/images/custom_logo_login/login_logo_v7.png'), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
} else { } else {
html_print_image('enterprise/images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true); html_print_image(ui_get_full_url('enterprise/images/custom_logo_login/'.$config['custom_logo_login']), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
} }
} else { } else {
if (!isset($config['custom_logo_login']) || $config['custom_logo_login'] === 0) { if (empty($config['custom_logo_login']) === true) {
html_print_image('images/custom_logo_login/pandora_logo.png', false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true); html_print_image(ui_get_full_url('images/custom_logo_login/pandora_logo.png'), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
} else { } else {
html_print_image('images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true); html_print_image(ui_get_full_url('images/custom_logo_login/').$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
} }
// I comment this in case in the future we put a logo without text. // I comment this in case in the future we put a logo without text.

View File

@ -181,7 +181,7 @@ function open_submenus () {
if (value) if (value)
$('div.menu>ul>li#' + index + '>ul').show(); $('div.menu>ul>li#' + index + '>ul').show();
}); });
$('div.menu>ul>li.selected>ul').removeClass('invisible'); //$('div.menu>ul>li.selected>ul').removeClass('invisible');
} }
function close_submenus () { function close_submenus () {
@ -189,7 +189,7 @@ function close_submenus () {
if (value) if (value)
$('div.menu>ul>li#' + index + '>ul').hide(); $('div.menu>ul>li#' + index + '>ul').hide();
}); });
$('div.menu>ul>li.selected>ul').addClass('invisible'); //$('div.menu>ul>li.selected>ul').addClass('invisible');
} }

View File

@ -227,7 +227,9 @@ if (!$new_agent && $alias != '') {
$agent_options_update = 'agent_options_update'; $agent_options_update = 'agent_options_update';
// Delete link from here. // Delete link from here.
$table_agent_name .= "<a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=".$id_agente."&search=&offset=0&sort_field=&sort=none'>".html_print_image('images/cross.png', true, ['title' => __('Delete agent')]).'</a>'; if (!is_central_policies_on_node()) {
$table_agent_name .= "<a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=".$id_agente."&search=&offset=0&sort_field=&sort=none'>".html_print_image('images/cross.png', true, ['title' => __('Delete agent')]).'</a>';
}
// Remote configuration available. // Remote configuration available.
if (isset($filename)) { if (isset($filename)) {

View File

@ -62,6 +62,10 @@ $onheader = ['view' => $viewtab];
// Header. // Header.
ui_print_page_header(__('Agents defined in %s', get_product_name()), 'images/agent_mc.png', false, '', true, $onheader); ui_print_page_header(__('Agents defined in %s', get_product_name()), 'images/agent_mc.png', false, '', true, $onheader);
if (is_central_policies_on_node()) {
ui_print_warning_message(__('This node is configured with centralized mode. To delete an agent go to metaconsole.'));
}
// Perform actions. // Perform actions.
$agent_to_delete = (int) get_parameter('borrar_agente'); $agent_to_delete = (int) get_parameter('borrar_agente');
$enable_agent = (int) get_parameter('enable_agent'); $enable_agent = (int) get_parameter('enable_agent');
@ -694,7 +698,7 @@ if ($agents !== false) {
echo html_print_image('images/lightbulb.png', true, ['alt' => __('Disable agent'), 'title' => __('Disable agent')]).'</a>'; echo html_print_image('images/lightbulb.png', true, ['alt' => __('Disable agent'), 'title' => __('Disable agent')]).'</a>';
} }
if ($check_aw) { if ($check_aw && !is_central_policies_on_node()) {
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente& echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
borrar_agente=".$agent['id_agente']."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'"; borrar_agente=".$agent['id_agente']."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";

View File

@ -517,7 +517,7 @@ $table_advanced->style = [];
$table_advanced->style[0] = $table_advanced->style[3] = $table_advanced->style[5] = 'font-weight: bold;'; $table_advanced->style[0] = $table_advanced->style[3] = $table_advanced->style[5] = 'font-weight: bold;';
$table_advanced->colspan = []; $table_advanced->colspan = [];
$table_advanced->colspan[17][1] = 3; $table_advanced->colspan[5][1] = 3;
$table_advanced->data[0][0] = __('Custom ID'); $table_advanced->data[0][0] = __('Custom ID');
$table_advanced->colspan[0][1] = 2; $table_advanced->colspan[0][1] = 2;
@ -612,7 +612,59 @@ $table_advanced->data[2][3] = __('Max. Value');
$table_advanced->data[2][4] = html_print_input_text('max', $max, '', 5, 15, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).' '.ui_print_help_tip(__('Any value over this number is discarted.'), true); $table_advanced->data[2][4] = html_print_input_text('max', $max, '', 5, 15, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).' '.ui_print_help_tip(__('Any value over this number is discarted.'), true);
$table_advanced->colspan[2][4] = 3; $table_advanced->colspan[2][4] = 3;
$table_advanced->data[3][0] = __('Export target');
$table_advanced->data[3][0] = __('Dynamic Threshold Interval');
$table_advanced->data[3][1] = html_print_extended_select_for_time(
'dynamic_interval',
$dynamic_interval,
'',
'None',
'0',
10,
true,
'width:150px',
false,
$classdisabledBecauseInPolicy,
$disabledBecauseInPolicy
);
$table_advanced->data[3][1] .= '<a onclick=advanced_option_dynamic()>'.html_print_image('images/cog.png', true, ['title' => __('Advanced options Dynamic Threshold')]).'</a>';
$table_advanced->cellclass[3][2] = 'hide_dinamic';
$table_advanced->cellclass[3][3] = 'hide_dinamic';
$table_advanced->data[3][2] = '<span><em>'.__('Dynamic Threshold Min. ').'</em>';
$table_advanced->data[3][2] .= html_print_input_text(
'dynamic_min',
$dynamic_min,
'',
10,
255,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
);
$table_advanced->data[3][2] .= '<br /><em>'.__('Dynamic Threshold Max. ').'</em>';
$table_advanced->data[3][2] .= html_print_input_text(
'dynamic_max',
$dynamic_max,
'',
10,
255,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
);
$table_advanced->data[3][3] = '<span><em>'.__('Dynamic Threshold Two Tailed: ').'</em>';
$table_advanced->data[3][3] .= html_print_checkbox('dynamic_two_tailed', 1, $dynamic_two_tailed, true, $disabledBecauseInPolicy);
$table_advanced->data[4][0] = __('Export target');
// Default text message for export target select and disabled option // Default text message for export target select and disabled option
$none_text = __('None'); $none_text = __('None');
$disabled_export = false; $disabled_export = false;
@ -622,7 +674,7 @@ if ($__code_from == 'policies') {
$disabled_export = true; $disabled_export = true;
} }
$table_advanced->data[3][1] = html_print_select_from_sql( $table_advanced->data[4][1] = html_print_select_from_sql(
'SELECT id, name FROM tserver_export ORDER BY name', 'SELECT id, name FROM tserver_export ORDER BY name',
'id_export', 'id_export',
$id_export, $id_export,
@ -634,7 +686,7 @@ $table_advanced->data[3][1] = html_print_select_from_sql(
false, false,
$disabled_export $disabled_export
).ui_print_help_tip(__('In case you use an Export server you can link this module and export data to one these.'), true); ).ui_print_help_tip(__('In case you use an Export server you can link this module and export data to one these.'), true);
$table_advanced->colspan[3][1] = 2; $table_advanced->colspan[4][1] = 2;
// Code comes from module_editor // Code comes from module_editor
if ($__code_from == 'modules') { if ($__code_from == 'modules') {
@ -645,18 +697,105 @@ if ($__code_from == 'modules') {
$throw_unknown_events_check = policy_module_is_disable_type_event($__id_pol_mod, EVENTS_GOING_UNKNOWN); $throw_unknown_events_check = policy_module_is_disable_type_event($__id_pol_mod, EVENTS_GOING_UNKNOWN);
} }
$table_advanced->data[3][3] = __('Discard unknown events'); $table_advanced->data[4][3] = __('Discard unknown events');
$table_advanced->data[3][4] = html_print_checkbox( $table_advanced->data[4][4] = html_print_checkbox(
'throw_unknown_events', 'throw_unknown_events',
1, 1,
$throw_unknown_events_check, $throw_unknown_events_check,
true, true,
$disabledBecauseInPolicy $disabledBecauseInPolicy
); );
$table_advanced->colspan[3][4] = 3; $table_advanced->colspan[4][4] = 3;
$table_advanced->data[4][0] = __('FF interval');
$table_advanced->data[4][1] = html_print_input_text( // FF stands for Flip-flop.
$table_advanced->data[5][0] = __('FF threshold').' ';
$table_advanced->data[5][1] .= __('Keep counters');
$table_advanced->data[5][1] .= html_print_checkbox(
'ff_type',
1,
$ff_type,
true,
$disabledBecauseInPolicy
).'<br />';
$table_advanced->data[5][1] .= html_print_radio_button(
'each_ff',
0,
'',
$each_ff,
true,
$disabledBecauseInPolicy
);
$table_advanced->data[5][1] .= ' '.__('All state changing').' : ';
$table_advanced->data[5][1] .= html_print_input_text(
'ff_event',
$ff_event,
'',
5,
15,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
).'<br />';
$table_advanced->data[5][1] .= html_print_radio_button(
'each_ff',
1,
'',
$each_ff,
true,
$disabledBecauseInPolicy
);
$table_advanced->data[5][1] .= ' '.__('Each state changing').' : ';
$table_advanced->data[5][1] .= __('To normal');
$table_advanced->data[5][1] .= html_print_input_text(
'ff_event_normal',
$ff_event_normal,
'',
5,
15,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
).' ';
$table_advanced->data[5][1] .= __('To warning');
$table_advanced->data[5][1] .= html_print_input_text(
'ff_event_warning',
$ff_event_warning,
'',
5,
15,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
).' ';
$table_advanced->data[5][1] .= __('To critical');
$table_advanced->data[5][1] .= html_print_input_text(
'ff_event_critical',
$ff_event_critical,
'',
5,
15,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
);
$table_advanced->data[6][0] = __('FF interval');
$table_advanced->data[6][1] = html_print_input_text(
'module_ff_interval', 'module_ff_interval',
$ff_interval, $ff_interval,
'', '',
@ -668,14 +807,14 @@ $table_advanced->data[4][1] = html_print_input_text(
'', '',
$classdisabledBecauseInPolicy $classdisabledBecauseInPolicy
).ui_print_help_tip(__('Module execution flip flop time interval (in secs).'), true); ).ui_print_help_tip(__('Module execution flip flop time interval (in secs).'), true);
$table_advanced->colspan[4][1] = 2; $table_advanced->colspan[6][1] = 2;
$table_advanced->data[4][3] = __('FF timeout'); $table_advanced->data[6][3] = __('FF timeout');
$module_type_name = modules_get_type_name($id_module_type); $module_type_name = modules_get_type_name($id_module_type);
$table_advanced->data[4][4] = ''; $table_advanced->data[6][4] = '';
if (preg_match('/async/', $module_type_name) || $edit) { if (preg_match('/async/', $module_type_name) || $edit) {
$table_advanced->data[4][4] .= '<span id="ff_timeout">'.html_print_input_text( $table_advanced->data[6][4] .= '<span id="ff_timeout">'.html_print_input_text(
'ff_timeout', 'ff_timeout',
$ff_timeout, $ff_timeout,
'', '',
@ -687,16 +826,16 @@ if (preg_match('/async/', $module_type_name) || $edit) {
} }
if (!preg_match('/async/', $module_type_name) || $edit) { if (!preg_match('/async/', $module_type_name) || $edit) {
$table_advanced->data[4][4] .= '<span id="ff_timeout_disable">'.__('Disabled').ui_print_help_tip(__('This value can be set only in the async modules.'), true).'</span>'; $table_advanced->data[6][4] .= '<span id="ff_timeout_disable">'.__('Disabled').ui_print_help_tip(__('This value can be set only in the async modules.'), true).'</span>';
} }
$table_advanced->colspan[4][4] = 3; $table_advanced->colspan[6][4] = 3;
/* /*
Tags */ Tags */
// This var comes from module_manager_editor.php or policy_modules.php // This var comes from module_manager_editor.php or policy_modules.php
global $__code_from; global $__code_from;
$table_advanced->data[5][0] = __('Tags available'); $table_advanced->data[7][0] = __('Tags available');
// Code comes from module_editor // Code comes from module_editor
if ($__code_from == 'modules') { if ($__code_from == 'modules') {
$__table_modules = 'ttag_module'; $__table_modules = 'ttag_module';
@ -716,7 +855,7 @@ if ($__code_from == 'modules') {
} }
if (!tags_has_user_acl_tags($config['id_user'])) { if (!tags_has_user_acl_tags($config['id_user'])) {
$table_advanced->data[5][1] = html_print_select_from_sql( $table_advanced->data[7][1] = html_print_select_from_sql(
"SELECT id_tag, name "SELECT id_tag, name
FROM ttag FROM ttag
WHERE id_tag NOT IN ( WHERE id_tag NOT IN (
@ -741,7 +880,7 @@ if (!tags_has_user_acl_tags($config['id_user'])) {
if (!empty($user_tags)) { if (!empty($user_tags)) {
$id_user_tags = array_keys($user_tags); $id_user_tags = array_keys($user_tags);
$table_advanced->data[5][1] = html_print_select_from_sql( $table_advanced->data[7][1] = html_print_select_from_sql(
'SELECT id_tag, name 'SELECT id_tag, name
FROM ttag FROM ttag
WHERE id_tag IN ('.implode(',', $id_user_tags).") AND WHERE id_tag IN ('.implode(',', $id_user_tags).") AND
@ -763,7 +902,7 @@ if (!tags_has_user_acl_tags($config['id_user'])) {
'5' '5'
); );
} else { } else {
$table_advanced->data[5][1] = html_print_select_from_sql( $table_advanced->data[7][1] = html_print_select_from_sql(
"SELECT id_tag, name "SELECT id_tag, name
FROM ttag FROM ttag
WHERE id_tag NOT IN ( WHERE id_tag NOT IN (
@ -786,12 +925,12 @@ if (!tags_has_user_acl_tags($config['id_user'])) {
} }
} }
$table_advanced->data[5][2] = html_print_image('images/darrowright.png', true, ['id' => 'right', 'title' => __('Add tags to module')]); $table_advanced->data[7][2] = html_print_image('images/darrowright.png', true, ['id' => 'right', 'title' => __('Add tags to module')]);
// html_print_input_image ('add', 'images/darrowright.png', 1, '', true, array ('title' => __('Add tags to module'))); // html_print_input_image ('add', 'images/darrowright.png', 1, '', true, array ('title' => __('Add tags to module')));
$table_advanced->data[5][2] .= '<br><br><br><br>'.html_print_image('images/darrowleft.png', true, ['id' => 'left', 'title' => __('Delete tags to module')]); $table_advanced->data[7][2] .= '<br><br><br><br>'.html_print_image('images/darrowleft.png', true, ['id' => 'left', 'title' => __('Delete tags to module')]);
// html_print_input_image ('add', 'images/darrowleft.png', 1, '', true, array ('title' => __('Delete tags to module'))); // html_print_input_image ('add', 'images/darrowleft.png', 1, '', true, array ('title' => __('Delete tags to module')));
$table_advanced->data[5][3] = '<b>'.__('Tags selected').'</b>'; $table_advanced->data[7][3] = '<b>'.__('Tags selected').'</b>';
$table_advanced->data[5][4] = html_print_select_from_sql( $table_advanced->data[7][4] = html_print_select_from_sql(
"SELECT a.id_tag, name "SELECT a.id_tag, name
FROM ttag a, $__table_modules b FROM ttag a, $__table_modules b
WHERE a.id_tag = b.id_tag AND $__id_where = $__id WHERE a.id_tag = b.id_tag AND $__id_where = $__id
@ -811,8 +950,8 @@ $table_advanced->data[5][4] = html_print_select_from_sql(
); );
if ($__code_from == 'modules') { if ($__code_from == 'modules') {
$table_advanced->data[5][5] = '<b>'.__('Tags from policy').'</b>'; $table_advanced->data[7][5] = '<b>'.__('Tags from policy').'</b>';
$table_advanced->data[5][6] = html_print_select_from_sql( $table_advanced->data[7][6] = html_print_select_from_sql(
"SELECT a.id_tag, name "SELECT a.id_tag, name
FROM ttag a, $__table_modules b FROM ttag a, $__table_modules b
WHERE a.id_tag = b.id_tag AND $__id_where = $__id WHERE a.id_tag = b.id_tag AND $__id_where = $__id
@ -832,9 +971,9 @@ if ($__code_from == 'modules') {
); );
} }
$table_advanced->data[6][0] = __('Quiet'); $table_advanced->data[8][0] = __('Quiet');
$table_advanced->data[6][0] .= ui_print_help_tip(__('The module still stores data but the alerts and events will be stop'), true); $table_advanced->data[8][0] .= ui_print_help_tip(__('The module still stores data but the alerts and events will be stop'), true);
$table_advanced->data[6][1] = html_print_checkbox('quiet_module', 1, $quiet_module, true, $disabledBecauseInPolicy); $table_advanced->data[8][1] = html_print_checkbox('quiet_module', 1, $quiet_module, true, $disabledBecauseInPolicy);
$cps_array[-1] = __('Disabled'); $cps_array[-1] = __('Disabled');
if ($cps_module > 0) { if ($cps_module > 0) {
@ -851,17 +990,17 @@ if ($cps_module > 0) {
$cps_array[$cps_inc] = __('Enabled'); $cps_array[$cps_inc] = __('Enabled');
} }
$table_advanced->data[6][2] = ''; $table_advanced->data[8][2] = '';
$table_advanced->data[6][3] = __('Cascade Protection Services'); $table_advanced->data[8][3] = __('Cascade Protection Services');
$table_advanced->data[6][3] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true); $table_advanced->data[8][3] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
$table_advanced->colspan[6][4] = 3; $table_advanced->colspan[8][4] = 3;
$table_advanced->data[6][4] = html_print_select($cps_array, 'cps_module', $cps_module, '', '', 0, true, false, true, '', $disabledBecauseInPolicy); $table_advanced->data[8][4] = html_print_select($cps_array, 'cps_module', $cps_module, '', '', 0, true, false, true, '', $disabledBecauseInPolicy);
$textarea_custom_style = ' style="min-height: 0px;"'; $textarea_custom_style = ' style="min-height: 0px;"';
$table_advanced->data[7][0] = __('Description'); $table_advanced->data[9][0] = __('Description');
$table_advanced->colspan[7][1] = 6; $table_advanced->colspan[9][1] = 6;
$table_advanced->data[7][1] = html_print_textarea( $table_advanced->data[9][1] = html_print_textarea(
'description', 'description',
3, 3,
65, 65,
@ -871,58 +1010,58 @@ $table_advanced->data[7][1] = html_print_textarea(
$largeClassDisabledBecauseInPolicy $largeClassDisabledBecauseInPolicy
); );
$table_advanced->data[8][0] = __('Critical instructions').ui_print_help_tip(__('Instructions when the status is critical'), true); $table_advanced->data[10][0] = __('Critical instructions').ui_print_help_tip(__('Instructions when the status is critical'), true);
$table_advanced->data[8][1] = html_print_textarea('critical_instructions', 3, 65, $critical_instructions, $disabledTextBecauseInPolicy.$textarea_custom_style, true, $largeClassDisabledBecauseInPolicy); $table_advanced->data[10][1] = html_print_textarea('critical_instructions', 3, 65, $critical_instructions, $disabledTextBecauseInPolicy.$textarea_custom_style, true, $largeClassDisabledBecauseInPolicy);
$table_advanced->colspan[8][1] = 6;
$table_advanced->data[9][0] = __('Warning instructions').ui_print_help_tip(__('Instructions when the status is warning'), true);
$table_advanced->data[9][1] = html_print_textarea('warning_instructions', 3, 65, $warning_instructions, $disabledTextBecauseInPolicy.$textarea_custom_style, true, $largeClassDisabledBecauseInPolicy);
$table_advanced->colspan[9][1] = 6;
$table_advanced->data[10][0] = __('Unknown instructions').ui_print_help_tip(__('Instructions when the status is unknown'), true);
$table_advanced->data[10][1] = html_print_textarea('unknown_instructions', 3, 65, $unknown_instructions, $disabledTextBecauseInPolicy.$textarea_custom_style, true, $largeClassDisabledBecauseInPolicy);
$table_advanced->colspan[10][1] = 6; $table_advanced->colspan[10][1] = 6;
$table_advanced->data[11][0] = __('Warning instructions').ui_print_help_tip(__('Instructions when the status is warning'), true);
$table_advanced->data[11][1] = html_print_textarea('warning_instructions', 3, 65, $warning_instructions, $disabledTextBecauseInPolicy.$textarea_custom_style, true, $largeClassDisabledBecauseInPolicy);
$table_advanced->colspan[11][1] = 6;
$table_advanced->data[12][0] = __('Unknown instructions').ui_print_help_tip(__('Instructions when the status is unknown'), true);
$table_advanced->data[12][1] = html_print_textarea('unknown_instructions', 3, 65, $unknown_instructions, $disabledTextBecauseInPolicy.$textarea_custom_style, true, $largeClassDisabledBecauseInPolicy);
$table_advanced->colspan[12][1] = 6;
if (isset($id_agente) && $moduletype == MODULE_DATA) { if (isset($id_agente) && $moduletype == MODULE_DATA) {
$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']]); $has_remote_conf = enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']]);
if ($has_remote_conf) { if ($has_remote_conf) {
$table_advanced->data[11][0] = __('Cron from'); $table_advanced->data[13][0] = __('Cron from');
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy); $table_advanced->data[13][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
$table_advanced->colspan[11][1] = 6; $table_advanced->colspan[13][1] = 6;
$table_advanced->data[12][0] = __('Cron to'); $table_advanced->data[14][0] = __('Cron to');
$table_advanced->data[12][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true); $table_advanced->data[14][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
$table_advanced->colspan[12][1] = 6; $table_advanced->colspan[14][1] = 6;
} else { } else {
$table_advanced->data[11][0] = __('Cron from'); $table_advanced->data[13][0] = __('Cron from');
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true); $table_advanced->data[13][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true);
$table_advanced->colspan[11][1] = 6; $table_advanced->colspan[13][1] = 6;
$table_advanced->data[12][0] = __('Cron to'); $table_advanced->data[14][0] = __('Cron to');
$table_advanced->data[12][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, true, true); $table_advanced->data[14][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, true, true);
$table_advanced->colspan[12][1] = 6; $table_advanced->colspan[14][1] = 6;
} }
} else { } else {
$table_advanced->data[11][0] = __('Cron from'); $table_advanced->data[13][0] = __('Cron from');
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy); $table_advanced->data[13][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
$table_advanced->colspan[11][1] = 6; $table_advanced->colspan[13][1] = 6;
$table_advanced->data[12][0] = __('Cron to'); $table_advanced->data[14][0] = __('Cron to');
$table_advanced->data[12][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true); $table_advanced->data[14][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
$table_advanced->colspan[12][1] = 6; $table_advanced->colspan[14][1] = 6;
} }
$table_advanced->data[13][0] = __('Timeout'); $table_advanced->data[15][0] = __('Timeout');
$table_advanced->data[13][1] = html_print_input_text('max_timeout', $max_timeout, '', 5, 10, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).' '.ui_print_help_tip(__('Seconds that agent will wait for the execution of the module.'), true); $table_advanced->data[15][1] = html_print_input_text('max_timeout', $max_timeout, '', 5, 10, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).' '.ui_print_help_tip(__('Seconds that agent will wait for the execution of the module.'), true);
$table_advanced->data[13][2] = ''; $table_advanced->data[15][2] = '';
$table_advanced->data[13][3] = __('Retries'); $table_advanced->data[15][3] = __('Retries');
$table_advanced->data[13][4] = html_print_input_text('max_retries', $max_retries, '', 5, 10, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).' '.ui_print_help_tip(__('Number of retries that the module will attempt to run.'), true); $table_advanced->data[15][4] = html_print_input_text('max_retries', $max_retries, '', 5, 10, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).' '.ui_print_help_tip(__('Number of retries that the module will attempt to run.'), true);
$table_advanced->colspan[13][4] = 3; $table_advanced->colspan[15][4] = 3;
if (check_acl($config['id_user'], 0, 'PM')) { if (check_acl($config['id_user'], 0, 'PM')) {
$table_advanced->data[14][0] = __('Category'); $table_advanced->data[16][0] = __('Category');
$table_advanced->data[14][1] = html_print_select( $table_advanced->data[16][1] = html_print_select(
categories_get_all_categories('forselect'), categories_get_all_categories('forselect'),
'id_category', 'id_category',
$id_category, $id_category,
@ -935,16 +1074,16 @@ if (check_acl($config['id_user'], 0, 'PM')) {
'', '',
$disabledBecauseInPolicy $disabledBecauseInPolicy
); );
$table_advanced->colspan[14][1] = 6; $table_advanced->colspan[16][1] = 6;
} else { } else {
// Store in a hidden field if is not visible to avoid delete the value // Store in a hidden field if is not visible to avoid delete the value
$table_advanced->data[13][4] .= html_print_input_hidden('id_category', $id_category, true); $table_advanced->data[15][4] .= html_print_input_hidden('id_category', $id_category, true);
} }
if (!$in_policy) { if (!$in_policy) {
// Cannot select the current module to be itself parent. // Cannot select the current module to be itself parent.
$module_parent_filter = ($id_agent_module) ? ['tagente_modulo.id_agente_modulo' => "<>$id_agent_module"] : ''; $module_parent_filter = ($id_agent_module) ? ['tagente_modulo.id_agente_modulo' => "<>$id_agent_module"] : '';
$table_advanced->data[15][0] = __('Module parent'); $table_advanced->data[17][0] = __('Module parent');
$modules_can_be_parent = agents_get_modules( $modules_can_be_parent = agents_get_modules(
$id_agente, $id_agente,
false, false,
@ -954,14 +1093,14 @@ if (!$in_policy) {
if ($parent_module_id != 0 if ($parent_module_id != 0
&& !in_array($parent_module_id, array_keys($modules_can_be_parent)) && !in_array($parent_module_id, array_keys($modules_can_be_parent))
) { ) {
$table_advanced->data[15][1] = db_get_value( $table_advanced->data[17][1] = db_get_value(
'nombre', 'nombre',
'tagente_modulo', 'tagente_modulo',
'id_agente_modulo', 'id_agente_modulo',
$parent_module_id $parent_module_id
); );
} else { } else {
$table_advanced->data[15][1] = html_print_select( $table_advanced->data[17][1] = html_print_select(
$modules_can_be_parent, $modules_can_be_parent,
'parent_module_id', 'parent_module_id',
$parent_module_id, $parent_module_id,
@ -973,142 +1112,6 @@ if (!$in_policy) {
} }
} }
$table_advanced->data[16][0] = __('Dynamic Threshold Interval');
$table_advanced->data[16][1] = html_print_extended_select_for_time(
'dynamic_interval',
$dynamic_interval,
'',
'None',
'0',
10,
true,
'width:150px',
false,
$classdisabledBecauseInPolicy,
$disabledBecauseInPolicy
);
$table_advanced->data[16][1] .= '<a onclick=advanced_option_dynamic()>'.html_print_image('images/cog.png', true, ['title' => __('Advanced options Dynamic Threshold')]).'</a>';
$table_advanced->cellclass[16][2] = 'hide_dinamic';
$table_advanced->cellclass[16][3] = 'hide_dinamic';
$table_advanced->data[16][2] = '<span><em>'.__('Dynamic Threshold Min. ').'</em>';
$table_advanced->data[16][2] .= html_print_input_text(
'dynamic_min',
$dynamic_min,
'',
10,
255,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
);
$table_advanced->data[16][2] .= '<br /><em>'.__('Dynamic Threshold Max. ').'</em>';
$table_advanced->data[16][2] .= html_print_input_text(
'dynamic_max',
$dynamic_max,
'',
10,
255,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
);
$table_advanced->data[16][3] = '<span><em>'.__('Dynamic Threshold Two Tailed: ').'</em>';
$table_advanced->data[16][3] .= html_print_checkbox('dynamic_two_tailed', 1, $dynamic_two_tailed, true, $disabledBecauseInPolicy);
// FF stands for Flip-flop.
$table_advanced->data[17][0] = __('FF threshold').' ';
$table_advanced->data[17][1] .= __('Keep counters');
$table_advanced->data[17][1] .= html_print_checkbox(
'ff_type',
1,
$ff_type,
true,
$disabledBecauseInPolicy
).'<br />';
$table_advanced->data[17][1] .= html_print_radio_button(
'each_ff',
0,
'',
$each_ff,
true,
$disabledBecauseInPolicy
);
$table_advanced->data[17][1] .= ' '.__('All state changing').' : ';
$table_advanced->data[17][1] .= html_print_input_text(
'ff_event',
$ff_event,
'',
5,
15,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
).'<br />';
$table_advanced->data[17][1] .= html_print_radio_button(
'each_ff',
1,
'',
$each_ff,
true,
$disabledBecauseInPolicy
);
$table_advanced->data[17][1] .= ' '.__('Each state changing').' : ';
$table_advanced->data[17][1] .= __('To normal');
$table_advanced->data[17][1] .= html_print_input_text(
'ff_event_normal',
$ff_event_normal,
'',
5,
15,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
).' ';
$table_advanced->data[17][1] .= __('To warning');
$table_advanced->data[17][1] .= html_print_input_text(
'ff_event_warning',
$ff_event_warning,
'',
5,
15,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
).' ';
$table_advanced->data[17][1] .= __('To critical');
$table_advanced->data[17][1] .= html_print_input_text(
'ff_event_critical',
$ff_event_critical,
'',
5,
15,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
);
// Advanced form part // Advanced form part
$table_macros = new stdClass(); $table_macros = new stdClass();

View File

@ -97,6 +97,10 @@ if ($fields_selected[0] != '') {
$result = __('Status'); $result = __('Status');
break; break;
case 'last_status_change':
$result = __('Last status change');
break;
case 'graph': case 'graph':
$result = __('Graph'); $result = __('Graph');
break; break;
@ -112,10 +116,6 @@ if ($fields_selected[0] != '') {
case 'timestamp': case 'timestamp':
$result = __('Timestamp'); $result = __('Timestamp');
break; break;
case 'to_critical':
$result = __('Last status change');
break;
} }
$result_selected[$field_selected] = $result; $result_selected[$field_selected] = $result;
@ -146,11 +146,11 @@ $fields_available['module_name'] = __('Module name');
$fields_available['server_type'] = __('Server type'); $fields_available['server_type'] = __('Server type');
$fields_available['interval'] = __('Interval'); $fields_available['interval'] = __('Interval');
$fields_available['status'] = __('Status'); $fields_available['status'] = __('Status');
$fields_available['last_status_change'] = __('Last status change');
$fields_available['graph'] = __('Graph'); $fields_available['graph'] = __('Graph');
$fields_available['warn'] = __('Warn'); $fields_available['warn'] = __('Warn');
$fields_available['data'] = __('Data'); $fields_available['data'] = __('Data');
$fields_available['timestamp'] = __('Timestamp'); $fields_available['timestamp'] = __('Timestamp');
$fields_available['to_critical'] = __('Last status change');
// remove fields already selected // remove fields already selected
foreach ($fields_available as $key => $available) { foreach ($fields_available as $key => $available) {

View File

@ -175,6 +175,52 @@ if ($delete_action) {
); );
} }
$search_string = (string) get_parameter('search_string', '');
$group = (int) get_parameter('group', 0);
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions';
// Filter table.
$table_filter = new stdClass();
$table_filter->width = '100%';
$table_filter->class = 'databox filters';
$table_filter->style = [];
$table_filter->style[0] = 'font-weight: bold';
$table_filter->style[2] = 'font-weight: bold';
$table_filter->data = [];
$table_filter->data[0][0] = __('Search');
$table_filter->data[0][1] = html_print_input_text(
'search_string',
$search_string,
'',
25,
255,
true
);
$table_filter->data[0][2] = __('Group');
$table_filter->data[0][3] = html_print_select_groups($config['id_user'], 'LM', true, 'group', $group, '', '', 0, true);
$table_filter->data[0][4] = '<div class="action-buttons">';
$table_filter->data[0][4] .= html_print_submit_button(
__('Search'),
'',
false,
'class="sub search"',
true
);
$table_filter->data[0][4] .= '</div>';
$show_table_filter = '<form method="post" action="'.$url.'">';
$show_table_filter .= html_print_table($table_filter, true);
$show_table_filter .= '</form>';
if (is_metaconsole()) {
ui_toggle($show_table_filter, __('Show Options'));
} else {
echo $show_table_filter;
}
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'info_table'; $table->class = 'info_table';
@ -196,10 +242,18 @@ $table->align[2] = 'left';
$table->align[3] = 'left'; $table->align[3] = 'left';
$filter = []; $filter = [];
if (!is_user_admin($config['id_user'])) { if (!is_user_admin($config['id_user']) && $group === 0) {
$filter['talert_actions.id_group'] = array_keys(users_get_groups(false, 'LM')); $filter['talert_actions.id_group'] = array_keys(users_get_groups(false, 'LM'));
} }
if ($group !== 0) {
$filter['talert_actions.id_group'] = $group;
}
if ($search_string !== '') {
$filter['talert_actions.name'] = '%'.$search_string.'%';
}
$actions = db_get_all_rows_filter( $actions = db_get_all_rows_filter(
'talert_actions INNER JOIN talert_commands ON talert_actions.id_alert_command = talert_commands.id', 'talert_actions INNER JOIN talert_commands ON talert_actions.id_alert_command = talert_commands.id',
$filter, $filter,
@ -209,6 +263,12 @@ if ($actions === false) {
$actions = []; $actions = [];
} }
// Pagination.
$total_actions = count($actions);
$offset = (int) get_parameter('offset');
$limit = (int) $config['block_size'];
$actions = array_slice($actions, $offset, $limit);
$rowPair = true; $rowPair = true;
$iterator = 0; $iterator = 0;
foreach ($actions as $action) { foreach ($actions as $action) {
@ -254,8 +314,10 @@ foreach ($actions as $action) {
array_push($table->data, $data); array_push($table->data, $data);
} }
ui_pagination($total_actions, $url);
if (isset($data)) { if (isset($data)) {
html_print_table($table); html_print_table($table);
ui_pagination($total_actions, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]); ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]);
} }

View File

@ -56,7 +56,19 @@ if (is_ajax()) {
// If is setted a description, we change the carriage return by <br> tags // If is setted a description, we change the carriage return by <br> tags
if (isset($command['description'])) { if (isset($command['description'])) {
$command['description'] = io_safe_input(str_replace("\r\n", '<br>', io_safe_output($command['description']))); $command['description'] = str_replace(
[
'<',
'>',
"\r\n",
],
[
'',
'',
'<br>',
],
io_safe_output($command['description'])
);
} }
// Descriptions are stored in json. // Descriptions are stored in json.
@ -431,8 +443,16 @@ foreach ($commands as $command) {
$data['id'] = $command['id']; $data['id'] = $command['id'];
$data['group'] = ui_print_group_icon($command['id_group'], true); $data['group'] = ui_print_group_icon($command['id_group'], true);
$data['description'] = str_replace( $data['description'] = str_replace(
"\r\n", [
'<br>', '<',
'>',
"\r\n",
],
[
'',
'',
'<br>',
],
io_safe_output($command['description']) io_safe_output($command['description'])
); );
$data['action'] = ''; $data['action'] = '';

View File

@ -133,6 +133,16 @@ $sb_list = [];
$sb_list[1] = __('Standby on'); $sb_list[1] = __('Standby on');
$sb_list[0] = __('Standby off'); $sb_list[0] = __('Standby off');
$form_filter .= html_print_select($sb_list, 'standby', $standby, '', __('All'), -1, true); $form_filter .= html_print_select($sb_list, 'standby', $standby, '', __('All'), -1, true);
$form_filter .= '</td>';
$form_filter .= "</td><td style='font-weight: bold;'>".__('Group').'</td><td>';
$own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = false;
} else {
$return_all_group = true;
}
$form_filter .= html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false);
$form_filter .= '</td></tr>'; $form_filter .= '</td></tr>';
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
$form_filter .= '<tr>'; $form_filter .= '<tr>';
@ -214,7 +224,7 @@ $total = agents_get_alerts_simple(
$where, $where,
false, false,
false, false,
false, $ag_group,
true true
); );
@ -375,7 +385,7 @@ switch ($sortField) {
break; break;
} }
$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby; $form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group;
$sort_params = '&sort_field='.$sortField.'&sort='.$sort; $sort_params = '&sort_field='.$sortField.'&sort='.$sort;
if ($id_agente) { if ($id_agente) {
@ -394,7 +404,9 @@ $simple_alerts = agents_get_alerts_simple(
'order' => $order, 'order' => $order,
], ],
$where, $where,
false false,
false,
$ag_group
); );
if (!$id_agente) { if (!$id_agente) {

View File

@ -67,6 +67,7 @@ $searchFlag = get_parameter('search', 0);
$enabledisable = get_parameter('enabledisable', ''); $enabledisable = get_parameter('enabledisable', '');
$standby = get_parameter('standby', ''); $standby = get_parameter('standby', '');
$pure = get_parameter('pure', 0); $pure = get_parameter('pure', 0);
$ag_group = get_parameter('ag_group', 0);
$messageAction = ''; $messageAction = '';
if ($update_alert) { if ($update_alert) {

View File

@ -305,7 +305,7 @@ $(document).ready (function () {
var origicommand_descriptionnal_command; var origicommand_descriptionnal_command;
if (<?php echo (int) $id_command; ?>) { if (<?php echo (int) $id_command; ?>) {
original_command = "<?php echo addslashes(io_safe_output(alerts_get_alert_command_command($id_command))); ?>"; original_command = "<?php echo str_replace("\r\n", '<br>', addslashes(io_safe_output(alerts_get_alert_command_command($id_command)))); ?>";
render_command_preview(original_command); render_command_preview(original_command);
command_description = "<?php echo str_replace("\r\n", '<br>', addslashes(io_safe_output(alerts_get_alert_command_description($id_command)))); ?>"; command_description = "<?php echo str_replace("\r\n", '<br>', addslashes(io_safe_output(alerts_get_alert_command_description($id_command)))); ?>";

View File

@ -290,6 +290,7 @@ function update_template($step)
$max_alerts = (int) get_parameter('max_alerts'); $max_alerts = (int) get_parameter('max_alerts');
$min_alerts = (int) get_parameter('min_alerts'); $min_alerts = (int) get_parameter('min_alerts');
$min_alerts_reset_counter = (int) get_parameter('min_alerts_reset_counter'); $min_alerts_reset_counter = (int) get_parameter('min_alerts_reset_counter');
$disable_event = (int) get_parameter('disable_event');
$type = (string) get_parameter('type'); $type = (string) get_parameter('type');
$value = (string) html_entity_decode(get_parameter('value')); $value = (string) html_entity_decode(get_parameter('value'));
$max = (float) get_parameter('max'); $max = (float) get_parameter('max');
@ -320,6 +321,7 @@ function update_template($step)
'max_value' => $max, 'max_value' => $max,
'min_value' => $min, 'min_value' => $min,
'matches_value' => $matches, 'matches_value' => $matches,
'disable_event' => $disable_event,
]; ];
// Different datetimes format for oracle // Different datetimes format for oracle
@ -532,6 +534,7 @@ if ($id && ! $create_template) {
$max_alerts = $template['max_alerts']; $max_alerts = $template['max_alerts'];
$min_alerts = $template['min_alerts']; $min_alerts = $template['min_alerts'];
$min_alerts_reset_counter = $template['min_alerts_reset_counter']; $min_alerts_reset_counter = $template['min_alerts_reset_counter'];
$disable_event = $template['disable_event'];
$threshold = $template['time_threshold']; $threshold = $template['time_threshold'];
$fields = []; $fields = [];
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
@ -578,8 +581,7 @@ if ($step == 2) {
// Firing conditions and events // Firing conditions and events
$table->colspan = []; $table->colspan = [];
$table->colspan[4][1] = 3; // $table->colspan[4][1] = 1;
$table->data[0][0] = __('Days of week'); $table->data[0][0] = __('Days of week');
$table->data[0][1] = __('Mon'); $table->data[0][1] = __('Mon');
$table->data[0][1] .= html_print_checkbox('monday', 1, $monday, true); $table->data[0][1] .= html_print_checkbox('monday', 1, $monday, true);
@ -653,6 +655,9 @@ if ($step == 2) {
true true
); );
$table->data[4][2] = __('Disable event');
$table->data[4][3] = html_print_checkbox('disable_event', 1, $disable_event, true);
$table->data[5][0] = __('Default action'); $table->data[5][0] = __('Default action');
$usr_groups = implode(',', array_keys(users_get_groups($config['id_user'], 'LM', true))); $usr_groups = implode(',', array_keys(users_get_groups($config['id_user'], 'LM', true)));
switch ($config['dbtype']) { switch ($config['dbtype']) {

View File

@ -443,37 +443,140 @@ if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
$usedGroup = groups_check_used($id_group); $usedGroup = groups_check_used($id_group);
if (!$usedGroup['return']) { if (!$usedGroup['return']) {
$group = db_get_row_filter( $errors_meta = false;
'tgrupo', if (is_metaconsole()) {
['id_grupo' => $id_group] $group_name = groups_get_name($id_group);
); $servers = metaconsole_get_servers();
db_process_sql_update( $error_counter = 0;
'tgrupo', $success_counter = 0;
['parent' => $group['parent']], $success_nodes = [];
['parent' => $id_group] $error_nodes = [];
); // Check if the group can be deleted or not.
foreach ($servers as $server) {
if (metaconsole_connect($server) == NOERR) {
$result_exist_group = db_get_row_filter('tgrupo', ['nombre' => $group_name, 'id_grupo' => $id_group]);
if ($result_exist_group !== false) {
$used_group = groups_check_used($id_group);
// Save the names of the nodes that are empty and can be deleted, and those that cannot.
if (!$used_group['return']) {
$success_nodes[] .= $server['server_name'];
$success_counter++;
} else {
$error_nodes[] .= $server['server_name'];
$error_counter++;
}
}
}
$result = db_process_sql_delete( metaconsole_restore_db();
'tgroup_stat', }
['id_group' => $id_group]
);
$result = db_process_sql_delete( if ($error_counter > 0) {
'tgrupo', ui_print_error_message(
['id_grupo' => $id_group] __('The group %s could not be deleted because it is not empty in the nodes', $group_name).': '.implode(', ', $error_nodes)
); );
$errors_meta = true;
} else {
if ($success_counter > 0) {
$error_deleting_counter = 0;
$success_deleting_counter = 0;
$error_deleting = [];
$success_deleting = [];
$error_connecting_node = [];
// Delete the group in the nodes.
foreach ($servers as $server) {
if (metaconsole_connect($server) == NOERR) {
$group = db_get_row_filter(
'tgrupo',
['id_grupo' => $id_group]
);
db_process_sql_update(
'tgrupo',
['parent' => $group['parent']],
['parent' => $id_group]
);
db_process_sql_delete(
'tgroup_stat',
['id_group' => $id_group]
);
$result = db_process_sql_delete(
'tgrupo',
['id_grupo' => $id_group]
);
if ($result === false) {
$error_deleting[] .= $server['server_name'];
$error_deleting_counter++;
} else {
$success_deleting[] .= $server['server_name'];
$success_deleting_counter++;
}
} else {
$error_deleting_counter++;
$error_connecting_node[] .= $server['server_name'];
}
metaconsole_restore_db();
}
// If the group could not be deleted in any node, do not delete it in meta.
if ($error_deleting_counter > 0) {
$errors_meta = true;
if (!empty($error_connecting_node)) {
ui_print_error_message(__('Error connecting to %s', implode(', ', $error_connecting_node).'. The group has not been deleted in the metaconsole.'));
}
if (!empty($error_deleting)) {
ui_print_error_message(
__('The group has not been deleted in the metaconsole due to an error in the node database').': '.implode(', ', $error_deleting)
);
}
}
if ($success_deleting_counter > 0) {
ui_print_success_message(__('The group %s has been deleted in the nodes', $group_name).': '.implode(', ', $success_deleting));
}
}
}
}
if ($errors_meta === false) {
$group = db_get_row_filter(
'tgrupo',
['id_grupo' => $id_group]
);
db_process_sql_update(
'tgrupo',
['parent' => $group['parent']],
['parent' => $id_group]
);
$result = db_process_sql_delete(
'tgroup_stat',
['id_group' => $id_group]
);
$result = db_process_sql_delete(
'tgrupo',
['id_grupo' => $id_group]
);
if ($result && (!$usedGroup['return'])) {
ui_print_success_message(__('Group successfully deleted'));
} else {
ui_print_error_message(__('There was a problem deleting group'));
}
}
} else { } else {
ui_print_error_message( ui_print_error_message(
sprintf(__('The group is not empty. It is use in %s.'), implode(', ', $usedGroup['tables'])) sprintf(__('The group is not empty. It is use in %s.'), implode(', ', $usedGroup['tables']))
); );
} }
if ($result && (!$usedGroup['return'])) {
ui_print_success_message(__('Group successfully deleted'));
} else {
ui_print_error_message(__('There was a problem deleting group'));
}
} }
@ -636,7 +739,12 @@ if ($tab == 'tree') {
] ]
).'</a>'; ).'</a>';
$confirm_message = __('Are you sure?'); if (is_metaconsole()) {
$confirm_message = __('Are you sure? This group will also be deleted in all the nodes.');
} else {
$confirm_message = __('Are you sure?');
}
if ($group['has_child']) { if ($group['has_child']) {
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group').'. '.$confirm_message; $confirm_message = __('The child groups will be updated to use the parent id of the deleted group').'. '.$confirm_message;
} }

View File

@ -186,11 +186,13 @@ $table->data[2][1] = html_print_select(
echo '<form method="post" id="form_agents" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents">'; echo '<form method="post" id="form_agents" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents">';
html_print_table($table); html_print_table($table);
if (!is_central_policies_on_node()) {
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
html_print_input_hidden('delete', 1);
html_print_submit_button(__('Delete'), 'go', false, 'class="sub delete"');
echo '</div>';
}
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
html_print_input_hidden('delete', 1);
html_print_submit_button(__('Delete'), 'go', false, 'class="sub delete"');
echo '</div>';
echo '</form>'; echo '</form>';
echo '<h3 class="error invisible" id="message"> </h3>'; echo '<h3 class="error invisible" id="message"> </h3>';

View File

@ -101,10 +101,17 @@ function process_manage_delete($id_alert_template, $id_agents, $module_names)
$module_selection_mode = get_parameter('modules_selection_mode'); $module_selection_mode = get_parameter('modules_selection_mode');
$alert_list = db_get_all_rows_filter('talert_template_modules', ['id_alert_template' => $id_alert_template], 'id_agent_module');
foreach ($module_names as $module) { foreach ($module_names as $module) {
foreach ($id_agents as $id_agent) { foreach ($id_agents as $id_agent) {
$module_id = modules_get_agentmodule_id($module, $id_agent); $module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo']; // The module can exist in several of the selected agents, but we have to check if it has an alert.
foreach ($alert_list as $alert) {
if ($alert['id_agent_module'] == $module_id['id_agente_modulo']) {
$modules_id[] = $module_id['id_agente_modulo'];
}
}
} }
} }

View File

@ -305,6 +305,10 @@ echo '</div>';
</script> </script>
<?php <?php
if (is_central_policies_on_node() && $option == 'delete_agents') {
ui_print_warning_message(__('This node is configured with centralized mode. To delete an agent go to metaconsole.'));
}
echo '<br />'; echo '<br />';
echo '<form method="post" id="form_options" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations">'; echo '<form method="post" id="form_options" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations">';
echo '<table border="0"><tr><td>'; echo '<table border="0"><tr><td>';

View File

@ -18,7 +18,7 @@ check_login();
enterprise_hook('open_meta_frame'); enterprise_hook('open_meta_frame');
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access SNMP Group Management' 'Trying to access SNMP Group Management'
@ -283,7 +283,6 @@ html_print_input_hidden('new', 1);
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"'); html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');
echo '</div>'; echo '</div>';
echo '</form>'; echo '</form>';
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
?> ?>

View File

@ -16,7 +16,7 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access SNMO Groups Management' 'Trying to access SNMO Groups Management'

View File

@ -33,7 +33,7 @@ check_login();
enterprise_hook('open_meta_frame'); enterprise_hook('open_meta_frame');
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access Agent Management' 'Trying to access Agent Management'

View File

@ -31,7 +31,7 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access Agent Management' 'Trying to access Agent Management'

View File

@ -14,7 +14,7 @@
global $config; global $config;
require_once $config['homedir'].'/include/graphs/functions_d3.php'; require_once $config['homedir'].'/include/graphs/functions_d3.php';
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access Agent Management' 'Trying to access Agent Management'

View File

@ -31,7 +31,7 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access Agent Management' 'Trying to access Agent Management'

View File

@ -130,7 +130,7 @@ if ($update) {
]; ];
// Save filter args // Save filter args
$values['filter_args'] = netflow_get_filter_arguments($values); $values['filter_args'] = netflow_get_filter_arguments($values, true);
$result = db_process_sql_update('tnetflow_filter', $values, ['id_sg' => $id]); $result = db_process_sql_update('tnetflow_filter', $values, ['id_sg' => $id]);
@ -164,7 +164,7 @@ if ($create) {
]; ];
// Save filter args // Save filter args
$values['filter_args'] = netflow_get_filter_arguments($values); $values['filter_args'] = netflow_get_filter_arguments($values, true);
$id = db_process_sql_insert('tnetflow_filter', $values); $id = db_process_sql_insert('tnetflow_filter', $values);
if ($id === false) { if ($id === false) {

View File

@ -94,7 +94,7 @@ require_once $config['homedir'].'/include/functions_filemanager.php';
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access Plugin Management' 'Trying to access Plugin Management'

View File

@ -170,6 +170,7 @@ if ($save_alert || $modify_alert) {
$trap_type = (int) get_parameter('trap_type', -1); $trap_type = (int) get_parameter('trap_type', -1);
$single_value = (string) get_parameter('single_value'); $single_value = (string) get_parameter('single_value');
$position = (int) get_parameter('position'); $position = (int) get_parameter('position');
$disable_event = (int) get_parameter('disable_event');
$group = (int) get_parameter('group'); $group = (int) get_parameter('group');
if ($time_threshold == -1) { if ($time_threshold == -1) {
@ -245,6 +246,7 @@ if ($save_alert || $modify_alert) {
'trap_type' => $trap_type, 'trap_type' => $trap_type,
'single_value' => $single_value, 'single_value' => $single_value,
'position' => $position, 'position' => $position,
'disable_event' => $disable_event,
'id_group' => $group, 'id_group' => $group,
]; ];
@ -296,8 +298,8 @@ if ($save_alert || $modify_alert) {
order_11 = '%d', order_12 = '%d', order_13 = '%d', order_11 = '%d', order_12 = '%d', order_13 = '%d',
order_14 = '%d', order_15 = '%d', order_16 = '%d', order_14 = '%d', order_15 = '%d', order_16 = '%d',
order_17 = '%d', order_18 = '%d', order_19 = '%d', order_17 = '%d', order_18 = '%d', order_19 = '%d',
order_20 = '%d', trap_type = %d, order_20 = '%d', trap_type = %d, single_value = '%s',
single_value = '%s', position = '%s', id_group ='%s' position = '%s', disable_event = %d, id_group ='%s'
WHERE id_as = %d", WHERE id_as = %d",
$priority, $priority,
$alert_type, $alert_type,
@ -366,6 +368,7 @@ if ($save_alert || $modify_alert) {
$trap_type, $trap_type,
$single_value, $single_value,
$position, $position,
$disable_event,
$group, $group,
$id_as $id_as
); );
@ -460,6 +463,7 @@ if ($update_alert || $duplicate_alert) {
$trap_type = $alert['trap_type']; $trap_type = $alert['trap_type'];
$single_value = $alert['single_value']; $single_value = $alert['single_value'];
$position = $alert['position']; $position = $alert['position'];
$disable_event = $alert['disable_event'];
$group = $alert['id_group']; $group = $alert['id_group'];
} else if ($create_alert) { } else if ($create_alert) {
// Variable init // Variable init
@ -532,6 +536,7 @@ if ($update_alert || $duplicate_alert) {
$trap_type = -1; $trap_type = -1;
$single_value = ''; $single_value = '';
$position = 0; $position = 0;
$disable_event = 0;
$group = 0; $group = 0;
} }
@ -566,7 +571,7 @@ if ($duplicate_alert) {
'.db_escape_key_identifier('_snmp_f18_').', '.db_escape_key_identifier('_snmp_f18_').',
'.db_escape_key_identifier('_snmp_f19_').', '.db_escape_key_identifier('_snmp_f19_').',
'.db_escape_key_identifier('_snmp_f20_').", '.db_escape_key_identifier('_snmp_f20_').",
trap_type, single_value, position, id_group, trap_type, single_value, position, disable_event, id_group,
order_1, order_2, order_3, order_4, order_5, order_6, order_7, order_8, order_1, order_2, order_3, order_4, order_5, order_6, order_7, order_8,
order_9, order_10, order_11, order_12, order_13, order_14, order_15, order_9, order_10, order_11, order_12, order_13, order_14, order_15,
order_16, order_17, order_18, order_19, order_20) order_16, order_17, order_18, order_19, order_20)
@ -574,7 +579,7 @@ if ($duplicate_alert) {
(%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s',
'%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, %d, %d, %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, %d, %d, %d, %d, %d, %d, '%s', '%s', '%s',
'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s',
'%s', '%s', '%s', '%s', %d, '%s', %d, %d, %d, %d, %d, %d, %d, %d, '%s', '%s', '%s', '%s', %d, '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d,
%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
$id_alert, $id_alert,
$al_field1, $al_field1,
@ -627,6 +632,7 @@ if ($duplicate_alert) {
$trap_type, $trap_type,
$single_value, $single_value,
$position, $position,
$disable_event,
$group, $group,
$order_1, $order_1,
$order_2, $order_2,
@ -1080,6 +1086,10 @@ if ($create_alert || $update_alert) {
html_print_input_text('position', $position, '', 3); html_print_input_text('position', $position, '', 3);
echo '</td></tr>'; echo '</td></tr>';
echo '<tr><td class="datos">'.__('Disable event').'</td><td class="datos">';
html_print_checkbox('disable_event', 1, $disable_event, false);
echo '</td></tr>';
echo '</table>'; echo '</table>';
echo "<table style='width:100%'>"; echo "<table style='width:100%'>";

View File

@ -16,6 +16,10 @@ global $config;
check_login(); check_login();
require 'vendor/autoload.php';
use PandoraFMS\Dashboard\Manager;
enterprise_hook('open_meta_frame'); enterprise_hook('open_meta_frame');
require_once $config['homedir'].'/include/functions_profile.php'; require_once $config['homedir'].'/include/functions_profile.php';
@ -31,7 +35,6 @@ if (enterprise_installed() && defined('METACONSOLE')) {
} }
$isFunctionSkins = enterprise_include_once('include/functions_skins.php'); $isFunctionSkins = enterprise_include_once('include/functions_skins.php');
enterprise_include_once('include/functions_dashboard.php');
// Add the columns for the enterprise Pandora edition. // Add the columns for the enterprise Pandora edition.
$enterprise_include = false; $enterprise_include = false;
@ -833,27 +836,27 @@ $values = [
'External link' => __('External link'), 'External link' => __('External link'),
'Other' => __('Other'), 'Other' => __('Other'),
]; ];
if (enterprise_installed() && !is_metaconsole()) { if (!is_metaconsole()) {
$values['Dashboard'] = __('Dashboard'); $values['Dashboard'] = __('Dashboard');
} }
$table->data[12][1] = html_print_select($values, 'section', io_safe_output($user_info['section']), 'show_data_section();', '', -1, true, false, false); $table->data[12][1] = html_print_select($values, 'section', io_safe_output($user_info['section']), 'show_data_section();', '', -1, true, false, false);
if (enterprise_installed()) {
$dashboards = dashboard_get_dashboards();
$dashboards_aux = [];
if ($dashboards === false) {
$dashboards = ['None' => 'None'];
} else {
foreach ($dashboards as $key => $dashboard) {
$dashboards_aux[$dashboard['name']] = $dashboard['name'];
}
}
$table->data[12][1] .= html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true); $dashboards = Manager::getDashboards(-1, -1);
$dashboards_aux = [];
if ($dashboards === false) {
$dashboards = ['None' => 'None'];
} else {
foreach ($dashboards as $key => $dashboard) {
$dashboards_aux[$dashboard['id']] = $dashboard['name'];
}
} }
$table->data[12][1] .= html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true);
$layouts = visual_map_get_user_layouts($config['id_user'], true); $layouts = visual_map_get_user_layouts($config['id_user'], true);
$layouts_aux = []; $layouts_aux = [];
if ($layouts === false) { if ($layouts === false) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -24,6 +24,7 @@ $disable_alert = (bool) get_parameter('disable_alert');
$enable_alert = (bool) get_parameter('enable_alert'); $enable_alert = (bool) get_parameter('enable_alert');
$get_actions_module = (bool) get_parameter('get_actions_module'); $get_actions_module = (bool) get_parameter('get_actions_module');
$show_update_action_menu = (bool) get_parameter('show_update_action_menu'); $show_update_action_menu = (bool) get_parameter('show_update_action_menu');
$get_agent_alerts_agent_view = (bool) get_parameter('get_agent_alerts_agent_view');
if ($get_agent_alerts_simple) { if ($get_agent_alerts_simple) {
$id_agent = (int) get_parameter('id_agent'); $id_agent = (int) get_parameter('id_agent');
@ -75,6 +76,258 @@ if ($get_agent_alerts_simple) {
return; return;
} }
if ($get_agent_alerts_agent_view) {
include_once $config['homedir'].'/include/functions_agents.php';
include_once $config['homedir'].'/operation/agentes/alerts_status.functions.php';
include_once $config['homedir'].'/include/functions_users.php';
$agent_a = check_acl($config['id_user'], 0, 'AR');
$agent_w = check_acl($config['id_user'], 0, 'AW');
$access = ($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR');
$free_search_alert = get_parameter('free_search_alert', '');
$all_groups = json_decode(io_safe_output(get_parameter('all_groups')));
$idAgent = (int) get_parameter('id_agent');
$filter = get_parameter('filter', 'all_enabled');
$url = 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$idAgent;
$sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none');
$selected = true;
$selectModuleUp = false;
$selectModuleDown = false;
$selectTemplateUp = false;
$selectTemplateDown = false;
$selectLastFiredUp = false;
$selectLastFiredDown = false;
switch ($sortField) {
case 'module':
switch ($sort) {
case 'up':
$selectModuleUp = $selected;
$order = [
'field' => 'agent_module_name',
'order' => 'ASC',
];
break;
case 'down':
$selectModuleDown = $selected;
$order = [
'field' => 'agent_module_name',
'order' => 'DESC',
];
break;
}
break;
case 'template':
switch ($sort) {
case 'up':
$selectTemplateUp = $selected;
$order = [
'field' => 'template_name',
'order' => 'ASC',
];
break;
case 'down':
$selectTemplateDown = $selected;
$order = [
'field' => 'template_name',
'order' => 'DESC',
];
break;
}
break;
case 'last_fired':
switch ($sort) {
case 'up':
$selectLastFiredUp = $selected;
$order = [
'field' => 'last_fired',
'order' => 'ASC',
];
break;
case 'down':
$selectLastFiredDown = $selected;
$order = [
'field' => 'last_fired',
'order' => 'DESC',
];
break;
}
break;
default:
$selectDisabledUp = '';
$selectDisabledDown = '';
$selectModuleUp = $selected;
$selectModuleDown = false;
$selectTemplateUp = false;
$selectTemplateDown = false;
$selectLastFiredUp = false;
$selectLastFiredDown = false;
$order = [
'field' => 'agent_module_name',
'order' => 'ASC',
];
break;
}
if ($free_search_alert != '') {
$whereAlertSimple = 'AND ('.'id_alert_template IN (
SELECT id
FROM talert_templates
WHERE name LIKE "%'.$free_search_alert.'%") OR '.'id_alert_template IN (
SELECT id
FROM talert_templates
WHERE id_alert_action IN (
SELECT id
FROM talert_actions
WHERE name LIKE "%'.$free_search_alert.'%")) OR '.'talert_template_modules.id IN (
SELECT id_alert_template_module
FROM talert_template_module_actions
WHERE id_alert_action IN (
SELECT id
FROM talert_actions
WHERE name LIKE "%'.$free_search_alert.'%")) OR '.'id_agent_module IN (
SELECT id_agente_modulo
FROM tagente_modulo
WHERE nombre LIKE "%'.$free_search_alert.'%") OR '.'id_agent_module IN (
SELECT id_agente_modulo
FROM tagente_modulo
WHERE alias LIKE "%'.$free_search_alert.'%")'.')';
} else {
$whereAlertSimple = '';
}
// Add checks for user ACL.
$groups = users_get_groups($config['id_user'], $access);
$id_groups = array_keys($groups);
if (empty($id_groups)) {
$whereAlertSimple .= ' AND (1 = 0) ';
} else {
$whereAlertSimple .= sprintf(
' AND id_agent_module IN (
SELECT tam.id_agente_modulo
FROM tagente_modulo tam
WHERE tam.id_agente IN (SELECT ta.id_agente
FROM tagente ta LEFT JOIN tagent_secondary_group tasg ON
ta.id_agente = tasg.id_agent
WHERE (ta.id_grupo IN (%s) OR tasg.id_group IN (%s)))) ',
implode(',', $id_groups),
implode(',', $id_groups)
);
}
$alerts = [];
$filter_alert = [];
if ($filter_standby == 'standby_on') {
$filter_alert['disabled'] = $filter;
$filter_alert['standby'] = '1';
} else if ($filter_standby == 'standby_off') {
$filter_alert['disabled'] = $filter;
$filter_alert['standby'] = '0';
} else {
$filter_alert['disabled'] = $filter;
}
$options_simple = ['order' => $order];
$alerts['alerts_simple'] = agents_get_alerts_simple($idAgent, $filter_alert, $options_simple, $whereAlertSimple, false, false, false, false, $strict_user, $tag_filter);
$countAlertsSimple = agents_get_alerts_simple($idAgent, $filter_alert, false, $whereAlertSimple, false, false, false, true, $strict_user, $tag_filter);
// Urls to sort the table.
$url_up_module = $url.'&sort_field=module&sort=up';
$url_down_module = $url.'&sort_field=module&sort=down';
$url_up_template = $url.'&sort_field=template&sort=up';
$url_down_template = $url.'&sort_field=template&sort=down';
$url_up_lastfired = $url.'&sort_field=last_fired&sort=up';
$url_down_lastfired = $url.'&sort_field=last_fired&sort=down';
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->cellpadding = '0';
$table->cellspacing = '0';
$table->size = [];
$table->head = [];
$table->align = [];
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->size[7] = '5%';
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW') || check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
$table->head[8] = __('Validate');
$table->align[8] = 'left';
$table->size[8] = '5%';
}
$table->head[0] = "<span title='".__('Policy')."'>".__('P.').'</span>';
$table->head[1] = "<span title='".__('Standby')."'>".__('S.').'</span>';
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') || check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
$table->head[2] = "<span title='".__('Force execution')."'>".__('F.').'</span>';
}
$table->head[3] = __('Module');
$table->head[4] = __('Template');
$table->head[5] = __('Action');
$table->head[6] = __('Last fired');
$table->head[7] = __('Status');
$table->align[7] = 'center';
$table->head[3] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
$table->head[4] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
$table->head[6] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
} else {
$table->size[6] = '5%';
if (check_acl($config['id_user'], $id_group, 'LW') || check_acl($config['id_user'], $id_group, 'LM')) {
$table->head[7] = __('Validate');
$table->align[7] = 'left';
$table->size[7] = '5%';
}
$table->head[0] = "<span title='".__('Standby')."'>".__('S.').'</span>';
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
$table->head[1] = "<span title='".__('Force execution')."'>".__('F.').'</span>';
}
$table->head[2] = __('Module');
$table->head[3] = __('Template');
$table->head[4] = __('Action');
$table->head[5] = __('Last fired');
$table->head[6] = __('Status');
$table->align[6] = 'center';
$table->head[2] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
$table->head[3] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
$table->head[5] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
}
$table->data = [];
$rowPair = true;
$iterator = 0;
foreach ($alerts['alerts_simple'] as $alert) {
$row = ui_format_alert_row($alert, false, $url, 'font-size: 7pt;');
$table->data[] = $row;
}
if (!empty($table->data)) {
html_print_table($table);
} else {
ui_print_info_message(['no_close' => true, 'message' => __('No alerts found') ]);
}
}
if ($enable_alert) { if ($enable_alert) {
if (! check_acl($config['id_user'], 0, 'LW')) { if (! check_acl($config['id_user'], 0, 'LW')) {
db_pandora_audit( db_pandora_audit(

View File

@ -923,7 +923,7 @@ if ($perform_event_response) {
$event_response = db_get_row('tevent_response', 'id', $response_id); $event_response = db_get_row('tevent_response', 'id', $response_id);
$command_timeout = $event_response['command_timeout']; $command_timeout = $event_response !== false ? $event_response['command_timeout'] : 90;
if (enterprise_installed()) { if (enterprise_installed()) {
if ($event_response['server_to_exec'] != 0 && $event_response['type'] == 'command') { if ($event_response['server_to_exec'] != 0 && $event_response['type'] == 'command') {

View File

@ -64,7 +64,6 @@ if ($print_custom_graph) {
'only_image' => (bool) get_parameter('only_image', false), 'only_image' => (bool) get_parameter('only_image', false),
'homeurl' => (string) get_parameter('homeurl', ''), 'homeurl' => (string) get_parameter('homeurl', ''),
'ttl' => (int) get_parameter('ttl', 1), 'ttl' => (int) get_parameter('ttl', 1),
'dashboard' => (bool) get_parameter('dashboard', false),
'vconsole' => (bool) get_parameter('vconsole', false), 'vconsole' => (bool) get_parameter('vconsole', false),
'fullscale' => (bool) get_parameter('fullscale', false), 'fullscale' => (bool) get_parameter('fullscale', false),
'backgroundColor' => (string) get_parameter('background_color', 'white'), 'backgroundColor' => (string) get_parameter('background_color', 'white'),
@ -114,7 +113,6 @@ if ($print_sparse_graph) {
'menu' => (bool) get_parameter('menu', true), 'menu' => (bool) get_parameter('menu', true),
'backgroundColor' => (string) get_parameter('background_color', 'white'), 'backgroundColor' => (string) get_parameter('background_color', 'white'),
'percentil' => get_parameter('percentil', null), 'percentil' => get_parameter('percentil', null),
'dashboard' => (bool) get_parameter('dashboard'),
'vconsole' => (bool) get_parameter('vconsole'), 'vconsole' => (bool) get_parameter('vconsole'),
'type_graph' => get_parameter('type_g', $config['type_module_charts']), 'type_graph' => get_parameter('type_g', $config['type_module_charts']),
'fullscale' => get_parameter('fullscale', 0), 'fullscale' => get_parameter('fullscale', 0),

View File

@ -1028,7 +1028,10 @@ if (check_login()) {
$title $title
); );
$data[5] = ui_print_status_image($status, htmlspecialchars($title), true); $last_status_change_text = 'Time elapsed since last status change: ';
$last_status_change_text .= !empty($module['last_status_change']) ? human_time_comparation($module['last_status_change']) : __('N/A');
$data[5] = ui_print_status_image($status, htmlspecialchars($title), true, false, false, false, $last_status_change_text);
if (!$show_context_help_first_time) { if (!$show_context_help_first_time) {
$show_context_help_first_time = true; $show_context_help_first_time = true;

View File

@ -14,28 +14,8 @@
if (is_ajax()) { if (is_ajax()) {
global $config; global $config;
enterprise_include_once('include/functions_dashboard.php'); // Login check.
check_login();
$public_hash = get_parameter('hash', 0);
// Try to authenticate by hash on public dashboards
if ($public_hash == 0) {
// Login check
check_login();
} else {
$validate_hash = enterprise_hook(
'dasboard_validate_public_hash',
[
$public_hash,
'tree_view',
]
);
if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) {
db_pandora_audit('Invalid public hash', 'Trying to access report builder');
include 'general/noaccess.php';
exit;
}
}
include_once $config['homedir'].'/include/class/Tree.class.php'; include_once $config['homedir'].'/include/class/Tree.class.php';
include_once $config['homedir'].'/include/class/TreeOS.class.php'; include_once $config['homedir'].'/include/class/TreeOS.class.php';
@ -61,10 +41,6 @@ if (is_ajax()) {
$rootID = get_parameter('rootID', -1); $rootID = get_parameter('rootID', -1);
$serverID = get_parameter('serverID', false); $serverID = get_parameter('serverID', false);
$childrenMethod = get_parameter('childrenMethod', 'on_demand'); $childrenMethod = get_parameter('childrenMethod', 'on_demand');
$hash = get_parameter('hash', false);
if ($hash !== false) {
enterprise_hook('dasboard_validate_public_hash', [$hash, 'tree_view']);
}
$default_filters = [ $default_filters = [
'searchAgent' => '', 'searchAgent' => '',

View File

@ -12,32 +12,13 @@
// GNU General Public License for more details. // GNU General Public License for more details.
global $config; global $config;
enterprise_include_once('include/functions_dashboard.php');
require_once 'include/functions_visual_map.php'; require_once 'include/functions_visual_map.php';
enterprise_include_once('include/functions_visual_map.php'); enterprise_include_once('include/functions_visual_map.php');
$public_hash = get_parameter('hash', false);
$id_visual_console = get_parameter('id_visual_console', null); $id_visual_console = get_parameter('id_visual_console', null);
// Try to authenticate by hash on public dashboards // Login check.
if ($public_hash === false) { check_login();
// Login check
check_login();
} else {
$validate_hash = enterprise_hook(
'dasboard_validate_public_hash',
[
$public_hash,
$id_visual_console,
'visual_console',
]
);
if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) {
db_pandora_audit('Invalid public hash', 'Trying to access report builder');
include 'general/noaccess.php';
exit;
}
}
// Fix: IW was the old ACL to check for report editing, now is RW // Fix: IW was the old ACL to check for report editing, now is RW
if (! check_acl($config['id_user'], 0, 'VR')) { if (! check_acl($config['id_user'], 0, 'VR')) {

View File

@ -216,24 +216,7 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
break; break;
case 'vbar': case 'vbar':
echo flot_vcolumn_chart( echo flot_vcolumn_chart($params);
$params['chart_data'],
$params['width'],
$params['height'],
$params['color'],
$params['legend'],
$params['long_index'],
$params['homeurl'],
$params['unit'],
$params['water_mark_url'],
$params['homedir'],
$params['font'],
$config['font_size'],
$params['from_ux'],
$params['from_wux'],
$params['backgroundColor'],
$params['tick_color']
);
break; break;
case 'hbar': case 'hbar':
@ -292,7 +275,7 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
$params['full_legend_daterray'], $params['full_legend_daterray'],
$params['not_interactive'], $params['not_interactive'],
$params['ttl'], $params['ttl'],
$params['widgets'], $params['sizeForTicks'],
$params['show'], $params['show'],
$params['date_to'] $params['date_to']
); );

View File

@ -2676,10 +2676,15 @@ class NetworkMap
$simulate = false; $simulate = false;
if (isset($networkmap['__simulated']) === false) { if (isset($networkmap['__simulated']) === false) {
$networkmap['filter'] = json_decode( if ($this->widget) {
$networkmap['filter'], $networkmap['filter'] = $this->mapOptions;
true } else {
); $networkmap['filter'] = json_decode(
$networkmap['filter'],
true
);
}
$networkmap['filter']['holding_area'] = [ $networkmap['filter']['holding_area'] = [
500, 500,
500, 500,
@ -3460,7 +3465,11 @@ class NetworkMap
// Open networkconsole_id div. // Open networkconsole_id div.
$output .= '<div id="networkconsole_'.$networkmap['id'].'"'; $output .= '<div id="networkconsole_'.$networkmap['id'].'"';
if ($this->fullSize) { if ($this->fullSize) {
$output .= ' style="width: 100%; height: 100%;position: relative; overflow: hidden; background: #FAFAFA">'; if ($this->widget) {
$output .= ' style="width: 100%; height: 100%;position: relative; overflow: hidden;">';
} else {
$output .= ' style="width: 100%; height: 100%;position: relative; overflow: hidden; background: #FAFAFA">';
}
} else { } else {
$output .= ' style="width: '.$this->mapOptions['width'].'px; height: '.$this->mapOptions['height'].'px;position: relative; overflow: hidden; background: #FAFAFA">'; $output .= ' style="width: '.$this->mapOptions['width'].'px; height: '.$this->mapOptions['height'].'px;position: relative; overflow: hidden; background: #FAFAFA">';
} }

View File

@ -221,7 +221,7 @@ class OrderInterpreter extends Wizard
'images/op_reporting.menu_gray.png' 'images/op_reporting.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=reporting&sec2=enterprise/dashboard/dashboards' 'index.php?sec=reporting&sec2=operation/dashboard/dashboard'
), ),
'acl' => check_acl( 'acl' => check_acl(
$config['id_user'], $config['id_user'],

View File

@ -122,6 +122,8 @@ class TreeService extends Tree
{ {
$fields = $this->getFirstLevelFields(); $fields = $this->getFirstLevelFields();
$is_favourite = $this->getServiceFavouriteFilter();
if (users_can_manage_group_all('AR')) { if (users_can_manage_group_all('AR')) {
$groups_acl = ''; $groups_acl = '';
} else { } else {
@ -143,13 +145,15 @@ class TreeService extends Tree
ON ts.id=tse.id_service ON ts.id=tse.id_service
WHERE WHERE
1=1 1=1
%s
%s %s
GROUP BY id GROUP BY id
) as t1 ) as t1
ON tss.id_service_child = t1.id ON tss.id_service_child = t1.id
WHERE tss.id_service_child IS NULL WHERE tss.id_service_child IS NULL
", ",
$groups_acl $groups_acl,
$is_favourite
); );
$stats = db_get_all_rows_sql($sql); $stats = db_get_all_rows_sql($sql);
@ -364,4 +368,14 @@ class TreeService extends Tree
} }
protected function getServiceFavouriteFilter()
{
if (isset($this->filter['is_favourite']) && !empty($this->filter['is_favourite'])) {
return ' AND is_favourite = 1';
}
return '';
}
} }

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC200310'; $build_version = 'PC200326';
$pandora_version = 'v7.0NG.744'; $pandora_version = 'v7.0NG.744';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.
@ -227,7 +227,7 @@ $config['extensions'] = extensions_get_extensions();
// Detect if enterprise extension is installed // Detect if enterprise extension is installed
// NOTICE: This variable (config[enterprise_installed] is used in several // NOTICE: This variable (config[enterprise_installed] is used in several
// sections. Faking or forcing to 1 will make pandora fails. // sections. Faking or forcing to 1 will make pandora fails.
if (file_exists($config['homedir'].'/'.ENTERPRISE_DIR.'/index.php')) { if (file_exists($config['homedir'].'/'.ENTERPRISE_DIR.'/load_enterprise.php')) {
$config['enterprise_installed'] = 1; $config['enterprise_installed'] = 1;
enterprise_include_once('include/functions_enterprise.php'); enterprise_include_once('include/functions_enterprise.php');
} else { } else {

View File

@ -280,6 +280,7 @@ define('STATUS_MODULE_CRITICAL', 'module_critical.png');
define('STATUS_MODULE_WARNING', 'module_warning.png'); define('STATUS_MODULE_WARNING', 'module_warning.png');
define('STATUS_MODULE_NO_DATA', 'module_no_data.png'); define('STATUS_MODULE_NO_DATA', 'module_no_data.png');
define('STATUS_MODULE_UNKNOWN', 'module_unknown.png'); define('STATUS_MODULE_UNKNOWN', 'module_unknown.png');
define('STATUS_MODULE_ALERT_TRIGGERED', 'module_alertsfired.png');
// For agents. // For agents.
define('STATUS_AGENT_CRITICAL', 'agent_critical.png'); define('STATUS_AGENT_CRITICAL', 'agent_critical.png');
define('STATUS_AGENT_WARNING', 'agent_warning.png'); define('STATUS_AGENT_WARNING', 'agent_warning.png');

View File

@ -2482,12 +2482,12 @@ function get_os_name($id_os)
function get_user_dashboards($id_user) function get_user_dashboards($id_user)
{ {
if (users_is_admin($id_user)) { if (users_is_admin($id_user)) {
$sql = "SELECT name $sql = "SELECT id, name
FROM tdashboard WHERE id_user = '".$id_user."' OR id_user = ''"; FROM tdashboard WHERE id_user = '".$id_user."' OR id_user = ''";
} else { } else {
$user_can_manage_all = users_can_manage_group_all('RR'); $user_can_manage_all = users_can_manage_group_all('RR');
if ($user_can_manage_all) { if ($user_can_manage_all) {
$sql = "SELECT name $sql = "SELECT id, name
FROM tdashboard WHERE id_user = '".$id_user."' OR id_user = ''"; FROM tdashboard WHERE id_user = '".$id_user."' OR id_user = ''";
} else { } else {
$user_groups = users_get_groups($id_user, 'RR', false); $user_groups = users_get_groups($id_user, 'RR', false);
@ -2500,7 +2500,7 @@ function get_user_dashboards($id_user)
$u_groups[] = $id; $u_groups[] = $id;
} }
$sql = 'SELECT name $sql = 'SELECT id, name
FROM tdashboard FROM tdashboard
WHERE id_group IN ('.implode(',', $u_groups).") AND (id_user = '".$id_user."' OR id_user = '')"; WHERE id_group IN ('.implode(',', $u_groups).") AND (id_user = '".$id_user."' OR id_user = '')";
} }
@ -3870,12 +3870,17 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined=false
$img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file; $img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file;
} }
$width_img = 550; if ($type_graph_pdf === 'vbar') {
$height_img = $params['height']; $width_img = $params['generals']['pdf']['width'];
$height_img = $params['generals']['pdf']['height'];
} else {
$width_img = 550;
$height_img = $params['height'];
if ((int) $params['landscape'] === 1) { if ((int) $params['landscape'] === 1) {
$height_img = 150; $height_img = 150;
$params['height'] = 150; $params['height'] = 150;
}
} }
$params_encode_json = urlencode(json_encode($params)); $params_encode_json = urlencode(json_encode($params));

View File

@ -295,10 +295,17 @@ function agents_get_alerts_simple($id_agent=false, $filter='', $options=false, $
if (($id_agent !== false) && ($idGroup !== false)) { if (($id_agent !== false) && ($idGroup !== false)) {
if ($idGroup != 0) { if ($idGroup != 0) {
$has_secondary = enterprise_hook('agents_is_using_secondary_groups');
// All group // All group
$subQuery = 'SELECT id_agente_modulo $subQuery = 'SELECT id_agente_modulo
FROM tagente_modulo FROM tagente_modulo
WHERE delete_pending = 0 AND id_agente IN (SELECT id_agente FROM tagente WHERE id_grupo = '.$idGroup.')'; WHERE delete_pending = 0 AND id_agente IN (SELECT id_agente FROM tagente WHERE id_grupo = '.$idGroup;
if ($has_secondary) {
$subQuery .= ' OR tasg.id_group = '.$idGroup;
}
$subQuery .= ')';
} else { } else {
$subQuery = 'SELECT id_agente_modulo $subQuery = 'SELECT id_agente_modulo
FROM tagente_modulo WHERE delete_pending = 0'; FROM tagente_modulo WHERE delete_pending = 0';
@ -337,17 +344,31 @@ function agents_get_alerts_simple($id_agent=false, $filter='', $options=false, $
$selectText = 'COUNT(talert_template_modules.id) AS count'; $selectText = 'COUNT(talert_template_modules.id) AS count';
} }
$secondary_join = '';
if ($idGroup) {
if (isset($has_secondary) && $has_secondary) {
$secondary_join = sprintf(
'LEFT JOIN tagent_secondary_group tasg
ON t3.id_agente = tasg.id_agent
AND tasg.id_group = %d',
$idGroup
);
}
}
$sql = sprintf( $sql = sprintf(
'SELECT %s 'SELECT %s
FROM talert_template_modules FROM talert_template_modules
INNER JOIN tagente_modulo t2 INNER JOIN tagente_modulo t2
ON talert_template_modules.id_agent_module = t2.id_agente_modulo ON talert_template_modules.id_agent_module = t2.id_agente_modulo
INNER JOIN tagente t3 INNER JOIN tagente t3
ON t2.id_agente = t3.id_agente ON t2.id_agente = t3.id_agente
INNER JOIN talert_templates t4 %s
ON talert_template_modules.id_alert_template = t4.id INNER JOIN talert_templates t4
ON talert_template_modules.id_alert_template = t4.id
WHERE id_agent_module in (%s) %s %s %s', WHERE id_agent_module in (%s) %s %s %s',
$selectText, $selectText,
$secondary_join,
$subQuery, $subQuery,
$where, $where,
$filter, $filter,
@ -1057,7 +1078,7 @@ function agents_get_group_agents(
} }
if ($childGroups) { if ($childGroups) {
if (is_array($id_group)) { if (is_array($id_group) === true) {
foreach ($id_group as $parent) { foreach ($id_group as $parent) {
$id_group = array_merge( $id_group = array_merge(
$id_group, $id_group,
@ -1077,7 +1098,7 @@ function agents_get_group_agents(
} }
// Search for primary and secondary groups. // Search for primary and secondary groups.
if (!empty($id_group)) { if (empty($id_group) === false) {
$filter[] = '('.db_format_array_where_clause_sql( $filter[] = '('.db_format_array_where_clause_sql(
[ [
'id_group' => $id_group, 'id_group' => $id_group,
@ -1087,71 +1108,47 @@ function agents_get_group_agents(
).')'; ).')';
} }
if ($search === true) { if (is_array($search) === true) {
// No added search. Show both disabled and non-disabled.
} else if (is_array($search)) {
if (!$search['all_agents']) { if (!$search['all_agents']) {
$filter['disabled'] = 0; $filter['disabled'] = 0;
if (isset($search['disabled'])) { if (isset($search['disabled']) === true) {
$filter['disabled'] = (int) $search['disabled']; $filter['disabled'] = (int) $search['disabled'];
unset($search['disabled']); unset($search['disabled']);
} }
} }
if (isset($search['string'])) { if (isset($search['string']) === true) {
$string = io_safe_input($search['string']); $string = io_safe_input($search['string']);
switch ($config['dbtype']) { $filter[] = "(nombre COLLATE utf8_general_ci LIKE '%$string%' OR direccion LIKE '%$string%')";
case 'mysql':
case 'postgresql':
$filter[] = "(nombre COLLATE utf8_general_ci LIKE '%$string%' OR direccion LIKE '%$string%')";
break;
case 'oracle':
$filter[] = "(UPPER(nombre) LIKE UPPER('%$string%') OR direccion LIKE upper('%$string%'))";
break;
}
unset($search['string']); unset($search['string']);
} }
if (isset($search['name'])) { if (isset($search['name']) === true) {
$name = io_safe_input($search['name']); $name = io_safe_input($search['name']);
switch ($config['dbtype']) { $filter[] = "nombre COLLATE utf8_general_ci LIKE '$name'";
case 'mysql':
case 'postgresql':
$filter[] = "nombre COLLATE utf8_general_ci LIKE '$name'";
break;
case 'oracle':
$filter[] = "UPPER(nombre) LIKE UPPER('$name')";
break;
}
unset($search['name']); unset($search['name']);
} }
if (isset($search['alias'])) { if (isset($search['alias']) === true) {
$name = io_safe_input($search['alias']); $name = io_safe_input($search['alias']);
switch ($config['dbtype']) { $filter[] = "alias COLLATE utf8_general_ci LIKE '$name'";
case 'mysql':
case 'postgresql':
$filter[] = "alias COLLATE utf8_general_ci LIKE '$name'";
break;
case 'oracle':
$filter[] = "UPPER(alias) LIKE UPPER('$name')";
break;
}
unset($search['alias']); unset($search['alias']);
} }
if (isset($search['id_os'])) { if (isset($search['aliasRegex']) === true) {
$name = io_safe_input($search['aliasRegex']);
$filter[] = sprintf(
'alias COLLATE utf8_general_ci REGEXP "%s"',
$name
);
unset($search['aliasRegex']);
}
if (isset($search['id_os']) === true) {
$filter['id_os'] = $search['id_os']; $filter['id_os'] = $search['id_os'];
} }
if (isset($search['status'])) { if (isset($search['status']) === true) {
switch ($search['status']) { switch ($search['status']) {
case AGENT_STATUS_NORMAL: case AGENT_STATUS_NORMAL:
$filter[] = '( $filter[] = '(
@ -1193,6 +1190,10 @@ function agents_get_group_agents(
total_count = 0 total_count = 0
OR total_count = notinit_count)'; OR total_count = notinit_count)';
break; break;
default:
// Not posible.
break;
} }
unset($search['status']); unset($search['status']);
@ -1208,7 +1209,7 @@ function agents_get_group_agents(
$filter['id_tmetaconsole_setup'] = $search['id_server']; $filter['id_tmetaconsole_setup'] = $search['id_server'];
if ($filter['id_tmetaconsole_setup'] == 0) { if ($filter['id_tmetaconsole_setup'] == 0) {
// All nodes // All nodes.
unset($filter['id_tmetaconsole_setup']); unset($filter['id_tmetaconsole_setup']);
} }
@ -1216,12 +1217,12 @@ function agents_get_group_agents(
} }
if (!$add_alert_bulk_op) { if (!$add_alert_bulk_op) {
// Add the rest of the filter from the search array // Add the rest of the filter from the search array.
foreach ($search as $key => $value) { foreach ($search as $key => $value) {
$filter[] = $value; $filter[] = $value;
} }
} }
} else { } else if ($filter !== true) {
$filter['disabled'] = 0; $filter['disabled'] = 0;
} }
@ -3601,3 +3602,25 @@ function agents_get_sap_agents($id_agent)
return false; return false;
} }
/**
* Return time at which last status change of a module occured.
*
* @param integer $id_agent.
* @return string timestamp.
*/
function agents_get_last_status_change($id_agent)
{
$sql = sprintf(
'SELECT *
FROM tagente_estado
WHERE id_agente = %d
ORDER BY last_status_change DESC',
$id_agent
);
$row = db_get_row_sql($sql);
return $row['last_status_change'];
}

View File

@ -1868,6 +1868,12 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
} }
} }
} else { } else {
// Delete only if the centralised mode is disabled.
if (is_central_policies_on_node()) {
returnError('centralized');
exit;
}
if ($agent_by_alias) { if ($agent_by_alias) {
$idsAgents = agents_get_agent_id_by_alias(io_safe_input($id)); $idsAgents = agents_get_agent_id_by_alias(io_safe_input($id));
} else { } else {

View File

@ -554,7 +554,7 @@ function cron_list_table()
$data[2] .= '<br>- '.__('Template').': '; $data[2] .= '<br>- '.__('Template').': ';
$data[2] .= '<a href="'.ui_get_full_url('index.php?sec=reporting&sec2=enterprise/godmode/reporting/reporting_builder.template&action=edit&id_template='.$args[0]).'">'; $data[2] .= '<a href="'.ui_get_full_url('index.php?sec=reporting&sec2=enterprise/godmode/reporting/reporting_builder.template&action=edit&id_template='.$args[0]).'">';
$data[2] .= $template['name'].'</a>'; $data[2] .= $template['name'].'</a>';
$data[2] .= '<br>- '.__('Agents').': '.$agents_id.'</a>'; $data[2] .= '<br>- '.__('Agents').': '.ui_print_truncate_text($agents_id, 120).'</a>';
$data[2] .= '<br>- '.__('Report per agent').': '.$report_per_agent.'</a>'; $data[2] .= '<br>- '.__('Report per agent').': '.$report_per_agent.'</a>';
$data[2] .= '<br>- '.__('Report name').': '.$report_name.'</a>'; $data[2] .= '<br>- '.__('Report name').': '.$report_name.'</a>';
$data[2] .= '<br>- '.__('Email').": <a href='mailto:".$email."'>".$email.'</a>'; $data[2] .= '<br>- '.__('Email').": <a href='mailto:".$email."'>".$email.'</a>';

View File

@ -1083,6 +1083,19 @@ function events_get_all(
$tag_without = base64_decode($filter['tag_without']); $tag_without = base64_decode($filter['tag_without']);
$tags = json_decode($tag_without, true); $tags = json_decode($tag_without, true);
if (is_array($tags) && !in_array('0', $tags)) { if (is_array($tags) && !in_array('0', $tags)) {
if (!$user_is_admin) {
$user_tags = array_flip(tags_get_tags_for_module_search());
if ($user_tags != null) {
foreach ($tags as $key_tag => $id_tag) {
// User cannot filter with those tags.
if (!array_search($id_tag, $user_tags)) {
unset($tags[$key_tag]);
continue;
}
}
}
}
foreach ($tags as $id_tag) { foreach ($tags as $id_tag) {
if (!isset($tags_names[$id_tag])) { if (!isset($tags_names[$id_tag])) {
$tags_names[$id_tag] = tags_get_name($id_tag); $tags_names[$id_tag] = tags_get_name($id_tag);
@ -4797,7 +4810,7 @@ function events_page_comments($event, $ajax=false)
__('Add comment'), __('Add comment'),
'comment_button', 'comment_button',
false, false,
'event_comment();', 'event_comment(\''.base64_encode(json_encode($event)).'\');',
'class="sub next"', 'class="sub next"',
true true
); );

View File

@ -1720,6 +1720,10 @@ function graphic_combined_module(
$params['threshold_data'] = $threshold_data; $params['threshold_data'] = $threshold_data;
} }
if ($params['vconsole'] === true) {
$water_mark = false;
}
$output = area_graph( $output = area_graph(
$agent_module_id, $agent_module_id,
$array_data, $array_data,
@ -1861,6 +1865,7 @@ function graphic_combined_module(
$height = 50; $height = 50;
} else { } else {
$height = ($height / $number_elements); $height = ($height / $number_elements);
$water_mark = false;
} }
$color = color_graph_array(); $color = color_graph_array();
@ -1983,18 +1988,25 @@ function graphic_combined_module(
$color = color_graph_array(); $color = color_graph_array();
if (!$params['vconsole']) { if ($params['vconsole'] === false) {
$width = 200; $width = 200;
$height = 200; $height = 200;
} else { } else {
$width = ($width / $number_elements); $ratio = ((200 * ( $height / (200 * $number_elements) )) / (200 * ( $width / (200 * $number_elements))));
$height = ($height / $number_elements);
$new_width = ( 200 * ( $width / (200 * $number_elements) ) );
$new_height = ( 200 * ( $height / (200 * $number_elements) / $ratio ) );
if ($height > $width) {
$new_height = (200 * ($height / (200 * $number_elements)));
$new_width = (200 * ($width / (200 * $number_elements)) / $ratio);
}
} }
$output = stacked_gauge( $output = stacked_gauge(
$graph_values, $graph_values,
$width, $new_width,
$height, $new_height,
$color, $color,
$module_name_list, $module_name_list,
ui_get_full_url( ui_get_full_url(
@ -2015,10 +2027,10 @@ function graphic_combined_module(
$label = ''; $label = '';
foreach ($module_list as $module_item) { foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false; $automatic_custom_graph_meta = false;
if ($config['metaconsole']) { if (is_metaconsole() === true) {
// Automatic custom graph from the report // Automatic custom graph from the report
// template in metaconsole. // template in metaconsole.
if (is_array($module_list[$i])) { if (is_array($module_list[$i]) === true) {
$server = metaconsole_get_connection_by_id( $server = metaconsole_get_connection_by_id(
$module_item['server'] $module_item['server']
); );
@ -2027,7 +2039,7 @@ function graphic_combined_module(
} }
} }
if ($automatic_custom_graph_meta) { if ($automatic_custom_graph_meta === true) {
$module = $module_item['module']; $module = $module_item['module'];
} else { } else {
$module = $module_item; $module = $module_item;
@ -2035,8 +2047,7 @@ function graphic_combined_module(
$module_data = modules_get_agentmodule($module); $module_data = modules_get_agentmodule($module);
$query_last_value = sprintf( $query_last_value = sprintf(
' 'SELECT datos
SELECT datos
FROM tagente_datos FROM tagente_datos
WHERE id_agente_modulo = %d WHERE id_agente_modulo = %d
AND utimestamp < %d AND utimestamp < %d
@ -2050,8 +2061,8 @@ function graphic_combined_module(
modules_get_agentmodule_agent_name($module) modules_get_agentmodule_agent_name($module)
); );
if (!empty($params_combined['labels']) if (empty($params_combined['labels']) === false
&& isset($params_combined['labels'][$module]) && isset($params_combined['labels'][$module]) === true
) { ) {
$label = $params_combined['labels'][$module]; $label = $params_combined['labels'][$module];
} else { } else {
@ -2061,15 +2072,30 @@ function graphic_combined_module(
'id_agente', 'id_agente',
$module_data['id_agente'] $module_data['id_agente']
); );
$label = $alias.' - '.$module_data['nombre']; if ($params['vconsole'] === true) {
if ($width < 250 || $height < 250) {
$label = \ui_print_truncate_text($module_data['nombre'], 3, false);
} else {
$label = $module_data['nombre'];
}
} else {
$label = $alias.' - '.$module_data['nombre'];
}
} }
$temp[$label]['g'] = round($temp_data, 4); if ($params_combined['stacked'] == CUSTOM_GRAPH_VBARS) {
$temp[] = [
'tick' => $label,
'data' => (int) round($temp_data, 4),
];
} else {
$temp[$label]['g'] = round($temp_data, 4);
}
if ($config['metaconsole']) { if (is_metaconsole() === true) {
// Automatic custom graph from the report // Automatic custom graph from the report
// template in metaconsole. // template in metaconsole.
if (is_array($module_list[0])) { if (is_array($module_list[0]) === true) {
metaconsole_restore_db(); metaconsole_restore_db();
} }
} }
@ -2079,12 +2105,14 @@ function graphic_combined_module(
$graph_values = $temp; $graph_values = $temp;
if (!$params['vconsole']) {
$width = 1024;
$height = 500;
}
if ($params_combined['stacked'] == CUSTOM_GRAPH_HBARS) { if ($params_combined['stacked'] == CUSTOM_GRAPH_HBARS) {
if ($params['vconsole'] === false) {
$width = 1024;
$height = 500;
} else {
$water_mark = false;
}
$output = hbar_graph( $output = hbar_graph(
$graph_values, $graph_values,
$width, $width,
@ -2112,32 +2140,27 @@ function graphic_combined_module(
} }
if ($params_combined['stacked'] == CUSTOM_GRAPH_VBARS) { if ($params_combined['stacked'] == CUSTOM_GRAPH_VBARS) {
$output = vbar_graph( $options = [];
$graph_values, $sizeLabelTickWidth = 85;
$width, if ($params['vconsole'] === true) {
$height, $water_mark = false;
$color, if (isset($width) === true) {
$module_name_list, $sizeLabelTickWidth = 30;
$long_index, }
ui_get_full_url( } else {
'images/image_problem_area_small.png', $options['grid']['hoverable'] = true;
false, }
false,
false $options['generals']['rotate'] = true;
), $options['generals']['forceTicks'] = true;
'', $options['x']['labelWidth'] = $sizeLabelTickWidth;
'', $options['generals']['arrayColors'] = $color;
$water_mark, $options['grid']['backgroundColor'] = 'transparent';
$config['fontpath'], $options['grid']['backgroundColor'] = $background_color;
$fixed_font_size, $options['y']['color'] = $background_color;
'', $options['x']['color'] = $background_color;
$ttl,
$homeurl, $output = vbar_graph($graph_values, $options, $ttl);
$background_color,
true,
false,
'#c1c1c1'
);
} }
break; break;
@ -2176,6 +2199,7 @@ function graphic_combined_module(
$datelimit, $datelimit,
$params['date'] $params['date']
); );
$temp_data = db_get_value_sql($query_last_value); $temp_data = db_get_value_sql($query_last_value);
if ($temp_data) { if ($temp_data) {
@ -2223,9 +2247,11 @@ function graphic_combined_module(
$graph_values = $temp; $graph_values = $temp;
if (!$params['vconsole']) { if ($params['vconsole'] === false) {
$width = $width; $width = $width;
$height = 500; $height = 500;
} else {
$water_mark = false;
} }
$color = color_graph_array(); $color = color_graph_array();
@ -2358,100 +2384,62 @@ function combined_graph_summatory_average(
/** /**
* Print a graph with access data of agents * Print a graph with access data of agents.
* *
* @param integer $id_agent Agent ID. * @param integer $id_agent Agent Id.
* @param integer $width Pie graph width. * @param integer $period Timestamp period graph.
* @param integer $height Pie graph height. * @param boolean|null $return Type return.
* @param integer $period Time period.
* @param boolean $return Return.
* @param boolean $tree View tree.
* *
* @return string Return or echo the result flag. * @return string
*/ */
function graphic_agentaccess( function graphic_agentaccess(
$id_agent, int $id_agent,
$width, int $period=0,
$height, ?bool $return=false
$period=0,
$return=false,
$tree=false
) { ) {
global $config; global $config;
global $graphic_type;
// Dates.
$date = get_system_time(); $date = get_system_time();
$datelimit = ($date - $period); $datelimit = ($date - $period);
$data_array = []; $interval = 3600;
$interval = agents_get_interval($id_agent);
$data = db_get_all_rows_sql( // Query.
sprintf( $sql = sprintf(
'SELECT utimestamp, count(*) as data 'SELECT utimestamp, count(*) as data
FROM tagent_access FROM tagent_access
WHERE id_agent = %d WHERE id_agent = %d
AND utimestamp > %d AND utimestamp >= %d
AND utimestamp < %d AND utimestamp <= %d
GROUP BY ROUND(utimestamp/%d)', GROUP BY TRUNCATE(utimestamp/%d,0)',
$id_agent, $id_agent,
$datelimit, $datelimit,
$date, $date,
$interval $interval
)
); );
if (isset($data) && is_array($data)) { $data = db_get_all_rows_sql($sql);
// Array data.
$data_array = [];
if (isset($data) === true && is_array($data) === true) {
foreach ($data as $key => $value) { foreach ($data as $key => $value) {
$data_array['Agent access']['data'][$key][0] = ($value['utimestamp'] * 1000); $time = (date('H:m', $value['utimestamp']));
$data_array['Agent access']['data'][$key][1] = $value['data']; $data_array[] = [
} 'tick' => $time,
'data' => (int) $value['data'],
$data_array['Agent access']['color'] = 'green'; 'color' => '#82b92f',
} else { ];
if ($return) {
return graph_nodata_image($width, $height);
} else {
echo graph_nodata_image($width, $height);
} }
} }
if ($config['fixed_graph'] == false) { $options = [];
$water_mark = [ $options['grid']['hoverable'] = true;
'file' => $config['homedir'].'/images/logo_vertical_water.png',
'url' => ui_get_full_url(
'images/logo_vertical_water.png',
false,
false,
false
),
];
}
$params = [ if ($return === true) {
'agent_module_id' => false, return vbar_graph($data_array, $options, 1);
'period' => $period,
'width' => $width,
'height' => $height,
'unit' => $unit,
'only_image' => $only_image,
'homeurl' => $homeurl,
'menu' => true,
'backgroundColor' => 'transparent',
'type_graph' => 'area',
'font' => $config['fontpath'],
'font_size' => $config['font_size'],
'array_data_create' => $data_array,
'show_overview' => false,
'show_export_csv' => false,
'vconsole' => true,
'show_legend' => false,
'grid_color' => 'grey',
];
if ($return) {
return grafico_modulo_sparse($params);
} else { } else {
echo grafico_modulo_sparse($params); echo vbar_graph($data_array, $options, 1);
} }
} }
@ -3667,6 +3655,7 @@ function graph_custom_sql_graph(
$data = []; $data = [];
$count = 0; $count = 0;
$flagOther = false;
foreach ($data_result as $data_item) { foreach ($data_result as $data_item) {
$count++; $count++;
$value = 0; $value = 0;
@ -3688,7 +3677,13 @@ function graph_custom_sql_graph(
switch ($type) { switch ($type) {
case 'sql_graph_vbar': case 'sql_graph_vbar':
// vertical bar // Vertical bar.
$data[] = [
'tick' => $label.'_'.$count,
'data' => $value,
];
break;
case 'sql_graph_hbar': case 'sql_graph_hbar':
// horizontal bar // horizontal bar
$data[$label.'_'.$count]['g'] = $value; $data[$label.'_'.$count]['g'] = $value;
@ -3702,7 +3697,19 @@ function graph_custom_sql_graph(
} else { } else {
switch ($type) { switch ($type) {
case 'sql_graph_vbar': case 'sql_graph_vbar':
// vertical bar // Vertical bar.
if ($flagOther === false) {
$data[] = [
'tick' => __('Other'),
'data' => $value,
];
$flagOther = true;
}
$data[(count($data) - 1)]['data'] += $value;
break;
case 'sql_graph_hbar': case 'sql_graph_hbar':
// horizontal bar // horizontal bar
if (!isset($data[__('Other')]['g'])) { if (!isset($data[__('Other')]['g'])) {
@ -3733,28 +3740,32 @@ function graph_custom_sql_graph(
switch ($type) { switch ($type) {
case 'sql_graph_vbar': case 'sql_graph_vbar':
// vertical bar // Vertical bar.
return vbar_graph( $color = color_graph_array();
$data,
$width, $options = [];
$height, $options['generals']['rotate'] = true;
[], $options['generals']['forceTicks'] = true;
[], $options['generals']['arrayColors'] = $color;
'', $options['x']['labelWidth'] = 75;
'', if ($ttl === 2) {
'', $options['backgroundColor'] = 'transparent';
'', $options['grid']['backgroundColor'] = 'transparent';
$water_mark, $options['y']['color'] = 'transparent';
$config['fontpath'], $options['x']['color'] = 'transparent';
$config['font_size'], $options['generals']['pdf']['width'] = $width;
'', $options['generals']['pdf']['height'] = $height;
$ttl,
$homeurl, $output .= '<img style="margin-left:20px;" src="data:image/jpg;base64,';
'white', $output .= vbar_graph($data, $options, $ttl);
true, $output .= '" />';
false, } else {
'#c1c1c1' $options['grid']['hoverable'] = true;
); $output = '<div style="width:100%; height:'.$height.'px">';
$output .= vbar_graph($data, $options, $ttl);
$output .= '</div>';
}
return $output;
break; break;
case 'sql_graph_hbar': case 'sql_graph_hbar':
@ -3809,8 +3820,18 @@ function graph_custom_sql_graph(
* @param string homeurl * @param string homeurl
* @param bool return or echo the result * @param bool return or echo the result
*/ */
function graph_graphic_agentevents($id_agent, $width, $height, $period=0, $homeurl, $return=false, $from_agent_view=false, $widgets=false) function graph_graphic_agentevents(
{ $id_agent,
$width,
$height,
$period=0,
$homeurl,
$return=false,
$from_agent_view=false,
$widgets=false,
$not_interactive=0,
$server_id=''
) {
global $config; global $config;
global $graphic_type; global $graphic_type;
@ -3885,7 +3906,26 @@ function graph_graphic_agentevents($id_agent, $width, $height, $period=0, $homeu
]; ];
// Draw slicebar graph // Draw slicebar graph
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date, 0, 1, $widgets); $out = flot_slicesbar_graph(
$data,
$period,
$width,
$height,
$full_legend,
$colors,
$config['fontpath'],
$config['round_corner'],
$homeurl,
'',
'',
false,
$id_agent,
$full_legend_date,
$not_interactive,
1,
$widgets,
$server_id
);
if ($return) { if ($return) {
return $out; return $out;
@ -3905,8 +3945,17 @@ function graph_graphic_agentevents($id_agent, $width, $height, $period=0, $homeu
* @param string homeurl * @param string homeurl
* @param bool return or echo the result * @param bool return or echo the result
*/ */
function graph_graphic_moduleevents($id_agent, $id_module, $width, $height, $period=0, $homeurl, $return=false, $ttl=1) function graph_graphic_moduleevents(
{ $id_agent,
$id_module,
$width,
$height,
$period=0,
$homeurl='',
$return=false,
$ttl=1,
$widthForTicks=false
) {
global $config; global $config;
global $graphic_type; global $graphic_type;
@ -3995,7 +4044,7 @@ function graph_graphic_moduleevents($id_agent, $id_module, $width, $height, $per
[], [],
true, true,
$ttl, $ttl,
true $widthForTicks
); );
if ($return) { if ($return) {
@ -4851,8 +4900,13 @@ function graphic_module_events($id_module, $width, $height, $period=0, $homeurl=
} }
function graph_nodata_image($width=300, $height=110, $type='area', $text='') function graph_nodata_image(
{ $width=300,
$height=110,
$type='area',
$text='',
$percent=false
) {
$image = ui_get_full_url( $image = ui_get_full_url(
'images/image_problem_area.png', 'images/image_problem_area.png',
false, false,
@ -4860,14 +4914,20 @@ function graph_nodata_image($width=300, $height=110, $type='area', $text='')
false false
); );
// if ($text == '') { $style = 'text-align:center; padding: 30px 0; display:block; font-size:9.5pt;';
// $text = __('No data to show'); $text_div = '<div class="nodata_text" style="'.$style.'">';
// } $text_div .= $text;
$text_div = '<div class="nodata_text" style="text-align:center; padding: 30px 0; display:block; font-size:9.5pt;">'.$text.'</div>'; $text_div .= '</div>';
$image_div = $text_div.'<div class="nodata_container" style="background-position: top; width:40%;height:40%;background-size: contain;background-image: url(\''.$image.'\');"><div></div></div>'; $style = 'background-size: contain;background-image: url(\''.$image.'\');';
$image_div = '<div class="nodata_container" style="'.$style.'"></div>';
$div = '<div style="width:'.$width.'px; height:'.$height.'px; background-color: white; margin: 0 auto;">'.$image_div.'</div>'; if ($percent === true) {
$div = $image_div;
} else {
$style = 'width:'.$width.'px; height:'.$height.'px; background-color: white; margin: 0 auto;';
$div = '<div style="'.$style.'">'.$image_div.'</div>';
}
return $div; return $div;
} }

View File

@ -1270,8 +1270,21 @@ function html_print_extended_select_for_cron($hour='*', $minute='*', $mday='*',
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
function html_print_input_text_extended($name, $value, $id, $alt, $size, $maxlength, $disabled, $script, $attributes, $return=false, $password=false, $function='', $autocomplete='off') function html_print_input_text_extended(
{ $name,
$value,
$id,
$alt,
$size,
$maxlength,
$disabled,
$script,
$attributes,
$return=false,
$password=false,
$function='',
$autocomplete='off'
) {
static $idcounter = 0; static $idcounter = 0;
if ($maxlength == 0) { if ($maxlength == 0) {
@ -1288,6 +1301,7 @@ function html_print_input_text_extended($name, $value, $id, $alt, $size, $maxlen
$valid_attrs = [ $valid_attrs = [
'accept', 'accept',
'autofocus',
'disabled', 'disabled',
'maxlength', 'maxlength',
'name', 'name',
@ -1345,7 +1359,7 @@ function html_print_input_text_extended($name, $value, $id, $alt, $size, $maxlen
$output .= 'alt="'.$alt.'" '; $output .= 'alt="'.$alt.'" ';
} }
// Attributes specified by function call // Attributes specified by function call.
$attrs = [ $attrs = [
'name' => 'unnamed', 'name' => 'unnamed',
'value' => '', 'value' => '',
@ -1523,8 +1537,21 @@ function html_print_input_password(
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
function html_print_input_text($name, $value, $alt='', $size=50, $maxlength=255, $return=false, $disabled=false, $required=false, $function='', $class='', $onChange='', $autocomplete='') function html_print_input_text(
{ $name,
$value,
$alt='',
$size=50,
$maxlength=255,
$return=false,
$disabled=false,
$required=false,
$function='',
$class='',
$onChange='',
$autocomplete='',
$autofocus=false
) {
if ($maxlength == 0) { if ($maxlength == 0) {
$maxlength = 255; $maxlength = 255;
} }
@ -1552,7 +1579,24 @@ function html_print_input_text($name, $value, $alt='', $size=50, $maxlength=255,
$attr['autocomplete'] = $autocomplete; $attr['autocomplete'] = $autocomplete;
} }
return html_print_input_text_extended($name, $value, 'text-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, false, $function); if ($autofocus === true) {
$attr['autofocus'] = $autofocus;
}
return html_print_input_text_extended(
$name,
$value,
'text-'.$name,
$alt,
$size,
$maxlength,
$disabled,
'',
$attr,
$return,
false,
$function
);
} }
@ -1687,6 +1731,7 @@ function html_print_input_number(array $settings):string
'autocomplete', 'autocomplete',
'min', 'min',
'max', 'max',
'step',
]; ];
$output = ''; $output = '';
@ -3466,7 +3511,8 @@ function html_print_input($data, $wrapper='div', $input_only=false)
((isset($data['function']) === true) ? $data['function'] : ''), ((isset($data['function']) === true) ? $data['function'] : ''),
((isset($data['class']) === true) ? $data['class'] : ''), ((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['onChange']) === true) ? $data['onChange'] : ''), ((isset($data['onChange']) === true) ? $data['onChange'] : ''),
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : '') ((isset($data['autocomplete']) === true) ? $data['autocomplete'] : ''),
((isset($data['autofocus']) === true) ? $data['autofocus'] : false)
); );
break; break;
@ -3727,6 +3773,16 @@ function html_print_input($data, $wrapper='div', $input_only=false)
$params['add_none_module'] = $data['module_none']; $params['add_none_module'] = $data['module_none'];
} }
if (isset($data['size']) === true) {
$params['size'] = $data['size'];
}
if (isset($data['from_wux']) === true
&& $data['from_wux'] === true
) {
$params['from_wux'] = 1;
}
$params['use_hidden_input_idagent'] = true; $params['use_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-'.$data['name_agent_hidden']; $params['hidden_input_idagent_id'] = 'hidden-'.$data['name_agent_hidden'];
if (is_metaconsole()) { if (is_metaconsole()) {
@ -3766,6 +3822,10 @@ function html_print_input($data, $wrapper='div', $input_only=false)
$string_filter = 'AND id_tipo_modulo IN (17,23,3,10,33,36)'; $string_filter = 'AND id_tipo_modulo IN (17,23,3,10,33,36)';
} }
if ($data['from_wux'] === true) {
$string_filter = ' AND id_tipo_modulo = 25 ';
}
$sql = sprintf( $sql = sprintf(
'SELECT id_agente_modulo, nombre 'SELECT id_agente_modulo, nombre
FROM tagente_modulo FROM tagente_modulo

View File

@ -437,7 +437,8 @@ function menu_print_menu(&$menu)
$visible = false; $visible = false;
} }
$output .= '<ul id="subicon_'.$id.'" class="submenu'.($visible ? '' : ' invisible').'">'; // $output .= '<ul id="subicon_'.$id.'" class="submenu'.($visible ? '' : ' invisible').'">';
$output .= '<ul id="subicon_'.$id.'" class="submenu">';
$output .= $submenu_output; $output .= $submenu_output;
$output .= '</ul>'; $output .= '</ul>';
} }
@ -521,8 +522,6 @@ function menu_add_extras(&$menu)
$menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_item_editor']['text'] = __('Graph template items'); $menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_item_editor']['text'] = __('Graph template items');
$menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_wizard']['text'] = __('Graph template wizard'); $menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_wizard']['text'] = __('Graph template wizard');
$menu_extra['reporting']['sub']['enterprise/dashboard/dashboard_replicate']['text'] = __('Copy dashboard');
if ($config['activate_gis']) { if ($config['activate_gis']) {
$menu_extra['godgismaps']['sub']['godmode/gis_maps/configure_gis_map']['text'] = __('Manage GIS Maps'); $menu_extra['godgismaps']['sub']['godmode/gis_maps/configure_gis_map']['text'] = __('Manage GIS Maps');
} }

View File

@ -2381,6 +2381,7 @@ function modules_get_color_status($status)
case AGENT_STATUS_ALERT_FIRED: case AGENT_STATUS_ALERT_FIRED:
case STATUS_ALERT_FIRED: case STATUS_ALERT_FIRED:
case STATUS_ALERT_FIRED_BALL: case STATUS_ALERT_FIRED_BALL:
case STATUS_MODULE_ALERT_TRIGGERED:
return COL_ALERTFIRED; return COL_ALERTFIRED;
case AGENT_MODULE_STATUS_UNKNOWN: case AGENT_MODULE_STATUS_UNKNOWN:

View File

@ -829,7 +829,7 @@ function reporting_make_reporting_data(
break; break;
case 'module_histogram_graph': case 'module_histogram_graph':
$report['contents'][] = reporting_enterprise_module_histogram_graph( $report['contents'][] = reporting_module_histogram_graph(
$report, $report,
$content, $content,
$pdf $pdf
@ -2880,19 +2880,19 @@ function reporting_group_report($report, $content)
$return['data'] = []; $return['data'] = [];
$events = events_get_agent( $id_group = groups_safe_acl($config['id_user'], $content['id_group'], 'ER');
false,
$content['period'], if (empty($id_group)) {
$report['datetime'], $events = [];
false, } else {
true, $sql_where = sprintf(' AND id_grupo IN (%s) AND estado<>1 ', implode(',', $id_group));
false, $events = events_get_events_grouped(
false, $sql_where,
false, 0,
false, 1000,
$content['id_group'], is_metaconsole()
true );
); }
if (empty($events)) { if (empty($events)) {
$events = []; $events = [];
@ -5140,7 +5140,7 @@ function reporting_sql($report, $content)
$return['description'] = $content['description']; $return['description'] = $content['description'];
$return['date'] = reporting_get_date_text(); $return['date'] = reporting_get_date_text();
if ($config['metaconsole']) { if ($config['metaconsole'] && !empty($content['server_name'])) {
$id_meta = metaconsole_get_id_server( $id_meta = metaconsole_get_id_server(
$content['server_name'] $content['server_name']
); );
@ -5212,7 +5212,7 @@ function reporting_sql($report, $content)
$return['error'] = __('Illegal query: Due security restrictions, there are some tokens or words you cannot use: *, delete, drop, alter, modify, password, pass, insert or update.'); $return['error'] = __('Illegal query: Due security restrictions, there are some tokens or words you cannot use: *, delete, drop, alter, modify, password, pass, insert or update.');
} }
if ($config['metaconsole']) { if ($config['metaconsole'] && !empty($content['server_name'])) {
metaconsole_restore_db(); metaconsole_restore_db();
} }
@ -5664,22 +5664,32 @@ function reporting_advanced_sla(
// Infer availability range based on the critical thresholds. // Infer availability range based on the critical thresholds.
$agentmodule_info = modules_get_agentmodule($id_agent_module); $agentmodule_info = modules_get_agentmodule($id_agent_module);
// // Check if module type is string.
$is_string_module = modules_is_string($agentmodule_info['id_agente_modulo']);
// Take in mind: the "inverse" critical threshold. // Take in mind: the "inverse" critical threshold.
$min_value = $agentmodule_info['min_critical'];
$max_value = $agentmodule_info['max_critical'];
$inverse_interval = ($agentmodule_info['critical_inverse'] == 0) ? 1 : 0; $inverse_interval = ($agentmodule_info['critical_inverse'] == 0) ? 1 : 0;
if ((!isset($min_value)) || ($min_value == 0)) { if (!$is_string_module) {
$min_value = null; $min_value = $agentmodule_info['min_critical'];
$max_value = $agentmodule_info['max_critical'];
} else {
$max_value = io_safe_output($agentmodule_info['str_critical']);
} }
if ((!isset($max_value)) || ($max_value == 0)) { if (!$is_string_module) {
$max_value = null; if ((!isset($min_value)) || ($min_value == 0)) {
} $min_value = null;
}
if ((!(isset($max_value))) && (!(isset($min_value)))) { if ((!isset($max_value)) || ($max_value == 0)) {
$max_value = null; $max_value = null;
$min_value = null; }
if ((!(isset($max_value))) && (!(isset($min_value)))) {
$max_value = null;
$min_value = null;
}
} }
if ((!isset($min_value)) && (!isset($max_value))) { if ((!isset($min_value)) && (!isset($max_value))) {
@ -6141,14 +6151,31 @@ function reporting_advanced_sla(
if ((isset($current_data['datos'])) if ((isset($current_data['datos']))
&& ($current_data['datos'] !== false) && ($current_data['datos'] !== false)
) { ) {
// Check values if module is sring type.
if ($is_string_module) {
if (empty($max_value)) {
$match = preg_match('/^'.$max_value.'$/', $current_data['datos']);
} else {
$match = preg_match('/'.$max_value.'/', $current_data['datos']);
}
// Take notice of $inverse_interval value,
if ($inverse_interval == 0) {
$sla_check_value = $match;
} else {
$sla_check_value = !$match;
}
} else {
$sla_check_value = sla_check_value(
$current_data['datos'],
$min_value,
$max_value,
$inverse_interval
);
}
// Not unknown nor not init values. // Not unknown nor not init values.
if (sla_check_value( if ($sla_check_value) {
$current_data['datos'],
$min_value,
$max_value,
$inverse_interval
)
) {
$ok_checks++; $ok_checks++;
$time_in_ok += $time_interval; $time_in_ok += $time_interval;
} else { } else {
@ -11629,7 +11656,7 @@ function reporting_get_stats_servers()
$output .= 'parameters["page"] = "include/ajax/events";'; $output .= 'parameters["page"] = "include/ajax/events";';
$output .= 'parameters["total_events"] = 1;'; $output .= 'parameters["total_events"] = 1;';
$output .= '$.ajax({type: "GET",url: "/pandora_console/ajax.php",data: parameters,'; $output .= '$.ajax({type: "GET",url: "'.ui_get_full_url('ajax.php', false, false, false).'",data: parameters,';
$output .= 'success: function(data) {'; $output .= 'success: function(data) {';
$output .= '$("#total_events").text(data);'; $output .= '$("#total_events").text(data);';
$output .= '}'; $output .= '}';
@ -12319,3 +12346,327 @@ function reporting_nt_top_n_report($period, $content, $pdf)
); );
return $return; return $return;
} }
/**
* Will display an hourly analysis of the selected period.
*
* @param array $report Info report.
* @param array $content Info contents.
* @param boolean $pdf If pdf.
*
* @return html
*/
function reporting_module_histogram_graph($report, $content, $pdf=0)
{
global $config;
$metaconsole_on = is_metaconsole();
$return = [];
$urlImage = ui_get_full_url(false, true, false, false);
$return['type'] = 'module_histogram_graph';
$ttl = 1;
if ($pdf) {
$ttl = 2;
}
if (empty($content['name'])) {
$content['name'] = __('Module Histogram Graph');
}
$server_name = $content['server_name'];
// Metaconsole connection.
if ($metaconsole_on && $server_name != '') {
$connection = metaconsole_get_connection($server_name);
if (!metaconsole_load_external_db($connection)) {
ui_print_error_message('Error connecting to '.$server_name);
}
}
$module_name = io_safe_output(
modules_get_agentmodule_name(
$content['id_agent_module']
)
);
$agent_name = io_safe_output(
modules_get_agentmodule_agent_alias(
$content['id_agent_module']
)
);
$return['title'] = $content['name'];
$return['landscape'] = $content['landscape'];
$return['pagebreak'] = $content['pagebreak'];
$return['subtitle'] = $agent_name.' - '.$module_name;
$return['description'] = $content['description'];
$return['date'] = reporting_get_date_text(
$report,
$content
);
if (modules_is_disable_agent($content['id_agent_module'])
|| modules_is_not_init($content['id_agent_module'])
) {
if ($metaconsole_on) {
// Restore db connection.
metaconsole_restore_db();
}
return false;
}
$uncompress_module = db_uncompress_module_data(
$content['id_agent_module'],
($report['datetime'] - $content['period']),
$report['datetime']
);
// Select Warning and critical values.
$agentmodule_info = modules_get_agentmodule($content['id_agent_module']);
$min_value_critical = ($agentmodule_info['min_critical'] == 0) ? null : $agentmodule_info['min_critical'];
// Check if module type is string.
$modules_is_string = modules_is_string($agentmodule_info['id_agente_modulo']);
if ($modules_is_string === false) {
if ($agentmodule_info['max_critical'] == 0) {
$max_value_critical = null;
} else {
$max_value_critical = $agentmodule_info['max_critical'];
}
} else {
if ($agentmodule_info['str_critical'] == '') {
$max_value_critical = null;
} else {
$max_value_critical = $agentmodule_info['str_critical'];
}
}
$inverse_critical = $agentmodule_info['critical_inverse'];
$min_value_warning = ($agentmodule_info['min_warning'] == 0) ? null : $agentmodule_info['min_warning'];
if ($modules_is_string === false) {
if ($agentmodule_info['max_warning'] == 0) {
$max_value_warning = null;
} else {
$max_value_warning = $agentmodule_info['max_warning'];
}
} else {
if ($agentmodule_info['str_warning'] == '') {
$max_value_warning = null;
} else {
$max_value_warning = $agentmodule_info['str_warning'];
}
}
$inverse_warning = $agentmodule_info['warning_inverse'];
// Initialize vars.
$tstart = 0;
$tend = 0;
$tacum = 0;
$tacum_data = 0;
$array_graph = [];
$data_not_init = 0;
$data_unknown = 0;
$data_critical = 0;
$data_warning = 0;
$data_ok = 0;
$data_total = 0;
$time_not_init = 0;
$time_unknown = 0;
$time_critical = 0;
$time_warning = 0;
$time_ok = 0;
$legend = [];
foreach ($uncompress_module as $data) {
foreach ($data['data'] as $key => $value) {
if ($tacum == 0) {
// Initialize the accumulators.
$tacum = $value['utimestamp'];
$tacum_data = $value['datos'];
} else {
// Utimestand end and final.
$tstart = $tacum;
$tend = $value['utimestamp'];
// Module type isn't string.
$sla_check_value_critical = sla_check_value(
$tacum_data,
$min_value_critical,
$max_value_critical,
$inverse_critical
);
$sla_check_value_warning = sla_check_value(
$tacum_data,
$min_value_warning,
$max_value_warning,
$inverse_warning
);
// Module type is string.
$string_check_value_critical = preg_match('/'.$max_value_critical.'/', $tacum_data);
$string_check_value_warning = preg_match('/'.$max_value_warning.'/', $tacum_data);
if ($inverse_critical) {
$string_check_value_critical = !preg_match('/'.$max_value_critical.'/', $tacum_data);
}
if ($string_check_value_warning) {
$string_check_value_warning = !preg_match('/'.$max_value_warning.'/', $tacum_data);
}
// Contruct array period and data.
if ($tacum_data === false) {
$array_graph[$data_total]['data'] = AGENT_MODULE_STATUS_NOT_INIT;
// NOT INIT.
$time_not_init = ($time_not_init + ($tend - $tstart));
$data_not_init ++;
} else if ($tacum_data === null) {
$array_graph[$data_total]['data'] = AGENT_MODULE_STATUS_UNKNOWN;
// UNKNOWN.
$time_unknown = ($time_unknown + ($tend - $tstart));
$data_unknown ++;
} else if (( (isset($min_value_critical) || isset($max_value_critical)) && ($modules_is_string === false) && ($sla_check_value_critical == true) )
|| ( isset($max_value_critical) && ($modules_is_string === true) && $string_check_value_critical )
) {
$array_graph[$data_total]['data'] = AGENT_MODULE_STATUS_CRITICAL_BAD;
// CRITICAL.
$time_critical = ($time_critical + ($tend - $tstart));
$data_critical ++;
} else if (( (isset($min_value_warning) || isset($max_value_warning)) && ($modules_is_string === false) && ($sla_check_value_warning == true) )
|| ( isset($max_value_warning) && ($modules_is_string === true) && $sla_check_value_warning )
) {
$array_graph[$data_total]['data'] = AGENT_MODULE_STATUS_WARNING;
// WARNING.
$time_warning = ($time_warning + ($tend - $tstart));
$data_warning ++;
} else {
$array_graph[$data_total]['data'] = AGENT_MODULE_STATUS_NORMAL;
// OK.
$time_ok = ($time_ok + ($tend - $tstart));
$data_ok ++;
}
$array_graph[$data_total]['utimestamp'] = ($tend - $tstart);
$array_graph[$data_total]['real_data'] = $tacum_data;
// Reassign accumulators.
$tacum = $value['utimestamp'];
$tacum_data = $value['datos'];
$data_total++;
}
}
}
$data_init = -1;
$acum = 0;
$sum = 0;
$array_result = [];
$i = 0;
foreach ($array_graph as $key => $value) {
if ($data_init == -1) {
$data_init = $value['data'];
$acum = $value['utimestamp'];
} else {
if ($data_init == $value['data']) {
$acum = ($acum + $value['utimestamp']);
if ($modules_is_string === false) {
$sum = ($sum + $value['real_data']);
} else {
$sum = $value['real_data'];
}
} else {
$array_result[$i]['data'] = $data_init;
$array_result[$i]['utimestamp'] = $acum;
$array_result[$i]['real_data'] = $sum;
$i++;
$data_init = $value['data'];
$acum = $value['utimestamp'];
$sum = $value['real_data'];
}
}
}
if (count($array_result) == 0) {
$array_result = $array_graph;
} else {
$array_result[$i]['data'] = $data_init;
$array_result[$i]['utimestamp'] = $acum;
$array_result[$i]['real_data'] = $sum;
}
$time_total = ($time_not_init + $time_unknown + $time_critical + $time_warning + $time_ok);
// Slice graphs calculation.
$return['agent'] = modules_get_agentmodule_agent_alias(
$content['id_agent_module']
);
$return['module'] = modules_get_agentmodule_name(
$content['id_agent_module']
);
$return['max_critical'] = $max_value_critical;
$return['min_critical'] = $min_value_critical;
$return['critical_inverse'] = $inverse_critical;
$return['max_warning'] = $max_value_warning;
$return['min_warning'] = $min_value_warning;
$return['warning_inverse'] = $inverse_warning;
$return['data_not_init'] = $data_not_init;
$return['data_unknown'] = $data_unknown;
$return['data_critical'] = $data_critical;
$return['data_warning'] = $data_warning;
$return['data_ok'] = $data_ok;
$return['data_total'] = $data_total;
$return['time_not_init'] = $time_not_init;
$return['time_unknown'] = $time_unknown;
$return['time_critical'] = $time_critical;
$return['time_warning'] = $time_warning;
$return['time_ok'] = $time_ok;
$return['percent_ok'] = (($data_ok * 100) / $data_total);
$colors = [
AGENT_MODULE_STATUS_NORMAL => COL_NORMAL,
AGENT_MODULE_STATUS_WARNING => COL_WARNING,
AGENT_MODULE_STATUS_CRITICAL_BAD => COL_CRITICAL,
AGENT_MODULE_STATUS_UNKNOWN => COL_UNKNOWN,
AGENT_MODULE_STATUS_NOT_INIT => COL_NOTINIT,
];
$width_graph = 100;
$height_graph = 80;
$return['chart'] = flot_slicesbar_graph(
$array_result,
$time_total,
$width_graph,
$height_graph,
$legend,
$colors,
$config['fontpath'],
$config['round_corner'],
$homeurl,
'',
'',
false,
0,
[],
true,
$ttl,
$content['sizeForTicks'],
true
);
if ($metaconsole_on) {
// Restore db connection.
metaconsole_restore_db();
}
return reporting_check_structure_content($return);
}

View File

@ -1920,11 +1920,7 @@ function reporting_html_group_report($table, $item, $pdf=0)
<td colspan='3' class='cellBold cellCenter cellAlert cellBorder1 cellBig'>".$item['data']['group_stats']['monitor_alerts_fired']."</td> <td colspan='3' class='cellBold cellCenter cellAlert cellBorder1 cellBig'>".$item['data']['group_stats']['monitor_alerts_fired']."</td>
</tr> </tr>
<tr> <tr>
<td></td> <td class='cellBold cellCenter'>".__('Events (not validated)')."</td>
<td colspan='6' class='cellBold cellCenter'>".__('Last %s', human_time_description_raw($item['date']['period']))."</td>
</tr>
<tr>
<td class='cellBold cellCenter'>".__('Events')."</td>
<td colspan='6' class='cellBold cellCenter cellWhite cellBorder1 cellBig'>".$item['data']['count_events'].'</td> <td colspan='6' class='cellBold cellCenter cellWhite cellBorder1 cellBig'>".$item['data']['count_events'].'</td>
</tr></tbody> </tr></tbody>
</table>'; </table>';
@ -3476,17 +3472,30 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
if (empty($item['data'][$k_chart]['failover']) === true) { if (empty($item['data'][$k_chart]['failover']) === true) {
$table1 = new stdClass(); $table1 = new stdClass();
$table1->width = '100%'; $table1->width = '100%';
$table1->autosize = 1;
$table1->styleTable = 'overflow: wrap; table-layout: fixed;';
$table1->data = []; $table1->data = [];
$table1->size = []; $table1->size = [];
$table1->size[0] = '10%'; $table1->size[0] = '10%';
$table1->size[1] = '80%'; $table1->size[1] = '80%';
$table1->size[2] = '5%'; $table1->size[2] = '10%';
$table1->size[3] = '5%';
$table1->style[0] = 'overflow-wrap: break-word';
// Align percentage and checks resume.
$table1->align[2] = 'center';
$table1->data[0][0] = $chart['agent'].'<br />'.$chart['module']; $table1->data[0][0] = $chart['agent'].'<br />'.$chart['module'];
$table1->data[0][1] = $chart['chart']; $table1->data[0][1] = $chart['chart'];
$table1->data[0][2] = "<span style = 'font-weight: bold; font-size: ".$font_size.'; color: '.$color."'>".$sla_value.'</span>'; $table1->data[0][2] = "<span style = 'font-weight: bold; font-size: ".$font_size.'; color: '.$color."'>".$sla_value.'</span><br/>';
$table1->data[0][3] = "<span style = 'font-size: ".$font_mini.";'>".$checks_resume.'</span>';
// Pdf sizes to avoid excesive overflow.
if ($pdf !== 0) {
$table1->size[0] = '15%';
$table1->size[1] = '70%';
$table1->size[2] = '15%';
}
$table1->data[0][2] .= "<span style = 'font-size: ".$font_mini.";'>".$checks_resume.'</span>';
$tables_chart .= html_print_table( $tables_chart .= html_print_table(
$table1, $table1,

View File

@ -1366,7 +1366,9 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags=[], $children
$tag_conds = ''; $tag_conds = '';
if (!empty($tags_str)) { if (!empty($tags_str)) {
$tag_conds = " AND (tags IN ('$tags_str') OR tags = '') "; $tag_conds = " AND (tags IN ($tags_str) OR tags = '') ";
} else if (!empty($tags_user)) {
$tag_conds = " AND (tags IN ($tags_user) OR tags = '') ";
} else { } else {
$tag_conds = " AND tags = '' "; $tag_conds = " AND tags = '' ";
} }

View File

@ -325,6 +325,14 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
$row['data'] = $last_data_str; $row['data'] = $last_data_str;
$table->data['last_data'] = $row; $table->data['last_data'] = $row;
// Last status change.
$last_status_change = db_get_value('last_status_change', 'tagente_estado', 'id_agente_modulo', $module['id_agente_modulo']);
$row = [];
$row['title'] = __('Last status change');
$time_elapsed = ($last_status_change > 0) ? human_time_comparation($last_status_change) : __('N/A');
$row['data'] = $time_elapsed;
$table->data['tags'] = $row;
// End of table // End of table
html_print_table($table); html_print_table($table);
@ -761,13 +769,28 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
if ($config['agentaccess']) { if ($config['agentaccess']) {
$access_graph = '<div style="width:100%; height:130px;">'; $access_graph = '<div style="width:100%; height:130px;">';
$access_graph .= graphic_agentaccess($id_agente, 380, 120, SECONDS_1DAY, true, true); $access_graph .= graphic_agentaccess(
$id_agente,
SECONDS_1DAY,
true
);
$access_graph .= '</div>'; $access_graph .= '</div>';
ui_toggle($access_graph, __('Agent access rate (24h)')); ui_toggle($access_graph, __('Agent access rate (24h)'));
} }
$events_graph = '<div style="margin-left:10px; width:100%;">'; $events_graph = '<div style="width: 100%; height: 90px; display: flex; flex-direction: row; justify-content: center;">';
$events_graph .= graph_graphic_agentevents($id_agente, 375, 45, SECONDS_1DAY, '', true, false, true); $events_graph .= graph_graphic_agentevents(
$id_agente,
'385px;',
45,
SECONDS_1DAY,
'',
true,
false,
550,
1,
$server_id
);
$events_graph .= '</div><br>'; $events_graph .= '</div><br>';
ui_toggle($events_graph, __('Events (24h)')); ui_toggle($events_graph, __('Events (24h)'));

View File

@ -1451,12 +1451,17 @@ function ui_print_help_icon(
* *
* @return boolean True if the file was added. False if the file doesn't exist. * @return boolean True if the file was added. False if the file doesn't exist.
*/ */
function ui_require_css_file($name, $path='include/styles/') function ui_require_css_file($name, $path='include/styles/', $echo_tag=false)
{ {
global $config; global $config;
$filename = $path.$name.'.css'; $filename = $path.$name.'.css';
if ($echo_tag === true) {
echo '<link type="text/css" rel="stylesheet" href="'.ui_get_full_url($filename, false, false, false).'">';
return null;
}
if (! isset($config['css'])) { if (! isset($config['css'])) {
$config['css'] = []; $config['css'] = [];
} }
@ -1678,7 +1683,7 @@ function ui_process_page_head($string, $bitfield)
|| $_GET['sec2'] == 'operation/agentes/group_view' || $_GET['sec2'] == 'operation/agentes/group_view'
|| $_GET['sec2'] == 'operation/events/events' || $_GET['sec2'] == 'operation/events/events'
|| $_GET['sec2'] == 'operation/snmpconsole/snmp_view' || $_GET['sec2'] == 'operation/snmpconsole/snmp_view'
|| $_GET['sec2'] == 'enterprise/dashboard/main_dashboard' || $_GET['sec2'] == 'operation/dashboard/dashboard'
) { ) {
$query = ui_get_url_refresh(false, false); $query = ui_get_url_refresh(false, false);
@ -2654,6 +2659,7 @@ function ui_get_status_images_path()
* @param array $options Options to set image attributes: I.E.: style. * @param array $options Options to set image attributes: I.E.: style.
* @param string $path Path of the image, if not provided use the status path. * @param string $path Path of the image, if not provided use the status path.
* @param boolean $image_with_css Don't use an image. Draw an image with css styles. * @param boolean $image_with_css Don't use an image. Draw an image with css styles.
* @param string $extra_text Text that is displayed after title (i.e. time elapsed since last status change of module).
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
@ -2663,7 +2669,8 @@ function ui_print_status_image(
$return=false, $return=false,
$options=false, $options=false,
$path=false, $path=false,
$image_with_css=false $image_with_css=false,
$extra_info=''
) { ) {
if ($path === false) { if ($path === false) {
$imagepath_array = ui_get_status_images_path(); $imagepath_array = ui_get_status_images_path();
@ -2680,7 +2687,7 @@ function ui_print_status_image(
if ($image_with_css === true) { if ($image_with_css === true) {
$shape_status = get_shape_status_set($type); $shape_status = get_shape_status_set($type);
return ui_print_status_sets($type, $title, $return, $shape_status); return ui_print_status_sets($type, $title, $return, $shape_status, $extra_info);
} else { } else {
if ($options === false) { if ($options === false) {
$options = []; $options = [];
@ -2716,6 +2723,7 @@ function get_shape_status_set($type)
case STATUS_MODULE_NO_DATA: case STATUS_MODULE_NO_DATA:
case STATUS_AGENT_NO_DATA: case STATUS_AGENT_NO_DATA:
case STATUS_MODULE_CRITICAL: case STATUS_MODULE_CRITICAL:
case STATUS_MODULE_ALERT_TRIGGERED:
case STATUS_AGENT_CRITICAL: case STATUS_AGENT_CRITICAL:
case STATUS_MODULE_WARNING: case STATUS_MODULE_WARNING:
case STATUS_AGENT_WARNING: case STATUS_AGENT_WARNING:
@ -2767,10 +2775,11 @@ function get_shape_status_set($type)
/** /**
* Prints an image representing a status. * Prints an image representing a status.
* *
* @param string $status Module status. * @param string $status Module status.
* @param string $title Title. * @param string $title Title.
* @param boolean $return Whether to return an output string or echo now (optional, echo by default). * @param boolean $return Whether to return an output string or echo now (optional, echo by default).
* @param array $options Options to set image attributes: I.E.: style. * @param array $options Options to set image attributes: I.E.: style.
* @param string $extra_info Text that is displayed after title (i.e. time elapsed since last status change of module).
* *
* @return string HTML. * @return string HTML.
*/ */
@ -2778,7 +2787,8 @@ function ui_print_status_sets(
$status, $status,
$title='', $title='',
$return=false, $return=false,
$options=false $options=false,
$extra_info=''
) { ) {
global $config; global $config;
@ -2797,8 +2807,8 @@ function ui_print_status_sets(
} }
if ($title != '') { if ($title != '') {
$options['title'] = $title; $options['title'] = empty($extra_info) ? $title : $title.'&#10'.$extra_info;
$options['data-title'] = $title; $options['data-title'] = empty($extra_info) ? $title : $title.'<br>'.$extra_info;
$options['data-use_title_for_force_title'] = 1; $options['data-use_title_for_force_title'] = 1;
if (isset($options['class'])) { if (isset($options['class'])) {
$options['class'] .= ' forced_title'; $options['class'] .= ' forced_title';
@ -4777,9 +4787,7 @@ function ui_print_agent_autocomplete_input($parameters)
inputs.push ("force_local_modules=1"); inputs.push ("force_local_modules=1");
} }
if ('.((int) $get_order_json).') { inputs.push ("get_order_json=1");
inputs.push ("get_order_json=1");
}
if ('.((int) $get_only_string_modules).') { if ('.((int) $get_only_string_modules).') {
inputs.push ("get_only_string_modules=1"); inputs.push ("get_only_string_modules=1");
@ -4814,6 +4822,14 @@ function ui_print_agent_autocomplete_input($parameters)
url: action="'.$javascript_ajax_page.'", url: action="'.$javascript_ajax_page.'",
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
if (Array.isArray(data) === true) {
data.sort(function(a, b) {
var textA = a.nombre.toUpperCase();
var textB = b.nombre.toUpperCase();
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
});
}
if ('.((int) $add_none_module).') { if ('.((int) $add_none_module).') {
$("#'.$selectbox_id.'") $("#'.$selectbox_id.'")
.append($("<option></option>") .append($("<option></option>")

View File

@ -1025,11 +1025,13 @@ function visual_map_print_item(
$params_combined $params_combined
).'</div>'; ).'</div>';
} else { } else {
$img = graphic_combined_module( $img = '<div style="width:'.$width.'px; height:'.$height.'px;">';
$img .= graphic_combined_module(
false, false,
$params, $params,
$params_combined $params_combined
); );
$img .= '</div>';
} }
} }
} else { } else {
@ -1223,7 +1225,16 @@ function visual_map_print_item(
'alpha' => CHART_DEFAULT_ALPHA, 'alpha' => CHART_DEFAULT_ALPHA,
]; ];
$module_data = get_bars_module_data($id_module); $module_data = get_bars_module_data(
$id_module,
($layoutData['type_graph'] !== 'horizontal')
);
$options = [];
$options['generals']['rotate'] = true;
$options['generals']['forceTicks'] = true;
$options['generals']['arrayColors'] = $color;
$options['x']['labelWidth'] = 60;
$water_mark = [ $water_mark = [
'file' => '/var/www/html/pandora_console/images/logo_vertical_water.png', 'file' => '/var/www/html/pandora_console/images/logo_vertical_water.png',
'url' => 'http://localhost/pandora_console/images/logo_vertical_water.png', 'url' => 'http://localhost/pandora_console/images/logo_vertical_water.png',
@ -1252,27 +1263,9 @@ function visual_map_print_item(
$layoutData['border_color'] $layoutData['border_color']
).'</div>'; ).'</div>';
} else { } else {
$img = '<div style="float:right;height:'.$himg.'px;">'.vbar_graph( $img = '<div style="float:right;height:'.$himg.'px;">';
$module_data, $img .= vbar_graph($module_data, $options, 1);
400, $img .= '</div>';
400,
$color,
[],
[],
ui_get_full_url('images/image_problem_area.png', false, false, false),
'',
'',
$water_mark,
$config['fontpath'],
6,
'',
0,
$config['homeurl'],
$layoutData['image'],
true,
false,
$layoutData['border_color']
).'</div>';
} }
} else if ($layoutData['label_position'] == 'right') { } else if ($layoutData['label_position'] == 'right') {
if ($layoutData['type_graph'] == 'horizontal') { if ($layoutData['type_graph'] == 'horizontal') {
@ -1296,27 +1289,9 @@ function visual_map_print_item(
$layoutData['border_color'] $layoutData['border_color']
).'</div>'; ).'</div>';
} else { } else {
$img = '<div style="float:left;height:'.$himg.'px;">'.vbar_graph( $img = '<div style="float:left;height:'.$himg.'px;">';
$module_data, $img .= vbar_graph($module_data, $options, 1);
400, $img .= '</div>';
400,
$color,
[],
[],
ui_get_full_url('images/image_problem_area.png', false, false, false),
'',
'',
$water_mark,
$config['fontpath'],
6,
'',
0,
$config['homeurl'],
$layoutData['image'],
true,
false,
$layoutData['border_color']
).'</div>';
} }
} else { } else {
if ($layoutData['type_graph'] == 'horizontal') { if ($layoutData['type_graph'] == 'horizontal') {
@ -1340,27 +1315,7 @@ function visual_map_print_item(
$layoutData['border_color'] $layoutData['border_color']
); );
} else { } else {
$img = vbar_graph( $img = vbar_graph($module_data, $options, 1);
$module_data,
400,
400,
$color,
[],
[],
ui_get_full_url('images/image_problem_area.png', false, false, false),
'',
'',
$water_mark,
$config['fontpath'],
6,
'',
0,
$config['homeurl'],
$layoutData['image'],
true,
false,
$layoutData['border_color']
);
} }
} }
} else { } else {
@ -1386,27 +1341,9 @@ function visual_map_print_item(
$layoutData['border_color'] $layoutData['border_color']
).'</div>'; ).'</div>';
} else { } else {
$img = '<div style="float:right;height:'.$himg.'px;">'.vbar_graph( $img = '<div style="float:right;height:'.$himg.'px;">';
$module_data, $img .= vbar_graph($module_data, $options, 1);
$width, $img .= '</div>';
$height,
$color,
[],
[],
ui_get_full_url('images/image_problem_area.png', false, false, false),
'',
'',
$water_mark,
$config['fontpath'],
6,
'',
0,
$config['homeurl'],
$layoutData['image'],
true,
false,
$layoutData['border_color']
).'</div>';
} }
} else if ($layoutData['label_position'] == 'right') { } else if ($layoutData['label_position'] == 'right') {
if ($layoutData['type_graph'] == 'horizontal') { if ($layoutData['type_graph'] == 'horizontal') {
@ -1430,27 +1367,9 @@ function visual_map_print_item(
$layoutData['border_color'] $layoutData['border_color']
).'</div>'; ).'</div>';
} else { } else {
$img = '<div style="float:left;height:'.$himg.'px;">'.vbar_graph( $img = '<div style="float:left;height:'.$himg.'px;">';
$module_data, $img .= vbar_graph($module_data, $options, 1);
$width, $img .= '</div>';
$height,
$color,
[],
[],
ui_get_full_url('images/image_problem_area.png', false, false, false),
'',
'',
$water_mark,
$config['fontpath'],
6,
'',
0,
$config['homeurl'],
$layoutData['image'],
true,
false,
$layoutData['border_color']
).'</div>';
} }
} else { } else {
if ($layoutData['type_graph'] == 'horizontal') { if ($layoutData['type_graph'] == 'horizontal') {
@ -1474,27 +1393,9 @@ function visual_map_print_item(
$layoutData['border_color'] $layoutData['border_color']
); );
} else { } else {
$img = vbar_graph( $img = '<div style="width:'.$width.'px; height:'.$height.'px;">';
$module_data, $img .= vbar_graph($module_data, $options, 1);
$width, $img .= '</div>';
$height,
$color,
[],
[],
ui_get_full_url('images/image_problem_area.png', false, false, false),
'',
'',
$water_mark,
$config['fontpath'],
6,
'',
0,
$config['homeurl'],
$layoutData['image'],
true,
false,
$layoutData['border_color']
);
} }
} }
} }
@ -2443,7 +2344,7 @@ function get_if_module_is_image($id_module)
} }
function get_bars_module_data($id_module) function get_bars_module_data($id_module, $vBars=false)
{ {
// This charts is only serialize graphs. // This charts is only serialize graphs.
// In other string show image no data to show. // In other string show image no data to show.
@ -2472,9 +2373,19 @@ function get_bars_module_data($id_module)
return false; return false;
} }
foreach ($values as $val) { if ($vBars === false) {
$data = explode(',', $val); foreach ($values as $val) {
$values_to_return[$data[0]] = ['g' => $data[1]]; $data = explode(',', $val);
$values_to_return[$data[0]] = ['g' => $data[1]];
}
} else {
foreach ($values as $val) {
$data = explode(',', $val);
$values_to_return[] = [
'tick' => $data[0],
'data' => $data[1],
];
}
} }
return $values_to_return; return $values_to_return;

Some files were not shown because too many files have changed in this diff Show More