Merge remote-tracking branch 'origin/develop' into ent-7060-gestion-basica-de-configuracion-de-equipos-de-red
Conflicts: pandora_console/vendor/composer/autoload_classmap.php pandora_console/vendor/composer/autoload_static.php
This commit is contained in:
commit
31f329a833
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.757-210928
|
||||
Version: 7.0NG.757-211005
|
||||
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-210928"
|
||||
pandora_version="7.0NG.757-211005"
|
||||
|
||||
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 => '210928';
|
||||
use constant AGENT_BUILD => '211005';
|
||||
|
||||
# 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 210928
|
||||
%define release 211005
|
||||
|
||||
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 210928
|
||||
%define release 211005
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.757"
|
||||
PI_BUILD="210928"
|
||||
PI_BUILD="211005"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{210928}
|
||||
{211005}
|
||||
|
||||
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 210928")
|
||||
#define PANDORA_VERSION ("7.0NG.757 Build 211005")
|
||||
|
||||
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 210928))"
|
||||
VALUE "ProductVersion", "(7.0NG.757(Build 211005))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.757-210928
|
||||
Version: 7.0NG.757-211005
|
||||
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-210928"
|
||||
pandora_version="7.0NG.757-211005"
|
||||
|
||||
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 />';
|
||||
|
|
|
@ -10,6 +10,14 @@ ALTER TABLE `tevent_alert` ADD COLUMN `id_template_conditions` int(10) unsigned
|
|||
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';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tncm_template` (
|
||||
`id` serial,
|
||||
|
|
|
@ -898,6 +898,8 @@ 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;
|
||||
|
@ -1779,6 +1781,8 @@ 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;
|
||||
|
|
|
@ -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'];
|
||||
|
@ -679,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'];
|
||||
|
@ -843,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':
|
||||
|
@ -2361,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>';
|
||||
|
@ -2473,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');
|
||||
|
@ -4484,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':
|
||||
|
@ -4538,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':
|
||||
|
@ -4624,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':
|
||||
|
@ -4673,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':
|
||||
|
@ -5703,7 +5721,6 @@ function chooseType() {
|
|||
$("#row_summary").show();
|
||||
break;
|
||||
|
||||
case 'histogram_data':
|
||||
case 'module_histogram_graph':
|
||||
$("#row_description").show();
|
||||
$("#row_period").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'
|
||||
);
|
||||
|
@ -1902,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
|
||||
|
@ -1926,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
|
||||
|
@ -2192,7 +2206,6 @@ switch ($action) {
|
|||
break;
|
||||
|
||||
case 'module_histogram_graph':
|
||||
case 'histogram_data':
|
||||
case 'agent_configuration':
|
||||
case 'alert_report_agent':
|
||||
case 'alert_report_module':
|
||||
|
@ -2579,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
|
||||
|
@ -2603,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
|
||||
|
@ -2844,7 +2865,6 @@ switch ($action) {
|
|||
break;
|
||||
|
||||
case 'module_histogram_graph':
|
||||
case 'histogram_data':
|
||||
case 'agent_configuration':
|
||||
case 'alert_report_agent':
|
||||
case 'alert_report_module':
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 565 B |
Binary file not shown.
After Width: | Height: | Size: 563 B |
|
@ -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;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC210928';
|
||||
$build_version = 'PC211005';
|
||||
$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);
|
||||
|
|
|
@ -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 = [];
|
||||
|
|
|
@ -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'],
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -865,7 +865,6 @@ function reporting_make_reporting_data(
|
|||
);
|
||||
break;
|
||||
|
||||
case 'histogram_data':
|
||||
case 'module_histogram_graph':
|
||||
$report['contents'][] = reporting_module_histogram_graph(
|
||||
$report,
|
||||
|
@ -6717,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
|
||||
|
@ -6739,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))) {
|
||||
|
@ -6785,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.
|
||||
|
@ -7128,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;
|
||||
|
@ -7137,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;
|
||||
|
@ -7229,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 {
|
||||
|
@ -7241,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)
|
||||
|
@ -7326,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;
|
||||
|
@ -7335,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']
|
||||
|
@ -7545,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
|
||||
) {
|
||||
|
@ -7566,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
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -7719,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'];
|
||||
|
@ -9566,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'] = '';
|
||||
|
@ -13623,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);
|
||||
}
|
||||
|
|
|
@ -437,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') {
|
||||
|
@ -1539,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') {
|
||||
|
@ -3570,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) {
|
||||
|
@ -3604,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';
|
||||
|
@ -3619,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%';
|
||||
|
@ -3656,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';
|
||||
|
@ -3677,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';
|
||||
|
@ -3774,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']
|
||||
) {
|
||||
|
@ -3883,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 {
|
||||
|
|
|
@ -764,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'),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -189,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
|
@ -129,7 +129,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.757';
|
||||
$build = '210928';
|
||||
$build = '211005';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -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 210928
|
||||
%define release 211005
|
||||
|
||||
# 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 210928
|
||||
%define release 211005
|
||||
|
||||
# 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 210928
|
||||
%define release 211005
|
||||
%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',
|
||||
|
@ -3180,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',
|
||||
|
|
|
@ -115,10 +115,11 @@ return array(
|
|||
'Models\\VisualConsole\\Items\\Line' => $baseDir . '/include/rest-api/models/VisualConsole/Items/Line.php',
|
||||
'Models\\VisualConsole\\Items\\ModuleGraph' => $baseDir . '/include/rest-api/models/VisualConsole/Items/ModuleGraph.php',
|
||||
'Models\\VisualConsole\\Items\\NetworkLink' => $baseDir . '/include/rest-api/models/VisualConsole/Items/NetworkLink.php',
|
||||
'Models\\VisualConsole\\Items\\Odometer' => $baseDir . '/include/rest-api/models/VisualConsole/Items/Odometer.php',
|
||||
'Models\\VisualConsole\\Items\\Percentile' => $baseDir . '/include/rest-api/models/VisualConsole/Items/Percentile.php',
|
||||
'Models\\VisualConsole\\Items\\SimpleValue' => $baseDir . '/include/rest-api/models/VisualConsole/Items/SimpleValue.php',
|
||||
'Models\\VisualConsole\\Items\\StaticGraph' => $baseDir . '/include/rest-api/models/VisualConsole/Items/StaticGraph.php',
|
||||
'Models\\VisualConsole\\Items\\Odometer' => $baseDir . '/include/rest-api/models/VisualConsole/Items/Odometer.php',
|
||||
'Models\\VisualConsole\\Items\\BasicChart' => $baseDir . '/include/rest-api/models/VisualConsole/Items/BasicChart.php',
|
||||
'Models\\VisualConsole\\View' => $baseDir . '/include/rest-api/models/VisualConsole/View.php',
|
||||
'Mpdf\\Barcode' => $vendorDir . '/mpdf/mpdf/src/Barcode.php',
|
||||
'Mpdf\\Barcode\\AbstractBarcode' => $vendorDir . '/mpdf/mpdf/src/Barcode/AbstractBarcode.php',
|
||||
|
|
|
@ -189,10 +189,11 @@ class ComposerStaticInitfdecadadce22e6dde51e9535fe4ad7aa
|
|||
'Models\\VisualConsole\\Items\\Line' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/Line.php',
|
||||
'Models\\VisualConsole\\Items\\ModuleGraph' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/ModuleGraph.php',
|
||||
'Models\\VisualConsole\\Items\\NetworkLink' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/NetworkLink.php',
|
||||
'Models\\VisualConsole\\Items\\Odometer' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/Odometer.php',
|
||||
'Models\\VisualConsole\\Items\\Percentile' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/Percentile.php',
|
||||
'Models\\VisualConsole\\Items\\SimpleValue' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/SimpleValue.php',
|
||||
'Models\\VisualConsole\\Items\\StaticGraph' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/StaticGraph.php',
|
||||
'Models\\VisualConsole\\Items\\Odometer' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/Odometer.php',
|
||||
'Models\\VisualConsole\\Items\\BasicChart' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/BasicChart.php',
|
||||
'Models\\VisualConsole\\View' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/View.php',
|
||||
'Mpdf\\Barcode' => __DIR__ . '/..' . '/mpdf/mpdf/src/Barcode.php',
|
||||
'Mpdf\\Barcode\\AbstractBarcode' => __DIR__ . '/..' . '/mpdf/mpdf/src/Barcode/AbstractBarcode.php',
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.757-210928
|
||||
Version: 7.0NG.757-211005
|
||||
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-210928"
|
||||
pandora_version="7.0NG.757-211005"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -702,3 +702,15 @@ alertserver_threads 4
|
|||
# Generate an hourly warning event if alert execution is being delayed more than alertserver_warn seconds.
|
||||
alertserver_warn 180
|
||||
|
||||
# Pandora FMS HA MySQL cluster splitbrain auto-recovery (PANDORA FMS ENTERPRISE ONLY)
|
||||
# IMPORTANT! Please understand and configure all settings from pandora_console/index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster&tab=setup
|
||||
# before enable this feature.
|
||||
#splitbrain_autofix 0
|
||||
|
||||
# Pandora FMS HA MySQL cluster splitbrain auto-recovery settings (PANDORA FMS ENTERPRISE ONLY)
|
||||
# Maximum number of retries
|
||||
#ha_max_splitbrain_retries 2
|
||||
# Maximum number of retries to verify resync status.
|
||||
#ha_max_resync_wait_retries 3
|
||||
# Maximum number of seconds waiting while verifying resync status.
|
||||
#ha_resync_sleep 10
|
||||
|
|
|
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.757";
|
||||
my $pandora_build = "210928";
|
||||
my $pandora_build = "211005";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -1289,6 +1289,18 @@ sub pandora_load_config {
|
|||
elsif ($parametro =~ m/^pandora_service_cmd\s(.*)/i) {
|
||||
$pa_config->{'pandora_service_cmd'} = clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^splitbrain_autofix\s+([0-9]*)/i) {
|
||||
$pa_config->{'splitbrain_autofix'} = clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^ha_max_resync_wait_retries\s+([0-9]*)/i) {
|
||||
$pa_config->{'ha_max_resync_wait_retries'} = clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^ha_resync_sleep\s+([0-9]*)/i) {
|
||||
$pa_config->{'ha_resync_sleep'} = clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^ha_max_splitbrain_retries\s+([0-9]*)/i) {
|
||||
$pa_config->{'ha_max_splitbrain_retries'} = clean_blank($1);
|
||||
}
|
||||
|
||||
} # end of loop for parameter #
|
||||
|
||||
|
|
|
@ -241,6 +241,9 @@ our @EXPORT = qw(
|
|||
pandora_update_agent_alert_count
|
||||
pandora_update_agent_module_count
|
||||
pandora_update_config_token
|
||||
pandora_update_agent_custom_field
|
||||
pandora_select_id_custom_field
|
||||
pandora_select_combo_custom_field
|
||||
pandora_update_gis_data
|
||||
pandora_update_module_on_error
|
||||
pandora_update_module_from_hash
|
||||
|
@ -3413,6 +3416,41 @@ sub pandora_update_config_token ($$$) {
|
|||
return $result;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
## Select custom field id by name tagent_custom_field
|
||||
##########################################################################
|
||||
sub pandora_select_id_custom_field ($$) {
|
||||
my ($dbh, $field) = @_;
|
||||
my $result = undef;
|
||||
|
||||
$result = get_db_single_row ($dbh, 'SELECT id_field FROM tagent_custom_fields WHERE name = ? ', safe_input($field));
|
||||
|
||||
return $result->{'id_field'};
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
## Select custom field id by name tagent_custom_field
|
||||
##########################################################################
|
||||
sub pandora_select_combo_custom_field ($$) {
|
||||
my ($dbh, $field) = @_;
|
||||
my $result = undef;
|
||||
|
||||
$result = get_db_single_row ($dbh, 'SELECT combo_values FROM tagent_custom_fields WHERE id_field = ? ', $field);
|
||||
|
||||
return $result->{'combo_values'};
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
## Update a custom field from agent of tagent_custom_data
|
||||
##########################################################################
|
||||
sub pandora_update_agent_custom_field ($$$$) {
|
||||
my ($dbh, $token, $field, $id_agent) = @_;
|
||||
my $result = undef;
|
||||
$result = db_update ($dbh, 'UPDATE tagent_custom_data SET description = ? WHERE id_field = ? AND id_agent = ?', safe_input($token), $field, $id_agent);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
## Get value of a token of tconfig table
|
||||
##########################################################################
|
||||
|
|
|
@ -434,6 +434,9 @@ sub process_xml_data ($$$$$) {
|
|||
|
||||
}
|
||||
|
||||
# Return if metaconsole, no further analysis.
|
||||
return if (PandoraFMS::Tools::is_metaconsole($pa_config));
|
||||
|
||||
# Get the data of the agent, if fail return
|
||||
my $agent = get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE id_agente = ?', $agent_id);
|
||||
if (!defined ($agent)) {
|
||||
|
|
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.757";
|
||||
my $pandora_build = "210928";
|
||||
my $pandora_build = "211005";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.757
|
||||
%define release 210928
|
||||
%define release 211005
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.757
|
||||
%define release 210928
|
||||
%define release 211005
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.757"
|
||||
PI_BUILD="210928"
|
||||
PI_BUILD="211005"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.757 Build 210928";
|
||||
my $version = "7.0NG.757 Build 211005";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -49,11 +49,14 @@ my $Running = 0;
|
|||
########################################################################
|
||||
# Print the given message with a preceding timestamp.
|
||||
########################################################################
|
||||
sub log_message($$$) {
|
||||
my ($conf, $source, $message) = @_;
|
||||
sub log_message($$$;$) {
|
||||
my ($conf, $source, $message, $verbosity_level) = @_;
|
||||
|
||||
my $level = $verbosity_level;
|
||||
$level = 5 unless defined($level);
|
||||
|
||||
if (ref($conf) eq "HASH") {
|
||||
logger($conf, 'HA (' . $source . ') ' . "$message", 5);
|
||||
logger($conf, 'HA (' . $source . ') ' . "$message", $level);
|
||||
}
|
||||
|
||||
if ($source eq '') {
|
||||
|
@ -403,19 +406,6 @@ END {
|
|||
stop();
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Aux. get module id
|
||||
###############################################################################
|
||||
my %module_id;
|
||||
sub __get_module_id {
|
||||
my ($dbh, $module_type) = @_;
|
||||
|
||||
if (!defined($module_id{$module_type})) {
|
||||
$module_id{$module_type} = get_module_id($dbh, $module_type);
|
||||
}
|
||||
|
||||
return $module_id{$module_type}
|
||||
}
|
||||
|
||||
$SIG{INT} = \&stop;
|
||||
$SIG{TERM} = \&stop;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.757 Build 210928";
|
||||
my $version = "7.0NG.757 Build 211005";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
@ -142,6 +142,8 @@ sub help_screen{
|
|||
help_screen_line('--get_cluster_status', '<id_cluster>', 'Getting cluster status');
|
||||
help_screen_line('--set_disabled_and_standby', '<id_agent> <id_node> <value>', 'Overwrite and disable and standby status');
|
||||
help_screen_line('--reset_agent_counts', '<id_agent>', 'Resets module counts and alert counts in the agents');
|
||||
help_screen_line('--update_agent_custom_fields', '<id_agent> <type_field> <field_to_change> <new_value>', "Update an agent custom field. The fields can be \n\t the following: Serial number, Department ... and types can be 0 text and 1 combo ");
|
||||
|
||||
print "\nMODULES:\n\n" unless $param ne '';
|
||||
help_screen_line('--create_data_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <definition_file> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout> <warning_inverse> <critical_inverse>\n\t <critical_instructions> <warning_instructions> <unknown_instructions> <use_alias>]", 'Add data server module to agent');
|
||||
help_screen_line('--create_web_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <retries> <requests> <agent_browser_id> <auth_server> <auth_realm> <definition_file>\n\t <proxy_url> <proxy_auth_login> <proxy_auth_password> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout> <warning_inverse> <critical_inverse>\n\t <critical_instructions> <warning_instructions> <unknown_instructions> <use_alias>].\n\t The valid data types are web_data, web_proc, web_content_data or web_content_string", 'Add web server module to agent');
|
||||
|
@ -3042,6 +3044,64 @@ sub cli_user_update() {
|
|||
pandora_update_user_from_hash ($update, 'id_user', safe_input($user_id), $dbh);
|
||||
}
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Update an agent customs field.
|
||||
# Related option: --update_agent_custom_fields
|
||||
##############################################################################
|
||||
|
||||
sub cli_agent_update_custom_fields() {
|
||||
my ($id_agent,$type,$field,$new_value) = @ARGV[2..5];
|
||||
|
||||
my $agent_name = get_agent_name($dbh, $id_agent);
|
||||
|
||||
my $id_field;
|
||||
|
||||
my $found = 0;
|
||||
|
||||
if($agent_name eq '') {
|
||||
print_log "[ERROR] Agent '$id_agent' doesnt exist\n\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
# Department, Serial number ...
|
||||
my $custom_field = pandora_select_id_custom_field ($dbh, $field);
|
||||
|
||||
|
||||
if($custom_field eq '') {
|
||||
print_log "[ERROR] Field '$field' doesnt exist\n\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if($type == 1) {
|
||||
my $exist_option = pandora_select_combo_custom_field ($dbh, $custom_field);
|
||||
|
||||
my @fields = split(',',$exist_option);
|
||||
foreach my $combo (@fields) {
|
||||
if($combo eq safe_input($new_value)) {
|
||||
$found = 1;
|
||||
}
|
||||
}
|
||||
if($found == 0) {
|
||||
print_log "\n[ERROR] Field '$new_value' doesn't match with combo option values\n\n";
|
||||
exit
|
||||
}
|
||||
}
|
||||
|
||||
print_log "\n[INFO] Updating field '$field' in agent with ID '$id_agent'\n\n";
|
||||
|
||||
my $result = pandora_update_agent_custom_field ($dbh, $new_value, $custom_field, $id_agent);
|
||||
|
||||
if($result == "0E0"){
|
||||
print_log "[ERROR] Error updating field '$field'\n\n";
|
||||
} else {
|
||||
print_log "[INFO] Field '$field' updated succesfully!\n\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Update an agent field.
|
||||
# Related option: --update_agent
|
||||
|
@ -7866,6 +7926,9 @@ sub pandora_manage_main ($$$) {
|
|||
}elsif ($param eq '--event_in_progress') {
|
||||
param_check($ltotal, 1, 0);
|
||||
cli_event_in_progress();
|
||||
} elsif ($param eq '--agent_update_custom_fields') {
|
||||
param_check($ltotal, 4, 5);
|
||||
cli_agent_update_custom_fields();
|
||||
}
|
||||
else {
|
||||
print_log "[ERROR] Invalid option '$param'.\n\n";
|
||||
|
|
|
@ -48,7 +48,8 @@ export const enum ItemType {
|
|||
CLOCK = 19,
|
||||
COLOR_CLOUD = 20,
|
||||
NETWORK_LINK = 21,
|
||||
ODOMETER = 22
|
||||
ODOMETER = 22,
|
||||
BASIC_CHART = 23
|
||||
}
|
||||
|
||||
// Base item properties. This interface should be extended by the item implementations.
|
||||
|
@ -220,6 +221,9 @@ export function titleItem(id: number): string {
|
|||
case ItemType.ODOMETER:
|
||||
title = t("Odometer");
|
||||
break;
|
||||
case ItemType.BASIC_CHART:
|
||||
title = t("Basic chart");
|
||||
break;
|
||||
default:
|
||||
title = t("Item");
|
||||
break;
|
||||
|
|
|
@ -38,6 +38,7 @@ import BarsGraph, { barsGraphPropsDecoder } from "./items/BarsGraph";
|
|||
import ModuleGraph, { moduleGraphPropsDecoder } from "./items/ModuleGraph";
|
||||
import Service, { servicePropsDecoder } from "./items/Service";
|
||||
import Odometer, { odometerPropsDecoder } from "./items/Odometer";
|
||||
import BasicChart, { basicChartPropsDecoder } from "./items/BasicChart";
|
||||
|
||||
// TODO: Document.
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
|
@ -88,6 +89,8 @@ function itemInstanceFrom(data: AnyObject) {
|
|||
return new NetworkLink(networkLinkPropsDecoder(data), meta);
|
||||
case ItemType.ODOMETER:
|
||||
return new Odometer(odometerPropsDecoder(data), meta);
|
||||
case ItemType.BASIC_CHART:
|
||||
return new BasicChart(basicChartPropsDecoder(data), meta);
|
||||
default:
|
||||
throw new TypeError("item not found");
|
||||
}
|
||||
|
@ -140,6 +143,8 @@ function decodeProps(data: AnyObject) {
|
|||
return networkLinkPropsDecoder(data);
|
||||
case ItemType.ODOMETER:
|
||||
return odometerPropsDecoder(data);
|
||||
case ItemType.BASIC_CHART:
|
||||
return basicChartPropsDecoder(data);
|
||||
default:
|
||||
throw new TypeError("decoder not found");
|
||||
}
|
||||
|
@ -1287,7 +1292,8 @@ export default class VisualConsole {
|
|||
[ItemType.CLOCK]: Clock,
|
||||
[ItemType.COLOR_CLOUD]: ColorCloud,
|
||||
[ItemType.NETWORK_LINK]: NetworkLink,
|
||||
[ItemType.ODOMETER]: Odometer
|
||||
[ItemType.ODOMETER]: Odometer,
|
||||
[ItemType.BASIC_CHART]: BasicChart
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1343,6 +1349,9 @@ export default class VisualConsole {
|
|||
case ItemType.ODOMETER:
|
||||
text = t("Odometer");
|
||||
break;
|
||||
case ItemType.BASIC_CHART:
|
||||
text = t("BasicChart");
|
||||
break;
|
||||
default:
|
||||
text = t("Item");
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,222 @@
|
|||
import {
|
||||
LinkedVisualConsoleProps,
|
||||
AnyObject,
|
||||
WithModuleProps
|
||||
} from "../lib/types";
|
||||
import {
|
||||
linkedVCPropsDecoder,
|
||||
modulePropsDecoder,
|
||||
decodeBase64,
|
||||
stringIsEmpty,
|
||||
parseIntOr
|
||||
} from "../lib";
|
||||
import Item, { ItemType, ItemProps, itemBasePropsDecoder } from "../Item";
|
||||
|
||||
export type BasicChartProps = {
|
||||
type: ItemType.BASIC_CHART;
|
||||
html: string;
|
||||
period: number | null;
|
||||
value: number | null;
|
||||
status: string;
|
||||
moduleNameColor: string;
|
||||
} & ItemProps &
|
||||
WithModuleProps &
|
||||
LinkedVisualConsoleProps;
|
||||
|
||||
/**
|
||||
* Build a valid typed object from a raw object.
|
||||
* This will allow us to ensure the type safety.
|
||||
*
|
||||
* @param data Raw object.
|
||||
* @return An object representing the basic chart props.
|
||||
* @throws Will throw a TypeError if some property
|
||||
* is missing from the raw object or have an invalid type.
|
||||
*/
|
||||
export function basicChartPropsDecoder(
|
||||
data: AnyObject
|
||||
): BasicChartProps | never {
|
||||
if (stringIsEmpty(data.html) && stringIsEmpty(data.encodedHtml)) {
|
||||
throw new TypeError("missing html content.");
|
||||
}
|
||||
|
||||
return {
|
||||
...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.
|
||||
type: ItemType.BASIC_CHART,
|
||||
html: !stringIsEmpty(data.html)
|
||||
? data.html
|
||||
: decodeBase64(data.encodedHtml),
|
||||
period: parseIntOr(data.period, null),
|
||||
value: parseFloat(data.value),
|
||||
status: stringIsEmpty(data.status) ? "#B2B2B2" : data.status,
|
||||
moduleNameColor: stringIsEmpty(data.moduleNameColor)
|
||||
? "#3f3f3f"
|
||||
: data.moduleNameColor,
|
||||
...modulePropsDecoder(data), // Object spread. It will merge the properties of the two objects.
|
||||
...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.
|
||||
};
|
||||
}
|
||||
|
||||
export default class BasicChart extends Item<BasicChartProps> {
|
||||
protected createDomElement(): HTMLElement {
|
||||
const element = document.createElement("div");
|
||||
|
||||
const header = document.createElement("div");
|
||||
header.className = "basic-chart-header";
|
||||
|
||||
const moduleName = document.createElement("h2");
|
||||
moduleName.className = "basic-chart-header-name";
|
||||
moduleName.textContent = this.props.moduleName;
|
||||
moduleName.style.color = `${this.props.moduleNameColor}`;
|
||||
header.appendChild(moduleName);
|
||||
|
||||
let value = "";
|
||||
if (this.props.value !== null) {
|
||||
value = this.number_format(this.props.value, false, "", 2, 1000);
|
||||
}
|
||||
|
||||
const moduleValue = document.createElement("h2");
|
||||
moduleValue.className = "basic-chart-header-value";
|
||||
moduleValue.textContent = `${value}`;
|
||||
moduleValue.style.color = this.props.status;
|
||||
header.appendChild(moduleValue);
|
||||
|
||||
element.innerHTML = this.props.html;
|
||||
element.className = "basic-chart";
|
||||
if (
|
||||
this.props.agentDisabled === true ||
|
||||
this.props.moduleDisabled === true
|
||||
) {
|
||||
element.style.opacity = "0.2";
|
||||
}
|
||||
|
||||
// Remove the overview graph.
|
||||
const legendP = element.getElementsByTagName("p");
|
||||
for (let i = 0; i < legendP.length; i++) {
|
||||
legendP[i].style.margin = "0px";
|
||||
}
|
||||
|
||||
// Remove the overview graph.
|
||||
const overviewGraphs = element.getElementsByClassName("overview_graph");
|
||||
for (let i = 0; i < overviewGraphs.length; i++) {
|
||||
overviewGraphs[i].remove();
|
||||
}
|
||||
|
||||
// Hack to execute the JS after the HTML is added to the DOM.
|
||||
const scripts = element.getElementsByTagName("script");
|
||||
for (let i = 0; i < scripts.length; i++) {
|
||||
if (scripts[i].src.length === 0) {
|
||||
setTimeout(() => {
|
||||
try {
|
||||
eval(scripts[i].innerHTML.trim());
|
||||
} catch (ignored) {} // eslint-disable-line no-empty
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
element.innerHTML = this.props.html;
|
||||
element.insertBefore(header, element.firstChild);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
protected updateDomElement(element: HTMLElement): void {
|
||||
const header = document.createElement("div");
|
||||
header.className = "basic-chart-header";
|
||||
|
||||
const moduleName = document.createElement("h2");
|
||||
moduleName.className = "basic-chart-header-name";
|
||||
moduleName.textContent = this.props.moduleName;
|
||||
moduleName.style.color = `${this.props.moduleNameColor}`;
|
||||
header.appendChild(moduleName);
|
||||
|
||||
let value = "";
|
||||
if (this.props.value !== null) {
|
||||
value = this.number_format(this.props.value, false, "", 2, 1000);
|
||||
}
|
||||
|
||||
const moduleValue = document.createElement("h2");
|
||||
moduleValue.className = "basic-chart-header-value";
|
||||
moduleValue.textContent = `${value}`;
|
||||
moduleValue.style.color = this.props.status;
|
||||
header.appendChild(moduleValue);
|
||||
|
||||
element.innerHTML = this.props.html;
|
||||
element.insertBefore(header, element.firstChild);
|
||||
|
||||
// Remove the overview graph.
|
||||
const legendP = element.getElementsByTagName("p");
|
||||
for (let i = 0; i < legendP.length; i++) {
|
||||
legendP[i].style.margin = "0px";
|
||||
}
|
||||
|
||||
// Remove the overview graph.
|
||||
const overviewGraphs = element.getElementsByClassName("overview_graph");
|
||||
for (let i = 0; i < overviewGraphs.length; i++) {
|
||||
overviewGraphs[i].remove();
|
||||
}
|
||||
|
||||
// Hack to execute the JS after the HTML is added to the DOM.
|
||||
const scripts = element.getElementsByTagName("script");
|
||||
for (let i = 0; i < scripts.length; i++) {
|
||||
if (scripts[i].src.length === 0) {
|
||||
eval(scripts[i].innerHTML.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected number_format(
|
||||
number: number,
|
||||
force_integer: boolean,
|
||||
unit: string,
|
||||
short_data: number,
|
||||
divisor: number
|
||||
) {
|
||||
divisor = typeof divisor !== "undefined" ? divisor : 1000;
|
||||
var decimals = 2;
|
||||
|
||||
// Set maximum decimal precision to 99 in case short_data is not set.
|
||||
if (!short_data) {
|
||||
short_data = 99;
|
||||
}
|
||||
|
||||
if (force_integer) {
|
||||
if (Math.round(number) != number) {
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
short_data++;
|
||||
const aux_decimals = this.pad("1", short_data, 0);
|
||||
number =
|
||||
Math.round(number * Number.parseInt(aux_decimals)) /
|
||||
Number.parseInt(aux_decimals);
|
||||
}
|
||||
|
||||
var shorts = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"];
|
||||
var pos = 0;
|
||||
|
||||
while (Math.abs(number) >= divisor) {
|
||||
// As long as the number can be divided by 1000 or 1024.
|
||||
pos++;
|
||||
number = number / divisor;
|
||||
}
|
||||
|
||||
if (divisor) {
|
||||
number = Math.round(number * decimals) / decimals;
|
||||
} else {
|
||||
number = Math.round(number * decimals);
|
||||
}
|
||||
|
||||
if (isNaN(number)) {
|
||||
number = 0;
|
||||
}
|
||||
|
||||
return number + " " + shorts[pos] + unit;
|
||||
}
|
||||
|
||||
protected pad(input: string, length: number, padding: number): string {
|
||||
var str = input + "";
|
||||
return length <= str.length
|
||||
? str
|
||||
: this.pad(str + padding, length, padding);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue