Merge remote-tracking branch 'origin/develop' into ent-3295-revision-comportamiento-metaconsola-con-nodo-multi-servidor
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.735
|
||||
Version: 7.0NG.735-190603
|
||||
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.735"
|
||||
pandora_version="7.0NG.735-190603"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -42,7 +42,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.735';
|
||||
use constant AGENT_BUILD => '190522';
|
||||
use constant AGENT_BUILD => '190603';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -536,6 +536,12 @@ sub parse_conf_modules($) {
|
|||
# Check for invalid modules
|
||||
next unless (($module->{'name'} ne '' && $module->{'func'} != 0) || $module->{'func'} == \&module_plugin);
|
||||
|
||||
# Skip disabled modules.
|
||||
if (defined($module->{'disabled'}) && $module->{'disabled'} == 1) {
|
||||
log_message('setup', 'Skipping disabled module "' . $module->{'name'} . '"');
|
||||
next;
|
||||
}
|
||||
|
||||
# Set the intensive interval
|
||||
if ($module->{'is_intensive'} == 1) {
|
||||
$module->{'intensive_interval'} = $module->{'interval'};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.735
|
||||
%define release 1
|
||||
%define release 190603
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.735
|
||||
%define release 1
|
||||
%define release 190603
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.735"
|
||||
PI_BUILD="190522"
|
||||
PI_BUILD="190603"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{190522}
|
||||
{190603}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
|
|||
{No}
|
||||
|
||||
Windows,Executable
|
||||
{<%AppName%>-Setup<%Ext%>}
|
||||
{<%AppName%>-<%Version%>-Setup<%Ext%>}
|
||||
|
||||
Windows,FileDescription
|
||||
{<%AppName%> <%Version%> Setup}
|
||||
|
|
|
@ -1117,6 +1117,12 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
|||
}
|
||||
}
|
||||
|
||||
/* Skip disabled modules */
|
||||
if (module_disabled == "1") {
|
||||
pandoraLog ("Skipping disabled module \"%s\"", module_name.c_str ());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Create module objects */
|
||||
if (module_exec != "") {
|
||||
module = new Pandora_Module_Exec (module_name,
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.735(Build 190522)")
|
||||
#define PANDORA_VERSION ("7.0NG.735(Build 190603)")
|
||||
|
||||
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.735(Build 190522))"
|
||||
VALUE "ProductVersion", "(7.0NG.735(Build 190603))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.735
|
||||
Version: 7.0NG.735-190603
|
||||
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.735"
|
||||
pandora_version="7.0NG.735-190603"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -298,7 +298,7 @@ function mainAgentsAlerts()
|
|||
|
||||
$table2->data[2][0] = __('Threshold');
|
||||
$table2->data[2][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true);
|
||||
$table2->data[2][1] .= ' '.__('seconds').ui_print_help_icon('action_threshold', true);
|
||||
$table2->data[2][1] .= ' '.__('seconds');
|
||||
|
||||
$content2 = '<form class="add_alert_form" method="post">';
|
||||
$content2 .= html_print_table($table2, true);
|
||||
|
|
|
@ -9,11 +9,37 @@ ALTER TABLE `talert_commands` ADD COLUMN `fields_hidden` text;
|
|||
ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal');
|
||||
|
||||
DELETE FROM `tevent_response` WHERE `name` LIKE 'Create Integria IMS incident from event';
|
||||
INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (1,'admin','Welcome to Pandora FMS Console', '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ',NOW());
|
||||
INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (NULL,'admin','Welcome to Pandora FMS Console', '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ',NOW());
|
||||
|
||||
|
||||
INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `also_mail`) VALUES ((SELECT `id` FROM `tnotification_source` WHERE `description`="Official communication"), "admin", 1, 0);
|
||||
UPDATE `tnotification_source` SET `enabled`=1 WHERE `description` = 'System status' OR `description` = 'Official communication';
|
||||
UPDATE `tnotification_source` SET `icon`="icono_logo_pandora.png" WHERE `description` = 'Official communication';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tvisual_console_items_cache`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tvisual_console_elements_cache` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`vc_id` INTEGER UNSIGNED NOT NULL,
|
||||
`vc_item_id` INTEGER UNSIGNED NOT NULL,
|
||||
`user_id` VARCHAR(60) DEFAULT NULL,
|
||||
`data` TEXT NOT NULL,
|
||||
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`expiration` INTEGER UNSIGNED NOT NULL COMMENT 'Seconds to expire',
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY(`vc_id`) REFERENCES `tlayout`(`id`)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(`vc_item_id`) REFERENCES `tlayout_data`(`id`)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY (`user_id`) REFERENCES `tusuario`(`id_user`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `cache_expiration` INTEGER UNSIGNED NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_user` VARCHAR(60);
|
||||
ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_pass` VARCHAR(45);
|
||||
ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_enabled` TINYINT(1) DEFAULT '1';
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -1288,6 +1288,11 @@ alter table tusuario add autorefresh_white_list text not null default '';
|
|||
ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
|
||||
ALTER TABLE `tusuario` DROP COLUMN `flash_chart`;
|
||||
ALTER TABLE `tusuario` ADD COLUMN `default_custom_view` int(10) unsigned NULL default '0';
|
||||
ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_user` VARCHAR(60);
|
||||
ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_pass` VARCHAR(45);
|
||||
ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_enabled` TINYINT(1);
|
||||
|
||||
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagente_modulo`
|
||||
|
@ -1370,6 +1375,7 @@ ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_type` ENUM ('default
|
|||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_node_id` INT(10) NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `cache_expiration` INTEGER UNSIGNED NOT NULL DEFAULT 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagent_custom_fields`
|
||||
|
@ -2126,11 +2132,11 @@ ALTER TABLE `tnetflow_filter` DROP COLUMN `output`;
|
|||
-- ----------------------------------------------------------------------
|
||||
UPDATE tuser_task set parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report";
|
||||
|
||||
------------------------------------------------------------------------
|
||||
------ ADD message in table 'tnews'
|
||||
------------------------------------------------------------------------
|
||||
-- ----------------------------------------------------------------------
|
||||
-- ADD message in table 'tnews'
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (1,'admin','Welcome to Pandora FMS Console', '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ',NOW());
|
||||
INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (NULL,'admin','Welcome to Pandora FMS Console', '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ',NOW());
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Alter table `talert_templates`
|
||||
|
@ -2138,3 +2144,24 @@ INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES
|
|||
|
||||
ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tvisual_console_items_cache`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE `tvisual_console_elements_cache` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`vc_id` INTEGER UNSIGNED NOT NULL,
|
||||
`vc_item_id` INTEGER UNSIGNED NOT NULL,
|
||||
`user_id` VARCHAR(60) DEFAULT NULL,
|
||||
`data` TEXT NOT NULL,
|
||||
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`expiration` INTEGER UNSIGNED NOT NULL COMMENT 'Seconds to expire',
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY(`vc_id`) REFERENCES `tlayout`(`id`)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(`vc_item_id`) REFERENCES `tlayout_data`(`id`)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY (`user_id`) REFERENCES `tusuario`(`id_user`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ switch ($login_screen) {
|
|||
echo '</div>';
|
||||
|
||||
echo '<div id="log_button" class="login_button" style="display: none;">';
|
||||
html_print_submit_button(__('Login as admin'), 'login_button', false, 'class="sub next_login"');
|
||||
html_print_submit_button(__('Login as admin'), 'login_button', false, 'class="next_login"');
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="login_button" id="remove_button">';
|
||||
|
@ -226,7 +226,7 @@ switch ($login_screen) {
|
|||
);
|
||||
echo '</div>';
|
||||
echo '<div class="login_button">';
|
||||
html_print_submit_button(__('Login'), 'login_button', false, 'class="sub next_login"');
|
||||
html_print_submit_button(__('Login'), 'login_button', false, 'class="next_login"');
|
||||
echo '</div>';
|
||||
}
|
||||
break;
|
||||
|
@ -245,7 +245,7 @@ switch ($login_screen) {
|
|||
html_print_input_text_extended('auth_code', '', 'auth_code', '', '', '', false, '', 'class="login login_password" placeholder="'.__('Authentication code').'"', false, true);
|
||||
echo '</div>';
|
||||
echo '<div class="login_button">';
|
||||
html_print_submit_button(__('Check code').' >', 'login_button', false, 'class="sub next_login"');
|
||||
html_print_submit_button(__('Check code').' >', 'login_button', false, 'class="next_login"');
|
||||
echo '</div>';
|
||||
break;
|
||||
|
||||
|
@ -319,7 +319,7 @@ echo '</div>';
|
|||
echo '<div id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '').'</div>';
|
||||
echo '</div>';
|
||||
|
||||
if (!isset($process_error_message) && isset($mail)) {
|
||||
if (empty($process_error_message) && isset($mail)) {
|
||||
echo '<div id="reset_correct" title="'.__('Password reset').'">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
|
@ -336,7 +336,7 @@ if (!isset($process_error_message) && isset($mail)) {
|
|||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
} else if (isset($process_error_message)) {
|
||||
} else if (isset($process_error_message) && !empty($process_error_message)) {
|
||||
echo '<div id="reset_correct" title="'.__('Password reset').'">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
|
|
|
@ -197,12 +197,17 @@ if (!empty($all_data)) {
|
|||
}
|
||||
|
||||
foreach ($news as $article) {
|
||||
$image = false;
|
||||
if ($article['text'] == '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ') {
|
||||
$image = true;
|
||||
}
|
||||
|
||||
$text_bbdd = io_safe_output($article['text']);
|
||||
$text = html_entity_decode($text_bbdd);
|
||||
echo '<tr><th class="green_title">'.$article['subject'].'</th></tr>';
|
||||
echo '<tr><td>'.__('by').' <b>'.$article['author'].'</b> <i>'.ui_print_timestamp($article['timestamp'], true).'</i> '.$comparation_suffix.'</td></tr>';
|
||||
echo '<tr><td class="datos">';
|
||||
if ($article['id_news'] == 1) {
|
||||
if ($image) {
|
||||
echo '<center><img src="./images/welcome_image.png" alt="img colabora con nosotros - Support" width="191" height="207"></center>';
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ $registration = isset($config['pandora_uid']) !== true
|
|||
|| $config['pandora_uid'] == '';
|
||||
|
||||
|
||||
if ($initial) {
|
||||
if ($initial && users_is_admin()) {
|
||||
// Show all forms in order.
|
||||
// 1- Ask for email, timezone, etc. Fullfill alerts and user mail.
|
||||
config_wiz_modal(
|
||||
|
@ -150,7 +150,7 @@ if ($initial) {
|
|||
);
|
||||
}
|
||||
|
||||
if ($registration) {
|
||||
if ($registration && users_is_admin()) {
|
||||
// Prepare registration wizard, not launch. leave control to flow.
|
||||
registration_wiz_modal(
|
||||
false,
|
||||
|
@ -169,6 +169,9 @@ if ($registration) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$newsletter = null;
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
|
|
@ -1,17 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to schedule tasks on Pandora FMS Console
|
||||
*
|
||||
* @category Agent editor/ builder.
|
||||
* @package Pandora FMS
|
||||
* @subpackage Classic agent management view.
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Load global vars
|
||||
// Begin.
|
||||
enterprise_include('godmode/agentes/agent_manager.php');
|
||||
|
||||
require_once 'include/functions_clippy.php';
|
||||
|
@ -30,23 +45,19 @@ if (is_ajax()) {
|
|||
|
||||
$id_agent = (int) get_parameter('id_agent');
|
||||
$string = (string) get_parameter('q');
|
||||
// q is what autocomplete plugin gives
|
||||
// Field q is what autocomplete plugin gives.
|
||||
$filter = [];
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%" OR alias LIKE "%'.$string.'%")';
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$filter[] = '(upper(nombre) LIKE upper(\'%'.$string.'%\') OR upper(direccion) LIKE upper(\'%'.$string.'%\') OR upper(comentarios) LIKE upper(\'%'.$string.'%\') OR upper(alias) LIKE upper(\'%'.$string.'%\'))';
|
||||
break;
|
||||
}
|
||||
|
||||
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%" OR alias LIKE "%'.$string.'%")';
|
||||
$filter[] = 'id_agente != '.$id_agent;
|
||||
|
||||
$agents = agents_get_agents($filter, ['id_agente', 'nombre', 'direccion']);
|
||||
$agents = agents_get_agents(
|
||||
$filter,
|
||||
[
|
||||
'id_agente',
|
||||
'nombre',
|
||||
'direccion',
|
||||
]
|
||||
);
|
||||
if ($agents === false) {
|
||||
$agents = [];
|
||||
}
|
||||
|
@ -78,7 +89,7 @@ if (is_ajax()) {
|
|||
$out = false;
|
||||
foreach ($idSNMP as $id) {
|
||||
foreach ($snmp[$id] as $key => $value) {
|
||||
// Check if it has "ifXXXX" syntax and skip it
|
||||
// Check if it has "ifXXXX" syntax and skip it.
|
||||
if (! preg_match('/if/', $key)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -98,7 +109,7 @@ if (is_ajax()) {
|
|||
echo io_json_mb_encode($out);
|
||||
}
|
||||
|
||||
// And and remove groups use the same function
|
||||
// And and remove groups use the same function.
|
||||
$add_secondary_groups = get_parameter('add_secondary_groups');
|
||||
$remove_secondary_groups = get_parameter('remove_secondary_groups');
|
||||
if ($add_secondary_groups || $remove_secondary_groups) {
|
||||
|
@ -114,12 +125,12 @@ if (is_ajax()) {
|
|||
'agents_update_secondary_groups',
|
||||
[
|
||||
$id_agent,
|
||||
$add_secondary_groups ? $groups_to_add : [],
|
||||
$remove_secondary_groups ? $groups_to_add : [],
|
||||
($add_secondary_groups) ? $groups_to_add : [],
|
||||
($remove_secondary_groups) ? $groups_to_add : [],
|
||||
]
|
||||
);
|
||||
// Echo 0 in case of error. 0 Otherwise.
|
||||
echo $ret ? 1 : 0;
|
||||
echo ($ret) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,7 +160,7 @@ if ($new_agent) {
|
|||
}
|
||||
|
||||
if (!$new_agent) {
|
||||
// Agent remote configuration editor
|
||||
// Agent remote configuration editor.
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
if (enterprise_installed()) {
|
||||
$filename = config_agents_get_agent_config_filenames($id_agente);
|
||||
|
@ -157,27 +168,41 @@ if (!$new_agent) {
|
|||
}
|
||||
|
||||
$disk_conf_delete = (bool) get_parameter('disk_conf_delete');
|
||||
// Agent remote configuration DELETE
|
||||
// Agent remote configuration DELETE.
|
||||
if ($disk_conf_delete) {
|
||||
// TODO: Get this working on computers where the Pandora server(s) are not on the webserver
|
||||
// TODO: Get a remote_config editor working in the open version
|
||||
// TODO: Get a remote_config editor working in the open version.
|
||||
@unlink($filename['md5']);
|
||||
@unlink($filename['conf']);
|
||||
}
|
||||
|
||||
echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||
echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||
|
||||
// Custom ID.
|
||||
$custom_id_div = '<div class="label_select">';
|
||||
$custom_id_div .= '<p class="input_label">'.__('Custom ID').': </p>';
|
||||
$custom_id_div .= html_print_input_text(
|
||||
'custom_id',
|
||||
$custom_id,
|
||||
'',
|
||||
16,
|
||||
255,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'agent_custom_id'
|
||||
).'</div>';
|
||||
|
||||
if (!$new_agent && $alias != '') {
|
||||
$table_agent_name = '<div class="label_select"><p class="input_label">'.__('Agent name').': '.ui_print_help_tip(__("The agent's name must be the same as the one defined at the console"), true).'</p>';
|
||||
$table_agent_name .= '<div class="label_select_parent">';
|
||||
$table_agent_name .= '<div class="label_select_child_left">'.html_print_input_text('agente', $nombre_agente, '', 50, 100, true).'</div>';
|
||||
$table_agent_name .= '<div class="label_select_child_right agent_options_agent_name">';
|
||||
|
||||
$table_qr_code = '<div class="agent_qr white_box"><p class="input_label">'.__('QR Code Agent view').': </p>';
|
||||
$table_agent_name .= '<div class="label_select_child_left" style="width: 60%;">'.html_print_input_text('agente', $nombre_agente, '', 50, 100, true).'</div>';
|
||||
$table_agent_name .= '<div class="label_select_child_right agent_options_agent_name" style="width: 40%;">';
|
||||
|
||||
if ($id_agente) {
|
||||
$table_agent_name .= '<span>'.__('ID').' '.$id_agente.'</span>';
|
||||
$table_agent_name .= '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
|
||||
$table_agent_name .= '<label>'.__('ID').'</label><input style="width: 50%;" type="text" disabled="true" value="'.$id_agente.'" />';
|
||||
$table_agent_name .= '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
|
||||
$table_agent_name .= html_print_image(
|
||||
'images/zoom.png',
|
||||
true,
|
||||
|
@ -192,7 +217,7 @@ if (!$new_agent && $alias != '') {
|
|||
$agent_options_update = 'agent_options_update';
|
||||
|
||||
// Delete link from here.
|
||||
$table_agent_name .= "<a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=$id_agente&search=&offset=0&sort_field=&sort=none'>".html_print_image('images/cross.png', true, ['title' => __('Delete agent')]).'</a>';
|
||||
$table_agent_name .= "<a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=".$id_agente."&search=&offset=0&sort_field=&sort=none'>".html_print_image('images/cross.png', true, ['title' => __('Delete agent')]).'</a>';
|
||||
|
||||
// Remote configuration available.
|
||||
if (isset($filename)) {
|
||||
|
@ -201,7 +226,7 @@ if (!$new_agent && $alias != '') {
|
|||
$agent_name = io_safe_output($agent_name);
|
||||
$agent_md5 = md5($agent_name, false);
|
||||
|
||||
$table_agent_name .= '<a href="index.php?'.'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'tab=remote_configuration&'.'id_agente='.$id_agente.'&'.'disk_conf='.$agent_md5.'">';
|
||||
$table_agent_name .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$id_agente.'&disk_conf='.$agent_md5.'">';
|
||||
$table_agent_name .= html_print_image(
|
||||
'images/application_edit.png',
|
||||
true,
|
||||
|
@ -218,6 +243,19 @@ if (!$new_agent && $alias != '') {
|
|||
}
|
||||
|
||||
$table_agent_name .= '</div></div></div>';
|
||||
|
||||
// QR code div.
|
||||
$table_qr_code = '<div class="agent_qr white_box">';
|
||||
$table_qr_code .= '<p class="input_label">'.__('QR Code Agent view').': </p>';
|
||||
$table_qr_code .= '<div id="qr_container_image"></div>';
|
||||
if ($id_agente) {
|
||||
$table_qr_code .= "<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"".ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente)."\" );'></a>";
|
||||
}
|
||||
|
||||
// Add Custom id div.
|
||||
$table_qr_code .= '<br />';
|
||||
$table_qr_code .= $custom_id_div;
|
||||
$table_qr_code .= '</div>';
|
||||
}
|
||||
|
||||
if ($new_agent) {
|
||||
|
@ -257,14 +295,6 @@ if ($id_agente) {
|
|||
}
|
||||
</style>
|
||||
<?php
|
||||
if (!$new_agent && $alias != '') {
|
||||
if ($id_agente) {
|
||||
$table_qr_code .= "<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"".ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente)."\" );'></a>";
|
||||
}
|
||||
|
||||
$table_qr_code .= '</div>';
|
||||
}
|
||||
|
||||
$groups = users_get_groups($config['id_user'], 'AR', false);
|
||||
|
||||
$modules = db_get_all_rows_sql(
|
||||
|
@ -295,7 +325,21 @@ $table_primary_group .= '</span></div></div></div>';
|
|||
|
||||
$table_interval = '<div class="label_select"><p class="input_label">'.__('Interval').': </p>';
|
||||
$table_interval .= '<div class="label_select_parent">';
|
||||
$table_interval .= html_print_extended_select_for_time('intervalo', $intervalo, '', '', '0', 10, true);
|
||||
$table_interval .= html_print_extended_select_for_time(
|
||||
'intervalo',
|
||||
$intervalo,
|
||||
'',
|
||||
'',
|
||||
'0',
|
||||
10,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'w40p'
|
||||
);
|
||||
|
||||
|
||||
|
||||
if ($intervalo < SECONDS_5MINUTES) {
|
||||
$table_interval .= clippy_context_help('interval_agent_min');
|
||||
}
|
||||
|
@ -341,20 +385,21 @@ $table_server .= html_print_select(
|
|||
__('None'),
|
||||
0,
|
||||
true
|
||||
).'<div class="label_select_child_icons">'.ui_print_help_icon('agent_server', true).'</div></div></div>';
|
||||
).'<div class="label_select_child_icons"></div></div></div>';
|
||||
|
||||
// Description.
|
||||
$table_description = '<div class="label_select"><p class="input_label">'.__('Description').': </p>';
|
||||
$table_description .= html_print_input_text(
|
||||
$table_description .= html_print_textarea(
|
||||
'comentarios',
|
||||
3,
|
||||
10,
|
||||
$comentarios,
|
||||
'',
|
||||
45,
|
||||
200,
|
||||
true
|
||||
true,
|
||||
'agent_description'
|
||||
).'</div>';
|
||||
|
||||
|
||||
// QR code.
|
||||
echo '<div class="first_row">
|
||||
<div class="agent_options '.$agent_options_update.' white_box">
|
||||
<div class="agent_options_column_left">'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'</div>
|
||||
|
@ -368,46 +413,46 @@ echo '</div>';
|
|||
|
||||
if (enterprise_installed()) {
|
||||
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
|
||||
$table_adv_secondary_groups = '<div class="label_select"><p class="input_label">'.__('Secondary groups').': '.ui_print_help_icon('secondary_groups', true).'</p></div>';
|
||||
$table_adv_secondary_groups = '<div class="label_select"><p class="input_label">'.__('Secondary groups').': </p></div>';
|
||||
$table_adv_secondary_groups_left = html_print_select_groups(
|
||||
false,
|
||||
// Use the current user to select the groups
|
||||
// Use the current user to select the groups.
|
||||
'AR',
|
||||
// ACL permission
|
||||
// ACL permission.
|
||||
false,
|
||||
// Not all group
|
||||
// Not all group.
|
||||
'secondary_groups',
|
||||
// HTML id
|
||||
// HTML id.
|
||||
'',
|
||||
// No select any by default
|
||||
// No select any by default.
|
||||
'',
|
||||
// Javascript onChange code
|
||||
// Javascript onChange code.
|
||||
'',
|
||||
// Do not user no selected value
|
||||
// Do not user no selected value.
|
||||
0,
|
||||
// Do not use no selected value
|
||||
// Do not use no selected value.
|
||||
true,
|
||||
// Return HTML (not echo)
|
||||
// Return HTML (not echo).
|
||||
true,
|
||||
// Multiple selection
|
||||
// Multiple selection.
|
||||
true,
|
||||
// Sorting by default
|
||||
// Sorting by default.
|
||||
'',
|
||||
// CSS classnames (default)
|
||||
// CSS classnames (default).
|
||||
false,
|
||||
// Not disabled (default)
|
||||
'width:50%; min-width:170px; text-align:center',
|
||||
// Inline styles (default)
|
||||
// Not disabled (default).
|
||||
'width:50%; min-width:170px;',
|
||||
// Inline styles (default).
|
||||
false,
|
||||
// Option style select (default)
|
||||
// Option style select (default).
|
||||
false,
|
||||
// Do not truncate the users tree (default)
|
||||
// Do not truncate the users tree (default).
|
||||
'id_grupo',
|
||||
// Key to get as value (default)
|
||||
// Key to get as value (default).
|
||||
false,
|
||||
// Not strict user (default)
|
||||
// Not strict user (default).
|
||||
$secondary_groups_selected['plain']
|
||||
// Do not show the primary group in this selection
|
||||
// Do not show the primary group in this selection.
|
||||
);
|
||||
|
||||
$table_adv_secondary_groups_arrows = html_print_input_image(
|
||||
|
@ -436,32 +481,32 @@ if (enterprise_installed()) {
|
|||
|
||||
$table_adv_secondary_groups_right .= html_print_select(
|
||||
$secondary_groups_selected['for_select'],
|
||||
// Values
|
||||
// Values.
|
||||
'secondary_groups_selected',
|
||||
// HTML id
|
||||
// HTML id.
|
||||
'',
|
||||
// Selected
|
||||
// Selected.
|
||||
'',
|
||||
// Javascript onChange code
|
||||
// Javascript onChange code.
|
||||
'',
|
||||
// Nothing selected
|
||||
// Nothing selected.
|
||||
0,
|
||||
// Nothing selected
|
||||
// Nothing selected.
|
||||
true,
|
||||
// Return HTML (not echo)
|
||||
// Return HTML (not echo).
|
||||
true,
|
||||
// Multiple selection
|
||||
// Multiple selection.
|
||||
true,
|
||||
// Sort
|
||||
// Sort.
|
||||
'',
|
||||
// Class
|
||||
// Class.
|
||||
false,
|
||||
// Disabled
|
||||
'width:50%; min-width:170px; text-align:center'
|
||||
// Style
|
||||
// Disabled.
|
||||
'width:50%; min-width:170px;'
|
||||
// Style.
|
||||
);
|
||||
|
||||
// safe operation mode
|
||||
// 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
|
||||
|
@ -485,13 +530,13 @@ if (enterprise_installed()) {
|
|||
$table_adv_safe .= __('Module').' '.html_print_select($safe_mode_modules, 'safe_mode_module', $safe_mode_module, '', '', 0, true).'</div>';
|
||||
}
|
||||
|
||||
// Remote configuration
|
||||
// Remote configuration.
|
||||
$table_adv_remote = '<div class="label_select"><p class="input_label">'.__('Remote configuration').': </p>';
|
||||
|
||||
if (!$new_agent && isset($filename) && file_exists($filename['md5'])) {
|
||||
$table_adv_remote .= date('F d Y H:i:s', fileatime($filename['md5']));
|
||||
// Delete remote configuration
|
||||
$table_adv_remote .= '<a href="index.php?'.'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'tab=main&'.'disk_conf_delete=1&'.'id_agente='.$id_agente.'">';
|
||||
// Delete remote configuration.
|
||||
$table_adv_remote .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&disk_conf_delete=1&id_agente='.$id_agente.'">';
|
||||
$table_adv_remote .= html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
|
@ -510,26 +555,29 @@ if (enterprise_installed()) {
|
|||
|
||||
$table_adv_remote .= '</div>';
|
||||
|
||||
$cps_array[-1] = __('Disabled');
|
||||
if ($cps > 0) {
|
||||
$cps_array[$cps] = __('Enabled');
|
||||
} else {
|
||||
$cps_inc = 0;
|
||||
if ($id_agente) {
|
||||
$cps_inc = service_agents_cps($id_agente);
|
||||
}
|
||||
|
||||
$cps_array[$cps_inc] = __('Enabled');
|
||||
// Calculate cps value - agents.
|
||||
if ($id_agente) {
|
||||
$cps_val = service_agents_cps($id_agente);
|
||||
} else {
|
||||
// No agent defined, use received cps as base value.
|
||||
if ($cps >= 0) {
|
||||
$cps_val = $cps;
|
||||
}
|
||||
}
|
||||
|
||||
$table_adv_cascade = '<div class="label_select"><p class="input_label">'.__('Cascade protection services').': ';
|
||||
$table_adv_cascade .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true).'</p>';
|
||||
$table_adv_cascade .= html_print_select($cps_array, 'cps', $cps, '', '', 0, true).'</div>';
|
||||
$cps_html = '<div class="label_select"><div class="label_simple_items">';
|
||||
$cps_html .= html_print_checkbox_switch('cps', $cps_val, ($cps >= 0), true);
|
||||
$cps_html .= __('Cascade protection services').' ';
|
||||
$cps_html .= ui_print_help_tip(
|
||||
__('Alerts and events will be managed by the service joined by this agent.'),
|
||||
true
|
||||
);
|
||||
$cps_html .= '</div></div>';
|
||||
|
||||
$table_adv_cascade .= $cps_html;
|
||||
}
|
||||
|
||||
// Custom ID
|
||||
$table_adv_custom_id = '<div class="label_select"><p class="input_label">'.__('Custom ID').': </p>';
|
||||
$table_adv_custom_id .= html_print_input_text('custom_id', $custom_id, '', 16, 255, true).'</div>';
|
||||
|
||||
$table_adv_parent = '<div class="label_select"><p class="input_label">'.__('Parent').': </p>';
|
||||
$params = [];
|
||||
|
@ -546,13 +594,26 @@ $params['cascade_protection'] = true;
|
|||
$table_adv_parent .= '<div class="label_simple_items">';
|
||||
$table_adv_parent .= ui_print_agent_autocomplete_input($params);
|
||||
if (enterprise_installed()) {
|
||||
$table_adv_parent .= html_print_checkbox_switch('cascade_protection', 1, $cascade_protection, true).__('Cascade protection').' '.ui_print_help_icon('cascade_protection', true);
|
||||
$table_adv_parent .= html_print_checkbox_switch(
|
||||
'cascade_protection',
|
||||
1,
|
||||
$cascade_protection,
|
||||
true
|
||||
).__('Cascade protection').' ';
|
||||
}
|
||||
|
||||
$table_adv_parent .= __('Module').' '.html_print_select($modules_values, 'cascade_protection_module', $cascade_protection_module, '', '', 0, true).'</div></div>';
|
||||
$table_adv_parent .= __('Module').' '.html_print_select(
|
||||
$modules_values,
|
||||
'cascade_protection_module',
|
||||
$cascade_protection_module,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
).'</div></div>';
|
||||
|
||||
// Learn mode / Normal mode
|
||||
$table_adv_module_mode = '<div class="label_select"><p class="input_label">'.__('Module definition').': '.ui_print_help_icon('module_definition', true).'</p>';
|
||||
// Learn mode / Normal mode.
|
||||
$table_adv_module_mode = '<div class="label_select"><p class="input_label">'.__('Module definition').': </p>';
|
||||
$table_adv_module_mode .= '<div class="switch_radio_button">';
|
||||
$table_adv_module_mode .= html_print_radio_button_extended(
|
||||
'modo',
|
||||
|
@ -586,9 +647,14 @@ $table_adv_module_mode .= html_print_radio_button_extended(
|
|||
);
|
||||
$table_adv_module_mode .= '</div></div>';
|
||||
|
||||
// Status (Disabled / Enabled)
|
||||
// Status (Disabled / Enabled).
|
||||
$table_adv_status = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Disabled').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'</p>';
|
||||
$table_adv_status .= html_print_checkbox_switch('disabled', 1, $disabled, true).'</div>';
|
||||
$table_adv_status .= html_print_checkbox_switch(
|
||||
'disabled',
|
||||
1,
|
||||
$disabled,
|
||||
true
|
||||
).'</div>';
|
||||
|
||||
// Url address.
|
||||
if (enterprise_installed()) {
|
||||
|
@ -625,11 +691,11 @@ foreach ($listIcons as $index => $value) {
|
|||
}
|
||||
|
||||
$path = 'images/gis_map/icons/';
|
||||
// TODO set better method the path
|
||||
// TODO set better method the path.
|
||||
$table_adv_agent_icon = '<div class="label_select"><p class="input_label">'.__('Agent icon').': '.ui_print_help_tip(__('Agent icon for GIS Maps.'), true).'</p>';
|
||||
if ($icon_path == '') {
|
||||
$display_icons = 'none';
|
||||
// Hack to show no icon. Use any given image to fix not found image errors
|
||||
// Hack to show no icon. Use any given image to fix not found image errors.
|
||||
$path_without = 'images/spinner.png';
|
||||
$path_default = 'images/spinner.png';
|
||||
$path_ok = 'images/spinner.png';
|
||||
|
@ -686,6 +752,7 @@ if ($config['activate_gis']) {
|
|||
|
||||
|
||||
|
||||
// General display distribution.
|
||||
$table_adv_options = $table_adv_secondary_groups.'<div class="secondary_groups_select" style="margin-bottom:30px;">
|
||||
<div class="secondary_groups_list_left">
|
||||
'.$table_adv_secondary_groups_left.'
|
||||
|
@ -698,7 +765,14 @@ $table_adv_options = $table_adv_secondary_groups.'<div class="secondary_groups_s
|
|||
</div>
|
||||
</div>
|
||||
<div class="agent_options agent_options_adv">
|
||||
<div class="agent_options_column_left" >'.$table_adv_parent.$table_adv_custom_id.$table_adv_module_mode.$table_adv_cascade.$table_adv_gis.'</div>
|
||||
<div class="agent_options_column_left" >'.$table_adv_parent.$table_adv_module_mode.$table_adv_cascade;
|
||||
|
||||
if ($new_agent) {
|
||||
// If agent is new, show custom id as old style format.
|
||||
$table_adv_options .= $custom_id_div;
|
||||
}
|
||||
|
||||
$table_adv_options .= $table_adv_gis.'</div>
|
||||
<div class="agent_options_column_right" >'.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'</div>
|
||||
</div>';
|
||||
|
||||
|
@ -711,10 +785,17 @@ $table = new stdClass();
|
|||
$table->width = '100%';
|
||||
$table->class = 'custom_fields_table';
|
||||
|
||||
$table->head = [];
|
||||
$table->head = [
|
||||
0 => __('Click to display').ui_print_help_tip(
|
||||
__('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'),
|
||||
true
|
||||
),
|
||||
];
|
||||
$table->class = 'info_table';
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold;';
|
||||
$table->data = [];
|
||||
$table->rowstyle = [];
|
||||
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
||||
|
@ -722,15 +803,12 @@ if ($fields === false) {
|
|||
$fields = [];
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach ($fields as $field) {
|
||||
$id_custom_field = $field['id_field'];
|
||||
|
||||
$data[0] = '<div class="field_title" onclick="show_custom_field_row('.$id_custom_field.')">';
|
||||
$data[0] .= '<b>'.$field['name'].'</b>';
|
||||
$data[0] .= ui_print_help_tip(
|
||||
__('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'),
|
||||
true
|
||||
);
|
||||
$data[0] .= '</div>';
|
||||
$combo = [];
|
||||
$combo = $field['combo_values'];
|
||||
|
@ -753,6 +831,13 @@ foreach ($fields as $field) {
|
|||
$custom_value = '';
|
||||
}
|
||||
|
||||
$table->rowstyle[$i] = 'cursor: pointer;';
|
||||
if (!empty($custom_value)) {
|
||||
$table->rowstyle[($i + 1)] = 'display: table-row;';
|
||||
} else {
|
||||
$table->rowstyle[($i + 1)] = 'display: none;';
|
||||
}
|
||||
|
||||
if ($field['is_password_type']) {
|
||||
$data_field[1] = html_print_input_text_extended(
|
||||
'customvalue_'.$field['id_field'],
|
||||
|
@ -801,21 +886,28 @@ foreach ($fields as $field) {
|
|||
};
|
||||
|
||||
$table->rowid[] = 'name_field-'.$id_custom_field;
|
||||
array_push($table->data, $data);
|
||||
$table->data[] = $data;
|
||||
|
||||
$table->rowid[] = 'field-'.$id_custom_field;
|
||||
array_push($table->data, $data_field);
|
||||
$table->data[] = $data_field;
|
||||
$i += 2;
|
||||
}
|
||||
|
||||
if (!empty($fields)) {
|
||||
echo '<div class="ui_toggle">';
|
||||
ui_toggle(html_print_table($table, true), __('Custom fields'), '', true, false, 'white_box white_box_opened');
|
||||
ui_toggle(
|
||||
html_print_table($table, true),
|
||||
__('Custom fields'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
'white_box white_box_opened'
|
||||
);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '<div class="action-buttons" style="display: flex; justify-content: flex-end; align-items: center; width: '.$table->width.'">';
|
||||
|
||||
|
||||
// The context help about the learning mode.
|
||||
if ($modo == 0) {
|
||||
echo "<span id='modules_not_learning_mode_context_help' style='padding-right:8px;'>";
|
||||
|
|
|
@ -1,17 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Configure agents.
|
||||
*
|
||||
* @category Agents view - management.
|
||||
* @package Pandora FMS
|
||||
* @subpackage User interface.
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Load global vars.
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
enterprise_include('godmode/agentes/configurar_agente.php');
|
||||
|
@ -20,6 +35,7 @@ enterprise_include_once('include/functions_modules.php');
|
|||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_cron.php';
|
||||
ui_require_javascript_file('encode_decode_base64');
|
||||
ui_require_css_file('agent_manager');
|
||||
|
||||
check_login();
|
||||
|
||||
|
@ -194,7 +210,7 @@ if ($create_agent) {
|
|||
$update_gis_data = (int) get_parameter_post('update_gis_data', 0);
|
||||
$url_description = (string) get_parameter('url_description');
|
||||
$quiet = (int) get_parameter('quiet', 0);
|
||||
$cps = (int) get_parameter('cps', 0);
|
||||
$cps = (int) get_parameter_switch('cps', -1);
|
||||
|
||||
$secondary_groups = (string) get_parameter('secondary_hidden', '');
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
@ -325,7 +341,7 @@ if ($create_agent) {
|
|||
$unsafe_alias = io_safe_output($alias);
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Created agent $unsafe_alias",
|
||||
'Created agent '.$unsafe_alias,
|
||||
false,
|
||||
true,
|
||||
$info
|
||||
|
@ -489,7 +505,7 @@ if ($id_agente) {
|
|||
$agent_name = io_safe_output($agent_name);
|
||||
$agent_md5 = md5($agent_name, false);
|
||||
|
||||
$remote_configuration_tab['text'] = '<a href="index.php?'.'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'tab=remote_configuration&'.'id_agente='.$id_agente.'&'.'disk_conf='.$agent_md5.'">'.html_print_image(
|
||||
$remote_configuration_tab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$id_agente.'&disk_conf='.$agent_md5.'">'.html_print_image(
|
||||
'images/remote_configuration.png',
|
||||
true,
|
||||
['title' => __('Remote configuration')]
|
||||
|
@ -575,20 +591,24 @@ if ($id_agente) {
|
|||
}
|
||||
|
||||
$help_header = '';
|
||||
$tab_name = '';
|
||||
// This add information to the header.
|
||||
switch ($tab) {
|
||||
case 'main':
|
||||
$tab_description = '- '.__('Setup');
|
||||
$help_header = 'main_tab';
|
||||
$tab_name = 'Setup';
|
||||
break;
|
||||
|
||||
case 'collection':
|
||||
$tab_description = '- '.__('Collection');
|
||||
$tab_name = 'Collection';
|
||||
break;
|
||||
|
||||
case 'inventory':
|
||||
$tab_description = '- '.__('Inventory');
|
||||
$help_header = 'inventory_tab';
|
||||
$tab_name = 'Inventory';
|
||||
break;
|
||||
|
||||
case 'plugins':
|
||||
|
@ -599,6 +619,7 @@ if ($id_agente) {
|
|||
case 'module':
|
||||
$type_module_t = get_parameter('moduletype', '');
|
||||
$tab_description = '- '.__('Modules');
|
||||
$tab_name = 'Modules';
|
||||
if ($type_module_t == 'webux') {
|
||||
$help_header = 'wux_console';
|
||||
} else {
|
||||
|
@ -609,10 +630,12 @@ if ($id_agente) {
|
|||
case 'alert':
|
||||
$tab_description = '- '.__('Alert');
|
||||
$help_header = 'manage_alert_list';
|
||||
$tab_name = 'Alerts';
|
||||
break;
|
||||
|
||||
case 'template':
|
||||
$tab_description = '- '.__('Templates');
|
||||
$tab_name = 'Module templates';
|
||||
break;
|
||||
|
||||
case 'gis':
|
||||
|
@ -633,16 +656,19 @@ if ($id_agente) {
|
|||
case 'snmp_explorer':
|
||||
$tab_description = '- '.__('SNMP Wizard');
|
||||
$help_header = 'agent_snmp_explorer_tab';
|
||||
$tab_name = 'SNMP Wizard';
|
||||
break;
|
||||
|
||||
case 'snmp_interfaces_explorer':
|
||||
$tab_description = '- '.__('SNMP Interfaces wizard');
|
||||
$help_header = 'agent_snmp_interfaces_explorer_tab';
|
||||
$tab_name = 'SNMP Interfaces wizard';
|
||||
break;
|
||||
|
||||
case 'wmi_explorer':
|
||||
$tab_description = '- '.__('WMI Wizard');
|
||||
$help_header = 'agent_snmp_wmi_explorer_tab';
|
||||
$tab_name = 'WMI Wizard';
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -679,7 +705,15 @@ if ($id_agente) {
|
|||
$onheader,
|
||||
false,
|
||||
'',
|
||||
$config['item_title_size_text']
|
||||
$config['item_title_size_text'],
|
||||
'',
|
||||
ui_print_breadcrums(
|
||||
[
|
||||
__('Resources'),
|
||||
__('Manage agents'),
|
||||
'<span class="breadcrumb_active">'.$tab_name.'</span>',
|
||||
]
|
||||
)
|
||||
);
|
||||
} else {
|
||||
// Create agent.
|
||||
|
@ -688,7 +722,19 @@ if ($id_agente) {
|
|||
'images/bricks.png',
|
||||
false,
|
||||
'create_agent',
|
||||
true
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
GENERIC_SIZE_TEXT,
|
||||
'',
|
||||
ui_print_breadcrums(
|
||||
[
|
||||
__('Resources'),
|
||||
__('Manage agents'),
|
||||
'<span class="breadcrumb_active">'.__('Create agent').'</span>',
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -829,8 +875,7 @@ if ($update_agent) {
|
|||
$update_gis_data = (int) get_parameter_post('update_gis_data', 0);
|
||||
$url_description = (string) get_parameter('url_description');
|
||||
$quiet = (int) get_parameter('quiet', 0);
|
||||
$cps = (int) get_parameter('cps', 0);
|
||||
|
||||
$cps = get_parameter_switch('cps', -1);
|
||||
$old_values = db_get_row('tagente', 'id_agente', $id_agente);
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
||||
|
@ -978,7 +1023,7 @@ if ($update_agent) {
|
|||
[
|
||||
$id_agente,
|
||||
'standby',
|
||||
$disabled ? '1' : '0',
|
||||
($disabled) ? '1' : '0',
|
||||
]
|
||||
);
|
||||
// Validate alerts for disabled agents.
|
||||
|
@ -1064,7 +1109,7 @@ if ($update_agent) {
|
|||
ui_print_success_message(__('Successfully updated'));
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Updated agent $alias",
|
||||
'Updated agent '.$alias,
|
||||
false,
|
||||
false,
|
||||
$info
|
||||
|
@ -1206,7 +1251,7 @@ if ($update_module || $create_module) {
|
|||
}
|
||||
|
||||
if ($id_module_type == 25) {
|
||||
// web analysis, from MODULE_WUX.
|
||||
// Web analysis, from MODULE_WUX.
|
||||
$custom_string_1 = base64_encode((string) get_parameter('custom_string_1', $custom_string_1_default));
|
||||
$custom_integer_1 = (int) get_parameter('custom_integer_1', $custom_integer_1_default);
|
||||
} else {
|
||||
|
@ -1220,6 +1265,7 @@ if ($update_module || $create_module) {
|
|||
|
||||
// Get macros.
|
||||
$macros = (string) get_parameter('macros');
|
||||
$macros_names = (array) get_parameter('macro_name', []);
|
||||
|
||||
if (!empty($macros)) {
|
||||
$macros = json_decode(base64_decode($macros), true);
|
||||
|
@ -1230,10 +1276,18 @@ if ($update_module || $create_module) {
|
|||
$m_hide = $m['hide'];
|
||||
}
|
||||
|
||||
if ($m_hide == '1') {
|
||||
$macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
|
||||
if ($update_module) {
|
||||
if ($m_hide == '1') {
|
||||
$macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
|
||||
} else {
|
||||
$macros[$k]['value'] = get_parameter($m['macro'], '');
|
||||
}
|
||||
} else {
|
||||
$macros[$k]['value'] = get_parameter($m['macro'], '');
|
||||
if ($m_hide == '1') {
|
||||
$macros[$k]['value'] = io_input_password($macros_names[$k]);
|
||||
} else {
|
||||
$macros[$k]['value'] = $macros_names[$k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1243,12 +1297,11 @@ if ($update_module || $create_module) {
|
|||
|
||||
foreach ($conf_array as $line) {
|
||||
if (preg_match('/^module_name\s*(.*)/', $line, $match)) {
|
||||
$new_configuration_data .= 'module_name '.io_safe_output($name)."\n";
|
||||
}
|
||||
|
||||
// We delete from conf all the module macros starting with _field.
|
||||
else if (!preg_match('/^module_macro_field.*/', $line, $match)) {
|
||||
$new_configuration_data .= "$line\n";
|
||||
$new_configuration_data .= 'module_name ';
|
||||
$new_configuration_data .= io_safe_output($name)."\n";
|
||||
} else if (!preg_match('/^module_macro_field.*/', $line, $match)) {
|
||||
// We delete from conf all the module macros starting with _field.
|
||||
$new_configuration_data .= $line."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1410,9 +1463,13 @@ if ($update_module || $create_module) {
|
|||
}
|
||||
|
||||
$active_snmp_v3 = get_parameter('active_snmp_v3');
|
||||
if ($active_snmp_v3) {
|
||||
// LOST CODE?
|
||||
}
|
||||
|
||||
/*
|
||||
* if ($active_snmp_v3) {
|
||||
* // LOST CODE?.
|
||||
*
|
||||
* }
|
||||
*/
|
||||
|
||||
$throw_unknown_events = (bool) get_parameter('throw_unknown_events', false);
|
||||
// Set the event type that can show.
|
||||
|
@ -1428,32 +1485,11 @@ if ($update_module || $create_module) {
|
|||
|
||||
$module_in_policy = enterprise_hook('policies_is_module_in_policy', [$id_agent_module]);
|
||||
$module_linked = enterprise_hook('policies_is_module_linked', [$id_agent_module]);
|
||||
|
||||
if ((!$module_in_policy && !$module_linked && $update_module)
|
||||
|| ( $module_in_policy && !$module_linked && $update_module)
|
||||
) {
|
||||
enterprise_hook(
|
||||
'config_agents_update_module_in_conf',
|
||||
[
|
||||
$id_agente,
|
||||
io_safe_output($old_configuration_data),
|
||||
io_safe_output($configuration_data),
|
||||
$disabled,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
enterprise_hook(
|
||||
'config_agents_write_module_in_conf',
|
||||
[
|
||||
$id_agente,
|
||||
io_safe_output($old_configuration_data),
|
||||
io_safe_output($configuration_data),
|
||||
$disabled,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize result of the action (insert or update).
|
||||
$success_action = NOERR;
|
||||
|
||||
// MODULE UPDATE.
|
||||
if ($update_module) {
|
||||
$id_agent_module = (int) get_parameter('id_agent_module');
|
||||
|
@ -1589,6 +1625,8 @@ if ($update_module) {
|
|||
break;
|
||||
}
|
||||
|
||||
// I save the result of the action (insert or update).
|
||||
$success_action = $result;
|
||||
$result = false;
|
||||
ui_print_error_message($msg);
|
||||
|
||||
|
@ -1596,7 +1634,7 @@ if ($update_module) {
|
|||
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Fail to try update module '$name' for agent ".$agent['alias']
|
||||
"Fail to try update module '".$name."' for agent ".$agent['alias']
|
||||
);
|
||||
} else {
|
||||
if ($prediction_module == 3) {
|
||||
|
@ -1620,7 +1658,7 @@ if ($update_module) {
|
|||
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Updated module '$name' for agent ".$agent['alias'],
|
||||
"Updated module '".$name."' for agent ".$agent['alias'],
|
||||
false,
|
||||
false,
|
||||
io_json_mb_encode($values)
|
||||
|
@ -1630,6 +1668,9 @@ if ($update_module) {
|
|||
|
||||
// MODULE INSERT.
|
||||
if ($create_module) {
|
||||
// Old configuration data must always be empty in case of creation.
|
||||
$old_configuration_data = '';
|
||||
|
||||
if (isset($_POST['combo_snmp_oid'])) {
|
||||
$combo_snmp_oid = get_parameter_post('combo_snmp_oid');
|
||||
}
|
||||
|
@ -1639,12 +1680,6 @@ if ($create_module) {
|
|||
}
|
||||
|
||||
$id_module = (int) get_parameter('id_module');
|
||||
// Commented because can't create prediction modules
|
||||
/*
|
||||
if ($id_module == 5) {
|
||||
$prediction_module = 1;
|
||||
}
|
||||
*/
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'oracle':
|
||||
|
@ -1768,17 +1803,26 @@ if ($create_module) {
|
|||
break;
|
||||
}
|
||||
|
||||
// I save the result of the action (insert or update).
|
||||
$success_action = $id_agent_module;
|
||||
|
||||
$id_agent_module = false;
|
||||
ui_print_error_message($msg);
|
||||
$edit_module = true;
|
||||
$moduletype = $id_module;
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Fail to try added module '$name' for agent ".$agent['alias']
|
||||
"Fail to try added module '".$name."' for agent ".$agent['alias']
|
||||
);
|
||||
} else {
|
||||
if ($prediction_module == 3) {
|
||||
enterprise_hook('modules_create_synthetic_operations', [$id_agent_module, $serialize_ops]);
|
||||
enterprise_hook(
|
||||
'modules_create_synthetic_operations',
|
||||
[
|
||||
$id_agent_module,
|
||||
$serialize_ops,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// Update the module interval.
|
||||
|
@ -1793,7 +1837,7 @@ if ($create_module) {
|
|||
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Added module '$name' for agent ".$agent['alias'],
|
||||
"Added module '".$name."' for agent ".$agent['alias'],
|
||||
false,
|
||||
true,
|
||||
io_json_mb_encode($values)
|
||||
|
@ -1801,6 +1845,112 @@ if ($create_module) {
|
|||
}
|
||||
}
|
||||
|
||||
// MODULE ENABLE/DISABLE
|
||||
// =====================.
|
||||
if ($enable_module) {
|
||||
$result = modules_change_disabled($enable_module, 0);
|
||||
$module_name = modules_get_agentmodule_name($enable_module);
|
||||
|
||||
// Write for conf disable if remote_config.
|
||||
$configuration_data = enterprise_hook(
|
||||
'config_agents_get_module_from_conf',
|
||||
[
|
||||
$id_agente,
|
||||
io_safe_output($module_name),
|
||||
]
|
||||
);
|
||||
// Force disable.
|
||||
$disabled = 0;
|
||||
|
||||
// Force Update when disabled for save disabled in conf.
|
||||
$old_configuration_data = $configuration_data;
|
||||
|
||||
// Successfull action.
|
||||
$success_action = $result;
|
||||
|
||||
$success_action = $result;
|
||||
if ($result === NOERR) {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
'Enable #'.$enable_module.' | '.$module_name.' | '.$agent['alias']
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
'Fail to enable #'.$enable_module.' | '.$module_name.' | '.$agent['alias']
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully enabled'),
|
||||
__('Could not be enabled')
|
||||
);
|
||||
}
|
||||
|
||||
if ($disable_module) {
|
||||
$result = modules_change_disabled($disable_module, 1);
|
||||
$module_name = modules_get_agentmodule_name($disable_module);
|
||||
|
||||
// Write for conf disable if remote_config.
|
||||
$configuration_data = enterprise_hook(
|
||||
'config_agents_get_module_from_conf',
|
||||
[
|
||||
$id_agente,
|
||||
io_safe_output($module_name),
|
||||
]
|
||||
);
|
||||
// Force disable.
|
||||
$disabled = 1;
|
||||
|
||||
// Force Update when disabled for save disabled in conf.
|
||||
$old_configuration_data = $configuration_data;
|
||||
|
||||
// Successfull action.
|
||||
$success_action = $result;
|
||||
|
||||
|
||||
if ($result === NOERR) {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
'Disable #'.$disable_module.' | '.$module_name.' | '.$agent['alias']
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
'Fail to disable #'.$disable_module.' | '.$module_name.' | '.$agent['alias']
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully disabled'),
|
||||
__('Could not be disabled')
|
||||
);
|
||||
}
|
||||
|
||||
// Fix to stop the module from being added to the agent's conf
|
||||
// when an error occurred while updating or inserting. or enable disable module.
|
||||
if ($update_module || $create_module
|
||||
|| $enable_module || $disable_module
|
||||
) {
|
||||
if ((!$module_in_policy && !$module_linked)
|
||||
|| ($module_in_policy && !$module_linked)
|
||||
) {
|
||||
if ($success_action > 0) {
|
||||
enterprise_hook(
|
||||
'config_agents_write_module_in_conf',
|
||||
[
|
||||
$id_agente,
|
||||
io_safe_output($old_configuration_data),
|
||||
io_safe_output($configuration_data),
|
||||
$disabled,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE DELETION
|
||||
// =================.
|
||||
if ($delete_module) {
|
||||
|
@ -2000,46 +2150,6 @@ if (!empty($duplicate_module)) {
|
|||
}
|
||||
}
|
||||
|
||||
// MODULE ENABLE/DISABLE
|
||||
// =====================.
|
||||
if ($enable_module) {
|
||||
$result = modules_change_disabled($enable_module, 0);
|
||||
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$enable_module.'');
|
||||
$modulo_nombre = $modulo_nombre['nombre'];
|
||||
|
||||
if ($result === NOERR) {
|
||||
enterprise_hook('config_agents_enable_module_conf', [$id_agente, $enable_module]);
|
||||
db_pandora_audit('Module management', 'Enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
|
||||
} else {
|
||||
db_pandora_audit('Module management', 'Fail to enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully enabled'),
|
||||
__('Could not be enabled')
|
||||
);
|
||||
}
|
||||
|
||||
if ($disable_module) {
|
||||
$result = modules_change_disabled($disable_module, 1);
|
||||
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$disable_module.'');
|
||||
$modulo_nombre = $modulo_nombre['nombre'];
|
||||
|
||||
if ($result === NOERR) {
|
||||
enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]);
|
||||
db_pandora_audit('Module management', 'Disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
|
||||
} else {
|
||||
db_pandora_audit('Module management', 'Fail to disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully disabled'),
|
||||
__('Could not be disabled')
|
||||
);
|
||||
}
|
||||
|
||||
// UPDATE GIS
|
||||
// ==========.
|
||||
$updateGIS = get_parameter('update_gis', 0);
|
||||
|
|
|
@ -81,7 +81,6 @@ function add_component_selection($id_network_component_type)
|
|||
|
||||
$data = [];
|
||||
$data[0] = __('Using module component').' ';
|
||||
$data[0] .= ui_print_help_icon('network_component', true);
|
||||
|
||||
$component_groups = network_components_get_groups($id_network_component_type);
|
||||
$data[1] = '<span id="component_group" class="left">';
|
||||
|
@ -384,7 +383,7 @@ if ($disabledBecauseInPolicy) {
|
|||
$table_simple->data[2][3] .= html_print_input_hidden('id_module_group', $id_module_group, true);
|
||||
}
|
||||
|
||||
$table_simple->data[3][0] = __('Dynamic Threshold Interval').' '.ui_print_help_icon('dynamic_threshold', true);
|
||||
$table_simple->data[3][0] = __('Dynamic Threshold Interval');
|
||||
$table_simple->data[3][1] = html_print_extended_select_for_time('dynamic_interval', $dynamic_interval, '', 'None', '0', 10, true, 'width:150px', false, $classdisabledBecauseInPolicy, $disabledBecauseInPolicy);
|
||||
$table_simple->data[3][1] .= '<a onclick=advanced_option_dynamic()>'.html_print_image('images/cog.png', true, ['title' => __('Advanced options Dynamic Threshold')]).'</a>';
|
||||
if ($in_policy) {
|
||||
|
@ -424,7 +423,7 @@ $table_simple->data[3][2] .= html_print_input_text(
|
|||
$table_simple->data[3][3] = '<span><em>'.__('Dynamic Threshold Two Tailed: ').'</em>';
|
||||
$table_simple->data[3][3] .= html_print_checkbox('dynamic_two_tailed', 1, $dynamic_two_tailed, true, $disabledBecauseInPolicy);
|
||||
|
||||
$table_simple->data[4][0] = __('Warning status').' '.ui_print_help_icon('warning_status', true);
|
||||
$table_simple->data[4][0] = __('Warning status');
|
||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[4][1] .= '<span id="minmax_warning"><em>'.__('Min. ').'</em>';
|
||||
$table_simple->data[4][1] .= html_print_input_text(
|
||||
|
@ -477,7 +476,7 @@ if (!modules_is_string_type($id_module_type) || $edit) {
|
|||
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
|
||||
}
|
||||
|
||||
$table_simple->data[5][0] = __('Critical status').' '.ui_print_help_icon('critical_status', true);
|
||||
$table_simple->data[5][0] = __('Critical status');
|
||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[5][1] .= '<span id="minmax_critical"><em>'.__('Min. ').'</em>';
|
||||
$table_simple->data[5][1] .= html_print_input_text(
|
||||
|
@ -528,7 +527,6 @@ $table_simple->data[5][1] .= html_print_checkbox('critical_inverse', 1, $critica
|
|||
|
||||
// FF stands for Flip-flop.
|
||||
$table_simple->data[6][0] = __('FF threshold').' ';
|
||||
$table_simple->data[6][0] .= ui_print_help_icon('ff_threshold', true);
|
||||
|
||||
$table_simple->data[6][1] .= __('Keep counters');
|
||||
$table_simple->data[6][1] .= html_print_checkbox(
|
||||
|
@ -703,15 +701,15 @@ if ($moduletype == MODULE_DATA) {
|
|||
if (isset($id_agente)) {
|
||||
$agent_interval = agents_get_interval($id_agente);
|
||||
$interval_factor = ($interval / $agent_interval);
|
||||
$table_advanced->data[2][1] = human_time_description_raw($interval).' ('.sprintf(__('Agent interval x %s'), $interval_factor).') '.ui_print_help_icon('module_interval_factor', true);
|
||||
$table_advanced->data[2][1] = human_time_description_raw($interval).' ('.sprintf(__('Agent interval x %s'), $interval_factor).') ';
|
||||
} else {
|
||||
$table_advanced->data[2][1] = sprintf(__('Agent interval x %s'), $interval_factor).ui_print_help_icon('module_interval_factor', true);
|
||||
$table_advanced->data[2][1] = sprintf(__('Agent interval x %s'), $interval_factor);
|
||||
}
|
||||
|
||||
if ($__code_from == 'policies') {
|
||||
// If is the policy form, module_interval will store the factor (not the seconds).
|
||||
// So server will transform it to interval in seconds
|
||||
$table_advanced->data[2][1] = sprintf(__('Default').': 1', $interval_factor).ui_print_help_icon('module_interval_factor', true);
|
||||
$table_advanced->data[2][1] = sprintf(__('Default').': 1', $interval_factor);
|
||||
$table_advanced->data[2][1] .= html_print_input_hidden('module_interval', $interval_factor, true);
|
||||
} else if ($module_id_policy_module != 0) {
|
||||
$table_advanced->data[2][1] .= ui_print_help_tip(__('The policy modules of data type will only update their intervals when policy is applied.'), true);
|
||||
|
@ -720,14 +718,14 @@ if ($moduletype == MODULE_DATA) {
|
|||
// If it is a non policy form, the module_interval will not provided and will
|
||||
// be taken the agent interval (this code is at configurar_agente.php)
|
||||
} else {
|
||||
$table_advanced->data[2][0] = __('Interval').ui_print_help_icon('module_interval', true);
|
||||
$table_advanced->data[2][0] = __('Interval');
|
||||
$table_advanced->colspan[2][1] = 2;
|
||||
$table_advanced->data[2][1] = html_print_extended_select_for_time('module_interval', $interval, '', '', '0', false, true, false, false, $classdisabledBecauseInPolicy, $disabledBecauseInPolicy);
|
||||
}
|
||||
|
||||
$table_advanced->data[2][1] .= html_print_input_hidden('moduletype', $moduletype, true);
|
||||
|
||||
$table_advanced->data[2][3] = __('Post process').' '.ui_print_help_icon('postprocess', true);
|
||||
$table_advanced->data[2][3] = __('Post process');
|
||||
$table_advanced->data[2][4] = html_print_extended_select_for_post_process(
|
||||
'post_process',
|
||||
$post_process,
|
||||
|
@ -793,7 +791,7 @@ $table_advanced->data[4][4] = html_print_checkbox(
|
|||
);
|
||||
$table_advanced->colspan[4][4] = 3;
|
||||
|
||||
$table_advanced->data[5][0] = __('FF interval').' '.ui_print_help_icon('ff_interval', true);
|
||||
$table_advanced->data[5][0] = __('FF interval');
|
||||
$table_advanced->data[5][1] = html_print_input_text(
|
||||
'module_ff_interval',
|
||||
$ff_interval,
|
||||
|
@ -808,7 +806,7 @@ $table_advanced->data[5][1] = html_print_input_text(
|
|||
).ui_print_help_tip(__('Module execution flip flop time interval (in secs).'), true);
|
||||
$table_advanced->colspan[5][1] = 2;
|
||||
|
||||
$table_advanced->data[5][3] = __('FF timeout').' '.ui_print_help_icon('ff_timeout', true);
|
||||
$table_advanced->data[5][3] = __('FF timeout');
|
||||
|
||||
$module_type_name = modules_get_type_name($id_module_type);
|
||||
$table_advanced->data[5][4] = '';
|
||||
|
@ -1010,7 +1008,7 @@ $table_advanced->colspan[10][1] = 6;
|
|||
if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
||||
$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']]);
|
||||
if ($has_remote_conf) {
|
||||
$table_advanced->data[11][0] = __('Cron from').ui_print_help_icon('cron', true);
|
||||
$table_advanced->data[11][0] = __('Cron from');
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
|
||||
|
@ -1018,7 +1016,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
|||
$table_advanced->data[12][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
|
||||
$table_advanced->colspan[12][1] = 6;
|
||||
} else {
|
||||
$table_advanced->data[11][0] = __('Cron from').ui_print_help_icon('cron', true);
|
||||
$table_advanced->data[11][0] = __('Cron from');
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
|
||||
|
@ -1027,7 +1025,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_icon('cron', true);
|
||||
$table_advanced->data[11][0] = __('Cron from');
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ $snmp_versions['2c'] = 'v. 2c';
|
|||
$snmp_versions['3'] = 'v. 3';
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('SNMP community').ui_print_help_icon('column_macros', true);
|
||||
$data[0] = __('SNMP community');
|
||||
$adopt = false;
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && isset($id_agent_module)) {
|
||||
$adopt = policies_is_module_adopt($id_agent_module);
|
||||
|
@ -233,7 +233,7 @@ push_table_simple($data, 'snmp_2');
|
|||
|
||||
// Advanced stuff
|
||||
$data = [];
|
||||
$data[0] = __('TCP send').' '.ui_print_help_icon('tcp_send', true);
|
||||
$data[0] = __('TCP send');
|
||||
$data[1] = html_print_textarea('tcp_send', 2, 65, $tcp_send, $disabledTextBecauseInPolicy, true, $largeclassdisabledBecauseInPolicy);
|
||||
$table_simple->colspan['tcp_send'][1] = 3;
|
||||
|
||||
|
@ -277,7 +277,7 @@ if (!isset($id_agent_module)) {
|
|||
}
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Auth user').ui_print_help_icon('column_macros', true);
|
||||
$data[0] = __('Auth user');
|
||||
$data[1] = html_print_input_text(
|
||||
'snmp3_auth_user',
|
||||
$snmp3_auth_user,
|
||||
|
@ -290,7 +290,7 @@ $data[1] = html_print_input_text(
|
|||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
$data[2] = __('Auth password').ui_print_help_icon('column_macros', true).ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||
$data[2] = __('Auth password').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||
$data[3] = html_print_input_password(
|
||||
'snmp3_auth_pass',
|
||||
$snmp3_auth_pass,
|
||||
|
@ -312,7 +312,7 @@ push_table_simple($data, 'field_snmpv3_row1');
|
|||
$data = [];
|
||||
$data[0] = __('Privacy method');
|
||||
$data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true, false, false, '', $disabledBecauseInPolicy);
|
||||
$data[2] = __('Privacy pass').ui_print_help_icon('column_macros', true).ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||
$data[2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||
$data[3] = html_print_input_password(
|
||||
'snmp3_privacy_pass',
|
||||
$snmp3_privacy_pass,
|
||||
|
|
|
@ -79,7 +79,7 @@ push_table_simple($data, 'plugin_1');
|
|||
$data = [];
|
||||
$data[0] = 'macro_desc';
|
||||
$data[0] .= ui_print_help_tip('macro_help', true);
|
||||
$data[1] = html_print_input_text('macro_name', 'macro_value', '', 100, 1024, true);
|
||||
$data[1] = html_print_input_text('macro_name[]', 'macro_value', '', 100, 1024, true);
|
||||
$table_simple->colspan['macro_field'][1] = 3;
|
||||
$table_simple->rowstyle['macro_field'] = 'display:none';
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ $data[3] = html_print_input_text(
|
|||
push_table_simple($data, 'target_ip');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Username').ui_print_help_icon('column_macros', true);
|
||||
$data[0] = __('Username');
|
||||
$data[1] = html_print_input_text(
|
||||
'plugin_user',
|
||||
$plugin_user,
|
||||
|
@ -73,7 +73,7 @@ $data[1] = html_print_input_text(
|
|||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
$data[2] = __('Password').ui_print_help_icon('column_macros', true);
|
||||
$data[2] = __('Password');
|
||||
$data[3] = html_print_input_password(
|
||||
'plugin_pass',
|
||||
$plugin_pass,
|
||||
|
@ -91,7 +91,6 @@ push_table_simple($data, 'user_pass');
|
|||
|
||||
$data = [];
|
||||
$data[0] = __('WMI query');
|
||||
$data[0] .= ui_print_help_icon('wmiquery', true);
|
||||
$data[1] = html_print_input_text(
|
||||
'snmp_oid',
|
||||
$snmp_oid,
|
||||
|
|
|
@ -84,9 +84,7 @@ if (is_ajax()) {
|
|||
// If the field is the number one, print the help message.
|
||||
if ($i == 1) {
|
||||
// If our context is snmpconsole, show snmp_alert helps.
|
||||
if ((isset($_SERVER['HTTP_REFERER'])) && ( preg_match('/snmp_alert/', $_SERVER['HTTP_REFERER']) > 0 )) {
|
||||
$fdesc .= ui_print_help_icon('snmp_alert_field1', true);
|
||||
} else {
|
||||
if ((!isset($_SERVER['HTTP_REFERER'])) && ( preg_match('/snmp_alert/', $_SERVER['HTTP_REFERER']) > 0 )) {
|
||||
$fdesc .= ui_print_help_icon('alert_config', true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -386,7 +386,7 @@ if (count($actions) == 1 && isset($actions[0])) {
|
|||
$table->data[$kaction][($k + 1)] = human_time_description_raw($action_threshold, true, 'tiny');
|
||||
}
|
||||
|
||||
$table->head[($k + 1)] = __('Threshold').'<span style="float: right;">'.ui_print_help_icon('action_threshold', true, '', 'images/header_help.png').'</span>';
|
||||
$table->head[($k + 1)] = __('Threshold');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -516,14 +516,22 @@ if ($tab == 'tree') {
|
|||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
$table->headstyle = [];
|
||||
$table->head = [];
|
||||
$table->head[0] = __('ID');
|
||||
$table->headstyle[0] = 'min-width: 100px;';
|
||||
$table->head[1] = __('Name');
|
||||
$table->headstyle[1] = 'min-width: 100px;';
|
||||
$table->head[2] = __('Icon');
|
||||
$table->headstyle[2] = 'min-width: 100px;';
|
||||
$table->head[3] = __('Alerts');
|
||||
$table->headstyle[3] = 'min-width: 100px;';
|
||||
$table->head[4] = __('Parent');
|
||||
$table->headstyle[4] = 'min-width: 100px;';
|
||||
$table->head[5] = __('Description');
|
||||
$table->headstyle[5] = 'min-width: 100px;';
|
||||
$table->head[6] = __('Actions');
|
||||
$table->headstyle[6] = 'min-width: 100px;';
|
||||
$table->align = [];
|
||||
$table->align[0] = 'left';
|
||||
$table->align[2] = 'left';
|
||||
|
|
|
@ -215,7 +215,6 @@ $table->data[3][1] .= __('Number of alerts match from').' ';
|
|||
$table->data[3][1] .= html_print_input_text('fires_min', 0, '', 4, 10, true);
|
||||
$table->data[3][1] .= ' '.__('to').' ';
|
||||
$table->data[3][1] .= html_print_input_text('fires_max', 0, '', 4, 10, true);
|
||||
$table->data[3][1] .= ui_print_help_icon('alert-matches', true);
|
||||
$table->data[3][1] .= '</span>';
|
||||
|
||||
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_action_alerts">';
|
||||
|
|
|
@ -125,7 +125,7 @@ echo '<form '.'action="index.php?'.'sec=gmassive&'.'sec2=godmode/massive/massive
|
|||
|
||||
echo '<fieldset id="fieldset_source">';
|
||||
echo '<legend>';
|
||||
echo '<span>'.__('Source').ui_print_help_icon('manageconfig', true).'</span>';
|
||||
echo '<span>'.__('Source');
|
||||
echo '</legend>';
|
||||
html_print_table($table);
|
||||
echo '</fieldset>';
|
||||
|
|
|
@ -695,7 +695,7 @@ $table->data['edit1'][1] = '<table width="100%">';
|
|||
true
|
||||
);
|
||||
|
||||
$table->data['edit3'][0] = __('Post process').ui_print_help_icon('postprocess', true);
|
||||
$table->data['edit3'][0] = __('Post process');
|
||||
|
||||
$table->data['edit3'][1] = html_print_extended_select_for_post_process(
|
||||
'post_process',
|
||||
|
@ -846,10 +846,6 @@ $table->data['edit1'][1] = '<table width="100%">';
|
|||
|
||||
// FF stands for Flip-flop.
|
||||
$table->data['edit7'][0] = __('FF threshold').' ';
|
||||
$table->data['edit7'][0] .= ui_print_help_icon(
|
||||
'ff_threshold',
|
||||
true
|
||||
);
|
||||
|
||||
$table->colspan['edit7'][1] = 3;
|
||||
$table->data['edit7'][1] = __('Mode').' ';
|
||||
|
@ -1060,26 +1056,26 @@ $table->data['edit1'][1] = '<table width="100%">';
|
|||
true
|
||||
);
|
||||
|
||||
$table->data['edit22'][0] = __('Web checks').ui_print_help_icon('web_checks', true);
|
||||
$table->data['edit22'][0] = __('Web checks');
|
||||
;
|
||||
$table->data['edit22'][1] = '<textarea id="textarea_plugin_parameter" name="plugin_parameter_text" cols="65" rows="15"></textarea>';
|
||||
|
||||
$table->data['edit16'][2] = __('Port');
|
||||
$table->data['edit16'][3] = html_print_input_text('tcp_port', '', '', 5, 20, true);
|
||||
|
||||
$table->data['edit17'][0] = __('TCP send').' '.ui_print_help_icon('tcp_send', true);
|
||||
$table->data['edit17'][0] = __('TCP send');
|
||||
$table->data['edit17'][1] = html_print_textarea('tcp_send2', 2, 65, '', '', true);
|
||||
|
||||
$table->data['edit17'][2] = __('TCP receive');
|
||||
$table->data['edit17'][3] = html_print_textarea('tcp_rcv', 2, 65, '', '', true);
|
||||
|
||||
$table->data['edit18'][0] = __('WMI query').ui_print_help_icon('wmiquery', true);
|
||||
$table->data['edit18'][0] = __('WMI query');
|
||||
$table->data['edit18'][1] = html_print_input_text('wmi_query', '', '', 35, 255, true);
|
||||
|
||||
$table->data['edit18'][2] = __('Key string');
|
||||
$table->data['edit18'][3] = html_print_input_text('key_string', '', '', 20, 60, true);
|
||||
|
||||
$table->data['edit19'][0] = __('Field number').ui_print_help_icon('wmifield', true);
|
||||
$table->data['edit19'][0] = __('Field number');
|
||||
$table->data['edit19'][1] = html_print_input_text('field_number', '', '', 5, 15, true);
|
||||
|
||||
$table->data['edit20'][0] = __('Plugin').ui_print_help_icon('plugin_macros', true);
|
||||
|
|
|
@ -72,6 +72,7 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
|
|||
|
||||
$options_policies = [];
|
||||
$policies_options = enterprise_hook('massive_policies_options');
|
||||
$policies_options = array_unique($policies_options);
|
||||
|
||||
if ($policies_options != ENTERPRISE_NOT_HOOK) {
|
||||
$options_policies = array_merge($options_policies, $policies_options);
|
||||
|
|
|
@ -154,7 +154,7 @@ $table->data[2][1] = html_print_select(
|
|||
$table->data[2][2] = __('Interval');
|
||||
$table->data[2][3] = html_print_extended_select_for_time('module_interval', $module_interval, '', '', '0', false, true);
|
||||
|
||||
$table->data[3][0] = __('Dynamic Interval').' '.ui_print_help_icon('dynamic_threshold', true);
|
||||
$table->data[3][0] = __('Dynamic Interval');
|
||||
$table->data[3][1] = html_print_extended_select_for_time('dynamic_interval', $dynamic_interval, '', 'None', '0', 10, true, 'width:150px', false);
|
||||
$table->data[3][1] .= '<a onclick=advanced_option_dynamic()>'.html_print_image('images/cog.png', true, ['title' => __('Advanced options Dynamic Threshold')]).'</a>';
|
||||
|
||||
|
@ -165,7 +165,7 @@ $table->data[3][2] .= html_print_input_text('dynamic_max', $dynamic_max, '', 10,
|
|||
$table->data[3][3] = '<span><em>'.__('Dynamic Two Tailed: ').'</em>';
|
||||
$table->data[3][3] .= html_print_checkbox('dynamic_two_tailed', 1, $dynamic_two_tailed, true);
|
||||
|
||||
$table->data[4][0] = __('Warning status').' '.ui_print_help_icon('warning_status', true);
|
||||
$table->data[4][0] = __('Warning status');
|
||||
$table->data[4][1] = '<span id="minmax_warning"><em>'.__('Min.').' </em> ';
|
||||
$table->data[4][1] .= html_print_input_text(
|
||||
'min_warning',
|
||||
|
@ -200,7 +200,7 @@ $table->data[4][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
|
|||
$table->colspan[4][2] = 2;
|
||||
$table->rowspan[4][2] = 3;
|
||||
|
||||
$table->data[5][0] = __('Critical status').' '.ui_print_help_icon('critical_status', true);
|
||||
$table->data[5][0] = __('Critical status');
|
||||
$table->data[5][1] = '<span id="minmax_critical"><em>'.__('Min.').' </em> ';
|
||||
$table->data[5][1] .= html_print_input_text(
|
||||
'min_critical',
|
||||
|
@ -231,7 +231,7 @@ $table->data[5][1] .= html_print_input_text(
|
|||
$table->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table->data[5][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true);
|
||||
|
||||
$table->data[6][0] = __('FF threshold').' '.ui_print_help_icon('ff_threshold', true);
|
||||
$table->data[6][0] = __('FF threshold');
|
||||
$table->colspan[6][1] = 3;
|
||||
|
||||
$table->data[6][1] = __('Keep counters');
|
||||
|
|
|
@ -57,16 +57,16 @@ $data = [];
|
|||
$data[0] = __('SNMP Enterprise String');
|
||||
$data[1] = html_print_input_text('snmp_oid', $snmp_oid, '', 30, 400, true);
|
||||
// $table->colspan['snmp_2'][1] = 3;
|
||||
$data[2] = __('SNMP community').ui_print_help_icon('column_macros', true);
|
||||
$data[2] = __('SNMP community');
|
||||
$data[3] = html_print_input_text('snmp_community', $snmp_community, '', 15, 60, true);
|
||||
|
||||
push_table_row($data, 'snmp_2');
|
||||
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Auth user').ui_print_help_icon('column_macros', true);
|
||||
$data[0] = __('Auth user');
|
||||
$data[1] = html_print_input_text('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$data[2] = __('Auth password').ui_print_help_icon('column_macros', true);
|
||||
$data[2] = __('Auth password');
|
||||
$data[3] = html_print_input_password('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$data[3] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_mncfn', true);
|
||||
push_table_row($data, 'field_snmpv3_row1');
|
||||
|
@ -74,7 +74,7 @@ push_table_row($data, 'field_snmpv3_row1');
|
|||
$data = [];
|
||||
$data[0] = __('Privacy method');
|
||||
$data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
|
||||
$data[2] = __('Privacy pass').ui_print_help_icon('column_macros', true);
|
||||
$data[2] = __('Privacy pass');
|
||||
$data[3] = html_print_input_password('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true);
|
||||
push_table_row($data, 'field_snmpv3_row2');
|
||||
|
||||
|
@ -98,7 +98,7 @@ $data[3] = html_print_select(
|
|||
push_table_row($data, 'field_snmpv3_row3');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Post process').' '.ui_print_help_icon('postprocess', true);
|
||||
$data[0] = __('Post process');
|
||||
$data[1] = html_print_extended_select_for_post_process(
|
||||
'post_process',
|
||||
$post_process,
|
||||
|
@ -117,7 +117,7 @@ push_table_row($data, 'field_process');
|
|||
|
||||
// Advanced stuff
|
||||
$data = [];
|
||||
$data[0] = __('TCP send').' '.ui_print_help_icon('tcp_send', true);
|
||||
$data[0] = __('TCP send');
|
||||
$data[1] = html_print_textarea('tcp_send', 2, 65, $tcp_send, '', true);
|
||||
$table->colspan['tcp_send'][1] = 3;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ $data[1] = html_print_select_from_sql(
|
|||
);
|
||||
// Store the macros in base64 into a hidden control to move between pages
|
||||
$data[1] .= html_print_input_hidden('macros', base64_encode($macros), true);
|
||||
$data[2] = __('Post process').' '.ui_print_help_icon('postprocess', true, ui_get_full_url(false, false, false, false));
|
||||
$data[2] = __('Post process');
|
||||
$data[3] = html_print_extended_select_for_post_process(
|
||||
'post_process',
|
||||
$post_process,
|
||||
|
|
|
@ -30,29 +30,29 @@ require_once $config['homedir'].'/include/functions_modules.php';
|
|||
$data = [];
|
||||
$data[0] = __('WMI query').' '.ui_print_help_icon('wmi_query_tab', true);
|
||||
$data[1] = html_print_input_text('snmp_oid', $snmp_oid, '', 25, 255, true);
|
||||
$data[2] = __('Key string').' '.ui_print_help_icon('wmikey', true, ui_get_full_url(false, false, false, false));
|
||||
$data[2] = __('Key string');
|
||||
$data[3] = html_print_input_text('snmp_community', $snmp_community, '', 25, 255, true);
|
||||
|
||||
push_table_row($data, 'wmi_1');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Field number').' '.ui_print_help_icon('wmifield', true, ui_get_full_url(false, false, false, false));
|
||||
$data[0] = __('Field number');
|
||||
$data[1] = html_print_input_text('tcp_port', $tcp_port, '', 5, 25, true);
|
||||
$data[2] = __('Namespace').' '.ui_print_help_icon('wminamespace', true, ui_get_full_url(false, false, false, false));
|
||||
$data[2] = __('Namespace');
|
||||
$data[3] = html_print_input_text('tcp_send', $tcp_send, '', 25, 255, true);
|
||||
|
||||
push_table_row($data, 'wmi_2');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Username').ui_print_help_icon('column_macros', true);
|
||||
$data[0] = __('Username');
|
||||
$data[1] = html_print_input_text('plugin_user', $plugin_user, '', 15, 255, true);
|
||||
$data[2] = __('Password').ui_print_help_icon('column_macros', true);
|
||||
$data[2] = __('Password');
|
||||
$data[3] = html_print_input_password('plugin_pass', $plugin_pass, '', 25, 255, true);
|
||||
|
||||
push_table_row($data, 'wmi_3');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Post process').' '.ui_print_help_icon('postprocess', true, ui_get_full_url(false, false, false, false));
|
||||
$data[0] = __('Post process');
|
||||
$data[1] = html_print_extended_select_for_post_process(
|
||||
'post_process',
|
||||
$post_process,
|
||||
|
|
|
@ -877,7 +877,7 @@ $class = 'databox filters';
|
|||
<tr id="row_label" style="" class="datos">
|
||||
<td style="font-weight:bold;">
|
||||
<?php
|
||||
echo __('Label').ui_print_help_icon('reports_label_field', true);
|
||||
echo __('Label');
|
||||
?>
|
||||
</td>
|
||||
<td style="">
|
||||
|
@ -981,11 +981,6 @@ $class = 'databox filters';
|
|||
<td style="font-weight:bold;">
|
||||
<?php
|
||||
echo __('Period');
|
||||
if ($type == 'projection_graph') {
|
||||
echo ui_print_help_icon('projection_graph', true);
|
||||
} else {
|
||||
echo ui_print_help_icon('prediction_date', true);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td style="">
|
||||
|
@ -1004,10 +999,7 @@ $class = 'databox filters';
|
|||
<tr id="row_estimate" style="" class="datos">
|
||||
<td style="font-weight:bold;">
|
||||
<?php
|
||||
echo __('Projection period').ui_print_help_icon(
|
||||
'projection_graph',
|
||||
true
|
||||
);
|
||||
echo __('Projection period');
|
||||
?>
|
||||
</td>
|
||||
<td style="">
|
||||
|
@ -1026,10 +1018,7 @@ $class = 'databox filters';
|
|||
<tr id="row_interval" style="" class="datos">
|
||||
<td style="font-weight:bold;">
|
||||
<?php
|
||||
echo __('Data range').ui_print_help_icon(
|
||||
'prediction_date',
|
||||
true
|
||||
);
|
||||
echo __('Data range');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
|
@ -4865,7 +4854,6 @@ function chooseType() {
|
|||
switch (type) {
|
||||
case 'event_report_agent':
|
||||
case 'simple_graph':
|
||||
case 'agent_configuration':
|
||||
case 'event_report_module':
|
||||
case 'alert_report_agent':
|
||||
case 'alert_report_module':
|
||||
|
@ -4876,8 +4864,6 @@ function chooseType() {
|
|||
case 'min_value':
|
||||
case 'max_value':
|
||||
case 'avg_value':
|
||||
case 'projection_graph':
|
||||
case 'prediction_date':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
|
|
|
@ -745,7 +745,12 @@ function message_check_delete_items() {
|
|||
}
|
||||
|
||||
function added_ids_deleted_items_to_hidden_input() {
|
||||
message_check_delete_items();
|
||||
var success = message_check_delete_items();
|
||||
|
||||
if(success === false){
|
||||
$(".check_delete").prop("checked", false);
|
||||
return false;
|
||||
}
|
||||
|
||||
var ids = '';
|
||||
var first = true;
|
||||
|
|
|
@ -760,6 +760,9 @@ switch ($action) {
|
|||
|
||||
$table->head = [];
|
||||
$table->align = [];
|
||||
$table->headstyle = [];
|
||||
$table->style = [];
|
||||
|
||||
$table->align[2] = 'left';
|
||||
$table->align[3] = 'left';
|
||||
$table->align[4] = 'left';
|
||||
|
@ -771,11 +774,21 @@ switch ($action) {
|
|||
$table->size[0] = '20%';
|
||||
$table->size[1] = '30%';
|
||||
$table->size[2] = '2%';
|
||||
$table->headstyle[2] = 'min-width: 35px;';
|
||||
$table->size[3] = '2%';
|
||||
$table->headstyle[3] = 'min-width: 35px;';
|
||||
$table->size[4] = '2%';
|
||||
$table->headstyle[4] = 'min-width: 35px;';
|
||||
$table->size[5] = '2%';
|
||||
$table->headstyle[5] = 'min-width: 35px;';
|
||||
$table->size[6] = '2%';
|
||||
$table->size['csv'] = '5%';
|
||||
$table->headstyle[6] = 'min-width: 35px;';
|
||||
$table->size[7] = '5%';
|
||||
$table->headstyle['csv'] = 'min-width: 65px;';
|
||||
$table->style[7] = 'text-align: center;';
|
||||
|
||||
$table->headstyle[9] = 'min-width: 100px;';
|
||||
$table->style[9] = 'text-align: center;';
|
||||
|
||||
$next = 4;
|
||||
// Calculate dinamically the number of the column.
|
||||
|
@ -814,7 +827,6 @@ switch ($action) {
|
|||
// $table->size = array ();
|
||||
$table->size[$next] = '10%';
|
||||
$table->align[$next] = 'left';
|
||||
$table->headstyle[$next] = 'text-align:left;';
|
||||
}
|
||||
|
||||
$columnview = false;
|
||||
|
@ -996,7 +1008,6 @@ switch ($action) {
|
|||
$table->head[$next] = '<span title="Operations">'.__('Op.').'</span>'.html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->size = [];
|
||||
// $table->size[$next] = '80px';
|
||||
$table->style[$next] = 'text-align:left;';
|
||||
}
|
||||
|
||||
if ($edit) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* globals $ */
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
|
@ -31,6 +33,8 @@ var SIZE_GRID = 16; //Const the size (for width and height) of grid.
|
|||
var img_handler_start;
|
||||
var img_handler_end;
|
||||
|
||||
var default_cache_expiration = null;
|
||||
|
||||
function toggle_advance_options_palette(close) {
|
||||
if ($("#advance_options").css("display") == "none") {
|
||||
$("#advance_options").css("display", "");
|
||||
|
@ -1183,6 +1187,10 @@ function readFields() {
|
|||
values["timezone"] = $("select[name=timezone]").val();
|
||||
values["clock_animation"] = $("select[name=clock_animation]").val();
|
||||
values["show_last_value"] = $("select[name=last_value]").val();
|
||||
values["cache_expiration"] =
|
||||
typeof $("#hidden-cache_expiration").val() !== "undefined"
|
||||
? $("#hidden-cache_expiration").val()
|
||||
: $("#cache_expiration").val();
|
||||
|
||||
// Color Cloud values
|
||||
if (selectedItem == "color_cloud" || creationItem == "color_cloud") {
|
||||
|
@ -1226,7 +1234,6 @@ function readFields() {
|
|||
|
||||
function create_button_palette_callback() {
|
||||
var values = readFields();
|
||||
|
||||
//VALIDATE DATA
|
||||
var validate = true;
|
||||
switch (creationItem) {
|
||||
|
@ -2219,6 +2226,26 @@ function loadFieldsFromDB(item) {
|
|||
});
|
||||
}
|
||||
|
||||
if (key == "cache_expiration") {
|
||||
var intoCacheExpSelect = false;
|
||||
var cacheExpId = $("#hidden-cache_expiration").attr("class");
|
||||
$("#" + cacheExpId + "_select option").each(function() {
|
||||
if ($(this).val() == val) {
|
||||
$(this).prop("selected", true);
|
||||
$(this).trigger("change");
|
||||
intoCacheExpSelect = true;
|
||||
}
|
||||
});
|
||||
if (intoCacheExpSelect == false) {
|
||||
$("#" + cacheExpId + "_select").val(0);
|
||||
$("#" + cacheExpId + "_units").val(1);
|
||||
$("#hidden-cache_expiration").val(val);
|
||||
$("#text-" + cacheExpId + "_text").val(val);
|
||||
$("#" + cacheExpId + "_default").hide();
|
||||
$("#" + cacheExpId + "_manual").show();
|
||||
}
|
||||
}
|
||||
|
||||
if (key == "value_show") {
|
||||
$("select[name=value_show]").val(val);
|
||||
}
|
||||
|
@ -2595,6 +2622,9 @@ function hiddenFields(item) {
|
|||
$("#line_case").css("display", "none");
|
||||
$("#line_case." + item).css("display", "");
|
||||
|
||||
$("#cache_expiration_row").css("display", "none");
|
||||
$("#cache_expiration_row." + item).css("display", "");
|
||||
|
||||
// Color cloud rows
|
||||
$("#color_cloud_diameter_row").hide();
|
||||
$("#color_cloud_diameter_row." + item).show();
|
||||
|
@ -2668,6 +2698,44 @@ function cleanFields(item) {
|
|||
$("table.color-range-creation input[type=color]").val("#FFFFFF");
|
||||
$("table.color-range:not(table.color-range-creation)").remove();
|
||||
|
||||
// Clean the cache expiration selection.
|
||||
if (default_cache_expiration === null) {
|
||||
var cacheExpVal = $("#hidden-cache_expiration").val();
|
||||
if (!Number.isNaN(Number.parseInt(cacheExpVal))) {
|
||||
cacheExpVal = Number.parseInt(cacheExpVal);
|
||||
} else {
|
||||
cacheExpVal = 0;
|
||||
}
|
||||
|
||||
default_cache_expiration = cacheExpVal;
|
||||
}
|
||||
var cacheExpId = $("#hidden-cache_expiration").attr("class");
|
||||
$("#hidden-cache_expiration").val(default_cache_expiration);
|
||||
|
||||
var intoCacheExpSelect = false;
|
||||
$("#" + cacheExpId + "_select option").each(function() {
|
||||
if ($(this).val() == default_cache_expiration) {
|
||||
$(this).prop("selected", true);
|
||||
$(this).trigger("change");
|
||||
intoCacheExpSelect = true;
|
||||
}
|
||||
});
|
||||
if (!intoCacheExpSelect) {
|
||||
// Show input.
|
||||
$("#" + cacheExpId + "_select").val(0);
|
||||
$("#" + cacheExpId + "_units").val(1);
|
||||
$("#text-" + cacheExpId + "_text").val(default_cache_expiration);
|
||||
$("#" + cacheExpId + "_default").hide();
|
||||
$("#" + cacheExpId + "_manual").show();
|
||||
} else {
|
||||
// Show select.
|
||||
$("#" + cacheExpId + "_select").val(default_cache_expiration);
|
||||
$("#" + cacheExpId + "_units").val(0);
|
||||
$("#text-" + cacheExpId + "_text").val("");
|
||||
$("#" + cacheExpId + "_default").show();
|
||||
$("#" + cacheExpId + "_manual").hide();
|
||||
}
|
||||
|
||||
$("#preview").empty();
|
||||
|
||||
if (item == "simple_value") {
|
||||
|
|
|
@ -231,7 +231,12 @@ if ($tiny) {
|
|||
}
|
||||
|
||||
if ($tiny) {
|
||||
ui_toggle(html_print_table($table, true), __('Tactical server information'), false, $hidden_toggle);
|
||||
ui_toggle(
|
||||
html_print_table($table, true),
|
||||
__('Tactical server information'),
|
||||
false,
|
||||
$hidden_toggle
|
||||
);
|
||||
} else {
|
||||
html_print_table($table);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,32 @@
|
|||
<?php
|
||||
// Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Load global vars
|
||||
/**
|
||||
* License form.
|
||||
*
|
||||
* @category Form
|
||||
* @package Pandora FMS
|
||||
* @subpackage Enterprise
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// File begin.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
@ -22,22 +39,38 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
|
|||
|
||||
$update_settings = (bool) get_parameter_post('update_settings');
|
||||
|
||||
ui_print_page_header(__('License management'), 'images/extensions.png', false, '', true);
|
||||
if (is_metaconsole()) {
|
||||
// Metaconsole.
|
||||
ui_require_javascript_file_enterprise('load_enterprise', true);
|
||||
enterprise_include_once('include/functions_license.php');
|
||||
} else {
|
||||
ui_print_page_header(
|
||||
__('License management'),
|
||||
'images/extensions.png',
|
||||
false,
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
if ($update_settings) {
|
||||
foreach ($_POST['keys'] as $key => $value) {
|
||||
db_process_sql_update(
|
||||
'tupdate_settings',
|
||||
[db_escape_key_identifier('value') => $value],
|
||||
[db_escape_key_identifier('key') => $key]
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_success_message(__('License updated'));
|
||||
ui_require_javascript_file_enterprise('load_enterprise');
|
||||
enterprise_include_once('include/functions_license.php');
|
||||
}
|
||||
|
||||
if ($update_settings) {
|
||||
if (!is_metaconsole()) {
|
||||
// Node.
|
||||
foreach ($_POST['keys'] as $key => $value) {
|
||||
db_process_sql_update(
|
||||
'tupdate_settings',
|
||||
[db_escape_key_identifier('value') => $value],
|
||||
[db_escape_key_identifier('key') => $key]
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_success_message(__('License updated'));
|
||||
}
|
||||
}
|
||||
|
||||
ui_require_javascript_file_enterprise('load_enterprise');
|
||||
enterprise_include_once('include/functions_license.php');
|
||||
$license = enterprise_hook('license_get_info');
|
||||
|
||||
$rows = db_get_all_rows_in_table('tupdate_settings');
|
||||
|
@ -55,11 +88,20 @@ if (enterprise_installed()) {
|
|||
echo '</script>';
|
||||
|
||||
echo '<form method="post">';
|
||||
// Retrieve UM url configured (or default).
|
||||
$url = get_um_url();
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$table->head[0] = __('Licence');
|
||||
$table->head_colspan[0] = 3;
|
||||
$table->headstyle[0] = 'text-align: center';
|
||||
$table->style[0] = 'font-weight: bold;';
|
||||
}
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$table->data[0][0] = '<strong>'.__('Customer key').'</strong>';
|
||||
|
@ -98,13 +140,17 @@ if (enterprise_installed()) {
|
|||
html_print_input_hidden('update_settings', 1);
|
||||
html_print_submit_button(__('Validate'), 'update_button', false, 'class="sub upd"');
|
||||
echo ' ';
|
||||
html_print_button(__('Request new license'), '', false, 'generate_request_code()', 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub next"');
|
||||
html_print_button(__('Request new license'), '', false, 'generate_request_code()', 'class="sub next"');
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
echo '<link rel="stylesheet" href="'.ui_get_full_url(false, false, false, false).'include/styles/pandora.css" type="text/css">';
|
||||
echo '<link rel="stylesheet" href="'.ui_get_full_url(false, false, false, false).'enterprise/include/styles/pandora_enterprise.css" type="text/css">';
|
||||
if (is_metaconsole()) {
|
||||
ui_require_css_file('pandora_enterprise', '../../'.ENTERPRISE_DIR.'/include/styles/');
|
||||
ui_require_css_file('register', '../../include/styles/');
|
||||
} else {
|
||||
ui_require_css_file('pandora');
|
||||
ui_require_css_file('pandora_enterprise', ENTERPRISE_DIR.'/include/styles/');
|
||||
ui_require_css_file('register');
|
||||
}
|
||||
|
||||
if (enterprise_hook('print_activate_licence_dialog') == ENTERPRISE_NOT_HOOK) {
|
||||
|
@ -116,7 +162,7 @@ if (enterprise_hook('print_activate_licence_dialog') == ENTERPRISE_NOT_HOOK) {
|
|||
echo ''.__('To get your <b>%s Enterprise License</b>:', get_product_name()).'<br />';
|
||||
echo '<ul>';
|
||||
echo '<li>';
|
||||
echo ''.sprintf(__('Go to %s'), '<a target="_blank" href="https://licensing.artica.es/pandoraupdate7/index.php?section=generate_key_client">https://licensing.artica.es/pandoraupdate7/index.php?section=generate_key_client</a>');
|
||||
echo ''.sprintf(__('Go to %s'), '<a target="_blank" href="'.$url.'/index.php?section=generate_key_client">'.$url.'index.php?section=generate_key_client</a>');
|
||||
echo '</li>';
|
||||
echo '<li>';
|
||||
echo ''.__('Enter the <b>auth key</b> and the following <b>request key</b>:');
|
||||
|
|
|
@ -247,8 +247,7 @@ $table->style[0] = 'font-weight: bold';
|
|||
$table->size[0] = '70%';
|
||||
$table->size[1] = '30%';
|
||||
|
||||
enterprise_hook('enterprise_warnings_history_days');
|
||||
|
||||
// enterprise_hook('enterprise_warnings_history_days');
|
||||
$table->data[1][0] = __('Max. days before delete events');
|
||||
$table->data[1][0] .= ui_print_help_tip(
|
||||
__('If the compaction or purge of the data is more frequent than the events deletion, anomalies in module graphs could appear'),
|
||||
|
|
|
@ -66,6 +66,12 @@ $table_remote->class = 'databox filters';
|
|||
$table_remote->size['name'] = '30%';
|
||||
$table_remote->style['name'] = 'font-weight: bold';
|
||||
|
||||
// Enable eHorus user configuration.
|
||||
$row = [];
|
||||
$row['name'] = ('eHorus configuration at user level');
|
||||
$row['control'] = html_print_checkbox_switch('ehorus_user_level_conf', 1, $config['ehorus_user_level_conf'], true);
|
||||
$table_remote->data['ehorus_user_level_conf'] = $row;
|
||||
|
||||
// User.
|
||||
$row = [];
|
||||
$row['name'] = __('User');
|
||||
|
@ -163,9 +169,19 @@ echo '</div>';
|
|||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
if(!$('input:checkbox[name="ehorus_enabled"]').is(':checked')){
|
||||
$('#form_remote').hide();
|
||||
|
||||
if(!$('input:checkbox[name="ehorus_enabled"]').is(':checked'))
|
||||
{
|
||||
$('#form_remote').hide();
|
||||
}
|
||||
|
||||
if($('input:checkbox[name="ehorus_user_level_conf"]').is(':checked'))
|
||||
{
|
||||
$('#ehorus-remote-setup-ehorus_user').hide();
|
||||
$('#ehorus-remote-setup-ehorus_pass').hide()
|
||||
}
|
||||
|
||||
|
||||
$('#form_enable').css('margin-bottom','20px');
|
||||
var showFields = function () {
|
||||
$('#form_remote').show();
|
||||
|
@ -173,6 +189,17 @@ if(!$('input:checkbox[name="ehorus_enabled"]').is(':checked')){
|
|||
var hideFields = function () {
|
||||
$('#form_remote').hide();
|
||||
}
|
||||
|
||||
var hideUserPass = function () {
|
||||
$('#ehorus-remote-setup-ehorus_user').hide();
|
||||
$('#ehorus-remote-setup-ehorus_pass').hide();
|
||||
}
|
||||
|
||||
var showUserPass = function () {
|
||||
$('#ehorus-remote-setup-ehorus_user').show();
|
||||
$('#ehorus-remote-setup-ehorus_pass').show();
|
||||
}
|
||||
|
||||
var handleEnable = function (event) {
|
||||
var is_checked = $('input:checkbox[name="ehorus_enabled"]').is(':checked');
|
||||
if (event.target.value == '1' && is_checked) {
|
||||
|
@ -184,15 +211,32 @@ if(!$('input:checkbox[name="ehorus_enabled"]').is(':checked')){
|
|||
$('input:checkbox[name="ehorus_enabled"]').attr('checked', false);
|
||||
};
|
||||
}
|
||||
|
||||
var handleUserLevel = function(event) {
|
||||
var is_checked = $('input:checkbox[name="ehorus_enabled"]').is(':checked');
|
||||
var is_checked_userlevel = $('input:checkbox[name="ehorus_user_level_conf"]').is(':checked');
|
||||
|
||||
if (event.target.value == '1' && is_checked && !is_checked_userlevel) {
|
||||
showUserPass();
|
||||
$('input:checkbox[name="ehorus_user_level_conf"]').attr('checked', true);
|
||||
}
|
||||
else {
|
||||
hideUserPass();
|
||||
$('input:checkbox[name="ehorus_user_level_conf"]').attr('checked', false);
|
||||
};
|
||||
}
|
||||
|
||||
$('input:checkbox[name="ehorus_enabled"]').change(handleEnable);
|
||||
|
||||
$('input:checkbox[name="ehorus_user_level_conf"]').change(handleUserLevel);
|
||||
|
||||
var handleTest = function (event) {
|
||||
var user = $('input#text-ehorus_user').val();
|
||||
var pass = $('input#password-ehorus_pass').val();
|
||||
var host = $('input#text-ehorus_hostname').val();
|
||||
var port = $('input#text-ehorus_port').val();
|
||||
var timeout = Number.parseInt($('input#text-ehorus_req_timeout').val(), 10);
|
||||
|
||||
var is_checked_user_level = $('input:checkbox[name="ehorus_user_level_conf"]').is(':checked');
|
||||
|
||||
var timeoutMessage = '<?php echo __('Connection timeout'); ?>';
|
||||
var badRequestMessage = '<?php echo __('Empty user or password'); ?>';
|
||||
var notFoundMessage = '<?php echo __('User not found'); ?>';
|
||||
|
@ -230,7 +274,7 @@ if(!$('input:checkbox[name="ehorus_enabled"]').is(':checked')){
|
|||
hideFailureImage();
|
||||
hideMessage();
|
||||
showLoadingImage();
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: 'https://' + host + ':' + port + '/login',
|
||||
type: 'POST',
|
||||
|
@ -245,9 +289,11 @@ if(!$('input:checkbox[name="ehorus_enabled"]').is(':checked')){
|
|||
showSuccessImage();
|
||||
})
|
||||
.fail(function(xhr, textStatus, errorThrown) {
|
||||
showFailureImage();
|
||||
|
||||
if (xhr.status === 400) {
|
||||
if((xhr.status === 400 || xhr.status === 403) && is_checked_user_level)
|
||||
{
|
||||
showSuccessImage();
|
||||
return;
|
||||
}else if (xhr.status === 400) {
|
||||
changeTestMessage(badRequestMessage);
|
||||
}
|
||||
else if (xhr.status === 401 || xhr.status === 403) {
|
||||
|
@ -262,6 +308,8 @@ if(!$('input:checkbox[name="ehorus_enabled"]').is(':checked')){
|
|||
else {
|
||||
changeTestMessage(errorThrown);
|
||||
}
|
||||
|
||||
showFailureImage();
|
||||
showMessage();
|
||||
})
|
||||
.always(function(xhr, textStatus) {
|
||||
|
@ -269,4 +317,7 @@ if(!$('input:checkbox[name="ehorus_enabled"]').is(':checked')){
|
|||
});
|
||||
}
|
||||
$('input#button-test-ehorus').click(handleTest);
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
|
|
@ -918,6 +918,32 @@ $row++;
|
|||
);
|
||||
$row++;
|
||||
|
||||
$intervals = [
|
||||
10 => '10 '.__('seconds'),
|
||||
30 => '30 '.__('seconds'),
|
||||
60 => '1 '.__('minutes'),
|
||||
300 => '5 '.__('minutes'),
|
||||
900 => '15 '.__('minutes'),
|
||||
1800 => '30 '.__('minutes'),
|
||||
3600 => '1 '.__('hour'),
|
||||
];
|
||||
$table_vc->data[$row][0] = __('Default cache expiration');
|
||||
$table_vc->data[$row][1] = html_print_extended_select_for_time(
|
||||
'vc_default_cache_expiration',
|
||||
$config['vc_default_cache_expiration'],
|
||||
'',
|
||||
__('No cache'),
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
$intervals
|
||||
);
|
||||
$row++;
|
||||
|
||||
$table_vc->data[$row][0] = __('Default interval for refresh on Visual Console').ui_print_help_tip(__('This interval will affect to Visual Console pages'), true);
|
||||
$table_vc->data[$row][1] = html_print_select($values, 'vc_refr', (int) $config['vc_refr'], '', 'N/A', 0, true, false, false);
|
||||
$row++;
|
||||
|
@ -1394,6 +1420,15 @@ tinyMCE.init({
|
|||
});
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
// Show the cache expiration conf or not.
|
||||
$("input[name=legacy_vc]").change(function (e) {
|
||||
if ($(this).prop("checked") === true) {
|
||||
$("select#vc_default_cache_expiration_select").closest("tr").hide();
|
||||
} else {
|
||||
$("select#vc_default_cache_expiration_select").closest("tr").show();
|
||||
}
|
||||
}).change();
|
||||
|
||||
var comfort = 0;
|
||||
|
||||
|
|
|
@ -1,18 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* Update manager client options.
|
||||
*
|
||||
* @category Update Manager
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
require_once __DIR__.'/../../include/functions_users.php';
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
||||
|
@ -27,12 +45,38 @@ $action_update_url_update_manager = (bool) get_parameter(
|
|||
0
|
||||
);
|
||||
|
||||
if (users_is_admin()) {
|
||||
$update_manager_disconnect = get_parameter(
|
||||
'um_disconnect_console',
|
||||
0
|
||||
);
|
||||
|
||||
if ($update_manager_disconnect) {
|
||||
config_update_value(
|
||||
'pandora_uid',
|
||||
'OFFLINE'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$action_update_url_update_manager) {
|
||||
$url_update_manager = get_parameter('url_update_manager', $config['url_update_manager']);
|
||||
$update_manager_proxy_server = get_parameter('update_manager_proxy_server', $config['update_manager_proxy_server']);
|
||||
$update_manager_proxy_port = get_parameter('update_manager_proxy_port', $config['update_manager_proxy_port']);
|
||||
$update_manager_proxy_user = get_parameter('update_manager_proxy_user', $config['update_manager_proxy_user']);
|
||||
$update_manager_proxy_password = get_parameter('update_manager_proxy_password', $config['update_manager_proxy_password']);
|
||||
$update_manager_proxy_server = get_parameter(
|
||||
'update_manager_proxy_server',
|
||||
$config['update_manager_proxy_server']
|
||||
);
|
||||
$update_manager_proxy_port = get_parameter(
|
||||
'update_manager_proxy_port',
|
||||
$config['update_manager_proxy_port']
|
||||
);
|
||||
$update_manager_proxy_user = get_parameter(
|
||||
'update_manager_proxy_user',
|
||||
$config['update_manager_proxy_user']
|
||||
);
|
||||
$update_manager_proxy_password = get_parameter(
|
||||
'update_manager_proxy_password',
|
||||
$config['update_manager_proxy_password']
|
||||
);
|
||||
|
||||
|
||||
if ($action_update_url_update_manager) {
|
||||
|
@ -69,7 +113,10 @@ if (!$action_update_url_update_manager) {
|
|||
}
|
||||
|
||||
if ($result && license_free()) {
|
||||
$result = config_update_value('identification_reminder', $identification_reminder);
|
||||
$result = config_update_value(
|
||||
'identification_reminder',
|
||||
$identification_reminder
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
|
@ -189,11 +236,26 @@ $table->data[4][1] = html_print_input_password(
|
|||
true
|
||||
);
|
||||
|
||||
|
||||
$table->data[5][0] = __('Registration ID:');
|
||||
$table->data[5][1] = '<i>'.$config['pandora_uid'].'</i>';
|
||||
|
||||
if (update_manager_verify_registration() === true && users_is_admin()) {
|
||||
$table->data[6][0] = __('Cancel registration:');
|
||||
$table->data[6][1] = '<a href="';
|
||||
$table->data[6][1] .= ui_get_full_url(
|
||||
'index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=setup&um_disconnect_console=1'
|
||||
);
|
||||
$table->data[6][1] .= '" onclick="if(confirm(\'Are you sure?\')) {return true;} else { return false; }">'.__('Unregister').'</a>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (license_free()) {
|
||||
$config['identification_reminder'] = isset($config['identification_reminder']) ? $config['identification_reminder'] : 1;
|
||||
$table->data[6][0] = __('Pandora FMS community reminder').ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this Pandora instance'), true);
|
||||
$table->data[6][1] = __('Yes').' '.html_print_radio_button('identification_reminder', 1, '', $config['identification_reminder'], true).' ';
|
||||
$table->data[6][1] .= __('No').' '.html_print_radio_button('identification_reminder', 0, '', $config['identification_reminder'], true);
|
||||
$table->data[7][0] = __('Pandora FMS community reminder').ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this Pandora instance'), true);
|
||||
$table->data[7][1] = __('Yes').' '.html_print_radio_button('identification_reminder', 1, '', $config['identification_reminder'], true).' ';
|
||||
$table->data[7][1] .= __('No').' '.html_print_radio_button('identification_reminder', 0, '', $config['identification_reminder'], true);
|
||||
}
|
||||
|
||||
html_print_input_hidden('action_update_url_update_manager', 1);
|
||||
|
|
|
@ -151,6 +151,12 @@ if ($new_user && $config['admin_can_add_user']) {
|
|||
$user_info['metaconsole_assigned_server'] = '';
|
||||
$user_info['metaconsole_access_node'] = 0;
|
||||
}
|
||||
|
||||
if ($config['ehorus_user_level_conf']) {
|
||||
$user_info['ehorus_user_level_user'] = '';
|
||||
$user_info['ehorus_user_level_pass'] = '';
|
||||
$user_info['ehorus_user_level_enabled'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($create_user) {
|
||||
|
@ -215,6 +221,19 @@ if ($create_user) {
|
|||
$values['strict_acl'] = (bool) get_parameter('strict_acl', false);
|
||||
$values['session_time'] = (int) get_parameter('session_time', 0);
|
||||
|
||||
// eHorus user level conf
|
||||
if ($config['ehorus_user_level_conf']) {
|
||||
$values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false);
|
||||
if ($values['ehorus_user_level_enabled'] === true) {
|
||||
$values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user');
|
||||
$values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass');
|
||||
} else {
|
||||
$values['ehorus_user_level_user'] = null;
|
||||
$values['ehorus_user_level_pass'] = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($id == '') {
|
||||
ui_print_error_message(__('User ID cannot be empty'));
|
||||
$user_info = $values;
|
||||
|
@ -298,6 +317,13 @@ if ($update_user) {
|
|||
$values['timezone'] = (string) get_parameter('timezone');
|
||||
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
|
||||
$values['default_custom_view'] = (int) get_parameter('default_custom_view');
|
||||
// eHorus user level conf
|
||||
$values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false);
|
||||
$values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user');
|
||||
$values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass');
|
||||
|
||||
|
||||
|
||||
$dashboard = get_parameter('dashboard', '');
|
||||
$visual_console = get_parameter('visual_console', '');
|
||||
|
||||
|
@ -760,6 +786,7 @@ if (enterprise_installed() && !is_metaconsole()) {
|
|||
$values['Dashboard'] = __('Dashboard');
|
||||
}
|
||||
|
||||
|
||||
$table->data[12][1] = html_print_select($values, 'section', io_safe_output($user_info['section']), 'show_data_section();', '', -1, true, false, false);
|
||||
|
||||
if (enterprise_installed()) {
|
||||
|
@ -842,6 +869,16 @@ foreach ($event_filter_data as $filter) {
|
|||
$table->data[16][0] = __('Default event filter');
|
||||
$table->data[16][1] = html_print_select($event_filter, 'default_event_filter', $user_info['default_event_filter'], '', '', __('None'), true, false, false);
|
||||
|
||||
if ($config['ehorus_user_level_conf']) {
|
||||
$table->data[17][0] = __('eHorus user acces enabled');
|
||||
$table->data[17][1] = html_print_checkbox('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true);
|
||||
$table->data[18][0] = __('eHorus user');
|
||||
$table->data[19][0] = __('eHorus password');
|
||||
$table->data[18][1] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 15, 45, true);
|
||||
$table->data[19][1] = html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 15, 45, true);
|
||||
}
|
||||
|
||||
|
||||
if ($meta) {
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
|
||||
|
@ -933,6 +970,11 @@ $(document).ready (function () {
|
|||
$('#checkbox-metaconsole_agents_manager').trigger('change');
|
||||
|
||||
show_data_section();
|
||||
$('#checkbox-ehorus_user_level_enabled').change(function () {
|
||||
switch_ehorus_conf();
|
||||
});
|
||||
$('#checkbox-ehorus_user_level_enabled').trigger('change');
|
||||
|
||||
});
|
||||
|
||||
function show_data_section () {
|
||||
|
@ -987,5 +1029,21 @@ function show_data_section () {
|
|||
}
|
||||
}
|
||||
|
||||
function switch_ehorus_conf()
|
||||
{
|
||||
if(!$('#checkbox-ehorus_user_level_enabled').prop('checked'))
|
||||
{
|
||||
$("#user_configuration_table-18").hide();
|
||||
$("#user_configuration_table-19").hide();
|
||||
|
||||
}else
|
||||
{
|
||||
$("#user_configuration_table-18").show();
|
||||
$("#user_configuration_table-19").show()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -361,50 +361,61 @@ class DiscoveryTaskList extends Wizard
|
|||
$recon_tasks = [];
|
||||
}
|
||||
|
||||
$url_ajax = $config['homeurl'].'ajax.php';
|
||||
$url_ajax = $config['homeurl'].'ajax.php';
|
||||
|
||||
$table = new StdClass();
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
$table->head = [];
|
||||
$table->data = [];
|
||||
$table->align = [];
|
||||
$table->headstyle = [];
|
||||
$table = new StdClass();
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
$table->head = [];
|
||||
$table->data = [];
|
||||
$table->align = [];
|
||||
$table->headstyle = [];
|
||||
for ($i = 0; $i < 9; $i++) {
|
||||
$table->headstyle[$i] = 'text-align: left;';
|
||||
}
|
||||
|
||||
$table->head[0] = __('Force');
|
||||
$table->align[0] = 'left';
|
||||
// Status.
|
||||
$table->headstyle[5] .= 'min-width: 100px; width: 100px;';
|
||||
// Task type.
|
||||
$table->headstyle[6] .= 'min-width: 200px; width: 150px;';
|
||||
// Progress.
|
||||
$table->headstyle[7] .= 'min-width: 150px; width: 150px;';
|
||||
// Updated at.
|
||||
$table->headstyle[8] .= 'min-width: 150px; width: 150px;';
|
||||
// Operations.
|
||||
$table->headstyle[9] .= 'min-width: 150px; width: 150px;';
|
||||
|
||||
$table->head[1] = __('Task name');
|
||||
$table->align[1] = 'left';
|
||||
$table->head[0] = __('Force');
|
||||
$table->align[0] = 'left';
|
||||
|
||||
$table->head[2] = __('Server name');
|
||||
$table->align[2] = 'left';
|
||||
$table->head[1] = __('Task name');
|
||||
$table->align[1] = 'left';
|
||||
|
||||
$table->head[3] = __('Interval');
|
||||
$table->align[3] = 'left';
|
||||
$table->head[2] = __('Server name');
|
||||
$table->align[2] = 'left';
|
||||
|
||||
$table->head[4] = __('Network');
|
||||
$table->align[4] = 'left';
|
||||
$table->head[3] = __('Interval');
|
||||
$table->align[3] = 'left';
|
||||
|
||||
$table->head[5] = __('Status');
|
||||
$table->align[5] = 'left';
|
||||
$table->head[4] = __('Network');
|
||||
$table->align[4] = 'left';
|
||||
|
||||
$table->head[6] = __('Task type');
|
||||
$table->align[6] = 'left';
|
||||
$table->head[5] = __('Status');
|
||||
$table->align[5] = 'left';
|
||||
|
||||
$table->head[7] = __('Progress');
|
||||
$table->align[7] = 'left';
|
||||
$table->head[6] = __('Task type');
|
||||
$table->align[6] = 'left';
|
||||
|
||||
$table->head[8] = __('Updated at');
|
||||
$table->align[8] = 'left';
|
||||
$table->head[7] = __('Progress');
|
||||
$table->align[7] = 'left';
|
||||
|
||||
$table->head[9] = __('Operations');
|
||||
$table->align[9] = 'left';
|
||||
$table->head[8] = __('Updated at');
|
||||
$table->align[8] = 'left';
|
||||
|
||||
$table->head[9] = __('Operations');
|
||||
$table->align[9] = 'left';
|
||||
|
||||
foreach ($recon_tasks as $task) {
|
||||
$data = [];
|
||||
|
@ -553,13 +564,7 @@ class DiscoveryTaskList extends Wizard
|
|||
if ($task['status'] <= 0 || $task['status'] > 100) {
|
||||
$data[7] = '-';
|
||||
} else {
|
||||
$data[7] = progress_bar(
|
||||
$task['status'],
|
||||
100,
|
||||
20,
|
||||
__('Progress').':'.$task['status'].'%',
|
||||
1
|
||||
);
|
||||
$data[7] = ui_progress($task['status'], '100%', 1.5);
|
||||
}
|
||||
|
||||
if ($task['utimestamp'] > 0) {
|
||||
|
|
|
@ -783,20 +783,24 @@ class Wizard
|
|||
/**
|
||||
* Print a form.
|
||||
*
|
||||
* @param array $data Definition of target form to be printed.
|
||||
* @param boolean $return Return as string or direct output.
|
||||
* @param array $data Definition of target form to be printed.
|
||||
* @param boolean $return Return as string or direct output.
|
||||
* @param boolean $print_white_box Print a white box.
|
||||
*
|
||||
* @return string HTML code.
|
||||
*/
|
||||
public function printForm(array $data, bool $return=false, bool $print_white_box=false)
|
||||
{
|
||||
public function printForm(
|
||||
array $data,
|
||||
bool $return=false,
|
||||
bool $print_white_box=false
|
||||
) {
|
||||
$form = $data['form'];
|
||||
$inputs = $data['inputs'];
|
||||
$js = $data['js'];
|
||||
$cb_function = $data['cb_function'];
|
||||
$cb_args = $data['cb_args'];
|
||||
|
||||
$output_head = '<form enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
|
||||
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
|
||||
$output_head .= '" '.$form['extra'].'>';
|
||||
|
||||
if ($return === false) {
|
||||
|
@ -868,7 +872,7 @@ class Wizard
|
|||
$cb_function = $data['cb_function'];
|
||||
$cb_args = $data['cb_args'];
|
||||
|
||||
$output_head = '<form enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
|
||||
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
|
||||
$output_head .= '" '.$form['extra'].'>';
|
||||
|
||||
if ($return === false) {
|
||||
|
@ -963,7 +967,7 @@ class Wizard
|
|||
$cb_function = $data['cb_function'];
|
||||
$cb_args = $data['cb_args'];
|
||||
|
||||
$output_head = '<form enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
|
||||
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
|
||||
$output_head .= '" '.$form['extra'].'>';
|
||||
|
||||
if ($return === false) {
|
||||
|
|
After Width: | Height: | Size: 311 B |
After Width: | Height: | Size: 251 B |
After Width: | Height: | Size: 250 B |
After Width: | Height: | Size: 251 B |
After Width: | Height: | Size: 251 B |
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 249 B |
After Width: | Height: | Size: 250 B |
After Width: | Height: | Size: 251 B |
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 220 B |
After Width: | Height: | Size: 220 B |
After Width: | Height: | Size: 251 B |
After Width: | Height: | Size: 249 B |
|
@ -456,30 +456,30 @@ if ($get_extended_event) {
|
|||
switch ($event['criticity']) {
|
||||
default:
|
||||
case 0:
|
||||
$img_sev = 'images/status_sets/default/severity_maintenance.png';
|
||||
$img_sev = 'images/status_sets/default/severity_maintenance_rounded.png';
|
||||
break;
|
||||
case 1:
|
||||
$img_sev = 'images/status_sets/default/severity_informational.png';
|
||||
$img_sev = 'images/status_sets/default/severity_informational_rounded.png';
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$img_sev = 'images/status_sets/default/severity_normal.png';
|
||||
$img_sev = 'images/status_sets/default/severity_normal_rounded.png';
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$img_sev = 'images/status_sets/default/severity_warning.png';
|
||||
$img_sev = 'images/status_sets/default/severity_warning_rounded.png';
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$img_sev = 'images/status_sets/default/severity_critical.png';
|
||||
$img_sev = 'images/status_sets/default/severity_critical_rounded.png';
|
||||
break;
|
||||
|
||||
case 5:
|
||||
$img_sev = 'images/status_sets/default/severity_minor.png';
|
||||
$img_sev = 'images/status_sets/default/severity_minor_rounded.png';
|
||||
break;
|
||||
|
||||
case 6:
|
||||
$img_sev = 'images/status_sets/default/severity_major.png';
|
||||
$img_sev = 'images/status_sets/default/severity_major_rounded.png';
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -717,9 +717,15 @@ if ($table_events) {
|
|||
'event_condition',
|
||||
'AND'
|
||||
);
|
||||
echo '<div id="div_all_events_24h">';
|
||||
echo '<label><b>'.__('Show all Events 24h').'</b></label>';
|
||||
echo html_print_checkbox('all_events_24h', $all_events_24h, $all_events_24h, true, false, '', true);
|
||||
echo '<div style="display: flex;" id="div_all_events_24h">';
|
||||
echo '<label style="margin-right: 1em;"><b>'.__('Show all Events 24h').'</b></label>';
|
||||
echo html_print_switch(
|
||||
[
|
||||
'name' => 'all_events_24h',
|
||||
'value' => $all_events_24h,
|
||||
'id' => 'checkbox-all_events_24h',
|
||||
]
|
||||
);
|
||||
echo '</div>';
|
||||
$date_subtract_day = (time() - (24 * 60 * 60));
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ if ($get_extended_info == 1) {
|
|||
$table->head = [];
|
||||
$table->cellspacing = 2;
|
||||
$table->cellpadding = 2;
|
||||
$table->class = 'events_show_more_table';
|
||||
$table->class = 'table_modal_alternate';
|
||||
|
||||
$output = [];
|
||||
$output[] = '<b>'.__('Timestamp').'</b>';
|
||||
|
|
|
@ -1,17 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* Module management.
|
||||
*
|
||||
* @category Ajax library.
|
||||
* @package Pandora FMS
|
||||
* @subpackage Modules.
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
if (check_login()) {
|
||||
// Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
|
||||
include_once $config['homedir'].'/include/functions_agents.php';
|
||||
|
@ -76,7 +92,7 @@ if (check_login()) {
|
|||
$id_agents = json_decode(io_safe_output(get_parameter('id_agents')));
|
||||
$filter = '%'.get_parameter('q', '').'%';
|
||||
$other_filter = json_decode(io_safe_output(get_parameter('other_filter')), true);
|
||||
// TODO TAGS agents_get_modules
|
||||
// TODO TAGS agents_get_modules.
|
||||
$modules = agents_get_modules(
|
||||
$id_agents,
|
||||
false,
|
||||
|
@ -96,7 +112,7 @@ if (check_login()) {
|
|||
}
|
||||
|
||||
if ($get_module_detail) {
|
||||
// This script is included manually to be included after jquery and avoid error
|
||||
// This script is included manually to be included after jquery and avoid error.
|
||||
ui_include_time_picker();
|
||||
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
|
||||
|
||||
|
@ -307,7 +323,7 @@ if (check_login()) {
|
|||
if (empty($module_data)) {
|
||||
$result = [];
|
||||
} else {
|
||||
// Paginate the result
|
||||
// Paginate the result.
|
||||
$result = array_slice($module_data, $offset, $block_size);
|
||||
}
|
||||
|
||||
|
@ -366,10 +382,10 @@ if (check_login()) {
|
|||
$data[] = html_print_result_div($row[$attr[0]]);
|
||||
} else if ($is_web_content_string) {
|
||||
// Fixed the goliat sends the strings from web
|
||||
// without HTML entities
|
||||
// without HTML entities.
|
||||
$data[] = io_safe_input($row[$attr[0]]);
|
||||
} else {
|
||||
// Fixed the data from Selenium Plugin
|
||||
// Fixed the data from Selenium Plugin.
|
||||
if ($row[$attr[0]] != strip_tags($row[$attr[0]])) {
|
||||
$data[] = html_print_result_div($row[$attr[0]]);
|
||||
} else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type'])) {
|
||||
|
@ -523,7 +539,8 @@ if (check_login()) {
|
|||
$agent_w = check_acl($config['id_user'], 0, 'AW');
|
||||
$access = ($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR');
|
||||
|
||||
$id_agente = $id_agent = (int) get_parameter('id_agente', 0);
|
||||
$id_agent = (int) get_parameter('id_agente', 0);
|
||||
$id_agente = $id_agent;
|
||||
$show_notinit = (int) get_parameter('show_notinit', 0);
|
||||
$cluster_list = (int) get_parameter('cluster_list', 0);
|
||||
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent;
|
||||
|
@ -549,6 +566,7 @@ if (check_login()) {
|
|||
case 'type':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
default:
|
||||
$selectTypeUp = $selected;
|
||||
$order[] = [
|
||||
'field' => 'tagente_modulo.id_modulo',
|
||||
|
@ -583,6 +601,10 @@ if (check_login()) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -603,6 +625,10 @@ if (check_login()) {
|
|||
'order' => '',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -623,6 +649,10 @@ if (check_login()) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -645,7 +675,8 @@ if (check_login()) {
|
|||
break;
|
||||
}
|
||||
|
||||
// Fix: for tag functionality groups have to be all user_groups (propagate ACL funct!)
|
||||
// Fix: for tag functionality groups have to be all user_groups
|
||||
// (propagate ACL funct!).
|
||||
$groups = users_get_groups($config['id_user'], $access);
|
||||
|
||||
$tags_join = '';
|
||||
|
@ -669,7 +700,7 @@ if (check_login()) {
|
|||
|
||||
$status_filter_sql = '1 = 1';
|
||||
if ($status_filter_monitor == AGENT_MODULE_STATUS_NOT_NORMAL) {
|
||||
// Not normal
|
||||
// Not normal.
|
||||
$status_filter_sql = ' tagente_estado.estado <> 0';
|
||||
} else if ($status_filter_monitor != -1) {
|
||||
$status_filter_sql = 'tagente_estado.estado = '.$status_filter_monitor;
|
||||
|
@ -693,7 +724,7 @@ if (check_login()) {
|
|||
}
|
||||
|
||||
// Count monitors/modules
|
||||
// Build the order sql
|
||||
// Build the order sql.
|
||||
$first = true;
|
||||
foreach ($order as $ord) {
|
||||
if ($first) {
|
||||
|
@ -769,6 +800,7 @@ if (check_login()) {
|
|||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->styleTable = 'border: 0;border-radius: 0;';
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->class = 'info_table';
|
||||
|
@ -791,7 +823,6 @@ if (check_login()) {
|
|||
$table->head[6] = __('Thresholds');
|
||||
$table->head[7] = __('Data');
|
||||
$table->head[8] = __('Graph');
|
||||
$table->headstyle[8] = 'min-width: 60px';
|
||||
$table->head[9] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastContactUp, $selectLastContactDown);
|
||||
$table->align = [
|
||||
'left',
|
||||
|
@ -805,6 +836,12 @@ if (check_login()) {
|
|||
'left',
|
||||
];
|
||||
|
||||
$table->headstyle[2] = 'min-width: 60px';
|
||||
$table->headstyle[3] = 'min-width: 100px';
|
||||
$table->headstyle[5] = 'min-width: 60px';
|
||||
$table->headstyle[8] = 'min-width: 85px';
|
||||
$table->headstyle[9] = 'min-width: 100px';
|
||||
|
||||
$last_modulegroup = 0;
|
||||
$rowIndex = 0;
|
||||
|
||||
|
@ -936,12 +973,12 @@ if (check_login()) {
|
|||
}
|
||||
}
|
||||
|
||||
// Adds tag context information
|
||||
// Adds tag context information.
|
||||
if (tags_get_modules_tag_count($module['id_agente_modulo']) > 0) {
|
||||
$data[3] .= ' <a class="tag_details" href="ajax.php?page=operation/agentes/estado_monitores&get_tag_tooltip=1&id_agente_modulo='.$module['id_agente_modulo'].'">'.html_print_image('images/tag_red.png', true, ['id' => 'tag-details-'.$module['id_agente_modulo'], 'class' => 'img_help']).'</a> ';
|
||||
}
|
||||
|
||||
// Adds relations context information
|
||||
// Adds relations context information.
|
||||
if (modules_relation_exists($module['id_agente_modulo'])) {
|
||||
$data[3] .= ' <a class="relations_details" href="ajax.php?page=operation/agentes/estado_monitores&get_relations_tooltip=1&id_agente_modulo='.$module['id_agente_modulo'].'">'.html_print_image('images/link2.png', true, ['id' => 'relations-details-'.$module['id_agente_modulo'], 'class' => 'img_help']).'</a> ';
|
||||
}
|
||||
|
@ -964,7 +1001,7 @@ if (check_login()) {
|
|||
$title
|
||||
);
|
||||
|
||||
$data[5] = ui_print_status_image($status, $title, true);
|
||||
$data[5] = ui_print_module_status($module['estado'], $title, true, false, true);
|
||||
if (!$show_context_help_first_time) {
|
||||
$show_context_help_first_time = true;
|
||||
|
||||
|
@ -973,122 +1010,85 @@ if (check_login()) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($module['id_tipo_modulo'] == 24) {
|
||||
// log4x
|
||||
switch ($module['datos']) {
|
||||
case 10:
|
||||
$salida = 'TRACE';
|
||||
$style = 'font-weight:bold; color:darkgreen;';
|
||||
break;
|
||||
if (is_numeric($module['datos']) && !modules_is_string_type($module['id_tipo_modulo'])) {
|
||||
if ($config['render_proc']) {
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 2:
|
||||
case 6:
|
||||
case 9:
|
||||
case 18:
|
||||
case 21:
|
||||
case 31:
|
||||
if ($module['datos'] >= 1) {
|
||||
$salida = $config['render_proc_ok'];
|
||||
} else {
|
||||
$salida = $config['render_proc_fail'];
|
||||
}
|
||||
break;
|
||||
|
||||
case 20:
|
||||
$salida = 'DEBUG';
|
||||
$style = 'font-weight:bold; color:darkgreen;';
|
||||
break;
|
||||
|
||||
case 30:
|
||||
$salida = 'INFO';
|
||||
$style = 'font-weight:bold; color:darkgreen;';
|
||||
break;
|
||||
|
||||
case 40:
|
||||
$salida = 'WARN';
|
||||
$style = 'font-weight:bold; color:darkorange;';
|
||||
break;
|
||||
|
||||
case 50:
|
||||
$salida = 'ERROR';
|
||||
$style = 'font-weight:bold; color:red;';
|
||||
break;
|
||||
|
||||
case 60:
|
||||
$salida = 'FATAL';
|
||||
$style = 'font-weight:bold; color:red;';
|
||||
break;
|
||||
}
|
||||
|
||||
$salida = "<span style='$style'>$salida</span>";
|
||||
} else {
|
||||
if (is_numeric($module['datos']) && !modules_is_string_type($module['id_tipo_modulo'])) {
|
||||
if ($config['render_proc']) {
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 2:
|
||||
case 6:
|
||||
case 9:
|
||||
case 18:
|
||||
case 21:
|
||||
case 31:
|
||||
if ($module['datos'] >= 1) {
|
||||
$salida = $config['render_proc_ok'];
|
||||
} else {
|
||||
$salida = $config['render_proc_fail'];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 15:
|
||||
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
|
||||
if ($module['post_process'] > 0) {
|
||||
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
|
||||
} else {
|
||||
$salida = human_milliseconds_to_string($module['datos']);
|
||||
}
|
||||
default:
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 15:
|
||||
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
|
||||
if ($module['post_process'] > 0) {
|
||||
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
|
||||
} else {
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
$salida = human_milliseconds_to_string($module['datos']);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 15:
|
||||
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
|
||||
if ($module['post_process'] > 0) {
|
||||
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
|
||||
} else {
|
||||
$salida = human_milliseconds_to_string($module['datos']);
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
|
||||
default:
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Show units ONLY in numeric data types
|
||||
if (isset($module['unit'])) {
|
||||
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
|
||||
if ($data_macro) {
|
||||
$salida = $data_macro;
|
||||
} else {
|
||||
$salida .= ' '.'<i>'.io_safe_output($module['unit']).'</i>';
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 15:
|
||||
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
|
||||
if ($module['post_process'] > 0) {
|
||||
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
|
||||
} else {
|
||||
$salida = human_milliseconds_to_string($module['datos']);
|
||||
}
|
||||
} else {
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Show units ONLY in numeric data types
|
||||
if (isset($module['unit'])) {
|
||||
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
|
||||
if ($data_macro) {
|
||||
$salida = $data_macro;
|
||||
} else {
|
||||
$salida = ui_print_module_string_value(
|
||||
$module['datos'],
|
||||
$module['id_agente_modulo'],
|
||||
$module['current_interval'],
|
||||
$module['module_name']
|
||||
);
|
||||
$salida .= ' '.'<i>'.io_safe_output($module['unit']).'</i>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
|
||||
if ($data_macro) {
|
||||
$salida = $data_macro;
|
||||
} else {
|
||||
$salida = ui_print_module_string_value(
|
||||
$module['datos'],
|
||||
$module['id_agente_modulo'],
|
||||
$module['current_interval'],
|
||||
$module['module_name']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($module['id_tipo_modulo'] != 25) {
|
||||
|
@ -1230,5 +1230,3 @@ if (check_login()) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -176,6 +176,7 @@ $default_color = get_parameter('default_color', '#FFFFFF');
|
|||
$color_range_from_values = get_parameter('color_range_from_values', []);
|
||||
$color_range_to_values = get_parameter('color_range_to_values', []);
|
||||
$color_range_colors = get_parameter('color_range_colors', []);
|
||||
$cache_expiration = (int) get_parameter('cache_expiration');
|
||||
|
||||
switch ($action) {
|
||||
case 'get_font':
|
||||
|
@ -581,7 +582,21 @@ switch ($action) {
|
|||
$values['label_position'] = $label_position;
|
||||
$values['show_on_top'] = $show_on_top;
|
||||
|
||||
// In Graphs, background color is stored in column image (sorry)
|
||||
switch ($type) {
|
||||
case 'line_item':
|
||||
case 'box_item':
|
||||
case 'clock':
|
||||
case 'icon':
|
||||
case 'label':
|
||||
$values['cache_expiration'] = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
$values['cache_expiration'] = $cache_expiration;
|
||||
break;
|
||||
}
|
||||
|
||||
// In Graphs, background color is stored in column image (sorry).
|
||||
if ($type == 'module_graph') {
|
||||
$values['image'] = $background_color;
|
||||
$values['type_graph'] = $type_graph;
|
||||
|
@ -997,6 +1012,7 @@ switch ($action) {
|
|||
unset($values['id_layout_linked']);
|
||||
unset($values['element_group']);
|
||||
unset($values['id_layout_linked_weight']);
|
||||
unset($values['cache_expiration']);
|
||||
// Don't change background color in graphs when move
|
||||
switch ($type) {
|
||||
case 'group_item':
|
||||
|
@ -1070,6 +1086,16 @@ switch ($action) {
|
|||
['id' => $id_element]
|
||||
);
|
||||
|
||||
// Invalidate the item's cache.
|
||||
if ($result !== false && $result > 0) {
|
||||
db_process_sql_delete(
|
||||
'tvisual_console_elements_cache',
|
||||
[
|
||||
'vc_item_id' => (int) $id_element,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$return_val = [];
|
||||
$return_val['correct'] = (int) $result;
|
||||
$return_val['new_line'] = $new_line;
|
||||
|
@ -1404,9 +1430,22 @@ switch ($action) {
|
|||
$values['show_on_top'] = $show_on_top;
|
||||
$values['image'] = $background_color;
|
||||
$values['type_graph'] = $type_graph;
|
||||
|
||||
$values['id_custom_graph'] = $id_custom_graph;
|
||||
|
||||
switch ($type) {
|
||||
case 'line_item':
|
||||
case 'box_item':
|
||||
case 'clock':
|
||||
case 'icon':
|
||||
case 'label':
|
||||
$values['cache_expiration'] = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
$values['cache_expiration'] = $cache_expiration;
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'line_item':
|
||||
$values['type'] = LINE_ITEM;
|
||||
|
|
|
@ -1519,43 +1519,8 @@ class NetworkMap
|
|||
*/
|
||||
public static function getColorByStatus($status)
|
||||
{
|
||||
if (isset($status) === false) {
|
||||
return COL_UNKNOWN;
|
||||
}
|
||||
|
||||
switch ($status) {
|
||||
case AGENT_MODULE_STATUS_NORMAL:
|
||||
case AGENT_STATUS_NORMAL:
|
||||
return COL_NORMAL;
|
||||
|
||||
case AGENT_MODULE_STATUS_NOT_INIT:
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
return COL_NOTINIT;
|
||||
|
||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
return COL_CRITICAL;
|
||||
|
||||
case AGENT_MODULE_STATUS_WARNING:
|
||||
case AGENT_STATUS_WARNING:
|
||||
return COL_WARNING;
|
||||
|
||||
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||
case AGENT_STATUS_ALERT_FIRED:
|
||||
return COL_ALERTFIRED;
|
||||
|
||||
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
return COL_UNKNOWN;
|
||||
|
||||
default:
|
||||
// Ignored.
|
||||
break;
|
||||
}
|
||||
|
||||
return COL_IGNORED;
|
||||
|
||||
include_once __DIR__.'/../functions_modules.php';
|
||||
return modules_get_color_status($status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC190522';
|
||||
$build_version = 'PC190603';
|
||||
$pandora_version = 'v7.0NG.735';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -871,12 +871,13 @@ function get_parameter_switch($name, $default='')
|
|||
$data = get_parameter($name, null);
|
||||
|
||||
if ($data === null) {
|
||||
return 0;
|
||||
return (isset($default) ? $default : 0);
|
||||
} else if ($data == 'on') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
// Return value assigned to switch.
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
@ -4971,6 +4972,14 @@ function get_help_info($section_name)
|
|||
}
|
||||
break;
|
||||
|
||||
case 'create_agent':
|
||||
if ($es) {
|
||||
$result .= 'Intro_Monitorizacion&printable=yes#Configuraci.C3.B3n_del_agente_en_consola';
|
||||
} else {
|
||||
$result .= 'Intro_Monitoring&printable=yes#Agent_configuration_in_the_console';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'agent_snmp_explorer_tab':
|
||||
if ($es) {
|
||||
$result .= 'Monitorizacion_remota&printable=yes#Wizard_SNMP';
|
||||
|
|
|
@ -296,7 +296,7 @@ function clippy_context_help($help=null)
|
|||
$code = str_replace('{clippy}', '#'.$id, $code);
|
||||
$code = str_replace('{clippy_obj}', 'intro_'.$id, $code);
|
||||
|
||||
$return = $code.'<div id="'.$id.'" style="display: inline;"><a onclick="show_'.$id.'();" href="javascript: void(0);" >'.html_print_image(
|
||||
$return = $code.'<div id="'.$id.'" style="display: inline-block;"><a onclick="show_'.$id.'();" href="javascript: void(0);" >'.html_print_image(
|
||||
'images/clippy_icon.png',
|
||||
true
|
||||
).'</a></div>
|
||||
|
|
|
@ -984,6 +984,10 @@ function config_update_config()
|
|||
$error_update[] = __('Use the legacy Visual Console');
|
||||
}
|
||||
|
||||
if (!config_update_value('vc_default_cache_expiration', (int) get_parameter('vc_default_cache_expiration'))) {
|
||||
$error_update[] = __("Default expiration of the Visual Console item's cache");
|
||||
}
|
||||
|
||||
if (!config_update_value('vc_refr', (int) get_parameter('vc_refr'))) {
|
||||
$error_update[] = __('Default interval for refresh on Visual Console');
|
||||
}
|
||||
|
@ -1353,6 +1357,10 @@ function config_update_config()
|
|||
$error_update[] = __('Enable eHorus');
|
||||
}
|
||||
|
||||
if (!config_update_value('ehorus_user_level_conf', (int) get_parameter('ehorus_user_level_conf', 0))) {
|
||||
$error_update[] = __('eHorus user login');
|
||||
}
|
||||
|
||||
if (!config_update_value('ehorus_user', (string) get_parameter('ehorus_user', $config['ehorus_user']))) {
|
||||
$error_update[] = __('eHorus user');
|
||||
}
|
||||
|
@ -2423,6 +2431,10 @@ function config_process_config()
|
|||
config_update_value('legacy_vc', 1);
|
||||
}
|
||||
|
||||
if (!isset($config['vc_default_cache_expiration'])) {
|
||||
config_update_value('vc_default_cache_expiration', 60);
|
||||
}
|
||||
|
||||
if (!isset($config['vc_refr'])) {
|
||||
config_update_value('vc_refr', 300);
|
||||
}
|
||||
|
@ -2740,6 +2752,31 @@ function config_check()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves base url stored for Update Manager.
|
||||
*
|
||||
* @return string URL.
|
||||
*/
|
||||
function get_um_url()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($config['url_update_manager'])) {
|
||||
$url = $config['url_update_manager'];
|
||||
$url = substr($url, 0, (strlen($url) - strpos(strrev($url), '/')));
|
||||
} else {
|
||||
$url = 'https://licensing.artica.es/pandoraupdate7/';
|
||||
config_update_value(
|
||||
'url_update_manager',
|
||||
'https://licensing.artica.es/pandoraupdate7/server.php'
|
||||
);
|
||||
}
|
||||
|
||||
return $url;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return in bytes
|
||||
*
|
||||
|
|
|
@ -959,6 +959,8 @@ function events_print_event_table(
|
|||
) {
|
||||
global $config;
|
||||
|
||||
ui_require_css_file('events');
|
||||
|
||||
if ($agent_id == 0) {
|
||||
$agent_condition = '';
|
||||
} else {
|
||||
|
@ -997,7 +999,7 @@ function events_print_event_table(
|
|||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = $width;
|
||||
$table->class = 'databox data';
|
||||
$table->class = 'info_table no-td-padding';
|
||||
if (!$tactical_view) {
|
||||
$table->title = __('Latest events');
|
||||
}
|
||||
|
@ -1010,36 +1012,38 @@ function events_print_event_table(
|
|||
$table->cellclass = [];
|
||||
$table->data = [];
|
||||
$table->align = [];
|
||||
$table->style[0] = 'width:25px;';
|
||||
$table->style[1] = 'width:25px;';
|
||||
$table->style[2] = 'width:25px;';
|
||||
if ($agent_id == 0) {
|
||||
$table->style[3] = 'word-break: break-all;';
|
||||
}
|
||||
$table->style = [];
|
||||
|
||||
$table->style[4] = 'width:120px; word-break: break-all;';
|
||||
$i = 0;
|
||||
$table->head[$i] = "<span title='".__('Severity')."'>".__('S.').'</span>';
|
||||
$table->headstyle[$i] = 'width: 1%;text-align: center;';
|
||||
$table->style[$i++] = 'text-align: center;';
|
||||
|
||||
$table->head[0] = "<span title='".__('Validated')."'>".__('V.').'</span>';
|
||||
$table->align[0] = 'center';
|
||||
$table->head[$i] = __('Type');
|
||||
$table->headstyle[$i] = 'width: 3%;text-align: center;';
|
||||
$table->style[$i++] = 'text-align: center;';
|
||||
|
||||
$table->head[1] = "<span title='".__('Severity')."'>".__('S.').'</span>';
|
||||
$table->align[1] = 'center';
|
||||
|
||||
$table->head[2] = __('Type');
|
||||
$table->headclass[2] = 'datos3 f9';
|
||||
$table->align[2] = 'center';
|
||||
|
||||
$table->head[3] = __('Event name');
|
||||
$table->head[$i] = __('Event name');
|
||||
$table->headstyle[$i] = '';
|
||||
$table->style[$i++] = 'word-break: break-word;';
|
||||
|
||||
if ($agent_id == 0) {
|
||||
$table->head[4] = __('Agent name');
|
||||
$table->size[4] = '15%';
|
||||
$table->head[$i] = __('Agent name');
|
||||
$table->headstyle[$i] = '';
|
||||
$table->style[$i++] = 'word-break: break-all;';
|
||||
}
|
||||
|
||||
$table->head[5] = __('Timestamp');
|
||||
$table->headclass[5] = 'datos3 f9';
|
||||
$table->align[5] = 'left';
|
||||
$table->size[5] = '15%';
|
||||
$table->head[$i] = __('Timestamp');
|
||||
$table->headstyle[$i] = 'width: 120px;';
|
||||
$table->style[$i++] = 'word-break: break-word;';
|
||||
|
||||
$table->head[$i] = __('Status');
|
||||
$table->headstyle[$i] = 'width: 150px;text-align: center;';
|
||||
$table->style[$i++] = 'text-align: center;';
|
||||
|
||||
$table->head[$i] = "<span title='".__('Validated')."'>".__('V.').'</span>';
|
||||
$table->headstyle[$i] = 'width: 1%;text-align: center;';
|
||||
$table->style[$i++] = 'text-align: center;';
|
||||
|
||||
$all_groups = [];
|
||||
if ($agent_id != 0) {
|
||||
|
@ -1078,53 +1082,15 @@ function events_print_event_table(
|
|||
break;
|
||||
}
|
||||
|
||||
$data[0] = html_print_image(
|
||||
$img,
|
||||
true,
|
||||
[
|
||||
'class' => 'image_status',
|
||||
'title' => $title,
|
||||
]
|
||||
);
|
||||
|
||||
switch ($event['criticity']) {
|
||||
default:
|
||||
case EVENT_CRIT_MAINTENANCE:
|
||||
$img = 'images/status_sets/default/severity_maintenance.png';
|
||||
break;
|
||||
case EVENT_CRIT_INFORMATIONAL:
|
||||
$img = 'images/status_sets/default/severity_informational.png';
|
||||
break;
|
||||
|
||||
case EVENT_CRIT_NORMAL:
|
||||
$img = 'images/status_sets/default/severity_normal.png';
|
||||
break;
|
||||
|
||||
case EVENT_CRIT_WARNING:
|
||||
$img = 'images/status_sets/default/severity_warning.png';
|
||||
break;
|
||||
|
||||
case EVENT_CRIT_CRITICAL:
|
||||
$img = 'images/status_sets/default/severity_critical.png';
|
||||
break;
|
||||
}
|
||||
|
||||
$data[1] = html_print_image(
|
||||
$img,
|
||||
true,
|
||||
[
|
||||
'class' => 'image_status',
|
||||
'width' => 12,
|
||||
'height' => 12,
|
||||
'title' => get_priority_name($event['criticity']),
|
||||
]
|
||||
);
|
||||
$i = 0;
|
||||
// Criticity.
|
||||
$data[$i++] = ui_print_event_priority($event['criticity'], true, true);
|
||||
|
||||
// Event type.
|
||||
$data[2] = events_print_type_img($event['event_type'], true);
|
||||
$data[$i++] = events_print_type_img($event['event_type'], true);
|
||||
|
||||
// Event text.
|
||||
$data[3] = ui_print_string_substr(
|
||||
$data[$i++] = ui_print_string_substr(
|
||||
strip_tags(io_safe_output($event['evento'])),
|
||||
75,
|
||||
true,
|
||||
|
@ -1135,33 +1101,32 @@ function events_print_event_table(
|
|||
if ($event['id_agente'] > 0) {
|
||||
// Agent name.
|
||||
// Get class name, for the link color, etc.
|
||||
$myclass = get_priority_class($event['criticity']);
|
||||
|
||||
$data[4] = "<a class='".$myclass."' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event['id_agente']."'>".agents_get_alias($event['id_agente']).'</A>';
|
||||
$data[$i] = "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event['id_agente']."'>".agents_get_alias($event['id_agente']).'</A>';
|
||||
// For System or SNMP generated alerts.
|
||||
} else if ($event['event_type'] == 'system') {
|
||||
$data[4] = __('System');
|
||||
$data[$i] = __('System');
|
||||
} else {
|
||||
$data[4] = __('Alert').'SNMP';
|
||||
$data[$i] = __('Alert').'SNMP';
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Timestamp.
|
||||
$data[5] = ui_print_timestamp($event['timestamp'], true, ['style' => 'font-size: 7.5pt; letter-spacing: 0.3pt;']);
|
||||
$data[$i++] = ui_print_timestamp($event['timestamp'], true, ['style' => 'font-size: 7.5pt; letter-spacing: 0.3pt;']);
|
||||
|
||||
$class = get_priority_class($event['criticity']);
|
||||
$cell_classes[3] = $class;
|
||||
$cell_classes[4] = $class;
|
||||
$cell_classes[5] = $class;
|
||||
// Status.
|
||||
$data[$i++] = ui_print_event_type($event['event_type'], true);
|
||||
|
||||
array_push($table->cellclass, $cell_classes);
|
||||
|
||||
/*
|
||||
Commented out (old).
|
||||
// array_push ($table->rowclass, get_priority_class ($event["criticity"]));
|
||||
*/
|
||||
|
||||
array_push($table->data, $data);
|
||||
$data[$i++] = html_print_image(
|
||||
$img,
|
||||
true,
|
||||
[
|
||||
'class' => 'image_status',
|
||||
'title' => $title,
|
||||
]
|
||||
);
|
||||
$table->data[] = $data;
|
||||
}
|
||||
|
||||
$events_table = html_print_table($table, true);
|
||||
|
@ -1989,7 +1954,7 @@ function events_page_responses($event, $childrens_ids=[])
|
|||
$table_responses->head = [];
|
||||
$table_responses->style[0] = 'height:30px';
|
||||
$table_responses->style[2] = 'text-align:right;';
|
||||
$table_responses->class = 'events_show_more_table';
|
||||
$table_responses->class = 'table_modal_alternate';
|
||||
|
||||
if (tags_checks_event_acl($config['id_user'], $event['id_grupo'], 'EM', $event['clean_tags'], $childrens_ids)) {
|
||||
// Owner.
|
||||
|
@ -2523,7 +2488,7 @@ function events_page_custom_fields($event)
|
|||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->head = [];
|
||||
$table->class = 'events_show_more_table';
|
||||
$table->class = 'table_modal_alternate';
|
||||
|
||||
$all_customs_fields = (bool) check_acl(
|
||||
$config['id_user'],
|
||||
|
@ -2673,7 +2638,7 @@ function events_page_details($event, $server='')
|
|||
$table_details->head = [];
|
||||
$table_details->cellspacing = 0;
|
||||
$table_details->cellpadding = 0;
|
||||
$table_details->class = 'events_show_more_table';
|
||||
$table_details->class = 'table_modal_alternate';
|
||||
|
||||
/*
|
||||
* Useless switch.
|
||||
|
@ -2917,9 +2882,10 @@ function events_page_details($event, $server='')
|
|||
true,
|
||||
[
|
||||
'class' => 'image_status',
|
||||
'width' => 12,
|
||||
'height' => 12,
|
||||
'width' => 61,
|
||||
'height' => 28,
|
||||
'title' => $alert_priority,
|
||||
'style' => 'vertical-align:text-bottom',
|
||||
]
|
||||
);
|
||||
$data[1] .= ' '.$alert_priority;
|
||||
|
@ -2983,7 +2949,7 @@ function events_page_custom_data($event)
|
|||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->head = [];
|
||||
$table->class = 'events_show_more_table';
|
||||
$table->class = 'table_modal_alternate';
|
||||
|
||||
$json_custom_data = base64_decode($event['custom_data']);
|
||||
$custom_data = json_decode($json_custom_data);
|
||||
|
@ -3138,7 +3104,7 @@ function events_page_general($event)
|
|||
$table_general->width = '100%';
|
||||
$table_general->data = [];
|
||||
$table_general->head = [];
|
||||
$table_general->class = 'events_show_more_table';
|
||||
$table_general->class = 'table_modal_alternate';
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Event ID');
|
||||
|
@ -3210,8 +3176,8 @@ function events_page_general($event)
|
|||
true,
|
||||
[
|
||||
'class' => 'image_status',
|
||||
'width' => 12,
|
||||
'height' => 12,
|
||||
'width' => 61,
|
||||
'height' => 28,
|
||||
'title' => $event_criticity,
|
||||
]
|
||||
);
|
||||
|
@ -3321,7 +3287,7 @@ function events_page_comments($event, $childrens_ids=[])
|
|||
$table_comments->width = '100%';
|
||||
$table_comments->data = [];
|
||||
$table_comments->head = [];
|
||||
$table_comments->class = 'events_show_more_table';
|
||||
$table_comments->class = 'table_modal_alternate';
|
||||
|
||||
$event_comments = $event['user_comment'];
|
||||
$event_comments = str_replace(["\n", '
'], '<br>', $event_comments);
|
||||
|
|
|
@ -660,7 +660,7 @@ function html_print_select(
|
|||
}
|
||||
|
||||
if ($optlabel === '') {
|
||||
$output .= '>'.$value.'</option>';
|
||||
$output .= '>None</option>';
|
||||
} else {
|
||||
$output .= '>'.$optlabel.'</option>';
|
||||
}
|
||||
|
@ -1079,7 +1079,7 @@ function html_print_extended_select_for_time(
|
|||
'class' => $uniq_name.'_toggler '.$class,
|
||||
'alt' => __('Custom'),
|
||||
'title' => __('Custom'),
|
||||
'style' => 'width: 18px;'.$style_icon,
|
||||
'style' => 'width: 18px; margin-bottom: -5px;'.$style_icon,
|
||||
],
|
||||
false,
|
||||
false,
|
||||
|
@ -1114,7 +1114,7 @@ function html_print_extended_select_for_time(
|
|||
'class' => $uniq_name.'_toggler',
|
||||
'alt' => __('List'),
|
||||
'title' => __('List'),
|
||||
'style' => 'width: 18px;'.$style_icon,
|
||||
'style' => 'width: 18px;margin-bottom: -5px;'.$style_icon,
|
||||
]
|
||||
).'</a>';
|
||||
echo '</div>';
|
||||
|
@ -2989,6 +2989,7 @@ function html_print_switch($attributes=[])
|
|||
'class',
|
||||
'name',
|
||||
'onclick',
|
||||
'onchange',
|
||||
];
|
||||
foreach ($valid_attrs as $va) {
|
||||
if (!isset($attributes[$va])) {
|
||||
|
@ -2998,7 +2999,11 @@ function html_print_switch($attributes=[])
|
|||
$html_expand .= ' '.$va.'="'.$attributes[$va].'"';
|
||||
}
|
||||
|
||||
return "<label class='p-switch'>
|
||||
if (!isset($attributes['style'])) {
|
||||
$attributes['style'] = '';
|
||||
}
|
||||
|
||||
return "<label class='p-switch' style='".$attributes['style']."'>
|
||||
<input type='checkbox' $html_expand>
|
||||
<span class='p-slider'></span>
|
||||
</label>";
|
||||
|
|
|
@ -2294,6 +2294,54 @@ function modules_get_modulegroup_name($modulegroup_id)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns target color to be used based on the status received.
|
||||
*
|
||||
* @param integer $status Source information.
|
||||
*
|
||||
* @return string HTML tag for color.
|
||||
*/
|
||||
function modules_get_color_status($status)
|
||||
{
|
||||
if (isset($status) === false) {
|
||||
return COL_UNKNOWN;
|
||||
}
|
||||
|
||||
switch ($status) {
|
||||
case AGENT_MODULE_STATUS_NORMAL:
|
||||
case AGENT_STATUS_NORMAL:
|
||||
return COL_NORMAL;
|
||||
|
||||
case AGENT_MODULE_STATUS_NOT_INIT:
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
return COL_NOTINIT;
|
||||
|
||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
return COL_CRITICAL;
|
||||
|
||||
case AGENT_MODULE_STATUS_WARNING:
|
||||
case AGENT_STATUS_WARNING:
|
||||
return COL_WARNING;
|
||||
|
||||
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||
case AGENT_STATUS_ALERT_FIRED:
|
||||
return COL_ALERTFIRED;
|
||||
|
||||
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
return COL_UNKNOWN;
|
||||
|
||||
default:
|
||||
// Ignored.
|
||||
break;
|
||||
}
|
||||
|
||||
return COL_IGNORED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets a module status an modify the status and title reference variables
|
||||
*
|
||||
|
@ -2322,7 +2370,7 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
|
|||
$status = STATUS_MODULE_OK;
|
||||
$title = __('NORMAL');
|
||||
} else if ($db_status == AGENT_MODULE_STATUS_UNKNOWN) {
|
||||
$status = STATUS_AGENT_DOWN;
|
||||
$status = STATUS_MODULE_UNKNOWN;
|
||||
$last_status = modules_get_agentmodule_last_status($id_agent_module);
|
||||
switch ($last_status) {
|
||||
case AGENT_STATUS_NORMAL:
|
||||
|
|
|
@ -1914,6 +1914,11 @@ function reporting_event_report_module(
|
|||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = agents_get_alias($content['id_agent']).' - '.io_safe_output(modules_get_agentmodule_name($content['id_agent_module']));
|
||||
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($return['label'] != '') {
|
||||
$return['label'] = reporting_label_macro($content, $return['label']);
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
@ -1921,7 +1926,6 @@ function reporting_event_report_module(
|
|||
$return['description'] = $content['description'];
|
||||
$return['show_extended_events'] = $content['show_extended_events'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
|
||||
$event_filter = $content['style'];
|
||||
$return['show_summary_group'] = $event_filter['show_summary_group'];
|
||||
|
@ -2741,6 +2745,17 @@ function reporting_group_report($report, $content)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create data report event agent.
|
||||
*
|
||||
* @param array $report Data report.
|
||||
* @param array $content Content report.
|
||||
* @param string $type Type report.
|
||||
* @param integer $force_width_chart Force width.
|
||||
* @param integer $force_height_chart Force height.
|
||||
*
|
||||
* @return array Data.
|
||||
*/
|
||||
function reporting_event_report_agent(
|
||||
$report,
|
||||
$content,
|
||||
|
@ -2761,26 +2776,26 @@ function reporting_event_report_agent(
|
|||
$history = true;
|
||||
}
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = agents_get_alias($content['id_agent']);
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = agents_get_alias($content['id_agent']);
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
|
||||
$return['show_summary_group'] = $content['style']['show_summary_group'];
|
||||
$return['show_extended_events'] = $content['show_extended_events'];
|
||||
|
||||
$style = $content['style'];
|
||||
|
||||
// filter
|
||||
$show_summary_group = $style['show_summary_group'];
|
||||
$filter_event_severity = json_decode($style['filter_event_severity'], true);
|
||||
$filter_event_type = json_decode($style['filter_event_type'], true);
|
||||
$filter_event_status = json_decode($style['filter_event_status'], true);
|
||||
// Filter.
|
||||
$show_summary_group = $style['show_summary_group'];
|
||||
$filter_event_severity = json_decode($style['filter_event_severity'], true);
|
||||
$filter_event_type = json_decode($style['filter_event_type'], true);
|
||||
$filter_event_status = json_decode($style['filter_event_status'], true);
|
||||
$filter_event_filter_search = $style['event_filter_search'];
|
||||
|
||||
// graph
|
||||
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
|
||||
$event_graph_by_criticity = $style['event_graph_by_criticity'];
|
||||
// Graph.
|
||||
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
|
||||
$event_graph_by_criticity = $style['event_graph_by_criticity'];
|
||||
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
|
||||
|
||||
$return['data'] = reporting_get_agents_detailed_event(
|
||||
|
@ -2825,6 +2840,13 @@ function reporting_event_report_agent(
|
|||
$metaconsole_dbtable = false;
|
||||
}
|
||||
|
||||
$label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($label != '') {
|
||||
$label = reporting_label_macro($content, $label);
|
||||
}
|
||||
|
||||
$return['label'] = $label;
|
||||
|
||||
if ($event_graph_by_user_validator) {
|
||||
$data_graph = events_get_count_events_validated_by_user(
|
||||
['id_agent' => $content['id_agent']],
|
||||
|
@ -2908,7 +2930,7 @@ function reporting_event_report_agent(
|
|||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
// total_events
|
||||
// Total events.
|
||||
if ($return['data'] != '') {
|
||||
$return['total_events'] = count($return['data']);
|
||||
} else {
|
||||
|
@ -2941,7 +2963,11 @@ function reporting_historical_data($report, $content)
|
|||
$return['subtitle'] = $agent_name.' - '.$module_name;
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($return['label'] != '') {
|
||||
$return['label'] = reporting_label_macro($content, $return['label']);
|
||||
}
|
||||
|
||||
$return['keys'] = [
|
||||
__('Date'),
|
||||
|
@ -3017,7 +3043,6 @@ function reporting_database_serialized($report, $content)
|
|||
$return['subtitle'] = $agent_name.' - '.$module_name;
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
|
||||
$keys = [];
|
||||
if (isset($content['header_definition']) && ($content['header_definition'] != '')) {
|
||||
|
@ -3043,6 +3068,11 @@ function reporting_database_serialized($report, $content)
|
|||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($return['label'] != '') {
|
||||
$return['label'] = reporting_label_macro($content, $return['label']);
|
||||
}
|
||||
|
||||
$datelimit = ($report['datetime'] - $content['period']);
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
|
@ -3589,7 +3619,12 @@ function reporting_alert_report_agent($report, $content)
|
|||
$return['subtitle'] = $agent_name;
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($return['label'] != '') {
|
||||
$return['label'] = reporting_label_macro($content, $return['label']);
|
||||
}
|
||||
|
||||
$module_list = agents_get_modules($content['id_agent']);
|
||||
|
||||
$data = [];
|
||||
|
@ -3721,6 +3756,9 @@ function reporting_alert_report_module($report, $content)
|
|||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($return['label'] != '') {
|
||||
$return['label'] = reporting_label_macro($content, $return['label']);
|
||||
}
|
||||
|
||||
$data_row = [];
|
||||
|
||||
|
@ -3923,7 +3961,6 @@ function reporting_monitor_report($report, $content)
|
|||
$return['subtitle'] = $agent_name.' - '.$module_name;
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
$id_meta = metaconsole_get_id_server($content['server_name']);
|
||||
|
@ -3932,6 +3969,11 @@ function reporting_monitor_report($report, $content)
|
|||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($return['label'] != '') {
|
||||
$return['label'] = reporting_label_macro($content, $return['label']);
|
||||
}
|
||||
|
||||
$module_name = io_safe_output(
|
||||
modules_get_agentmodule_name($content['id_agent_module'])
|
||||
);
|
||||
|
@ -5518,7 +5560,6 @@ function reporting_advanced_sla(
|
|||
} else if ($agentmodule_info['id_tipo_modulo'] == '100') {
|
||||
$max_value = 0.9;
|
||||
$min_value = 0;
|
||||
$inverse_interval = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7335,6 +7376,7 @@ function reporting_simple_graph(
|
|||
$report,
|
||||
$content
|
||||
);
|
||||
|
||||
$label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($label != '') {
|
||||
$label = reporting_label_macro($content, $label);
|
||||
|
@ -7346,7 +7388,7 @@ function reporting_simple_graph(
|
|||
|
||||
$return['chart'] = '';
|
||||
|
||||
// Get chart
|
||||
// Get chart.
|
||||
reporting_set_conf_charts($width, $height, $only_image, $type, $content, $ttl);
|
||||
|
||||
if (!empty($force_width_chart)) {
|
||||
|
@ -9457,13 +9499,23 @@ function reporting_get_agent_module_info($id_agent)
|
|||
/**
|
||||
* Print tiny statistics of the status of one agent, group, etc.
|
||||
*
|
||||
* @param mixed Array with the counts of the total modules, normal modules, critical modules, warning modules, unknown modules and fired alerts
|
||||
* @param bool return or echo flag
|
||||
* @param mixed $counts_info Array with the counts of the total modules,
|
||||
* normal modules, critical modules, warning modules, unknown modules and
|
||||
* fired alerts.
|
||||
* @param boolean $return Return or echo flag.
|
||||
* @param string $type agent or modules or ??.
|
||||
* @param string $separator Sepearator (classic view).
|
||||
* @param boolean $modern Use modern interfaces or old one.
|
||||
*
|
||||
* @return string html formatted tiny stats of modules/alerts of an agent
|
||||
* @return string HTML formatted tiny stats of modules/alerts of an agent.
|
||||
*/
|
||||
function reporting_tiny_stats($counts_info, $return=false, $type='agent', $separator=':', $strict_user=false)
|
||||
{
|
||||
function reporting_tiny_stats(
|
||||
$counts_info,
|
||||
$return=false,
|
||||
$type='agent',
|
||||
$separator=':',
|
||||
$modern=false
|
||||
) {
|
||||
global $config;
|
||||
|
||||
$out = '';
|
||||
|
@ -9580,37 +9632,74 @@ function reporting_tiny_stats($counts_info, $return=false, $type='agent', $separ
|
|||
$out .= html_print_div($params, true);
|
||||
}
|
||||
|
||||
// If total count is less than 0, is an error. Never show negative numbers
|
||||
// If total count is less than 0, is an error. Never show negative numbers.
|
||||
if ($total_count < 0) {
|
||||
$total_count = 0;
|
||||
}
|
||||
|
||||
$out .= '<b>'.'<span id="total_count_'.$uniq_id.'" class="forced_title" style="font-size: 7pt">'.$total_count.'</span>';
|
||||
if (isset($fired_count) && $fired_count > 0) {
|
||||
$out .= ' '.$separator.' <span class="orange forced_title" id="fired_count_'.$uniq_id.'" style="font-size: 7pt">'.$fired_count.'</span>';
|
||||
}
|
||||
if ($modern === true) {
|
||||
$out .= '<div id="bullets_modules">';
|
||||
// $out .='<span id="total_count_'.$uniq_id.'" class="forced_title" style="font-size: 13pt">'.$total_count.$separator.'</span>';
|
||||
if (isset($fired_count) && $fired_count > 0) {
|
||||
$out .= '<div><div id="fired_count_'.$uniq_id.'" class="forced_title bullet_modules orange_background"></div>';
|
||||
$out .= '<span style="font-size: 12pt">'.$fired_count.'</span></div>';
|
||||
}
|
||||
|
||||
if (isset($critical_count) && $critical_count > 0) {
|
||||
$out .= ' '.$separator.' <span class="red forced_title" id="critical_count_'.$uniq_id.'" style="font-size: 7pt">'.$critical_count.'</span>';
|
||||
}
|
||||
if (isset($critical_count) && $critical_count > 0) {
|
||||
$out .= '<div><div id="critical_count_'.$uniq_id.'" class="forced_title bullet_modules red_background"></div>';
|
||||
$out .= '<span style="font-size: 12pt">'.$critical_count.'</span></div>';
|
||||
}
|
||||
|
||||
if (isset($warning_count) && $warning_count > 0) {
|
||||
$out .= ' '.$separator.' <span class="yellow forced_title" id="warning_count_'.$uniq_id.'" style="font-size: 7pt">'.$warning_count.'</span>';
|
||||
}
|
||||
if (isset($warning_count) && $warning_count > 0) {
|
||||
$out .= '<div><div id="warning_count_'.$uniq_id.'" class="forced_title bullet_modules yellow_background"></div>';
|
||||
$out .= '<span style="font-size: 12pt">'.$warning_count.'</span></div>';
|
||||
}
|
||||
|
||||
if (isset($unknown_count) && $unknown_count > 0) {
|
||||
$out .= ' '.$separator.' <span class="grey forced_title" id="unknown_count_'.$uniq_id.'" style="font-size: 7pt">'.$unknown_count.'</span>';
|
||||
}
|
||||
if (isset($unknown_count) && $unknown_count > 0) {
|
||||
$out .= '<div><div id="unknown_count_'.$uniq_id.'" class="forced_title bullet_modules grey_background"></div>';
|
||||
$out .= '<span style="font-size: 12pt">'.$unknown_count.'</span></div>';
|
||||
}
|
||||
|
||||
if (isset($not_init_count) && $not_init_count > 0) {
|
||||
$out .= ' '.$separator.' <span class="blue forced_title" id="not_init_count_'.$uniq_id.'" style="font-size: 7pt">'.$not_init_count.'</span>';
|
||||
}
|
||||
if (isset($not_init_count) && $not_init_count > 0) {
|
||||
$out .= '<div><div id="not_init_count_'.$uniq_id.'" class="forced_title bullet_modules blue_background"></div>';
|
||||
$out .= '<span style="font-size: 12pt">'.$not_init_count.'</span></div>';
|
||||
}
|
||||
|
||||
if (isset($normal_count) && $normal_count > 0) {
|
||||
$out .= ' '.$separator.' <span class="green forced_title" id="normal_count_'.$uniq_id.'" style="font-size: 7pt">'.$normal_count.'</span>';
|
||||
}
|
||||
if (isset($normal_count) && $normal_count > 0) {
|
||||
$out .= '<div><div id="normal_count_'.$uniq_id.'" class="forced_title bullet_modules green_background"></div>';
|
||||
$out .= '<span style="font-size: 12pt">'.$normal_count.'</span></div>';
|
||||
}
|
||||
|
||||
$out .= '</b>';
|
||||
$out .= '</div>';
|
||||
} else {
|
||||
// Classic ones.
|
||||
$out .= '<b><span id="total_count_'.$uniq_id.'" class="forced_title" style="font-size: 7pt">'.$total_count.'</span>';
|
||||
if (isset($fired_count) && $fired_count > 0) {
|
||||
$out .= ' '.$separator.' <span class="orange forced_title" id="fired_count_'.$uniq_id.'" style="font-size: 7pt">'.$fired_count.'</span>';
|
||||
}
|
||||
|
||||
if (isset($critical_count) && $critical_count > 0) {
|
||||
$out .= ' '.$separator.' <span class="red forced_title" id="critical_count_'.$uniq_id.'" style="font-size: 7pt">'.$critical_count.'</span>';
|
||||
}
|
||||
|
||||
if (isset($warning_count) && $warning_count > 0) {
|
||||
$out .= ' '.$separator.' <span class="yellow forced_title" id="warning_count_'.$uniq_id.'" style="font-size: 7pt">'.$warning_count.'</span>';
|
||||
}
|
||||
|
||||
if (isset($unknown_count) && $unknown_count > 0) {
|
||||
$out .= ' '.$separator.' <span class="grey forced_title" id="unknown_count_'.$uniq_id.'" style="font-size: 7pt">'.$unknown_count.'</span>';
|
||||
}
|
||||
|
||||
if (isset($not_init_count) && $not_init_count > 0) {
|
||||
$out .= ' '.$separator.' <span class="blue forced_title" id="not_init_count_'.$uniq_id.'" style="font-size: 7pt">'.$not_init_count.'</span>';
|
||||
}
|
||||
|
||||
if (isset($normal_count) && $normal_count > 0) {
|
||||
$out .= ' '.$separator.' <span class="green forced_title" id="normal_count_'.$uniq_id.'" style="font-size: 7pt">'.$normal_count.'</span>';
|
||||
}
|
||||
|
||||
$out .= '</b>';
|
||||
}
|
||||
|
||||
if ($return) {
|
||||
return $out;
|
||||
|
|
|
@ -41,13 +41,24 @@ $nfdump_date_format = 'Y/m/d.H:i:s';
|
|||
|
||||
|
||||
/**
|
||||
* Selects all netflow filters (array (id_name => id_name)) or filters filtered
|
||||
* Generates a Tree with given $tree information.
|
||||
*
|
||||
* @param tree string SNMP tree returned by snmp_broser_get_tree.
|
||||
* @param id string Level ID. Do not set, used for recursion.
|
||||
* @param depth string Branch depth. Do not set, used for recursion.
|
||||
* Selects all netflow filters (array (id_name => id_name)) or filters filtered
|
||||
* Used also in Cloud Wizard.
|
||||
*
|
||||
* @param string $tree SNMP tree returned by snmp_broser_get_tree.
|
||||
* @param string $id Level ID. Do not set, used for recursion.
|
||||
* @param string $depth Branch depth. Do not set, used for recursion.
|
||||
* @param integer $last Last.
|
||||
* @param array $last_array Last_array.
|
||||
* @param string $sufix Sufix.
|
||||
* @param array $checked Checked.
|
||||
* @param boolean $descriptive_ids Descriptive_ids.
|
||||
* @param string $previous_id Previous_id.
|
||||
*
|
||||
* @return string HTML code with complete tree.
|
||||
*/
|
||||
function snmp_browser_print_tree(
|
||||
function snmp_browser_get_html_tree(
|
||||
$tree,
|
||||
$id=0,
|
||||
$depth=0,
|
||||
|
@ -55,7 +66,6 @@ function snmp_browser_print_tree(
|
|||
$last_array=[],
|
||||
$sufix=false,
|
||||
$checked=[],
|
||||
$return=false,
|
||||
$descriptive_ids=false,
|
||||
$previous_id=''
|
||||
) {
|
||||
|
@ -70,17 +80,17 @@ function snmp_browser_print_tree(
|
|||
|
||||
// Leaf.
|
||||
if (empty($tree['__LEAVES__'])) {
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
$total = (sizeof(array_keys($tree['__LEAVES__'])) - 1);
|
||||
$total = (count(array_keys($tree['__LEAVES__'])) - 1);
|
||||
$last_array[$depth] = $last;
|
||||
|
||||
if ($depth > 0) {
|
||||
$output .= "<ul id='ul_$id' style='margin: 0; padding: 0; display: none'>\n";
|
||||
$output .= '<ul id="ul_'.$id.'" style="margin: 0; padding: 0; display: none;">';
|
||||
} else {
|
||||
$output .= "<ul id='ul_$id' style='margin: 0; padding: 0;'>\n";
|
||||
$output .= '<ul id="ul_'.$id.'" style="margin: 0; padding: 0;">';
|
||||
}
|
||||
|
||||
foreach ($tree['__LEAVES__'] as $level => $sub_level) {
|
||||
|
@ -88,7 +98,7 @@ function snmp_browser_print_tree(
|
|||
$sub_id = time().rand(0, getrandmax());
|
||||
|
||||
// Display the branch.
|
||||
$output .= "<li id='li_$sub_id' style='margin: 0; padding: 0;'>";
|
||||
$output .= '<li id="li_'.$sub_id.'" style="margin: 0; padding: 0;">';
|
||||
|
||||
// Indent sub branches.
|
||||
for ($i = 1; $i <= $depth; $i++) {
|
||||
|
@ -156,11 +166,11 @@ function snmp_browser_print_tree(
|
|||
$output .= '</li>';
|
||||
|
||||
// Recursively print sub levels.
|
||||
$output .= snmp_browser_print_tree(
|
||||
$output .= snmp_browser_get_html_tree(
|
||||
$sub_level,
|
||||
$sub_id,
|
||||
($depth + 1),
|
||||
($count == $total ? 1 : 0),
|
||||
(($count == $total) ? 1 : 0),
|
||||
$last_array,
|
||||
$sufix,
|
||||
$checked,
|
||||
|
@ -174,11 +184,57 @@ function snmp_browser_print_tree(
|
|||
|
||||
$output .= '</ul>';
|
||||
|
||||
if ($return == false) {
|
||||
echo $output;
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects all netflow filters (array (id_name => id_name)) or filters filtered
|
||||
* This function is also being used while painting instances in AWS Cloud wiz.
|
||||
*
|
||||
* @param string $tree SNMP tree returned by snmp_broser_get_tree.
|
||||
* @param string $id Level ID. Do not set, used for recursion.
|
||||
* @param string $depth Branch depth. Do not set, used for recursion.
|
||||
* @param integer $last Last.
|
||||
* @param array $last_array Last_array.
|
||||
* @param string $sufix Sufix.
|
||||
* @param array $checked Checked.
|
||||
* @param boolean $return Return.
|
||||
* @param boolean $descriptive_ids Descriptive_ids.
|
||||
* @param string $previous_id Previous_id.
|
||||
*
|
||||
* @return string HTML code with complete tree.
|
||||
*/
|
||||
function snmp_browser_print_tree(
|
||||
$tree,
|
||||
$id=0,
|
||||
$depth=0,
|
||||
$last=0,
|
||||
$last_array=[],
|
||||
$sufix=false,
|
||||
$checked=[],
|
||||
$return=false,
|
||||
$descriptive_ids=false,
|
||||
$previous_id=''
|
||||
) {
|
||||
$str = snmp_browser_get_html_tree(
|
||||
$tree,
|
||||
$id,
|
||||
$depth,
|
||||
$last,
|
||||
$last_array,
|
||||
$sufix,
|
||||
$checked,
|
||||
$return,
|
||||
$descriptive_ids,
|
||||
$previous_id
|
||||
);
|
||||
|
||||
if ($return === false) {
|
||||
echo $str;
|
||||
}
|
||||
|
||||
return $output;
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
|
@ -695,11 +751,32 @@ function snmp_browser_print_container($return=false, $width='100%', $height='500
|
|||
$table->data = [];
|
||||
|
||||
$table->data[0][0] = '<strong>'.__('Target IP').'</strong> ';
|
||||
$table->data[0][0] .= html_print_input_text('target_ip', '', '', 25, 0, true);
|
||||
$table->data[0][0] .= html_print_input_text(
|
||||
'target_ip',
|
||||
get_parameter('target_ip', ''),
|
||||
'',
|
||||
25,
|
||||
0,
|
||||
true
|
||||
);
|
||||
$table->data[0][1] = '<strong>'.__('Community').'</strong> ';
|
||||
$table->data[0][1] .= html_print_input_text('community', '', '', 25, 0, true);
|
||||
$table->data[0][1] .= html_print_input_text(
|
||||
'community',
|
||||
get_parameter('community', ''),
|
||||
'',
|
||||
25,
|
||||
0,
|
||||
true
|
||||
);
|
||||
$table->data[0][2] = '<strong>'.__('Starting OID').'</strong> ';
|
||||
$table->data[0][2] .= html_print_input_text('starting_oid', '.1.3.6.1.2', '', 25, 0, true);
|
||||
$table->data[0][2] .= html_print_input_text(
|
||||
'starting_oid',
|
||||
get_parameter('starting_oid', '.1.3.6.1.2'),
|
||||
'',
|
||||
25,
|
||||
0,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[1][0] = '<strong>'.__('Version').'</strong> ';
|
||||
$table->data[1][0] .= html_print_select(
|
||||
|
@ -710,7 +787,7 @@ function snmp_browser_print_container($return=false, $width='100%', $height='500
|
|||
'3' => 'v. 3',
|
||||
],
|
||||
'snmp_browser_version',
|
||||
'',
|
||||
get_parameter('snmp_browser_version', '2c'),
|
||||
'checkSNMPVersion();',
|
||||
'',
|
||||
'',
|
||||
|
|
|
@ -865,50 +865,63 @@ function show_newsletter_wizard() {
|
|||
var language = $("#language").val();
|
||||
var email_identification = $("#text-email-newsletter").val();
|
||||
|
||||
jQuery.post (
|
||||
"ajax.php",
|
||||
{
|
||||
"page": "general/register",
|
||||
"register_newsletter": 1,
|
||||
"email": email_identification
|
||||
},
|
||||
function (data) {
|
||||
cl = '';
|
||||
msg = 'no response';
|
||||
|
||||
try {
|
||||
json = JSON.parse(data);
|
||||
cl = json.status
|
||||
msg = json.message;
|
||||
|
||||
} catch (error) {
|
||||
msg = 'Failed: ' + error;
|
||||
cl = 'error';
|
||||
}
|
||||
|
||||
if (!cl || cl == 'error') {
|
||||
cl = 'error';
|
||||
} else {
|
||||
// Success.
|
||||
}
|
||||
|
||||
$('#news_result_content').html(msg);
|
||||
$('#news_result').addClass(cl);
|
||||
$('#news_result').dialog({
|
||||
buttons: {
|
||||
'Ok': function() {
|
||||
$(this).dialog('close');
|
||||
$("#newsletter_wizard").dialog('close');
|
||||
<?php
|
||||
if (isset($callback) && $callback != '') {
|
||||
echo $callback;
|
||||
}
|
||||
?>
|
||||
}
|
||||
if (email_identification == '') {
|
||||
msg = '<?php echo __('You must specify an email'); ?>';
|
||||
$('#news_result_content').html(msg);
|
||||
$('#news_result').dialog({
|
||||
buttons: {
|
||||
'Ok': function() {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
jQuery.post (
|
||||
"ajax.php",
|
||||
{
|
||||
"page": "general/register",
|
||||
"register_newsletter": 1,
|
||||
"email": email_identification
|
||||
},
|
||||
function (data) {
|
||||
cl = '';
|
||||
msg = 'no response';
|
||||
|
||||
try {
|
||||
json = JSON.parse(data);
|
||||
cl = json.status
|
||||
msg = json.message;
|
||||
|
||||
} catch (error) {
|
||||
msg = 'Failed: ' + error;
|
||||
cl = 'error';
|
||||
}
|
||||
|
||||
if (!cl || cl == 'error') {
|
||||
cl = 'error';
|
||||
} else {
|
||||
// Success.
|
||||
}
|
||||
|
||||
$('#news_result_content').html(msg);
|
||||
$('#news_result').addClass(cl);
|
||||
$('#news_result').dialog({
|
||||
buttons: {
|
||||
'Ok': function() {
|
||||
$(this).dialog('close');
|
||||
$("#newsletter_wizard").dialog('close');
|
||||
<?php
|
||||
if (isset($callback) && $callback != '') {
|
||||
echo $callback;
|
||||
}
|
||||
?>
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -955,6 +968,8 @@ function update_manager_get_config_values()
|
|||
global $build_version;
|
||||
global $pandora_version;
|
||||
|
||||
enterprise_include_once('include/functions_license.php');
|
||||
|
||||
$license = db_get_value(
|
||||
db_escape_key_identifier('value'),
|
||||
'tupdate_settings',
|
||||
|
@ -962,7 +977,13 @@ function update_manager_get_config_values()
|
|||
'customer_key'
|
||||
);
|
||||
|
||||
$limit_count = db_get_value_sql('SELECT count(*) FROM tagente');
|
||||
$data = enterprise_hook('license_get_info');
|
||||
|
||||
if ($data === ENTERPRISE_NOT_HOOK) {
|
||||
$limit_count = db_get_value_sql('SELECT count(*) FROM tagente');
|
||||
} else {
|
||||
$limit_count = $data['count_enabled'];
|
||||
}
|
||||
|
||||
return [
|
||||
'license' => $license,
|
||||
|
@ -1211,7 +1232,7 @@ function update_manager_check_online_free_packages_available()
|
|||
];
|
||||
|
||||
$curlObj = curl_init();
|
||||
curl_setopt($curlObj, CURLOPT_URL, $config['url_update_manager']);
|
||||
curl_setopt($curlObj, CURLOPT_URL, get_um_url().'server.php');
|
||||
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curlObj, CURLOPT_POST, true);
|
||||
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $params);
|
||||
|
@ -1285,7 +1306,7 @@ function update_manager_check_online_free_packages($is_ajax=true)
|
|||
*/
|
||||
|
||||
$curlObj = curl_init();
|
||||
curl_setopt($curlObj, CURLOPT_URL, $config['url_update_manager']);
|
||||
curl_setopt($curlObj, CURLOPT_URL, get_um_url().'server.php');
|
||||
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curlObj, CURLOPT_POST, true);
|
||||
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $params);
|
||||
|
@ -1436,7 +1457,7 @@ function update_manager_curl_request($action, $additional_params=false)
|
|||
$params['action'] = $action;
|
||||
|
||||
$curlObj = curl_init();
|
||||
curl_setopt($curlObj, CURLOPT_URL, $config['url_update_manager']);
|
||||
curl_setopt($curlObj, CURLOPT_URL, get_um_url().'server.php');
|
||||
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curlObj, CURLOPT_POST, true);
|
||||
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $params);
|
||||
|
@ -1562,15 +1583,20 @@ function update_manager_register_instance()
|
|||
global $config;
|
||||
|
||||
$email = db_get_value('email', 'tusuario', 'id_user', $config['id_user']);
|
||||
|
||||
$um_config_values = update_manager_get_config_values();
|
||||
|
||||
$params = [
|
||||
'language' => $config['language'],
|
||||
'timezone' => $config['timezone'],
|
||||
'email' => $email,
|
||||
'license' => db_get_value_filter(
|
||||
'value',
|
||||
'tupdate_settings',
|
||||
['key' => 'customer_key']
|
||||
),
|
||||
'action' => 'newest_package',
|
||||
'license' => $um_config_values['license'],
|
||||
'limit_count' => $um_config_values['limit_count'],
|
||||
'current_package' => $um_config_values['current_update'],
|
||||
'version' => $um_config_values['version'],
|
||||
'build' => $um_config_values['build'],
|
||||
'puid' => $um_config_values['puid'],
|
||||
'email' => $email,
|
||||
'language' => $config['language'],
|
||||
'timezone' => $config['timezone'],
|
||||
];
|
||||
|
||||
$result = update_manager_curl_request('new_register', $params);
|
||||
|
|
|
@ -1128,9 +1128,58 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background)
|
|||
true
|
||||
).'</td>';
|
||||
|
||||
// Insert and modify before the buttons to create or update.
|
||||
if (!$config['legacy_vc']) {
|
||||
$intervals = [
|
||||
10 => '10 '.__('seconds'),
|
||||
30 => '30 '.__('seconds'),
|
||||
60 => '1 '.__('minutes'),
|
||||
300 => '5 '.__('minutes'),
|
||||
900 => '15 '.__('minutes'),
|
||||
1800 => '30 '.__('minutes'),
|
||||
3600 => '1 '.__('hour'),
|
||||
];
|
||||
|
||||
$form_items_advance['cache_expiration_row'] = [];
|
||||
$form_items_advance['cache_expiration_row']['items'] = [
|
||||
'static_graph',
|
||||
'percentile_bar',
|
||||
'percentile_item',
|
||||
'module_graph',
|
||||
'simple_value',
|
||||
'datos',
|
||||
'auto_sla_graph',
|
||||
'group_item',
|
||||
'bars_graph',
|
||||
'donut_graph',
|
||||
'color_cloud',
|
||||
'service',
|
||||
];
|
||||
$form_items_advance['cache_expiration_row']['html'] = '<td align="left">';
|
||||
$form_items_advance['cache_expiration_row']['html'] .= __('Cache expiration');
|
||||
$form_items_advance['cache_expiration_row']['html'] .= '</td>';
|
||||
$form_items_advance['cache_expiration_row']['html'] .= '<td align="left">';
|
||||
$form_items_advance['cache_expiration_row']['html'] .= html_print_extended_select_for_time(
|
||||
'cache_expiration',
|
||||
$config['vc_default_cache_expiration'],
|
||||
'',
|
||||
__('No cache'),
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
$intervals
|
||||
);
|
||||
$form_items_advance['cache_expiration_row']['html'] .= '</td>';
|
||||
}
|
||||
|
||||
// Insert and modify before the buttons to create or update.
|
||||
if (enterprise_installed()) {
|
||||
enterprise_visual_map_editor_modify_form_items_advance_palette($form_items_advance);
|
||||
enterprise_visual_map_editor_modify_form_items_advance_palette(
|
||||
$form_items_advance
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($form_items_advance as $item => $item_options) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* global $ */
|
||||
|
||||
function pandoraFlotPie(
|
||||
graph_id,
|
||||
values,
|
||||
|
@ -1074,7 +1076,6 @@ function pandoraFlotArea(
|
|||
.split(".")
|
||||
.shift();
|
||||
var width = params.width;
|
||||
var height = params.height;
|
||||
var vconsole = params.vconsole;
|
||||
var dashboard = params.dashboard;
|
||||
var menu = params.menu;
|
||||
|
@ -1088,9 +1089,8 @@ function pandoraFlotArea(
|
|||
var background_color = params.backgroundColor;
|
||||
var legend_color = params.legend_color;
|
||||
var update_legend = {};
|
||||
|
||||
//XXXXXX colocar
|
||||
var force_integer = 0;
|
||||
var title = params.title;
|
||||
|
||||
if (typeof type === "undefined" || type == "") {
|
||||
type = params.type_graph;
|
||||
|
@ -1105,8 +1105,6 @@ function pandoraFlotArea(
|
|||
var red_up = parseFloat(data_module_graph.c_max);
|
||||
var yellow_inverse = parseInt(data_module_graph.w_inv);
|
||||
var red_inverse = parseInt(data_module_graph.c_inv);
|
||||
|
||||
//XXXXX
|
||||
var markins_graph = true;
|
||||
|
||||
// If threshold and up are the same, that critical or warning is disabled
|
||||
|
@ -1934,11 +1932,12 @@ function pandoraFlotArea(
|
|||
}
|
||||
}
|
||||
|
||||
var stacked = null;
|
||||
var filled_s = 0.3;
|
||||
|
||||
switch (type) {
|
||||
case "line":
|
||||
case 2:
|
||||
stacked = null;
|
||||
filled_s = false;
|
||||
break;
|
||||
case 3:
|
||||
stacked = "stack";
|
||||
|
@ -1960,7 +1959,15 @@ function pandoraFlotArea(
|
|||
var data_base = new Array();
|
||||
var lineWidth = $("#hidden-line_width_graph").val() || 1;
|
||||
|
||||
i = 0;
|
||||
var i = 0;
|
||||
var fill_color = "green";
|
||||
var line_show = true;
|
||||
var points_show = false;
|
||||
var filled = false;
|
||||
var steps_chart = false;
|
||||
var radius = false;
|
||||
var fill_points = fill_color;
|
||||
|
||||
$.each(values, function(index, value) {
|
||||
if (typeof value.data !== "undefined") {
|
||||
if (index.search("alert") >= 0) {
|
||||
|
@ -1974,7 +1981,7 @@ function pandoraFlotArea(
|
|||
switch (series_type[index]) {
|
||||
case "area":
|
||||
line_show = true;
|
||||
points_show = false; // XXX - false
|
||||
points_show = false;
|
||||
filled = filled_s;
|
||||
steps_chart = false;
|
||||
radius = false;
|
||||
|
@ -1995,7 +2002,7 @@ function pandoraFlotArea(
|
|||
points_show = true;
|
||||
filled = false;
|
||||
steps_chart = false;
|
||||
radius = 1.5;
|
||||
radius = 3;
|
||||
fill_points = fill_color;
|
||||
break;
|
||||
case "unknown":
|
||||
|
@ -2033,7 +2040,7 @@ function pandoraFlotArea(
|
|||
},
|
||||
points: {
|
||||
show: points_show,
|
||||
radius: 3,
|
||||
radius: radius,
|
||||
fillColor: fill_points
|
||||
},
|
||||
legend: legend.index
|
||||
|
@ -2051,7 +2058,8 @@ function pandoraFlotArea(
|
|||
number_ticks = 5;
|
||||
}
|
||||
|
||||
var maxticks = date_array["period"] / 3600 / number_ticks;
|
||||
// masticks this variable is commented because the library defines the tick number by itself
|
||||
// var maxticks = date_array["period"] / 3600 / number_ticks;
|
||||
|
||||
var options = {
|
||||
series: {
|
||||
|
@ -2125,16 +2133,11 @@ function pandoraFlotArea(
|
|||
options.selection = false;
|
||||
}
|
||||
|
||||
var stack = 0,
|
||||
bars = true,
|
||||
lines = false,
|
||||
steps = false;
|
||||
|
||||
var plot = $.plot($("#" + graph_id), datas, options);
|
||||
|
||||
// Re-calculate the graph height with the legend height
|
||||
if (dashboard) {
|
||||
$acum = 0;
|
||||
var $acum = 0;
|
||||
if (dashboard) $acum = 35;
|
||||
var hDiff =
|
||||
$("#" + graph_id).height() - $("#legend_" + graph_id).height() - $acum;
|
||||
|
@ -2143,22 +2146,12 @@ function pandoraFlotArea(
|
|||
navigator.userAgent
|
||||
)
|
||||
) {
|
||||
// not defined.???
|
||||
} else {
|
||||
$("#" + graph_id).css("height", hDiff);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
//XXXREvisar esto
|
||||
if (vconsole) {
|
||||
var myCanvas = plot.getCanvas();
|
||||
plot.setupGrid(); // redraw plot to new size
|
||||
plot.draw();
|
||||
var image = myCanvas.toDataURL("image/png");
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
// Adjust the overview plot to the width and position of the main plot
|
||||
adjust_left_width_canvas(graph_id, "overview_" + graph_id);
|
||||
update_left_width_canvas(graph_id);
|
||||
|
@ -2251,7 +2244,7 @@ function pandoraFlotArea(
|
|||
return;
|
||||
}
|
||||
|
||||
dataInSelection = ranges.xaxis.to - ranges.xaxis.from;
|
||||
var dataInSelection = ranges.xaxis.to - ranges.xaxis.from;
|
||||
|
||||
var maxticks_zoom = dataInSelection / 3600000 / number_ticks;
|
||||
if (maxticks_zoom < 0.001) {
|
||||
|
@ -2261,8 +2254,9 @@ function pandoraFlotArea(
|
|||
}
|
||||
}
|
||||
|
||||
var y_recal = "";
|
||||
if (thresholded) {
|
||||
var y_recal = axis_thresholded(
|
||||
y_recal = axis_thresholded(
|
||||
threshold_data,
|
||||
plot.getAxes().yaxis.min,
|
||||
plot.getAxes().yaxis.max,
|
||||
|
@ -2271,11 +2265,11 @@ function pandoraFlotArea(
|
|||
red_up
|
||||
);
|
||||
} else {
|
||||
var y_recal = ranges.yaxis;
|
||||
y_recal = ranges.yaxis;
|
||||
}
|
||||
|
||||
if (thresholded) {
|
||||
data_base_treshold = add_threshold(
|
||||
var data_base_treshold = add_threshold(
|
||||
data_base,
|
||||
threshold_data,
|
||||
ranges.yaxis.from,
|
||||
|
@ -2400,7 +2394,6 @@ function pandoraFlotArea(
|
|||
var updateLegendTimeout = null;
|
||||
var latestPosition = null;
|
||||
var currentPlot = null;
|
||||
var currentRanges = null;
|
||||
|
||||
// Update legend with the data of the plot in the mouse position
|
||||
function updateLegend() {
|
||||
|
@ -2434,7 +2427,7 @@ function pandoraFlotArea(
|
|||
"Dec"
|
||||
];
|
||||
|
||||
date_format =
|
||||
var date_format =
|
||||
(d.getDate() < 10 ? "0" : "") +
|
||||
d.getDate() +
|
||||
" " +
|
||||
|
@ -2455,7 +2448,7 @@ function pandoraFlotArea(
|
|||
|
||||
var timesize = $("#timestamp_" + graph_id).width();
|
||||
|
||||
dataset = currentPlot.getData();
|
||||
var dataset = currentPlot.getData();
|
||||
|
||||
var timenewpos =
|
||||
dataset[0].xaxis.p2c(pos.x) +
|
||||
|
@ -2481,9 +2474,8 @@ function pandoraFlotArea(
|
|||
$("#timestamp_" + graph_id).css("left", timenewpos);
|
||||
}
|
||||
|
||||
var dataset = currentPlot.getData();
|
||||
var i = 0;
|
||||
for (k = 0; k < dataset.length; k++) {
|
||||
for (var k = 0; k < dataset.length; k++) {
|
||||
// k is the real series counter
|
||||
// i is the series counter without thresholds
|
||||
var series = dataset[k];
|
||||
|
@ -2492,7 +2484,7 @@ function pandoraFlotArea(
|
|||
}
|
||||
|
||||
// find the nearest points, x-wise
|
||||
for (j = 0; j < series.data.length; ++j) {
|
||||
for (var j = 0; j < series.data.length; ++j) {
|
||||
if (series.data[j][0] > pos.x) {
|
||||
break;
|
||||
}
|
||||
|
@ -2503,10 +2495,10 @@ function pandoraFlotArea(
|
|||
}
|
||||
}
|
||||
|
||||
y_array = format_unit_yaxes(y);
|
||||
var y_array = format_unit_yaxes(y);
|
||||
|
||||
y = y_array["y"];
|
||||
how_bigger = y_array["unit"];
|
||||
var how_bigger = y_array["unit"];
|
||||
|
||||
var data_legend = [];
|
||||
|
||||
|
@ -2516,8 +2508,9 @@ function pandoraFlotArea(
|
|||
series_type[dataset[k]["label"]] != "unknown" &&
|
||||
series_type[dataset[k]["label"]] != "percentil"
|
||||
) {
|
||||
var label_aux = "";
|
||||
if (Object.keys(update_legend).length == 0) {
|
||||
var label_aux = legend[series.label];
|
||||
label_aux = legend[series.label];
|
||||
|
||||
$("#legend_" + graph_id + " .legendLabel")
|
||||
.eq(i)
|
||||
|
@ -2532,6 +2525,16 @@ function pandoraFlotArea(
|
|||
unit
|
||||
);
|
||||
} else {
|
||||
var min_y_array;
|
||||
var min_y = 0;
|
||||
var min_bigger = "";
|
||||
var max_y_array;
|
||||
var max_y = 0;
|
||||
var max_bigger = "";
|
||||
var avg_y_array;
|
||||
var avg_y = 0;
|
||||
var avg_bigger = "";
|
||||
|
||||
$.each(update_legend, function(index, value) {
|
||||
if (!value[x]) {
|
||||
x = x + 1;
|
||||
|
@ -2581,7 +2584,7 @@ function pandoraFlotArea(
|
|||
avg_bigger;
|
||||
});
|
||||
|
||||
var label_aux =
|
||||
label_aux =
|
||||
legend[series.label].split(":")[0] + data_legend[series.label];
|
||||
$("#legend_" + graph_id + " .legendLabel")
|
||||
.eq(i)
|
||||
|
@ -2604,7 +2607,7 @@ function pandoraFlotArea(
|
|||
}
|
||||
|
||||
// Events
|
||||
$("#overview_" + graph_id).bind("plothover", function(event, pos, item) {
|
||||
$("#overview_" + graph_id).bind("plothover", function(event, pos) {
|
||||
plot.setCrosshair({ x: pos.x, y: pos.y });
|
||||
currentPlot = plot;
|
||||
latestPosition = pos;
|
||||
|
@ -2613,7 +2616,7 @@ function pandoraFlotArea(
|
|||
}
|
||||
});
|
||||
|
||||
$("#" + graph_id).bind("plothover", function(event, pos, item) {
|
||||
$("#" + graph_id).bind("plothover", function(event, pos) {
|
||||
overview.setCrosshair({ x: pos.x, y: pos.y });
|
||||
currentPlot = plot;
|
||||
latestPosition = pos;
|
||||
|
@ -2636,7 +2639,6 @@ function pandoraFlotArea(
|
|||
$("#extra_" + graph_id).css("width", "170px");
|
||||
$("#extra_" + graph_id).css("height", "60px");
|
||||
|
||||
var dataset = plot.getData();
|
||||
var extra_info = "<i>No info to show</i>";
|
||||
var extra_show = false;
|
||||
var extra_height = $("#extra_" + graph_id).height();
|
||||
|
@ -2657,8 +2659,6 @@ function pandoraFlotArea(
|
|||
coord_x = coord_x - extra_width;
|
||||
}
|
||||
|
||||
var coord_y = offset_graph.top + height_legend + extra_height;
|
||||
|
||||
$("#extra_" + graph_id).css("left", coord_x);
|
||||
$("#extra_" + graph_id).css("top", coord_y);
|
||||
|
||||
|
@ -2677,21 +2677,22 @@ function pandoraFlotArea(
|
|||
});
|
||||
});
|
||||
|
||||
var extra_color = "#ffffff";
|
||||
if (events_data.event_type.search("alert") >= 0) {
|
||||
$extra_color = "#FFA631";
|
||||
extra_color = "#FFA631";
|
||||
} else if (events_data.event_type.search("critical") >= 0) {
|
||||
$extra_color = "#FC4444";
|
||||
extra_color = "#FC4444";
|
||||
} else if (events_data.event_type.search("warning") >= 0) {
|
||||
$extra_color = "#FAD403";
|
||||
extra_color = "#FAD403";
|
||||
} else if (events_data.event_type.search("unknown") >= 0) {
|
||||
$extra_color = "#3BA0FF";
|
||||
extra_color = "#3BA0FF";
|
||||
} else if (events_data.event_type.search("normal") >= 0) {
|
||||
$extra_color = "#80BA27";
|
||||
extra_color = "#80BA27";
|
||||
} else {
|
||||
$extra_color = "#ffffff";
|
||||
extra_color = "#ffffff";
|
||||
}
|
||||
|
||||
$("#extra_" + graph_id).css("background-color", $extra_color);
|
||||
$("#extra_" + graph_id).css("background-color", extra_color);
|
||||
|
||||
extra_info = "<b>" + events_data.evento + ":";
|
||||
extra_info +=
|
||||
|
@ -2717,9 +2718,10 @@ function pandoraFlotArea(
|
|||
}
|
||||
|
||||
if (image_treshold) {
|
||||
var y_recal = plot.getAxes().yaxis.max;
|
||||
if (!thresholded) {
|
||||
// Recalculate the y axis
|
||||
var y_recal = axis_thresholded(
|
||||
y_recal = axis_thresholded(
|
||||
threshold_data,
|
||||
plot.getAxes().yaxis.min,
|
||||
plot.getAxes().yaxis.max,
|
||||
|
@ -2727,11 +2729,9 @@ function pandoraFlotArea(
|
|||
extremes,
|
||||
red_up
|
||||
);
|
||||
} else {
|
||||
var y_recal = plot.getAxes().yaxis.max;
|
||||
}
|
||||
|
||||
datas_treshold = add_threshold(
|
||||
var datas_treshold = add_threshold(
|
||||
data_base,
|
||||
threshold_data,
|
||||
plot.getAxes().yaxis.min,
|
||||
|
@ -2762,7 +2762,7 @@ function pandoraFlotArea(
|
|||
// Reset interactivity styles
|
||||
function resetInteractivity() {
|
||||
$("#timestamp_" + graph_id).hide();
|
||||
dataset = plot.getData();
|
||||
var dataset = plot.getData();
|
||||
for (i = 0; i < dataset.length; ++i) {
|
||||
var series = dataset[i];
|
||||
var label_aux = legend[series.label];
|
||||
|
@ -2784,15 +2784,14 @@ function pandoraFlotArea(
|
|||
overview.clearCrosshair();
|
||||
}
|
||||
|
||||
function yFormatter(v, axis) {
|
||||
function yFormatter(v) {
|
||||
var formatted = v;
|
||||
if (short_data) {
|
||||
var formatted = number_format(v, force_integer, "", short_data);
|
||||
formatted = number_format(v, force_integer, "", short_data);
|
||||
} else {
|
||||
// It is an integer
|
||||
if (v - Math.floor(v) == 0) {
|
||||
var formatted = number_format(v, force_integer, "", 2);
|
||||
} else {
|
||||
var formatted = v;
|
||||
formatted = number_format(v, force_integer, "", 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2801,7 +2800,7 @@ function pandoraFlotArea(
|
|||
return formatted;
|
||||
}
|
||||
|
||||
function lFormatter(v, item) {
|
||||
function lFormatter(v) {
|
||||
return '<span style="color:' + legend_color + '">' + legend[v] + "</span>";
|
||||
}
|
||||
|
||||
|
@ -2858,9 +2857,10 @@ function pandoraFlotArea(
|
|||
);
|
||||
thresholded = false;
|
||||
} else {
|
||||
var y_recal = plot.getAxes().yaxis.max;
|
||||
if (!thresholded) {
|
||||
// Recalculate the y axis
|
||||
var y_recal = axis_thresholded(
|
||||
y_recal = axis_thresholded(
|
||||
threshold_data,
|
||||
plot.getAxes().yaxis.min,
|
||||
plot.getAxes().yaxis.max,
|
||||
|
@ -2868,8 +2868,6 @@ function pandoraFlotArea(
|
|||
extremes,
|
||||
red_up
|
||||
);
|
||||
} else {
|
||||
var y_recal = plot.getAxes().yaxis.max;
|
||||
}
|
||||
|
||||
datas_treshold = add_threshold(
|
||||
|
@ -2917,7 +2915,6 @@ function pandoraFlotArea(
|
|||
homeurl + "images/zoom_cross.disabled.png"
|
||||
);
|
||||
overview.clearSelection();
|
||||
currentRanges = null;
|
||||
thresholded = false;
|
||||
max_draw = [];
|
||||
});
|
||||
|
@ -2932,7 +2929,6 @@ function pandoraFlotArea(
|
|||
|
||||
// Add bottom margin in the legend
|
||||
// Estimated height of 24 (works fine with this data in all browsers)
|
||||
menu_height = 24;
|
||||
$("#legend_" + graph_id).css("margin-bottom", "10px");
|
||||
parent_height = parseInt(
|
||||
$("#menu_" + graph_id)
|
||||
|
@ -2979,6 +2975,7 @@ function format_unit_yaxes(y) {
|
|||
}
|
||||
|
||||
function adjust_menu(graph_id, plot, parent_height, width, show_legend) {
|
||||
var left_ticks_width = 0;
|
||||
if (
|
||||
$("#" + graph_id + " .xAxis .tickLabel")
|
||||
.eq(0)
|
||||
|
@ -2988,14 +2985,11 @@ function adjust_menu(graph_id, plot, parent_height, width, show_legend) {
|
|||
.eq(0)
|
||||
.css("width")
|
||||
.split("px")[0];
|
||||
} else {
|
||||
left_ticks_width = 0;
|
||||
}
|
||||
|
||||
var parent_height_new = 0;
|
||||
|
||||
var legend_height = 0;
|
||||
if (show_legend) {
|
||||
var legend_height =
|
||||
legend_height =
|
||||
parseInt(
|
||||
$("#legend_" + graph_id)
|
||||
.css("height")
|
||||
|
@ -3006,12 +3000,9 @@ function adjust_menu(graph_id, plot, parent_height, width, show_legend) {
|
|||
.css("margin-top")
|
||||
.split("px")[0]
|
||||
);
|
||||
} else {
|
||||
var legend_height = 0;
|
||||
}
|
||||
|
||||
var menu_height = "25";
|
||||
|
||||
if (
|
||||
$("#menu_" + graph_id).height() != undefined &&
|
||||
$("#menu_" + graph_id).height() > 20
|
||||
|
@ -3019,7 +3010,7 @@ function adjust_menu(graph_id, plot, parent_height, width, show_legend) {
|
|||
menu_height = $("#menu_" + graph_id).height();
|
||||
}
|
||||
|
||||
offset = $("#" + graph_id)[0].offsetTop;
|
||||
var offset = $("#" + graph_id)[0].offsetTop;
|
||||
|
||||
$("#menu_" + graph_id).css("top", offset + "px");
|
||||
|
||||
|
|
|
@ -720,3 +720,48 @@ function print_clock_digital_1($time_format, $timezone, $clock_animation, $width
|
|||
return $output;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print dougnhnut.
|
||||
*
|
||||
* @param array $colors Colors.
|
||||
* @param integer $width Width.
|
||||
* @param integer $height Height.
|
||||
* @param array $data Data.
|
||||
* @param mixed $data_total Data_total.
|
||||
*
|
||||
* @return string HTML.
|
||||
*/
|
||||
function print_donut_narrow_graph(
|
||||
array $colors,
|
||||
$width,
|
||||
$height,
|
||||
array $data,
|
||||
$data_total
|
||||
) {
|
||||
if (empty($data)) {
|
||||
return graph_nodata_image($width, $height, 'pie');
|
||||
}
|
||||
|
||||
$series = count($data);
|
||||
if (($series != count($colors)) || ($series == 0)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$data = json_encode($data);
|
||||
$colors = json_encode($colors);
|
||||
|
||||
$graph_id = uniqid('graph_');
|
||||
|
||||
$out = "<div id='$graph_id'></div>";
|
||||
$out .= include_javascript_d3(true);
|
||||
$out .= "<script type='text/javascript'>
|
||||
donutNarrowGraph($colors, $width, $height, $data_total)
|
||||
.donutbody(d3.select($graph_id))
|
||||
.data($data)
|
||||
.render();
|
||||
</script>";
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
|
|
@ -82,9 +82,22 @@ function include_javascript_dependencies_flot_graph($return=false)
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// AREA GRAPHS ////////
|
||||
//
|
||||
/**
|
||||
* Function create container for print charts.
|
||||
*
|
||||
* @param integer $agent_module_id Id module.
|
||||
* @param array $array_data Data.
|
||||
* @param array $legend Legend.
|
||||
* @param array $series_type Series.
|
||||
* @param array $color Color.
|
||||
* @param array $date_array Date.
|
||||
* @param array $data_module_graph Data module.
|
||||
* @param array $params Params.
|
||||
* @param string $water_mark Water.
|
||||
* @param array $array_events_alerts Events array.
|
||||
*
|
||||
* @return string Return graphs.
|
||||
*/
|
||||
function flot_area_graph(
|
||||
$agent_module_id,
|
||||
$array_data,
|
||||
|
@ -99,8 +112,7 @@ function flot_area_graph(
|
|||
) {
|
||||
global $config;
|
||||
|
||||
// include_javascript_dependencies_flot_graph();
|
||||
// Get a unique identifier to graph
|
||||
// Get a unique identifier to graph.
|
||||
$graph_id = uniqid('graph_');
|
||||
|
||||
$background_style = '';
|
||||
|
@ -126,19 +138,26 @@ function flot_area_graph(
|
|||
break;
|
||||
}
|
||||
|
||||
$padding_vconsole = $params['dashboard'] ? 'padding: 1px 0px 10px 10px;' : '';
|
||||
$padding_vconsole = ($params['dashboard']) ? 'padding: 1px 0px 10px 10px;' : '';
|
||||
|
||||
// Parent layer
|
||||
// Parent layer.
|
||||
$return = "<div class='parent_graph' style='width: ".($params['width']).';'.$background_style.$padding_vconsole."'>";
|
||||
|
||||
if (empty($params['title']) === false) {
|
||||
$return .= '<p style="text-align:center;">'.$params['title'].'</p>';
|
||||
}
|
||||
|
||||
// Set some containers to legend, graph, timestamp tooltip, etc.
|
||||
if ($params['show_legend']) {
|
||||
$return .= "<p id='legend_$graph_id' style='text-align:left;'></p>";
|
||||
$return .= '<p id="legend_'.$graph_id.'" style="text-align:left;"></p>';
|
||||
}
|
||||
|
||||
if (isset($params['graph_combined']) && $params['graph_combined']
|
||||
&& (!isset($params['from_interface']) || !$params['from_interface'])
|
||||
) {
|
||||
if (isset($params['threshold_data']) && is_array($params['threshold_data'])) {
|
||||
if (isset($params['threshold_data'])
|
||||
&& is_array($params['threshold_data'])
|
||||
) {
|
||||
$yellow_threshold = $params['threshold_data']['yellow_threshold'];
|
||||
$red_threshold = $params['threshold_data']['red_threshold'];
|
||||
$yellow_up = $params['threshold_data']['yellow_up'];
|
||||
|
@ -154,7 +173,7 @@ function flot_area_graph(
|
|||
} else if (!isset($params['combined']) || !$params['combined']) {
|
||||
$yellow_threshold = $data_module_graph['w_min'];
|
||||
$red_threshold = $data_module_graph['c_min'];
|
||||
// Get other required module datas to draw warning and critical
|
||||
// Get other required module datas to draw warning and critical.
|
||||
if ($agent_module_id == 0) {
|
||||
$yellow_up = 0;
|
||||
$red_up = 0;
|
||||
|
@ -166,8 +185,12 @@ function flot_area_graph(
|
|||
$yellow_inverse = !($data_module_graph['w_inv'] == 0);
|
||||
$red_inverse = !($data_module_graph['c_inv'] == 0);
|
||||
}
|
||||
} else if (isset($params['from_interface']) && $params['from_interface']) {
|
||||
if (isset($params['threshold_data']) && is_array($params['threshold_data'])) {
|
||||
} else if (isset($params['from_interface'])
|
||||
&& $params['from_interface']
|
||||
) {
|
||||
if (isset($params['threshold_data'])
|
||||
&& is_array($params['threshold_data'])
|
||||
) {
|
||||
$yellow_threshold = $params['threshold_data']['yellow_threshold'];
|
||||
$red_threshold = $params['threshold_data']['red_threshold'];
|
||||
$yellow_up = $params['threshold_data']['yellow_up'];
|
||||
|
@ -200,7 +223,11 @@ function flot_area_graph(
|
|||
);
|
||||
}
|
||||
|
||||
$return .= html_print_input_hidden('line_width_graph', $config['custom_graph_width'], true);
|
||||
$return .= html_print_input_hidden(
|
||||
'line_width_graph',
|
||||
$config['custom_graph_width'],
|
||||
true
|
||||
);
|
||||
$return .= "<div id='timestamp_$graph_id'
|
||||
class='timestamp_graph'
|
||||
style=' font-size:".$params['font_size']."pt;
|
||||
|
@ -239,20 +266,21 @@ function flot_area_graph(
|
|||
$series_type_unique['data_'.$graph_id.'_'.$k] = $v;
|
||||
}
|
||||
|
||||
// Store data series in javascript format
|
||||
// Store data series in javascript format.
|
||||
$extra_width = (int) ($params['width'] / 3);
|
||||
$return .= "<div id='extra_$graph_id'
|
||||
style='font-size: ".$params['font_size'].'pt;
|
||||
display:none; position:absolute; overflow: auto;
|
||||
max-height: '.($params['height'] + 50).'px;
|
||||
width: '.$extra_width."px;
|
||||
background:#fff; padding: 2px 2px 2px 2px;
|
||||
border: solid #000 1px;'></div>";
|
||||
style='font-size: ".$params['font_size'].'pt;
|
||||
display:none; position:absolute; overflow: auto;
|
||||
max-height: '.($params['height'] + 50).'px;
|
||||
width: '.$extra_width."px;
|
||||
background:#fff; padding: 2px 2px 2px 2px;
|
||||
border: solid #000 1px;'></div>";
|
||||
|
||||
// Trick to get translated string from javascript
|
||||
// Trick to get translated string from javascript.
|
||||
$return .= html_print_input_hidden('unknown_text', __('Unknown'), true);
|
||||
|
||||
$values = json_encode($array_data);
|
||||
$values = json_encode($array_data);
|
||||
|
||||
$legend = json_encode($legend);
|
||||
$series_type = json_encode($series_type);
|
||||
$color = json_encode($color);
|
||||
|
@ -261,7 +289,7 @@ function flot_area_graph(
|
|||
$params = json_encode($params);
|
||||
$array_events_alerts = json_encode($array_events_alerts);
|
||||
|
||||
// Javascript code
|
||||
// Javascript code.
|
||||
if ($font_size == '') {
|
||||
$font_size = '\'\'';
|
||||
}
|
||||
|
@ -272,7 +300,7 @@ function flot_area_graph(
|
|||
$return .= '});';
|
||||
$return .= '</script>';
|
||||
|
||||
// Parent layer
|
||||
// Parent layer.
|
||||
$return .= '</div>';
|
||||
|
||||
return $return;
|
||||
|
|
|
@ -344,9 +344,9 @@ function drawRating($rating, $width, $height, $font, $out_of_lim_str, $mode, $fo
|
|||
$image = imagecreate($width, $height);
|
||||
|
||||
// colors
|
||||
$back = imagecolorallocate($image, 255, 255, 255);
|
||||
$back = imagecolorallocate($image, 241, 241, 241);
|
||||
|
||||
$bordercolor = imagecolorallocate($image, 174, 174, 174);
|
||||
$bordercolor = imagecolorallocate($image, 241, 241, 241);
|
||||
$text = imagecolorallocate($image, 74, 74, 74);
|
||||
$red = imagecolorallocate($image, 255, 60, 75);
|
||||
$green = imagecolorallocate($image, 50, 205, 50);
|
||||
|
@ -483,7 +483,7 @@ function gd_progress_bar($width, $height, $progress, $title, $font, $out_of_lim_
|
|||
break;
|
||||
|
||||
case 1:
|
||||
drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 6, $value_text, $color);
|
||||
drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 9, $value_text, $color);
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -2113,8 +2113,7 @@ function print_circular_progress_bar(
|
|||
|
||||
var progress = startPercent;
|
||||
|
||||
if (transition == 0)
|
||||
updateProgress(endPercent);
|
||||
if (transition == 0) updateProgress(endPercent);
|
||||
else {
|
||||
(function loops() {
|
||||
updateProgress(progress);
|
||||
|
@ -2762,3 +2761,224 @@ function valueToBytes(value) {
|
|||
// This will actually do the rounding and the decimals.
|
||||
return value.toFixed(2) + shorts[pos] + "B";
|
||||
}
|
||||
|
||||
function donutNarrowGraph(colores, width, height, total) {
|
||||
// Default settings
|
||||
var donutbody = d3.select("body");
|
||||
var data = {};
|
||||
// var showTitle = true;
|
||||
|
||||
if (width == "") {
|
||||
width = 180;
|
||||
}
|
||||
|
||||
if (height == "") {
|
||||
height = 180;
|
||||
}
|
||||
|
||||
var radius = Math.min(width, height) / 2;
|
||||
|
||||
var currentVal;
|
||||
//var color = d3.scale.category20();
|
||||
|
||||
var colores_index = [];
|
||||
var colores_value = [];
|
||||
|
||||
$.each(colores, function(index, value) {
|
||||
colores_index.push(index);
|
||||
colores_value.push(value);
|
||||
});
|
||||
|
||||
var color = d3.scale
|
||||
.ordinal()
|
||||
.domain(colores_index)
|
||||
.range(colores_value);
|
||||
|
||||
var pie = d3.layout
|
||||
.pie()
|
||||
.sort(null)
|
||||
.value(function(d) {
|
||||
return d.value;
|
||||
});
|
||||
|
||||
var svg, g, arc;
|
||||
|
||||
var object = {};
|
||||
|
||||
// Method for render/refresh graph
|
||||
object.render = function() {
|
||||
if (!svg) {
|
||||
// Show normal status by default. This variable must be initialized here, before clearing data.
|
||||
var normal_status = data.Normal;
|
||||
|
||||
// Don't draw 0 or invalid values. console.log(data);
|
||||
var data_map = $.map(data, function(value, index) {
|
||||
if (value == 0 || isNaN(value)) {
|
||||
return index;
|
||||
}
|
||||
});
|
||||
|
||||
$.each(data_map, function(i, val) {
|
||||
delete data[val];
|
||||
});
|
||||
//New data: console.log(data);
|
||||
|
||||
arc = d3.svg
|
||||
.arc()
|
||||
.outerRadius(radius)
|
||||
.innerRadius(radius - radius / 2.5);
|
||||
|
||||
svg = donutbody
|
||||
.append("svg")
|
||||
.attr("width", width)
|
||||
.attr("height", height)
|
||||
.append("g")
|
||||
.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
|
||||
|
||||
g = svg
|
||||
.selectAll(".arc")
|
||||
.data(pie(d3.entries(data)))
|
||||
.enter()
|
||||
.append("g")
|
||||
.attr("class", "arc");
|
||||
|
||||
g.append("path")
|
||||
// Attach current value to g so that we can use it for animation
|
||||
.each(function(d) {
|
||||
this._current = d;
|
||||
})
|
||||
.attr("d", arc)
|
||||
.attr("stroke", "white")
|
||||
.style("stroke-width", 2)
|
||||
.style("fill", function(d) {
|
||||
return color(d.data.key);
|
||||
});
|
||||
// This is to show labels on the graph
|
||||
/* g.append("text")
|
||||
.attr("transform", function(d) {
|
||||
return "translate(" + arc.centroid(d) + ")";
|
||||
})
|
||||
.attr("dy", ".35em")
|
||||
.style("text-anchor", "middle");
|
||||
g.select("text").text(function(d) {
|
||||
return d.data.key;
|
||||
});*/
|
||||
|
||||
// Show normal status by default.
|
||||
var percentage_normal;
|
||||
svg
|
||||
.append("text")
|
||||
.datum(data)
|
||||
.attr("x", 0)
|
||||
.attr("y", 0 + radius / 10)
|
||||
.attr("class", "text-tooltip")
|
||||
.style("text-anchor", "middle")
|
||||
.attr("font-weight", "bold")
|
||||
.style("font-family", "Arial, Verdana")
|
||||
//.attr("fill", "#82b92e")
|
||||
.style("font-size", function(d) {
|
||||
if (normal_status) {
|
||||
percentage_normal = (normal_status * 100) / total;
|
||||
if (Number.isInteger(percentage_normal)) {
|
||||
percentage_normal = percentage_normal.toFixed(0);
|
||||
return radius / 3 + "px";
|
||||
} else {
|
||||
percentage_normal = percentage_normal.toFixed(1);
|
||||
return radius / 3.5 + "px";
|
||||
}
|
||||
}
|
||||
})
|
||||
.text(function(d) {
|
||||
if (normal_status) {
|
||||
return percentage_normal + "%";
|
||||
} else {
|
||||
return "0%";
|
||||
}
|
||||
});
|
||||
|
||||
g.on("mouseover", function(obj) {
|
||||
//console.log(obj);
|
||||
var percentage;
|
||||
svg
|
||||
.select("text.text-tooltip")
|
||||
// This is to paint the text of the corresponding color.
|
||||
/* .attr("fill", function(d) {
|
||||
return color(obj.data.key);
|
||||
})*/
|
||||
.style("font-size", function(d) {
|
||||
percentage = (d[obj.data.key] * 100) / total;
|
||||
if (Number.isInteger(percentage)) {
|
||||
percentage = percentage.toFixed(0);
|
||||
return radius / 3 + "px";
|
||||
} else {
|
||||
percentage = percentage.toFixed(1);
|
||||
return radius / 3.5 + "px";
|
||||
}
|
||||
})
|
||||
.text(percentage + "%");
|
||||
});
|
||||
|
||||
g.on("mouseout", function(obj) {
|
||||
svg.select("text.text-tooltip").text(function(d) {
|
||||
if (normal_status) {
|
||||
return percentage_normal + "%";
|
||||
} else {
|
||||
return "0%";
|
||||
}
|
||||
});
|
||||
// .attr("fill", "#82b92e");
|
||||
});
|
||||
} else {
|
||||
g.data(pie(d3.entries(data)))
|
||||
.exit()
|
||||
.remove();
|
||||
|
||||
g.select("path")
|
||||
.transition()
|
||||
.duration(200)
|
||||
.attrTween("d", function(a) {
|
||||
var i = d3.interpolate(this._current, a);
|
||||
this._current = i(0);
|
||||
return function(t) {
|
||||
return arc(i(t));
|
||||
};
|
||||
});
|
||||
|
||||
g.select("text").attr("transform", function(d) {
|
||||
return "translate(" + arc.centroid(d) + ")";
|
||||
});
|
||||
|
||||
svg.select("text.text-tooltip").datum(data);
|
||||
}
|
||||
return object;
|
||||
};
|
||||
|
||||
// Getter and setter methods
|
||||
object.data = function(value) {
|
||||
if (!arguments.length) return data;
|
||||
data = value;
|
||||
return object;
|
||||
};
|
||||
|
||||
object.donutbody = function(value) {
|
||||
if (!arguments.length) return donutbody;
|
||||
donutbody = value;
|
||||
return object;
|
||||
};
|
||||
|
||||
object.width = function(value) {
|
||||
if (!arguments.length) return width;
|
||||
width = value;
|
||||
radius = Math.min(width, height) / 2;
|
||||
return object;
|
||||
};
|
||||
|
||||
object.height = function(value) {
|
||||
if (!arguments.length) return height;
|
||||
height = value;
|
||||
radius = Math.min(width, height) / 2;
|
||||
return object;
|
||||
};
|
||||
|
||||
return object;
|
||||
}
|
||||
|
|
|
@ -1226,7 +1226,7 @@ function paint_qrcode(text, where, width, height) {
|
|||
text: text,
|
||||
width: width,
|
||||
height: height,
|
||||
colorDark: "#3B6941",
|
||||
colorDark: "#343434",
|
||||
colorLight: "#ffffff",
|
||||
correctLevel: QRCode.CorrectLevel.M
|
||||
});
|
||||
|
|
|
@ -196,10 +196,10 @@ function configure_modules_form() {
|
|||
);
|
||||
$("#text-unit").attr("value", data["unit"] == "" ? "" : data["unit"]);
|
||||
$("#checkbox-critical_inverse").prop(
|
||||
"checked",
|
||||
"uncheck",
|
||||
data["critical_inverse"]
|
||||
);
|
||||
$("#checkbox-warning_inverse").prop("checked", data["warning_inverse"]);
|
||||
$("#checkbox-warning_inverse").prop("uncheck", data["warning_inverse"]);
|
||||
$("#component_loading").hide();
|
||||
$("#id_module_type").change();
|
||||
if ($("#id_category").is("select")) {
|
||||
|
|
|
@ -19,10 +19,13 @@ function progress_task_list(id, title) {
|
|||
.empty()
|
||||
.dialog({
|
||||
title: title,
|
||||
draggable: true,
|
||||
autoOpen: false,
|
||||
modal: false,
|
||||
width: 600,
|
||||
height: 420,
|
||||
resizable: false,
|
||||
draggable: false,
|
||||
closeOnEscape: true,
|
||||
width: 800,
|
||||
height: 600,
|
||||
close: function() {
|
||||
if (xhr != null) xhr.abort();
|
||||
if (timeoutRef != null) clearTimeout(timeoutRef);
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Models;
|
||||
use Models\Model;
|
||||
|
||||
/**
|
||||
* This class should be extended to add functionalities to
|
||||
* fetch, clear and save item cache.
|
||||
*/
|
||||
abstract class CachedModel extends Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Used to decide if the cache should also be indexed by user or not.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected static $indexCacheByUser = false;
|
||||
|
||||
|
||||
/**
|
||||
* Obtain a data structure from the database using a filter.
|
||||
*
|
||||
* @param array $filter Filter to retrieve the modeled element.
|
||||
*
|
||||
* @return array The modeled element data structure stored into the DB.
|
||||
* @throws \Exception When the data cannot be retrieved from the DB.
|
||||
*
|
||||
* @abstract
|
||||
*/
|
||||
abstract protected static function fetchCachedData(array $filter);
|
||||
|
||||
|
||||
/**
|
||||
* Stores the data structure obtained.
|
||||
*
|
||||
* @param array $filter Filter to retrieve the modeled element.
|
||||
* @param array $data Data to store in cache.
|
||||
*
|
||||
* @return array The modeled element data structure stored into the DB.
|
||||
* @throws \Exception When the data cannot be retrieved from the DB.
|
||||
*
|
||||
* @abstract
|
||||
*/
|
||||
abstract protected static function saveCachedData(
|
||||
array $filter,
|
||||
array $data
|
||||
): bool;
|
||||
|
||||
|
||||
/**
|
||||
* Deletes previous data that are not useful.
|
||||
*
|
||||
* @param array $filter Filter to retrieve the modeled element.
|
||||
*
|
||||
* @return array The modeled element data structure stored into the DB.
|
||||
* @throws \Exception When the data cannot be retrieved from the DB.
|
||||
*
|
||||
* @abstract
|
||||
*/
|
||||
abstract protected static function clearCachedData(array $filter): int;
|
||||
|
||||
|
||||
/**
|
||||
* Obtain a model's instance from the database using a filter.
|
||||
*
|
||||
* @param array $filter Filter to retrieve the modeled element.
|
||||
*
|
||||
* @return self A modeled element's instance.
|
||||
*
|
||||
* @overrides Model::fromDB.
|
||||
*/
|
||||
public static function fromDB(array $filter): Model
|
||||
{
|
||||
global $config;
|
||||
|
||||
if ($filter['cache_expiration'] > 0) {
|
||||
// Obtain the item's data from cache.
|
||||
$cachedData = static::fetchCachedData($filter);
|
||||
if ($cachedData === null) {
|
||||
$userId = (static::$indexCacheByUser === true) ? $config['id_user'] : null;
|
||||
|
||||
// Delete expired data cache.
|
||||
static::clearCachedData(
|
||||
[
|
||||
'vc_item_id' => $filter['id'],
|
||||
'vc_id' => $filter['id_layout'],
|
||||
'user_id' => $userId,
|
||||
]
|
||||
);
|
||||
// Obtain the item's data from the database.
|
||||
$data = static::fetchDataFromDB($filter);
|
||||
// Save the item's data in cache.
|
||||
static::saveCachedData(
|
||||
[
|
||||
'vc_item_id' => $filter['id'],
|
||||
'vc_id' => $filter['id_layout'],
|
||||
'user_id' => $userId,
|
||||
'expiration' => $filter['cache_expiration'],
|
||||
],
|
||||
$data
|
||||
);
|
||||
} else {
|
||||
$data = $cachedData;
|
||||
}
|
||||
} else {
|
||||
$data = static::fetchDataFromDB($filter);
|
||||
}
|
||||
|
||||
return static::fromArray($data);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -321,6 +321,8 @@ final class Container extends Model
|
|||
$fields = [
|
||||
'id',
|
||||
'type',
|
||||
'cache_expiration',
|
||||
'id_layout',
|
||||
];
|
||||
|
||||
// Override the filter if the groups filter is not empty.
|
||||
|
@ -359,11 +361,10 @@ final class Container extends Model
|
|||
|
||||
foreach ($rows as $data) {
|
||||
$itemId = (int) $data['id'];
|
||||
$itemType = (int) $data['type'];
|
||||
$class = static::getItemClass($itemType);
|
||||
$class = static::getItemClass((int) $data['type']);
|
||||
|
||||
try {
|
||||
array_push($items, $class::fromDB(['id' => $itemId]));
|
||||
array_push($items, $class::fromDB($data));
|
||||
} catch (\Throwable $e) {
|
||||
// TODO: Log this?
|
||||
}
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
namespace Models\VisualConsole;
|
||||
use Models\Model;
|
||||
use Models\CachedModel;
|
||||
|
||||
/**
|
||||
* Model of a generic Visual Console Item.
|
||||
*/
|
||||
class Item extends Model
|
||||
class Item extends CachedModel
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -698,10 +698,6 @@ class Item extends Model
|
|||
throw new \Exception('error fetching the data from the DB');
|
||||
}
|
||||
|
||||
// Load side libraries.
|
||||
global $config;
|
||||
include_once $config['homedir'].'/include/functions_io.php';
|
||||
|
||||
// Clean up to two levels of HTML entities.
|
||||
$row = \io_safe_output(\io_safe_output($row));
|
||||
|
||||
|
@ -725,6 +721,89 @@ class Item extends Model
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch a cache item data structure from the database using a filter.
|
||||
*
|
||||
* @param array $filter Filter of the Visual Console Item.
|
||||
*
|
||||
* @return array The Visual Console Item data structure stored into the DB.
|
||||
* @throws \Exception When the data cannot be retrieved from the DB.
|
||||
*
|
||||
* @override CachedModel::fetchCachedData.
|
||||
*/
|
||||
protected static function fetchCachedData(array $filter)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$filter = [
|
||||
'vc_id' => (int) $filter['id_layout'],
|
||||
'vc_item_id' => (int) $filter['id'],
|
||||
'(UNIX_TIMESTAMP(`created_at`) + `expiration`) > UNIX_TIMESTAMP()'
|
||||
];
|
||||
|
||||
if (static::$indexCacheByUser === true) {
|
||||
$filter['user_id'] = $config['id_user'];
|
||||
}
|
||||
|
||||
$data = \db_get_value_filter(
|
||||
'data',
|
||||
'tvisual_console_elements_cache',
|
||||
$filter
|
||||
);
|
||||
|
||||
if ($data === false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return json_decode(base64_decode($data), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stores the data structure obtained.
|
||||
*
|
||||
* @param array $filter Filter to save the modeled element.
|
||||
* @param array $data Modeled element to save.
|
||||
*
|
||||
* @return boolean The modeled element data structure stored into the DB.
|
||||
* @throws \Exception When the data cannot be retrieved from the DB.
|
||||
*
|
||||
* @override CachedModel::saveCachedData.
|
||||
*/
|
||||
protected static function saveCachedData(array $filter, array $data): bool
|
||||
{
|
||||
return \db_process_sql_insert(
|
||||
'tvisual_console_elements_cache',
|
||||
[
|
||||
'vc_id' => $filter['vc_id'],
|
||||
'vc_item_id' => $filter['vc_item_id'],
|
||||
'user_id' => $filter['user_id'],
|
||||
'data' => base64_encode(json_encode($data)),
|
||||
'expiration' => $filter['expiration'],
|
||||
]
|
||||
) > 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deletes previous data that are not useful.
|
||||
*
|
||||
* @param array $filter Filter to retrieve the modeled element.
|
||||
*
|
||||
* @return array The modeled element data structure stored into the DB.
|
||||
* @throws \Exception When the data cannot be retrieved from the DB.
|
||||
*
|
||||
* @override CachedModel::clearCachedData.
|
||||
*/
|
||||
protected static function clearCachedData(array $filter): int
|
||||
{
|
||||
return \db_process_sql_delete(
|
||||
'tvisual_console_elements_cache',
|
||||
$filter
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch a data structure of an agent from the database using the
|
||||
* vs item's data.
|
||||
|
|
|
@ -26,6 +26,13 @@ final class Group extends Item
|
|||
*/
|
||||
protected static $useHtmlOutput = true;
|
||||
|
||||
/**
|
||||
* Enable the cache index by user id.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected static $indexCacheByUser = true;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a valid representation of the model.
|
||||
|
|
|
@ -0,0 +1,158 @@
|
|||
/*
|
||||
* ---------------------------------------------------------------------
|
||||
* - Create/Update Agent - agent_manager.php
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
.agent_options {
|
||||
width: 100%;
|
||||
margin-right: 0px;
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.agent_options_update {
|
||||
width: 85%;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.agent_options_column_left,
|
||||
.agent_options_column_right {
|
||||
width: 50%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.agent_options_column_left {
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
.agent_qr {
|
||||
width: 15%;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
padding: 20px 0px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
a#qr_code_agent_view {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.first_row .agent_options_column_right select,
|
||||
.first_row .agent_options_column_right input,
|
||||
.first_row .agent_options_column_left select#grupo {
|
||||
width: 95%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.first_row .agent_options_column_left .p-switch {
|
||||
margin-right: 5px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.agent_options_column_left input#text-direccion,
|
||||
.agent_options_column_left select#address_list,
|
||||
.agent_options_column_left input#text-agente,
|
||||
.agent_options_column_left input#text-alias {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.agent_options_agent_name > * {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.custom_fields_table {
|
||||
border-spacing: 0px;
|
||||
}
|
||||
|
||||
.custom_fields_table tr.datos {
|
||||
background-color: #f7f7f7;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.custom_fields_table tr.datos2 {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.custom_fields_table tr td {
|
||||
border: 1px solid #e0e0e0;
|
||||
}
|
||||
|
||||
.custom_fields_table tr.datos2 td div.field_title {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.custom_fields_table tr.datos2 td {
|
||||
border-radius: 4px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.custom_fields_table tr.datos td {
|
||||
padding: 15px 10px;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
.custom_fields_table .custom_field_row_opened td {
|
||||
border-bottom-left-radius: 0px !important;
|
||||
border-bottom-right-radius: 0px !important;
|
||||
}
|
||||
|
||||
.secondary_groups_select {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.secondary_groups_select .secondary_groups_select_arrows input {
|
||||
display: grid;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.secondary_groups_select .secondary_groups_list_left {
|
||||
text-align: right;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.secondary_groups_select .secondary_groups_list_right {
|
||||
text-align: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.secondary_groups_select .secondary_groups_select_arrows {
|
||||
padding: 0 50px;
|
||||
}
|
||||
|
||||
.secondary_groups_select_arrows a {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.agent_options_adv .agent_options_column_right .label_select select,
|
||||
.agent_options_adv .agent_options_column_right .label_select input[type="text"],
|
||||
.agent_options_adv #text-custom_id,
|
||||
.agent_options_adv #cps {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.agent_options_adv .label_select_simple.label_simple_one_item .p-switch {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.agent_description {
|
||||
min-height: 4.8em !important;
|
||||
}
|
||||
.agent_custom_id {
|
||||
padding-bottom: 0.7em;
|
||||
padding-top: 0.5em;
|
||||
display: inline-block;
|
||||
border-radius: 5px !important;
|
||||
border: 1px solid #ccc;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
text.text-tooltip {
|
||||
font-family: "lato-bolder", "Open Sans", sans-serif !important;
|
||||
}
|
||||
|
||||
div#bullets_modules span {
|
||||
font-family: "lato-bolder", "Open Sans", sans-serif !important;
|
||||
}
|
||||
|
||||
table#agent_interface_info .noresizevc.graph {
|
||||
width: 500px !important;
|
||||
}
|
||||
|
||||
div.agent_details_agent_alias {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
div.agent_details_agent_alias * {
|
||||
font-family: "lato-bolder", "Open Sans", sans-serif !important;
|
||||
}
|
|
@ -27,6 +27,11 @@ li.discovery > a label {
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
div.data_container > label {
|
||||
font-family: "lato-bolder", "Open Sans", sans-serif !important;
|
||||
font-weight: lighter;
|
||||
}
|
||||
|
||||
div.data_container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
@ -120,7 +125,6 @@ div.arrow_box:before {
|
|||
border-top-right-radius: 7px;
|
||||
border-top-left-radius: 7px;
|
||||
box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1);
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#menu_tab_frame_view_bc .breadcrumbs_container {
|
||||
|
@ -160,6 +164,10 @@ span.breadcrumb_link {
|
|||
* Discovery forms structure
|
||||
*/
|
||||
|
||||
form.discovery * {
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
.edit_discovery_info {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
|
@ -196,7 +204,9 @@ li > input[type="password"],
|
|||
background-color: transparent !important;
|
||||
border: none;
|
||||
border-radius: 0 !important;
|
||||
border-bottom: 1px solid #343434;
|
||||
border-bottom: 1px solid #ccc;
|
||||
font-family: "lato-bolder", "Open Sans", sans-serif !important;
|
||||
font-weight: lighter;
|
||||
padding: 0px 0px 2px 0px;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 4px;
|
||||
|
@ -215,7 +225,7 @@ li > input[type="password"],
|
|||
}
|
||||
|
||||
.discovery_list_input option {
|
||||
text-align: center;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.discovery_list_input option:checked {
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
div.criticity {
|
||||
width: 150px;
|
||||
height: 2em;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 5px;
|
||||
font-size: 0.8em;
|
||||
padding: 3px;
|
||||
margin: 0;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
div.mini-criticity {
|
||||
width: 5px;
|
||||
height: 4em;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: inline-block;
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
width: 43px;
|
||||
height: 11px;
|
||||
position: absolute;
|
||||
background-image: url(../../images/wait.gif);
|
||||
background-image: url(../../../images/wait.gif);
|
||||
}
|
||||
.cluetip-arrows {
|
||||
display: none;
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
span.progress_text {
|
||||
position: absolute;
|
||||
font-family: "lato-bolder", "Open Sans", sans-serif;
|
||||
font-size: 2em;
|
||||
margin-left: -0.5em;
|
||||
}
|
||||
|
||||
div.progress_main {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
height: 2.5em;
|
||||
border: 1px solid #80ba27;
|
||||
}
|
||||
|
||||
div.progress {
|
||||
width: 0%;
|
||||
background: #80ba27;
|
||||
height: 100%;
|
||||
float: left;
|
||||
}
|
|
@ -623,10 +623,9 @@ if (! isset($config['id_user'])) {
|
|||
|
||||
header('Location: '.$config['homeurl'].'index.php'.$redirect_url);
|
||||
exit;
|
||||
// Always exit after sending location headers
|
||||
}
|
||||
// Hash login process
|
||||
else if (isset($_GET['loginhash'])) {
|
||||
// Always exit after sending location headers.
|
||||
} else if (isset($_GET['loginhash'])) {
|
||||
// Hash login process
|
||||
$loginhash_data = get_parameter('loginhash_data', '');
|
||||
$loginhash_user = str_rot13(get_parameter('loginhash_user', ''));
|
||||
|
||||
|
@ -642,9 +641,8 @@ if (! isset($config['id_user'])) {
|
|||
|
||||
exit('</html>');
|
||||
}
|
||||
}
|
||||
// There is no user connected
|
||||
else {
|
||||
} else {
|
||||
// There is no user connected.
|
||||
if ($config['enterprise_installed']) {
|
||||
enterprise_include_once('include/functions_reset_pass.php');
|
||||
}
|
||||
|
@ -726,64 +724,55 @@ if (! isset($config['id_user'])) {
|
|||
$show_error = false;
|
||||
|
||||
if (!$first) {
|
||||
if ($reset) {
|
||||
if ($user_reset_pass == '') {
|
||||
if ($user_reset_pass == '') {
|
||||
$reset = false;
|
||||
$error = __('Id user cannot be empty');
|
||||
$show_error = true;
|
||||
} else {
|
||||
$check_user = check_user_id($user_reset_pass);
|
||||
|
||||
if (!$check_user) {
|
||||
$reset = false;
|
||||
$error = __('Id user cannot be empty');
|
||||
register_pass_change_try($user_reset_pass, 0);
|
||||
$error = __('Error in reset password request');
|
||||
$show_error = true;
|
||||
} else {
|
||||
$check_user = check_user_id($user_reset_pass);
|
||||
$check_mail = check_user_have_mail($user_reset_pass);
|
||||
|
||||
if (!$check_user) {
|
||||
if (!$check_mail) {
|
||||
$reset = false;
|
||||
register_pass_change_try($user_reset_pass, 0);
|
||||
$error = __('Error in reset password request');
|
||||
$error = __('This user doesn\'t have a valid email address');
|
||||
$show_error = true;
|
||||
} else {
|
||||
$check_mail = check_user_have_mail($user_reset_pass);
|
||||
|
||||
if (!$check_mail) {
|
||||
$reset = false;
|
||||
register_pass_change_try($user_reset_pass, 0);
|
||||
$error = __('This user doesn\'t have a valid email address');
|
||||
$show_error = true;
|
||||
} else {
|
||||
$mail = $check_mail;
|
||||
}
|
||||
$mail = $check_mail;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$reset) {
|
||||
if ($config['enterprise_installed']) {
|
||||
include_once 'enterprise/include/reset_pass.php';
|
||||
}
|
||||
$cod_hash = $user_reset_pass.'::::'.md5(rand(10, 1000000).rand(10, 1000000).rand(10, 1000000));
|
||||
|
||||
$subject = '['.io_safe_output(get_product_name()).'] '.__('Reset password');
|
||||
$body = __('This is an automatically sent message for user ');
|
||||
$body .= ' "<strong>'.$user_reset_pass.'"</strong>';
|
||||
$body .= '<p />';
|
||||
$body .= __('Please click the link below to reset your password');
|
||||
$body .= '<p />';
|
||||
$body .= '<a href="'.$config['homeurl'].'index.php?reset_hash='.$cod_hash.'">'.__('Reset your password').'</a>';
|
||||
$body .= '<p />';
|
||||
$body .= get_product_name();
|
||||
$body .= '<p />';
|
||||
$body .= '<em>'.__('Please do not reply to this email.').'</em>';
|
||||
|
||||
$result = send_email_to_user($mail, $body, $subject);
|
||||
|
||||
if (!$result) {
|
||||
$process_error_message = __('Error at sending the email');
|
||||
} else {
|
||||
$cod_hash = $user_reset_pass.'::::'.md5(rand(10, 1000000).rand(10, 1000000).rand(10, 1000000));
|
||||
|
||||
$subject = '['.get_product_name().'] '.__('Reset password');
|
||||
$body = __('This is an automatically sent message for user ');
|
||||
$body .= ' "<strong>'.$user_reset_pass.'"</strong>';
|
||||
$body .= '<p />';
|
||||
$body .= __('Please click the link below to reset your password');
|
||||
$body .= '<p />';
|
||||
$body .= '<a href="'.$config['homeurl'].'index.php?reset_hash='.$cod_hash.'">'.__('Reset your password').'</a>';
|
||||
$body .= '<p />';
|
||||
$body .= get_product_name();
|
||||
$body .= '<p />';
|
||||
$body .= '<em>'.__('Please do not reply to this email.').'</em>';
|
||||
|
||||
$result = send_email_to_user($mail, $body, $subject);
|
||||
|
||||
$process_error_message = '';
|
||||
if (!$result) {
|
||||
$process_error_message = __('Error at sending the email');
|
||||
} else {
|
||||
send_token_to_db($user_reset_pass, $cod_hash);
|
||||
}
|
||||
|
||||
include_once 'general/login_page.php';
|
||||
send_token_to_db($user_reset_pass, $cod_hash);
|
||||
}
|
||||
|
||||
include_once 'general/login_page.php';
|
||||
} else {
|
||||
include_once 'enterprise/include/reset_pass.php';
|
||||
}
|
||||
|
|