Merge branch 'develop' into 1552-vmware-plugin-no-esta-actualizado-en-las-isos
This commit is contained in:
commit
3f82db6c6c
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.715-171114
|
||||
Version: 7.0NG.715-171127
|
||||
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.715-171114"
|
||||
pandora_version="7.0NG.715-171127"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -41,7 +41,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.715';
|
||||
use constant AGENT_BUILD => '171114';
|
||||
use constant AGENT_BUILD => '171127';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.715
|
||||
%define release 171114
|
||||
%define release 171127
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.715
|
||||
%define release 171114
|
||||
%define release 171127
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.715"
|
||||
PI_BUILD="171114"
|
||||
PI_BUILD="171127"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{171114}
|
||||
{171127}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.715(Build 171114)")
|
||||
#define PANDORA_VERSION ("7.0NG.715(Build 171127)")
|
||||
|
||||
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.715(Build 171114))"
|
||||
VALUE "ProductVersion", "(7.0NG.715(Build 171127))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.715-171114
|
||||
Version: 7.0NG.715-171127
|
||||
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.715-171114"
|
||||
pandora_version="7.0NG.715-171127"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
START TRANSACTION;
|
||||
|
||||
SET @st_oum708 = (SELECT IF(
|
||||
(SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled') > 0,
|
||||
"ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL",
|
||||
"SELECT 1"
|
||||
));
|
||||
|
||||
PREPARE pr_oum708 FROM @st_oum708;
|
||||
EXECUTE pr_oum708;
|
||||
DEALLOCATE PREPARE pr_oum708;
|
||||
|
||||
ALTER TABLE tagente ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
|
||||
|
||||
alter table tlayout_data add column element_group int(10) not null default 0;
|
||||
|
||||
alter table tlayout_data add column id_layout_linked_weight int(10) not null default 0;
|
||||
|
||||
ALTER TABLE tlayout_data ADD COLUMN show_on_top tinyint(1) default 0;
|
||||
|
||||
ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL default 0;
|
||||
|
||||
COMMIT;
|
|
@ -1157,10 +1157,10 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
|||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 8);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 9);
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '714');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '716');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tplanned_downtime_agents`
|
||||
|
@ -1226,6 +1226,7 @@ ALTER TABLE tagente ADD `remote` tinyint(1) NOT NULL default 0;
|
|||
ALTER TABLE tagente ADD COLUMN `cascade_protection_module` int(10) unsigned NOT NULL default '0';
|
||||
ALTER TABLE tagente ADD COLUMN (alias varchar(600) not null default '');
|
||||
ALTER TABLE tagente ADD `alias_as_name` int(2) unsigned default '0';
|
||||
ALTER TABLE tagente ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
|
||||
|
||||
UPDATE tagente SET tagente.alias = tagente.nombre;
|
||||
-- ---------------------------------------------------------------------
|
||||
|
@ -1239,6 +1240,9 @@ ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF';
|
|||
ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area';
|
||||
ALTER TABLE tlayout_data ADD `label_position` varchar(50) NOT NULL default 'down';
|
||||
ALTER TABLE tlayout_data ADD COLUMN `show_statistics` tinyint(2) NOT NULL default '0';
|
||||
ALTER TABLE tlayout_data ADD COLUMN `element_group` int(10) NOT NULL default '0';
|
||||
ALTER TABLE tlayout_data ADD COLUMN `id_layout_linked_weight` int(10) NOT NULL default '0';
|
||||
ALTER TABLE tlayout_data ADD COLUMN `show_on_top` tinyint(1) NOT NULL default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagent_custom_fields`
|
||||
|
@ -1256,6 +1260,8 @@ UPDATE tagente_modulo SET cron_interval = '' WHERE cron_interval LIKE '% %';
|
|||
-- Table `tgraph`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tgraph ADD COLUMN `percentil` int(4) unsigned default '0';
|
||||
ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tnetflow_filter`
|
||||
|
@ -1306,6 +1312,7 @@ ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) de
|
|||
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';
|
||||
|
||||
UPDATE `tmetaconsole_agent` SET tmetaconsole_agent.alias = tmetaconsole_agent.nombre;
|
||||
-- ---------------------------------------------------------------------
|
||||
|
@ -1337,6 +1344,10 @@ SET @vv1 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema =
|
|||
IF @vv1>0 THEN
|
||||
ALTER TABLE tbackup ADD COLUMN `filepath` varchar(512) NOT NULL DEFAULT "";
|
||||
END IF;
|
||||
SET @vv2 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled');
|
||||
IF @vv2>0 THEN
|
||||
ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL;
|
||||
END IF;
|
||||
END;
|
||||
//
|
||||
delimiter ;
|
||||
|
@ -1451,3 +1462,7 @@ INSERT INTO tmodule VALUES (8, 'Wux module');
|
|||
|
||||
INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'module-wux.png');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tdashboard`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL default 0;
|
||||
|
|
|
@ -252,25 +252,6 @@ foreach ($modules as $m) {
|
|||
$modules_values[$m['id_module']] = $m['name'];
|
||||
}
|
||||
|
||||
$table->data[3][0] = __('Parent');
|
||||
$params = array();
|
||||
$params['return'] = true;
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'id_parent';
|
||||
$params['print_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_name'] = 'id_agent_parent';
|
||||
$params['hidden_input_idagent_value'] = $id_parent;
|
||||
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
|
||||
$params['selectbox_id'] = 'cascade_protection_module';
|
||||
$params['javascript_is_function_select'] = true;
|
||||
$params['cascade_protection'] = true;
|
||||
|
||||
$table->data[3][1] = ui_print_agent_autocomplete_input($params);
|
||||
|
||||
$table->data[3][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true);
|
||||
|
||||
$table->data[3][1] .= " " . __('Module') . " " . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true);
|
||||
|
||||
$table->data[4][0] = __('Group');
|
||||
$table->data[4][1] = html_print_select_groups(false, "AR", false, 'grupo', $grupo, '', '', 0, true);
|
||||
$table->data[4][1] .= ' <span id="group_preview">';
|
||||
|
@ -320,52 +301,87 @@ $table->class = "databox filters";
|
|||
$table->head = array ();
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold; ';
|
||||
$table->style[2] = 'font-weight: bold;';
|
||||
$table->style[4] = 'font-weight: bold;';
|
||||
$table->data = array ();
|
||||
|
||||
// Custom ID
|
||||
$table->data[0][0] = __('Custom ID');
|
||||
$table->data[0][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true);
|
||||
|
||||
$table->data[1][0] = __('Parent');
|
||||
$params = array();
|
||||
$params['return'] = true;
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'id_parent';
|
||||
$params['print_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_name'] = 'id_agent_parent';
|
||||
$params['hidden_input_idagent_value'] = $id_parent;
|
||||
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
|
||||
$params['selectbox_id'] = 'cascade_protection_module';
|
||||
$params['javascript_is_function_select'] = true;
|
||||
$params['cascade_protection'] = true;
|
||||
|
||||
$table->data[1][1] = ui_print_agent_autocomplete_input($params);
|
||||
$table->data[1][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true);
|
||||
$table->data[1][1] .= " " . __('Module') . " " . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true);
|
||||
|
||||
//safe operation mode
|
||||
if($id_agente){
|
||||
$sql_modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
|
||||
WHERE id_agente = " . $id_agente);
|
||||
$safe_mode_modules = array();
|
||||
$safe_mode_modules[0] = __('Any');
|
||||
foreach ($sql_modules as $m) {
|
||||
$safe_mode_modules[$m['id_module']] = $m['name'];
|
||||
}
|
||||
|
||||
$table->data[2][0] = __('Safe operation mode')
|
||||
. ui_print_help_tip(__('This mode allow Pandora FMS to disable all modules
|
||||
of this agent while the selected module is on CRITICAL status'), true);
|
||||
$table->data[2][1] = html_print_checkbox('safe_mode', 1, $safe_mode, true);
|
||||
$table->data[2][1] .= " " . __('Module') . " " . html_print_select ($safe_mode_modules, "safe_mode_module", $safe_mode_module, "", "", 0, true);
|
||||
}
|
||||
|
||||
|
||||
// Learn mode / Normal mode
|
||||
$table->data[1][0] = __('Module definition') .
|
||||
$table->data[3][0] = __('Module definition') .
|
||||
ui_print_help_icon("module_definition", true);
|
||||
$table->data[1][1] = __('Learning mode') . ' ' .
|
||||
$table->data[3][1] = __('Learning mode') . ' ' .
|
||||
html_print_radio_button_extended ("modo", 1, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
|
||||
'style="margin-right: 40px;"', true);
|
||||
$table->data[1][1] .= __('Normal mode') . ' ' .
|
||||
$table->data[3][1] .= __('Normal mode') . ' ' .
|
||||
html_print_radio_button_extended ("modo", 0, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
|
||||
'style="margin-right: 40px;"', true);
|
||||
$table->data[1][1] .= __('Autodisable mode') . ' ' .
|
||||
$table->data[3][1] .= __('Autodisable mode') . ' ' .
|
||||
html_print_radio_button_extended ("modo", 2, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
|
||||
'style="margin-right: 40px;"', true);
|
||||
|
||||
// Status (Disabled / Enabled)
|
||||
$table->data[2][0] = __('Status');
|
||||
$table->data[2][1] = __('Disabled') . ' ' .
|
||||
$table->data[4][0] = __('Status');
|
||||
$table->data[4][1] = __('Disabled') . ' ' .
|
||||
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][1] .= __('Active') . ' ' .
|
||||
$table->data[4][1] .= __('Active') . ' ' .
|
||||
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
|
||||
// Remote configuration
|
||||
$table->data[3][0] = __('Remote configuration');
|
||||
$table->data[5][0] = __('Remote configuration');
|
||||
|
||||
if (!$new_agent) {
|
||||
$table->data[3][1] = '<em>' . __('Not available') . '</em>';
|
||||
$table->data[5][1] = '<em>' . __('Not available') . '</em>';
|
||||
if (isset($filename)) {
|
||||
if (file_exists ($filename['md5'])) {
|
||||
$table->data[3][1] = date ("F d Y H:i:s", fileatime ($filename['md5']));
|
||||
$table->data[5][1] = date ("F d Y H:i:s", fileatime ($filename['md5']));
|
||||
// Delete remote configuration
|
||||
$table->data[3][1] .= '<a href="index.php?' .
|
||||
$table->data[5][1] .= '<a href="index.php?' .
|
||||
'sec=gagente&' .
|
||||
'sec2=godmode/agentes/configurar_agente&' .
|
||||
'tab=main&' .
|
||||
'disk_conf_delete=1&' .
|
||||
'id_agente=' . $id_agente . '">';
|
||||
$table->data[3][1] .= html_print_image(
|
||||
$table->data[5][1] .= html_print_image(
|
||||
"images/cross.png", true,
|
||||
array ('title' => __('Delete remote configuration file'), 'style' => 'vertical-align: middle;')).'</a>';
|
||||
$table->data[3][1] .= '</a>' .
|
||||
$table->data[5][1] .= '</a>' .
|
||||
ui_print_help_tip(
|
||||
__('Delete this conf file implies that for restore you must reactive remote config in the local agent.'),
|
||||
true);
|
||||
|
@ -373,7 +389,7 @@ if (!$new_agent) {
|
|||
}
|
||||
}
|
||||
else
|
||||
$table->data[3][1] = '<em>' . __('Not available') . '</em>';
|
||||
$table->data[5][1] = '<em>' . __('Not available') . '</em>';
|
||||
|
||||
$listIcons = gis_get_array_list_icons();
|
||||
|
||||
|
@ -411,23 +427,23 @@ $table->data[0][3] = html_print_select($arraySelectIcon, "icon_path",
|
|||
array("id" => "icon_warning", "style" => "display:".$display_icons.";"));
|
||||
|
||||
if ($config['activate_gis']) {
|
||||
$table->data[1][2] = __('Ignore new GIS data:');
|
||||
$table->data[1][3] = __('Yes') . ' ' .
|
||||
$table->data[3][2] = __('Ignore new GIS data:');
|
||||
$table->data[3][3] = __('Yes') . ' ' .
|
||||
html_print_radio_button_extended ("update_gis_data", 0, '',
|
||||
$update_gis_data, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[1][3] .= __('No') . ' ' .
|
||||
$table->data[3][3] .= __('No') . ' ' .
|
||||
html_print_radio_button_extended ("update_gis_data", 1, '',
|
||||
$update_gis_data, false, '', 'style="margin-right: 40px;"', true);
|
||||
}
|
||||
|
||||
$table->data[2][2] = __('Url address');
|
||||
$table->data[2][3] = html_print_input_text ('url_description',
|
||||
$table->data[4][2] = __('Url address');
|
||||
$table->data[4][3] = html_print_input_text ('url_description',
|
||||
$url_description, '', 45, 255, true);
|
||||
|
||||
$table->data[3][2] = __('Quiet');
|
||||
$table->data[3][3] = ui_print_help_tip(
|
||||
$table->data[5][2] = __('Quiet');
|
||||
$table->data[5][3] = ui_print_help_tip(
|
||||
__('The agent still runs but the alerts and events will be stop'), true);
|
||||
$table->data[3][3] .= html_print_checkbox('quiet', 1, $quiet, true);
|
||||
$table->data[5][3] .= html_print_checkbox('quiet', 1, $quiet, true);
|
||||
|
||||
ui_toggle(html_print_table ($table, true), __('Advanced options'));
|
||||
unset($table);
|
||||
|
@ -582,6 +598,26 @@ ui_require_jquery_file('bgiframe');
|
|||
$("#cascade_protection_module").attr("disabled", 'disabled');
|
||||
}
|
||||
});
|
||||
|
||||
var safe_mode_checked = $("#checkbox-safe_mode").is(":checked");
|
||||
if (safe_mode_checked) {
|
||||
$("#safe_mode_module").removeAttr("disabled");
|
||||
}
|
||||
else {
|
||||
$("#safe_mode_module").attr("disabled", 'disabled');
|
||||
}
|
||||
|
||||
$("#checkbox-safe_mode").change(function () {
|
||||
var safe_mode_checked = $("#checkbox-safe_mode").is(":checked");
|
||||
|
||||
if (safe_mode_checked) {
|
||||
$("#safe_mode_module").removeAttr("disabled");
|
||||
}
|
||||
else {
|
||||
$("#safe_mode_module").val(0);
|
||||
$("#safe_mode_module").attr("disabled", 'disabled');
|
||||
}
|
||||
});
|
||||
|
||||
paint_qrcode(
|
||||
"<?php
|
||||
|
|
|
@ -542,7 +542,7 @@ if (!empty($interfaces_list)) {
|
|||
$table->data[0][1] = '';
|
||||
$table->data[0][2] = '<b>'.__('Modules').'</b>';
|
||||
|
||||
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:200px;');
|
||||
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px;');
|
||||
$table->data[1][1] = html_print_image('images/darrowright.png', true);
|
||||
$table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
|
||||
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
|
||||
|
|
|
@ -135,6 +135,8 @@ $id_os = 9; // Windows
|
|||
$custom_id = "";
|
||||
$cascade_protection = 0;
|
||||
$cascade_protection_modules = 0;
|
||||
$safe_mode = 0;
|
||||
$safe_mode_module = 0;
|
||||
$icon_path = '';
|
||||
$update_gis_data = 0;
|
||||
$unit = "";
|
||||
|
@ -166,6 +168,8 @@ if ($create_agent) {
|
|||
$custom_id = (string) get_parameter_post ("custom_id",'');
|
||||
$cascade_protection = (int) get_parameter_post ("cascade_protection", 0);
|
||||
$cascade_protection_module = (int) get_parameter_post("cascade_protection_module", 0);
|
||||
$safe_mode = (int) get_parameter_post ("safe_mode", 0);
|
||||
$safe_mode_module = (int) get_parameter_post ("safe_mode_module", 0);
|
||||
$icon_path = (string) get_parameter_post ("icon_path",'');
|
||||
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
|
||||
$url_description = (string) get_parameter("url_description");
|
||||
|
@ -707,6 +711,7 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
$custom_id = (string) get_parameter_post ("custom_id", "");
|
||||
$cascade_protection = (int) get_parameter_post ("cascade_protection", 0);
|
||||
$cascade_protection_module = (int) get_parameter ("cascade_protection_module", 0);
|
||||
$safe_mode_module = (int) get_parameter ("safe_mode_module", 0);
|
||||
$icon_path = (string) get_parameter_post ("icon_path",'');
|
||||
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
|
||||
$url_description = (string) get_parameter("url_description");
|
||||
|
@ -782,7 +787,8 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
'update_gis_data' => $update_gis_data,
|
||||
'url_address' => $url_description,
|
||||
'url_address' => $url_description,
|
||||
'quiet' => $quiet);
|
||||
'quiet' => $quiet,
|
||||
'safe_mode_module' => $safe_mode_module);
|
||||
|
||||
if ($config['metaconsole_agent_cache'] == 1) {
|
||||
$values['update_module_count'] = 1; // Force an update of the agent cache.
|
||||
|
@ -900,6 +906,8 @@ if ($id_agente) {
|
|||
$update_gis_data = $agent["update_gis_data"];
|
||||
$url_description = $agent["url_address"];
|
||||
$quiet = $agent["quiet"];
|
||||
$safe_mode_module = $agent["safe_mode_module"];
|
||||
$safe_mode = ($safe_mode_module) ? 1 : 0;
|
||||
}
|
||||
|
||||
$update_module = (bool) get_parameter ('update_module');
|
||||
|
|
|
@ -590,8 +590,7 @@ $table_advanced->colspan[10][1] = 6;
|
|||
if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
||||
$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"]));
|
||||
if ($has_remote_conf) {
|
||||
$table_advanced->data[11][0] = __('Cron from') .
|
||||
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
|
||||
$table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true);
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
|
||||
|
@ -600,8 +599,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
|||
$table_advanced->colspan[12][1] = 6;
|
||||
}
|
||||
else {
|
||||
$table_advanced->data[11][0] = __('Cron from') .
|
||||
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
|
||||
$table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true);
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
|
||||
|
@ -611,8 +609,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
$table_advanced->data[11][0] = __('Cron from') .
|
||||
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
|
||||
$table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true);
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
|
||||
|
|
|
@ -822,6 +822,8 @@ function readFields() {
|
|||
values['bars_graph_type'] = $("select[name=bars_graph_type]").val();
|
||||
values['parent'] = $("select[name=parent]").val();
|
||||
values['map_linked'] = $("select[name=map_linked]").val();
|
||||
values['element_group'] = $("select[name=element_group]").val();
|
||||
values['map_linked_weight'] = $("select[name=map_linked_weight]").val();
|
||||
values['width_percentile'] = $("input[name=width_percentile]").val();
|
||||
values['bars_graph_height'] = $("input[name=bars_graph_height]").val();
|
||||
values['max_percentile'] = parseInt($("input[name=max_percentile]").val());
|
||||
|
@ -853,6 +855,7 @@ function readFields() {
|
|||
values['line_color'] = $("input[name='line_color']").val();
|
||||
values['label_position'] = $(".labelpos[sel=yes]").attr('position');
|
||||
values['show_statistics'] = $("input[name=show_statistics]").is(':checked') ? 1 : 0;
|
||||
values['show_on_top'] = $("input[name=show_on_top]").is(':checked') ? 1 : 0;
|
||||
|
||||
if (is_metaconsole()) {
|
||||
values['metaconsole'] = 1;
|
||||
|
@ -1293,6 +1296,9 @@ function toggle_item_palette() {
|
|||
}
|
||||
|
||||
hiddenFields(item);
|
||||
|
||||
$("#show_on_top_row").css('display', 'table-row');
|
||||
$("#show_on_top." + item).css('display', 'block');
|
||||
|
||||
$("#properties_panel").show("fast");
|
||||
|
||||
|
@ -1422,6 +1428,17 @@ function loadFieldsFromDB(item) {
|
|||
}
|
||||
}
|
||||
|
||||
if (key == 'show_on_top') {
|
||||
if (val == "1") {
|
||||
$("input[name=show_on_top]")
|
||||
.prop("checked", true);
|
||||
}
|
||||
else {
|
||||
$("input[name=show_on_top]")
|
||||
.prop("checked", false);
|
||||
}
|
||||
}
|
||||
|
||||
if (key == 'type_graph') {
|
||||
$("select[name=type_graph]").val(val);
|
||||
}
|
||||
|
@ -1510,6 +1527,10 @@ function loadFieldsFromDB(item) {
|
|||
$("select[name=parent]").val(val);
|
||||
if (key == 'id_layout_linked')
|
||||
$("select[name=map_linked]").val(val);
|
||||
if (key == 'id_layout_linked_weight')
|
||||
$("select[name=map_linked_weight]").val(val);
|
||||
if (key == 'element_group')
|
||||
$("select[name=element_group]").val(val);
|
||||
if (key == 'width_percentile')
|
||||
$("input[name=width_percentile]").val(val);
|
||||
if (key == 'bars_graph_height')
|
||||
|
@ -1800,6 +1821,12 @@ function hiddenFields(item) {
|
|||
$("#map_linked_row").css('display', 'none');
|
||||
$("#map_linked_row." + item).css('display', '');
|
||||
|
||||
$("#element_group_row").css('display', 'none');
|
||||
$("#element_group_row." + item).css('display', '');
|
||||
|
||||
$("#map_linked_weight").css('display', 'none');
|
||||
$("#map_linked_weight." + item).css('display', '');
|
||||
|
||||
$("#module_graph_size_row").css('display', 'none');
|
||||
$("#module_graph_size_row." + item).css('display', '');
|
||||
|
||||
|
@ -1850,14 +1877,6 @@ function hiddenFields(item) {
|
|||
if (typeof(enterprise_hiddenFields) == 'function') {
|
||||
enterprise_hiddenFields(item);
|
||||
}
|
||||
|
||||
//~ var code_control = tinyMCE.activeEditor.controlManager.controls['text-label_code'];
|
||||
//~ if (item == 'label') {
|
||||
//~ code_control.setDisabled(false);
|
||||
//~ }
|
||||
//~ else {
|
||||
//~ code_control.setDisabled(true);
|
||||
//~ }
|
||||
}
|
||||
|
||||
function cleanFields(item) {
|
||||
|
@ -1879,6 +1898,8 @@ function cleanFields(item) {
|
|||
$("input[name=height]").val(0);
|
||||
$("select[name=parent]").val('');
|
||||
$("select[name=map_linked]").val('');
|
||||
$("select[name=element_group]").val('');
|
||||
$("select[name=map_linked_weight]").val('');
|
||||
$("input[name=width_module_graph]").val(300);
|
||||
$("input[name=height_module_graph]").val(180);
|
||||
$("input[name='width_box']").val(300);
|
||||
|
@ -1895,6 +1916,7 @@ function cleanFields(item) {
|
|||
$("input[name=percentile_label_color]").val('');
|
||||
$("input[name=percentile_label]").val('');
|
||||
$(".ColorPickerDivSample").css('background-color', '#FFF');
|
||||
$("input[name=show_on_top]").prop("checked", false);
|
||||
|
||||
|
||||
$("#preview").empty();
|
||||
|
@ -3458,8 +3480,6 @@ function createItem(type, values, id_data) {
|
|||
}
|
||||
|
||||
$("#background").append(item);
|
||||
$(".item").css('z-index', '2');
|
||||
$(".box_item").css('z-index', '1');
|
||||
|
||||
if (values['parent'] != 0) {
|
||||
var line = {"id": id_data,
|
||||
|
@ -3482,6 +3502,14 @@ function createItem(type, values, id_data) {
|
|||
$('#text_'+id_data).css({'display':'block','float':'left'});
|
||||
}
|
||||
|
||||
if(values['show_on_top'] == 1){
|
||||
$("#" + id_data).css('z-index', '10');
|
||||
}
|
||||
|
||||
if(values['show_on_top'] == 0){
|
||||
$("#" + id_data).css('z-index', '5');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function addItemSelectParents(id_data, text) {
|
||||
|
@ -3684,6 +3712,15 @@ function updateDB_visual(type, idElement , values, event, top, left) {
|
|||
|
||||
refresh_lines(lines, 'background', true);
|
||||
draw_user_lines("", 0, 0, 0 , 0, 0, true);
|
||||
|
||||
if(values['show_on_top'] == 1){
|
||||
$("#" + idElement).css('z-index',10);
|
||||
}
|
||||
|
||||
if(values['show_on_top'] == 0){
|
||||
$("#" + idElement).css('z-index',5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function updateDB(type, idElement , values, event) {
|
||||
|
@ -4519,6 +4556,8 @@ function eventsBackground() {
|
|||
if ((!is_opened_palette) && (autosave)) {
|
||||
toggle_item_palette();
|
||||
}
|
||||
$("#show_on_top_row").css('display', 'none');
|
||||
$("#show_on_top." + item).css('display', '');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -413,6 +413,8 @@ switch ($activeTab) {
|
|||
$value_show = get_parameter ("value_show", 'percent');
|
||||
$label_type = get_parameter ("label_type", 'agent_module');
|
||||
$enable_link = get_parameter ("enable_link", 'enable_link');
|
||||
$show_on_top = get_parameter ("show_on_top", 0);
|
||||
|
||||
// This var switch between creation of items, item_per_agent = 0 => item per module; item_per_agent <> 0 => item per agent
|
||||
$item_per_agent = get_parameter ("item_per_agent", 0);
|
||||
$id_server = (int)get_parameter('servers', 0);
|
||||
|
|
|
@ -17,8 +17,25 @@
|
|||
if (is_ajax ()) {
|
||||
global $config;
|
||||
|
||||
// Login check
|
||||
check_login ();
|
||||
enterprise_include_once("include/functions_dashboard.php");
|
||||
|
||||
$public_hash = get_parameter('hash', 0);
|
||||
|
||||
// Try to authenticate by hash on public dashboards
|
||||
if ($public_hash == 0) {
|
||||
// Login check
|
||||
check_login();
|
||||
} else {
|
||||
$validate_hash = enterprise_hook(
|
||||
'dasboard_validate_public_hash',
|
||||
array($public_hash, 'tree_view')
|
||||
);
|
||||
if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) {
|
||||
db_pandora_audit("Invalid public hash", "Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
require_once($config['homedir'] . "/include/class/Tree.class.php");
|
||||
enterprise_include_once("include/class/Tree.class.php");
|
||||
|
@ -36,6 +53,10 @@ if (is_ajax ()) {
|
|||
$rootID = get_parameter('rootID', -1);
|
||||
$serverID = get_parameter('serverID', false);
|
||||
$childrenMethod = get_parameter('childrenMethod', 'on_demand');
|
||||
$hash = get_parameter('hash', false);
|
||||
if ($hash !== false) {
|
||||
enterprise_hook('dasboard_validate_public_hash', array($hash, 'tree_view'));
|
||||
}
|
||||
|
||||
$default_filters = array(
|
||||
'searchAgent' => '',
|
||||
|
|
|
@ -12,10 +12,30 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Login check
|
||||
global $config;
|
||||
|
||||
check_login ();
|
||||
enterprise_include_once ('include/functions_dashboard.php');
|
||||
require_once('include/functions_visual_map.php');
|
||||
enterprise_include_once('include/functions_visual_map.php');
|
||||
|
||||
$public_hash = get_parameter('hash', false);
|
||||
$id_visual_console = get_parameter('id_visual_console', null);
|
||||
|
||||
// Try to authenticate by hash on public dashboards
|
||||
if ($public_hash === false) {
|
||||
// Login check
|
||||
check_login();
|
||||
} else {
|
||||
$validate_hash = enterprise_hook(
|
||||
'dasboard_validate_public_hash',
|
||||
array($public_hash, $id_visual_console, 'visual_console')
|
||||
);
|
||||
if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) {
|
||||
db_pandora_audit("Invalid public hash", "Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Fix: IW was the old ACL to check for report editing, now is RW
|
||||
if (! check_acl ($config['id_user'], 0, "VR")) {
|
||||
|
@ -29,12 +49,6 @@ if (! check_acl ($config['id_user'], 0, "VR")) {
|
|||
//Fix ajax to avoid include the file, 'functions_graph.php'.
|
||||
$ajax = true;
|
||||
|
||||
|
||||
require_once('include/functions_visual_map.php');
|
||||
enterprise_include_once('include/functions_visual_map.php');
|
||||
|
||||
$id_visual_console = get_parameter('id_visual_console', null);
|
||||
|
||||
$render_map = (bool)get_parameter('render_map', false);
|
||||
$graph_javascript = (bool)get_parameter('graph_javascript', false);
|
||||
|
||||
|
|
|
@ -100,6 +100,8 @@ $width = get_parameter('width', null);
|
|||
$height = get_parameter('height', null);
|
||||
$parent = get_parameter('parent', null);
|
||||
$map_linked = get_parameter('map_linked', null);
|
||||
$map_linked_weight = get_parameter('map_linked_weight', null);
|
||||
$element_group = get_parameter('element_group', null);
|
||||
$width_percentile = get_parameter('width_percentile', null);
|
||||
$bars_graph_height = get_parameter('bars_graph_height', null);
|
||||
$max_percentile = get_parameter('max_percentile', null);
|
||||
|
@ -138,6 +140,7 @@ $line_color = get_parameter('line_color', '');
|
|||
$get_element_status = get_parameter('get_element_status', 0);
|
||||
|
||||
$enable_link = get_parameter('enable_link', 1);
|
||||
$show_on_top = get_parameter('show_on_top', 0);
|
||||
$type_graph = get_parameter('type_graph', 'area');
|
||||
$label_position = get_parameter('label_position', 'down');
|
||||
$show_statistics = get_parameter('show_statistics', 0);
|
||||
|
@ -380,7 +383,7 @@ switch ($action) {
|
|||
|
||||
// Linked to other layout ?? - Only if not module defined
|
||||
if ($layoutData['id_layout_linked'] != 0) {
|
||||
$status = visual_map_get_layout_status ($layoutData['id_layout_linked']);
|
||||
$status = visual_map_get_layout_status ($layoutData['id_layout_linked'], $layoutData['id_layout_linked_weight']);
|
||||
|
||||
// Single object
|
||||
}
|
||||
|
@ -490,6 +493,7 @@ switch ($action) {
|
|||
$values = array();
|
||||
|
||||
$values['label_position'] = $label_position;
|
||||
$values['show_on_top'] = $show_on_top;
|
||||
|
||||
// In Graphs, background color is stored in column image (sorry)
|
||||
if ($type == 'module_graph') {
|
||||
|
@ -529,6 +533,9 @@ switch ($action) {
|
|||
if ($enable_link !== null) {
|
||||
$values['enable_link'] = $enable_link;
|
||||
}
|
||||
if ($show_on_top !== null) {
|
||||
$values['show_on_top'] = $show_on_top;
|
||||
}
|
||||
if ($label !== null) {
|
||||
$values['label'] = $label;
|
||||
}
|
||||
|
@ -554,8 +561,6 @@ switch ($action) {
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (defined('METACONSOLE') && $metaconsole) {
|
||||
if ($server_name !== null) {
|
||||
$values['id_metaconsole'] = db_get_value('id',
|
||||
|
@ -570,6 +575,9 @@ switch ($action) {
|
|||
$values['id_agent'] = $id_agent;
|
||||
}
|
||||
}
|
||||
else if ($id_agent == 0) {
|
||||
$values['id_agent'] = 0;
|
||||
}
|
||||
else if (!empty($id_agent)) {
|
||||
$values['id_agent'] = $id_agent;
|
||||
}
|
||||
|
@ -586,6 +594,12 @@ switch ($action) {
|
|||
if ($map_linked !== null) {
|
||||
$values['id_layout_linked'] = $map_linked;
|
||||
}
|
||||
if ($element_group !== null) {
|
||||
$values['element_group'] = $element_group;
|
||||
}
|
||||
if ($map_linked_weight !== null) {
|
||||
$values['id_layout_linked_weight'] = $map_linked_weight;
|
||||
}
|
||||
switch ($type) {
|
||||
// -- line_item ------------------------------------
|
||||
case 'handler_start':
|
||||
|
@ -736,6 +750,13 @@ switch ($action) {
|
|||
// Don't change the label because only change the positions
|
||||
unset($values['label']);
|
||||
unset($values['label_position']);
|
||||
unset($values['id_agent']);
|
||||
unset($values['id_agente_modulo']);
|
||||
unset($values['enable_link']);
|
||||
unset($values['show_on_top']);
|
||||
unset($values['id_layout_linked']);
|
||||
unset($values['element_group']);
|
||||
unset($values['id_layout_linked_weight']);
|
||||
// Don't change background color in graphs when move
|
||||
|
||||
switch ($type) {
|
||||
|
@ -1021,8 +1042,11 @@ switch ($action) {
|
|||
}
|
||||
$values['id_agente_modulo'] = $id_module;
|
||||
$values['id_layout_linked'] = $map_linked;
|
||||
$values['element_group'] = $element_group;
|
||||
$values['id_layout_linked_weight'] = $map_linked_weight;
|
||||
$values['parent_item'] = $parent;
|
||||
$values['enable_link'] = $enable_link;
|
||||
$values['show_on_top'] = $show_on_top;
|
||||
$values['image'] = $background_color;
|
||||
$values['type_graph'] = $type_graph;
|
||||
|
||||
|
|
|
@ -215,6 +215,13 @@ function process_user_login_remote ($login, $pass, $api = false) {
|
|||
break;
|
||||
}
|
||||
|
||||
if ($config["auth"] === 'ldap') {
|
||||
$login_user_attribute = $login;
|
||||
if (($config['ldap_login_user_attr'] != 'name') && ($config['ldap_login_user_attr'] != null)) {
|
||||
$login = get_ldap_login_attr($login);
|
||||
}
|
||||
}
|
||||
|
||||
// Authentication ok, check if the user exists in the local database
|
||||
if (is_user ($login)) {
|
||||
if (!user_can_login($login)) {
|
||||
|
@ -240,26 +247,19 @@ function process_user_login_remote ($login, $pass, $api = false) {
|
|||
}
|
||||
}
|
||||
}
|
||||
elseif (($config["auth"] === 'ldap') &&
|
||||
(isset($config['ldap_advanced_config']) && $config['ldap_advanced_config'])) {
|
||||
elseif ($config["auth"] === 'ldap') {
|
||||
if ($config['ldap_save_password']) {
|
||||
$update_credentials = change_local_user_pass_ldap ($login, $pass);
|
||||
|
||||
$return = enterprise_hook ('prepare_permissions_groups_of_user_ldap',
|
||||
array ($login, $pass, false, true, defined('METACONSOLE')));
|
||||
|
||||
if ($return === "error_permissions") {
|
||||
$config["auth_error"] =
|
||||
__("Problems with configuration permissions. Please contact with Administrator");
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if ($return === "permissions_changed") {
|
||||
if ($update_credentials) {
|
||||
$config["auth_error"] =
|
||||
__("Your permissions have changed. Please, login again.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
change_local_user_pass_ldap ($login, $pass);
|
||||
else {
|
||||
delete_user_pass_ldap ($login);
|
||||
}
|
||||
}
|
||||
|
||||
return $login;
|
||||
|
@ -310,9 +310,7 @@ function process_user_login_remote ($login, $pass, $api = false) {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($config["auth"] === 'ldap' &&
|
||||
(isset($config['ldap_advanced_config']) &&
|
||||
$config['ldap_advanced_config'])) {
|
||||
elseif ($config["auth"] === 'ldap') {
|
||||
if ( defined('METACONSOLE') ) {
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
enterprise_include_once ('meta/include/functions_groups_meta.php');
|
||||
|
@ -332,13 +330,11 @@ function process_user_login_remote ($login, $pass, $api = false) {
|
|||
}
|
||||
|
||||
// Create the user
|
||||
if (enterprise_hook ('prepare_permissions_groups_of_user_ldap',
|
||||
array($login,
|
||||
$pass,
|
||||
array ('fullname' => $login,
|
||||
'comments' => 'Imported from ' . $config['auth']),
|
||||
false, defined('METACONSOLE'))) === false) {
|
||||
|
||||
$prepare_perms = prepare_permissions_groups_of_user_ldap($login_user_attribute, $pass,
|
||||
array ('fullname' => $login_user_attribute, 'comments' => 'Imported from ' . $config['auth']),
|
||||
false, defined('METACONSOLE'));
|
||||
|
||||
if (!$prepare_perms) {
|
||||
$config["auth_error"] = __("User not found in database
|
||||
or incorrect password");
|
||||
|
||||
|
@ -717,7 +713,7 @@ function ldap_process_user_login ($login, $password) {
|
|||
|
||||
$correct = false;
|
||||
if(!empty($ldap_base_dn)) {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, $memberof['dn'], $password) ) {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($memberof['dn']), $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
}
|
||||
|
@ -739,6 +735,67 @@ function ldap_process_user_login ($login, $password) {
|
|||
}
|
||||
}
|
||||
|
||||
function get_ldap_login_attr ($login) {
|
||||
global $config;
|
||||
|
||||
if (! function_exists ("ldap_connect")) {
|
||||
$config["auth_error"] = __('Your installation of PHP does not support LDAP');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Connect to the LDAP server
|
||||
$ds = @ldap_connect ($config["ldap_server"], $config["ldap_port"]);
|
||||
|
||||
if (!$ds) {
|
||||
$config["auth_error"] = 'Error connecting to LDAP server';
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the LDAP version
|
||||
ldap_set_option ($ds, LDAP_OPT_PROTOCOL_VERSION, $config["ldap_version"]);
|
||||
|
||||
if ($config["ldap_start_tls"]) {
|
||||
if (!@ldap_start_tls ($ds)) {
|
||||
$config["auth_error"] = 'Could not start TLS for LDAP connection';
|
||||
@ldap_close ($ds);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$id_user = $login;
|
||||
|
||||
switch ($config['ldap_login_user_attr']) {
|
||||
case 'email':
|
||||
$dc = io_safe_output($config["ldap_base_dn"]);
|
||||
|
||||
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
|
||||
$justthese = array("mail");
|
||||
|
||||
$sr = ldap_search($ds, $dc, $filter, $justthese);
|
||||
|
||||
$info = ldap_get_entries($ds, $sr);
|
||||
|
||||
if ($info["count"] == 0 && !isset($info[0]["mail"])) {
|
||||
@ldap_close ($ds);
|
||||
return $id_user;
|
||||
}
|
||||
else {
|
||||
$info = $info[0];
|
||||
}
|
||||
|
||||
$id_user = $info['mail'][0];
|
||||
|
||||
@ldap_close ($ds);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return $id_user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a user is in the autocreate blacklist.
|
||||
*
|
||||
|
@ -759,6 +816,458 @@ function is_user_blacklisted ($user) {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check permissions in LDAP for prepare to create user in Pandora.
|
||||
*
|
||||
* @param string Login
|
||||
* @param string Password
|
||||
* @param string User Info
|
||||
* @param string check_permissions Check if change permissions
|
||||
*
|
||||
* @return bool True if the login succeeds, false otherwise
|
||||
*/
|
||||
function prepare_permissions_groups_of_user_ldap ($id_user, $password,
|
||||
$user_info, $check_permissions = false, $syncronize = false) {
|
||||
|
||||
global $config;
|
||||
include_once($config['homedir'] . "/include/functions_html.php");
|
||||
|
||||
if (! function_exists ("ldap_connect")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do not allow blank passwords
|
||||
if ($password == "") {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Connect to the LDAP server
|
||||
$ds = @ldap_connect ($config["ldap_server"], $config["ldap_port"]);
|
||||
if (!$ds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the LDAP version
|
||||
ldap_set_option ($ds, LDAP_OPT_PROTOCOL_VERSION, $config["ldap_version"]);
|
||||
|
||||
if ($config["ldap_start_tls"]) {
|
||||
if (!@ldap_start_tls ($ds)) {
|
||||
@ldap_close ($ds);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$dc = io_safe_output($config["ldap_base_dn"]);
|
||||
|
||||
#Search group of this user it belong.
|
||||
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
|
||||
$justthese = array("objectclass=group");
|
||||
|
||||
$sr = ldap_search($ds, $dc, $filter, $justthese);
|
||||
|
||||
$memberof = ldap_get_entries($ds, $sr);
|
||||
|
||||
if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
|
||||
@ldap_close ($ds);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$memberof = $memberof[0];
|
||||
}
|
||||
|
||||
unset($memberof["count"]);
|
||||
|
||||
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
|
||||
|
||||
$correct = false;
|
||||
if(!empty($ldap_base_dn)) {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, $memberof['dn'], $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$correct) {
|
||||
@ldap_close ($ds);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$permissions = array();
|
||||
$i = 0;
|
||||
$count_total = 0;
|
||||
|
||||
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
|
||||
|
||||
foreach ($ldap_adv_perms as $ldap_adv_perm) {
|
||||
$groups = $ldap_adv_perm['groups_ldap'];
|
||||
|
||||
if ($groups[0] == '') {
|
||||
$groups = array();
|
||||
}
|
||||
else {
|
||||
$groups = $groups[0];
|
||||
}
|
||||
|
||||
$count_ad_adv_perms = count(explode(",", $groups));
|
||||
|
||||
$tags_ids = array();
|
||||
$tags = implode(",", $tags);
|
||||
if ($tags == null) {
|
||||
$tags = "";
|
||||
}
|
||||
|
||||
foreach ($memberof as $member) {
|
||||
$member_to_compare = str_replace($config['ldap_login_attr'] . "=", "", $member);
|
||||
$member_to_compare = str_replace($id_user . ",", "", $member_to_compare);
|
||||
$member_to_compare = str_replace("," . $dc, "", $member_to_compare);
|
||||
|
||||
if (($member_to_compare == $dc) && (empty($groups))) {
|
||||
$count_total++;
|
||||
}
|
||||
else {
|
||||
$member_to_compare = explode(",", $member_to_compare);
|
||||
$groups = explode(",", $groups);
|
||||
foreach ($groups as $g) {
|
||||
if ($member_to_compare[0] == $g) {
|
||||
$count_total++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($count_total > 0) {
|
||||
$profile_id = $ldap_adv_perm['profile'];
|
||||
$id_grupos = $ldap_adv_perm['group'];
|
||||
|
||||
if (empty($profile_id)) {
|
||||
@ldap_close ($ds);
|
||||
return false;
|
||||
}
|
||||
|
||||
$permissions[$i]["profile"] = $profile_id;
|
||||
$permissions[$i]["groups"] = $id_grupos;
|
||||
$permissions[$i]["tags"] = $tags;
|
||||
}
|
||||
$i++;
|
||||
$count_total = 0;
|
||||
$count_ad_adv_perms = 0;
|
||||
}
|
||||
|
||||
if ( $check_permissions ) {
|
||||
$result = check_permission_ldap ($id_user, $password, $user_info, $permissions, $syncronize);
|
||||
@ldap_close ($ds);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (!is_user ($id_user)) {
|
||||
if (($config['ldap_login_user_attr'] != 'name') && ($config['ldap_login_user_attr'] != null)) {
|
||||
switch ($config['ldap_login_user_attr']) {
|
||||
case 'email':
|
||||
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
|
||||
$justthese = array("mail");
|
||||
|
||||
$sr = ldap_search($ds, $dc, $filter, $justthese);
|
||||
|
||||
$info = ldap_get_entries($ds, $sr);
|
||||
|
||||
if ($info["count"] == 0 && !isset($info[0]["mail"])) {
|
||||
@ldap_close ($ds);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$info = $info[0];
|
||||
}
|
||||
|
||||
$id_user = $info['mail'][0];
|
||||
$user_info['fullname'] = $id_user;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$create_user = create_user_and_permisions_ldap($id_user, $password, $user_info, $permissions, $syncronize);
|
||||
}
|
||||
|
||||
@ldap_close ($ds);
|
||||
|
||||
return $create_user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create progile with data obtaint from AD
|
||||
*
|
||||
* @param string Login
|
||||
* @param string Password
|
||||
* @param array user_info
|
||||
* @param array permiisons
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function create_user_and_permisions_ldap ($id_user, $password, $user_info,
|
||||
$permissions, $syncronize = false) {
|
||||
global $config;
|
||||
|
||||
$values = $user_info;
|
||||
$values["id_user"] = $id_user;
|
||||
|
||||
if ($config['ldap_save_password']) {
|
||||
$values["password"] = md5 ($password);
|
||||
}
|
||||
$values["last_connect"] = 0;
|
||||
$values["registered"] = get_system_time ();
|
||||
if ( defined("METACONSOLE") && $syncronize )
|
||||
$values['metaconsole_access_node'] = $config['ldap_adv_user_node'];
|
||||
$user = (@db_process_sql_insert ("tusuario", $values)) !== false;
|
||||
|
||||
if ($user) {
|
||||
if (!empty($permissions)) {
|
||||
foreach ($permissions as $permission) {
|
||||
$id_profile = $permission["profile"];
|
||||
$id_groups = $permission["groups"];
|
||||
$tags = $permission["tags"];
|
||||
|
||||
foreach ($id_groups as $id_group) {
|
||||
$profile = profile_create_user_profile(
|
||||
$id_user, $id_profile, $id_group, false, $tags);
|
||||
}
|
||||
|
||||
if ( defined("METACONSOLE") && $syncronize ) {
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
|
||||
unset($values['metaconsole_access_node']);
|
||||
$values['not_login'] = (int) !$config['ldap_adv_user_node'];
|
||||
|
||||
$servers = metaconsole_get_servers();
|
||||
foreach ($servers as $server) {
|
||||
$perfil_maestro = db_get_row('tperfil',
|
||||
'id_perfil', $permission["profile"]);
|
||||
|
||||
if (metaconsole_connect($server) == NOERR ) {
|
||||
|
||||
if (!profile_exist($perfil_maestro['name'])) {
|
||||
unset($perfil_maestro['id_perfil']);
|
||||
$id_profile = db_process_sql_insert('tperfil', $perfil_maestro);
|
||||
}
|
||||
else {
|
||||
$id_profile = db_get_value('id_perfil', 'tperfil', 'name', $perfil_maestro['name']);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
if (!$profile)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$profile = profile_create_user_profile(
|
||||
$id_user, $config['default_remote_profile'], $config['default_remote_group'], false, $config['default_assign_tags']);
|
||||
|
||||
if (!$profile)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user have right permission in pandora. This
|
||||
* permission depend of ldap.
|
||||
*
|
||||
* @param string Login
|
||||
* @param string Password
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function check_permission_ldap ($id_user, $password, $user_info,
|
||||
$permissions, $syncronize = false) {
|
||||
|
||||
global $config;
|
||||
include_once($config['homedir'] . "/enterprise/include/functions_metaconsole.php");
|
||||
|
||||
$result_user = users_get_user_by_id($id_user);
|
||||
$filter = array("id_usuario" => $id_user);
|
||||
$profiles_user = array();
|
||||
$user_profiles =
|
||||
db_get_all_rows_filter ("tusuario_perfil", $filter);
|
||||
|
||||
foreach ($user_profiles as $user_profile) {
|
||||
$profiles_user[$user_profile["id_up"]] =
|
||||
$user_profile["id_perfil"];
|
||||
}
|
||||
|
||||
$profiles_user_nodes = array();
|
||||
$permissions_nodes = array();
|
||||
if ( is_metaconsole() && $syncronize ) {
|
||||
$servers = metaconsole_get_servers();
|
||||
foreach ($servers as $server) {
|
||||
if ( metaconsole_connect($server) == NOERR ) {
|
||||
$user_profiles_nodes =
|
||||
db_get_all_rows_filter ("tusuario_perfil", $filter);
|
||||
foreach ($user_profiles_nodes as $user_profile_node) {
|
||||
$profiles_user_nodes[$server['server_name']][$user_profile_node["id_up"]] =
|
||||
$user_profile_node["id_perfil"];
|
||||
}
|
||||
}
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
foreach ($permissions as $key => $permission) {
|
||||
$perfil_maestro = db_get_row('tperfil',
|
||||
'id_perfil', $permission['profile']);
|
||||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect($server) == NOERR ) {
|
||||
if (profile_exist($perfil_maestro['name'])) {
|
||||
$id_profile = db_get_value('id_perfil', 'tperfil', 'name', $perfil_maestro['name']);
|
||||
$permissions_nodes[$server['server_name']][$key] = $permission;
|
||||
$permissions_nodes[$server['server_name']][$key]['profile'] = $id_profile;
|
||||
}
|
||||
}
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$no_found = array();
|
||||
if ($result_user) {
|
||||
foreach ($permissions as $permission) {
|
||||
$id_profile = $permission["profile"];
|
||||
$id_groups = $permission["groups"];
|
||||
$tags = $permission["tags"];
|
||||
|
||||
foreach ($id_groups as $id_group) {
|
||||
$filter = array("id_usuario" => $id_user,
|
||||
"id_perfil"=>$id_profile,
|
||||
"id_grupo" => $id_group);
|
||||
//~ Find perfil with advance permissions in
|
||||
//~ authentication menu. This data depends on
|
||||
//~ groups where this user it belong.
|
||||
$result_profiles =
|
||||
db_get_row_filter ("tusuario_perfil", $filter);
|
||||
if (!$result_profiles) {
|
||||
#If not found save in array.
|
||||
$no_found[] = array("id_perfil"=>$id_profile,
|
||||
"id_grupo" => $id_group, "tags" =>$tags);
|
||||
}
|
||||
else {
|
||||
#if profile is find, delete from array.
|
||||
db_process_sql_update("tusuario_perfil",
|
||||
array("tags" =>$tags),
|
||||
array('id_usuario' => $id_user,
|
||||
'id_up' => $profiles_user[$id_profile]));
|
||||
|
||||
unset($profiles_user[$result_profiles["id_up"]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole() && $syncronize) {
|
||||
$servers = metaconsole_get_servers();
|
||||
foreach ($servers as $server) {
|
||||
foreach ($permissions_nodes[$server['server_name']] as $permission_node) {
|
||||
|
||||
$id_profile = $permission_node["profile"];
|
||||
$id_groups = $permission_node["groups"];
|
||||
$tags = $permission_node["tags"];
|
||||
|
||||
foreach ($id_groups as $id_group) {
|
||||
|
||||
$filter = array("id_usuario" => $id_user,
|
||||
"id_perfil"=>$id_profile,
|
||||
"id_grupo" => $id_group);
|
||||
|
||||
if (metaconsole_connect($server) == NOERR ) {
|
||||
$result_profiles =
|
||||
db_get_row_filter ("tusuario_perfil", $filter);
|
||||
|
||||
if (!$result_profiles) {
|
||||
#If not found save in array.
|
||||
$no_found_server[$server['server_name']][] = array("id_perfil" => $id_profile,
|
||||
"id_grupo" => $id_group, "tags" => $tags);
|
||||
}
|
||||
else {
|
||||
#if profile is find, delete from array.
|
||||
db_process_sql_update("tusuario_perfil",
|
||||
array("tags" =>$tags),
|
||||
array('id_usuario' => $id_user,
|
||||
'id_up' => $profiles_user_nodes[$server_name][$id_profile]));
|
||||
|
||||
unset($profiles_user_nodes[$server_name][$result_profiles["id_up"]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty($profiles_user) && empty($no_found) ) {
|
||||
#The permmisions of user not changed
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
foreach ($profiles_user as $key => $profile_user) {
|
||||
#The other profiles are deleted
|
||||
profile_delete_user_profile ($id_user, $key);
|
||||
}
|
||||
|
||||
if ( is_metaconsole() && $syncronize ) {
|
||||
foreach ($profiles_user_nodes as $server_name => $profile_users) {
|
||||
$server = metaconsole_get_connection($server_name);
|
||||
foreach ($profile_users as $key => $profile_user) {
|
||||
if ( metaconsole_connect($server) == NOERR ) {
|
||||
profile_delete_user_profile ($id_user, $key);
|
||||
}
|
||||
}
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($no_found as $new_profiles) {
|
||||
#Add the missing permissions
|
||||
profile_create_user_profile ($id_user,
|
||||
$new_profiles["id_perfil"],
|
||||
$new_profiles["id_grupo"], false,
|
||||
$new_profiles["tags"]);
|
||||
}
|
||||
|
||||
if ( is_metaconsole() && $syncronize ) {
|
||||
$servers = metaconsole_get_servers();
|
||||
foreach ($servers as $server) {
|
||||
if ( metaconsole_connect($server) == NOERR ) {
|
||||
foreach ($no_found_server[$server['server_name']] as $new_profiles) {
|
||||
profile_create_user_profile ($id_user,
|
||||
$new_profiles["id_perfil"],
|
||||
$new_profiles["id_grupo"], false,
|
||||
$new_profiles["tags"]);
|
||||
}
|
||||
}
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
return "permissions_changed";
|
||||
}
|
||||
}
|
||||
else {
|
||||
return "error_permissions";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update local user pass from ldap user
|
||||
*
|
||||
|
@ -770,13 +1279,23 @@ function is_user_blacklisted ($user) {
|
|||
function change_local_user_pass_ldap ($id_user, $password) {
|
||||
$local_user_pass = db_get_value_filter('password', 'tusuario', array('id_user' => $id_user));
|
||||
|
||||
$return = false;
|
||||
if (md5($password) !== $local_user_pass) {
|
||||
$values_update = array();
|
||||
$values_update['password'] = md5($password);
|
||||
|
||||
db_process_sql_update('tusuario', $values_update, array('id_user' => $id_user));
|
||||
$return = db_process_sql_update('tusuario', $values_update, array('id_user' => $id_user));
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
function delete_user_pass_ldap ($id_user) {
|
||||
$values_update = array();
|
||||
$values_update['password'] = null;
|
||||
|
||||
$return = db_process_sql_update('tusuario', $values_update, array('id_user' => $id_user));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC171114';
|
||||
$build_version = 'PC171127';
|
||||
$pandora_version = 'v7.0NG.715';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -1594,7 +1594,7 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '',
|
|||
case '2c':
|
||||
case '1':
|
||||
default:
|
||||
$command_str = $snmpwalk_bin . ' -m ALL -Oa -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg($snmp_community) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir;
|
||||
$command_str = $snmpwalk_bin . ' -m ALL -Oa -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg(io_safe_output($snmp_community)) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -345,7 +345,17 @@ function config_update_config () {
|
|||
$error_update[] = __('Login attribute');
|
||||
if (!config_update_value ('fallback_local_auth', get_parameter ('fallback_local_auth')))
|
||||
$error_update[] = __('Fallback to local authentication');
|
||||
|
||||
if (!config_update_value ('ldap_login_user_attr', get_parameter ('ldap_login_user_attr')))
|
||||
$error_update[] = __('Login user attribute');
|
||||
|
||||
if (isset($config['fallback_local_auth']) && $config['fallback_local_auth'] == 0) {
|
||||
if (!config_update_value ('ldap_save_password', get_parameter ('ldap_save_password')))
|
||||
$error_update[] = __('Save Password');
|
||||
}
|
||||
else if (isset($config['fallback_local_auth']) && $config['fallback_local_auth'] == 1) {
|
||||
config_update_value ('ldap_save_password', 1);
|
||||
}
|
||||
|
||||
if (!config_update_value ('rpandora_server', get_parameter ('rpandora_server')))
|
||||
$error_update[] = __('MySQL host');
|
||||
if (!config_update_value ('rpandora_port', get_parameter ('rpandora_port')))
|
||||
|
|
|
@ -30,24 +30,30 @@ function cron_update_module_interval ($module_id, $cron) {
|
|||
$module_interval = db_get_value_filter('module_interval','tagente_modulo',array("id_agente_modulo" => $module_id));
|
||||
return db_process_sql ('UPDATE tagente_estado SET current_interval = ' . $module_interval . ' WHERE id_agente_modulo = ' . (int) $module_id);
|
||||
} else {
|
||||
return db_process_sql ('UPDATE tagente_estado SET current_interval = ' . cron_next_execution ($cron) . ' WHERE id_agente_modulo = ' . (int) $module_id);
|
||||
return db_process_sql (
|
||||
'UPDATE tagente_estado SET current_interval = ' .
|
||||
cron_next_execution ($cron, $module_interval, $module_id) .
|
||||
' WHERE id_agente_modulo = ' .
|
||||
(int) $module_id)
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Get the number of seconds left to the next execution of the given cron entry.
|
||||
function cron_next_execution ($cron) {
|
||||
function cron_next_execution ($cron, $module_interval, $module_id) {
|
||||
|
||||
// Get day of the week and month from cron config
|
||||
list ($minute, $hour, $mday, $month, $wday) = explode (" ", $cron);
|
||||
|
||||
// Get current time
|
||||
$cur_time = time();
|
||||
// Get last execution time
|
||||
$last_execution = db_get_value('utimestamp', 'tagente_estado', 'id_agente_modulo', $module_id);
|
||||
$cur_time = ($last_execution !== false) ? $last_execution : time();
|
||||
|
||||
// Any day of the way
|
||||
if ($wday == '*') {
|
||||
$nex_time = cron_next_execution_date ($cron, $cur_time);
|
||||
$nex_time = cron_next_execution_date ($cron, $cur_time, $module_interval);
|
||||
return $nex_time - $cur_time;
|
||||
}
|
||||
|
||||
|
@ -55,7 +61,7 @@ function cron_next_execution ($cron) {
|
|||
$count = 0;
|
||||
$nex_time = $cur_time;
|
||||
do {
|
||||
$nex_time = cron_next_execution_date ($cron, $nex_time);
|
||||
$nex_time = cron_next_execution_date ($cron, $nex_time, $module_interval);
|
||||
$nex_time_wd = $nex_time;
|
||||
list ($nex_mon, $nex_wday) = explode (" ", date ("m w", $nex_time_wd));
|
||||
|
||||
|
@ -80,90 +86,202 @@ function cron_next_execution ($cron) {
|
|||
}
|
||||
|
||||
// Get the next execution date for the given cron entry in seconds since epoch.
|
||||
function cron_next_execution_date ($cron, $cur_time = false) {
|
||||
function cron_next_execution_date ($cron, $cur_time = false, $module_interval = 300) {
|
||||
|
||||
// Get cron configuration
|
||||
list ($min, $hour, $mday, $mon, $wday) = explode (" ", $cron);
|
||||
|
||||
$cron_array = explode (" ", $cron);
|
||||
// Months start from 0
|
||||
if ($mon != '*') {
|
||||
$mon -= 1;
|
||||
if ($cron_array[3] != '*') {
|
||||
$mon_s = cron_get_interval ($cron_array[3]);
|
||||
if ($mon_s['up'] !== false) {
|
||||
$cron_array[3] = $mon_s['down'] - 1 . "-" . $mon_s['up'] - 1;
|
||||
} else {
|
||||
$cron_array[3] = $mon_s['down'] - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Get current time
|
||||
if ($cur_time === false) {
|
||||
$cur_time = time();
|
||||
}
|
||||
list ($cur_min, $cur_hour, $cur_mday, $cur_mon, $cur_year) = explode (" ", date ("i H d m Y", $cur_time));
|
||||
if ($cur_time === false) $cur_time = time();
|
||||
|
||||
$nex_time = $cur_time + $module_interval;
|
||||
$nex_time_array = explode (" ", date ("i H d m Y", $nex_time));
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array)) return $nex_time;
|
||||
|
||||
// Get first next date candidate from cron configuration
|
||||
$nex_min = $min;
|
||||
$nex_hour = $hour;
|
||||
$nex_mday = $mday;
|
||||
$nex_mon = $mon;
|
||||
$nex_year = $cur_year;
|
||||
// Get first next date candidate from next cron configuration
|
||||
// Initialize some vars
|
||||
$prev_ovfl = false;
|
||||
|
||||
// Update minutes
|
||||
$min_s = cron_get_interval ($cron_array[0]);
|
||||
$nex_time_array[0] = ($min_s['down'] == '*') ? 0 : $min_s['down'];
|
||||
|
||||
// Replace wildcards
|
||||
if ($min == '*') {
|
||||
if ($hour != '*' || $mday != '*' || $wday != '*' || $mon != '*') {
|
||||
$nex_min = 0;
|
||||
}
|
||||
else {
|
||||
$nex_min = $cur_min;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time >= $cur_time) {
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
}
|
||||
if ($hour == '*') {
|
||||
if ($mday != '*' || $wday != '*' ||$mon != '*') {
|
||||
$nex_hour = 0;
|
||||
}
|
||||
else {
|
||||
$nex_hour = $cur_hour;
|
||||
}
|
||||
}
|
||||
if ($mday == '*') {
|
||||
if ($mon != '*') {
|
||||
$nex_mday = 1;
|
||||
}
|
||||
else {
|
||||
$nex_mday = $cur_mday;
|
||||
}
|
||||
}
|
||||
if ($mon == '*') {
|
||||
$nex_mon = $cur_mon;
|
||||
}
|
||||
|
||||
// Find the next execution date
|
||||
$count = 0;
|
||||
do {
|
||||
$next_time = mktime($nex_hour, $nex_min, 0, $nex_mon, $nex_mday, $nex_year);
|
||||
if ($next_time > $cur_time) {
|
||||
return $next_time;
|
||||
}
|
||||
if ($min == '*' && $hour == '*' && $wday == '*' && $mday == '*' && $mon == '*') {
|
||||
list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1MINUTE));
|
||||
}
|
||||
else if ($hour == '*' && $wday == '*' && $mday == '*' && $mon == '*') {
|
||||
list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1HOUR));
|
||||
}
|
||||
else if ($mday == '*' && $mon == '*') {
|
||||
list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1DAY));
|
||||
}
|
||||
else if ($mon == '*') {
|
||||
$nex_mon = $nex_mon + 1;
|
||||
if ($nex_mon > 11) {
|
||||
$nex_mon = 0;
|
||||
$nex_year++;
|
||||
|
||||
// Check if next hour is in cron
|
||||
$nex_time_array[1]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
|
||||
if ($nex_time === false) {
|
||||
// Update the month day if overflow
|
||||
$prev_ovfl = true;
|
||||
$nex_time_array[1] = 0;
|
||||
$nex_time_array[2]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time === false) {
|
||||
// Update the month if overflow
|
||||
$nex_time_array[2] = 1;
|
||||
$nex_time_array[3]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time === false) {
|
||||
#Update the year if overflow
|
||||
$nex_time_array[3] = 0;
|
||||
$nex_time_array[4]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$nex_year++;
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
while ($count < SECONDS_1DAY);
|
||||
// Check the hour
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
|
||||
// Update the hour if fails
|
||||
$hour_s = cron_get_interval ($cron_array[1]);
|
||||
$nex_time_array[1] = ($hour_s['down'] == '*') ? 0 : $hour_s['down'];
|
||||
|
||||
// When an overflow is passed check the hour update again
|
||||
if ($prev_ovfl) {
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
}
|
||||
$prev_ovfl = false;
|
||||
|
||||
// Check if next day is in cron
|
||||
$nex_time_array[2]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time === false) {
|
||||
// Update the month if overflow
|
||||
$prev_ovfl = true;
|
||||
$nex_time_array[2] = 1;
|
||||
$nex_time_array[3]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time === false) {
|
||||
// Update the year if overflow
|
||||
$nex_time_array[3] = 0;
|
||||
$nex_time_array[4]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
}
|
||||
}
|
||||
// Check the day
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
|
||||
// Update the day if fails
|
||||
$mday_s = cron_get_interval ($cron_array[2]);
|
||||
$nex_time_array[2] = ($mday_s['down'] == '*') ? 1 : $mday_s['down'];
|
||||
|
||||
// When an overflow is passed check the hour update in the next execution
|
||||
if ($prev_ovfl) {
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
}
|
||||
$prev_ovfl = false;
|
||||
|
||||
// Check if next month is in cron
|
||||
$nex_time_array[3]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time === false) {
|
||||
#Update the year if overflow
|
||||
$prev_ovfl = true;
|
||||
$nex_time_array[3]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
}
|
||||
|
||||
// Check the month
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
|
||||
// Update the month if fails
|
||||
$mon_s = cron_get_interval ($cron_array[3]);
|
||||
$nex_time_array[3] = ($mon_s['down'] == '*') ? 0 : $mon_s['down'];
|
||||
|
||||
// When an overflow is passed check the hour update in the next execution
|
||||
if ($prev_ovfl) {
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the year
|
||||
$nex_time_array[4]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
|
||||
return ($nex_time !== false) ? $nex_time : $module_interval;
|
||||
}
|
||||
|
||||
// Get an array with the cron interval
|
||||
function cron_get_interval ($element) {
|
||||
# Not a range
|
||||
if (!preg_match('/(\d+)\-(\d+)/', $element, $capture)) {
|
||||
return array(
|
||||
'down' => $element,
|
||||
'up' => false
|
||||
);
|
||||
}
|
||||
return array(
|
||||
'down' => $capture[1],
|
||||
'up' => $capture[2]
|
||||
);
|
||||
}
|
||||
|
||||
// Returns if a date is in a cron. Recursive.
|
||||
function cron_is_in_cron($elems_cron, $elems_curr_time) {
|
||||
|
||||
// Something went wrong, default to 5 minutes
|
||||
return $cur_time + SECONDS_5MINUTES;
|
||||
$elem_cron = array_shift($elems_cron);
|
||||
$elem_curr_time = array_shift($elems_curr_time);
|
||||
|
||||
// If there is no elements means that is in cron
|
||||
if ($elem_cron === null || $elem_curr_time === null) return true;
|
||||
|
||||
// Go to last element if current is a wild card
|
||||
if ($elem_cron != '*') {
|
||||
$elem_s = cron_get_interval($elem_cron);
|
||||
// Check if there is no a range
|
||||
if (($elem_s['up'] === false) && ($elem_s['down'] != $elem_curr_time)) {
|
||||
return false;
|
||||
}
|
||||
// Check if there is on the range
|
||||
if ($elem_s['up'] !== false) {
|
||||
if ($elem_s['down'] < $elem_s['up']) {
|
||||
if ($elem_curr_time < $elem_s['down'] || $elem_curr_time > $elem_s['up']){
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if ($elem_curr_time > $elem_s['down'] || $elem_curr_time < $elem_s['up']){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return cron_is_in_cron($elems_cron, $elems_curr_time);
|
||||
}
|
||||
|
||||
function cron_valid_date ($da) {
|
||||
$st = sprintf("%04d:%02d:%02d %02d:%02d:00", $da[4], $da[3], $da[2], $da[1], $da[0]);
|
||||
$time = strtotime($st);
|
||||
return $time;
|
||||
}
|
||||
|
||||
// Check if cron is properly constructed
|
||||
|
|
|
@ -1060,8 +1060,8 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu
|
|||
}
|
||||
|
||||
// Short name
|
||||
$name = $agent["nombre"];
|
||||
if ($cut_names) {
|
||||
$name = io_safe_output($agent["nombre"]);
|
||||
if ((strlen ($name) > 16) && ($cut_names)) {
|
||||
$name = ui_print_truncate_text($name, 16, false, true, false);
|
||||
}
|
||||
|
||||
|
@ -1111,7 +1111,7 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu
|
|||
}
|
||||
|
||||
$node = "\n" . $agent['id_node'].' [ parent="' . $agent['id_parent'] . '", color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' . $img_node . '</TD></TR>
|
||||
<TR><TD>'.$name.'</TD></TR></TABLE>>,
|
||||
<TR><TD>'.io_safe_input($name).'</TD></TR></TABLE>>,
|
||||
shape="doublecircle", URL="'.$url.'",
|
||||
tooltip="' . $url_tooltip . '"];' . "\n";
|
||||
}
|
||||
|
@ -1174,7 +1174,7 @@ function networkmap_create_module_group_node ($module_group, $simple = 0, $font_
|
|||
'", fontsize='.$font_size.', style="filled", ' .
|
||||
'fixedsize=true, width=0.30, height=0.30, ' .
|
||||
'label=<<TABLE data-id_agent="' . $module_group['id_agent'] . '" data-status="' . $module_group['status'] . '" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' .
|
||||
$module_group['name'] . '</TD></TR></TABLE>>,
|
||||
io_safe_output($module_group['name']) . '</TD></TR></TABLE>>,
|
||||
shape="square", URL="' . $url . '",
|
||||
tooltip="' . $url_tooltip . '"];';
|
||||
}
|
||||
|
@ -1268,7 +1268,7 @@ function networkmap_create_module_node ($module, $simple = 0, $font_size = 10, $
|
|||
'fixedsize=true, width=0.30, height=0.30, ' .
|
||||
'label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' .
|
||||
$img_node . '</TD></TR>
|
||||
<TR><TD>' . $module['nombre'] . '</TD></TR></TABLE>>,
|
||||
<TR><TD>' . io_safe_output($module['nombre']) . '</TD></TR></TABLE>>,
|
||||
shape="circle", URL="' . $url . '",
|
||||
tooltip="' . $url_tooltip . '"];';
|
||||
}
|
||||
|
@ -1412,21 +1412,11 @@ function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom,
|
|||
$size = '';
|
||||
}
|
||||
|
||||
|
||||
if ($layout == 'radial') {
|
||||
$overlap = 'true';
|
||||
}
|
||||
|
||||
if ($layout == 'flat' || $layout == 'radial' || $layout == 'spring1' || $layout == "spring2") {
|
||||
if ($nooverlap != '') {
|
||||
$overlap = 'scalexy';
|
||||
}
|
||||
}
|
||||
|
||||
if ($zoom > 0) {
|
||||
$size_x *= $zoom;
|
||||
$size_y *= $zoom;
|
||||
}
|
||||
|
||||
$size = $size_x . ',' . $size_y;
|
||||
|
||||
if (!is_null($size_canvas)) {
|
||||
|
@ -1436,18 +1426,21 @@ function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom,
|
|||
// BEWARE: graphwiz DONT use single ('), you need double (")
|
||||
$head = "graph networkmap { dpi=100; bgcolor=\"transparent\"; labeljust=l; margin=0; pad=\"0.75,0.75\";";
|
||||
if ($nooverlap != '') {
|
||||
$head .= "overlap=\"$overlap\";";
|
||||
$head .= "ranksep=\"$ranksep\";";
|
||||
$head .= "ranksep=\"4\";";
|
||||
$head .= "outputorder=edgesfirst;";
|
||||
}
|
||||
if ($layout == 'flat' || $layout == 'spring1' || $layout == "spring2") {
|
||||
if ($nooverlap != '') {
|
||||
$head .= "overlap=\"scalexy\";";
|
||||
}
|
||||
}
|
||||
|
||||
$head .= "ratio=fill;";
|
||||
$head .= "root=0;";
|
||||
$head .= "nodesep=\"0.02\";";
|
||||
$head .= "nodesep=\"0.=2\";";
|
||||
$head .= "size=\"$size\";";
|
||||
|
||||
$head .= "\n";
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ function networkmap_process_networkmap($id = 0) {
|
|||
|
||||
$networkmap = db_get_row_filter('tmap',
|
||||
array('id' => $id));
|
||||
$filter = json_decode($networkmap['filter'], true);
|
||||
$map_filter = json_decode($networkmap['filter'], true);
|
||||
|
||||
$pure = (int)get_parameter('pure', 0);
|
||||
|
||||
|
@ -95,181 +95,315 @@ function networkmap_process_networkmap($id = 0) {
|
|||
}
|
||||
|
||||
$nodes_and_relations = array();
|
||||
|
||||
|
||||
if (enterprise_installed() && ($numNodes > 0)) {
|
||||
$nodes_and_relations = get_structure_nodes($id);
|
||||
}
|
||||
else {
|
||||
// Generate dot file
|
||||
$graph = networkmap_generate_dot (__('Pandora FMS'),
|
||||
$id_group,
|
||||
$simple,
|
||||
$font_size,
|
||||
$layout,
|
||||
$nooverlap,
|
||||
$zoom,
|
||||
$ranksep,
|
||||
$center,
|
||||
$regen,
|
||||
$pure,
|
||||
$id,
|
||||
$show_snmp_modules,
|
||||
false, //cut_names
|
||||
true, // relative
|
||||
'',
|
||||
$ip_mask,
|
||||
$dont_show_subgroups,
|
||||
false,
|
||||
null,
|
||||
$old_mode);
|
||||
|
||||
switch (PHP_OS) {
|
||||
case "WIN32":
|
||||
case "WINNT":
|
||||
case "Windows":
|
||||
$filename_dot = sys_get_temp_dir() . "\\networkmap_" . $filter;
|
||||
break;
|
||||
default:
|
||||
$filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($simple) {
|
||||
$filename_dot .= "_simple";
|
||||
}
|
||||
if ($nooverlap) {
|
||||
$filename_dot .= "_nooverlap";
|
||||
}
|
||||
$filename_dot .= "_" . $id . ".dot";
|
||||
if ($map_filter['empty_map']) {
|
||||
// Open Graph
|
||||
$graph = networkmap_open_graph ($layout, $nooverlap, $pure, $zoom,
|
||||
$ranksep, $font_size, null);
|
||||
$graph .= networkmap_create_pandora_node (__('Pandora FMS'), $font_size, $simple);
|
||||
$graph .= networkmap_close_graph ();
|
||||
|
||||
file_put_contents($filename_dot, $graph);
|
||||
switch (PHP_OS) {
|
||||
case "WIN32":
|
||||
case "WINNT":
|
||||
case "Windows":
|
||||
$filename_dot = sys_get_temp_dir() . "\\networkmap_" . $filter;
|
||||
break;
|
||||
default:
|
||||
$filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($simple) {
|
||||
$filename_dot .= "_simple";
|
||||
}
|
||||
if ($nooverlap) {
|
||||
$filename_dot .= "_nooverlap";
|
||||
}
|
||||
$filename_dot .= "_" . $id . ".dot";
|
||||
|
||||
switch (PHP_OS) {
|
||||
case "WIN32":
|
||||
case "WINNT":
|
||||
case "Windows":
|
||||
$filename_plain = sys_get_temp_dir() . "\\plain.txt";
|
||||
|
||||
$cmd = io_safe_output($config['graphviz_bin_dir'] . "\\$filter.exe -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot);
|
||||
break;
|
||||
default:
|
||||
$filename_plain = sys_get_temp_dir() . "/plain.txt";
|
||||
file_put_contents($filename_dot, $graph);
|
||||
|
||||
$cmd = "$filter -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot;
|
||||
break;
|
||||
}
|
||||
switch (PHP_OS) {
|
||||
case "WIN32":
|
||||
case "WINNT":
|
||||
case "Windows":
|
||||
$filename_plain = sys_get_temp_dir() . "\\plain.txt";
|
||||
|
||||
$cmd = io_safe_output($config['graphviz_bin_dir'] . "\\$filter.exe -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot);
|
||||
break;
|
||||
default:
|
||||
$filename_plain = sys_get_temp_dir() . "/plain.txt";
|
||||
|
||||
system ($cmd);
|
||||
|
||||
unlink($filename_dot);
|
||||
|
||||
$nodes = networkmap_loadfile($id, $filename_plain,
|
||||
$relation_nodes, $graph);
|
||||
|
||||
unlink($filename_plain);
|
||||
$cmd = "$filter -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot;
|
||||
break;
|
||||
}
|
||||
|
||||
//Set the position of modules
|
||||
foreach ($nodes as $key => $node) {
|
||||
if ($node['type'] == 'module') {
|
||||
//Search the agent of this module for to get the
|
||||
//position
|
||||
foreach ($nodes as $key2 => $node2) {
|
||||
if ($node2['id_agent'] != 0 && $node2['type'] == 'agent') {
|
||||
if ($node2['id_agent'] == $node['id_agent']) {
|
||||
$nodes[$key]['coords'][0] =
|
||||
$nodes[$key2]['coords'][0] + $node['height'] / 2;
|
||||
$nodes[$key]['coords'][1] =
|
||||
$nodes[$key2]['coords'][1] + $node['width'] / 2;
|
||||
system ($cmd);
|
||||
|
||||
unlink($filename_dot);
|
||||
|
||||
$nodes = networkmap_loadfile($id, $filename_plain,
|
||||
$relation_nodes, $graph);
|
||||
|
||||
unlink($filename_plain);
|
||||
|
||||
//Set the position of modules
|
||||
foreach ($nodes as $key => $node) {
|
||||
if ($node['type'] == 'module') {
|
||||
//Search the agent of this module for to get the
|
||||
//position
|
||||
foreach ($nodes as $key2 => $node2) {
|
||||
if ($node2['id_agent'] != 0 && $node2['type'] == 'agent') {
|
||||
if ($node2['id_agent'] == $node['id_agent']) {
|
||||
$nodes[$key]['coords'][0] =
|
||||
$nodes[$key2]['coords'][0] + $node['height'] / 2;
|
||||
$nodes[$key]['coords'][1] =
|
||||
$nodes[$key2]['coords'][1] + $node['width'] / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$nodes_and_relations['nodes'] = array();
|
||||
$index = 0;
|
||||
foreach ($nodes as $key => $node) {
|
||||
$nodes_and_relations['nodes'][$index]['id_map'] = $id;
|
||||
|
||||
$nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0];
|
||||
$nodes_and_relations['nodes'][$index]['y'] = (int)$node['coords'][1];
|
||||
|
||||
if (($node['type'] == 'agent') || ($node['type'] == '')) {
|
||||
$nodes_and_relations['nodes'][$index]['source_data'] = $node['id_agent'];
|
||||
$nodes_and_relations['nodes'][$index]['type'] = 0;
|
||||
}
|
||||
else {
|
||||
$nodes_and_relations['nodes'][$index]['source_data'] = $node['id_module'];
|
||||
$nodes_and_relations['nodes'][$index]['id_agent'] = $node['id_agent'];
|
||||
$nodes_and_relations['nodes'][$index]['type'] = 1;
|
||||
}
|
||||
|
||||
$style = array();
|
||||
$style['shape'] = 'circle';
|
||||
$style['image'] = $node['image'];
|
||||
$style['width'] = $node['width'];
|
||||
$style['height'] = $node['height'];
|
||||
$style['label'] = $node['text'];
|
||||
$style['id_networkmap'] = $node['networkmap'];
|
||||
$nodes_and_relations['nodes'][$index]['style'] = json_encode($style);
|
||||
|
||||
$index++;
|
||||
}
|
||||
|
||||
$nodes_and_relations['relations'] = array();
|
||||
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include_once("include/functions_pandora_networkmap.php");
|
||||
save_generate_nodes($id, $nodes_and_relations);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Generate dot file
|
||||
$graph = networkmap_generate_dot (__('Pandora FMS'),
|
||||
$id_group,
|
||||
$simple,
|
||||
$font_size,
|
||||
$layout,
|
||||
$nooverlap,
|
||||
$zoom,
|
||||
$ranksep,
|
||||
$center,
|
||||
$regen,
|
||||
$pure,
|
||||
$id,
|
||||
$show_snmp_modules,
|
||||
false, //cut_names
|
||||
true, // relative
|
||||
'',
|
||||
$ip_mask,
|
||||
$dont_show_subgroups,
|
||||
false,
|
||||
null,
|
||||
$old_mode);
|
||||
|
||||
switch (PHP_OS) {
|
||||
case "WIN32":
|
||||
case "WINNT":
|
||||
case "Windows":
|
||||
$filename_dot = sys_get_temp_dir() . "\\networkmap_" . $filter;
|
||||
break;
|
||||
default:
|
||||
$filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($simple) {
|
||||
$filename_dot .= "_simple";
|
||||
}
|
||||
if ($nooverlap) {
|
||||
$filename_dot .= "_nooverlap";
|
||||
}
|
||||
$filename_dot .= "_" . $id . ".dot";
|
||||
|
||||
file_put_contents($filename_dot, $graph);
|
||||
|
||||
switch (PHP_OS) {
|
||||
case "WIN32":
|
||||
case "WINNT":
|
||||
case "Windows":
|
||||
$filename_plain = sys_get_temp_dir() . "\\plain.txt";
|
||||
|
||||
$cmd = io_safe_output($config['graphviz_bin_dir'] . "\\$filter.exe -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot);
|
||||
break;
|
||||
default:
|
||||
$filename_plain = sys_get_temp_dir() . "/plain.txt";
|
||||
|
||||
$cmd = "$filter -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot;
|
||||
break;
|
||||
}
|
||||
|
||||
system ($cmd);
|
||||
|
||||
unlink($filename_dot);
|
||||
|
||||
$nodes = networkmap_loadfile($id, $filename_plain,
|
||||
$relation_nodes, $graph);
|
||||
|
||||
unlink($filename_plain);
|
||||
|
||||
//Set the position of modules
|
||||
foreach ($nodes as $key => $node) {
|
||||
if ($node['type'] == 'module') {
|
||||
//Search the agent of this module for to get the
|
||||
//position
|
||||
foreach ($nodes as $key2 => $node2) {
|
||||
if ($node2['id_agent'] != 0 && $node2['type'] == 'agent') {
|
||||
if ($node2['id_agent'] == $node['id_agent']) {
|
||||
$nodes[$key]['coords'][0] =
|
||||
$nodes[$key2]['coords'][0] + $node['height'] / 2;
|
||||
$nodes[$key]['coords'][1] =
|
||||
$nodes[$key2]['coords'][1] + $node['width'] / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$nodes_and_relations['nodes'] = array();
|
||||
$index = 0;
|
||||
$node_center = array();
|
||||
foreach ($nodes as $key => $node) {
|
||||
$nodes_and_relations['nodes'][$index]['id_map'] = $id;
|
||||
|
||||
$children_count = 0;
|
||||
foreach ($relation_nodes as $relation) {
|
||||
if (($relation['parent_type'] == 'agent') || ($relation['parent_type'] == '')) {
|
||||
if ($nodes[$relation['id_parent']]['id_agent'] == $node['id_agent']) {
|
||||
$children_count++;
|
||||
}
|
||||
}
|
||||
else if ($relation['parent_type'] == 'module') {
|
||||
if ($nodes[$relation['id_parent']]['id_module'] == $node['id_module']) {
|
||||
$children_count++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (empty($node_center) || $node_center['counter'] < $children_count) {
|
||||
$node_center['x'] = (int)$node['coords'][0];
|
||||
$node_center['y'] = (int)$node['coords'][1];
|
||||
$node_center['counter'] = $children_count;
|
||||
}
|
||||
|
||||
$nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0];
|
||||
$nodes_and_relations['nodes'][$index]['y'] = (int)$node['coords'][1];
|
||||
|
||||
if (($node['type'] == 'agent') || ($node['type'] == '')) {
|
||||
$nodes_and_relations['nodes'][$index]['source_data'] = $node['id_agent'];
|
||||
$nodes_and_relations['nodes'][$index]['type'] = 0;
|
||||
}
|
||||
else {
|
||||
$nodes_and_relations['nodes'][$index]['source_data'] = $node['id_module'];
|
||||
$nodes_and_relations['nodes'][$index]['id_agent'] = $node['id_agent'];
|
||||
$nodes_and_relations['nodes'][$index]['type'] = 1;
|
||||
}
|
||||
|
||||
$style = array();
|
||||
$style['shape'] = 'circle';
|
||||
$style['image'] = $node['image'];
|
||||
$style['width'] = $node['width'];
|
||||
$style['height'] = $node['height'];
|
||||
$style['label'] = $node['text'];
|
||||
$nodes_and_relations['nodes'][$index]['style'] = json_encode($style);
|
||||
|
||||
$index++;
|
||||
}
|
||||
|
||||
$nodes_and_relations['relations'] = array();
|
||||
$index = 0;
|
||||
foreach ($relation_nodes as $relation) {
|
||||
$nodes_and_relations['relations'][$index]['id_map'] = $id;
|
||||
|
||||
if (($relation['parent_type'] == 'agent') || ($relation['parent_type'] == '')) {
|
||||
$nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent'];
|
||||
$nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_agent'];
|
||||
$nodes_and_relations['relations'][$index]['parent_type'] = 0;
|
||||
}
|
||||
else if ($relation['parent_type'] == 'module') {
|
||||
$nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent'];
|
||||
$nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_module'];
|
||||
$nodes_and_relations['relations'][$index]['parent_type'] = 1;
|
||||
}
|
||||
else {
|
||||
$nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = -2;
|
||||
$nodes_and_relations['relations'][$index]['parent_type'] = 3;
|
||||
}
|
||||
|
||||
if (($relation['child_type'] == 'agent') || ($relation['child_type'] == '')) {
|
||||
$nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_agent'];
|
||||
$nodes_and_relations['relations'][$index]['child_type'] = 0;
|
||||
}
|
||||
else if ($relation['child_type'] == 'module') {
|
||||
$nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_module'];
|
||||
$nodes_and_relations['relations'][$index]['child_type'] = 1;
|
||||
}
|
||||
else {
|
||||
$nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = -2;
|
||||
$nodes_and_relations['relations'][$index]['child_type'] = 3;
|
||||
}
|
||||
|
||||
$index++;
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include_once("include/functions_pandora_networkmap.php");
|
||||
save_generate_nodes($id, $nodes_and_relations);
|
||||
}
|
||||
|
||||
$pandorafms_node = $nodes_and_relations['nodes'][0];
|
||||
$center = array('x' => $node_center['x'], 'y' => $node_center['y']);
|
||||
|
||||
$networkmap['center_x'] = $center['x'];
|
||||
$networkmap['center_y'] = $center['y'];
|
||||
db_process_sql_update('tmap',
|
||||
array('center_x' => $networkmap['center_x'], 'center_y' => $networkmap['center_y']),
|
||||
array('id' => $id));
|
||||
}
|
||||
|
||||
$nodes_and_relations['nodes'] = array();
|
||||
$index = 0;
|
||||
foreach ($nodes as $key => $node) {
|
||||
$nodes_and_relations['nodes'][$index]['id_map'] = $id;
|
||||
|
||||
$nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0];
|
||||
$nodes_and_relations['nodes'][$index]['y'] = (int)$node['coords'][1];
|
||||
|
||||
if (($node['type'] == 'agent') || ($node['type'] == '')) {
|
||||
$nodes_and_relations['nodes'][$index]['source_data'] = $node['id_agent'];
|
||||
$nodes_and_relations['nodes'][$index]['type'] = 0;
|
||||
}
|
||||
else {
|
||||
$nodes_and_relations['nodes'][$index]['source_data'] = $node['id_module'];
|
||||
$nodes_and_relations['nodes'][$index]['id_agent'] = $node['id_agent'];
|
||||
$nodes_and_relations['nodes'][$index]['type'] = 1;
|
||||
}
|
||||
|
||||
$style = array();
|
||||
$style['shape'] = 'circle';
|
||||
$style['image'] = $node['image'];
|
||||
$style['width'] = $node['width'];
|
||||
$style['height'] = $node['height'];
|
||||
$style['label'] = $node['text'];
|
||||
$nodes_and_relations['nodes'][$index]['style'] = json_encode($style);
|
||||
|
||||
$index++;
|
||||
}
|
||||
|
||||
$nodes_and_relations['relations'] = array();
|
||||
$index = 0;
|
||||
foreach ($relation_nodes as $relation) {
|
||||
$nodes_and_relations['relations'][$index]['id_map'] = $id;
|
||||
|
||||
if (($relation['parent_type'] == 'agent') || ($relation['parent_type'] == '')) {
|
||||
$nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent'];
|
||||
$nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_agent'];
|
||||
$nodes_and_relations['relations'][$index]['parent_type'] = 0;
|
||||
}
|
||||
else if ($relation['parent_type'] == 'module') {
|
||||
$nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent'];
|
||||
$nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_module'];
|
||||
$nodes_and_relations['relations'][$index]['parent_type'] = 1;
|
||||
}
|
||||
else {
|
||||
$nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = -2;
|
||||
$nodes_and_relations['relations'][$index]['parent_type'] = 3;
|
||||
}
|
||||
|
||||
if (($relation['child_type'] == 'agent') || ($relation['child_type'] == '')) {
|
||||
$nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_agent'];
|
||||
$nodes_and_relations['relations'][$index]['child_type'] = 0;
|
||||
}
|
||||
else if ($relation['child_type'] == 'module') {
|
||||
$nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_module'];
|
||||
$nodes_and_relations['relations'][$index]['child_type'] = 1;
|
||||
}
|
||||
else {
|
||||
$nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = -2;
|
||||
$nodes_and_relations['relations'][$index]['child_type'] = 3;
|
||||
}
|
||||
|
||||
$index++;
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include_once("include/functions_pandora_networkmap.php");
|
||||
save_generate_nodes($id, $nodes_and_relations);
|
||||
}
|
||||
|
||||
$pandorafms_node = $nodes_and_relations['nodes'][0];
|
||||
$center = array('x' => $pandorafms_node['x'], 'y' => $pandorafms_node['y']);
|
||||
|
||||
$networkmap['center_x'] = $center['x'];
|
||||
$networkmap['center_y'] = $center['y'];
|
||||
db_process_sql_update('tmap',
|
||||
array('center_x' => $networkmap['center_x'], 'center_y' => $networkmap['center_y']),
|
||||
array('id' => $id));
|
||||
}
|
||||
|
||||
return $nodes_and_relations;
|
||||
|
@ -399,6 +533,13 @@ function networkmap_db_node_to_js_node($node, &$count, &$count_item_holding_area
|
|||
if (isset($node['id_map'])) {
|
||||
$item['map_id'] = $node['id_map'];
|
||||
}
|
||||
|
||||
if (!isset($node['style']['id_networkmap']) || $node['style']['id_networkmap'] == '' || $node['style']['id_networkmap'] == 0) {
|
||||
$item['networkmap_id'] = 0;
|
||||
}
|
||||
else {
|
||||
$item['networkmap_id'] = $node['style']['id_networkmap'];
|
||||
}
|
||||
|
||||
$count++;
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve
|
|||
}
|
||||
}
|
||||
else {
|
||||
$command = $snmpwalk_bin . " -m ALL -M +" . escapeshellarg($config['homedir'] . "/attachment/mibs") . " -Cc -c " . escapeshellarg($community) . " -v " . escapeshellarg($version) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir;
|
||||
$command = $snmpwalk_bin . " -m ALL -M +" . escapeshellarg($config['homedir'] . "/attachment/mibs") . " -Cc -c " . escapeshellarg(io_safe_output($community)) . " -v " . escapeshellarg($version) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir;
|
||||
}
|
||||
exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $command . "\"", $output, $rc);
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve
|
|||
}
|
||||
}
|
||||
else {
|
||||
exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
|
||||
exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve
|
|||
}
|
||||
}
|
||||
else {
|
||||
exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
|
||||
exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ function snmp_browser_get_oid ($target_ip, $community, $target_oid, $version = '
|
|||
exec ($snmpget_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' -x ' . escapeshellarg($snmp3_privacy_method) . ' -X ' . escapeshellarg($snmp3_privacy_pass) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
|
||||
}
|
||||
else {
|
||||
exec ($snmpget_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -On -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
|
||||
exec ($snmpget_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -On -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
|
||||
}
|
||||
|
||||
if ($rc != 0) {
|
||||
|
|
|
@ -111,6 +111,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$border_color = $layoutData['border_color'];
|
||||
$fill_color = $layoutData['fill_color'];
|
||||
$label_position = $layoutData['label_position'];
|
||||
$show_on_top = $layoutData['show_on_top'];
|
||||
|
||||
if($show_on_top){
|
||||
$show_on_top_index = 10;
|
||||
}
|
||||
else{
|
||||
$show_on_top_index = '';
|
||||
}
|
||||
|
||||
$sizeStyle = '';
|
||||
$borderStyle = '';
|
||||
|
@ -961,14 +969,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
else {
|
||||
if ($width == 0 || $height == 0) {
|
||||
if ($layoutData['label_position']=='left') {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.custom_graphs_print(
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;">'.custom_graphs_print(
|
||||
$layoutData['id_custom_graph'], 180, 480,
|
||||
$period, null, true, 0, $only_image, $layoutData['image'],
|
||||
array(), '', array(), array(), true,
|
||||
false, false, true, 1, false, true).'</div>';
|
||||
}
|
||||
elseif ($layoutData['label_position']=='right') {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.custom_graphs_print(
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;">'.custom_graphs_print(
|
||||
$layoutData['id_custom_graph'], 180, 480,
|
||||
$period, null, true, 0, $only_image, $layoutData['image'],
|
||||
array(), '', array(), array(), true,
|
||||
|
@ -988,14 +996,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
else {
|
||||
if ($layoutData['label_position']=='left') {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.custom_graphs_print(
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;">'.custom_graphs_print(
|
||||
$layoutData['id_custom_graph'], $height, $width,
|
||||
$period, null, true, 0, $only_image, $layoutData['image'],
|
||||
array(), '', array(), array(), true,
|
||||
false, false, true, 1, false, true).'</div>';
|
||||
}
|
||||
elseif($layoutData['label_position']=='right') {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.custom_graphs_print(
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;">'.custom_graphs_print(
|
||||
$layoutData['id_custom_graph'], $height, $width,
|
||||
$period, null, true, 0, $only_image, $layoutData['image'],
|
||||
array(), '', array(), array(), true,
|
||||
|
@ -1041,7 +1049,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
if ($width == 0 || $height == 0) {
|
||||
|
||||
if ($layoutData['label_position']=='left') {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;">'.
|
||||
grafico_modulo_sparse($id_module, $period,
|
||||
0, 300, 180, modules_get_agentmodule_name($id_module),null, false, 1, false, 0,
|
||||
modules_get_unit($id_module), 0, 0, true, $only_image, '', 1, false, '',
|
||||
|
@ -1049,7 +1057,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
null, true, false, $type_graph) . '</div>';
|
||||
}
|
||||
elseif($layoutData['label_position']=='right') {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">' .
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;">' .
|
||||
grafico_modulo_sparse($id_module,
|
||||
$period, 0, 300, 180, modules_get_agentmodule_name($id_module),null, false,
|
||||
1, false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, '',
|
||||
|
@ -1067,7 +1075,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
else{
|
||||
if ($layoutData['label_position']=='left') {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">' .
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;">' .
|
||||
grafico_modulo_sparse($id_module, $period,
|
||||
0, $width, $height, modules_get_agentmodule_name($id_module), null, false, 1,
|
||||
false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, '',
|
||||
|
@ -1076,7 +1084,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
false, $type_graph) . '</div>';
|
||||
}
|
||||
elseif ($layoutData['label_position']=='right') {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">' .
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;">' .
|
||||
grafico_modulo_sparse($id_module, $period,
|
||||
0, $width, $height, modules_get_agentmodule_name($id_module), null, false, 1,
|
||||
false, 0, modules_get_unit($id_module), 0, 0, true, $only_image,
|
||||
|
@ -1436,10 +1444,10 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
else {
|
||||
if ($width == 0 || $height == 0) {
|
||||
if ($layoutData['label_position']=='left') {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
elseif ($layoutData['label_position']=='right') {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
else {
|
||||
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true);
|
||||
|
@ -1447,10 +1455,10 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
else{
|
||||
if ($layoutData['label_position']=='left') {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
elseif ($layoutData['label_position']=='right') {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
else {
|
||||
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true);
|
||||
|
@ -1515,6 +1523,10 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
break;
|
||||
}
|
||||
|
||||
if($show_on_top){
|
||||
$z_index = 10;
|
||||
}
|
||||
|
||||
echo '<div id="' . $id . '" class="' . $class . '" ' .
|
||||
'style="z-index: ' .$z_index . ';' .
|
||||
'position: absolute; ' .
|
||||
|
@ -1525,7 +1537,12 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
if ($link) {
|
||||
echo "<a href=\"$url\">";
|
||||
}
|
||||
|
||||
|
||||
//for clean link text from bbdd only edit_visualmap
|
||||
if (get_parameter('action') == 'edit' || get_parameter('operation') == 'edit_visualmap') {
|
||||
$text = preg_replace("/<\/*a.*?>/", '', $text);
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case BOX_ITEM:
|
||||
if ($width == 0 || $width == 0) {
|
||||
|
@ -1536,7 +1553,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$style .= "border-width: " . $border_width . "px; ";
|
||||
$style .= "border-color: " . $border_color . "; ";
|
||||
$style .= "background-color: " . $fill_color . "; ";
|
||||
echo "<div style='" . $style . "'></div>";
|
||||
echo "<div style='z-index:".$show_on_top_index.";" . $style . "'></div>";
|
||||
}
|
||||
else {
|
||||
if (!empty($proportion)) {
|
||||
|
@ -1547,7 +1564,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$style .= "border-width: " . $border_width . "px; ";
|
||||
$style .= "border-color: " . $border_color . "; ";
|
||||
$style .= "background-color: " . $fill_color . "; ";
|
||||
echo "<div style='" . $style . "'></div>";
|
||||
echo "<div style='z-index:".$show_on_top_index.";" . $style . "'></div>";
|
||||
}
|
||||
else {
|
||||
$style = "";
|
||||
|
@ -1557,7 +1574,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$style .= "border-width: " . $border_width . "px; ";
|
||||
$style .= "border-color: " . $border_color . "; ";
|
||||
$style .= "background-color: " . $fill_color . "; ";
|
||||
echo "<div style='" . $style . "'></div>";
|
||||
echo "<div style='z-index:".$show_on_top_index.";" . $style . "'></div>";
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2895,6 +2912,8 @@ function visual_map_get_image_status_element($layoutData, $status = false) {
|
|||
* @return integer
|
||||
*/
|
||||
function visual_map_get_status_element($layoutData) {
|
||||
global $config;
|
||||
|
||||
enterprise_include_once('include/functions_visual_map.php');
|
||||
if (enterprise_installed()) {
|
||||
$status = enterprise_visual_map_get_status_element($layoutData);
|
||||
|
@ -2912,7 +2931,34 @@ function visual_map_get_status_element($layoutData) {
|
|||
|
||||
//Linked to other layout ?? - Only if not module defined
|
||||
if ($layoutData['id_layout_linked'] != 0) {
|
||||
$status = visual_map_get_layout_status ($layoutData['id_layout_linked']);
|
||||
if ($layoutData['id_layout_linked_weight'] != 0) {
|
||||
$calculate_weight = true;
|
||||
}
|
||||
else {
|
||||
$calculate_weight = false;
|
||||
}
|
||||
$status = visual_map_get_layout_status ($layoutData['id_layout_linked'], 0, 0, $calculate_weight);
|
||||
|
||||
if ($layoutData['id_layout_linked_weight'] > 0) {
|
||||
$elements_to_compare = db_get_all_rows_sql("SELECT id, element_group FROM tlayout_data WHERE type = 0 AND id_layout = " . $layoutData['id_layout_linked']);
|
||||
|
||||
$childs_group_acl = array();
|
||||
foreach ($elements_to_compare as $c) {
|
||||
if (check_acl ($config['id_user'], $c['element_group'], "VR")) {
|
||||
$childs_group_acl[] = $c['id'];
|
||||
}
|
||||
}
|
||||
$elements_to_compare = $childs_group_acl;
|
||||
|
||||
$aux_weight = ($status['elements_in_critical'] / count($elements_to_compare)) * 100;
|
||||
|
||||
if ($aux_weight >= $layoutData['id_layout_linked_weight']) {
|
||||
$status = $status['temp_total'];
|
||||
}
|
||||
else {
|
||||
$status = VISUAL_MAP_STATUS_NORMAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ($layoutData["type"]) {
|
||||
|
@ -3237,6 +3283,11 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
|||
|
||||
|
||||
foreach ($layout_datas as $layout_data) {
|
||||
$layout_group = $layout_data['element_group'];
|
||||
if (!check_acl ($config['id_user'], $layout_group, "VR")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//Check the items are from disabled or pending delete modules
|
||||
if ($layout_data['id_agente_modulo'] != 0 &&
|
||||
(($layout_data['type'] != LABEL)
|
||||
|
@ -3264,7 +3315,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
|||
'proportion_width' => $proportion_width);
|
||||
}
|
||||
|
||||
$layout_data['label'] = visual_map_macro($layout_data['label']);
|
||||
$layout_data['label'] = visual_map_macro($layout_data['label'],$layout_data["id_agente_modulo"]);
|
||||
|
||||
switch ($layout_data['type']) {
|
||||
case LINE_ITEM:
|
||||
|
@ -3303,13 +3354,32 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
|||
* @return array A list of layouts the user can see.
|
||||
*/
|
||||
function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter = false, $returnAllGroup = true) {
|
||||
if (! is_array ($filter))
|
||||
if (! is_array ($filter)){
|
||||
$filter = array ();
|
||||
|
||||
if ($returnAllGroup)
|
||||
} else {
|
||||
if(!empty($filter['name'])){
|
||||
$where .= "name LIKE '%".io_safe_output($filter['name'])."%'";
|
||||
unset($filter['name']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($returnAllGroup) {
|
||||
$groups = users_get_groups ($id_user, 'VR');
|
||||
else
|
||||
$groups = users_get_groups ($id_user, 'VR', false);
|
||||
} else {
|
||||
if(!empty($filter['group'])) {
|
||||
$permissions_group = users_get_groups ($id_user, 'VR', false);
|
||||
if(empty($permissions_group)){
|
||||
$permissions_group = users_get_groups ($id_user, 'VM', false);
|
||||
}
|
||||
$groups = array_intersect_key($filter['group'], $permissions_group);
|
||||
} else {
|
||||
$groups = users_get_groups ($id_user, 'VR', false);
|
||||
if(empty($groups)) {
|
||||
$groups = users_get_groups ($id_user, 'VM', false);
|
||||
}
|
||||
}
|
||||
unset($filter['group']);
|
||||
}
|
||||
|
||||
if (!empty($groups)) {
|
||||
if (empty($where))
|
||||
|
@ -3356,7 +3426,9 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
|
|||
*
|
||||
* @return bool The status of the given layout. True if it's OK, false if not.
|
||||
*/
|
||||
function visual_map_get_layout_status ($id_layout = 0, $depth = 0) {
|
||||
function visual_map_get_layout_status ($id_layout = 0, $depth = 0, $elements_in_critical = 0, $calculate_weight = false) {
|
||||
global $config;
|
||||
|
||||
$temp_status = VISUAL_MAP_STATUS_NORMAL;
|
||||
$temp_total = VISUAL_MAP_STATUS_NORMAL;
|
||||
$depth++; // For recursion depth checking
|
||||
|
@ -3376,11 +3448,20 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) {
|
|||
'parent_item',
|
||||
'id_layout_linked',
|
||||
'id_agent',
|
||||
'type'));
|
||||
'type',
|
||||
'id_layout_linked_weight',
|
||||
'id',
|
||||
'id_layout',
|
||||
'element_group'));
|
||||
if ($result === false)
|
||||
return VISUAL_MAP_STATUS_NORMAL;
|
||||
|
||||
foreach ($result as $data) {
|
||||
$layout_group = $data['element_group'];
|
||||
if (!check_acl ($config['id_user'], $layout_group, "VR")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch ($data['type']) {
|
||||
case GROUP_ITEM:
|
||||
if ($data["id_layout_linked"] == 0) {
|
||||
|
@ -3418,12 +3499,39 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) {
|
|||
|
||||
// Other Layout (Recursive!)
|
||||
if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) {
|
||||
$status = visual_map_get_layout_status($data["id_layout_linked"], $depth);
|
||||
if ($data['id_layout_linked_weight'] > 0) {
|
||||
$calculate_weight_c = true;
|
||||
}
|
||||
else {
|
||||
$calculate_weight_c = false;
|
||||
}
|
||||
$status = visual_map_get_layout_status($data["id_layout_linked"], $depth, 0, $calculate_weight_c);
|
||||
|
||||
$elements_in_child = db_get_all_rows_sql("SELECT id, element_group FROM tlayout_data WHERE type = 0 AND id_layout = " . $data['id_layout_linked']);
|
||||
$layout_group = $data['element_group'];
|
||||
|
||||
$childs_group_acl = array();
|
||||
foreach ($elements_in_child as $c) {
|
||||
if (check_acl ($config['id_user'], $c['element_group'], "VR")) {
|
||||
$childs_group_acl[] = $c['id'];
|
||||
}
|
||||
}
|
||||
$elements_in_child = $childs_group_acl;
|
||||
|
||||
if ($calculate_weight_c) {
|
||||
$aux_weight = ($status['elements_in_critical'] / count($elements_in_child)) * 100;
|
||||
|
||||
if ($aux_weight >= $data['id_layout_linked_weight']) {
|
||||
$status = $status['temp_total'];
|
||||
}
|
||||
else {
|
||||
$status = VISUAL_MAP_STATUS_NORMAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Module
|
||||
elseif ($data["id_agente_modulo"] != 0) {
|
||||
$status = modules_get_agentmodule_status($data["id_agente_modulo"]);
|
||||
|
||||
}
|
||||
// Agent
|
||||
else {
|
||||
|
@ -3437,11 +3545,31 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) {
|
|||
break;
|
||||
}
|
||||
|
||||
if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD)
|
||||
return VISUAL_MAP_STATUS_CRITICAL_BAD;
|
||||
if ($calculate_weight) {
|
||||
if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD || $status == VISUAL_MAP_STATUS_WARNING) {
|
||||
$elements_in_critical++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) {
|
||||
return VISUAL_MAP_STATUS_CRITICAL_BAD;
|
||||
}
|
||||
|
||||
if ($status > $temp_total)
|
||||
}
|
||||
if ($calculate_weight) {
|
||||
if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) {
|
||||
$temp_total = VISUAL_MAP_STATUS_CRITICAL_BAD;
|
||||
}
|
||||
else if ($status == VISUAL_MAP_STATUS_WARNING && $temp_total != VISUAL_MAP_STATUS_CRITICAL_BAD) {
|
||||
$temp_total = VISUAL_MAP_STATUS_WARNING;
|
||||
}
|
||||
}
|
||||
else if ($status > $temp_total) {
|
||||
$temp_total = $status;
|
||||
}
|
||||
}
|
||||
if ($calculate_weight) {
|
||||
return array('elements_in_critical' => $elements_in_critical, 'temp_total' => $temp_total);
|
||||
}
|
||||
|
||||
return $temp_total;
|
||||
|
@ -3650,9 +3778,14 @@ function visual_map_type_in_js($type) {
|
|||
}
|
||||
}
|
||||
|
||||
function visual_map_macro($label){
|
||||
function visual_map_macro($label,$module){
|
||||
$label = str_replace('_date_',strftime("%x"),$label);
|
||||
$label = str_replace('_time_',strftime("%T"),$label);
|
||||
$label = str_replace('_agent_',agents_get_alias(modules_get_agentmodule_agent($module)),$label);
|
||||
$label = str_replace('_module_',modules_get_agentmodule_name($module),$label);
|
||||
$label = str_replace('_agentdescription_',agents_get_description(modules_get_agentmodule_agent($module)),$label);
|
||||
$label = str_replace('_address_',agents_get_address(modules_get_agentmodule_agent($module)),$label);
|
||||
$label = str_replace('_moduledescription_',modules_get_agentmodule_descripcion($module),$label);
|
||||
return $label;
|
||||
}
|
||||
|
||||
|
|
|
@ -542,7 +542,13 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
'<td align="left" style="">' . __('Show statistics') . '</td>
|
||||
<td align="left" style="">' .
|
||||
html_print_checkbox('show_statistics', 1, '', true) . '</td>';
|
||||
|
||||
|
||||
$form_items['show_on_top_row'] = array();
|
||||
$form_items['show_on_top_row']['items'] = array('group_item');
|
||||
$form_items['show_on_top_row']['html'] =
|
||||
'<td align="left" style="">' . __('Always show on top') . '</td>
|
||||
<td align="left" style="">' .
|
||||
html_print_checkbox('show_on_top', 1, '', true) . '</td>';
|
||||
|
||||
$form_items['module_graph_size_row'] = array();
|
||||
$form_items['module_graph_size_row']['items'] = array('module_graph', 'datos');
|
||||
|
@ -659,10 +665,40 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
WHERE id != ' . $visualConsole_id, 'map_linked', '', '', 'None', '0', true) .
|
||||
'</td>';
|
||||
|
||||
$form_items_advance['map_linked_weight'] = array();
|
||||
$form_items_advance['map_linked_weight']['items'] = array('static_graph');
|
||||
$form_items_advance['map_linked_weight']['html'] = '<td align="left">'.
|
||||
__('Map linked weight') . '</td>' .
|
||||
'<td align="left">' . html_print_select(array('10' => '10%',
|
||||
'20' => '20%',
|
||||
'30' => '30%',
|
||||
'40' => '40%',
|
||||
'50' => '50%',
|
||||
'60' => '60%',
|
||||
'70' => '70%',
|
||||
'80' => '80%',
|
||||
'90' => '90%',
|
||||
'100' => '100%'),
|
||||
'map_linked_weight', '', '', __('By default'), 0, true) .
|
||||
ui_print_help_icon ("linked_map_weight", true) .
|
||||
'</td>';
|
||||
|
||||
$form_items_advance['line_case']['items'] = array('line_item');
|
||||
$form_items_advance['line_case']['html'] = '
|
||||
<td align="left">' . __('Lines haven\'t advanced options') . '</td>';
|
||||
|
||||
$user_groups = users_get_groups($config['id_user']);
|
||||
$form_items_advance['element_group_row'] = array();
|
||||
$form_items_advance['element_group_row']['items'] = array(
|
||||
'group_item', 'static_graph', 'percentile_bar',
|
||||
'percentile_item', 'module_graph', 'simple_value',
|
||||
'icon', 'label', 'datos');
|
||||
$form_items_advance['element_group_row']['html'] = '<td align="left">'.
|
||||
__('Restrict access to group') . '</td>' .
|
||||
'<td align="left">' . html_print_select($user_groups, 'element_group', '', '', '', 0, true) .
|
||||
ui_print_help_tip (
|
||||
__("If selected, restrict visualization of this item in the visual console to users who have access to selected group. This is also used on calculating child visual consoles."), true) .
|
||||
'</td>';
|
||||
|
||||
//Insert and modify before the buttons to create or update.
|
||||
if (enterprise_installed()) {
|
||||
|
@ -846,4 +882,18 @@ function visual_map_editor_print_hack_translate_strings() {
|
|||
echo '<span style="display: none" id="hack_translation_incorrect_save">' .
|
||||
__('Could not be save') .'</span>';
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
$("#map_linked").change(function () {
|
||||
$("#text-agent").val("");
|
||||
$("input[name=id_agent]").val(0);
|
||||
$("#module").empty();
|
||||
$("#module")
|
||||
.append($("<option>")
|
||||
.attr("value", 0)
|
||||
.html("<?php echo __('Any'); ?>"));
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Include/help/en
|
||||
*/
|
||||
?>
|
||||
<h1>Cron for server modules</h1>
|
||||
|
||||
Using the configuration parameter sets <b>Cron from</b> and <b>Cron to</b> makes
|
||||
it possible for a module to run only for certain periods of time.
|
||||
The way in which it is configured is similar to the syntax of
|
||||
<a style="font-size:14px;" href="https://en.wikipedia.org/wiki/Cron">cron</a>.
|
||||
Just as they appear in the Pandora console, each one of the parameters
|
||||
has three options.
|
||||
|
||||
<h4>Cron from: any</h4>
|
||||
|
||||
The module will not have restrictions in that parameter. Whatever the value is
|
||||
will be executed, and it is equivalent to the asterisk (*) in the cron nomenclature. In this
|
||||
case <b>Cron to</b> is ignored.
|
||||
|
||||
<h4>Cron from: different from any. Cron to: any</h4>
|
||||
|
||||
The module will run only during the time in which the date matches that
|
||||
parameter. It is equivalent to writingjust one number in cron nomenclature.
|
||||
|
||||
<h4>Cron from: different from any. Cron to: different from any</h4>
|
||||
|
||||
The module will run only during the time specified between <b>Cron from</b> and <b>Cron to</b>.
|
||||
It is equivalent to writing number dash number (n-n) in cron nomenclature.
|
||||
|
||||
<h2>Agent interval</h2>
|
||||
|
||||
As long as cron conditions are met, the agent will run following
|
||||
its execution interval.
|
||||
|
||||
<h2>Examples</h2>
|
||||
|
||||
<ul>
|
||||
<li><i>* * * * *</i>: No cron configured.</li>
|
||||
<li><i>15 20 * * *</i>: It will run every day at 20:15.</li>
|
||||
<li><i>* 20 * * *</i>: It will run every day during the hour 20, that is, from 20:00 to 20:59.</li>
|
||||
<li><i>* 8-19 * * *</i>: It will run everyday from 8:00 to 19:59.</li>
|
||||
<li><i>15-45 * 1-16 * *</i>: It will run every first 16 days of the month every hour, from quarter past to quarter to.</li>
|
||||
<li><i>* * * 5 *</i>: It will run only in May.</li>
|
||||
<ul>
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Include/help/es
|
||||
*/
|
||||
?>
|
||||
<h1>Associated map status weight</h1>
|
||||
|
||||
<p>
|
||||
Only "static image" type elements can have this option. Through it we establish a percentage of elements in a status other than the normal one so that our element linked to that map picks up its status.
|
||||
</p>
|
||||
<p>
|
||||
For example:
|
||||
</p>
|
||||
<p>
|
||||
If we have a map 1 with a "static image" type element that points to map 2 and has its weight set at 50%, you will only see its status modified if at least half of the elements (items that must return a status from an agent, module or other linked console) of map 2 are not in normal status.
|
||||
</p>
|
||||
<p>
|
||||
We can also have an element linked to a console with 10 elements that return a status, which in turn can have elements linked to other consoles. If our element from the first console has a weight of 20%, it is because we want it to show a critical (or warning) status if at least 2 of the 10 elements of the second console have a critical (or warning) status. Similarly, if the weight is 80%, 8 out of 10 elements must be in a non-normal status.
|
||||
</p>
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Include/help/es
|
||||
*/
|
||||
?>
|
||||
<h1>Cron para módulos de servidor</h1>
|
||||
|
||||
Mediante los grupos de parámetros de configuración <b>Cron desde</b> y <b>Cron hasta</b> se
|
||||
puede hacer que un módulo solo se ejecute durante ciertos periodos de tiempo. El
|
||||
modo en el que se configura es parecido a la sintaxis de
|
||||
<a style="font-size:14px;" href="https://es.wikipedia.org/wiki/Cron_(Unix)">cron</a>.
|
||||
Tal y como aparecen en la consola de Pandora, cada uno de los parámetros
|
||||
tiene tres opciones.
|
||||
|
||||
<h4>Cron desde: cualquiera</h4>
|
||||
|
||||
El módulo no tendrá restricciones en ese parámetro. Se ejecutará cualquiera que
|
||||
que sea el valor y equivale al asterisco (*) en la nomenclatura de cron. En este
|
||||
caso se ignora <b>Cron desde</b>.
|
||||
|
||||
<h4>Cron desde: distinto de cualquiera. Cron hasta: cualquiera</h4>
|
||||
|
||||
El módulo se ejecutará solamente el tiempo en el que la fecha coincida con ese
|
||||
parámetro. Equivale a escribir solamente un número en la nomenclatura de cron.
|
||||
|
||||
<h4>Cron desde: distinto de cualquiera. Cron hasta: distinto de cualquiera</h4>
|
||||
|
||||
El módulo se ejecutará entre el tiempo indicado en el <b>Cron desde</b> y el <b>Cron hasta</b>.
|
||||
Equivale a escribir el número guión número (n-n) en la nomenclatura de cron.
|
||||
|
||||
<h2>Intervalo del agente</h2>
|
||||
|
||||
Mientras que se cumplan las condiciones de cron, el agente se ejecutará siguiendo
|
||||
su intervalo de ejecución.
|
||||
|
||||
<h2>Ejemplos</h2>
|
||||
|
||||
<ul>
|
||||
<li><i>* * * * *</i>: No hay cron configurado.</li>
|
||||
<li><i>15 20 * * *</i>: Se ejecutará todos los días a las 20:15.</li>
|
||||
<li><i>* 20 * * *</i>: Se ejecutará todos los días durante las 20 horas, es decir, entre las 20:00 y las 20:59.</li>
|
||||
<li><i>* 8-19 * * *</i>: Se ejecutará todos los días entre las 8:00 y las 19:59.</li>
|
||||
<li><i>15-45 * 1-16 * *</i>: Se ejecutará todos los primeros 16 días del mes a todas horas entre y cuarto y menos cuarto.</li>
|
||||
<li><i>* * * 5 *</i>: Se ejecutará solamente en mayo.</li>
|
||||
<ul>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Include/help/es
|
||||
*/
|
||||
?>
|
||||
<h1>Peso de estado del mapa asociado</h1>
|
||||
|
||||
<p>
|
||||
Solo los elementos de tipo "imagen estática" pueden llevar esta opción. Mediante ella establecemos un porcentaje de elementos en un estado diferente al normal para que nuestro elemento enlazado a ese mapa recoja su estado.
|
||||
</p>
|
||||
<p>
|
||||
Por ejemplo:
|
||||
</p>
|
||||
<p>
|
||||
Si tenemos un mapa 1 con un elemento de tipo "imagen estática" que apunta a un mapa 2 y tiene su peso establecido en un 50%, solo verá modificado su estado si al menos la mitad de los elementos (elementos que deben devolver un estado tanto de agente, de módulo o de otra consola enlazada) del mapa 2 no están en un estado normal.
|
||||
</p>
|
||||
<p>
|
||||
También podemos tener un elemento enlazado a una consola con 10 elementos que devuelvan un estado, que a su vez pueden tener elementos enlazados a otras consolas. Si nuestro elemento de la primera consola tiene establecido un peso del 20% es porque queremos que nos muestre un estado crítico (o de advertencia) si al menos 2 de los 10 elementos de la segunda consola tienen un estado crítico (o de advertencia). Del mismo modo si el peso fuese del 80%, se tendrán que tener 8 elementos de 10 en un estado no normal.
|
||||
</p>
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Include/help/ja
|
||||
*/
|
||||
?>
|
||||
<h1>Cron for server modules</h1>
|
||||
|
||||
Using the configuration parameter sets <b>Cron from</b> and <b>Cron to</b> makes
|
||||
it possible for a module to run only for certain periods of time.
|
||||
The way in which it is configured is similar to the syntax of
|
||||
<a style="font-size:14px;" href="https://en.wikipedia.org/wiki/Cron">cron</a>.
|
||||
Just as they appear in the Pandora console, each one of the parameters
|
||||
has three options.
|
||||
|
||||
<h4>Cron from: any</h4>
|
||||
|
||||
The module will not have restrictions in that parameter. Whatever the value is
|
||||
will be executed, and it is equivalent to the asterisk (*) in the cron nomenclature. In this
|
||||
case <b>Cron to</b> is ignored.
|
||||
|
||||
<h4>Cron from: different from any. Cron to: any</h4>
|
||||
|
||||
The module will run only during the time in which the date matches that
|
||||
parameter. It is equivalent to writingjust one number in cron nomenclature.
|
||||
|
||||
<h4>Cron from: different from any. Cron to: different from any</h4>
|
||||
|
||||
The module will run only during the time specified between <b>Cron from</b> and <b>Cron to</b>.
|
||||
It is equivalent to writing number dash number (n-n) in cron nomenclature.
|
||||
|
||||
<h2>Agent interval</h2>
|
||||
|
||||
As long as cron conditions are met, the agent will run following
|
||||
its execution interval.
|
||||
|
||||
<h2>Examples</h2>
|
||||
|
||||
<ul>
|
||||
<li><i>* * * * *</i>: No cron configured.</li>
|
||||
<li><i>15 20 * * *</i>: It will run every day at 20:15.</li>
|
||||
<li><i>* 20 * * *</i>: It will run every day during the hour 20, that is, from 20:00 to 20:59.</li>
|
||||
<li><i>* 8-19 * * *</i>: It will run everyday from 8:00 to 19:59.</li>
|
||||
<li><i>15-45 * 1-16 * *</i>: It will run every first 16 days of the month every hour, from quarter past to quarter to.</li>
|
||||
<li><i>* * * 5 *</i>: It will run only in May.</li>
|
||||
<ul>
|
||||
|
|
@ -572,6 +572,12 @@ var TreeController = {
|
|||
});
|
||||
}
|
||||
}
|
||||
// Get hash and user.
|
||||
var public_hash = $("#hidden-publi_dash_tree_view_hash" ).val();
|
||||
if (typeof(public_hash) === 'undefined') public_hash = 0;
|
||||
var public_user = $("#hidden-publi_dash_tree_view_id_user" ).val();
|
||||
if (typeof(public_user) === 'undefined') public_user = 0;
|
||||
|
||||
if (typeof element.searchChildren != 'undefined' && element.searchChildren) {
|
||||
$node
|
||||
.removeClass("leaf-empty")
|
||||
|
@ -598,7 +604,9 @@ var TreeController = {
|
|||
rootID: element.rootID,
|
||||
serverID: element.serverID,
|
||||
rootType: element.rootType,
|
||||
filter: controller.filter
|
||||
filter: controller.filter,
|
||||
hash: public_hash,
|
||||
id_user: public_user
|
||||
},
|
||||
complete: function(xhr, textStatus) {
|
||||
$node.removeClass("leaf-loading");
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.715';
|
||||
$build = '171114';
|
||||
$build = '171127';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -18,7 +18,13 @@
|
|||
global $config;
|
||||
|
||||
check_login ();
|
||||
$id = get_parameter('id_networkmap', true);
|
||||
if (_id_ != "_id_") {
|
||||
$id = _id_;
|
||||
}
|
||||
else {
|
||||
$id = get_parameter('id_networkmap', true);
|
||||
}
|
||||
|
||||
$activeTab = get_parameter('activeTab', true);
|
||||
|
||||
if (enterprise_installed()) {
|
||||
|
@ -31,6 +37,11 @@ if (enterprise_installed()) {
|
|||
}
|
||||
}
|
||||
|
||||
if (_activeTab_ != "_activeTab_") {
|
||||
$activeTab = _activeTab_;
|
||||
$tab = $activeTab;
|
||||
}
|
||||
|
||||
// Networkmap id required
|
||||
if (!isset($id)) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
|
@ -107,6 +118,11 @@ ui_print_page_header(io_safe_output($networkmap['name']),
|
|||
global $width;
|
||||
global $height;
|
||||
|
||||
if (_id_ != "_id_") {
|
||||
$width = array();
|
||||
$height = array();
|
||||
}
|
||||
|
||||
if (empty($width)) {
|
||||
$width = 600;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,9 @@ if ($new_networkmap) {
|
|||
$source = 'group';
|
||||
$ip_mask = '';
|
||||
$dont_show_subgroups = false;
|
||||
$offset_x = "";
|
||||
$offset_y = "";
|
||||
$scale_z = 0.5;
|
||||
}
|
||||
|
||||
$disabled_generation_method_select = false;
|
||||
|
@ -75,6 +78,10 @@ if ($edit_networkmap) {
|
|||
$description = $values['description'];
|
||||
|
||||
$filter = json_decode($values['filter'], true);
|
||||
|
||||
$offset_x = $filter['x_offs'];
|
||||
$offset_y = $filter['y_offs'];
|
||||
$scale_z = $filter['z_dash'];
|
||||
|
||||
$node_radius = $filter['node_radius'];
|
||||
|
||||
|
@ -190,6 +197,17 @@ else {
|
|||
|
||||
$table->data[3][0] = __('Description');
|
||||
$table->data[3][1] = html_print_textarea ('description', 7, 25, $description, '', true);
|
||||
|
||||
$table->data[4][0] = __('Position X');
|
||||
$table->data[4][1] = html_print_input_text ('pos_x', $offset_x, '', 2, 10,true);
|
||||
$table->data[5][0] = __('Position Y');
|
||||
$table->data[5][1] = html_print_input_text ('pos_y', $offset_y, '', 2, 10,true);
|
||||
|
||||
$table->data[6][0] = __('Zoom scale');
|
||||
if ($scale_z == "") {
|
||||
$scale_z = 0.5;
|
||||
}
|
||||
$table->data[6][1] = html_print_input_text ('scale_z', $scale_z, '', 2, 10,true) . ui_print_help_tip (__('Introduce zoom level. 1 = Highest resolution. Figures may include decimals'), true);
|
||||
|
||||
$table->data['source'][0] = __('Source');
|
||||
$table->data['source'][1] =
|
||||
|
@ -222,8 +240,8 @@ else {
|
|||
'radial_dinamic' => 'radial dinamic'
|
||||
);
|
||||
|
||||
$table->data[4][0] = __('Method generation networkmap');
|
||||
$table->data[4][1] = html_print_select($methods, 'method', $method,
|
||||
$table->data[7][0] = __('Method generation networkmap');
|
||||
$table->data[7][1] = html_print_select($methods, 'method', $method,
|
||||
'', '', 'twopi', true, false, true, '',
|
||||
$disabled_generation_method_select);
|
||||
|
||||
|
|
|
@ -33,10 +33,140 @@ include_once("include/functions_pandora_networkmap.php");
|
|||
|
||||
$new_networkmap = (bool) get_parameter('new_networkmap', false);
|
||||
$save_networkmap = (bool) get_parameter('save_networkmap', false);
|
||||
$save_empty_networkmap = (bool) get_parameter('save_empty_networkmap', false);
|
||||
$update_empty_networkmap = (bool) get_parameter('save_empty_networkmap', false);
|
||||
$update_networkmap = (bool) get_parameter('update_networkmap', false);
|
||||
$copy_networkmap = (bool) get_parameter('copy_networkmap', false);
|
||||
$delete = (bool) get_parameter('delete', false);
|
||||
$tab = (string) get_parameter('tab', 'list');
|
||||
$new_empty_networkmap = get_parameter('new_empty_networkmap', false);
|
||||
|
||||
if (enterprise_installed()) {
|
||||
if ($new_empty_networkmap) {
|
||||
if ($networkmaps_write || $networkmaps_manage) {
|
||||
require ($config["homedir"]."/enterprise/godmode/agentes/pandora_networkmap_empty.editor.php");
|
||||
require('pandora_networkmap_empty.editor.php');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($save_empty_networkmap) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
|
||||
// ACL for the network map
|
||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
||||
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
$name = (string) get_parameter('name', '');
|
||||
|
||||
// Default size values
|
||||
$width = 4000;
|
||||
$height = 4000;
|
||||
|
||||
$method = (string) get_parameter('method', 'fdp');
|
||||
|
||||
$dont_show_subgroups = 0;
|
||||
$node_radius = (int)get_parameter('node_radius', 40);
|
||||
$description = get_parameter('description', '');
|
||||
|
||||
$values = array();
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
$values['source_period'] = 60;
|
||||
$values['width'] = $width;
|
||||
$values['height'] = $height;
|
||||
$values['id_user'] = $config['id_user'];
|
||||
$values['description'] = $description;
|
||||
$values['source'] = 0;
|
||||
$values['source_data'] = $id_group;
|
||||
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
$filter = array();
|
||||
$filter['dont_show_subgroups'] = $dont_show_subgroups;
|
||||
$filter['node_radius'] = $node_radius;
|
||||
$filter['empty_map'] = 1;
|
||||
$values['filter'] = json_encode($filter);
|
||||
|
||||
$result = false;
|
||||
if (!empty($name)) {
|
||||
$result = db_process_sql_insert('tmap',
|
||||
$values);
|
||||
}
|
||||
|
||||
$result_txt = ui_print_result_message($result,
|
||||
__('Succesfully created'), __('Could not be created'), '',
|
||||
true);
|
||||
|
||||
$id = $result;
|
||||
define("_id_", $id);
|
||||
|
||||
$tab = "view";
|
||||
}
|
||||
else if ($update_empty_networkmap) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
|
||||
// ACL for the new network map
|
||||
$networkmap_write_new = check_acl ($config['id_user'], $id_group, "MW");
|
||||
$networkmap_manage_new = check_acl ($config['id_user'], $id_group, "MM");
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
$name = (string) get_parameter('name', '');
|
||||
|
||||
$recon_task_id = (int) get_parameter(
|
||||
'recon_task_id', 0);
|
||||
|
||||
$source = (string)get_parameter('source', 'group');
|
||||
|
||||
$values = array();
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
|
||||
$values['generation_method'] = 4;
|
||||
|
||||
$description = get_parameter('description', '');
|
||||
$values['description'] = $description;
|
||||
|
||||
$dont_show_subgroups = 0;
|
||||
$node_radius = (int)get_parameter('node_radius', 40);
|
||||
$row = db_get_row('tmap', 'id', $id);
|
||||
$filter = json_decode($row['filter'], true);
|
||||
$filter['dont_show_subgroups'] = $dont_show_subgroups;
|
||||
$filter['node_radius'] = $node_radius;
|
||||
|
||||
$values['filter'] = json_encode($filter);
|
||||
|
||||
$result = false;
|
||||
if (!empty($name)) {
|
||||
$result = db_process_sql_update('tmap',
|
||||
$values, array('id' => $id));
|
||||
}
|
||||
|
||||
$result_txt = ui_print_result_message($result,
|
||||
__('Succesfully updated'), __('Could not be updated'), '',
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
$result_txt = '';
|
||||
// The networkmap doesn't exist yet
|
||||
|
@ -84,6 +214,10 @@ if ($new_networkmap || $save_networkmap) {
|
|||
$dont_show_subgroups = (int)get_parameter('dont_show_subgroups', 0);
|
||||
$node_radius = (int)get_parameter('node_radius', 40);
|
||||
$description = get_parameter('description', '');
|
||||
|
||||
$offset_x = get_parameter('pos_x');
|
||||
$offset_y = get_parameter('pos_y');
|
||||
$scale_z = get_parameter('scale_z', 0.5);
|
||||
|
||||
$values = array();
|
||||
$values['name'] = $name;
|
||||
|
@ -141,6 +275,9 @@ if ($new_networkmap || $save_networkmap) {
|
|||
$filter = array();
|
||||
$filter['dont_show_subgroups'] = $dont_show_subgroups;
|
||||
$filter['node_radius'] = $node_radius;
|
||||
$filter['x_offs'] = $offset_x;
|
||||
$filter['y_offs'] = $offset_y;
|
||||
$filter['z_dash'] = $scale_z;
|
||||
$values['filter'] = json_encode($filter);
|
||||
|
||||
$result = false;
|
||||
|
@ -153,8 +290,15 @@ if ($new_networkmap || $save_networkmap) {
|
|||
__('Succesfully created'), __('Could not be created'), '',
|
||||
true);
|
||||
|
||||
// Force the tab = 'list'
|
||||
$tab = "list";
|
||||
$id = $result;
|
||||
define("_id_", $id);
|
||||
|
||||
$tab = "view";
|
||||
|
||||
if ($values['generation_method'] == 6) {
|
||||
$tab = "r_dinamic";
|
||||
define("_activeTab_", 'radial_dynamic');
|
||||
}
|
||||
}
|
||||
}
|
||||
// The networkmap exists
|
||||
|
@ -209,26 +353,15 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
|||
'recon_task_id', 0);
|
||||
|
||||
$source = (string)get_parameter('source', 'group');
|
||||
|
||||
$offset_x = get_parameter('pos_x');
|
||||
$offset_y = get_parameter('pos_y');
|
||||
$scale_z = get_parameter('scale_z', 0.5);
|
||||
|
||||
$values = array();
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
|
||||
/*
|
||||
if ($source == 'group') {
|
||||
$values['source'] = 0;
|
||||
$values['source_data'] = $id_group;
|
||||
}
|
||||
else if ($source == 'recon_task') {
|
||||
$values['source'] = 1;
|
||||
$values['source_data'] = $recon_task_id;
|
||||
}
|
||||
else if ($source == 'ip_mask') {
|
||||
$values['source'] = 2;
|
||||
$values['source_data'] = $ip_mask;
|
||||
}
|
||||
*/
|
||||
|
||||
switch ($method) {
|
||||
case 'twopi':
|
||||
$values['generation_method'] = 2;
|
||||
|
@ -262,6 +395,9 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
|||
$filter = json_decode($row['filter'], true);
|
||||
$filter['dont_show_subgroups'] = $dont_show_subgroups;
|
||||
$filter['node_radius'] = $node_radius;
|
||||
$filter['x_offs'] = $offset_x;
|
||||
$filter['y_offs'] = $offset_y;
|
||||
$filter['z_dash'] = $scale_z;
|
||||
|
||||
$values['filter'] = json_encode($filter);
|
||||
|
||||
|
@ -304,6 +440,9 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
|||
}
|
||||
|
||||
switch ($tab) {
|
||||
case 'r_dinamic':
|
||||
require('networkmap.dinamic.php');
|
||||
break;
|
||||
case 'edit':
|
||||
require('pandora_networkmap.editor.php');
|
||||
break;
|
||||
|
@ -546,6 +685,15 @@ switch ($tab) {
|
|||
html_print_submit_button (__('Create networkmap'), 'crt', false, 'class="sub next" style="float: right;"');
|
||||
echo "</form>";
|
||||
echo "</div>";
|
||||
|
||||
if (enterprise_installed()) {
|
||||
echo "<div style='width: " . $table->width . "; margin-top: 5px;'>";
|
||||
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
||||
html_print_input_hidden ('new_empty_networkmap', 1);
|
||||
html_print_submit_button (__('Create empty networkmap'), 'crt', false, 'class="sub next" style="float: right; margin-right:20px;"');
|
||||
echo "</form>";
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -13,13 +13,29 @@
|
|||
// Load global variables
|
||||
global $config;
|
||||
|
||||
// Check user credentials
|
||||
check_login();
|
||||
|
||||
require_once ('include/functions_pandora_networkmap.php');
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
enterprise_include_once('include/functions_dashboard.php');
|
||||
require_once ('include/functions_modules.php');
|
||||
|
||||
$public_hash = get_parameter('hash', false);
|
||||
|
||||
// Try to authenticate by hash on public dashboards
|
||||
if ($public_hash === false) {
|
||||
// Login check
|
||||
check_login();
|
||||
} else {
|
||||
$validate_hash = enterprise_hook(
|
||||
'dasboard_validate_public_hash',
|
||||
array($public_hash, get_parameter('networkmap_id'), 'network_map')
|
||||
);
|
||||
if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) {
|
||||
db_pandora_audit("Invalid public hash", "Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------INIT AJAX-----------------------------------------------
|
||||
if (is_ajax ()) {
|
||||
$update_refresh_state = (bool)get_parameter('update_refresh_state',false);
|
||||
|
@ -677,7 +693,13 @@ if (is_ajax ()) {
|
|||
}
|
||||
}
|
||||
//--------------END AJAX------------------------------------------------
|
||||
$id = (int) get_parameter('id_networkmap', 0);
|
||||
if (_id_ != "_id_") {
|
||||
$id = _id_;
|
||||
}
|
||||
else {
|
||||
$id = (int) get_parameter('id_networkmap', 0);
|
||||
}
|
||||
|
||||
$dash_mode = 0;
|
||||
$map_dash_details = array();
|
||||
|
||||
|
@ -692,11 +714,34 @@ if (enterprise_installed()) {
|
|||
$map_dash_details['x_offs'] = $x_offs;
|
||||
$map_dash_details['y_offs'] = $y_offs;
|
||||
$map_dash_details['z_dash'] = $z_dash;
|
||||
|
||||
$networkmap = db_get_row('tmap', 'id', $id);
|
||||
}
|
||||
else {
|
||||
$networkmap = db_get_row('tmap', 'id', $id);
|
||||
|
||||
$networkmap_filter = json_decode($networkmap['filter'], true);
|
||||
if ($networkmap_filter['x_offs'] != null) {
|
||||
$map_dash_details['x_offs'] = $networkmap_filter['x_offs'];
|
||||
}
|
||||
else {
|
||||
$map_dash_details['x_offs'] = 0;
|
||||
}
|
||||
if ($networkmap_filter['y_offs'] != null) {
|
||||
$map_dash_details['y_offs'] = $networkmap_filter['y_offs'];
|
||||
}
|
||||
else {
|
||||
$map_dash_details['y_offs'] = 0;
|
||||
}
|
||||
if ($networkmap_filter['z_dash'] != null) {
|
||||
$map_dash_details['z_dash'] = $networkmap_filter['z_dash'];
|
||||
}
|
||||
else {
|
||||
$map_dash_details['z_dash'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$networkmap = db_get_row('tmap', 'id', $id);
|
||||
|
||||
if ($networkmap === false) {
|
||||
ui_print_page_header(__('Networkmap'),
|
||||
"images/bricks.png", false, "network_map_enterprise", false);
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
|
@ -671,8 +670,6 @@ if ($event_w || $event_m) {
|
|||
|
||||
$data[0] .= '<a href="javascript:" onclick="show_load_filter_dialog();">' .
|
||||
html_print_image("images/load.png", true, array("border" => '0', "title" => __('Load filter'), "alt" => __('Load filter'))) . '</a> ';
|
||||
$data[0] .= '<a id="events_graph_link" href="javascript: show_events_graph_dialog()">' .
|
||||
html_print_image('images/chart_curve.png', true, array('title' => __('Show events graph'))) . '</a> <br />';
|
||||
$data[0] .= '</div>';
|
||||
|
||||
|
||||
|
@ -787,8 +784,6 @@ elseif ($group_rep == 2) {
|
|||
$history);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Active filter tag view call (only enterprise version)
|
||||
// It is required to pass some references to enterprise function
|
||||
// to translate the active filters
|
||||
|
@ -803,87 +798,6 @@ enterprise_hook('print_event_tags_active_filters',
|
|||
)
|
||||
);
|
||||
|
||||
if (!empty($result)) {
|
||||
if ($group_rep == 0) {
|
||||
$sql = "SELECT COUNT(id_evento)
|
||||
FROM $event_table
|
||||
WHERE 1=1 " . $sql_post;
|
||||
}
|
||||
elseif ($group_rep == 1) {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$sql = "SELECT COUNT(1)
|
||||
FROM (SELECT 1
|
||||
FROM $event_table
|
||||
WHERE 1=1 " . $sql_post . "
|
||||
GROUP BY evento, id_agentmodule) t";
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = "SELECT COUNT(1)
|
||||
FROM (SELECT 1
|
||||
FROM $event_table
|
||||
WHERE 1=1 " . $sql_post . "
|
||||
GROUP BY to_char(evento), id_agentmodule) t";
|
||||
break;
|
||||
}
|
||||
}
|
||||
elseif ($group_rep == 2) {
|
||||
|
||||
}
|
||||
$limit = (int) db_get_sql ($sql);
|
||||
|
||||
if ($group_rep == 0) {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = "SELECT *, 1 event_rep
|
||||
FROM $event_table
|
||||
WHERE 1=1 " . $sql_post . "
|
||||
ORDER BY utimestamp DESC LIMIT 0,".$limit;
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = "SELECT *, 1 event_rep
|
||||
FROM $event_table
|
||||
WHERE 1=1 " . $sql_post . "
|
||||
ORDER BY utimestamp DESC LIMIT ".$limit." OFFSET 0";
|
||||
break;
|
||||
case "oracle":
|
||||
$set = array();
|
||||
$set['limit'] = $pagination;
|
||||
$set['offset'] = $offset;
|
||||
$sql = "SELECT $event_table.*, 1 event_rep
|
||||
FROM $event_table
|
||||
WHERE 1=1 " . $sql_post . "
|
||||
ORDER BY utimestamp DESC";
|
||||
$sql = oracle_recode_query ($sql, $set);
|
||||
break;
|
||||
}
|
||||
|
||||
//Extract the events by filter (or not) from db
|
||||
$results_graph = db_get_all_rows_sql ($sql);
|
||||
}
|
||||
elseif ($group_rep == 1) {
|
||||
$results_graph = events_get_events_grouped($sql_post,
|
||||
0,
|
||||
$limit,
|
||||
$meta,
|
||||
$history);
|
||||
}
|
||||
elseif ($group_rep == 2) {
|
||||
|
||||
}
|
||||
|
||||
if (($group_rep == 1) OR ($group_rep == 0)) {
|
||||
$graph = '<div style="width: 350px; margin: 0 auto;">' .
|
||||
grafico_eventos_agente(350, 185,
|
||||
$results_graph, $meta, $history, $tags_acls_condition,$limit) .
|
||||
'</div>';
|
||||
html_print_div(array('id' => 'events_graph',
|
||||
'hidden' => true, 'content' => $graph));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($result)) {
|
||||
//~ Checking the event tags exactly. The event query filters approximated tags to keep events
|
||||
//~ with several tags
|
||||
|
@ -986,11 +900,6 @@ $(document).ready( function() {
|
|||
|
||||
$("#text-date_from, #text-date_to").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
|
||||
|
||||
// If the events are not charged, dont show graphs link
|
||||
if ($('#events_graph').val() == undefined) {
|
||||
$('#events_graph_link').hide();
|
||||
}
|
||||
|
||||
// Don't collapse filter if update button has been pushed
|
||||
if ($("#hidden-open_filter").val() == 'true') {
|
||||
$("#event_control").toggle();
|
||||
|
@ -1658,23 +1567,6 @@ function reorder_tags_inputs() {
|
|||
}
|
||||
}
|
||||
|
||||
// Show the modal window of an module
|
||||
function show_events_graph_dialog() {
|
||||
$("#events_graph").hide ()
|
||||
.dialog ({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
title: '<?php echo __('Events generated -by agent-'); ?>',
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 450,
|
||||
height: 380
|
||||
})
|
||||
.show ();
|
||||
}
|
||||
/* ]]> */
|
||||
|
||||
//function datetime
|
||||
|
|
|
@ -59,6 +59,8 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
|||
$sub2["operation/agentes/status_monitor"]["text"] = __('Monitor detail');
|
||||
$sub2["operation/agentes/status_monitor"]["refr"] = 0;
|
||||
|
||||
enterprise_hook ('tag_view_submenu');
|
||||
|
||||
$sub2["operation/agentes/alerts_status"]["text"] = __('Alert detail');
|
||||
$sub2["operation/agentes/alerts_status"]["refr"] = 0;
|
||||
|
||||
|
|
|
@ -208,6 +208,11 @@ $ignored_params['refr'] = '';
|
|||
|
||||
$(".overlay").removeClass("overlay").addClass("overlaydisabled");
|
||||
|
||||
// Start the map fetch
|
||||
//~ fetchMap();
|
||||
});
|
||||
|
||||
$(window).load (function () {
|
||||
$('.item:not(.icon) img:not(.b64img)').each( function() {
|
||||
if ($(this).css('float')=='left' || $(this).css('float')=='right') {
|
||||
if( $(this).parent()[0].tagName == 'DIV'){
|
||||
|
|
|
@ -183,7 +183,10 @@ $ignored_params['refr'] = '';
|
|||
});
|
||||
|
||||
$(".overlay").removeClass("overlay").addClass("overlaydisabled");
|
||||
|
||||
|
||||
});
|
||||
|
||||
$(window).load (function () {
|
||||
$('.item:not(.icon) img').each(function(){
|
||||
|
||||
|
||||
|
|
|
@ -279,7 +279,10 @@ $ignored_params['refr'] = '';
|
|||
});
|
||||
|
||||
$(".overlay").removeClass("overlay").addClass("overlaydisabled");
|
||||
|
||||
|
||||
});
|
||||
|
||||
$(window).load (function () {
|
||||
$('.item:not(.icon) img:not(.b64img)').each( function() {
|
||||
if ($(this).css('float')=='left' || $(this).css('float')=='right') {
|
||||
if( $(this).parent()[0].tagName == 'DIV'){
|
||||
|
@ -332,6 +335,6 @@ $ignored_params['refr'] = '';
|
|||
height = parseInt($(this).css("height")) - 30;
|
||||
$(this).css('height', height);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.715
|
||||
%define release 171114
|
||||
%define release 171127
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.715
|
||||
%define release 171114
|
||||
%define release 171127
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -85,6 +85,7 @@ CREATE TABLE IF NOT EXISTS `tagente` (
|
|||
`alias` varchar(600) BINARY NOT NULL default '',
|
||||
`transactional_agent` tinyint(1) NOT NULL default '0',
|
||||
`alias_as_name` tinyint(2) NOT NULL default '0',
|
||||
`safe_mode_module` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id_agente`),
|
||||
KEY `nombre` (`nombre`(255)),
|
||||
KEY `direccion` (`direccion`),
|
||||
|
@ -1189,6 +1190,8 @@ CREATE TABLE IF NOT EXISTS `tgraph` (
|
|||
`id_group` mediumint(8) unsigned NULL default 0,
|
||||
`id_graph_template` int(11) NOT NULL default 0,
|
||||
`percentil` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`summatory_series` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`average_series` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY(`id_graph`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -1360,6 +1363,9 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` (
|
|||
`border_color` varchar(200) DEFAULT "",
|
||||
`fill_color` varchar(200) DEFAULT "",
|
||||
`show_statistics` tinyint(2) NOT NULL default '0',
|
||||
`id_layout_linked_weight` int(10) NOT NULL default '0',
|
||||
`element_group` int(10) NOT NULL default '0',
|
||||
`show_on_top` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -2210,6 +2216,7 @@ CREATE TABLE IF NOT EXISTS `tdashboard` (
|
|||
`id_group` int(10) NOT NULL default 0,
|
||||
`active` tinyint(1) NOT NULL default 0,
|
||||
`cells` int(10) unsigned default 0,
|
||||
`cells_slideshow` TINYINT(1) NOT NULL default 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -2964,6 +2971,7 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
|
|||
`transactional_agent` tinyint(1) NOT NULL default '0',
|
||||
`alias` varchar(600) BINARY NOT NULL default '',
|
||||
`alias_as_name` tinyint(2) NOT NULL default '0',
|
||||
`safe_mode_module` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id_agente`),
|
||||
KEY `nombre` (`nombre`(255)),
|
||||
KEY `direccion` (`direccion`),
|
||||
|
|
|
@ -109,10 +109,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||
('custom_report_front_header', ''),
|
||||
('custom_report_front_footer', ''),
|
||||
('MR', 8),
|
||||
('MR', 9),
|
||||
('identification_reminder', 1),
|
||||
('identification_reminder_timestamp', 0),
|
||||
('current_package_enterprise', '715'),
|
||||
('current_package_enterprise', '716'),
|
||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}');
|
||||
|
||||
UNLOCK TABLES;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.715-171114
|
||||
Version: 7.0NG.715-171127
|
||||
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.715-171114"
|
||||
pandora_version="7.0NG.715-171127"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -43,7 +43,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.715";
|
||||
my $pandora_build = "171114";
|
||||
my $pandora_build = "171127";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -525,7 +525,7 @@ Process an alert given the status returned by pandora_evaluate_alert.
|
|||
##########################################################################
|
||||
sub pandora_process_alert ($$$$$$$$;$) {
|
||||
my ($pa_config, $data, $agent, $module, $alert, $rc, $dbh, $timestamp, $extra_macros) = @_;
|
||||
|
||||
|
||||
if (defined ($agent)) {
|
||||
logger ($pa_config, "Processing alert '" . safe_output($alert->{'name'}) . "' for agent '" . safe_output($agent->{'nombre'}) . "': " . (defined ($AlertStatus[$rc]) ? $AlertStatus[$rc] : 'Unknown status') . ".", 10);
|
||||
}
|
||||
|
@ -565,12 +565,12 @@ sub pandora_process_alert ($$$$$$$$;$) {
|
|||
# Generate an event
|
||||
if ($table eq 'tevent_alert') {
|
||||
pandora_event ($pa_config, "Alert ceased (" .
|
||||
$alert->{'name'} . ")", 0, 0, $alert->{'priority'}, $id,
|
||||
safe_output($alert->{'name'}) . ")", 0, 0, $alert->{'priority'}, $id,
|
||||
(defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0),
|
||||
"alert_ceased", 0, $dbh, 'Pandora', '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions);
|
||||
} else {
|
||||
pandora_event ($pa_config, "Alert ceased (" .
|
||||
$alert->{'name'} . ")", $agent->{'id_grupo'},
|
||||
safe_output($alert->{'name'}) . ")", $agent->{'id_grupo'},
|
||||
$agent->{'id_agente'}, $alert->{'priority'}, $id,
|
||||
(defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0),
|
||||
"alert_ceased", 0, $dbh, 'Pandora', '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions);
|
||||
|
@ -1530,6 +1530,11 @@ sub pandora_process_module ($$$$$$$$$;$) {
|
|||
|
||||
# Update module status count.
|
||||
$mark_for_update = 1;
|
||||
|
||||
# Safe mode execution.
|
||||
if ($agent->{'safe_mode_module'} == $module->{'id_agente_modulo'}) {
|
||||
safe_mode($pa_config, $agent, $module, $new_status, $known_status, $dbh);
|
||||
}
|
||||
}
|
||||
# Set not-init modules to normal status even if min_ff_event is not matched the first time they receive data.
|
||||
# if critical or warning status, just pass through here and wait the time min_ff_event will be matched.
|
||||
|
@ -1622,9 +1627,8 @@ sub pandora_planned_downtime_disabled_once_stop($$) {
|
|||
db_do($dbh, 'UPDATE tplanned_downtime
|
||||
SET executed = 0
|
||||
WHERE id = ?', $downtime->{'id'});
|
||||
|
||||
pandora_event ($pa_config,
|
||||
'(Created by ' . $downtime->{'id_user'} . ') Server ' . $pa_config->{'servername'} . ' stopped planned downtime: ' . $downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
'(Created by ' . $downtime->{'id_user'} . ') Server ' . $pa_config->{'servername'} . ' stopped planned downtime: ' . safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
|
||||
pandora_planned_downtime_unset_disabled_elements($pa_config,
|
||||
$dbh, $downtime);
|
||||
|
@ -1669,8 +1673,9 @@ sub pandora_planned_downtime_disabled_once_start($$) {
|
|||
SET executed = 1
|
||||
WHERE id = ?', $downtime->{'id'});
|
||||
|
||||
print"pandora_planned_downtime_disabled_once_start\n";
|
||||
pandora_event ($pa_config,
|
||||
"(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
"(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
|
||||
pandora_planned_downtime_set_disabled_elements($pa_config,
|
||||
$dbh, $downtime);
|
||||
|
@ -1860,7 +1865,7 @@ sub pandora_planned_downtime_quiet_once_stop($$) {
|
|||
SET executed = 0
|
||||
WHERE id = ?', $downtime->{'id'});
|
||||
pandora_event ($pa_config,
|
||||
"(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
"(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." stopped planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
|
||||
pandora_planned_downtime_unset_quiet_elements($pa_config,
|
||||
$dbh, $downtime->{'id'});
|
||||
|
@ -1901,8 +1906,9 @@ sub pandora_planned_downtime_quiet_once_start($$) {
|
|||
db_do($dbh, 'UPDATE tplanned_downtime
|
||||
SET executed = 1
|
||||
WHERE id = ?', $downtime->{'id'});
|
||||
print"pandora_planned_downtime_quiet_once_start\n";
|
||||
pandora_event ($pa_config,
|
||||
"(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
"(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
|
||||
pandora_planned_downtime_set_quiet_elements($pa_config,
|
||||
$dbh, $downtime->{'id'});
|
||||
|
@ -1955,8 +1961,9 @@ sub pandora_planned_downtime_monthly_start($$) {
|
|||
db_do($dbh, 'UPDATE tplanned_downtime
|
||||
SET executed = 1
|
||||
WHERE id = ?', $downtime->{'id'});
|
||||
print"pandora_planned_downtime_monthly_start\n";
|
||||
pandora_event ($pa_config,
|
||||
"Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
"Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
|
||||
|
||||
if ($downtime->{'type_downtime'} eq "quiet") {
|
||||
|
@ -2031,8 +2038,9 @@ sub pandora_planned_downtime_monthly_stop($$) {
|
|||
db_do($dbh, 'UPDATE tplanned_downtime
|
||||
SET executed = 0
|
||||
WHERE id = ?', $downtime->{'id'});
|
||||
print"pandora_planned_downtime_monthly_stop\n";
|
||||
pandora_event ($pa_config,
|
||||
"Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
"Server ".$pa_config->{'servername'}." stopped planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
|
||||
if ($downtime->{'type_downtime'} eq "quiet") {
|
||||
pandora_planned_downtime_unset_quiet_elements($pa_config,
|
||||
|
@ -2140,8 +2148,9 @@ sub pandora_planned_downtime_weekly_start($$) {
|
|||
db_do($dbh, 'UPDATE tplanned_downtime
|
||||
SET executed = 1
|
||||
WHERE id = ?', $downtime->{'id'});
|
||||
print"pandora_planned_downtime_weekly_start\n";
|
||||
pandora_event ($pa_config,
|
||||
"Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
"Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
|
||||
if ($downtime->{'type_downtime'} eq "quiet") {
|
||||
pandora_planned_downtime_set_quiet_elements($pa_config,
|
||||
|
@ -2254,8 +2263,10 @@ sub pandora_planned_downtime_weekly_stop($$) {
|
|||
db_do($dbh, 'UPDATE tplanned_downtime
|
||||
SET executed = 0
|
||||
WHERE id = ?', $downtime->{'id'});
|
||||
|
||||
print"pandora_planned_downtime_weekly_stop\n";
|
||||
pandora_event ($pa_config,
|
||||
"Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
"Server ".$pa_config->{'servername'}." stopped planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
|
||||
|
||||
if ($downtime->{'type_downtime'} eq "quiet") {
|
||||
pandora_planned_downtime_unset_quiet_elements($pa_config,
|
||||
|
@ -2985,7 +2996,7 @@ sub pandora_create_agent ($$$$$$$$$$;$$$$$$$$$) {
|
|||
}
|
||||
|
||||
logger ($pa_config, "Server '$server_name' CREATED agent '$agent_name' address '$address'.", 10);
|
||||
pandora_event ($pa_config, "Agent [$alias] created by $server_name", $group_id, $agent_id, 2, 0, 0, 'new_agent', 0, $dbh);
|
||||
pandora_event ($pa_config, "Agent [" . safe_output($alias) . "] created by $server_name", $group_id, $agent_id, 2, 0, 0, 'new_agent', 0, $dbh);
|
||||
return $agent_id;
|
||||
}
|
||||
|
||||
|
@ -5467,6 +5478,30 @@ sub pandora_output_password($$) {
|
|||
return $decrypted_password;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
=head2 C<< safe_mode (I<$pa_config>, I<$agent>, I<$module>, I<$new_status>, I<$known_status>, I<$dbh>) >>
|
||||
|
||||
Execute safe mode for the given agent based on the status of the given module.
|
||||
|
||||
=cut
|
||||
##########################################################################
|
||||
sub safe_mode($$$$$$) {
|
||||
my ($pa_config, $agent, $module, $new_status, $known_status, $dbh) = @_;
|
||||
|
||||
return unless $agent->{'safe_mode_module'} > 0;
|
||||
|
||||
# Going to critical. Disable the rest of the modules.
|
||||
if ($new_status == MODULE_CRITICAL) {
|
||||
logger($pa_config, "Enabling safe mode for agent " . $agent->{'nombre'}, 10);
|
||||
db_do($dbh, 'UPDATE tagente_modulo SET disabled=1 WHERE id_agente=? AND id_agente_modulo!=?', $agent->{'id_agente'}, $module->{'id_agente_modulo'});
|
||||
}
|
||||
# Coming back from critical. Enable the rest of the modules.
|
||||
elsif ($known_status == MODULE_CRITICAL) {
|
||||
logger($pa_config, "Disabling safe mode for agent " . $agent->{'nombre'}, 10);
|
||||
db_do($dbh, 'UPDATE tagente_modulo SET disabled=0 WHERE id_agente=? AND id_agente_modulo!=?', $agent->{'id_agente'}, $module->{'id_agente_modulo'});
|
||||
}
|
||||
}
|
||||
|
||||
# End of function declaration
|
||||
# End of defined Code
|
||||
|
||||
|
|
|
@ -333,19 +333,22 @@ sub process_xml_data ($$$$$) {
|
|||
if (defined ($data->{'group_id'}) && $data->{'group_id'} ne '') {
|
||||
$group_id = $data->{'group_id'};
|
||||
if (! defined (get_group_name ($dbh, $group_id))) {
|
||||
pandora_event ($pa_config, "Unable to create agent '$agent_name': group ID '" . $group_id . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
|
||||
print "UNABLE GROUP ID\n";
|
||||
pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': group ID '" . $group_id . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
|
||||
logger($pa_config, "Group ID " . $group_id . " does not exist.", 3);
|
||||
return;
|
||||
}
|
||||
} elsif (defined ($data->{'group'}) && $data->{'group'} ne '') {
|
||||
$group_id = get_group_id ($dbh, $data->{'group'});
|
||||
if (! defined (get_group_name ($dbh, $group_id))) {
|
||||
pandora_event ($pa_config, "Unable to create agent '$agent_name': group '" . $data->{'group'} . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
|
||||
print "UNABLE GROUP\n";
|
||||
pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': group '" . safe_output($data->{'group'}) . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
|
||||
logger($pa_config, "Group " . $data->{'group'} . " does not exist.", 3);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
pandora_event ($pa_config, "Unable to create agent '$agent_name': autocreate_group $group_id does not exist. Edit the pandora_server.conf file and change it.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
|
||||
print "UNABLE AUTOCREATE\n";
|
||||
pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': autocreate_group $group_id does not exist. Edit the pandora_server.conf file and change it.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
|
||||
logger($pa_config, "Group id $group_id does not exist (check autocreate_group config token).", 3);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -421,7 +421,7 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
|||
|
||||
$agent_id = pandora_create_agent($self->{'pa_config'}, $self->{'pa_config'}->{'servername'}, $host_name, $device, $self->{'group_id'}, 0, $id_os, '', 300, $self->{'dbh'});
|
||||
return undef unless defined ($agent_id) and ($agent_id > 0);
|
||||
pandora_event($self->{'pa_config'}, "[RECON] New " . $self->get_device_type($device) . " found (" . join(',', $self->get_addresses($device)) . ").", $self->{'group_id'}, $agent_id, 2, 0, 0, 'recon_host_detected', 0, $self->{'dbh'});
|
||||
pandora_event($self->{'pa_config'}, "[RECON] New " . safe_output($self->get_device_type($device)) . " found (" . join(',', safe_output($self->get_addresses($device))) . ").", $self->{'group_id'}, $agent_id, 2, 0, 0, 'recon_host_detected', 0, $self->{'dbh'});
|
||||
$agent_learning = 1;
|
||||
|
||||
# Create network profile modules for the agent
|
||||
|
|
|
@ -68,6 +68,11 @@ our @EXPORT = qw(
|
|||
$OS_VERSION
|
||||
RECOVERED_ALERT
|
||||
FIRED_ALERT
|
||||
MODULE_NORMAL
|
||||
MODULE_CRITICAL
|
||||
MODULE_WARNING
|
||||
MODULE_UNKNOWN
|
||||
MODULE_NOTINIT
|
||||
cron_get_closest_in_range
|
||||
cron_next_execution
|
||||
cron_next_execution_date
|
||||
|
@ -127,6 +132,13 @@ use constant MFSERVER => 15;
|
|||
use constant SYNCSERVER => 16;
|
||||
use constant WUXSERVER => 17;
|
||||
|
||||
# Module status
|
||||
use constant MODULE_NORMAL => 0;
|
||||
use constant MODULE_CRITICAL => 1;
|
||||
use constant MODULE_WARNING => 2;
|
||||
use constant MODULE_UNKNOWN => 3;
|
||||
use constant MODULE_NOTINIT => 4;
|
||||
|
||||
# Value for a metaconsole license type
|
||||
use constant METACONSOLE_LICENSE => 0x01;
|
||||
|
||||
|
@ -1323,7 +1335,12 @@ sub cron_next_execution_date {
|
|||
|
||||
# Months start from 0
|
||||
if($mon ne '*') {
|
||||
$mon -= 1;
|
||||
my ($mon_down, $mon_up) = cron_get_interval ($mon);
|
||||
if (defined($mon_up)) {
|
||||
$mon = $mon_down - 1 . "-" . $mon_up - 1;
|
||||
} else {
|
||||
$mon = $mon_down - 1;
|
||||
}
|
||||
}
|
||||
|
||||
# Get current time
|
||||
|
@ -1338,76 +1355,113 @@ sub cron_next_execution_date {
|
|||
my @cron_array = ($min, $hour, $mday, $mon);
|
||||
my @curr_time_array = ($cur_min, $cur_hour, $cur_mday, $cur_mon);
|
||||
return ($nex_time) if cron_is_in_cron(\@cron_array, \@curr_time_array) == 1;
|
||||
|
||||
# Parse intervals
|
||||
($min, undef) = cron_get_interval ($min);
|
||||
($hour, undef) = cron_get_interval ($hour);
|
||||
($mday, undef) = cron_get_interval ($mday);
|
||||
($mon, undef) = cron_get_interval ($mon);
|
||||
|
||||
# Get first next date candidate from cron configuration
|
||||
my ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year)
|
||||
= ($min, $hour, $mday, $mon, $cur_year);
|
||||
# Get first next date candidate from next cron configuration
|
||||
# Initialize some vars
|
||||
my @nex_time_array = @curr_time_array;
|
||||
my $prev_ovfl = 0;
|
||||
|
||||
# Replace wildcards
|
||||
if ($min eq '*') {
|
||||
if ($hour ne '*' || $mday ne '*' || $wday ne '*' || $mon ne '*') {
|
||||
$nex_min = 0;
|
||||
}
|
||||
else {
|
||||
$nex_min = $cur_min;
|
||||
}
|
||||
}
|
||||
if ($hour eq '*') {
|
||||
if ($mday ne '*' || $wday ne '*' ||$mon ne '*') {
|
||||
$nex_hour = 0;
|
||||
}
|
||||
else {
|
||||
$nex_hour = $cur_hour;
|
||||
}
|
||||
}
|
||||
if ($mday eq '*') {
|
||||
if ($mon ne '*') {
|
||||
$nex_mday = 1;
|
||||
}
|
||||
else {
|
||||
$nex_mday = $cur_mday;
|
||||
}
|
||||
}
|
||||
if ($mon eq '*') {
|
||||
$nex_mon = $cur_mon;
|
||||
# Update minutes
|
||||
my ($min_down, undef) = cron_get_interval ($min);
|
||||
$nex_time_array[0] = ($min_down eq '*') ? 0 : $min_down;
|
||||
|
||||
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
|
||||
if ($nex_time >= $cur_time) {
|
||||
return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array);
|
||||
}
|
||||
|
||||
# Find the next execution date
|
||||
my $count = 0;
|
||||
do {
|
||||
my $next_time = timelocal(0, $nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year);
|
||||
if ($next_time > $cur_time) {
|
||||
return $next_time;
|
||||
}
|
||||
if ($min eq '*' && $hour eq '*' && $wday eq '*' && $mday eq '*' && $mon eq '*') {
|
||||
($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = (localtime ($next_time + 60))[1, 2, 3, 4, 5];
|
||||
}
|
||||
elsif ($hour eq '*' && $wday eq '*' && $mday eq '*' && $mon eq '*') {
|
||||
($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = (localtime ($next_time + 3600))[1, 2, 3, 4, 5];
|
||||
}
|
||||
elsif ($mday eq '*' && $mon eq '*') {
|
||||
($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = (localtime ($next_time + 86400))[1, 2, 3, 4, 5];
|
||||
}
|
||||
elsif ($mon eq '*') {
|
||||
$nex_mon = $nex_mon + 1;
|
||||
if ($nex_mon > 11) {
|
||||
$nex_mon = 0;
|
||||
$nex_year++;
|
||||
# Check if next hour is in cron
|
||||
$nex_time_array[1]++;
|
||||
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
|
||||
|
||||
if ($nex_time == 0) {
|
||||
#Update the month day if overflow
|
||||
$prev_ovfl = 1;
|
||||
$nex_time_array[1] = 0;
|
||||
$nex_time_array[2]++;
|
||||
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
|
||||
if ($nex_time == 0) {
|
||||
#Update the month if overflow
|
||||
$nex_time_array[2] = 1;
|
||||
$nex_time_array[3]++;
|
||||
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
|
||||
if ($nex_time == 0) {
|
||||
#Update the year if overflow
|
||||
$cur_year++;
|
||||
$nex_time_array[3] = 0;
|
||||
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$nex_year++;
|
||||
}
|
||||
#Check the hour
|
||||
return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array);
|
||||
|
||||
#Update the hour if fails
|
||||
my ($hour_down, undef) = cron_get_interval ($hour);
|
||||
$nex_time_array[1] = ($hour_down eq '*') ? 0 : $hour_down;
|
||||
|
||||
# When an overflow is passed check the hour update again
|
||||
if ($prev_ovfl) {
|
||||
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
|
||||
return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array);
|
||||
}
|
||||
$prev_ovfl = 0;
|
||||
|
||||
# Check if next day is in cron
|
||||
$nex_time_array[2]++;
|
||||
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
|
||||
if ($nex_time == 0) {
|
||||
#Update the month if overflow
|
||||
$prev_ovfl = 1;
|
||||
$nex_time_array[2] = 1;
|
||||
$nex_time_array[3]++;
|
||||
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
|
||||
if ($nex_time == 0) {
|
||||
#Update the year if overflow
|
||||
$nex_time_array[3] = 0;
|
||||
$cur_year++;
|
||||
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
|
||||
}
|
||||
$count++;
|
||||
} while ($count < 60);
|
||||
}
|
||||
#Check the day
|
||||
return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array);
|
||||
|
||||
# Something went wrong, default to 5 minutes
|
||||
#Update the day if fails
|
||||
my ($mday_down, undef) = cron_get_interval ($mday);
|
||||
$nex_time_array[2] = ($mday_down eq '*') ? 1 : $mday_down;
|
||||
|
||||
# When an overflow is passed check the hour update in the next execution
|
||||
if ($prev_ovfl) {
|
||||
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
|
||||
return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array);
|
||||
}
|
||||
$prev_ovfl = 0;
|
||||
|
||||
# Check if next month is in cron
|
||||
$nex_time_array[3]++;
|
||||
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
|
||||
if ($nex_time == 0) {
|
||||
#Update the year if overflow
|
||||
$prev_ovfl = 1;
|
||||
$cur_year++;
|
||||
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
|
||||
}
|
||||
|
||||
#Check the month
|
||||
return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array);
|
||||
|
||||
#Update the month if fails
|
||||
my ($mon_down, undef) = cron_get_interval ($mon);
|
||||
$nex_time_array[3] = ($mday_down eq '*') ? 0 : $mday_down;
|
||||
|
||||
# When an overflow is passed check the hour update in the next execution
|
||||
if ($prev_ovfl) {
|
||||
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
|
||||
return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array);
|
||||
}
|
||||
|
||||
$nex_time = cron_valid_date(@nex_time_array, $cur_year + 1);
|
||||
|
||||
return $nex_time;
|
||||
}
|
||||
###############################################################################
|
||||
|
@ -1417,9 +1471,12 @@ sub cron_next_execution_date {
|
|||
###############################################################################
|
||||
sub cron_is_in_cron {
|
||||
my ($elems_cron, $elems_curr_time) = @_;
|
||||
|
||||
my @deref_elems_cron = @$elems_cron;
|
||||
my @deref_elems_curr_time = @$elems_curr_time;
|
||||
|
||||
my $elem_cron = shift(@$elems_cron);
|
||||
my $elem_curr_time = shift (@$elems_curr_time);
|
||||
my $elem_cron = shift(@deref_elems_cron);
|
||||
my $elem_curr_time = shift (@deref_elems_curr_time);
|
||||
|
||||
#If there is no elements means that is in cron
|
||||
return 1 unless (defined($elem_cron) || defined($elem_curr_time));
|
||||
|
@ -1428,15 +1485,17 @@ sub cron_is_in_cron {
|
|||
if ($elem_cron ne '*') {
|
||||
my ($down, $up) = cron_get_interval($elem_cron);
|
||||
# Check if there is no a range
|
||||
return 0 if (!defined($up) && ($down != $cron));
|
||||
return 0 if (!defined($up) && ($down != $elem_curr_time));
|
||||
# Check if there is on the range
|
||||
if ($down < $up) {
|
||||
return 0 if ($elem_curr_time < $down || $elem_curr_time > $up);
|
||||
} else {
|
||||
return 0 if ($elem_curr_time > $down || $elem_curr_time < $up);
|
||||
if (defined($up)) {
|
||||
if ($down < $up) {
|
||||
return 0 if ($elem_curr_time < $down || $elem_curr_time > $up);
|
||||
} else {
|
||||
return 0 if ($elem_curr_time > $down || $elem_curr_time < $up);
|
||||
}
|
||||
}
|
||||
}
|
||||
return cron_is_in_cron($elems_cron, $elems_curr_time);
|
||||
return cron_is_in_cron(\@deref_elems_cron, \@deref_elems_curr_time);
|
||||
}
|
||||
###############################################################################
|
||||
# Returns the interval of a cron element. If there is not a range,
|
||||
|
@ -1478,6 +1537,22 @@ sub cron_get_closest_in_range ($$) {
|
|||
return $target;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Check if a date is valid to get timelocal
|
||||
###############################################################################
|
||||
sub cron_valid_date {
|
||||
my ($min, $hour, $mday, $month, $year) = @_;
|
||||
my $utime;
|
||||
eval {
|
||||
local $SIG{__DIE__} = sub {};
|
||||
$utime = timelocal(0, $min, $hour, $mday, $month, $year);
|
||||
};
|
||||
if ($@) {
|
||||
return 0;
|
||||
}
|
||||
return $utime;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Attempt to resolve the given hostname.
|
||||
###############################################################################
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.715
|
||||
%define release 171114
|
||||
%define release 171127
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.715
|
||||
%define release 171114
|
||||
%define release 171127
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.715"
|
||||
PI_BUILD="171114"
|
||||
PI_BUILD="171127"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -33,7 +33,7 @@ use PandoraFMS::Tools;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.715 PS171114";
|
||||
my $version = "7.0NG.715 PS171127";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.715 PS171114";
|
||||
my $version = "7.0NG.715 PS171127";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
@ -4824,9 +4824,13 @@ sub cli_create_visual_console() {
|
|||
my $label_position = $elem->{'label_position'};
|
||||
my $border_color = $elem->{'border_color'};
|
||||
my $fill_color = $elem->{'fill_color'};
|
||||
my $show_statistics = $elem->{'fill_color'};
|
||||
my $id_layout_linked_weight = $elem->{'id_layout_linked_weight'};
|
||||
my $element_group = $elem->{'element_group'};
|
||||
my $show_on_top = $elem->{'show_on_top'};
|
||||
|
||||
my $elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $vc_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
|
||||
my $elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics, id_layout_linked_weight, element_group, show_on_top)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $vc_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0, $id_layout_linked_weight, $element_group, $show_on_top);
|
||||
|
||||
print_log "[INFO] The element id in position $elem_count is '$elem_id' \n\n";
|
||||
|
||||
|
@ -4893,9 +4897,13 @@ sub cli_create_visual_console() {
|
|||
my $label_position = $elem->{'label_position'};
|
||||
my $border_color = $elem->{'border_color'};
|
||||
my $fill_color = $elem->{'fill_color'};
|
||||
my $id_layout_linked_weight = $elem->{'id_layout_linked_weight'};
|
||||
my $element_group = $elem->{'element_group'};
|
||||
my $show_on_top = $elem->{'show_on_top'};
|
||||
|
||||
|
||||
my $elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $vc_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
|
||||
my $elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics, id_layout_linked_weight, element_group, show_on_top)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $vc_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0, $id_layout_linked_weight, $element_group, $show_on_top);
|
||||
|
||||
print_log "[INFO] The element id in position $elem_count is '$elem_id' \n\n";
|
||||
|
||||
|
@ -5001,6 +5009,9 @@ sub cli_edit_visual_console() {
|
|||
my $new_label_position = $element_in_db->{'label_position'};
|
||||
my $new_border_color = $element_in_db->{'border_color'};
|
||||
my $new_fill_color = $element_in_db->{'fill_color'};
|
||||
my $new_id_layout_linked_weight = $elem->{'id_layout_linked_weight'};
|
||||
my $new_element_group = $elem->{'element_group'};
|
||||
my $new_show_on_top = $elem->{'show_on_top'};
|
||||
|
||||
if(defined($elem->{'pos_x'})) {
|
||||
$new_pos_x = $elem->{'pos_x'};
|
||||
|
@ -5065,6 +5076,15 @@ sub cli_edit_visual_console() {
|
|||
if(defined($elem->{'fill_color'})) {
|
||||
$new_fill_color = $elem->{'fill_color'};
|
||||
}
|
||||
if(defined($elem->{'id_layout_linked_weight'})) {
|
||||
$new_id_layout_linked_weight = $elem->{'id_layout_linked_weight'};
|
||||
}
|
||||
if(defined($elem->{'element_group'})) {
|
||||
$new_element_group = $elem->{'element_group'};
|
||||
}
|
||||
if(defined($elem->{'show_on_top'})) {
|
||||
$new_show_on_top = $elem->{'show_on_top'};
|
||||
}
|
||||
|
||||
db_update ($dbh, "UPDATE tlayout_data SET pos_x = " . $new_pos_x . ", pos_y = " . $new_pos_y . ", width = " . $new_width .
|
||||
", height = " . $new_height . ", label = '" . $new_label . "', image = '" . $new_image .
|
||||
|
@ -5073,6 +5093,7 @@ sub cli_edit_visual_console() {
|
|||
", enable_link = " . $new_enable_link . ", id_metaconsole = " . $new_id_metaconsole . ", id_group = " . $new_id_group .
|
||||
", id_custom_graph = " . $new_id_custom_graph . ", border_width = " . $new_border_width . ", type_graph = '" . $new_type_graph .
|
||||
"', label_position = '" . $new_label_position . "', border_color = '" . $new_border_color . "', fill_color = '" . $new_fill_color .
|
||||
"', id_layout_linked_weight = '" . $new_id_layout_linked_weight . "', element_group = '" . $new_element_group . "', show_on_top = '" . $new_show_on_top .
|
||||
"' WHERE id = " . $elem->{'id'});
|
||||
|
||||
print_log "[INFO] Element with id " . $elem->{'id'} . " has been updated \n\n";
|
||||
|
@ -5099,9 +5120,12 @@ sub cli_edit_visual_console() {
|
|||
my $label_position = $elem->{'label_position'};
|
||||
my $border_color = $elem->{'border_color'};
|
||||
my $fill_color = $elem->{'fill_color'};
|
||||
my $id_layout_linked_weight = $elem->{'id_layout_linked_weight'};
|
||||
my $element_group = $elem->{'element_group'};
|
||||
my $show_on_top = $elem->{'show_on_top'};
|
||||
|
||||
my $new_elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
|
||||
my $new_elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics, id_layout_linked_weight, element_group, show_on_top)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0, $id_layout_linked_weight, $element_group, $show_on_top);
|
||||
|
||||
print_log "[INFO] New element with id $new_elem_id has been created \n\n";
|
||||
}
|
||||
|
@ -5142,6 +5166,9 @@ sub cli_edit_visual_console() {
|
|||
my $new_label_position = $element_in_db->{'label_position'};
|
||||
my $new_border_color = $element_in_db->{'border_color'};
|
||||
my $new_fill_color = $element_in_db->{'fill_color'};
|
||||
my $new_id_layout_linked_weight = $elem->{'id_layout_linked_weight'};
|
||||
my $new_element_group = $elem->{'element_group'};
|
||||
my $new_show_on_top = $elem->{'show_on_top'};
|
||||
|
||||
if(defined($elem->{'width'})) {
|
||||
$new_width = $elem->{'width'};
|
||||
|
@ -5200,6 +5227,15 @@ sub cli_edit_visual_console() {
|
|||
if(defined($elem->{'fill_color'})) {
|
||||
$new_fill_color = $elem->{'fill_color'};
|
||||
}
|
||||
if(defined($elem->{'id_layout_linked_weight'})) {
|
||||
$new_id_layout_linked_weight = $elem->{'id_layout_linked_weight'};
|
||||
}
|
||||
if(defined($elem->{'element_group'})) {
|
||||
$new_element_group = $elem->{'element_group'};
|
||||
}
|
||||
if(defined($elem->{'show_on_top'})) {
|
||||
$new_show_on_top = $elem->{'show_on_top'};
|
||||
}
|
||||
|
||||
db_update ($dbh, "UPDATE tlayout_data SET pos_x = " . $new_pos_x . ", pos_y = " . $new_pos_y . ", width = " . $new_width .
|
||||
", height = " . $new_height . ", label = '" . $new_label . "', image = '" . $new_image .
|
||||
|
@ -5208,6 +5244,7 @@ sub cli_edit_visual_console() {
|
|||
", enable_link = " . $new_enable_link . ", id_metaconsole = " . $new_id_metaconsole . ", id_group = " . $new_id_group .
|
||||
", id_custom_graph = " . $new_id_custom_graph . ", border_width = " . $new_border_width . ", type_graph = '" . $new_type_graph .
|
||||
"', label_position = '" . $new_label_position . "', border_color = '" . $new_border_color . "', fill_color = '" . $new_fill_color .
|
||||
"', id_layout_linked_weight = '" . $new_id_layout_linked_weight . "', element_group = '" . $new_element_group . "', show_on_top = '" . $new_show_on_top .
|
||||
"' WHERE id = " . $elem->{'id'});
|
||||
|
||||
print_log "[INFO] Element with id " . $elem->{'id'} . " has been updated \n\n";
|
||||
|
@ -5234,9 +5271,12 @@ sub cli_edit_visual_console() {
|
|||
my $label_position = $elem->{'label_position'};
|
||||
my $border_color = $elem->{'border_color'};
|
||||
my $fill_color = $elem->{'fill_color'};
|
||||
my $id_layout_linked_weight = $elem->{'id_layout_linked_weight'};
|
||||
my $element_group = $elem->{'element_group'};
|
||||
my $show_on_top = $elem->{'show_on_top'};
|
||||
|
||||
my $new_elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
|
||||
my $new_elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics, id_layout_linked_weight, element_group, show_on_top)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0, $id_layout_linked_weight, $element_group, $show_on_top);
|
||||
|
||||
print_log "[INFO] New element with id $new_elem_id has been created \n\n";
|
||||
}
|
||||
|
@ -5441,9 +5481,12 @@ sub cli_duplicate_visual_console () {
|
|||
my $label_position = $element->{'label_position'};
|
||||
my $border_color = $element->{'border_color'};
|
||||
my $fill_color = $element->{'fill_color'};
|
||||
my $id_layout_linked_weight = $element->{'id_layout_linked_weight'};
|
||||
my $element_group = $element->{'element_group'};
|
||||
my $show_on_top = $element->{'show_on_top'};
|
||||
|
||||
my $element_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $new_console_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
|
||||
my $element_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics, id_layout_linked_weight, element_group, show_on_top)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $new_console_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0, $id_layout_linked_weight, $element_group, $show_on_top);
|
||||
|
||||
print_log "[INFO] Element with ID " . $element->{"id"} . " has been duplicated to the new console \n\n";
|
||||
}
|
||||
|
@ -5509,6 +5552,9 @@ sub cli_export_visual_console() {
|
|||
my $label_position = $element->{'label_position'};
|
||||
my $border_color = $element->{'border_color'};
|
||||
my $fill_color = $element->{'fill_color'};
|
||||
my $id_layout_linked_weight = $element->{'id_layout_linked_weight'};
|
||||
my $element_group = $element->{'element_group'};
|
||||
my $show_on_top = $element->{'show_on_top'};
|
||||
|
||||
if ($first == 0) {
|
||||
$data_to_json .= ','
|
||||
|
@ -5546,6 +5592,9 @@ sub cli_export_visual_console() {
|
|||
$data_to_json .= ',"label_position":"' . $label_position . '"';
|
||||
$data_to_json .= ',"border_color":"' . $border_color . '"';
|
||||
$data_to_json .= ',"fill_color":"' . $fill_color . '"';
|
||||
$data_to_json .= ',"id_layout_linked_weight":' . $id_layout_linked_weight;
|
||||
$data_to_json .= ',"element_group":' . $element_group;
|
||||
$data_to_json .= ',"show_on_top":' . $show_on_top;
|
||||
$data_to_json .= '}';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue