mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
#8365 Added reports for ncm backups.
This commit is contained in:
parent
f521f3e9bb
commit
407a505a3e
@ -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;
|
||||
}
|
||||
|
||||
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'
|
||||
);
|
||||
|
||||
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) {
|
||||
);
|
||||
}
|
||||
|
||||
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'
|
||||
);
|
||||
if (isset($values['id_group']) === false) {
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
}
|
||||
|
||||
|
||||
if ((($values['type'] == 'custom_graph')
|
||||
|
@ -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'),
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||
use PandoraFMS\ITSM\ITSM;
|
||||
use PandoraFMS\Enterprise\NetworkManager;
|
||||
|
||||
global $config;
|
||||
|
||||
@ -72,6 +73,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);
|
||||
|
||||
@ -213,6 +215,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