2009-03-25 14:51:52 +01:00
|
|
|
<?php
|
|
|
|
|
2009-06-08 20:26:14 +02:00
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
2011-03-02 22:56:48 +01:00
|
|
|
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
2009-06-08 20:26:14 +02:00
|
|
|
// Please see http://pandorafms.org for full contribution list
|
2009-03-25 14:51:52 +01:00
|
|
|
// This program is free software; you can redistribute it and/or
|
2009-06-08 20:26:14 +02:00
|
|
|
// modify it under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation; version 2
|
2009-03-25 14:51:52 +01:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2009-06-08 20:26:14 +02:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2009-03-25 14:51:52 +01:00
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
2009-08-24 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_menu.php, include/functions_html.php,
include/functions_events.php, include/functions_messages.php,
include/functions_modules.php, include/functions_exportserver.php,
include/functions_reporting.php, include/functions_filemanager.php,
include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php,
include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php,
include/functions_networkmap.php, include/functions_servers.php,
include/FusionCharts/FusionCharts_Gen.php,
include/FusionCharts/FusionCharts.php,
include/functions_network_profiles.php, include/gettext.php,
include/functions_network_components.php, include/functions_visual_map.php,
include/fgraph2.php, include/Image/image_functions.php,
include/functions_config.php, include/help/en/help_plugin_parameters.php,
include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php,
include/help/en/help_postprocess.php,
include/help/en/help_prediction_source_module.php,
include/help/en/help_date_format.php, include/help/en/help_recontask.php,
include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php,
include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php,
include/help/en/help_agent_status.php,
include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php,
include/help/en/help_alert_type.php,
include/help/en/help_network_component.php,
include/help/en/help_time_stamp-comparation.php,
include/help/en/help_eventview.php, include/help/en/help_timesource.php,
include/help/en/help_alert_validation.php,
include/help/en/help_map_builder.php,
include/help/en/help_alert_recovery.php,
include/help/en/help_module_type.php,
include/help/en/help_planned_downtime.php,
include/help/en/help_serverlag.php, include/help/en/help_alerts.php,
include/help/en/help_snmpwalk.php,
include/help/en/help_module_definition.php,
include/help/en/help_plugin_definition.php,
include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php
include/help/en/help_manageconfig.php,
include/help/es/help_alert_validation.php,
include/help/es/help_plugin_parameters.php,
include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php,
include/help/es/help_map_builder.php, include/help/es/help_postprocess.php,
include/help/es/help_date_format.php,
include/help/es/help_alert_recovery.php,
include/help/es/help_prediction_source_module.php,
include/help/es/help_module_type.php,
include/help/es/help_planned_downtime.php,
include/help/es/help_alert-matches.php, include/help/es/help_recontask.php,
include/help/es/help_alerts.php, include/help/es/help_serverlag.php,
include/help/es/help_snmpwalk.php,
include/help/es/help_module_definition.php,
include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php,
include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php,
include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php,
include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php,
include/help/es/help_wminamespace.php,
include/help/es/help_network_component.php,
include/help/es/help_time_stamp-comparation.php,
include/help/es/help_manageconfig.php, include/help/es/help_timesource.php,
include/config_process.php, include/functions_ui.php, include/htmlawed.php,
include/functions_custom_graphs.php, include/fgraph.php,
include/functions_incidents.php, include/functions.php,
include/functions_agents.php, include/functions_db.php,
include/functions_themes.php, include/streams.php,
include/functions_fsgraph.php, include/functions_alerts.php,
include/functions_reports.php, include/functions_extensions.php,
include/functions_ui_renders.php: change comments blocks for delete the
warnings to construct phpDoc Files, give a struct and order in the
phpDoc files.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
|
|
|
/**
|
2019-01-30 16:18:44 +01:00
|
|
|
* @package Include
|
2009-08-24 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_menu.php, include/functions_html.php,
include/functions_events.php, include/functions_messages.php,
include/functions_modules.php, include/functions_exportserver.php,
include/functions_reporting.php, include/functions_filemanager.php,
include/pchart_graph.php, include/pandora_graph.php, include/auth/ldap.php,
include/auth/mysql.php, include/config.inc.php,
include/functions_networkmap.php, include/functions_servers.php,
include/functions_network_profiles.php, include/gettext.php,
include/functions_network_components.php, include/functions_visual_map.php,
include/fgraph2.php, include/Image/image_functions.php,
include/functions_config.php, include/config_process.php,
include/functions_ui.php, include/htmlawed.php,
include/functions_custom_graphs.php, include/fgraph.php,
include/functions_incidents.php, include/functions.php,
include/functions_agents.php, include/functions_db.php,
include/functions_themes.php, include/streams.php,
include/functions_fsgraph.php, include/functions_alerts.php,
include/functions_reports.php, include/functions_extensions.php,
include/functions_ui_renders.php: change or add the subpackage in phpdoc
comment blocks for to organize more the result phpdoc files. Start to
document undocument functions.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1882 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-26 17:37:47 +02:00
|
|
|
* @subpackage Reporting
|
2009-08-24 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_menu.php, include/functions_html.php,
include/functions_events.php, include/functions_messages.php,
include/functions_modules.php, include/functions_exportserver.php,
include/functions_reporting.php, include/functions_filemanager.php,
include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php,
include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php,
include/functions_networkmap.php, include/functions_servers.php,
include/FusionCharts/FusionCharts_Gen.php,
include/FusionCharts/FusionCharts.php,
include/functions_network_profiles.php, include/gettext.php,
include/functions_network_components.php, include/functions_visual_map.php,
include/fgraph2.php, include/Image/image_functions.php,
include/functions_config.php, include/help/en/help_plugin_parameters.php,
include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php,
include/help/en/help_postprocess.php,
include/help/en/help_prediction_source_module.php,
include/help/en/help_date_format.php, include/help/en/help_recontask.php,
include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php,
include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php,
include/help/en/help_agent_status.php,
include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php,
include/help/en/help_alert_type.php,
include/help/en/help_network_component.php,
include/help/en/help_time_stamp-comparation.php,
include/help/en/help_eventview.php, include/help/en/help_timesource.php,
include/help/en/help_alert_validation.php,
include/help/en/help_map_builder.php,
include/help/en/help_alert_recovery.php,
include/help/en/help_module_type.php,
include/help/en/help_planned_downtime.php,
include/help/en/help_serverlag.php, include/help/en/help_alerts.php,
include/help/en/help_snmpwalk.php,
include/help/en/help_module_definition.php,
include/help/en/help_plugin_definition.php,
include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php
include/help/en/help_manageconfig.php,
include/help/es/help_alert_validation.php,
include/help/es/help_plugin_parameters.php,
include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php,
include/help/es/help_map_builder.php, include/help/es/help_postprocess.php,
include/help/es/help_date_format.php,
include/help/es/help_alert_recovery.php,
include/help/es/help_prediction_source_module.php,
include/help/es/help_module_type.php,
include/help/es/help_planned_downtime.php,
include/help/es/help_alert-matches.php, include/help/es/help_recontask.php,
include/help/es/help_alerts.php, include/help/es/help_serverlag.php,
include/help/es/help_snmpwalk.php,
include/help/es/help_module_definition.php,
include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php,
include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php,
include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php,
include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php,
include/help/es/help_wminamespace.php,
include/help/es/help_network_component.php,
include/help/es/help_time_stamp-comparation.php,
include/help/es/help_manageconfig.php, include/help/es/help_timesource.php,
include/config_process.php, include/functions_ui.php, include/htmlawed.php,
include/functions_custom_graphs.php, include/fgraph.php,
include/functions_incidents.php, include/functions.php,
include/functions_agents.php, include/functions_db.php,
include/functions_themes.php, include/streams.php,
include/functions_fsgraph.php, include/functions_alerts.php,
include/functions_reports.php, include/functions_extensions.php,
include/functions_ui_renders.php: change comments blocks for delete the
warnings to construct phpDoc Files, give a struct and order in the
phpDoc files.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
|
|
|
*/
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
require_once $config['homedir'].'/include/functions_users.php';
|
|
|
|
|
|
|
|
|
|
|
|
function reports_get_type_access($report)
|
|
|
|
{
|
|
|
|
if (empty($report)) {
|
|
|
|
return 'group_view';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($report['private']) {
|
|
|
|
return 'user_edit';
|
|
|
|
} else if ($report['id_group_edit'] != 0) {
|
|
|
|
return 'group_edit';
|
|
|
|
}
|
|
|
|
|
|
|
|
return 'group_view';
|
2012-08-20 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.main.php,
godmode/reporting/reporting_builder.php,
include/functions_reports.php, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql: now the reports
can set the group can edit or private edition.
* include/functions_users.php: cleaned source code style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6889 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-20 15:12:53 +02:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2009-03-25 14:51:52 +01:00
|
|
|
/**
|
|
|
|
* Get a custom user report.
|
|
|
|
*
|
|
|
|
* @param int Report id to get.
|
|
|
|
* @param array Extra filter.
|
|
|
|
* @param array Fields to get.
|
|
|
|
*
|
|
|
|
* @return Report with the given id. False if not available or readable.
|
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function reports_get_report($id_report, $filter=false, $fields=false)
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
$id_report = safe_int($id_report);
|
|
|
|
if (empty($id_report)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! is_array($filter)) {
|
|
|
|
$filter = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
$filter['id_report'] = $id_report;
|
|
|
|
if (!is_user_admin($config['id_user'])) {
|
|
|
|
$filter[] = sprintf(
|
|
|
|
'private = 0 OR (private = 1 AND id_user = "%s")',
|
|
|
|
$config['id_user']
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_array($fields)) {
|
|
|
|
$fields[] = 'id_group';
|
|
|
|
}
|
|
|
|
|
|
|
|
$report = db_get_row_filter('treport', $filter, $fields);
|
|
|
|
|
|
|
|
if (! check_acl($config['id_user'], $report['id_group'], 'RR')) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $report;
|
2009-03-25 14:51:52 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2009-03-25 14:51:52 +01:00
|
|
|
/**
|
|
|
|
* Get a list of the reports the user can view.
|
|
|
|
*
|
|
|
|
* A user can view a report by two ways:
|
|
|
|
* - The user created the report (id_user field in treport)
|
2019-01-30 16:18:44 +01:00
|
|
|
* - The report is not private and the user has reading privileges on
|
|
|
|
* the group associated to the report
|
2009-03-25 14:51:52 +01:00
|
|
|
*
|
2009-04-02 14:53:27 +02:00
|
|
|
* @param array Extra filter to retrieve reports. All reports are returned by
|
|
|
|
* default
|
|
|
|
* @param array Fields to be fetched on every report.
|
2009-03-25 14:51:52 +01:00
|
|
|
*
|
|
|
|
* @return array An array with all the reports the user can view.
|
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function reports_get_reports(
|
|
|
|
$filter=false,
|
|
|
|
$fields=false,
|
|
|
|
$returnAllGroup=true,
|
|
|
|
$privileges='RR',
|
|
|
|
$group=false,
|
|
|
|
$strict_user=false
|
|
|
|
) {
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
if (! is_array($filter)) {
|
|
|
|
$filter = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
if (!is_user_admin ($config["id_user"]))
|
|
|
|
$filter[] = sprintf ('private = 0 OR (private = 1 AND id_user = "%s")',
|
|
|
|
$config['id_user']);
|
|
|
|
*/
|
|
|
|
$filter['hidden'] = 0;
|
|
|
|
if (is_array($fields)) {
|
|
|
|
$fields[] = 'id_group';
|
|
|
|
$fields[] = 'id_user';
|
|
|
|
$fields[] = 'id_group_edit';
|
|
|
|
$fields[] = 'hidden';
|
|
|
|
}
|
|
|
|
|
|
|
|
$reports = [];
|
|
|
|
$all_reports = @db_get_all_rows_filter('treport', $filter, $fields);
|
|
|
|
|
|
|
|
if (empty($all_reports)) {
|
|
|
|
$all_reports = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($group) {
|
|
|
|
$groups = $group;
|
|
|
|
} else {
|
|
|
|
// Recheck in all reports if the user have permissions to see each report.
|
|
|
|
$groups = users_get_groups($config['id_user'], $privileges, $returnAllGroup);
|
|
|
|
if ($strict_user) {
|
|
|
|
$groups = users_get_strict_mode_groups($config['id_user'], $returnAllGroup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($all_reports as $report) {
|
|
|
|
// If the report is not in all group.
|
|
|
|
if ($report['id_group'] != 0) {
|
|
|
|
if (!in_array($report['id_group'], array_keys($groups))) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($config['id_user'] != $report['id_user']
|
|
|
|
&& ! check_acl($config['id_user'], $report['id_group'], $privileges)
|
|
|
|
) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
array_push($reports, $report);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $reports;
|
2009-03-25 14:51:52 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2009-03-25 14:51:52 +01:00
|
|
|
/**
|
|
|
|
* Creates a report.
|
|
|
|
*
|
|
|
|
* @param string Report name.
|
|
|
|
* @param int Group where the report will operate.
|
|
|
|
* @param array Extra values to be set. Notice that id_user is automatically
|
|
|
|
* set to the logged user.
|
2019-01-30 16:18:44 +01:00
|
|
|
*
|
2009-03-25 14:51:52 +01:00
|
|
|
* @return mixed New report id if created. False if it could not be created.
|
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function reports_create_report($name, $id_group, $values=false)
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
if (! is_array($values)) {
|
|
|
|
$values = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
$values['name'] = $name;
|
|
|
|
$values['id_group'] = $id_group;
|
|
|
|
$values['id_user'] = $config['id_user'];
|
|
|
|
|
|
|
|
return @db_process_sql_insert('treport', $values);
|
2009-03-25 14:51:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates a report.
|
|
|
|
*
|
|
|
|
* @param int Report id.
|
|
|
|
* @param array Extra values to be set.
|
2019-01-30 16:18:44 +01:00
|
|
|
*
|
|
|
|
* @return boolean True if the report was updated. False otherwise.
|
2009-03-25 14:51:52 +01:00
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function reports_update_report($id_report, $values)
|
|
|
|
{
|
|
|
|
$report = reports_get_report($id_report, false, ['id_report']);
|
|
|
|
if ($report === false) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (@db_process_sql_update(
|
|
|
|
'treport',
|
|
|
|
$values,
|
|
|
|
['id_report' => $id_report]
|
|
|
|
)) !== false;
|
2009-03-25 14:51:52 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2009-03-25 14:51:52 +01:00
|
|
|
/**
|
|
|
|
* Deletes a report.
|
2019-01-30 16:18:44 +01:00
|
|
|
*
|
2009-03-25 14:51:52 +01:00
|
|
|
* @param int Report id to be deleted.
|
|
|
|
*
|
2019-01-30 16:18:44 +01:00
|
|
|
* @return boolean True if deleted, false otherwise.
|
2009-03-25 14:51:52 +01:00
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function reports_delete_report($id_report)
|
|
|
|
{
|
|
|
|
$id_report = safe_int($id_report);
|
|
|
|
if (empty($id_report)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$report = reports_get_report($id_report);
|
|
|
|
if ($report === false) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@db_process_sql_delete('treport_content', ['id_report' => $id_report]);
|
|
|
|
return @db_process_sql_delete('treport', ['id_report' => $id_report]);
|
2009-03-25 14:51:52 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2009-03-25 14:51:52 +01:00
|
|
|
/**
|
|
|
|
* Deletes a content from a report.
|
2019-01-30 16:18:44 +01:00
|
|
|
*
|
2009-03-25 14:51:52 +01:00
|
|
|
* @param int Report content id to be deleted.
|
|
|
|
*
|
2019-01-30 16:18:44 +01:00
|
|
|
* @return boolean True if deleted, false otherwise.
|
2009-03-25 14:51:52 +01:00
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function reports_get_content($id_report_content, $filter=false, $fields=false)
|
|
|
|
{
|
|
|
|
$id_report_content = safe_int($id_report_content);
|
|
|
|
if (empty($id_report_content)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! is_array($filter)) {
|
|
|
|
$filter = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_array($fields)) {
|
|
|
|
$fields[] = 'id_report';
|
|
|
|
}
|
|
|
|
|
|
|
|
$filter['id_rc'] = $id_report_content;
|
|
|
|
|
|
|
|
$content = @db_get_row_filter('treport_content', $filter, $fields);
|
|
|
|
if ($content === false) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$report = reports_get_report($content['id_report']);
|
|
|
|
if ($report === false) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $content;
|
2009-03-25 14:51:52 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2009-03-25 14:51:52 +01:00
|
|
|
/**
|
|
|
|
* Get all the contents of a report.
|
|
|
|
*
|
|
|
|
* @param int Report id to get contents.
|
|
|
|
* @param array Extra filters for the contents.
|
|
|
|
* @param array Fields to be fetched. All fields by default
|
|
|
|
*
|
2019-01-30 16:18:44 +01:00
|
|
|
* @return array All the contents of a report.
|
2009-03-25 14:51:52 +01:00
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function reports_create_content($id_report, $values)
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
$id_report = safe_int($id_report);
|
|
|
|
if (empty($id_report)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$report = reports_get_report($id_report);
|
|
|
|
if ($report === false) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! is_array($values)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$values['id_report'] = $id_report;
|
|
|
|
|
|
|
|
switch ($config['dbtype']) {
|
|
|
|
case 'mysql':
|
|
|
|
unset($values['`order`']);
|
|
|
|
|
|
|
|
$order = (int) db_get_value('MAX(`order`)', 'treport_content', 'id_report', $id_report);
|
|
|
|
$values['`order`'] = ($order + 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'postgresql':
|
|
|
|
case 'oracle':
|
|
|
|
unset($values['"order"']);
|
|
|
|
|
|
|
|
$order = (int) db_get_value('MAX("order")', 'treport_content', 'id_report', $id_report);
|
|
|
|
$values['"order"'] = ($order + 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return @db_process_sql_insert('treport_content', $values);
|
2009-03-25 14:51:52 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2009-03-25 14:51:52 +01:00
|
|
|
/**
|
|
|
|
* Get all the contents of a report.
|
|
|
|
*
|
|
|
|
* @param int Report id to get contents.
|
|
|
|
* @param array Extra filters for the contents.
|
|
|
|
* @param array Fields to be fetched. All fields by default
|
|
|
|
*
|
2019-01-30 16:18:44 +01:00
|
|
|
* @return array All the contents of a report.
|
2009-03-25 14:51:52 +01:00
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function reports_get_contents($id_report, $filter=false, $fields=false)
|
|
|
|
{
|
|
|
|
$id_report = safe_int($id_report);
|
|
|
|
if (empty($id_report)) {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
|
|
|
$report = reports_get_report($id_report);
|
|
|
|
if ($report === false) {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! is_array($filter)) {
|
|
|
|
$filter = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
$filter['id_report'] = $id_report;
|
|
|
|
$filter['order'] = '`order`';
|
|
|
|
|
|
|
|
$contents = db_get_all_rows_filter('treport_content', $filter, $fields);
|
|
|
|
if ($contents === false) {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $contents;
|
2009-03-25 14:51:52 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2009-03-25 14:51:52 +01:00
|
|
|
/**
|
|
|
|
* Moves a content from a report up.
|
2019-01-30 16:18:44 +01:00
|
|
|
*
|
2009-03-25 14:51:52 +01:00
|
|
|
* @param int Report content id to be moved.
|
|
|
|
*
|
2019-01-30 16:18:44 +01:00
|
|
|
* @return boolean True if moved, false otherwise.
|
2009-03-25 14:51:52 +01:00
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function reports_move_content_up($id_report_content)
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
if (empty($id_report_content)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$content = reports_get_content($id_report_content);
|
|
|
|
if ($content === false) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($config['dbtype']) {
|
|
|
|
case 'mysql':
|
|
|
|
$order = db_get_value('`order`', 'treport_content', 'id_rc', $id_report_content);
|
|
|
|
// Set the previous element order to the current of the content we want to change
|
|
|
|
db_process_sql_update(
|
|
|
|
'treport_content',
|
|
|
|
['`order` = `order` + 1'],
|
|
|
|
[
|
|
|
|
'id_report' => $content['id_report'],
|
|
|
|
'`order` = '.($order - 1)
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
return (@db_process_sql_update(
|
|
|
|
'treport_content',
|
|
|
|
['`order` = `order` - 1'],
|
|
|
|
['id_rc' => $id_report_content]
|
|
|
|
)) !== false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case 'postgresql':
|
|
|
|
case 'oracle':
|
|
|
|
$order = db_get_value('"order"', 'treport_content', 'id_rc', $id_report_content);
|
|
|
|
// Set the previous element order to the current of the content we want to change
|
|
|
|
db_process_sql_update(
|
|
|
|
'treport_content',
|
|
|
|
['"order" = "order" + 1'],
|
|
|
|
[
|
|
|
|
'id_report' => $content['id_report'],
|
|
|
|
'"order" = '.($order - 1)
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
return (@db_process_sql_update(
|
|
|
|
'treport_content',
|
|
|
|
['"order" = "order" - 1'],
|
|
|
|
['id_rc' => $id_report_content]
|
|
|
|
)) !== false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2009-03-25 14:51:52 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2009-03-25 14:51:52 +01:00
|
|
|
/**
|
|
|
|
* Moves a content from a report up.
|
2019-01-30 16:18:44 +01:00
|
|
|
*
|
2009-03-25 14:51:52 +01:00
|
|
|
* @param int Report content id to be moved.
|
|
|
|
*
|
2019-01-30 16:18:44 +01:00
|
|
|
* @return boolean True if moved, false otherwise.
|
2009-03-25 14:51:52 +01:00
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function reports_move_content_down($id_report_content)
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
if (empty($id_report_content)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$content = reports_get_content($id_report_content);
|
|
|
|
if ($content === false) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($config['dbtype']) {
|
|
|
|
case 'mysql':
|
|
|
|
$order = db_get_value('`order`', 'treport_content', 'id_rc', $id_report_content);
|
|
|
|
// Set the previous element order to the current of the content we want to change
|
|
|
|
db_process_sql_update(
|
|
|
|
'treport_content',
|
|
|
|
['`order` = `order` - 1'],
|
|
|
|
[
|
|
|
|
'id_report' => (int) $content['id_report'],
|
|
|
|
'`order` = '.($order + 1)
|
|
|
|
]
|
|
|
|
);
|
|
|
|
return (@db_process_sql_update(
|
|
|
|
'treport_content',
|
|
|
|
['`order` = `order` + 1'],
|
|
|
|
['id_rc' => $id_report_content]
|
|
|
|
)) !== false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case 'postgresql':
|
|
|
|
case 'oracle':
|
|
|
|
$order = db_get_value('"order"', 'treport_content', 'id_rc', $id_report_content);
|
|
|
|
// Set the previous element order to the current of the content we want to change
|
|
|
|
db_process_sql_update(
|
|
|
|
'treport_content',
|
|
|
|
['"order" = "order" - 1'],
|
|
|
|
[
|
|
|
|
'id_report' => (int) $content['id_report'],
|
|
|
|
'"order" = '.($order + 1)
|
|
|
|
]
|
|
|
|
);
|
|
|
|
return (@db_process_sql_update(
|
|
|
|
'treport_content',
|
|
|
|
['"order" = "order" + 1'],
|
|
|
|
['id_rc' => $id_report_content]
|
|
|
|
)) !== false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2009-03-25 14:51:52 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2009-03-25 14:51:52 +01:00
|
|
|
/**
|
|
|
|
* Deletes a content from a report.
|
2019-01-30 16:18:44 +01:00
|
|
|
*
|
2009-03-25 14:51:52 +01:00
|
|
|
* @param int Report content id to be deleted.
|
|
|
|
*
|
2019-01-30 16:18:44 +01:00
|
|
|
* @return boolean True if deleted, false otherwise.
|
2009-03-25 14:51:52 +01:00
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function reports_delete_content($id_report_content)
|
|
|
|
{
|
|
|
|
if (empty($id_report_content)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$content = reports_get_content($id_report_content);
|
|
|
|
if ($content === false) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($config['dbtype']) {
|
|
|
|
case 'mysql':
|
|
|
|
$order = db_get_value('`order`', 'treport_content', 'id_rc', $id_report_content);
|
|
|
|
db_process_sql_update(
|
|
|
|
'treport_content',
|
|
|
|
['`order` = `order` - 1'],
|
|
|
|
[
|
|
|
|
'id_report' => (int) $content['id_report'],
|
|
|
|
'`order` > '.$order
|
|
|
|
]
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'postgresql':
|
|
|
|
case 'oracle':
|
|
|
|
$order = db_get_value('"order"', 'treport_content', 'id_rc', $id_report_content);
|
|
|
|
db_process_sql_update(
|
|
|
|
'treport_content',
|
|
|
|
['"order" = "order" - 1'],
|
|
|
|
[
|
|
|
|
'id_report' => (int) $content['id_report'],
|
|
|
|
'"order" > '.$order
|
|
|
|
]
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (@db_process_sql_delete(
|
|
|
|
'treport_content',
|
|
|
|
['id_rc' => $id_report_content]
|
|
|
|
)) !== false;
|
2009-03-25 14:51:52 +01:00
|
|
|
}
|
2012-03-27 09:44:54 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2012-03-27 09:44:54 +02:00
|
|
|
/**
|
|
|
|
* Get report type name from type id.
|
|
|
|
*
|
2019-01-30 16:18:44 +01:00
|
|
|
* @param integer $type Type id of the report.
|
2012-09-04 16:04:46 +02:00
|
|
|
* @param boolean $template Set true for to get types for templates. By default false.
|
2012-03-27 09:44:54 +02:00
|
|
|
*
|
|
|
|
* @return string Report type name.
|
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function get_report_name($type, $template=false)
|
|
|
|
{
|
|
|
|
$types = reports_get_report_types($template);
|
|
|
|
if (! isset($types[$type])) {
|
|
|
|
return __('Unknown');
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($type == 'automatic_custom_graph') {
|
|
|
|
return __('Custom graph');
|
|
|
|
}
|
|
|
|
|
|
|
|
return $types[$type]['name'];
|
2012-03-27 09:44:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get report type data source from type id.
|
|
|
|
*
|
|
|
|
* TODO: Better documentation as to what this function does
|
|
|
|
*
|
|
|
|
* @param mixed $type Type id or type name of the report.
|
|
|
|
*
|
|
|
|
* @return string Report type name.
|
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function get_report_type_data_source($type)
|
|
|
|
{
|
|
|
|
switch ($type) {
|
|
|
|
case 1:
|
|
|
|
case 'simple_graph':
|
|
|
|
case 6:
|
|
|
|
case 'monitor_report':
|
|
|
|
case 7:
|
|
|
|
case 'avg_value':
|
|
|
|
case 8:
|
|
|
|
case 'max_value':
|
|
|
|
case 9:
|
|
|
|
case 'min_value':
|
|
|
|
case 10:
|
|
|
|
case 'sumatory':
|
|
|
|
case 'agent_detailed_event':
|
|
|
|
return 'module';
|
|
|
|
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 'custom_graph':
|
|
|
|
case 'automatic_custom_graph':
|
|
|
|
return 'custom-graph';
|
|
|
|
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
case 'SLA':
|
|
|
|
case 4:
|
|
|
|
case 'event_report':
|
|
|
|
case 5:
|
|
|
|
case 'alert_report':
|
|
|
|
case 11:
|
|
|
|
case 'general_group_report':
|
|
|
|
case 12:
|
|
|
|
case 'monitor_health':
|
|
|
|
case 13:
|
|
|
|
case 'agents_detailed':
|
|
|
|
return 'agent-group';
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 'unknown';
|
2012-03-27 09:44:54 +02:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2012-03-27 09:44:54 +02:00
|
|
|
/**
|
|
|
|
* Get report types in an array.
|
2019-01-30 16:18:44 +01:00
|
|
|
*
|
|
|
|
* @param boolean $template Set true for to get types for templates. By default false.
|
2012-12-18 16:47:11 +01:00
|
|
|
* @param boolean $not_editor When this function is not used in item editors.
|
2019-01-30 16:18:44 +01:00
|
|
|
*
|
2012-03-27 09:44:54 +02:00
|
|
|
* @return array An array with all the possible reports in Pandora where the array index is the report id.
|
|
|
|
*/
|
2019-01-30 16:18:44 +01:00
|
|
|
function reports_get_report_types($template=false, $not_editor=false)
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
$types = [];
|
|
|
|
|
|
|
|
$types['simple_graph'] = [
|
|
|
|
'optgroup' => __('Graphs'),
|
|
|
|
'name' => __('Simple graph'),
|
|
|
|
];
|
|
|
|
$types['simple_baseline_graph'] = [
|
|
|
|
'optgroup' => __('Graphs'),
|
|
|
|
'name' => __('Simple baseline graph'),
|
|
|
|
];
|
|
|
|
if ($not_editor == false) {
|
|
|
|
$types['automatic_custom_graph'] = [
|
|
|
|
'optgroup' => __('Graphs'),
|
|
|
|
'name' => __('Custom graph'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
$types['custom_graph'] = [
|
|
|
|
'optgroup' => __('Graphs'),
|
|
|
|
'name' => __('Custom graph'),
|
|
|
|
];
|
|
|
|
// Only pandora managers have access to the whole database
|
|
|
|
if (check_acl($config['id_user'], 0, 'PM')) {
|
|
|
|
$types['sql_graph_vbar'] = [
|
|
|
|
'optgroup' => __('Graphs'),
|
|
|
|
'name' => __('SQL vertical bar graph'),
|
|
|
|
];
|
|
|
|
$types['sql_graph_pie'] = [
|
|
|
|
'optgroup' => __('Graphs'),
|
|
|
|
'name' => __('SQL pie graph'),
|
|
|
|
];
|
|
|
|
$types['sql_graph_hbar'] = [
|
|
|
|
'optgroup' => __('Graphs'),
|
|
|
|
'name' => __('SQL horizonal bar graph'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($template) {
|
|
|
|
$types['automatic_graph'] = [
|
|
|
|
'optgroup' => __('Graphs'),
|
|
|
|
'name' => __('Automatic combined Graph'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
$types['availability_graph'] = [
|
|
|
|
'optgroup' => __('Graphs'),
|
|
|
|
'name' => __('Availability graph'),
|
|
|
|
];
|
|
|
|
|
|
|
|
$types['module_histogram_graph'] = [
|
|
|
|
'optgroup' => __('Graphs'),
|
|
|
|
'name' => __('Module Histogram graph'),
|
|
|
|
];
|
|
|
|
|
|
|
|
$types['SLA'] = [
|
|
|
|
'optgroup' => __('SLA'),
|
|
|
|
'name' => __('S.L.A.'),
|
|
|
|
];
|
|
|
|
if ($config['enterprise_installed']) {
|
|
|
|
$types['SLA_monthly'] = [
|
|
|
|
'optgroup' => __('SLA'),
|
|
|
|
'name' => __('Monthly S.L.A.'),
|
|
|
|
];
|
|
|
|
$types['SLA_weekly'] = [
|
|
|
|
'optgroup' => __('SLA'),
|
|
|
|
'name' => __('Weekly S.L.A.'),
|
|
|
|
];
|
|
|
|
$types['SLA_hourly'] = [
|
|
|
|
'optgroup' => __('SLA'),
|
|
|
|
'name' => __('Hourly S.L.A.'),
|
|
|
|
];
|
|
|
|
|
|
|
|
if (!$config['metaconsole'] && !$template) {
|
|
|
|
$types['SLA_services'] = [
|
|
|
|
'optgroup' => __('SLA'),
|
|
|
|
'name' => __('Services S.L.A.'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$types['prediction_date'] = [
|
|
|
|
'optgroup' => __('Forecasting'),
|
|
|
|
'name' => __('Prediction date'),
|
|
|
|
];
|
|
|
|
$types['projection_graph'] = [
|
|
|
|
'optgroup' => __('Forecasting'),
|
|
|
|
'name' => __('Projection graph'),
|
|
|
|
];
|
|
|
|
|
|
|
|
$types['avg_value'] = [
|
|
|
|
'optgroup' => __('Modules'),
|
|
|
|
'name' => __('Avg. Value'),
|
|
|
|
];
|
|
|
|
$types['max_value'] = [
|
|
|
|
'optgroup' => __('Modules'),
|
|
|
|
'name' => __('Max. Value'),
|
|
|
|
];
|
|
|
|
$types['min_value'] = [
|
|
|
|
'optgroup' => __('Modules'),
|
|
|
|
'name' => __('Min. Value'),
|
|
|
|
];
|
|
|
|
$types['monitor_report'] = [
|
|
|
|
'optgroup' => __('Modules'),
|
|
|
|
'name' => __('Monitor report'),
|
|
|
|
];
|
|
|
|
$types['database_serialized'] = [
|
|
|
|
'optgroup' => __('Modules'),
|
|
|
|
'name' => __('Serialize data'),
|
|
|
|
];
|
|
|
|
$types['sumatory'] = [
|
|
|
|
'optgroup' => __('Modules'),
|
|
|
|
'name' => __('Summatory'),
|
|
|
|
];
|
|
|
|
$types['historical_data'] = [
|
|
|
|
'optgroup' => __('Modules'),
|
|
|
|
'name' => __('Historical Data'),
|
|
|
|
];
|
|
|
|
$types['increment'] = [
|
|
|
|
'optgroup' => __('Modules'),
|
|
|
|
'name' => __('Increment'),
|
|
|
|
];
|
|
|
|
|
|
|
|
$types['general'] = [
|
|
|
|
'optgroup' => __('Grouped'),
|
|
|
|
'name' => __('General'),
|
|
|
|
];
|
2019-10-22 15:41:13 +02:00
|
|
|
if (is_metaconsole()) {
|
|
|
|
if ($template === false) {
|
|
|
|
$types['group_report'] = [
|
|
|
|
'optgroup' => __('Grouped'),
|
|
|
|
'name' => __('Group report'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$types['group_report'] = [
|
|
|
|
'optgroup' => __('Grouped'),
|
|
|
|
'name' => __('Group report'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$types['exception'] = [
|
|
|
|
'optgroup' => __('Grouped'),
|
|
|
|
'name' => __('Exception'),
|
|
|
|
];
|
|
|
|
if ($config['metaconsole'] != 1) {
|
2019-09-26 10:32:36 +02:00
|
|
|
if (!$template) {
|
|
|
|
$types['agent_module'] = [
|
|
|
|
'optgroup' => __('Grouped'),
|
|
|
|
'name' => __('Agents/Modules'),
|
|
|
|
];
|
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
|
2019-09-26 10:32:36 +02:00
|
|
|
// Only pandora managers have access to the whole database.
|
2019-01-30 16:18:44 +01:00
|
|
|
if (check_acl($config['id_user'], 0, 'PM')) {
|
|
|
|
$types['sql'] = [
|
|
|
|
'optgroup' => __('Grouped'),
|
|
|
|
'name' => __('SQL query'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
$types['top_n'] = [
|
|
|
|
'optgroup' => __('Grouped'),
|
|
|
|
'name' => __('Top n'),
|
|
|
|
];
|
|
|
|
$types['network_interfaces_report'] = [
|
|
|
|
'optgroup' => __('Grouped'),
|
|
|
|
'name' => __('Network interfaces'),
|
|
|
|
];
|
|
|
|
$types['availability'] = [
|
|
|
|
'optgroup' => __('Grouped'),
|
|
|
|
'name' => __('Availability'),
|
|
|
|
];
|
|
|
|
|
|
|
|
$types['text'] = [
|
|
|
|
'optgroup' => __('Text/HTML '),
|
|
|
|
'name' => __('Text'),
|
|
|
|
];
|
|
|
|
$types['url'] = [
|
|
|
|
'optgroup' => __('Text/HTML '),
|
|
|
|
'name' => __('Import text from URL'),
|
|
|
|
];
|
|
|
|
|
|
|
|
$types['alert_report_module'] = [
|
|
|
|
'optgroup' => __('Alerts'),
|
2019-12-12 18:12:42 +01:00
|
|
|
'name' => __('Module alert report'),
|
2019-01-30 16:18:44 +01:00
|
|
|
];
|
|
|
|
$types['alert_report_agent'] = [
|
|
|
|
'optgroup' => __('Alerts'),
|
2019-12-12 18:12:42 +01:00
|
|
|
'name' => __('Agent alert report '),
|
2019-01-30 16:18:44 +01:00
|
|
|
];
|
|
|
|
if (!$template) {
|
|
|
|
$types['alert_report_group'] = [
|
|
|
|
'optgroup' => __('Alerts'),
|
2019-12-12 18:12:42 +01:00
|
|
|
'name' => __('Group alert report'),
|
2019-01-30 16:18:44 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2019-12-12 18:12:42 +01:00
|
|
|
$types['event_report_module'] = [
|
2019-01-30 16:18:44 +01:00
|
|
|
'optgroup' => __('Events'),
|
2019-12-12 18:12:42 +01:00
|
|
|
'name' => __('Module event report'),
|
2019-01-30 16:18:44 +01:00
|
|
|
];
|
2019-12-12 18:12:42 +01:00
|
|
|
$types['event_report_agent'] = [
|
2019-01-30 16:18:44 +01:00
|
|
|
'optgroup' => __('Events'),
|
2019-12-12 18:12:42 +01:00
|
|
|
'name' => __('Agent event report'),
|
2019-01-30 16:18:44 +01:00
|
|
|
];
|
|
|
|
$types['event_report_group'] = [
|
|
|
|
'optgroup' => __('Events'),
|
2019-12-12 18:12:42 +01:00
|
|
|
'name' => __('Group event report'),
|
2019-01-30 16:18:44 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
if ($config['enterprise_installed']) {
|
|
|
|
$types['inventory'] = [
|
|
|
|
'optgroup' => __('Inventory'),
|
|
|
|
'name' => __('Inventory'),
|
|
|
|
];
|
|
|
|
if (!$template) {
|
|
|
|
$types['inventory_changes'] = [
|
|
|
|
'optgroup' => __('Inventory'),
|
|
|
|
'name' => __('Inventory changes'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$template) {
|
|
|
|
$types['agent_configuration'] = [
|
|
|
|
'optgroup' => __('Configuration'),
|
|
|
|
'name' => __('Agent configuration'),
|
|
|
|
];
|
|
|
|
$types['group_configuration'] = [
|
|
|
|
'optgroup' => __('Configuration'),
|
|
|
|
'name' => __('Group configuration'),
|
|
|
|
];
|
|
|
|
$types['netflow_area'] = [
|
|
|
|
'optgroup' => __('Netflow'),
|
|
|
|
'name' => __('Netflow area chart'),
|
|
|
|
];
|
|
|
|
$types['netflow_data'] = [
|
|
|
|
'optgroup' => __('Netflow'),
|
|
|
|
'name' => __('Netflow data table'),
|
|
|
|
];
|
|
|
|
$types['netflow_summary'] = [
|
|
|
|
'optgroup' => __('Netflow'),
|
|
|
|
'name' => __('Netflow summary table'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2019-10-22 15:41:13 +02:00
|
|
|
if ($config['enterprise_installed'] && $template === false) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$types['event_report_log'] = [
|
|
|
|
'optgroup' => __('Log'),
|
|
|
|
'name' => __('Log report'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2019-12-12 18:12:42 +01:00
|
|
|
if (!is_metaconsole()) {
|
|
|
|
$types['nt_top_n'] = [
|
|
|
|
'optgroup' => __('Network traffic'),
|
|
|
|
'name' => __('Network Traffic Top N'),
|
|
|
|
];
|
|
|
|
}
|
2019-02-21 17:21:42 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
return $types;
|
2012-03-27 09:44:54 +02:00
|
|
|
}
|