mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
Merge branch 'ent-8365-ncm-fase-3' of brutus.artica.es:artica/pandorafms into ent-8365-ncm-fase-3
This commit is contained in:
commit
c01af3e9b6
7
pandora_console/extras/mr/67.sql
Normal file
7
pandora_console/extras/mr/67.sql
Normal file
@ -0,0 +1,7 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tncm_queue`
|
||||
ADD COLUMN `id_agent_data` INT NOT NULL DEFAULT 0 AFTER `id_script`;
|
||||
|
||||
|
||||
COMMIT;
|
@ -1039,6 +1039,11 @@ switch ($action) {
|
||||
$idAgent = $item['id_agent'];
|
||||
break;
|
||||
|
||||
case 'ncm_backups':
|
||||
$id_agent_ncm = $item['id_agent'];
|
||||
$ncm_group = $item['id_group'];
|
||||
break;
|
||||
|
||||
case 'top_n_agents_sh':
|
||||
$group = $item['id_group'];
|
||||
$recursion = $item['recursion'];
|
||||
@ -1928,6 +1933,71 @@ if (is_metaconsole() === true) {
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row_ncm_group" class="datos">
|
||||
<td class="bolder"><?php echo __('Group NCM'); ?></td>
|
||||
<td >
|
||||
<?php
|
||||
echo '<div class="w250px inline padding-right-2-imp">';
|
||||
$url = ui_get_full_url('ajax.php');
|
||||
html_print_input_hidden('url_ajax', $url, false, false, false, 'url_ajax');
|
||||
if (check_acl($config['id_user'], 0, 'RW')) {
|
||||
html_print_select_groups(
|
||||
$config['id_user'],
|
||||
'RW',
|
||||
true,
|
||||
'ncm_group',
|
||||
$ncm_group,
|
||||
'filterNcmAgentChange()',
|
||||
);
|
||||
} else if (check_acl($config['id_user'], 0, 'RM')) {
|
||||
html_print_select_groups(
|
||||
$config['id_user'],
|
||||
'RM',
|
||||
true,
|
||||
'ncm_group',
|
||||
$ncm_group,
|
||||
'filterNcmAgentChange()',
|
||||
);
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row_ncm_agent">
|
||||
<td class="bolder"><?php echo __('Agent NCM'); ?></td>
|
||||
<td >
|
||||
<?php
|
||||
echo '<div class="w250px inline padding-right-2-imp">';
|
||||
$all_agents = agents_get_agents_selected($ncm_group);
|
||||
html_print_select(
|
||||
$all_agents,
|
||||
'agent_ncm',
|
||||
$id_agent_ncm,
|
||||
'',
|
||||
__('Any'),
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 100%;',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
);
|
||||
echo '</div>';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row_source" class="datos">
|
||||
<td class="bolder"><?php echo __('Source'); ?></td>
|
||||
<td >
|
||||
@ -6915,6 +6985,10 @@ function chooseType() {
|
||||
|
||||
$('#agent_autocomplete_events').show();
|
||||
|
||||
// NCM fields.
|
||||
$("#row_ncm_group").hide();
|
||||
$("#row_ncm_agent").hide();
|
||||
|
||||
switch (type) {
|
||||
case 'event_report_group':
|
||||
$("#row_description").show();
|
||||
@ -7764,6 +7838,11 @@ function chooseType() {
|
||||
$("#row_agent").show();
|
||||
break;
|
||||
|
||||
case 'ncm_backups':
|
||||
$("#row_ncm_group").show();
|
||||
$("#row_ncm_agent").show();
|
||||
break;
|
||||
|
||||
case 'top_n_agents_sh':
|
||||
$("#row_group").show();
|
||||
$("#row_max_items").show();
|
||||
@ -8046,4 +8125,36 @@ $(document).ready(function () {
|
||||
});
|
||||
});
|
||||
|
||||
// Ncm agent filter by group.
|
||||
function filterNcmAgentChange() {
|
||||
var idGroup = $("#ncm_group").val();
|
||||
const url_ajax = $("#url_ajax").val();
|
||||
|
||||
$.ajax({
|
||||
url: url_ajax,
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: {
|
||||
page: "operation/agentes/ver_agente",
|
||||
get_ncm_agents: 1,
|
||||
id_group: idGroup,
|
||||
privilege: "AW",
|
||||
keys_prefix: "_"
|
||||
},
|
||||
success: function(data) {
|
||||
$("#agent_ncm").empty();
|
||||
data.map(item => {
|
||||
var option = $("<option></option>")
|
||||
.attr("value", item.id_agent)
|
||||
.html(item.alias);
|
||||
$("#agent_ncm").append(option);
|
||||
});
|
||||
},
|
||||
error: function(err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -2045,6 +2045,12 @@ switch ($action) {
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'ncm_backups':
|
||||
$values['id_agent'] = get_parameter('agent_ncm');
|
||||
$values['id_group'] = get_parameter('ncm_group');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['top_n'] = get_parameter(
|
||||
@ -2065,7 +2071,10 @@ switch ($action) {
|
||||
break;
|
||||
}
|
||||
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
if (isset($values['id_agent']) === false) {
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
}
|
||||
|
||||
$values['id_gs'] = get_parameter('id_custom_graph');
|
||||
|
||||
$values['id_agent_module'] = '';
|
||||
@ -2181,7 +2190,10 @@ switch ($action) {
|
||||
$values['id_module_group'] = get_parameter(
|
||||
'combo_modulegroup'
|
||||
);
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
|
||||
if (isset($values['id_group']) === false) {
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
}
|
||||
|
||||
if ($values['server_name'] == '') {
|
||||
$values['server_name'] = get_parameter(
|
||||
@ -2977,6 +2989,12 @@ switch ($action) {
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'ncm_backups':
|
||||
$values['id_agent'] = get_parameter('agent_ncm');
|
||||
$values['id_group'] = get_parameter('ncm_group');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['top_n'] = get_parameter(
|
||||
@ -3003,7 +3021,10 @@ switch ($action) {
|
||||
);
|
||||
}
|
||||
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
if (isset($values['id_agent']) === false) {
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
}
|
||||
|
||||
$values['id_gs'] = get_parameter('id_custom_graph');
|
||||
if (($values['type'] == 'alert_report_agent')
|
||||
|| ($values['type'] == 'event_report_agent')
|
||||
@ -3117,7 +3138,9 @@ switch ($action) {
|
||||
$values['id_module_group'] = get_parameter(
|
||||
'combo_modulegroup'
|
||||
);
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
if (isset($values['id_group']) === false) {
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
}
|
||||
|
||||
|
||||
if ((($values['type'] == 'custom_graph')
|
||||
|
7
pandora_console/images/donut.svg
Normal file
7
pandora_console/images/donut.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>donut</title>
|
||||
<g id="donut" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M10,1 C14.9705627,1 19,5.02943725 19,10 C19,14.9705627 14.9705627,19 10,19 C5.02943725,19 1,14.9705627 1,10 C1,5.02943725 5.02943725,1 10,1 Z M10,6 C7.790861,6 6,7.790861 6,10 C6,12.209139 7.790861,14 10,14 C12.209139,14 14,12.209139 14,10 C14,7.790861 12.209139,6 10,6 Z" id="Oval" fill="#484848" fill-rule="nonzero"></path>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 649 B |
@ -968,6 +968,11 @@ function reports_get_report_types($template=false, $not_editor=false)
|
||||
'name' => __('Network configuration changes'),
|
||||
];
|
||||
|
||||
$types['ncm_backups'] = [
|
||||
'optgroup' => __('NCM'),
|
||||
'name' => __('Network backups'),
|
||||
];
|
||||
|
||||
if (enterprise_installed() === true) {
|
||||
$types['top_n_agents_sh'] = [
|
||||
'optgroup' => __('Security hardening'),
|
||||
|
@ -1,10 +1,3 @@
|
||||
span.select2.select2-container.select2-container--default {
|
||||
max-width: 175px !important;
|
||||
width: 175px !important;
|
||||
}
|
||||
|
||||
.edit_discovery_input b {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
.select2-selection__rendered {
|
||||
max-width: 600px;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||
use PandoraFMS\ITSM\ITSM;
|
||||
use PandoraFMS\Enterprise\NetworkManager;
|
||||
|
||||
global $config;
|
||||
|
||||
@ -73,6 +74,7 @@ if (is_ajax()) {
|
||||
$get_node_agent = (bool) get_parameter('get_node_agent', false);
|
||||
$get_agent_inventory_modules = (bool) get_parameter('get_agent_inventory_modules', false);
|
||||
$get_agent_inventory_dates = (bool) get_parameter('get_agent_inventory_dates', false);
|
||||
$get_ncm_agents = (bool) get_parameter('get_ncm_agents', false);
|
||||
|
||||
$refresh_contact = get_parameter('refresh_contact', 0);
|
||||
|
||||
@ -214,6 +216,30 @@ if (is_ajax()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get ncm Agent.
|
||||
if ($get_ncm_agents === true) {
|
||||
$fields = [
|
||||
'`tncm_agent`.id_agent',
|
||||
'`tagente`.alias',
|
||||
];
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
|
||||
$filter['filter_id_group'] = $id_group;
|
||||
// Retrieve data.
|
||||
$ncm_data = NetworkManager::agents(
|
||||
// Fields.
|
||||
$fields,
|
||||
// Filter.
|
||||
$filter,
|
||||
);
|
||||
|
||||
echo json_encode($ncm_data);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($get_modules_group_json === true) {
|
||||
$id_group = (int) get_parameter('id_module_group', 0);
|
||||
$id_agents = get_parameter('id_agents', null);
|
||||
|
Loading…
x
Reference in New Issue
Block a user