Merge remote-tracking branch 'origin/develop' into ent-4205-gigas-proyectos-funcionamiento-incorrecto-del-wizard-snmp-con-exec-server
Conflicts: pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php
This commit is contained in:
commit
6b6d852ceb
|
@ -10,4 +10,6 @@ ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEF
|
|||
|
||||
ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover') DEFAULT 'direct';
|
||||
|
||||
ALTER TABLE `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
|
||||
|
||||
COMMIT;
|
|
@ -724,7 +724,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
|
|||
`type` varchar(30) default 'simple_graph',
|
||||
`period` int(11) NOT NULL default 0,
|
||||
`order` int (11) NOT NULL default 0,
|
||||
`description` mediumtext,
|
||||
`description` mediumtext,
|
||||
`text_agent` text,
|
||||
`text` TEXT,
|
||||
`external_source` Text,
|
||||
|
@ -1446,6 +1446,7 @@ ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1
|
|||
ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
|
||||
ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
|
||||
ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
|
||||
ALTER table `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmodule_relationship`
|
||||
|
|
|
@ -77,6 +77,7 @@ if (is_ajax()) {
|
|||
}
|
||||
|
||||
$get_modules_json_for_multiple_snmp = (bool) get_parameter('get_modules_json_for_multiple_snmp', 0);
|
||||
$get_common_modules = (bool) get_parameter('get_common_modules', 1);
|
||||
if ($get_modules_json_for_multiple_snmp) {
|
||||
include_once 'include/graphs/functions_utils.php';
|
||||
|
||||
|
@ -100,7 +101,16 @@ if (is_ajax()) {
|
|||
if ($out === false) {
|
||||
$out = $oid_snmp;
|
||||
} else {
|
||||
$out = array_intersect($out, $oid_snmp);
|
||||
$commons = array_intersect($out, $oid_snmp);
|
||||
if ($get_common_modules) {
|
||||
// Common modules is selected (default)
|
||||
$out = $commons;
|
||||
} else {
|
||||
// All modules is selected
|
||||
$array1 = array_diff($out, $oid_snmp);
|
||||
$array2 = array_diff($oid_snmp, $out);
|
||||
$out = array_merge($commons, $array1, $array2);
|
||||
}
|
||||
}
|
||||
|
||||
$oid_snmp = [];
|
||||
|
|
|
@ -608,7 +608,24 @@ if (!empty($interfaces_list)) {
|
|||
$table->data[0][2] = '<b>'.__('Modules').'</b>';
|
||||
|
||||
$table->data[1][0] = html_print_select($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;');
|
||||
$table->data[1][1] = html_print_image('images/darrowright.png', true);
|
||||
|
||||
$table->data[1][1] = __('When selecting interfaces');
|
||||
$table->data[1][1] .= '<br>';
|
||||
$table->data[1][1] .= html_print_select(
|
||||
[
|
||||
1 => __('Show common modules'),
|
||||
0 => __('Show all modules'),
|
||||
],
|
||||
'modules_selection_mode',
|
||||
1,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
$table->data[1][2] = html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
|
||||
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
|
||||
|
||||
|
@ -655,10 +672,17 @@ $(document).ready (function () {
|
|||
$("#no_snmp").hide ();
|
||||
$("#form_interfaces").hide ();
|
||||
});
|
||||
|
||||
// When select interfaces changes
|
||||
$("#modules_selection_mode").change (function() {
|
||||
$("#id_snmp").trigger('change');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
||||
var idSNMP = Array();
|
||||
var get_common_modules = $("#modules_selection_mode option:selected").val();
|
||||
|
||||
jQuery.each ($("#id_snmp option:selected"), function (i, val) {
|
||||
idSNMP.push($(val).val());
|
||||
|
@ -670,6 +694,7 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
|||
jQuery.post ('ajax.php',
|
||||
{"page" : "godmode/agentes/agent_manager",
|
||||
"get_modules_json_for_multiple_snmp": 1,
|
||||
"get_common_modules" : get_common_modules,
|
||||
"id_snmp[]": idSNMP,
|
||||
"id_snmp_serialize": $("#hidden-id_snmp_serialize").val()
|
||||
},
|
||||
|
|
|
@ -868,7 +868,18 @@ $class = 'databox filters';
|
|||
</td>
|
||||
<td style="">
|
||||
<?php
|
||||
html_print_input_text('name', $name, '', 80, 100);
|
||||
html_print_input_text(
|
||||
'name',
|
||||
$name,
|
||||
'',
|
||||
80,
|
||||
100,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'fullwidth'
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -926,7 +937,18 @@ $class = 'databox filters';
|
|||
</td>
|
||||
<td style="">
|
||||
<?php
|
||||
echo html_print_input_text('label', $label, '', 50, 255, true);
|
||||
echo html_print_input_text(
|
||||
'label',
|
||||
$label,
|
||||
'',
|
||||
50,
|
||||
255,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'fullwidth'
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -1344,6 +1344,16 @@ switch ($action) {
|
|||
switch ($action) {
|
||||
case 'update':
|
||||
$values = [];
|
||||
$server_name = get_parameter('server_id');
|
||||
if (is_metaconsole() && $server_name != '') {
|
||||
$id_meta = metaconsole_get_id_server($server_name);
|
||||
$connection = metaconsole_get_connection_by_id(
|
||||
$id_meta
|
||||
);
|
||||
metaconsole_connect($connection);
|
||||
$values['server_name'] = $connection['server_name'];
|
||||
}
|
||||
|
||||
$values['id_report'] = $idReport;
|
||||
$values['description'] = get_parameter('description');
|
||||
$values['type'] = get_parameter('type', null);
|
||||
|
@ -1352,14 +1362,36 @@ switch ($action) {
|
|||
|
||||
$label = get_parameter('label', '');
|
||||
|
||||
$id_agent = get_parameter('id_agent');
|
||||
$id_agent_module = get_parameter('id_agent_module');
|
||||
|
||||
// Add macros name.
|
||||
$items_label = [];
|
||||
$items_label['type'] = get_parameter('type');
|
||||
$items_label['id_agent'] = get_parameter('id_agent');
|
||||
$items_label['id_agent_module'] = get_parameter(
|
||||
'id_agent_module'
|
||||
);
|
||||
$name_it = (string) get_parameter('name');
|
||||
|
||||
$agent_description = agents_get_description($id_agent);
|
||||
$agent_group = agents_get_agent_group($id_agent);
|
||||
$agent_address = agents_get_address($id_agent);
|
||||
$agent_alias = agents_get_alias($id_agent);
|
||||
$module_name = modules_get_agentmodule_name(
|
||||
$id_agent_module
|
||||
);
|
||||
|
||||
$module_description = modules_get_agentmodule_descripcion(
|
||||
$id_agent_module
|
||||
);
|
||||
|
||||
$items_label = [
|
||||
'type' => get_parameter('type'),
|
||||
'id_agent' => $id_agent,
|
||||
'id_agent_module' => $id_agent_module,
|
||||
'agent_description' => $agent_description,
|
||||
'agent_group' => $agent_group,
|
||||
'agent_address' => $agent_address,
|
||||
'agent_alias' => $agent_alias,
|
||||
'module_name' => $module_name,
|
||||
'module_description' => $module_description,
|
||||
];
|
||||
|
||||
$values['name'] = reporting_label_macro(
|
||||
$items_label,
|
||||
$name_it
|
||||
|
@ -1715,13 +1747,6 @@ switch ($action) {
|
|||
);
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$values['server_name'] = get_parameter('server_name');
|
||||
$server_id = (int) get_parameter('server_id');
|
||||
if ($server_id != 0) {
|
||||
$connection = metaconsole_get_connection_by_id(
|
||||
$server_id
|
||||
);
|
||||
$values['server_name'] = $connection['server_name'];
|
||||
}
|
||||
|
||||
if ($values['server_name'] == '') {
|
||||
$values['server_name'] = get_parameter(
|
||||
|
@ -1978,22 +2003,11 @@ switch ($action) {
|
|||
|
||||
$values['style'] = io_safe_input(json_encode($style));
|
||||
|
||||
if (is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
if ($good_format) {
|
||||
switch ($config['dbtype']) {
|
||||
case 'oracle':
|
||||
if (isset($values['type'])) {
|
||||
$values[db_escape_key_identifier(
|
||||
'type'
|
||||
)] = $values['type'];
|
||||
unset($values['type']);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
$resultOperationDB = db_process_sql_update(
|
||||
'treport_content',
|
||||
$values,
|
||||
|
@ -2006,21 +2020,62 @@ switch ($action) {
|
|||
|
||||
case 'save':
|
||||
$values = [];
|
||||
|
||||
$values['server_name'] = get_parameter('server_name');
|
||||
$server_id = (int) get_parameter('server_id');
|
||||
if ($server_id != 0) {
|
||||
$connection = metaconsole_get_connection_by_id(
|
||||
$server_id
|
||||
);
|
||||
metaconsole_connect($connection);
|
||||
$values['server_name'] = $connection['server_name'];
|
||||
}
|
||||
|
||||
$values['id_report'] = $idReport;
|
||||
$values['type'] = get_parameter('type', null);
|
||||
$values['description'] = get_parameter('description');
|
||||
$label = get_parameter('label', '');
|
||||
|
||||
// Add macros name.
|
||||
$items_label = [];
|
||||
$items_label['type'] = get_parameter('type');
|
||||
$items_label['id_agent'] = get_parameter('id_agent');
|
||||
$items_label['id_agent_module'] = get_parameter(
|
||||
'id_agent_module'
|
||||
);
|
||||
$name_it = (string) get_parameter('name');
|
||||
$values['recursion'] = get_parameter('recursion', null);
|
||||
$values['show_extended_events'] = get_parameter('include_extended_events', null);
|
||||
$values['show_extended_events'] = get_parameter(
|
||||
'include_extended_events',
|
||||
null
|
||||
);
|
||||
|
||||
$id_agent = get_parameter('id_agent');
|
||||
$id_agent_module = get_parameter('id_agent_module');
|
||||
|
||||
// Add macros name.
|
||||
$name_it = (string) get_parameter('name');
|
||||
|
||||
$agent_description = agents_get_description($id_agent);
|
||||
$agent_group = agents_get_agent_group($id_agent);
|
||||
$agent_address = agents_get_address($id_agent);
|
||||
$agent_alias = agents_get_alias($id_agent);
|
||||
$module_name = modules_get_agentmodule_name(
|
||||
$id_agent_module
|
||||
);
|
||||
|
||||
$module_description = modules_get_agentmodule_descripcion(
|
||||
$id_agent_module
|
||||
);
|
||||
|
||||
if (is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$items_label = [
|
||||
'type' => get_parameter('type'),
|
||||
'id_agent' => $id_agent,
|
||||
'id_agent_module' => $id_agent_module,
|
||||
'agent_description' => $agent_description,
|
||||
'agent_group' => $agent_group,
|
||||
'agent_address' => $agent_address,
|
||||
'agent_alias' => $agent_alias,
|
||||
'module_name' => $module_name,
|
||||
'module_description' => $module_description,
|
||||
];
|
||||
|
||||
$values['name'] = reporting_label_macro(
|
||||
$items_label,
|
||||
$name_it
|
||||
|
@ -2225,18 +2280,6 @@ switch ($action) {
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$values['server_name'] = get_parameter('server_name');
|
||||
$server_id = (int) get_parameter('server_id');
|
||||
if ($server_id != 0) {
|
||||
$connection = metaconsole_get_connection_by_id(
|
||||
$server_id
|
||||
);
|
||||
|
||||
$values['server_name'] = $connection['server_name'];
|
||||
}
|
||||
|
||||
if ($values['server_name'] == '') {
|
||||
$values['server_name'] = get_parameter(
|
||||
'combo_server'
|
||||
|
|
|
@ -1513,29 +1513,30 @@ function agents_get_name($id_agent, $case='none')
|
|||
* Get alias of an agent (cached function).
|
||||
*
|
||||
* @param integer $id_agent Agent id.
|
||||
* @param string $case Case (upper, lower, none)
|
||||
* @param string $case Case (upper, lower, none).
|
||||
*
|
||||
* @return string Alias of the given agent.
|
||||
*/
|
||||
function agents_get_alias($id_agent, $case='none')
|
||||
{
|
||||
global $config;
|
||||
// Prepare cache
|
||||
// Prepare cache.
|
||||
static $cache = [];
|
||||
if (empty($case)) {
|
||||
$case = 'none';
|
||||
}
|
||||
|
||||
// Check cache
|
||||
// Check cache.
|
||||
if (isset($cache[$case][$id_agent])) {
|
||||
return $cache[$case][$id_agent];
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$alias = (string) db_get_value('alias', 'tmetaconsole_agent', 'id_tagente', (int) $id_agent);
|
||||
} else {
|
||||
$alias = (string) db_get_value('alias', 'tagente', 'id_agente', (int) $id_agent);
|
||||
}
|
||||
$alias = (string) db_get_value(
|
||||
'alias',
|
||||
'tagente',
|
||||
'id_agente',
|
||||
(int) $id_agent
|
||||
);
|
||||
|
||||
switch ($case) {
|
||||
case 'upper':
|
||||
|
@ -1545,6 +1546,10 @@ function agents_get_alias($id_agent, $case='none')
|
|||
case 'lower':
|
||||
$alias = mb_strtolower($alias, 'UTF-8');
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not posible.
|
||||
break;
|
||||
}
|
||||
|
||||
$cache[$case][$id_agent] = $alias;
|
||||
|
|
|
@ -1277,12 +1277,34 @@ function graphic_combined_module(
|
|||
array_push($modules, $source['id_agent_module']);
|
||||
array_push($weights, $source['weight']);
|
||||
if ($source['label'] != '' || $params_combined['labels']) {
|
||||
$item['type'] = 'custom_graph';
|
||||
$item['id_agent'] = agents_get_module_id(
|
||||
$id_agent = agents_get_module_id(
|
||||
$source['id_agent_module']
|
||||
);
|
||||
$item['id_agent_module'] = $source['id_agent_module'];
|
||||
$labels[$source['id_agent_module']] = ($source['label'] != '') ? reporting_label_macro($item, $source['label']) : reporting_label_macro($item, $params_combined['labels']);
|
||||
$agent_description = agents_get_description($id_agent);
|
||||
$agent_group = agents_get_agent_group($id_agent);
|
||||
$agent_address = agents_get_address($id_agent);
|
||||
$agent_alias = agents_get_alias($id_agent);
|
||||
$module_name = modules_get_agentmodule_name(
|
||||
$source['id_agent_module']
|
||||
);
|
||||
|
||||
$module_description = modules_get_agentmodule_descripcion(
|
||||
$source['id_agent_module']
|
||||
);
|
||||
|
||||
$items_label = [
|
||||
'type' => 'custom_graph',
|
||||
'id_agent' => $id_agent,
|
||||
'id_agent_module' => $source['id_agent_module'],
|
||||
'agent_description' => $agent_description,
|
||||
'agent_group' => $agent_group,
|
||||
'agent_address' => $agent_address,
|
||||
'agent_alias' => $agent_alias,
|
||||
'module_name' => $module_name,
|
||||
'module_description' => $module_description,
|
||||
];
|
||||
|
||||
$labels[$source['id_agent_module']] = ($source['label'] != '') ? reporting_label_macro($items_label, $source['label']) : reporting_label_macro($item, $params_combined['labels']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -141,6 +141,15 @@ function html_do_report_info($report)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print html report.
|
||||
*
|
||||
* @param array $report Info.
|
||||
* @param boolean $mini Type.
|
||||
* @param integer $report_info Show info.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function reporting_html_print_report($report, $mini=false, $report_info=1)
|
||||
{
|
||||
if ($report_info == 1) {
|
||||
|
@ -161,7 +170,38 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||
$table->rowstyle = [];
|
||||
|
||||
if (isset($item['label']) && $item['label'] != '') {
|
||||
$label = reporting_label_macro($item, $item['label']);
|
||||
$id_agent = $item['id_agent'];
|
||||
$id_agent_module = $item['id_agent_module'];
|
||||
|
||||
// Add macros name.
|
||||
$agent_description = agents_get_description($id_agent);
|
||||
$agent_group = agents_get_agent_group($id_agent);
|
||||
$agent_address = agents_get_address($id_agent);
|
||||
$agent_alias = agents_get_alias($id_agent);
|
||||
$module_name = modules_get_agentmodule_name(
|
||||
$id_agent_module
|
||||
);
|
||||
|
||||
$module_description = modules_get_agentmodule_descripcion(
|
||||
$id_agent_module
|
||||
);
|
||||
|
||||
$items_label = [
|
||||
'type' => $item['type'],
|
||||
'id_agent' => $id_agent,
|
||||
'id_agent_module' => $id_agent_module,
|
||||
'agent_description' => $agent_description,
|
||||
'agent_group' => $agent_group,
|
||||
'agent_address' => $agent_address,
|
||||
'agent_alias' => $agent_alias,
|
||||
'module_name' => $module_name,
|
||||
'module_description' => $module_description,
|
||||
];
|
||||
|
||||
$label = reporting_label_macro(
|
||||
$items_label,
|
||||
$item['label']
|
||||
);
|
||||
} else {
|
||||
$label = '';
|
||||
}
|
||||
|
@ -180,7 +220,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||
|
||||
$table->data['description_row']['description'] = $item['description'];
|
||||
|
||||
if ($item['type'] == 'event_report_agent' || $item['type'] == 'event_report_group' || $item['type'] == 'event_report_module') {
|
||||
if ($item['type'] == 'event_report_agent'
|
||||
|| $item['type'] == 'event_report_group'
|
||||
|| $item['type'] == 'event_report_module'
|
||||
) {
|
||||
$table->data['count_row']['count'] = 'Total events: '.$item['total_events'];
|
||||
}
|
||||
|
||||
|
|
|
@ -5866,3 +5866,7 @@ table.table_modal_alternate tr td:first-child {
|
|||
padding-left: 20px;
|
||||
}
|
||||
/* END - Table for show more info in events and config menu in modules graphs */
|
||||
|
||||
.fullwidth {
|
||||
width: 100%;
|
||||
}
|
||||
|
|
|
@ -1402,8 +1402,8 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
|
|||
`type` varchar(30) default 'simple_graph',
|
||||
`period` int(11) NOT NULL default 0,
|
||||
`order` int (11) NOT NULL default 0,
|
||||
`name` varchar(150) NULL,
|
||||
`description` mediumtext,
|
||||
`name` varchar(300) NULL,
|
||||
`description` mediumtext,
|
||||
`id_agent` int(10) unsigned NOT NULL default 0,
|
||||
`text` TEXT,
|
||||
`external_source` Text,
|
||||
|
|
Loading…
Reference in New Issue