2011-03-30 14:34:25 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2011 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation; version 2
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
2012-06-25 12:42:52 +02:00
|
|
|
include_once($config['homedir'] . "/include/graphs/fgraph.php");
|
|
|
|
include_once($config['homedir'] . "/include/functions_reporting.php");
|
* include/functions_graph.php
include/functions_html.php
include/functions_messages.php
include/db/postgresql.php
include/db/mysql.php
include/db/oracle.php
include/functions_reporting.php
include/functions_filemanager.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/ajax/skins.ajax.php
include/ajax/reporting.ajax.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/help/en/help_timesource.php
include/help/es/help_timesource.php
include/help/ja/help_timesource.php
include/config_process.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_incidents.php
include/api.php
include/functions_reports.php
include/functions_ui_renders.php
extensions/insert_data.php
extensions/system_info.php
extensions/extension_uploader.php
extensions/pandora_logs.php
extensions/agents_modules.php
extensions/update_manager.php
extensions/ssh_console.php
extensions/dbmanager.php
extensions/vnc_view.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/users_connected.php
extensions/module_groups.php
extensions/update_manager/load_updatemanager.php
extensions/update_manager/lib/libupdate_manager_client.php
extensions/update_manager/lib/libupdate_manager.php
extensions/update_manager/lib/libupdate_manager_components.php
extensions/update_manager/lib/libupdate_manager_updates.php
extensions/update_manager/settings.php
extensions/update_manager/main.php
extensions/plugin_registration.php
operation/incidents/incident.php
operation/incidents/incident_detail.php
operation/incidents/incident_statistics.php
operation/search_modules.php
operation/visual_console/render_view.php
operation/visual_console/index.php
operation/extensions.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/custom_fields.php
operation/agentes/estado_agente.php
operation/agentes/networkmap.topology.php
operation/agentes/networkmap.groups.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/gis_view.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.php
operation/agentes/graphs.php
operation/agentes/agent_fields.php
operation/agentes/tactical.php
operation/agentes/group_view.php
operation/agentes/networkmap.php
operation/agentes/stat_win.php
operation/servers/view_server.php
operation/servers/view_server_detail.php
operation/menu.php
operation/search_agents.php
operation/search_graphs.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/integria_incidents/incident.php
operation/integria_incidents/incident_detail.php
operation/integria_incidents/incident_statistics.php
operation/events/event_statistics.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/sound_events.php
operation/events/events_validate.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
operation/reporting/graph_viewer.php
operation/search_reports.php
operation/search_maps.php
operation/search_users.php
extras/pandora_diag.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
mobile/index.php
general/error_authconfig.php
general/links_menu.php
general/logon_ok.php
general/error_dbconfig.php
general/ui/agents_list.php
general/header.php
godmode/groups/modu_group_list.php
godmode/groups/configure_group.php
godmode/groups/configure_modu_group.php
godmode/groups/group_list.php
godmode/admin_access_logs.php
godmode/db/db_main.php
godmode/db/db_audit.php
godmode/db/db_sanity.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_event.php
godmode/db/db_purge.php
godmode/extensions.php
godmode/agentes/agent_template.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/fields_manager.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/configure_field.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/recon_script.php
godmode/servers/plugin.php
godmode/servers/manage_recontask.php
godmode/servers/modificar_server.php
godmode/servers/manage_recontask_form.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.php
godmode/alerts/alert_list.php
godmode/alerts/configure_alert_template.php
godmode/alerts/alert_templates.php
godmode/alerts/configure_alert_action.php
godmode/alerts/configure_alert_command.php
godmode/alerts/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/alerts/alert_commands.php
godmode/setup/file_manager.php
godmode/setup/os.list.php
godmode/setup/news.php
godmode/setup/gis_step_2.php
godmode/setup/links.php
godmode/setup/setup.php
godmode/setup/os.php
godmode/setup/performance.php
godmode/setup/setup_auth.php
godmode/setup/gis.php
godmode/setup/os.builder.php
godmode/setup/setup_visuals.php
godmode/snmpconsole/snmp_alert.php
godmode/snmpconsole/snmp_filters.php
godmode/users/user_list.php
godmode/users/configure_profile.php
godmode/gis_maps/configure_gis_map.php
godmode/gis_maps/index.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_operations.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_modules.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/modules/manage_network_components_form.php
godmode/modules/manage_nc_groups_form.php
godmode/modules/manage_network_templates.php
godmode/modules/module_list.php
godmode/modules/manage_network_components_form_common.php
godmode/modules/manage_network_components_form_network.php
godmode/modules/manage_network_templates_form.php
godmode/modules/manage_network_components_form_wmi.php
godmode/modules/manage_network_components.php
godmode/modules/manage_nc_groups.php
godmode/reporting/visual_console_builder.wizard.php
godmode/reporting/graph_builder.main.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.php
godmode/reporting/reporting_builder.preview.php
godmode/reporting/reporting_builder.main.php
godmode/reporting/visual_console_builder.data.php
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/graph_builder.php
godmode/reporting/visual_console_builder.preview.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/visual_console_builder.editor.php
godmode/reporting/reporting_builder.item_editor.php
godmode/reporting/map_builder.php
godmode/reporting/graphs.php
godmode/reporting/graph_builder.preview.php
include/functions_db.php: Added some includes and functions of this code have "db_" prefix.
* include/functions.php: Moved function check_login(), check_acl(),
dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php.
* include/functions_groups.php: Moved functions get_childrens(), safe_acl_group()
and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(),
get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(),
get_group_name(), get_group_users() from functions_db.php to this code.
* include/functions_profile.php: New library with profile functions. Moved functions
get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(),
delete_profile() from functions_db.php to this code. Added new parameter in function
get_profile() to retrieve profiles with filter conditions applied.
* include/functions_users.php: New library with users functions. Moved functions
get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(),
get_user_first_group(), user_access_to_agent() from funtions_db.php to this code.
* godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile().
* include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(),
get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(),
check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(),
agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(),
get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(),
get_agent_group() from functions_db.php to this code.
* include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(),
get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(),
get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(),
get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(),
get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(),
get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(),
give_modulecategory_name(),
give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(),
get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(),
get_modulegroup_name() from functions_db.php to this code.
* include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(),
get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(),
get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(),
get_agentmodule_last_status() from functions_db.php to this code.
* include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion()
from functions_db.php to this code.
* include/functions_events.php: Moved functions get_group_events(), get_agent_events(),
get_module_events() from functions_db.php to this code.
* include/functions_servers.php: Moved functions get_server_name(), show_server_type(),
check_server_status(), server_status() from functions_db.php to this code.
* include/functions_network_profiles.php: Moved function get_networkprofile_name()
from functions_db.php to this code.
* include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y()
from fucntions_db.php to this code.
* include/functions_io.php: Moved function __() from functions_db.php to this code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-19 20:42:49 +02:00
|
|
|
include_once($config['homedir'] . "/include/functions_agents.php");
|
|
|
|
include_once($config['homedir'] . "/include/functions_modules.php");
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
include_once($config['homedir'] . "/include/functions_users.php");
|
2011-03-30 14:34:25 +02:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
function get_graph_statistics ($chart_array) {
|
2016-10-18 16:32:39 +02:00
|
|
|
global $config;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
/// IMPORTANT!
|
|
|
|
///
|
|
|
|
/// The calculus for AVG, MIN and MAX values are in this function
|
2018-02-27 16:28:00 +01:00
|
|
|
/// because it must be done based on graph array data not using reporting
|
2013-01-30 17:29:49 +01:00
|
|
|
/// function to get coherent data between stats and graph visualization
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
$stats = array ();
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
$count = 0;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
$size = sizeof($chart_array);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
//Initialize stats array
|
|
|
|
$stats = array ("avg" => 0, "min" => null, "max" => null, "last" => 0);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
foreach ($chart_array as $item) {
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
//Sum all values later divide by the number of elements
|
2013-01-30 17:29:49 +01:00
|
|
|
$stats['avg'] = $stats['avg'] + $item;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
//Get minimum
|
|
|
|
if ($stats['min'] == null) {
|
2012-10-02 11:07:20 +02:00
|
|
|
$stats['min'] = $item;
|
2013-01-30 17:29:49 +01:00
|
|
|
}
|
|
|
|
else if ($item < $stats['min']) {
|
|
|
|
$stats['min'] = $item;
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
//Get maximum
|
|
|
|
if ($stats['max'] == null) {
|
|
|
|
$stats['max'] = $item;
|
|
|
|
}
|
|
|
|
else if ($item > $stats['max']) {
|
|
|
|
$stats['max'] = $item;
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
$count++;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
//Get last data
|
|
|
|
if ($count == $size) {
|
|
|
|
$stats['last'] = $item;
|
|
|
|
}
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
//End the calculus for average
|
|
|
|
if ($count > 0) {
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
$stats['avg'] = $stats['avg'] / $count;
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
//Format stat data to display properly
|
2016-10-20 10:47:12 +02:00
|
|
|
$stats['last'] = remove_right_zeros(number_format($stats['last'], $config['graph_precision']));
|
|
|
|
$stats['avg'] = remove_right_zeros(number_format($stats['avg'], $config['graph_precision']));
|
|
|
|
$stats['min'] = remove_right_zeros(number_format($stats['min'], $config['graph_precision']));
|
|
|
|
$stats['max'] = remove_right_zeros(number_format($stats['max'], $config['graph_precision']));
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
return $stats;
|
|
|
|
}
|
|
|
|
|
2012-12-05 12:41:52 +01:00
|
|
|
function get_statwin_graph_statistics ($chart_array, $series_suffix = '') {
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
/// IMPORTANT!
|
|
|
|
///
|
|
|
|
/// The calculus for AVG, MIN and MAX values are in this function
|
2018-02-27 16:28:00 +01:00
|
|
|
/// because it must be done based on graph array data not using reporting
|
2012-10-02 11:07:20 +02:00
|
|
|
/// function to get coherent data between stats and graph visualization
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
$stats = array ();
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
$count = 0;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
$size = sizeof($chart_array);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
//Initialize stats array
|
|
|
|
$stats['sum'] = array ("avg" => 0, "min" => null, "max" => null, "last" => 0);
|
|
|
|
$stats['min'] = array ("avg" => 0, "min" => null, "max" => null, "last" => 0);
|
2013-02-06 15:03:32 +01:00
|
|
|
$stats['max'] = array ("avg" => 0, "min" => null, "max" => null, "last" => 0);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
foreach ($chart_array as $item) {
|
2013-07-22 16:33:37 +02:00
|
|
|
if ($series_suffix != '') {
|
2014-10-13 15:50:35 +02:00
|
|
|
if (isset($item['sum' . $series_suffix]))
|
|
|
|
$item['sum'] = $item['sum' . $series_suffix];
|
|
|
|
if (isset($item['min' . $series_suffix]))
|
|
|
|
$item['min'] = $item['min' . $series_suffix];
|
|
|
|
if (isset($item['max' . $series_suffix]))
|
|
|
|
$item['max'] = $item['max' . $series_suffix];
|
2012-12-05 12:41:52 +01:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-12-26 17:43:05 +01:00
|
|
|
//Get stats for normal graph
|
2012-11-28 19:29:24 +01:00
|
|
|
if (isset($item['sum']) && $item['sum']) {
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
//Sum all values later divide by the number of elements
|
|
|
|
$stats['sum']['avg'] = $stats['sum']['avg'] + $item['sum'];
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
//Get minimum
|
|
|
|
if ($stats['sum']['min'] == null) {
|
|
|
|
$stats['sum']['min'] = $item['sum'];
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
}
|
|
|
|
else if ($item['sum'] < $stats['sum']['min']) {
|
2012-10-02 11:07:20 +02:00
|
|
|
$stats['sum']['min'] = $item['sum'];
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
//Get maximum
|
|
|
|
if ($stats['sum']['max'] == null) {
|
2013-02-06 15:03:32 +01:00
|
|
|
$stats['sum']['max'] = $item['sum'];
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
}
|
|
|
|
else if ($item['sum'] > $stats['sum']['max']) {
|
2013-02-06 15:03:32 +01:00
|
|
|
$stats['sum']['max'] = $item['sum'];
|
2012-12-05 12:41:52 +01:00
|
|
|
}
|
2012-10-02 11:07:20 +02:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
//Get stats for min graph
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
if (isset($item['min']) && $item['min']) {
|
2012-11-28 19:29:24 +01:00
|
|
|
//Sum all values later divide by the number of elements
|
|
|
|
$stats['min']['avg'] = $stats['min']['avg'] + $item['min'];
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-11-28 19:29:24 +01:00
|
|
|
//Get minimum
|
|
|
|
if ($stats['min']['min'] == null) {
|
2013-02-06 15:03:32 +01:00
|
|
|
$stats['min']['min'] = $item['min'];
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
}
|
|
|
|
else if ($item['min'] < $stats['min']['min']) {
|
2013-02-06 15:03:32 +01:00
|
|
|
$stats['min']['min'] = $item['min'];
|
2012-11-28 19:29:24 +01:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-11-28 19:29:24 +01:00
|
|
|
//Get maximum
|
|
|
|
if ($stats['min']['max'] == null) {
|
2013-02-06 15:03:32 +01:00
|
|
|
$stats['min']['max'] = $item['min'];
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
}
|
|
|
|
else if ($item['min'] > $stats['min']['max']) {
|
2013-02-06 15:03:32 +01:00
|
|
|
$stats['min']['max'] = $item['min'];
|
2012-11-28 19:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
//Get stats for max graph
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
if (isset($item['max']) && $item['max']) {
|
2012-11-28 19:29:24 +01:00
|
|
|
//Sum all values later divide by the number of elements
|
|
|
|
$stats['max']['avg'] = $stats['max']['avg'] + $item['max'];
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-11-28 19:29:24 +01:00
|
|
|
//Get minimum
|
|
|
|
if ($stats['max']['min'] == null) {
|
2013-02-06 15:03:32 +01:00
|
|
|
$stats['max']['min'] = $item['max'];
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
}
|
|
|
|
else if ($item['max'] < $stats['max']['min']) {
|
2013-02-06 15:03:32 +01:00
|
|
|
$stats['max']['min'] = $item['max'];
|
2012-11-28 19:29:24 +01:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-11-28 19:29:24 +01:00
|
|
|
//Get maximum
|
|
|
|
if ($stats['max']['max'] == null) {
|
2013-02-06 15:03:32 +01:00
|
|
|
$stats['max']['max'] = $item['max'];
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
}
|
|
|
|
else if ($item['max'] > $stats['max']['max']) {
|
2013-02-06 15:03:32 +01:00
|
|
|
$stats['max']['max'] = $item['max'];
|
2012-11-28 19:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
//Count elements
|
|
|
|
$count++;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
//Get last data
|
|
|
|
if ($count == $size) {
|
2012-11-28 19:29:24 +01:00
|
|
|
if (isset($item['sum']) && $item['sum']) {
|
2012-10-02 11:07:20 +02:00
|
|
|
$stats['sum']['last'] = $item['sum'];
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-12-26 17:43:05 +01:00
|
|
|
if (isset($item['min']) && $item['min']) {
|
2012-10-02 11:07:20 +02:00
|
|
|
$stats['min']['last'] = $item['min'];
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-11-28 19:29:24 +01:00
|
|
|
if (isset($item['max']) && $item['max']) {
|
2012-10-02 11:07:20 +02:00
|
|
|
$stats['max']['last'] = $item['max'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
//End the calculus for average
|
|
|
|
if ($count > 0) {
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
$stats['sum']['avg'] = $stats['sum']['avg'] / $count;
|
|
|
|
$stats['min']['avg'] = $stats['min']['avg'] / $count;
|
|
|
|
$stats['max']['avg'] = $stats['max']['avg'] / $count;
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
//Format stat data to display properly
|
|
|
|
$stats['sum']['last'] = round($stats['sum']['last'], 2);
|
|
|
|
$stats['sum']['avg'] = round($stats['sum']['avg'], 2);
|
2013-02-06 15:03:32 +01:00
|
|
|
$stats['sum']['min'] = round($stats['sum']['min'], 2);
|
|
|
|
$stats['sum']['max'] = round($stats['sum']['max'], 2);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
$stats['min']['last'] = round($stats['min']['last'], 2);
|
2013-02-06 15:03:32 +01:00
|
|
|
$stats['min']['avg'] = round($stats['min']['avg'], 2);
|
|
|
|
$stats['min']['min'] = round($stats['min']['min'], 2);
|
|
|
|
$stats['min']['max'] = round($stats['min']['max'], 2);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
$stats['max']['last'] = round($stats['max']['last'], 2);
|
2013-02-06 15:03:32 +01:00
|
|
|
$stats['max']['avg'] = round($stats['max']['avg'], 2);
|
|
|
|
$stats['max']['min'] = round($stats['max']['min'], 2);
|
|
|
|
$stats['max']['max'] = round($stats['max']['max'], 2);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-10-02 11:07:20 +02:00
|
|
|
return $stats;
|
|
|
|
}
|
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
function grafico_modulo_sparse_data_chart (
|
2018-02-21 11:54:24 +01:00
|
|
|
$agent_module_id,
|
|
|
|
$date_array,
|
|
|
|
$data_module_graph,
|
2018-05-28 17:47:40 +02:00
|
|
|
$params,
|
2018-02-21 11:54:24 +01:00
|
|
|
$series_suffix
|
|
|
|
) {
|
|
|
|
|
|
|
|
global $config;
|
|
|
|
|
2018-05-30 17:45:17 +02:00
|
|
|
if( $data_module_graph['id_module_type'] == 23 ||
|
|
|
|
$data_module_graph['id_module_type'] == 3 ||
|
|
|
|
$data_module_graph['id_module_type'] == 17 ||
|
|
|
|
$data_module_graph['id_module_type'] == 10 ||
|
|
|
|
$data_module_graph['id_module_type'] == 33 ){
|
|
|
|
|
|
|
|
//XXXXXXXXXXX
|
|
|
|
/*
|
|
|
|
"SELECT count(*) as data, min(utimestamp) as utimestamp
|
|
|
|
FROM tagente_datos_string
|
|
|
|
WHERE id_agente_modulo = 227
|
|
|
|
AND utimestamp > 1527584831
|
|
|
|
AND utimestamp < 1527671231
|
|
|
|
GROUP by ROUND(utimestamp / 300);"
|
|
|
|
*/
|
|
|
|
$data = db_get_all_rows_filter (
|
|
|
|
'tagente_datos_string',
|
|
|
|
array ('id_agente_modulo' => (int)$agent_module_id,
|
|
|
|
"utimestamp > '". $date_array['start_date']. "'",
|
|
|
|
"utimestamp < '". $date_array['final_date'] . "'",
|
|
|
|
'group' => "ROUND(utimestamp / 300)",
|
|
|
|
'order' => 'utimestamp ASC'),
|
|
|
|
array ('count(*) as datos', 'min(utimestamp) as utimestamp'),
|
|
|
|
'AND',
|
|
|
|
$data_module_graph['history_db']
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$data = db_get_all_rows_filter (
|
|
|
|
'tagente_datos',
|
|
|
|
array ('id_agente_modulo' => (int)$agent_module_id,
|
|
|
|
"utimestamp > '". $date_array['start_date']. "'",
|
|
|
|
"utimestamp < '". $date_array['final_date'] . "'",
|
|
|
|
'order' => 'utimestamp ASC'),
|
|
|
|
array ('datos', 'utimestamp'),
|
|
|
|
'AND',
|
|
|
|
$data_module_graph['history_db']
|
|
|
|
);
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
|
|
|
if($data === false){
|
|
|
|
$data = array();
|
|
|
|
}
|
2018-02-21 11:54:24 +01:00
|
|
|
|
|
|
|
// Get previous data
|
|
|
|
$previous_data = modules_get_previous_data (
|
2018-02-27 16:28:00 +01:00
|
|
|
$agent_module_id,
|
|
|
|
$date_array['start_date']
|
|
|
|
);
|
2018-02-21 11:54:24 +01:00
|
|
|
|
|
|
|
if ($previous_data !== false) {
|
|
|
|
$previous_data['utimestamp'] = $date_array['start_date'];
|
|
|
|
unset($previous_data['id_agente_modulo']);
|
|
|
|
array_unshift ($data, $previous_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get next data
|
|
|
|
$nextData = modules_get_next_data (
|
2018-02-27 16:28:00 +01:00
|
|
|
$agent_module_id,
|
|
|
|
$date_array['final_date']
|
|
|
|
);
|
2018-02-21 11:54:24 +01:00
|
|
|
|
|
|
|
if ($nextData !== false) {
|
|
|
|
unset($nextData['id_agente_modulo']);
|
|
|
|
array_push ($data, $nextData);
|
|
|
|
}
|
|
|
|
else if (count ($data) > 0) {
|
|
|
|
// Propagate the last known data to the end of the interval
|
|
|
|
$nextData = array(
|
|
|
|
'datos' => $data[count($data)-1]['datos'],
|
2018-02-27 16:28:00 +01:00
|
|
|
'utimestamp' => $date_array['final_date'],
|
2018-02-21 11:54:24 +01:00
|
|
|
);
|
|
|
|
array_push ($data, $nextData);
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-02-21 11:54:24 +01:00
|
|
|
// Check available data
|
|
|
|
if (count ($data) < 1) {
|
2018-02-27 16:28:00 +01:00
|
|
|
//return fs_error_image ();
|
|
|
|
return false;
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-02-21 11:54:24 +01:00
|
|
|
$array_data = array();
|
|
|
|
$min_value = PHP_INT_MAX-1;
|
|
|
|
$max_value = PHP_INT_MIN+1;
|
|
|
|
$array_percentil = array();
|
|
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
|
//convert array
|
2018-05-28 17:47:40 +02:00
|
|
|
if($params['flag_overlapped']){
|
2018-02-21 11:54:24 +01:00
|
|
|
$array_data["sum" . $series_suffix]['data'][$k] = array(
|
|
|
|
($v['utimestamp'] + $date_array['period'] )* 1000,
|
|
|
|
$v['datos']
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$array_data["sum" . $series_suffix]['data'][$k] = array(
|
|
|
|
$v['utimestamp'] * 1000,
|
|
|
|
$v['datos']
|
|
|
|
);
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-02-21 11:54:24 +01:00
|
|
|
//min
|
|
|
|
if($min_value > $v['datos']){
|
|
|
|
$min_value = $v['datos'];
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-02-21 11:54:24 +01:00
|
|
|
//max
|
|
|
|
if($max_value < $v['datos']){
|
|
|
|
$max_value = $v['datos'];
|
|
|
|
}
|
|
|
|
|
|
|
|
//avg
|
|
|
|
$sum_data += $v['datos'];
|
|
|
|
$count_data++;
|
|
|
|
|
|
|
|
//percentil
|
2018-05-28 17:47:40 +02:00
|
|
|
if (!is_null($params['percentil']) && $params['percentil']) {
|
2018-02-21 11:54:24 +01:00
|
|
|
$array_percentil[] = $v['datos'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
$array_data["sum" . $series_suffix]['min'] = $min_value;
|
|
|
|
$array_data["sum" . $series_suffix]['max'] = $max_value;
|
|
|
|
$array_data["sum" . $series_suffix]['avg'] = $sum_data/$count_data;
|
|
|
|
$array_data["sum" . $series_suffix]['agent_module_id']= $agent_module_id;
|
|
|
|
$array_data["sum" . $series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
|
|
|
|
$array_data["sum" . $series_suffix]['agent_name'] = $data_module_graph['agent_name'];
|
|
|
|
$array_data["sum" . $series_suffix]['module_name'] = $data_module_graph['module_name'];
|
2018-05-18 14:22:39 +02:00
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
if (!is_null($params['percentil']) &&
|
|
|
|
$params['percentil'] &&
|
|
|
|
!$params['flag_overlapped']) {
|
|
|
|
$percentil_result = get_percentile($params['percentil'], $array_percentil);
|
2018-02-21 11:54:24 +01:00
|
|
|
$array_data["percentil" . $series_suffix]['data'][0] = array(
|
2018-02-27 16:28:00 +01:00
|
|
|
$date_array['start_date'] * 1000,
|
2018-02-21 11:54:24 +01:00
|
|
|
$percentil_result
|
|
|
|
);
|
|
|
|
$array_data["percentil" . $series_suffix]['data'][1] = array(
|
2018-02-27 16:28:00 +01:00
|
|
|
$date_array['final_date'] * 1000,
|
2018-02-21 11:54:24 +01:00
|
|
|
$percentil_result
|
|
|
|
);
|
2018-06-06 11:18:39 +02:00
|
|
|
$array_data["percentil" . $series_suffix]['agent_module_id'] = $agent_module_id;
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
|
|
|
return $array_data;
|
|
|
|
}
|
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
function grafico_modulo_sparse_data(
|
|
|
|
$agent_module_id, $date_array,
|
2018-05-28 17:47:40 +02:00
|
|
|
$data_module_graph, $params,
|
2018-06-06 11:18:39 +02:00
|
|
|
$series_suffix) {
|
2018-02-16 13:41:31 +01:00
|
|
|
|
2018-02-12 13:29:25 +01:00
|
|
|
global $config;
|
2018-02-28 08:46:51 +01:00
|
|
|
global $array_events_alerts;
|
2018-02-16 13:41:31 +01:00
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
if($params['fullscale']){
|
2018-02-27 16:28:00 +01:00
|
|
|
$array_data = fullscale_data(
|
2018-02-21 11:54:24 +01:00
|
|
|
$agent_module_id,
|
|
|
|
$date_array,
|
2018-05-28 17:47:40 +02:00
|
|
|
$params['show_unknown'],
|
|
|
|
$params['percentil'],
|
2018-02-21 11:54:24 +01:00
|
|
|
$series_suffix,
|
2018-05-28 17:47:40 +02:00
|
|
|
$params['flag_overlapped']
|
2018-02-16 13:41:31 +01:00
|
|
|
);
|
2018-06-06 11:18:39 +02:00
|
|
|
|
|
|
|
$array_data["sum" . $series_suffix]['agent_module_id']= $agent_module_id;
|
|
|
|
$array_data["sum" . $series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
|
|
|
|
$array_data["sum" . $series_suffix]['agent_name'] = $data_module_graph['agent_name'];
|
|
|
|
$array_data["sum" . $series_suffix]['module_name'] = $data_module_graph['module_name'];
|
2018-02-16 13:41:31 +01:00
|
|
|
}
|
|
|
|
else{
|
2018-02-27 16:28:00 +01:00
|
|
|
$array_data = grafico_modulo_sparse_data_chart (
|
2018-02-21 11:54:24 +01:00
|
|
|
$agent_module_id,
|
|
|
|
$date_array,
|
|
|
|
$data_module_graph,
|
2018-05-28 17:47:40 +02:00
|
|
|
$params,
|
2018-02-21 11:54:24 +01:00
|
|
|
$series_suffix
|
|
|
|
);
|
2018-02-12 13:29:25 +01:00
|
|
|
}
|
2018-02-16 13:41:31 +01:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
if($array_data === false){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
//XXX Para un tipo de reports en concreto habria que optimizar que la tabla que crea coincida con los datos documentar
|
|
|
|
if($params['force_interval'] != ''){
|
|
|
|
$period_time_interval = $date_array['period'] * 1000;
|
|
|
|
$start_period = $date_array['start_date'] * 1000;
|
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
$sum_data = 0;
|
|
|
|
$count_data = 0;
|
|
|
|
$data_last_acum = $array_data['sum1']['data'][0][1];
|
|
|
|
|
|
|
|
while($period_time_interval > 0) {
|
|
|
|
foreach ($array_data['sum1']['data'] as $key => $value) {
|
|
|
|
if($value[0] >= $start_period && $value[0] < $start_period + $params['time_interval'] * 1000){
|
|
|
|
$sum_data = $value[1];
|
|
|
|
$array_data_only[] = $value[1];
|
|
|
|
$count_data++;
|
|
|
|
unset($array_data['sum1']['data'][$key]);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
if($params['force_interval'] == 'max_only'){
|
|
|
|
$acum_array_data[$i][0] = $start_period;
|
|
|
|
if(is_array($array_data_only) && count($array_data_only) > 0){
|
|
|
|
$acum_array_data[$i][1] = max($array_data_only);
|
|
|
|
$data_last_acum = $array_data_only[count($array_data_only) - 1];
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$acum_array_data[$i][1] = $data_last_acum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if($params['force_interval'] == 'min_only'){
|
|
|
|
$acum_array_data[$i][0] = $start_period;
|
|
|
|
if(is_array($array_data_only) && count($array_data_only) > 0){
|
|
|
|
$acum_array_data[$i][1] = min($array_data_only);
|
|
|
|
$data_last_acum = $array_data_only[count($array_data_only) - 1];
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$acum_array_data[$i][1] = $data_last_acum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if($params['force_interval'] == 'avg_only'){
|
|
|
|
$acum_array_data[$i][0] = $start_period;
|
|
|
|
if(is_array($array_data_only) && count($array_data_only) > 0){
|
|
|
|
$acum_array_data[$i][1] = $sum_data / $count_data;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$acum_array_data[$i][1] = $data_last_acum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$start_period = $start_period + $params['time_interval'] * 1000;
|
|
|
|
$array_data_only = array();
|
|
|
|
$sum_data = 0;
|
|
|
|
$count_data = 0;
|
|
|
|
$i++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$period_time_interval = $period_time_interval - $params['time_interval'];
|
|
|
|
}
|
|
|
|
$array_data['sum1']['data'] = $acum_array_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($params['percentil']){
|
2018-02-21 11:54:24 +01:00
|
|
|
$percentil_value = $array_data['percentil' . $series_suffix]['data'][0][1];
|
2018-02-16 13:41:31 +01:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
$percentil_value = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$events = array();
|
|
|
|
if(isset($array_data['sum' . $series_suffix]['max'])){
|
|
|
|
$max = $array_data['sum'. $series_suffix]['max'];
|
|
|
|
$min = $array_data['sum'. $series_suffix]['min'];
|
|
|
|
$avg = $array_data['sum'. $series_suffix]['avg'];
|
|
|
|
}
|
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
if(!$params['flag_overlapped']){
|
|
|
|
if($params['fullscale']){
|
|
|
|
if( $params['show_unknown'] &&
|
2018-02-21 11:54:24 +01:00
|
|
|
isset($array_data['unknown' . $series_suffix]) &&
|
|
|
|
is_array($array_data['unknown' . $series_suffix]['data']) ){
|
|
|
|
foreach ($array_data['unknown' . $series_suffix]['data'] as $key => $s_date) {
|
|
|
|
if ($s_date[1] == 1) {
|
|
|
|
$array_data['unknown' . $series_suffix]['data'][$key] = array($s_date[0], $max * 1.05);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
2018-05-28 17:47:40 +02:00
|
|
|
if( $params['show_unknown'] ) {
|
2018-02-21 11:54:24 +01:00
|
|
|
$unknown_events = db_get_module_ranges_unknown(
|
2018-02-27 16:28:00 +01:00
|
|
|
$agent_module_id,
|
|
|
|
$date_array['start_date'],
|
|
|
|
$date_array['final_date'],
|
|
|
|
$data_module_graph['history_db'],
|
|
|
|
1 // fix the time ranges to start_date - final_date
|
2018-02-21 11:54:24 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
if($unknown_events !== false){
|
|
|
|
foreach ($unknown_events as $key => $s_date) {
|
2018-02-27 16:28:00 +01:00
|
|
|
if( isset($s_date['time_from'])) {
|
|
|
|
$array_data['unknown' . $series_suffix]['data'][] = array(
|
2018-02-21 11:54:24 +01:00
|
|
|
($s_date['time_from'] - 1) * 1000,
|
|
|
|
0
|
|
|
|
);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
|
|
|
$array_data['unknown' . $series_suffix]['data'][] = array(
|
2018-02-21 11:54:24 +01:00
|
|
|
$s_date['time_from'] * 1000,
|
|
|
|
$max * 1.05
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else{
|
2018-02-27 16:28:00 +01:00
|
|
|
$array_data['unknown' . $series_suffix]['data'][] = array(
|
2018-02-21 11:54:24 +01:00
|
|
|
$date_array['start_date'] * 1000,
|
|
|
|
$max * 1.05
|
|
|
|
);
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-02-21 11:54:24 +01:00
|
|
|
if( isset($s_date['time_to']) ){
|
|
|
|
$array_data['unknown' . $series_suffix]['data'][] = array(
|
|
|
|
$s_date['time_to'] * 1000,
|
|
|
|
$max * 1.05
|
|
|
|
);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
|
|
|
$array_data['unknown' . $series_suffix]['data'][] = array(
|
2018-02-21 11:54:24 +01:00
|
|
|
($s_date['time_to'] + 1) * 1000,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else{
|
2018-02-27 16:28:00 +01:00
|
|
|
$array_data['unknown' . $series_suffix]['data'][] = array(
|
2018-02-21 11:54:24 +01:00
|
|
|
$date_array['final_date'] * 1000,
|
|
|
|
$max * 1.05
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-02-16 13:41:31 +01:00
|
|
|
}
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
if ($params['show_events'] ||
|
|
|
|
$params['show_alerts'] ) {
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-02-21 11:54:24 +01:00
|
|
|
$events = db_get_all_rows_filter (
|
|
|
|
'tevento',
|
|
|
|
array ('id_agentmodule' => $agent_module_id,
|
|
|
|
"utimestamp > " . $date_array['start_date'],
|
|
|
|
"utimestamp < " . $date_array['final_date'],
|
|
|
|
'order' => 'utimestamp ASC'
|
|
|
|
),
|
2018-02-27 16:28:00 +01:00
|
|
|
false,
|
2018-02-21 11:54:24 +01:00
|
|
|
'AND',
|
|
|
|
$data_module_graph['history_db']
|
|
|
|
);
|
2018-02-16 13:41:31 +01:00
|
|
|
|
2018-02-21 11:54:24 +01:00
|
|
|
$alerts_array = array();
|
|
|
|
$events_array = array();
|
2018-02-16 13:41:31 +01:00
|
|
|
|
2018-02-21 11:54:24 +01:00
|
|
|
if($events && is_array($events)){
|
2018-02-28 08:46:51 +01:00
|
|
|
$count_events=0;
|
|
|
|
$count_alerts=0;
|
2018-02-21 11:54:24 +01:00
|
|
|
foreach ($events as $k => $v) {
|
|
|
|
if (strpos($v["event_type"], "alert") !== false){
|
2018-05-28 17:47:40 +02:00
|
|
|
if($params['flag_overlapped']){
|
2018-02-28 08:46:51 +01:00
|
|
|
$alerts_array['data'][$count_alerts] = array(
|
|
|
|
($v['utimestamp'] + $date_array['period'] *1000),
|
|
|
|
$max * 1.10
|
|
|
|
);
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
|
|
|
else{
|
2018-02-28 08:46:51 +01:00
|
|
|
$alerts_array['data'][$count_alerts] = array(
|
|
|
|
($v['utimestamp']*1000),
|
|
|
|
$max * 1.10
|
|
|
|
);
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
2018-02-28 08:46:51 +01:00
|
|
|
$count_alerts++;
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
|
|
|
else{
|
2018-05-28 17:47:40 +02:00
|
|
|
if($params['flag_overlapped']){
|
2018-05-10 08:43:09 +02:00
|
|
|
if( ( strstr($v['event_type'], 'going_up') ) ||
|
|
|
|
( strstr($v['event_type'], 'going_down') ) ){
|
|
|
|
$events_array['data'][$count_events] = array(
|
|
|
|
(($v['utimestamp'] + 1 + $date_array['period']) * 1000),
|
|
|
|
$max * 1.15
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$events_array['data'][$count_events] = array(
|
|
|
|
($v['utimestamp'] + $date_array['period'] *1000),
|
|
|
|
$max * 1.15
|
|
|
|
);
|
|
|
|
}
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
|
|
|
else{
|
2018-05-10 08:43:09 +02:00
|
|
|
if( ( strstr($v['event_type'], 'going_up') ) ||
|
|
|
|
( strstr($v['event_type'], 'going_down') ) ){
|
|
|
|
$events_array['data'][$count_events] = array(
|
|
|
|
(($v['utimestamp'] + 1) *1000),
|
|
|
|
$max * 1.15
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$events_array['data'][$count_events] = array(
|
|
|
|
($v['utimestamp']*1000),
|
|
|
|
$max * 1.15
|
|
|
|
);
|
|
|
|
}
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
2018-02-28 08:46:51 +01:00
|
|
|
$count_events++;
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
2018-02-16 13:41:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
if($params['show_events']){
|
2018-02-21 11:54:24 +01:00
|
|
|
$array_data['event' . $series_suffix] = $events_array;
|
|
|
|
}
|
2018-02-16 13:41:31 +01:00
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
if($params['show_alerts']){
|
2018-02-21 11:54:24 +01:00
|
|
|
$array_data['alert' . $series_suffix] = $alerts_array;
|
|
|
|
}
|
2018-02-16 13:41:31 +01:00
|
|
|
}
|
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
if ($params['return_data'] == 1) {
|
2018-02-16 13:41:31 +01:00
|
|
|
return $array_data;
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-02-28 08:46:51 +01:00
|
|
|
$color = color_graph_array(
|
|
|
|
$series_suffix,
|
2018-05-28 17:47:40 +02:00
|
|
|
$params['flag_overlapped']
|
2018-02-28 08:46:51 +01:00
|
|
|
);
|
2018-02-16 13:41:31 +01:00
|
|
|
|
|
|
|
foreach ($color as $k => $v) {
|
|
|
|
if(is_array($array_data[$k])){
|
|
|
|
$array_data[$k]['color'] = $v['color'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-28 08:46:51 +01:00
|
|
|
$array_events_alerts[$series_suffix] = $events;
|
2018-05-10 08:43:09 +02:00
|
|
|
|
2018-05-18 14:22:39 +02:00
|
|
|
return $array_data;
|
2018-02-12 13:29:25 +01:00
|
|
|
}
|
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
/*
|
|
|
|
$params =array(
|
|
|
|
'agent_module_id' => $agent_module_id,
|
|
|
|
'period' => $period,
|
|
|
|
'show_events' => false,
|
|
|
|
'width' => $width,
|
|
|
|
'height' => $height,
|
|
|
|
'title' => '',
|
|
|
|
'unit_name' => null,
|
|
|
|
'show_alerts' => false,
|
|
|
|
'date' => 0,
|
|
|
|
'unit' => '',
|
|
|
|
'baseline' => 0,
|
|
|
|
'return_data' => 0,
|
|
|
|
'show_title' => true,
|
|
|
|
'only_image' => false,
|
2018-06-06 11:18:39 +02:00
|
|
|
'homeurl' => $config['homeurl'],
|
2018-05-28 17:47:40 +02:00
|
|
|
'ttl' => 1,
|
|
|
|
'adapt_key' => '',
|
|
|
|
'compare' => false,
|
|
|
|
'show_unknown' => false,
|
|
|
|
'menu' => true,
|
|
|
|
'backgroundColor' => 'white',
|
|
|
|
'percentil' => null,
|
|
|
|
'dashboard' => false,
|
|
|
|
'vconsole' => false,
|
|
|
|
'type_graph' => 'area',
|
|
|
|
'fullscale' => false,
|
|
|
|
'id_widget_dashboard' => false,
|
|
|
|
'force_interval' => '',
|
|
|
|
'time_interval' => 300,
|
2018-06-06 11:18:39 +02:00
|
|
|
'array_data_create' => 0,
|
|
|
|
'show_legend' => true,
|
|
|
|
'show_overview' => true
|
2018-05-28 17:47:40 +02:00
|
|
|
);
|
|
|
|
*/
|
|
|
|
function grafico_modulo_sparse ($params) {
|
2012-08-30 11:22:03 +02:00
|
|
|
global $config;
|
2018-05-18 14:22:39 +02:00
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
/*XXXXXXXXXXXX Documnetar
|
|
|
|
*Set all variable
|
|
|
|
*/
|
|
|
|
|
|
|
|
if(!isset($params) || !is_array($params)){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['agent_module_id'])){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$agent_module_id = $params['agent_module_id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['period'])){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['show_events'])){
|
|
|
|
$params['show_events'] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['width'])){
|
|
|
|
$params['width'] = '90%';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['height'])){
|
|
|
|
$params['height'] = 450;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['title'])){
|
|
|
|
$params['title'] = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['unit_name'])){
|
|
|
|
$params['unit_name'] = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['show_alerts'])){
|
|
|
|
$params['show_alerts'] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['date']) || !$params['date']){
|
|
|
|
$params['date'] = get_system_time();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['unit'])){
|
|
|
|
$params['unit'] = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['baseline'])){
|
|
|
|
$params['baseline'] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['return_data'])){
|
|
|
|
$params['return_data'] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['show_title'])){
|
|
|
|
$show_title = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['only_image'])){
|
|
|
|
$params['only_image'] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['homeurl'])){
|
2018-06-06 11:18:39 +02:00
|
|
|
$params['homeurl'] = $config['homeurl'];
|
2018-05-28 17:47:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['ttl'])){
|
|
|
|
$params['ttl'] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['adapt_key'])){
|
|
|
|
$params['adapt_key'] = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['compare'])){
|
|
|
|
$params['compare'] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['show_unknown'])){
|
|
|
|
$params['show_unknown'] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['menu'])){
|
|
|
|
$params['menu'] = true;
|
|
|
|
}
|
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
if(!isset($params['show_legend'])){
|
|
|
|
$params['show_legend'] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['show_overview'])){
|
|
|
|
$params['show_overview'] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['show_export_csv'])){
|
|
|
|
$params['show_export_csv'] = true;
|
|
|
|
}
|
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
if(!isset($params['backgroundColor'])){
|
|
|
|
$params['backgroundColor'] = 'white';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['percentil'])){
|
|
|
|
$params['percentil'] = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['dashboard'])){
|
|
|
|
$params['dashboard'] = false;
|
|
|
|
}
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
if(!isset($params['vconsole']) || $params['vconsole'] == false){
|
2018-05-28 17:47:40 +02:00
|
|
|
$params['vconsole'] = false;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$params['menu'] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['type_graph'])){
|
|
|
|
$params['type_graph'] = $config['type_module_charts'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['fullscale'])){
|
|
|
|
$params['fullscale'] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['id_widget_dashboard'])){
|
|
|
|
$params['id_widget_dashboard'] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['force_interval'])){
|
|
|
|
$params['force_interval'] = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['time_interval'])){
|
|
|
|
$params['time_interval'] = 300;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['array_data_create'])){
|
|
|
|
$params['array_data_create'] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$params['font'] = $config['fontpath'];
|
|
|
|
$params['font-size'] = $config['font_size'];
|
|
|
|
|
|
|
|
//XXXXXXXXXXXX se devuelve phantom.js
|
|
|
|
if($params['only_image']){
|
2018-06-01 13:58:29 +02:00
|
|
|
return generator_chart_to_pdf('sparse', $params);
|
2018-05-28 17:47:40 +02:00
|
|
|
}
|
|
|
|
|
2012-08-30 11:22:03 +02:00
|
|
|
global $graphic_type;
|
2018-02-28 08:46:51 +01:00
|
|
|
global $array_events_alerts;
|
2018-02-16 13:41:31 +01:00
|
|
|
|
2018-02-28 08:46:51 +01:00
|
|
|
$array_data = array();
|
|
|
|
$legend = array();
|
|
|
|
$array_events_alerts = array();
|
2018-02-12 13:29:25 +01:00
|
|
|
|
2018-02-16 13:41:31 +01:00
|
|
|
|
2018-02-08 15:47:12 +01:00
|
|
|
$date_array = array();
|
2018-05-28 17:47:40 +02:00
|
|
|
$date_array["period"] = $params['period'];
|
|
|
|
$date_array["final_date"] = $params['date'];
|
|
|
|
$date_array["start_date"] = $params['date'] - $params['period'];
|
2018-02-16 13:41:31 +01:00
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
if($agent_module_id){
|
|
|
|
$module_data = db_get_row_sql (
|
|
|
|
'SELECT * FROM tagente_modulo
|
|
|
|
WHERE id_agente_modulo = ' .
|
|
|
|
$agent_module_id
|
|
|
|
);
|
2018-02-16 13:41:31 +01:00
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
$data_module_graph = array();
|
|
|
|
$data_module_graph['history_db'] = db_search_in_history_db($date_array["start_date"]);
|
|
|
|
$data_module_graph['agent_name'] = modules_get_agentmodule_agent_name ($agent_module_id);
|
|
|
|
$data_module_graph['agent_id'] = $module_data['id_agente'];
|
|
|
|
$data_module_graph['module_name'] = $module_data['nombre'];
|
|
|
|
$data_module_graph['id_module_type'] = $module_data['id_tipo_modulo'];
|
|
|
|
$data_module_graph['module_type'] = modules_get_moduletype_name ($data_module_graph['id_module_type']);
|
|
|
|
$data_module_graph['uncompressed'] = is_module_uncompressed ($data_module_graph['module_type']);
|
|
|
|
$data_module_graph['w_min'] = $module_data['min_warning'];
|
|
|
|
$data_module_graph['w_max'] = $module_data['max_warning'];
|
|
|
|
$data_module_graph['w_inv'] = $module_data['warning_inverse'];
|
|
|
|
$data_module_graph['c_min'] = $module_data['min_critical'];
|
|
|
|
$data_module_graph['c_max'] = $module_data['max_critical'];
|
|
|
|
$data_module_graph['c_inv'] = $module_data['critical_inverse'];
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$data_module_graph = false;
|
|
|
|
}
|
2018-02-08 15:47:12 +01:00
|
|
|
|
|
|
|
//format of the graph
|
2018-05-28 17:47:40 +02:00
|
|
|
if (empty($params['unit'])) {
|
|
|
|
$params['unit'] = $module_data['unit'];
|
|
|
|
if(modules_is_unit_macro($params['unit'])){
|
|
|
|
$params['unit'] = "";
|
2018-02-16 13:41:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
if(!$params['array_data_create']){
|
|
|
|
if ($params['compare'] !== false) {
|
2018-05-18 14:22:39 +02:00
|
|
|
$series_suffix = 2;
|
2018-02-21 11:54:24 +01:00
|
|
|
|
2018-05-18 14:22:39 +02:00
|
|
|
$date_array_prev['final_date'] = $date_array['start_date'];
|
|
|
|
$date_array_prev['start_date'] = $date_array['start_date'] - $date_array['period'];
|
|
|
|
$date_array_prev['period'] = $date_array['period'];
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
if ($params['compare'] === 'overlapped') {
|
|
|
|
$params['flag_overlapped'] = 1;
|
2018-05-18 14:22:39 +02:00
|
|
|
}
|
|
|
|
else{
|
2018-05-28 17:47:40 +02:00
|
|
|
$params['flag_overlapped'] = 0;
|
2018-05-18 14:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$array_data = grafico_modulo_sparse_data(
|
2018-06-06 11:18:39 +02:00
|
|
|
$agent_module_id,
|
|
|
|
$date_array_prev,
|
|
|
|
$data_module_graph,
|
|
|
|
$params,
|
|
|
|
$series_suffix
|
2018-05-18 14:22:39 +02:00
|
|
|
);
|
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
switch ($params['compare']) {
|
2018-05-18 14:22:39 +02:00
|
|
|
case 'separated':
|
|
|
|
case 'overlapped':
|
|
|
|
// Store the chart calculated
|
2018-05-21 17:25:09 +02:00
|
|
|
$array_data_prev = $array_data;
|
|
|
|
$legend_prev = $legend;
|
2018-05-18 14:22:39 +02:00
|
|
|
break;
|
|
|
|
}
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-05-18 14:22:39 +02:00
|
|
|
$series_suffix = 1;
|
2018-05-28 17:47:40 +02:00
|
|
|
$params['flag_overlapped'] = 0;
|
2018-05-18 14:22:39 +02:00
|
|
|
|
|
|
|
$array_data = grafico_modulo_sparse_data(
|
2018-06-06 11:18:39 +02:00
|
|
|
$agent_module_id,
|
|
|
|
$date_array,
|
|
|
|
$data_module_graph,
|
|
|
|
$params,
|
|
|
|
$series_suffix
|
2018-02-21 11:54:24 +01:00
|
|
|
);
|
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
if($params['compare']){
|
|
|
|
if ($params['compare'] === 'overlapped') {
|
2018-05-18 14:22:39 +02:00
|
|
|
$array_data = array_merge($array_data, $array_data_prev);
|
|
|
|
$legend = array_merge($legend, $legend_prev);
|
|
|
|
}
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
|
|
|
}
|
2018-05-18 14:22:39 +02:00
|
|
|
else{
|
2018-05-28 17:47:40 +02:00
|
|
|
$array_data = $params['array_data_create'];
|
2018-05-18 14:22:39 +02:00
|
|
|
}
|
2018-02-21 11:54:24 +01:00
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
if($params['return_data']){
|
2018-05-18 14:22:39 +02:00
|
|
|
return $array_data;
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//XXX
|
2018-02-27 16:28:00 +01:00
|
|
|
//esto lo tenia la bool
|
|
|
|
$water_mark = array(
|
|
|
|
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url(
|
|
|
|
"/images/logo_vertical_water.png",
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false
|
|
|
|
)
|
|
|
|
);
|
2018-02-28 08:46:51 +01:00
|
|
|
|
2018-05-21 17:25:09 +02:00
|
|
|
$series_type_array = series_type_graph_array(
|
|
|
|
$array_data,
|
2018-05-28 17:47:40 +02:00
|
|
|
$params
|
2018-05-18 14:22:39 +02:00
|
|
|
);
|
|
|
|
|
2018-05-21 17:25:09 +02:00
|
|
|
$series_type = $series_type_array['series_type'];
|
|
|
|
$legend = $series_type_array['legend'];
|
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
//esto la sparse
|
|
|
|
//setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
2018-03-01 09:46:52 +01:00
|
|
|
|
|
|
|
$data_module_graph['series_suffix'] = $series_suffix;
|
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
// Check available data
|
2018-05-28 17:47:40 +02:00
|
|
|
if ($params['compare'] === 'separated') {
|
2018-02-27 16:28:00 +01:00
|
|
|
if (!empty($array_data)) {
|
|
|
|
$return = area_graph(
|
|
|
|
$agent_module_id,
|
|
|
|
$array_data,
|
|
|
|
$legend,
|
|
|
|
$series_type,
|
|
|
|
$date_array,
|
|
|
|
$data_module_graph,
|
2018-05-28 17:47:40 +02:00
|
|
|
$params,
|
2018-02-27 16:28:00 +01:00
|
|
|
$water_mark,
|
2018-02-28 08:46:51 +01:00
|
|
|
$array_events_alerts
|
2018-02-27 16:28:00 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
else{
|
2018-05-28 17:47:40 +02:00
|
|
|
$return = graph_nodata_image($params['width'], $params['height']);
|
2018-02-27 16:28:00 +01:00
|
|
|
}
|
|
|
|
$return .= '<br>';
|
|
|
|
if (!empty($array_data_prev)) {
|
2018-05-18 14:22:39 +02:00
|
|
|
|
2018-05-21 17:25:09 +02:00
|
|
|
$series_type_array = series_type_graph_array(
|
|
|
|
$array_data_prev,
|
2018-05-28 17:47:40 +02:00
|
|
|
$params
|
2018-05-18 14:22:39 +02:00
|
|
|
);
|
|
|
|
|
2018-05-21 17:25:09 +02:00
|
|
|
$series_type = $series_type_array['series_type'];
|
|
|
|
$legend = $series_type_array['legend'];
|
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
$return .= area_graph(
|
|
|
|
$agent_module_id,
|
|
|
|
$array_data_prev,
|
|
|
|
$legend,
|
|
|
|
$series_type,
|
|
|
|
$date_array,
|
|
|
|
$data_module_graph,
|
2018-05-28 17:47:40 +02:00
|
|
|
$params,
|
2018-02-27 16:28:00 +01:00
|
|
|
$water_mark,
|
2018-02-28 08:46:51 +01:00
|
|
|
$array_events_alerts
|
2018-02-27 16:28:00 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
else{
|
2018-05-28 17:47:40 +02:00
|
|
|
$return .= graph_nodata_image($params['width'], $params['height']);
|
2018-02-27 16:28:00 +01:00
|
|
|
}
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
|
|
|
else{
|
2018-02-27 16:28:00 +01:00
|
|
|
if (!empty($array_data)) {
|
|
|
|
$return = area_graph(
|
2018-02-16 13:41:31 +01:00
|
|
|
$agent_module_id,
|
|
|
|
$array_data,
|
|
|
|
$legend,
|
|
|
|
$series_type,
|
|
|
|
$date_array,
|
|
|
|
$data_module_graph,
|
2018-05-28 17:47:40 +02:00
|
|
|
$params,
|
2018-02-16 13:41:31 +01:00
|
|
|
$water_mark,
|
2018-02-28 08:46:51 +01:00
|
|
|
$array_events_alerts
|
2018-02-16 13:41:31 +01:00
|
|
|
);
|
2018-02-27 16:28:00 +01:00
|
|
|
}
|
|
|
|
else{
|
2018-06-06 11:18:39 +02:00
|
|
|
$return = graph_nodata_image(
|
|
|
|
$params['width'],
|
|
|
|
$params['height']
|
|
|
|
);
|
2018-02-27 16:28:00 +01:00
|
|
|
}
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
2018-02-08 15:47:12 +01:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
return $return;
|
2011-04-05 18:11:53 +02:00
|
|
|
}
|
|
|
|
|
2011-12-22 19:42:50 +01:00
|
|
|
function graph_get_formatted_date($timestamp, $format1, $format2) {
|
|
|
|
global $config;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
if ($config['flash_charts']) {
|
2011-12-22 19:42:50 +01:00
|
|
|
$date = date("$format1 $format2", $timestamp);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$date = date($format1, $timestamp);
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
if ($format2 != '') {
|
2011-12-22 19:42:50 +01:00
|
|
|
$date .= "\n".date($format2, $timestamp);
|
|
|
|
}
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
return $date;
|
2011-12-22 19:42:50 +01:00
|
|
|
}
|
|
|
|
|
2011-04-05 18:11:53 +02:00
|
|
|
/**
|
|
|
|
* Produces a combined/user defined graph
|
|
|
|
*
|
|
|
|
* @param array List of source modules
|
|
|
|
* @param array List of weighs for each module
|
|
|
|
* @param int Period (in seconds)
|
|
|
|
* @param int Width, in pixels
|
|
|
|
* @param int Height, in pixels
|
|
|
|
* @param string Title for graph
|
|
|
|
* @param string Unit name, for render in legend
|
|
|
|
* @param int Show events in graph (set to 1)
|
|
|
|
* @param int Show alerts in graph (set to 1)
|
|
|
|
* @param int Pure mode (without titles) (set to 1)
|
|
|
|
* @param int Date to start of getting info.
|
2018-05-10 08:52:45 +02:00
|
|
|
* @param mixed If is a projection graph this parameter will be module data with prediction data (the projection)
|
2011-10-26 17:18:51 +02:00
|
|
|
* or false in other case.
|
2014-09-22 19:42:40 +02:00
|
|
|
* @param array List of names for the items. Should have the same size as the module list.
|
2014-09-23 13:07:58 +02:00
|
|
|
* @param array List of units for the items. Should have the same size as the module list.
|
2014-09-22 19:42:40 +02:00
|
|
|
* @param bool Show the last value of the item on the list.
|
|
|
|
* @param bool Show the max value of the item on the list.
|
|
|
|
* @param bool Show the min value of the item on the list.
|
|
|
|
* @param bool Show the average value of the item on the list.
|
2018-04-27 10:03:05 +02:00
|
|
|
*
|
|
|
|
* @return Mixed
|
2011-04-05 18:11:53 +02:00
|
|
|
*/
|
2018-06-01 13:58:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
$params =array(
|
|
|
|
'period' => $period,
|
|
|
|
'show_events' => false,
|
|
|
|
'width' => $width,
|
|
|
|
'height' => $height,
|
|
|
|
'title' => '',
|
|
|
|
'unit_name' => null,
|
|
|
|
'show_alerts' => false,
|
|
|
|
'date' => 0,
|
|
|
|
'unit' => '',
|
|
|
|
'only_image' => false,
|
|
|
|
'homeurl' => '',
|
|
|
|
'ttl' => 1,
|
|
|
|
'percentil' => null,
|
|
|
|
'dashboard' => false,
|
|
|
|
'vconsole' => false,
|
|
|
|
'fullscale' => false,
|
|
|
|
'id_widget_dashboard' => false,
|
|
|
|
);
|
|
|
|
|
|
|
|
$params_combined = array(
|
|
|
|
'weight_list' => array(),
|
|
|
|
'stacked' => 0,
|
|
|
|
'projection' => false,
|
|
|
|
'labels' => array(),
|
|
|
|
'from_interface' => false,
|
|
|
|
'summatory' => 0,
|
|
|
|
'average' => 0,
|
|
|
|
'modules_series' => 0,
|
|
|
|
'id_graph' => 0,
|
|
|
|
'return' => 1
|
|
|
|
);
|
|
|
|
*/
|
|
|
|
|
2018-04-18 16:01:38 +02:00
|
|
|
function graphic_combined_module (
|
|
|
|
$module_list,
|
2018-06-01 13:58:29 +02:00
|
|
|
$params,
|
|
|
|
$params_combined
|
2018-04-18 16:01:38 +02:00
|
|
|
) {
|
2018-06-01 13:58:29 +02:00
|
|
|
//XXX seteo todos los parametros
|
|
|
|
if(!isset($params_combined['from_interface'])){
|
|
|
|
$params_combined['from_interface'] = false;
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
if(!isset($params_combined['stacked'])){
|
|
|
|
if ($params_combined['from_interface']) {
|
|
|
|
if ($config["type_interface_charts"] == 'line') {
|
|
|
|
$params_combined['stacked'] = CUSTOM_GRAPH_LINE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$params_combined['stacked'] = CUSTOM_GRAPH_AREA;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if ($id_graph == 0) {
|
|
|
|
$params_combined['stacked'] = CUSTOM_GRAPH_LINE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$params_combined['stacked'] = db_get_row('tgraph', 'id_graph', $id_graph);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$params['stacked'] = $params_combined['stacked'];
|
|
|
|
|
|
|
|
if(!isset($params_combined['projection'])){
|
|
|
|
$params_combined['projection'] = false;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$params['stacked'] = 'area';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params_combined['labels'])){
|
|
|
|
$params_combined['labels'] = array();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params_combined['summatory'])){
|
|
|
|
$params_combined['summatory'] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params_combined['average'])){
|
|
|
|
$params_combined['average'] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params_combined['modules_series'])){
|
|
|
|
$params_combined['modules_series'] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params_combined['return'])){
|
|
|
|
$params_combined['return'] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params_combined['id_graph'])){
|
|
|
|
$params_combined['id_graph'] = 0;
|
|
|
|
}
|
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
if(!isset($params['percentil'])){
|
|
|
|
$params_combined['percentil'] = null;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$params_combined['percentil'] = $params['percentil'];
|
|
|
|
}
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
|
|
|
|
//XXX seteo los parametros
|
|
|
|
if(!isset($params['period'])){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['width'])){
|
|
|
|
$params['width'] = '90%';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['height'])){
|
|
|
|
$params['height'] = 450;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['title'])){
|
|
|
|
$params['title'] = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['unit_name'])){
|
|
|
|
$params['unit_name'] = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['show_alerts'])){
|
|
|
|
$params['show_alerts'] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['date']) || !$params['date']){
|
|
|
|
$params['date'] = get_system_time();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['only_image'])){
|
|
|
|
$params['only_image'] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['ttl'])){
|
|
|
|
$params['ttl'] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['backgroundColor'])){
|
|
|
|
$params['backgroundColor'] = 'white';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['dashboard'])){
|
|
|
|
$params['dashboard'] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['menu']) || $params['only_image']){
|
|
|
|
$params['menu'] = true;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$params['menu'] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['vconsole']) || $params['vconsole'] == false){
|
|
|
|
$params['vconsole'] = false;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$params['menu'] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['percentil'])){
|
|
|
|
$params['percentil'] = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['fullscale'])){
|
|
|
|
$params['fullscale'] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['id_widget_dashboard'])){
|
|
|
|
$params['id_widget_dashboard'] = false;
|
|
|
|
}
|
2018-01-03 12:13:00 +01:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
if(!isset($params['homeurl'])){
|
|
|
|
$params['homeurl'] = ui_get_full_url(false, false, false, false);
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
if(!isset($params['show_legend'])){
|
|
|
|
$params['show_legend'] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['show_overview'])){
|
|
|
|
$params['show_overview'] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($params['show_export_csv'])){
|
|
|
|
$params['show_export_csv'] = true;
|
|
|
|
}
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
//XXXX
|
|
|
|
if($params['only_image']){
|
|
|
|
return generator_chart_to_pdf('combined', $params, $params_combined, $module_list);
|
2018-04-26 10:24:37 +02:00
|
|
|
}
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
|
|
|
|
|
|
|
$sources = false;
|
|
|
|
if ($params_combined['id_graph'] == 0) {
|
|
|
|
$count_modules = count($module_list);
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
if(!$params_combined['weight_list']){
|
|
|
|
$weights = array_fill(0, $count_modules, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($count_modules > 0){
|
|
|
|
$sources = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$sources = db_get_all_rows_field_filter(
|
|
|
|
'tgraph_source',
|
|
|
|
'id_graph',
|
|
|
|
$params_combined['id_graph']
|
2018-04-26 10:24:37 +02:00
|
|
|
);
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$series = db_get_all_rows_sql(
|
|
|
|
'SELECT summatory_series,average_series,modules_series
|
|
|
|
FROM tgraph
|
|
|
|
WHERE id_graph = '.
|
|
|
|
$params_combined['id_graph']
|
|
|
|
);
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$summatory = $series[0]['summatory_series'];
|
|
|
|
$average = $series[0]['average_series'];
|
|
|
|
$modules_series = $series[0]['modules_series'];
|
|
|
|
|
|
|
|
$weights = array ();
|
|
|
|
$labels = array ();
|
|
|
|
$modules = array ();
|
|
|
|
|
|
|
|
if(isset($sources) && is_array($sources)){
|
|
|
|
foreach ($sources as $source) {
|
|
|
|
array_push ($modules, $source['id_agent_module']);
|
|
|
|
array_push ($weights, $source['weight']);
|
|
|
|
if ($source['label'] != ''){
|
|
|
|
$item['type'] = 'custom_graph';
|
|
|
|
$item['id_agent'] = agents_get_module_id($source['id_agent_module']);
|
|
|
|
$item['id_agent_module'] = $source['id_agent_module'];
|
|
|
|
$labels[$source['id_agent_module']] = reporting_label_macro($item, $source['label']);
|
2018-04-27 10:03:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-06-01 13:58:29 +02:00
|
|
|
}
|
2018-04-27 10:03:05 +02:00
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
if(isset($summatory)){
|
|
|
|
$params_combined['summatory'] = $summatory;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($average)){
|
|
|
|
$params_combined['average'] = $average;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($modules_series)){
|
|
|
|
$params_combined['modules_series'] = $modules_series;
|
|
|
|
}
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
if(isset($labels)){
|
|
|
|
$params_combined['labels'] = $labels;
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
if(isset($weights)){
|
|
|
|
$params_combined['weight_list'] = $weights;
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
if(!$module_list){
|
|
|
|
$module_list = $modules;
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
if ($sources === false) {
|
|
|
|
if ($params_combined['return']){
|
|
|
|
return false;
|
2012-03-12 17:23:50 +01:00
|
|
|
}
|
2018-06-01 13:58:29 +02:00
|
|
|
else{
|
|
|
|
ui_print_info_message (
|
|
|
|
array (
|
|
|
|
'no_close' => true,
|
|
|
|
'message' => __('No items.')
|
|
|
|
)
|
|
|
|
);
|
|
|
|
return;
|
2017-11-24 11:55:25 +01:00
|
|
|
}
|
2018-06-01 13:58:29 +02:00
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$width = $params['width'];
|
|
|
|
$height = $params['height'];
|
|
|
|
$homeurl = $params['homeurl'];
|
|
|
|
$ttl = $params['ttl'];
|
|
|
|
$background_color = $params['backgroundColor'];
|
|
|
|
$datelimit = $date_array["start_date"];
|
|
|
|
$flash_charts = false;
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
//XXX no se que hacen
|
2018-06-06 11:18:39 +02:00
|
|
|
$fixed_font_size = $config['font_size'];
|
2018-06-01 13:58:29 +02:00
|
|
|
$water_mark = '';
|
|
|
|
$long_index = '';
|
|
|
|
$color = array();
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
switch ($params_combined['stacked']) {
|
|
|
|
default:
|
|
|
|
case CUSTOM_GRAPH_STACKED_LINE:
|
|
|
|
case CUSTOM_GRAPH_STACKED_AREA:
|
|
|
|
case CUSTOM_GRAPH_AREA:
|
|
|
|
case CUSTOM_GRAPH_LINE:
|
2018-05-30 17:45:17 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$date_array = array();
|
|
|
|
$date_array["period"] = $params['period'];
|
|
|
|
$date_array["final_date"] = $params['date'];
|
|
|
|
$date_array["start_date"] = $params['date'] - $params['period'];
|
|
|
|
|
|
|
|
$i=0;
|
|
|
|
$array_data = array();
|
|
|
|
foreach ($module_list as $key => $agent_module_id) {
|
|
|
|
$module_data = db_get_row_sql (
|
|
|
|
'SELECT * FROM tagente_modulo
|
|
|
|
WHERE id_agente_modulo = ' .
|
|
|
|
$agent_module_id
|
|
|
|
);
|
2018-05-21 17:25:09 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$data_module_graph = array();
|
|
|
|
$data_module_graph['history_db'] = db_search_in_history_db($date_array["start_date"]);
|
|
|
|
$data_module_graph['agent_name'] = modules_get_agentmodule_agent_name ($agent_module_id);
|
|
|
|
$data_module_graph['agent_id'] = $module_data['id_agente'];
|
|
|
|
$data_module_graph['module_name'] = $module_data['nombre'];
|
|
|
|
$data_module_graph['id_module_type'] = $module_data['id_tipo_modulo'];
|
|
|
|
$data_module_graph['module_type'] = modules_get_moduletype_name ($data_module_graph['id_module_type']);
|
|
|
|
$data_module_graph['uncompressed'] = is_module_uncompressed ($data_module_graph['module_type']);
|
|
|
|
$data_module_graph['w_min'] = $module_data['min_warning'];
|
|
|
|
$data_module_graph['w_max'] = $module_data['max_warning'];
|
|
|
|
$data_module_graph['w_inv'] = $module_data['warning_inverse'];
|
|
|
|
$data_module_graph['c_min'] = $module_data['min_critical'];
|
|
|
|
$data_module_graph['c_max'] = $module_data['max_critical'];
|
|
|
|
$data_module_graph['c_inv'] = $module_data['critical_inverse'];
|
|
|
|
$data_module_graph['module_id'] = $agent_module_id;
|
|
|
|
|
|
|
|
//stract data
|
|
|
|
$array_data_module = grafico_modulo_sparse_data(
|
|
|
|
$agent_module_id,
|
|
|
|
$date_array,
|
|
|
|
$data_module_graph,
|
|
|
|
$params,
|
2018-06-06 11:18:39 +02:00
|
|
|
$i
|
2018-06-01 13:58:29 +02:00
|
|
|
);
|
2018-05-18 14:22:39 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$series_suffix = $i;
|
|
|
|
|
|
|
|
//convert to array graph and weight
|
|
|
|
foreach ($array_data_module as $key => $value) {
|
|
|
|
$array_data[$key] = $value;
|
|
|
|
if($params_combined['weight_list'][$i] > 1){
|
|
|
|
foreach ($value['data'] as $k => $v) {
|
|
|
|
$array_data[$key]['data'][$k][1] = $v[1] * $params_combined['weight_list'][$i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$max = $array_data['sum' . $i]['max'];
|
|
|
|
$min = $array_data['sum' . $i]['min'];
|
|
|
|
$avg = $array_data['sum' . $i]['avg'];
|
|
|
|
|
|
|
|
$percentil_value = $array_data['percentil' . $i]['data'][0][1];
|
2018-05-21 17:25:09 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$color = color_graph_array(
|
|
|
|
$series_suffix,
|
2018-06-06 11:18:39 +02:00
|
|
|
$params['flag_overlapped']
|
2018-06-01 13:58:29 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
foreach ($color as $k => $v) {
|
|
|
|
if(is_array($array_data[$k])){
|
|
|
|
$array_data[$k]['color'] = $v['color'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array(
|
|
|
|
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
|
|
|
|
|
|
|
//Work around for fixed the agents name with huge size chars.
|
|
|
|
$fixed_font_size = $config['font_size'];
|
|
|
|
|
|
|
|
//$array_events_alerts[$series_suffix] = $events;
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($params_combined['projection'] && is_array($params_combined['projection'])){
|
|
|
|
$array_data['projection']['data']= $params_combined['projection'];
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
//summatory and average series
|
|
|
|
if($params_combined['stacked'] == CUSTOM_GRAPH_AREA || $params_combined['stacked'] == CUSTOM_GRAPH_LINE) {
|
|
|
|
if($params_combined['summatory'] || $params_combined['average']) {
|
|
|
|
$array_data = combined_graph_summatory_average (
|
|
|
|
$array_data,
|
|
|
|
$params_combined['average'],
|
|
|
|
$params_combined['summatory'],
|
|
|
|
$params_combined['modules_series']
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$series_type_array = series_type_graph_array(
|
|
|
|
$array_data,
|
2018-06-06 11:18:39 +02:00
|
|
|
$params_combined
|
2018-06-01 13:58:29 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
$series_type = $series_type_array['series_type'];
|
|
|
|
$legend = $series_type_array['legend'];
|
|
|
|
|
|
|
|
//XXXXXXREVISAR
|
|
|
|
$threshold_data = array();
|
|
|
|
if ($params_combined['from_interface']) {
|
|
|
|
$yellow_threshold = 0;
|
|
|
|
$red_threshold = 0;
|
|
|
|
|
|
|
|
$yellow_up = 0;
|
|
|
|
$red_up = 0;
|
|
|
|
|
|
|
|
$yellow_inverse = 0;
|
|
|
|
$red_inverse = 0;
|
|
|
|
|
|
|
|
$compare_warning = false;
|
|
|
|
$compare_critical = false;
|
|
|
|
|
|
|
|
$do_it_warning_min = true;
|
|
|
|
$do_it_critical_min = true;
|
|
|
|
|
|
|
|
$do_it_warning_max = true;
|
|
|
|
$do_it_critical_max = true;
|
|
|
|
|
|
|
|
$do_it_warning_inverse = true;
|
|
|
|
$do_it_critical_inverse = true;
|
|
|
|
|
|
|
|
foreach ($module_list as $index => $id_module) {
|
|
|
|
// Get module warning_min and critical_min
|
|
|
|
$warning_min = db_get_value('min_warning','tagente_modulo','id_agente_modulo',$id_module);
|
|
|
|
$critical_min = db_get_value('min_critical','tagente_modulo','id_agente_modulo',$id_module);
|
|
|
|
|
|
|
|
if ($index == 0) {
|
|
|
|
$compare_warning = $warning_min;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if ($compare_warning != $warning_min) {
|
|
|
|
$do_it_warning_min = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($index == 0) {
|
|
|
|
$compare_critical = $critical_min;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if ($compare_critical != $critical_min) {
|
|
|
|
$do_it_critical_min = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($do_it_warning_min || $do_it_critical_min) {
|
|
|
|
foreach ($module_list as $index => $id_module) {
|
|
|
|
$warning_max = db_get_value('max_warning','tagente_modulo','id_agente_modulo',$id_module);
|
|
|
|
$critical_max = db_get_value('max_critical','tagente_modulo','id_agente_modulo',$id_module);
|
|
|
|
|
|
|
|
if ($index == 0) {
|
|
|
|
$yellow_up = $warning_max;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if ($yellow_up != $warning_max) {
|
|
|
|
$do_it_warning_max = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($index == 0) {
|
|
|
|
$red_up = $critical_max;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if ($red_up != $critical_max) {
|
|
|
|
$do_it_critical_max = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($do_it_warning_min || $do_it_critical_min) {
|
|
|
|
foreach ($module_list as $index => $id_module) {
|
|
|
|
$warning_inverse = db_get_value('warning_inverse','tagente_modulo','id_agente_modulo',$id_module);
|
|
|
|
$critical_inverse = db_get_value('critical_inverse','tagente_modulo','id_agente_modulo',$id_module);
|
|
|
|
|
|
|
|
if ($index == 0) {
|
|
|
|
$yellow_inverse = $warning_inverse;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if ($yellow_inverse != $warning_inverse) {
|
|
|
|
$do_it_warning_inverse = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($index == 0) {
|
|
|
|
$red_inverse = $critical_inverse;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if ($red_inverse != $critical_inverse) {
|
|
|
|
$do_it_critical_inverse = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($do_it_warning_min && $do_it_warning_max && $do_it_warning_inverse) {
|
|
|
|
$yellow_threshold = $compare_warning;
|
|
|
|
$threshold_data['yellow_up'] = $yellow_up;
|
|
|
|
$threshold_data['yellow_inverse'] = (bool)$yellow_inverse;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($do_it_critical_min && $do_it_critical_max && $do_it_critical_inverse) {
|
|
|
|
$red_threshold = $compare_critical;
|
|
|
|
$threshold_data['red_up'] = $red_up;
|
|
|
|
$threshold_data['red_inverse'] = (bool)$red_inverse;
|
|
|
|
}
|
|
|
|
|
|
|
|
$show_elements_graph['threshold_data'] = $threshold_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
$output = area_graph(
|
|
|
|
$agent_module_id,
|
|
|
|
$array_data,
|
|
|
|
$legend,
|
|
|
|
$series_type,
|
|
|
|
$date_array,
|
|
|
|
$data_module_graph,
|
|
|
|
$params,
|
|
|
|
$water_mark,
|
|
|
|
$array_events_alerts
|
|
|
|
);
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
break;
|
2018-04-27 10:03:05 +02:00
|
|
|
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
|
|
|
|
case CUSTOM_GRAPH_BULLET_CHART:
|
2018-06-01 13:58:29 +02:00
|
|
|
|
|
|
|
if($params_combined['stacked'] == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
|
2018-04-27 10:03:05 +02:00
|
|
|
$acumulador = 0;
|
|
|
|
foreach ($module_list as $module_item) {
|
|
|
|
$module = $module_item;
|
|
|
|
$query_last_value = sprintf('
|
|
|
|
SELECT datos
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE id_agente_modulo = %d
|
|
|
|
AND utimestamp < %d
|
|
|
|
ORDER BY utimestamp DESC',
|
2018-06-01 13:58:29 +02:00
|
|
|
$module, $params['date']);
|
2018-04-27 10:03:05 +02:00
|
|
|
$temp_data = db_get_value_sql($query_last_value);
|
|
|
|
if ($acumulador < $temp_data){
|
|
|
|
$acumulador = $temp_data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-06-01 13:58:29 +02:00
|
|
|
|
2018-04-27 10:03:05 +02:00
|
|
|
foreach ($module_list as $module_item) {
|
|
|
|
$automatic_custom_graph_meta = false;
|
|
|
|
if ($config['metaconsole']) {
|
|
|
|
// Automatic custom graph from the report template in metaconsole
|
|
|
|
if (is_array($module_list[$i])) {
|
|
|
|
$server = metaconsole_get_connection_by_id ($module_item['server']);
|
|
|
|
metaconsole_connect($server);
|
|
|
|
$automatic_custom_graph_meta = true;
|
|
|
|
}
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-04-27 10:03:05 +02:00
|
|
|
if ($automatic_custom_graph_meta)
|
|
|
|
$module = $module_item['module'];
|
|
|
|
else
|
|
|
|
$module = $module_item;
|
|
|
|
|
|
|
|
$search_in_history_db = db_search_in_history_db($datelimit);
|
|
|
|
|
|
|
|
$temp[$module] = modules_get_agentmodule($module);
|
|
|
|
$query_last_value = sprintf('
|
|
|
|
SELECT datos
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE id_agente_modulo = %d
|
|
|
|
AND utimestamp < %d
|
|
|
|
ORDER BY utimestamp DESC',
|
2018-06-01 13:58:29 +02:00
|
|
|
$module, $params['date']);
|
2018-04-27 10:03:05 +02:00
|
|
|
$temp_data = db_get_value_sql($query_last_value);
|
|
|
|
|
|
|
|
if ($temp_data) {
|
|
|
|
if (is_numeric($temp_data))
|
|
|
|
$value = $temp_data;
|
|
|
|
else
|
|
|
|
$value = count($value);
|
|
|
|
}
|
|
|
|
else {
|
2018-06-06 11:18:39 +02:00
|
|
|
$value = false;
|
2018-04-27 10:03:05 +02:00
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
if ( !empty($params_combined['labels']) && isset($params_combined['labels'][$module]) ){
|
|
|
|
$label = io_safe_input($params_combined['labels'][$module]);
|
2018-04-27 10:03:05 +02:00
|
|
|
}else{
|
|
|
|
$alias = db_get_value ("alias","tagente","id_agente",$temp[$module]['id_agente']);
|
|
|
|
$label = $alias . ': ' . $temp[$module]['nombre'];
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-04-27 10:03:05 +02:00
|
|
|
$temp[$module]['label'] = $label;
|
|
|
|
$temp[$module]['value'] = $value;
|
2018-06-01 13:58:29 +02:00
|
|
|
$temp_max = reporting_get_agentmodule_data_max($module, $params['period'], $params['date']);
|
2018-04-27 10:03:05 +02:00
|
|
|
if ($temp_max < 0)
|
|
|
|
$temp_max = 0;
|
|
|
|
if (isset($acumulador)){
|
|
|
|
$temp[$module]['max'] = $acumulador;
|
|
|
|
}else{
|
|
|
|
$temp[$module]['max'] = ($temp_max === false) ? 0 : $temp_max;
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$temp_min = reporting_get_agentmodule_data_min($module, $params['period'], $params['date']);
|
2018-04-27 10:03:05 +02:00
|
|
|
if ($temp_min < 0)
|
|
|
|
$temp_min = 0;
|
|
|
|
$temp[$module]['min'] = ($temp_min === false) ? 0 : $temp_min;
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-04-27 10:03:05 +02:00
|
|
|
if ($config['metaconsole']) {
|
|
|
|
// Automatic custom graph from the report template in metaconsole
|
|
|
|
if (is_array($module_list[0])) {
|
|
|
|
metaconsole_restore_db();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
//XXXX
|
|
|
|
$graph_values = $temp;
|
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
$width = 1024;
|
|
|
|
$height = 50;
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$output = stacked_bullet_chart(
|
|
|
|
$graph_values,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
$color,
|
|
|
|
$module_name_list,
|
|
|
|
$long_index,
|
|
|
|
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
$water_mark,
|
|
|
|
$config['fontpath'],
|
|
|
|
($config['font_size']+1),
|
|
|
|
"",
|
|
|
|
$ttl,
|
|
|
|
$homeurl,
|
|
|
|
$background_color
|
|
|
|
);
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2018-04-27 10:03:05 +02:00
|
|
|
break;
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
case CUSTOM_GRAPH_GAUGE:
|
|
|
|
$i = 0;
|
2018-04-27 10:03:05 +02:00
|
|
|
foreach ($module_list as $module_item) {
|
|
|
|
$automatic_custom_graph_meta = false;
|
|
|
|
if ($config['metaconsole']) {
|
|
|
|
// Automatic custom graph from the report template in metaconsole
|
|
|
|
if (is_array($module_list[$i])) {
|
|
|
|
$server = metaconsole_get_connection_by_id ($module_item['server']);
|
|
|
|
metaconsole_connect($server);
|
|
|
|
$automatic_custom_graph_meta = true;
|
|
|
|
}
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-04-27 10:03:05 +02:00
|
|
|
if ($automatic_custom_graph_meta)
|
|
|
|
$module = $module_item['module'];
|
|
|
|
else
|
|
|
|
$module = $module_item;
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$temp[$module] = modules_get_agentmodule($module);
|
2018-04-27 10:03:05 +02:00
|
|
|
$query_last_value = sprintf('
|
|
|
|
SELECT datos
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE id_agente_modulo = %d
|
|
|
|
AND utimestamp < %d
|
|
|
|
ORDER BY utimestamp DESC',
|
2018-06-01 13:58:29 +02:00
|
|
|
$module, $params['date']);
|
2018-04-27 10:03:05 +02:00
|
|
|
$temp_data = db_get_value_sql($query_last_value);
|
2018-06-01 13:58:29 +02:00
|
|
|
if ( $temp_data ) {
|
|
|
|
if (is_numeric($temp_data))
|
|
|
|
$value = $temp_data;
|
|
|
|
else
|
|
|
|
$value = count($value);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$value = false;
|
|
|
|
}
|
|
|
|
$temp[$module]['label'] = ($params_combined['labels'][$module] != '') ? $params_combined['labels'][$module] : $temp[$module]['nombre'];
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$temp[$module]['value'] = $value;
|
|
|
|
$temp[$module]['label'] = ui_print_truncate_text($temp[$module]['label'],"module_small",false,true,false,"..");
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
if ($temp[$module]['unit'] == '%') {
|
|
|
|
$temp[$module]['min'] = 0;
|
|
|
|
$temp[$module]['max'] = 100;
|
2018-04-27 10:03:05 +02:00
|
|
|
}
|
2018-06-01 13:58:29 +02:00
|
|
|
else {
|
|
|
|
$min = $temp[$module]['min'];
|
|
|
|
if ($temp[$module]['max'] == 0)
|
|
|
|
$max = reporting_get_agentmodule_data_max($module, $params['period'], $params['date']);
|
|
|
|
else
|
|
|
|
$max = $temp[$module]['max'];
|
|
|
|
$temp[$module]['min'] = ($min == 0 ) ? 0 : $min;
|
|
|
|
$temp[$module]['max'] = ($max == 0 ) ? 100 : $max;
|
|
|
|
}
|
|
|
|
$temp[$module]['gauge'] = uniqid('gauge_');
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-04-27 10:03:05 +02:00
|
|
|
if ($config['metaconsole']) {
|
|
|
|
// Automatic custom graph from the report template in metaconsole
|
|
|
|
if (is_array($module_list[0])) {
|
|
|
|
metaconsole_restore_db();
|
|
|
|
}
|
|
|
|
}
|
2018-06-01 13:58:29 +02:00
|
|
|
$i++;
|
2018-04-27 10:03:05 +02:00
|
|
|
}
|
2018-06-01 13:58:29 +02:00
|
|
|
|
|
|
|
//XXXX
|
|
|
|
$graph_values = $temp;
|
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
$width = 200;
|
|
|
|
$height = 200;
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$output = stacked_gauge(
|
|
|
|
$graph_values,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
$color,
|
|
|
|
$module_name_list,
|
|
|
|
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
|
|
|
|
$config['fontpath'],
|
|
|
|
$fixed_font_size,
|
|
|
|
"",
|
2018-06-06 11:18:39 +02:00
|
|
|
$homeurl
|
2018-06-01 13:58:29 +02:00
|
|
|
);
|
|
|
|
|
2018-04-27 10:03:05 +02:00
|
|
|
break;
|
2018-06-01 13:58:29 +02:00
|
|
|
case CUSTOM_GRAPH_HBARS:
|
|
|
|
case CUSTOM_GRAPH_VBARS:
|
|
|
|
$label = '';
|
2018-04-27 10:03:05 +02:00
|
|
|
foreach ($module_list as $module_item) {
|
|
|
|
$automatic_custom_graph_meta = false;
|
|
|
|
if ($config['metaconsole']) {
|
|
|
|
// Automatic custom graph from the report template in metaconsole
|
|
|
|
if (is_array($module_list[$i])) {
|
|
|
|
$server = metaconsole_get_connection_by_id ($module_item['server']);
|
|
|
|
metaconsole_connect($server);
|
|
|
|
$automatic_custom_graph_meta = true;
|
|
|
|
}
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-04-27 10:03:05 +02:00
|
|
|
if ($automatic_custom_graph_meta)
|
|
|
|
$module = $module_item['module'];
|
|
|
|
else
|
|
|
|
$module = $module_item;
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$module_data = modules_get_agentmodule($module);
|
2018-04-27 10:03:05 +02:00
|
|
|
$query_last_value = sprintf('
|
|
|
|
SELECT datos
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE id_agente_modulo = %d
|
|
|
|
AND utimestamp < %d
|
|
|
|
ORDER BY utimestamp DESC',
|
2018-06-01 13:58:29 +02:00
|
|
|
$module, $params['date']);
|
2018-04-27 10:03:05 +02:00
|
|
|
$temp_data = db_get_value_sql($query_last_value);
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$agent_name = io_safe_output(
|
|
|
|
modules_get_agentmodule_agent_name ($module));
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
if (!empty($params_combined['labels']) && isset($params_combined['labels'][$module]) ){
|
|
|
|
$label = $params_combined['labels'][$module];
|
2018-04-27 10:03:05 +02:00
|
|
|
}else {
|
2018-06-01 13:58:29 +02:00
|
|
|
$alias = db_get_value ("alias","tagente","id_agente",$module_data['id_agente']);
|
|
|
|
$label = $alias . " - " .$module_data['nombre'];
|
2018-04-27 10:03:05 +02:00
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$temp[$label]['g'] = round($temp_data,4);
|
|
|
|
|
2018-04-27 10:03:05 +02:00
|
|
|
if ($config['metaconsole']) {
|
|
|
|
// Automatic custom graph from the report template in metaconsole
|
|
|
|
if (is_array($module_list[0])) {
|
|
|
|
metaconsole_restore_db();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-06-01 13:58:29 +02:00
|
|
|
|
|
|
|
//XXXX
|
|
|
|
$graph_values = $temp;
|
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
$width = 1024;
|
|
|
|
$height = 500;
|
|
|
|
$flash_charts = true;
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
if($params_combined['stacked'] == CUSTOM_GRAPH_HBARS){
|
|
|
|
$output = hbar_graph(
|
2018-06-06 11:18:39 +02:00
|
|
|
true,
|
2018-06-01 13:58:29 +02:00
|
|
|
$graph_values,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
$color,
|
|
|
|
$module_name_list,
|
|
|
|
$long_index,
|
|
|
|
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
$water_mark,
|
|
|
|
$config['fontpath'],
|
|
|
|
$fixed_font_size,
|
|
|
|
"",
|
|
|
|
$ttl,
|
|
|
|
$homeurl,
|
|
|
|
$background_color,
|
|
|
|
'black'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if($params_combined['stacked'] == CUSTOM_GRAPH_VBARS){
|
|
|
|
$output = vbar_graph(
|
2018-06-06 11:18:39 +02:00
|
|
|
true,
|
2018-06-01 13:58:29 +02:00
|
|
|
$graph_values,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
$color,
|
|
|
|
$module_name_list,
|
|
|
|
$long_index,
|
|
|
|
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
$water_mark,
|
|
|
|
$config['fontpath'],
|
|
|
|
$fixed_font_size,
|
|
|
|
"",
|
|
|
|
$ttl,
|
|
|
|
$homeurl,
|
|
|
|
$background_color,
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
"black"
|
|
|
|
);
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-06 11:57:02 +02:00
|
|
|
break;
|
|
|
|
case CUSTOM_GRAPH_THERMOMETER:
|
|
|
|
$datelimit = $params['date'] - $params['period'];
|
|
|
|
$i = 0;
|
|
|
|
foreach ($module_list as $module_item) {
|
|
|
|
$automatic_custom_graph_meta = false;
|
|
|
|
if ($config['metaconsole']) {
|
|
|
|
// Automatic custom graph from the report template in metaconsole
|
|
|
|
if (is_array($module_list[$i])) {
|
|
|
|
$server = metaconsole_get_connection_by_id ($module_item['server']);
|
|
|
|
metaconsole_connect($server);
|
|
|
|
$automatic_custom_graph_meta = true;
|
|
|
|
}
|
|
|
|
}
|
2017-01-17 14:29:42 +01:00
|
|
|
|
2018-06-06 11:57:02 +02:00
|
|
|
if ($automatic_custom_graph_meta)
|
|
|
|
$module = $module_item['module'];
|
|
|
|
else
|
|
|
|
$module = $module_item;
|
|
|
|
|
|
|
|
$temp[$module] = modules_get_agentmodule($module);
|
|
|
|
$query_last_value = sprintf('
|
|
|
|
SELECT datos
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE id_agente_modulo = %d
|
|
|
|
AND utimestamp < %d
|
|
|
|
ORDER BY utimestamp DESC',
|
|
|
|
$module, $params['date']);
|
|
|
|
$temp_data = db_get_value_sql($query_last_value);
|
|
|
|
if ( $temp_data ) {
|
|
|
|
if (is_numeric($temp_data))
|
|
|
|
$value = $temp_data;
|
|
|
|
else
|
|
|
|
$value = count($value);
|
2017-01-17 14:29:42 +01:00
|
|
|
}
|
|
|
|
else {
|
2018-06-06 11:57:02 +02:00
|
|
|
$value = false;
|
2017-01-17 14:29:42 +01:00
|
|
|
}
|
2018-06-06 11:57:02 +02:00
|
|
|
$temp[$module]['label'] = ($labels[$module] != '') ? $labels[$module] : $temp[$module]['nombre'];
|
|
|
|
$temp[$module]['value'] = $value;
|
|
|
|
$temp[$module]['label'] = ui_print_truncate_text($temp[$module]['label'],"module_small",false,true,false,"..");
|
2017-01-17 14:29:42 +01:00
|
|
|
|
2018-06-06 11:57:02 +02:00
|
|
|
if ($temp[$module]['unit'] == '%') {
|
|
|
|
$temp[$module]['min'] = 0;
|
|
|
|
$temp[$module]['max'] = 100;
|
2017-01-17 14:29:42 +01:00
|
|
|
}
|
|
|
|
else {
|
2018-06-06 11:57:02 +02:00
|
|
|
$min = $temp[$module]['min'];
|
|
|
|
if ($temp[$module]['max'] == 0)
|
|
|
|
$max = reporting_get_agentmodule_data_max($module,$params['period'],$params['date']);
|
|
|
|
else
|
|
|
|
$max = $temp[$module]['max'];
|
|
|
|
$temp[$module]['min'] = ($min == 0 ) ? 0 : $min;
|
|
|
|
$temp[$module]['max'] = ($max == 0 ) ? 100 : $max;
|
|
|
|
}
|
|
|
|
$temp[$module]['gauge'] = uniqid('gauge_');
|
|
|
|
|
|
|
|
if ($config['metaconsole']) {
|
|
|
|
// Automatic custom graph from the report template in metaconsole
|
|
|
|
if (is_array($module_list[0])) {
|
|
|
|
metaconsole_restore_db();
|
2017-01-17 14:29:42 +01:00
|
|
|
}
|
2016-11-28 10:53:05 +01:00
|
|
|
}
|
2018-06-06 11:57:02 +02:00
|
|
|
$i++;
|
|
|
|
|
|
|
|
//XXXX
|
|
|
|
$graph_values = $temp;
|
|
|
|
|
|
|
|
return stacked_thermometers(
|
|
|
|
$flash_charts,
|
|
|
|
$graph_values,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
$color,
|
|
|
|
$module_name_list,
|
|
|
|
$long_index,
|
|
|
|
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
$water_mark,
|
|
|
|
$config['fontpath'],
|
|
|
|
$fixed_font_size,
|
|
|
|
"",
|
|
|
|
$ttl,
|
|
|
|
$homeurl,
|
|
|
|
$background_color
|
|
|
|
);
|
2016-11-28 10:53:05 +01:00
|
|
|
}
|
2018-04-27 10:03:05 +02:00
|
|
|
break;
|
2018-06-01 13:58:29 +02:00
|
|
|
case CUSTOM_GRAPH_PIE:
|
|
|
|
$total_modules = 0;
|
2018-04-27 10:03:05 +02:00
|
|
|
foreach ($module_list as $module_item) {
|
|
|
|
$automatic_custom_graph_meta = false;
|
|
|
|
if ($config['metaconsole']) {
|
|
|
|
// Automatic custom graph from the report template in metaconsole
|
|
|
|
if (is_array($module_list[$i])) {
|
|
|
|
$server = metaconsole_get_connection_by_id ($module_item['server']);
|
|
|
|
metaconsole_connect($server);
|
|
|
|
$automatic_custom_graph_meta = true;
|
|
|
|
}
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-04-27 10:03:05 +02:00
|
|
|
if ($automatic_custom_graph_meta)
|
|
|
|
$module = $module_item['module'];
|
|
|
|
else
|
|
|
|
$module = $module_item;
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$data_module = modules_get_agentmodule($module);
|
2018-04-27 10:03:05 +02:00
|
|
|
$query_last_value = sprintf('
|
|
|
|
SELECT datos
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE id_agente_modulo = %d
|
2018-06-01 13:58:29 +02:00
|
|
|
AND utimestamp > %d
|
2018-04-27 10:03:05 +02:00
|
|
|
AND utimestamp < %d
|
|
|
|
ORDER BY utimestamp DESC',
|
2018-06-01 13:58:29 +02:00
|
|
|
$module, $datelimit, $params['date']);
|
2018-04-27 10:03:05 +02:00
|
|
|
$temp_data = db_get_value_sql($query_last_value);
|
2018-06-01 13:58:29 +02:00
|
|
|
|
|
|
|
if ( $temp_data ){
|
2018-04-27 10:03:05 +02:00
|
|
|
if (is_numeric($temp_data))
|
|
|
|
$value = $temp_data;
|
|
|
|
else
|
|
|
|
$value = count($value);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$value = false;
|
|
|
|
}
|
2018-06-01 13:58:29 +02:00
|
|
|
$total_modules += $value;
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
if ( !empty($params_combined['labels']) && isset($params_combined['labels'][$module]) ){
|
|
|
|
$label = io_safe_output($params_combined['labels'][$module]);
|
|
|
|
}else {
|
|
|
|
$alias = db_get_value ("alias","tagente","id_agente",$data_module['id_agente']);
|
|
|
|
$label = io_safe_output($alias . ": " . $data_module['nombre']);
|
2018-04-27 10:03:05 +02:00
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$temp[$label] = array('value'=>$value,
|
|
|
|
'unit'=>$data_module['unit']);
|
2018-04-27 10:03:05 +02:00
|
|
|
if ($config['metaconsole']) {
|
|
|
|
// Automatic custom graph from the report template in metaconsole
|
|
|
|
if (is_array($module_list[0])) {
|
|
|
|
metaconsole_restore_db();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$temp['total_modules'] = $total_modules;
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
//XXXX
|
|
|
|
$graph_values = $temp;
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
$width = 1024;
|
|
|
|
$height = 500;
|
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
$output = ring_graph(
|
2018-06-06 11:18:39 +02:00
|
|
|
true,
|
2018-06-01 13:58:29 +02:00
|
|
|
$graph_values,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
$others_str,
|
|
|
|
$homeurl,
|
|
|
|
$water_mark,
|
|
|
|
$config['fontpath'],
|
|
|
|
($config['font_size']+1),
|
|
|
|
$ttl,
|
|
|
|
false,
|
|
|
|
$color,
|
|
|
|
false,
|
|
|
|
$background_color
|
|
|
|
);
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
break;
|
2017-10-31 11:51:19 +01:00
|
|
|
}
|
2018-04-26 10:24:37 +02:00
|
|
|
|
2018-06-01 13:58:29 +02:00
|
|
|
if ($params_combined['return']){
|
|
|
|
return $output;
|
2011-04-12 18:30:24 +02:00
|
|
|
}
|
2018-06-01 13:58:29 +02:00
|
|
|
|
|
|
|
echo $output;
|
2011-04-12 18:30:24 +02:00
|
|
|
}
|
|
|
|
|
2018-05-21 17:25:09 +02:00
|
|
|
function combined_graph_summatory_average ($array_data, $average = false, $summatory = false, $modules_series = false, $baseline = false){
|
2018-05-18 14:22:39 +02:00
|
|
|
if(isset($array_data) && is_array($array_data)){
|
|
|
|
foreach ($array_data as $key => $value) {
|
|
|
|
if(strpos($key, 'sum') !== false){
|
|
|
|
$data_array_reverse[$key] = array_reverse($value['data']);
|
|
|
|
if(!$modules_series) {
|
|
|
|
unset($array_data[$key]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($data_array_reverse) && is_array($data_array_reverse)){
|
|
|
|
$array_sum_reverse = array();
|
|
|
|
$array_avg_reverse = array();
|
|
|
|
$data_array_prev = false;
|
|
|
|
$data_array_pop = array();
|
|
|
|
$count = 0;
|
|
|
|
|
|
|
|
while(count($data_array_reverse['sum0']) > 0){
|
|
|
|
foreach ($data_array_reverse as $key_reverse => $value_reverse) {
|
|
|
|
if(is_array($value_reverse) && count($value_reverse) > 0){
|
|
|
|
$data_array_pop[$key_reverse] = array_pop($data_array_reverse[$key_reverse]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($data_array_pop) && is_array($data_array_pop)){
|
|
|
|
$acum_data = 0;
|
|
|
|
$acum_array = array();
|
|
|
|
$sum_data = 0;
|
|
|
|
$count_pop = 0;
|
|
|
|
foreach ($data_array_pop as $key_pop => $value_pop) {
|
|
|
|
if( $value_pop[0] > $acum_data ){
|
|
|
|
if($acum_data != 0){
|
|
|
|
$sum_data = $sum_data + $data_array_prev[$key_pop][1];
|
|
|
|
$data_array_reverse[$key_pop][] = $value_pop;
|
|
|
|
$data_array_prev[$acum_key] = $acum_array;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
if($data_array_prev[$key_pop] == false){
|
|
|
|
$data_array_prev[$key_pop] = $value_pop;
|
|
|
|
}
|
|
|
|
$acum_key = $key_pop;
|
|
|
|
$acum_data = $value_pop[0];
|
|
|
|
$acum_array = $value_pop;
|
|
|
|
$sum_data = $value_pop[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif($value_pop[0] < $acum_data){
|
|
|
|
$sum_data = $sum_data + $data_array_prev[$key_pop][1];
|
|
|
|
$data_array_reverse[$acum_key][] = $acum_array;
|
|
|
|
$data_array_prev[$key_pop] = $value_pop;
|
|
|
|
$acum_key = $key_pop;
|
|
|
|
$acum_data = $value_pop[0];
|
|
|
|
$acum_array = $value_pop;
|
|
|
|
}
|
|
|
|
elseif($value_pop[0] == $acum_data){
|
|
|
|
$data_array_prev[$key_pop] = $value_pop;
|
|
|
|
$sum_data += $value_pop[1];
|
|
|
|
}
|
|
|
|
$count_pop++;
|
|
|
|
}
|
2018-05-21 17:25:09 +02:00
|
|
|
if($summatory){
|
|
|
|
$array_sum_reverse[$count][0] = $acum_data;
|
|
|
|
$array_sum_reverse[$count][1] = $sum_data;
|
|
|
|
}
|
|
|
|
if($average){
|
2018-05-18 14:22:39 +02:00
|
|
|
$array_avg_reverse[$count][0] = $acum_data;
|
|
|
|
$array_avg_reverse[$count][1] = $sum_data / $count_pop;
|
2018-05-21 17:25:09 +02:00
|
|
|
}
|
2018-05-18 14:22:39 +02:00
|
|
|
}
|
|
|
|
$count++;
|
|
|
|
}
|
2018-05-21 17:25:09 +02:00
|
|
|
|
|
|
|
if($summatory && isset($array_sum_reverse) && is_array($array_sum_reverse) && count($array_sum_reverse) > 0){
|
|
|
|
$array_data['summatory']['data'] = $array_sum_reverse;
|
|
|
|
$array_data['summatory']['color'] = 'purple';
|
|
|
|
}
|
|
|
|
|
|
|
|
if($average && isset($array_avg_reverse) && is_array($array_avg_reverse) && count($array_avg_reverse) > 0){
|
|
|
|
if($baseline){
|
|
|
|
$array_data['baseline']['data'] = $array_avg_reverse;
|
|
|
|
$array_data['baseline']['color'] = 'green';
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$array_data['average']['data'] = $array_avg_reverse;
|
|
|
|
$array_data['average']['color'] = 'orange';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-18 14:22:39 +02:00
|
|
|
}
|
2018-05-21 17:25:09 +02:00
|
|
|
return $array_data;
|
2018-05-18 14:22:39 +02:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-04-12 18:30:24 +02:00
|
|
|
/**
|
|
|
|
* Print a graph with access data of agents
|
2018-04-27 10:03:05 +02:00
|
|
|
*
|
2011-04-12 18:30:24 +02:00
|
|
|
* @param integer id_agent Agent ID
|
|
|
|
* @param integer width pie graph width
|
|
|
|
* @param integer height pie graph height
|
|
|
|
* @param integer period time period
|
2013-02-20 18:15:38 +01:00
|
|
|
* @param bool return or echo the result flag
|
2011-04-12 18:30:24 +02:00
|
|
|
*/
|
2018-06-06 11:18:39 +02:00
|
|
|
function graphic_agentaccess ($id_agent, $width, $height, $period = 0, $return = false, $tree = false) {
|
2011-04-12 18:30:24 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
$date = get_system_time();
|
|
|
|
$datelimit = $date - $period;
|
|
|
|
$data_array = array ();
|
|
|
|
|
|
|
|
$data = db_get_all_rows_sql(
|
|
|
|
"SELECT count(*) as data, min(utimestamp) as utimestamp
|
|
|
|
FROM tagent_access
|
|
|
|
WHERE id_agent = $id_agent
|
|
|
|
AND utimestamp > $datelimit
|
|
|
|
AND utimestamp < $date
|
|
|
|
GROUP by ROUND(utimestamp / 300)"
|
|
|
|
);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
if(isset($data) && is_array($data)){
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
$data_array['Agent access']['data'][$key][0] = $value['utimestamp'] * 1000;
|
|
|
|
$data_array['Agent access']['data'][$key][1] = $value['data'];
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
}
|
2018-06-06 11:18:39 +02:00
|
|
|
$data_array['Agent access']['color'] = 'green';
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
if ($return) {
|
|
|
|
return graph_nodata_image($width, $height);
|
2011-04-12 18:30:24 +02:00
|
|
|
}
|
2018-06-06 11:18:39 +02:00
|
|
|
else{
|
|
|
|
echo graph_nodata_image($width, $height);
|
2011-08-19 17:33:41 +02:00
|
|
|
}
|
2011-04-12 18:30:24 +02:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
//XXXXX
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2013-04-15 18:04:39 +02:00
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
$params =array(
|
|
|
|
'agent_module_id' => false,
|
|
|
|
'period' => $period,
|
|
|
|
'width' => $width,
|
|
|
|
'height' => $height,
|
|
|
|
'unit' => $unit,
|
|
|
|
'only_image' => $only_image,
|
|
|
|
'homeurl' => $homeurl,
|
|
|
|
'menu' => true,
|
|
|
|
'backgroundColor' => 'white',
|
|
|
|
'type_graph' => 'area',
|
|
|
|
'font' => $config['fontpath'],
|
|
|
|
'font-size' => $config['font_size'],
|
|
|
|
'array_data_create' => $data_array,
|
|
|
|
'show_overview' => false,
|
|
|
|
'show_export_csv' => false,
|
|
|
|
'vconsole' => $tree
|
|
|
|
);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-05-16 11:19:16 +02:00
|
|
|
if ($return) {
|
2018-06-06 11:18:39 +02:00
|
|
|
return grafico_modulo_sparse($params);
|
2013-02-20 18:15:38 +01:00
|
|
|
}
|
|
|
|
else {
|
2018-06-06 11:18:39 +02:00
|
|
|
echo grafico_modulo_sparse($params);
|
2013-02-20 18:15:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-27 18:11:42 +01:00
|
|
|
/**
|
|
|
|
* Print a pie graph with alerts defined/fired data
|
|
|
|
*
|
|
|
|
* @param integer Number of defined alerts
|
|
|
|
* @param integer Number of fired alerts
|
|
|
|
* @param integer width pie graph width
|
|
|
|
* @param integer height pie graph height
|
|
|
|
* @param bool return or echo flag
|
|
|
|
*/
|
|
|
|
function graph_alert_status ($defined_alerts, $fired_alerts, $width = 300, $height = 200, $return = false) {
|
|
|
|
global $config;
|
|
|
|
|
2013-07-09 11:44:11 +02:00
|
|
|
$data = array(__('Not fired alerts') => $defined_alerts - $fired_alerts, __('Fired alerts') => $fired_alerts);
|
2013-02-27 18:11:42 +01:00
|
|
|
$colors = array(COL_NORMAL, COL_ALERTFIRED);
|
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2013-02-27 18:11:42 +01:00
|
|
|
|
|
|
|
$out = pie2d_graph($config['flash_charts'], $data, $width, $height, __("other"),
|
2013-07-09 11:44:11 +02:00
|
|
|
'', '', $config['fontpath'], $config['font_size'], 1, "hidden", $colors);
|
2013-02-27 18:11:42 +01:00
|
|
|
|
|
|
|
if ($return) {
|
|
|
|
return $out;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
echo $out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-15 18:04:39 +02:00
|
|
|
// If any value is negative, truncate it to 0
|
|
|
|
function truncate_negatives(&$element) {
|
2013-04-22 19:43:28 +02:00
|
|
|
if ($element < 0) {
|
|
|
|
$element = 0;
|
|
|
|
}
|
2013-04-15 18:04:39 +02:00
|
|
|
}
|
|
|
|
|
2013-02-20 18:15:38 +01:00
|
|
|
/**
|
2013-02-25 17:44:26 +01:00
|
|
|
* Print a pie graph with events data of agent or all agents (if id_agent = false)
|
2013-02-20 18:15:38 +01:00
|
|
|
*
|
|
|
|
* @param integer id_agent Agent ID
|
|
|
|
* @param integer width pie graph width
|
|
|
|
* @param integer height pie graph height
|
|
|
|
* @param bool return or echo flag
|
2013-02-26 17:10:02 +01:00
|
|
|
* @param bool show_not_init flag
|
2013-02-20 18:15:38 +01:00
|
|
|
*/
|
2014-09-29 11:19:51 +02:00
|
|
|
function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $return = false, $show_not_init = false, $data_agents=false) {
|
2013-02-20 18:15:38 +01:00
|
|
|
global $config;
|
2014-09-29 11:19:51 +02:00
|
|
|
|
|
|
|
if ($data_agents == false) {
|
2018-03-26 12:52:37 +02:00
|
|
|
$groups = implode(',', array_keys(users_get_groups(false, 'AR', false)));
|
|
|
|
$data = db_get_row_sql(sprintf('SELECT
|
|
|
|
SUM(critical_count) AS Critical,
|
|
|
|
SUM(warning_count) AS Warning,
|
|
|
|
SUM(normal_count) AS Normal,
|
|
|
|
SUM(unknown_count) AS Unknown
|
|
|
|
%s
|
|
|
|
FROM tagente ta LEFT JOIN tagent_secondary_group tasg
|
|
|
|
ON ta.id_agente = tasg.id_agent
|
|
|
|
WHERE
|
|
|
|
ta.disabled = 0 AND
|
2018-03-27 17:02:41 +02:00
|
|
|
%s
|
2018-03-26 12:52:37 +02:00
|
|
|
(ta.id_grupo IN (%s) OR tasg.id_group IN (%s))',
|
|
|
|
$show_not_init ? ', SUM(notinit_count) "Not init"' : '',
|
2018-03-27 17:02:41 +02:00
|
|
|
empty($id_agent) ? '' : "ta.id_agente = $id_agent AND",
|
2018-03-26 12:52:37 +02:00
|
|
|
$groups,
|
|
|
|
$groups
|
|
|
|
));
|
2014-09-29 11:19:51 +02:00
|
|
|
} else {
|
|
|
|
$data = $data_agents;
|
|
|
|
}
|
2018-03-26 12:52:37 +02:00
|
|
|
|
2014-07-29 17:11:23 +02:00
|
|
|
if (empty($data)) {
|
|
|
|
$data = array();
|
|
|
|
}
|
2013-02-20 18:15:38 +01:00
|
|
|
|
2013-03-11 16:57:35 +01:00
|
|
|
array_walk($data, 'truncate_negatives');
|
2013-03-15 15:38:48 +01:00
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2013-02-20 18:15:38 +01:00
|
|
|
|
2015-04-16 10:50:43 +02:00
|
|
|
//$colors = array(COL_CRITICAL, COL_WARNING, COL_NORMAL, COL_UNKNOWN);
|
|
|
|
$colors[__('Critical')] = COL_CRITICAL;
|
|
|
|
$colors[__('Warning')] = COL_WARNING;
|
|
|
|
$colors[__('Normal')] = COL_NORMAL;
|
|
|
|
$colors[__('Unknown')] = COL_UNKNOWN;
|
2013-02-26 17:10:02 +01:00
|
|
|
|
2013-03-15 15:38:48 +01:00
|
|
|
if ($show_not_init) {
|
2015-04-16 10:50:43 +02:00
|
|
|
$colors[__('Not init')] = COL_NOTINIT;
|
2013-02-26 17:10:02 +01:00
|
|
|
}
|
2013-02-20 18:15:38 +01:00
|
|
|
|
2013-05-23 17:42:32 +02:00
|
|
|
if (array_sum($data) == 0) {
|
|
|
|
$data = array();
|
|
|
|
}
|
|
|
|
|
2013-07-11 10:15:48 +02:00
|
|
|
$out = pie2d_graph($config['flash_charts'], $data, $width, $height,
|
2015-03-18 20:28:55 +01:00
|
|
|
__("other"), ui_get_full_url(false, false, false, false), '',
|
|
|
|
$config['fontpath'], $config['font_size'], 1, "hidden", $colors);
|
2013-02-21 11:10:49 +01:00
|
|
|
|
2013-02-20 18:15:38 +01:00
|
|
|
if ($return) {
|
|
|
|
return $out;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
echo $out;
|
|
|
|
}
|
2011-04-12 18:30:24 +02:00
|
|
|
}
|
|
|
|
|
2013-02-20 18:15:38 +01:00
|
|
|
|
2011-04-12 18:30:24 +02:00
|
|
|
/**
|
|
|
|
* Print a pie graph with events data of agent
|
|
|
|
*
|
|
|
|
* @param integer width pie graph width
|
|
|
|
* @param integer height pie graph height
|
|
|
|
* @param integer id_agent Agent ID
|
|
|
|
*/
|
2011-07-19 11:28:09 +02:00
|
|
|
function graph_event_module ($width = 300, $height = 200, $id_agent) {
|
2011-04-12 18:30:24 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2014-02-14 14:20:38 +01:00
|
|
|
|
|
|
|
// Fix: tag filters implemented! for tag functionality groups have to be all user_groups (propagate ACL funct!)
|
|
|
|
$groups = users_get_groups($config["id_user"]);
|
|
|
|
$tags_condition = tags_get_acl_tags($config['id_user'], array_keys($groups), 'ER', 'event_condition', 'AND');
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
|
2011-04-12 18:30:24 +02:00
|
|
|
$data = array ();
|
|
|
|
$max_items = 6;
|
2011-05-16 18:56:14 +02:00
|
|
|
switch ($config["dbtype"]) {
|
|
|
|
case "mysql":
|
|
|
|
case "postgresql":
|
2013-01-30 17:29:49 +01:00
|
|
|
$sql = sprintf ('SELECT COUNT(id_evento) AS count_number,
|
2013-04-12 11:27:55 +02:00
|
|
|
id_agentmodule
|
|
|
|
FROM tevento
|
2014-02-14 14:20:38 +01:00
|
|
|
WHERE tevento.id_agente = %d %s
|
|
|
|
GROUP BY id_agentmodule ORDER BY count_number DESC LIMIT %d', $id_agent, $tags_condition, $max_items);
|
2011-05-16 18:56:14 +02:00
|
|
|
break;
|
|
|
|
case "oracle":
|
2013-01-30 17:29:49 +01:00
|
|
|
$sql = sprintf ('SELECT COUNT(id_evento) AS count_number,
|
2013-04-12 11:27:55 +02:00
|
|
|
id_agentmodule
|
|
|
|
FROM tevento
|
|
|
|
WHERE tevento.id_agente = %d AND rownum <= %d
|
|
|
|
GROUP BY id_agentmodule ORDER BY count_number DESC', $id_agent, $max_items);
|
2011-05-16 18:56:14 +02:00
|
|
|
break;
|
|
|
|
}
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
|
* include/functions_graph.php
include/functions_html.php
include/functions_messages.php
include/db/postgresql.php
include/db/mysql.php
include/db/oracle.php
include/functions_reporting.php
include/functions_filemanager.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/ajax/skins.ajax.php
include/ajax/reporting.ajax.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/help/en/help_timesource.php
include/help/es/help_timesource.php
include/help/ja/help_timesource.php
include/config_process.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_incidents.php
include/api.php
include/functions_reports.php
include/functions_ui_renders.php
extensions/insert_data.php
extensions/system_info.php
extensions/extension_uploader.php
extensions/pandora_logs.php
extensions/agents_modules.php
extensions/update_manager.php
extensions/ssh_console.php
extensions/dbmanager.php
extensions/vnc_view.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/users_connected.php
extensions/module_groups.php
extensions/update_manager/load_updatemanager.php
extensions/update_manager/lib/libupdate_manager_client.php
extensions/update_manager/lib/libupdate_manager.php
extensions/update_manager/lib/libupdate_manager_components.php
extensions/update_manager/lib/libupdate_manager_updates.php
extensions/update_manager/settings.php
extensions/update_manager/main.php
extensions/plugin_registration.php
operation/incidents/incident.php
operation/incidents/incident_detail.php
operation/incidents/incident_statistics.php
operation/search_modules.php
operation/visual_console/render_view.php
operation/visual_console/index.php
operation/extensions.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/custom_fields.php
operation/agentes/estado_agente.php
operation/agentes/networkmap.topology.php
operation/agentes/networkmap.groups.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/gis_view.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.php
operation/agentes/graphs.php
operation/agentes/agent_fields.php
operation/agentes/tactical.php
operation/agentes/group_view.php
operation/agentes/networkmap.php
operation/agentes/stat_win.php
operation/servers/view_server.php
operation/servers/view_server_detail.php
operation/menu.php
operation/search_agents.php
operation/search_graphs.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/integria_incidents/incident.php
operation/integria_incidents/incident_detail.php
operation/integria_incidents/incident_statistics.php
operation/events/event_statistics.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/sound_events.php
operation/events/events_validate.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
operation/reporting/graph_viewer.php
operation/search_reports.php
operation/search_maps.php
operation/search_users.php
extras/pandora_diag.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
mobile/index.php
general/error_authconfig.php
general/links_menu.php
general/logon_ok.php
general/error_dbconfig.php
general/ui/agents_list.php
general/header.php
godmode/groups/modu_group_list.php
godmode/groups/configure_group.php
godmode/groups/configure_modu_group.php
godmode/groups/group_list.php
godmode/admin_access_logs.php
godmode/db/db_main.php
godmode/db/db_audit.php
godmode/db/db_sanity.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_event.php
godmode/db/db_purge.php
godmode/extensions.php
godmode/agentes/agent_template.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/fields_manager.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/configure_field.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/recon_script.php
godmode/servers/plugin.php
godmode/servers/manage_recontask.php
godmode/servers/modificar_server.php
godmode/servers/manage_recontask_form.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.php
godmode/alerts/alert_list.php
godmode/alerts/configure_alert_template.php
godmode/alerts/alert_templates.php
godmode/alerts/configure_alert_action.php
godmode/alerts/configure_alert_command.php
godmode/alerts/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/alerts/alert_commands.php
godmode/setup/file_manager.php
godmode/setup/os.list.php
godmode/setup/news.php
godmode/setup/gis_step_2.php
godmode/setup/links.php
godmode/setup/setup.php
godmode/setup/os.php
godmode/setup/performance.php
godmode/setup/setup_auth.php
godmode/setup/gis.php
godmode/setup/os.builder.php
godmode/setup/setup_visuals.php
godmode/snmpconsole/snmp_alert.php
godmode/snmpconsole/snmp_filters.php
godmode/users/user_list.php
godmode/users/configure_profile.php
godmode/gis_maps/configure_gis_map.php
godmode/gis_maps/index.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_operations.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_modules.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/modules/manage_network_components_form.php
godmode/modules/manage_nc_groups_form.php
godmode/modules/manage_network_templates.php
godmode/modules/module_list.php
godmode/modules/manage_network_components_form_common.php
godmode/modules/manage_network_components_form_network.php
godmode/modules/manage_network_templates_form.php
godmode/modules/manage_network_components_form_wmi.php
godmode/modules/manage_network_components.php
godmode/modules/manage_nc_groups.php
godmode/reporting/visual_console_builder.wizard.php
godmode/reporting/graph_builder.main.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.php
godmode/reporting/reporting_builder.preview.php
godmode/reporting/reporting_builder.main.php
godmode/reporting/visual_console_builder.data.php
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/graph_builder.php
godmode/reporting/visual_console_builder.preview.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/visual_console_builder.editor.php
godmode/reporting/reporting_builder.item_editor.php
godmode/reporting/map_builder.php
godmode/reporting/graphs.php
godmode/reporting/graph_builder.preview.php
include/functions_db.php: Added some includes and functions of this code have "db_" prefix.
* include/functions.php: Moved function check_login(), check_acl(),
dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php.
* include/functions_groups.php: Moved functions get_childrens(), safe_acl_group()
and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(),
get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(),
get_group_name(), get_group_users() from functions_db.php to this code.
* include/functions_profile.php: New library with profile functions. Moved functions
get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(),
delete_profile() from functions_db.php to this code. Added new parameter in function
get_profile() to retrieve profiles with filter conditions applied.
* include/functions_users.php: New library with users functions. Moved functions
get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(),
get_user_first_group(), user_access_to_agent() from funtions_db.php to this code.
* godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile().
* include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(),
get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(),
check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(),
agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(),
get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(),
get_agent_group() from functions_db.php to this code.
* include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(),
get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(),
get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(),
get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(),
get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(),
get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(),
give_modulecategory_name(),
give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(),
get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(),
get_modulegroup_name() from functions_db.php to this code.
* include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(),
get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(),
get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(),
get_agentmodule_last_status() from functions_db.php to this code.
* include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion()
from functions_db.php to this code.
* include/functions_events.php: Moved functions get_group_events(), get_agent_events(),
get_module_events() from functions_db.php to this code.
* include/functions_servers.php: Moved functions get_server_name(), show_server_type(),
check_server_status(), server_status() from functions_db.php to this code.
* include/functions_network_profiles.php: Moved function get_networkprofile_name()
from functions_db.php to this code.
* include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y()
from fucntions_db.php to this code.
* include/functions_io.php: Moved function __() from functions_db.php to this code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-19 20:42:49 +02:00
|
|
|
$events = db_get_all_rows_sql ($sql);
|
2011-04-12 18:30:24 +02:00
|
|
|
if ($events === false) {
|
|
|
|
if (! $graphic_type) {
|
2011-07-19 11:28:09 +02:00
|
|
|
return fs_error_image ();
|
2011-04-12 18:30:24 +02:00
|
|
|
}
|
|
|
|
graphic_error ();
|
|
|
|
return;
|
2011-04-05 18:11:53 +02:00
|
|
|
}
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
|
2011-04-12 18:30:24 +02:00
|
|
|
foreach ($events as $event) {
|
2013-07-22 16:33:37 +02:00
|
|
|
if ($event['id_agentmodule'] == 0) {
|
2013-04-12 11:27:55 +02:00
|
|
|
$key = __('System') . ' ('.$event['count_number'].')';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$key = modules_get_agentmodule_name ($event['id_agentmodule']) .
|
|
|
|
' ('.$event['count_number'].')';
|
|
|
|
}
|
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
$data[$key] = $event["count_number"];
|
2011-04-12 18:30:24 +02:00
|
|
|
}
|
2011-04-05 18:11:53 +02:00
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2011-04-20 11:23:54 +02:00
|
|
|
return pie3d_graph($config['flash_charts'], $data, $width, $height, __("other"),
|
2015-03-18 20:28:55 +01:00
|
|
|
'', $water_mark, $config['fontpath'], $config['font_size'], 1, "bottom");
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/graphs/functions_gd.php,
include/graphs/fgraph.php, include/functions_visual_map.php,
include/fgraph.php, operation/agentes/estado_generalagente.php,
operation/agentes/tactical.php. operation/agentes/stat_win.php,
operation/servers/view_server.php, operation/servers/view_server_detail.php,
mobile/operation/agents/tactical.php, general/logon_ok.php,
godmode/reporting/graph_builder.preview.php: added function "progress_bar2"
and changed in source code of Pandora.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4199 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 11:29:10 +02:00
|
|
|
|
2012-06-12 21:26:26 +02:00
|
|
|
function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value_text = false, $color = false, $options = false) {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/graphs/functions_gd.php,
include/graphs/fgraph.php, include/functions_visual_map.php,
include/fgraph.php, operation/agentes/estado_generalagente.php,
operation/agentes/tactical.php. operation/agentes/stat_win.php,
operation/servers/view_server.php, operation/servers/view_server_detail.php,
mobile/operation/agents/tactical.php, general/logon_ok.php,
godmode/reporting/graph_builder.preview.php: added function "progress_bar2"
and changed in source code of Pandora.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4199 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 11:29:10 +02:00
|
|
|
global $config;
|
|
|
|
|
2013-08-02 12:53:50 +02:00
|
|
|
$out_of_lim_str = io_safe_output(__("Out of limits"));
|
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/graphs/functions_gd.php,
include/graphs/fgraph.php, include/functions_visual_map.php,
include/fgraph.php, operation/agentes/estado_generalagente.php,
operation/agentes/tactical.php. operation/agentes/stat_win.php,
operation/servers/view_server.php, operation/servers/view_server_detail.php,
mobile/operation/agents/tactical.php, general/logon_ok.php,
godmode/reporting/graph_builder.preview.php: added function "progress_bar2"
and changed in source code of Pandora.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4199 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 11:29:10 +02:00
|
|
|
$title = "";
|
2011-06-13 13:12:32 +02:00
|
|
|
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
if ($value_text === false) {
|
|
|
|
$value_text = $progress . "%";
|
|
|
|
}
|
|
|
|
|
|
|
|
$colorRGB = '';
|
|
|
|
if ($color !== false) {
|
|
|
|
$colorRGB = html_html2rgb($color);
|
|
|
|
$colorRGB = implode('|', $colorRGB);
|
|
|
|
}
|
|
|
|
|
2012-06-12 21:26:26 +02:00
|
|
|
$class_tag = '';
|
|
|
|
$id_tag = '';
|
|
|
|
if ($options !== false) {
|
|
|
|
foreach ($options as $option_type => $option_value) {
|
|
|
|
if ($option_type == 'class')
|
|
|
|
$class_tag = ' class="' . $option_value . '" ';
|
|
|
|
else if ($option_type == 'id')
|
|
|
|
$id_tag = ' id="' . $option_value . '" ';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-13 13:12:32 +02:00
|
|
|
require_once("include_graph_dependencies.php");
|
2011-06-14 16:08:14 +02:00
|
|
|
include_graphs_dependencies($config['homedir'].'/');
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
$src = ui_get_full_url(
|
2017-10-30 18:03:09 +01:00
|
|
|
"/include/graphs/fgraph.php?graph_type=progressbar" .
|
|
|
|
"&width=".$width."&height=".$height."&progress=".$progress.
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
"&mode=" . $mode . "&out_of_lim_str=".$out_of_lim_str .
|
2017-10-30 18:03:09 +01:00
|
|
|
"&title=".$title."&value_text=". $value_text .
|
2012-11-27 12:53:31 +01:00
|
|
|
"&colorRGB=". $colorRGB, false, false, false
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
return "<img title='" . $title . "' alt='" . $title . "'" . $class_tag . $id_tag .
|
|
|
|
" src='" . $src . "' />";
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
}
|
2011-06-13 13:12:32 +02:00
|
|
|
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
function progress_bubble($progress, $width, $height, $title = '', $mode = 1, $value_text = false, $color = false) {
|
|
|
|
global $config;
|
|
|
|
|
2012-12-13 18:04:19 +01:00
|
|
|
$hack_metaconsole = '';
|
|
|
|
if (defined('METACONSOLE'))
|
|
|
|
$hack_metaconsole = '../../';
|
|
|
|
|
2013-08-02 12:53:50 +02:00
|
|
|
$out_of_lim_str = io_safe_output(__("Out of limits"));
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
$title = "";
|
|
|
|
|
|
|
|
if ($value_text === false) {
|
|
|
|
$value_text = $progress . "%";
|
|
|
|
}
|
|
|
|
|
|
|
|
$colorRGB = '';
|
|
|
|
if ($color !== false) {
|
|
|
|
$colorRGB = html_html2rgb($color);
|
|
|
|
$colorRGB = implode('|', $colorRGB);
|
|
|
|
}
|
|
|
|
|
|
|
|
require_once("include_graph_dependencies.php");
|
|
|
|
include_graphs_dependencies($config['homedir'].'/');
|
|
|
|
|
|
|
|
return "<img title='" . $title . "' alt='" . $title . "'" .
|
2017-10-30 18:03:09 +01:00
|
|
|
" src='" . $config['homeurl'] . $hack_metaconsole . "/include/graphs/fgraph.php?graph_type=progressbubble" .
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
"&width=".$width."&height=".$height."&progress=".$progress.
|
|
|
|
"&mode=" . $mode . "&out_of_lim_str=".$out_of_lim_str .
|
2017-10-30 18:03:09 +01:00
|
|
|
"&title=".$title."&value_text=". $value_text .
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
"&colorRGB=". $colorRGB . "' />";
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/graphs/functions_gd.php,
include/graphs/fgraph.php, include/functions_visual_map.php,
include/fgraph.php, operation/agentes/estado_generalagente.php,
operation/agentes/tactical.php. operation/agentes/stat_win.php,
operation/servers/view_server.php, operation/servers/view_server_detail.php,
mobile/operation/agents/tactical.php, general/logon_ok.php,
godmode/reporting/graph_builder.preview.php: added function "progress_bar2"
and changed in source code of Pandora.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4199 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 11:29:10 +02:00
|
|
|
}
|
2011-04-13 15:01:37 +02:00
|
|
|
|
2013-02-18 11:59:12 +01:00
|
|
|
function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek = null, $time_from = null, $time_to = null, $width, $height, $home_url, $ttl = 1, $data = false, $round_corner = null) {
|
2011-04-13 15:01:37 +02:00
|
|
|
global $config;
|
2012-04-24 15:45:02 +02:00
|
|
|
|
2013-02-18 11:59:12 +01:00
|
|
|
if ($round_corner === null) {
|
|
|
|
$round_corner = $config['round_corner'];
|
|
|
|
}
|
|
|
|
|
2012-11-08 08:42:11 +01:00
|
|
|
// If the data is not provided, we got it
|
2013-02-18 11:59:12 +01:00
|
|
|
if ($data === false) {
|
|
|
|
$data = reporting_get_agentmodule_sla_array ($id, $period,
|
2016-03-14 10:53:03 +01:00
|
|
|
$sla_min, $sla_max, $date, $daysWeek, null, null);
|
2012-11-08 08:42:11 +01:00
|
|
|
}
|
|
|
|
|
2015-07-03 13:16:30 +02:00
|
|
|
$col_planned_downtime = '#20973F';
|
|
|
|
|
2013-02-18 11:59:12 +01:00
|
|
|
$colors = array(1 => COL_NORMAL,
|
|
|
|
2 => COL_WARNING,
|
|
|
|
3 => COL_CRITICAL,
|
|
|
|
4 => COL_UNKNOWN,
|
2018-04-11 16:22:16 +02:00
|
|
|
5 => COL_DOWNTIME,
|
2016-11-24 18:27:11 +01:00
|
|
|
6 => COL_NOTINIT,
|
2018-04-11 16:22:16 +02:00
|
|
|
7 => COL_IGNORED);
|
2012-04-24 15:45:02 +02:00
|
|
|
|
2013-02-18 11:59:12 +01:00
|
|
|
return slicesbar_graph($data, $period, $width, $height, $colors,
|
2015-03-18 20:28:55 +01:00
|
|
|
$config['fontpath'], $round_corner, $home_url, $ttl);
|
2011-04-13 15:01:37 +02:00
|
|
|
}
|
2011-04-13 17:58:59 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Print a pie graph with purge data of agent
|
|
|
|
*
|
|
|
|
* @param integer id_agent ID of agent to show
|
|
|
|
* @param integer width pie graph width
|
|
|
|
* @param integer height pie graph height
|
|
|
|
*/
|
2011-07-21 11:24:41 +02:00
|
|
|
function grafico_db_agentes_purge ($id_agent, $width = 380, $height = 300) {
|
2011-04-13 17:58:59 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2011-04-20 11:23:54 +02:00
|
|
|
|
2015-05-18 18:08:14 +02:00
|
|
|
$filter = array();
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2011-04-13 17:58:59 +02:00
|
|
|
if ($id_agent < 1) {
|
|
|
|
$query = "";
|
2012-07-18 15:25:51 +02:00
|
|
|
}
|
|
|
|
else {
|
2014-10-14 13:18:42 +02:00
|
|
|
$modules = agents_get_modules($id_agent);
|
|
|
|
$module_ids = array_keys($modules);
|
2015-05-18 18:08:14 +02:00
|
|
|
|
|
|
|
if (!empty($module_ids))
|
|
|
|
$filter['id_agente_modulo'] = $module_ids;
|
2011-04-13 17:58:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// All data (now)
|
2014-10-14 13:18:42 +02:00
|
|
|
$time_now = time();
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
|
2011-04-13 17:58:59 +02:00
|
|
|
// 1 day ago
|
2014-10-14 13:18:42 +02:00
|
|
|
$time_1day = $time_now - SECONDS_1DAY;
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
|
2011-04-13 17:58:59 +02:00
|
|
|
// 1 week ago
|
2014-10-14 13:18:42 +02:00
|
|
|
$time_1week = $time_now - SECONDS_1WEEK;
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
|
2011-04-13 17:58:59 +02:00
|
|
|
// 1 month ago
|
2014-10-14 13:18:42 +02:00
|
|
|
$time_1month = $time_now - SECONDS_1MONTH;
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
|
2011-04-13 17:58:59 +02:00
|
|
|
// Three months ago
|
2014-10-14 13:18:42 +02:00
|
|
|
$time_3months = $time_now - SECONDS_3MONTHS;
|
|
|
|
|
|
|
|
$query_error = false;
|
2015-05-18 18:08:14 +02:00
|
|
|
|
2014-10-14 13:18:42 +02:00
|
|
|
// Data from 1 day ago
|
2015-05-18 18:08:14 +02:00
|
|
|
$num_1day = 0;
|
2015-10-26 10:03:42 +01:00
|
|
|
$num_1day += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE utimestamp > ' . $time_1day);
|
|
|
|
$num_1day += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos_string
|
|
|
|
WHERE utimestamp > ' . $time_1day);
|
|
|
|
$num_1day += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos_log4x
|
|
|
|
WHERE utimestamp > ' . $time_1day);
|
|
|
|
if ($num_1day >= 0) {
|
2014-10-14 13:18:42 +02:00
|
|
|
// Data from 1 week ago
|
2015-05-18 18:08:14 +02:00
|
|
|
$num_1week = 0;
|
2015-10-26 10:03:42 +01:00
|
|
|
$num_1week += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE utimestamp > ' . $time_1week . '
|
|
|
|
AND utimestamp < ' . $time_1day);
|
|
|
|
$num_1week += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos_string
|
|
|
|
WHERE utimestamp > ' . $time_1week . '
|
|
|
|
AND utimestamp < ' . $time_1day);
|
|
|
|
$num_1week += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos_log4x
|
|
|
|
WHERE utimestamp > ' . $time_1week . '
|
|
|
|
AND utimestamp < ' . $time_1day);
|
|
|
|
if ($num_1week >= 0) {
|
2015-10-26 10:58:31 +01:00
|
|
|
if ($num_1week > 0) {
|
|
|
|
$num_1week = 0;
|
|
|
|
$num_1week += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE utimestamp > ' . $time_1week);
|
|
|
|
$num_1week += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos_string
|
|
|
|
WHERE utimestamp > ' . $time_1week);
|
|
|
|
$num_1week += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos_log4x
|
|
|
|
WHERE utimestamp > ' . $time_1week);
|
|
|
|
}
|
2014-10-14 13:18:42 +02:00
|
|
|
// Data from 1 month ago
|
2015-05-18 18:08:14 +02:00
|
|
|
$num_1month = 0;
|
2015-10-26 10:03:42 +01:00
|
|
|
$num_1month += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE utimestamp > ' . $time_1month . '
|
|
|
|
AND utimestamp < ' . $time_1week);
|
|
|
|
$num_1month += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos_string
|
|
|
|
WHERE utimestamp > ' . $time_1month . '
|
|
|
|
AND utimestamp < ' . $time_1week);
|
|
|
|
$num_1month += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos_log4x
|
|
|
|
WHERE utimestamp > ' . $time_1month . '
|
|
|
|
AND utimestamp < ' . $time_1week);
|
|
|
|
if ($num_1month >= 0) {
|
2015-10-26 10:58:31 +01:00
|
|
|
if ($num_1month > 0) {
|
|
|
|
$num_1month = 0;
|
|
|
|
$num_1month += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE utimestamp > ' . $time_1month);
|
|
|
|
$num_1month += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos_string
|
|
|
|
WHERE utimestamp > ' . $time_1month);
|
|
|
|
$num_1month += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos_log4x
|
|
|
|
WHERE utimestamp > ' . $time_1month);
|
|
|
|
}
|
2014-10-14 13:18:42 +02:00
|
|
|
// Data from 3 months ago
|
2015-05-18 18:08:14 +02:00
|
|
|
$num_3months = 0;
|
2015-10-26 10:03:42 +01:00
|
|
|
$num_3months += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE utimestamp > ' . $time_3months . '
|
|
|
|
AND utimestamp < ' . $time_1month);
|
|
|
|
$num_3months += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE utimestamp > ' . $time_3months . '
|
|
|
|
AND utimestamp < ' . $time_1month);
|
|
|
|
$num_3months += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE utimestamp > ' . $time_3months . '
|
|
|
|
AND utimestamp < ' . $time_1month);
|
|
|
|
if ($num_3months >= 0) {
|
2015-10-26 10:58:31 +01:00
|
|
|
if ($num_3months > 0) {
|
|
|
|
$num_3months = 0;
|
|
|
|
$num_3months += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE utimestamp > ' . $time_3months);
|
|
|
|
$num_3months += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE utimestamp > ' . $time_3months);
|
|
|
|
$num_3months += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE utimestamp > ' . $time_3months);
|
|
|
|
}
|
2014-10-14 13:18:42 +02:00
|
|
|
// All data
|
2015-10-26 10:03:42 +01:00
|
|
|
$num_all = 0;
|
|
|
|
$num_all += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE utimestamp < ' . $time_3months);
|
|
|
|
$num_all += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE utimestamp < ' . $time_3months);
|
|
|
|
$num_all += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
|
|
|
WHERE utimestamp < ' . $time_3months);
|
|
|
|
if ($num_all >= 0) {
|
2014-10-14 13:18:42 +02:00
|
|
|
$num_older = $num_all - $num_3months;
|
|
|
|
if ($config['history_db_enabled'] == 1) {
|
|
|
|
// All data in common and history database
|
2015-10-26 10:03:42 +01:00
|
|
|
$num_all_w_history = 0;
|
|
|
|
$num_all_w_history += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
2015-10-26 10:58:31 +01:00
|
|
|
WHERE utimestamp < ' . $time_3months);
|
2015-10-26 10:03:42 +01:00
|
|
|
$num_all_w_history += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
2015-10-26 10:58:31 +01:00
|
|
|
WHERE utimestamp < ' . $time_3months);
|
2015-10-26 10:03:42 +01:00
|
|
|
$num_all_w_history += (int) db_get_sql('SELECT COUNT(*)
|
|
|
|
FROM tagente_datos
|
2015-10-26 10:58:31 +01:00
|
|
|
WHERE utimestamp < ' . $time_3months);
|
2015-10-26 10:03:42 +01:00
|
|
|
if ($num_all_w_history >= 0) {
|
2014-10-14 13:18:42 +02:00
|
|
|
$num_history = $num_all_w_history - $num_all;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-10-26 10:03:42 +01:00
|
|
|
}
|
|
|
|
else if (($num_1day == 0) && ($num_1week == 0) && ($num_1month == 0) && ($num_3months == 0) && ($num_all == 0)) {
|
|
|
|
//If no data, returns empty
|
2014-10-14 13:18:42 +02:00
|
|
|
$query_error = true;
|
|
|
|
}
|
2015-05-18 18:08:14 +02:00
|
|
|
|
2014-10-14 13:18:42 +02:00
|
|
|
// Error
|
|
|
|
if ($query_error || $num_older < 0 || ($config['history_db_enabled'] == 1 && $num_history < 0)
|
|
|
|
|| (empty($num_1day) && empty($num_1week) && empty($num_1month)
|
|
|
|
&& empty($num_3months) && empty($num_all)
|
|
|
|
&& ($config['history_db_enabled'] == 1 && empty($num_all_w_history)))) {
|
2017-10-09 18:31:42 +02:00
|
|
|
return html_print_image('images/image_problem_area_small.png', true);
|
2011-09-01 17:03:00 +02:00
|
|
|
}
|
2014-10-14 13:18:42 +02:00
|
|
|
|
|
|
|
// Data indexes
|
|
|
|
$str_1day = __("Today");
|
|
|
|
$str_1week = "1 ".__("Week");
|
|
|
|
$str_1month = "1 ".__("Month");
|
|
|
|
$str_3months = "3 ".__("Months");
|
|
|
|
$str_older = "> 3 ".__("Months");
|
|
|
|
|
|
|
|
// Filling the data array
|
|
|
|
$data = array();
|
|
|
|
if (!empty($num_1day))
|
|
|
|
$data[$str_1day] = $num_1day;
|
|
|
|
if (!empty($num_1week))
|
|
|
|
$data[$str_1week] = $num_1week;
|
|
|
|
if (!empty($num_1month))
|
|
|
|
$data[$str_1month] = $num_1month;
|
|
|
|
if (!empty($num_3months))
|
|
|
|
$data[$str_3months] = $num_3months;
|
|
|
|
if (!empty($num_older))
|
|
|
|
$data[$str_older] = $num_older;
|
|
|
|
if ($config['history_db_enabled'] == 1 && !empty($num_history)) {
|
|
|
|
// In this pie chart only 5 elements are shown, so we need to remove
|
|
|
|
// an element. With a history db enabled the >3 months element are dispensable
|
|
|
|
if (count($data) >= 5 && isset($data[$str_3months]))
|
|
|
|
unset($data[$str_3months]);
|
|
|
|
|
|
|
|
$time_historic_db = time() - ((int)$config['history_db_days'] * SECONDS_1DAY);
|
|
|
|
$date_human = human_time_comparation($time_historic_db);
|
|
|
|
$str_history = "> $date_human (".__("History db").")";
|
|
|
|
$data[$str_history] = $num_history;
|
|
|
|
}
|
|
|
|
|
|
|
|
$water_mark = array(
|
|
|
|
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
2015-03-18 20:28:55 +01:00
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)
|
2014-10-14 13:18:42 +02:00
|
|
|
);
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2011-04-20 11:23:54 +02:00
|
|
|
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
2014-10-14 13:18:42 +02:00
|
|
|
__('Other'), '', $water_mark, $config['fontpath'], $config['font_size']);
|
2011-04-13 17:58:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print a horizontal bar graph with packets data of agents
|
|
|
|
*
|
|
|
|
* @param integer width pie graph width
|
|
|
|
* @param integer height pie graph height
|
|
|
|
*/
|
2011-07-19 11:28:09 +02:00
|
|
|
function grafico_db_agentes_paquetes($width = 380, $height = 300) {
|
2011-04-13 17:58:59 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2011-04-20 11:23:54 +02:00
|
|
|
|
2013-07-03 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/module_graph.php,
mobile/operation/modules.php, mobile/operation/networkmaps.php,
mobile/operation/groups.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/networkmap.php,
mobile/operation/alerts.php, mobile/operation/agent.php,
mobile/include/ui.class.php: added the back button in the head and
impoved the source code style to make more easy the merges with
the last branch.
* include/functions_graph.php: fixed PHP notices.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8468 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-03 15:59:38 +02:00
|
|
|
|
2011-04-13 17:58:59 +02:00
|
|
|
$data = array ();
|
|
|
|
$legend = array ();
|
|
|
|
|
2012-12-28 18:06:17 +01:00
|
|
|
$agents = agents_get_group_agents (array_keys (users_get_groups (false, 'RR')), false, "none");
|
2011-05-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_graph.php
include/functions_users.php
include/functions_html.php
include/functions_menu.php
include/functions_messages.php
include/functions_modules.php
include/functions_reporting.php
include/functions_groups.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/functions_visual_map.php
include/functions_profile.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_agents.php
include/functions_db.php
include/functions_alerts.php
include/functions_reports.php
index.php
extensions/insert_data.php
extensions/agents_modules.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/module_groups.php
operation/incidents/incident_detail.php
operation/search_modules.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/estado_agente.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/gis_view.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.php
operation/agentes/graphs.php
operation/agentes/group_view.php
operation/search_agents.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/integria_incidents/incident_detail.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/search_users.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
ajax.php
general/ui/agents_list.php
godmode/groups/configure_group.php
godmode/groups/group_list.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_purge.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/module_manager_editor_network.php
godmode/agentes/module_manager_editor_wmi.php
godmode/agentes/module_manager_editor_plugin.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/manage_recontask_form.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.php
godmode/alerts/alert_list.php
godmode/alerts/configure_alert_template.php
godmode/alerts/alert_templates.php
godmode/alerts/configure_alert_action.php
godmode/alerts/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/setup/setup_auth.php
godmode/users/user_list.php
godmode/users/configure_user.php
godmode/users/configure_profile.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_modules.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/reporting/visual_console_builder.wizard.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.php
godmode/reporting/reporting_builder.main.php
godmode/reporting/visual_console_builder.data.php
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/reporting_builder.item_editor.php: Functions in
functions_profile.php, functions_agents.php, functions_users.php,
functions_massive_policies.php, functions_audit.php, functions_backup.php,
functions_collection.php, functions_skins.php, functions_enterprise.php,
functions_groups.php, functions_local_components.php, functions_metaconsole.php,
functions_policies.php, functions_reporting.php, functions_reporting_csv.php,
functions_reporting_pdf2.php, functions_services.php have their own prefixes.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4333 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-05-10 20:51:09 +02:00
|
|
|
$count = agents_get_modules_data_count (array_keys ($agents));
|
2011-04-13 17:58:59 +02:00
|
|
|
unset ($count["total"]);
|
|
|
|
arsort ($count, SORT_NUMERIC);
|
|
|
|
$count = array_slice ($count, 0, 8, true);
|
|
|
|
|
|
|
|
foreach ($count as $agent_id => $value) {
|
|
|
|
$data[$agents[$agent_id]]['g'] = $value;
|
|
|
|
}
|
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2012-03-05 11:26:34 +01:00
|
|
|
|
2011-04-20 11:23:54 +02:00
|
|
|
return hbar_graph($config['flash_charts'], $data, $width, $height, array(),
|
2015-03-18 20:28:55 +01:00
|
|
|
$legend, "", "", true, "", $water_mark,
|
2017-11-08 09:55:36 +01:00
|
|
|
$config['fontpath'], $config['font_size'], false, 1, $config['homeurl'],
|
|
|
|
'white',
|
|
|
|
'black');
|
2011-04-13 17:58:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print a horizontal bar graph with modules data of agents
|
|
|
|
*
|
|
|
|
* @param integer height graph height
|
|
|
|
* @param integer width graph width
|
|
|
|
*/
|
2012-03-05 11:26:34 +01:00
|
|
|
function graph_db_agentes_modulos($width, $height) {
|
2011-04-13 17:58:59 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2011-04-20 11:23:54 +02:00
|
|
|
|
2013-07-03 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/module_graph.php,
mobile/operation/modules.php, mobile/operation/networkmaps.php,
mobile/operation/groups.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/networkmap.php,
mobile/operation/alerts.php, mobile/operation/agent.php,
mobile/include/ui.class.php: added the back button in the head and
impoved the source code style to make more easy the merges with
the last branch.
* include/functions_graph.php: fixed PHP notices.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8468 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-03 15:59:38 +02:00
|
|
|
|
2011-04-13 17:58:59 +02:00
|
|
|
$data = array ();
|
|
|
|
|
2015-06-08 11:05:19 +02:00
|
|
|
switch ($config['dbtype']) {
|
2011-04-13 17:58:59 +02:00
|
|
|
case "mysql":
|
|
|
|
case "postgresql":
|
2015-06-08 11:05:19 +02:00
|
|
|
$modules = db_get_all_rows_sql ('
|
|
|
|
SELECT COUNT(id_agente_modulo), id_agente
|
2011-04-13 17:58:59 +02:00
|
|
|
FROM tagente_modulo
|
2013-04-30 13:54:37 +02:00
|
|
|
WHERE delete_pending = 0
|
2011-04-13 17:58:59 +02:00
|
|
|
GROUP BY id_agente
|
|
|
|
ORDER BY 1 DESC LIMIT 10');
|
|
|
|
break;
|
|
|
|
case "oracle":
|
2015-06-08 11:05:19 +02:00
|
|
|
$modules = db_get_all_rows_sql ('
|
|
|
|
SELECT COUNT(id_agente_modulo), id_agente
|
2011-04-13 17:58:59 +02:00
|
|
|
FROM tagente_modulo
|
|
|
|
WHERE rownum <= 10
|
2013-04-30 13:54:37 +02:00
|
|
|
AND delete_pending = 0
|
2011-04-13 17:58:59 +02:00
|
|
|
GROUP BY id_agente
|
|
|
|
ORDER BY 1 DESC');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ($modules === false)
|
|
|
|
$modules = array ();
|
|
|
|
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
$data = array();
|
2011-04-13 17:58:59 +02:00
|
|
|
foreach ($modules as $module) {
|
2011-05-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_graph.php
include/functions_users.php
include/functions_html.php
include/functions_menu.php
include/functions_messages.php
include/functions_modules.php
include/functions_reporting.php
include/functions_groups.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/functions_visual_map.php
include/functions_profile.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_agents.php
include/functions_db.php
include/functions_alerts.php
include/functions_reports.php
index.php
extensions/insert_data.php
extensions/agents_modules.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/module_groups.php
operation/incidents/incident_detail.php
operation/search_modules.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/estado_agente.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/gis_view.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.php
operation/agentes/graphs.php
operation/agentes/group_view.php
operation/search_agents.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/integria_incidents/incident_detail.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/search_users.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
ajax.php
general/ui/agents_list.php
godmode/groups/configure_group.php
godmode/groups/group_list.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_purge.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/module_manager_editor_network.php
godmode/agentes/module_manager_editor_wmi.php
godmode/agentes/module_manager_editor_plugin.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/manage_recontask_form.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.php
godmode/alerts/alert_list.php
godmode/alerts/configure_alert_template.php
godmode/alerts/alert_templates.php
godmode/alerts/configure_alert_action.php
godmode/alerts/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/setup/setup_auth.php
godmode/users/user_list.php
godmode/users/configure_user.php
godmode/users/configure_profile.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_modules.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/reporting/visual_console_builder.wizard.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.php
godmode/reporting/reporting_builder.main.php
godmode/reporting/visual_console_builder.data.php
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/reporting_builder.item_editor.php: Functions in
functions_profile.php, functions_agents.php, functions_users.php,
functions_massive_policies.php, functions_audit.php, functions_backup.php,
functions_collection.php, functions_skins.php, functions_enterprise.php,
functions_groups.php, functions_local_components.php, functions_metaconsole.php,
functions_policies.php, functions_reporting.php, functions_reporting_csv.php,
functions_reporting_pdf2.php, functions_services.php have their own prefixes.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4333 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-05-10 20:51:09 +02:00
|
|
|
$agent_name = agents_get_name ($module['id_agente'], "none");
|
2013-04-30 13:54:37 +02:00
|
|
|
|
2013-07-22 16:33:37 +02:00
|
|
|
if (empty($agent_name)) {
|
2013-04-30 13:54:37 +02:00
|
|
|
continue;
|
|
|
|
}
|
2015-06-08 11:05:19 +02:00
|
|
|
switch ($config['dbtype']) {
|
2011-04-13 17:58:59 +02:00
|
|
|
case "mysql":
|
|
|
|
case "postgresql":
|
|
|
|
$data[$agent_name]['g'] = $module['COUNT(id_agente_modulo)'];
|
|
|
|
break;
|
|
|
|
case "oracle":
|
|
|
|
$data[$agent_name]['g'] = $module['count(id_agente_modulo)'];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2015-03-18 20:28:55 +01:00
|
|
|
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
return hbar_graph($config['flash_charts'],
|
|
|
|
$data, $width, $height, array(),
|
2011-04-20 17:54:31 +02:00
|
|
|
array(), "", "", true, "",
|
2012-03-01 17:41:02 +01:00
|
|
|
$water_mark,
|
2017-11-08 09:55:36 +01:00
|
|
|
$config['fontpath'], $config['font_size'], false, 1, $config['homeurl'],
|
|
|
|
'white',
|
|
|
|
'black');
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print a pie graph with users activity in a period of time
|
|
|
|
*
|
|
|
|
* @param integer width pie graph width
|
|
|
|
* @param integer height pie graph height
|
|
|
|
* @param integer period time period
|
|
|
|
*/
|
2011-07-19 11:28:09 +02:00
|
|
|
function graphic_user_activity ($width = 350, $height = 230) {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$data = array ();
|
|
|
|
$max_items = 5;
|
|
|
|
switch ($config['dbtype']) {
|
|
|
|
case "mysql":
|
|
|
|
case "postgresql":
|
|
|
|
$sql = sprintf ('SELECT COUNT(id_usuario) n_incidents, id_usuario
|
|
|
|
FROM tsesion
|
|
|
|
GROUP BY id_usuario
|
|
|
|
ORDER BY 1 DESC LIMIT %d', $max_items);
|
|
|
|
break;
|
|
|
|
case "oracle":
|
|
|
|
$sql = sprintf ('SELECT COUNT(id_usuario) n_incidents, id_usuario
|
|
|
|
FROM tsesion
|
|
|
|
WHERE rownum <= %d
|
|
|
|
GROUP BY id_usuario
|
|
|
|
ORDER BY 1 DESC', $max_items);
|
|
|
|
break;
|
|
|
|
}
|
* include/functions_graph.php
include/functions_html.php
include/functions_messages.php
include/db/postgresql.php
include/db/mysql.php
include/db/oracle.php
include/functions_reporting.php
include/functions_filemanager.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/ajax/skins.ajax.php
include/ajax/reporting.ajax.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/help/en/help_timesource.php
include/help/es/help_timesource.php
include/help/ja/help_timesource.php
include/config_process.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_incidents.php
include/api.php
include/functions_reports.php
include/functions_ui_renders.php
extensions/insert_data.php
extensions/system_info.php
extensions/extension_uploader.php
extensions/pandora_logs.php
extensions/agents_modules.php
extensions/update_manager.php
extensions/ssh_console.php
extensions/dbmanager.php
extensions/vnc_view.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/users_connected.php
extensions/module_groups.php
extensions/update_manager/load_updatemanager.php
extensions/update_manager/lib/libupdate_manager_client.php
extensions/update_manager/lib/libupdate_manager.php
extensions/update_manager/lib/libupdate_manager_components.php
extensions/update_manager/lib/libupdate_manager_updates.php
extensions/update_manager/settings.php
extensions/update_manager/main.php
extensions/plugin_registration.php
operation/incidents/incident.php
operation/incidents/incident_detail.php
operation/incidents/incident_statistics.php
operation/search_modules.php
operation/visual_console/render_view.php
operation/visual_console/index.php
operation/extensions.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/custom_fields.php
operation/agentes/estado_agente.php
operation/agentes/networkmap.topology.php
operation/agentes/networkmap.groups.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/gis_view.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.php
operation/agentes/graphs.php
operation/agentes/agent_fields.php
operation/agentes/tactical.php
operation/agentes/group_view.php
operation/agentes/networkmap.php
operation/agentes/stat_win.php
operation/servers/view_server.php
operation/servers/view_server_detail.php
operation/menu.php
operation/search_agents.php
operation/search_graphs.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/integria_incidents/incident.php
operation/integria_incidents/incident_detail.php
operation/integria_incidents/incident_statistics.php
operation/events/event_statistics.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/sound_events.php
operation/events/events_validate.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
operation/reporting/graph_viewer.php
operation/search_reports.php
operation/search_maps.php
operation/search_users.php
extras/pandora_diag.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
mobile/index.php
general/error_authconfig.php
general/links_menu.php
general/logon_ok.php
general/error_dbconfig.php
general/ui/agents_list.php
general/header.php
godmode/groups/modu_group_list.php
godmode/groups/configure_group.php
godmode/groups/configure_modu_group.php
godmode/groups/group_list.php
godmode/admin_access_logs.php
godmode/db/db_main.php
godmode/db/db_audit.php
godmode/db/db_sanity.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_event.php
godmode/db/db_purge.php
godmode/extensions.php
godmode/agentes/agent_template.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/fields_manager.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/configure_field.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/recon_script.php
godmode/servers/plugin.php
godmode/servers/manage_recontask.php
godmode/servers/modificar_server.php
godmode/servers/manage_recontask_form.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.php
godmode/alerts/alert_list.php
godmode/alerts/configure_alert_template.php
godmode/alerts/alert_templates.php
godmode/alerts/configure_alert_action.php
godmode/alerts/configure_alert_command.php
godmode/alerts/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/alerts/alert_commands.php
godmode/setup/file_manager.php
godmode/setup/os.list.php
godmode/setup/news.php
godmode/setup/gis_step_2.php
godmode/setup/links.php
godmode/setup/setup.php
godmode/setup/os.php
godmode/setup/performance.php
godmode/setup/setup_auth.php
godmode/setup/gis.php
godmode/setup/os.builder.php
godmode/setup/setup_visuals.php
godmode/snmpconsole/snmp_alert.php
godmode/snmpconsole/snmp_filters.php
godmode/users/user_list.php
godmode/users/configure_profile.php
godmode/gis_maps/configure_gis_map.php
godmode/gis_maps/index.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_operations.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_modules.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/modules/manage_network_components_form.php
godmode/modules/manage_nc_groups_form.php
godmode/modules/manage_network_templates.php
godmode/modules/module_list.php
godmode/modules/manage_network_components_form_common.php
godmode/modules/manage_network_components_form_network.php
godmode/modules/manage_network_templates_form.php
godmode/modules/manage_network_components_form_wmi.php
godmode/modules/manage_network_components.php
godmode/modules/manage_nc_groups.php
godmode/reporting/visual_console_builder.wizard.php
godmode/reporting/graph_builder.main.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.php
godmode/reporting/reporting_builder.preview.php
godmode/reporting/reporting_builder.main.php
godmode/reporting/visual_console_builder.data.php
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/graph_builder.php
godmode/reporting/visual_console_builder.preview.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/visual_console_builder.editor.php
godmode/reporting/reporting_builder.item_editor.php
godmode/reporting/map_builder.php
godmode/reporting/graphs.php
godmode/reporting/graph_builder.preview.php
include/functions_db.php: Added some includes and functions of this code have "db_" prefix.
* include/functions.php: Moved function check_login(), check_acl(),
dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php.
* include/functions_groups.php: Moved functions get_childrens(), safe_acl_group()
and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(),
get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(),
get_group_name(), get_group_users() from functions_db.php to this code.
* include/functions_profile.php: New library with profile functions. Moved functions
get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(),
delete_profile() from functions_db.php to this code. Added new parameter in function
get_profile() to retrieve profiles with filter conditions applied.
* include/functions_users.php: New library with users functions. Moved functions
get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(),
get_user_first_group(), user_access_to_agent() from funtions_db.php to this code.
* godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile().
* include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(),
get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(),
check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(),
agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(),
get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(),
get_agent_group() from functions_db.php to this code.
* include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(),
get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(),
get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(),
get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(),
get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(),
get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(),
give_modulecategory_name(),
give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(),
get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(),
get_modulegroup_name() from functions_db.php to this code.
* include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(),
get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(),
get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(),
get_agentmodule_last_status() from functions_db.php to this code.
* include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion()
from functions_db.php to this code.
* include/functions_events.php: Moved functions get_group_events(), get_agent_events(),
get_module_events() from functions_db.php to this code.
* include/functions_servers.php: Moved functions get_server_name(), show_server_type(),
check_server_status(), server_status() from functions_db.php to this code.
* include/functions_network_profiles.php: Moved function get_networkprofile_name()
from functions_db.php to this code.
* include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y()
from fucntions_db.php to this code.
* include/functions_io.php: Moved function __() from functions_db.php to this code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-19 20:42:49 +02:00
|
|
|
$logins = db_get_all_rows_sql ($sql);
|
2011-04-13 17:58:59 +02:00
|
|
|
|
2013-07-22 16:33:37 +02:00
|
|
|
if ($logins == false) {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$logins = array();
|
|
|
|
}
|
|
|
|
foreach ($logins as $login) {
|
|
|
|
$data[$login['id_usuario']] = $login['n_incidents'];
|
|
|
|
}
|
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2015-03-18 20:28:55 +01:00
|
|
|
|
2011-04-20 11:23:54 +02:00
|
|
|
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
2015-03-18 20:28:55 +01:00
|
|
|
__('Other'), '', $water_mark,
|
2011-04-20 17:54:31 +02:00
|
|
|
$config['fontpath'], $config['font_size']);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
}
|
2011-04-13 17:58:59 +02:00
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
/**
|
|
|
|
* Print a pie graph with priodity incident
|
|
|
|
*/
|
2011-07-19 11:28:09 +02:00
|
|
|
function grafico_incidente_prioridad () {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2012-04-24 15:45:02 +02:00
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$data_tmp = array (0, 0, 0, 0, 0, 0);
|
|
|
|
$sql = 'SELECT COUNT(id_incidencia) n_incidents, prioridad
|
|
|
|
FROM tincidencia
|
|
|
|
GROUP BY prioridad
|
|
|
|
ORDER BY 2 DESC';
|
* include/functions_graph.php
include/functions_html.php
include/functions_messages.php
include/db/postgresql.php
include/db/mysql.php
include/db/oracle.php
include/functions_reporting.php
include/functions_filemanager.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/ajax/skins.ajax.php
include/ajax/reporting.ajax.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/help/en/help_timesource.php
include/help/es/help_timesource.php
include/help/ja/help_timesource.php
include/config_process.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_incidents.php
include/api.php
include/functions_reports.php
include/functions_ui_renders.php
extensions/insert_data.php
extensions/system_info.php
extensions/extension_uploader.php
extensions/pandora_logs.php
extensions/agents_modules.php
extensions/update_manager.php
extensions/ssh_console.php
extensions/dbmanager.php
extensions/vnc_view.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/users_connected.php
extensions/module_groups.php
extensions/update_manager/load_updatemanager.php
extensions/update_manager/lib/libupdate_manager_client.php
extensions/update_manager/lib/libupdate_manager.php
extensions/update_manager/lib/libupdate_manager_components.php
extensions/update_manager/lib/libupdate_manager_updates.php
extensions/update_manager/settings.php
extensions/update_manager/main.php
extensions/plugin_registration.php
operation/incidents/incident.php
operation/incidents/incident_detail.php
operation/incidents/incident_statistics.php
operation/search_modules.php
operation/visual_console/render_view.php
operation/visual_console/index.php
operation/extensions.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/custom_fields.php
operation/agentes/estado_agente.php
operation/agentes/networkmap.topology.php
operation/agentes/networkmap.groups.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/gis_view.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.php
operation/agentes/graphs.php
operation/agentes/agent_fields.php
operation/agentes/tactical.php
operation/agentes/group_view.php
operation/agentes/networkmap.php
operation/agentes/stat_win.php
operation/servers/view_server.php
operation/servers/view_server_detail.php
operation/menu.php
operation/search_agents.php
operation/search_graphs.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/integria_incidents/incident.php
operation/integria_incidents/incident_detail.php
operation/integria_incidents/incident_statistics.php
operation/events/event_statistics.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/sound_events.php
operation/events/events_validate.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
operation/reporting/graph_viewer.php
operation/search_reports.php
operation/search_maps.php
operation/search_users.php
extras/pandora_diag.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
mobile/index.php
general/error_authconfig.php
general/links_menu.php
general/logon_ok.php
general/error_dbconfig.php
general/ui/agents_list.php
general/header.php
godmode/groups/modu_group_list.php
godmode/groups/configure_group.php
godmode/groups/configure_modu_group.php
godmode/groups/group_list.php
godmode/admin_access_logs.php
godmode/db/db_main.php
godmode/db/db_audit.php
godmode/db/db_sanity.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_event.php
godmode/db/db_purge.php
godmode/extensions.php
godmode/agentes/agent_template.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/fields_manager.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/configure_field.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/recon_script.php
godmode/servers/plugin.php
godmode/servers/manage_recontask.php
godmode/servers/modificar_server.php
godmode/servers/manage_recontask_form.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.php
godmode/alerts/alert_list.php
godmode/alerts/configure_alert_template.php
godmode/alerts/alert_templates.php
godmode/alerts/configure_alert_action.php
godmode/alerts/configure_alert_command.php
godmode/alerts/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/alerts/alert_commands.php
godmode/setup/file_manager.php
godmode/setup/os.list.php
godmode/setup/news.php
godmode/setup/gis_step_2.php
godmode/setup/links.php
godmode/setup/setup.php
godmode/setup/os.php
godmode/setup/performance.php
godmode/setup/setup_auth.php
godmode/setup/gis.php
godmode/setup/os.builder.php
godmode/setup/setup_visuals.php
godmode/snmpconsole/snmp_alert.php
godmode/snmpconsole/snmp_filters.php
godmode/users/user_list.php
godmode/users/configure_profile.php
godmode/gis_maps/configure_gis_map.php
godmode/gis_maps/index.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_operations.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_modules.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/modules/manage_network_components_form.php
godmode/modules/manage_nc_groups_form.php
godmode/modules/manage_network_templates.php
godmode/modules/module_list.php
godmode/modules/manage_network_components_form_common.php
godmode/modules/manage_network_components_form_network.php
godmode/modules/manage_network_templates_form.php
godmode/modules/manage_network_components_form_wmi.php
godmode/modules/manage_network_components.php
godmode/modules/manage_nc_groups.php
godmode/reporting/visual_console_builder.wizard.php
godmode/reporting/graph_builder.main.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.php
godmode/reporting/reporting_builder.preview.php
godmode/reporting/reporting_builder.main.php
godmode/reporting/visual_console_builder.data.php
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/graph_builder.php
godmode/reporting/visual_console_builder.preview.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/visual_console_builder.editor.php
godmode/reporting/reporting_builder.item_editor.php
godmode/reporting/map_builder.php
godmode/reporting/graphs.php
godmode/reporting/graph_builder.preview.php
include/functions_db.php: Added some includes and functions of this code have "db_" prefix.
* include/functions.php: Moved function check_login(), check_acl(),
dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php.
* include/functions_groups.php: Moved functions get_childrens(), safe_acl_group()
and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(),
get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(),
get_group_name(), get_group_users() from functions_db.php to this code.
* include/functions_profile.php: New library with profile functions. Moved functions
get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(),
delete_profile() from functions_db.php to this code. Added new parameter in function
get_profile() to retrieve profiles with filter conditions applied.
* include/functions_users.php: New library with users functions. Moved functions
get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(),
get_user_first_group(), user_access_to_agent() from funtions_db.php to this code.
* godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile().
* include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(),
get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(),
check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(),
agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(),
get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(),
get_agent_group() from functions_db.php to this code.
* include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(),
get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(),
get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(),
get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(),
get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(),
get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(),
give_modulecategory_name(),
give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(),
get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(),
get_modulegroup_name() from functions_db.php to this code.
* include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(),
get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(),
get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(),
get_agentmodule_last_status() from functions_db.php to this code.
* include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion()
from functions_db.php to this code.
* include/functions_events.php: Moved functions get_group_events(), get_agent_events(),
get_module_events() from functions_db.php to this code.
* include/functions_servers.php: Moved functions get_server_name(), show_server_type(),
check_server_status(), server_status() from functions_db.php to this code.
* include/functions_network_profiles.php: Moved function get_networkprofile_name()
from functions_db.php to this code.
* include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y()
from fucntions_db.php to this code.
* include/functions_io.php: Moved function __() from functions_db.php to this code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-19 20:42:49 +02:00
|
|
|
$incidents = db_get_all_rows_sql ($sql);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
|
2013-07-22 16:33:37 +02:00
|
|
|
if ($incidents == false) {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$incidents = array();
|
2011-04-13 17:58:59 +02:00
|
|
|
}
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
foreach ($incidents as $incident) {
|
|
|
|
if ($incident['prioridad'] < 5)
|
|
|
|
$data_tmp[$incident['prioridad']] = $incident['n_incidents'];
|
|
|
|
else
|
|
|
|
$data_tmp[5] += $incident['n_incidents'];
|
|
|
|
}
|
|
|
|
$data = array (__('Informative') => $data_tmp[0],
|
2012-07-18 15:25:51 +02:00
|
|
|
__('Low') => $data_tmp[1],
|
|
|
|
__('Medium') => $data_tmp[2],
|
|
|
|
__('Serious') => $data_tmp[3],
|
|
|
|
__('Very serious') => $data_tmp[4],
|
|
|
|
__('Maintenance') => $data_tmp[5]);
|
2011-04-13 17:58:59 +02:00
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2015-03-18 20:28:55 +01:00
|
|
|
|
2011-04-20 11:23:54 +02:00
|
|
|
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
2015-03-18 20:28:55 +01:00
|
|
|
__('Other'), '', $water_mark,
|
2011-04-20 17:54:31 +02:00
|
|
|
$config['fontpath'], $config['font_size']);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
}
|
2011-04-13 17:58:59 +02:00
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
/**
|
|
|
|
* Print a pie graph with incidents data
|
|
|
|
*/
|
2011-07-19 11:28:09 +02:00
|
|
|
function graph_incidents_status () {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
|
|
|
$data = array (0, 0, 0, 0);
|
2011-04-13 17:58:59 +02:00
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$data = array ();
|
|
|
|
$data[__('Open incident')] = 0;
|
|
|
|
$data[__('Closed incident')] = 0;
|
|
|
|
$data[__('Outdated')] = 0;
|
|
|
|
$data[__('Invalid')] = 0;
|
|
|
|
|
* include/functions_graph.php
include/functions_html.php
include/functions_messages.php
include/db/postgresql.php
include/db/mysql.php
include/db/oracle.php
include/functions_reporting.php
include/functions_filemanager.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/ajax/skins.ajax.php
include/ajax/reporting.ajax.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/help/en/help_timesource.php
include/help/es/help_timesource.php
include/help/ja/help_timesource.php
include/config_process.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_incidents.php
include/api.php
include/functions_reports.php
include/functions_ui_renders.php
extensions/insert_data.php
extensions/system_info.php
extensions/extension_uploader.php
extensions/pandora_logs.php
extensions/agents_modules.php
extensions/update_manager.php
extensions/ssh_console.php
extensions/dbmanager.php
extensions/vnc_view.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/users_connected.php
extensions/module_groups.php
extensions/update_manager/load_updatemanager.php
extensions/update_manager/lib/libupdate_manager_client.php
extensions/update_manager/lib/libupdate_manager.php
extensions/update_manager/lib/libupdate_manager_components.php
extensions/update_manager/lib/libupdate_manager_updates.php
extensions/update_manager/settings.php
extensions/update_manager/main.php
extensions/plugin_registration.php
operation/incidents/incident.php
operation/incidents/incident_detail.php
operation/incidents/incident_statistics.php
operation/search_modules.php
operation/visual_console/render_view.php
operation/visual_console/index.php
operation/extensions.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/custom_fields.php
operation/agentes/estado_agente.php
operation/agentes/networkmap.topology.php
operation/agentes/networkmap.groups.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/gis_view.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.php
operation/agentes/graphs.php
operation/agentes/agent_fields.php
operation/agentes/tactical.php
operation/agentes/group_view.php
operation/agentes/networkmap.php
operation/agentes/stat_win.php
operation/servers/view_server.php
operation/servers/view_server_detail.php
operation/menu.php
operation/search_agents.php
operation/search_graphs.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/integria_incidents/incident.php
operation/integria_incidents/incident_detail.php
operation/integria_incidents/incident_statistics.php
operation/events/event_statistics.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/sound_events.php
operation/events/events_validate.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
operation/reporting/graph_viewer.php
operation/search_reports.php
operation/search_maps.php
operation/search_users.php
extras/pandora_diag.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
mobile/index.php
general/error_authconfig.php
general/links_menu.php
general/logon_ok.php
general/error_dbconfig.php
general/ui/agents_list.php
general/header.php
godmode/groups/modu_group_list.php
godmode/groups/configure_group.php
godmode/groups/configure_modu_group.php
godmode/groups/group_list.php
godmode/admin_access_logs.php
godmode/db/db_main.php
godmode/db/db_audit.php
godmode/db/db_sanity.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_event.php
godmode/db/db_purge.php
godmode/extensions.php
godmode/agentes/agent_template.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/fields_manager.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/configure_field.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/recon_script.php
godmode/servers/plugin.php
godmode/servers/manage_recontask.php
godmode/servers/modificar_server.php
godmode/servers/manage_recontask_form.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.php
godmode/alerts/alert_list.php
godmode/alerts/configure_alert_template.php
godmode/alerts/alert_templates.php
godmode/alerts/configure_alert_action.php
godmode/alerts/configure_alert_command.php
godmode/alerts/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/alerts/alert_commands.php
godmode/setup/file_manager.php
godmode/setup/os.list.php
godmode/setup/news.php
godmode/setup/gis_step_2.php
godmode/setup/links.php
godmode/setup/setup.php
godmode/setup/os.php
godmode/setup/performance.php
godmode/setup/setup_auth.php
godmode/setup/gis.php
godmode/setup/os.builder.php
godmode/setup/setup_visuals.php
godmode/snmpconsole/snmp_alert.php
godmode/snmpconsole/snmp_filters.php
godmode/users/user_list.php
godmode/users/configure_profile.php
godmode/gis_maps/configure_gis_map.php
godmode/gis_maps/index.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_operations.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_modules.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/modules/manage_network_components_form.php
godmode/modules/manage_nc_groups_form.php
godmode/modules/manage_network_templates.php
godmode/modules/module_list.php
godmode/modules/manage_network_components_form_common.php
godmode/modules/manage_network_components_form_network.php
godmode/modules/manage_network_templates_form.php
godmode/modules/manage_network_components_form_wmi.php
godmode/modules/manage_network_components.php
godmode/modules/manage_nc_groups.php
godmode/reporting/visual_console_builder.wizard.php
godmode/reporting/graph_builder.main.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.php
godmode/reporting/reporting_builder.preview.php
godmode/reporting/reporting_builder.main.php
godmode/reporting/visual_console_builder.data.php
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/graph_builder.php
godmode/reporting/visual_console_builder.preview.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/visual_console_builder.editor.php
godmode/reporting/reporting_builder.item_editor.php
godmode/reporting/map_builder.php
godmode/reporting/graphs.php
godmode/reporting/graph_builder.preview.php
include/functions_db.php: Added some includes and functions of this code have "db_" prefix.
* include/functions.php: Moved function check_login(), check_acl(),
dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php.
* include/functions_groups.php: Moved functions get_childrens(), safe_acl_group()
and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(),
get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(),
get_group_name(), get_group_users() from functions_db.php to this code.
* include/functions_profile.php: New library with profile functions. Moved functions
get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(),
delete_profile() from functions_db.php to this code. Added new parameter in function
get_profile() to retrieve profiles with filter conditions applied.
* include/functions_users.php: New library with users functions. Moved functions
get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(),
get_user_first_group(), user_access_to_agent() from funtions_db.php to this code.
* godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile().
* include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(),
get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(),
check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(),
agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(),
get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(),
get_agent_group() from functions_db.php to this code.
* include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(),
get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(),
get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(),
get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(),
get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(),
get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(),
give_modulecategory_name(),
give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(),
get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(),
get_modulegroup_name() from functions_db.php to this code.
* include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(),
get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(),
get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(),
get_agentmodule_last_status() from functions_db.php to this code.
* include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion()
from functions_db.php to this code.
* include/functions_events.php: Moved functions get_group_events(), get_agent_events(),
get_module_events() from functions_db.php to this code.
* include/functions_servers.php: Moved functions get_server_name(), show_server_type(),
check_server_status(), server_status() from functions_db.php to this code.
* include/functions_network_profiles.php: Moved function get_networkprofile_name()
from functions_db.php to this code.
* include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y()
from fucntions_db.php to this code.
* include/functions_io.php: Moved function __() from functions_db.php to this code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-19 20:42:49 +02:00
|
|
|
$incidents = db_get_all_rows_filter ('tincidencia',
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
array ('estado' => array (0, 2, 3, 13)),
|
|
|
|
array ('estado'));
|
|
|
|
if ($incidents === false)
|
|
|
|
$incidents = array ();
|
|
|
|
foreach ($incidents as $incident) {
|
|
|
|
if ($incident["estado"] == 0)
|
|
|
|
$data[__("Open incident")]++;
|
|
|
|
if ($incident["estado"] == 2)
|
|
|
|
$data[__("Closed incident")]++;
|
|
|
|
if ($incident["estado"] == 3)
|
|
|
|
$data[__("Outdated")]++;
|
|
|
|
if ($incident["estado"] == 13)
|
|
|
|
$data[__("Invalid")]++;
|
|
|
|
}
|
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2015-03-18 20:28:55 +01:00
|
|
|
|
2017-03-06 18:11:58 +01:00
|
|
|
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
2015-03-18 20:28:55 +01:00
|
|
|
__('Other'), '', $water_mark,
|
2011-04-20 17:54:31 +02:00
|
|
|
$config['fontpath'], $config['font_size']);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print a pie graph with incident data by group
|
|
|
|
*/
|
2011-07-19 11:28:09 +02:00
|
|
|
function graphic_incident_group () {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2012-04-24 15:45:02 +02:00
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$data = array ();
|
|
|
|
$max_items = 5;
|
2015-10-21 13:57:05 +02:00
|
|
|
switch ($config["dbtype"]) {
|
|
|
|
case 'mysql':
|
|
|
|
$sql = sprintf ('SELECT COUNT(id_incidencia) n_incidents, nombre
|
|
|
|
FROM tincidencia,tgrupo
|
|
|
|
WHERE tgrupo.id_grupo = tincidencia.id_grupo
|
|
|
|
GROUP BY tgrupo.id_grupo, nombre ORDER BY 1 DESC LIMIT %d',
|
|
|
|
$max_items);
|
|
|
|
break;
|
|
|
|
case 'oracle':
|
|
|
|
$sql = sprintf ('SELECT COUNT(id_incidencia) n_incidents, nombre
|
|
|
|
FROM tincidencia,tgrupo
|
|
|
|
WHERE tgrupo.id_grupo = tincidencia.id_grupo
|
|
|
|
AND rownum <= %d
|
|
|
|
GROUP BY tgrupo.id_grupo, nombre ORDER BY 1 DESC',
|
|
|
|
$max_items);
|
|
|
|
break;
|
|
|
|
}
|
* include/functions_graph.php
include/functions_html.php
include/functions_messages.php
include/db/postgresql.php
include/db/mysql.php
include/db/oracle.php
include/functions_reporting.php
include/functions_filemanager.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/ajax/skins.ajax.php
include/ajax/reporting.ajax.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/help/en/help_timesource.php
include/help/es/help_timesource.php
include/help/ja/help_timesource.php
include/config_process.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_incidents.php
include/api.php
include/functions_reports.php
include/functions_ui_renders.php
extensions/insert_data.php
extensions/system_info.php
extensions/extension_uploader.php
extensions/pandora_logs.php
extensions/agents_modules.php
extensions/update_manager.php
extensions/ssh_console.php
extensions/dbmanager.php
extensions/vnc_view.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/users_connected.php
extensions/module_groups.php
extensions/update_manager/load_updatemanager.php
extensions/update_manager/lib/libupdate_manager_client.php
extensions/update_manager/lib/libupdate_manager.php
extensions/update_manager/lib/libupdate_manager_components.php
extensions/update_manager/lib/libupdate_manager_updates.php
extensions/update_manager/settings.php
extensions/update_manager/main.php
extensions/plugin_registration.php
operation/incidents/incident.php
operation/incidents/incident_detail.php
operation/incidents/incident_statistics.php
operation/search_modules.php
operation/visual_console/render_view.php
operation/visual_console/index.php
operation/extensions.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/custom_fields.php
operation/agentes/estado_agente.php
operation/agentes/networkmap.topology.php
operation/agentes/networkmap.groups.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/gis_view.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.php
operation/agentes/graphs.php
operation/agentes/agent_fields.php
operation/agentes/tactical.php
operation/agentes/group_view.php
operation/agentes/networkmap.php
operation/agentes/stat_win.php
operation/servers/view_server.php
operation/servers/view_server_detail.php
operation/menu.php
operation/search_agents.php
operation/search_graphs.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/integria_incidents/incident.php
operation/integria_incidents/incident_detail.php
operation/integria_incidents/incident_statistics.php
operation/events/event_statistics.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/sound_events.php
operation/events/events_validate.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
operation/reporting/graph_viewer.php
operation/search_reports.php
operation/search_maps.php
operation/search_users.php
extras/pandora_diag.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
mobile/index.php
general/error_authconfig.php
general/links_menu.php
general/logon_ok.php
general/error_dbconfig.php
general/ui/agents_list.php
general/header.php
godmode/groups/modu_group_list.php
godmode/groups/configure_group.php
godmode/groups/configure_modu_group.php
godmode/groups/group_list.php
godmode/admin_access_logs.php
godmode/db/db_main.php
godmode/db/db_audit.php
godmode/db/db_sanity.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_event.php
godmode/db/db_purge.php
godmode/extensions.php
godmode/agentes/agent_template.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/fields_manager.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/configure_field.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/recon_script.php
godmode/servers/plugin.php
godmode/servers/manage_recontask.php
godmode/servers/modificar_server.php
godmode/servers/manage_recontask_form.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.php
godmode/alerts/alert_list.php
godmode/alerts/configure_alert_template.php
godmode/alerts/alert_templates.php
godmode/alerts/configure_alert_action.php
godmode/alerts/configure_alert_command.php
godmode/alerts/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/alerts/alert_commands.php
godmode/setup/file_manager.php
godmode/setup/os.list.php
godmode/setup/news.php
godmode/setup/gis_step_2.php
godmode/setup/links.php
godmode/setup/setup.php
godmode/setup/os.php
godmode/setup/performance.php
godmode/setup/setup_auth.php
godmode/setup/gis.php
godmode/setup/os.builder.php
godmode/setup/setup_visuals.php
godmode/snmpconsole/snmp_alert.php
godmode/snmpconsole/snmp_filters.php
godmode/users/user_list.php
godmode/users/configure_profile.php
godmode/gis_maps/configure_gis_map.php
godmode/gis_maps/index.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_operations.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_modules.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/modules/manage_network_components_form.php
godmode/modules/manage_nc_groups_form.php
godmode/modules/manage_network_templates.php
godmode/modules/module_list.php
godmode/modules/manage_network_components_form_common.php
godmode/modules/manage_network_components_form_network.php
godmode/modules/manage_network_templates_form.php
godmode/modules/manage_network_components_form_wmi.php
godmode/modules/manage_network_components.php
godmode/modules/manage_nc_groups.php
godmode/reporting/visual_console_builder.wizard.php
godmode/reporting/graph_builder.main.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.php
godmode/reporting/reporting_builder.preview.php
godmode/reporting/reporting_builder.main.php
godmode/reporting/visual_console_builder.data.php
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/graph_builder.php
godmode/reporting/visual_console_builder.preview.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/visual_console_builder.editor.php
godmode/reporting/reporting_builder.item_editor.php
godmode/reporting/map_builder.php
godmode/reporting/graphs.php
godmode/reporting/graph_builder.preview.php
include/functions_db.php: Added some includes and functions of this code have "db_" prefix.
* include/functions.php: Moved function check_login(), check_acl(),
dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php.
* include/functions_groups.php: Moved functions get_childrens(), safe_acl_group()
and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(),
get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(),
get_group_name(), get_group_users() from functions_db.php to this code.
* include/functions_profile.php: New library with profile functions. Moved functions
get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(),
delete_profile() from functions_db.php to this code. Added new parameter in function
get_profile() to retrieve profiles with filter conditions applied.
* include/functions_users.php: New library with users functions. Moved functions
get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(),
get_user_first_group(), user_access_to_agent() from funtions_db.php to this code.
* godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile().
* include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(),
get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(),
check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(),
agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(),
get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(),
get_agent_group() from functions_db.php to this code.
* include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(),
get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(),
get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(),
get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(),
get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(),
get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(),
give_modulecategory_name(),
give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(),
get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(),
get_modulegroup_name() from functions_db.php to this code.
* include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(),
get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(),
get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(),
get_agentmodule_last_status() from functions_db.php to this code.
* include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion()
from functions_db.php to this code.
* include/functions_events.php: Moved functions get_group_events(), get_agent_events(),
get_module_events() from functions_db.php to this code.
* include/functions_servers.php: Moved functions get_server_name(), show_server_type(),
check_server_status(), server_status() from functions_db.php to this code.
* include/functions_network_profiles.php: Moved function get_networkprofile_name()
from functions_db.php to this code.
* include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y()
from fucntions_db.php to this code.
* include/functions_io.php: Moved function __() from functions_db.php to this code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-19 20:42:49 +02:00
|
|
|
$incidents = db_get_all_rows_sql ($sql);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
|
2011-08-11 19:09:21 +02:00
|
|
|
$sql = sprintf ('SELECT COUNT(id_incidencia) n_incidents
|
|
|
|
FROM tincidencia
|
|
|
|
WHERE tincidencia.id_grupo = 0');
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2011-08-11 19:09:21 +02:00
|
|
|
$incidents_all = db_get_value_sql($sql);
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2013-07-22 16:33:37 +02:00
|
|
|
if ($incidents == false) {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$incidents = array();
|
|
|
|
}
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
foreach ($incidents as $incident) {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$data[$incident['nombre']] = $incident['n_incidents'];
|
|
|
|
}
|
|
|
|
|
2013-07-22 16:33:37 +02:00
|
|
|
if ($incidents_all > 0) {
|
2011-08-11 19:09:21 +02:00
|
|
|
$data[__('All')] = $incidents_all;
|
|
|
|
}
|
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2015-03-18 20:28:55 +01:00
|
|
|
|
2011-04-20 11:23:54 +02:00
|
|
|
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
2015-03-18 20:28:55 +01:00
|
|
|
__('Other'), '', $water_mark,
|
2011-04-20 17:54:31 +02:00
|
|
|
$config['fontpath'], $config['font_size']);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print a graph with access data of agents
|
|
|
|
* @param integer id_agent Agent ID
|
|
|
|
* @param integer width pie graph width
|
|
|
|
* @param integer height pie graph height
|
|
|
|
* @param integer period time period
|
|
|
|
*/
|
2011-07-19 11:28:09 +02:00
|
|
|
function graphic_incident_user () {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2012-04-24 15:45:02 +02:00
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$data = array ();
|
|
|
|
$max_items = 5;
|
2015-10-21 13:57:05 +02:00
|
|
|
switch ($config["dbtype"]) {
|
|
|
|
case 'mysql':
|
|
|
|
$sql = sprintf ('SELECT COUNT(id_incidencia) n_incidents, id_usuario
|
|
|
|
FROM tincidencia
|
|
|
|
GROUP BY id_usuario
|
|
|
|
ORDER BY 1 DESC LIMIT %d', $max_items);
|
|
|
|
break;
|
|
|
|
case 'oracle':
|
|
|
|
$sql = sprintf ('SELECT COUNT(id_incidencia) n_incidents, id_usuario
|
|
|
|
FROM tincidencia
|
|
|
|
WHERE rownum <= %d
|
|
|
|
GROUP BY id_usuario
|
|
|
|
ORDER BY 1 DESC', $max_items);
|
|
|
|
break;
|
|
|
|
}
|
* include/functions_graph.php
include/functions_html.php
include/functions_messages.php
include/db/postgresql.php
include/db/mysql.php
include/db/oracle.php
include/functions_reporting.php
include/functions_filemanager.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/ajax/skins.ajax.php
include/ajax/reporting.ajax.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/help/en/help_timesource.php
include/help/es/help_timesource.php
include/help/ja/help_timesource.php
include/config_process.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_incidents.php
include/api.php
include/functions_reports.php
include/functions_ui_renders.php
extensions/insert_data.php
extensions/system_info.php
extensions/extension_uploader.php
extensions/pandora_logs.php
extensions/agents_modules.php
extensions/update_manager.php
extensions/ssh_console.php
extensions/dbmanager.php
extensions/vnc_view.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/users_connected.php
extensions/module_groups.php
extensions/update_manager/load_updatemanager.php
extensions/update_manager/lib/libupdate_manager_client.php
extensions/update_manager/lib/libupdate_manager.php
extensions/update_manager/lib/libupdate_manager_components.php
extensions/update_manager/lib/libupdate_manager_updates.php
extensions/update_manager/settings.php
extensions/update_manager/main.php
extensions/plugin_registration.php
operation/incidents/incident.php
operation/incidents/incident_detail.php
operation/incidents/incident_statistics.php
operation/search_modules.php
operation/visual_console/render_view.php
operation/visual_console/index.php
operation/extensions.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/custom_fields.php
operation/agentes/estado_agente.php
operation/agentes/networkmap.topology.php
operation/agentes/networkmap.groups.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/gis_view.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.php
operation/agentes/graphs.php
operation/agentes/agent_fields.php
operation/agentes/tactical.php
operation/agentes/group_view.php
operation/agentes/networkmap.php
operation/agentes/stat_win.php
operation/servers/view_server.php
operation/servers/view_server_detail.php
operation/menu.php
operation/search_agents.php
operation/search_graphs.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/integria_incidents/incident.php
operation/integria_incidents/incident_detail.php
operation/integria_incidents/incident_statistics.php
operation/events/event_statistics.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/sound_events.php
operation/events/events_validate.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
operation/reporting/graph_viewer.php
operation/search_reports.php
operation/search_maps.php
operation/search_users.php
extras/pandora_diag.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
mobile/index.php
general/error_authconfig.php
general/links_menu.php
general/logon_ok.php
general/error_dbconfig.php
general/ui/agents_list.php
general/header.php
godmode/groups/modu_group_list.php
godmode/groups/configure_group.php
godmode/groups/configure_modu_group.php
godmode/groups/group_list.php
godmode/admin_access_logs.php
godmode/db/db_main.php
godmode/db/db_audit.php
godmode/db/db_sanity.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_event.php
godmode/db/db_purge.php
godmode/extensions.php
godmode/agentes/agent_template.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/fields_manager.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/configure_field.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/recon_script.php
godmode/servers/plugin.php
godmode/servers/manage_recontask.php
godmode/servers/modificar_server.php
godmode/servers/manage_recontask_form.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.php
godmode/alerts/alert_list.php
godmode/alerts/configure_alert_template.php
godmode/alerts/alert_templates.php
godmode/alerts/configure_alert_action.php
godmode/alerts/configure_alert_command.php
godmode/alerts/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/alerts/alert_commands.php
godmode/setup/file_manager.php
godmode/setup/os.list.php
godmode/setup/news.php
godmode/setup/gis_step_2.php
godmode/setup/links.php
godmode/setup/setup.php
godmode/setup/os.php
godmode/setup/performance.php
godmode/setup/setup_auth.php
godmode/setup/gis.php
godmode/setup/os.builder.php
godmode/setup/setup_visuals.php
godmode/snmpconsole/snmp_alert.php
godmode/snmpconsole/snmp_filters.php
godmode/users/user_list.php
godmode/users/configure_profile.php
godmode/gis_maps/configure_gis_map.php
godmode/gis_maps/index.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_operations.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_modules.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/modules/manage_network_components_form.php
godmode/modules/manage_nc_groups_form.php
godmode/modules/manage_network_templates.php
godmode/modules/module_list.php
godmode/modules/manage_network_components_form_common.php
godmode/modules/manage_network_components_form_network.php
godmode/modules/manage_network_templates_form.php
godmode/modules/manage_network_components_form_wmi.php
godmode/modules/manage_network_components.php
godmode/modules/manage_nc_groups.php
godmode/reporting/visual_console_builder.wizard.php
godmode/reporting/graph_builder.main.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.php
godmode/reporting/reporting_builder.preview.php
godmode/reporting/reporting_builder.main.php
godmode/reporting/visual_console_builder.data.php
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/graph_builder.php
godmode/reporting/visual_console_builder.preview.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/visual_console_builder.editor.php
godmode/reporting/reporting_builder.item_editor.php
godmode/reporting/map_builder.php
godmode/reporting/graphs.php
godmode/reporting/graph_builder.preview.php
include/functions_db.php: Added some includes and functions of this code have "db_" prefix.
* include/functions.php: Moved function check_login(), check_acl(),
dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php.
* include/functions_groups.php: Moved functions get_childrens(), safe_acl_group()
and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(),
get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(),
get_group_name(), get_group_users() from functions_db.php to this code.
* include/functions_profile.php: New library with profile functions. Moved functions
get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(),
delete_profile() from functions_db.php to this code. Added new parameter in function
get_profile() to retrieve profiles with filter conditions applied.
* include/functions_users.php: New library with users functions. Moved functions
get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(),
get_user_first_group(), user_access_to_agent() from funtions_db.php to this code.
* godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile().
* include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(),
get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(),
check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(),
agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(),
get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(),
get_agent_group() from functions_db.php to this code.
* include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(),
get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(),
get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(),
get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(),
get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(),
get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(),
give_modulecategory_name(),
give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(),
get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(),
get_modulegroup_name() from functions_db.php to this code.
* include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(),
get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(),
get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(),
get_agentmodule_last_status() from functions_db.php to this code.
* include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion()
from functions_db.php to this code.
* include/functions_events.php: Moved functions get_group_events(), get_agent_events(),
get_module_events() from functions_db.php to this code.
* include/functions_servers.php: Moved functions get_server_name(), show_server_type(),
check_server_status(), server_status() from functions_db.php to this code.
* include/functions_network_profiles.php: Moved function get_networkprofile_name()
from functions_db.php to this code.
* include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y()
from fucntions_db.php to this code.
* include/functions_io.php: Moved function __() from functions_db.php to this code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-19 20:42:49 +02:00
|
|
|
$incidents = db_get_all_rows_sql ($sql);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
|
2013-07-22 16:33:37 +02:00
|
|
|
if ($incidents == false) {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$incidents = array();
|
|
|
|
}
|
|
|
|
foreach ($incidents as $incident) {
|
2013-07-22 16:33:37 +02:00
|
|
|
if ($incident['id_usuario'] == false) {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$name = __('System');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$name = $incident['id_usuario'];
|
|
|
|
}
|
2012-04-24 15:45:02 +02:00
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$data[$name] = $incident['n_incidents'];
|
|
|
|
}
|
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2015-03-18 20:28:55 +01:00
|
|
|
|
2011-04-20 11:23:54 +02:00
|
|
|
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
2015-03-18 20:28:55 +01:00
|
|
|
__('Other'), '', $water_mark,
|
2011-04-20 17:54:31 +02:00
|
|
|
$config['fontpath'], $config['font_size']);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print a pie graph with access data of incidents source
|
|
|
|
*
|
|
|
|
* @param integer width pie graph width
|
|
|
|
* @param integer height pie graph height
|
|
|
|
*/
|
2011-07-19 11:28:09 +02:00
|
|
|
function graphic_incident_source($width = 320, $height = 200) {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$data = array ();
|
|
|
|
$max_items = 5;
|
|
|
|
|
|
|
|
switch ($config["dbtype"]) {
|
|
|
|
case "mysql":
|
|
|
|
$sql = sprintf ('SELECT COUNT(id_incidencia) n_incident, origen
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
FROM tincidencia
|
|
|
|
GROUP BY `origen`
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
ORDER BY 1 DESC LIMIT %d', $max_items);
|
|
|
|
break;
|
|
|
|
case "postgresql":
|
|
|
|
$sql = sprintf ('SELECT COUNT(id_incidencia) n_incident, origen
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
FROM tincidencia
|
|
|
|
GROUP BY "origen"
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
ORDER BY 1 DESC LIMIT %d', $max_items);
|
|
|
|
break;
|
|
|
|
case "oracle":
|
|
|
|
$sql = sprintf ('SELECT COUNT(id_incidencia) n_incident, origen
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
FROM tincidencia
|
|
|
|
WHERE rownum <= %d
|
|
|
|
GROUP BY origen
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
ORDER BY 1 DESC', $max_items);
|
|
|
|
break;
|
|
|
|
}
|
* include/functions_graph.php
include/functions_html.php
include/functions_messages.php
include/db/postgresql.php
include/db/mysql.php
include/db/oracle.php
include/functions_reporting.php
include/functions_filemanager.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/ajax/skins.ajax.php
include/ajax/reporting.ajax.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/help/en/help_timesource.php
include/help/es/help_timesource.php
include/help/ja/help_timesource.php
include/config_process.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_incidents.php
include/api.php
include/functions_reports.php
include/functions_ui_renders.php
extensions/insert_data.php
extensions/system_info.php
extensions/extension_uploader.php
extensions/pandora_logs.php
extensions/agents_modules.php
extensions/update_manager.php
extensions/ssh_console.php
extensions/dbmanager.php
extensions/vnc_view.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/users_connected.php
extensions/module_groups.php
extensions/update_manager/load_updatemanager.php
extensions/update_manager/lib/libupdate_manager_client.php
extensions/update_manager/lib/libupdate_manager.php
extensions/update_manager/lib/libupdate_manager_components.php
extensions/update_manager/lib/libupdate_manager_updates.php
extensions/update_manager/settings.php
extensions/update_manager/main.php
extensions/plugin_registration.php
operation/incidents/incident.php
operation/incidents/incident_detail.php
operation/incidents/incident_statistics.php
operation/search_modules.php
operation/visual_console/render_view.php
operation/visual_console/index.php
operation/extensions.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/custom_fields.php
operation/agentes/estado_agente.php
operation/agentes/networkmap.topology.php
operation/agentes/networkmap.groups.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/gis_view.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.php
operation/agentes/graphs.php
operation/agentes/agent_fields.php
operation/agentes/tactical.php
operation/agentes/group_view.php
operation/agentes/networkmap.php
operation/agentes/stat_win.php
operation/servers/view_server.php
operation/servers/view_server_detail.php
operation/menu.php
operation/search_agents.php
operation/search_graphs.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/integria_incidents/incident.php
operation/integria_incidents/incident_detail.php
operation/integria_incidents/incident_statistics.php
operation/events/event_statistics.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/sound_events.php
operation/events/events_validate.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
operation/reporting/graph_viewer.php
operation/search_reports.php
operation/search_maps.php
operation/search_users.php
extras/pandora_diag.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
mobile/index.php
general/error_authconfig.php
general/links_menu.php
general/logon_ok.php
general/error_dbconfig.php
general/ui/agents_list.php
general/header.php
godmode/groups/modu_group_list.php
godmode/groups/configure_group.php
godmode/groups/configure_modu_group.php
godmode/groups/group_list.php
godmode/admin_access_logs.php
godmode/db/db_main.php
godmode/db/db_audit.php
godmode/db/db_sanity.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_event.php
godmode/db/db_purge.php
godmode/extensions.php
godmode/agentes/agent_template.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/fields_manager.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/configure_field.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/recon_script.php
godmode/servers/plugin.php
godmode/servers/manage_recontask.php
godmode/servers/modificar_server.php
godmode/servers/manage_recontask_form.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.php
godmode/alerts/alert_list.php
godmode/alerts/configure_alert_template.php
godmode/alerts/alert_templates.php
godmode/alerts/configure_alert_action.php
godmode/alerts/configure_alert_command.php
godmode/alerts/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/alerts/alert_commands.php
godmode/setup/file_manager.php
godmode/setup/os.list.php
godmode/setup/news.php
godmode/setup/gis_step_2.php
godmode/setup/links.php
godmode/setup/setup.php
godmode/setup/os.php
godmode/setup/performance.php
godmode/setup/setup_auth.php
godmode/setup/gis.php
godmode/setup/os.builder.php
godmode/setup/setup_visuals.php
godmode/snmpconsole/snmp_alert.php
godmode/snmpconsole/snmp_filters.php
godmode/users/user_list.php
godmode/users/configure_profile.php
godmode/gis_maps/configure_gis_map.php
godmode/gis_maps/index.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_operations.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_modules.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/modules/manage_network_components_form.php
godmode/modules/manage_nc_groups_form.php
godmode/modules/manage_network_templates.php
godmode/modules/module_list.php
godmode/modules/manage_network_components_form_common.php
godmode/modules/manage_network_components_form_network.php
godmode/modules/manage_network_templates_form.php
godmode/modules/manage_network_components_form_wmi.php
godmode/modules/manage_network_components.php
godmode/modules/manage_nc_groups.php
godmode/reporting/visual_console_builder.wizard.php
godmode/reporting/graph_builder.main.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.php
godmode/reporting/reporting_builder.preview.php
godmode/reporting/reporting_builder.main.php
godmode/reporting/visual_console_builder.data.php
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/graph_builder.php
godmode/reporting/visual_console_builder.preview.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/visual_console_builder.editor.php
godmode/reporting/reporting_builder.item_editor.php
godmode/reporting/map_builder.php
godmode/reporting/graphs.php
godmode/reporting/graph_builder.preview.php
include/functions_db.php: Added some includes and functions of this code have "db_" prefix.
* include/functions.php: Moved function check_login(), check_acl(),
dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php.
* include/functions_groups.php: Moved functions get_childrens(), safe_acl_group()
and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(),
get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(),
get_group_name(), get_group_users() from functions_db.php to this code.
* include/functions_profile.php: New library with profile functions. Moved functions
get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(),
delete_profile() from functions_db.php to this code. Added new parameter in function
get_profile() to retrieve profiles with filter conditions applied.
* include/functions_users.php: New library with users functions. Moved functions
get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(),
get_user_first_group(), user_access_to_agent() from funtions_db.php to this code.
* godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile().
* include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(),
get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(),
check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(),
agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(),
get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(),
get_agent_group() from functions_db.php to this code.
* include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(),
get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(),
get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(),
get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(),
get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(),
get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(),
give_modulecategory_name(),
give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(),
get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(),
get_modulegroup_name() from functions_db.php to this code.
* include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(),
get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(),
get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(),
get_agentmodule_last_status() from functions_db.php to this code.
* include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion()
from functions_db.php to this code.
* include/functions_events.php: Moved functions get_group_events(), get_agent_events(),
get_module_events() from functions_db.php to this code.
* include/functions_servers.php: Moved functions get_server_name(), show_server_type(),
check_server_status(), server_status() from functions_db.php to this code.
* include/functions_network_profiles.php: Moved function get_networkprofile_name()
from functions_db.php to this code.
* include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y()
from fucntions_db.php to this code.
* include/functions_io.php: Moved function __() from functions_db.php to this code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-19 20:42:49 +02:00
|
|
|
$origins = db_get_all_rows_sql ($sql);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
|
2013-07-22 16:33:37 +02:00
|
|
|
if ($origins == false) {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$origins = array();
|
|
|
|
}
|
|
|
|
foreach ($origins as $origin) {
|
|
|
|
$data[$origin['origen']] = $origin['n_incident'];
|
|
|
|
}
|
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2015-03-18 20:28:55 +01:00
|
|
|
|
2011-04-20 11:23:54 +02:00
|
|
|
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
2015-03-18 20:28:55 +01:00
|
|
|
__('Other'), '', $water_mark,
|
2011-04-20 17:54:31 +02:00
|
|
|
$config['fontpath'], $config['font_size']);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
}
|
|
|
|
|
2017-03-07 16:30:01 +01:00
|
|
|
function graph_events_validated($width = 300, $height = 200, $extra_filters = array(), $meta = false, $history = false) {
|
2013-02-04 11:22:56 +01:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
|
|
|
|
2017-03-07 16:30:01 +01:00
|
|
|
$event_type = false;
|
|
|
|
if (array_key_exists('event_type', $extra_filters))
|
|
|
|
$event_type = $extra_filters['event_type'];
|
|
|
|
|
|
|
|
$event_severity = false;
|
|
|
|
if (array_key_exists('event_severity', $extra_filters))
|
|
|
|
$event_severity = $extra_filters['event_severity'];
|
|
|
|
|
|
|
|
$event_status = false;
|
|
|
|
if (array_key_exists('event_status', $extra_filters))
|
|
|
|
$event_status = $extra_filters['event_status'];
|
|
|
|
|
|
|
|
$event_filter_search = false;
|
|
|
|
if (array_key_exists('event_filter_search', $extra_filters))
|
|
|
|
$event_filter_search = $extra_filters['event_filter_search'];
|
|
|
|
|
2017-01-11 13:26:50 +01:00
|
|
|
$data_graph = events_get_count_events_validated(
|
2017-03-07 16:30:01 +01:00
|
|
|
array('id_group' => array_keys(users_get_groups())), null, null,
|
|
|
|
$event_severity, $event_type, $event_status, $event_filter_search);
|
2013-02-04 11:22:56 +01:00
|
|
|
|
2013-03-01 14:22:29 +01:00
|
|
|
$colors = array();
|
|
|
|
foreach ($data_graph as $k => $v) {
|
2013-07-22 16:33:37 +02:00
|
|
|
if ($k == __('Validated')) {
|
2013-03-01 14:22:29 +01:00
|
|
|
$colors[$k] = COL_NORMAL;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$colors[$k] = COL_CRITICAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2013-02-19 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_agents.php,
include/functions_config.php, include/ajax/reporting.ajax.php,
include/functions_snmp_browser.php,
operation/agentes/status_monitor.php: improved code style.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/flot/jquery.flot.pie.js,
include/graphs/flot/jquery.flot.pie.min.js,
include/graphs/flot/pandora.flot.js,
include/graphs/functions_flot.php: fixed the pie graphs, added the
expanded version of flot pie js file with some changes for the
last version of jQuery.
Fixes: #3604555
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7675 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-02-19 11:35:04 +01:00
|
|
|
|
2013-02-04 11:22:56 +01:00
|
|
|
echo pie3d_graph(
|
|
|
|
true, $data_graph, $width, $height, __("other"), "",
|
2013-02-19 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_agents.php,
include/functions_config.php, include/ajax/reporting.ajax.php,
include/functions_snmp_browser.php,
operation/agentes/status_monitor.php: improved code style.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/flot/jquery.flot.pie.js,
include/graphs/flot/jquery.flot.pie.min.js,
include/graphs/flot/pandora.flot.js,
include/graphs/functions_flot.php: fixed the pie graphs, added the
expanded version of flot pie js file with some changes for the
last version of jQuery.
Fixes: #3604555
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7675 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-02-19 11:35:04 +01:00
|
|
|
$water_mark,
|
2013-03-01 14:22:29 +01:00
|
|
|
$config['fontpath'], $config['font_size'], 1, false, $colors);
|
2013-02-04 11:22:56 +01:00
|
|
|
}
|
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
/**
|
|
|
|
* Print a pie graph with events data of group
|
|
|
|
*
|
|
|
|
* @param integer width pie graph width
|
|
|
|
* @param integer height pie graph height
|
|
|
|
* @param string url
|
2012-12-18 12:54:22 +01:00
|
|
|
* @param bool if the graph required is or not for metaconsole
|
2013-01-16 13:57:11 +01:00
|
|
|
* @param bool if the graph required is or not for history table
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
*/
|
2015-04-15 09:45:13 +02:00
|
|
|
function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta = false, $history = false, $noWaterMark = true) {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
//It was urlencoded, so we urldecode it
|
|
|
|
$url = html_entity_decode (rawurldecode ($url), ENT_QUOTES);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$data = array ();
|
|
|
|
$loop = 0;
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
define ('NUM_PIECES_PIE', 6);
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2014-09-01 15:23:45 +02:00
|
|
|
|
|
|
|
//Hotfix for the id_agente_modulo
|
|
|
|
$url = str_replace(
|
|
|
|
'SELECT id_agente_modulo', 'SELECT_id_agente_modulo', $url);
|
|
|
|
|
|
|
|
|
|
|
|
$badstrings = array (";",
|
|
|
|
"SELECT ",
|
|
|
|
"DELETE ",
|
|
|
|
"UPDATE ",
|
|
|
|
"INSERT ",
|
|
|
|
"EXEC");
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
//remove bad strings from the query so queries like ; DELETE FROM don't pass
|
|
|
|
$url = str_ireplace ($badstrings, "", $url);
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
|
2014-09-01 15:23:45 +02:00
|
|
|
|
|
|
|
//Hotfix for the id_agente_modulo
|
|
|
|
$url = str_replace(
|
|
|
|
'SELECT_id_agente_modulo', 'SELECT id_agente_modulo', $url);
|
|
|
|
|
|
|
|
|
2012-12-18 12:54:22 +01:00
|
|
|
// Choose the table where search if metaconsole or not
|
2013-02-19 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_agents.php,
include/functions_config.php, include/ajax/reporting.ajax.php,
include/functions_snmp_browser.php,
operation/agentes/status_monitor.php: improved code style.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/flot/jquery.flot.pie.js,
include/graphs/flot/jquery.flot.pie.min.js,
include/graphs/flot/pandora.flot.js,
include/graphs/functions_flot.php: fixed the pie graphs, added the
expanded version of flot pie js file with some changes for the
last version of jQuery.
Fixes: #3604555
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7675 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-02-19 11:35:04 +01:00
|
|
|
if ($meta) {
|
2013-07-22 16:33:37 +02:00
|
|
|
if ($history) {
|
2013-01-16 13:57:11 +01:00
|
|
|
$event_table = 'tmetaconsole_event_history';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$event_table = 'tmetaconsole_event';
|
|
|
|
}
|
2012-12-18 12:54:22 +01:00
|
|
|
$field_extra = ', agent_name';
|
|
|
|
$groupby_extra = ', server_id';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$event_table = 'tevento';
|
|
|
|
$field_extra = '';
|
|
|
|
$groupby_extra = '';
|
|
|
|
}
|
2013-02-19 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_agents.php,
include/functions_config.php, include/ajax/reporting.ajax.php,
include/functions_snmp_browser.php,
operation/agentes/status_monitor.php: improved code style.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/flot/jquery.flot.pie.js,
include/graphs/flot/jquery.flot.pie.min.js,
include/graphs/flot/pandora.flot.js,
include/graphs/functions_flot.php: fixed the pie graphs, added the
expanded version of flot pie js file with some changes for the
last version of jQuery.
Fixes: #3604555
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7675 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-02-19 11:35:04 +01:00
|
|
|
|
2013-03-01 14:22:29 +01:00
|
|
|
// Add tags condition to filter
|
2015-01-23 08:59:42 +01:00
|
|
|
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
|
2013-03-01 14:22:29 +01:00
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
//This will give the distinct id_agente, give the id_grupo that goes
|
|
|
|
//with it and then the number of times it occured. GROUP BY statement
|
|
|
|
//is required if both DISTINCT() and COUNT() are in the statement
|
2017-03-07 16:30:01 +01:00
|
|
|
$sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente,
|
2013-04-12 11:27:55 +02:00
|
|
|
COUNT(id_agente) AS count'.$field_extra.'
|
2018-03-26 12:52:37 +02:00
|
|
|
FROM '.$event_table.' te LEFT JOIN tagent_secondary_group tasg
|
|
|
|
ON te.id_grupo = tasg.id_group
|
2013-03-01 14:22:29 +01:00
|
|
|
WHERE 1=1 %s %s
|
2012-12-18 12:54:22 +01:00
|
|
|
GROUP BY id_agente'.$groupby_extra.'
|
2014-09-01 15:23:45 +02:00
|
|
|
ORDER BY count DESC LIMIT 8', $url, $tags_condition);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
|
2013-04-10 13:03:45 +02:00
|
|
|
$result = db_get_all_rows_sql ($sql, false, false);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
if ($result === false) {
|
|
|
|
$result = array();
|
|
|
|
}
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2012-12-18 12:54:22 +01:00
|
|
|
$system_events = 0;
|
|
|
|
$other_events = 0;
|
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
foreach ($result as $row) {
|
2013-04-12 11:27:55 +02:00
|
|
|
$row["id_grupo"] = agents_get_agent_group ($row["id_agente"]);
|
2012-12-28 18:06:17 +01:00
|
|
|
if (!check_acl ($config["id_user"], $row["id_grupo"], "ER") == 1)
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
continue;
|
|
|
|
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
if ($loop >= NUM_PIECES_PIE) {
|
2012-12-18 12:54:22 +01:00
|
|
|
$other_events += $row["count"];
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
}
|
2012-07-18 15:25:51 +02:00
|
|
|
else {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
if ($row["id_agente"] == 0) {
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
$system_events += $row["count"];
|
2012-07-18 15:25:51 +02:00
|
|
|
}
|
|
|
|
else {
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
if ($meta) {
|
2017-10-04 17:49:46 +02:00
|
|
|
$name = mb_substr (io_safe_output($row['agent_name']), 0, 25)." (".$row["count"].")";
|
2012-12-18 12:54:22 +01:00
|
|
|
}
|
|
|
|
else {
|
2017-02-22 16:43:28 +01:00
|
|
|
$alias = agents_get_alias($row["id_agente"]);
|
2017-10-04 17:49:46 +02:00
|
|
|
$name = mb_substr($alias, 0, 25)." #".$row["id_agente"]." (".$row["count"].")";
|
2012-12-18 12:54:22 +01:00
|
|
|
}
|
|
|
|
$data[$name] = $row["count"];
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$loop++;
|
|
|
|
}
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
if ($system_events > 0) {
|
2012-12-18 12:54:22 +01:00
|
|
|
$name = __('SYSTEM')." (".$system_events.")";
|
|
|
|
$data[$name] = $system_events;
|
|
|
|
}
|
|
|
|
|
2013-03-01 14:22:29 +01:00
|
|
|
/*
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
if ($other_events > 0) {
|
2012-12-18 12:54:22 +01:00
|
|
|
$name = __('Other')." (".$other_events.")";
|
|
|
|
$data[$name] = $other_events;
|
|
|
|
}
|
2013-03-01 14:22:29 +01:00
|
|
|
*/
|
2012-12-18 12:54:22 +01:00
|
|
|
|
|
|
|
// Sort the data
|
|
|
|
arsort($data);
|
2015-04-15 09:45:13 +02:00
|
|
|
if ($noWaterMark) {
|
|
|
|
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2015-07-14 15:59:39 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$water_mark = array();
|
|
|
|
}
|
2013-02-19 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_agents.php,
include/functions_config.php, include/ajax/reporting.ajax.php,
include/functions_snmp_browser.php,
operation/agentes/status_monitor.php: improved code style.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/flot/jquery.flot.pie.js,
include/graphs/flot/jquery.flot.pie.min.js,
include/graphs/flot/pandora.flot.js,
include/graphs/functions_flot.php: fixed the pie graphs, added the
expanded version of flot pie js file with some changes for the
last version of jQuery.
Fixes: #3604555
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7675 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-02-19 11:35:04 +01:00
|
|
|
|
2011-04-20 11:23:54 +02:00
|
|
|
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
2012-03-05 11:26:34 +01:00
|
|
|
__('Other'), '', $water_mark,
|
2013-04-10 13:03:45 +02:00
|
|
|
$config['fontpath'], $config['font_size'], 1, 'bottom');
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
}
|
|
|
|
|
2015-04-13 12:46:30 +02:00
|
|
|
function grafico_eventos_agente ($width = 300, $height = 200, $result = false, $meta = false, $history = false) {
|
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
|
|
|
|
|
|
|
//It was urlencoded, so we urldecode it
|
2015-04-13 15:50:49 +02:00
|
|
|
//$url = html_entity_decode (rawurldecode ($url), ENT_QUOTES);
|
2015-04-13 12:46:30 +02:00
|
|
|
$data = array ();
|
|
|
|
$loop = 0;
|
|
|
|
|
|
|
|
if ($result === false) {
|
|
|
|
$result = array();
|
|
|
|
}
|
|
|
|
|
|
|
|
$system_events = 0;
|
|
|
|
$other_events = 0;
|
|
|
|
$total = array();
|
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
foreach ($result as $row) {
|
|
|
|
if ($meta) {
|
|
|
|
$count[] = $row["agent_name"];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if ($row["id_agente"] == 0) {
|
|
|
|
$count[] = __('SYSTEM');
|
|
|
|
}
|
|
|
|
else
|
2017-02-21 19:06:59 +01:00
|
|
|
$count[] = agents_get_alias($row["id_agente"]) ;
|
2015-04-13 12:46:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$total = array_count_values($count);
|
|
|
|
|
|
|
|
foreach ($total as $key => $total) {
|
|
|
|
if ($meta) {
|
|
|
|
$name = $key." (".$total.")";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$name = $key." (".$total.")";
|
|
|
|
}
|
|
|
|
$data[$name] = $total;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
if ($other_events > 0) {
|
|
|
|
$name = __('Other')." (".$other_events.")";
|
|
|
|
$data[$name] = $other_events;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Sort the data
|
|
|
|
arsort($data);
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2015-04-13 12:46:30 +02:00
|
|
|
|
|
|
|
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
2015-04-13 15:50:49 +02:00
|
|
|
__('Others'), '', $water_mark,
|
2015-04-13 12:46:30 +02:00
|
|
|
$config['fontpath'], $config['font_size'], 1, 'bottom');
|
|
|
|
}
|
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
/**
|
|
|
|
* Print a pie graph with events data in 320x200 size
|
|
|
|
*
|
|
|
|
* @param string filter Filter for query in DB
|
|
|
|
*/
|
2015-04-15 09:45:13 +02:00
|
|
|
function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWaterMark = true) {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$filter = str_replace ( "\\" , "", $filter);
|
2013-03-01 14:22:29 +01:00
|
|
|
|
|
|
|
// Add tags condition to filter
|
2015-01-23 08:59:42 +01:00
|
|
|
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
|
2013-03-01 14:22:29 +01:00
|
|
|
$filter .= $tags_condition;
|
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$data = array ();
|
|
|
|
$legend = array ();
|
|
|
|
$total = 0;
|
|
|
|
|
2017-03-07 16:30:01 +01:00
|
|
|
$where = '';
|
|
|
|
if (!users_is_admin()) {
|
|
|
|
$where = 'WHERE event_type NOT IN (\'recon_host_detected\', \'system\',\'error\', \'new_agent\', \'configuration_change\')';
|
|
|
|
}
|
|
|
|
|
|
|
|
$sql = sprintf("SELECT criticity, COUNT(id_evento) events
|
|
|
|
FROM tevento %s
|
|
|
|
GROUP BY criticity ORDER BY events DESC", $where);
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2013-04-10 13:03:45 +02:00
|
|
|
$criticities = db_get_all_rows_sql ($sql, false, false);
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2013-04-25 Miguel de Dios <miguel.dedios@artica.es>
* godmode/events/custom_events.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_edit_agents.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_delete_profiles.php,
godmode/massive/massive_delete_alerts.php,
godmode/groups/modu_group_list.php, godmode/groups/group_list.php,
godmode/reporting/graph_builder.php, godmode/reporting/graphs.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_action.php, include/functions_ui.php,
include/functions_graph.php: improved the source code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8057 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-04-25 12:16:41 +02:00
|
|
|
if (empty($criticities)) {
|
2013-03-01 14:22:29 +01:00
|
|
|
$criticities = array();
|
|
|
|
$colors = array();
|
2011-09-06 14:32:26 +02:00
|
|
|
}
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
|
2013-04-25 Miguel de Dios <miguel.dedios@artica.es>
* godmode/events/custom_events.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_edit_agents.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_delete_profiles.php,
godmode/massive/massive_delete_alerts.php,
godmode/groups/modu_group_list.php, godmode/groups/group_list.php,
godmode/reporting/graph_builder.php, godmode/reporting/graphs.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_action.php, include/functions_ui.php,
include/functions_graph.php: improved the source code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8057 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-04-25 12:16:41 +02:00
|
|
|
foreach ($criticities as $cr) {
|
|
|
|
switch ($cr['criticity']) {
|
2013-03-01 14:22:29 +01:00
|
|
|
case EVENT_CRIT_MAINTENANCE:
|
|
|
|
$data[__('Maintenance')] = $cr['events'];
|
|
|
|
$colors[__('Maintenance')] = COL_MAINTENANCE;
|
|
|
|
break;
|
|
|
|
case EVENT_CRIT_INFORMATIONAL:
|
|
|
|
$data[__('Informational')] = $cr['events'];
|
|
|
|
$colors[__('Informational')] = COL_INFORMATIONAL;
|
|
|
|
break;
|
|
|
|
case EVENT_CRIT_NORMAL:
|
|
|
|
$data[__('Normal')] = $cr['events'];
|
|
|
|
$colors[__('Normal')] = COL_NORMAL;
|
|
|
|
break;
|
|
|
|
case EVENT_CRIT_MINOR:
|
|
|
|
$data[__('Minor')] = $cr['events'];
|
|
|
|
$colors[__('Minor')] = COL_MINOR;
|
|
|
|
break;
|
|
|
|
case EVENT_CRIT_WARNING:
|
|
|
|
$data[__('Warning')] = $cr['events'];
|
|
|
|
$colors[__('Warning')] = COL_WARNING;
|
|
|
|
break;
|
|
|
|
case EVENT_CRIT_MAJOR:
|
|
|
|
$data[__('Major')] = $cr['events'];
|
|
|
|
$colors[__('Major')] = COL_MAJOR;
|
|
|
|
break;
|
|
|
|
case EVENT_CRIT_CRITICAL:
|
|
|
|
$data[__('Critical')] = $cr['events'];
|
|
|
|
$colors[__('Critical')] = COL_CRITICAL;
|
|
|
|
break;
|
|
|
|
}
|
2011-09-06 14:32:26 +02:00
|
|
|
}
|
2015-04-15 09:45:13 +02:00
|
|
|
if ($noWaterMark) {
|
|
|
|
$water_mark = array(
|
|
|
|
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("/images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2015-07-14 15:59:39 +02:00
|
|
|
else {
|
|
|
|
$water_mark = array();
|
|
|
|
}
|
2012-03-05 11:26:34 +01:00
|
|
|
|
2013-03-01 14:22:29 +01:00
|
|
|
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
2012-03-05 11:26:34 +01:00
|
|
|
__('Other'), '', $water_mark,
|
2013-04-10 13:03:45 +02:00
|
|
|
$config['fontpath'], $config['font_size'], 1, 'bottom', $colors);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print a pie graph with events data of users
|
|
|
|
*
|
|
|
|
* @param integer height pie graph height
|
|
|
|
* @param integer period time period
|
|
|
|
*/
|
2011-07-19 11:28:09 +02:00
|
|
|
function grafico_eventos_usuario ($width, $height) {
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
$data = array ();
|
|
|
|
$max_items = 5;
|
2017-03-07 16:30:01 +01:00
|
|
|
|
|
|
|
$where = '';
|
|
|
|
if (!users_is_admin()) {
|
|
|
|
$where = 'WHERE event_type NOT IN (\'recon_host_detected\', \'system\',\'error\', \'new_agent\', \'configuration_change\')';
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
}
|
2017-03-07 16:30:01 +01:00
|
|
|
|
|
|
|
$sql = sprintf ('SELECT COUNT(id_evento) events, id_usuario
|
|
|
|
FROM tevento %s
|
|
|
|
GROUP BY id_usuario
|
|
|
|
ORDER BY 1 DESC LIMIT %d', $where, $max_items);
|
|
|
|
|
* include/functions_graph.php
include/functions_html.php
include/functions_messages.php
include/db/postgresql.php
include/db/mysql.php
include/db/oracle.php
include/functions_reporting.php
include/functions_filemanager.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/ajax/skins.ajax.php
include/ajax/reporting.ajax.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/help/en/help_timesource.php
include/help/es/help_timesource.php
include/help/ja/help_timesource.php
include/config_process.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_incidents.php
include/api.php
include/functions_reports.php
include/functions_ui_renders.php
extensions/insert_data.php
extensions/system_info.php
extensions/extension_uploader.php
extensions/pandora_logs.php
extensions/agents_modules.php
extensions/update_manager.php
extensions/ssh_console.php
extensions/dbmanager.php
extensions/vnc_view.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/users_connected.php
extensions/module_groups.php
extensions/update_manager/load_updatemanager.php
extensions/update_manager/lib/libupdate_manager_client.php
extensions/update_manager/lib/libupdate_manager.php
extensions/update_manager/lib/libupdate_manager_components.php
extensions/update_manager/lib/libupdate_manager_updates.php
extensions/update_manager/settings.php
extensions/update_manager/main.php
extensions/plugin_registration.php
operation/incidents/incident.php
operation/incidents/incident_detail.php
operation/incidents/incident_statistics.php
operation/search_modules.php
operation/visual_console/render_view.php
operation/visual_console/index.php
operation/extensions.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/custom_fields.php
operation/agentes/estado_agente.php
operation/agentes/networkmap.topology.php
operation/agentes/networkmap.groups.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/gis_view.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.php
operation/agentes/graphs.php
operation/agentes/agent_fields.php
operation/agentes/tactical.php
operation/agentes/group_view.php
operation/agentes/networkmap.php
operation/agentes/stat_win.php
operation/servers/view_server.php
operation/servers/view_server_detail.php
operation/menu.php
operation/search_agents.php
operation/search_graphs.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/integria_incidents/incident.php
operation/integria_incidents/incident_detail.php
operation/integria_incidents/incident_statistics.php
operation/events/event_statistics.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/sound_events.php
operation/events/events_validate.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
operation/reporting/graph_viewer.php
operation/search_reports.php
operation/search_maps.php
operation/search_users.php
extras/pandora_diag.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
mobile/index.php
general/error_authconfig.php
general/links_menu.php
general/logon_ok.php
general/error_dbconfig.php
general/ui/agents_list.php
general/header.php
godmode/groups/modu_group_list.php
godmode/groups/configure_group.php
godmode/groups/configure_modu_group.php
godmode/groups/group_list.php
godmode/admin_access_logs.php
godmode/db/db_main.php
godmode/db/db_audit.php
godmode/db/db_sanity.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_event.php
godmode/db/db_purge.php
godmode/extensions.php
godmode/agentes/agent_template.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/fields_manager.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/configure_field.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/recon_script.php
godmode/servers/plugin.php
godmode/servers/manage_recontask.php
godmode/servers/modificar_server.php
godmode/servers/manage_recontask_form.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.php
godmode/alerts/alert_list.php
godmode/alerts/configure_alert_template.php
godmode/alerts/alert_templates.php
godmode/alerts/configure_alert_action.php
godmode/alerts/configure_alert_command.php
godmode/alerts/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/alerts/alert_commands.php
godmode/setup/file_manager.php
godmode/setup/os.list.php
godmode/setup/news.php
godmode/setup/gis_step_2.php
godmode/setup/links.php
godmode/setup/setup.php
godmode/setup/os.php
godmode/setup/performance.php
godmode/setup/setup_auth.php
godmode/setup/gis.php
godmode/setup/os.builder.php
godmode/setup/setup_visuals.php
godmode/snmpconsole/snmp_alert.php
godmode/snmpconsole/snmp_filters.php
godmode/users/user_list.php
godmode/users/configure_profile.php
godmode/gis_maps/configure_gis_map.php
godmode/gis_maps/index.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_operations.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_modules.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/modules/manage_network_components_form.php
godmode/modules/manage_nc_groups_form.php
godmode/modules/manage_network_templates.php
godmode/modules/module_list.php
godmode/modules/manage_network_components_form_common.php
godmode/modules/manage_network_components_form_network.php
godmode/modules/manage_network_templates_form.php
godmode/modules/manage_network_components_form_wmi.php
godmode/modules/manage_network_components.php
godmode/modules/manage_nc_groups.php
godmode/reporting/visual_console_builder.wizard.php
godmode/reporting/graph_builder.main.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.php
godmode/reporting/reporting_builder.preview.php
godmode/reporting/reporting_builder.main.php
godmode/reporting/visual_console_builder.data.php
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/graph_builder.php
godmode/reporting/visual_console_builder.preview.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/visual_console_builder.editor.php
godmode/reporting/reporting_builder.item_editor.php
godmode/reporting/map_builder.php
godmode/reporting/graphs.php
godmode/reporting/graph_builder.preview.php
include/functions_db.php: Added some includes and functions of this code have "db_" prefix.
* include/functions.php: Moved function check_login(), check_acl(),
dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php.
* include/functions_groups.php: Moved functions get_childrens(), safe_acl_group()
and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(),
get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(),
get_group_name(), get_group_users() from functions_db.php to this code.
* include/functions_profile.php: New library with profile functions. Moved functions
get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(),
delete_profile() from functions_db.php to this code. Added new parameter in function
get_profile() to retrieve profiles with filter conditions applied.
* include/functions_users.php: New library with users functions. Moved functions
get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(),
get_user_first_group(), user_access_to_agent() from funtions_db.php to this code.
* godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile().
* include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(),
get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(),
check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(),
agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(),
get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(),
get_agent_group() from functions_db.php to this code.
* include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(),
get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(),
get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(),
get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(),
get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(),
get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(),
give_modulecategory_name(),
give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(),
get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(),
get_modulegroup_name() from functions_db.php to this code.
* include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(),
get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(),
get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(),
get_agentmodule_last_status() from functions_db.php to this code.
* include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion()
from functions_db.php to this code.
* include/functions_events.php: Moved functions get_group_events(), get_agent_events(),
get_module_events() from functions_db.php to this code.
* include/functions_servers.php: Moved functions get_server_name(), show_server_type(),
check_server_status(), server_status() from functions_db.php to this code.
* include/functions_network_profiles.php: Moved function get_networkprofile_name()
from functions_db.php to this code.
* include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y()
from fucntions_db.php to this code.
* include/functions_io.php: Moved function __() from functions_db.php to this code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-19 20:42:49 +02:00
|
|
|
$events = db_get_all_rows_sql ($sql);
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
if ($events === false) {
|
|
|
|
$events = array();
|
|
|
|
}
|
|
|
|
|
2011-08-19 14:14:42 +02:00
|
|
|
foreach($events as $event) {
|
2013-02-19 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_agents.php,
include/functions_config.php, include/ajax/reporting.ajax.php,
include/functions_snmp_browser.php,
operation/agentes/status_monitor.php: improved code style.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/flot/jquery.flot.pie.js,
include/graphs/flot/jquery.flot.pie.min.js,
include/graphs/flot/pandora.flot.js,
include/graphs/functions_flot.php: fixed the pie graphs, added the
expanded version of flot pie js file with some changes for the
last version of jQuery.
Fixes: #3604555
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7675 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-02-19 11:35:04 +01:00
|
|
|
if ($event['id_usuario'] == '0') {
|
|
|
|
$data[__('System')] = $event['events'];
|
|
|
|
}
|
|
|
|
elseif ($event['id_usuario'] == '') {
|
2011-08-19 14:14:42 +02:00
|
|
|
$data[__('System')] = $event['events'];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data[$event['id_usuario']] = $event['events'];
|
|
|
|
}
|
|
|
|
}
|
2012-03-05 11:26:34 +01:00
|
|
|
|
2013-02-19 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_agents.php,
include/functions_config.php, include/ajax/reporting.ajax.php,
include/functions_snmp_browser.php,
operation/agentes/status_monitor.php: improved code style.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/flot/jquery.flot.pie.js,
include/graphs/flot/jquery.flot.pie.min.js,
include/graphs/flot/pandora.flot.js,
include/graphs/functions_flot.php: fixed the pie graphs, added the
expanded version of flot pie js file with some changes for the
last version of jQuery.
Fixes: #3604555
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7675 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-02-19 11:35:04 +01:00
|
|
|
$water_mark = array(
|
|
|
|
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
2015-03-18 20:28:55 +01:00
|
|
|
'url' => ui_get_full_url("/images/logo_vertical_water.png", false, false, false));
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2011-04-20 11:23:54 +02:00
|
|
|
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
2012-03-05 11:26:34 +01:00
|
|
|
__('Other'), '', $water_mark,
|
2011-04-20 17:54:31 +02:00
|
|
|
$config['fontpath'], $config['font_size']);
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_reporting.php,
operation/incidents/incident_statistics.php,
operation/agentes/custom_fields.php, operation/agentes/agent_fields.php,
operation/servers/view_server_detail.php,
operation/integria_incidents/incident_statistics.php,
operation/events/event_statistics.php, operation/events/events_list.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
godmode/admin_access_logs.php, godmode/db/db_main.php,
godmode/db/db_info.php, godmode/db/db_purge.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/graph_builder.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/graph_builder.preview.php: changed for to use new engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 19:31:06 +02:00
|
|
|
}
|
2011-04-14 18:52:50 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Print a custom SQL-defined graph
|
|
|
|
*
|
|
|
|
* @param integer ID of report content, used to get SQL code to get information for graph
|
|
|
|
* @param integer height graph height
|
|
|
|
* @param integer width graph width
|
|
|
|
* @param integer Graph type 1 vbar, 2 hbar, 3 pie
|
|
|
|
*/
|
2015-05-12 16:41:08 +02:00
|
|
|
function graph_custom_sql_graph ($id, $width, $height,
|
|
|
|
$type = 'sql_graph_vbar', $only_image = false, $homeurl = '',
|
2018-03-01 13:11:11 +01:00
|
|
|
$ttl = 1, $max_num_elements = 8) {
|
2015-05-12 16:41:08 +02:00
|
|
|
|
2011-04-14 18:52:50 +02:00
|
|
|
global $config;
|
2018-03-01 12:41:17 +01:00
|
|
|
$SQL_GRAPH_MAX_LABEL_SIZE = 20;
|
2012-07-18 15:25:51 +02:00
|
|
|
|
|
|
|
$report_content = db_get_row ('treport_content', 'id_rc', $id);
|
2017-07-03 10:38:04 +02:00
|
|
|
if($id != null){
|
|
|
|
$historical_db = db_get_value_sql("SELECT historical_db from treport_content where id_rc =".$id);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$historical_db = $content['historical_db'];
|
|
|
|
}
|
2015-06-08 11:05:19 +02:00
|
|
|
if ($report_content["external_source"] != "") {
|
2012-07-18 15:25:51 +02:00
|
|
|
$sql = io_safe_output ($report_content["external_source"]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$sql = db_get_row('treport_custom_sql', 'id', $report_content["treport_custom_sql_id"]);
|
|
|
|
$sql = io_safe_output($sql['sql']);
|
|
|
|
}
|
|
|
|
|
2012-09-10 17:12:52 +02:00
|
|
|
if (($config['metaconsole'] == 1) && defined('METACONSOLE')) {
|
|
|
|
$metaconsole_connection = enterprise_hook('metaconsole_get_connection', array($report_content['server_name']));
|
|
|
|
|
|
|
|
if ($metaconsole_connection === false) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (enterprise_hook('metaconsole_load_external_db', array($metaconsole_connection)) != NOERR) {
|
|
|
|
//ui_print_error_message ("Error connecting to ".$server_name);
|
|
|
|
return false;
|
2013-02-14 11:05:16 +01:00
|
|
|
}
|
2012-09-10 17:12:52 +02:00
|
|
|
}
|
2013-02-14 11:05:16 +01:00
|
|
|
|
2015-06-02 19:10:11 +02:00
|
|
|
|
|
|
|
switch ($config["dbtype"]) {
|
|
|
|
case "mysql":
|
|
|
|
case "postgresql":
|
|
|
|
break;
|
|
|
|
case "oracle":
|
|
|
|
$sql = str_replace(";", "", $sql);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2017-05-31 12:42:43 +02:00
|
|
|
$data_result = db_get_all_rows_sql ($sql,$historical_db);
|
|
|
|
|
2015-06-02 19:10:11 +02:00
|
|
|
|
2013-02-14 11:05:16 +01:00
|
|
|
|
2012-09-10 17:12:52 +02:00
|
|
|
if (($config['metaconsole'] == 1) && defined('METACONSOLE'))
|
|
|
|
enterprise_hook('metaconsole_restore_db');
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2011-04-14 18:52:50 +02:00
|
|
|
if ($data_result === false)
|
|
|
|
$data_result = array ();
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2011-04-14 18:52:50 +02:00
|
|
|
$data = array ();
|
|
|
|
|
|
|
|
$count = 0;
|
|
|
|
foreach ($data_result as $data_item) {
|
|
|
|
$count++;
|
2013-06-12 18:36:46 +02:00
|
|
|
$value = 0;
|
|
|
|
if (!empty($data_item["value"])) {
|
|
|
|
$value = $data_item["value"];
|
|
|
|
}
|
2018-03-01 13:11:11 +01:00
|
|
|
if ($count <= $max_num_elements) {
|
|
|
|
$label = __('Data');
|
|
|
|
if (!empty($data_item["label"])) {
|
|
|
|
$label = io_safe_output($data_item["label"]);
|
2018-03-01 16:49:50 +01:00
|
|
|
if (strlen($label) > $SQL_GRAPH_MAX_LABEL_SIZE) {
|
2018-03-01 13:11:11 +01:00
|
|
|
$first_label = $label;
|
|
|
|
$label = substr($first_label, 0, floor($SQL_GRAPH_MAX_LABEL_SIZE/2));
|
|
|
|
$label .= '...';
|
|
|
|
$label .= substr($first_label, floor(-$SQL_GRAPH_MAX_LABEL_SIZE/2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
switch ($type) {
|
|
|
|
case 'sql_graph_vbar': // vertical bar
|
|
|
|
case 'sql_graph_hbar': // horizontal bar
|
|
|
|
$data[$label."_".$count]['g'] = $value;
|
|
|
|
break;
|
|
|
|
case 'sql_graph_pie': // Pie
|
|
|
|
$data[$label."_".$count] = $value;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch ($type) {
|
|
|
|
case 'sql_graph_vbar': // vertical bar
|
|
|
|
case 'sql_graph_hbar': // horizontal bar
|
|
|
|
if (!isset($data[__('Other')]['g'])) $data[__('Other')]['g'] = 0;
|
|
|
|
$data[__('Other')]['g'] += $value;
|
|
|
|
break;
|
|
|
|
case 'sql_graph_pie': // Pie
|
|
|
|
if (!isset($data[__('Other')])) $data[__('Other')] = 0;
|
|
|
|
$data[__('Other')] += $value;
|
|
|
|
break;
|
2018-03-01 12:41:17 +01:00
|
|
|
}
|
2012-07-18 15:25:51 +02:00
|
|
|
}
|
2011-04-14 18:52:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$flash_charts = $config['flash_charts'];
|
2017-05-31 12:42:43 +02:00
|
|
|
|
2011-04-14 18:52:50 +02:00
|
|
|
if ($only_image) {
|
|
|
|
$flash_charts = false;
|
|
|
|
}
|
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2012-03-05 11:26:34 +01:00
|
|
|
|
2012-07-18 15:25:51 +02:00
|
|
|
switch ($type) {
|
|
|
|
case 'sql_graph_vbar': // vertical bar
|
2018-03-01 12:02:08 +01:00
|
|
|
return vbar_graph(
|
|
|
|
$flash_charts,
|
|
|
|
$data,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
array(),
|
|
|
|
array(),
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
$water_mark,
|
|
|
|
$config['fontpath'],
|
|
|
|
$config['font_size'],
|
|
|
|
"",
|
|
|
|
$ttl,
|
2018-04-10 11:37:17 +02:00
|
|
|
$homeurl,
|
2018-03-01 12:02:08 +01:00
|
|
|
"white",
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
"black"
|
|
|
|
);
|
2012-07-18 15:25:51 +02:00
|
|
|
break;
|
|
|
|
case 'sql_graph_hbar': // horizontal bar
|
2018-03-01 13:11:11 +01:00
|
|
|
return hbar_graph(
|
|
|
|
$flash_charts,
|
|
|
|
$data,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
array(),
|
|
|
|
array(),
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
$water_mark,
|
|
|
|
$config['fontpath'],
|
|
|
|
$config['font_size'],
|
|
|
|
false,
|
|
|
|
$ttl,
|
2018-04-10 11:37:17 +02:00
|
|
|
$homeurl,
|
2018-03-01 13:11:11 +01:00
|
|
|
'white',
|
|
|
|
'black'
|
|
|
|
);
|
2012-07-18 15:25:51 +02:00
|
|
|
break;
|
|
|
|
case 'sql_graph_pie': // Pie
|
|
|
|
return pie3d_graph($flash_charts, $data, $width, $height, __("other"), $homeurl,
|
|
|
|
$water_mark, $config['fontpath'], '', $ttl);
|
|
|
|
break;
|
|
|
|
}
|
2011-04-14 18:52:50 +02:00
|
|
|
}
|
2011-04-18 16:05:54 +02:00
|
|
|
|
2012-01-26 13:51:43 +01:00
|
|
|
/**
|
|
|
|
* Print a static graph with event data of agents
|
|
|
|
*
|
|
|
|
* @param integer id_agent Agent ID
|
|
|
|
* @param integer width pie graph width
|
|
|
|
* @param integer height pie graph height
|
|
|
|
* @param integer period time period
|
2013-02-20 18:15:38 +01:00
|
|
|
* @param string homeurl
|
|
|
|
* @param bool return or echo the result
|
2012-01-26 13:51:43 +01:00
|
|
|
*/
|
2017-07-10 16:22:41 +02:00
|
|
|
function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false) {
|
2012-01-26 13:51:43 +01:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
|
|
|
|
2013-07-03 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/module_graph.php,
mobile/operation/modules.php, mobile/operation/networkmaps.php,
mobile/operation/groups.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/networkmap.php,
mobile/operation/alerts.php, mobile/operation/agent.php,
mobile/include/ui.class.php: added the back button in the head and
impoved the source code style to make more easy the merges with
the last branch.
* include/functions_graph.php: fixed PHP notices.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8468 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-03 15:59:38 +02:00
|
|
|
|
2012-01-26 13:51:43 +01:00
|
|
|
$data = array ();
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2012-01-26 13:51:43 +01:00
|
|
|
$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
|
|
|
|
|
|
|
$interval = (int) ($period / $resolution);
|
|
|
|
$date = get_system_time ();
|
|
|
|
$datelimit = $date - $period;
|
|
|
|
$periodtime = floor ($period / $interval);
|
|
|
|
$time = array ();
|
|
|
|
$data = array ();
|
|
|
|
$legend = array();
|
2012-03-01 17:41:02 +01:00
|
|
|
$full_legend = array();
|
2017-07-10 16:22:41 +02:00
|
|
|
$full_legend_date = array();
|
2012-01-26 13:51:43 +01:00
|
|
|
|
|
|
|
$cont = 0;
|
|
|
|
for ($i = 0; $i < $interval; $i++) {
|
|
|
|
$bottom = $datelimit + ($periodtime * $i);
|
|
|
|
if (! $graphic_type) {
|
2013-04-22 17:51:37 +02:00
|
|
|
if ($config['flash_charts']) {
|
2017-11-17 11:44:38 +01:00
|
|
|
$name = date('H:i', $bottom);
|
2013-02-21 15:26:00 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$name = date('H\h', $bottom);
|
|
|
|
}
|
2012-07-18 15:25:51 +02:00
|
|
|
}
|
|
|
|
else {
|
2012-01-26 13:51:43 +01:00
|
|
|
$name = $bottom;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Show less values in legend
|
|
|
|
if ($cont == 0 or $cont % 2)
|
2013-02-21 11:10:49 +01:00
|
|
|
$legend[$cont] = $name;
|
2012-01-26 13:51:43 +01:00
|
|
|
|
2017-07-10 16:22:41 +02:00
|
|
|
if ($from_agent_view) {
|
|
|
|
$full_date = date('Y/m/d', $bottom);
|
|
|
|
$full_legend_date[$cont] = $full_date;
|
|
|
|
}
|
|
|
|
|
2013-02-21 11:10:49 +01:00
|
|
|
$full_legend[$cont] = $name;
|
2012-03-01 17:41:02 +01:00
|
|
|
|
2012-01-26 13:51:43 +01:00
|
|
|
$top = $datelimit + ($periodtime * ($i + 1));
|
2017-07-13 16:57:53 +02:00
|
|
|
$event = db_get_row_filter ('tevento',
|
|
|
|
array ('id_agente' => $id_agent,
|
|
|
|
'utimestamp > '.$bottom,
|
|
|
|
'utimestamp < '.$top), 'criticity, utimestamp');
|
|
|
|
|
|
|
|
if (!empty($event['utimestamp'])) {
|
|
|
|
$data[$cont]['utimestamp'] = $periodtime;
|
|
|
|
switch ($event['criticity']) {
|
|
|
|
case EVENT_CRIT_WARNING:
|
|
|
|
$data[$cont]['data'] = 2;
|
|
|
|
break;
|
|
|
|
case EVENT_CRIT_CRITICAL:
|
|
|
|
$data[$cont]['data'] = 3;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$data[$cont]['data'] = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data[$cont]['utimestamp'] = $periodtime;
|
|
|
|
$data[$cont]['data'] = 1;
|
|
|
|
}
|
|
|
|
$cont++;
|
|
|
|
}
|
2017-07-10 16:22:41 +02:00
|
|
|
|
2017-07-13 16:57:53 +02:00
|
|
|
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
|
|
|
|
|
|
|
// Draw slicebar graph
|
|
|
|
if ($config['flash_charts']) {
|
2017-07-10 16:22:41 +02:00
|
|
|
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
|
2017-07-13 16:57:53 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$out = slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
|
|
|
|
|
|
|
// Draw legend
|
|
|
|
$out .= "<br>";
|
|
|
|
$out .= " ";
|
|
|
|
foreach ($legend as $hour) {
|
|
|
|
$out .= "<span style='font-size: 6pt'>" . $hour . "</span>";
|
|
|
|
$out .= " ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($return) {
|
|
|
|
return $out;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
echo $out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print a static graph with event data of agents
|
|
|
|
*
|
|
|
|
* @param integer id_agent Agent ID
|
|
|
|
* @param integer width pie graph width
|
|
|
|
* @param integer height pie graph height
|
|
|
|
* @param integer period time period
|
|
|
|
* @param string homeurl
|
|
|
|
* @param bool return or echo the result
|
|
|
|
*/
|
|
|
|
function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $period = 0, $homeurl, $return = false) {
|
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2017-07-13 16:57:53 +02:00
|
|
|
$data = array ();
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2017-07-13 16:57:53 +02:00
|
|
|
$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
|
|
|
$interval = (int) ($period / $resolution);
|
|
|
|
$date = get_system_time ();
|
|
|
|
$datelimit = $date - $period;
|
|
|
|
$periodtime = floor ($period / $interval);
|
|
|
|
$time = array ();
|
|
|
|
$data = array ();
|
|
|
|
$legend = array();
|
|
|
|
$full_legend = array();
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2017-07-13 16:57:53 +02:00
|
|
|
$cont = 0;
|
|
|
|
for ($i = 0; $i < $interval; $i++) {
|
|
|
|
$bottom = $datelimit + ($periodtime * $i);
|
|
|
|
if (! $graphic_type) {
|
|
|
|
if ($config['flash_charts']) {
|
|
|
|
$name = date('H:i:s', $bottom);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$name = date('H\h', $bottom);
|
|
|
|
}
|
2017-07-13 13:25:28 +02:00
|
|
|
}
|
|
|
|
else {
|
2017-07-13 16:57:53 +02:00
|
|
|
$name = $bottom;
|
2017-07-13 13:25:28 +02:00
|
|
|
}
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2017-07-13 16:57:53 +02:00
|
|
|
// Show less values in legend
|
|
|
|
if ($cont == 0 or $cont % 2)
|
|
|
|
$legend[$cont] = $name;
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2017-07-13 16:57:53 +02:00
|
|
|
$full_legend[$cont] = $name;
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2017-07-13 16:57:53 +02:00
|
|
|
$top = $datelimit + ($periodtime * ($i + 1));
|
|
|
|
|
2017-10-13 14:16:37 +02:00
|
|
|
$event_filter = array ('id_agente' => $id_agent,
|
|
|
|
'utimestamp > '.$bottom,
|
|
|
|
'utimestamp < '.$top);
|
|
|
|
if ((int)$id_module !== 0) {
|
|
|
|
$event_filter['id_agentmodule'] = $id_module;
|
|
|
|
}
|
|
|
|
$event = db_get_row_filter ('tevento', $event_filter, 'criticity, utimestamp');
|
2017-07-13 16:57:53 +02:00
|
|
|
|
2013-04-25 Miguel de Dios <miguel.dedios@artica.es>
* godmode/events/custom_events.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_edit_agents.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_delete_profiles.php,
godmode/massive/massive_delete_alerts.php,
godmode/groups/modu_group_list.php, godmode/groups/group_list.php,
godmode/reporting/graph_builder.php, godmode/reporting/graphs.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_action.php, include/functions_ui.php,
include/functions_graph.php: improved the source code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8057 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-04-25 12:16:41 +02:00
|
|
|
if (!empty($event['utimestamp'])) {
|
2012-01-26 13:51:43 +01:00
|
|
|
$data[$cont]['utimestamp'] = $periodtime;
|
|
|
|
switch ($event['criticity']) {
|
2013-04-25 Miguel de Dios <miguel.dedios@artica.es>
* godmode/events/custom_events.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_edit_agents.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_delete_profiles.php,
godmode/massive/massive_delete_alerts.php,
godmode/groups/modu_group_list.php, godmode/groups/group_list.php,
godmode/reporting/graph_builder.php, godmode/reporting/graphs.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_action.php, include/functions_ui.php,
include/functions_graph.php: improved the source code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8057 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-04-25 12:16:41 +02:00
|
|
|
case EVENT_CRIT_WARNING:
|
2012-07-18 15:25:51 +02:00
|
|
|
$data[$cont]['data'] = 2;
|
|
|
|
break;
|
2013-04-25 Miguel de Dios <miguel.dedios@artica.es>
* godmode/events/custom_events.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_edit_agents.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_delete_profiles.php,
godmode/massive/massive_delete_alerts.php,
godmode/groups/modu_group_list.php, godmode/groups/group_list.php,
godmode/reporting/graph_builder.php, godmode/reporting/graphs.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_action.php, include/functions_ui.php,
include/functions_graph.php: improved the source code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8057 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-04-25 12:16:41 +02:00
|
|
|
case EVENT_CRIT_CRITICAL:
|
2012-07-18 15:25:51 +02:00
|
|
|
$data[$cont]['data'] = 3;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$data[$cont]['data'] = 1;
|
|
|
|
break;
|
2012-01-26 13:51:43 +01:00
|
|
|
}
|
|
|
|
}
|
2013-04-22 17:51:37 +02:00
|
|
|
else {
|
2012-07-18 15:25:51 +02:00
|
|
|
$data[$cont]['utimestamp'] = $periodtime;
|
|
|
|
$data[$cont]['data'] = 1;
|
|
|
|
}
|
2012-01-26 13:51:43 +01:00
|
|
|
$cont++;
|
|
|
|
}
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2013-02-21 11:10:49 +01:00
|
|
|
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2012-01-26 13:51:43 +01:00
|
|
|
// Draw slicebar graph
|
2012-07-18 15:25:51 +02:00
|
|
|
if ($config['flash_charts']) {
|
2016-08-19 12:46:27 +02:00
|
|
|
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent);
|
2012-03-01 17:41:02 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-02-20 18:15:38 +01:00
|
|
|
$out = slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Draw legend
|
2013-02-20 18:15:38 +01:00
|
|
|
$out .= "<br>";
|
|
|
|
$out .= " ";
|
2012-07-18 15:25:51 +02:00
|
|
|
foreach ($legend as $hour) {
|
2013-02-20 18:15:38 +01:00
|
|
|
$out .= "<span style='font-size: 6pt'>" . $hour . "</span>";
|
|
|
|
$out .= " ";
|
2012-03-01 17:41:02 +01:00
|
|
|
}
|
2012-01-26 13:51:43 +01:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-22 17:51:37 +02:00
|
|
|
if ($return) {
|
2013-02-20 18:15:38 +01:00
|
|
|
return $out;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
echo $out;
|
|
|
|
}
|
2012-01-26 13:51:43 +01:00
|
|
|
}
|
|
|
|
|
2011-04-18 16:05:54 +02:00
|
|
|
// Prints an error image
|
2013-07-01 17:41:40 +02:00
|
|
|
function fs_error_image ($width = 300, $height = 110) {
|
2011-04-18 16:05:54 +02:00
|
|
|
global $config;
|
2013-07-01 17:41:40 +02:00
|
|
|
return graph_nodata_image($width, $height, 'area');
|
2011-04-18 16:05:54 +02:00
|
|
|
}
|
2011-04-19 14:11:00 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
function fullscale_data (
|
|
|
|
$agent_module_id, $date_array,
|
|
|
|
$show_unknown = 0, $show_percentil = 0,
|
2018-06-06 11:18:39 +02:00
|
|
|
$series_suffix,
|
2018-02-21 11:54:24 +01:00
|
|
|
$compare = false){
|
|
|
|
|
2018-02-16 13:41:31 +01:00
|
|
|
global $config;
|
2018-02-27 16:28:00 +01:00
|
|
|
$data_uncompress =
|
2018-02-16 13:41:31 +01:00
|
|
|
db_uncompress_module_data(
|
2018-02-27 16:28:00 +01:00
|
|
|
$agent_module_id,
|
|
|
|
$date_array['start_date'],
|
2018-02-16 13:41:31 +01:00
|
|
|
$date_array['final_date']
|
|
|
|
);
|
|
|
|
|
|
|
|
$data = array();
|
|
|
|
$previous_data = 0;
|
|
|
|
$min_value = PHP_INT_MAX-1;
|
|
|
|
$max_value = PHP_INT_MIN+1;
|
|
|
|
$flag_unknown = 0;
|
|
|
|
$array_percentil = array();
|
|
|
|
foreach ($data_uncompress as $k) {
|
|
|
|
foreach ($k["data"] as $v) {
|
|
|
|
if (isset($v["type"]) && $v["type"] == 1) { # skip unnecesary virtual data
|
|
|
|
continue;
|
|
|
|
}
|
2018-02-21 11:54:24 +01:00
|
|
|
if($compare){ // * 1000 need js utimestam mlsecond
|
|
|
|
$real_date = ($v['utimestamp'] + $date_array['period']) * 1000;
|
|
|
|
}
|
|
|
|
else{
|
2018-02-27 16:28:00 +01:00
|
|
|
$real_date = $v['utimestamp'] * 1000;
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
2018-02-16 13:41:31 +01:00
|
|
|
|
|
|
|
if ($v["datos"] === NULL) {
|
|
|
|
// Unknown
|
2018-02-21 11:54:24 +01:00
|
|
|
if(!$compare){
|
|
|
|
if($flag_unknown){
|
|
|
|
$data["unknown" . $series_suffix]['data'][] = array($real_date , 1);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$data["unknown" . $series_suffix]['data'][] = array( ($real_date - 1) , 0);
|
|
|
|
$data["unknown" . $series_suffix]['data'][] = array($real_date , 1);
|
|
|
|
$flag_unknown = 1;
|
|
|
|
}
|
2018-02-16 13:41:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$data["sum" . $series_suffix]['data'][] = array($real_date , $previous_data);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
//normal
|
|
|
|
$previous_data = $v["datos"];
|
|
|
|
$data["sum" . $series_suffix]['data'][] = array($real_date , $v["datos"]);
|
2018-02-21 11:54:24 +01:00
|
|
|
if(!$compare){
|
|
|
|
if($flag_unknown){
|
|
|
|
$data["unknown" . $series_suffix]['data'][] = array($real_date , 0);
|
|
|
|
$flag_unknown = 0;
|
|
|
|
}
|
2018-02-16 13:41:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($v["datos"]) && $v["datos"]){
|
|
|
|
//max
|
|
|
|
if($v['datos'] >= $max_value){
|
|
|
|
$max_value = $v['datos'];
|
|
|
|
}
|
|
|
|
//min
|
|
|
|
if($v['datos'] <= $min_value){
|
|
|
|
$min_value = $v['datos'];
|
|
|
|
}
|
|
|
|
//avg sum
|
|
|
|
$sum_data += $v["datos"];
|
|
|
|
}
|
|
|
|
//avg count
|
|
|
|
$count_data++;
|
|
|
|
|
2018-02-21 11:54:24 +01:00
|
|
|
if($show_percentil && !$compare){
|
2018-02-27 16:28:00 +01:00
|
|
|
$array_percentil[] = $v["datos"];
|
2018-02-16 13:41:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$last_data = $v["datos"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-21 11:54:24 +01:00
|
|
|
if($show_percentil && !$compare){
|
2018-02-16 13:41:31 +01:00
|
|
|
$percentil_result = get_percentile($show_percentil, $array_percentil);
|
2018-02-21 11:54:24 +01:00
|
|
|
if($compare){
|
2018-02-27 16:28:00 +01:00
|
|
|
$data["percentil" . $series_suffix]['data'][] = array(
|
|
|
|
($date_array['start_date'] + $date_array['period']) * 1000,
|
|
|
|
$percentil_result
|
|
|
|
);
|
|
|
|
$data["percentil" . $series_suffix]['data'][] = array(
|
|
|
|
($date_array['final_date'] + $date_array['period']) * 1000,
|
|
|
|
$percentil_result
|
|
|
|
);
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
|
|
|
else{
|
2018-02-27 16:28:00 +01:00
|
|
|
$data["percentil" . $series_suffix]['data'][] = array(
|
|
|
|
$date_array['start_date'] * 1000,
|
|
|
|
$percentil_result
|
|
|
|
);
|
|
|
|
$data["percentil" . $series_suffix]['data'][] = array(
|
|
|
|
$date_array['final_date'] * 1000,
|
|
|
|
$percentil_result
|
|
|
|
);
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
2018-02-16 13:41:31 +01:00
|
|
|
}
|
|
|
|
// Add missed last data
|
2018-02-21 11:54:24 +01:00
|
|
|
if($compare){
|
2018-02-27 16:28:00 +01:00
|
|
|
$data["sum" . $series_suffix]['data'][] = array(
|
|
|
|
($date_array['final_date'] + $date_array['period']) * 1000,
|
|
|
|
$last_data
|
|
|
|
);
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
|
|
|
else{
|
2018-02-27 16:28:00 +01:00
|
|
|
$data["sum" . $series_suffix]['data'][] = array(
|
|
|
|
$date_array['final_date'] * 1000,
|
|
|
|
$last_data
|
|
|
|
);
|
2018-02-21 11:54:24 +01:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2018-02-16 13:41:31 +01:00
|
|
|
$data["sum" . $series_suffix]['min'] = $min_value;
|
|
|
|
$data["sum" . $series_suffix]['max'] = $max_value;
|
|
|
|
$data["sum" . $series_suffix]['avg'] = $sum_data/$count_data;
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
/**
|
|
|
|
* Print an area graph with netflow aggregated
|
|
|
|
*/
|
|
|
|
function graph_netflow_aggregate_area ($data, $period, $width, $height, $unit = '', $ttl = 1, $only_image = false) {
|
2017-09-20 17:29:17 +02:00
|
|
|
global $config;
|
2018-02-27 16:28:00 +01:00
|
|
|
global $graphic_type;
|
2017-11-07 09:46:37 +01:00
|
|
|
|
2012-01-11 17:34:53 +01:00
|
|
|
if (empty ($data)) {
|
|
|
|
echo fs_error_image ();
|
|
|
|
return;
|
2011-12-21 14:09:26 +01:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-01-11 17:34:53 +01:00
|
|
|
// Calculate source indexes
|
2018-06-06 11:18:39 +02:00
|
|
|
foreach ($data['sources'] as $key => $value) {
|
|
|
|
$i = 0;
|
|
|
|
foreach($data['data'] as $k => $v){
|
|
|
|
$chart['netflow_' . $key]['data'][$i][0] = $k * 1000;
|
|
|
|
$chart['netflow_' . $key]['data'][$i][1] = $v[$key];
|
|
|
|
$i++;
|
2011-12-21 14:09:26 +01:00
|
|
|
}
|
|
|
|
}
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2012-01-13 15:52:52 +01:00
|
|
|
if ($config['homeurl'] != '') {
|
2012-09-28 16:06:20 +02:00
|
|
|
$homeurl = $config['homeurl'];
|
2012-07-18 15:25:51 +02:00
|
|
|
}
|
|
|
|
else {
|
2012-01-13 15:52:52 +01:00
|
|
|
$homeurl = '';
|
|
|
|
}
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
2018-06-06 11:18:39 +02:00
|
|
|
|
|
|
|
$water_mark = $config['homedir'] . "/images/logo_vertical_water.png";
|
2016-10-27 17:30:45 +02:00
|
|
|
}
|
2018-06-06 11:18:39 +02:00
|
|
|
|
|
|
|
if($ttl >= 2){
|
|
|
|
$only_image = true;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$only_image = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$params =array(
|
|
|
|
'agent_module_id' => false,
|
|
|
|
'period' => $period,
|
|
|
|
'width' =>'90%',
|
|
|
|
'height' => 450,
|
|
|
|
'unit' => $unit,
|
|
|
|
'only_image' => $only_image,
|
|
|
|
'homeurl' => $homeurl,
|
|
|
|
'menu' => true,
|
|
|
|
'backgroundColor' => 'white',
|
|
|
|
'type_graph' => 'area',
|
|
|
|
'font' => $config['fontpath'],
|
|
|
|
'font-size' => $config['font_size'],
|
|
|
|
'array_data_create' => $chart
|
|
|
|
);
|
|
|
|
|
|
|
|
return grafico_modulo_sparse($params);
|
2011-12-21 14:09:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print an area graph with netflow total
|
|
|
|
*/
|
2012-10-08 21:19:58 +02:00
|
|
|
function graph_netflow_total_area ($data, $period, $width, $height, $unit = '', $ttl = 1, $only_image = false) {
|
2011-12-21 14:09:26 +01:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2012-01-11 17:34:53 +01:00
|
|
|
if (empty ($data)) {
|
|
|
|
echo fs_error_image ();
|
|
|
|
return;
|
|
|
|
}
|
2013-01-22 12:38:56 +01:00
|
|
|
|
2018-06-06 11:18:39 +02:00
|
|
|
// Calculate source indexes
|
|
|
|
$i=0;
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
$chart['netflow']['data'][$i][0] = $key * 1000;
|
|
|
|
$chart['netflow']['data'][$i][1] = $value['data'];
|
|
|
|
$i++;
|
2013-01-22 12:38:56 +01:00
|
|
|
}
|
|
|
|
|
2012-01-13 15:52:52 +01:00
|
|
|
if ($config['homeurl'] != '') {
|
2012-09-28 16:06:20 +02:00
|
|
|
$homeurl = $config['homeurl'];
|
2012-07-18 15:25:51 +02:00
|
|
|
}
|
|
|
|
else {
|
2012-01-13 15:52:52 +01:00
|
|
|
$homeurl = '';
|
|
|
|
}
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
2018-06-06 11:18:39 +02:00
|
|
|
|
|
|
|
$water_mark = $config['homedir'] . "/images/logo_vertical_water.png";
|
2016-10-27 17:30:45 +02:00
|
|
|
}
|
2018-06-06 11:18:39 +02:00
|
|
|
|
|
|
|
if($ttl >= 2){
|
|
|
|
$only_image = true;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$only_image = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$params =array(
|
|
|
|
'agent_module_id' => false,
|
|
|
|
'period' => $period,
|
|
|
|
'width' =>'90%',
|
|
|
|
'height' => 450,
|
|
|
|
'unit' => $unit,
|
|
|
|
'only_image' => $only_image,
|
|
|
|
'homeurl' => $homeurl,
|
|
|
|
'menu' => true,
|
|
|
|
'backgroundColor' => 'white',
|
|
|
|
'type_graph' => 'area',
|
|
|
|
'font' => $config['fontpath'],
|
|
|
|
'font-size' => $config['font_size'],
|
|
|
|
'array_data_create' => $chart
|
|
|
|
);
|
|
|
|
|
|
|
|
return grafico_modulo_sparse($params);
|
2011-12-21 14:09:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print a pie graph with netflow aggregated
|
|
|
|
*/
|
2012-10-08 21:19:58 +02:00
|
|
|
function graph_netflow_aggregate_pie ($data, $aggregate, $ttl = 1, $only_image = false) {
|
2011-12-21 14:09:26 +01:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2012-01-11 17:34:53 +01:00
|
|
|
if (empty ($data)) {
|
2012-10-08 21:19:58 +02:00
|
|
|
return fs_error_image ();
|
2012-01-11 17:34:53 +01:00
|
|
|
}
|
2018-06-06 11:18:39 +02:00
|
|
|
|
|
|
|
$date_array = array();
|
|
|
|
$date_array["period"] = 300;
|
|
|
|
$date_array["final_date"] = time();
|
|
|
|
$date_array["start_date"] = time() - 300;
|
|
|
|
|
2011-12-21 14:09:26 +01:00
|
|
|
$i = 0;
|
2011-12-21 16:28:01 +01:00
|
|
|
$values = array();
|
2011-12-21 17:07:15 +01:00
|
|
|
$agg = '';
|
2011-12-21 14:09:26 +01:00
|
|
|
while (isset ($data[$i])) {
|
|
|
|
$agg = $data[$i]['agg'];
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
if (!isset($values[$agg])) {
|
2011-12-21 14:09:26 +01:00
|
|
|
$values[$agg] = $data[$i]['data'];
|
2012-07-18 15:25:51 +02:00
|
|
|
}
|
|
|
|
else {
|
2011-12-21 14:09:26 +01:00
|
|
|
$values[$agg] += $data[$i]['data'];
|
|
|
|
}
|
|
|
|
$i++;
|
|
|
|
}
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2012-10-08 21:19:58 +02:00
|
|
|
$flash_chart = $config['flash_charts'];
|
|
|
|
if ($only_image) {
|
|
|
|
$flash_chart = false;
|
|
|
|
}
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2016-10-27 17:30:45 +02:00
|
|
|
if($config["fixed_graph"] == false){
|
|
|
|
$water_mark = array('file' =>
|
|
|
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
|
|
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
|
|
|
}
|
2018-06-06 11:18:39 +02:00
|
|
|
|
2014-04-16 14:06:19 +02:00
|
|
|
return pie3d_graph($flash_chart, $values, 370, 200,
|
2015-03-18 20:28:55 +01:00
|
|
|
__('Other'), $config['homeurl'], $water_mark,
|
2012-10-08 21:19:58 +02:00
|
|
|
$config['fontpath'], $config['font_size'], $ttl);
|
2011-12-21 14:09:26 +01:00
|
|
|
}
|
|
|
|
|
2014-04-23 11:34:00 +02:00
|
|
|
/**
|
|
|
|
* Print a circular graph with the data transmitted between IPs
|
|
|
|
*/
|
|
|
|
function graph_netflow_circular_mesh ($data, $unit, $radius = 700) {
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
if (empty($data) || empty($data['elements']) || empty($data['matrix'])) {
|
|
|
|
return fs_error_image ();
|
|
|
|
}
|
|
|
|
|
|
|
|
include_once($config['homedir'] . "/include/graphs/functions_d3.php");
|
|
|
|
|
|
|
|
return d3_relationship_graph ($data['elements'], $data['matrix'], $unit, $radius, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-06-10 17:21:58 +02:00
|
|
|
* Print a rectangular graph with the traffic of the ports for each IP
|
2014-04-23 11:34:00 +02:00
|
|
|
*/
|
|
|
|
function graph_netflow_host_traffic ($data, $unit, $width = 700, $height = 700) {
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
if (empty ($data)) {
|
|
|
|
return fs_error_image ();
|
|
|
|
}
|
|
|
|
|
|
|
|
include_once($config['homedir'] . "/include/graphs/functions_d3.php");
|
|
|
|
|
|
|
|
return d3_tree_map_graph ($data, $width, $height, true);
|
|
|
|
}
|
2011-12-21 14:09:26 +01:00
|
|
|
|
2011-04-19 14:11:00 +02:00
|
|
|
/**
|
2018-02-27 16:28:00 +01:00
|
|
|
* Print a graph with event data of module
|
2011-04-19 14:11:00 +02:00
|
|
|
*
|
2018-02-27 16:28:00 +01:00
|
|
|
* @param integer id_module Module ID
|
2011-04-19 14:11:00 +02:00
|
|
|
* @param integer width graph width
|
2018-02-27 16:28:00 +01:00
|
|
|
* @param integer height graph height
|
|
|
|
* @param integer period time period
|
|
|
|
* @param string homeurl Home url if the complete path is needed
|
|
|
|
* @param int Zoom factor over the graph
|
|
|
|
* @param string adaptation width and margin left key (could be adapter_[something] or adapted_[something])
|
|
|
|
* @param int date limit of the period
|
2011-04-19 14:11:00 +02:00
|
|
|
*/
|
2018-02-27 16:28:00 +01:00
|
|
|
function graphic_module_events ($id_module, $width, $height, $period = 0, $homeurl = '', $zoom = 0, $adapt_key = '', $date = false, $stat_win = false) {
|
2011-04-19 14:11:00 +02:00
|
|
|
global $config;
|
|
|
|
global $graphic_type;
|
2018-05-10 08:43:09 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
$data = array ();
|
2018-05-10 08:43:09 +02:00
|
|
|
$width = 90;
|
|
|
|
$height = 100;
|
2018-02-27 16:28:00 +01:00
|
|
|
$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
2018-05-10 08:43:09 +02:00
|
|
|
|
2011-04-19 14:11:00 +02:00
|
|
|
$interval = (int) ($period / $resolution);
|
2018-02-27 16:28:00 +01:00
|
|
|
if ($date === false) {
|
|
|
|
$date = get_system_time ();
|
2011-04-19 14:11:00 +02:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
$datelimit = $date - $period;
|
|
|
|
$periodtime = floor ($period / $interval);
|
|
|
|
$time = array ();
|
|
|
|
$data = array ();
|
2018-05-10 08:43:09 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
// Set the title and time format
|
|
|
|
if ($period <= SECONDS_6HOURS) {
|
|
|
|
$time_format = 'H:i:s';
|
2011-04-19 14:11:00 +02:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
elseif ($period < SECONDS_1DAY) {
|
|
|
|
$time_format = 'H:i';
|
2012-07-18 15:25:51 +02:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
elseif ($period < SECONDS_15DAYS) {
|
|
|
|
$time_format = 'M d H:i';
|
2011-04-19 14:11:00 +02:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
elseif ($period < SECONDS_1MONTH) {
|
|
|
|
$time_format = 'M d H\h';
|
2011-04-19 14:11:00 +02:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
elseif ($period < SECONDS_6MONTHS) {
|
|
|
|
$time_format = "M d H\h";
|
2012-07-18 15:25:51 +02:00
|
|
|
}
|
|
|
|
else {
|
2018-02-27 16:28:00 +01:00
|
|
|
$time_format = "Y M d H\h";
|
2011-04-19 14:11:00 +02:00
|
|
|
}
|
2018-05-10 08:43:09 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
$legend = array();
|
|
|
|
$cont = 0;
|
|
|
|
for ($i = 0; $i < $interval; $i++) {
|
|
|
|
$bottom = $datelimit + ($periodtime * $i);
|
|
|
|
if (! $graphic_type) {
|
|
|
|
$name = date($time_format, $bottom);
|
|
|
|
//$name = date('H\h', $bottom);
|
2017-05-18 17:01:15 +02:00
|
|
|
}
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
else {
|
2018-02-27 16:28:00 +01:00
|
|
|
$name = $bottom;
|
2011-04-19 14:11:00 +02:00
|
|
|
}
|
2018-05-10 08:43:09 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
$top = $datelimit + ($periodtime * ($i + 1));
|
2018-05-10 08:43:09 +02:00
|
|
|
|
|
|
|
$events = db_get_all_rows_filter ('tevento',
|
2018-02-27 16:28:00 +01:00
|
|
|
array ('id_agentmodule' => $id_module,
|
|
|
|
'utimestamp > '.$bottom,
|
|
|
|
'utimestamp < '.$top),
|
|
|
|
'event_type, utimestamp');
|
|
|
|
|
|
|
|
if (!empty($events)) {
|
|
|
|
$status = 'normal';
|
|
|
|
foreach($events as $event) {
|
|
|
|
if (empty($event['utimestamp'])) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
switch($event['event_type']) {
|
|
|
|
case 'going_down_normal':
|
|
|
|
case 'going_up_normal':
|
|
|
|
// The default status is normal. Do nothing
|
|
|
|
break;
|
|
|
|
case 'going_unknown':
|
|
|
|
if ($status == 'normal') {
|
|
|
|
$status = 'unknown';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'going_up_warning':
|
|
|
|
case 'going_down_warning':
|
|
|
|
if ($status == 'normal' || $status == 'unknown') {
|
|
|
|
$status = 'warning';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'going_up_critical':
|
|
|
|
case 'going_down_critical':
|
|
|
|
$status = 'critical';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-07-01 17:41:40 +02:00
|
|
|
}
|
2018-05-10 08:43:09 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
$data[$cont]['utimestamp'] = $periodtime;
|
2018-05-10 08:43:09 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
if (!empty($events)) {
|
|
|
|
switch ($status) {
|
|
|
|
case 'warning':
|
|
|
|
$data[$cont]['data'] = 2;
|
|
|
|
break;
|
|
|
|
case 'critical':
|
|
|
|
$data[$cont]['data'] = 3;
|
|
|
|
break;
|
|
|
|
case 'unknown':
|
|
|
|
$data[$cont]['data'] = 4;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$data[$cont]['data'] = 1;
|
|
|
|
break;
|
|
|
|
}
|
2012-07-18 15:25:51 +02:00
|
|
|
}
|
|
|
|
else {
|
2018-02-27 16:28:00 +01:00
|
|
|
$data[$cont]['data'] = 1;
|
2011-04-19 14:11:00 +02:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
$current_timestamp = $bottom;
|
2018-05-10 08:43:09 +02:00
|
|
|
|
|
|
|
$legend[] = date($time_format, $current_timestamp);
|
2018-02-27 16:28:00 +01:00
|
|
|
$cont++;
|
2011-04-19 14:11:00 +02:00
|
|
|
}
|
2018-05-10 08:43:09 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
$pixels_between_xdata = 25;
|
|
|
|
$max_xdata_display = round($width / $pixels_between_xdata);
|
|
|
|
$ndata = count($data);
|
|
|
|
if ($max_xdata_display > $ndata) {
|
|
|
|
$xdata_display = $ndata;
|
2011-04-19 14:11:00 +02:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
else {
|
|
|
|
$xdata_display = $max_xdata_display;
|
2012-02-27 17:20:28 +01:00
|
|
|
}
|
2018-05-10 08:43:09 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
$step = round($ndata/$xdata_display);
|
2018-05-10 08:43:09 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
$colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3');
|
2018-05-10 08:43:09 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
// Draw slicebar graph
|
|
|
|
if ($config['flash_charts']) {
|
2018-05-10 08:43:09 +02:00
|
|
|
echo flot_slicesbar_graph($data, $period, $width, 50, $legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', $adapt_key, $stat_win);
|
2013-02-06 15:03:32 +01:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
else {
|
|
|
|
echo slicesbar_graph($data, $period, $width, 15, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
2013-02-06 15:03:32 +01:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function graph_nodata_image($width = 300, $height = 110, $type = 'area', $text = '') {
|
|
|
|
$image = ui_get_full_url('images/image_problem_area_small.png',
|
|
|
|
false, false, false);
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
// if ($text == '') {
|
|
|
|
// $text = __('No data to show');
|
|
|
|
// }
|
2013-02-06 15:03:32 +01:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
$text_div = '<div class="nodata_text">' . $text . '</div>';
|
2013-07-01 17:41:40 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
$image_div = '<div class="nodata_container" style="width:80%;height:80%;background-size: 80% 80%;background-image: url(\'' . $image . '\');">' .
|
|
|
|
$text_div . '</div>';
|
2013-02-06 15:03:32 +01:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
$div = '<div style="width:' . $width . 'px; height:' . $height . 'px; border: 1px dotted #ddd; background-color: white; margin: 0 auto;">' .
|
|
|
|
$image_div . '</div>';
|
2011-04-19 14:11:00 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
return $div;
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_criticity_pie_colors ($data_graph) {
|
|
|
|
$colors = array();
|
|
|
|
foreach (array_keys($data_graph) as $crit) {
|
|
|
|
switch ($crit) {
|
|
|
|
case __('Maintenance'):
|
|
|
|
$colors[$crit] = COL_MAINTENANCE;
|
|
|
|
break;
|
|
|
|
case __('Informational'):
|
|
|
|
$colors[$crit] = COL_INFORMATIONAL;
|
|
|
|
break;
|
|
|
|
case __('Normal'):
|
|
|
|
$colors[$crit] = COL_NORMAL;
|
|
|
|
break;
|
|
|
|
case __('Warning'):
|
|
|
|
$colors[$crit] = COL_WARNING;
|
|
|
|
break;
|
|
|
|
case __('Critical'):
|
|
|
|
$colors[$crit] = COL_CRITICAL;
|
|
|
|
break;
|
|
|
|
case __('Minor'):
|
|
|
|
$colors[$crit] = COL_MINOR;
|
|
|
|
break;
|
|
|
|
case __('Major'):
|
|
|
|
$colors[$crit] = COL_MAJOR;
|
|
|
|
break;
|
|
|
|
}
|
2016-10-27 17:30:45 +02:00
|
|
|
}
|
2012-03-08 17:32:11 +01:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
return $colors;
|
2011-04-19 14:11:00 +02:00
|
|
|
}
|
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2012-07-18 15:25:51 +02:00
|
|
|
/**
|
2018-02-27 16:28:00 +01:00
|
|
|
* Print a rectangular graph with the snmptraps received
|
2012-07-18 15:25:51 +02:00
|
|
|
*/
|
2018-02-27 16:28:00 +01:00
|
|
|
function graph_snmp_traps_treemap ($data, $width = 700, $height = 700) {
|
2012-07-18 15:25:51 +02:00
|
|
|
global $config;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
|
|
|
if (empty ($data)) {
|
|
|
|
return fs_error_image ();
|
2012-07-18 15:25:51 +02:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
|
|
|
include_once($config['homedir'] . "/include/graphs/functions_d3.php");
|
|
|
|
|
|
|
|
return d3_tree_map_graph ($data, $width, $height, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print a solarburst graph with a representation of all the groups, agents, module groups and modules grouped
|
|
|
|
*/
|
|
|
|
function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) {
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
include_once ($config['homedir'] . "/include/functions_users.php");
|
|
|
|
include_once ($config['homedir'] . "/include/functions_groups.php");
|
|
|
|
include_once ($config['homedir'] . "/include/functions_agents.php");
|
|
|
|
include_once ($config['homedir'] . "/include/functions_modules.php");
|
|
|
|
|
|
|
|
$graph_data = array();
|
|
|
|
|
|
|
|
$filter_module_group = (!empty($filter) && !empty($filter['module_group'])) ? $filter['module_group'] : false;
|
|
|
|
|
|
|
|
if ($filter['group'] != 0) {
|
|
|
|
$filter_subgroups = "";
|
|
|
|
if (!$filter['dont_show_subgroups']) {
|
|
|
|
$filter_subgroups = " || parent = " . $filter['group'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$groups = db_get_all_rows_sql ("SELECT * FROM tgrupo where id_grupo = " . $filter['group'] . $filter_subgroups);
|
|
|
|
|
|
|
|
$groups_ax = array();
|
|
|
|
foreach ($groups as $g) {
|
|
|
|
$groups_ax[$g['id_grupo']] = $g;
|
|
|
|
}
|
|
|
|
|
|
|
|
$groups = $groups_ax;
|
2017-05-18 17:01:15 +02:00
|
|
|
}
|
|
|
|
else {
|
2018-02-27 16:28:00 +01:00
|
|
|
$groups = users_get_groups(false, "AR", false, true, (!empty($filter) && isset($filter['group']) ? $filter['group'] : null));
|
2012-07-18 15:25:51 +02:00
|
|
|
}
|
2013-05-03 10:19:07 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
$data_groups = array();
|
|
|
|
if (!empty($groups)) {
|
|
|
|
$groups_aux = $groups;
|
2012-07-18 15:25:51 +02:00
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
$childrens = array();
|
|
|
|
$data_groups = groups_get_tree_good($groups, false, $childrens);
|
|
|
|
|
|
|
|
// When i want only one group
|
|
|
|
if (count($data_groups) > 1) {
|
|
|
|
foreach ($childrens as $id_c) {
|
|
|
|
unset($data_groups[$id_c]);
|
2017-11-30 10:45:28 +01:00
|
|
|
}
|
2017-11-24 12:08:15 +01:00
|
|
|
}
|
2017-11-24 11:27:10 +01:00
|
|
|
$data_groups_keys = array();
|
|
|
|
groups_get_tree_keys($data_groups, $data_groups_keys);
|
|
|
|
|
2014-10-20 16:56:01 +02:00
|
|
|
$groups_aux = null;
|
2014-07-30 17:58:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($data_groups)) {
|
2017-11-24 11:27:10 +01:00
|
|
|
$filter = array('id_grupo' => array_keys($data_groups_keys));
|
2017-11-21 10:27:17 +01:00
|
|
|
|
2017-10-04 17:49:46 +02:00
|
|
|
$fields = array('id_agente', 'id_parent', 'id_grupo', 'alias');
|
2014-06-26 13:32:14 +02:00
|
|
|
$agents = agents_get_agents($filter, $fields);
|
|
|
|
|
|
|
|
if (!empty($agents)) {
|
|
|
|
$agents_id = array();
|
2014-07-30 17:58:27 +02:00
|
|
|
$agents_aux = array();
|
2014-06-26 13:32:14 +02:00
|
|
|
foreach ($agents as $key => $agent) {
|
2014-07-30 17:58:27 +02:00
|
|
|
$agents_aux[$agent['id_agente']] = $agent;
|
2014-06-26 13:32:14 +02:00
|
|
|
}
|
2014-07-30 17:58:27 +02:00
|
|
|
$agents = $agents_aux;
|
|
|
|
$agents_aux = null;
|
2014-06-26 13:32:14 +02:00
|
|
|
$fields = array('id_agente_modulo', 'id_agente', 'id_module_group', 'nombre');
|
|
|
|
|
|
|
|
$module_groups = modules_get_modulegroups();
|
2014-07-30 17:58:27 +02:00
|
|
|
$module_groups[0] = __('Not assigned');
|
2014-08-05 15:09:46 +02:00
|
|
|
$modules = agents_get_modules(array_keys($agents), '*');
|
2014-06-26 13:32:14 +02:00
|
|
|
|
2014-07-30 17:58:27 +02:00
|
|
|
$data_agents = array();
|
2014-06-26 13:32:14 +02:00
|
|
|
if (!empty($modules)) {
|
2014-07-30 17:58:27 +02:00
|
|
|
foreach ($modules as $key => $module) {
|
2014-08-05 15:09:46 +02:00
|
|
|
$module_id = (int) $module['id_agente_modulo'];
|
|
|
|
$agent_id = (int) $module['id_agente'];
|
|
|
|
$module_group_id = (int) $module['id_module_group'];
|
2014-08-21 12:15:12 +02:00
|
|
|
$module_name = io_safe_output($module['nombre']);
|
2014-08-05 15:09:46 +02:00
|
|
|
$module_status = modules_get_agentmodule_status($module_id);
|
2014-08-21 12:15:12 +02:00
|
|
|
$module_value = modules_get_last_value($module_id);
|
2014-08-21 13:41:30 +02:00
|
|
|
|
|
|
|
if ($filter_module_group && $filter_module_group != $module_group_id)
|
|
|
|
continue;
|
2014-07-30 17:58:27 +02:00
|
|
|
|
|
|
|
if (!isset($data_agents[$agent_id])) {
|
|
|
|
$data_agents[$agent_id] = array();
|
|
|
|
$data_agents[$agent_id]['id'] = $agent_id;
|
2017-10-04 17:49:46 +02:00
|
|
|
$data_agents[$agent_id]['name'] = io_safe_output($agents[$agent_id]['alias']);
|
2014-08-05 15:09:46 +02:00
|
|
|
$data_agents[$agent_id]['group'] = (int) $agents[$agent_id]['id_grupo'];
|
2014-07-30 17:58:27 +02:00
|
|
|
$data_agents[$agent_id]['type'] = 'agent';
|
|
|
|
$data_agents[$agent_id]['size'] = 30;
|
2017-11-30 10:45:28 +01:00
|
|
|
$data_agents[$agent_id]['show_name'] = true;
|
2014-07-30 17:58:27 +02:00
|
|
|
$data_agents[$agent_id]['children'] = array();
|
|
|
|
|
|
|
|
$tooltip_content = __('Agent') . ": <b>" . $data_agents[$agent_id]['name'] . "</b>";
|
2014-08-21 12:15:12 +02:00
|
|
|
$data_agents[$agent_id]['tooltip_content'] = io_safe_output($tooltip_content);
|
2014-07-30 17:58:27 +02:00
|
|
|
|
2014-08-05 15:09:46 +02:00
|
|
|
$data_agents[$agent_id]['modules_critical'] = 0;
|
|
|
|
$data_agents[$agent_id]['modules_warning'] = 0;
|
|
|
|
$data_agents[$agent_id]['modules_normal'] = 0;
|
|
|
|
$data_agents[$agent_id]['modules_not_init'] = 0;
|
|
|
|
$data_agents[$agent_id]['modules_not_normal'] = 0;
|
|
|
|
$data_agents[$agent_id]['modules_unknown'] = 0;
|
|
|
|
|
|
|
|
$data_agents[$agent_id]['color'] = COL_UNKNOWN;
|
|
|
|
|
2014-07-30 17:58:27 +02:00
|
|
|
unset($agents[$agent_id]);
|
|
|
|
}
|
|
|
|
if (!isset($data_agents[$agent_id]['children'][$module_group_id])) {
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id] = array();
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['id'] = $module_group_id;
|
2014-08-21 12:15:12 +02:00
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['name'] = io_safe_output($module_groups[$module_group_id]);
|
2014-07-30 17:58:27 +02:00
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['type'] = 'module_group';
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['size'] = 10;
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['children'] = array();
|
|
|
|
|
2014-08-21 12:15:12 +02:00
|
|
|
$tooltip_content = __('Module group') . ": <b>" . $data_agents[$agent_id]['children'][$module_group_id]['name'] . "</b>";
|
2014-07-30 17:58:27 +02:00
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['tooltip_content'] = $tooltip_content;
|
2014-08-05 15:09:46 +02:00
|
|
|
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['modules_critical'] = 0;
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['modules_warning'] = 0;
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['modules_normal'] = 0;
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['modules_not_init'] = 0;
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['modules_not_normal'] = 0;
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['modules_unknown'] = 0;
|
|
|
|
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['color'] = COL_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($module_status) {
|
|
|
|
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
|
|
|
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
|
|
|
$data_agents[$agent_id]['modules_critical']++;
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['modules_critical']++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AGENT_MODULE_STATUS_WARNING:
|
|
|
|
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
|
|
|
$data_agents[$agent_id]['modules_warning']++;
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['modules_warning']++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AGENT_MODULE_STATUS_NORMAL:
|
|
|
|
case AGENT_MODULE_STATUS_NORMAL_ALERT:
|
|
|
|
$data_agents[$agent_id]['modules_normal']++;
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['modules_normal']++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AGENT_MODULE_STATUS_NOT_INIT:
|
|
|
|
$data_agents[$agent_id]['modules_not_init']++;
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['modules_not_init']++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AGENT_MODULE_STATUS_NOT_NORMAL:
|
|
|
|
$data_agents[$agent_id]['modules_not_normal']++;
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['modules_not_normal']++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AGENT_MODULE_STATUS_NO_DATA:
|
|
|
|
case AGENT_MODULE_STATUS_UNKNOWN:
|
|
|
|
$data_agents[$agent_id]['modules_unknown']++;
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['modules_unknown']++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($data_agents[$agent_id]['modules_critical'] > 0) {
|
|
|
|
$data_agents[$agent_id]['color'] = COL_CRITICAL;
|
|
|
|
}
|
|
|
|
else if ($data_agents[$agent_id]['modules_warning'] > 0) {
|
|
|
|
$data_agents[$agent_id]['color'] = COL_WARNING;
|
|
|
|
}
|
|
|
|
else if ($data_agents[$agent_id]['modules_not_normal'] > 0) {
|
|
|
|
$data_agents[$agent_id]['color'] = COL_WARNING;
|
|
|
|
}
|
|
|
|
else if ($data_agents[$agent_id]['modules_unknown'] > 0) {
|
|
|
|
$data_agents[$agent_id]['color'] = COL_UNKNOWN;
|
|
|
|
}
|
|
|
|
else if ($data_agents[$agent_id]['modules_normal'] > 0) {
|
|
|
|
$data_agents[$agent_id]['color'] = COL_NORMAL;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data_agents[$agent_id]['color'] = COL_NOTINIT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($data_agents[$agent_id]['children'][$module_group_id]['modules_critical'] > 0) {
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['color'] = COL_CRITICAL;
|
|
|
|
}
|
|
|
|
else if ($data_agents[$agent_id]['children'][$module_group_id]['modules_warning'] > 0) {
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['color'] = COL_WARNING;
|
|
|
|
}
|
|
|
|
else if ($data_agents[$agent_id]['children'][$module_group_id]['modules_not_normal'] > 0) {
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['color'] = COL_WARNING;
|
|
|
|
}
|
|
|
|
else if ($data_agents[$agent_id]['children'][$module_group_id]['modules_unknown'] > 0) {
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['color'] = COL_UNKNOWN;
|
|
|
|
}
|
|
|
|
else if ($data_agents[$agent_id]['children'][$module_group_id]['modules_normal'] > 0) {
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['color'] = COL_NORMAL;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['color'] = COL_NOTINIT;
|
2014-07-30 17:58:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$data_module = array();
|
|
|
|
$data_module['id'] = $module_id;
|
|
|
|
$data_module['name'] = $module_name;
|
|
|
|
$data_module['type'] = 'module';
|
|
|
|
$data_module['size'] = 10;
|
2014-08-21 12:15:12 +02:00
|
|
|
$data_module['link'] = ui_get_full_url("index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$agent_id");
|
2014-07-30 17:58:27 +02:00
|
|
|
|
|
|
|
$tooltip_content = __('Module') . ": <b>" . $module_name . "</b>";
|
2014-08-21 12:15:12 +02:00
|
|
|
if (isset($module_value) && $module_value !== false) {
|
|
|
|
$tooltip_content .= "<br>";
|
|
|
|
$tooltip_content .= __('Value') . ": <b>" . io_safe_output($module_value) . "</b>";
|
|
|
|
}
|
2014-07-30 17:58:27 +02:00
|
|
|
$data_module['tooltip_content'] = $tooltip_content;
|
|
|
|
|
2014-08-05 15:09:46 +02:00
|
|
|
switch ($module_status) {
|
|
|
|
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
|
|
|
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
|
|
|
$data_module['color'] = COL_CRITICAL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AGENT_MODULE_STATUS_WARNING:
|
|
|
|
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
|
|
|
$data_module['color'] = COL_WARNING;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AGENT_MODULE_STATUS_NORMAL:
|
|
|
|
case AGENT_MODULE_STATUS_NORMAL_ALERT:
|
|
|
|
$data_module['color'] = COL_NORMAL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AGENT_MODULE_STATUS_NOT_INIT:
|
|
|
|
$data_module['color'] = COL_NOTINIT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AGENT_MODULE_STATUS_NOT_NORMAL:
|
|
|
|
$data_module['color'] = COL_WARNING;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AGENT_MODULE_STATUS_NO_DATA:
|
|
|
|
case AGENT_MODULE_STATUS_UNKNOWN:
|
|
|
|
default:
|
|
|
|
$data_module['color'] = COL_UNKNOWN;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-07-30 17:58:27 +02:00
|
|
|
$data_agents[$agent_id]['children'][$module_group_id]['children'][] = $data_module;
|
|
|
|
unset($modules[$module_id]);
|
|
|
|
}
|
2014-08-20 13:10:19 +02:00
|
|
|
function order_module_group_keys ($value, $key) {
|
|
|
|
$value['children'] = array_merge($value['children']);
|
|
|
|
return $value;
|
|
|
|
}
|
|
|
|
$data_agents = array_map('order_module_group_keys', $data_agents);
|
2014-07-30 17:58:27 +02:00
|
|
|
}
|
|
|
|
foreach ($agents as $id => $agent) {
|
|
|
|
if (!isset($data_agents[$id])) {
|
|
|
|
$data_agents[$id] = array();
|
2014-08-05 15:09:46 +02:00
|
|
|
$data_agents[$id]['id'] = (int) $id;
|
2017-10-04 17:49:46 +02:00
|
|
|
$data_agents[$id]['name'] = io_safe_output($agent['alias']);
|
2014-07-30 17:58:27 +02:00
|
|
|
$data_agents[$id]['type'] = 'agent';
|
2014-08-05 15:09:46 +02:00
|
|
|
$data_agents[$id]['color'] = COL_NOTINIT;
|
2017-11-30 10:45:28 +01:00
|
|
|
$data_agents[$id]['show_name'] = true;
|
2014-07-30 17:58:27 +02:00
|
|
|
}
|
2014-06-26 13:32:14 +02:00
|
|
|
}
|
2014-07-30 17:58:27 +02:00
|
|
|
$agents = null;
|
2014-06-26 13:32:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-30 17:58:27 +02:00
|
|
|
function iterate_group_array ($groups, &$data_agents) {
|
|
|
|
$data = array();
|
2014-06-26 13:32:14 +02:00
|
|
|
|
2014-07-30 17:58:27 +02:00
|
|
|
foreach ($groups as $id => $group) {
|
|
|
|
|
|
|
|
$group_aux = array();
|
2014-08-05 15:09:46 +02:00
|
|
|
$group_aux['id'] = (int) $id;
|
2014-08-21 12:15:12 +02:00
|
|
|
$group_aux['name'] = io_safe_output($group['nombre']);
|
|
|
|
$group_aux['show_name'] = true;
|
2014-08-05 15:09:46 +02:00
|
|
|
$group_aux['parent'] = (int) $group['parent'];
|
2014-07-30 17:58:27 +02:00
|
|
|
$group_aux['type'] = 'group';
|
|
|
|
$group_aux['size'] = 100;
|
2014-08-05 15:09:46 +02:00
|
|
|
$group_aux['status'] = groups_get_status($id);
|
2014-07-30 17:58:27 +02:00
|
|
|
|
2014-08-05 15:09:46 +02:00
|
|
|
switch ($group_aux['status']) {
|
|
|
|
case AGENT_STATUS_CRITICAL:
|
|
|
|
$group_aux['color'] = COL_CRITICAL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AGENT_STATUS_WARNING:
|
|
|
|
case AGENT_STATUS_ALERT_FIRED:
|
|
|
|
$group_aux['color'] = COL_WARNING;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AGENT_STATUS_NORMAL:
|
|
|
|
$group_aux['color'] = COL_NORMAL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AGENT_STATUS_UNKNOWN:
|
|
|
|
default:
|
|
|
|
$group_aux['color'] = COL_UNKNOWN;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$tooltip_content = html_print_image("images/groups_small/" . $group['icon'] . ".png", true) . " " . __('Group') . ": <b>" . $group_aux['name'] . "</b>";
|
2014-07-30 17:58:27 +02:00
|
|
|
$group_aux['tooltip_content'] = $tooltip_content;
|
|
|
|
|
2017-11-24 11:27:10 +01:00
|
|
|
$group_aux['children'] = array();
|
2017-11-21 10:27:17 +01:00
|
|
|
|
2014-07-30 17:58:27 +02:00
|
|
|
if (!empty($group['children']))
|
2014-10-20 16:56:01 +02:00
|
|
|
$group_aux['children'] = iterate_group_array($group['children'], $data_agents);
|
2014-07-30 17:58:27 +02:00
|
|
|
|
2014-08-05 15:09:46 +02:00
|
|
|
$agents = extract_agents_with_group_id($data_agents, (int) $id);
|
2014-07-30 17:58:27 +02:00
|
|
|
|
|
|
|
if (!empty($agents))
|
|
|
|
$group_aux['children'] = array_merge($group_aux['children'], $agents);
|
2017-11-24 11:27:10 +01:00
|
|
|
|
2014-07-30 17:58:27 +02:00
|
|
|
$data[] = $group_aux;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $data;
|
2014-06-26 13:32:14 +02:00
|
|
|
}
|
|
|
|
|
2014-07-30 17:58:27 +02:00
|
|
|
function extract_agents_with_group_id (&$agents, $group_id) {
|
|
|
|
$valid_agents = array();
|
|
|
|
foreach ($agents as $id => $agent) {
|
|
|
|
if (isset($agent['group']) && $agent['group'] == $group_id) {
|
|
|
|
$valid_agents[$id] = $agent;
|
|
|
|
unset($agents[$id]);
|
|
|
|
}
|
|
|
|
}
|
2017-11-24 11:27:10 +01:00
|
|
|
|
2014-07-30 17:58:27 +02:00
|
|
|
if (!empty($valid_agents))
|
|
|
|
return $valid_agents;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-11-30 10:45:28 +01:00
|
|
|
$graph_data = array('name' => __('Main node'), 'type' => 'center_node', 'children' => iterate_group_array($data_groups, $data_agents), 'color' => '#3F3F3F');
|
2017-11-24 11:27:10 +01:00
|
|
|
|
2014-07-30 17:58:27 +02:00
|
|
|
if (empty($graph_data['children']))
|
|
|
|
return fs_error_image();
|
|
|
|
|
2014-06-26 13:32:14 +02:00
|
|
|
include_once($config['homedir'] . "/include/graphs/functions_d3.php");
|
|
|
|
|
2014-07-30 17:58:27 +02:00
|
|
|
return d3_sunburst_graph ($graph_data, $width, $height, true);
|
2014-06-26 13:32:14 +02:00
|
|
|
}
|
|
|
|
|
2018-02-27 16:28:00 +01:00
|
|
|
?>
|