pandorafms/pandora_console/godmode/reporting/graph_builder.php

466 lines
14 KiB
PHP
Raw Normal View History

<?php
2020-10-05 17:03:30 +02:00
/**
* Combined graph
*
* @category Combined graph
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
2020-11-27 13:52:35 +01:00
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
2020-10-05 17:03:30 +02:00
* 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 General Public License
* as published by the Free Software Foundation for 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.
* ============================================================================
*/
2021-04-30 13:24:55 +02:00
// Begin.
global $config;
if (is_ajax()) {
$search_agents = (bool) get_parameter('search_agents');
if ($search_agents) {
include_once 'include/functions_agents.php';
$id_agent = (int) get_parameter('id_agent');
$string = (string) get_parameter('q');
2020-10-05 17:03:30 +02:00
// Q is what autocomplete plugin gives.
$id_group = (int) get_parameter('id_group');
$filter = [];
$filter[] = '(nombre LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
$filter['id_grupo'] = $id_group;
$agents = agents_get_agents($filter, ['nombre', 'direccion']);
if ($agents === false) {
return;
}
foreach ($agents as $agent) {
echo $agent['nombre'].'|'.$agent['direccion']."\n";
}
return;
}
return;
}
check_login();
2008-08-11 Esteban Sanchez <estebans@artica.es> * include/functions_db.php: Added __ as an alias of lang_string(). * include/functions_reporting_pdf.php, include/functions_reporting.php, include/functions.php, include/functions_visual_map.php, index.php, operation/incidents/incident.php, operation/incidents/incident_detail.php, operation/incidents/incident_note.php, operation/incidents/incident_search.php, operation/incidents/incident_statistics.php, operation/snmpconsole/snmp_alert.php, operation/snmpconsole/snmp_view.php, operation/users/user.php, operation/users/user_edit.php, operation/users/user_statistics.php, operation/events/event_statistics.php, operation/events/events.php, operation/visual_console/render_view.php, operation/visual_console/index.php, operation/extensions.php, operation/agentes/estado_alertas.php, operation/agentes/status_monitor.php, operation/agentes/estado_grupo.php, operation/agentes/export_csv.php, operation/agentes/datos_agente.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/estado_generalagente.php, operation/agentes/estado_agente.php, operation/agentes/bulbs.php, operation/agentes/status_events.php, operation/agentes/sla_view.php, operation/agentes/exportdata.php, operation/agentes/estado_monitores.php, operation/agentes/ver_agente.php, operation/agentes/estadisticas.php, operation/agentes/tactical.php, operation/agentes/networkmap.php, operation/messages/message.php, operation/reporting/reporting_viewer.php, operation/reporting/graph_viewer.php, operation/reporting/custom_reporting.php, operation/servers/view_server.php, operation/servers/view_server_detail.php, operation/menu.php, reporting/fgraph.php, reporting/stat_win.php, ajax.php, general/logoff.php, general/pandora_help.php, general/footer.php, general/noaccess.php, general/logon_failed.php, general/links_menu.php, general/login_page.php, general/logon_ok.php, general/header.php, general/main_menu.php, godmode/groups/configure_group.php, godmode/groups/group_list.php, godmode/setup/news.php, godmode/setup/links.php, godmode/setup/setup.php, godmode/users/user_list.php, godmode/users/configure_user.php, godmode/profiles/profile_list.php, godmode/admin_access_logs.php, godmode/db/db_info_data.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_network.php, godmode/agentes/module_manager_editor_wmi.php, godmode/agentes/alert_manager.php, godmode/agentes/module_manager_editor_plugin.php, godmode/agentes/module_manager_editor_prediction.php, godmode/agentes/alert_manager_editor.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor_data.php, godmode/agentes/module_manager.php, godmode/agentes/modificar_agente.php, godmode/agentes/configurar_agente.php, godmode/agentes/agent_disk_conf_editor.php, godmode/agentes/planned_downtime.php, godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.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_templates_form.php, godmode/modules/manage_network_components_form_network.php, godmode/modules/manage_network_components_form_wmi.php, godmode/modules/manage_network_components.php, godmode/modules/manage_nc_groups.php, godmode/reporting/reporting_builder.php, godmode/reporting/map_builder.php, godmode/reporting/graph_builder.php, godmode/servers/plugin.php, godmode/servers/manage_recontask.php, godmode/servers/modificar_server.php, godmode/servers/manage_recontask_form.php, godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php, godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a instead of $lang_label to future use of gettext. Style corrections. * godmode/agentes/planned_downtime.php: Rewritten to use Pandora functions and adopt the UI style. Replaced lang_string with __(). * pandoradb.sql: Fields in tplanned_downtime renamed to fit guidelines. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
2020-10-05 17:03:30 +02:00
if (! check_acl($config['id_user'], 0, 'RW')
&& ! check_acl($config['id_user'], 0, 'RM')
) {
db_pandora_audit(
2022-01-20 10:55:23 +01:00
AUDIT_LOG_ACL_VIOLATION,
'Trying to access graph builder'
);
include 'general/noaccess.php';
exit;
2008-08-11 Esteban Sanchez <estebans@artica.es> * include/functions_db.php: Added __ as an alias of lang_string(). * include/functions_reporting_pdf.php, include/functions_reporting.php, include/functions.php, include/functions_visual_map.php, index.php, operation/incidents/incident.php, operation/incidents/incident_detail.php, operation/incidents/incident_note.php, operation/incidents/incident_search.php, operation/incidents/incident_statistics.php, operation/snmpconsole/snmp_alert.php, operation/snmpconsole/snmp_view.php, operation/users/user.php, operation/users/user_edit.php, operation/users/user_statistics.php, operation/events/event_statistics.php, operation/events/events.php, operation/visual_console/render_view.php, operation/visual_console/index.php, operation/extensions.php, operation/agentes/estado_alertas.php, operation/agentes/status_monitor.php, operation/agentes/estado_grupo.php, operation/agentes/export_csv.php, operation/agentes/datos_agente.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/estado_generalagente.php, operation/agentes/estado_agente.php, operation/agentes/bulbs.php, operation/agentes/status_events.php, operation/agentes/sla_view.php, operation/agentes/exportdata.php, operation/agentes/estado_monitores.php, operation/agentes/ver_agente.php, operation/agentes/estadisticas.php, operation/agentes/tactical.php, operation/agentes/networkmap.php, operation/messages/message.php, operation/reporting/reporting_viewer.php, operation/reporting/graph_viewer.php, operation/reporting/custom_reporting.php, operation/servers/view_server.php, operation/servers/view_server_detail.php, operation/menu.php, reporting/fgraph.php, reporting/stat_win.php, ajax.php, general/logoff.php, general/pandora_help.php, general/footer.php, general/noaccess.php, general/logon_failed.php, general/links_menu.php, general/login_page.php, general/logon_ok.php, general/header.php, general/main_menu.php, godmode/groups/configure_group.php, godmode/groups/group_list.php, godmode/setup/news.php, godmode/setup/links.php, godmode/setup/setup.php, godmode/users/user_list.php, godmode/users/configure_user.php, godmode/profiles/profile_list.php, godmode/admin_access_logs.php, godmode/db/db_info_data.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_network.php, godmode/agentes/module_manager_editor_wmi.php, godmode/agentes/alert_manager.php, godmode/agentes/module_manager_editor_plugin.php, godmode/agentes/module_manager_editor_prediction.php, godmode/agentes/alert_manager_editor.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor_data.php, godmode/agentes/module_manager.php, godmode/agentes/modificar_agente.php, godmode/agentes/configurar_agente.php, godmode/agentes/agent_disk_conf_editor.php, godmode/agentes/planned_downtime.php, godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.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_templates_form.php, godmode/modules/manage_network_components_form_network.php, godmode/modules/manage_network_components_form_wmi.php, godmode/modules/manage_network_components.php, godmode/modules/manage_nc_groups.php, godmode/reporting/reporting_builder.php, godmode/reporting/map_builder.php, godmode/reporting/graph_builder.php, godmode/servers/plugin.php, godmode/servers/manage_recontask.php, godmode/servers/modificar_server.php, godmode/servers/manage_recontask_form.php, godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php, godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a instead of $lang_label to future use of gettext. Style corrections. * godmode/agentes/planned_downtime.php: Rewritten to use Pandora functions and adopt the UI style. Replaced lang_string with __(). * pandoradb.sql: Fields in tplanned_downtime renamed to fit guidelines. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
}
unset($name);
$add_module = (bool) get_parameter('add_module', false);
$delete_module = (bool) get_parameter('delete_module', false);
$edit_graph = (bool) get_parameter('edit_graph', false);
$active_tab = get_parameter('tab', 'main');
$add_graph = (bool) get_parameter('add_graph', false);
$update_graph = (bool) get_parameter('update_graph', false);
$change_weight = (bool) get_parameter('change_weight', false);
$change_label = (bool) get_parameter('change_label', false);
$id_graph = (int) get_parameter('id', 0);
if ($id_graph > 0) {
$graph_group = db_get_value('id_group', 'tgraph', 'id_graph', $id_graph);
if (!check_acl_restricted_all($config['id_user'], $graph_group, 'RW')
&& !check_acl_restricted_all($config['id_user'], $graph_group, 'RM')
) {
db_pandora_audit(
2022-01-20 10:55:23 +01:00
AUDIT_LOG_ACL_VIOLATION,
'Trying to access graph builder'
);
include 'general/noaccess.php';
exit;
}
}
if ($id_graph !== 0) {
$sql = "SELECT * FROM tgraph
WHERE (private = 0 OR (private = 1 AND id_user = '".$config['id_user']."'))
AND id_graph = ".$id_graph;
$control = db_process_sql($sql);
if (!$control) {
header('Location: index.php?sec=reporting&sec2=godmode/reporting/graphs');
}
}
if ($add_graph === true) {
$name = get_parameter_post('name');
$description = get_parameter_post('description');
$module_number = get_parameter_post('module_number');
$idGroup = get_parameter_post('graph_id_group');
$stacked = get_parameter('stacked', 0);
$period = get_parameter_post('period');
$threshold = get_parameter('threshold');
$percentil = get_parameter('percentil', 0);
$summatory_series = get_parameter('summatory_series', 0);
$average_series = get_parameter('average_series', 0);
$modules_series = get_parameter('modules_series', 0);
$fullscale = get_parameter('fullscale', 0);
if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD) {
$stacked = $threshold;
}
2020-10-05 17:03:30 +02:00
// Create graph.
$values = [
'id_user' => $config['id_user'],
'name' => $name,
'description' => $description,
'period' => $period,
'private' => 0,
'id_group' => $idGroup,
'stacked' => $stacked,
'percentil' => $percentil,
'summatory_series' => $summatory_series,
'average_series' => $average_series,
'modules_series' => $modules_series,
'fullscale' => $fullscale,
];
if (trim($name) != '') {
$id_graph = db_process_sql_insert('tgraph', $values);
2022-02-01 13:39:18 +01:00
$auditMessage = ($id_graph !== false) ? sprintf('Create graph #%s', $id_graph) : 'Fail try to create graph';
db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
$auditMessage
);
} else {
$id_graph = false;
}
if (!$id_graph) {
$edit_graph = false;
}
}
2008-06-17 Esteban Sanchez <estebans@artica.es> * ajax.php: Added to repository. AJAX interface for Pandora. A new time is coming... * pandoradb.sql: Added id_group to treport. A report is now assigned to a group of agents. Changes in treport_content to add an order field, drop sla fields and use an enum for the type. NOTE: This will break all your current defined reports, update under your responsabillity. Added table treport_content_sla_combined to define SLAs in the SLA types reports. * godmode/reporting/graph_builder.php: Use Pandora functions. Adde javascript code to display the module icon when changing from the dropdown menu. * godmode/reporting/reporting_builder.php: Almost complet rewritten to use Pandora HTML functions. Style correction. * include/functions.php: Added new report types. Style correction. * include/functions_db.php: Use Pandora database functions to get simple values. Added functions get_agents_in_group(), get_modules_in_agent(), get_simple_alerts_in_agent(), get_combined_alerts_in_agent(), get_alerts_in_agent(), get_monitor_downs_in_period(), get_monitor_last_down_timestamp_in_period(), get_alert_fires_in_period(), get_alert_last_fire_timestamp_in_period(). Deleted debug output and fixed calling to an inexistent function in return_moduledata_sum_value(). * include/functions_html.php: Tab style correction. Thanks to Ramon for the advice. Fixed some errors on print_table that was causing not to work fine if rowclass or colspan was defined. * include/functions_reporting.php: Adde date support to return_module_SLA(), event_reporting(). Added alert_reporting(), monitor_health_reporting(), general_group_reporting() and agents_detailed_reporting() to implement new report types. Style correction. * include/javascript/pandora.js: Added html_entity_decode() function to decode some AJAX results. * javascript/jquery.js: Added to repository. jQuery version 1.2.4a * include/javascript/jquery.timeentry.js: jQuery plugin to manage time inputs. * include/javascript/jquery.ui.datepicker.js: jQuery plugin to manage date inputs in a dropdown calendar. * include/languages/date_*.js, include/languages/time_*.js: Added to repository. Translation of date and time strings for the new calendar javascript support. * include/languages/language_en.php: Added new strings relatives to reports. * include/languages/language_de.php, include/languages/language_fr.php, include/languages/language_gl.php, include/languages/language_pt_br.php: Fixed a variable name. * godmode/groups/group_list.php: Avoid the use of an extra indentation by returning if no success on comprueba_login(). * include/styles/pandora.css: Add some classes. Tab style correction. * operation/agentes/ver_agente.php: Added AJAX support to agent operations. * operation/reporting/graph_viewer.php: Period dropdown selection improved and printed with Pandora functions. * operation/reporting/reporting_viewer.php: Massive rewritten. Implemented date and time support, added new report types, use Pandora functions... * reporting/fgraph.php: Documentation fix. Added a new graphic to show monitors health. * godmode/agentes/agent_manager.php, operation/reporting/custom_reporting.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@869 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-17 16:30:44 +02:00
if ($update_graph) {
$id_graph = get_parameter('id');
$name = get_parameter('name');
$id_group = get_parameter('graph_id_group');
$description = get_parameter('description');
$period = get_parameter('period');
$stacked = get_parameter('stacked');
$percentil = get_parameter('percentil');
$summatory_series = get_parameter('summatory_series');
$average_series = get_parameter('average_series');
$modules_series = get_parameter('modules_series');
$alerts = get_parameter('alerts');
$threshold = get_parameter('threshold');
$fullscale = get_parameter('fullscale');
if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD) {
$stacked = $threshold;
}
if (empty(trim($name)) === false) {
$success = db_process_sql_update(
'tgraph',
[
'name' => $name,
'id_group' => $id_group,
'description' => $description,
'width' => $width,
'height' => $height,
'period' => $period,
'stacked' => $stacked,
'percentil' => $percentil,
'summatory_series' => $summatory_series,
'average_series' => $average_series,
'modules_series' => $modules_series,
'fullscale' => $fullscale,
],
['id_graph' => $id_graph]
);
2022-02-01 13:39:18 +01:00
$auditMessage = ($success !== false) ? 'Update graph' : 'Fail try to update graph';
db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
sprintf(
'%s #%s',
$auditMessage,
$id_graph
)
);
} else {
$success = false;
}
2007-03-28 Sancho Lerena <slerena@artica.es> * tip.css, pandora.css: Some updates to fix render in tooltips and datos3 background color. * config.php: Version update. * operation/menu.php: Added reporting suboption: Custom Graph Builder. * operation/reporting/graph_builder.php: New custom and combined graphic generator that uses new function from fgraph graphic_combined_module(). * reporting/fgraph.php: new function graphic_combined_module() to generate combined graphs. Needs to finish implementation to show alerts and evetns (most work done). Function grafico_db_agentes_purge() now uses Pear Graph instead jpgraph. * operation/agents/exportdata.php: Now uses indexes and improve the overall speed. * operation/agents/estado_grupo.php: Rewritten version, much more fast than previous. * operation/events/events.php: Fixed code to mass delete/update and added some audit control points. * pandora_db.php: audit_db() now uses utimestamp. event_insert() now uses utimestamp. Added function give_agent_id_from_module_id(). * operation/agents/estado_ultimopaquete.php: Now render in red timestamp for "outdated" data. Fixes some minor problems with module groups and interval rendering. * operation/agents/estado_monitores.php: now uses utimestamp. * operation/agents/ver_agente.php: Uses lang_label labels for some texts. Fixed image bug. * operation/servers/view_server.php: Added version of server and some cosmetic adjustments. * godmode/db/db_main.php: Applied new graphic. * godmode/agentes/module_manager.php: Now sort by modulegroup. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@405 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-03-28 18:07:29 +02:00
}
function add_quotes($item)
{
return "'$item'";
2007-03-28 Sancho Lerena <slerena@artica.es> * tip.css, pandora.css: Some updates to fix render in tooltips and datos3 background color. * config.php: Version update. * operation/menu.php: Added reporting suboption: Custom Graph Builder. * operation/reporting/graph_builder.php: New custom and combined graphic generator that uses new function from fgraph graphic_combined_module(). * reporting/fgraph.php: new function graphic_combined_module() to generate combined graphs. Needs to finish implementation to show alerts and evetns (most work done). Function grafico_db_agentes_purge() now uses Pear Graph instead jpgraph. * operation/agents/exportdata.php: Now uses indexes and improve the overall speed. * operation/agents/estado_grupo.php: Rewritten version, much more fast than previous. * operation/events/events.php: Fixed code to mass delete/update and added some audit control points. * pandora_db.php: audit_db() now uses utimestamp. event_insert() now uses utimestamp. Added function give_agent_id_from_module_id(). * operation/agents/estado_ultimopaquete.php: Now render in red timestamp for "outdated" data. Fixes some minor problems with module groups and interval rendering. * operation/agents/estado_monitores.php: now uses utimestamp. * operation/agents/ver_agente.php: Uses lang_label labels for some texts. Fixed image bug. * operation/servers/view_server.php: Added version of server and some cosmetic adjustments. * godmode/db/db_main.php: Applied new graphic. * godmode/agentes/module_manager.php: Now sort by modulegroup. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@405 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-03-28 18:07:29 +02:00
}
if ($add_module === true) {
$id_graph = get_parameter('id');
$id_modules = explode(',', get_parameter('id_modules'));
$id_agents = explode(',', get_parameter('id_agents'));
$weight = get_parameter('weight');
2020-10-05 17:03:30 +02:00
// Id modules has double entities conversion.
// Safe output remove all entities.
io_safe_output_array($id_modules, '');
2022-12-05 09:44:35 +01:00
$id_modules = array_map(
function ($mod) {
2022-11-18 14:21:31 +01:00
return io_safe_input($mod);
},
$id_modules
);
$id_agent_modules = db_get_all_rows_sql(
'SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN ('.implode(',', $id_agents).") AND nombre IN ('".implode("','", $id_modules)."')"
);
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
$order = db_get_row_sql("SELECT `field_order` from tgraph_source WHERE id_graph=$id_graph ORDER BY `field_order` DESC");
$order = $order['field_order'];
foreach ($id_agent_modules as $id_agent_module) {
$order++;
$result = db_process_sql_insert('tgraph_source', ['id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight, 'field_order' => $order]);
}
} else {
$result = false;
}
}
if ($delete_module === true) {
$id_graph = get_parameter('id');
$deleteGraph = get_parameter('delete');
$order_val = db_get_value('field_order', 'tgraph_source', 'id_gs', $deleteGraph);
$result = db_process_sql_delete('tgraph_source', ['id_gs' => $deleteGraph]);
db_process_sql('UPDATE tgraph_source SET field_order=field_order-1 WHERE id_graph='.$id_graph.' AND field_order>'.$order_val);
}
if ($change_weight === true) {
$weight = get_parameter('weight');
$id_gs = get_parameter('graph');
db_process_sql_update(
'tgraph_source',
['weight' => $weight],
['id_gs' => $id_gs]
);
}
if ($change_label) {
$label = get_parameter('label');
$id_gs = get_parameter('graph');
db_process_sql_update(
'tgraph_source',
['label' => $label],
['id_gs' => $id_gs]
);
}
if ($edit_graph === true) {
$buttons = [
'graph_list' => [
'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs">'.html_print_image(
2023-03-03 14:50:47 +01:00
'images/logs@svg.svg',
true,
[
'title' => __('Graph list'),
2023-03-03 14:50:47 +01:00
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
],
'main' => [
'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=main&edit_graph=1&id='.$id_graph.'">'.html_print_image(
2023-03-03 14:50:47 +01:00
'images/graph@svg.svg',
true,
[
'title' => __('Main data'),
2023-03-03 14:50:47 +01:00
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
],
'graph_editor' => [
'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&edit_graph=1&id='.$id_graph.'">'.html_print_image(
2023-04-19 10:53:52 +02:00
'images/builder@svg.svg',
true,
[
'title' => __('Graph editor'),
2023-03-03 14:50:47 +01:00
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
],
'view' => [
'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$id_graph.'">'.html_print_image(
2023-03-03 14:50:47 +01:00
'images/enable.svg',
true,
[
'title' => __('View graph'),
2023-03-03 14:50:47 +01:00
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
],
];
$buttons[$active_tab]['active'] = true;
$graphInTgraph = db_get_row_sql('SELECT name FROM tgraph WHERE id_graph = '.$id_graph);
$name = $graphInTgraph['name'];
} else {
$buttons = [];
}
$head = __('Graph builder');
2021-04-30 13:24:55 +02:00
if (isset($name) === true) {
$head .= ' &raquo; '.$name;
}
// Header.
2021-04-30 13:24:55 +02:00
$tab = get_parameter('tab');
2012-07-10 Miguel de Dios <miguel.dedios@artica.es> * install.php, operation/reporting/reporting_xml.php, operation/netflow/nf_live_view.php, operation/netflow/nf_view.php, operation/tree.php, operation/agentes/gis_view.php, operation/agentes/estado_monitores.php, operation/agentes/networkmap.php, operation/agentes/datos_agente.php, operation/agentes/alerts_status.php, operation/menu.php, operation/snmpconsole/snmp_view.php, operation/users/user_edit.php, godmode/groups/configure_group.php, godmode/groups/configure_modu_group.php, godmode/agentes/module_manager_editor_prediction.php, godmode/servers/manage_recontask.php, godmode/alerts/alert_compounds.php, godmode/alerts/configure_alert_template.php, godmode/alerts/alert_special_days.php, godmode/setup/links.php, godmode/setup/os.php, godmode/users/configure_profile.php, godmode/events/events.php, godmode/massive/massive_delete_modules.php, godmode/massive/massive_edit_modules.php, godmode/massive/massive_standby_alerts.php, godmode/massive/massive_add_action_alerts.php, godmode/massive/massive_enable_disable_alerts.php, godmode/massive/massive_operations.php, godmode/massive/massive_delete_profiles.php, godmode/modules/manage_network_components.php, godmode/modules/manage_nc_groups.php, godmode/reporting/graph_builder.php, godmode/reporting/reporting_builder.item_editor.php, include/functions_menu.php, include/functions_visual_map.php, include/functions_db.php: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6759 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-07-10 12:38:02 +02:00
switch ($tab) {
2021-04-30 13:24:55 +02:00
case 'graph_editor':
$headerHelp = '';
break;
2021-04-30 13:24:55 +02:00
case 'main':
default:
$headerHelp = 'graph_builder';
break;
2011-09-15 Juan Manuel Ramon <juanmanuel.ramon@artica.es> * include/help/en/help_visual_console_editor_editor_tab.php include/help/en/help_reporting_list_items_tab.php include/help/en/help_alert_template.php include/help/en/help_alert_action.php include/help/en/help_alert_command.php include/help/en/help_alert_compound.php include/help/en/help_reporting_wizard_sla_tab.php include/help/en/help_reporting_wizard_tab.php include/help/en/help_graph_view.php include/help/en/help_module_linking.php include/help/en/help_visual_console_editor_list_elements_tab.php include/help/en/help_visual_console_editor_data_tab.php include/help/en/help_policy_agent.php include/help/en/help_profile.php include/help/en/help_visual_console_editor_wizard_tab.php include/help/en/help_graph_builder.php include/help/en/help_event_alert.php include/help/en/help_external_alert.php include/help/en/help_visual_console_editor_preview_tab.php include/help/en/help_reporting_item_editor_tab.php include/help/en/help_snmp_alert_custom.php include/help/en/help_reporting_preview_tab.php include/help/en/help_policy_queue.php include/help/en/help_snmp_alert.php include/help/en/help_graph_editor.php include/help/en/help_reporting_global_tab.php include/help/es/help_visual_console_editor_editor_tab.php include/help/es/help_reporting_list_items_tab.php include/help/es/help_alert_template.php include/help/es/help_alert_action.php include/help/es/help_alert_command.php include/help/es/help_alert_compound.php include/help/es/help_reporting_wizard_sla_tab.php include/help/es/help_reporting_wizard_tab.php include/help/es/help_graph_view.php include/help/es/help_module_linking.php include/help/es/help_visual_console_editor_list_elements_tab.php include/help/es/help_visual_console_editor_data_tab.php include/help/es/help_policy_agent.php include/help/es/help_profile.php include/help/es/help_visual_console_editor_wizard_tab.php include/help/es/help_graph_builder.php include/help/es/help_event_alert.php include/help/es/help_external_alert.php include/help/es/help_visual_console_editor_preview_tab.php include/help/es/help_reporting_item_editor_tab.php include/help/es/help_snmp_alert_custom.php include/help/es/help_reporting_preview_tab.php include/help/es/help_policy_queue.php include/help/es/help_snmp_alert.php include/help/es/help_graph_editor.php include/help/es/help_reporting_global_tab.php: New help pages. * godmode/alerts/alert_list.list.php godmode/alerts/alert_compounds.php godmode/alerts/alert_templates.php godmode/alerts/alert_actions.php godmode/alerts/alert_list.builder.php godmode/alerts/alert_commands.php godmode/snmpconsole/snmp_alert.php godmode/users/profile_list.php godmode/modules/manage_network_templates.php godmode/reporting/graph_builder.php: Added contextual alerts. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4959 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-09-15 20:52:54 +02:00
}
2021-04-30 13:24:55 +02:00
// Header.
ui_print_standard_header(
$head,
'images/chart.png',
false,
$headerHelp,
false,
$buttons,
2021-04-30 13:24:55 +02:00
[
[
'link' => '',
'label' => __('Reporting'),
],
[
'link' => '',
'label' => __('Custom graphs'),
],
]
);
if ($add_graph) {
2020-10-05 17:03:30 +02:00
ui_print_result_message(
$id_graph,
__('Graph stored successfully'),
__('There was a problem storing Graph')
);
}
if ($add_module) {
2020-10-05 17:03:30 +02:00
ui_print_result_message(
$result,
__('Module added successfully'),
__('There was a problem adding Module')
);
}
if ($update_graph) {
2020-10-05 17:03:30 +02:00
ui_print_result_message(
$success,
__('Update the graph'),
__('Bad update the graph')
);
}
if ($delete_module) {
2020-10-05 17:03:30 +02:00
ui_print_result_message(
$result,
__('Graph deleted successfully'),
__('There was a problem deleting Graph')
);
2007-03-28 Sancho Lerena <slerena@artica.es> * tip.css, pandora.css: Some updates to fix render in tooltips and datos3 background color. * config.php: Version update. * operation/menu.php: Added reporting suboption: Custom Graph Builder. * operation/reporting/graph_builder.php: New custom and combined graphic generator that uses new function from fgraph graphic_combined_module(). * reporting/fgraph.php: new function graphic_combined_module() to generate combined graphs. Needs to finish implementation to show alerts and evetns (most work done). Function grafico_db_agentes_purge() now uses Pear Graph instead jpgraph. * operation/agents/exportdata.php: Now uses indexes and improve the overall speed. * operation/agents/estado_grupo.php: Rewritten version, much more fast than previous. * operation/events/events.php: Fixed code to mass delete/update and added some audit control points. * pandora_db.php: audit_db() now uses utimestamp. event_insert() now uses utimestamp. Added function give_agent_id_from_module_id(). * operation/agents/estado_ultimopaquete.php: Now render in red timestamp for "outdated" data. Fixes some minor problems with module groups and interval rendering. * operation/agents/estado_monitores.php: now uses utimestamp. * operation/agents/ver_agente.php: Uses lang_label labels for some texts. Fixed image bug. * operation/servers/view_server.php: Added version of server and some cosmetic adjustments. * godmode/db/db_main.php: Applied new graphic. * godmode/agentes/module_manager.php: Now sort by modulegroup. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@405 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-03-28 18:07:29 +02:00
}
2020-10-05 17:03:30 +02:00
// Parse CHUNK information into showable information.
// Split id to get all parameters.
if ($delete_module === false) {
if (isset($_POST['period']) === true) {
$period = $_POST['period'];
}
if ((isset($chunkdata) === true) && (empty($chunkdata) === false)) {
$module_array = [];
$weight_array = [];
$agent_array = [];
$chunk1 = [];
$chunk1 = explode('|', $chunkdata);
$modules = '';
$weights = '';
2021-04-30 13:24:55 +02:00
$chunkCount = count($chunk1);
for ($a = 0; $a < $chunkCount; $a++) {
$chunk2[$a] = [];
$chunk2[$a] = explode(',', $chunk1[$a]);
if (strpos($modules, $chunk2[$a][1]) == 0) {
// Skip dupes
$module_array[] = $chunk2[$a][1];
$agent_array[] = $chunk2[$a][0];
$weight_array[] = $chunk2[$a][2];
if ($modules != '') {
$modules = $modules.','.$chunk2[$a][1];
} else {
$modules = $chunk2[$a][1];
}
if ($weights != '') {
$weights = $weights.','.$chunk2[$a][2];
} else {
$weights = $chunk2[$a][2];
}
}
}
}
2007-03-28 Sancho Lerena <slerena@artica.es> * tip.css, pandora.css: Some updates to fix render in tooltips and datos3 background color. * config.php: Version update. * operation/menu.php: Added reporting suboption: Custom Graph Builder. * operation/reporting/graph_builder.php: New custom and combined graphic generator that uses new function from fgraph graphic_combined_module(). * reporting/fgraph.php: new function graphic_combined_module() to generate combined graphs. Needs to finish implementation to show alerts and evetns (most work done). Function grafico_db_agentes_purge() now uses Pear Graph instead jpgraph. * operation/agents/exportdata.php: Now uses indexes and improve the overall speed. * operation/agents/estado_grupo.php: Rewritten version, much more fast than previous. * operation/events/events.php: Fixed code to mass delete/update and added some audit control points. * pandora_db.php: audit_db() now uses utimestamp. event_insert() now uses utimestamp. Added function give_agent_id_from_module_id(). * operation/agents/estado_ultimopaquete.php: Now render in red timestamp for "outdated" data. Fixes some minor problems with module groups and interval rendering. * operation/agents/estado_monitores.php: now uses utimestamp. * operation/agents/ver_agente.php: Uses lang_label labels for some texts. Fixed image bug. * operation/servers/view_server.php: Added version of server and some cosmetic adjustments. * godmode/db/db_main.php: Applied new graphic. * godmode/agentes/module_manager.php: Now sort by modulegroup. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@405 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-03-28 18:07:29 +02:00
}
switch ($active_tab) {
case 'main':
include_once 'godmode/reporting/graph_builder.main.php';
break;
case 'graph_editor':
include_once 'godmode/reporting/graph_builder.graph_editor.php';
break;
2021-04-30 13:24:55 +02:00
default:
// Nothing to do.
break;
2007-04-19 Sancho Lerena <slerena@artica.es> * pandora.css: added some classes for graphical input buttons. * languages/language_en.php: More strings to go ! * include/config.php: Deleted from repo, now has no sense. * pandoradb.sql: Added `alert_text` to talerta_agent for new text alerts. Added tables for custom graphs and reporting: tgraph, tgraph_source, treport, and treport_content. * operation/users/user.php: Fixed problem with last Raul's commit. * godmode/usuarios/lista_usuarios.php: Fixed problem with last Raul's commit. * operation/agentes/estado_alertas.php: Code cleanup. Implemented render for text alerts. * operation/agentes/datos_agente.php: Fixed small bug with text output. * operation/agentes/datos_agente_calendar.php: Added contribution from Leandro Doctors. Need to work on it before use several problems detected. * operation/servers/view_server.php: Fixed some bugs. * operation/reporting/graph_viewer.php: Added viewer for custom graphs. * operation/reporting/custom_reporting.php: Initial code, not finished yet. * operation/reporting/graph_builder.php: Work for modules in the same agent, several problems, but works. * operation/menu.php: Updated options for new reporting menu. * reporting/stat_win.php: New menu is great :-) * general/login_page.php: Updated login page. * godmode/agentes/alert_manager.php, configurar_agente.php: New code for text alerts and better user help. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@433 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-19 20:50:07 +02:00
}