#11807 new report list of checks agent

This commit is contained in:
Daniel Cebrian 2023-08-22 16:28:01 +02:00
parent dd453507d2
commit 61839db7ff
7 changed files with 99 additions and 1 deletions

View File

@ -4,6 +4,8 @@ ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL
ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `status_of_check` TINYTEXT;
UPDATE `twelcome_tip`
SET title = 'Scheduled downtimes',
url = 'https://pandorafms.com/manual/en/documentation/04_using/11_managing_and_administration#scheduled_downtimes'

View File

@ -1050,6 +1050,14 @@ switch ($action) {
$ignore_skipped = $item['ignore_skipped'];
break;
case 'list_checks':
$group = $item['id_group'];
$recursion = $item['recursion'];
$cat_selected = $item['cat_security_hardening'];
$status_of_check = $item['status_of_check'];
$idAgent = $item['id_agent'];
break;
default:
// It's not possible.
break;
@ -3751,6 +3759,28 @@ $class = 'databox filters';
</td>
</tr>
<tr id="row_status_check" class="datos">
<td class="bolder">
<?php
echo __('Status of check');
?>
</td>
<td>
<?php
html_print_select(
[
'all' => __('All'),
'PASS' => __('Passed'),
'FAIL' => __('Failed'),
'INVALID' => __('Skipped'),
],
'status_of_check',
$status_of_check,
);
?>
</td>
</tr>
<?php
if ($is_enterprise) {
?>
@ -6625,6 +6655,7 @@ function chooseType() {
$("#row_use_prefix_notation").hide();
$("#row_cat_security_hardening").hide();
$("#row_ignore_skipped").hide();
$("#row_status_check").hide();
// SLA list default state.
$("#sla_list").hide();
@ -7500,6 +7531,13 @@ function chooseType() {
$("#row_cat_security_hardening").show();
$("#row_ignore_skipped").show();
break;
case 'list_checks':
$("#row_group").show();
$("#row_agent").show();
$("#row_cat_security_hardening").show();
$("#row_status_check").show();
break;
}
switch (type) {

View File

@ -2015,6 +2015,13 @@ switch ($action) {
$good_format = true;
break;
case 'list_checks':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['status_of_check'] = get_parameter('status_of_check');
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(
@ -2916,6 +2923,13 @@ switch ($action) {
$good_format = true;
break;
case 'list_checks':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['status_of_check'] = get_parameter('status_of_check');
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(

View File

@ -963,6 +963,13 @@ function reporting_make_reporting_data(
);
break;
case 'list_checks':
$report['contents'][] = reporting_list_checks(
$report,
$content
);
break;
default:
// Default.
break;

View File

@ -479,6 +479,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
case 'vul_by_cat':
reporting_vul_by_cat_graph($table, $item);
break;
case 'list_checks':
reporting_html_list_checks($table, $item);
break;
}
if ($item['type'] == 'agent_module') {
@ -494,6 +498,34 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
}
/**
* Function to print HTML checks filtered by agent and category.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
*
* @return void
*/
function reporting_html_list_checks($table, $item)
{
$table->rowclass[0] = '';
$table->colspan[0][1] = 3;
$table->data[1][0] = '<b>'.__('Id').'</b>';
$table->data[1][1] = '<b>'.__('Title').'</b>';
$table->data[1][2] = '<b>'.__('Category').'</b>';
$table->data[1][3] = '<b>'.__('Status').'</b>';
$row = 2;
foreach ($item['data'] as $key => $check) {
$table->data[$row][0] = $check['id'];
$table->data[$row][1] = $check['title'];
$table->data[$row][2] = $check['category'];
$table->data[$row][3] = $check['status'];
$row++;
}
}
/**
* Function to print HTML top checks failed by category
*
@ -504,7 +536,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
*/
function reporting_html_top_n_categories_checks($table, $item)
{
global $config;
$table->rowclass[0] = '';
$table->data[1][0] = '<b>'.__('Id').'</b>';
$table->data[1][1] = '<b>'.__('Category').'</b>';

View File

@ -983,6 +983,11 @@ function reports_get_report_types($template=false, $not_editor=false)
'optgroup' => __('Security hardening'),
'name' => __('Vulnerabilities by category'),
];
$types['list_checks'] = [
'optgroup' => __('Security hardening'),
'name' => __('List of checks'),
];
}
return $types;

View File

@ -1674,6 +1674,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`use_prefix_notation` TINYINT UNSIGNED NOT NULL DEFAULT 1,
`cat_security_hardening` INT NOT NULL DEFAULT 0,
`ignore_skipped` INT NOT NULL DEFAULT 0,
`status_of_check` TINYTEXT,
PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE