created agents inventory report item

This commit is contained in:
alejandro.campos@artica.es 2021-06-01 18:04:01 +02:00
parent 9cbe6a2924
commit 59834088bf
4 changed files with 50 additions and 5 deletions

View File

@ -744,6 +744,7 @@ switch ($action) {
$es = json_decode($item['external_source'], true);
$date = $es['date'];
$selected_agent_server_filter = $es['agent_server_filter'];
$selected_agent_group_filter = $es['agent_group_filter'];
$selected_agents_inventory_display_options = $es['agents_inventory_display_options'];
$selected_agent_os_filter = $es['agent_os_filter'];
@ -3078,6 +3079,38 @@ $class = 'databox filters';
</td>
</tr>
<?php
$server_fields = [];
$server_fields[0] = __('All');
$servers = metaconsole_get_servers();
foreach ($servers as $key => $server) {
$server_fields[$key] = $server['server_name'];
}
$server_filter_markup = '
<tr id="row_agent_server_filter" class="datos">
<td class="bolder">'.__('Server').'</td><td>'.html_print_select(
$server_fields,
'agent_server_filter',
$selected_agent_server_filter,
'',
false,
'',
true,
false,
false,
'',
false,
'min-width: 180px'
).'</td></tr>';
if (is_metaconsole()) {
echo $server_filter_markup;
}
?>
<tr id="row_agent_group_filter" class="datos">
<td class="bolder">
<?php
@ -5440,6 +5473,7 @@ function chooseType() {
$("#row_profiles_group").hide();
$("#row_select_by_group").hide();
$("#row_agents_inventory_display_options").hide();
$("#row_agent_server_filter").hide();
$("#row_agent_group_filter").hide();
$("#row_os").hide();
$("#row_custom_field").hide();
@ -5990,6 +6024,7 @@ function chooseType() {
case 'agents_inventory':
$("#row_agents_inventory_display_options").show();
$("#row_agent_server_filter").show();
$("#row_agent_group_filter").show();
$("#row_group").show();
$("#row_os").show();

View File

@ -2101,6 +2101,7 @@ switch ($action) {
break;
case 'agents_inventory':
$es['agent_server_filter'] = get_parameter('agent_server_filter');
$es['agents_inventory_display_options'] = get_parameter('agents_inventory_display_options');
$es['agent_custom_field_filter'] = get_parameter('agent_custom_field_filter');
$es['agent_os_filter'] = get_parameter('agent_os_filter');
@ -2739,6 +2740,7 @@ switch ($action) {
break;
case 'agents_inventory':
$es['agent_server_filter'] = get_parameter('agent_server_filter');
$es['agents_inventory_display_options'] = get_parameter('agents_inventory_display_options');
$es['agent_custom_field_filter'] = get_parameter('agent_custom_field_filter');
$es['agent_os_filter'] = get_parameter('agent_os_filter');

View File

@ -2266,7 +2266,7 @@ function reporting_event_report_module(
function reporting_agents_inventory($report, $content)
{
global $config;
hd($content);
$return['name'] = $content['name'];
$return['type'] = 'agents_inventory';
$return['title'] = $content['name'];
@ -2283,9 +2283,14 @@ function reporting_agents_inventory($report, $content)
$es_agent_version_filter = $external_source['agent_version_filter'];
$es_agent_module_search_filter = $external_source['agent_module_search_filter'];
$es_agent_group_filter = $external_source['agent_group_filter'];
$es_agent_server_filter = $external_source['agent_server_filter'];
$es_users_groups = $external_source['users_groups'];
$es_agent_remote_conf = $external_source['agent_remote_conf'];
if ($es_agents_inventory_display_options === '') {
$es_agents_inventory_display_options = [];
}
$search_sql = '';
if ($es_custom_fields != '') {
@ -2357,6 +2362,13 @@ function reporting_agents_inventory($report, $content)
foreach ($servers_ids as $server_id) {
if (is_metaconsole()) {
$server = metaconsole_get_connection_by_id($server_id);
if ((int) $es_agent_server_filter !== 0
&& (int) $es_agent_server_filter !== (int) $server_id
) {
continue;
}
metaconsole_connect($server);
}

View File

@ -1573,8 +1573,6 @@ function reporting_html_agents_inventory($table, $item, $pdf=0)
}
}
hd('======', true);
hd($pdf, true);
if ($pdf === 0) {
$table->colspan['permissions']['cell'] = 3;
$table->cellstyle['permissions']['cell'] = 'text-align: center;';
@ -5925,8 +5923,6 @@ function reporting_html_permissions($table, $item, $pdf=0)
}
}
// hd("lllllp", true);
// hd($pdf, true);
if ($pdf === 0) {
$table->colspan['permissions']['cell'] = 3;
$table->cellstyle['permissions']['cell'] = 'text-align: center;';