Merge branch 'ent-3407-Informes-en-IPAM' into 'develop'

Ent 3407 informes en ipam

See merge request artica/pandorafms!4424
This commit is contained in:
Daniel Rodriguez 2021-09-27 12:06:00 +00:00
commit 894cd0974f
8 changed files with 123 additions and 2 deletions

View File

@ -1,8 +1,14 @@
START TRANSACTION; START TRANSACTION;
ALTER TABLE `treport_content` ADD COLUMN `ipam_network_filter` int(10) UNSIGNED DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_network_filter` int(10) UNSIGNED DEFAULT 0;
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `tevent_alert` ADD COLUMN `id_template_conditions` int(10) unsigned NOT NULL default 0; ALTER TABLE `tevent_alert` ADD COLUMN `id_template_conditions` int(10) unsigned NOT NULL default 0;
ALTER TABLE `tevent_alert` ADD COLUMN `id_template_fields` int(10) unsigned NOT NULL default 0; ALTER TABLE `tevent_alert` ADD COLUMN `id_template_fields` int(10) unsigned NOT NULL default 0;
ALTER TABLE `tevent_filter` ADD COLUMN `time_from` TIME NULL; ALTER TABLE `tevent_filter` ADD COLUMN `time_from` TIME NULL;
ALTER TABLE `tevent_filter` ADD COLUMN `time_to` TIME NULL; ALTER TABLE `tevent_filter` ADD COLUMN `time_to` TIME NULL;
COMMIT; COMMIT;

View File

@ -898,6 +898,9 @@ ALTER TABLE `treport_content_template` ADD COLUMN `landscape` tinyint(1) UNSIGNE
ALTER TABLE `treport_content_template` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content_template` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content_template` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content_template` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content_template` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content_template` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_network_filter` int(10) UNSIGNED DEFAULT 0;
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- Table `tnews` -- Table `tnews`
@ -1776,6 +1779,9 @@ ALTER TABLE `treport_content` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NUL
ALTER TABLE `treport_content` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` MODIFY `external_source` MEDIUMTEXT; ALTER TABLE `treport_content` MODIFY `external_source` MEDIUMTEXT;
ALTER TABLE `treport_content` ADD COLUMN `ipam_network_filter` int(10) UNSIGNED DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmodule_relationship` -- Table `tmodule_relationship`

View File

@ -399,6 +399,12 @@ switch ($action) {
$sla_sorted_by = $item['top_n']; $sla_sorted_by = $item['top_n'];
break; break;
case 'IPAM_network':
$network_filter = $item['ipam_network_filter'];
$alive_ip = $item['ipam_alive_ips'];
$agent_not_assigned_to_ip = $item['ipam_ip_not_assigned_to_agent'];
break;
case 'monitor_report': case 'monitor_report':
$description = $item['description']; $description = $item['description'];
$idAgentModule = $item['id_agent_module']; $idAgentModule = $item['id_agent_module'];
@ -1068,6 +1074,51 @@ $class = 'databox filters';
</td> </td>
</tr> </tr>
<tr id="row_network_filter" class="datos">
<td class="bolder"><?php echo __('Filter by network'); ?></td>
<td>
<?php
$sql = 'SELECT id, CONCAT(name_network, " (", network, ")")
FROM tipam_network';
html_print_select_from_sql(
$sql,
'network_filter',
$network_filter,
'',
'',
'0'
);
?>
</td>
</tr>
<tr id="row_alive_ip" class="datos">
<td class="bolder"><?php echo __('Show alive IPs only'); ?></td>
<td>
<?php
html_print_checkbox_switch(
'alive_ip',
1,
$alive_ip
);
?>
</td>
</tr>
<tr id="row_agent_not_assigned_to_ip" class="datos">
<td class="bolder"><?php echo __('Show IPs not assigned to an agent'); ?></td>
<td>
<?php
html_print_checkbox_switch(
'agent_not_assigned_to_ip',
1,
$agent_not_assigned_to_ip
);
?>
</td>
</tr>
<tr id="row_period" class="datos"> <tr id="row_period" class="datos">
<td class="bolder"> <td class="bolder">
<?php <?php
@ -5514,7 +5565,9 @@ function chooseType() {
$("#row_agent_version").hide(); $("#row_agent_version").hide();
$("#row_agent_remote_conf").hide(); $("#row_agent_remote_conf").hide();
$("#row_module_free_search").hide(); $("#row_module_free_search").hide();
$("#row_network_filter").hide();
$("#row_alive_ip").hide();
$("#row_agent_not_assigned_to_ip").hide();
// SLA list default state. // SLA list default state.
$("#sla_list").hide(); $("#sla_list").hide();
@ -6231,6 +6284,13 @@ function chooseType() {
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
break; break;
case 'IPAM_network':
$("#row_network_filter").show();
$("#row_alive_ip").show();
$("#row_agent_not_assigned_to_ip").show();
$("#row_historical_db_check").hide();
break;
case 'permissions_report': case 'permissions_report':
$("#row_description").show(); $("#row_description").show();
$("#row_users").show(); $("#row_users").show();

View File

@ -1832,6 +1832,13 @@ switch ($action) {
$good_format = true; $good_format = true;
break; break;
case 'IPAM_network':
$values['ipam_network_filter'] = get_parameter('network_filter');
$values['ipam_alive_ips'] = get_parameter('alive_ip');
$values['ipam_ip_not_assigned_to_agent'] = get_parameter('agent_not_assigned_to_ip');
$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(
@ -2229,6 +2236,14 @@ switch ($action) {
$values['external_source'] = json_encode($es); $values['external_source'] = json_encode($es);
break; break;
case 'IPAM_network':
$es['network_filter'] = get_parameter('network_filter');
$es['alive_ip'] = get_parameter('alive_ip');
$es['agent_not_assigned_to_ip'] = get_parameter('agent_not_assigned_to_ip');
// $values['external_source'] = json_encode($es);
break;
default: default:
// Default. // Default.
break; break;
@ -2536,6 +2551,10 @@ switch ($action) {
); );
} }
$values['ipam_network_filter'] = get_parameter('network_filter', 0);
$values['ipam_alive_ips'] = get_parameter('alive_ip', 0);
$values['ipam_ip_not_assigned_to_agent'] = get_parameter('agent_not_assigned_to_ip', 0);
$values['only_display_wrong'] = (int) get_parameter( $values['only_display_wrong'] = (int) get_parameter(
'checkbox_only_display_wrong', 'checkbox_only_display_wrong',
0 0
@ -2869,6 +2888,12 @@ switch ($action) {
$values['external_source'] = json_encode($es); $values['external_source'] = json_encode($es);
break; break;
case 'IPAM_network':
$es['network_filter'] = get_parameter('network_filter');
$es['alive_ip'] = get_parameter('alive_ip');
$es['agent_not_assigned_to_ip'] = get_parameter('agent_not_assigned_to_ip');
break;
default: default:
// Default. // Default.
break; break;

View File

@ -757,6 +757,13 @@ function reporting_make_reporting_data(
); );
break; break;
case 'IPAM_network':
$report['contents'][] = reporting_ipam(
$report,
$content
);
break;
case 'agent_detailed_event': case 'agent_detailed_event':
case 'event_report_agent': case 'event_report_agent':
$report_control = io_safe_output( $report_control = io_safe_output(

View File

@ -389,6 +389,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
reporting_html_inventory_changes($table, $item); reporting_html_inventory_changes($table, $item);
break; break;
case 'IPAM_network':
reporting_enterprise_html_ipam($table, $item, $mini);
break;
case 'agent_detailed_event': case 'agent_detailed_event':
case 'event_report_agent': case 'event_report_agent':
reporting_html_event_report_agent($table, $item); reporting_html_event_report_agent($table, $item);

View File

@ -686,6 +686,13 @@ function reports_get_report_types($template=false, $not_editor=false)
'name' => __('Module Histogram graph'), 'name' => __('Module Histogram graph'),
]; ];
if ($config['enterprise_installed'] && is_metaconsole() === false) {
$types['IPAM_network'] = [
'optgroup' => __('IPAM'),
'name' => __('IPAM networks'),
];
}
$types['SLA'] = [ $types['SLA'] = [
'optgroup' => __('SLA'), 'optgroup' => __('SLA'),
'name' => __('S.L.A.'), 'name' => __('S.L.A.'),

View File

@ -1580,6 +1580,9 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`pagebreak` tinyint(1) UNSIGNED NOT NULL default 0, `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0,
`compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0, `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0,
`graph_render` tinyint(1) UNSIGNED NOT NULL default 0, `graph_render` tinyint(1) UNSIGNED NOT NULL default 0,
`ipam_network_filter` int(10) UNSIGNED DEFAULT 0,
`ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
`ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY(`id_rc`), PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE
@ -3195,6 +3198,9 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`pagebreak` tinyint(1) UNSIGNED NOT NULL default 0, `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0,
`compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0, `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0,
`graph_render` tinyint(1) UNSIGNED NOT NULL default 0, `graph_render` tinyint(1) UNSIGNED NOT NULL default 0,
`ipam_network_filter` int(10) UNSIGNED DEFAULT 0,
`ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
`ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY(`id_rc`) PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;