resolved merge conflict
This commit is contained in:
commit
7418719861
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.757-210915
|
||||
Version: 7.0NG.757-211004
|
||||
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.757-210915"
|
||||
pandora_version="7.0NG.757-211004"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1015,7 +1015,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.757';
|
||||
use constant AGENT_BUILD => '210915';
|
||||
use constant AGENT_BUILD => '211004';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.757
|
||||
%define release 210915
|
||||
%define release 211004
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.757
|
||||
%define release 210915
|
||||
%define release 211004
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.757"
|
||||
PI_BUILD="210915"
|
||||
PI_BUILD="211004"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{210915}
|
||||
{211004}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora_Modules;
|
|||
* @param host Host to be pinged.
|
||||
*/
|
||||
Pandora_Module_Ping::Pandora_Module_Ping (string name, string host, string count, string timeout, string advanced_options)
|
||||
: Pandora_Module_Exec (name, "ping -n " + count + " -w " + timeout + " " + advanced_options + " " + host) {
|
||||
: Pandora_Module_Exec (name, "ping -n " + count + " -w " + timeout + " " + advanced_options + " " + host + " | find \"TTL=\"") {
|
||||
this->proc = 1;
|
||||
this->setKind (module_ping_str);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.757 Build 210915")
|
||||
#define PANDORA_VERSION ("7.0NG.757 Build 211004")
|
||||
|
||||
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.757(Build 210915))"
|
||||
VALUE "ProductVersion", "(7.0NG.757(Build 211004))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.757-210915
|
||||
Version: 7.0NG.757-211004
|
||||
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.757-210915"
|
||||
pandora_version="7.0NG.757-211004"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -1094,7 +1094,7 @@ function resource_registration_extension_main()
|
|||
}
|
||||
|
||||
echo '<div class=notify>';
|
||||
echo __('This extension makes registering resource templates easier.').' '.__('Here you can upload a resource template in .ptr format.').' '.__('Please refer to our documentation for more information on how to obtain and use %s resources.', get_product_name()).' '.'<br> <br>'.__("You can get more resurces in our <a href='http://pandorafms.com/Library/Library/'>Public Resource Library</a>");
|
||||
echo __('This extension makes registering resource templates easier.').' '.__('Here you can upload a resource template in .ptr format.').' '.__('Please refer to our documentation for more information on how to obtain and use %s resources.', get_product_name()).' '.'<br> <br>'.__('You can get more resurces in our <a href="http://pandorafms.com/Library/Library/">Public Resource Library</a>');
|
||||
echo '</div>';
|
||||
|
||||
echo '<br /><br />';
|
||||
|
|
|
@ -106,3 +106,9 @@ enterprise/godmode/alerts/alert_events.php
|
|||
enterprise/godmode/alerts/alert_events_list.php
|
||||
enterprise/godmode/alerts/alert_events_rules.php
|
||||
enterprise/godmode/alerts/configure_alert_rule.php
|
||||
enterprise/include/functions_networkmap.php
|
||||
enterprise/operation/agentes/pandora_networkmap.view.php
|
||||
enterprise/include/ajax/map_enterprise.ajax.php
|
||||
enterprise/include/javascript/SimpleMapController.js
|
||||
enterprise/include/javascript/tooltipster.bundle.min.js
|
||||
enterprise/include/styles/tooltipster.bundle.min.css
|
|
@ -0,0 +1,22 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `treport_content` ADD COLUMN `ipam_network_filter` int(10) UNSIGNED DEFAULT 0;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_network_filter` int(10) UNSIGNED DEFAULT 0;
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `tevent_alert` ADD COLUMN `id_template_conditions` int(10) unsigned NOT NULL default 0;
|
||||
ALTER TABLE `tevent_alert` ADD COLUMN `id_template_fields` int(10) unsigned NOT NULL default 0;
|
||||
ALTER TABLE `tevent_filter` ADD COLUMN `time_from` TIME NULL;
|
||||
ALTER TABLE `tevent_filter` ADD COLUMN `time_to` TIME NULL;
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `time_in_warning_status` TINYINT(1) DEFAULT '0';
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `checks_in_warning_status` TINYINT(1) DEFAULT '0';
|
||||
ALTER TABLE `treport_content` ADD COLUMN `time_in_warning_status` TINYINT(1) DEFAULT '0';
|
||||
ALTER TABLE `treport_content` ADD COLUMN `checks_in_warning_status` TINYINT(1) DEFAULT '0';
|
||||
|
||||
INSERT INTO `treport_content` (id_report, id_gs, id_agent_module, type, period, `order`, name, description, id_agent, `text`, external_source, treport_custom_sql_id, header_definition, column_separator, line_separator, time_from, time_to, style, server_name, time_in_warning_status, checks_in_warning_status, failover_mode) SELECT id_report, 0, id_agent_module, 'availability', period, `order`, name, description, id_agent, NULL, NULL, treport_custom_sql_id, header_definition, column_separator, line_separator, time_from, time_to, '{"show_in_same_row":0,"hide_notinit_agents":0,"priority_mode":1,"dyn_height":"230"}', server_name, 1, 1, 0 FROM treport_content WHERE type = 'histogram_data';
|
||||
INSERT INTO `treport_content_item` (id_report_content, id_agent_module, id_agent_module_failover, operation, server_name) SELECT id_rc, id_agent_module, 0, '', server_name FROM treport_content WHERE type = 'availability' AND id_agent <> 0 AND id_agent_module <> 0;
|
||||
DELETE FROM `treport_content` WHERE type = 'histogram_data';
|
||||
|
||||
COMMIT;
|
|
@ -710,6 +710,8 @@ CREATE TABLE IF NOT EXISTS `tevent_alert` (
|
|||
ALTER TABLE `tevent_alert` ADD COLUMN `special_days` tinyint(1) default 0;
|
||||
ALTER TABLE `tevent_alert` MODIFY COLUMN `time_threshold` int(10) NOT NULL default 86400;
|
||||
ALTER TABLE `tevent_alert` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
|
||||
ALTER TABLE `tevent_alert` ADD COLUMN `id_template_conditions` int(10) unsigned NOT NULL default 0;
|
||||
ALTER TABLE `tevent_alert` ADD COLUMN `id_template_fields` int(10) unsigned NOT NULL default 0;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tevent_alert_action`
|
||||
|
@ -896,6 +898,11 @@ ALTER TABLE `treport_content_template` ADD COLUMN `landscape` tinyint(1) UNSIGNE
|
|||
ALTER TABLE `treport_content_template` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `time_in_warning_status` TINYINT(1) DEFAULT '0';
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `checks_in_warning_status` TINYINT(1) DEFAULT '0';
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_network_filter` int(10) UNSIGNED DEFAULT 0;
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnews`
|
||||
|
@ -1774,6 +1781,11 @@ ALTER TABLE `treport_content` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NUL
|
|||
ALTER TABLE `treport_content` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content` MODIFY `external_source` MEDIUMTEXT;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `time_in_warning_status` TINYINT(1) DEFAULT '0';
|
||||
ALTER TABLE `treport_content` ADD COLUMN `checks_in_warning_status` TINYINT(1) DEFAULT '0';
|
||||
ALTER TABLE `treport_content` ADD COLUMN `ipam_network_filter` int(10) UNSIGNED DEFAULT 0;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmodule_relationship`
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin
|
||||
// Begin.
|
||||
require_once $config['homedir'].'/include/functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_categories.php';
|
||||
require_once $config['homedir'].'/include/graphs/functions_d3.php';
|
||||
|
@ -273,7 +273,8 @@ $table_simple->data[0][3] .= html_print_select_from_sql(
|
|||
true,
|
||||
false,
|
||||
true,
|
||||
$disabledBecauseInPolicy
|
||||
$disabledBecauseInPolicy,
|
||||
'width: 150px'
|
||||
);
|
||||
|
||||
if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) {
|
||||
|
@ -358,7 +359,7 @@ if (!$edit) {
|
|||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'width:200px',
|
||||
false,
|
||||
100
|
||||
);
|
||||
|
@ -637,7 +638,7 @@ $table_advanced->data[1][4] = html_print_extended_select_for_post_process(
|
|||
'0',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
'width:10em',
|
||||
false,
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
|
|
|
@ -0,0 +1,195 @@
|
|||
<?php
|
||||
/**
|
||||
* Empty Network map editor.
|
||||
*
|
||||
* @category View
|
||||
* @package Pandora FMS
|
||||
* @subpackage Enterprise
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 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.
|
||||
global $config;
|
||||
|
||||
// Check user credentials
|
||||
check_login();
|
||||
|
||||
$id = (int) get_parameter('id_networkmap', 0);
|
||||
|
||||
$new_empty_networkmap = (bool) get_parameter('new_empty_networkmap', false);
|
||||
$edit_networkmap = (bool) get_parameter('edit_networkmap', false);
|
||||
|
||||
$not_found = false;
|
||||
|
||||
if (empty($id)) {
|
||||
$new_empty_networkmap = true;
|
||||
$edit_networkmap = false;
|
||||
}
|
||||
|
||||
if ($new_empty_networkmap) {
|
||||
$name = '';
|
||||
$id_group = 0;
|
||||
$node_radius = 40;
|
||||
$description = '';
|
||||
}
|
||||
|
||||
if ($edit_networkmap) {
|
||||
if (enterprise_installed()) {
|
||||
$disabled_generation_method_select = true;
|
||||
}
|
||||
|
||||
$disabled_source = true;
|
||||
|
||||
$values = db_get_row('tmap', 'id', $id);
|
||||
|
||||
$not_found = false;
|
||||
if ($values === false) {
|
||||
$not_found = true;
|
||||
} else {
|
||||
$id_group = $values['id_group'];
|
||||
|
||||
// ACL for the network map
|
||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||
$networkmap_write = check_acl($config['id_user'], $id_group, 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $id_group, 'MM');
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access networkmap'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$name = io_safe_output($values['name']);
|
||||
|
||||
$description = $values['description'];
|
||||
|
||||
$filter = json_decode($values['filter'], true);
|
||||
|
||||
$node_radius = $filter['node_radius'];
|
||||
}
|
||||
}
|
||||
|
||||
// Header.
|
||||
ui_print_standard_header(
|
||||
__('Empty Network maps editor'),
|
||||
'images/bricks.png',
|
||||
false,
|
||||
'network_map_enterprise_edit',
|
||||
false,
|
||||
[],
|
||||
[
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Topology maps'),
|
||||
],
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Networkmap'),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
if ($not_found) {
|
||||
ui_print_error_message(__('Not found networkmap.'));
|
||||
} else {
|
||||
$table = new StdClass();
|
||||
$table->id = 'form_editor';
|
||||
|
||||
$table->width = '98%';
|
||||
$table->class = 'databox_color';
|
||||
|
||||
$table->head = [];
|
||||
|
||||
$table->size = [];
|
||||
$table->size[0] = '30%';
|
||||
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold; width: 150px;';
|
||||
$table->data = [];
|
||||
|
||||
$table->data[0][0] = __('Name');
|
||||
$table->data[0][1] = html_print_input_text(
|
||||
'name',
|
||||
$name,
|
||||
'',
|
||||
30,
|
||||
100,
|
||||
true
|
||||
);
|
||||
$table->data[1][0] = __('Group');
|
||||
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
|
||||
false,
|
||||
'AR',
|
||||
true,
|
||||
'id_group',
|
||||
$id_group,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
).'</div>';
|
||||
|
||||
$table->data[2][0] = __('Node radius');
|
||||
$table->data[2][1] = html_print_input_text(
|
||||
'node_radius',
|
||||
$node_radius,
|
||||
'',
|
||||
2,
|
||||
10,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[3][0] = __('Description');
|
||||
$table->data[3][1] = html_print_textarea('description', 7, 25, $description, '', true);
|
||||
|
||||
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
echo "<div style='width: ".$table->width."; text-align: right; margin-top:20px;'>";
|
||||
if ($new_empty_networkmap) {
|
||||
html_print_input_hidden('save_empty_networkmap', 1);
|
||||
html_print_submit_button(
|
||||
__('Save networkmap'),
|
||||
'crt',
|
||||
false,
|
||||
'class="sub next"'
|
||||
);
|
||||
}
|
||||
|
||||
if ($edit_networkmap) {
|
||||
html_print_input_hidden('id_networkmap', $id);
|
||||
html_print_input_hidden('update_empty_networkmap', 1);
|
||||
html_print_submit_button(
|
||||
__('Update networkmap'),
|
||||
'crt',
|
||||
false,
|
||||
'class="sub upd"'
|
||||
);
|
||||
}
|
||||
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
|
@ -861,10 +861,16 @@ foreach ($simple_alerts as $alert) {
|
|||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
|
||||
if ($policyInfo === false) {
|
||||
$data[1] .= '';
|
||||
$module_linked = policies_is_module_linked($alert['id_agent_module']);
|
||||
if (is_array($policyInfo) === false && $module_linked === false) {
|
||||
$data[$index['policy']] = '';
|
||||
} else {
|
||||
$img = 'images/policies_mc.png';
|
||||
$module_linked = policies_is_module_linked($alert['id_agent_module']);
|
||||
if ($module_linked === '0') {
|
||||
$img = 'images/unlinkpolicy.png';
|
||||
} else {
|
||||
$img = 'images/policies_mc.png';
|
||||
}
|
||||
|
||||
$data[1] .= ' <a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&pure='.$pure.'&id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
|
||||
}
|
||||
|
@ -886,7 +892,7 @@ foreach ($simple_alerts as $alert) {
|
|||
]
|
||||
);
|
||||
} else {
|
||||
if ((int) $alert['id_policy_alerts'] === 0) {
|
||||
if ((int) $alert['id_policy_alerts'] === 0 || $module_linked === '0') {
|
||||
$data[4] .= '<a href="javascript:show_add_action(\''.$alert['id'].'\');">';
|
||||
$data[4] .= html_print_image('images/add.png', true, ['title' => __('Add action'), 'class' => 'invert_filter']);
|
||||
$data[4] .= '</a>';
|
||||
|
|
|
@ -162,12 +162,14 @@ $filter_exclude = '';
|
|||
$total_time = true;
|
||||
$time_failed = true;
|
||||
$time_in_ok_status = true;
|
||||
$time_in_warning_status = false;
|
||||
$time_in_unknown_status = true;
|
||||
$time_of_not_initialized_module = true;
|
||||
$time_of_downtime = true;
|
||||
$total_checks = true;
|
||||
$checks_failed = true;
|
||||
$checks_in_ok_status = true;
|
||||
$checks_in_warning_status = true;
|
||||
$unknown_checks = true;
|
||||
$agent_max_value = true;
|
||||
$agent_min_value = true;
|
||||
|
@ -358,7 +360,6 @@ switch ($action) {
|
|||
$failover_type = $item['failover_type'];
|
||||
break;
|
||||
|
||||
case 'histogram_data':
|
||||
case 'module_histogram_graph':
|
||||
$description = $item['description'];
|
||||
$period = $item['period'];
|
||||
|
@ -399,6 +400,12 @@ switch ($action) {
|
|||
$sla_sorted_by = $item['top_n'];
|
||||
break;
|
||||
|
||||
case 'IPAM_network':
|
||||
$network_filter = $item['ipam_network_filter'];
|
||||
$alive_ip = $item['ipam_alive_ips'];
|
||||
$agent_not_assigned_to_ip = $item['ipam_ip_not_assigned_to_agent'];
|
||||
break;
|
||||
|
||||
case 'monitor_report':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
|
@ -673,12 +680,14 @@ switch ($action) {
|
|||
$total_time = $item['total_time'];
|
||||
$time_failed = $item['time_failed'];
|
||||
$time_in_ok_status = $item['time_in_ok_status'];
|
||||
$time_in_warning_status = $item['time_in_warning_status'];
|
||||
$time_in_unknown_status = $item['time_in_unknown_status'];
|
||||
$time_of_not_initialized_module = $item['time_of_not_initialized_module'];
|
||||
$time_of_downtime = $item['time_of_downtime'];
|
||||
$total_checks = $item['total_checks'];
|
||||
$checks_failed = $item['checks_failed'];
|
||||
$checks_in_ok_status = $item['checks_in_ok_status'];
|
||||
$checks_in_warning_status = $item['checks_in_warning_status'];
|
||||
$unknown_checks = $item['unknown_checks'];
|
||||
$agent_max_value = $item['agent_max_value'];
|
||||
$agent_min_value = $item['agent_min_value'];
|
||||
|
@ -837,7 +846,6 @@ switch ($action) {
|
|||
case 'database_serialized':
|
||||
case 'last_value':
|
||||
case 'monitor_report':
|
||||
case 'histogram_data':
|
||||
case 'min_value':
|
||||
case 'max_value':
|
||||
case 'avg_value':
|
||||
|
@ -1068,6 +1076,51 @@ $class = 'databox filters';
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_network_filter" class="datos">
|
||||
<td class="bolder"><?php echo __('Filter by network'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
$sql = 'SELECT id, CONCAT(name_network, " (", network, ")")
|
||||
FROM tipam_network';
|
||||
|
||||
html_print_select_from_sql(
|
||||
$sql,
|
||||
'network_filter',
|
||||
$network_filter,
|
||||
'',
|
||||
'',
|
||||
'0'
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_alive_ip" class="datos">
|
||||
<td class="bolder"><?php echo __('Show alive IPs only'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_checkbox_switch(
|
||||
'alive_ip',
|
||||
1,
|
||||
$alive_ip
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_agent_not_assigned_to_ip" class="datos">
|
||||
<td class="bolder"><?php echo __('Show IPs not assigned to an agent'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_checkbox_switch(
|
||||
'agent_not_assigned_to_ip',
|
||||
1,
|
||||
$agent_not_assigned_to_ip
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_period" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
|
@ -2310,6 +2363,14 @@ $class = 'databox filters';
|
|||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p class="mrgn_right_30px">
|
||||
<?php
|
||||
echo __('Time in warning status').'<br>';
|
||||
html_print_checkbox_switch('time_in_warning_status', 1, $time_in_warning_status);
|
||||
?>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p class="mrgn_right_30px">
|
||||
<?php
|
||||
echo __('Time in unknown status').'<br>';
|
||||
|
@ -2422,6 +2483,18 @@ $class = 'databox filters';
|
|||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p class="mrgn_right_30px">
|
||||
<?php
|
||||
echo __('Checks in Warning status');
|
||||
html_print_checkbox(
|
||||
'checks_in_warning_status',
|
||||
1,
|
||||
$checks_in_warning_status
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p class="mrgn_right_30px">
|
||||
<?php
|
||||
echo __('Unknown checks');
|
||||
|
@ -4433,7 +4506,6 @@ $(document).ready (function () {
|
|||
case 'max_value':
|
||||
case 'min_value':
|
||||
case 'monitor_report':
|
||||
case 'histogram_data':
|
||||
case 'database_serialized':
|
||||
case 'last_value':
|
||||
case 'sumatory':
|
||||
|
@ -4487,7 +4559,6 @@ $(document).ready (function () {
|
|||
case 'prediction_date':
|
||||
case 'projection_graph':
|
||||
case 'monitor_report':
|
||||
case 'histogram_data':
|
||||
case 'module_histogram_graph':
|
||||
case 'avg_value':
|
||||
case 'max_value':
|
||||
|
@ -4573,7 +4644,6 @@ $(document).ready (function () {
|
|||
case 'max_value':
|
||||
case 'min_value':
|
||||
case 'monitor_report':
|
||||
case 'histogram_data':
|
||||
case 'database_serialized':
|
||||
case 'last_value':
|
||||
case 'sumatory':
|
||||
|
@ -4622,7 +4692,6 @@ $(document).ready (function () {
|
|||
case 'prediction_date':
|
||||
case 'projection_graph':
|
||||
case 'monitor_report':
|
||||
case 'histogram_data':
|
||||
case 'module_histogram_graph':
|
||||
case 'avg_value':
|
||||
case 'max_value':
|
||||
|
@ -5514,7 +5583,9 @@ function chooseType() {
|
|||
$("#row_agent_version").hide();
|
||||
$("#row_agent_remote_conf").hide();
|
||||
$("#row_module_free_search").hide();
|
||||
|
||||
$("#row_network_filter").hide();
|
||||
$("#row_alive_ip").hide();
|
||||
$("#row_agent_not_assigned_to_ip").hide();
|
||||
|
||||
// SLA list default state.
|
||||
$("#sla_list").hide();
|
||||
|
@ -5650,7 +5721,6 @@ function chooseType() {
|
|||
$("#row_summary").show();
|
||||
break;
|
||||
|
||||
case 'histogram_data':
|
||||
case 'module_histogram_graph':
|
||||
$("#row_description").show();
|
||||
$("#row_period").show();
|
||||
|
@ -6231,6 +6301,13 @@ function chooseType() {
|
|||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'IPAM_network':
|
||||
$("#row_network_filter").show();
|
||||
$("#row_alive_ip").show();
|
||||
$("#row_agent_not_assigned_to_ip").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'permissions_report':
|
||||
$("#row_description").show();
|
||||
$("#row_users").show();
|
||||
|
|
|
@ -1759,6 +1759,9 @@ switch ($action) {
|
|||
$values['time_in_ok_status'] = get_parameter(
|
||||
'time_in_ok_status'
|
||||
);
|
||||
$values['time_in_warning_status'] = get_parameter(
|
||||
'time_in_warning_status'
|
||||
);
|
||||
$values['time_in_unknown_status'] = get_parameter(
|
||||
'time_in_unknown_status'
|
||||
);
|
||||
|
@ -1777,6 +1780,9 @@ switch ($action) {
|
|||
$values['checks_in_ok_status'] = get_parameter(
|
||||
'checks_in_ok_status'
|
||||
);
|
||||
$values['checks_in_warning_status'] = get_parameter(
|
||||
'checks_in_warning_status'
|
||||
);
|
||||
$values['unknown_checks'] = get_parameter(
|
||||
'unknown_checks'
|
||||
);
|
||||
|
@ -1832,6 +1838,13 @@ switch ($action) {
|
|||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'IPAM_network':
|
||||
$values['ipam_network_filter'] = get_parameter('network_filter');
|
||||
$values['ipam_alive_ips'] = get_parameter('alive_ip');
|
||||
$values['ipam_ip_not_assigned_to_agent'] = get_parameter('agent_not_assigned_to_ip');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['top_n'] = get_parameter(
|
||||
|
@ -1895,6 +1908,10 @@ switch ($action) {
|
|||
'time_in_ok_status',
|
||||
0
|
||||
);
|
||||
$values['time_in_warning_status'] = get_parameter(
|
||||
'time_in_warning_status',
|
||||
0
|
||||
);
|
||||
$values['time_in_unknown_status'] = get_parameter(
|
||||
'time_in_unknown_status',
|
||||
0
|
||||
|
@ -1919,6 +1936,10 @@ switch ($action) {
|
|||
'checks_in_ok_status',
|
||||
0
|
||||
);
|
||||
$values['checks_in_warning_status'] = get_parameter(
|
||||
'checks_in_warning_status',
|
||||
0
|
||||
);
|
||||
$values['unknown_checks'] = get_parameter(
|
||||
'unknown_checks',
|
||||
0
|
||||
|
@ -2185,7 +2206,6 @@ switch ($action) {
|
|||
break;
|
||||
|
||||
case 'module_histogram_graph':
|
||||
case 'histogram_data':
|
||||
case 'agent_configuration':
|
||||
case 'alert_report_agent':
|
||||
case 'alert_report_module':
|
||||
|
@ -2229,6 +2249,14 @@ switch ($action) {
|
|||
$values['external_source'] = json_encode($es);
|
||||
break;
|
||||
|
||||
case 'IPAM_network':
|
||||
$es['network_filter'] = get_parameter('network_filter');
|
||||
$es['alive_ip'] = get_parameter('alive_ip');
|
||||
$es['agent_not_assigned_to_ip'] = get_parameter('agent_not_assigned_to_ip');
|
||||
|
||||
// $values['external_source'] = json_encode($es);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
|
@ -2536,6 +2564,10 @@ switch ($action) {
|
|||
);
|
||||
}
|
||||
|
||||
$values['ipam_network_filter'] = get_parameter('network_filter', 0);
|
||||
$values['ipam_alive_ips'] = get_parameter('alive_ip', 0);
|
||||
$values['ipam_ip_not_assigned_to_agent'] = get_parameter('agent_not_assigned_to_ip', 0);
|
||||
|
||||
$values['only_display_wrong'] = (int) get_parameter(
|
||||
'checkbox_only_display_wrong',
|
||||
0
|
||||
|
@ -2560,6 +2592,10 @@ switch ($action) {
|
|||
'time_in_ok_status',
|
||||
0
|
||||
);
|
||||
$values['time_in_warning_status'] = get_parameter(
|
||||
'time_in_warning_status',
|
||||
0
|
||||
);
|
||||
$values['time_in_unknown_status'] = get_parameter(
|
||||
'time_in_unknown_status',
|
||||
0
|
||||
|
@ -2584,6 +2620,10 @@ switch ($action) {
|
|||
'checks_in_ok_status',
|
||||
0
|
||||
);
|
||||
$values['checks_in_warning_status'] = get_parameter(
|
||||
'checks_in_warning_status',
|
||||
0
|
||||
);
|
||||
$values['unknown_checks'] = get_parameter(
|
||||
'unknown_checks',
|
||||
0
|
||||
|
@ -2825,7 +2865,6 @@ switch ($action) {
|
|||
break;
|
||||
|
||||
case 'module_histogram_graph':
|
||||
case 'histogram_data':
|
||||
case 'agent_configuration':
|
||||
case 'alert_report_agent':
|
||||
case 'alert_report_module':
|
||||
|
@ -2869,6 +2908,12 @@ switch ($action) {
|
|||
$values['external_source'] = json_encode($es);
|
||||
break;
|
||||
|
||||
case 'IPAM_network':
|
||||
$es['network_filter'] = get_parameter('network_filter');
|
||||
$es['alive_ip'] = get_parameter('alive_ip');
|
||||
$es['agent_not_assigned_to_ip'] = get_parameter('agent_not_assigned_to_ip');
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
|
|
|
@ -87,7 +87,8 @@ if (function_exists('enterprise_hook') === true) {
|
|||
$days_to_expiry = ((strtotime($license_data['expiry_date']) - time()) / (60 * 60 * 24));
|
||||
|
||||
if ((int) $license_data['limit_mode'] === 0) {
|
||||
$limit = db_get_value('count(*)', 'tagente', 'disabled', 0);
|
||||
$agent_table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
|
||||
$limit = db_get_value('count(*)', $agent_table, 'disabled', 0);
|
||||
} else {
|
||||
$limit = db_get_value('count(*)', 'tagente_modulo', 'disabled', 0);
|
||||
}
|
||||
|
|
|
@ -991,7 +991,7 @@ $email = '<div class="label_select_simple">'.html_print_input_text_extended(
|
|||
$view_mode,
|
||||
'',
|
||||
[
|
||||
'class' => 'input input_line email_icon_input invert_filter',
|
||||
'class' => 'input input_line email_icon_input',
|
||||
'placeholder' => __('E-mail'),
|
||||
],
|
||||
true
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 565 B |
Binary file not shown.
After Width: | Height: | Size: 563 B |
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
|
@ -252,7 +252,9 @@ if ($save_event_filter) {
|
|||
$values['filter_only_alert'] = get_parameter('filter_only_alert');
|
||||
$values['id_group_filter'] = get_parameter('id_group_filter');
|
||||
$values['date_from'] = get_parameter('date_from');
|
||||
$values['time_from'] = get_parameter('time_from');
|
||||
$values['date_to'] = get_parameter('date_to');
|
||||
$values['time_to'] = get_parameter('time_to');
|
||||
$values['source'] = get_parameter('source');
|
||||
$values['id_extra'] = get_parameter('id_extra');
|
||||
$values['user_comment'] = get_parameter('user_comment');
|
||||
|
@ -304,13 +306,15 @@ if ($update_event_filter) {
|
|||
$values['filter_only_alert'] = get_parameter('filter_only_alert');
|
||||
$values['id_group_filter'] = get_parameter('id_group_filter');
|
||||
$values['date_from'] = get_parameter('date_from');
|
||||
$values['time_from'] = get_parameter('time_from');
|
||||
$values['date_to'] = get_parameter('date_to');
|
||||
$values['time_to'] = get_parameter('time_to');
|
||||
$values['source'] = get_parameter('source');
|
||||
$values['id_extra'] = get_parameter('id_extra');
|
||||
$values['user_comment'] = get_parameter('user_comment');
|
||||
$values['id_source_event'] = get_parameter('id_source_event');
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
$values['server_id'] = get_parameter('server_id');
|
||||
}
|
||||
|
||||
|
@ -355,7 +359,9 @@ if ($get_filter_values) {
|
|||
'id_extra' => '',
|
||||
'id_user_ack' => '',
|
||||
'date_from' => '',
|
||||
'time_from' => '',
|
||||
'date_to' => '',
|
||||
'time_to' => '',
|
||||
'severity' => '',
|
||||
'event_type' => '',
|
||||
'group_rep' => 0,
|
||||
|
@ -380,7 +386,7 @@ if ($get_filter_values) {
|
|||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
$server_name = db_get_value('server_name', 'tmetaconsole_setup', 'id', $event_filter['server_id']);
|
||||
if ($server_name !== false) {
|
||||
$event_filter['server_name'] = $server_name;
|
||||
|
@ -543,8 +549,12 @@ function load_form_filter() {
|
|||
$("#select2-server_id-container").text(val);
|
||||
if(i == 'date_from')
|
||||
$("#text-date_from").val(val);
|
||||
if(i == 'time_from')
|
||||
$("#text-time_from").val(val);
|
||||
if(i == 'date_to')
|
||||
$("#text-date_to").val(val);
|
||||
if(i == 'time_to')
|
||||
$("#text-time_to").val(val);
|
||||
if(i == 'module_search')
|
||||
$('input[name=module_search]').val(val);
|
||||
if(i == 'group_name')
|
||||
|
@ -767,7 +777,9 @@ function save_new_filter() {
|
|||
"filter_only_alert" : $("#filter_only_alert").val(),
|
||||
"id_group_filter": $("#id_group_filter").val(),
|
||||
"date_from": $("#text-date_from").val(),
|
||||
"time_from": $("#text-time_from").val(),
|
||||
"date_to": $("#text-date_to").val(),
|
||||
"time_to": $("#text-time_to").val(),
|
||||
"source": $("#text-source").val(),
|
||||
"id_extra": $("#text-id_extra").val(),
|
||||
"user_comment": $("#text-user_comment").val(),
|
||||
|
@ -838,7 +850,9 @@ function save_update_filter() {
|
|||
"filter_only_alert" : $("#filter_only_alert").val(),
|
||||
"id_group_filter": $("#id_group_filter").val(),
|
||||
"date_from": $("#text-date_from").val(),
|
||||
"time_from": $("#text-time_from").val(),
|
||||
"date_to": $("#text-date_to").val(),
|
||||
"time_to": $("#text-time_to").val(),
|
||||
"source": $("#text-source").val(),
|
||||
"id_extra": $("#text-id_extra").val(),
|
||||
"user_comment": $("#text-user_comment").val(),
|
||||
|
@ -1783,7 +1797,9 @@ if ($get_list_events_agents) {
|
|||
$tag_without = get_parameter('tag_without');
|
||||
$filter_only_alert = get_parameter('filter_only_alert');
|
||||
$date_from = get_parameter('date_from');
|
||||
$time_from = get_parameter('time_from', '00:00:00');
|
||||
$date_to = get_parameter('date_to');
|
||||
$time_to = get_parameter('time_to', '23:59:59');
|
||||
$id_user = $config['id_user'];
|
||||
|
||||
$returned_sql = events_sql_events_grouped_agents(
|
||||
|
@ -1800,7 +1816,9 @@ if ($get_list_events_agents) {
|
|||
$tag_without,
|
||||
$filter_only_alert,
|
||||
$date_from,
|
||||
$time_from,
|
||||
$date_to,
|
||||
$time_to,
|
||||
$id_user
|
||||
);
|
||||
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
// ______ __ _______ _______ _______
|
||||
// | __ \.---.-.-----.--| |.-----.----.---.-. | ___| | | __|
|
||||
// | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
// |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
//
|
||||
// ============================================================================
|
||||
// Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||
// This code is NOT free software. This code is NOT licenced under GPL2 licence
|
||||
// You cannnot redistribute it without written permission of copyright holder.
|
||||
// ============================================================================
|
||||
$networkmap = get_parameter('networkmap', false);
|
||||
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/class/NetworkMap.class.php';
|
||||
|
||||
|
||||
if ((bool) is_metaconsole() === true) {
|
||||
$node = get_parameter('node', 0);
|
||||
if ($node > 0) {
|
||||
metaconsole_connect(null, $node);
|
||||
}
|
||||
}
|
||||
|
||||
if ($networkmap) {
|
||||
$networkmap_id = get_parameter('networkmap_id', 0);
|
||||
$x_offset = get_parameter('x_offset', 0);
|
||||
$y_offset = get_parameter('y_offset', 0);
|
||||
$zoom_dash = get_parameter('zoom_dash', 0.5);
|
||||
|
||||
// Dashboard mode.
|
||||
$ignore_acl = (bool) get_parameter('ignore_acl', 0);
|
||||
|
||||
$networkmap = db_get_row_filter('tmap', ['id' => $networkmap_id]);
|
||||
|
||||
if ($ignore_acl === false) {
|
||||
// ACL for the network map.
|
||||
$networkmap_read = check_acl($config['id_user'], $networkmap['id_group'], 'MR');
|
||||
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM');
|
||||
|
||||
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access networkmap'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
|
||||
if ($node > 0) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
if ($networkmap['generation_method'] == LAYOUT_RADIAL_DYNAMIC) {
|
||||
$data['name'] = '<a href="index.php?'.'sec=network&'.'sec2=operation/agentes/networkmap.dinamic&'.'activeTab=radial_dynamic&'.'id_networkmap='.$networkmap['id'].'">'.$networkmap['name'].'</a>';
|
||||
global $id_networkmap;
|
||||
$id_networkmap = $networkmap['id'];
|
||||
$tab = 'radial_dynamic';
|
||||
|
||||
include_once 'operation/agentes/networkmap.dinamic.php';
|
||||
} else {
|
||||
$map = new NetworkMap(
|
||||
[
|
||||
'id_map' => $networkmap_id,
|
||||
'widget' => 1,
|
||||
'pure' => 1,
|
||||
'no_popup' => 1,
|
||||
'map_options' => [
|
||||
'x_offs' => $x_offset,
|
||||
'y_offs' => $y_offset,
|
||||
'z_dash' => $zoom_dash,
|
||||
],
|
||||
|
||||
|
||||
]
|
||||
);
|
||||
|
||||
$map->printMap(false, $ignore_acl);
|
||||
}
|
||||
|
||||
$return = ob_get_clean();
|
||||
|
||||
echo $return;
|
||||
|
||||
|
||||
if ($node > 0) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ($node > 0) {
|
||||
metaconsole_restore_db();
|
||||
}
|
|
@ -40,6 +40,7 @@ if (is_ajax() === true) {
|
|||
include_once $config['homedir'].'/include/class/TreeGroup.class.php';
|
||||
include_once $config['homedir'].'/include/class/TreeService.class.php';
|
||||
include_once $config['homedir'].'/include/class/TreeGroupEdition.class.php';
|
||||
enterprise_include_once('include/class/TreeIPAMSupernet.class.php');
|
||||
enterprise_include_once('include/class/TreePolicies.class.php');
|
||||
enterprise_include_once('include/class/TreeGroupMeta.class.php');
|
||||
include_once $config['homedir'].'/include/functions_reporting.php';
|
||||
|
@ -190,6 +191,18 @@ if (is_ajax() === true) {
|
|||
);
|
||||
break;
|
||||
|
||||
case 'IPAM_supernets':
|
||||
$tree = new TreeIPAMSupernet(
|
||||
$type,
|
||||
$rootType,
|
||||
$id,
|
||||
$rootID,
|
||||
$serverID,
|
||||
$childrenMethod,
|
||||
$access
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// No error handler.
|
||||
return;
|
||||
|
|
|
@ -770,7 +770,7 @@ function ldap_process_user_login($login, $password)
|
|||
io_safe_output($config['ldap_base_dn']),
|
||||
$config['ldap_login_attr'],
|
||||
io_safe_output($config['ldap_admin_login']),
|
||||
$config['ldap_admin_pass'],
|
||||
io_safe_output($config['ldap_admin_pass']),
|
||||
io_safe_output($login)
|
||||
);
|
||||
|
||||
|
|
|
@ -837,8 +837,11 @@ class ModuleTemplates extends HTML
|
|||
|
||||
$penInfo = db_get_all_rows_filter('tnetwork_profile_pen', ['id_np' => $this->id_np]);
|
||||
$penList = [];
|
||||
foreach ($penInfo as $pen) {
|
||||
$penList[] = $pen['pen'];
|
||||
// Handle if list of PEN does not exist or is empty.
|
||||
if ($penInfo !== false) {
|
||||
foreach ($penInfo as $pen) {
|
||||
$penList[] = $pen['pen'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->pen = implode(',', $penList);
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_networkmap.php';
|
||||
enterprise_include_once('include/functions_networkmap.php');
|
||||
enterprise_include_once('include/functions_discovery.php');
|
||||
|
||||
// Avoid node overlapping.
|
||||
|
@ -723,13 +722,7 @@ class NetworkMap
|
|||
}
|
||||
|
||||
if ($this->idMap !== false) {
|
||||
if (enterprise_installed()) {
|
||||
// Enterprise environment: LOAD.
|
||||
$this->nodes = enterprise_hook(
|
||||
'get_nodes_from_db',
|
||||
[$this->idMap]
|
||||
);
|
||||
}
|
||||
$this->nodes = get_nodes_from_db($this->idMap);
|
||||
}
|
||||
|
||||
return $this->nodes;
|
||||
|
@ -762,12 +755,7 @@ class NetworkMap
|
|||
}
|
||||
|
||||
if ($this->idMap !== false) {
|
||||
if (enterprise_installed()) {
|
||||
$this->relations = enterprise_hook(
|
||||
'get_relations_from_db',
|
||||
[$this->idMap]
|
||||
);
|
||||
}
|
||||
$this->relations = get_relations_from_db($this->idMap);
|
||||
}
|
||||
|
||||
return $this->relations;
|
||||
|
@ -786,12 +774,9 @@ class NetworkMap
|
|||
|
||||
// Calculate.
|
||||
// Search.
|
||||
if (enterprise_installed() && $this->idTask) {
|
||||
if ($this->idTask) {
|
||||
// Network map, based on discovery task.
|
||||
return enterprise_hook(
|
||||
'get_discovery_agents',
|
||||
[$this->idTask]
|
||||
);
|
||||
return get_discovery_agents($this->idTask);
|
||||
}
|
||||
|
||||
if ($this->network) {
|
||||
|
@ -1101,18 +1086,14 @@ class NetworkMap
|
|||
$relations = $this->relations;
|
||||
|
||||
// Generate if there's no data in DB about nodes or relations.
|
||||
if (empty($nodes) && empty($relations)) {
|
||||
if (empty($nodes) === true && empty($relations) === true) {
|
||||
$this->generateNetworkMap();
|
||||
return;
|
||||
}
|
||||
|
||||
$graph = enterprise_hook(
|
||||
'networkmap_load_map',
|
||||
[$this]
|
||||
);
|
||||
$graph = networkmap_load_map($this);
|
||||
|
||||
if ($graph === ENTERPRISE_NOT_HOOK) {
|
||||
// Method not available, regenerate.
|
||||
if (empty($graph) === true) {
|
||||
$this->generateNetworkMap();
|
||||
return;
|
||||
}
|
||||
|
@ -2607,15 +2588,7 @@ class NetworkMap
|
|||
|
||||
// Save data.
|
||||
if ($this->idMap > 0 && (isset($this->map['__simulated']) === false)) {
|
||||
if (enterprise_installed()) {
|
||||
$graph = enterprise_hook(
|
||||
'save_generate_nodes',
|
||||
[
|
||||
$this->idMap,
|
||||
$graph,
|
||||
]
|
||||
);
|
||||
}
|
||||
$graph = save_generate_nodes($this->idMap, $graph);
|
||||
|
||||
db_process_sql_update(
|
||||
'tmap',
|
||||
|
@ -2733,7 +2706,6 @@ class NetworkMap
|
|||
$output .= 'var networkmap_refresh_time = 1000 * '.$networkmap['source_period'].";\n";
|
||||
$output .= 'var networkmap_center = [ '.$networkmap['center_x'].', '.$networkmap['center_y']."];\n";
|
||||
$output .= 'var networkmap_dimensions = [ '.$networkmap['width'].', '.$networkmap['height']."];\n";
|
||||
$output .= 'var enterprise_installed = '.((int) enterprise_installed()).";\n";
|
||||
$output .= 'var networkmap_write = '.$networkmap_write.";\n";
|
||||
$output .= 'var node_radius = '.$networkmap['filter']['node_radius'].";\n";
|
||||
$output .= 'var networkmap_holding_area_dimensions = '.json_encode($networkmap['filter']['holding_area']).";\n";
|
||||
|
@ -2883,22 +2855,14 @@ class NetworkMap
|
|||
public function loadAdvancedInterface()
|
||||
{
|
||||
$list_networkmaps = get_networkmaps($this->idMap);
|
||||
if (empty($list_networkmaps)) {
|
||||
|
||||
if (empty($list_networkmaps) === true) {
|
||||
$list_networkmaps = [];
|
||||
}
|
||||
|
||||
$id = 'dialog_node_edit';
|
||||
if (!enterprise_installed()) {
|
||||
$id = 'open_version_dialog';
|
||||
$output = '<div id="open_version" style="display: none" title="'.__('Warning').'">';
|
||||
$output .= '<div class="center mrgn_top_20px w90p font_13px">'.__(
|
||||
'In the Open version of %s can not be edited nodes or map',
|
||||
get_product_name()
|
||||
);
|
||||
$output .= '</div></div>';
|
||||
}
|
||||
|
||||
$output .= '<div id="'.$id.'" class="invisible" title="';
|
||||
$output = '<div id="'.$id.'" class="invisible" title="';
|
||||
$output .= __('Edit node').'">';
|
||||
$output .= '<div class="left w100p">';
|
||||
|
||||
|
@ -3017,16 +2981,14 @@ class NetworkMap
|
|||
true
|
||||
);
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$output .= ui_toggle(
|
||||
html_print_table($table, true),
|
||||
__('Node options'),
|
||||
__('Node options'),
|
||||
'',
|
||||
true,
|
||||
true
|
||||
);
|
||||
}
|
||||
$output .= ui_toggle(
|
||||
html_print_table($table, true),
|
||||
__('Node options'),
|
||||
__('Node options'),
|
||||
'',
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
$table = new StdClass();
|
||||
$table->id = 'relations_table';
|
||||
|
@ -3109,16 +3071,14 @@ class NetworkMap
|
|||
true
|
||||
);
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$output .= ui_toggle(
|
||||
html_print_table($table, true),
|
||||
__('Relations'),
|
||||
__('Relations'),
|
||||
'',
|
||||
true,
|
||||
true
|
||||
);
|
||||
}
|
||||
$output .= ui_toggle(
|
||||
html_print_table($table, true),
|
||||
__('Relations'),
|
||||
__('Relations'),
|
||||
'',
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
$output .= '</div></div>';
|
||||
|
||||
|
@ -3245,6 +3205,16 @@ class NetworkMap
|
|||
-1,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[0][2] = html_print_checkbox(
|
||||
'group_recursion',
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
'choose_group_for_show_agents()'
|
||||
).__('Recursion');
|
||||
|
||||
$table->data[1][0] = __('Agents');
|
||||
$table->data[1][1] = html_print_select(
|
||||
[-1 => __('None')],
|
||||
|
@ -3340,8 +3310,7 @@ class NetworkMap
|
|||
{
|
||||
$output = '';
|
||||
|
||||
if (enterprise_installed()
|
||||
&& $this->useTooltipster
|
||||
if ($this->useTooltipster
|
||||
) {
|
||||
$output .= '<script type="text/javascript">
|
||||
$(function() {
|
||||
|
@ -3376,7 +3345,7 @@ class NetworkMap
|
|||
graph: networkmap,
|
||||
networkmap_center: networkmap_center,
|
||||
networkmap_dimensions: networkmap_dimensions,
|
||||
enterprise_installed: enterprise_installed,
|
||||
enterprise_installed: 1,
|
||||
node_radius: node_radius,
|
||||
holding_area_dimensions: networkmap_holding_area_dimensions,
|
||||
url_background_grid: url_background_grid,
|
||||
|
@ -3419,18 +3388,17 @@ class NetworkMap
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (enterprise_installed()
|
||||
&& isset($this->useTooltipster)
|
||||
&& $this->useTooltipster == true
|
||||
if (isset($this->useTooltipster) === true
|
||||
&& (bool) $this->useTooltipster === true
|
||||
) {
|
||||
$output = '<script type="text/javascript" src="'.ui_get_full_url(
|
||||
'include/javascript/d3.3.5.14.js'
|
||||
).'" charset="utf-8"></script>';
|
||||
$output .= '<script type="text/javascript" src="'.ui_get_full_url(
|
||||
'enterprise/include/javascript/SimpleMapController.js'
|
||||
'include/javascript/SimpleMapController.js'
|
||||
).'"></script>';
|
||||
$output .= '<script type="text/javascript" src="'.ui_get_full_url(
|
||||
'enterprise/include/javascript/tooltipster.bundle.min.js'
|
||||
'include/javascript/tooltipster.bundle.min.js'
|
||||
).'"></script>';
|
||||
$output .= '<script type="text/javascript" src="'.ui_get_full_url(
|
||||
'include/javascript/jquery.svg.js'
|
||||
|
@ -3439,7 +3407,7 @@ class NetworkMap
|
|||
'include/javascript/jquery.svgdom.js'
|
||||
).'"></script>';
|
||||
$output .= '<link rel="stylesheet" type="text/css" href="'.ui_get_full_url(
|
||||
'/enterprise/include/styles/tooltipster.bundle.min.css'
|
||||
'include/styles/tooltipster.bundle.min.css'
|
||||
).'" />'."\n";
|
||||
|
||||
$output .= '<div id="simple_map" data-id="'.$this->idMap.'" ';
|
||||
|
|
|
@ -222,20 +222,20 @@ class TreeService extends Tree
|
|||
|
||||
switch ($status) {
|
||||
case SERVICE_STATUS_NORMAL:
|
||||
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_ok_ball.png'.'" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="NORMAL status." />';
|
||||
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_ok_ball.png').'" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="NORMAL status." />';
|
||||
break;
|
||||
|
||||
case SERVICE_STATUS_CRITICAL:
|
||||
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_critical_ball.png'.'" data-title="CRITICAL status." data-use_title_for_force_title="1" class="forced_title" alt="CRITICAL status." />';
|
||||
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_critical_ball.png').'" data-title="CRITICAL status." data-use_title_for_force_title="1" class="forced_title" alt="CRITICAL status." />';
|
||||
break;
|
||||
|
||||
case SERVICE_STATUS_WARNING:
|
||||
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_warning_ball.png'.'" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
|
||||
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_warning_ball.png').'" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
|
||||
break;
|
||||
|
||||
case SERVICE_STATUS_UNKNOWN:
|
||||
default:
|
||||
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_no_data_ball.png'.'" data-title="UNKNOWN status." data-use_title_for_force_title="1" class="forced_title" alt="UNKNOWN status." />';
|
||||
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_no_data_ball.png').'" data-title="UNKNOWN status." data-use_title_for_force_title="1" class="forced_title" alt="UNKNOWN status." />';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -406,21 +406,21 @@ class TreeService extends Tree
|
|||
|
||||
switch ($item->agent()->lastStatus()) {
|
||||
case AGENT_STATUS_NORMAL:
|
||||
$tmp['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_ok_ball.png'.'" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="NORMAL status." />';
|
||||
$tmp['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_ok_ball.png').'" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="NORMAL status." />';
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
case AGENT_STATUS_ALERT_FIRED:
|
||||
$tmp['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_critical_ball.png'.'" data-title="CRITICAL status." data-use_title_for_force_title="1" class="forced_title" alt="CRITICAL status." />';
|
||||
$tmp['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_critical_ball.png').'" data-title="CRITICAL status." data-use_title_for_force_title="1" class="forced_title" alt="CRITICAL status." />';
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_WARNING:
|
||||
$tmp['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_warning_ball.png'.'" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
|
||||
$tmp['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_warning_ball.png').'" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
default:
|
||||
$tmp['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_no_data_ball.png'.'" data-title="UNKNOWN status." data-use_title_for_force_title="1" class="forced_title" alt="UNKNOWN status." />';
|
||||
$tmp['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_no_data_ball.png').'" data-title="UNKNOWN status." data-use_title_for_force_title="1" class="forced_title" alt="UNKNOWN status." />';
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,8 @@ class TreeTag extends Tree
|
|||
$this->L1orderByFinal = 'tt.name';
|
||||
|
||||
$this->L2condition = 'AND ttm.id_tag = '.$this->rootID;
|
||||
$this->L2inner = $this->L1innerInside;
|
||||
$this->L2inner = 'INNER JOIN ttag_module ttm
|
||||
ON ttm.id_agente_modulo = tam.id_agente_modulo';
|
||||
|
||||
$this->L3forceTagCondition = true;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC210915';
|
||||
$build_version = 'PC211004';
|
||||
$pandora_version = 'v7.0NG.757';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -234,6 +234,7 @@ define('CLOCK', 19);
|
|||
define('COLOR_CLOUD', 20);
|
||||
define('NETWORK_LINK', 21);
|
||||
define('ODOMETER', 22);
|
||||
define('BASIC_CHART', 23);
|
||||
// Some styles.
|
||||
define('MIN_WIDTH', 300);
|
||||
define('MIN_HEIGHT', 120);
|
||||
|
|
|
@ -3299,8 +3299,10 @@ function extract_column($array, $column)
|
|||
|
||||
function get_percentile($percentile, $array)
|
||||
{
|
||||
global $config;
|
||||
|
||||
sort($array);
|
||||
$index = (($percentile / 100) * count($array));
|
||||
$index = (($config['percentil'] / 100) * count($array));
|
||||
|
||||
if (floor($index) == $index) {
|
||||
$result = (($array[($index - 1)] + $array[$index]) / 2);
|
||||
|
|
|
@ -3072,7 +3072,7 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false)
|
|||
|
||||
$ni_by_agents = [];
|
||||
foreach ($agents as $agent) {
|
||||
$agent_id = $agent['id_agente'];
|
||||
$agent_id = (isset($agent['id_agente'])) ? $agent['id_agente'] : $agent;
|
||||
$agent_group_id = $agent['id_grupo'];
|
||||
$agent_name = $agent['alias'];
|
||||
$agent_interfaces = [];
|
||||
|
|
|
@ -5777,10 +5777,6 @@ function api_set_create_alert_template($name, $thrash1, $other, $thrash3)
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
|
@ -16733,9 +16729,15 @@ function api_get_group_id_by_name($thrash1, $thrash2, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
if (is_array($other['data']) === true) {
|
||||
$group_id = $other['data'][0];
|
||||
} else {
|
||||
$group_id = $other['data'];
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT id_grupo
|
||||
FROM tgrupo WHERE nombre = "'.$other['data'].'"'
|
||||
FROM tgrupo WHERE nombre = "'.$group_id.'"'
|
||||
);
|
||||
|
||||
$group_id = db_get_all_rows_sql($sql);
|
||||
|
|
|
@ -620,7 +620,7 @@ function config_update_config()
|
|||
$error_update[] = __('Admin LDAP login');
|
||||
}
|
||||
|
||||
if (!config_update_value('ldap_admin_pass', io_input_password(get_parameter('ldap_admin_pass')))) {
|
||||
if (!config_update_value('ldap_admin_pass', get_parameter('ldap_admin_pass'))) {
|
||||
$error_update[] = __('Admin LDAP password');
|
||||
}
|
||||
|
||||
|
|
|
@ -762,7 +762,7 @@ function events_get_all(
|
|||
}
|
||||
|
||||
if (isset($filter['time_from'])) {
|
||||
$time_from = $filter['time_from'];
|
||||
$time_from = (empty($filter['time_from']) === true) ? '00:00:00' : $filter['time_from'];
|
||||
}
|
||||
|
||||
if (isset($date_from)) {
|
||||
|
@ -785,7 +785,7 @@ function events_get_all(
|
|||
}
|
||||
|
||||
if (isset($filter['time_to'])) {
|
||||
$time_to = $filter['time_to'];
|
||||
$time_to = (empty($filter['time_to']) === true) ? '23:59:59' : $filter['time_to'];
|
||||
}
|
||||
|
||||
if (isset($date_to)) {
|
||||
|
@ -6193,7 +6193,9 @@ function events_get_events_grouped_by_agent(
|
|||
* @param array $tag_without Tag_without.
|
||||
* @param boolean $filter_only_alert Filter_only_alert.
|
||||
* @param string $date_from Date_from.
|
||||
* @param string $time_from Time_from.
|
||||
* @param string $date_to Date_to.
|
||||
* @param string $time_to Time_to.
|
||||
* @param boolean $id_user Id_user.
|
||||
* @param boolean $server_id_search Server_id_search.
|
||||
*
|
||||
|
@ -6213,7 +6215,9 @@ function events_sql_events_grouped_agents(
|
|||
$tag_without=[],
|
||||
$filter_only_alert=false,
|
||||
$date_from='',
|
||||
$time_from='',
|
||||
$date_to='',
|
||||
$time_to='',
|
||||
$id_user=false,
|
||||
$server_id_search=false
|
||||
) {
|
||||
|
@ -6320,27 +6324,35 @@ function events_sql_events_grouped_agents(
|
|||
$sql_post .= " AND id_usuario = '".$id_user_ack."'";
|
||||
}
|
||||
|
||||
if (!isset($date_from)) {
|
||||
if (isset($date_from) === false) {
|
||||
$date_from = '';
|
||||
}
|
||||
|
||||
if (!isset($date_to)) {
|
||||
if (isset($time_from) === false) {
|
||||
$time_from = '00:00:00';
|
||||
}
|
||||
|
||||
if (isset($date_to) === false) {
|
||||
$date_to = '';
|
||||
}
|
||||
|
||||
if (isset($time_to) === false || empty($time_to) === true) {
|
||||
$time_to = '23:59:59';
|
||||
}
|
||||
|
||||
if (($date_from == '') && ($date_to == '')) {
|
||||
if ($event_view_hr > 0) {
|
||||
$unixtime = (get_system_time() - ($event_view_hr * SECONDS_1HOUR));
|
||||
$sql_post .= ' AND (utimestamp > '.$unixtime.')';
|
||||
}
|
||||
} else {
|
||||
if ($date_from != '') {
|
||||
$udate_from = strtotime($date_from.' 00:00:00');
|
||||
if (empty($date_from) === false) {
|
||||
$udate_from = strtotime($date_from.' '.$time_from);
|
||||
$sql_post .= ' AND (utimestamp >= '.$udate_from.')';
|
||||
}
|
||||
|
||||
if ($date_to != '') {
|
||||
$udate_to = strtotime($date_to.' 23:59:59');
|
||||
if (empty($date_to) === false) {
|
||||
$udate_to = strtotime($date_to.' '.$time_to);
|
||||
$sql_post .= ' AND (utimestamp <= '.$udate_to.')';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -835,6 +835,10 @@ function grafico_modulo_sparse($params)
|
|||
$font_size = $config['font_size'];
|
||||
}
|
||||
|
||||
if (isset($params['basic_chart']) === false) {
|
||||
$params['basic_chart'] = false;
|
||||
}
|
||||
|
||||
// If is metaconsole set 10pt size value.
|
||||
if (is_metaconsole()) {
|
||||
$font_size = '10';
|
||||
|
@ -1416,14 +1420,6 @@ function graphic_combined_module(
|
|||
$labels = [];
|
||||
$modules = [];
|
||||
foreach ($sources as $source) {
|
||||
$id_agent = agents_get_module_id(
|
||||
$source['id_agent_module']
|
||||
);
|
||||
|
||||
if (!$id_agent) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
metaconsole_restore_db();
|
||||
$server = metaconsole_get_connection_by_id($source['id_server']);
|
||||
|
@ -1432,6 +1428,14 @@ function graphic_combined_module(
|
|||
}
|
||||
}
|
||||
|
||||
$id_agent = agents_get_module_id(
|
||||
$source['id_agent_module']
|
||||
);
|
||||
|
||||
if (!$id_agent) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$modulepush = [
|
||||
'server' => (isset($source['id_server']) === true) ? $source['id_server'] : 0,
|
||||
'module' => $source['id_agent_module'],
|
||||
|
@ -3755,7 +3759,7 @@ function graph_custom_sql_graph(
|
|||
0,
|
||||
floor($SQL_GRAPH_MAX_LABEL_SIZE / 2)
|
||||
);
|
||||
$label .= '...';
|
||||
$label .= '...<br>';
|
||||
$label .= substr(
|
||||
$first_label,
|
||||
floor(-$SQL_GRAPH_MAX_LABEL_SIZE / 2)
|
||||
|
@ -4808,7 +4812,11 @@ function graph_netflow_aggregate_pie($data, $aggregate, $ttl=1, $only_image=fals
|
|||
$water_mark,
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
$ttl
|
||||
$ttl,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
6
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4833,7 +4841,7 @@ function graph_netflow_circular_mesh($data)
|
|||
|
||||
include_once $config['homedir'].'/include/graphs/functions_d3.php';
|
||||
|
||||
return d3_relationship_graph($data['elements'], $data['matrix'], 700, true);
|
||||
return d3_relationship_graph($data['elements'], $data['matrix'], 900, true);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1774,6 +1774,12 @@ function html_print_extended_select_for_post_process(
|
|||
$uniq_name = $name;
|
||||
}
|
||||
|
||||
$style = 'font-size: xx-small;';
|
||||
|
||||
if ($select_style !== false) {
|
||||
$style .= sprintf(' %s', $select_style);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
echo '<div id="'.$uniq_name.'_default" style="w100p inline_line">';
|
||||
|
@ -1789,7 +1795,7 @@ function html_print_extended_select_for_post_process(
|
|||
false,
|
||||
'',
|
||||
$disabled,
|
||||
'font-size: xx-small;'.$select_style
|
||||
$style
|
||||
);
|
||||
echo ' <a href="javascript:">'.html_print_image(
|
||||
'images/pencil.png',
|
||||
|
@ -1840,20 +1846,20 @@ function html_print_extended_select_for_post_process(
|
|||
/**
|
||||
* Render a pair of select for times and text box for set the time more fine.
|
||||
*
|
||||
* @param string $name Select form name
|
||||
* @param variant $selected Current selected value. Can be a single value or an array of selected values (in combination with multiple)
|
||||
* @param string $name Select form name.
|
||||
* @param mixed $selected Current selected value. Can be a single value or an array of selected values (in combination with multiple).
|
||||
* @param string $script Javascript onChange (select) code.
|
||||
* @param string $nothing Label when nothing is selected.
|
||||
* @param variant $nothing_value Value when nothing is selected
|
||||
* @param mixed $nothing_value Value when nothing is selected.
|
||||
* @param integer $size Size of the input.
|
||||
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param boolean $select_style Wherter to assign to combo a unique name (to have more than one on same page, like dashboard)
|
||||
* @param boolean $unique_name
|
||||
* @param string $class
|
||||
* @param boolean $readonly
|
||||
* @param string $custom_fields
|
||||
* @param string $style_icon
|
||||
* @param boolean $no_change
|
||||
* @param boolean $select_style Wherter to assign to combo a unique name (to have more than one on same page, like dashboard).
|
||||
* @param boolean $unique_name Uunique name value.
|
||||
* @param string $class Class value.
|
||||
* @param boolean $readonly Readonly value.
|
||||
* @param string $custom_fields Custom fields value.
|
||||
* @param string $style_icon Style icon value.
|
||||
* @param boolean $no_change No change value.
|
||||
* @param boolean $allow_zero Allow the use of the value zero.
|
||||
|
||||
* @return string HTML code if return parameter is true.
|
||||
|
@ -1935,7 +1941,7 @@ function html_print_extended_select_for_time(
|
|||
|
||||
ob_start();
|
||||
// Use the no_meta parameter because this image is only in the base console.
|
||||
echo '<div id="'.$uniq_name.'_default" class="wauto inline_line">';
|
||||
echo '<div id="'.$uniq_name.'_default" class="wauto inline_flex">';
|
||||
html_print_select(
|
||||
$fields,
|
||||
$uniq_name.'_select',
|
||||
|
@ -2024,13 +2030,14 @@ function html_print_extended_select_for_time(
|
|||
/**
|
||||
* Print selects to configure the cron of a module.
|
||||
*
|
||||
* @param string Run hour.
|
||||
* @param string Run minute.
|
||||
* @param string Run day of the month.
|
||||
* @param string Run month.
|
||||
* @param string Run day of the week.
|
||||
* @param bool Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param bool Print cron grayed
|
||||
* @param string $hour Run hour.
|
||||
* @param string $minute Run minute.
|
||||
* @param string $mday Run day of the month.
|
||||
* @param string $month Run month.
|
||||
* @param string $wday Run day of the week.
|
||||
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param boolean $disabled If true, the control will show disabled.
|
||||
* @param boolean $to Print cron grayed.
|
||||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
|
@ -4814,7 +4821,11 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
((isset($data['size']) === true) ? $data['size'] : false),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['style']) === true) ? $data['selected'] : false),
|
||||
((isset($data['unique']) === true) ? $data['unique'] : false)
|
||||
((isset($data['unique']) === true) ? $data['unique'] : false),
|
||||
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||
((isset($data['readonly']) === true) ? $data['readonly'] : false),
|
||||
((isset($data['custom_fields']) === true) ? $data['custom_fields'] : false),
|
||||
((isset($data['style_icon']) === true) ? $data['style_icon'] : '')
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -5280,7 +5291,7 @@ function html_print_tabs(array $tabs)
|
|||
* Create a datalist.
|
||||
*
|
||||
* @param string $id Use custom id.
|
||||
* @param string $values Input values.
|
||||
* @param array $values Input values.
|
||||
* @param string $returnparam Whether to return an output string or echo now (optional, echo by default).
|
||||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
|
|
|
@ -420,7 +420,8 @@ function netflow_get_data(
|
|||
$max,
|
||||
$absolute,
|
||||
$connection_name='',
|
||||
$address_resolution=false
|
||||
$address_resolution=false,
|
||||
$network_format_bytes=false
|
||||
) {
|
||||
global $nfdump_date_format;
|
||||
global $config;
|
||||
|
@ -560,7 +561,25 @@ function netflow_get_data(
|
|||
continue;
|
||||
}
|
||||
|
||||
$values['data'][$interval_end][$line['agg']] = $line['data'];
|
||||
if ($network_format_bytes == true) {
|
||||
$pos = 0;
|
||||
$number = $line['data'];
|
||||
while ($number >= 1024) {
|
||||
// As long as the number can be divided by divider.
|
||||
$pos++;
|
||||
// Position in array starting with 0.
|
||||
$number = ($number / 1024);
|
||||
}
|
||||
|
||||
while ($pos > 0) {
|
||||
$number = ($number * 1000);
|
||||
$pos --;
|
||||
}
|
||||
|
||||
$values['data'][$interval_end][$line['agg']] = $number;
|
||||
} else {
|
||||
$values['data'][$interval_end][$line['agg']] = $line['data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1080,9 +1099,10 @@ function netflow_draw_item(
|
|||
$filter,
|
||||
$aggregate,
|
||||
$max_aggregates,
|
||||
false,
|
||||
true,
|
||||
$connection_name,
|
||||
$address_resolution
|
||||
$address_resolution,
|
||||
true
|
||||
);
|
||||
|
||||
if (empty($data) === true) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -757,6 +757,13 @@ function reporting_make_reporting_data(
|
|||
);
|
||||
break;
|
||||
|
||||
case 'IPAM_network':
|
||||
$report['contents'][] = reporting_ipam(
|
||||
$report,
|
||||
$content
|
||||
);
|
||||
break;
|
||||
|
||||
case 'agent_detailed_event':
|
||||
case 'event_report_agent':
|
||||
$report_control = io_safe_output(
|
||||
|
@ -858,7 +865,6 @@ function reporting_make_reporting_data(
|
|||
);
|
||||
break;
|
||||
|
||||
case 'histogram_data':
|
||||
case 'module_histogram_graph':
|
||||
$report['contents'][] = reporting_module_histogram_graph(
|
||||
$report,
|
||||
|
@ -6710,7 +6716,8 @@ function reporting_advanced_sla(
|
|||
$timeFrom=null,
|
||||
$timeTo=null,
|
||||
$slices=1,
|
||||
$inclusive_downtimes=1
|
||||
$inclusive_downtimes=1,
|
||||
$sla_check_warning=false
|
||||
) {
|
||||
// In content:
|
||||
// Example: [time_from, time_to] => Worktime
|
||||
|
@ -6732,27 +6739,55 @@ function reporting_advanced_sla(
|
|||
|
||||
// Take in mind: the "inverse" critical threshold.
|
||||
$inverse_interval = ($agentmodule_info['critical_inverse'] == 0) ? 1 : 0;
|
||||
$inverse_interval_warning = (int) $agentmodule_info['critical_warning'];
|
||||
|
||||
if (!$is_string_module) {
|
||||
$min_value = $agentmodule_info['min_critical'];
|
||||
$max_value = $agentmodule_info['max_critical'];
|
||||
$min_value = $agentmodule_info['min_critical'];
|
||||
$max_value = $agentmodule_info['max_critical'];
|
||||
$min_value_warning = $agentmodule_info['min_warning'];
|
||||
$max_value_warning = $agentmodule_info['max_warning'];
|
||||
} else {
|
||||
$max_value = io_safe_output($agentmodule_info['str_critical']);
|
||||
$max_values = io_safe_output($agentmodule_info['str_critical']);
|
||||
$max_value_warning = io_safe_output($agentmodule_info['str_warning']);
|
||||
}
|
||||
|
||||
if (!$is_string_module) {
|
||||
if ((!isset($min_value)) || ($min_value == 0)) {
|
||||
if (isset($min_value) === false || (int) $min_value === 0) {
|
||||
$min_value = null;
|
||||
}
|
||||
|
||||
if ((!isset($max_value)) || ($max_value == 0)) {
|
||||
$max_value = null;
|
||||
if (isset($max_value) === false || (int) $max_value === 0) {
|
||||
if ($max_value === '0'
|
||||
&& $max_value < $min_value
|
||||
&& isset($min_value_warning) === true
|
||||
&& $min_value_warning > $max_value
|
||||
) {
|
||||
$max_value = $min_value_warning;
|
||||
} else {
|
||||
$max_value = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!(isset($max_value))) && (!(isset($min_value)))) {
|
||||
if (isset($max_value) === false && isset($min_value) === false) {
|
||||
$max_value = null;
|
||||
$min_value = null;
|
||||
}
|
||||
|
||||
if (isset($min_value_warning) === false || (int) $min_value_warning === 0) {
|
||||
$min_value_warning = null;
|
||||
}
|
||||
|
||||
if (isset($max_value_warning) === false || (int) $max_value_warning === 0) {
|
||||
if ((int) $max_value_warning === 0
|
||||
&& $max_value_warning < $min_value_warning
|
||||
&& isset($min_value) === true
|
||||
&& $min_value > $max_value_warning
|
||||
) {
|
||||
$max_value_warning = $min_value;
|
||||
} else {
|
||||
$max_value_warning = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((!isset($min_value)) && (!isset($max_value))) {
|
||||
|
@ -6778,6 +6813,30 @@ function reporting_advanced_sla(
|
|||
$min_value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!isset($min_value_warning)) && (!isset($max_value_warning))) {
|
||||
if (($agentmodule_info['id_tipo_modulo'] == '2')
|
||||
// Generic_proc.
|
||||
|| ($agentmodule_info['id_tipo_modulo'] == '6')
|
||||
// Remote_icmp_proc.
|
||||
|| ($agentmodule_info['id_tipo_modulo'] == '9')
|
||||
// Remote_tcp_proc.
|
||||
|| ($agentmodule_info['id_tipo_modulo'] == '18')
|
||||
// Remote_snmp_proc.
|
||||
|| ($agentmodule_info['id_tipo_modulo'] == '21')
|
||||
// Async_proc.
|
||||
|| ($agentmodule_info['id_tipo_modulo'] == '31')
|
||||
) {
|
||||
// Web_proc
|
||||
// boolean values are OK if they're different from 0.
|
||||
$max_value_warning = 0;
|
||||
$min_value_warning = 0;
|
||||
$inverse_interval_warning = 0;
|
||||
} else if ($agentmodule_info['id_tipo_modulo'] == '100') {
|
||||
$max_value_warning = 0.9;
|
||||
$min_value_warning = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// By default show last day.
|
||||
|
@ -7121,6 +7180,7 @@ function reporting_advanced_sla(
|
|||
// Timing.
|
||||
$time_total = 0;
|
||||
$time_in_ok = 0;
|
||||
$time_in_warning = 0;
|
||||
$time_in_error = 0;
|
||||
$time_in_unknown = 0;
|
||||
$time_in_not_init = 0;
|
||||
|
@ -7130,6 +7190,7 @@ function reporting_advanced_sla(
|
|||
// Checks.
|
||||
$bad_checks = 0;
|
||||
$ok_checks = 0;
|
||||
$warning_checks = 0;
|
||||
$not_init_checks = 0;
|
||||
$unknown_checks = 0;
|
||||
$total_checks = 0;
|
||||
|
@ -7222,6 +7283,7 @@ function reporting_advanced_sla(
|
|||
) {
|
||||
// Check values if module is sring type.
|
||||
if ($is_string_module) {
|
||||
// OK SLA check.
|
||||
if (empty($max_value)) {
|
||||
$match = preg_match('/^'.$max_value.'$/', $current_data['datos']);
|
||||
} else {
|
||||
|
@ -7234,17 +7296,49 @@ function reporting_advanced_sla(
|
|||
} else {
|
||||
$sla_check_value = !$match;
|
||||
}
|
||||
|
||||
// Warning SLA check.
|
||||
if (empty($max_value_warning)) {
|
||||
$match = preg_match('/^'.$max_value_warning.'$/', $current_data['datos']);
|
||||
} else {
|
||||
$match = preg_match('/'.$max_value_warning.'/', $current_data['datos']);
|
||||
}
|
||||
|
||||
if ($inverse_interval_warning == 0) {
|
||||
$sla_check_value_warning = $match;
|
||||
} else {
|
||||
$sla_check_value_warning = !$match;
|
||||
}
|
||||
} else {
|
||||
// OK SLA check.
|
||||
$sla_check_value = sla_check_value(
|
||||
$current_data['datos'],
|
||||
$min_value,
|
||||
$max_value,
|
||||
$inverse_interval
|
||||
);
|
||||
|
||||
// Warning SLA check.
|
||||
$sla_check_value_warning = sla_check_value(
|
||||
$current_data['datos'],
|
||||
$min_value_warning,
|
||||
$max_value_warning,
|
||||
$inverse_interval_warning,
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
// Not unknown nor not init values.
|
||||
if ($sla_check_value) {
|
||||
if ($sla_check_value_warning && $sla_check_warning === true) {
|
||||
if (isset($current_data['type']) === false
|
||||
|| ((int) $current_data['type'] === 0
|
||||
&& $i !== 0)
|
||||
) {
|
||||
$warning_checks++;
|
||||
}
|
||||
|
||||
$time_in_warning += $time_interval;
|
||||
} else if ($sla_check_value === true) {
|
||||
if (isset($current_data['type']) === false
|
||||
|| ((int) $current_data['type'] === 0
|
||||
&& $i !== 0)
|
||||
|
@ -7319,6 +7413,7 @@ function reporting_advanced_sla(
|
|||
// Timing.
|
||||
$return['time_total'] = $time_total;
|
||||
$return['time_ok'] = $time_in_ok;
|
||||
$return['time_warning'] = $time_in_warning;
|
||||
$return['time_error'] = $time_in_error;
|
||||
$return['time_unknown'] = $time_in_unknown;
|
||||
$return['time_not_init'] = $time_in_not_init;
|
||||
|
@ -7328,12 +7423,13 @@ function reporting_advanced_sla(
|
|||
// Checks.
|
||||
$return['checks_total'] = $total_checks;
|
||||
$return['checks_ok'] = $ok_checks;
|
||||
$return['checks_warning'] = $warning_checks;
|
||||
$return['checks_error'] = $bad_checks;
|
||||
$return['checks_unknown'] = $unknown_checks;
|
||||
$return['checks_not_init'] = $not_init_checks;
|
||||
|
||||
// SLA.
|
||||
$return['SLA'] = reporting_sla_get_compliance_from_array($return);
|
||||
$return['SLA'] = reporting_sla_get_compliance_from_array($return, $sla_check_warning);
|
||||
$return['sla_fixed'] = sla_truncate(
|
||||
$return['SLA'],
|
||||
$config['graph_precision']
|
||||
|
@ -7538,6 +7634,8 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
|
||||
$text = '';
|
||||
|
||||
$check_sla_warning = ((int) $content['time_in_warning_status']) === 1;
|
||||
|
||||
if (isset($item['compare']) === true
|
||||
&& empty($item['compare']) === true
|
||||
) {
|
||||
|
@ -7559,14 +7657,26 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
'7' => $content['saturday'],
|
||||
],
|
||||
$content['time_from'],
|
||||
$content['time_to']
|
||||
$content['time_to'],
|
||||
1,
|
||||
1,
|
||||
$check_sla_warning
|
||||
);
|
||||
} else {
|
||||
// Intervals is dinamic.
|
||||
$row['data'] = reporting_advanced_sla(
|
||||
$item['id_agent_module'],
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime']
|
||||
$report['datetime'],
|
||||
null,
|
||||
null,
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
1,
|
||||
1,
|
||||
$check_sla_warning
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -7712,12 +7822,14 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
$return['fields']['total_time'] = $content['total_time'];
|
||||
$return['fields']['time_failed'] = $content['time_failed'];
|
||||
$return['fields']['time_in_ok_status'] = $content['time_in_ok_status'];
|
||||
$return['fields']['time_in_warning_status'] = $content['time_in_warning_status'];
|
||||
$return['fields']['time_in_unknown_status'] = $content['time_in_unknown_status'];
|
||||
$return['fields']['time_of_not_initialized_module'] = $content['time_of_not_initialized_module'];
|
||||
$return['fields']['time_of_downtime'] = $content['time_of_downtime'];
|
||||
$return['fields']['total_checks'] = $content['total_checks'];
|
||||
$return['fields']['checks_failed'] = $content['checks_failed'];
|
||||
$return['fields']['checks_in_ok_status'] = $content['checks_in_ok_status'];
|
||||
$return['fields']['checks_in_warning_status'] = $content['checks_in_warning_status'];
|
||||
$return['fields']['unknown_checks'] = $content['unknown_checks'];
|
||||
$return['fields']['agent_max_value'] = $content['agent_max_value'];
|
||||
$return['fields']['agent_min_value'] = $content['agent_min_value'];
|
||||
|
@ -9559,12 +9671,14 @@ function reporting_check_structure_content($report)
|
|||
$return['fields']['total_time'] = '';
|
||||
$return['fields']['time_failed'] = '';
|
||||
$return['fields']['time_in_ok_status'] = '';
|
||||
$return['fields']['time_in_warning_status'] = '';
|
||||
$return['fields']['time_in_unknown_status'] = '';
|
||||
$return['fields']['time_of_not_initialized_module'] = '';
|
||||
$return['fields']['time_of_downtime'] = '';
|
||||
$return['fields']['total_checks'] = '';
|
||||
$return['fields']['checks_failed'] = '';
|
||||
$return['fields']['checks_in_ok_status'] = '';
|
||||
$return['fields']['checks_in_warning_status'] = '';
|
||||
$return['fields']['unknown_checks'] = '';
|
||||
$return['fields']['agent_max_value'] = '';
|
||||
$return['fields']['agent_min_value'] = '';
|
||||
|
@ -13616,9 +13730,14 @@ function reporting_sql_macro(array $report, string $sql): string
|
|||
* @param Array With keys time_ok, time_error, time_downtime and time_unknown
|
||||
* @return SLA Return the compliance value.
|
||||
*/
|
||||
function reporting_sla_get_compliance_from_array($sla_array)
|
||||
function reporting_sla_get_compliance_from_array($sla_array, $sla_check_warning=false)
|
||||
{
|
||||
$time_compliance = ($sla_array['time_ok'] + $sla_array['time_unknown'] + $sla_array['time_downtime']);
|
||||
|
||||
if ($sla_check_warning === true) {
|
||||
$time_compliance += $sla_array['time_warning'];
|
||||
}
|
||||
|
||||
$time_total_working = ($time_compliance + $sla_array['time_error']);
|
||||
return $time_compliance == 0 ? 0 : (($time_compliance / $time_total_working) * 100);
|
||||
}
|
||||
|
|
|
@ -389,6 +389,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||
reporting_html_inventory_changes($table, $item);
|
||||
break;
|
||||
|
||||
case 'IPAM_network':
|
||||
reporting_enterprise_html_ipam($table, $item, $mini);
|
||||
break;
|
||||
|
||||
case 'agent_detailed_event':
|
||||
case 'event_report_agent':
|
||||
reporting_html_event_report_agent($table, $item);
|
||||
|
@ -433,10 +437,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||
$mini
|
||||
);
|
||||
break;
|
||||
|
||||
case 'histogram_data':
|
||||
reporting_enterprise_html_histogram_data($table, $item, $mini);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($item['type'] == 'agent_module') {
|
||||
|
@ -1535,7 +1535,7 @@ function reporting_html_agents_inventory($table, $item, $pdf=0)
|
|||
foreach ($data as $data_field_key => $data_field_value) {
|
||||
$column_value = $data_field_value;
|
||||
|
||||
$show_link = $pdf === 0 ? true : false;
|
||||
$show_link = ($pdf === 0) ? true : false;
|
||||
|
||||
// Necessary transformations of data prior to represent it.
|
||||
if ($data_field_key === 'id_os') {
|
||||
|
@ -3566,25 +3566,31 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
$table1->head[4] = __('');
|
||||
}
|
||||
|
||||
if ($item['fields']['time_in_unknown_status']) {
|
||||
$table1->head[5] = __('Time Unknown');
|
||||
if ($item['fields']['time_in_warning_status']) {
|
||||
$table1->head[5] = __('Time in warning status');
|
||||
} else {
|
||||
$table1->head[5] = __('');
|
||||
}
|
||||
|
||||
if ($item['fields']['time_of_not_initialized_module']) {
|
||||
$table1->head[6] = __('Time Not Init Module');
|
||||
if ($item['fields']['time_in_unknown_status']) {
|
||||
$table1->head[6] = __('Time Unknown');
|
||||
} else {
|
||||
$table1->head[6] = __('');
|
||||
}
|
||||
|
||||
if ($item['fields']['time_of_downtime']) {
|
||||
$table1->head[7] = __('Time Downtime');
|
||||
if ($item['fields']['time_of_not_initialized_module']) {
|
||||
$table1->head[7] = __('Time Not Init Module');
|
||||
} else {
|
||||
$table1->head[7] = __('');
|
||||
}
|
||||
|
||||
$table1->head[8] = __('% Ok');
|
||||
if ($item['fields']['time_of_downtime']) {
|
||||
$table1->head[8] = __('Time Downtime');
|
||||
} else {
|
||||
$table1->head[8] = __('');
|
||||
}
|
||||
|
||||
$table1->head[9] = __('% Ok');
|
||||
|
||||
$table1->headstyle = [];
|
||||
if (isset($item['data'][0]['failover']) === true) {
|
||||
|
@ -3600,6 +3606,7 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
$table1->headstyle[6] = 'text-align: center';
|
||||
$table1->headstyle[7] = 'text-align: right';
|
||||
$table1->headstyle[8] = 'text-align: right';
|
||||
$table1->headstyle[9] = 'text-align: right';
|
||||
|
||||
if (isset($item['data'][0]['failover']) === true) {
|
||||
$table1->style[-1] = 'text-align: left';
|
||||
|
@ -3615,6 +3622,7 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
$table1->style[7] = 'text-align: right';
|
||||
$table1->style[8] = 'text-align: right';
|
||||
$table1->style[9] = 'text-align: right';
|
||||
$table1->style[10] = 'text-align: right';
|
||||
|
||||
$table2 = new stdClass();
|
||||
$table2->width = '99%';
|
||||
|
@ -3652,12 +3660,18 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
$table2->head[4] = __('');
|
||||
}
|
||||
|
||||
if ($item['fields']['unknown_checks']) {
|
||||
$table2->head[5] = __('Checks Uknown');
|
||||
if ($item['fields']['checks_in_warning_status']) {
|
||||
$table2->head[5] = __('Checks Warning');
|
||||
} else {
|
||||
$table2->head[5] = __('');
|
||||
}
|
||||
|
||||
if ($item['fields']['unknown_checks']) {
|
||||
$table2->head[6] = __('Checks Uknown');
|
||||
} else {
|
||||
$table2->head[6] = __('');
|
||||
}
|
||||
|
||||
$table2->headstyle = [];
|
||||
if (isset($item['data'][0]['failover']) === true) {
|
||||
$table2->headstyle[-1] = 'text-align: left';
|
||||
|
@ -3673,6 +3687,7 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
$table2->headstyle[3] = 'text-align: right';
|
||||
$table2->headstyle[4] = 'text-align: right';
|
||||
$table2->headstyle[5] = 'text-align: right';
|
||||
$table2->headstyle[6] = 'text-align: right';
|
||||
|
||||
if (isset($item['data'][0]['failover']) === true) {
|
||||
$table2->style[-1] = 'text-align: left';
|
||||
|
@ -3770,6 +3785,20 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
$table_row[] = '';
|
||||
};
|
||||
|
||||
if ($row['time_warning'] != 0 && $item['fields']['time_in_warning_status']) {
|
||||
$table_row[] = human_time_description_raw(
|
||||
$row['time_warning'],
|
||||
true,
|
||||
$interval_description
|
||||
);
|
||||
} else if ($row['time_warning'] == 0
|
||||
&& $item['fields']['time_in_warning_status']
|
||||
) {
|
||||
$table_row[] = '--';
|
||||
} else {
|
||||
$table_row[] = '';
|
||||
};
|
||||
|
||||
if ($row['time_unknown'] != 0
|
||||
&& $item['fields']['time_in_unknown_status']
|
||||
) {
|
||||
|
@ -3879,6 +3908,12 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
$table_row2[] = '';
|
||||
}
|
||||
|
||||
if ($item['fields']['checks_in_warning_status']) {
|
||||
$table_row2[] = $row['checks_warning'];
|
||||
} else {
|
||||
$table_row2[] = '';
|
||||
}
|
||||
|
||||
if ($item['fields']['unknown_checks']) {
|
||||
$table_row2[] = $row['checks_unknown'];
|
||||
} else {
|
||||
|
|
|
@ -686,6 +686,13 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
'name' => __('Module Histogram graph'),
|
||||
];
|
||||
|
||||
if ($config['enterprise_installed'] && is_metaconsole() === false) {
|
||||
$types['IPAM_network'] = [
|
||||
'optgroup' => __('IPAM'),
|
||||
'name' => __('IPAM networks'),
|
||||
];
|
||||
}
|
||||
|
||||
$types['SLA'] = [
|
||||
'optgroup' => __('SLA'),
|
||||
'name' => __('S.L.A.'),
|
||||
|
@ -757,10 +764,6 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
'optgroup' => __('Modules'),
|
||||
'name' => __('Last value'),
|
||||
];
|
||||
$types['histogram_data'] = [
|
||||
'optgroup' => __('Modules'),
|
||||
'name' => __('Histogram'),
|
||||
];
|
||||
|
||||
$types['general'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
|
|
|
@ -705,7 +705,7 @@ function tags_get_tags_formatted($tags_array, $get_url=true)
|
|||
$tags = [];
|
||||
foreach ($tags_array as $t) {
|
||||
$tag_url = explode(' ', trim($t));
|
||||
$tag = $tag_url[0];
|
||||
$tag = io_safe_output($tag_url[0]);
|
||||
if (isset($tag_url[1]) && $tag_url[1] != '' && $get_url) {
|
||||
$title = $tag_url[1];
|
||||
// $link = '<a href="'.$tag_url[1].'" target="_blank">'.html_print_image('images/zoom.png',true, array('alt' => $title, 'title' => $title)).'</a>';
|
||||
|
|
|
@ -1117,10 +1117,17 @@ function ui_format_alert_row(
|
|||
}
|
||||
|
||||
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
|
||||
if ($policyInfo === false) {
|
||||
$module_linked = policies_is_module_linked($alert['id_agent_module']);
|
||||
if (is_array($policyInfo) === false && $module_linked === false) {
|
||||
$data[$index['policy']] = '';
|
||||
} else {
|
||||
$img = 'images/policies_mc.png';
|
||||
$module_linked = policies_is_module_linked($alert['id_agent_module']);
|
||||
if ($module_linked === '0') {
|
||||
$img = 'images/unlinkpolicy.png';
|
||||
} else {
|
||||
$img = 'images/policies_mc.png';
|
||||
}
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
$data[$index['policy']] = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
|
||||
} else {
|
||||
|
@ -5738,7 +5745,7 @@ function ui_print_agent_autocomplete_input($parameters)
|
|||
}
|
||||
|
||||
$attrs = [];
|
||||
$attrs['style'] = 'background: url('.$icon_image.') no-repeat right; '.$text_color.'';
|
||||
$attrs['style'] = 'padding-right: 20px; background: url('.$icon_image.') no-repeat right; '.$text_color.'';
|
||||
|
||||
if (!$disabled_javascript_on_blur_function) {
|
||||
$attrs['onblur'] = $javascript_on_blur_function_name.'()';
|
||||
|
|
|
@ -782,7 +782,8 @@ function pie_graph(
|
|||
$ttl=1,
|
||||
$legend_position=false,
|
||||
$colors='',
|
||||
$hide_labels=false
|
||||
$hide_labels=false,
|
||||
$max_values=9
|
||||
) {
|
||||
if (empty($chart_data) === true) {
|
||||
return graph_nodata_image($width, $height, 'pie');
|
||||
|
@ -793,8 +794,7 @@ function pie_graph(
|
|||
}
|
||||
|
||||
// This library allows only 8 colors.
|
||||
$max_values = 9;
|
||||
|
||||
// $max_values = 9;
|
||||
// Remove the html_entities.
|
||||
$temp = [];
|
||||
foreach ($chart_data as $key => $value) {
|
||||
|
|
|
@ -1014,6 +1014,7 @@ function pandoraFlotArea(
|
|||
var force_integer = 0;
|
||||
var divisor = params.divisor;
|
||||
var maximum_y_axis = params.maximum_y_axis;
|
||||
var basic_chart = params.basic_chart;
|
||||
|
||||
if (typeof divisor === "undefined") {
|
||||
divisor = 1000;
|
||||
|
@ -2018,11 +2019,8 @@ function pandoraFlotArea(
|
|||
grid: {
|
||||
hoverable: true,
|
||||
clickable: true,
|
||||
borderWidth: 1,
|
||||
borderColor: "#C1C1C1",
|
||||
backgroundColor: background_color,
|
||||
color: grid_color,
|
||||
autoHighlight: true
|
||||
color: grid_color
|
||||
},
|
||||
xaxis: {
|
||||
min: min_x,
|
||||
|
@ -2062,6 +2060,16 @@ function pandoraFlotArea(
|
|||
}
|
||||
};
|
||||
|
||||
if (basic_chart === true) {
|
||||
options.grid.borderWidth = 0;
|
||||
options.grid.backgroundColor = "rgba(255,255,255,0)";
|
||||
options.grid.autoHighlight = false;
|
||||
options.xaxis.show = false;
|
||||
options.xaxis.tickLength = 0;
|
||||
options.yaxis.show = false;
|
||||
options.yaxis.tickLength = 0;
|
||||
}
|
||||
|
||||
if (typeof maximum_y_axis !== "undefined" && maximum_y_axis != 0) {
|
||||
options.yaxis.max = maximum_y_axis;
|
||||
}
|
||||
|
|
|
@ -98,6 +98,32 @@ function chordDiagram(recipient, elements, matrix, width) {
|
|||
})
|
||||
.transition()
|
||||
.style("opacity", opacity);
|
||||
|
||||
if (event.type == "mouseover") {
|
||||
const chords = chord.chords();
|
||||
let aux = 0;
|
||||
$.each(chords, function(key, value) {
|
||||
console.log(aux);
|
||||
if (aux < 5) {
|
||||
if (
|
||||
(value.source.index == i && value.target.subindex == i) ||
|
||||
(value.source.subindex == i && value.target.index == i)
|
||||
) {
|
||||
if (
|
||||
$("#tooltip").is(":hidden") ||
|
||||
$("#tooltip").length == 0
|
||||
) {
|
||||
show_tooltip(value);
|
||||
} else {
|
||||
add_tooltip(value);
|
||||
aux++;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
hide_tooltip();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -122,7 +148,8 @@ function chordDiagram(recipient, elements, matrix, width) {
|
|||
.style("stroke", fill)
|
||||
.attr("d", arc)
|
||||
.on("mouseover", fade(0.1))
|
||||
.on("mouseout", fade(1));
|
||||
.on("mouseout", fade(1))
|
||||
.on("mousemove", move_tooltip);
|
||||
|
||||
g.append("svg:text")
|
||||
.each(function(d) {
|
||||
|
@ -259,6 +286,25 @@ function chordDiagram(recipient, elements, matrix, width) {
|
|||
);
|
||||
}
|
||||
|
||||
function add_tooltip(d) {
|
||||
$("#tooltip").append(
|
||||
"</br>" +
|
||||
elements[d.source.index] +
|
||||
" → " +
|
||||
elements[d.target.index] +
|
||||
": <b>" +
|
||||
valueToBytes(d.source.value) +
|
||||
"</b>" +
|
||||
"<br>" +
|
||||
elements[d.target.index] +
|
||||
" → " +
|
||||
elements[d.source.index] +
|
||||
": <b>" +
|
||||
valueToBytes(d.target.value) +
|
||||
"</b>"
|
||||
);
|
||||
}
|
||||
|
||||
function show_tooltip(d) {
|
||||
x = d3.event.pageX + 10;
|
||||
y = d3.event.pageY + 10;
|
||||
|
|
|
@ -0,0 +1,459 @@
|
|||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2021 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.
|
||||
|
||||
/* globals d3 */
|
||||
/* globals jQuery */
|
||||
/* globals $ */
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
/*-------------------Constants-------------------*/
|
||||
/*-----------------------------------------------*/
|
||||
var MAX_ZOOM_LEVEL = 5;
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
/*------------------Constructor------------------*/
|
||||
/*-----------------------------------------------*/
|
||||
var SimpleMapController = function(params) {
|
||||
if (!params) {
|
||||
console.log("[SimpleMapController]: No params received");
|
||||
return this;
|
||||
}
|
||||
this._target = params["target"];
|
||||
|
||||
if (typeof params["map_width"] == "undefined") {
|
||||
this.map_width = 0;
|
||||
} else {
|
||||
this.map_width = params["map_width"];
|
||||
}
|
||||
|
||||
if (typeof params["map_height"] == "undefined") {
|
||||
this.map_height = 0;
|
||||
} else {
|
||||
this.map_height = params["map_height"];
|
||||
}
|
||||
|
||||
if (typeof params["font_size"] == "undefined") {
|
||||
this.font_size = 20;
|
||||
} else {
|
||||
this.font_size = params["font_size"];
|
||||
}
|
||||
|
||||
if (typeof params["homedir"] == "undefined") {
|
||||
this.homedir = "";
|
||||
} else {
|
||||
this.homedir = params["homedir"];
|
||||
}
|
||||
|
||||
if (typeof params["custom_params"] == "undefined") {
|
||||
this.custom_params = "";
|
||||
} else {
|
||||
this.custom_params = params["custom_params"];
|
||||
}
|
||||
|
||||
if (typeof params["center_x"] == "undefined") {
|
||||
this.center_x = 0;
|
||||
} else {
|
||||
this.center_x = params["center_x"];
|
||||
}
|
||||
|
||||
if (typeof params["center_y"] == "undefined") {
|
||||
this.center_y = 0;
|
||||
} else {
|
||||
this.center_y = params["center_y"];
|
||||
}
|
||||
|
||||
if (typeof params["z_dash"] == "undefined") {
|
||||
this.z_dash = 0.5;
|
||||
} else {
|
||||
this.z_dash = params["z_dash"];
|
||||
}
|
||||
|
||||
if (typeof params["nodes"] == "undefined") {
|
||||
this.nodes = [];
|
||||
} else {
|
||||
this.nodes = params["nodes"];
|
||||
}
|
||||
|
||||
if (typeof params["arrows"] == "undefined") {
|
||||
this.arrows = [];
|
||||
} else {
|
||||
this.arrows = params["arrows"];
|
||||
}
|
||||
|
||||
var factor = $(this._target).width() / $(this._target).height();
|
||||
|
||||
// Center is about complete SVG map not only central node.
|
||||
// Calculus is to leave same space on left-right (width)
|
||||
// and top-bottom (height).
|
||||
this.center_x = ($(this._target).width() - this.map_width * factor) / 2;
|
||||
this.center_y = ($(this._target).height() - this.map_height * factor) / 2;
|
||||
};
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
/*------------------Atributes--------------------*/
|
||||
/*-----------------------------------------------*/
|
||||
SimpleMapController.prototype._viewport = null;
|
||||
SimpleMapController.prototype._zoomManager = null;
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
/*--------------------Methods--------------------*/
|
||||
/*-----------------------------------------------*/
|
||||
/**
|
||||
* Function init_trans_map
|
||||
* Return void
|
||||
* This function init the transactional map
|
||||
*/
|
||||
SimpleMapController.prototype.init_map = function() {
|
||||
var self = this;
|
||||
|
||||
var svg = d3.select(self._target + " svg");
|
||||
|
||||
self._zoomManager = d3.behavior
|
||||
.zoom()
|
||||
.scale(self.z_dash)
|
||||
.scaleExtent([1 / MAX_ZOOM_LEVEL, MAX_ZOOM_LEVEL])
|
||||
.on("zoom", zoom);
|
||||
|
||||
self._viewport = svg
|
||||
.call(self._zoomManager)
|
||||
.append("g")
|
||||
.attr("class", "viewport")
|
||||
.attr("transform", "translate(0, 0) scale(" + self.z_dash + ")");
|
||||
|
||||
self._slider = d3
|
||||
.select(self._target + " .zoom_controller .vertical_range")
|
||||
.property("value", 0)
|
||||
.property("min", -Math.log(MAX_ZOOM_LEVEL))
|
||||
.property("max", Math.log(MAX_ZOOM_LEVEL))
|
||||
.property("step", (Math.log(MAX_ZOOM_LEVEL) * 2) / MAX_ZOOM_LEVEL)
|
||||
.on("input", slided);
|
||||
|
||||
/**
|
||||
* Function zoom
|
||||
* Return void
|
||||
* This function manages the zoom
|
||||
*/
|
||||
function zoom() {
|
||||
self.last_event = "zoom";
|
||||
|
||||
var zoom_level = d3.event.scale;
|
||||
|
||||
self._slider.property("value", Math.log(zoom_level));
|
||||
|
||||
self._viewport.attr(
|
||||
"transform",
|
||||
"translate(" + d3.event.translate + ") scale(" + zoom_level + ")"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function slided
|
||||
* Return void
|
||||
* This function manages the slide (zoom system)
|
||||
*/
|
||||
function slided() {
|
||||
var slider_value = parseFloat(self._slider.property("value"));
|
||||
|
||||
var zoom_level = Math.exp(slider_value);
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*-Code to translate the map with the zoom for to hold the center-*/
|
||||
/*----------------------------------------------------------------*/
|
||||
var center = [
|
||||
parseFloat(d3.select(self._target).style("width")) / 2,
|
||||
parseFloat(d3.select(self._target).style("height")) / 2
|
||||
];
|
||||
|
||||
var old_translate = self._zoomManager.translate();
|
||||
var old_scale = self._zoomManager.scale();
|
||||
|
||||
var temp1 = [
|
||||
(center[0] - old_translate[0]) / old_scale,
|
||||
(center[1] - old_translate[1]) / old_scale
|
||||
];
|
||||
|
||||
var temp2 = [
|
||||
temp1[0] * zoom_level + old_translate[0],
|
||||
temp1[1] * zoom_level + old_translate[1]
|
||||
];
|
||||
|
||||
var new_translation = [
|
||||
old_translate[0] + center[0] - temp2[0],
|
||||
old_translate[1] + center[1] - temp2[1]
|
||||
];
|
||||
|
||||
self._zoomManager
|
||||
.scale(zoom_level)
|
||||
.translate(new_translation)
|
||||
.event(self._viewport);
|
||||
}
|
||||
|
||||
self.paint_arrows();
|
||||
self.paint_nodes();
|
||||
};
|
||||
|
||||
SimpleMapController.prototype.paint_nodes = function() {
|
||||
var self = this;
|
||||
if (self.nodes != null) {
|
||||
// Initialize objects.
|
||||
var circle_elem = self._viewport
|
||||
.selectAll(".node")
|
||||
.data(self.nodes)
|
||||
.enter()
|
||||
.append("g")
|
||||
.attr("id", function(d) {
|
||||
return "node_" + d["id"];
|
||||
})
|
||||
.attr("transform", function(d) {
|
||||
return "translate(" + d["x"] + ", " + d["y"] + ")";
|
||||
})
|
||||
.attr("class", "draggable node")
|
||||
.attr("image", function(d) {
|
||||
return d["image"];
|
||||
})
|
||||
.attr("style", function(d) {
|
||||
return (
|
||||
"fill: " + d["color"] + "; " + "stroke: " + d["stroke-color"] + ";"
|
||||
);
|
||||
})
|
||||
.attr("stroke-width", function(d) {
|
||||
return d["stroke-width"];
|
||||
})
|
||||
.style("cursor", function(d) {
|
||||
if (d["id"] === "0") {
|
||||
return "default";
|
||||
} else {
|
||||
return "pointer";
|
||||
}
|
||||
});
|
||||
|
||||
// Node size in map.
|
||||
circle_elem
|
||||
.append("circle")
|
||||
.attr("cx", self.center_x)
|
||||
.attr("cy", function(d) {
|
||||
return self.center_y + d["radius"];
|
||||
})
|
||||
.attr("r", function(d) {
|
||||
return d["radius"];
|
||||
});
|
||||
|
||||
circle_elem.each(function(node, index) {
|
||||
if (Array.isArray(node["label"])) {
|
||||
node["label"].forEach(function(value, index2) {
|
||||
d3.selectAll("#node_" + index)
|
||||
.append("text")
|
||||
.attr("dx", function(d) {
|
||||
if (typeof d["label_x_offset"] == "undefined") {
|
||||
d["label_x_offset"] = 0;
|
||||
}
|
||||
return self.center_x + d["label_x_offset"];
|
||||
})
|
||||
.attr("dy", function(d) {
|
||||
if (typeof d["font_size"] == "undefined") {
|
||||
d["font_size"] = self.font_size;
|
||||
}
|
||||
if (typeof d["label_y_offset"] == "undefined") {
|
||||
d["label_y_offset"] = d["radius"] + d["font_size"];
|
||||
}
|
||||
return (
|
||||
self.center_y +
|
||||
d["radius"] +
|
||||
d["label_y_offset"] +
|
||||
index2 * d["font_size"]
|
||||
);
|
||||
})
|
||||
.style("text-anchor", "middle")
|
||||
.style("font-size", function(d) {
|
||||
if (typeof d["font_size"] == "undefined") {
|
||||
d["font_size"] = self.font_size;
|
||||
}
|
||||
return d["font_size"] + "px";
|
||||
})
|
||||
.style("stroke-width", 0)
|
||||
.attr("fill", "black")
|
||||
.text(value);
|
||||
});
|
||||
} else {
|
||||
circle_elem
|
||||
.append("text")
|
||||
.attr("dx", function(d) {
|
||||
if (typeof d["label_x_offset"] == "undefined") {
|
||||
d["label_x_offset"] = 0;
|
||||
}
|
||||
return self.center_x + d["label_x_offset"];
|
||||
})
|
||||
.attr("dy", function(d) {
|
||||
if (typeof d["font_size"] == "undefined") {
|
||||
d["font_size"] = self.font_size;
|
||||
}
|
||||
if (typeof d["label_y_offset"] == "undefined") {
|
||||
d["label_y_offset"] = d["radius"] + d["font_size"];
|
||||
}
|
||||
return self.center_y + d["radius"] + d["label_y_offset"];
|
||||
})
|
||||
.style("text-anchor", "middle")
|
||||
.style("font-size", function(d) {
|
||||
if (typeof d["font_size"] == "undefined") {
|
||||
d["font_size"] = self.font_size;
|
||||
}
|
||||
return d["font_size"] + "px";
|
||||
})
|
||||
.style("stroke-width", 0)
|
||||
.attr("fill", "black")
|
||||
.text(function(d) {
|
||||
return d["label"];
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Node image.
|
||||
circle_elem
|
||||
.append("svg:image")
|
||||
.attr("class", "node_image")
|
||||
.attr("xlink:href", function(d) {
|
||||
return d["image"];
|
||||
})
|
||||
.attr("x", function(d) {
|
||||
if (typeof d["size_image"] != "undefined") {
|
||||
return self.center_x - d["size_image"] / 2;
|
||||
} else {
|
||||
return self.center_x - 52 / 2;
|
||||
}
|
||||
})
|
||||
.attr("y", function(d) {
|
||||
if (typeof size_image != "undefined") {
|
||||
return self.center_y + d["radius"] - d["size_image"] / 2;
|
||||
} else {
|
||||
return self.center_y + d["radius"] - 52 / 2;
|
||||
}
|
||||
})
|
||||
.attr("width", function(d) {
|
||||
return d["image_width"];
|
||||
})
|
||||
.attr("height", function(d) {
|
||||
return d["image_height"];
|
||||
});
|
||||
|
||||
// Tooltipster. This could be dynamic.
|
||||
self.nodes.forEach(function(node) {
|
||||
if (node["id_agent"] != 0) {
|
||||
$("#node_" + node["id"]).tooltipster({
|
||||
contentAsHTML: true,
|
||||
onlyOne: true,
|
||||
updateAnimation: null,
|
||||
interactive: true,
|
||||
trigger: "click",
|
||||
content: $('<img src="' + self.homedir + '/images/spinner.gif"/>'),
|
||||
functionReady: function() {
|
||||
$("#node_" + node["id"]).tooltipster("open");
|
||||
$(".tooltipster-content").css("background", "#FFF");
|
||||
$(".tooltipster-content").css("color", "#000");
|
||||
|
||||
var params = self.custom_params;
|
||||
|
||||
// Add data node click.
|
||||
params.node_data = node;
|
||||
|
||||
params["id_agent"] = node["id_agent"];
|
||||
jQuery.ajax({
|
||||
data: params,
|
||||
dataType: "html",
|
||||
type: "POST",
|
||||
url: self.homedir + "/ajax.php",
|
||||
success: function(data) {
|
||||
$(".tooltipster-content").css("min-height", "330px");
|
||||
$(".tooltipster-content").css("max-height", "500px");
|
||||
$("#node_" + node["id"]).tooltipster("content", data);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
SimpleMapController.prototype.paint_arrows = function() {
|
||||
var self = this;
|
||||
|
||||
if (self.arrows != null) {
|
||||
self._viewport
|
||||
.selectAll(".arrow")
|
||||
.data(self.arrows)
|
||||
.enter()
|
||||
.append("g")
|
||||
.attr("class", "arrow")
|
||||
.attr("to", function(d) {
|
||||
return d["dest"];
|
||||
})
|
||||
.attr("from", function(d) {
|
||||
return d["orig"];
|
||||
})
|
||||
.attr("style", "fill: rgb(50, 50, 128);")
|
||||
.append("line")
|
||||
.attr("stroke", "#373737")
|
||||
.attr("stroke-width", 3)
|
||||
.attr("x1", function(d) {
|
||||
return self.center_x + self.getFirstPoint(d["orig"], "x");
|
||||
})
|
||||
.attr("y1", function(d) {
|
||||
return self.center_y + self.getFirstPoint(d["orig"], "y");
|
||||
})
|
||||
.attr("x2", function(d) {
|
||||
return self.center_x + self.getSecondPoint(d["dest"], "x");
|
||||
})
|
||||
.attr("y2", function(d) {
|
||||
return self.center_y + self.getSecondPoint(d["dest"], "y");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
SimpleMapController.prototype.getFirstPoint = function(orig, coord) {
|
||||
var self = this;
|
||||
var point = 0;
|
||||
|
||||
self.nodes.forEach(function(node) {
|
||||
if (node["id"] === orig) {
|
||||
if (coord == "x") {
|
||||
point = parseFloat(node["x"]);
|
||||
return;
|
||||
} else {
|
||||
point = parseFloat(node["y"]) + node["radius"];
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return point;
|
||||
};
|
||||
|
||||
SimpleMapController.prototype.getSecondPoint = function(dest, coord) {
|
||||
var self = this;
|
||||
var point = 0;
|
||||
|
||||
self.nodes.forEach(function(node) {
|
||||
if (node["id"] === dest) {
|
||||
if (coord == "x") {
|
||||
point = parseFloat(node["x"]);
|
||||
return;
|
||||
} else {
|
||||
point = parseFloat(node["y"]) + node["radius"];
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return point;
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -948,6 +948,133 @@ function processTreeSearch(settings) {
|
|||
});
|
||||
}
|
||||
|
||||
function processServiceTree(settings) {
|
||||
var treeController = TreeController.getController();
|
||||
|
||||
if (
|
||||
typeof treeController.recipient != "undefined" &&
|
||||
treeController.recipient.length > 0
|
||||
)
|
||||
treeController.recipient.empty();
|
||||
|
||||
$(".loading_tree").show();
|
||||
|
||||
var parameters = {};
|
||||
parameters["page"] = "include/ajax/tree.ajax";
|
||||
parameters["getChildren"] = 1;
|
||||
parameters["type"] = "services";
|
||||
parameters["filter"] = {};
|
||||
parameters["filter"]["searchGroup"] = "";
|
||||
parameters["filter"]["searchAgent"] = "";
|
||||
parameters["filter"]["statusAgent"] = "";
|
||||
parameters["filter"]["searchModule"] = "";
|
||||
parameters["filter"]["statusModule"] = "";
|
||||
parameters["filter"]["groupID"] = "";
|
||||
parameters["filter"]["tagID"] = "";
|
||||
parameters["filter"]["searchHirearchy"] = 1;
|
||||
parameters["filter"]["show_not_init_agents"] = 1;
|
||||
parameters["filter"]["show_not_init_modules"] = 1;
|
||||
parameters["filter"]["is_favourite"] = 0;
|
||||
parameters["filter"]["width"] = 100;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: settings.ajaxURL,
|
||||
data: parameters,
|
||||
success: function(data) {
|
||||
if (data.success) {
|
||||
$(".loading_tree").hide();
|
||||
// Get the main values of the tree.
|
||||
var rawTree = Object.values(data.tree);
|
||||
// Sorting tree by description (TreeController.js).
|
||||
rawTree.sort(function(a, b) {
|
||||
var x = a.description.toLowerCase();
|
||||
var y = b.description.toLowerCase();
|
||||
if (x < y) {
|
||||
return -1;
|
||||
}
|
||||
if (x > y) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
treeController.init({
|
||||
recipient: $("div#container_servicemap_" + settings.cellId),
|
||||
detailRecipient: {
|
||||
render: function(element, data) {
|
||||
return {
|
||||
open: function() {
|
||||
$("#module_details_window")
|
||||
.hide()
|
||||
.empty()
|
||||
.append(data)
|
||||
.dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
title: "Info",
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 450,
|
||||
height: 500
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
page: parameters["page"],
|
||||
emptyMessage: "No data found",
|
||||
foundMessage: "Found groups",
|
||||
tree: rawTree,
|
||||
baseURL: settings.baseURL,
|
||||
ajaxURL: settings.ajaxURL,
|
||||
filter: parameters["filter"],
|
||||
counterTitles: {
|
||||
total: {
|
||||
agents: "Total agents",
|
||||
modules: "Total modules",
|
||||
none: "Total"
|
||||
},
|
||||
alerts: {
|
||||
agents: "Fired alerts",
|
||||
modules: "Fired alerts",
|
||||
none: "Fired alerts"
|
||||
},
|
||||
critical: {
|
||||
agents: "Critical agents",
|
||||
modules: "Critical modules')",
|
||||
none: "Critical"
|
||||
},
|
||||
warning: {
|
||||
agents: "Warning agents",
|
||||
modules: "Warning modules",
|
||||
none: "Warning"
|
||||
},
|
||||
unknown: {
|
||||
agents: "Unknown agents",
|
||||
modules: "Unknown modules",
|
||||
none: "Unknown"
|
||||
},
|
||||
not_init: {
|
||||
agents: "Not init agents",
|
||||
modules: "Not init modules",
|
||||
none: "Not init"
|
||||
},
|
||||
ok: {
|
||||
agents: " Normal agents ",
|
||||
modules: " Normal modules ",
|
||||
none: " Normal "
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
dataType: "json"
|
||||
});
|
||||
}
|
||||
|
||||
function show_module_detail_dialog(
|
||||
module_id,
|
||||
id_agent,
|
||||
|
|
|
@ -1327,12 +1327,23 @@ function filterByText(selectbox, textbox, textNoData) {
|
|||
function manageComponentFields(action, type) {
|
||||
var fieldLines = $("tr[id*=network_component-" + type + "]").length;
|
||||
var protocol = $("#module_protocol").val();
|
||||
let textForAdd = "";
|
||||
|
||||
if (action === "add") {
|
||||
let lineNumber = fieldLines + 1;
|
||||
let textForAdd =
|
||||
type === "oid-list-pluginRow-snmpRow"
|
||||
? "_oid_" + lineNumber + "_"
|
||||
: lineNumber;
|
||||
|
||||
switch (type) {
|
||||
case "oid-list-pluginRow-snmpRow":
|
||||
textForAdd = "_oid_" + lineNumber + "_";
|
||||
break;
|
||||
|
||||
case "oid-list-wmiRow":
|
||||
textForAdd = "_field_wmi_" + lineNumber + "_";
|
||||
break;
|
||||
|
||||
default:
|
||||
textForAdd = lineNumber;
|
||||
}
|
||||
|
||||
$("#network_component-manage-" + type).before(
|
||||
$("#network_component-" + type + "-row-1")
|
||||
|
|
|
@ -181,7 +181,7 @@ function expandTreeNode(node) {
|
|||
.attr("src", src);
|
||||
|
||||
// Show leaves
|
||||
$("#ul_" + node).css("display", "");
|
||||
$("#ul_" + node).css("display", "block");
|
||||
}
|
||||
|
||||
// Expand an SNMP tree node
|
||||
|
|
|
@ -520,6 +520,9 @@ function createVisualConsole(
|
|||
case "ODOMETER":
|
||||
type = 22;
|
||||
break;
|
||||
case "BASIC_CHART":
|
||||
type = 23;
|
||||
break;
|
||||
default:
|
||||
type = 0;
|
||||
}
|
||||
|
@ -1240,6 +1243,9 @@ function createOrUpdateVisualConsoleItem(
|
|||
case 22:
|
||||
nameType = "Odometer";
|
||||
break;
|
||||
case 23:
|
||||
nameType = "Basic chart";
|
||||
break;
|
||||
|
||||
default:
|
||||
nameType = "Static graph";
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -159,6 +159,21 @@ var TreeController = {
|
|||
}
|
||||
};
|
||||
|
||||
var IPAMSupernetCounterTitles = {
|
||||
total_networks: {
|
||||
totals: "Networks"
|
||||
}
|
||||
};
|
||||
|
||||
var IPAMNetworkCounterTitles = {
|
||||
alive_ips: {
|
||||
totals: "Alive IPs"
|
||||
},
|
||||
total_ips: {
|
||||
totals: "Total IPs"
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
var title = "";
|
||||
|
||||
|
@ -192,6 +207,12 @@ var TreeController = {
|
|||
case "services":
|
||||
title = serviceCounterTitles[counterType].totals;
|
||||
break;
|
||||
case "IPAM_supernets":
|
||||
title = IPAMSupernetCounterTitles[counterType].totals;
|
||||
break;
|
||||
case "IPAM_networks":
|
||||
title = IPAMNetworkCounterTitles[counterType].totals;
|
||||
break;
|
||||
default:
|
||||
if (
|
||||
typeof controller.counterTitles != "undefined" &&
|
||||
|
@ -333,6 +354,113 @@ var TreeController = {
|
|||
|
||||
hasCounters = true;
|
||||
}
|
||||
} else if (type == "IPAM_supernets") {
|
||||
var $counters = $("<div></div>");
|
||||
$counters.addClass("tree-node-counters");
|
||||
|
||||
if (counters.total_networks > 0) {
|
||||
// Open the parentheses
|
||||
$counters.append(" (");
|
||||
|
||||
if (
|
||||
typeof counters.total_networks !== "undefined" &&
|
||||
counters.total_networks >= 0
|
||||
) {
|
||||
var $networksCounter = $("<div></div>");
|
||||
$networksCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html(counters.total_networks);
|
||||
|
||||
_processNodeCounterTitle(
|
||||
$networksCounter,
|
||||
type,
|
||||
"total_networks"
|
||||
);
|
||||
|
||||
$counters.append($networksCounter);
|
||||
} else {
|
||||
var $networksCounter = $("<div></div>");
|
||||
$networksCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html("0");
|
||||
|
||||
_processNodeCounterTitle(
|
||||
$networksCounter,
|
||||
type,
|
||||
"total_networks"
|
||||
);
|
||||
|
||||
$counters.append($networksCounter);
|
||||
}
|
||||
|
||||
// Close the parentheses
|
||||
$counters.append(")");
|
||||
|
||||
hasCounters = true;
|
||||
}
|
||||
} else if (type == "IPAM_networks") {
|
||||
var $counters = $("<div></div>");
|
||||
$counters.addClass("tree-node-counters");
|
||||
|
||||
// Open the parentheses
|
||||
$counters.append(" (");
|
||||
|
||||
if (
|
||||
typeof counters.alive_ips !== "undefined" &&
|
||||
counters.alive_ips >= 0
|
||||
) {
|
||||
var $aliveCounter = $("<div></div>");
|
||||
$aliveCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html(counters.alive_ips);
|
||||
|
||||
_processNodeCounterTitle($aliveCounter, type, "alive_ips");
|
||||
|
||||
$counters.append($aliveCounter);
|
||||
} else {
|
||||
var $aliveCounter = $("<div></div>");
|
||||
$aliveCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html("0");
|
||||
|
||||
_processNodeCounterTitle($aliveCounter, type, "alive_ips");
|
||||
|
||||
$counters.append($aliveCounter);
|
||||
}
|
||||
|
||||
if (
|
||||
typeof counters.total_ips !== "undefined" &&
|
||||
counters.total_ips >= 0
|
||||
) {
|
||||
var $totalCounter = $("<div></div>");
|
||||
$totalCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html(counters.total_ips);
|
||||
|
||||
_processNodeCounterTitle($totalCounter, type, "total_ips");
|
||||
|
||||
$counters.append(" : ").append($totalCounter);
|
||||
} else {
|
||||
var $totalCounter = $("<div></div>");
|
||||
$totalCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html("0");
|
||||
|
||||
_processNodeCounterTitle($totalCounter, type, "total_ips");
|
||||
|
||||
$counters.append(" : ").append($totalCounter);
|
||||
}
|
||||
|
||||
// Close the parentheses
|
||||
$counters.append(")");
|
||||
|
||||
hasCounters = true;
|
||||
} else {
|
||||
var $counters = $("<div></div>");
|
||||
$counters.addClass("tree-node-counters");
|
||||
|
@ -637,6 +765,87 @@ var TreeController = {
|
|||
}
|
||||
|
||||
$content.append(" " + element.alias);
|
||||
break;
|
||||
case "IPAM_supernets":
|
||||
var IPAMSupernetDetailImage = $(
|
||||
'<img class="invert_filter" src="' +
|
||||
(controller.baseURL.length > 0 ? controller.baseURL : "") +
|
||||
'images/transactional_map.png" /> '
|
||||
);
|
||||
|
||||
if (typeof element.id !== "undefined") {
|
||||
IPAMSupernetDetailImage.click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var postData = {
|
||||
page: "enterprise/include/ajax/ipam.ajax",
|
||||
show_networkmap_statistics: 1,
|
||||
"node_data[id_net]": element.id,
|
||||
"node_data[type_net]": "supernet"
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: controller.ajaxURL,
|
||||
type: "POST",
|
||||
dataType: "html",
|
||||
data: postData,
|
||||
success: function(data, textStatus, xhr) {
|
||||
controller.detailRecipient
|
||||
.render("IPAMsupernets", data)
|
||||
.open();
|
||||
}
|
||||
});
|
||||
}).css("cursor", "pointer");
|
||||
|
||||
$content.append(IPAMSupernetDetailImage);
|
||||
}
|
||||
|
||||
if (element.name !== null) {
|
||||
$content.append(" " + element.name);
|
||||
}
|
||||
|
||||
break;
|
||||
case "IPAM_networks":
|
||||
$content.addClass("ipam-network");
|
||||
|
||||
var IPAMNetworkDetailImage = $(
|
||||
'<img class="invert_filter" src="' +
|
||||
(controller.baseURL.length > 0 ? controller.baseURL : "") +
|
||||
'images/list.png" /> '
|
||||
);
|
||||
|
||||
if (typeof element.id !== "undefined") {
|
||||
IPAMNetworkDetailImage.click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
//window.location.href = element.IPAMNetworkDetail;
|
||||
var postData = {
|
||||
page: "enterprise/include/ajax/ipam.ajax",
|
||||
show_networkmap_statistics: 1,
|
||||
"node_data[id_net]": element.id,
|
||||
"node_data[type_net]": "network"
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: controller.ajaxURL,
|
||||
type: "POST",
|
||||
dataType: "html",
|
||||
data: postData,
|
||||
success: function(data, textStatus, xhr) {
|
||||
controller.detailRecipient
|
||||
.render("IPAMnetwork", data)
|
||||
.open();
|
||||
}
|
||||
});
|
||||
}).css("cursor", "pointer");
|
||||
|
||||
$content.append(IPAMNetworkDetailImage);
|
||||
}
|
||||
|
||||
if (element.name !== null) {
|
||||
$content.append(" " + element.name);
|
||||
}
|
||||
|
||||
break;
|
||||
case "services":
|
||||
if (
|
||||
|
@ -960,7 +1169,7 @@ var TreeController = {
|
|||
return;
|
||||
}
|
||||
}
|
||||
// If exist the detail container, show the data
|
||||
// If detail container exists, show the data.
|
||||
if (
|
||||
typeof controller.detailRecipient !== "undefined" ||
|
||||
disabled == false
|
||||
|
|
|
@ -352,6 +352,14 @@ class Widget
|
|||
$className .= '\ServiceMapWidget';
|
||||
break;
|
||||
|
||||
case 'service_view':
|
||||
if (\enterprise_installed() === false) {
|
||||
$not_installed = true;
|
||||
}
|
||||
|
||||
$className .= '\ServiceViewWidget';
|
||||
break;
|
||||
|
||||
case 'single_graph':
|
||||
$className .= '\SingleGraphWidget';
|
||||
break;
|
||||
|
|
|
@ -354,6 +354,7 @@ class CustomGraphWidget extends Widget
|
|||
'value' => $values['period'],
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -325,6 +325,8 @@ class GraphModuleHistogramWidget extends Widget
|
|||
'value' => $values['period'],
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -285,7 +285,6 @@ class NetworkMapWidget extends Widget
|
|||
null,
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
$return_all_group
|
||||
);
|
||||
|
||||
|
@ -438,7 +437,7 @@ class NetworkMapWidget extends Widget
|
|||
$settings = \json_encode(
|
||||
[
|
||||
'cellId' => $this->cellId,
|
||||
'page' => 'enterprise/include/ajax/map_enterprise.ajax',
|
||||
'page' => 'include/ajax/map_enterprise.ajax',
|
||||
'url' => ui_get_full_url('ajax.php'),
|
||||
'networkmap_id' => $id_networkmap,
|
||||
'x_offset' => $x_offset,
|
||||
|
|
|
@ -0,0 +1,471 @@
|
|||
<?php
|
||||
/**
|
||||
* Widget Tree view Pandora FMS Console
|
||||
*
|
||||
* @category Console Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage Widget Tree view
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
namespace PandoraFMS\Dashboard;
|
||||
|
||||
use PandoraFMS\Dashboard\Manager;
|
||||
|
||||
/**
|
||||
* Tree view Widgets.
|
||||
*/
|
||||
class ServiceViewWidget extends Widget
|
||||
{
|
||||
|
||||
/**
|
||||
* Name widget.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Title widget.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Page widget;
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $page;
|
||||
|
||||
/**
|
||||
* Class name widget.
|
||||
*
|
||||
* @var [type]
|
||||
*/
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* Values options for each widget.
|
||||
*
|
||||
* @var [type]
|
||||
*/
|
||||
protected $values;
|
||||
|
||||
/**
|
||||
* Configuration required.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $configurationRequired;
|
||||
|
||||
/**
|
||||
* Error load widget.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $loadError;
|
||||
|
||||
/**
|
||||
* Width.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $width;
|
||||
|
||||
/**
|
||||
* Heigth.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $height;
|
||||
|
||||
/**
|
||||
* Grid Width.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $gridWidth;
|
||||
|
||||
/**
|
||||
* Dashboard ID.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $dashboardId;
|
||||
|
||||
/**
|
||||
* Cell ID.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $cellId;
|
||||
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param integer $cellId Cell ID.
|
||||
* @param integer $dashboardId Dashboard ID.
|
||||
* @param integer $widgetId Widget ID.
|
||||
* @param integer|null $width New width.
|
||||
* @param integer|null $height New height.
|
||||
* @param integer|null $gridWidth Grid width.
|
||||
*/
|
||||
public function __construct(
|
||||
int $cellId,
|
||||
int $dashboardId=0,
|
||||
int $widgetId=0,
|
||||
?int $width=0,
|
||||
?int $height=0,
|
||||
?int $gridWidth=0
|
||||
) {
|
||||
global $config;
|
||||
|
||||
ui_require_css_file('tree');
|
||||
ui_require_css_file('fixed-bottom-box');
|
||||
|
||||
// Includes.
|
||||
enterprise_include_once('/include/functions_services.php');
|
||||
enterprise_include_once('/include/functions_servicemap.php');
|
||||
|
||||
// WARNING: Do not edit. This chunk must be in the constructor.
|
||||
parent::__construct(
|
||||
$cellId,
|
||||
$dashboardId,
|
||||
$widgetId
|
||||
);
|
||||
|
||||
// Width.
|
||||
$this->width = $width;
|
||||
|
||||
// Height.
|
||||
$this->height = $height;
|
||||
|
||||
// Grid Width.
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Cell Id.
|
||||
$this->cellId = $cellId;
|
||||
|
||||
// Widget ID.
|
||||
$this->widgetId = $widgetId;
|
||||
|
||||
// Dashboard ID.
|
||||
$this->dashboardId = $dashboardId;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
||||
// Page.
|
||||
$this->page = basename(__FILE__);
|
||||
|
||||
// ClassName.
|
||||
$class = new \ReflectionClass($this);
|
||||
$this->className = $class->getShortName();
|
||||
|
||||
// Title.
|
||||
$this->title = __('Service View');
|
||||
|
||||
// Name.
|
||||
if (empty($this->name) === true) {
|
||||
$this->name = 'service_view';
|
||||
}
|
||||
|
||||
// // This forces at least a first configuration.
|
||||
// $this->configurationRequired = false;
|
||||
// if (empty($this->values['serviceId']) === true) {
|
||||
// $this->configurationRequired = true;
|
||||
// }
|
||||
$this->overflow_scrollbars = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['type']) === true) {
|
||||
$values['type'] = $decoder['type'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
* @return array Of inputs.
|
||||
*
|
||||
* @throws Exception On error.
|
||||
*/
|
||||
public function getFormInputs(): array
|
||||
{
|
||||
// Retrieve global - common inputs.
|
||||
$inputs = parent::getFormInputs();
|
||||
|
||||
$values = $this->values;
|
||||
if (empty($values['type']) === true) {
|
||||
$values['type'] = 'tree';
|
||||
}
|
||||
|
||||
// Type services view.
|
||||
$fields = [
|
||||
'tree' => __('Tree'),
|
||||
'table' => __('Table'),
|
||||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Type'),
|
||||
'arguments' => [
|
||||
'type' => 'select',
|
||||
'fields' => $fields,
|
||||
'name' => 'type',
|
||||
'selected' => $values['type'],
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Post for widget.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPost():array
|
||||
{
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::getPost();
|
||||
$values['type'] = \get_parameter('type', 'tree');
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw widget.
|
||||
*
|
||||
* @return string;
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$values = $this->values;
|
||||
|
||||
$size = parent::getSize();
|
||||
$output = '';
|
||||
|
||||
if ($values['type'] === 'tree' || empty($values['type'])) {
|
||||
if (check_acl($config['id_user'], 0, 'AR') === 0) {
|
||||
$output .= '<div class="container-center">';
|
||||
$output .= \ui_print_error_message(
|
||||
__('The user doesn\'t have permission to read agents'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
$output .= '</div>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
$containerId = 'container_servicemap_'.$this->cellId;
|
||||
$output .= "<div id='".$containerId."' class='tree-controller-recipient'>";
|
||||
$output .= '</div>';
|
||||
|
||||
$output .= \html_print_image(
|
||||
'images/spinner.gif',
|
||||
true,
|
||||
[
|
||||
'class' => 'loading_tree',
|
||||
'style' => 'display: none;',
|
||||
]
|
||||
);
|
||||
|
||||
// Css Files.
|
||||
\ui_require_css_file('tree', 'include/styles/', true);
|
||||
if ($config['style'] == 'pandora_black') {
|
||||
\ui_require_css_file('pandora_black', 'include/styles/', true);
|
||||
}
|
||||
|
||||
\ui_require_javascript_file(
|
||||
'TreeController',
|
||||
'include/javascript/tree/',
|
||||
true
|
||||
);
|
||||
|
||||
\ui_require_javascript_file(
|
||||
'fixed-bottom-box',
|
||||
'include/javascript/',
|
||||
true
|
||||
);
|
||||
|
||||
$settings['cellId'] = $this->cellId;
|
||||
$settings['baseURL'] = \ui_get_full_url('/', false, false, false);
|
||||
$settings['ajaxURL'] = \ui_get_full_url('ajax.php', false, false, false);
|
||||
|
||||
// Show the modal window of an module.
|
||||
$output .= '<div id="module_details_window" class="">';
|
||||
$output .= '</div>';
|
||||
|
||||
// Script.
|
||||
$output .= '<script type="text/javascript">';
|
||||
$output .= 'processServiceTree('.json_encode($settings).');';
|
||||
$output .= '</script>';
|
||||
} else {
|
||||
$own_info = \get_user_info($config['id_user']);
|
||||
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||
$display_all_services = true;
|
||||
} else {
|
||||
$display_all_services = false;
|
||||
}
|
||||
|
||||
$order = [
|
||||
'field' => 'name',
|
||||
'field2' => 'name',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
|
||||
$filter['order'] = $order;
|
||||
|
||||
$services = services_get_services(
|
||||
$filter,
|
||||
false,
|
||||
$display_all_services,
|
||||
'AR'
|
||||
);
|
||||
|
||||
$output .= '<div class="white_box mgn_btt_20px mrgn_top_20px pddng_50px services_table" >';
|
||||
$output .= '<div id="table_services_dashboard">';
|
||||
foreach ($services as $service) {
|
||||
switch ($service['status']) {
|
||||
case SERVICE_STATUS_NORMAL:
|
||||
$color = COL_NORMAL;
|
||||
break;
|
||||
|
||||
case SERVICE_STATUS_CRITICAL:
|
||||
$color = COL_CRITICAL;
|
||||
break;
|
||||
|
||||
case SERVICE_STATUS_WARNING:
|
||||
$color = COL_WARNING;
|
||||
break;
|
||||
|
||||
case SERVICE_STATUS_UNKNOWN:
|
||||
default:
|
||||
$color = COL_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
$output .= '<a id="service_'.$service['id'].'" style="background-color: '.$color.'; color: #fff;" class="table_services_item_link_dashboard" href="index.php?'.'sec=network&'.'sec2=enterprise/operation/services/services&tab=service_map&'.'id_service='.$service['id'].'">
|
||||
<div class="table_services_item">
|
||||
<div style="width:50px; text-align:center;">';
|
||||
$output .= \ui_print_group_icon($service['id_group'], true, 'groups_small_white', '', false);
|
||||
|
||||
$output .= '</div>
|
||||
<div class="tooltip" style="color: #fff;position: relative;opacity: 1">'.$service['description'].'
|
||||
</div>
|
||||
<div class="tooltip" style="color: #fff;position: relative;opacity: 1">';
|
||||
$output .= \html_print_image('images/help_w.png', true, ['class' => 'img_help', 'title' => __($service['name']), 'id' => $service['id']]);
|
||||
|
||||
$output .= '</div>
|
||||
</div>
|
||||
</a>';
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
$output .= '<table cellspacing="0" cellpadding="0">';
|
||||
$output .= '<tr>';
|
||||
$output .= '<td>';
|
||||
$output .= '<div class="service_status" style=" background: '.COL_UNKNOWN.';"></div>';
|
||||
$output .= '</td>';
|
||||
$output .= '<td>';
|
||||
$output .= '<div class="service_status" style="background: '.COL_NORMAL.';"></div>';
|
||||
$output .= '</td>';
|
||||
$output .= '<td>';
|
||||
$output .= '<div class="service_status" style="background: '.COL_WARNING.';"></div>';
|
||||
$output .= '</td>';
|
||||
$output .= '<td>';
|
||||
$output .= '<div class="service_status" style="background: '.COL_CRITICAL.';"></div>';
|
||||
$output .= '</td>';
|
||||
|
||||
$output .= '</tr><tr>';
|
||||
|
||||
$output .= '<td>';
|
||||
$output .= '<div class="pdd_r_15px"><span class="font_12px">Unknown</span></div>';
|
||||
$output .= '</td>';
|
||||
$output .= '<td >';
|
||||
$output .= '<div class="pdd_r_15px"><span class="font_12px">Normal</span></div>';
|
||||
$output .= '</div>';
|
||||
$output .= '<td>';
|
||||
$output .= '<div class="pdd_r_15px"><span class="font_12px">Warning</span></div>';
|
||||
$output .= '</td>';
|
||||
$output .= '<td>';
|
||||
$output .= '<div><span class="font_12px">Critical</span></div>';
|
||||
$output .= '</td>';
|
||||
$output .= '</tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get description.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public static function getDescription()
|
||||
{
|
||||
return __('Services view');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Name.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public static function getName()
|
||||
{
|
||||
return 'service_view';
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -310,6 +310,7 @@ class SingleGraphWidget extends Widget
|
|||
'value' => $values['period'],
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -335,6 +335,7 @@ class SLAPercentWidget extends Widget
|
|||
'value' => $values['period'],
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -240,6 +240,7 @@ class TopNWidget extends Widget
|
|||
'value' => $values['period'],
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -153,6 +153,17 @@ abstract class Entity
|
|||
/**
|
||||
* Dynamically call methods in this object.
|
||||
*
|
||||
* To dynamically switch between community methods and prioritize
|
||||
* enterprise ones, define method visibility as 'protected' in both
|
||||
* classes.
|
||||
*
|
||||
* For instance, in following situation:
|
||||
* protected PandoraFMS\Agent::test()
|
||||
* protected PandoraFMS\Enterprise\Agent::test()
|
||||
*
|
||||
* If enterprise is available, then PandoraFMS\Enterprise\Agent::test()
|
||||
* will be executed, community method otherwise.
|
||||
*
|
||||
* @param string $methodName Name of target method or attribute.
|
||||
* @param array $params Arguments for target method.
|
||||
*
|
||||
|
@ -161,41 +172,38 @@ abstract class Entity
|
|||
*/
|
||||
public function __call(string $methodName, ?array $params=null)
|
||||
{
|
||||
// Prioritize written methods over dynamic ones.
|
||||
if (method_exists($this, $methodName) === true) {
|
||||
return call_user_func_array(
|
||||
$this->{$methodName},
|
||||
$params
|
||||
);
|
||||
}
|
||||
|
||||
// Enterprise capabilities.
|
||||
// Prioritize enterprise written methods over dynamic fields.
|
||||
if (\enterprise_installed() === true
|
||||
&& $this->enterprise !== null
|
||||
&& method_exists($this->enterprise, $methodName) === true
|
||||
) {
|
||||
return call_user_func_array(
|
||||
[
|
||||
$this->enterprise,
|
||||
$methodName,
|
||||
],
|
||||
$params
|
||||
return $this->enterprise->$methodName(...$params);
|
||||
}
|
||||
|
||||
if (method_exists($this, $methodName) === false) {
|
||||
if (array_key_exists($methodName, $this->fields) === true) {
|
||||
if (empty($params) === true) {
|
||||
return $this->fields[$methodName];
|
||||
} else {
|
||||
$this->fields[$methodName] = $params[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
throw new \Exception(
|
||||
get_class($this).' error, method '.$methodName.' does not exist'
|
||||
);
|
||||
}
|
||||
|
||||
if (array_key_exists($methodName, $this->fields) === true) {
|
||||
if (empty($params) === true) {
|
||||
return $this->fields[$methodName];
|
||||
} else {
|
||||
$this->fields[$methodName] = $params[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
throw new \Exception(
|
||||
get_class($this).' error, method '.$methodName.' does not exist'
|
||||
);
|
||||
// Do not return nor throw exceptions after this point, allow php
|
||||
// default __call behaviour to continue working with object method
|
||||
// defined.
|
||||
// If you're receiving NULL as result of the method invocation, ensure
|
||||
// it is not private, take in mind this method will mask any access
|
||||
// level error or notification since it is public and has limited access
|
||||
// to the object (public|protected).
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -389,6 +389,9 @@ final class Container extends Model
|
|||
case ODOMETER:
|
||||
return Items\Odometer::class;
|
||||
|
||||
case BASIC_CHART:
|
||||
return Items\BasicChart::class;
|
||||
|
||||
default:
|
||||
return Item::class;
|
||||
}
|
||||
|
|
|
@ -1792,6 +1792,7 @@ class Item extends CachedModel
|
|||
'legendBackgroundColor',
|
||||
'legendColor',
|
||||
'titleColor',
|
||||
'moduleNameColor',
|
||||
]
|
||||
),
|
||||
null
|
||||
|
@ -2119,6 +2120,10 @@ class Item extends CachedModel
|
|||
$text = __('Odometer');
|
||||
break;
|
||||
|
||||
case BASIC_CHART:
|
||||
$text = __('Basic chart');
|
||||
break;
|
||||
|
||||
default:
|
||||
// Lines could not be parents.
|
||||
continue 2;
|
||||
|
|
|
@ -0,0 +1,348 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Models\VisualConsole\Items;
|
||||
use Models\VisualConsole\Item;
|
||||
/**
|
||||
* Model of a basic chart item of the Visual Console.
|
||||
*/
|
||||
final class BasicChart extends Item
|
||||
{
|
||||
|
||||
/**
|
||||
* Used to enable the fetching, validation and extraction of information
|
||||
* about the linked module.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected static $useLinkedModule = true;
|
||||
|
||||
/**
|
||||
* Used to enable the fetching, validation and extraction of information
|
||||
* about the linked visual console.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected static $useLinkedVisualConsole = true;
|
||||
|
||||
/**
|
||||
* Used to enable validation, extraction and encodeing of the HTML output.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected static $useHtmlOutput = true;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a valid representation of the model.
|
||||
*
|
||||
* @param array $data Input data.
|
||||
*
|
||||
* @return array Data structure representing the model.
|
||||
*
|
||||
* @overrides Item::decode.
|
||||
*/
|
||||
protected function decode(array $data): array
|
||||
{
|
||||
$return = parent::decode($data);
|
||||
$return['type'] = BASIC_CHART;
|
||||
$return['period'] = $this->extractPeriod($data);
|
||||
$return['value'] = $this->extractValue($data);
|
||||
$return['status'] = $this->extractStatus($data);
|
||||
$return['moduleNameColor'] = $this->extractModuleNameColor($data);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extract a graph period value.
|
||||
*
|
||||
* @param array $data Unknown input data structure.
|
||||
*
|
||||
* @return mixed The time in seconds of the graph period or null.
|
||||
*/
|
||||
private static function extractPeriod(array $data)
|
||||
{
|
||||
return static::parseIntOr(
|
||||
static::issetInArray($data, ['period']),
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extract value.
|
||||
*
|
||||
* @param array $data Unknown input data structure.
|
||||
*
|
||||
* @return mixed String representing value or null.
|
||||
*/
|
||||
private static function extractValue(array $data)
|
||||
{
|
||||
return static::notEmptyStringOr(
|
||||
static::issetInArray(
|
||||
$data,
|
||||
['value']
|
||||
),
|
||||
'0'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extract status value.
|
||||
*
|
||||
* @param array $data Unknown input data structure.
|
||||
*
|
||||
* @return mixed String representing status value or null.
|
||||
*/
|
||||
private static function extractStatus(array $data)
|
||||
{
|
||||
return static::notEmptyStringOr(
|
||||
static::issetInArray(
|
||||
$data,
|
||||
['status']
|
||||
),
|
||||
COL_UNKNOWN
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extract label color value.
|
||||
*
|
||||
* @param array $data Unknown input data structure.
|
||||
*
|
||||
* @return mixed String representing the grid color (not empty) or null.
|
||||
*/
|
||||
private static function extractModuleNameColor(array $data): string
|
||||
{
|
||||
return static::notEmptyStringOr(
|
||||
static::issetInArray($data, ['moduleNameColor', 'border_color']),
|
||||
'#3f3f3f'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch a vc 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 \InvalidArgumentException When an agent Id cannot be found.
|
||||
*
|
||||
* @override Item::fetchDataFromDB.
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||
|
||||
/*
|
||||
* Retrieve extra data.
|
||||
*/
|
||||
|
||||
// Load side libraries.
|
||||
global $config;
|
||||
include_once $config['homedir'].'/include/functions_graph.php';
|
||||
include_once $config['homedir'].'/include/functions_modules.php';
|
||||
if (is_metaconsole()) {
|
||||
\enterprise_include_once('include/functions_metaconsole.php');
|
||||
}
|
||||
|
||||
$imageOnly = false;
|
||||
$period = static::extractPeriod($data);
|
||||
$linkedModule = static::extractLinkedModule($data);
|
||||
$moduleId = $linkedModule['moduleId'];
|
||||
$metaconsoleId = $linkedModule['metaconsoleId'];
|
||||
|
||||
// Maybe connect to node.
|
||||
$nodeConnected = false;
|
||||
if (\is_metaconsole() === true && $metaconsoleId !== null) {
|
||||
$nodeConnected = \metaconsole_connect(
|
||||
null,
|
||||
$metaconsoleId
|
||||
) === NOERR;
|
||||
|
||||
if ($nodeConnected === false) {
|
||||
throw new \InvalidArgumentException(
|
||||
'error connecting to the node'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* About the 30 substraction to the graph height:
|
||||
* The function which generates the graph doesn't respect the
|
||||
* required height. It uses it for the canvas (the graph itself and
|
||||
* their axes), but then it adds the legend. One item of the legend
|
||||
* (one dataset) is about 30px, so we need to substract that height
|
||||
* from the canvas to try to fit the element's height.
|
||||
*
|
||||
* PD: The custom graphs can have more datasets, but we only substract
|
||||
* the height of one of it to replicate the legacy functionality.
|
||||
*/
|
||||
|
||||
$width = (int) $data['width'];
|
||||
$height = ((int) $data['height'] * 0.6);
|
||||
|
||||
// Module graph.
|
||||
if ($moduleId === null) {
|
||||
throw new \InvalidArgumentException('missing module Id');
|
||||
}
|
||||
|
||||
$now = new \DateTime();
|
||||
$date_array = [];
|
||||
$date_array['period'] = $period;
|
||||
$date_array['final_date'] = $now->getTimestamp();
|
||||
$date_array['start_date'] = ($now->getTimestamp() - $period);
|
||||
|
||||
$params = [
|
||||
'agent_module_id' => $moduleId,
|
||||
'period' => $period,
|
||||
'show_events' => false,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'title' => \modules_get_agentmodule_name(
|
||||
$moduleId
|
||||
),
|
||||
'unit' => \modules_get_unit($moduleId),
|
||||
'only_image' => $imageOnly,
|
||||
'menu' => false,
|
||||
'vconsole' => true,
|
||||
'return_img_base_64' => true,
|
||||
'show_legend' => false,
|
||||
'show_title' => false,
|
||||
'dashboard' => true,
|
||||
'backgroundColor' => 'transparent',
|
||||
'server_id' => $metaconsoleId,
|
||||
'basic_chart' => true,
|
||||
];
|
||||
|
||||
if ($imageOnly !== false) {
|
||||
$imgbase64 = 'data:image/jpg;base64,';
|
||||
}
|
||||
|
||||
$imgbase64 .= \grafico_modulo_sparse($params);
|
||||
|
||||
$data['html'] = $imgbase64;
|
||||
|
||||
$data['value'] = \modules_get_last_value($moduleId);
|
||||
$data['status'] = \modules_get_color_status(modules_get_agentmodule_last_status($moduleId));
|
||||
|
||||
// Restore connection.
|
||||
if ($nodeConnected === true) {
|
||||
\metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
* @param array $values Default values.
|
||||
*
|
||||
* @return array Of inputs.
|
||||
*
|
||||
* @throws Exception On error.
|
||||
*/
|
||||
public static function getFormInputs(array $values): array
|
||||
{
|
||||
// Default values.
|
||||
$values = static::getDefaultGeneralValues($values);
|
||||
|
||||
// Retrieve global - common inputs.
|
||||
$inputs = Item::getFormInputs($values);
|
||||
|
||||
if (is_array($inputs) !== true) {
|
||||
throw new \Exception(
|
||||
'[BasicChart]::getFormInputs parent class return is not an array'
|
||||
);
|
||||
}
|
||||
|
||||
if ($values['tabSelected'] === 'specific') {
|
||||
// Default values.
|
||||
if (isset($values['period']) === false) {
|
||||
$values['period'] = 3600;
|
||||
}
|
||||
|
||||
// Autocomplete agents.
|
||||
$inputs[] = [
|
||||
'id' => 'BCautoCompleteAgent',
|
||||
'label' => __('Agent'),
|
||||
'arguments' => [
|
||||
'type' => 'autocomplete_agent',
|
||||
'name' => 'agentAlias',
|
||||
'id_agent_hidden' => $values['agentId'],
|
||||
'name_agent_hidden' => 'agentId',
|
||||
'server_id_hidden' => $values['metaconsoleId'],
|
||||
'name_server_hidden' => 'metaconsoleId',
|
||||
'return' => true,
|
||||
'module_input' => true,
|
||||
'module_name' => 'moduleId',
|
||||
'module_none' => false,
|
||||
],
|
||||
];
|
||||
|
||||
// Autocomplete module.
|
||||
$inputs[] = [
|
||||
'id' => 'BCautoCompleteModule',
|
||||
'label' => __('Module'),
|
||||
'arguments' => [
|
||||
'type' => 'autocomplete_module',
|
||||
'name' => 'moduleId',
|
||||
'selected' => $values['moduleId'],
|
||||
'return' => true,
|
||||
'sort' => false,
|
||||
'agent_id' => $values['agentId'],
|
||||
'metaconsole_id' => $values['metaconsoleId'],
|
||||
],
|
||||
];
|
||||
|
||||
// Period.
|
||||
$inputs[] = [
|
||||
'label' => __('Period'),
|
||||
'arguments' => [
|
||||
'name' => 'period',
|
||||
'type' => 'interval',
|
||||
'value' => $values['period'],
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
// module name color.
|
||||
$inputs[] = [
|
||||
'label' => __('Module name color'),
|
||||
'arguments' => [
|
||||
'wrapper' => 'div',
|
||||
'name' => 'moduleNameColor',
|
||||
'type' => 'color',
|
||||
'value' => $values['moduleNameColor'],
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
// Inputs LinkedVisualConsole.
|
||||
$inputsLinkedVisualConsole = self::inputsLinkedVisualConsole(
|
||||
$values
|
||||
);
|
||||
foreach ($inputsLinkedVisualConsole as $key => $value) {
|
||||
$inputs[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -612,6 +612,9 @@ final class ModuleGraph extends Item
|
|||
|
||||
// Custom graph.
|
||||
$fields = self::getListCustomGraph();
|
||||
$selected_custom_graph = (\is_metaconsole() === true)
|
||||
? $values['customGraphId'].'|'.$values['metaconsoleId']
|
||||
: $values['customGraphId'];
|
||||
$inputs[] = [
|
||||
'id' => 'MGcustomGraph',
|
||||
'hidden' => $hiddenCustom,
|
||||
|
@ -620,7 +623,7 @@ final class ModuleGraph extends Item
|
|||
'type' => 'select',
|
||||
'fields' => $fields,
|
||||
'name' => 'customGraphId',
|
||||
'selected' => $values['customGraphId'],
|
||||
'selected' => $selected_custom_graph,
|
||||
'return' => true,
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
|
|
|
@ -379,6 +379,11 @@ final class Percentile extends Item
|
|||
|
||||
$moduleValue = \modules_get_last_value($moduleId);
|
||||
if ($moduleValue === false) {
|
||||
// Restore connection.
|
||||
if ($nodeConnected === true) {
|
||||
\metaconsole_restore_db();
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException(
|
||||
'error fetching the module value'
|
||||
);
|
||||
|
|
|
@ -528,6 +528,19 @@ class View extends \HTML
|
|||
}
|
||||
break;
|
||||
|
||||
case BASIC_CHART:
|
||||
$data['agentId'] = \get_parameter('agentId');
|
||||
$data['metaconsoleId'] = \get_parameter('metaconsoleId');
|
||||
$data['agentAlias'] = \get_parameter('agentAlias');
|
||||
$data['moduleId'] = \get_parameter('moduleId');
|
||||
$data['period'] = \get_parameter('period');
|
||||
$data['moduleNameColor'] = \get_parameter('moduleNameColor');
|
||||
if ($itemId === 0) {
|
||||
$data['height'] = 110;
|
||||
$data['width'] = 375;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not posible.
|
||||
break;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.query_result_view_container {
|
||||
|
|
|
@ -166,7 +166,6 @@ div.target.flex {
|
|||
text-align: center;
|
||||
}
|
||||
div#rules::after {
|
||||
content: "Drop Here";
|
||||
position: relative;
|
||||
display: block;
|
||||
margin: 2em auto;
|
||||
|
|
|
@ -5814,6 +5814,18 @@ div#status_pie {
|
|||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
#table_services_dashboard {
|
||||
display: grid;
|
||||
grid-gap: 20px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
||||
grid-template-rows: 1fr;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.services_table {
|
||||
width: 97%;
|
||||
}
|
||||
|
||||
.table_services_item_link {
|
||||
font-size: 16px;
|
||||
display: grid;
|
||||
|
@ -5822,6 +5834,14 @@ div#status_pie {
|
|||
padding: 10px 10px 10px 0;
|
||||
}
|
||||
|
||||
.table_services_item_link_dashboard {
|
||||
font-size: 16px;
|
||||
display: grid;
|
||||
min-height: 50px;
|
||||
box-sizing: border-box;
|
||||
padding: 10px 10px 10px 0;
|
||||
}
|
||||
|
||||
.table_services_item {
|
||||
display: grid;
|
||||
align-items: center;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -176,6 +176,12 @@ div#tree-controller-recipient {
|
|||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.tree-controller-recipient {
|
||||
text-align: left;
|
||||
width: 98%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.tree-node > .node-content > div + div:not(.tree-node-counters) {
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
@ -183,3 +189,7 @@ div#tree-controller-recipient {
|
|||
.tree-node .disabled {
|
||||
filter: opacity(0.3);
|
||||
}
|
||||
|
||||
.ipam-network {
|
||||
font-size: 9pt;
|
||||
}
|
||||
|
|
|
@ -426,6 +426,19 @@ input.odometer_min_white[disabled] {
|
|||
background: url(../../images/odometer.png) no-repeat center;
|
||||
}
|
||||
|
||||
input.basic_chart_min {
|
||||
background: url(../../images/basic_chart.png) no-repeat center;
|
||||
}
|
||||
input.basic_chart_min[disabled] {
|
||||
background: url(../../images/basic_chart.disabled.png) no-repeat center;
|
||||
}
|
||||
input.basic_chart_min_white {
|
||||
background: url(../../images/basic_chart.disabled.png) no-repeat center;
|
||||
}
|
||||
input.basic_chart_min_white[disabled] {
|
||||
background: url(../../images/basic_chart.png) no-repeat center;
|
||||
}
|
||||
|
||||
div#cont {
|
||||
position: fixed;
|
||||
max-height: 320px;
|
||||
|
|
|
@ -547,6 +547,44 @@ div.module-graph {
|
|||
justify-content: center;
|
||||
}
|
||||
|
||||
div.basic-chart {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.basic-chart-header {
|
||||
height: 40%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.basic-chart-header-name {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
width: 80%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 2.5vmin;
|
||||
margin-left: 3%;
|
||||
}
|
||||
|
||||
.basic-chart-header-value {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
width: 20%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 2.5vmin;
|
||||
}
|
||||
|
||||
div.module-graph .gauge_d3_class {
|
||||
flex: 1 1 100px;
|
||||
float: none !important;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -616,36 +616,7 @@ if (! isset($config['id_user'])) {
|
|||
config_prepare_session();
|
||||
}
|
||||
|
||||
if (is_user_admin($config['id_user'])) {
|
||||
// PHP configuration values.
|
||||
$PHPupload_max_filesize = config_return_in_bytes(
|
||||
ini_get('upload_max_filesize')
|
||||
);
|
||||
$PHPmemory_limit = config_return_in_bytes(
|
||||
ini_get('memory_limit')
|
||||
);
|
||||
$PHPmax_execution_time = ini_get('max_execution_time');
|
||||
|
||||
if ($PHPmax_execution_time !== '0') {
|
||||
set_time_limit(0);
|
||||
}
|
||||
|
||||
$PHPupload_max_filesize_min = config_return_in_bytes('800M');
|
||||
|
||||
if ($PHPupload_max_filesize < $PHPupload_max_filesize_min) {
|
||||
ini_set('upload_max_filesize', config_return_in_bytes('800M'));
|
||||
}
|
||||
|
||||
$PHPmemory_limit_min = config_return_in_bytes('500M');
|
||||
|
||||
if ($PHPmemory_limit < $PHPmemory_limit_min && $PHPmemory_limit !== '-1') {
|
||||
ini_set('memory_limit', config_return_in_bytes('500M'));
|
||||
}
|
||||
|
||||
set_time_limit((int) $PHPmax_execution_time);
|
||||
ini_set('upload_max_filesize', $PHPupload_max_filesize);
|
||||
ini_set('memory_limit', $PHPmemory_limit);
|
||||
}
|
||||
|
||||
// ==========================================================
|
||||
// -------- SET THE CUSTOM CONFIGS OF USER ------------------
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.757';
|
||||
$build = '210915';
|
||||
$build = '211004';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -31,13 +31,14 @@ global $config;
|
|||
|
||||
// Check user credentials.
|
||||
check_login();
|
||||
|
||||
// error_reporting(E_ALL);
|
||||
// ini_set("display_errors", 1);
|
||||
// General ACL for the network maps.
|
||||
$networkmaps_read = check_acl($config['id_user'], 0, 'MR');
|
||||
$networkmaps_write = check_acl($config['id_user'], 0, 'MW');
|
||||
$networkmaps_manage = check_acl($config['id_user'], 0, 'MM');
|
||||
$networkmaps_read = (bool) check_acl($config['id_user'], 0, 'MR');
|
||||
$networkmaps_write = (bool) check_acl($config['id_user'], 0, 'MW');
|
||||
$networkmaps_manage = (bool) check_acl($config['id_user'], 0, 'MM');
|
||||
|
||||
if (!$networkmaps_read && !$networkmaps_write && !$networkmaps_manage) {
|
||||
if ($networkmaps_read === false && $networkmaps_write === false && $networkmaps_manage === false) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access networkmap'
|
||||
|
@ -48,179 +49,174 @@ if (!$networkmaps_read && !$networkmaps_write && !$networkmaps_manage) {
|
|||
|
||||
require_once 'include/functions_networkmap.php';
|
||||
|
||||
$new_networkmap = (bool) get_parameter('new_networkmap', false);
|
||||
$save_networkmap = (bool) get_parameter('save_networkmap', false);
|
||||
$save_empty_networkmap = (bool) get_parameter('save_empty_networkmap', false);
|
||||
$new_networkmap = (bool) get_parameter('new_networkmap', false);
|
||||
$save_networkmap = (bool) get_parameter('save_networkmap', false);
|
||||
$save_empty_networkmap = (bool) get_parameter('save_empty_networkmap', false);
|
||||
$update_empty_networkmap = (bool) get_parameter('update_empty_networkmap', false);
|
||||
$update_networkmap = (bool) get_parameter('update_networkmap', false);
|
||||
$copy_networkmap = (bool) get_parameter('copy_networkmap', false);
|
||||
$delete = (bool) get_parameter('delete', false);
|
||||
$tab = (string) get_parameter('tab', 'list');
|
||||
$new_empty_networkmap = get_parameter('new_empty_networkmap', false);
|
||||
$update_networkmap = (bool) get_parameter('update_networkmap', false);
|
||||
$copy_networkmap = (bool) get_parameter('copy_networkmap', false);
|
||||
$delete = (bool) get_parameter('delete', false);
|
||||
$tab = (string) get_parameter('tab', 'list');
|
||||
$new_empty_networkmap = (bool) get_parameter('new_empty_networkmap', false);
|
||||
|
||||
if (enterprise_installed()) {
|
||||
if ($new_empty_networkmap) {
|
||||
if ($networkmaps_write || $networkmaps_manage) {
|
||||
enterprise_include(
|
||||
'godmode/agentes/pandora_networkmap_empty.editor.php'
|
||||
);
|
||||
return;
|
||||
}
|
||||
if ($new_empty_networkmap === true) {
|
||||
if ($networkmaps_write === true || $networkmaps_manage === true) {
|
||||
include_once 'godmode/agentes/pandora_networkmap_empty.editor.php';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($save_empty_networkmap === true) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
$id_group_map = (int) get_parameter('id_group_map', 0);
|
||||
|
||||
// ACL for the network map.
|
||||
$networkmap_write = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MW');
|
||||
$networkmap_manage = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MM');
|
||||
|
||||
if ($networkmap_write === false && $networkmap_manage === false) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access networkmap'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
if ($save_empty_networkmap) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
$id_group_map = (int) get_parameter('id_group_map', 0);
|
||||
$name = (string) get_parameter('name', '');
|
||||
|
||||
// ACL for the network map.
|
||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||
$networkmap_write = check_acl_restricted_all($config['id_user'], $id_group_map, 'MW');
|
||||
$networkmap_manage = check_acl_restricted_all($config['id_user'], $id_group_map, 'MM');
|
||||
// Default size values.
|
||||
$width = $config['networkmap_max_width'];
|
||||
$height = $config['networkmap_max_width'];
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access networkmap'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
$method = (string) get_parameter('method', 'fdp');
|
||||
|
||||
$name = (string) get_parameter('name', '');
|
||||
$dont_show_subgroups = (int) get_parameter_checkbox(
|
||||
'dont_show_subgroups',
|
||||
0
|
||||
);
|
||||
$node_radius = (int) get_parameter('node_radius', 40);
|
||||
$description = get_parameter('description', '');
|
||||
|
||||
// Default size values
|
||||
$width = $config['networkmap_max_width'];
|
||||
$height = $config['networkmap_max_width'];
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
$values['source_period'] = 60;
|
||||
$values['width'] = $width;
|
||||
$values['height'] = $height;
|
||||
$values['id_user'] = $config['id_user'];
|
||||
$values['description'] = $description;
|
||||
$values['source'] = 0;
|
||||
$values['source_data'] = $id_group;
|
||||
$values['id_group_map'] = $id_group_map;
|
||||
|
||||
$method = (string) get_parameter('method', 'fdp');
|
||||
|
||||
$dont_show_subgroups = (int) get_parameter_checkbox(
|
||||
'dont_show_subgroups',
|
||||
0
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access networkmap'
|
||||
);
|
||||
$node_radius = (int) get_parameter('node_radius', 40);
|
||||
$description = get_parameter('description', '');
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
$values['source_period'] = 60;
|
||||
$values['width'] = $width;
|
||||
$values['height'] = $height;
|
||||
$values['id_user'] = $config['id_user'];
|
||||
$values['description'] = $description;
|
||||
$values['source'] = 0;
|
||||
$values['source_data'] = $id_group;
|
||||
$values['id_group_map'] = $id_group_map;
|
||||
$filter = [];
|
||||
$filter['dont_show_subgroups'] = $dont_show_subgroups;
|
||||
$filter['node_radius'] = $node_radius;
|
||||
$filter['empty_map'] = 1;
|
||||
$values['filter'] = json_encode($filter);
|
||||
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access networkmap'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$filter = [];
|
||||
$filter['dont_show_subgroups'] = $dont_show_subgroups;
|
||||
$filter['node_radius'] = $node_radius;
|
||||
$filter['empty_map'] = 1;
|
||||
$values['filter'] = json_encode($filter);
|
||||
|
||||
$result = false;
|
||||
if (!empty($name)) {
|
||||
$result = db_process_sql_insert(
|
||||
'tmap',
|
||||
$values
|
||||
);
|
||||
}
|
||||
|
||||
$result_txt = ui_print_result_message(
|
||||
$result,
|
||||
__('Succesfully created'),
|
||||
__('Could not be created'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
$id = $result;
|
||||
define('_id_', $id);
|
||||
|
||||
if ($result !== false) {
|
||||
$tab = 'view';
|
||||
header(
|
||||
'Location: '.ui_get_full_url(
|
||||
'index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab='.$tab.'&id_networkmap='.$id
|
||||
)
|
||||
);
|
||||
}
|
||||
} else if ($update_empty_networkmap) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
$id_group_map = (int) get_parameter('id_group_map', 0);
|
||||
|
||||
|
||||
// ACL for the new network map
|
||||
$networkmap_write_new = check_acl_restricted_all($config['id_user'], $id_group_map, 'MW');
|
||||
$networkmap_manage_new = check_acl_restricted_all($config['id_user'], $id_group_map, 'MM');
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access networkmap'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$name = (string) get_parameter('name', '');
|
||||
|
||||
$recon_task_id = (int) get_parameter(
|
||||
'recon_task_id',
|
||||
0
|
||||
);
|
||||
|
||||
$source = (string) get_parameter('source', 'group');
|
||||
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
|
||||
$values['generation_method'] = 4;
|
||||
|
||||
$description = get_parameter('description', '');
|
||||
$values['description'] = $description;
|
||||
|
||||
$dont_show_subgroups = (int) get_parameter_checkbox(
|
||||
'dont_show_subgroups',
|
||||
0
|
||||
);
|
||||
$node_radius = (int) get_parameter('node_radius', 40);
|
||||
$row = db_get_row('tmap', 'id', $id);
|
||||
$filter = json_decode($row['filter'], true);
|
||||
$filter['dont_show_subgroups'] = $dont_show_subgroups;
|
||||
$filter['node_radius'] = $node_radius;
|
||||
|
||||
$values['filter'] = json_encode($filter);
|
||||
|
||||
$result = false;
|
||||
if (!empty($name)) {
|
||||
$result = db_process_sql_update(
|
||||
'tmap',
|
||||
$values,
|
||||
['id' => $id]
|
||||
);
|
||||
}
|
||||
|
||||
$result_txt = ui_print_result_message(
|
||||
$result,
|
||||
__('Succesfully updated'),
|
||||
__('Could not be updated'),
|
||||
'',
|
||||
true
|
||||
$result = false;
|
||||
if (!empty($name)) {
|
||||
$result = db_process_sql_insert(
|
||||
'tmap',
|
||||
$values
|
||||
);
|
||||
}
|
||||
|
||||
$result_txt = ui_print_result_message(
|
||||
$result,
|
||||
__('Succesfully created'),
|
||||
__('Could not be created'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
$id = $result;
|
||||
define('_id_', $id);
|
||||
|
||||
if ($result !== false) {
|
||||
$tab = 'view';
|
||||
header(
|
||||
'Location: '.ui_get_full_url(
|
||||
'index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab='.$tab.'&id_networkmap='.$id
|
||||
)
|
||||
);
|
||||
}
|
||||
} else if ($update_empty_networkmap) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
$id_group_map = (int) get_parameter('id_group_map', 0);
|
||||
|
||||
|
||||
// ACL for the new network map
|
||||
$networkmap_write_new = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MW');
|
||||
$networkmap_manage_new = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MM');
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access networkmap'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$name = (string) get_parameter('name', '');
|
||||
|
||||
$recon_task_id = (int) get_parameter(
|
||||
'recon_task_id',
|
||||
0
|
||||
);
|
||||
|
||||
$source = (string) get_parameter('source', 'group');
|
||||
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
|
||||
$values['generation_method'] = 4;
|
||||
|
||||
$description = get_parameter('description', '');
|
||||
$values['description'] = $description;
|
||||
|
||||
$dont_show_subgroups = (int) get_parameter_checkbox(
|
||||
'dont_show_subgroups',
|
||||
0
|
||||
);
|
||||
$node_radius = (int) get_parameter('node_radius', 40);
|
||||
$row = db_get_row('tmap', 'id', $id);
|
||||
$filter = json_decode($row['filter'], true);
|
||||
$filter['dont_show_subgroups'] = $dont_show_subgroups;
|
||||
$filter['node_radius'] = $node_radius;
|
||||
|
||||
$values['filter'] = json_encode($filter);
|
||||
|
||||
$result = false;
|
||||
if (empty($name) === false) {
|
||||
$result = db_process_sql_update(
|
||||
'tmap',
|
||||
$values,
|
||||
['id' => $id]
|
||||
);
|
||||
}
|
||||
|
||||
$result_txt = ui_print_result_message(
|
||||
$result,
|
||||
__('Succesfully updated'),
|
||||
__('Could not be updated'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// The networkmap doesn't exist yet
|
||||
|
@ -245,12 +241,11 @@ if ($new_networkmap || $save_networkmap) {
|
|||
$id_group_map = (int) get_parameter('id_group_map', 0);
|
||||
|
||||
|
||||
// ACL for the network map
|
||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||
$networkmap_write = check_acl_restricted_all($config['id_user'], $id_group_map, 'MW');
|
||||
$networkmap_manage = check_acl_restricted_all($config['id_user'], $id_group_map, 'MM');
|
||||
// ACL for the network map.
|
||||
$networkmap_write = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MW');
|
||||
$networkmap_manage = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MM');
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
if ($networkmap_write === false && $networkmap_manage === false) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access networkmap'
|
||||
|
@ -259,9 +254,9 @@ if ($new_networkmap || $save_networkmap) {
|
|||
return;
|
||||
}
|
||||
|
||||
$name = (string) get_parameter('name', '');
|
||||
$name = (string) get_parameter('name');
|
||||
|
||||
// Default size values
|
||||
// Default size values.
|
||||
$width = $config['networkmap_max_width'];
|
||||
$height = $config['networkmap_max_width'];
|
||||
|
||||
|
@ -288,11 +283,7 @@ if ($new_networkmap || $save_networkmap) {
|
|||
$scale_z = get_parameter('scale_z', 0.5);
|
||||
|
||||
$node_sep = get_parameter('node_sep', '0.25');
|
||||
if ($method == 'twopi') {
|
||||
$rank_sep = get_parameter('rank_sep', '1.0');
|
||||
} else {
|
||||
$rank_sep = get_parameter('rank_sep', '0.5');
|
||||
}
|
||||
$rank_sep = get_parameter('rank_sep', ($method === 'twopi') ? '1.0' : '0.5');
|
||||
|
||||
$mindist = get_parameter('mindist', '1.0');
|
||||
$kval = get_parameter('kval', '0.3');
|
||||
|
@ -348,7 +339,7 @@ if ($new_networkmap || $save_networkmap) {
|
|||
$values['source_data'] = $ip_mask;
|
||||
}
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
if ($networkmap_write === false && $networkmap_manage === false) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access networkmap'
|
||||
|
@ -437,10 +428,10 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
|||
return;
|
||||
}
|
||||
|
||||
$networkmap_write = check_acl_restricted_all($config['id_user'], $id_group_map_old, 'MW');
|
||||
$networkmap_manage = check_acl_restricted_all($config['id_user'], $id_group_map_old, 'MM');
|
||||
$networkmap_write = (bool) check_acl_restricted_all($config['id_user'], $id_group_map_old, 'MW');
|
||||
$networkmap_manage = (bool) check_acl_restricted_all($config['id_user'], $id_group_map_old, 'MM');
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
if ($networkmap_write === false && $networkmap_manage === false) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access networkmap'
|
||||
|
@ -455,12 +446,12 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
|||
$id_group_old = db_get_value('id_group', 'tmap', 'id', $id);
|
||||
|
||||
|
||||
// ACL for the new network map
|
||||
$id_group_map = (int) get_parameter('id_group_map', 0);
|
||||
$networkmap_write_new = check_acl_restricted_all($config['id_user'], $id_group_map, 'MW');
|
||||
$networkmap_manage_new = check_acl_restricted_all($config['id_user'], $id_group_map, 'MM');
|
||||
// ACL for the new network map.
|
||||
$id_group_map = (int) get_parameter('id_group_map', 0);
|
||||
$networkmap_write_new = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MW');
|
||||
$networkmap_manage_new = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MM');
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
if ($networkmap_write === false && $networkmap_manage === false) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access networkmap'
|
||||
|
@ -503,7 +494,7 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
|||
$values['filter'] = json_encode($filter);
|
||||
|
||||
$result = false;
|
||||
if (!empty($name)) {
|
||||
if (empty($name) === false) {
|
||||
$result = db_process_sql_update(
|
||||
'tmap',
|
||||
$values,
|
||||
|
@ -577,11 +568,9 @@ switch ($tab) {
|
|||
$old_networkmaps_enterprise = [];
|
||||
$old_networkmaps_open = [];
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$old_networkmaps_enterprise = db_get_all_rows_sql('SELECT * FROM tnetworkmap_enterprise');
|
||||
if ($old_networkmaps_enterprise === false) {
|
||||
$old_networkmaps_enterprise = [];
|
||||
}
|
||||
$old_networkmaps_enterprise = db_get_all_rows_sql('SELECT * FROM tnetworkmap_enterprise');
|
||||
if ($old_networkmaps_enterprise === false) {
|
||||
$old_networkmaps_enterprise = [];
|
||||
}
|
||||
|
||||
$old_networkmaps_open = db_get_all_rows_sql('SELECT * FROM tnetwork_map');
|
||||
|
@ -590,13 +579,13 @@ switch ($tab) {
|
|||
foreach ($old_networkmaps_enterprise as $old_map_ent) {
|
||||
$old_map_options = json_decode($old_map_ent['options'], true);
|
||||
|
||||
if (!isset($old_map_options['migrated'])) {
|
||||
if (isset($old_map_options['migrated']) === false) {
|
||||
$ent_maps_to_migrate[] = $old_map_ent['id'];
|
||||
}
|
||||
}
|
||||
|
||||
$open_maps_to_migrate = [];
|
||||
if (isset($old_networkmaps_open) && is_array($old_networkmaps_open)) {
|
||||
if (isset($old_networkmaps_open) === true && is_array($old_networkmaps_open) === true) {
|
||||
foreach ($old_networkmaps_open as $old_map_open) {
|
||||
$text_filter = $old_map_open['text_filter'];
|
||||
if ($text_filter != 'migrated') {
|
||||
|
@ -605,7 +594,7 @@ switch ($tab) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($ent_maps_to_migrate) || !empty($open_maps_to_migrate)) {
|
||||
if (empty($ent_maps_to_migrate) === false || empty($open_maps_to_migrate) === false) {
|
||||
?>
|
||||
<div id="migration_dialog" class="center">
|
||||
<p class="center"><strong>Networkmaps are not migrated, wait while migration is processed...</strong></p>
|
||||
|
@ -694,12 +683,10 @@ switch ($tab) {
|
|||
|
||||
$table->style = [];
|
||||
$table->style['name'] = '';
|
||||
if (enterprise_installed()) {
|
||||
$table->style['nodes'] = 'text-align: center;';
|
||||
}
|
||||
$table->style['nodes'] = 'text-align: center;';
|
||||
|
||||
$table->style['groups'] = 'text-align: left;';
|
||||
if ($networkmaps_write || $networkmaps_manage) {
|
||||
if ($networkmaps_write === true || $networkmaps_manage === true) {
|
||||
$table->style['copy'] = 'text-align: center;';
|
||||
$table->style['edit'] = 'text-align: center;';
|
||||
$table->style['delete'] = 'text-align: center;';
|
||||
|
@ -707,12 +694,10 @@ switch ($tab) {
|
|||
|
||||
$table->size = [];
|
||||
$table->size['name'] = '60%';
|
||||
if (enterprise_installed()) {
|
||||
$table->size['nodes'] = '30px';
|
||||
}
|
||||
$table->size['nodes'] = '30px';
|
||||
|
||||
$table->size['groups'] = '400px';
|
||||
if ($networkmaps_write || $networkmaps_manage) {
|
||||
if ($networkmaps_write === true || $networkmaps_manage === true) {
|
||||
$table->size['copy'] = '30px';
|
||||
$table->size['edit'] = '30px';
|
||||
$table->size['delete'] = '30px';
|
||||
|
@ -720,12 +705,10 @@ switch ($tab) {
|
|||
|
||||
$table->head = [];
|
||||
$table->head['name'] = __('Name');
|
||||
if (enterprise_installed()) {
|
||||
$table->head['nodes'] = __('Nodes');
|
||||
}
|
||||
$table->head['nodes'] = __('Nodes');
|
||||
|
||||
$table->head['groups'] = __('Groups');
|
||||
if ($networkmaps_write || $networkmaps_manage) {
|
||||
if ($networkmaps_write === true || $networkmaps_manage === true) {
|
||||
$table->head['copy'] = __('Copy');
|
||||
$table->head['edit'] = __('Edit');
|
||||
$table->head['delete'] = __('Delete');
|
||||
|
@ -755,19 +738,10 @@ switch ($tab) {
|
|||
$table->data = [];
|
||||
|
||||
foreach ($network_maps as $network_map) {
|
||||
// ACL for the network map
|
||||
$networkmap_read = check_acl_restricted_all($config['id_user'], $network_map['id_group_map'], 'MR');
|
||||
$networkmap_write = check_acl_restricted_all($config['id_user'], $network_map['id_group_map'], 'MW');
|
||||
$networkmap_manage = check_acl_restricted_all($config['id_user'], $network_map['id_group_map'], 'MM');
|
||||
|
||||
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access networkmap enterprise'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
continue;
|
||||
}
|
||||
// ACL for the network map.
|
||||
$networkmap_read = (bool) check_acl_restricted_all($config['id_user'], $network_map['id_group_map'], 'MR');
|
||||
$networkmap_write = (bool) check_acl_restricted_all($config['id_user'], $network_map['id_group_map'], 'MW');
|
||||
$networkmap_manage = (bool) check_acl_restricted_all($config['id_user'], $network_map['id_group_map'], 'MM');
|
||||
|
||||
$data = [];
|
||||
if ($network_map['generation_method'] == 6) {
|
||||
|
@ -797,19 +771,17 @@ switch ($tab) {
|
|||
$count = 0;
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
if (($count == 0) && ($network_map['source'] != 'empty')) {
|
||||
if ($network_map['generated']) {
|
||||
$data['nodes'] = __('Empty map');
|
||||
} else if ($network_map['generation_method'] == LAYOUT_RADIAL_DYNAMIC) {
|
||||
$data['nodes'] = __('Dynamic');
|
||||
} else {
|
||||
$data['nodes'] = __('Pending to generate');
|
||||
}
|
||||
if (($count == 0) && ($network_map['source'] != 'empty')) {
|
||||
if ($network_map['generated']) {
|
||||
$data['nodes'] = __('Empty map');
|
||||
} else if ($network_map['generation_method'] == LAYOUT_RADIAL_DYNAMIC) {
|
||||
$data['nodes'] = __('Dynamic');
|
||||
} else {
|
||||
$data['nodes'] = ($network_map['id_group'] == 0) ? ($count - 1) : $count;
|
||||
// PandoraFMS node is not an agent
|
||||
$data['nodes'] = __('Pending to generate');
|
||||
}
|
||||
} else {
|
||||
$data['nodes'] = ($network_map['id_group'] == 0) ? ($count - 1) : $count;
|
||||
// PandoraFMS node is not an agent
|
||||
}
|
||||
|
||||
$data['groups'] = ui_print_group_icon($network_map['id_group_map'], true);
|
||||
|
@ -847,14 +819,12 @@ switch ($tab) {
|
|||
echo '</form>';
|
||||
echo '</div>';
|
||||
|
||||
if (enterprise_installed()) {
|
||||
echo "<div style='width: ".$table->width."; margin-top: 5px;'>";
|
||||
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
||||
html_print_input_hidden('new_empty_networkmap', 1);
|
||||
html_print_submit_button(__('Create empty network map'), 'crt', false, 'class="sub next float-right mrgn_right_20px"');
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
echo "<div style='width: ".$table->width."; margin-top: 5px;'>";
|
||||
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
||||
html_print_input_hidden('new_empty_networkmap', 1);
|
||||
html_print_submit_button(__('Create empty network map'), 'crt', false, 'class="sub next float-right mrgn_right_20px"');
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ if (is_ajax()) {
|
|||
$process_migration = (bool) get_parameter('process_migration', false);
|
||||
$get_agent_info = (bool) get_parameter('get_agent_info', false);
|
||||
$update_node = (bool) get_parameter('update_node', false);
|
||||
$get_agents_in_group = (bool) get_parameter('get_agents_in_group', false);
|
||||
|
||||
if ($update_node) {
|
||||
$node_json = io_safe_output(get_parameter('node', ''));
|
||||
|
@ -80,6 +81,65 @@ if (is_ajax()) {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
if ($get_agents_in_group) {
|
||||
$id = (int) get_parameter('id', 0);
|
||||
$group = (int) get_parameter('group', -1);
|
||||
$group_recursion = (int) get_parameter('group_recursion', 0);
|
||||
|
||||
$return = [];
|
||||
$return['correct'] = false;
|
||||
|
||||
if ($group != -1) {
|
||||
$where_id_agente = ' 1=1 ';
|
||||
|
||||
$agents_in_networkmap = db_get_all_rows_filter(
|
||||
'titem',
|
||||
[
|
||||
'id_map' => $id,
|
||||
'deleted' => 0,
|
||||
]
|
||||
);
|
||||
if ($agents_in_networkmap !== false) {
|
||||
$ids = [];
|
||||
foreach ($agents_in_networkmap as $agent) {
|
||||
if ($agent['type'] == 0) {
|
||||
$ids[] = $agent['source_data'];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($ids) === false) {
|
||||
$where_id_agente = 'id_agente NOT IN ('.implode(',', $ids).')';
|
||||
}
|
||||
}
|
||||
|
||||
if ($group_recursion !== 0) {
|
||||
$group_tree = groups_get_children_ids($group);
|
||||
$group = implode(',', $group_tree);
|
||||
}
|
||||
|
||||
$sql = 'SELECT id_agente, alias
|
||||
FROM tagente
|
||||
WHERE id_grupo IN ('.$group.') AND '.$where_id_agente.'
|
||||
ORDER BY alias ASC';
|
||||
|
||||
$agents = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($agents !== false) {
|
||||
$return['agents'] = [];
|
||||
foreach ($agents as $agent) {
|
||||
$return['agents'][$agent['id_agente']] = $agent['alias'];
|
||||
}
|
||||
|
||||
$return['correct'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($return);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($module_get_status) {
|
||||
$id = (int) get_parameter('id', 0);
|
||||
|
||||
|
|
|
@ -765,7 +765,7 @@ if (is_ajax()) {
|
|||
|
||||
$result = [];
|
||||
foreach ($last_modules_set as $module_name => $module_data) {
|
||||
$value = ui_print_truncate_text(io_safe_output($module_name), 'module_medium', false, true);
|
||||
$value = ui_print_truncate_text(io_safe_output($module_name), 'module_medium', false, true, false, '...');
|
||||
|
||||
$module_data_processed = array_map(
|
||||
function ($item) {
|
||||
|
@ -863,10 +863,12 @@ if (is_ajax()) {
|
|||
io_safe_output($nameModule['nombre']),
|
||||
'module_medium',
|
||||
false,
|
||||
true
|
||||
true,
|
||||
false,
|
||||
'...'
|
||||
);
|
||||
} else {
|
||||
$result[io_safe_output($nameModule['nombre']).'$*$'.implode('|', $idAgents)] = ui_print_truncate_text(io_safe_output($nameModule['nombre']), 'module_medium', false, true);
|
||||
$result[io_safe_output($nameModule['nombre']).'$*$'.implode('|', $idAgents)] = ui_print_truncate_text(io_safe_output($nameModule['nombre']), 'module_medium', false, true, false, '...');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ $access = ($event_a == true) ? 'ER' : (($event_w == true) ? 'EW' : (($event_m ==
|
|||
|
||||
|
||||
$readonly = false;
|
||||
if (!is_metaconsole()
|
||||
if (is_metaconsole() === false
|
||||
&& isset($config['event_replication'])
|
||||
&& $config['event_replication'] == 1
|
||||
&& $config['show_events_in_local'] == 1
|
||||
|
@ -82,7 +82,7 @@ if (!is_metaconsole()
|
|||
// Load specific stylesheet.
|
||||
ui_require_css_file('events');
|
||||
ui_require_css_file('tables');
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
ui_require_css_file('tables_meta', ENTERPRISE_DIR.'/include/styles/');
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ $section = get_parameter('section', false);
|
|||
|
||||
$id_source_event = get_parameter(
|
||||
'filter[id_source_event]',
|
||||
$filter['id_source_event']
|
||||
($filter['id_source_event'] ?? '')
|
||||
);
|
||||
|
||||
$server_id = get_parameter(
|
||||
|
@ -224,7 +224,7 @@ $server_id = get_parameter(
|
|||
$filter['id_server_meta']
|
||||
);
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
// Connect to node database.
|
||||
$id_node = $server_id;
|
||||
if ($id_node != 0) {
|
||||
|
@ -235,16 +235,16 @@ if (is_metaconsole()) {
|
|||
}
|
||||
|
||||
|
||||
if (empty($text_agent) && !empty($id_agent)) {
|
||||
if (empty($text_agent) && empty($id_agent) === false) {
|
||||
$text_agent = agents_get_alias($id_agent);
|
||||
}
|
||||
|
||||
if (empty($text_module) && !empty($id_agent_module)) {
|
||||
if (empty($text_module) && empty($id_agent_module) === false) {
|
||||
$text_module = modules_get_agentmodule_name($id_agent_module);
|
||||
$text_agent = agents_get_alias(modules_get_agentmodule_agent($id_agent_module));
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
// Return to metaconsole database.
|
||||
if ($id_node != 0) {
|
||||
metaconsole_restore_db();
|
||||
|
@ -252,7 +252,7 @@ if (is_metaconsole()) {
|
|||
}
|
||||
|
||||
// Ajax responses.
|
||||
if (is_ajax()) {
|
||||
if (is_ajax() === true) {
|
||||
$get_events = get_parameter('get_events', 0);
|
||||
// Datatables offset, limit.
|
||||
$start = get_parameter('start', 0);
|
||||
|
@ -263,7 +263,7 @@ if (is_ajax()) {
|
|||
ob_start();
|
||||
$order = get_datatable_order(true);
|
||||
|
||||
if (is_array($order) && $order['field'] == 'mini_severity') {
|
||||
if (is_array($order) === true && $order['field'] === 'mini_severity') {
|
||||
$order['field'] = 'te.criticity';
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,8 @@ if (is_ajax()) {
|
|||
'tg.nombre as group_name',
|
||||
'ta.direccion',
|
||||
];
|
||||
if (!is_metaconsole()) {
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
$fields[] = 'am.nombre as module_name';
|
||||
$fields[] = 'am.id_agente_modulo as id_agentmodule';
|
||||
$fields[] = 'am.custom_id as module_custom_id';
|
||||
|
@ -509,11 +510,13 @@ if ($loaded_filter !== false && $from_event_graph != 1) {
|
|||
$filter_only_alert = $filter['filter_only_alert'];
|
||||
$id_group_filter = $filter['id_group_filter'];
|
||||
$date_from = $filter['date_from'];
|
||||
$time_from = $filter['time_from'];
|
||||
$date_to = $filter['date_to'];
|
||||
$time_to = $filter['time_to'];
|
||||
$source = $filter['source'];
|
||||
$id_extra = $filter['id_extra'];
|
||||
$user_comment = $filter['user_comment'];
|
||||
$id_source_event = $filter['id_source_event'];
|
||||
$id_source_event = ($filter['id_source_event'] ?? '');
|
||||
$server_id = $filter['server_id'];
|
||||
}
|
||||
}
|
||||
|
@ -565,7 +568,7 @@ $tabletags_with->cellspacing = 4;
|
|||
$tabletags_with->cellpadding = 4;
|
||||
$tabletags_with->class = 'noshadow';
|
||||
$tabletags_with->styleTable = 'border: 0px;';
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
$tabletags_with->class = 'nobady';
|
||||
$tabletags_with->cellspacing = 0;
|
||||
$tabletags_with->cellpadding = 0;
|
||||
|
@ -642,7 +645,7 @@ $tabletags_without->width = '100%';
|
|||
$tabletags_without->cellspacing = 4;
|
||||
$tabletags_without->cellpadding = 4;
|
||||
$tabletags_without->class = 'noshadow';
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
$tabletags_without->class = 'nobady';
|
||||
$tabletags_without->cellspacing = 0;
|
||||
$tabletags_without->cellpadding = 0;
|
||||
|
@ -781,7 +784,7 @@ if ($pure) {
|
|||
// Floating menu - End.
|
||||
ui_require_jquery_file('countdown');
|
||||
} else {
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
// Load metaconsole frame.
|
||||
enterprise_hook('open_meta_frame');
|
||||
}
|
||||
|
@ -892,7 +895,7 @@ if ($pure) {
|
|||
}
|
||||
|
||||
// If the history event is not enabled, dont show the history tab.
|
||||
if (!isset($config['metaconsole_events_history']) || $config['metaconsole_events_history'] != 1) {
|
||||
if (isset($config['metaconsole_events_history']) === false || $config['metaconsole_events_history'] != 1) {
|
||||
unset($onheader['history']);
|
||||
}
|
||||
|
||||
|
@ -913,7 +916,7 @@ if ($pure) {
|
|||
break;
|
||||
}
|
||||
|
||||
if (! defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === false) {
|
||||
unset($onheader['history']);
|
||||
ui_print_page_header(
|
||||
__('Events'),
|
||||
|
@ -974,13 +977,16 @@ if (enterprise_installed() === true) {
|
|||
}
|
||||
|
||||
// Error div for ajax messages.
|
||||
echo "<div id='show_message_error'>";
|
||||
echo '</div>';
|
||||
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'show_message_error',
|
||||
'content' => '',
|
||||
]
|
||||
);
|
||||
|
||||
// Controls.
|
||||
if (is_metaconsole() !== true) {
|
||||
if (isset($config['event_replication'])
|
||||
if (isset($config['event_replication']) === true
|
||||
&& $config['event_replication'] == 1
|
||||
) {
|
||||
if ($config['show_events_in_local'] == 0) {
|
||||
|
@ -1095,7 +1101,7 @@ $in = '<div class="filter_input"><label>'.__('Free search').'</label>';
|
|||
$in .= $data.'</div>';
|
||||
$inputs[] = $in;
|
||||
|
||||
if (empty($severity) && $severity !== '0') {
|
||||
if (empty($severity) === true && $severity !== '0') {
|
||||
$severity = -1;
|
||||
}
|
||||
|
||||
|
@ -1207,7 +1213,7 @@ $in .= $data.'</div>';
|
|||
$adv_inputs[] = $in;
|
||||
|
||||
// Mixed. Metaconsole => server, Console => module.
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
$title = __('Server');
|
||||
$data = html_print_select_from_sql(
|
||||
'SELECT id, server_name FROM tmetaconsole_setup',
|
||||
|
@ -1270,16 +1276,20 @@ $data = html_print_select(
|
|||
-1,
|
||||
true
|
||||
);
|
||||
$in = '<div class="filter_input"><label>'.__('Alert events').'</label>';
|
||||
$in .= $data.'</div>';
|
||||
$adv_inputs[] = $in;
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (empty($id_source_event) === true) {
|
||||
$id_source_event = '';
|
||||
}
|
||||
$adv_inputs[] = html_print_div(
|
||||
[
|
||||
'class' => 'filter_input',
|
||||
'content' => sprintf(
|
||||
'<label>%s</label>%s',
|
||||
__('Alert events'),
|
||||
$data
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$input_id_source_event = (empty($id_source_event) === true) ? '' : $id_source_event;
|
||||
if (is_metaconsole() === true) {
|
||||
$data = html_print_input_text(
|
||||
'id_source_event',
|
||||
$id_source_event,
|
||||
|
@ -1288,19 +1298,24 @@ if (is_metaconsole()) {
|
|||
255,
|
||||
true
|
||||
);
|
||||
$in = '<div class="filter_input"><label>'.__('Id source event').'</label>';
|
||||
$in .= $data.'</div>';
|
||||
$adv_inputs[] = $in;
|
||||
}
|
||||
|
||||
if ($date_from === '0000-00-00') {
|
||||
$date_from = '';
|
||||
$adv_inputs[] = html_print_div(
|
||||
[
|
||||
'class' => 'filter_input',
|
||||
'content' => sprintf(
|
||||
'<label>%s</label>%s',
|
||||
__('Id source event'),
|
||||
$data
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// Date from.
|
||||
$data = html_print_input_text(
|
||||
$inputDateFrom = html_print_input_text(
|
||||
'date_from',
|
||||
$date_from,
|
||||
($date_from === '0000-00-00') ? '' : $date_from,
|
||||
'',
|
||||
false,
|
||||
10,
|
||||
|
@ -1318,22 +1333,69 @@ $data = html_print_input_text(
|
|||
// Autocomplete.
|
||||
'off'
|
||||
);
|
||||
$in = '<div class="filter_input">';
|
||||
$in .= '<div class="filter_input_little"><label>'.__('Date from').'</label>';
|
||||
$in .= $data.'</div>';
|
||||
|
||||
$data = '';
|
||||
$in .= $data.'</div>';
|
||||
$adv_inputs[] = $in;
|
||||
// Time from.
|
||||
$inputTimeFrom = html_print_input_text(
|
||||
'time_from',
|
||||
$time_from,
|
||||
'',
|
||||
false,
|
||||
10,
|
||||
true,
|
||||
// Disabled.
|
||||
false,
|
||||
// Required.
|
||||
false,
|
||||
// Function.
|
||||
'',
|
||||
// Class.
|
||||
'',
|
||||
// OnChange.
|
||||
'',
|
||||
// Autocomplete.
|
||||
'off'
|
||||
);
|
||||
|
||||
if ($date_to === '0000-00-00') {
|
||||
$date_to = '';
|
||||
}
|
||||
// Date and Time From.
|
||||
$adv_inputs[] = html_print_div(
|
||||
[
|
||||
'class' => 'filter_input',
|
||||
'content' => sprintf(
|
||||
'<label>%s</label>%s<span>:</span>%s',
|
||||
__('From (date:time)'),
|
||||
$inputDateFrom,
|
||||
$inputTimeFrom
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
// Time to.
|
||||
$inputTimeTo = html_print_input_text(
|
||||
'time_to',
|
||||
$time_to,
|
||||
'',
|
||||
false,
|
||||
10,
|
||||
true,
|
||||
// Disabled.
|
||||
false,
|
||||
// Required.
|
||||
false,
|
||||
// Function.
|
||||
'',
|
||||
// Class.
|
||||
'',
|
||||
// OnChange.
|
||||
'',
|
||||
// Autocomplete.
|
||||
'off'
|
||||
);
|
||||
|
||||
// Date to.
|
||||
$data = html_print_input_text(
|
||||
$inputDateTo = html_print_input_text(
|
||||
'date_to',
|
||||
$date_to,
|
||||
($date_to === '0000-00-00') ? '' : $date_to,
|
||||
'',
|
||||
false,
|
||||
10,
|
||||
|
@ -1351,16 +1413,23 @@ $data = html_print_input_text(
|
|||
// Autocomplete.
|
||||
'off'
|
||||
);
|
||||
$in = '<div class="filter_input">';
|
||||
$in .= '<div class="filter_input_little"><label>'.__('Date to').'</label>';
|
||||
$in .= $data.'</div>';
|
||||
|
||||
$data = '';
|
||||
$in .= $data.'</div>';
|
||||
$adv_inputs[] = $in;
|
||||
// Date and Time To.
|
||||
$adv_inputs[] = html_print_div(
|
||||
[
|
||||
'class' => 'filter_input',
|
||||
'content' => sprintf(
|
||||
'<label>%s</label>%s<span>:</span>%s',
|
||||
__('To (date:time)'),
|
||||
$inputDateTo,
|
||||
$inputTimeTo
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
// Tags.
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
$data = '<fieldset><legend class="pdd_0px">'.__('Events with following tags').'</legend>'.html_print_table($tabletags_with, true).'</fieldset>';
|
||||
$data .= '<fieldset><legend class="pdd_0px">'.__('Events without following tags').'</legend>'.html_print_table($tabletags_without, true).'</fieldset>';
|
||||
} else {
|
||||
|
|
|
@ -1,16 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Tree view.
|
||||
*
|
||||
* @category Operation
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 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-2021 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.
|
||||
// Begin.
|
||||
ui_require_css_file('tree');
|
||||
ui_require_css_file('fixed-bottom-box');
|
||||
|
||||
|
@ -35,11 +51,11 @@ if (enterprise_include_once('include/functions_policies.php') !== ENTERPRISE_NOT
|
|||
$enterpriseEnable = true;
|
||||
}
|
||||
|
||||
$url = 'index.php?'.'sec=estado&'.'sec2=operation/tree&'.'refr=0&'.'pure='.$pure.'&'.'tab=%s';
|
||||
$url = 'index.php?sec=estado&sec2=operation/tree&refr=0&pure='.$pure.'&tab=%s';
|
||||
|
||||
$tabs = [];
|
||||
|
||||
if (!$strict_acl) {
|
||||
if ($strict_acl === false) {
|
||||
$tabs['tag'] = [
|
||||
'text' => "<a href='".sprintf($url, 'tag')."'>".html_print_image(
|
||||
'images/tag.png',
|
||||
|
@ -221,7 +237,7 @@ $row[] = __('Show full hirearchy');
|
|||
$row[] = html_print_checkbox('serach_hirearchy', $serach_hirearchy, false, true);
|
||||
|
||||
$row[] = __('Agent status');
|
||||
$row[] = html_print_select($agent_status_arr, 'status_agent', $status_agent, '', '', 0, true);
|
||||
$row[] = html_print_select($agent_status_arr, 'status_agent', $status_agent, '', '', 0, true, false, true, '', false, 'width:10em');
|
||||
$row[] = html_print_input_hidden('show_not_init_modules_hidden', $show_not_init_modules, true);
|
||||
|
||||
// Button
|
||||
|
|
|
@ -445,30 +445,29 @@ if (check_acl($config['id_user'], 0, 'ER')) {
|
|||
|
||||
|
||||
$autorefresh_list_out = [];
|
||||
if (is_metaconsole()) {
|
||||
$autorefresh_list_out['monitoring/tactical'] = 'Tactical view';
|
||||
$autorefresh_list_out['monitoring/group_view'] = 'Group view';
|
||||
} else {
|
||||
$autorefresh_list_out['operation/agentes/tactical'] = 'Tactical view';
|
||||
$autorefresh_list_out['operation/agentes/group_view'] = 'Group view';
|
||||
if (is_metaconsole() === false || is_centrallised() === true) {
|
||||
$autorefresh_list_out['operation/agentes/estado_agente'] = 'Agent detail';
|
||||
$autorefresh_list_out['operation/agentes/alerts_status'] = 'Alert detail';
|
||||
$autorefresh_list_out['enterprise/operation/cluster/cluster'] = 'Cluster view';
|
||||
$autorefresh_list_out['operation/gis_maps/render_view'] = 'Gis Map';
|
||||
$autorefresh_list_out['operation/reporting/graph_viewer'] = 'Graph Viewer';
|
||||
$autorefresh_list_out['operation/snmpconsole/snmp_view'] = 'SNMP console';
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$autorefresh_list_out['general/sap_view'] = 'SAP view';
|
||||
}
|
||||
}
|
||||
|
||||
$autorefresh_list_out['operation/agentes/estado_agente'] = 'Agent detail';
|
||||
$autorefresh_list_out['operation/agentes/alerts_status'] = 'Alert detail';
|
||||
$autorefresh_list_out['operation/agentes/tactical'] = 'Tactical view';
|
||||
$autorefresh_list_out['operation/agentes/group_view'] = 'Group view';
|
||||
$autorefresh_list_out['operation/agentes/status_monitor'] = 'Monitor detail';
|
||||
$autorefresh_list_out['operation/operation/services/services'] = 'Services';
|
||||
$autorefresh_list_out['enterprise/operation/services/services'] = 'Services';
|
||||
$autorefresh_list_out['operation/dashboard/dashboard'] = 'Dashboard';
|
||||
$autorefresh_list_out['operation/reporting/graph_viewer'] = 'Graph Viewer';
|
||||
$autorefresh_list_out['operation/gis_maps/render_view'] = 'Gis Map';
|
||||
|
||||
$autorefresh_list_out['operation/snmpconsole/snmp_view'] = 'SNMP console';
|
||||
$autorefresh_list_out['operation/agentes/pandora_networkmap'] = 'Network map';
|
||||
$autorefresh_list_out['operation/visual_console/render_view'] = 'Visual console';
|
||||
$autorefresh_list_out['operation/events/events'] = 'Events';
|
||||
$autorefresh_list_out['enterprise/operation/cluster/cluster'] = 'Cluster view';
|
||||
if (enterprise_installed()) {
|
||||
$autorefresh_list_out['general/sap_view'] = 'SAP view';
|
||||
}
|
||||
|
||||
|
||||
if (!isset($autorefresh_list)) {
|
||||
$select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '".$config['id_user']."'");
|
||||
|
|
|
@ -266,6 +266,7 @@ if ($pure === false) {
|
|||
$class_cloud = 'color_cloud_min link-create-item';
|
||||
$class_nlink = 'network_link_min link-create-item';
|
||||
$class_odometer = 'odometer_min link-create-item';
|
||||
$class_basic_chart = 'basic_chart_min link-create-item';
|
||||
$class_delete = 'delete_item delete_min';
|
||||
$class_copy = 'copy_item';
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
|
@ -285,6 +286,7 @@ if ($pure === false) {
|
|||
$class_cloud = 'color_cloud_min_white link-create-item';
|
||||
$class_nlink = 'network_link_min_white link-create-item';
|
||||
$class_odometer = 'odometer_min_white link-create-item';
|
||||
$class_basic_chart = 'basic_chart_min_white link-create-item';
|
||||
$class_delete = 'delete_item_white delete_min_white';
|
||||
$class_copy = 'copy_item_white';
|
||||
}
|
||||
|
@ -304,6 +306,11 @@ if ($pure === false) {
|
|||
__('Module Graph'),
|
||||
$class_module_graph
|
||||
);
|
||||
visual_map_print_button_editor_refactor(
|
||||
'BASIC_CHART',
|
||||
__('Basic chart'),
|
||||
$class_basic_chart
|
||||
);
|
||||
visual_map_print_button_editor_refactor(
|
||||
'DONUT_GRAPH',
|
||||
__('Serialized pie graph'),
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.757
|
||||
%define release 210915
|
||||
%define release 211004
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.757
|
||||
%define release 210915
|
||||
%define release 211004
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.757
|
||||
%define release 210915
|
||||
%define release 211004
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -1562,12 +1562,14 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
|
|||
`total_time` TINYINT(1) DEFAULT '1',
|
||||
`time_failed` TINYINT(1) DEFAULT '1',
|
||||
`time_in_ok_status` TINYINT(1) DEFAULT '1',
|
||||
`time_in_warning_status` TINYINT(1) DEFAULT '0',
|
||||
`time_in_unknown_status` TINYINT(1) DEFAULT '1',
|
||||
`time_of_not_initialized_module` TINYINT(1) DEFAULT '1',
|
||||
`time_of_downtime` TINYINT(1) DEFAULT '1',
|
||||
`total_checks` TINYINT(1) DEFAULT '1',
|
||||
`checks_failed` TINYINT(1) DEFAULT '1',
|
||||
`checks_in_ok_status` TINYINT(1) DEFAULT '1',
|
||||
`checks_in_warning_status` TINYINT(1) DEFAULT '0',
|
||||
`unknown_checks` TINYINT(1) DEFAULT '1',
|
||||
`agent_max_value` TINYINT(1) DEFAULT '1',
|
||||
`agent_min_value` TINYINT(1) DEFAULT '1',
|
||||
|
@ -1580,6 +1582,9 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
|
|||
`pagebreak` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`graph_render` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`ipam_network_filter` int(10) UNSIGNED DEFAULT 0,
|
||||
`ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id_rc`),
|
||||
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
|
@ -3012,6 +3017,8 @@ CREATE TABLE IF NOT EXISTS `tevent_alert` (
|
|||
`group_by` enum ('','id_agente','id_agentmodule','id_alert_am','id_grupo') default '',
|
||||
`special_days` tinyint(1) default 0,
|
||||
`disable_event` tinyint(1) default 0,
|
||||
`id_template_conditions` int(10) unsigned NOT NULL default 0,
|
||||
`id_template_fields` int(10) unsigned NOT NULL default 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -3175,12 +3182,14 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
|
|||
`total_time` TINYINT(1) DEFAULT '1',
|
||||
`time_failed` TINYINT(1) DEFAULT '1',
|
||||
`time_in_ok_status` TINYINT(1) DEFAULT '1',
|
||||
`time_in_warning_status` TINYINT(1) DEFAULT '0',
|
||||
`time_in_unknown_status` TINYINT(1) DEFAULT '1',
|
||||
`time_of_not_initialized_module` TINYINT(1) DEFAULT '1',
|
||||
`time_of_downtime` TINYINT(1) DEFAULT '1',
|
||||
`total_checks` TINYINT(1) DEFAULT '1',
|
||||
`checks_failed` TINYINT(1) DEFAULT '1',
|
||||
`checks_in_ok_status` TINYINT(1) DEFAULT '1',
|
||||
`checks_in_warning_status` TINYINT(1) DEFAULT '0',
|
||||
`unknown_checks` TINYINT(1) DEFAULT '1',
|
||||
`agent_max_value` TINYINT(1) DEFAULT '1',
|
||||
`agent_min_value` TINYINT(1) DEFAULT '1',
|
||||
|
@ -3193,6 +3202,9 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
|
|||
`pagebreak` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`graph_render` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`ipam_network_filter` int(10) UNSIGNED DEFAULT 0,
|
||||
`ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id_rc`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__.'/../include/config.php';
|
||||
require_once __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
if (file_exists(__DIR__.'/../'.ENTERPRISE_DIR.'/load_enterprise.php') === true) {
|
||||
include_once __DIR__.'/../'.ENTERPRISE_DIR.'/load_enterprise.php';
|
||||
}
|
||||
|
||||
if (isset($_SERVER['argc']) === false) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
global $config;
|
||||
|
||||
use PandoraFMS\Agent;
|
||||
|
||||
$ids = \db_get_all_rows_filter('tagente', [], ['id_agente']);
|
||||
if ($ids === false) {
|
||||
echo "Unable to find agents\n";
|
||||
$ids = [];
|
||||
}
|
||||
|
||||
$policies = \db_get_all_rows_filter('tpolicies', [], 'id,name');
|
||||
$policies = array_reduce(
|
||||
$policies,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['name']] = $item['id'];
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
foreach ($ids as $a) {
|
||||
try {
|
||||
$agent = new Agent($a['id_agente']);
|
||||
if ($agent->hasRemoteCapabilities() === true) {
|
||||
$agent_policies = $agent->getConfPolicies();
|
||||
|
||||
$oldIds = [];
|
||||
$newIds = [];
|
||||
foreach ($agent_policies as $oldId => $name) {
|
||||
$oldIds[] = $oldId;
|
||||
$newIds[] = $policies[io_safe_input($name)];
|
||||
}
|
||||
|
||||
$res_update_con_policy = $agent->updatePolicyIds(
|
||||
$oldIds,
|
||||
$newIds
|
||||
);
|
||||
if ($res_update_con_policy === false) {
|
||||
echo 'Failed ['.$agent->name()."]\n";
|
||||
} else {
|
||||
echo 'Agent '.io_safe_output($agent->alias())." updated successfully\n";
|
||||
}
|
||||
} else {
|
||||
echo 'Agent '.io_safe_output($agent->alias())." skipped\n";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage()."\n";
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue