mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Fixed conflict
Former-commit-id: 9ca611335700b59f58edf02fa1ab393fcfb8c567
This commit is contained in:
commit
da7e8e5487
@ -16,7 +16,7 @@ else
|
||||
fi
|
||||
VERSION=$2
|
||||
if [ $# == 2 ]; then
|
||||
BUILD=`date +%g%m%d`
|
||||
BUILD=`date +%y%m%d`
|
||||
else
|
||||
BUILD=$3
|
||||
fi
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.730-181221
|
||||
Version: 7.0NG.730-190121
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.730-181221"
|
||||
pandora_version="7.0NG.730-190121"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -42,7 +42,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.730';
|
||||
use constant AGENT_BUILD => '181221';
|
||||
use constant AGENT_BUILD => '190121';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
@ -516,11 +516,18 @@ sub parse_conf_modules($) {
|
||||
log_message ('setup', "Invalid regular expression in intensive condition: $line");
|
||||
}
|
||||
}
|
||||
} elsif ($line =~ /^\s*module_crontab\s+(((\*|(\d+(-\d+){0,1}))\s*){5}).*$/) {
|
||||
} elsif ($line =~ /^\s*module_crontab\s+(.*)$/) {
|
||||
my $cron_text = $1;
|
||||
chomp ($cron_text);
|
||||
$cron_text =~ s/\s+$//;
|
||||
# Get module name if is already read.
|
||||
my $module_name_message = "";
|
||||
$module_name_message = " (module $module->{'name'})" if defined($module->{'name'});
|
||||
if (cron_check_syntax($cron_text)) {
|
||||
$module->{'cron'} = $cron_text;
|
||||
log_message('debug', "Cron '$module->{'cron'}' configured $module_name_message.");
|
||||
} else {
|
||||
log_message('setup', "Incorrect cron syntax '$cron_text'. This module$module_name_message will be executed always.");
|
||||
}
|
||||
} elsif ($line =~ /^\s*module_end\s*$/) {
|
||||
|
||||
@ -2397,6 +2404,7 @@ sub check_module_cron {
|
||||
$interval
|
||||
);
|
||||
|
||||
my $is_first = ($module->{'cron_utimestamp'} == 0) ? 1 : 0;
|
||||
$module->{'cron_utimestamp'} = $now + $time_to_next_execution;
|
||||
$module->{'cron_interval'} = $time_to_next_execution;
|
||||
|
||||
@ -2405,7 +2413,7 @@ sub check_module_cron {
|
||||
}
|
||||
|
||||
# On first execution checking if cron is valid is required
|
||||
return 1 unless ($module->{'cron_utimestamp'} == 0);
|
||||
return 1 unless ($is_first);
|
||||
|
||||
# Check if current timestamp is a valid cron date
|
||||
my $next_execution = cron_next_execution_date(
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.730
|
||||
%define release 181221
|
||||
%define release 190121
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.730
|
||||
%define release 181221
|
||||
%define release 190121
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.730"
|
||||
PI_BUILD="181221"
|
||||
PI_BUILD="190121"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{181221}
|
||||
{190121}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.730(Build 181221)")
|
||||
#define PANDORA_VERSION ("7.0NG.730(Build 190121)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.730(Build 181221))"
|
||||
VALUE "ProductVersion", "(7.0NG.730(Build 190121))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.730-181221
|
||||
Version: 7.0NG.730-190121
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.730-181221"
|
||||
pandora_version="7.0NG.730-190121"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -14,6 +14,15 @@
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Enable profiler for testing
|
||||
if (!defined("__PAN_XHPROF__")) define ("__PAN_XHPROF__", 0);
|
||||
|
||||
if (__PAN_XHPROF__ === 1) {
|
||||
if (function_exists('tideways_xhprof_enable')) {
|
||||
tideways_xhprof_enable();
|
||||
}
|
||||
}
|
||||
|
||||
if ((! file_exists("include/config.php")) || (! is_readable("include/config.php"))) {
|
||||
exit;
|
||||
}
|
||||
@ -88,4 +97,8 @@ if (file_exists ($page)) {
|
||||
else {
|
||||
echo '<br /><b class="error">Sorry! I can\'t find the page '.$page.'!</b>';
|
||||
}
|
||||
|
||||
if (__PAN_XHPROF__ === 1) {
|
||||
pandora_xhprof_display_result("ajax", "console");
|
||||
}
|
||||
?>
|
||||
|
@ -48,8 +48,6 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` (
|
||||
`dynamic_interval` int(4) unsigned default '0',
|
||||
`dynamic_max` int(4) default '0',
|
||||
`dynamic_min` int(4) default '0',
|
||||
`dynamic_next` bigint(20) NOT NULL default '0',
|
||||
`dynamic_two_tailed` tinyint(1) unsigned default '0',
|
||||
`prediction_sample_window` int(10) default 0,
|
||||
`prediction_samples` int(4) default 0,
|
||||
`prediction_threshold` int(4) default 0,
|
||||
@ -58,6 +56,9 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` (
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
|
||||
ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tpolicy_modules`
|
||||
-- -----------------------------------------------------
|
||||
@ -125,8 +126,6 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` (
|
||||
`dynamic_interval` int(4) unsigned default '0',
|
||||
`dynamic_max` int(4) default '0',
|
||||
`dynamic_min` int(4) default '0',
|
||||
`dynamic_next` bigint(20) NOT NULL default '0',
|
||||
`dynamic_two_tailed` tinyint(1) unsigned default '0',
|
||||
`prediction_sample_window` int(10) default 0,
|
||||
`prediction_samples` int(4) default 0,
|
||||
`prediction_threshold` int(4) default 0,
|
||||
@ -135,6 +134,9 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` (
|
||||
UNIQUE (`id_policy`, `name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
|
||||
ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tpolicies`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -181,6 +183,9 @@ CREATE TABLE IF NOT EXISTS `tpolicy_agents` (
|
||||
UNIQUE (`id_policy`, `id_agent`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tpolicy_agents` ADD COLUMN `id_node` int(10) NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `tpolicy_agents` ADD UNIQUE(`id_policy`, `id_agent`, `id_node`);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tpolicy_groups`
|
||||
-- -----------------------------------------------------
|
||||
@ -292,6 +297,8 @@ CREATE TABLE IF NOT EXISTS `tagent_module_inventory` (
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tagent_module_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tpolicy_modules_inventory`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -310,6 +317,8 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules_inventory` (
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tpolicy_modules_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tagente_datos_inventory`
|
||||
-- -----------------------------------------------------
|
||||
@ -341,18 +350,13 @@ CREATE TABLE IF NOT EXISTS `ttrap_custom_values` (
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
|
||||
`id` int(10) NOT NULL auto_increment primary key,
|
||||
`server_name` text,
|
||||
`server_url` text,
|
||||
`dbuser` text,
|
||||
`dbpass` text,
|
||||
`dbhost` text,
|
||||
`dbport` text,
|
||||
`dbname` text,
|
||||
`meta_dbuser` text,
|
||||
`meta_dbpass` text,
|
||||
`meta_dbhost` text,
|
||||
`meta_dbport` text,
|
||||
`meta_dbname` text,
|
||||
`server_name` text default '',
|
||||
`server_url` text default '',
|
||||
`dbuser` text default '',
|
||||
`dbpass` text default '',
|
||||
`dbhost` text default '',
|
||||
`dbport` text default '',
|
||||
`dbname` text default '',
|
||||
`auth_token` text default '',
|
||||
`id_group` int(10) unsigned NOT NULL default 0,
|
||||
`api_password` text NOT NULL,
|
||||
@ -362,6 +366,12 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
|
||||
COMMENT = 'Table to store metaconsole sources'
|
||||
DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbuser` text;
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbpass` text;
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbhost` text;
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbport` text;
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbname` text;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tprofile_view`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -400,7 +410,7 @@ CREATE TABLE IF NOT EXISTS `tservice` (
|
||||
`id_template_alert_warning` int(10) unsigned NOT NULL default 0,
|
||||
`id_template_alert_critical` int(10) unsigned NOT NULL default 0,
|
||||
`id_template_alert_unknown` int(10) unsigned NOT NULL default 0,
|
||||
`id_template_alert_critical_sla` int(10) unsigned NOT NULL default 0
|
||||
`id_template_alert_critical_sla` int(10) unsigned NOT NULL default 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB
|
||||
COMMENT = 'Table to define services to monitor'
|
||||
@ -544,11 +554,12 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` (
|
||||
`user_comment` text NOT NULL,
|
||||
`id_tag` integer(10) unsigned NOT NULL default '0',
|
||||
`name` text default '',
|
||||
`group_recursion` INT(1) unsigned default 0,
|
||||
PRIMARY KEY (`id_event_rule`),
|
||||
KEY `idx_id_event_alert` (`id_event_alert`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tevent_rule` ADD COLUMN `group_recursion` INT(1) unsigned default 0;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tevent_alert`
|
||||
-- -----------------------------------------------------
|
||||
@ -745,14 +756,15 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
|
||||
`module_names` TEXT,
|
||||
`module_free_text` TEXT,
|
||||
`each_agent` tinyint(1) default 1,
|
||||
`historical_db` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0',
|
||||
`lapse` int(11) UNSIGNED NOT NULL default '300',
|
||||
`visual_format` tinyint(1) UNSIGNED NOT NULL default '0',
|
||||
`hide_no_data` tinyint(1) default 0,
|
||||
PRIMARY KEY(`id_rc`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE treport_content_template ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0';
|
||||
ALTER TABLE treport_content_template ADD COLUMN `lapse_calc` tinyint(1) default '0';
|
||||
ALTER TABLE treport_content_template ADD COLUMN `lapse` int(11) default '300';
|
||||
ALTER TABLE treport_content_template ADD COLUMN `visual_format` tinyint(1) default '0';
|
||||
ALTER TABLE treport_content_template ADD COLUMN `hide_no_data` tinyint(1) default '0';
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
|
||||
-- -----------------------------------------------------
|
||||
@ -861,6 +873,9 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event` (
|
||||
-- Criticity: 5 - Minor
|
||||
-- Criticity: 6 - Major
|
||||
|
||||
ALTER TABLE `tmetaconsole_event` ADD COLUMN `data` double(22,5) default NULL;
|
||||
ALTER TABLE `tmetaconsole_event` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmetaconsole_event_history`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -906,6 +921,8 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event_history` (
|
||||
-- Criticity: 5 - Minor
|
||||
-- Criticity: 6 - Major
|
||||
|
||||
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `data` double(22,5) default NULL;
|
||||
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `textension_translate_string`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -958,12 +975,10 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
|
||||
`agent_version` varchar(100) default '',
|
||||
`ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00',
|
||||
`disabled` tinyint(2) NOT NULL default '0',
|
||||
`remote` tinyint(1) NOT NULL default '0',
|
||||
`id_parent` int(10) unsigned default '0',
|
||||
`custom_id` varchar(255) default '',
|
||||
`server_name` varchar(100) default '',
|
||||
`cascade_protection` tinyint(2) NOT NULL default '0',
|
||||
`cascade_protection_module` int(10) unsigned default '0',
|
||||
`timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'number of hours of diference with the server timezone' ,
|
||||
`icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' ,
|
||||
`update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' ,
|
||||
@ -978,8 +993,6 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
|
||||
`fired_count` bigint(20) NOT NULL default '0',
|
||||
`update_module_count` tinyint(1) NOT NULL default '0',
|
||||
`update_alert_count` tinyint(1) NOT NULL default '0',
|
||||
`transactional_agent` tinyint(1) NOT NULL default '0',
|
||||
`alias` varchar(600) BINARY NOT NULL default '',
|
||||
PRIMARY KEY (`id_agente`),
|
||||
KEY `nombre` (`nombre`(255)),
|
||||
KEY `direccion` (`direccion`),
|
||||
@ -988,6 +1001,11 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
|
||||
FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `ttransaction`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -1306,6 +1324,10 @@ ALTER TABLE tlayout_data ADD COLUMN `clock_animation` varchar(60) NOT NULL defau
|
||||
ALTER TABLE tlayout_data ADD COLUMN `time_format` varchar(60) NOT NULL default "time";
|
||||
ALTER TABLE tlayout_data ADD COLUMN `timezone` varchar(60) NOT NULL default "Europe/Madrid";
|
||||
ALTER TABLE tlayout_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default';
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_node_id` INT(10) NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagent_custom_fields`
|
||||
@ -1359,26 +1381,15 @@ ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL;
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT '';
|
||||
|
||||
-- Table `tlocal_component`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tlocal_component ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
|
||||
ALTER TABLE tlocal_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tpolicy_module`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tpolicy_modules ADD COLUMN `ip_target`varchar(100) default '';
|
||||
ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
|
||||
ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
|
||||
ALTER TABLE `tpolicy_modules` ADD COLUMN `cps` int NOT NULL DEFAULT 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmetaconsole_agent`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias_as_name` int(2) unsigned default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
|
||||
ALTER TABLE `tmetaconsole_agent` ADD COLUMN `cps` int NOT NULL default 0;
|
||||
@ -1543,6 +1554,8 @@ ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL defaul
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tsnmp_filter`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tsnmp_filter ADD unified_filters_id int(10) NOT NULL DEFAULT 0;
|
||||
|
||||
SELECT max(unified_filters_id) INTO @max FROM tsnmp_filter;
|
||||
UPDATE tsnmp_filter tsf,(SELECT @max:= @max) m SET tsf.unified_filters_id = @max:= @max + 1 where tsf.unified_filters_id=0;
|
||||
|
||||
@ -1733,7 +1746,7 @@ CREATE TABLE IF NOT EXISTS `tautoconfig_actions` (
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tlayout_template` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(50) NOT NULL,
|
||||
`name` varchar(600) NOT NULL,
|
||||
`id_group` INTEGER UNSIGNED NOT NULL,
|
||||
`background` varchar(200) NOT NULL,
|
||||
`height` INTEGER UNSIGNED NOT NULL default 0,
|
||||
@ -1779,11 +1792,15 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
||||
`clock_animation` varchar(60) NOT NULL default "analogic_1",
|
||||
`time_format` varchar(60) NOT NULL default "time",
|
||||
`timezone` varchar(60) NOT NULL default "Europe/Madrid",
|
||||
`show_last_value` tinyint(1) UNSIGNED NULL default '0',
|
||||
`linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default',
|
||||
`linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0,
|
||||
`linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0,
|
||||
`linked_layout_node_id` INT(10) NOT NULL default 0,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE tlayout_template_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlog_graph_models`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -1826,11 +1843,28 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
|
||||
`id_custom_fields_data` varchar(600) default '',
|
||||
`id_status` varchar(600) default '',
|
||||
`module_search` varchar(600) default '',
|
||||
`module_status` varchar(600) default '',
|
||||
`recursion` int(1) unsigned default '0',
|
||||
`group_search` int(10) unsigned default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `module_status` varchar(600) default '';
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tevento`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `tevento` ADD COLUMN `data` double(22,5) default NULL;
|
||||
|
||||
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `recursion` int(1) unsigned default '0';
|
||||
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
|
||||
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `group_search` int(10) unsigned default '0';
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tgis_map_layer_groups`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tgis_map_layer_groups` (
|
||||
`layer_id` INT NOT NULL,
|
||||
`group_id` MEDIUMINT(4) UNSIGNED NOT NULL,
|
||||
`agent_id` INT(10) UNSIGNED NOT NULL COMMENT 'Used to link the position to the group',
|
||||
PRIMARY KEY (`layer_id`, `group_id`),
|
||||
FOREIGN KEY (`layer_id`) REFERENCES `tgis_map_layer` (`id_tmap_layer`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`group_id`) REFERENCES `tgrupo` (`id_grupo`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
@ -573,19 +573,28 @@ ui_require_javascript_file ('pandora_modules');
|
||||
?>
|
||||
<script language="javascript">
|
||||
/* <![CDATA[ */
|
||||
var no_name_lang = "<?php echo __ui_print_info_message ( array('no_close'=>true, 'message'=> __('No module name provided') ) ); ?>";
|
||||
var no_target_lang = "<?php echo __('No target IP provided') ?>";
|
||||
var no_oid_lang = "<?php echo __('No SNMP OID provided') ?>";
|
||||
var no_prediction_module_lang = "<?php echo __('No module to predict') ?>";
|
||||
var no_plugin_lang = "<?php echo __('No plug-in provided') ?>";
|
||||
var no_execute_test_from = "<?php echo __('No server provided') ?>"
|
||||
var no_name_lang =`
|
||||
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No module name provided') ) ); ?>
|
||||
`;
|
||||
var no_target_lang =`
|
||||
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No target IP provided') ) ); ?>
|
||||
`;
|
||||
var no_oid_lang =`
|
||||
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No SNMP OID provided') ) ); ?>
|
||||
`;
|
||||
var no_prediction_module_lang =`
|
||||
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No module to predict') ) ); ?>
|
||||
`;
|
||||
var no_plugin_lang =`
|
||||
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No plug-in provided') ) ); ?>
|
||||
`;
|
||||
var no_execute_test_from =`
|
||||
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No server provided') ) ); ?>
|
||||
`;
|
||||
|
||||
$(document).ready (function () {
|
||||
configure_modules_form ();
|
||||
|
||||
|
||||
|
||||
|
||||
$("#module_form").submit(function() {
|
||||
if (typeof(check_remote_conf) != 'undefined') {
|
||||
if (check_remote_conf) {
|
||||
|
@ -249,29 +249,33 @@ else {
|
||||
$idModuleType = '';
|
||||
}
|
||||
|
||||
$sql = sprintf ('SELECT id_tipo, descripcion
|
||||
//Removed web analysis and log4x from select
|
||||
$sql = sprintf (
|
||||
'SELECT id_tipo, descripcion, nombre
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s)
|
||||
WHERE categoria IN (%s) AND id_tipo NOT IN (24, 25)
|
||||
ORDER BY descripcion',
|
||||
implode (',', $categories));
|
||||
|
||||
$table_simple->data[2][1] = html_print_select_from_sql ($sql, 'id_module_type',
|
||||
$idModuleType, '', '', '', true, false, false, $disabledBecauseInPolicy, false, false, 100);
|
||||
|
||||
// Store the relation between id and name of the types on a hidden field
|
||||
$sql = sprintf ('SELECT id_tipo, nombre
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s)
|
||||
ORDER BY descripcion',
|
||||
implode (',', $categories));
|
||||
implode (',', $categories)
|
||||
);
|
||||
|
||||
$type_names = db_get_all_rows_sql($sql);
|
||||
|
||||
$type_names_hash = array();
|
||||
$type_description_hash = array();
|
||||
if (isset($type_names) && is_array($type_names)) {
|
||||
foreach ($type_names as $tn) {
|
||||
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
|
||||
$type_description_hash[$tn['id_tipo']] = $tn['descripcion'];
|
||||
}
|
||||
}
|
||||
|
||||
$table_simple->data[2][1] = html_print_select (
|
||||
$type_description_hash, 'id_module_type', $idModuleType,
|
||||
$disabledBecauseInPolicy, '', 0, true,
|
||||
false, true, '', false, false, false, 100
|
||||
);
|
||||
|
||||
// Store the relation between id and name of the types on a hidden field
|
||||
$table_simple->data[2][1] .= html_print_input_hidden('type_names',base64_encode(io_json_mb_encode($type_names_hash)),true);
|
||||
}
|
||||
|
||||
@ -439,7 +443,7 @@ $table_advanced->data[2][1] .= html_print_input_hidden ('moduletype', $moduletyp
|
||||
$table_advanced->data[2][3] = __('Post process').' ' . ui_print_help_icon ('postprocess', true);
|
||||
$table_advanced->data[2][4] =
|
||||
html_print_extended_select_for_post_process('post_process',
|
||||
$post_process, '', '', '0', false, true, false, true,
|
||||
$post_process, '', '', '0', false, true, false, false,
|
||||
$disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[2][4] = 3;
|
||||
|
||||
|
@ -65,6 +65,8 @@ if (! $id_agente) {
|
||||
$params['selectbox_id'] = 'id_agent_module';
|
||||
$params['javascript_is_function_select'] = true;
|
||||
$params['metaconsole_enabled'] = false;
|
||||
$params['use_hidden_input_idagent'] = true;
|
||||
$params['print_hidden_input_idagent'] = true;
|
||||
$table->data['agent'][1] = ui_print_agent_autocomplete_input($params);
|
||||
}
|
||||
|
||||
@ -137,20 +139,18 @@ if (check_acl ($config['id_user'], 0, "LM")) {
|
||||
$table->data[3][1] .= ' ' . __('seconds') . ui_print_help_icon ('action_threshold', true);
|
||||
|
||||
|
||||
if (!isset($step) || $step!=5) {
|
||||
if (!isset($step)) {
|
||||
echo '<form class="add_alert_form" method="post">';
|
||||
html_print_table ($table);
|
||||
}
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
||||
if (!isset($step) || $step!=5) {
|
||||
if (!isset($step)) {
|
||||
if($id_cluster){
|
||||
echo "<input onclick='window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");' type=button style='float:right;margin-left:20px;' name='store' class='sub upd' value='".__('Finish and view cluster')."'>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
html_print_submit_button (__('Add alert'), 'add', false, 'class="sub wand"');
|
||||
html_print_input_hidden ('create_alert', 1);
|
||||
echo '</div></form>';
|
||||
@ -223,7 +223,7 @@ $(document).ready (function () {
|
||||
$("#value", $value).append ("<em><?php echo __('Empty') ?></em>");
|
||||
}
|
||||
else {
|
||||
$("#value", $value).append (parseInt(data));
|
||||
$("#value", $value).append (data);
|
||||
}
|
||||
$loading.hide ();
|
||||
$value.show ();
|
||||
|
@ -285,7 +285,7 @@ else {
|
||||
$filter = false;
|
||||
}
|
||||
$names = agents_get_modules (array_keys ($agents),
|
||||
'DISTINCT(tagente_modulo.nombre)', $filter, false);
|
||||
'tagente_modulo.nombre', $filter, false);
|
||||
foreach ($names as $name) {
|
||||
$modules[$name['nombre']] = $name['nombre'];
|
||||
}
|
||||
|
@ -56,12 +56,8 @@ if ($update) {
|
||||
$agents_select = array();
|
||||
}
|
||||
|
||||
foreach ($agents_select as $agent_name) {
|
||||
$agents_[] = agents_get_agent_id($agent_name);
|
||||
}
|
||||
|
||||
$agents_ = $agents_select;
|
||||
$modules_ = $module_name;
|
||||
|
||||
}
|
||||
else if ($selection_mode == 'agents') {
|
||||
$force = get_parameter('force_group', false);
|
||||
|
@ -119,7 +119,9 @@ if ($schedule_report != '') {
|
||||
$time = date(TIME_FORMAT);
|
||||
$parameters[0] = get_parameter('id_schedule_report');
|
||||
//$parameters[1] = db_get_value('schedule_email', 'treport', 'id_report', $id_report);
|
||||
$parameters[1] = get_parameter('schedule_email');
|
||||
$parameters[1] = get_parameter('schedule_email_address');
|
||||
$parameters[2] = get_parameter('schedule_subject', '');
|
||||
$parameters[3] = get_parameter('schedule_email', '');
|
||||
$parameters['first_execution'] = strtotime ($date.' '.$time);
|
||||
|
||||
$values = array(
|
||||
|
BIN
pandora_console/images/success.png
Normal file
BIN
pandora_console/images/success.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@ -193,15 +193,37 @@ if ($dialogue_event_response) {
|
||||
$event_id = get_parameter ('event_id');
|
||||
$response_id = get_parameter ('response_id');
|
||||
$command = get_parameter ('target');
|
||||
|
||||
$massive = get_parameter ('massive');
|
||||
$end = get_parameter ('end');
|
||||
$show_execute_again_btn = get_parameter ('show_execute_again_btn');
|
||||
$out_iterator = get_parameter ('out_iterator');
|
||||
$event_response = db_get_row('tevent_response','id',$response_id);
|
||||
|
||||
$event = db_get_row('tevento','id_evento',$event_id);
|
||||
|
||||
$prompt = "<br>> ";
|
||||
|
||||
switch($event_response['type']) {
|
||||
case 'command':
|
||||
|
||||
|
||||
if ($massive) {
|
||||
echo "<div style='text-align:left'>";
|
||||
echo $prompt.sprintf("(Event #$event_id) ".__('Executing command: %s',$command));
|
||||
echo "</div><br>";
|
||||
|
||||
echo "<div id='response_loading_command_".$out_iterator."' style='display:none'>".html_print_image('images/spinner.gif', true)."</div>";
|
||||
echo "<br><div id='response_out_".$out_iterator."' style='text-align:left'></div>";
|
||||
|
||||
if ($end) {
|
||||
|
||||
echo "<br><div id='re_exec_command_".$out_iterator."' style='display:none;'>";
|
||||
html_print_button(__('Execute again'),'btn_str',false,'execute_event_response(false);', "class='sub next'");
|
||||
echo "<span id='execute_again_loading' style='display:none'>".html_print_image('images/spinner.gif', true)."</span>";
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
echo "<div style='text-align:left'>";
|
||||
echo $prompt.sprintf(__('Executing command: %s',$command));
|
||||
echo "</div><br>";
|
||||
@ -212,6 +234,8 @@ if ($dialogue_event_response) {
|
||||
echo "<br><div id='re_exec_command' style='display:none;'>";
|
||||
html_print_button(__('Execute again'),'btn_str',false,'perform_response(\''.$command.'\', ' . $response_id . ');', "class='sub next'");
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
break;
|
||||
case 'url':
|
||||
$command = str_replace("localhost",$_SERVER['SERVER_NAME'],$command);
|
||||
|
@ -270,31 +270,7 @@ function process_user_login_remote ($login, $pass, $api = false) {
|
||||
delete_user_pass_ldap ($login);
|
||||
}
|
||||
|
||||
$permissions = array();
|
||||
if($config['ldap_advanced_config']){
|
||||
$i = 0;
|
||||
|
||||
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
|
||||
foreach ($ldap_adv_perms as $ldap_adv_perm) {
|
||||
$attributes = $ldap_adv_perm['groups_ldap'];
|
||||
|
||||
foreach ($attributes as $attr) {
|
||||
$attr = explode('=', $attr, 2);
|
||||
foreach ($sr[$attr[0]] as $s_attr) {
|
||||
if(preg_match('/' . $attr[1] . '/', $s_attr)){
|
||||
$permissions[$i]["profile"] = $ldap_adv_perm['profile'];
|
||||
$permissions[$i]["groups"] = $ldap_adv_perm['group'];
|
||||
$permissions[$i]["tags"] = implode(",",$ldap_adv_perm['tags']);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$permissions[0]["profile"] = $config['default_remote_profile'];
|
||||
$permissions[0]["groups"][] = $config['default_remote_group'];
|
||||
$permissions[0]["tags"] = $config['default_assign_tags'];
|
||||
}
|
||||
$permissions = fill_permissions_ldap($sr);
|
||||
if(empty($permissions)) {
|
||||
$config["auth_error"] = __("User not found in database or incorrect password");
|
||||
return false;
|
||||
@ -388,33 +364,7 @@ function process_user_login_remote ($login, $pass, $api = false) {
|
||||
}
|
||||
}
|
||||
|
||||
$permissions = array();
|
||||
if($config['ldap_advanced_config']){
|
||||
$i = 0;
|
||||
|
||||
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
|
||||
|
||||
foreach ($ldap_adv_perms as $ldap_adv_perm) {
|
||||
$attributes = $ldap_adv_perm['groups_ldap'];
|
||||
|
||||
foreach ($attributes as $attr) {
|
||||
$attr = explode('=', $attr, 2);
|
||||
foreach ($sr[$attr[0]] as $s_attr) {
|
||||
if(preg_match('/' . $attr[1] . '/', $s_attr)){
|
||||
$permissions[$i]["profile"] = $ldap_adv_perm['profile'];
|
||||
$permissions[$i]["groups"] = $ldap_adv_perm['group'];
|
||||
$permissions[$i]["tags"] = implode(",",$ldap_adv_perm['tags']);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$permissions[0]["profile"] = $config['default_remote_profile'];
|
||||
$permissions[0]["groups"][] = $config['default_remote_group'];
|
||||
$permissions[0]["tags"] = $config['default_assign_tags'];
|
||||
}
|
||||
|
||||
$permissions = fill_permissions_ldap($sr);
|
||||
if(empty($permissions)) {
|
||||
$config["auth_error"] = __("User not found in database or incorrect password");
|
||||
return false;
|
||||
@ -904,10 +854,11 @@ function create_user_and_permisions_ldap ($id_user, $password, $user_info,
|
||||
$id_profile = $permission["profile"];
|
||||
$id_groups = $permission["groups"];
|
||||
$tags = $permission["tags"];
|
||||
$no_hierarchy = (bool)$permission["no_hierarchy"] ? 1 : 0;
|
||||
|
||||
foreach ($id_groups as $id_group) {
|
||||
$profile = profile_create_user_profile(
|
||||
$id_user, $id_profile, $id_group, false, $tags);
|
||||
$id_user, $id_profile, $id_group, false, $tags, $no_hierarchy);
|
||||
}
|
||||
|
||||
if ( defined("METACONSOLE") && $syncronize ) {
|
||||
@ -934,7 +885,7 @@ function create_user_and_permisions_ldap ($id_user, $password, $user_info,
|
||||
db_process_sql_insert ("tusuario", $values);
|
||||
foreach ($id_groups as $id_group) {
|
||||
$profile = profile_create_user_profile ($id_user,
|
||||
$id_profile, $id_group, false, $tags);
|
||||
$id_profile, $id_group, false, $tags, $no_hierarchy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1141,6 +1092,46 @@ function check_permission_ldap ($id_user, $password, $user_info,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill permissions array with setup values
|
||||
*
|
||||
* @param string sr return value from LDAP connection
|
||||
*
|
||||
* @return array with all permission on LDAP authentication
|
||||
*/
|
||||
function fill_permissions_ldap ($sr) {
|
||||
global $config;
|
||||
|
||||
$permissions = array();
|
||||
if(!$config['ldap_advanced_config']){
|
||||
$permissions[0]["profile"] = $config['default_remote_profile'];
|
||||
$permissions[0]["groups"][] = $config['default_remote_group'];
|
||||
$permissions[0]["tags"] = $config['default_assign_tags'];
|
||||
$permissions[0]["no_hierarchy"] = $config['default_no_hierarchy'];
|
||||
return $permissions;
|
||||
}
|
||||
|
||||
// Decode permissions in advanced mode
|
||||
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
|
||||
foreach ($ldap_adv_perms as $ldap_adv_perm) {
|
||||
$attributes = $ldap_adv_perm['groups_ldap'];
|
||||
foreach ($attributes as $attr) {
|
||||
$attr = explode('=', $attr, 2);
|
||||
foreach ($sr[$attr[0]] as $s_attr) {
|
||||
if(preg_match('/' . $attr[1] . '/', $s_attr)){
|
||||
$permissions[] = array(
|
||||
"profile" => $ldap_adv_perm['profile'],
|
||||
"groups" => $ldap_adv_perm['group'],
|
||||
"tags" => implode(",",$ldap_adv_perm['tags']),
|
||||
"no_hierarchy" => (bool)$ldap_adv_perm['no_hierarchy'] ? 1 : 0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update local user pass from ldap user
|
||||
*
|
||||
|
@ -22,7 +22,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC181221';
|
||||
$build_version = 'PC190121';
|
||||
$pandora_version = 'v7.0NG.730';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -3401,4 +3401,38 @@ function validate_csrf_code() {
|
||||
function generate_hash_to_api(){
|
||||
hash('sha256', db_get_value ('value', 'tupdate_settings', '`key`', 'customer_key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the profiller and display de result
|
||||
*
|
||||
* @param string Key to identify the profiler run.
|
||||
* @param string Way to display the result
|
||||
* "link" (default): Click into word "Performance" to display the profilling info.
|
||||
* "console": Display with a message in pandora_console.log.
|
||||
*/
|
||||
function pandora_xhprof_display_result($key = "", $method = "link") {
|
||||
// Check if function exists
|
||||
if (!function_exists('tideways_xhprof_disable')) {
|
||||
error_log("Cannot find tideways_xhprof_disable function");
|
||||
return;
|
||||
}
|
||||
|
||||
$run_id = uniqid();
|
||||
$data = tideways_xhprof_disable();
|
||||
$source = "pandora_$key";
|
||||
file_put_contents(
|
||||
sys_get_temp_dir() . "/" . $run_id . ".$source.xhprof",
|
||||
serialize($data)
|
||||
);
|
||||
$new_url = "http://{$_SERVER['HTTP_HOST']}/profiler/index.php?run={$run_id}&source={$source}";
|
||||
switch($method) {
|
||||
case "console":
|
||||
error_log("'{$new_url}'");
|
||||
case "link":
|
||||
default:
|
||||
echo "<a href='{$new_url}' target='_new'>Performance</a>\n";
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -827,7 +827,8 @@ function agents_get_group_agents (
|
||||
|
||||
$filter = array();
|
||||
|
||||
if (!$noACL) {
|
||||
// check available groups for target user only if asking for 'All' group
|
||||
if (!$noACL && $id_group == 0) {
|
||||
$id_group = $id_group == 0
|
||||
? array_keys(users_get_groups(false, "AR", false))
|
||||
: groups_safe_acl($config["id_user"], $id_group, "AR");
|
||||
@ -848,7 +849,8 @@ function agents_get_group_agents (
|
||||
$id_group = groups_get_id_recursive($id_group, true);
|
||||
}
|
||||
|
||||
if (!$noACL) {
|
||||
// check available groups for target user only if asking for 'All' group
|
||||
if (!$noACL && $id_group == 0) {
|
||||
$id_group = array_keys(
|
||||
users_get_groups(false, "AR", true, false, (array)$id_group));
|
||||
}
|
||||
@ -1231,8 +1233,8 @@ function agents_get_modules ($id_agent = null, $details = false,
|
||||
ON tagente.id_agente = tasg.id_agent
|
||||
WHERE tagente_modulo.delete_pending = 0
|
||||
AND %s
|
||||
GROUP BY tagente_modulo.id_agente_modulo
|
||||
ORDER BY tagente_modulo.nombre',
|
||||
GROUP BY 1
|
||||
ORDER BY 1',
|
||||
($details != 'tagente_modulo.*' && $indexed) ? 'tagente_modulo.id_agente_modulo,' : '',
|
||||
io_safe_output(implode (",", (array) $details)),
|
||||
$sql_tags_join,
|
||||
|
@ -32,6 +32,7 @@ include_once($config['homedir'] . "/include/functions_servers.php");
|
||||
include_once($config['homedir'] . "/include/functions_planned_downtimes.php");
|
||||
include_once($config['homedir'] . "/include/functions_db.php");
|
||||
include_once($config['homedir'] . "/include/functions_event_responses.php");
|
||||
include_once($config['homedir'] . "/include/functions_policies.php");
|
||||
enterprise_include_once ('include/functions_local_components.php');
|
||||
enterprise_include_once ('include/functions_events.php');
|
||||
enterprise_include_once ('include/functions_agents.php');
|
||||
@ -6448,6 +6449,63 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
||||
array('type' => 'string', 'data' => __('SNMP policy module updated.')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an agent from a policy.
|
||||
* @param $id Id of the policy
|
||||
* @param $id2 Id of the agent policy
|
||||
* @param $trash1
|
||||
* @param $trash2
|
||||
*
|
||||
* Example:
|
||||
* api.php?op=set&op2=remove_agent_from_policy&apipass=1234&user=admin&pass=pandora&id=11&id2=2
|
||||
*/
|
||||
function api_set_remove_agent_from_policy ($id, $id2, $thrash2, $thrash3) {
|
||||
global $config;
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "AW")){
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id == '' || !$id) {
|
||||
returnError('error_parameter', __('Error deleting agent from policy. Policy cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id2 == '' || !$id2) {
|
||||
returnError('error_parameter', __('Error deleting agent from policy. Agent cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$policy = policies_get_policy ($id, false, false);
|
||||
$agent = db_get_row_filter('tagente', array('id_agente' => $id2));
|
||||
$policy_agent = db_get_row_filter('tpolicy_agents', array('id_policy' => $id ,'id_agent' => $id2));
|
||||
|
||||
if (empty ($policy)){
|
||||
returnError('error_policy', __('This policy does not exist.'));
|
||||
return;
|
||||
}
|
||||
if (empty ($agent)){
|
||||
returnError('error_agent', __('This agent does not exist.'));
|
||||
return;
|
||||
}
|
||||
if (empty ($policy_agent)){
|
||||
returnError('error_policy_agent', __('This agent does not exist in this policy.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$return = policies_change_delete_pending_agent($policy_agent['id']);
|
||||
$data = __('Successfully added to delete pending id agent %d to id policy %d.', $id2, $id);
|
||||
|
||||
if ($return === false)
|
||||
returnError('error_delete_policy_agent', 'Could not be deleted id agent %d from id policy %d', $id2, $id);
|
||||
else
|
||||
returnData('string', array('type' => 'string', 'data' => $data));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new group. And return the id_group of the new group.
|
||||
*
|
||||
@ -7008,7 +7066,6 @@ function api_set_update_user($id, $thrash2, $other, $thrash3) {
|
||||
}
|
||||
|
||||
$cont = 0;
|
||||
|
||||
foreach ($fields_user as $field) {
|
||||
if ($other['data'][$cont] != "" and $field != "password") {
|
||||
$values[$field] = $other['data'][$cont];
|
||||
@ -9726,6 +9783,11 @@ function api_set_create_event($id, $trash1, $other, $returnType) {
|
||||
return;
|
||||
}
|
||||
$values['id_grupo'] = $other['data'][1];
|
||||
|
||||
if (groups_get_name($values['id_grupo']) === false) {
|
||||
returnError('error_parameter', 'Group ID does not exist');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
returnError('error_parameter', 'Group ID required.');
|
||||
@ -10069,7 +10131,7 @@ function api_get_netflow_get_summary ($discard_1, $discard_2, $params) {
|
||||
}
|
||||
|
||||
//http://localhost/pandora_console/include/api.php?op=set&op2=validate_event_by_id&id=23&apipass=1234&user=admin&pass=pandora
|
||||
function api_set_validate_event_by_id ($id, $trash1, $trash2, $returnType) {
|
||||
function api_set_validate_event_by_id ($id, $trash1 = null, $trash2 = null, $returnType = 'string') {
|
||||
global $config;
|
||||
$data['type'] = 'string';
|
||||
$check_id = db_get_value('id_evento', 'tevento', 'id_evento', $id);
|
||||
@ -11862,6 +11924,445 @@ function api_get_cluster_items ($cluster_id){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create an event filter.
|
||||
*
|
||||
* @param string $id Name of event filter to add.
|
||||
* @param $thrash1 Don't use.
|
||||
* @param array $other it's array, $other as param is<id_group_filter>;<id_group>;<event_type>;
|
||||
* <severity>;<event_status>;<free_search>;<agent_search_id>;<pagination_size>;<max_hours_old>;<id_user_ack>;<duplicate>;
|
||||
* <date_from>;<date_to>;<events_with_tags>;<events_without_tags>;<alert_events>;<module_search_id>;<source>;
|
||||
* <id_extra>;<user_comment> in this order
|
||||
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
*
|
||||
* example: api.php?op=set&op2=create_event_filter&id=test&other=||error|4|||1||12|||2018-12-09|2018-12-13|[%226%22]|[%2210%22,%226%22,%223%22]|1|10|||&other_mode=url_encode_separator_|
|
||||
*
|
||||
*
|
||||
* @param $thrash3 Don't use
|
||||
*/
|
||||
function api_set_create_event_filter($name, $thrash1, $other, $thrash3) {
|
||||
|
||||
if ($name == "") {
|
||||
returnError('error_create_event_filter',
|
||||
__('Error creating event filter. Event filter name cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$event_w = check_acl ($config['id_user'], 0, "EW");
|
||||
$event_m = check_acl ($config['id_user'], 0, "EM");
|
||||
$access = ($event_w == true) ? 'EW' : (($event_m == true) ? 'EM' : 'EW');
|
||||
|
||||
$event_filter_name = $name;
|
||||
|
||||
$user_groups = users_get_groups ($config['id_user'], "AR", true);
|
||||
|
||||
$id_group_filter = (array_key_exists($other['data'][0], $user_groups)) ? $other['data'][0] : 0;
|
||||
|
||||
$id_group = (array_key_exists($other['data'][1], $user_groups)) ? $other['data'][1] : 0;
|
||||
|
||||
$event_type = (array_key_exists($other['data'][2], get_event_types ()) || $other['data'][2]=='') ? $other['data'][2] : '';
|
||||
|
||||
$severity = (array_key_exists($other['data'][3], get_priorities()) || $other['data'][3]==-1) ? $other['data'][3] : -1;
|
||||
|
||||
$status = (array_key_exists($other['data'][4], events_get_all_status()) || $other['data'][4]==-1) ? $other['data'][4] : -1;
|
||||
|
||||
if (!is_numeric($other['data'][6]) || empty($other['data'][6])) {
|
||||
$text_agent = '';
|
||||
$id_agent = 0;
|
||||
}
|
||||
else {
|
||||
$filter = array ();
|
||||
|
||||
if ($id_group == 0)
|
||||
$filter['id_grupo'] = array_keys ($user_groups);
|
||||
else
|
||||
$filter['id_grupo'] = $id_group;
|
||||
|
||||
$filter[] = '(id_agente = '.$other["data"][6].')';
|
||||
$agent = agents_get_agents($filter, array ('id_agente'));
|
||||
|
||||
if ($agent === false)
|
||||
$text_agent = '';
|
||||
else {
|
||||
$sql = sprintf('SELECT alias
|
||||
FROM tagente
|
||||
WHERE id_agente = %d', $agent[0]['id_agente']);
|
||||
|
||||
$id_agent = $other["data"][6];
|
||||
$text_agent = db_get_value_sql($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$pagination = (in_array($other['data'][7], [20,25,50,100,200,500])) ? $other['data'][7] : 20;
|
||||
|
||||
$users = users_get_user_users($config['id_user'], $access, users_can_manage_group_all());
|
||||
|
||||
$id_user_ack = (in_array($other['data'][9], $users)) ? $other['data'][9] : 0;
|
||||
|
||||
$group_rep = ($other['data'][10] == 0 || $other['data'][10] == 1) ? $other['data'][10] : 0;
|
||||
|
||||
$date_from = (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$other['data'][11])) ? $other['data'][11] : '0000-00-00';
|
||||
|
||||
$date_to = (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$other['data'][12])) ? $other['data'][12] : '0000-00-00';
|
||||
|
||||
$tag_with = (preg_match('/^\[(("\d+"((,|\])("\d+"))+)|"\d+")\]$/', io_safe_output($other['data'][13]))) ? $other['data'][13] : '[]';
|
||||
|
||||
$tag_without = (preg_match('/^\[(("\d+"((,|\])("\d+"))+)|"\d+")\]$/', io_safe_output($other['data'][14]))) ? $other['data'][14] : '[]';
|
||||
|
||||
$filter_only_alert = (in_array($other['data'][15], [-1,0,1])) ? $other['data'][15] : -1;
|
||||
|
||||
if (!is_numeric($other['data'][16]) || empty($other['data'][16]))
|
||||
$id_agent_module = 0;
|
||||
else {
|
||||
$groups = array();
|
||||
|
||||
$groups = users_get_groups($config['id_user'], "AW", false);
|
||||
$groups = array_keys($groups);
|
||||
|
||||
if (empty($groups)) {
|
||||
$id_groups = 0;
|
||||
}
|
||||
else {
|
||||
$id_groups = implode(',', $groups);
|
||||
}
|
||||
|
||||
$agents = db_get_all_rows_sql('SELECT id_agente
|
||||
FROM tagente
|
||||
WHERE id_grupo IN (' . $id_groups . ')');
|
||||
|
||||
if ($agents === false) $agents = array();
|
||||
|
||||
$id_agents = array();
|
||||
foreach ($agents as $agent) {
|
||||
$id_agents[] = $agent['id_agente'];
|
||||
}
|
||||
|
||||
$filter = '(' . $other['data'][16] . ')';
|
||||
|
||||
$modules = agents_get_modules($id_agents, false,
|
||||
(array('tagente_modulo.id_agente_modulo in' => $filter)));
|
||||
|
||||
$id_agent_module = (array_key_exists($other['data'][16], $modules)) ? $other['data'][16] : 0;
|
||||
}
|
||||
|
||||
$values = array(
|
||||
'id_group_filter' => $id_group_filter,
|
||||
'id_group' => $id_group,
|
||||
'event_type' => $event_type,
|
||||
'severity' => $severity,
|
||||
'status' => $status,
|
||||
'search' => $other['data'][5],
|
||||
'text_agent' => $text_agent,
|
||||
'id_agent' => $id_agent,
|
||||
'pagination' => $pagination,
|
||||
'event_view_hr' => $other['data'][8],
|
||||
'id_user_ack' => $id_user_ack,
|
||||
'group_rep' => $group_rep,
|
||||
'date_from' => $date_from,
|
||||
'date_to' => $date_to,
|
||||
'tag_with' => $tag_with,
|
||||
'tag_without' => $tag_without,
|
||||
'filter_only_alert' => $filter_only_alert,
|
||||
'id_agent_module' => $id_agent_module,
|
||||
'source' => $other['data'][17],
|
||||
'id_extra' => $other['data'][18],
|
||||
'user_comment' => $other['data'][19]
|
||||
);
|
||||
|
||||
$values['id_name'] = $event_filter_name;
|
||||
|
||||
$id_filter = db_process_sql_insert('tevent_filter', $values);
|
||||
|
||||
if ($id_filter === false) {
|
||||
returnError('error_create_event_filter', __('Error creating event filter.'));
|
||||
}
|
||||
else {
|
||||
returnData('string', array('type' => 'string',
|
||||
'data' => __('Event filter successfully created.')));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an event filter. And return a message with the result of the operation.
|
||||
*
|
||||
* @param string $id_event_filter Id of the event filter to update.
|
||||
* @param $thrash1 Don't use.
|
||||
* @param array $other it's array, $other as param is <filter_name>;<id_group>;<event_type>;
|
||||
* <severity>;<event_status>;<free_search>;<agent_search_id>;<pagination_size>;<max_hours_old>;<id_user_ack>;<duplicate>;
|
||||
* <date_from>;<date_to>;<events_with_tags>;<events_without_tags>;<alert_events>;<module_search_id>;<source>;
|
||||
* <id_extra>;<user_comment> in this order
|
||||
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
*
|
||||
* example:
|
||||
*
|
||||
* api.php?op=set&op2=update_event_filter&id=198&other=new_name|||alert_recovered|||||||||||||||||&other_mode=url_encode_separator_%7C
|
||||
*
|
||||
* @param $thrash3 Don't use
|
||||
*/
|
||||
function api_set_update_event_filter($id_event_filter, $thrash1, $other, $thrash3) {
|
||||
global $config;
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "LM")) {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id_event_filter == "") {
|
||||
returnError('error_update_event_filter',
|
||||
__('Error updating event filter. Event filter ID cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM tevent_filter WHERE id_filter=$id_event_filter";
|
||||
$result_event_filter = db_get_row_sql($sql);
|
||||
|
||||
if (!$result_event_filter) {
|
||||
returnError('error_update_event_filter',
|
||||
__('Error updating event filter. Event filter ID doesn\'t exist.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array();
|
||||
|
||||
for ($i=0; $i<21; $i++) {
|
||||
if ($other['data'][$i] != "") {
|
||||
switch ($i) {
|
||||
case 0:
|
||||
$values['id_name'] = $other['data'][0];
|
||||
break;
|
||||
case 1:
|
||||
$user_groups = users_get_groups ($config['id_user'], "AR", true);
|
||||
$values['id_group_filter'] = (array_key_exists($other['data'][1], $user_groups)) ? $other['data'][1] : 0;
|
||||
break;
|
||||
case 2:
|
||||
$user_groups = users_get_groups ($config['id_user'], "AR", true);
|
||||
$values['id_group'] = (array_key_exists($other['data'][2], $user_groups)) ? $other['data'][2] : 0;
|
||||
break;
|
||||
case 3:
|
||||
$values['event_type'] = (array_key_exists($other['data'][3], get_event_types ()) || $other['data'][3]=='') ? $other['data'][3] : '';
|
||||
break;
|
||||
case 4:
|
||||
$values['severity'] = (array_key_exists($other['data'][4], get_priorities()) || $other['data'][4]==-1) ? $other['data'][4] : -1;
|
||||
break;
|
||||
case 5:
|
||||
$values['status'] = (array_key_exists($other['data'][5], events_get_all_status()) || $other['data'][5]==-1) ? $other['data'][5] : -1;
|
||||
break;
|
||||
case 6:
|
||||
$values['search'] = $other['data'][6];
|
||||
break;
|
||||
case 7:
|
||||
$user_groups = users_get_groups ($config['id_user'], "AR", true);
|
||||
|
||||
if (!is_numeric($other['data'][7]) || empty($other['data'][7])) {
|
||||
$values['text_agent'] = '';
|
||||
$values['id_agent'] = 0;
|
||||
}
|
||||
else {
|
||||
|
||||
$filter = array ();
|
||||
|
||||
if ($id_group == 0)
|
||||
$filter['id_grupo'] = array_keys ($user_groups);
|
||||
else
|
||||
$filter['id_grupo'] = $id_group;
|
||||
|
||||
$filter[] = '(id_agente = '.$other["data"][7].')';
|
||||
$agent = agents_get_agents($filter, array ('id_agente'));
|
||||
|
||||
if ($agent === false)
|
||||
$values['text_agent'] = '';
|
||||
else {
|
||||
$sql = sprintf('SELECT alias
|
||||
FROM tagente
|
||||
WHERE id_agente = %d', $agent[0]['id_agente']);
|
||||
|
||||
$values['id_agent'] = $other["data"][7];
|
||||
$values['text_agent'] = db_get_value_sql($sql);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
$values['pagination'] = (in_array($other['data'][8], [20,25,50,100,200,500])) ? $other['data'][8] : 20;
|
||||
break;
|
||||
case 9:
|
||||
$values['event_view_hr'] = $other['data'][9];
|
||||
break;
|
||||
case 10:
|
||||
|
||||
$event_w = check_acl ($config['id_user'], 0, "EW");
|
||||
$event_m = check_acl ($config['id_user'], 0, "EM");
|
||||
$access = ($event_w == true) ? 'EW' : (($event_m == true) ? 'EM' : 'EW');
|
||||
|
||||
$users = users_get_user_users($config['id_user'], $access, users_can_manage_group_all());
|
||||
|
||||
$values['id_user_ack'] = (in_array($other['data'][10], $users)) ? $other['data'][10] : 0;
|
||||
break;
|
||||
case 11:
|
||||
$values['group_rep'] = ($other['data'][11] == 0 || $other['data'][11] == 1) ? $other['data'][11] : 0;
|
||||
break;
|
||||
case 12:
|
||||
$values['date_from'] = (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$other['data'][12])) ? $other['data'][12] : '0000-00-00';
|
||||
break;
|
||||
case 13:
|
||||
$values['date_to'] = (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$other['data'][13])) ? $other['data'][13] : '0000-00-00';
|
||||
break;
|
||||
case 14:
|
||||
print_r("14444444");
|
||||
$values['tag_with'] = (preg_match('/^\[(("\d+"((,|\])("\d+"))+)|"\d+")\]$/', io_safe_output($other['data'][14]))) ? $other['data'][14] : '[]';
|
||||
break;
|
||||
case 15:
|
||||
print_r("1555555555");
|
||||
$values['tag_without'] = (preg_match('/^\[(("\d+"((,|\])("\d+"))+)|"\d+")\]$/', io_safe_output($other['data'][15]))) ? $other['data'][15] : '[]';
|
||||
break;
|
||||
case 16:
|
||||
$values['filter_only_alert'] = (in_array($other['data'][16], [-1,0,1])) ? $other['data'][16] : -1;
|
||||
break;
|
||||
case 17:
|
||||
if (!is_numeric($other['data'][17]) || empty($other['data'][17]))
|
||||
$values['id_agent_module'] = 0;
|
||||
else {
|
||||
$groups = array();
|
||||
|
||||
$groups = users_get_groups($config['id_user'], "AW", false);
|
||||
$groups = array_keys($groups);
|
||||
|
||||
if (empty($groups)) {
|
||||
$id_groups = 0;
|
||||
}
|
||||
else {
|
||||
$id_groups = implode(',', $groups);
|
||||
}
|
||||
|
||||
$agents = db_get_all_rows_sql('SELECT id_agente
|
||||
FROM tagente
|
||||
WHERE id_grupo IN (' . $id_groups . ')');
|
||||
|
||||
if ($agents === false) $agents = array();
|
||||
|
||||
$id_agents = array();
|
||||
foreach ($agents as $agent) {
|
||||
$id_agents[] = $agent['id_agente'];
|
||||
}
|
||||
|
||||
$filter = '(' . $other['data'][17] . ')';
|
||||
|
||||
$modules = agents_get_modules($id_agents, false,
|
||||
(array('tagente_modulo.id_agente_modulo in' => $filter)));
|
||||
|
||||
$values['id_agent_module'] = (array_key_exists($other['data'][17], $modules)) ? $other['data'][17] : 0;
|
||||
}
|
||||
break;
|
||||
case 18:
|
||||
$values['source'] = $other['data'][18];
|
||||
break;
|
||||
case 19:
|
||||
$values['id_extra'] = $other['data'][19];
|
||||
break;
|
||||
case 20:
|
||||
print_r("adadadasds");
|
||||
$values['user_comment'] = $other['data'][20];
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result = db_process_sql_update ('tevent_filter',
|
||||
$values,
|
||||
array ('id_filter' => $id_event_filter));
|
||||
|
||||
if ($result === false) {
|
||||
returnError('error_update_event_filter', __('Error updating event filter.'));
|
||||
}
|
||||
else {
|
||||
returnData('string', array('type' => 'string',
|
||||
'data' => __('Event filter successfully updated.')));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete an event filter. And return a message with the result of the operation.
|
||||
*
|
||||
* @param string $id_template Id of the event filter to delete.
|
||||
* @param $thrash1 Don't use.
|
||||
* @param array $other Don't use
|
||||
*
|
||||
* example:
|
||||
*
|
||||
* api.php?op=set&op2=delete_event_filter&id=38
|
||||
*
|
||||
* @param $thrash3 Don't use
|
||||
*/
|
||||
function api_set_delete_event_filter($id_event_filter, $thrash1, $other, $thrash3) {
|
||||
|
||||
if ($id_event_filter == "") {
|
||||
returnError('error_delete_event_filter',
|
||||
__('Error deleting event_filter. Event filter ID cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$result = db_process_sql_delete ('tevent_filter',array('id_filter' => $id_event_filter));
|
||||
|
||||
if ($result == 0) {
|
||||
returnError('error_delete_event_filter',
|
||||
__('Error deleting event filter.'));
|
||||
}
|
||||
else {
|
||||
returnData('string', array('type' => 'string',
|
||||
'data' => __('Event filter successfully deleted.')));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all event filters, and print all the result like a csv.
|
||||
*
|
||||
* @param $thrash1 Don't use.
|
||||
* @param $thrash2 Don't use.
|
||||
* @param array $other it's array, but only <csv_separator> is available.
|
||||
* example:
|
||||
*
|
||||
* api.php?op=get&op2=all_event_filters&return_type=csv&other=;
|
||||
*
|
||||
* @param $thrash3 Don't use.
|
||||
*/
|
||||
function api_get_all_event_filters($thrash1, $thrash2, $other, $thrash3) {
|
||||
global $config;
|
||||
|
||||
if (!isset($other['data'][0]))
|
||||
$separator = ';'; // by default
|
||||
else
|
||||
$separator = $other['data'][0];
|
||||
|
||||
if (!check_acl($config["id_user"], 0, "LM")) {
|
||||
returnError("forbidden", "csv");
|
||||
return;
|
||||
}
|
||||
|
||||
$filter = false;
|
||||
|
||||
$sql = "SELECT * FROM tevent_filter";
|
||||
$event_filters = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($event_filters !== false) {
|
||||
$data['type'] = 'array';
|
||||
$data['data'] = $event_filters;
|
||||
}
|
||||
|
||||
if (!$event_filters) {
|
||||
returnError('error_get_all_event_filters',
|
||||
__('Error getting all event filters.'));
|
||||
}
|
||||
else {
|
||||
returnData('csv', $data, $separator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// AUX FUNCTIONS
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
@ -11881,6 +12382,231 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access =
|
||||
return false;
|
||||
}
|
||||
|
||||
function api_get_user_info($thrash1, $thrash2, $other, $returnType) {
|
||||
|
||||
$separator = ';';
|
||||
|
||||
$other = json_decode(base64_decode($other['data']),true);
|
||||
|
||||
$sql = 'select * from tusuario where id_user = "'.$other[0]['id_user'].'" and password = "'.$other[0]['password'].'"';
|
||||
|
||||
$user_info = db_get_all_rows_sql($sql);
|
||||
|
||||
if (count($user_info) > 0 and $user_info !== false) {
|
||||
$data = array('type' => 'array', 'data' => $user_info);
|
||||
returnData($returnType, $data, $separator);
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
This function receives different parameters to process one of these actions the logging process in our application from the records in the audit of pandora fms, to avoid concurrent access of administrator users, and optionally to prohibit access to non-administrator users:
|
||||
|
||||
Parameter 0
|
||||
|
||||
The User ID that attempts the action is used to check the status of the application for access.
|
||||
|
||||
Parameter 1
|
||||
|
||||
Login, logout, exclude, browse.
|
||||
|
||||
These requests receive a response that we can treat as we consider, this function only sends answers, does not perform any action in your application, you must customize them.
|
||||
|
||||
Login action: free (register our access), taken, denied (if you are not an administrator user and parameter four is set to 1, register the expulsion).
|
||||
|
||||
Browse action: It has the same answers as login, but does not register anything in the audit.
|
||||
|
||||
Logout action: It records the deslogeo but does not send a response.
|
||||
|
||||
All other actions do not return a response,
|
||||
|
||||
Parameter 2
|
||||
|
||||
IP address of the application is also used to check the status of the application for access.
|
||||
|
||||
Parameter 3
|
||||
|
||||
Name of the application, it is also used to check the status of the application for access.
|
||||
|
||||
Parameter 4
|
||||
|
||||
If you mark 1 you will avoid the access to the non-administrators users, returning the response `denied' and registering that expulsion in the audit of pandora fms.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function api_set_access_process($thrash1, $thrash2, $other, $returnType) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$other['data'] = explode('|',$other['data']);
|
||||
|
||||
$sql = 'select id_usuario,utimestamp from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logon%" and id_usuario IN (select id_user from tusuario where is_admin = 1) and id_usuario != "'.$other['data'][0].'" order by utimestamp DESC limit 1';
|
||||
$audit_concurrence = db_get_all_rows_sql($sql);
|
||||
$sql_user = 'select id_usuario,utimestamp from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logon%" and id_usuario IN (select id_user from tusuario where is_admin = 1) and id_usuario = "'.$other['data'][0].'" order by utimestamp DESC limit 1';
|
||||
$audit_concurrence_user = db_get_all_rows_sql($sql_user);
|
||||
$sql2 = 'select id_usuario,utimestamp,accion from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logoff%" and id_usuario = "'.$audit_concurrence[0]['id_usuario'].'" order by utimestamp DESC limit 1';
|
||||
$audit_concurrence_2 = db_get_all_rows_sql($sql2);
|
||||
|
||||
//The user trying to log in is an administrator
|
||||
if(users_is_admin($other['data'][0])){
|
||||
//The admin user is trying to login
|
||||
if($other['data'][1] == 'login'){
|
||||
// Check if there is an administrator user logged in prior to our last login
|
||||
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_user[0]['utimestamp']){
|
||||
// Check if the administrator user logged in later to us has unlogged and left the node free
|
||||
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_2[0]['utimestamp']){
|
||||
// The administrator user logged in later has not yet unlogged
|
||||
returnData('string', array('type' => 'string', 'data' => 'taken'));
|
||||
}
|
||||
else{
|
||||
// The administrator user logged in later has already unlogged
|
||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
||||
}
|
||||
}
|
||||
else{
|
||||
// There is no administrator user who has logged in since then to log us in.
|
||||
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($other['data'][1] == 'logout') {
|
||||
// The administrator user wants to log out
|
||||
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]);
|
||||
}
|
||||
elseif ($other['data'][1] == 'exclude') {
|
||||
// The administrator user has ejected another administrator user who was logged in
|
||||
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
||||
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2] , $audit_concurrence[0]['id_usuario']);
|
||||
|
||||
}
|
||||
//The admin user is trying to browse
|
||||
elseif ($other['data'][1] == 'browse') {
|
||||
// Check if there is an administrator user logged in prior to our last login
|
||||
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_user[0]['utimestamp']){
|
||||
// Check if the administrator user logged in later to us has unlogged and left the node free
|
||||
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_2[0]['utimestamp']){
|
||||
// The administrator user logged in later has not yet unlogged
|
||||
returnData('string', array('type' => 'string', 'data' => $audit_concurrence[0]['id_usuario']));
|
||||
}
|
||||
else{
|
||||
// The administrator user logged in later has already unlogged
|
||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
||||
}
|
||||
}
|
||||
else{
|
||||
// There is no administrator user who has logged in since then to log us in.
|
||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($other['data'][1] == 'cancelled'){
|
||||
//The administrator user tries to log in having another administrator logged in, but instead of expelling him he cancels his log in.
|
||||
db_pandora_audit($other['data'][3].' cancelled access', 'Cancelled access in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
||||
returnData('string', array('type' => 'string', 'data' => 'cancelled'));
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
if($other['data'][4] == 1){
|
||||
//The user trying to log in is not an administrator and is not allowed no admin access
|
||||
db_pandora_audit($other['data'][3].' denied access', 'Denied access to non-admin user '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
||||
returnData('string', array('type' => 'string', 'data' => 'denied'));
|
||||
}
|
||||
else{
|
||||
//The user trying to log in is not an administrator and is allowed no admin access
|
||||
if($other['data'][1] == 'login'){
|
||||
//The user trying to login is not admin, can enter without concurrent use filter
|
||||
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
||||
|
||||
}
|
||||
elseif ($other['data'][1] == 'logout') {
|
||||
//The user trying to logoff is not admin
|
||||
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]);
|
||||
}
|
||||
elseif ($other['data'][1] == 'browse'){
|
||||
//The user trying to browse in an app page is not admin, can enter without concurrent use filter
|
||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function api_get_traps($thrash1, $thrash2, $other, $returnType) {
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$other['data'] = explode('|',$other['data']);
|
||||
|
||||
$other['data'][1] = date("Y-m-d H:i:s",$other['data'][1]);
|
||||
|
||||
$sql = 'SELECT * from ttrap where timestamp >= "'.$other['data'][1].'"';
|
||||
|
||||
// $sql = 'SELECT * from ttrap where source = "'.$other['data'][0].'" and timestamp >= "'.$other['data'][1].'"';
|
||||
|
||||
if($other['data'][4]){
|
||||
$other['data'][4] = date("Y-m-d H:i:s",$other['data'][4]);
|
||||
$sql .= ' and timestamp <= "'.$other['data'][4].'"';
|
||||
}
|
||||
|
||||
if($other['data'][2]){
|
||||
$sql .= ' limit '.$other['data'][2];
|
||||
}
|
||||
|
||||
if($other['data'][3]){
|
||||
$sql .= ' offset '.$other['data'][3];
|
||||
}
|
||||
|
||||
if($other['data'][5]){
|
||||
$sql .= ' and status = 0';
|
||||
}
|
||||
|
||||
if(sizeof($other['data']) == 0){
|
||||
$sql = 'SELECT * from ttrap';
|
||||
}
|
||||
|
||||
|
||||
$traps = db_get_all_rows_sql($sql);
|
||||
|
||||
if($other['data'][6]){
|
||||
|
||||
foreach ($traps as $key => $value) {
|
||||
|
||||
if(!strpos($value['oid_custom'],$other['data'][6]) && $other['data'][7] == 'false'){
|
||||
unset($traps[$key]);
|
||||
}
|
||||
|
||||
if(strpos($value['oid_custom'],$other['data'][6]) && $other['data'][7] == 'true'){
|
||||
unset($traps[$key]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$traps_json = json_encode($traps);
|
||||
|
||||
if (count($traps) > 0 and $traps !== false) {
|
||||
returnData('string', array('type' => 'string', 'data' => $traps_json));
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
@ -11930,6 +12656,8 @@ function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function api_get_group_id_by_name($thrash1, $thrash2, $other, $thrash3) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
@ -12016,7 +12744,6 @@ function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function api_get_users($thrash1, $thrash2, $other, $returnType) {
|
||||
|
||||
global $config;
|
||||
@ -12042,8 +12769,4 @@ function api_get_users($thrash1, $thrash2, $other, $returnType) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
@ -312,6 +312,8 @@ function config_update_config () {
|
||||
$error_update[] = __('Autocreate profile group');
|
||||
if (!config_update_value ('default_assign_tags', implode(",",get_parameter ('default_assign_tags'))))
|
||||
$error_update[] = __('Autocreate profile tags');
|
||||
if (!config_update_value ('default_no_hierarchy', (int)get_parameter ('default_no_hierarchy')))
|
||||
$error_update[] = __('Automatically assigned no hierarchy');
|
||||
if (!config_update_value ('autocreate_blacklist', get_parameter ('autocreate_blacklist')))
|
||||
$error_update[] = __('Autocreate blacklist');
|
||||
|
||||
@ -1452,6 +1454,9 @@ function config_process_config () {
|
||||
if (!isset ($config['default_assign_tags'])) {
|
||||
config_update_value ( 'default_assign_tags', '');
|
||||
}
|
||||
if (!isset ($config['default_no_hierarchy'])) {
|
||||
config_update_value ('default_no_hierarchy', 0);
|
||||
}
|
||||
|
||||
if (!isset ($config['ldap_server'])) {
|
||||
config_update_value ( 'ldap_server', 'localhost');
|
||||
|
@ -441,7 +441,7 @@ function groups_get_all($groupWithAgents = false) {
|
||||
* Get all groups recursive from an initial group.
|
||||
*
|
||||
* @param int Id of the parent group
|
||||
* @param bool Whether to return All group or not
|
||||
* @param bool Whether to force recursive search ignoring propagation (true) or not (false)
|
||||
*
|
||||
* @return Array with all result groups
|
||||
*/
|
||||
@ -451,10 +451,11 @@ function groups_get_id_recursive($id_parent, $all = false) {
|
||||
$return = array_merge($return, array($id_parent));
|
||||
|
||||
//Check propagate
|
||||
$id = db_get_value_filter('id_grupo', 'tgrupo', array('id_grupo' => $id_parent, 'propagate' => 1));
|
||||
$propagate = db_get_value_filter('propagate', 'tgrupo', array('id_grupo' => $id_parent));
|
||||
|
||||
if (($id !== false) || $all) {
|
||||
if (($propagate != 1) || $all) {
|
||||
$children = db_get_all_rows_filter("tgrupo", array('parent' => $id_parent, 'disabled' => 0), array('id_grupo'));
|
||||
|
||||
if ($children === false) {
|
||||
$children = array();
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ function groupview_get_modules_counters($groups_ids = false) {
|
||||
ta.id_grupo AS g
|
||||
FROM $table ta
|
||||
WHERE ta.id_grupo IN ($groups_ids)
|
||||
AND ta.disabled = 0
|
||||
GROUP BY ta.id_grupo
|
||||
UNION ALL
|
||||
SELECT SUM(ta.normal_count) AS module_normal,
|
||||
|
@ -735,8 +735,11 @@ function html_print_extended_select_for_post_process($name, $selected = '',
|
||||
$selected_float = (float)$selected;
|
||||
$found = false;
|
||||
|
||||
if (array_key_exists(number_format($selected, 14, '.', ','), $fields))
|
||||
if($selected){
|
||||
if (array_key_exists(number_format($selected, 14, '.', ','), $fields)) {
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
$fields[$selected] = floatval($selected);
|
||||
@ -1017,7 +1020,7 @@ function html_print_input_text_extended ($name, $value, $id, $alt, $size, $maxle
|
||||
++$idcounter;
|
||||
|
||||
$valid_attrs = array ("accept", "disabled", "maxlength",
|
||||
"name", "readonly", "size", "value", "accesskey",
|
||||
"name", "readonly", "placeholder", "size", "value", "accesskey",
|
||||
"class", "dir", "id", "lang", "style", "tabindex",
|
||||
"title", "xml:lang", "onfocus", "onblur", "onselect",
|
||||
"onchange", "onclick", "ondblclick", "onmousedown",
|
||||
|
@ -375,8 +375,8 @@ function __ ($string /*, variable arguments */) {
|
||||
global $config;
|
||||
static $extensions_cache = array();
|
||||
|
||||
if( !isset($config["id_user"]) && count($extensions_cache) > 0 ) {
|
||||
if (array_key_exists($config["id_user"], $extensions_cache)) {
|
||||
if( isset($config["id_user"]) ) {
|
||||
if ( count($extensions_cache) > 0 && array_key_exists($config["id_user"], $extensions_cache)) {
|
||||
$extensions = $extensions_cache[$config["id_user"]];
|
||||
}
|
||||
else {
|
||||
@ -385,8 +385,9 @@ function __ ($string /*, variable arguments */) {
|
||||
}
|
||||
}
|
||||
else{
|
||||
$extension =null;
|
||||
$extensions=null;
|
||||
}
|
||||
|
||||
if (empty($extensions))
|
||||
$extensions = array();
|
||||
|
||||
|
@ -79,15 +79,11 @@ function profile_create_user_profile ($id_user,
|
||||
$tags = '',
|
||||
$no_hierarchy = false
|
||||
) {
|
||||
|
||||
global $config;
|
||||
|
||||
if (empty ($id_profile) || $id_group < 0)
|
||||
return false;
|
||||
|
||||
// Secondary server is an enterprise function
|
||||
if (!enterprise_installed() && $no_hierarchy) return false;
|
||||
|
||||
// Checks if the user exists
|
||||
$result_user = users_get_user_by_id($id_user);
|
||||
|
||||
|
@ -278,6 +278,11 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
|
||||
));
|
||||
$salida = ui_get_snapshot_image($link, $is_snapshot) . ' ';
|
||||
}
|
||||
|
||||
if($salida !== NULL){
|
||||
$last_data_str = html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px'));
|
||||
}
|
||||
|
||||
$last_data_str .= $salida;
|
||||
}
|
||||
else {
|
||||
|
@ -362,10 +362,11 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark,
|
||||
tickFormatter: xFormatter,
|
||||
},
|
||||
yaxis: {
|
||||
color: tick_color,
|
||||
axisLabelUseCanvas: true,
|
||||
axisLabelFontSizePixels: font_size,
|
||||
axisLabelFontFamily: font+'Font',
|
||||
font: {
|
||||
size: font_size + 2,
|
||||
color: 'rgb(84, 84, 84)',
|
||||
family: font+'Font'
|
||||
},
|
||||
ticks: yFormatter,
|
||||
},
|
||||
legend: {
|
||||
@ -417,7 +418,7 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark,
|
||||
div_attributes += "min-height: 2.5em;";
|
||||
}
|
||||
|
||||
div_attributes += '" title="'+title+'" class="'+font+'" '+ ' style="overflow: hidden;"';
|
||||
div_attributes += '" title="'+title+'" style="overflow: hidden;"';
|
||||
|
||||
format.push([i,'<div ' + div_attributes + '>'
|
||||
+ label
|
||||
|
@ -412,11 +412,11 @@ function flot_pie_chart ($values, $labels, $width, $height, $water_mark,
|
||||
include_javascript_dependencies_flot_graph();
|
||||
|
||||
$return .= "<script type='text/javascript'>";
|
||||
|
||||
$return .= "$(document).ready( function () {";
|
||||
$return .= "pandoraFlotPie('$graph_id', '$values', '$labels',
|
||||
'$series', '$width', $font_size, $water_mark, '$separator',
|
||||
'$legend_position', '$height', '$colors', " . json_encode($hide_labels) . ")";
|
||||
|
||||
$return .= "});";
|
||||
$return .= "</script>";
|
||||
|
||||
return $return;
|
||||
@ -476,11 +476,11 @@ function flot_custom_pie_chart ($graph_values,
|
||||
$colors = implode($separator, $temp_colors);
|
||||
|
||||
$return .= "<script type='text/javascript'>";
|
||||
|
||||
$return .= "$(document).ready( function () {";
|
||||
$return .= "pandoraFlotPieCustom('$graph_id', '$values', '$labels',
|
||||
'$width', $font_size, '$fontpath', $water_mark,
|
||||
'$separator', '$legend_position', '$height', '$colors','$legend','$background_color')";
|
||||
|
||||
$return .= "});";
|
||||
$return .= "</script>";
|
||||
|
||||
return $return;
|
||||
@ -577,10 +577,10 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font =
|
||||
|
||||
// Javascript code
|
||||
$return .= "<script type='text/javascript'>";
|
||||
|
||||
$return .= "$(document).ready( function () {";
|
||||
$return .= "pandoraFlotHBars('$graph_id', '$values', '$labels',
|
||||
false, $max, '$water_mark', '$separator', '$separator2', '$font', $font_size, '$background_color', '$tick_color', $val_min, $val_max)";
|
||||
|
||||
$return .= "});";
|
||||
$return .= "</script>";
|
||||
|
||||
return $return;
|
||||
@ -668,7 +668,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
|
||||
|
||||
// Javascript code
|
||||
$return .= "<script type='text/javascript'>";
|
||||
|
||||
$return .= "$(document).ready( function () {";
|
||||
if ($from_ux) {
|
||||
if($from_wux){
|
||||
$return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, true, '$background_color', '$tick_color')";
|
||||
@ -680,7 +680,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
|
||||
else {
|
||||
$return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, false, false, '$background_color', '$tick_color')";
|
||||
}
|
||||
|
||||
$return .= "});";
|
||||
$return .= "</script>";
|
||||
|
||||
return $return;
|
||||
@ -843,7 +843,9 @@ function flot_slicesbar_graph (
|
||||
// Javascript code
|
||||
$return .= "<script type='text/javascript'>";
|
||||
$return .= "//<![CDATA[\n";
|
||||
$return .= "$(document).ready( function () {";
|
||||
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$labels','$legend','$acumulate_data',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive, '$show')";
|
||||
$return .= "});";
|
||||
$return .= "\n//]]>";
|
||||
$return .= "</script>";
|
||||
|
||||
|
@ -1332,7 +1332,7 @@ function print_phases_donut (recipient, phases) {
|
||||
var svg = d3.select(recipient)
|
||||
.append("svg")
|
||||
.attr("width", 800)
|
||||
.attr("height", 400)
|
||||
.attr("height", 500)
|
||||
.append("g");
|
||||
|
||||
svg.append("g")
|
||||
@ -1361,7 +1361,7 @@ function print_phases_donut (recipient, phases) {
|
||||
.outerRadius(radius * 0.9);
|
||||
|
||||
width = 800;
|
||||
height = 400;
|
||||
height = 500;
|
||||
svg.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
|
||||
|
||||
var key = function(d){ return d.data.label; };
|
||||
@ -1440,6 +1440,8 @@ function print_phases_donut (recipient, phases) {
|
||||
return d.startAngle + (d.endAngle - d.startAngle)/2;
|
||||
}
|
||||
|
||||
var ex = 1;
|
||||
var sum = 0;
|
||||
text.transition().duration(0)
|
||||
.attrTween("transform", function(d) {
|
||||
this._current = this._current || d;
|
||||
@ -1447,8 +1449,26 @@ function print_phases_donut (recipient, phases) {
|
||||
this._current = interpolate(0);
|
||||
return function(t) {
|
||||
var d2 = interpolate(t);
|
||||
|
||||
//fix for labels of a very small portion increase the
|
||||
//height of the label so that they do not overlap
|
||||
if( ( d2.endAngle - d2.startAngle ) < 0.1){
|
||||
var pos = outerArc.centroid(d2);
|
||||
if (ex%2==0){
|
||||
pos[0] = 150;
|
||||
}
|
||||
else{
|
||||
pos[0] = -150;
|
||||
sum++;
|
||||
}
|
||||
pos[1] = pos[1] - (35*sum);
|
||||
ex++;
|
||||
}
|
||||
else{
|
||||
var pos = outerArc.centroid(d2);
|
||||
pos[0] = radius * (midAngle(d2) < Math.PI ? 1 : -1);
|
||||
}
|
||||
|
||||
return "translate("+ pos +")";
|
||||
};
|
||||
})
|
||||
@ -1458,6 +1478,17 @@ function print_phases_donut (recipient, phases) {
|
||||
this._current = interpolate(0);
|
||||
return function(t) {
|
||||
var d2 = interpolate(t);
|
||||
|
||||
//fix for labels of a very small portion increase the
|
||||
//height of the label so that they do not overlap
|
||||
if( ( d2.endAngle - d2.startAngle ) < 0.1){
|
||||
if (ex%2==0){
|
||||
return "start";
|
||||
}
|
||||
else{
|
||||
return "end";
|
||||
}
|
||||
}
|
||||
return midAngle(d2) < Math.PI ? "start":"end";
|
||||
};
|
||||
});
|
||||
@ -1472,6 +1503,8 @@ function print_phases_donut (recipient, phases) {
|
||||
polyline.enter()
|
||||
.append("polyline");
|
||||
|
||||
var ex2 = 1;
|
||||
var sum2 = 0;
|
||||
polyline.transition().duration(0)
|
||||
.attrTween("points", function(d){
|
||||
this._current = this._current || d;
|
||||
@ -1479,8 +1512,25 @@ function print_phases_donut (recipient, phases) {
|
||||
this._current = interpolate(0);
|
||||
return function(t) {
|
||||
var d2 = interpolate(t);
|
||||
|
||||
//fix for labels of a very small portion increase the
|
||||
//height of the label so that they do not overlap
|
||||
if( ( d2.endAngle - d2.startAngle ) < 0.1){
|
||||
var pos = outerArc.centroid(d2);
|
||||
if (ex2%2==0){
|
||||
pos[0] = 150 * 0.95;
|
||||
}
|
||||
else{
|
||||
pos[0] = -150 * 0.95;
|
||||
sum2++;
|
||||
}
|
||||
pos[1] = pos[1] - (30*sum2);
|
||||
ex2++;
|
||||
}
|
||||
else{
|
||||
var pos = outerArc.centroid(d2);
|
||||
pos[0] = radius * 0.95 * (midAngle(d2) < Math.PI ? 1 : -1);
|
||||
}
|
||||
return [arc.centroid(d2), outerArc.centroid(d2), pos];
|
||||
};
|
||||
})
|
||||
|
@ -31,10 +31,10 @@ Hidden this macros because they cannot edit in the module form
|
||||
-->
|
||||
|
||||
<li>_plugin_parameters_ : Plug-in Parameters of the module.</li>
|
||||
<li>_name_tag_ : Nombre de los tags asociados al módulo.</li>
|
||||
<li>_email_tag_ : Emails asociados a los tags de módulos.</li>
|
||||
<li>_phone_tag_ : Teléfonos asociados a los tags de módulos.</li>
|
||||
<li>_moduletags_ : Teléfonos asociados a los tags de módulos.</li>
|
||||
<li>_name_tag_ : Names of the tags associated to the module.</li>
|
||||
<li>_email_tag_ : Emails associated to module tags.</li>
|
||||
<li>_phone_tag_ : Phone numbers associated to module tags.</li>
|
||||
<li>_moduletags_ : URLs associated to module tags.</li>
|
||||
<li>_agentcustomfield_<i>n</i>_: Agent custom field number <i>n</i> (eg. _agentcustomfield_9_).</li>
|
||||
</ul>
|
||||
<p>
|
||||
|
@ -30,9 +30,9 @@ Hidden this macros because they cannot edit in the module form
|
||||
-->
|
||||
|
||||
<li>_plugin_parameters_ : Parámetros del Plug-in del módulo.</li>
|
||||
<li>_name_tag_ : Names of the tags associated to the module.</li>
|
||||
<li>_email_tag_ : Emails associated to the module tags.</li>
|
||||
<li>_phone_tag_ : Phone numbers associated to the module tags.</li>
|
||||
<li>_moduletags_ : URLs associated to the module tags.</li>
|
||||
<li>_name_tag_ : Nombre de los tags asociados al módulo.</li>
|
||||
<li>_email_tag_ : Emails asociados a los tags de módulos.</li>
|
||||
<li>_phone_tag_ : Teléfonos asociados a los tags de módulos.</li>
|
||||
<li>_moduletags_ : URLs asociadas a los tags de módulos.</li>
|
||||
<li>_agentcustomfield_<i>n</i>_: Campo personalizado número <i>n</i> del agente (eg. _agentcustomfield_9_). </li>
|
||||
</ul>
|
||||
|
@ -26,7 +26,8 @@
|
||||
|
||||
$.fn.showMessage = function (msg) {
|
||||
return $(this).hide ().empty ()
|
||||
.text (msg)
|
||||
// here, previously .text (msg)
|
||||
.html (msg)
|
||||
.slideDown ();
|
||||
};
|
||||
}) (jQuery);
|
||||
|
@ -594,12 +594,51 @@ function post_process_select_init_unit(name,selected) {
|
||||
function post_process_select_events_unit(name,selected) {
|
||||
|
||||
$('.' + name + '_toggler').click(function() {
|
||||
$('#' + name + '_select option[value=none]').attr("selected",true);
|
||||
$('#text-' + name + '_text').val("");
|
||||
var value = $('#text-' + name + '_text').val();
|
||||
|
||||
var count = $('#' + name + '_select option')
|
||||
.filter(function(i, item) {
|
||||
|
||||
if ($(item).val() == value)
|
||||
return true;
|
||||
else return false;
|
||||
})
|
||||
.length;
|
||||
|
||||
if (count != 1) {
|
||||
$('#' + name + '_select')
|
||||
.append($("<option>").val(value).text(value));
|
||||
|
||||
}
|
||||
|
||||
$('#' + name + '_select option')
|
||||
.filter(function(i, item) {
|
||||
|
||||
if ($(item).val() == value)
|
||||
return true;
|
||||
else return false;
|
||||
})
|
||||
.prop("selected", true);
|
||||
|
||||
toggleBoth(name);
|
||||
$('#text-' + name + '_text').focus();
|
||||
});
|
||||
|
||||
// When select a default period, is setted in seconds
|
||||
$('#' + name + '_select').change(function() {
|
||||
var value = $('#' + name + '_select').val();
|
||||
|
||||
$('.' + name).val(value);
|
||||
$('#text-' + name + '_text').val(value);
|
||||
});
|
||||
|
||||
$('#text-' + name + '_text').keyup (function () {
|
||||
var value = $('#text-' + name + '_text').val();
|
||||
$('.' + name).val(value);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function post_process_select_events(name) {
|
||||
$('.' + name + '_toggler').click(function() {
|
||||
var value = $('#text-' + name + '_text').val();
|
||||
|
@ -158,6 +158,7 @@ function show_response_dialog(event_id, response_id, response) {
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("dialogue_event_response=1");
|
||||
params.push("massive=0");
|
||||
params.push("event_id="+event_id);
|
||||
params.push("target="+response['target']);
|
||||
params.push("response_id="+response_id);
|
||||
@ -187,6 +188,57 @@ function show_response_dialog(event_id, response_id, response) {
|
||||
});
|
||||
}
|
||||
|
||||
//Show the modal window of event responses when multiple events are selected
|
||||
function show_massive_response_dialog(event_id, response_id, response, out_iterator, end) {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("dialogue_event_response=1");
|
||||
params.push("massive=1");
|
||||
params.push("end="+end);
|
||||
params.push("out_iterator="+out_iterator);
|
||||
params.push("event_id="+event_id);
|
||||
params.push("target="+response['target']);
|
||||
params.push("response_id="+response_id);
|
||||
|
||||
|
||||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
response_tg: response['target'],
|
||||
response_id: response_id,
|
||||
out_iterator: out_iterator,
|
||||
type: 'POST',
|
||||
url: action=ajax_file,
|
||||
dataType: 'html',
|
||||
success: function (data) {
|
||||
if (out_iterator === 0)
|
||||
$("#event_response_window").empty();
|
||||
|
||||
$("#event_response_window").hide ()
|
||||
.append (data)
|
||||
.dialog ({
|
||||
title: $('#select_custom_response option:selected').html(),
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
open: function(event, ui) {
|
||||
$('#response_loading_dialog').hide();
|
||||
$('#button-submit_event_response').show();
|
||||
},
|
||||
close: function(event, ui) {
|
||||
$( ".chk_val" ).prop( "checked", false );
|
||||
},
|
||||
width: response['modal_width'],
|
||||
height: response['modal_height']
|
||||
})
|
||||
.show ();
|
||||
|
||||
perform_response_massive(this.response_tg, this.response_id, this.out_iterator);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Get an event response from db
|
||||
function get_response(response_id) {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
@ -371,6 +423,42 @@ function perform_response(target, response_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Perform a response and put the output into a div
|
||||
function perform_response_massive(target, response_id, out_iterator) {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
||||
$('#re_exec_command').hide();
|
||||
$('#response_loading_command_'+out_iterator).show();
|
||||
$('#response_out_'+out_iterator).html('');
|
||||
|
||||
var finished = 0;
|
||||
var time = Math.round(+new Date()/1000);
|
||||
var timeout = time + 10;
|
||||
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("perform_event_response=1");
|
||||
params.push("target="+target);
|
||||
params.push("response_id="+response_id)
|
||||
|
||||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action=ajax_file,
|
||||
async: true,
|
||||
timeout: 10000,
|
||||
dataType: 'html',
|
||||
success: function (data) {
|
||||
var out = data.replace(/[\n|\r]/g, "<br>");
|
||||
$('#response_out_'+out_iterator).html(out);
|
||||
$('#response_loading_command_'+out_iterator).hide();
|
||||
$('#re_exec_command_'+out_iterator).show();
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Change the status of an event to new, in process or validated
|
||||
function event_change_status(event_ids) {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
@ -320,8 +320,23 @@ function configure_modules_form () {
|
||||
$("#text-ff_event_normal").attr ("value", (data["min_ff_event_normal"] == 0) ? 0 : data["min_ff_event_normal"]);
|
||||
$("#text-ff_event_warning").attr ("value", (data["min_ff_event_warning"] == 0) ? 0 : data["min_ff_event_warning"]);
|
||||
$("#text-ff_event_critical").attr ("value", (data["min_ff_event_critical"] == 0) ? 0 : data["min_ff_event_critical"]);
|
||||
$("#text-post_process").attr("value", (data["post_process"] == 0) ? 0 : data["post_process"]);
|
||||
$("#text-unit").attr("value", (data["unit"] == '') ? '' : data["unit"]);
|
||||
|
||||
// Shows manual input if post_process field is setted
|
||||
if (data["post_process"] != 0) {
|
||||
$('#post_process_manual').show();
|
||||
$('#post_process_default').hide();
|
||||
}
|
||||
|
||||
$("#text-post_process_text").attr("value", (data["post_process"] == 0) ? 0 : data["post_process"]);
|
||||
|
||||
// Shows manual input if unit field is setted
|
||||
if (data["unit"] != '') {
|
||||
$('#unit_manual').show();
|
||||
$('#unit_default').hide();
|
||||
}
|
||||
|
||||
$("#text-unit_text").attr("value", (data["unit"] == '') ? '' : data["unit"]);
|
||||
|
||||
$("#checkbox-critical_inverse").prop ("checked", data["critical_inverse"]);
|
||||
$("#checkbox-warning_inverse").prop ("checked", data["warning_inverse"]);
|
||||
$("#component_loading").hide ();
|
||||
|
@ -14,6 +14,17 @@
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Enable profiler for testing
|
||||
if (!defined("__PAN_XHPROF__")) define ("__PAN_XHPROF__", 0);
|
||||
|
||||
if (__PAN_XHPROF__ === 1) {
|
||||
if (function_exists('tideways_xhprof_enable')) {
|
||||
tideways_xhprof_enable();
|
||||
} else {
|
||||
error_log("Cannot find tideways_xhprof_enable function");
|
||||
}
|
||||
}
|
||||
|
||||
//Set character encoding to UTF-8 - fixes a lot of multibyte character headaches
|
||||
if (function_exists ('mb_internal_encoding')) {
|
||||
mb_internal_encoding ("UTF-8");
|
||||
@ -1277,3 +1288,8 @@ require('include/php_to_js_values.php');
|
||||
*/
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
if (__PAN_XHPROF__ === 1) {
|
||||
pandora_xhprof_display_result("node_index");
|
||||
}
|
||||
?>
|
@ -116,7 +116,7 @@
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.730';
|
||||
$build = '181221';
|
||||
$build = '190121';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
@ -297,7 +297,7 @@ class Events {
|
||||
|
||||
$id_event = $system->getRequest('id_event', 0);
|
||||
|
||||
if (events_change_status($id_event, EVENT_VALIDATE)) {
|
||||
if (events_change_status($id_event, EVENT_VALIDATE,$system->getConfig('metaconsole'))) {
|
||||
echo json_encode(array('correct' => 1));
|
||||
}
|
||||
else {
|
||||
@ -379,11 +379,20 @@ class Events {
|
||||
$this->default_filters['severity'] = false;
|
||||
}
|
||||
|
||||
$this->filter = $system->getRequest('filter', __('Preset Filters'));
|
||||
if (($this->filter === __("Preset Filters")) || ($this->filter == 0)) {
|
||||
$this->filter = 0;
|
||||
if ($system->getRequest('filter', __('Preset Filters')) === __("Preset Filters")) {
|
||||
//Set filter as default user event filter (only first time)
|
||||
$this->filter = db_get_value('default_event_filter', 'tusuario', 'id_user', $system->getConfig('id_user'));
|
||||
|
||||
//Use user set default filter if admin set default filter is "none"
|
||||
if ($this->filter == 0){
|
||||
$this->filter = db_get_value('id_filter', 'tusuario', 'id_user', $system->getConfig('id_user'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->filter = $system->getRequest('filter', __('Preset Filters'));
|
||||
}
|
||||
|
||||
if ($this->filter != 0) {
|
||||
$this->default = false;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ global $config;
|
||||
|
||||
require_once ("include/functions_agents.php");
|
||||
require_once ("include/functions_custom_graphs.php");
|
||||
ui_require_javascript_file ('calendar');
|
||||
|
||||
if (! check_acl ($config['id_user'], $id_grupo, "AR") && ! check_acl ($config['id_user'], 0, "AW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
@ -242,7 +243,7 @@ echo '</div>';
|
||||
|
||||
//Dialog to save the custom graph
|
||||
echo "<div id='dialog_save_custom_graph' style='display: none;'>";
|
||||
$table = null;
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->style[0] = 'font-weight: bolder; text-align: right;';
|
||||
$table->data[0][0] = __('Name custom graph');
|
||||
|
@ -552,7 +552,7 @@ if (is_metaconsole()) {
|
||||
|
||||
$filters .= html_print_table($table, true);
|
||||
$filters .= "</form>";
|
||||
ui_toggle($filters, __('Show Options'));
|
||||
ui_toggle($filters, __('Show Options'), '', false);
|
||||
}
|
||||
else {
|
||||
$table->colspan[3][0] = 7;
|
||||
@ -778,15 +778,19 @@ $sql = 'SELECT
|
||||
ORDER BY ' . $order['field'] . " " . $order['order'] . '
|
||||
LIMIT '.$offset.",".$limit_sql;
|
||||
|
||||
// When you enter for the first time you have less than 4 query params in the url
|
||||
$first_interaction = count($_GET) > 4;
|
||||
// We do not show the modules until the user searches with the filter
|
||||
if ($first_interaction) {
|
||||
if (! defined ('METACONSOLE')) {
|
||||
$result = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($result === false) {
|
||||
$result = array();
|
||||
}
|
||||
else
|
||||
} else {
|
||||
ui_pagination($count, false, $offset);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// For each server defined and not disabled:
|
||||
$servers = db_get_all_rows_sql('SELECT *
|
||||
@ -857,6 +861,7 @@ else {
|
||||
// Get number of elements of the pagination
|
||||
$result = ui_meta_get_subset_array($result, $inferior_limit, $superior_limit);
|
||||
}
|
||||
}
|
||||
|
||||
if (($config['dbtype'] == 'oracle') && ($result !== false)) {
|
||||
for ($i=0; $i < count($result); $i++) {
|
||||
@ -1391,9 +1396,14 @@ if (!empty($result)) {
|
||||
}
|
||||
|
||||
html_print_table ($table);
|
||||
}
|
||||
else
|
||||
|
||||
} else {
|
||||
if ($first_interaction) {
|
||||
ui_print_info_message(array('no_close' => true, 'message' => __('This group doesn\'t have any monitor')));
|
||||
} else {
|
||||
ui_print_info_message(array('no_close' => true, 'message' => __('Sorry no search parameters')));
|
||||
}
|
||||
}
|
||||
// End Build List Result
|
||||
/////////////////////////////////////
|
||||
|
||||
|
@ -110,7 +110,7 @@ if (is_ajax ()) {
|
||||
}
|
||||
|
||||
// Perform search
|
||||
$agents = agents_get_group_agents($id_group,$filter,"lower",false,false,false,'|',$cluster_mode);
|
||||
$agents = agents_get_group_agents($id_group,$filter,"lower",false,$recursion,false,'|',$cluster_mode);
|
||||
if (empty($agents)) $agents = array();
|
||||
|
||||
// Add keys prefix
|
||||
|
@ -20,6 +20,8 @@ require_once ($config["homedir"] . "/include/functions_ui.php");
|
||||
$sort_field = get_parameter("sort_field", "timestamp");
|
||||
$sort = get_parameter("sort", "down");
|
||||
|
||||
$response_id = get_parameter ("response_id", "");
|
||||
|
||||
$table = new stdClass();
|
||||
if(!isset($table->width)) {
|
||||
$table->width = '100%';
|
||||
@ -887,9 +889,8 @@ else {
|
||||
|
||||
echo '<div style="width:' . $table->width . ';" class="action-buttons">';
|
||||
if (!$readonly && $show_validate_button) {
|
||||
html_print_button(__('In progress selected'), 'validate_button', false, 'validate_selected(2);', 'class="sub ok"');
|
||||
echo " ";
|
||||
html_print_button(__('Validate selected'), 'validate_button', false, 'validate_selected(1);', 'class="sub ok"');
|
||||
$array_events_actions['in_progress_selected'] = 'In progress selected';
|
||||
$array_events_actions['validate_selected'] = 'Validate selected';
|
||||
// Fix: validated_selected JS function has to be included with the proper user ACLs
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
@ -899,12 +900,14 @@ else {
|
||||
validate_event_advanced($(this).val(), new_status);
|
||||
}
|
||||
});
|
||||
location.reload();
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (!$readonly && ($show_delete_button)) {
|
||||
html_print_button(__('Delete selected'), 'delete_button', false, 'delete_selected();', 'class="sub delete"');
|
||||
$array_events_actions['delete_selected'] = 'Delete selected';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function delete_selected() {
|
||||
@ -916,10 +919,123 @@ else {
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
$sql_event_resp = "SELECT id, name FROM tevent_response WHERE type LIKE 'command'";
|
||||
$event_responses = db_get_all_rows_sql ($sql_event_resp);
|
||||
|
||||
foreach ($event_responses as $val)
|
||||
$array_events_actions[$val['id']] = $val['name'];
|
||||
|
||||
if ($config['event_replication'] != 1) {
|
||||
echo '<div style="width:100%;text-align:right;">';
|
||||
echo '<form method="post" id="form_event_response">';
|
||||
html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false);
|
||||
echo '  ';
|
||||
html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"');
|
||||
echo "<span id='response_loading_dialog' style='display:none'>".html_print_image('images/spinner.gif', true)."</span>";
|
||||
echo '</form>';
|
||||
echo '<span id="max_custom_event_resp_msg" style="display:none; color:#FC4444; line-height: 200%;">'.__("A maximum of 10 event custom responses can be selected").'</span>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
function execute_event_response(event_list_btn) {
|
||||
|
||||
$('#max_custom_event_resp_msg').hide();
|
||||
|
||||
var response_id = $('select[name=response_id]').val();
|
||||
|
||||
if (!isNaN(response_id)) { // It is a custom response
|
||||
|
||||
var response = get_response(response_id);
|
||||
|
||||
var counter=0;
|
||||
var end=0;
|
||||
|
||||
// If cannot get response abort it
|
||||
if (response == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var total_checked = $(".chk_val:checked").length;
|
||||
|
||||
// Limit number of events to apply custom responses to for performance reasons
|
||||
if (total_checked > 10) {
|
||||
$('#max_custom_event_resp_msg').show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event_list_btn) {
|
||||
$('#button-submit_event_response').hide(function() {
|
||||
$('#response_loading_dialog').show(function() {
|
||||
|
||||
$(".chk_val").each(function() {
|
||||
|
||||
if ($(this).is(":checked")) {
|
||||
//var server_id = $('#hidden-server_id_'+).
|
||||
event_id = $(this).val();
|
||||
server_id = $('#hidden-server_id_'+event_id).val();
|
||||
|
||||
response['target'] = get_response_target(event_id, response_id, server_id);
|
||||
|
||||
if (total_checked-1 === counter) end=1;
|
||||
|
||||
show_massive_response_dialog(event_id, response_id, response, counter, end);
|
||||
|
||||
counter++;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
$('#button-btn_str').hide(function() {
|
||||
$('#execute_again_loading').show(function() {
|
||||
|
||||
$(".chk_val").each(function() {
|
||||
|
||||
if ($(this).is(":checked")) {
|
||||
//var server_id = $('#hidden-server_id_'+).
|
||||
event_id = $(this).val();
|
||||
server_id = $('#hidden-server_id_'+event_id).val();
|
||||
|
||||
response['target'] = get_response_target(event_id, response_id, server_id);
|
||||
|
||||
if (total_checked-1 === counter) end=1;
|
||||
|
||||
show_massive_response_dialog(event_id, response_id, response, counter, end);
|
||||
|
||||
counter++;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
else { // It is not a custom response
|
||||
switch (response_id) {
|
||||
case 'in_progress_selected':
|
||||
validate_selected(2);
|
||||
break;
|
||||
case 'validate_selected':
|
||||
validate_selected(1);
|
||||
break;
|
||||
case 'delete_selected':
|
||||
delete_selected();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
echo '<div class="nf">' . __('No events') . '</div>';
|
||||
}
|
||||
|
@ -559,6 +559,18 @@ if ($validate) {
|
||||
if ($delete) {
|
||||
$ids = (array) get_parameter ("validate_ids", -1);
|
||||
|
||||
// Discard deleting in progress events
|
||||
$in_process_status = db_get_all_rows_sql("
|
||||
SELECT id_evento
|
||||
FROM tevento
|
||||
WHERE estado=2");
|
||||
|
||||
foreach ($in_process_status as $val) {
|
||||
if (($key = array_search($val['id_evento'], $ids)) !== false) {
|
||||
unset($ids[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($ids[0] != -1) {
|
||||
$return = events_delete_event ($ids, ($group_rep == 1), $meta);
|
||||
ui_print_result_message ($return,
|
||||
|
@ -74,9 +74,9 @@ if (isset ($_GET["modified"]) && !$view_mode) {
|
||||
$upd_info["lastname"] = get_parameter_post ("lastname", $user_info["lastname"]);
|
||||
$password_new = get_parameter_post ("password_new", "");
|
||||
$password_confirm = get_parameter_post ("password_conf", "");
|
||||
$upd_info["email"] = get_parameter_post ("email", $user_info["email"]);
|
||||
$upd_info["phone"] = get_parameter_post ("phone", $user_info["phone"]);
|
||||
$upd_info["comments"] = get_parameter_post ("comments", $user_info["comments"]);
|
||||
$upd_info["email"] = get_parameter_post ("email", "");
|
||||
$upd_info["phone"] = get_parameter_post ("phone", "");
|
||||
$upd_info["comments"] = get_parameter_post ("comments", "");
|
||||
$upd_info["language"] = get_parameter_post ("language", $user_info["language"]);
|
||||
$upd_info["timezone"] = get_parameter_post ("timezone", "");
|
||||
$upd_info["id_skin"] = get_parameter ("skin", $user_info["id_skin"]);
|
||||
@ -164,6 +164,8 @@ if (isset ($_GET["modified"]) && !$view_mode) {
|
||||
$success_msg = __('Password successfully updated');
|
||||
}
|
||||
|
||||
// if info is valid then proceed with update
|
||||
if ((filter_var($upd_info["email"], FILTER_VALIDATE_EMAIL) || $upd_info["email"]=="") && (preg_match('/^[0-9- ]+$/D', $upd_info["phone"]) || $upd_info["phone"]=="")) {
|
||||
$return_update_user = update_user ($id, $upd_info);
|
||||
|
||||
if ($return_update_user === false) {
|
||||
@ -182,7 +184,16 @@ if (isset ($_GET["modified"]) && !$view_mode) {
|
||||
}
|
||||
}
|
||||
|
||||
ui_print_result_message ($return, $success_msg, $error_msg,$user_auth_error);
|
||||
|
||||
}
|
||||
else if (!filter_var($upd_info["email"], FILTER_VALIDATE_EMAIL))
|
||||
ui_print_error_message (__('Please enter a valid email'));
|
||||
else if (!preg_match('/^[0-9- ]+$/D', $upd_info["phone"]))
|
||||
ui_print_error_message (__('Please enter a valid phone number'));
|
||||
|
||||
$user_info = $upd_info;
|
||||
|
||||
}
|
||||
else{
|
||||
if(!$error_msg){
|
||||
@ -190,11 +201,12 @@ if (isset ($_GET["modified"]) && !$view_mode) {
|
||||
}
|
||||
|
||||
$user_auth_error= $config['auth_error'];
|
||||
}
|
||||
|
||||
ui_print_result_message ($return, $success_msg, $error_msg,$user_auth_error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Prints action status for current message
|
||||
if ($status != -1) {
|
||||
ui_print_result_message ($status,
|
||||
@ -221,7 +233,7 @@ $data = array();
|
||||
$data[0] = '<span style="width:50%;float:left;"><b>' . __('User ID') . '</b></span>';
|
||||
$data[0] .= $jump . '<span style="font-weight: normal;width:20%;float:left;">' . $id . '</span>';
|
||||
$data[1] = '<span style="width:40%;float:left;line-height:20px;"><b>' . __('Full (display) name') . '</b></span>';
|
||||
$data[1] .= $jump . '<span style="width:20%;float:left;line-height:20px;">' . html_print_input_text_extended ("fullname", $user_info["fullname"], '', '', 20, 100, $view_mode, '', 'class="input"', true).'</span>';
|
||||
$data[1] .= $jump . '<span style="width:20%;float:left;line-height:20px;">' . html_print_input_text_extended ("fullname", $user_info["fullname"], 'fullname', '', 20, 100, $view_mode, '', 'class="input"', true).'</span>';
|
||||
// Show "Picture" (in future versions, why not, allow users to upload it's own avatar here.
|
||||
|
||||
if (is_user_admin ($id)) {
|
||||
@ -243,9 +255,9 @@ $table->data[] = $data;
|
||||
|
||||
$data = array();
|
||||
$data[0] = '<span style="width:50%;float:left;">'.__('E-mail').'</span>';
|
||||
$data[0] .= $jump .'<span style="width:20%;float:left;line-height:20px;">'. html_print_input_text_extended ("email", $user_info["email"], '', '', '25', '100', $view_mode, '', 'class="input"', true).'</span>';
|
||||
$data[0] .= $jump .'<span style="width:20%;float:left;line-height:20px;">'. html_print_input_text_extended ("email", $user_info["email"], 'email', '', '25', '100', $view_mode, '', 'class="input"', true).'</span>';
|
||||
$data[1] = '<span style="width:40%;float:left;">'.__('Phone number').'</span>';
|
||||
$data[1] .= $jump . '<div style="width:20%;float:left;line-height:50px;">'.html_print_input_text_extended ("phone", $user_info["phone"], '', '', '20', '30', $view_mode, '', 'class="input"', true).'</div>';
|
||||
$data[1] .= $jump . '<div style="width:20%;float:left;line-height:50px;">'.html_print_input_text_extended ("phone", $user_info["phone"], 'phone', '', '20', '30', $view_mode, '', 'class="input"', true).'</div>';
|
||||
$table->rowclass[] = '';
|
||||
$table->rowstyle[] = 'font-weight: bold;';
|
||||
$table->data[] = $data;
|
||||
@ -254,9 +266,9 @@ if ($view_mode === false) {
|
||||
if ($config["user_can_update_password"]) {
|
||||
$data = array();
|
||||
$data[0] = '<span style="width:50%;float:left;">'.__('New Password').'</span>';
|
||||
$data[0] .= $jump .'<span style="width:20%;float:left;line-height:20px;">'.html_print_input_text_extended ("password_new", "", '', '', '25', '45', $view_mode, '', 'class="input"', true, true).'</span>';
|
||||
$data[0] .= $jump .'<span style="width:20%;float:left;line-height:20px;">'.html_print_input_text_extended ("password_new", "", 'password_new', '', '25', '45', $view_mode, '', 'class="input"', true, true).'</span>';
|
||||
$data[1] = '<span style="width:40%;float:left;">'.__('Password confirmation').'</span>';
|
||||
$data[1] .= $jump . '<span style="width:20%;float:left;line-height:20px;">'.html_print_input_text_extended ("password_conf", "", '', '', '20', '45', $view_mode, '', 'class="input"', true, true).'</span>';
|
||||
$data[1] .= $jump . '<span style="width:20%;float:left;line-height:20px;">'.html_print_input_text_extended ("password_conf", "", 'password_conf', '', '20', '45', $view_mode, '', 'class="input"', true, true).'</span>';
|
||||
$table->rowclass[] = '';
|
||||
$table->rowstyle[] = 'font-weight: bold;';
|
||||
$table->data[] = $data;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.730
|
||||
%define release 181221
|
||||
%define release 190121
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.730
|
||||
%define release 181221
|
||||
%define release 190121
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 7.0NG.730-181221
|
||||
Version: 7.0NG.730-190121
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.730-181221"
|
||||
pandora_version="7.0NG.730-190121"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.730";
|
||||
my $pandora_build = "181221";
|
||||
my $pandora_build = "190121";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -396,7 +396,7 @@ sub process_xml_data ($$$$$) {
|
||||
|
||||
# If it exists add the value to the agent
|
||||
if (defined ($custom_field_info)) {
|
||||
my $cf_value = get_tag_value ($custom_field, 'value', '');
|
||||
my $cf_value = safe_input(get_tag_value ($custom_field, 'value', ''));
|
||||
|
||||
my $field_agent;
|
||||
|
||||
@ -482,7 +482,7 @@ sub process_xml_data ($$$$$) {
|
||||
my $custom_field_data = get_db_single_row($dbh, 'SELECT * FROM tagent_custom_data WHERE id_field = ? AND id_agent = ?',
|
||||
$custom_field_info->{"id_field"}, $agent->{"id_agente"});
|
||||
|
||||
my $cf_value = get_tag_value ($custom_field, 'value', '');
|
||||
my $cf_value = safe_input(get_tag_value ($custom_field, 'value', ''));
|
||||
|
||||
#If not defined we must create if defined just updated
|
||||
if(!defined($custom_field_data)) {
|
||||
|
@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.730";
|
||||
my $pandora_build = "181221";
|
||||
my $pandora_build = "190121";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.730
|
||||
%define release 181221
|
||||
%define release 190121
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.730
|
||||
%define release 181221
|
||||
%define release 190121
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -9,7 +9,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.730"
|
||||
PI_BUILD="181221"
|
||||
PI_BUILD="190121"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
||||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.730 PS181221";
|
||||
my $version = "7.0NG.730 PS190121";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
||||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.730 PS181221";
|
||||
my $version = "7.0NG.730 PS190121";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
@ -196,6 +196,7 @@ sub help_screen{
|
||||
help_screen_line('--apply_policy', '<policy_name>', 'Force apply a policy');
|
||||
help_screen_line('--apply_all_policies', '', 'Force apply to all the policies');
|
||||
help_screen_line('--add_agent_to_policy', '<agent_name> <policy_name>', 'Add an agent to a policy');
|
||||
help_screen_line('--remove_agent_from_policy', '<policy_id> <agent_id>', 'Delete an agent to a policy');
|
||||
help_screen_line('--delete_not_policy_modules', '', 'Delete all modules without policy from configuration file');
|
||||
help_screen_line('--disable_policy_alerts', '<policy_name>', 'Disable all the alerts of a policy');
|
||||
help_screen_line('--create_policy', '<policy_name> <group_name> <description>');
|
||||
@ -4102,6 +4103,19 @@ sub cli_policy_add_agent() {
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# delete an agent to a policy
|
||||
# Related option: --remove_agent_from_policy
|
||||
##############################################################################
|
||||
|
||||
sub cli_policy_delete_agent() {
|
||||
my ($policy_id, $agent_id) = @ARGV[2..3];
|
||||
|
||||
my $result = api_call(\%conf,'set', 'remove_agent_from_policy', $policy_id, $agent_id);
|
||||
print "$result \n\n ";
|
||||
|
||||
}
|
||||
|
||||
sub cli_create_planned_downtime() {
|
||||
my $name = @ARGV[2];
|
||||
my @todo = @ARGV[3..21];
|
||||
@ -5853,6 +5867,10 @@ sub pandora_manage_main ($$$) {
|
||||
param_check($ltotal, 2);
|
||||
cli_policy_add_agent();
|
||||
}
|
||||
elsif ($param eq '--remove_agent_from_policy') {
|
||||
param_check($ltotal, 2);
|
||||
cli_policy_delete_agent();
|
||||
}
|
||||
elsif ($param eq '--enable_user') {
|
||||
param_check($ltotal, 1);
|
||||
cli_user_enable();
|
||||
|
Loading…
x
Reference in New Issue
Block a user