mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-25 10:59:15 +02:00
#11326 added top n agents with worst score
This commit is contained in:
parent
001ffc1799
commit
d44df2ea6b
@ -1019,6 +1019,11 @@ switch ($action) {
|
|||||||
$idAgent = $item['id_agent'];
|
$idAgent = $item['id_agent'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'top_n_agents_sh':
|
||||||
|
$group = $item['id_group'];
|
||||||
|
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// It's not possible.
|
// It's not possible.
|
||||||
break;
|
break;
|
||||||
@ -7411,7 +7416,11 @@ function chooseType() {
|
|||||||
case 'ncm':
|
case 'ncm':
|
||||||
$("#row_agent").show();
|
$("#row_agent").show();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'top_n_agents_sh':
|
||||||
|
$("#row_group").show();
|
||||||
|
$("#row_max_items").show();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -1987,6 +1987,12 @@ switch ($action) {
|
|||||||
$good_format = true;
|
$good_format = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'top_n_agents_sh':
|
||||||
|
$values['id_group'] = get_parameter('combo_group');
|
||||||
|
$values['top_n_value'] = get_parameter('max_items');
|
||||||
|
$good_format = true;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$values['period'] = get_parameter('period');
|
$values['period'] = get_parameter('period');
|
||||||
$values['top_n'] = get_parameter(
|
$values['top_n'] = get_parameter(
|
||||||
@ -2863,6 +2869,12 @@ switch ($action) {
|
|||||||
$good_format = true;
|
$good_format = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'top_n_agents_sh':
|
||||||
|
$values['id_group'] = get_parameter('combo_group');
|
||||||
|
$values['top_n_value'] = get_parameter('max_items');
|
||||||
|
$good_format = true;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$values['period'] = get_parameter('period');
|
$values['period'] = get_parameter('period');
|
||||||
$values['top_n'] = get_parameter(
|
$values['top_n'] = get_parameter(
|
||||||
|
@ -935,6 +935,13 @@ function reporting_make_reporting_data(
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'top_n_agents_sh':
|
||||||
|
$report['contents'][] = reporting_top_n_agents_sh(
|
||||||
|
$report,
|
||||||
|
$content
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Default.
|
// Default.
|
||||||
break;
|
break;
|
||||||
|
@ -463,6 +463,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||||||
case 'ncm':
|
case 'ncm':
|
||||||
reporting_html_ncm_config($table, $item);
|
reporting_html_ncm_config($table, $item);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'top_n_agents_sh':
|
||||||
|
reporting_html_top_n_agents_sh($table, $item);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item['type'] == 'agent_module') {
|
if ($item['type'] == 'agent_module') {
|
||||||
@ -478,6 +482,24 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function reporting_html_top_n_agents_sh($table, $item)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$table->data[1][0] = '<b>'.__('Agent').'</b>';
|
||||||
|
$table->data[1][1] = '<b>'.__('Last audit scan').'</b>';
|
||||||
|
$table->data[1][2] = '<b>'.__('Score').'</b>';
|
||||||
|
|
||||||
|
$row = 2;
|
||||||
|
foreach ($item['data'] as $key => $agent) {
|
||||||
|
$table->data[$row][0] = $agent['alias'];
|
||||||
|
$table->data[$row][1] = date($config['date_format'], $agent['utimestamp']);
|
||||||
|
$table->data[$row][2] = $agent['datos'].' %';
|
||||||
|
$row++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to print to HTML SLA report.
|
* Function to print to HTML SLA report.
|
||||||
*
|
*
|
||||||
|
@ -963,6 +963,13 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||||||
'name' => __('Network configuration changes'),
|
'name' => __('Network configuration changes'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (enterprise_installed() === true) {
|
||||||
|
$types['top_n_agents_sh'] = [
|
||||||
|
'optgroup' => __('Security hardening'),
|
||||||
|
'name' => __('Top-N agents with the worst score'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
return $types;
|
return $types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user