pandorafms/pandora_console/include/functions_db.php

3450 lines
95 KiB
PHP
Raw Normal View History

<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
2008-04-01 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: Alert type 0 is not 1. 1-3 are reserved. Removed prediction module (nosense since it uses normal modules). * include/functions_db.php: Added wrapper give_db_value to get_db_value because A LOT of code uses old syntax and this makes too many errors. * include/functions.php: Fixed pagination issues with blocksize config. * pandoradb.sql: Change alert command lenght and added some comments for future implementation of alert criticity and others. * operation/incidents/incident.php: Fixed some bugs calling to old funcions / variables. * operation/events/events.php: Fixed some bugs calling to old funcions / variables. Removed graph and simplified header. * operation/agentes/estado_alertas.php: Changed get_db_value call and removed (Raul) button to create alert from here. * operation/agentes/estado_grupo.php: Implemented support for optional view of down modules and fired alerts. * operation/agentes/ver_agente.php, operation/agentes/datos_agente.php: Uses of new get_db_value and new session id variable. * images/mod_async_string.png: Added image. * images/mod_async_inc.png: Added image. * images/mod_image_png.png: Added image. * images/mod_async_data.png: Added image. * images/mod_async_proc.png: Added image. * images/mod_image_jpg.png: Added image. * godmode/setup/setup.php: Several fixes. * godmode/agentes/alert_manager.php: Several changes for new alert manager. Not finished. Interim commit. * godmode/agentes/configurar_agente.php: More changes needed to alert editor. * godmode/agentes/alert_manager_editor.php: New file for alert management. * godmode/modules/module_list.php: Some updates, removed invalid column. * godmode/alerts/modify_alert.php: Alert types < 4 cannot be modified (this includes combined, internal audit and Pandora FMS log). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@783 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-01 15:53:11 +02:00
// 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
2008-04-01 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: Alert type 0 is not 1. 1-3 are reserved. Removed prediction module (nosense since it uses normal modules). * include/functions_db.php: Added wrapper give_db_value to get_db_value because A LOT of code uses old syntax and this makes too many errors. * include/functions.php: Fixed pagination issues with blocksize config. * pandoradb.sql: Change alert command lenght and added some comments for future implementation of alert criticity and others. * operation/incidents/incident.php: Fixed some bugs calling to old funcions / variables. * operation/events/events.php: Fixed some bugs calling to old funcions / variables. Removed graph and simplified header. * operation/agentes/estado_alertas.php: Changed get_db_value call and removed (Raul) button to create alert from here. * operation/agentes/estado_grupo.php: Implemented support for optional view of down modules and fired alerts. * operation/agentes/ver_agente.php, operation/agentes/datos_agente.php: Uses of new get_db_value and new session id variable. * images/mod_async_string.png: Added image. * images/mod_async_inc.png: Added image. * images/mod_image_png.png: Added image. * images/mod_async_data.png: Added image. * images/mod_async_proc.png: Added image. * images/mod_image_jpg.png: Added image. * godmode/setup/setup.php: Several fixes. * godmode/agentes/alert_manager.php: Several changes for new alert manager. Not finished. Interim commit. * godmode/agentes/configurar_agente.php: More changes needed to alert editor. * godmode/agentes/alert_manager_editor.php: New file for alert management. * godmode/modules/module_list.php: Some updates, removed invalid column. * godmode/alerts/modify_alert.php: Alert types < 4 cannot be modified (this includes combined, internal audit and Pandora FMS log). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@783 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-01 15:53:11 +02:00
// 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
2008-04-01 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: Alert type 0 is not 1. 1-3 are reserved. Removed prediction module (nosense since it uses normal modules). * include/functions_db.php: Added wrapper give_db_value to get_db_value because A LOT of code uses old syntax and this makes too many errors. * include/functions.php: Fixed pagination issues with blocksize config. * pandoradb.sql: Change alert command lenght and added some comments for future implementation of alert criticity and others. * operation/incidents/incident.php: Fixed some bugs calling to old funcions / variables. * operation/events/events.php: Fixed some bugs calling to old funcions / variables. Removed graph and simplified header. * operation/agentes/estado_alertas.php: Changed get_db_value call and removed (Raul) button to create alert from here. * operation/agentes/estado_grupo.php: Implemented support for optional view of down modules and fired alerts. * operation/agentes/ver_agente.php, operation/agentes/datos_agente.php: Uses of new get_db_value and new session id variable. * images/mod_async_string.png: Added image. * images/mod_async_inc.png: Added image. * images/mod_image_png.png: Added image. * images/mod_async_data.png: Added image. * images/mod_async_proc.png: Added image. * images/mod_image_jpg.png: Added image. * godmode/setup/setup.php: Several fixes. * godmode/agentes/alert_manager.php: Several changes for new alert manager. Not finished. Interim commit. * godmode/agentes/configurar_agente.php: More changes needed to alert editor. * godmode/agentes/alert_manager_editor.php: New file for alert management. * godmode/modules/module_list.php: Some updates, removed invalid column. * godmode/alerts/modify_alert.php: Alert types < 4 cannot be modified (this includes combined, internal audit and Pandora FMS log). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@783 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-01 15:53:11 +02:00
// GNU General Public License for more details.
2009-08-24 Miguel de Dios <miguel.dedios@artica.es> * include/functions_menu.php, include/functions_html.php, include/functions_events.php, include/functions_messages.php, include/functions_modules.php, include/functions_exportserver.php, include/functions_reporting.php, include/functions_filemanager.php, include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php, include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php, include/functions_networkmap.php, include/functions_servers.php, include/FusionCharts/FusionCharts_Gen.php, include/FusionCharts/FusionCharts.php, include/functions_network_profiles.php, include/gettext.php, include/functions_network_components.php, include/functions_visual_map.php, include/fgraph2.php, include/Image/image_functions.php, include/functions_config.php, include/help/en/help_plugin_parameters.php, include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php, include/help/en/help_postprocess.php, include/help/en/help_prediction_source_module.php, include/help/en/help_date_format.php, include/help/en/help_recontask.php, include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php, include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php, include/help/en/help_agent_status.php, include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php, include/help/en/help_alert_type.php, include/help/en/help_network_component.php, include/help/en/help_time_stamp-comparation.php, include/help/en/help_eventview.php, include/help/en/help_timesource.php, include/help/en/help_alert_validation.php, include/help/en/help_map_builder.php, include/help/en/help_alert_recovery.php, include/help/en/help_module_type.php, include/help/en/help_planned_downtime.php, include/help/en/help_serverlag.php, include/help/en/help_alerts.php, include/help/en/help_snmpwalk.php, include/help/en/help_module_definition.php, include/help/en/help_plugin_definition.php, include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php include/help/en/help_manageconfig.php, include/help/es/help_alert_validation.php, include/help/es/help_plugin_parameters.php, include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php, include/help/es/help_map_builder.php, include/help/es/help_postprocess.php, include/help/es/help_date_format.php, include/help/es/help_alert_recovery.php, include/help/es/help_prediction_source_module.php, include/help/es/help_module_type.php, include/help/es/help_planned_downtime.php, include/help/es/help_alert-matches.php, include/help/es/help_recontask.php, include/help/es/help_alerts.php, include/help/es/help_serverlag.php, include/help/es/help_snmpwalk.php, include/help/es/help_module_definition.php, include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php, include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php, include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php, include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php, include/help/es/help_wminamespace.php, include/help/es/help_network_component.php, include/help/es/help_time_stamp-comparation.php, include/help/es/help_manageconfig.php, include/help/es/help_timesource.php, include/config_process.php, include/functions_ui.php, include/htmlawed.php, include/functions_custom_graphs.php, include/fgraph.php, include/functions_incidents.php, include/functions.php, include/functions_agents.php, include/functions_db.php, include/functions_themes.php, include/streams.php, include/functions_fsgraph.php, include/functions_alerts.php, include/functions_reports.php, include/functions_extensions.php, include/functions_ui_renders.php: change comments blocks for delete the warnings to construct phpDoc Files, give a struct and order in the phpDoc files. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
/**
* @package Include
* @subpackage DataBase
2009-08-24 Miguel de Dios <miguel.dedios@artica.es> * include/functions_menu.php, include/functions_html.php, include/functions_events.php, include/functions_messages.php, include/functions_modules.php, include/functions_exportserver.php, include/functions_reporting.php, include/functions_filemanager.php, include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php, include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php, include/functions_networkmap.php, include/functions_servers.php, include/FusionCharts/FusionCharts_Gen.php, include/FusionCharts/FusionCharts.php, include/functions_network_profiles.php, include/gettext.php, include/functions_network_components.php, include/functions_visual_map.php, include/fgraph2.php, include/Image/image_functions.php, include/functions_config.php, include/help/en/help_plugin_parameters.php, include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php, include/help/en/help_postprocess.php, include/help/en/help_prediction_source_module.php, include/help/en/help_date_format.php, include/help/en/help_recontask.php, include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php, include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php, include/help/en/help_agent_status.php, include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php, include/help/en/help_alert_type.php, include/help/en/help_network_component.php, include/help/en/help_time_stamp-comparation.php, include/help/en/help_eventview.php, include/help/en/help_timesource.php, include/help/en/help_alert_validation.php, include/help/en/help_map_builder.php, include/help/en/help_alert_recovery.php, include/help/en/help_module_type.php, include/help/en/help_planned_downtime.php, include/help/en/help_serverlag.php, include/help/en/help_alerts.php, include/help/en/help_snmpwalk.php, include/help/en/help_module_definition.php, include/help/en/help_plugin_definition.php, include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php include/help/en/help_manageconfig.php, include/help/es/help_alert_validation.php, include/help/es/help_plugin_parameters.php, include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php, include/help/es/help_map_builder.php, include/help/es/help_postprocess.php, include/help/es/help_date_format.php, include/help/es/help_alert_recovery.php, include/help/es/help_prediction_source_module.php, include/help/es/help_module_type.php, include/help/es/help_planned_downtime.php, include/help/es/help_alert-matches.php, include/help/es/help_recontask.php, include/help/es/help_alerts.php, include/help/es/help_serverlag.php, include/help/es/help_snmpwalk.php, include/help/es/help_module_definition.php, include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php, include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php, include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php, include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php, include/help/es/help_wminamespace.php, include/help/es/help_network_component.php, include/help/es/help_time_stamp-comparation.php, include/help/es/help_manageconfig.php, include/help/es/help_timesource.php, include/config_process.php, include/functions_ui.php, include/htmlawed.php, include/functions_custom_graphs.php, include/fgraph.php, include/functions_incidents.php, include/functions.php, include/functions_agents.php, include/functions_db.php, include/functions_themes.php, include/streams.php, include/functions_fsgraph.php, include/functions_alerts.php, include/functions_reports.php, include/functions_extensions.php, include/functions_ui_renders.php: change comments blocks for delete the warnings to construct phpDoc Files, give a struct and order in the phpDoc files. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
*/
/**
* When you delete (with the function "process_sql_delete" or other) any row in
* any table, some times the cache save the data just deleted, because you
* must use "clean_cache".
*/
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
/**
* Check if login session variables are set.
*
* It will stop the execution if those variables were not set
*
* @return bool 0 on success exit() on no success
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*/
function check_login () {
global $config;
if (!isset ($config["homedir"])) {
// No exists $config. Exit inmediatly
include("general/noaccess.php");
exit;
}
if ((isset($_SESSION["id_usuario"])) AND ($_SESSION["id_usuario"] != "")) {
if (is_user ($_SESSION["id_usuario"])) {
return 0;
}
}
audit_db ("N/A", getenv ("REMOTE_ADDR"), "No session", "Trying to access without a valid session");
include ($config["homedir"]."/general/noaccess.php");
exit;
2008-03-06 Sancho Lerena <slerena@gmail.com> Pandora FMS 2.0 development first commit. 1.4 version is now 2.0 * pandoradb_data.sql: Added correct tnetwork_components, fixed ttipo_modulo (categoria values). * include/styles/pandora.css: Added some server icons, tab style for module editor has been improved. * include/functions_db.php: added new functions, lang_string and check_login, and a first review of several functions that currently need change for new config session parameters in array $config[] * include/javascript/pandora.js: Added a new global include for spare javascript functions before included into a few pages. * include/languages/language_en.php: New tokens. * include/help*: New contextual help system. * include/config_process.php: New way to manage config. * include/functions.php: Added new functions to manage global * operation/agentes/estado_ultimopaquete.php: removed old javascript code from there. * operation/agentes/estado_agente.php: Removed references to deprecated field "agent_type". * operation/agentes/tactical.php: Some code cleanup and progressbar issues merged from 1.3.1 branch. Need to add support to new server types and new module types. * operation/servers/view_server.php: Added support to new servers, code cleanup. * reporting/fgraph.php: Code cleanup, changes to use new config method, and a lot of style change. * general/pandora_help.php: New source for contextual help in the way of moodle. * general/footer.php, general/noaccess.php: Code cleanup and uses of new config. * module_manager_editor: New editors for each module family. Need finish and implement EDITION of data, now only inserts data. * godmode/agentes/agent_manager.php: Implemented new server assigment and edition. * godmode/agentes/configurar_agente.php: Small changes that affects module management, visualization and agent management. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
}
/**
* Return a array of id_group of childrens (to branches down)
*
* @param integer $parent The id_group parent to search the childrens.
* @param array $groups The groups, its for optimize the querys to DB.
*/
function get_childrens($parent, $groups = null) {
if (empty($groups)) {
$groups = get_db_all_rows_in_table('tgrupo');
}
$return = array();
foreach ($groups as $key => $group) {
if ($group['id_grupo'] == 0) {
continue;
}
if ($group['parent'] == $parent) {
$return = $return + array($group['id_grupo'] => $group) + get_childrens($group['id_grupo'], $groups);
}
}
return $return;
}
/**
* Return a array of id_group of parents (to roots up).
*
* @param integer $parent The id_group parent to search the parent.
* @param boolean $onlyPropagate Flag to search only parents that true to propagate.
* @param array $groups The groups, its for optimize the querys to DB.
*/
function get_parents($parent, $onlyPropagate = false, $groups = null) {
if (empty($groups)) {
$groups = get_db_all_rows_in_table('tgrupo');
}
$return = array();
foreach ($groups as $key => $group) {
if ($group['id_grupo'] == 0) {
continue;
}
if (($group['id_grupo'] == $parent) && ($group['propagate'] || !$onlyPropagate)) {
$return = $return + array($group['id_grupo'] => $group) + get_parents($group['parent'], $groups);
}
}
return $return;
}
/**
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
* Check access privileges to resources
*
* Access can be:
* IR - Incident/report Read
* IW - Incident/report Write
* IM - Incident/report Management
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
* AR - Agent Read
* AW - Agent Write
* LW - Alert Write
* UM - User Management
* DM - DB Management
* LM - Alert Management
* PM - Pandora Management
*
* @param int $id_user User id
* @param int $id_group Agents group id to check from
* @param string $access Access privilege
*
* @return bool 1 if the user has privileges, 0 if not.
*/
function check_acl ($id_user, $id_group, $access) {
if (empty ($id_user)) {
//User ID needs to be specified
trigger_error ("Security error: check_acl got an empty string for user id", E_USER_WARNING);
return 0;
} elseif (is_user_admin ($id_user)) {
return 1;
} else {
$id_group = (int) $id_group;
}
$parents_id = array($id_group);
if ($id_group != 0) {
$group = get_db_row_filter('tgrupo', array('id_grupo' => $id_group));
$parents = get_parents($group['parent'], true);
foreach ($parents as $parent) {
$parents_id[] = $parent['id_grupo'];
}
}
else {
$parents_id = array();
}
//Joined multiple queries into one. That saves on the query overhead and query cache.
if ($id_group == 0) {
$query = sprintf("SELECT tperfil.incident_view, tperfil.incident_edit,
tperfil.incident_management, tperfil.agent_view,
tperfil.agent_edit, tperfil.alert_edit,
tperfil.alert_management, tperfil.pandora_management,
tperfil.db_management, tperfil.user_management
FROM tusuario_perfil, tperfil
WHERE tusuario_perfil.id_perfil = tperfil.id_perfil
AND tusuario_perfil.id_usuario = '%s'", $id_user);
//GroupID = 0, group id doesnt matter (use with caution!)
}
else {
$query = sprintf("SELECT tperfil.incident_view, tperfil.incident_edit,
tperfil.incident_management, tperfil.agent_view,
tperfil.agent_edit, tperfil.alert_edit,
tperfil.alert_management, tperfil.pandora_management,
tperfil.db_management, tperfil.user_management
FROM tusuario_perfil, tperfil
WHERE tusuario_perfil.id_perfil = tperfil.id_perfil
AND tusuario_perfil.id_usuario = '%s'
AND (tusuario_perfil.id_grupo IN (%s)
OR tusuario_perfil.id_grupo = 0)", $id_user, implode(', ', $parents_id));
}
$rowdup = get_db_all_rows_sql ($query);
if (empty ($rowdup))
return 0;
$result = 0;
foreach ($rowdup as $row) {
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
// For each profile for this pair of group and user do...
switch ($access) {
case "IR":
$result += $row["incident_view"];
break;
case "IW":
$result += $row["incident_edit"];
break;
case "IM":
$result += $row["incident_management"];
break;
case "AR":
$result += $row["agent_view"];
break;
case "AW":
$result += $row["agent_edit"];
break;
case "LW":
$result += $row["alert_edit"];
break;
case "LM":
$result += $row["alert_management"];
break;
case "PM":
$result += $row["pandora_management"];
break;
case "DM":
$result += $row["db_management"];
break;
case "UM":
$result += $row["user_management"];
break;
}
}
if ($result >= 1)
return 1;
return 0;
}
/*
* @deprecated Use check_acl instead
*/
function give_acl ($id_user, $id_group, $access) {
return check_acl ($id_user, $id_group, $access);
}
/**
* Filter out groups the user doesn't have access to
*
* Access can be:
* IR - Incident Read
* IW - Incident Write
* IM - Incident Management
* AR - Agent Read
* AW - Agent Write
* LW - Alert Write
* UM - User Management
* DM - DB Management
* LM - Alert Management
* PM - Pandora Management
*
* @param int $id_user User id
* @param mixed $id_group Group ID(s) to check
* @param string $access Access privilege
*
* @return array Groups the user DOES have acces to (or an empty array)
*/
function safe_acl_group ($id_user, $id_groups, $access) {
if (!is_array ($id_groups) && check_acl ($id_user, $id_groups, $access)) {
/* Return all the user groups if it's the group All */
if ($id_groups == 0)
return array_keys (get_user_groups ($id_user, $access));
return array ($id_groups);
} elseif (!is_array ($id_groups)) {
return array ();
}
foreach ($id_groups as $group) {
//Check ACL. If it doesn't match, remove the group
if (!check_acl ($id_user, $group, $access)) {
unset ($id_groups[$group]);
}
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
}
return $id_groups;
}
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
/**
2009-11-30 18:38:45 +01:00
* Adds an audit log entry (DEPRECATED!)
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*
* @param string $id User id
* @param string $ip Client IP
* @param string $accion Action description
* @param string $descripcion Long action description
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*/
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 audit_db ($id, $ip, $accion, $descripcion){
$accion = safe_input($accion);
$descripcion = safe_input($descripcion);
$sql = sprintf ("INSERT INTO tsesion (ID_usuario, accion, fecha, IP_origen,descripcion, utimestamp) VALUES ('%s','%s',NOW(),'%s','%s',UNIX_TIMESTAMP(NOW()))",$id,$accion,$ip,$descripcion);
process_sql ($sql);
}
2009-11-30 18:38:45 +01:00
/**
* Adds an audit log entry (new function in 3.0)
*
* @param string $accion Action description
* @param string $descripcion Long action description
*/
function pandora_audit ($accion, $descripcion){
global $config;
$ip = $config["remote_addr"];
$id = $config["id_user"];
$accion = safe_input($accion);
$descripcion = safe_input($descripcion);
$sql = sprintf ("INSERT INTO tsesion (ID_usuario, accion, fecha, IP_origen,descripcion, utimestamp) VALUES ('%s','%s',NOW(),'%s','%s',UNIX_TIMESTAMP(NOW()))",$id,$accion,$ip,$descripcion);
process_sql ($sql);
}
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
/**
* Log in a user into Pandora.
*
* @param string $id_user User id
* @param string $ip Client user IP address.
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*/
function logon_db ($id_user, $ip) {
audit_db ($id_user, $ip, "Logon", "Logged in");
// Update last registry of user to set last logon. How do we audit when the user was created then?
process_user_contact ($id_user);
}
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
/**
* Log out a user into Pandora.
*
* @param string $id_user User id
* @param string $ip Client user IP address.
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*/
function logoff_db ($id_user, $ip) {
audit_db ($id_user, $ip, "Logoff", "Logged out");
}
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
/**
* Get profile name from id.
*
* @param int $id_profile Id profile in tperfil
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*
* @return string Profile name of the given id
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*/
function get_profile_name ($id_profile) {
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
return (string) get_db_value ('name', 'tperfil', 'id_perfil', (int) $id_profile);
}
/**
* Selects all profiles (array (id => name))
*
* @return array List of all profiles
*/
function get_profiles () {
$profiles = get_db_all_rows_in_table ("tperfil", "name");
$return = array ();
if ($profiles === false) {
return $return;
}
foreach ($profiles as $profile) {
$return[$profile["id_perfil"]] = $profile["name"];
}
return $return;
}
/**
* Create Profile for User
*
* @param string User ID
* @param int Profile ID (default 1 => AR)
* @param int Group ID (default 1 => All)
* @param string Assign User who assign the profile to user.
*
* @return bool True if succesful, false if not
*/
function create_user_profile ($id_user, $id_profile = 1, $id_group = 0, $assignUser = false) {
global $config;
if (empty ($id_profile) || $id_group < 0)
2009-03-26 Esteban Sanchez <estebans@artica.es> * godmode/users/configure_user.php: Complete rewritten to fix minor errors and fit the Pandora style. * include/auth/ldap.php: Removed process_user_isadmin(). Renamed process_user_password() to update_user_password(). Renamed process_user_info to update_user(). update_user_password() does not require old password anymore. * include/functions_db.php: Added empty checks on create_user_profile(). * include/functions_ui.php: print_error_message() renamed to print_result_message(). * godmode/agentes/configurar_agente.php, godmode/alerts/alert_actions.php, godmode/alerts/alert_commands.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_template.php, godmode/modules/manage_nc_groups.php, godmode/modules/manage_network_templates.php, godmode/modules/manage_network_templates_form.php, godmode/reporting/map_builder_wizard.php, godmode/reporting/reporting_builder.php, operation/agentes/alerts_status.php, operation/events/events.php, operation/incidents/incident.php, operation/incidents/incident_detail.php, operation/messages/message.php, operation/snmpconsole/snmp_view.php, operation/users/user_edit.php: Renamed print_result_message(). Some translatable strings reused to simplify i18n work. * godmode/users/user_list.php: Renamed print_result_message(). Use cross.png for deletion links. Style corrections. * godmode/setup/news.php: Renamed print_result_message(). Use process_sql_delete() instead of direct mysql_query. * godmode/reporting/map_builder.php: Renamed print_result_message(). Style correction on process_sql_update(). * godmode/alerts/configure_alert_compound.php: Renamed print_result_message(). Fixed steps_clean div. * godmode/setup/setup.php: Return control to index instead of exit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1567 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-26 12:14:49 +01:00
return false;
if (isset ($config["id_user"])) {
//Usually this is set unless we call it while logging in (user known by auth scheme but not by pandora)
$assign = $config["id_user"];
} else {
$assign = $id_user;
}
if ($assignUser !== false)
$assign = $assignUser;
$insert = array (
"id_usuario" => $id_user,
"id_perfil" => $id_profile,
"id_grupo" => $id_group,
"assigned_by" => $assign
);
return (bool) process_sql_insert ("tusuario_perfil", $insert);
}
/**
* Delete user profile from database
*
* @param string User ID
* @param int Profile ID
*
* @return bool Whether or not it's deleted
*/
function delete_user_profile ($id_user, $id_profile) {
$sql = sprintf ("DELETE FROM tusuario_perfil WHERE id_usuario = '%s' AND id_up = %d", $id_user, $id_profile);
return (bool) process_sql ($sql);
}
/**
* Delete profile from database (not user-profile link (tusuario_perfil), but the actual profile (tperfil))
*
* @param int Profile ID
*
* @return bool Whether or not it's deleted
*/
function delete_profile ($id_profile) {
$sql = sprintf ("DELETE FROM tperfil WHERE id_perfil = %d", $id_profile);
return (bool) process_sql ($sql);
}
/**
* Get disabled field of a group
*
* @param int id_group Group id
*
* @return bool Disabled field of given group
*/
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
function give_disabled_group ($id_group) {
2008-06-16 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: Updated some new config tokens (graph colors), updated group default names and icons, * manage_config_remote.php, godmode/menu.php: Added new config to manage/copy remote config from one agent to other(s). * agent_manager.php: When create a new agent, cannot select group "ALL". * agent_template.php: Fixed a weird bug that creates two tagente_estado records when using a module template. * alert_manager_editor.php: Fixed ACL problem assigning combined alert components. Better management of NOP in combined alerts (Automated NOP when create the first component. Added NAND, NXOR y NOR). * manage_config.php: Solved some bugs copying configuration with new modules (Added support for new module types). Added filter for group and fixed ACL problems. Code cleanup and better layout. * module_manager_editor_prediction.php: ACL checks added. * config_process.php, setup.php: Support to choose color graphs. * functions.php: Fixed typo and removed N/A for alerts with min/max = 0 * functions_db.php: Fixed another typo in give_disabled_group(), and added feature to list_group() combo to render or now group "ALL". * estado_generalagente.php: Added network push button for whole agent. * tactical.php: Some minor layout improvement. * ver_agente.php: Network FLAG change request for whole group, and fixed manual validation on combined alerts. * events.php: Event description don't show with " ' "characters. Fixed. * fgraph.php: graph_event_module() restored (was missing in last commit), added user-defined color support. * stat_win.php: Added support to choose another date for graph. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@866 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 20:09:56 +02:00
return (bool) get_db_value ('disabled', 'tgrupo', 'id_grupo', (int) $id_group);
}
/**
* Test if the param array is all groups in db.
*
* @param array $id_groups
*
* @return bool It's true when the array is all groups in db.
*/
function isAllGroups($idGroups) {
if (!is_array($idGroups))
$arrayGroups = array($idGroups);
else
$arrayGroups = $idGroups;
$groupsDB = get_db_all_rows_in_table ('tgrupo');
$returnVar = true;
foreach ($groupsDB as $group) {
if (!in_array($group['id_grupo'], $arrayGroups)) {
$returnVar = false;
break;
}
}
return $returnVar;
}
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
/**
* Get all the agents within a group(s).
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
*
* @param mixed $id_group Group id or an array of ID's. If nothing is selected, it will select all
* @param mixed $search to add Default: False. If True will return disabled agents as well. If searching array (disabled => (bool), string => (string))
* @param string $case Which case to return the agentname as (lower, upper, none)
* @param boolean $noACL jump the ACL test.
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
*
* @return array An array with all agents in the group or an empty array
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
*/
function get_group_agents ($id_group = 0, $search = false, $case = "lower", $noACL = false) {
global $config;
if (!$noACL) {
$id_group = safe_acl_group ($config["id_user"], $id_group, "AR");
if (empty ($id_group)) {
//An empty array means the user doesn't have access
return array ();
}
}
if (is_array($id_group)) {
$search_sql = sprintf ('WHERE id_grupo IN (%s)', implode (",", $id_group));
}
else if ($id_group == 0) { //All group
$search_sql = 'WHERE 1 = 1';
}
else {
$search_sql = sprintf ('WHERE id_grupo = %d', $id_group);
}
if ($search === true) {
//No added search. Show both disabled and non-disabled
}
elseif (is_array ($search)) {
if (isset ($search["disabled"])) {
$search_sql .= ' AND disabled = '.($search["disabled"] ? 1 : 0); //Bool, no cleanup necessary
} else {
$search_sql .= ' AND disabled = 0';
}
unset ($search["disabled"]);
if (isset ($search["string"])) {
$string = safe_input ($search["string"]);
$search_sql .= ' AND (nombre LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%")';
unset ($search["string"]);
}
if (isset ($search["name"])) {
$name = safe_input ($search["name"]);
$search_sql .= ' AND nombre LIKE "' . $name . '" ';
unset ($search["name"]);
}
if (! empty ($search)) {
$search_sql .= ' AND '.format_array_to_where_clause_sql ($search);
}
}
else {
$search_sql .= ' AND disabled = 0';
}
$sql = sprintf ("SELECT id_agente, nombre FROM tagente %s ORDER BY nombre", $search_sql);
$result = get_db_all_rows_sql ($sql);
////////////////LOG AJAX///////////////////////
///////////////////////////////////////////////
//$log = fopen ( "/tmp/log_sql", "a");
//fwrite ($log, $sql."\n\n");
//fclose($log);
///////////////////////////////////////////////
if ($result === false)
return array (); //Return an empty array
$agents = array ();
foreach ($result as $row) {
switch ($case) {
case "lower":
$agents[$row["id_agente"]] = mb_strtolower ($row["nombre"], "UTF-8");
break;
case "upper":
$agents[$row["id_agente"]] = mb_strtoupper ($row["nombre"], "UTF-8");
break;
default:
$agents[$row["id_agente"]] = $row["nombre"];
}
}
return ($agents);
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
}
/**
* Get a single module information.
*
* @param int agentmodule id to get.
*
* @return array An array with module information
*/
function get_agentmodule ($id_agentmodule) {
return get_db_row ('tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
}
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
/**
* Get all the modules in an agent. If an empty list is passed it will select all
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
*
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
* @param mixed Agent id to get modules. It can also be an array of agent id's.
* @param mixed Array, comma delimited list or singular value of rows to
* select. If nothing is specified, nombre will be selected. A special
* character "*" will select all the values.
* @param mixed Aditional filters to the modules. It can be an indexed array
* (keys would be the field name and value the expected value, and would be
* joined with an AND operator) or a string, including any SQL clause (without
* the WHERE keyword).
* @param bool Wheter to return the modules indexed by the id_agente_modulo or
* not. Default is indexed.
* Example:
<code>
Both are similars:
$modules = get_agent_modules ($id_agent, false, array ('disabled' => 0));
$modules = get_agent_modules ($id_agent, false, 'disabled = 0');
Both are similars:
$modules = get_agent_modules ($id_agent, '*', array ('disabled' => 0, 'history_data' => 0));
$modules = get_agent_modules ($id_agent, '*', 'disabled = 0 AND history_data = 0');
</code>
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
*
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
* @return array An array with all modules in the agent.
* If multiple rows are selected, they will be in an array
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
*/
function get_agent_modules ($id_agent, $details = false, $filter = false, $indexed = true) {
$id_agent = safe_int ($id_agent, 1);
2009-02-11 Esteban Sanchez <estebans@artica.es> * general/main_menu.php, include/styles/menu.css: Selected menu style is done with a CSS classs. Slide effect removed. Submenus have now white background. * godmode/agentes/alert_manager.php: Allow creation of alerts without actions which have sense in compound alerts. * include/javascript/jquery.pandora.js: Added showMessage() function. * godmode/agentes/module_manager_editor.php: Use new showMessage() jQuery function. * godmode/alerts/configure_alert_compound.php: Added to repository. New compound alert editor interface. * godmode/alerts/alert_compounds.php: Added to repository. Compound alert list. * godmode/alerts/configure_alert_template.php: Better style for steps of the editor. * godmode/menu.php: Added compound alerts option. Changed default page on Manage alerts. * include/styles/pandora.css: Added style for editor steps. Added new generic classes. * include/functions.php: Added a new line when creating script list. * include/functions_agents.php: Fixed alert tables fields. Renamed get_agent_alerts_compound() and improved the returning value of get_agent_alerts(). * include/functions_alerts.php: Added new functions to manage compound alerts. Avoid SQL errors when using process_sql functions. * include/functions_reporting.php: Temporary disabled compound alert reports. * include/functions_ui.php: Fixed format_alert_row() to fit compound alerts. * operation/agentes/alerts_status.php: Allow compound alert validation. Removed effect of cluetip. * pandoradb.sql, pandoradb_migrate_20_to_21.sql: New compound alert tables (talert_compound, talert_compound_elements and talert_compound_actions). * godmode/alerts/alert_list.php: Added to repository. Shows a list of all the alerts defined. Would be improved in the future to allow sorting and filtering. * index.php, godmode/snmpconsole/snmp_alert.php, include/functions_db.php: Code style correction. * godmode/agentes/configurar_agente.php: Removed old compound alerts code git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1443 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-11 17:55:04 +01:00
$where = '';
if (! empty ($id_agent)) {
$where = sprintf (' WHERE id_agente IN (%s)', implode (",", (array) $id_agent));
}
if ($where != '') {
$where .= ' AND ';
} else {
$where .= ' WHERE ';
}
$where .= 'delete_pending = 0 ';
if (! empty ($filter)) {
$where .= ' AND ';
if (is_array ($filter)) {
$fields = array ();
foreach ($filter as $field => $value) {
array_push ($fields, $field.'="'.$value.'"');
}
$where .= implode (' AND ', $fields);
} else {
$where .= $filter;
}
}
if (empty ($details)) {
$details = "nombre";
} else {
$details = safe_input ($details);
}
$sql = sprintf ('SELECT %s%s
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
FROM tagente_modulo
%s
ORDER BY nombre',
($details != '*' && $indexed) ? 'id_agente_modulo,' : '',
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
implode (",", (array) $details),
$where);
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
$result = get_db_all_rows_sql ($sql);
if (empty ($result)) {
return array ();
}
if (! $indexed)
return $result;
$modules = array ();
foreach ($result as $module) {
if (is_array ($details) || $details == '*') {
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
//Just stack the information in array by ID
$modules[$module['id_agente_modulo']] = $module;
} else {
$modules[$module['id_agente_modulo']] = $module[$details];
}
}
return $modules;
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
}
/**
* Get the number of all agent modules in the database
*
* @param mixed Array of integers with agent(s) id or a single agent id. Default
* value will select all.
*
* @return int The number of agent modules
*/
function get_agent_modules_count ($id_agent = 0) {
//Make sure we're all int's and filter out bad stuff
$id_agent = safe_int ($id_agent, 1);
if (empty ($id_agent)) {
//If the array proved empty or the agent is less than 1 (eg. -1)
$filter = '';
} else {
$filter = sprintf (" WHERE id_agente IN (%s)", implode (",", (array) $id_agent));
}
return (int) get_db_sql ("SELECT COUNT(*) FROM tagente_modulo".$filter);
}
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
/**
* Get group icon from group.
*
* @param int id_group Id group to get the icon
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*
* @return string Icon path of the given group
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*/
function get_group_icon ($id_group) {
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
return (string) get_db_value ('icon', 'tgrupo', 'id_grupo', (int) $id_group);
}
/**
* DEPRECATED in favor of get_group_icon
*/
function dame_grupo_icono ($id_group) {
return get_group_icon ($id_group);
}
/**
* Get agent id from a module id that it has.
*
* @param int $id_module Id module is list modules this agent.
*
* @return int Id from the agent of the given id module.
*/
function get_agent_module_id ($id_agente_modulo) {
return (int) get_db_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_agente_modulo);
}
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
/**
* Get agent id from an agent name.
*
* @param string $agent_name Agent name to get its id.
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*
* @return int Id from the agent of the given name.
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*/
function get_agent_id ($agent_name) {
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
return (int) get_db_value ('id_agente', 'tagente', 'nombre', $agent_name);
}
/**
* Get name of an agent.
*
* @param int $id_agent Agent id.
* @param string $case Case (upper, lower, none)
*
* @return string Name of the given agent.
*/
2009-10-13 Sancho Lerena <slerena@artica.es> Upps, Tuesday #13, bad day for a last commit before launch RC1 ! :-S * general/logon_ok.php: Fixed ugly format of table showing last activity (has a too wide table width). * godmode/admin_access_logs.php: Removed that crappy div fashion code and replaced by old and reliable table-based-code :-) to fix the mess with the pagination. * godmode/agentes/configurar_agente.php: fixed problem with postprocess values very bug (like 0.0000000123), parameter is now passed as string because PHP is passing the value as scientific notation and mYsql don't understand that. * operation/agentes/exportdata.php, * operation/search_results.php, * godmode/reporting/map_builder.php, * godmode/agentes/agent_manager.php, * godmode/reporting/graph_builder.php, * godmode/agentes/modificar_agente.php: Added non-case search SQL code for make agent searches non case sensitive (nombre COLLATE utf8_general_ci LIKE...) * module_manager_editor_common.php: More size for postprocess field. * pandora_console/godmode/alerts/configure_alert_action.php: More width for field2 in action form. * godmode/alerts/configure_alert_command.php: Command field has more width and added a help icon for macro subtitutions. * include/functions_db.php: get_agent_name() now defaults to non uppercase the agent names, because 3.0 has case sensitive agent names, and all data must show the real Case. * include/styles/pandora.css: removed uppercase transition for menu items and agent tabs. * operation/agentes/estado_agente.php: Agent is not shown in uppercase anymore. * operation/agentes/estado_generalagente.php: Agent name and parent name is not in uppercase. OS version shows only last 15 characters or full string if strlen() < 15. * operation/agentes/status_monitor.php: Agent name is not in uppercase anymore. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2015 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-10-13 20:59:48 +02:00
function get_agent_name ($id_agent, $case = "none") {
$agent = (string) get_db_value ('nombre', 'tagente', 'id_agente', (int) $id_agent);
2009-10-13 Sancho Lerena <slerena@artica.es> Upps, Tuesday #13, bad day for a last commit before launch RC1 ! :-S * general/logon_ok.php: Fixed ugly format of table showing last activity (has a too wide table width). * godmode/admin_access_logs.php: Removed that crappy div fashion code and replaced by old and reliable table-based-code :-) to fix the mess with the pagination. * godmode/agentes/configurar_agente.php: fixed problem with postprocess values very bug (like 0.0000000123), parameter is now passed as string because PHP is passing the value as scientific notation and mYsql don't understand that. * operation/agentes/exportdata.php, * operation/search_results.php, * godmode/reporting/map_builder.php, * godmode/agentes/agent_manager.php, * godmode/reporting/graph_builder.php, * godmode/agentes/modificar_agente.php: Added non-case search SQL code for make agent searches non case sensitive (nombre COLLATE utf8_general_ci LIKE...) * module_manager_editor_common.php: More size for postprocess field. * pandora_console/godmode/alerts/configure_alert_action.php: More width for field2 in action form. * godmode/alerts/configure_alert_command.php: Command field has more width and added a help icon for macro subtitutions. * include/functions_db.php: get_agent_name() now defaults to non uppercase the agent names, because 3.0 has case sensitive agent names, and all data must show the real Case. * include/styles/pandora.css: removed uppercase transition for menu items and agent tabs. * operation/agentes/estado_agente.php: Agent is not shown in uppercase anymore. * operation/agentes/estado_generalagente.php: Agent name and parent name is not in uppercase. OS version shows only last 15 characters or full string if strlen() < 15. * operation/agentes/status_monitor.php: Agent name is not in uppercase anymore. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2015 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-10-13 20:59:48 +02:00
// Version 3.0 has enforced case sensitive agent names
// so we always should show real case names.
switch ($case) {
case "upper":
return mb_strtoupper ($agent,"UTF-8");
break;
case "lower":
return mb_strtolower ($agent,"UTF-8");
break;
case "none":
default:
return ($agent);
}
}
2009-04-02 Sancho Lerena <slerena@artica.es> * pandoradb.sql: Final DB changes proposed for closing this month the DB scheme. tagente-> new server_name field to assign server (old fields will be removed). talert_templates has two new types (warning, critical). tevento has "user_comment" new field. Tserver has three new fields, server_type (so some old fields will be deleted), threads and queued_modules this last two are for statistical options. Tusuario add language type to override global language. * update_manager/main.php: Minor changes for correct ACL usage. Non PM users could see in what revision it the system, but only that. * pandoradb_migrate_v2.x_to_v3.0.sql: Updated script for new DB changes. * general/noaccess.php: Added footer and ending div. Page was very ugly when showing noaccess errors, nobody see it ???. * godmode/menu.php: A LOT of ACL fixes on several options. * godmode/agentes/agent_manager.php: Fixed a crazy floating icon. * godmode/agentes/manage_config_remote.php: A LOT of changes, rewriting stuff, because was not working. This also adds a lot of ACL checks. * godmode/agentes/massive_config.php, massive*: ACL changes. * godmode/agentes/modificar_agente.php: Fixed ACL problems. * godmode/agentes/module_manager_editor.php: Fixed bad module categories for some types (data, plugin and prediction). * godmode/alerts/alert_list.php: Fixed ACL problem. * godmode/reporting/graph_builder.php: Added ACl restriction for non-viewable agents for current user. Seems to be a problem with data with more than 2 sources. * godmode/reporting/map_builder.php: ACL checks improved. * godmode/reporting/reporting_builder.php: ACL checks added (was missing), some code ported from 2.1, other is new. New fields shown in list. * include/functions.php: Fixed the annoying bug of "bad counters" in function human_time_description_raw(). Function used,format_numeric() should not be used never to calculate nothing, only to print formatted strings. * include/functions_db.php: Added function user_access_to_agent() to know if a given user has access to a given agent. * include/functioins_report.php: get_report() should let admin to watch any report. Fixed. * agentes/alerts_status.php: Fixed ACL problem for view alert. * operation/incidents/incident.php: Bad call for pagination() was giving problems to pagination call. Somebody changes pagination() interface and make this broken. Please if you change any interface, be sure that is compatible with old code or make a post in the list about this ! * godmode/users/user_edit.php: Additional ACL check to do not let anybody to watch non accesible users. Even for see the username or description. * reporting/pchart_graph.php:Progress bar shown text in white when > 60%. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1594 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-02 21:16:59 +02:00
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
/**
* Get type name for alerts (e-mail, text, internal, ...) based on type number
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*
* @param int id_alert Alert type id.
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*
* @return string Type name of the alert.
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*/
function get_alert_type ($id_type) {
return (string) get_db_value ('name', 'talert_templates', 'id', (int) $id_type);
}
/**
* Get the name of an exporting server
*
* @param int $id_server Server id
*
* @return string The name of given server.
*/
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
function dame_nombre_servidorexportacion ($id_server) {
return (string) get_db_value ('name', 'tserver_export', 'id', (int) $id_server);
}
/**
* Get the name of a plugin
*
* @param int id_plugin Plugin id.
*
* @return string The name of the given plugin
*/
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
function dame_nombre_pluginid ($id_plugin) {
return (string) get_db_value ('name', 'tplugin', 'id', (int) $id_plugin);
}
/**
* Get the name of a module type
*
* @param int $id_type Type id
*
* @return string The name of the given type.
*/
function get_module_type_name ($id_type) {
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
return (string) get_db_value ('nombre', 'ttipo_modulo', 'id_tipo', (int) $id_type);
}
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
/**
* Get agent id of an agent module.
*
* @param int $id_agentmodule Agent module id.
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
*
* @return int The id of the agent of given agent module
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
*/
function get_agentmodule_agent ($id_agentmodule) {
return (int) get_db_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
}
/**
* Get agent name of an agent module.
*
* @param int $id_agente_modulo Agent module id.
*
* @return string The name of the given agent module.
*/
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
function get_agentmodule_agent_name ($id_agentmodule) {
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
// Since this is a helper function we don't need to do casting
return (string) get_agent_name (get_agentmodule_agent ($id_agentmodule));
}
/**
* Get the module name of an agent module.
*
* @param int $id_agente_modulo Agent module id.
*
* @return string Name of the given agent module.
*/
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
function get_agentmodule_name ($id_agente_modulo) {
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
return (string) get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', (int) $id_agente_modulo);
}
/**
* Get the module type of an agent module.
*
* @param int $id_agentmodule Agent module id.
*
* @return string Module type of the given agent module.
*/
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
function get_agentmodule_type ($id_agentmodule) {
return (int) get_db_value ('id_tipo_modulo', 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
}
/**
* DEPRECATED: User get_user_fullname
*/
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
function dame_nombre_real ($id_user) {
return get_user_fullname ($id_user);
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
}
/**
* Get all the times a monitor went down during a period.
*
* @param int $id_agent_module Agent module of the monitor.
* @param int $period Period timed to check from date
* @param int $date Date to check (now by default)
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
*
* @return int The number of times a monitor went down.
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
*/
function get_monitor_downs_in_period ($id_agent_module, $period, $date = 0) {
if ($date == 0) {
$date = get_system_time ();
}
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
$datelimit = $date - $period;
$sql = sprintf ("SELECT COUNT(`id_agentmodule`) FROM `tevento` WHERE
`event_type` = 'monitor_down'
AND `id_agentmodule` = %d
AND `utimestamp` > %d
AND `utimestamp` <= %d",
$id_agent_module, $datelimit, $date);
return get_db_sql ($sql);
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
}
/**
* Get the last time a monitor went down during a period.
*
* @param int $id_agent_module Agent module of the monitor.
* @param int $period Period timed to check from date
* @param int $date Date to check (now by default)
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
*
* @return int The last time a monitor went down.
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
*/
function get_monitor_last_down_timestamp_in_period ($id_agent_module, $period, $date = 0) {
if ($date == 0) {
$date = get_system_time ();
}
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
$datelimit = $date - $period;
$sql = sprintf ("SELECT MAX(`timestamp`) FROM `tevento` WHERE
event_type = 'monitor_down'
AND `id_agentmodule` = %d
AND `utimestamp` > %d
AND `utimestamp` <= %d",
$id_agent_module, $datelimit, $date);
return get_db_sql ($sql);
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
}
/**
* Get all the monitors defined in an group.
*
* @param int $id_group Group id to get all the monitors.
*
* @return array An array with all the monitors defined in the group (tagente_modulo).
*/
function get_monitors_in_group ($id_group) {
if ($id_group <= 0) {
//We select all groups the user has access to if it's 0 or -1
global $config;
$id_group = array_keys (get_user_groups ($config['id_user']));
}
if (is_array ($id_group)) {
$id_group = implode (",",$id_group);
}
$sql = sprintf ("SELECT `tagente_modulo`.* FROM `tagente_modulo`, `ttipo_modulo`, `tagente` WHERE
`id_tipo_modulo` = `id_tipo`
AND `tagente`.`id_agente` = `tagente_modulo`.`id_agente`
AND `ttipo_modulo`.`nombre` LIKE '%%_proc'
AND `tagente`.`id_grupo` IN (%s) ORDER BY `tagente`.`nombre`", $id_group);
return get_db_all_rows_sql ($sql);
}
/**
* Get all the events happened in a group during a period of time.
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param mixed $id_group Group id to get events for.
* @param int $period Period of time in seconds to get events.
* @param int $date Beginning date to get events.
*
* @return array An array with all the events happened.
*/
function get_group_events ($id_group, $period, $date) {
global $config;
$id_group = safe_acl_group ($config["id_user"], $id_group, "AR");
if (empty ($id_group)) {
//An empty array means the user doesn't have access
return false;
}
$datelimit = $date - $period;
$sql = sprintf ('SELECT * FROM tevento
WHERE utimestamp > %d AND utimestamp <= %d
AND id_grupo IN (%s)
ORDER BY utimestamp ASC',
$datelimit, $date, implode (",", $id_group));
return get_db_all_rows_sql ($sql);
}
/**
* Get all the events happened in an Agent during a period of time.
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param int $id_agent Agent id to get events.
* @param int $period Period of time in seconds to get events.
* @param int $date Beginning date to get events.
*
* @return array An array with all the events happened.
*/
function get_agent_events ($id_agent, $period, $date = 0) {
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
}
$datelimit = $date - $period;
$sql = sprintf ('SELECT evento, event_type, criticity, count(*) as count_rep, max(timestamp) AS time2
FROM tevento WHERE id_agente = %d AND utimestamp > %d AND utimestamp <= %d
GROUP BY id_agentmodule, evento ORDER BY time2 DESC', $id_agent, $datelimit, $date);
return get_db_all_rows_sql ($sql);
}
/**
* Get all the events happened in an Agent during a period of time.
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param int $id_agent_module Module id to get events.
* @param int $period Period of time in seconds to get events.
* @param int $date Beginning date to get events.
*
* @return array An array with all the events happened.
*/
function get_module_events ($id_agent_module, $period, $date = 0) {
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
}
$datelimit = $date - $period;
$sql = sprintf ('SELECT evento, event_type, criticity, count(*) as count_rep, max(timestamp) AS time2
FROM tevento WHERE id_agentmodule = %d AND utimestamp > %d AND utimestamp <= %d
GROUP BY id_agentmodule, evento ORDER BY time2 DESC', $id_agent_module, $datelimit, $date);
return get_db_all_rows_sql ($sql);
}
/**
* Get all the fired of alerts happened in an Agent during a period of time.
*
* The returned alerts will be in the time interval ($date - $period, $date]
*
* @param int $id_agent Agent id to get events.
* @param int $period Period of time in seconds to get events.
* @param int $date Beginning date to get events.
*
* @return array An array with all the events happened.
*/
function get_agent_alert_fired ($id_agent, $id_alert, $period, $date = 0) {
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
}
$datelimit = $date - $period;
$sql = sprintf ('SELECT timestamp
FROM tevento
WHERE id_agente = %d AND utimestamp > %d AND utimestamp <= %d
AND id_alert_am = %d
ORDER BY timestamp DESC', $id_agent, $datelimit, $date, $id_alert);
return get_db_all_rows_sql ($sql);
}
/**
* Get all the fired of alerts happened in an Agent module during a period of time.
*
* The returned alerts will be in the time interval ($date - $period, $date]
*
* @param int $id_agent_module Agent module id to get events.
* @param int $period Period of time in seconds to get events.
* @param int $date Beginning date to get events.
*
* @return array An array with all the events happened.
*/
function get_module_alert_fired ($id_agent_module, $id_alert, $period, $date = 0) {
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
}
$datelimit = $date - $period;
$sql = sprintf ('SELECT timestamp
FROM tevento
WHERE id_agentmodule = %d AND utimestamp > %d AND utimestamp <= %d
AND id_alert_am = %d
ORDER BY timestamp DESC', $id_agent_module, $datelimit, $date, $id_alert);
return get_db_all_rows_sql ($sql);
}
/**
* Get all the monitors defined in an agent.
*
* @param int $id_agent Agent id to get all the monitors.
*
* @return array An array with all the monitors defined (tagente_modulo).
*/
function get_monitors_in_agent ($id_agent) {
$sql = sprintf ("SELECT `tagente_modulo`.*
FROM `tagente_modulo`, `ttipo_modulo`, `tagente`
WHERE `id_tipo_modulo` = `id_tipo`
AND `tagente`.`id_agente` = `tagente_modulo`.`id_agente`
AND `ttipo_modulo`.`nombre` LIKE '%%_proc'
AND `tagente`.`id_agente` = %d", $id_agent);
return get_db_all_rows_sql ($sql);
}
/**
* Get all the monitors down during a period of time.
*
* @param array $monitors An array with all the monitors to check. Each
* element of the array must be a dictionary.
* @param int $period Period of time to check the monitors.
* @param int $date Beginning date to check the monitors.
*
* @return array An array with all the monitors that went down in that
* period of time.
*/
function get_monitors_down ($monitors, $period = 0, $date = 0) {
$monitors_down = array ();
if (empty ($monitors))
2008-08-22 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: Removed data for locale, added for new date string format. * include/functions_html.php: Deletion of table properties after calling it makes a bad render on several pages that uses some properties for other things (width). * include/functions_reporting.php: Added several checks to avoid notices. * include/config_process.php: Removed locale code. Added code for new datetime string format. * include/locale.class.php: Removed. * include/functions.php: pandora_help() was not returning correct output. Added format_datetime() function to render date / time strings in user defined format. * include/functions_db.php: Added check in get_monitors_down() to avoid notice in void foreach. * operation/incidents/incident_detail.php: Solved problem with attachments. * operation/users/user.php: Solved problem with old help_lang[] array. * operation/messages/message.php: Sime minor fixes and style improvements. * operation/servers/view_server.php: Remove description. * operation/servers/view_server_detail.php: Removed bad field retrieval from database and added format_datetime(). * reporting/fgraph.php: Fixed small problem in monitors_health_pipe(). (changed parameters). * general/footer.php: Updated use of new functions. * general/header.php: Added blank spaces between icons and texts. * godmode/setup/setup.php: Management of new string format for datetime. * godmode/profiles/profile_list.php: Submit button now uses div instead tables. * godmode/reporting/reporting_builder.php: Added check before foreach() to avoid notice warnings. Changed div for buttons. * godmode/reporting/map_builder.php: Fixed div for submit button. * godmode/servers/modificar_server.php: Fixed typo in SQL sentence. Removed usage of not-used-now locale format functions. Alter legend to use a plain-formatted table to avoid background color in legend. * /en/help_date_format.php: Added help for date format string. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1023 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-22 16:28:00 +02:00
return $monitors_down;
foreach ($monitors as $monitor) {
$down = get_monitor_downs_in_period ($monitor['id_agente_modulo'], $period, $date);
if ($down > 0)
array_push ($monitors_down, $monitor);
}
return $monitors_down;
}
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
/**
* Get all the times an alerts fired during a period.
*
* @param int Alert module id.
* @param int Period timed to check from date
* @param int Date to check (current time by default)
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
*
* @return int The number of times an alert fired.
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
*/
function get_alert_fires_in_period ($id_alert_module, $period, $date = 0) {
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 (!$date)
$date = get_system_time ();
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
$datelimit = $date - $period;
$sql = sprintf ("SELECT COUNT(`id_agentmodule`) FROM `tevento` WHERE
`event_type` = 'alert_fired'
AND `id_alert_am` = %d
AND `utimestamp` > %d
AND `utimestamp` <= %d",
$id_alert_module, $datelimit, $date);
return (int) get_db_sql ($sql);
}
/**
* Get all the alerts defined in a group.
*
* It gets all the alerts of all the agents on a given group.
*
* @param int $id_group Group id to check.
*
* @return array An array with alerts dictionaries defined in a group.
*/
function get_group_alerts ($id_group) {
global $config;
require_once ($config["homedir"].'/include/functions_agents.php');
$alerts = array ();
$agents = get_group_agents ($id_group, false, "none");
foreach ($agents as $agent_id => $agent_name) {
$agent_alerts = get_agent_alerts ($agent_id);
$alerts = array_merge ($alerts, $agent_alerts);
}
return $alerts;
}
/**
* Get all the alerts fired during a period, given a list of alerts.
*
* @param array A list of alert modules to check. See get_alerts_in_group()
* @param int Period of time to check fired alerts.
* @param int Beginning date to check fired alerts in UNIX format (current date by default)
*
* @return array An array with the alert id as key and the number of times
* the alert was fired (only included if it was fired).
*/
function get_alerts_fired ($alerts, $period = 0, $date = 0) {
if (! $date)
$date = get_system_time ();
$datelimit = $date - $period;
$alerts_fired = array ();
$agents = array ();
foreach ($alerts as $alert) {
if (isset($alert['id'])){
$fires = get_alert_fires_in_period ($alert['id'], $period, $date);
if (! $fires) {
continue;
}
$alerts_fired[$alert['id']] = $fires;
}
}
return $alerts_fired;
}
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
/**
* Get the last time an alert fired during a period.
*
* @param int Alert agent module id.
* @param int Period timed to check from date
* @param int Date to check (current date by default)
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
*
* @return int The last time an alert fired. It's an UNIX timestamp.
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
*/
function get_alert_last_fire_timestamp_in_period ($id_alert_module, $period, $date = 0) {
if ($date == 0) {
$date = get_system_time ();
}
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
$datelimit = $date - $period;
$sql = sprintf ("SELECT MAX(`utimestamp`) FROM `tevento` WHERE
`event_type` = 'alert_fired'
AND `id_alert_am` = %d
AND `utimestamp` > %d
AND `utimestamp` <= %d",
$id_alert_module, $datelimit, $date);
return get_db_sql ($sql);
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
}
/**
* Get the server name.
*
* @param int Server id.
*
* @return string Name of the given server
*/
2008-12-16 Evi Vanoost <vanooste@rcbi.rochester.edu> * general/logon_ok.php, godmode/agentes/modificar_agente.php, godmode/agentes/planned_downtime.php, godmode/agentes/manage_recontask.php, godmode/setup/news.php, operation/agentes/datos_agente.php, operation/agentes/estado_agente.php, operation/agentes/status_events.php, operation/agentes/tactical.php, operation/events/events.php, operation/incidents/incidents.php, operation/incidents/incident_detail.php, operation/messages/message.php: Function updates and new function definitions * include/functions.php: safe_input used utf_decode which gives problems with foreign chars since everything else is (or should be UTF-8) fixed. format_datetime is no longer necessary - use print_timestamp for output. Extended multibyte wrapper functions. * include/functions_db.php: give_server_name is now get_server_name; dame_so_name is now get_os_name; dame_so_icon is now print_os_icon; show_icon_group is now print_group_icon; give_network_profile_name is now get_networkprofile_name; smal_event_table is now print_events_table * include/functions_events.php: print_events_table was moved here and fixed. Now calculates the cutoff of event and agent text. * include/functions_html.php: Added title to print_table function and updated documentation. print_timestamp now uses the new function definitions (array) and handles 0-dates better. print_group_icon and print_os_icon added and extended. Added print_agent_name. This function fixes issues that show up when cutting off agent names with multibyte char * operation/servers/view_server.php: Rewrite with new functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1295 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-17 15:26:42 +01:00
function get_server_name ($id_server) {
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
return (string) get_db_value ('name', 'tserver', 'id_server', (int) $id_server);
}
/**
2009-01-07 16:57:33 +01:00
* Get the module type name (type = generic_data, remote_snmp, ...)
*
* @param int $id_type Type id
*
* @return string Name of the given type.
*/
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
function get_moduletype_name ($id_type) {
return (string) get_db_value ('nombre', 'ttipo_modulo', 'id_tipo', (int) $id_type);
}
/**
* Get the module type description
*
* @param int $id_type Type id
*
* @return string Description of the given type.
*/
function get_moduletype_description ($id_type) {
return (string) get_db_value ('descripcion', 'ttipo_modulo', 'id_tipo', (int) $id_type);
}
/**
* Returns an array with all module types (default) or if "remote" or "agent"
* is passed it will return only remote (ICMP, SNMP, TCP...) module types
* otherwise the full list + the column you specify
*
* @param string Specifies which type to return (will return an array with id's)
* @param string Which rows to select (defaults to nombre)
*
* @return array Either the full table or if a type is specified, an array with id's
*/
function get_moduletypes ($type = "all", $rows = "nombre") {
$return = array ();
$rows = (array) $rows; //Cast as array
$row_cnt = count ($rows);
if ($type == "remote") {
return array_merge (range (6,18), (array) 100);
} elseif ($type == "agent") {
return array_merge (range (1,4), range (19,24));
}
$sql = sprintf ("SELECT id_tipo,%s FROM ttipo_modulo", implode (",", $rows));
$result = get_db_all_rows_sql ($sql);
if ($result === false) {
return $return;
}
foreach ($result as $type) {
if ($row_cnt > 1) {
$return[$type["id_tipo"]] = $type;
} else {
$return[$type["id_tipo"]] = $type[reset ($rows)];
}
}
return $return;
}
/**
* @deprecated Use get_agent_group ($id) now (fully compatible)
*/
function dame_id_grupo ($id_agent) {
return get_agent_group ($id_agent);
}
2009-01-12 Sancho Lerena <slerena@artica.es> * pandoradb.sql: Removed fields "timestamp" and "id_agente" (and altered some indexes) on tagente_datos, tagente_datos_string and tagente_datos_inc. tagente_estado table: removed cambio, added status_changes, last_status. tagente_modulo: added five new fields (warning,critical mgmt., flipflop detection, history module and delete_pending bit. * agent_manager.php: Group ALL not shown anymore. * configurar_agente.php: Support for new options. Delete a module now mark for deletion the module, not delete data (It's VERY slow!). * modificar_agente.php: Delete agent now uses the global function, minor fixes. * module_manager_editor.php: New fields initializacion. * module_manager_editor_network.php: At this time, the first module editor who implements the new fields and improve old ones (tcp data). * setup.php: Added support for new token: event_view_hr (Filter of max old (in hr) for the event viewer. Removed old tokens show_unknown and show_lastalert. * functions.php: format_for_graph() has an important BUG that makes all units rendered without the "K" !!!!. Fixed. * delete_agent.php: Delete remote config (if present). Also mark for deletion modules instead delete them (and let the data without being deleted, because it's a HUGE consuming time, and it's left for the daily db maintance process). * estado_agente.php: Updated code for view new status. * estado_generalagente.php: Total packets are removed from this view, this was a huge time consuming SQL operation that don't give important infomation. Groupname is now visualized. * estado_ultimopaquete.php, * estado_monitores.php, * estado_grupo.php: Rewritten much code to view new status and other minor changes. * ver_agente.php: Data view now works under the tabs and other minor changes. * events.php: Support for the new events and status. Added filter for username and for a max. hours old events. Some boxes are now hidden by default. * fgraph.php: Some graphs are now fixed and uses tagente_datos and tagent_access with utimestamp and without id_agent index. Works faster * images/*: Updated icons (module types) and two new bulb colors. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1326 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 04:53:33 +01:00
/**
* Get the number of pandora data packets in the database.
*
* In case an array is passed, it will have a value for every agent passed
* incl. a total otherwise it will just return the total
*
* @param mixed Agent id or array of agent id's, 0 for all
*
* @return mixed The number of data in the database
*/
function get_agent_modules_data_count ($id_agent = 0) {
$id_agent = safe_int ($id_agent, 1);
if (empty ($id_agent)) {
$id_agent = array ();
} else {
$id_agent = (array) $id_agent;
}
$count = array ();
$count["total"] = 0;
$query[0] = "SELECT COUNT(*) FROM tagente_datos";
//$query[1] = "SELECT COUNT(*) FROM tagente_datos_inc";
//$query[2] = "SELECT COUNT(*) FROM tagente_datos_string";
foreach ($id_agent as $agent_id) {
//Init value
$count[$agent_id] = 0;
$modules = array_keys (get_agent_modules ($agent_id));
foreach ($query as $sql) {
//Add up each table's data
$count[$agent_id] += (int) get_db_sql ($sql." WHERE id_agente_modulo IN (".implode (",", $modules).")", 0, true);
}
//Add total agent count to total count
$count["total"] += $count[$agent_id];
}
if ($count["total"] == 0) {
foreach ($query as $sql) {
$count["total"] += (int) get_db_sql ($sql, 0, true);
}
}
if (!isset ($agent_id)) {
//If agent_id is not set, it didn't loop through any agents
return $count["total"];
}
return $count; //Return the array
}
/**
* Get the operating system name.
*
* @param int Operating system id.
*
* @return string Name of the given operating system.
*/
2008-12-16 Evi Vanoost <vanooste@rcbi.rochester.edu> * general/logon_ok.php, godmode/agentes/modificar_agente.php, godmode/agentes/planned_downtime.php, godmode/agentes/manage_recontask.php, godmode/setup/news.php, operation/agentes/datos_agente.php, operation/agentes/estado_agente.php, operation/agentes/status_events.php, operation/agentes/tactical.php, operation/events/events.php, operation/incidents/incidents.php, operation/incidents/incident_detail.php, operation/messages/message.php: Function updates and new function definitions * include/functions.php: safe_input used utf_decode which gives problems with foreign chars since everything else is (or should be UTF-8) fixed. format_datetime is no longer necessary - use print_timestamp for output. Extended multibyte wrapper functions. * include/functions_db.php: give_server_name is now get_server_name; dame_so_name is now get_os_name; dame_so_icon is now print_os_icon; show_icon_group is now print_group_icon; give_network_profile_name is now get_networkprofile_name; smal_event_table is now print_events_table * include/functions_events.php: print_events_table was moved here and fixed. Now calculates the cutoff of event and agent text. * include/functions_html.php: Added title to print_table function and updated documentation. print_timestamp now uses the new function definitions (array) and handles 0-dates better. print_group_icon and print_os_icon added and extended. Added print_agent_name. This function fixes issues that show up when cutting off agent names with multibyte char * operation/servers/view_server.php: Rewrite with new functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1295 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-17 15:26:42 +01:00
function get_os_name ($id_os) {
return (string) get_db_value ('name', 'tconfig_os', 'id_os', (int) $id_os);
}
/**
* @deprecated Use is_user_admin
*/
function dame_admin ($id_user) {
return is_user_admin ($id_user);
}
/**
* @deprecated Use check_login () instead
*/
function comprueba_login () {
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
return check_login ();
}
/**
* Check if an agent has alerts fired.
*
* @param int Agent id.
*
* @return bool True if the agent has fired alerts.
*/
function check_alert_fired ($id_agent) {
$sql = sprintf ("SELECT COUNT(*)
FROM talert_template_modules, tagente_modulo
WHERE talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo
AND times_fired > 0 AND id_agente = %d",
$id_agent);
$value = get_db_sql ($sql);
if ($value > 0)
return true;
return false;
}
/**
* Get the interval value of an agent module.
*
* If the module interval is not set, the agent interval is returned
*
* @param int Id agent module to get the interval value.
*
* @return int Module interval or agent interval if no module interval
*/
function get_module_interval ($id_agent_module) {
2009-01-07 16:57:33 +01:00
$interval = (int) get_db_value ('module_interval', 'tagente_modulo', 'id_agente_modulo', (int) $id_agent_module);
if ($interval > 0)
return $interval;
$id_agent = give_agent_id_from_module_id ($id_agent_module);
return (int) get_agent_interval ($id_agent);
}
/**
* Get the interval of an agent.
*
* @param int Agent id.
*
* @return int The interval value of a given agent
*/
function get_agent_interval ($id_agent) {
return (int) get_db_value ('intervalo', 'tagente', 'id_agente', $id_agent);
}
/**
* Get the flag value of an agent module.
*
* @param int Agent module id.
*
* @return bool The flag value of an agent module.
*/
function give_agentmodule_flag ($id_agent_module) {
return get_db_value ('flag', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
}
/**
* Get all groups in array with index as id_group
*/
function get_all_groups($groupWithAgents = false) {
$sql = 'SELECT id_grupo, nombre FROM tgrupo';
global $config;
if ($groupWithAgents)
$sql .= ' WHERE id_grupo IN (SELECT id_grupo FROM tagente GROUP BY id_grupo)';
$sql .= ' ORDER BY nombre DESC';
$rows = get_db_all_rows_sql ($sql);
$return = array();
foreach ($rows as $row) {
if (give_acl ($config['id_user'], $row["id_grupo"], "AR"))
$return[$row['id_grupo']] = $row['nombre'];
}
return $return;
}
/**
* Get a list of all users in an array [username] => (info)
*
* @param string Field to order by (id_usuario, nombre_real or fecha_registro)
* @param string Which info to get (defaults to nombre_real)
*
* @return array An array of users
*/
function get_users_info ($order = "fullname", $info = "fullname") {
$users = get_users ($order);
$ret = array ();
foreach ($users as $user_id => $user_info) {
$ret[$user_id] = $user_info[$info];
}
return $ret;
}
/**
* Get all the Model groups a user has reading privileges.
*
* @param string User id
* @param string The privilege to evaluate
*
* @return array A list of the groups the user has certain privileges.
*/
function get_all_model_groups () {
$groups = get_db_all_rows_in_table ('tmodule_group');
$returnGroups = array();
foreach ($groups as $group)
$returnGroups[$group['id_mg']] = $group['name'];
$returnGroups[0] = "Not assigned"; //Module group external to DB but it exist
return $returnGroups;
}
/**
* Get all the groups a user has reading privileges.
*
* @param string User id
2010-07-15 Miguel de Dios <miguel.dedios@artica.es> * include/functions_html.php: added the function "print_select_groups" to print the field select box for groups with tree style. * include/functions_db.php: in function "get_user_groups" added test to false value in parameter $privilege for get all groups without ACL test. Fixed in function "get_user_groups_tree" the call to "get_user_groups" with the correct parameters. * operation/incidents/incident.php, operation/incidents/incident_detail.php, operation/events/events.php, operation/agentes/status_monitor.php, operation/agentes/estado_agente.php, operation/agentes/alerts_status.functions.php, operation/agentes/exportdata.php, operation/agentes/networkmap.php, operation/messages/message.php, general/ui/agents_list.php, godmode/groups/configure_group.php, godmode/groups/group_list.php, godmode/agentes/massive_add_alerts.php, godmode/agentes/massive_delete_agents.php, godmode/agentes/massive_config.php, godmode/agentes/massive_delete_action_alerts.php, godmode/agentes/massive_delete_alerts.php, godmode/agentes/modificar_agente.php, godmode/agentes/massive_delete_modules.php, godmode/agentes/massive_add_action_alerts.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/configure_alert_compound.php, godmode/alerts/alert_compounds.php, godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/setup/gis_step_2.php, godmode/users/configure_user.php, godmode/gis_maps/configure_gis_map.php, godmode/reporting/graph_builder.main.php, godmode/reporting/reporting_builder.main.php, godmode/reporting/visual_console_builder.data.php: changed the fields select box of group to tree style select box for groups. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3009 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-07-15 17:20:43 +02:00
* @param string The privilege to evaluate, and it is false then no check ACL.
* @param boolean $returnAllGroup Flag the return group, by default true.
* @param boolean $returnAllColumns Flag to return all columns of groups.
*
* @return array A list of the groups the user has certain privileges.
*/
function get_user_groups ($id_user = false, $privilege = "AR", $returnAllGroup = true, $returnAllColumns = false) {
if (empty ($id_user)) {
global $config;
$id_user = $config['id_user'];
}
$user_groups = array ();
$groups = get_db_all_rows_in_table ('tgrupo', 'nombre');
if (!$groups)
return $user_groups;
if ($returnAllGroup) { //All group
if ($returnAllColumns) {
$groups[0] = array('id_grupo' => 0, 'nombre' => __('All'),
'icon' => 'world', 'parent' => 0, 'disabled' => 0,
'custom_id' => null, 'propagate' => 0);
}
else {
$groups[0] = array('id_grupo' => 0, 'nombre' => __("All"));
}
}
foreach ($groups as $group) {
2010-07-15 Miguel de Dios <miguel.dedios@artica.es> * include/functions_html.php: added the function "print_select_groups" to print the field select box for groups with tree style. * include/functions_db.php: in function "get_user_groups" added test to false value in parameter $privilege for get all groups without ACL test. Fixed in function "get_user_groups_tree" the call to "get_user_groups" with the correct parameters. * operation/incidents/incident.php, operation/incidents/incident_detail.php, operation/events/events.php, operation/agentes/status_monitor.php, operation/agentes/estado_agente.php, operation/agentes/alerts_status.functions.php, operation/agentes/exportdata.php, operation/agentes/networkmap.php, operation/messages/message.php, general/ui/agents_list.php, godmode/groups/configure_group.php, godmode/groups/group_list.php, godmode/agentes/massive_add_alerts.php, godmode/agentes/massive_delete_agents.php, godmode/agentes/massive_config.php, godmode/agentes/massive_delete_action_alerts.php, godmode/agentes/massive_delete_alerts.php, godmode/agentes/modificar_agente.php, godmode/agentes/massive_delete_modules.php, godmode/agentes/massive_add_action_alerts.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/configure_alert_compound.php, godmode/alerts/alert_compounds.php, godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/setup/gis_step_2.php, godmode/users/configure_user.php, godmode/gis_maps/configure_gis_map.php, godmode/reporting/graph_builder.main.php, godmode/reporting/reporting_builder.main.php, godmode/reporting/visual_console_builder.data.php: changed the fields select box of group to tree style select box for groups. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3009 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-07-15 17:20:43 +02:00
if ($privilege === false) {
if ($returnAllColumns) {
$user_groups[$group['id_grupo']] = $group;
}
else {
$user_groups[$group['id_grupo']] = $group['nombre'];
}
}
else if (give_acl ($id_user, $group["id_grupo"], $privilege)) {
if ($returnAllColumns) {
$user_groups[$group['id_grupo']] = $group;
}
else {
$user_groups[$group['id_grupo']] = $group['nombre'];
}
}
}
return $user_groups;
}
/**
* Make with a list of groups a treefied list of groups.
*
* @param array $groups The list of groups to create the treefield list.
* @param integer $parent The id_group of parent actual scan branch.
* @param integer $deep The level of profundity in the branch.
*
* @return array The treefield list of groups.
*/
function get_user_groups_tree_recursive($groups, $parent = 0, $deep = 0) {
$return = array();
foreach ($groups as $key => $group) {
if (($key == 0) && ($parent == 0)) { //When the groups is the all group
$group['deep'] = $deep;
$group['hash_branch'] = true;
$deep ++;
$return = $return + array($key => $group);
}
else if ($group['parent'] == $parent) {
$group['deep'] = $deep;
$branch = get_user_groups_tree_recursive($groups, $key, $deep + 1);
if (empty($branch)) {
$group['hash_branch'] = false;
}
else {
$group['hash_branch'] = true;
}
$return = $return + array($key => $group) + $branch;
}
}
return $return;
}
/**
* Get all the groups a user has reading privileges. Version for tree groups.
*
* @param string User id
* @param string The privilege to evaluate
* @param boolean $returnAllGroup Flag the return group, by default true.
* @param boolean $returnAllColumns Flag to return all columns of groups.
*
* @return array A treefield list of the groups the user has certain privileges.
*/
function get_user_groups_tree($id_user = false, $privilege = "AR", $returnAllGroup = true) {
2010-07-15 Miguel de Dios <miguel.dedios@artica.es> * include/functions_html.php: added the function "print_select_groups" to print the field select box for groups with tree style. * include/functions_db.php: in function "get_user_groups" added test to false value in parameter $privilege for get all groups without ACL test. Fixed in function "get_user_groups_tree" the call to "get_user_groups" with the correct parameters. * operation/incidents/incident.php, operation/incidents/incident_detail.php, operation/events/events.php, operation/agentes/status_monitor.php, operation/agentes/estado_agente.php, operation/agentes/alerts_status.functions.php, operation/agentes/exportdata.php, operation/agentes/networkmap.php, operation/messages/message.php, general/ui/agents_list.php, godmode/groups/configure_group.php, godmode/groups/group_list.php, godmode/agentes/massive_add_alerts.php, godmode/agentes/massive_delete_agents.php, godmode/agentes/massive_config.php, godmode/agentes/massive_delete_action_alerts.php, godmode/agentes/massive_delete_alerts.php, godmode/agentes/modificar_agente.php, godmode/agentes/massive_delete_modules.php, godmode/agentes/massive_add_action_alerts.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/configure_alert_compound.php, godmode/alerts/alert_compounds.php, godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/setup/gis_step_2.php, godmode/users/configure_user.php, godmode/gis_maps/configure_gis_map.php, godmode/reporting/graph_builder.main.php, godmode/reporting/reporting_builder.main.php, godmode/reporting/visual_console_builder.data.php: changed the fields select box of group to tree style select box for groups. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3009 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-07-15 17:20:43 +02:00
$user_groups = get_user_groups ($id_user, $privilege, $returnAllGroup, true);
$user_groups_tree = get_user_groups_tree_recursive($user_groups);
return $user_groups_tree;
}
2009-04-20 Esteban Sanchez <estebans@artica.es> * godmode/agentes/module_manager_editor.php, godmode/agentes/module_manager_editor_common.php, godmode/agentes/module_manager_editor_data.php, godmode/agentes/module_manager_editor_network.php, godmode/agentes/module_manager_editor_plugin.php, godmode/agentes/module_manager_editor_prediction.php, godmode/agentes/module_manager_editor_wmi.php, godmode/agentes/module_manager.php: Some fixes to allow form reutilization. * include/javascript/jquery.pandora.controls.js: Fixed a typo. Added pandoraSelectGroup control. * include/javascript/jquery.pandora.js: Separate between auto executed code and document ready function. * include/javascript/pandora_modules.js: Added to repository. Functions to use on module editors. * include/functions_agents.php: Added get_agents(). * include/functions_db.php: Added get_user_first_group(). Changed user_access_to_agent() parameters order. * include/functions_reporting.php: Style corrections. * include/functions_ui.php: Added doc to print_status_image(). Added print_ui_agents_list() to print a list of agents with a search form and a lot of configuration options easily. * include/functions_ui_renders.php: Added to repository. New API for renders on UI components. * operation/agentes/estado_agente.php: Make table wider. * godmode/reporting/reporting_builder.php: Replaced exit with return. Use pandoraSelectGroup control. * godmode/servers/manage_recontask_form.php: Style corrections to fit Pandora styles. * godmode/servers/modificar_server.php: Removed a notice from a typo. * godmode/setup/setup.php: Fixed table data indexes. Removed javascript code from visual setup. * godmode/setup/setup_visuals.php: Some strings changed. Style correction. * godmode/menu.php: Added policies enterprise menu option. * images/policies.png: Added to repository. * godmode/agentes/modificar_agente.php: Style correction by using pandora functions. * godmode/agentes/massive_operations.php: Fixed tab styles that was showing wrong the . * godmode/agentes/manage_config_remote.php: Changes in user_access_to_agent() * general/ui/agents_list.php: Added to repository. Reusable render for an agent list. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1632 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-20 16:00:27 +02:00
/**
* Get the first group of an user.
*
* Useful function when you need a default group for a user.
*
* @param string User id
* @param string The privilege to evaluate
*
* @return array The first group where the user has certain privileges.
*/
function get_user_first_group ($id_user = false, $privilege = "AR") {
return array_shift (array_keys (get_user_groups ($id_user, $privilege)));
}
/**
* Get module type icon.
*
* TODO: Create print_moduletype_icon and print the full tag including hover etc.
* @deprecated Use print_moduletype_icon instead
*
* @param int Module type id
*
* @return string Icon filename of the given group
*/
function show_icon_type ($id_type) {
return (string) get_db_value ('icon', 'ttipo_modulo', 'id_tipo', $id_type);
}
/**
* Return a string containing image tag for a given target id (server)
* TODO: Make this print_servertype_icon and move to functions_ui.php. Make XHTML compatible. Make string translatable
*
* @deprecated Use print_servertype_icon instead
*
* @param int Server type id
*
* @return string Fully formatted IMG HTML tag with icon
*/
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
function show_server_type ($id) {
global $config;
switch ($id) {
case 1:
2009-05-18 Esteban Sanchez <estebans@artica.es> * images/award_star_bronze_1.png, images/award_star_bronze_2.png, images/award_star_bronze_3.png, images/award_star_gold_2.png, images/award_star_silver_1.png, images/bullet_add.png, images/bullet_black.png, images/bullet_blue.png, images/bullet_delete.png, images/bullet_disk.png, images/bullet_error.png, images/bullet_go.png, images/bullet_green.png, images/bullet_key.png, images/bullet_white.png, images/bullet_wrench.png, images/bullet_yellow.png, images/dot_down.png, images/exclamation.png, images/flag_blue.png, images/flag_green.png, images/flag_yellow.png, images/help_small.jpg, images/lock_open.png, images/mod_udp_proc.png, images/newspaper.png, images/phone_sound.png, images/pixel_blue.png, images/plugin_disabled.png, images/plugin_enabled.png, images/pulpo_lupa.png, images/shield.png, images/so_beos.png, images/status_busy.png, images/status_online.png, images/user_female.png, images/user_gray.png, images/user_orange.png, images/user_red.png, images/webcam.png: Deleted from repository. Unused icons. * images/agents_group.png: Added to repository. New icon. * godmode/agentes/configurar_agente.php, operation/agentes/ver_agente.php: Replaced icon for agent group. * include/functions_db.php: Replaced icons for data server. Style correction. * include/functions_ui.php: Cast block_size value for sanity. * ChangeLog: Added some lines of a previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1692 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-05-18 16:57:30 +02:00
return '<img src="images/database.png" title="Pandora FMS Data server">';
break;
case 2:
return '<img src="images/network.png" title="Pandora FMS Network server">';
break;
case 4:
return '<img src="images/plugin.png" title="Pandora FMS Plugin server">';
break;
case 5:
return '<img src="images/chart_bar.png" title="Pandora FMS Prediction server">';
break;
case 6:
return '<img src="images/wmi.png" title="Pandora FMS WMI server">';
break;
case 7:
return '<img src="images/server_web.png" title="Pandora FMS WEB server">';
2009-05-18 Esteban Sanchez <estebans@artica.es> * images/award_star_bronze_1.png, images/award_star_bronze_2.png, images/award_star_bronze_3.png, images/award_star_gold_2.png, images/award_star_silver_1.png, images/bullet_add.png, images/bullet_black.png, images/bullet_blue.png, images/bullet_delete.png, images/bullet_disk.png, images/bullet_error.png, images/bullet_go.png, images/bullet_green.png, images/bullet_key.png, images/bullet_white.png, images/bullet_wrench.png, images/bullet_yellow.png, images/dot_down.png, images/exclamation.png, images/flag_blue.png, images/flag_green.png, images/flag_yellow.png, images/help_small.jpg, images/lock_open.png, images/mod_udp_proc.png, images/newspaper.png, images/phone_sound.png, images/pixel_blue.png, images/plugin_disabled.png, images/plugin_enabled.png, images/pulpo_lupa.png, images/shield.png, images/so_beos.png, images/status_busy.png, images/status_online.png, images/user_female.png, images/user_gray.png, images/user_orange.png, images/user_red.png, images/webcam.png: Deleted from repository. Unused icons. * images/agents_group.png: Added to repository. New icon. * godmode/agentes/configurar_agente.php, operation/agentes/ver_agente.php: Replaced icon for agent group. * include/functions_db.php: Replaced icons for data server. Style correction. * include/functions_ui.php: Cast block_size value for sanity. * ChangeLog: Added some lines of a previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1692 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-05-18 16:57:30 +02:00
break;
default:
return "--";
}
}
2009-01-12 Sancho Lerena <slerena@artica.es> * pandoradb.sql: Removed fields "timestamp" and "id_agente" (and altered some indexes) on tagente_datos, tagente_datos_string and tagente_datos_inc. tagente_estado table: removed cambio, added status_changes, last_status. tagente_modulo: added five new fields (warning,critical mgmt., flipflop detection, history module and delete_pending bit. * agent_manager.php: Group ALL not shown anymore. * configurar_agente.php: Support for new options. Delete a module now mark for deletion the module, not delete data (It's VERY slow!). * modificar_agente.php: Delete agent now uses the global function, minor fixes. * module_manager_editor.php: New fields initializacion. * module_manager_editor_network.php: At this time, the first module editor who implements the new fields and improve old ones (tcp data). * setup.php: Added support for new token: event_view_hr (Filter of max old (in hr) for the event viewer. Removed old tokens show_unknown and show_lastalert. * functions.php: format_for_graph() has an important BUG that makes all units rendered without the "K" !!!!. Fixed. * delete_agent.php: Delete remote config (if present). Also mark for deletion modules instead delete them (and let the data without being deleted, because it's a HUGE consuming time, and it's left for the daily db maintance process). * estado_agente.php: Updated code for view new status. * estado_generalagente.php: Total packets are removed from this view, this was a huge time consuming SQL operation that don't give important infomation. Groupname is now visualized. * estado_ultimopaquete.php, * estado_monitores.php, * estado_grupo.php: Rewritten much code to view new status and other minor changes. * ver_agente.php: Data view now works under the tabs and other minor changes. * events.php: Support for the new events and status. Added filter for username and for a max. hours old events. Some boxes are now hidden by default. * fgraph.php: Some graphs are now fixed and uses tagente_datos and tagent_access with utimestamp and without id_agent index. Works faster * images/*: Updated icons (module types) and two new bulb colors. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1326 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 04:53:33 +01:00
/**
* Get a module category name
*
* @param int Id category
2009-01-12 Sancho Lerena <slerena@artica.es> * pandoradb.sql: Removed fields "timestamp" and "id_agente" (and altered some indexes) on tagente_datos, tagente_datos_string and tagente_datos_inc. tagente_estado table: removed cambio, added status_changes, last_status. tagente_modulo: added five new fields (warning,critical mgmt., flipflop detection, history module and delete_pending bit. * agent_manager.php: Group ALL not shown anymore. * configurar_agente.php: Support for new options. Delete a module now mark for deletion the module, not delete data (It's VERY slow!). * modificar_agente.php: Delete agent now uses the global function, minor fixes. * module_manager_editor.php: New fields initializacion. * module_manager_editor_network.php: At this time, the first module editor who implements the new fields and improve old ones (tcp data). * setup.php: Added support for new token: event_view_hr (Filter of max old (in hr) for the event viewer. Removed old tokens show_unknown and show_lastalert. * functions.php: format_for_graph() has an important BUG that makes all units rendered without the "K" !!!!. Fixed. * delete_agent.php: Delete remote config (if present). Also mark for deletion modules instead delete them (and let the data without being deleted, because it's a HUGE consuming time, and it's left for the daily db maintance process). * estado_agente.php: Updated code for view new status. * estado_generalagente.php: Total packets are removed from this view, this was a huge time consuming SQL operation that don't give important infomation. Groupname is now visualized. * estado_ultimopaquete.php, * estado_monitores.php, * estado_grupo.php: Rewritten much code to view new status and other minor changes. * ver_agente.php: Data view now works under the tabs and other minor changes. * events.php: Support for the new events and status. Added filter for username and for a max. hours old events. Some boxes are now hidden by default. * fgraph.php: Some graphs are now fixed and uses tagente_datos and tagent_access with utimestamp and without id_agent index. Works faster * images/*: Updated icons (module types) and two new bulb colors. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1326 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 04:53:33 +01:00
*
* @return Name of the given category
*/
function give_modulecategory_name ($id_category) {
switch ($id_category) {
case 0:
return __('Software agent data');
break;
case 1:
return __('Software agent monitor');
break;
case 2:
return __('Network agent data');
break;
case 3:
return __('Network agent monitor');
break;
}
return __('Unknown');
}
/**
* Get a network profile name.
*
* @param int Id network profile
*
* @return string Name of the given network profile.
*/
2008-12-16 Evi Vanoost <vanooste@rcbi.rochester.edu> * general/logon_ok.php, godmode/agentes/modificar_agente.php, godmode/agentes/planned_downtime.php, godmode/agentes/manage_recontask.php, godmode/setup/news.php, operation/agentes/datos_agente.php, operation/agentes/estado_agente.php, operation/agentes/status_events.php, operation/agentes/tactical.php, operation/events/events.php, operation/incidents/incidents.php, operation/incidents/incident_detail.php, operation/messages/message.php: Function updates and new function definitions * include/functions.php: safe_input used utf_decode which gives problems with foreign chars since everything else is (or should be UTF-8) fixed. format_datetime is no longer necessary - use print_timestamp for output. Extended multibyte wrapper functions. * include/functions_db.php: give_server_name is now get_server_name; dame_so_name is now get_os_name; dame_so_icon is now print_os_icon; show_icon_group is now print_group_icon; give_network_profile_name is now get_networkprofile_name; smal_event_table is now print_events_table * include/functions_events.php: print_events_table was moved here and fixed. Now calculates the cutoff of event and agent text. * include/functions_html.php: Added title to print_table function and updated documentation. print_timestamp now uses the new function definitions (array) and handles 0-dates better. print_group_icon and print_os_icon added and extended. Added print_agent_name. This function fixes issues that show up when cutting off agent names with multibyte char * operation/servers/view_server.php: Rewrite with new functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1295 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-17 15:26:42 +01:00
function get_networkprofile_name ($id_network_profile) {
return (string) get_db_value ('name', 'tnetwork_profile', 'id_np', $id_network_profile);
}
/**
* Assign an IP address to an agent.
*
* @param int Agent id
* @param string IP address to assign
*/
function agent_add_address ($id_agent, $ip_address) {
2007-04-18 Sancho Lerena <slerena@artica.es> * include/styles/pandora.css: Added frame and changed basic form input styles (fixed the old problem with radio and checkboxes). * include/functions_db.php: Finished function agent_add_address(). Added functions: agent_delete_address(), give_agent_address() and give_agent_address_from_list(). * include/languages/language_en.php: More strings ! * include/functions.php: Added numeric render for graph Y scale and for numeric data output in screen: format_for_graph(). * pandoradb.sql: Several small fixes and cleanup (deleted drop check). * operation/agentes/estado_alertas.php: Fixed old bug with visualization of alerts (min/max) vs (max/min). Now alert is a real value, not integer. * operation/agentes/datos_agente.php: Better render for numeric (float) data. * operation/agentes/estado_ultimopaquete.php: Better render for numeric (float) data and fixed a small costemic bug. * operation/agentes/estado_generalagente.php: Fixed a small costemic bug, list of ip's have some white space before and this have better visualization for user due to combo style stripping some space. * reporting/fgraph.php: Graph improvement: graphs now could show alerts associated to an agent and draw alert limits. Preprocessor function is now used to render axis label with (M,K) symbols and decimal commas. Title and subtitle has been improved. * reporting/stat_win.php: Graph menu improvement. Fully completed work. This should work for final version without more changes. * godmode/agentes/agent_template.php: Template/Wizard module assigment form for agent. * godmode/agentes/alert_manager.php: Several fixes (links) and alert max/min render. * godmode/agentes/configurar_agente.php: Fixed several navitation bugs. Added agent ip addition/deletion code. * godmode/agentes/agent_manager.php: Address list management code. * godmode/modules/module_list.php: Deleted link to "module type editor" and create button: This has no sense since there is no moduletype editor yet :-) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-18 11:58:26 +02:00
// Check if already is attached to agent
$sql = sprintf ("SELECT COUNT(`ip`) FROM taddress_agent, taddress
2007-04-18 Sancho Lerena <slerena@artica.es> * include/styles/pandora.css: Added frame and changed basic form input styles (fixed the old problem with radio and checkboxes). * include/functions_db.php: Finished function agent_add_address(). Added functions: agent_delete_address(), give_agent_address() and give_agent_address_from_list(). * include/languages/language_en.php: More strings ! * include/functions.php: Added numeric render for graph Y scale and for numeric data output in screen: format_for_graph(). * pandoradb.sql: Several small fixes and cleanup (deleted drop check). * operation/agentes/estado_alertas.php: Fixed old bug with visualization of alerts (min/max) vs (max/min). Now alert is a real value, not integer. * operation/agentes/datos_agente.php: Better render for numeric (float) data. * operation/agentes/estado_ultimopaquete.php: Better render for numeric (float) data and fixed a small costemic bug. * operation/agentes/estado_generalagente.php: Fixed a small costemic bug, list of ip's have some white space before and this have better visualization for user due to combo style stripping some space. * reporting/fgraph.php: Graph improvement: graphs now could show alerts associated to an agent and draw alert limits. Preprocessor function is now used to render axis label with (M,K) symbols and decimal commas. Title and subtitle has been improved. * reporting/stat_win.php: Graph menu improvement. Fully completed work. This should work for final version without more changes. * godmode/agentes/agent_template.php: Template/Wizard module assigment form for agent. * godmode/agentes/alert_manager.php: Several fixes (links) and alert max/min render. * godmode/agentes/configurar_agente.php: Fixed several navitation bugs. Added agent ip addition/deletion code. * godmode/agentes/agent_manager.php: Address list management code. * godmode/modules/module_list.php: Deleted link to "module type editor" and create button: This has no sense since there is no moduletype editor yet :-) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-18 11:58:26 +02:00
WHERE taddress_agent.id_a = taddress.id_a
AND ip = '%s' AND id_agent = %d",$ip_address,$id_agent);
$current_address = get_db_sql ($sql);
if ($current_address > 0)
2007-04-18 Sancho Lerena <slerena@artica.es> * include/styles/pandora.css: Added frame and changed basic form input styles (fixed the old problem with radio and checkboxes). * include/functions_db.php: Finished function agent_add_address(). Added functions: agent_delete_address(), give_agent_address() and give_agent_address_from_list(). * include/languages/language_en.php: More strings ! * include/functions.php: Added numeric render for graph Y scale and for numeric data output in screen: format_for_graph(). * pandoradb.sql: Several small fixes and cleanup (deleted drop check). * operation/agentes/estado_alertas.php: Fixed old bug with visualization of alerts (min/max) vs (max/min). Now alert is a real value, not integer. * operation/agentes/datos_agente.php: Better render for numeric (float) data. * operation/agentes/estado_ultimopaquete.php: Better render for numeric (float) data and fixed a small costemic bug. * operation/agentes/estado_generalagente.php: Fixed a small costemic bug, list of ip's have some white space before and this have better visualization for user due to combo style stripping some space. * reporting/fgraph.php: Graph improvement: graphs now could show alerts associated to an agent and draw alert limits. Preprocessor function is now used to render axis label with (M,K) symbols and decimal commas. Title and subtitle has been improved. * reporting/stat_win.php: Graph menu improvement. Fully completed work. This should work for final version without more changes. * godmode/agentes/agent_template.php: Template/Wizard module assigment form for agent. * godmode/agentes/alert_manager.php: Several fixes (links) and alert max/min render. * godmode/agentes/configurar_agente.php: Fixed several navitation bugs. Added agent ip addition/deletion code. * godmode/agentes/agent_manager.php: Address list management code. * godmode/modules/module_list.php: Deleted link to "module type editor" and create button: This has no sense since there is no moduletype editor yet :-) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-18 11:58:26 +02:00
return;
2007-04-18 Sancho Lerena <slerena@artica.es> * include/styles/pandora.css: Added frame and changed basic form input styles (fixed the old problem with radio and checkboxes). * include/functions_db.php: Finished function agent_add_address(). Added functions: agent_delete_address(), give_agent_address() and give_agent_address_from_list(). * include/languages/language_en.php: More strings ! * include/functions.php: Added numeric render for graph Y scale and for numeric data output in screen: format_for_graph(). * pandoradb.sql: Several small fixes and cleanup (deleted drop check). * operation/agentes/estado_alertas.php: Fixed old bug with visualization of alerts (min/max) vs (max/min). Now alert is a real value, not integer. * operation/agentes/datos_agente.php: Better render for numeric (float) data. * operation/agentes/estado_ultimopaquete.php: Better render for numeric (float) data and fixed a small costemic bug. * operation/agentes/estado_generalagente.php: Fixed a small costemic bug, list of ip's have some white space before and this have better visualization for user due to combo style stripping some space. * reporting/fgraph.php: Graph improvement: graphs now could show alerts associated to an agent and draw alert limits. Preprocessor function is now used to render axis label with (M,K) symbols and decimal commas. Title and subtitle has been improved. * reporting/stat_win.php: Graph menu improvement. Fully completed work. This should work for final version without more changes. * godmode/agentes/agent_template.php: Template/Wizard module assigment form for agent. * godmode/agentes/alert_manager.php: Several fixes (links) and alert max/min render. * godmode/agentes/configurar_agente.php: Fixed several navitation bugs. Added agent ip addition/deletion code. * godmode/agentes/agent_manager.php: Address list management code. * godmode/modules/module_list.php: Deleted link to "module type editor" and create button: This has no sense since there is no moduletype editor yet :-) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-18 11:58:26 +02:00
// Look for a record with this IP Address
$id_address = (int) get_db_value ('id_a', 'taddress', 'ip', $ip_address);
if ($id_address === 0) {
2007-04-18 Sancho Lerena <slerena@artica.es> * include/styles/pandora.css: Added frame and changed basic form input styles (fixed the old problem with radio and checkboxes). * include/functions_db.php: Finished function agent_add_address(). Added functions: agent_delete_address(), give_agent_address() and give_agent_address_from_list(). * include/languages/language_en.php: More strings ! * include/functions.php: Added numeric render for graph Y scale and for numeric data output in screen: format_for_graph(). * pandoradb.sql: Several small fixes and cleanup (deleted drop check). * operation/agentes/estado_alertas.php: Fixed old bug with visualization of alerts (min/max) vs (max/min). Now alert is a real value, not integer. * operation/agentes/datos_agente.php: Better render for numeric (float) data. * operation/agentes/estado_ultimopaquete.php: Better render for numeric (float) data and fixed a small costemic bug. * operation/agentes/estado_generalagente.php: Fixed a small costemic bug, list of ip's have some white space before and this have better visualization for user due to combo style stripping some space. * reporting/fgraph.php: Graph improvement: graphs now could show alerts associated to an agent and draw alert limits. Preprocessor function is now used to render axis label with (M,K) symbols and decimal commas. Title and subtitle has been improved. * reporting/stat_win.php: Graph menu improvement. Fully completed work. This should work for final version without more changes. * godmode/agentes/agent_template.php: Template/Wizard module assigment form for agent. * godmode/agentes/alert_manager.php: Several fixes (links) and alert max/min render. * godmode/agentes/configurar_agente.php: Fixed several navitation bugs. Added agent ip addition/deletion code. * godmode/agentes/agent_manager.php: Address list management code. * godmode/modules/module_list.php: Deleted link to "module type editor" and create button: This has no sense since there is no moduletype editor yet :-) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-18 11:58:26 +02:00
// Create IP address in tadress table
$sql = sprintf("INSERT INTO taddress (ip) VALUES ('%s')",$ip_address);
$id_address = process_sql ($sql, "insert_id");
}
2007-04-18 Sancho Lerena <slerena@artica.es> * include/styles/pandora.css: Added frame and changed basic form input styles (fixed the old problem with radio and checkboxes). * include/functions_db.php: Finished function agent_add_address(). Added functions: agent_delete_address(), give_agent_address() and give_agent_address_from_list(). * include/languages/language_en.php: More strings ! * include/functions.php: Added numeric render for graph Y scale and for numeric data output in screen: format_for_graph(). * pandoradb.sql: Several small fixes and cleanup (deleted drop check). * operation/agentes/estado_alertas.php: Fixed old bug with visualization of alerts (min/max) vs (max/min). Now alert is a real value, not integer. * operation/agentes/datos_agente.php: Better render for numeric (float) data. * operation/agentes/estado_ultimopaquete.php: Better render for numeric (float) data and fixed a small costemic bug. * operation/agentes/estado_generalagente.php: Fixed a small costemic bug, list of ip's have some white space before and this have better visualization for user due to combo style stripping some space. * reporting/fgraph.php: Graph improvement: graphs now could show alerts associated to an agent and draw alert limits. Preprocessor function is now used to render axis label with (M,K) symbols and decimal commas. Title and subtitle has been improved. * reporting/stat_win.php: Graph menu improvement. Fully completed work. This should work for final version without more changes. * godmode/agentes/agent_template.php: Template/Wizard module assigment form for agent. * godmode/agentes/alert_manager.php: Several fixes (links) and alert max/min render. * godmode/agentes/configurar_agente.php: Fixed several navitation bugs. Added agent ip addition/deletion code. * godmode/agentes/agent_manager.php: Address list management code. * godmode/modules/module_list.php: Deleted link to "module type editor" and create button: This has no sense since there is no moduletype editor yet :-) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-18 11:58:26 +02:00
// Add address to agent
$sql = sprintf("INSERT INTO taddress_agent
2007-04-18 Sancho Lerena <slerena@artica.es> * include/styles/pandora.css: Added frame and changed basic form input styles (fixed the old problem with radio and checkboxes). * include/functions_db.php: Finished function agent_add_address(). Added functions: agent_delete_address(), give_agent_address() and give_agent_address_from_list(). * include/languages/language_en.php: More strings ! * include/functions.php: Added numeric render for graph Y scale and for numeric data output in screen: format_for_graph(). * pandoradb.sql: Several small fixes and cleanup (deleted drop check). * operation/agentes/estado_alertas.php: Fixed old bug with visualization of alerts (min/max) vs (max/min). Now alert is a real value, not integer. * operation/agentes/datos_agente.php: Better render for numeric (float) data. * operation/agentes/estado_ultimopaquete.php: Better render for numeric (float) data and fixed a small costemic bug. * operation/agentes/estado_generalagente.php: Fixed a small costemic bug, list of ip's have some white space before and this have better visualization for user due to combo style stripping some space. * reporting/fgraph.php: Graph improvement: graphs now could show alerts associated to an agent and draw alert limits. Preprocessor function is now used to render axis label with (M,K) symbols and decimal commas. Title and subtitle has been improved. * reporting/stat_win.php: Graph menu improvement. Fully completed work. This should work for final version without more changes. * godmode/agentes/agent_template.php: Template/Wizard module assigment form for agent. * godmode/agentes/alert_manager.php: Several fixes (links) and alert max/min render. * godmode/agentes/configurar_agente.php: Fixed several navitation bugs. Added agent ip addition/deletion code. * godmode/agentes/agent_manager.php: Address list management code. * godmode/modules/module_list.php: Deleted link to "module type editor" and create button: This has no sense since there is no moduletype editor yet :-) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-18 11:58:26 +02:00
(id_a, id_agent) VALUES
(%d, %d)",$id_address, $id_agent);
process_sql ($sql);
2007-04-18 Sancho Lerena <slerena@artica.es> * include/styles/pandora.css: Added frame and changed basic form input styles (fixed the old problem with radio and checkboxes). * include/functions_db.php: Finished function agent_add_address(). Added functions: agent_delete_address(), give_agent_address() and give_agent_address_from_list(). * include/languages/language_en.php: More strings ! * include/functions.php: Added numeric render for graph Y scale and for numeric data output in screen: format_for_graph(). * pandoradb.sql: Several small fixes and cleanup (deleted drop check). * operation/agentes/estado_alertas.php: Fixed old bug with visualization of alerts (min/max) vs (max/min). Now alert is a real value, not integer. * operation/agentes/datos_agente.php: Better render for numeric (float) data. * operation/agentes/estado_ultimopaquete.php: Better render for numeric (float) data and fixed a small costemic bug. * operation/agentes/estado_generalagente.php: Fixed a small costemic bug, list of ip's have some white space before and this have better visualization for user due to combo style stripping some space. * reporting/fgraph.php: Graph improvement: graphs now could show alerts associated to an agent and draw alert limits. Preprocessor function is now used to render axis label with (M,K) symbols and decimal commas. Title and subtitle has been improved. * reporting/stat_win.php: Graph menu improvement. Fully completed work. This should work for final version without more changes. * godmode/agentes/agent_template.php: Template/Wizard module assigment form for agent. * godmode/agentes/alert_manager.php: Several fixes (links) and alert max/min render. * godmode/agentes/configurar_agente.php: Fixed several navitation bugs. Added agent ip addition/deletion code. * godmode/agentes/agent_manager.php: Address list management code. * godmode/modules/module_list.php: Deleted link to "module type editor" and create button: This has no sense since there is no moduletype editor yet :-) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-18 11:58:26 +02:00
}
/**
* Unassign an IP address from an agent.
*
* @param int Agent id
* @param string IP address to unassign
*/
2007-04-18 Sancho Lerena <slerena@artica.es> * include/styles/pandora.css: Added frame and changed basic form input styles (fixed the old problem with radio and checkboxes). * include/functions_db.php: Finished function agent_add_address(). Added functions: agent_delete_address(), give_agent_address() and give_agent_address_from_list(). * include/languages/language_en.php: More strings ! * include/functions.php: Added numeric render for graph Y scale and for numeric data output in screen: format_for_graph(). * pandoradb.sql: Several small fixes and cleanup (deleted drop check). * operation/agentes/estado_alertas.php: Fixed old bug with visualization of alerts (min/max) vs (max/min). Now alert is a real value, not integer. * operation/agentes/datos_agente.php: Better render for numeric (float) data. * operation/agentes/estado_ultimopaquete.php: Better render for numeric (float) data and fixed a small costemic bug. * operation/agentes/estado_generalagente.php: Fixed a small costemic bug, list of ip's have some white space before and this have better visualization for user due to combo style stripping some space. * reporting/fgraph.php: Graph improvement: graphs now could show alerts associated to an agent and draw alert limits. Preprocessor function is now used to render axis label with (M,K) symbols and decimal commas. Title and subtitle has been improved. * reporting/stat_win.php: Graph menu improvement. Fully completed work. This should work for final version without more changes. * godmode/agentes/agent_template.php: Template/Wizard module assigment form for agent. * godmode/agentes/alert_manager.php: Several fixes (links) and alert max/min render. * godmode/agentes/configurar_agente.php: Fixed several navitation bugs. Added agent ip addition/deletion code. * godmode/agentes/agent_manager.php: Address list management code. * godmode/modules/module_list.php: Deleted link to "module type editor" and create button: This has no sense since there is no moduletype editor yet :-) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-18 11:58:26 +02:00
function agent_delete_address ($id_agent, $ip_address) {
global $config;
$sql = sprintf ("SELECT id_ag FROM taddress_agent, taddress
WHERE taddress_agent.id_a = taddress.id_a AND ip = '%s'
AND id_agent = %d",$ip_address, $id_agent);
$id_ag = get_db_sql ($sql);
if ($id_ag !== false) {
$sql = sprintf ("DELETE FROM taddress_agent WHERE id_ag = %d",$id_ag);
process_sql ($sql);
}
2009-11-27 Sancho lerena <slerena@artica.es> * operation/menu.php: User section has no ACL check, always can be seen. * index.php: Added suppor for user-defined custom language (this code was on my disk for 3 months, pending to be commited!). * include/functions_db.php, * include/functions_agents.php, * godmode/alerts/alert_list.php, * godmode/agentes/modificar_agente.php, * godmode/agentes/configurar_agente.php: Added audit calls to several management operations who don't have or have insufficient audit info. * godmode/users/configure_user.php: Fixed several annoyings bugs. Added custom language support, and added more audit info on management operations. * godmode/users/user_list.php: More audit info. * include/config_process.php: Add new debug option to render error log to /pandora_console.log. Also set timezone if not defined (this makes warnings on several PHP 5.x setups). Added user custom language support. * include/functions_events.php: More audit info. Fixed problems with HTML encoding render. * functions_io.php: Some cleaning. * include/functions_messages.php: Fixed problems with HTML encoding render. * functions_ui.php: Fixed problems with HTML encoding render in print_string_substr() function. * auth/mysql.php: is_user_admin() functions seems to be broken ¿?¿!. Fixed. * styles/pandora.css: removed green colored left border in default style. * message.php, incident*: Fixed problems with HTML encoding render. * user.php: Better ACL check before let user to view/edit another user. * user_edit: Removed some un-used form fields, some arrangements in layout, and FIXED forever problems with password change (new code written). * users/user_statistics.php: Now user can see its own audit records. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2139 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-11-27 21:02:12 +01:00
$agent_name = get_agent_name($id_agent, "");
audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "Agent management",
2009-11-27 Sancho lerena <slerena@artica.es> * operation/menu.php: User section has no ACL check, always can be seen. * index.php: Added suppor for user-defined custom language (this code was on my disk for 3 months, pending to be commited!). * include/functions_db.php, * include/functions_agents.php, * godmode/alerts/alert_list.php, * godmode/agentes/modificar_agente.php, * godmode/agentes/configurar_agente.php: Added audit calls to several management operations who don't have or have insufficient audit info. * godmode/users/configure_user.php: Fixed several annoyings bugs. Added custom language support, and added more audit info on management operations. * godmode/users/user_list.php: More audit info. * include/config_process.php: Add new debug option to render error log to /pandora_console.log. Also set timezone if not defined (this makes warnings on several PHP 5.x setups). Added user custom language support. * include/functions_events.php: More audit info. Fixed problems with HTML encoding render. * functions_io.php: Some cleaning. * include/functions_messages.php: Fixed problems with HTML encoding render. * functions_ui.php: Fixed problems with HTML encoding render in print_string_substr() function. * auth/mysql.php: is_user_admin() functions seems to be broken ¿?¿!. Fixed. * styles/pandora.css: removed green colored left border in default style. * message.php, incident*: Fixed problems with HTML encoding render. * user.php: Better ACL check before let user to view/edit another user. * user_edit: Removed some un-used form fields, some arrangements in layout, and FIXED forever problems with password change (new code written). * users/user_statistics.php: Now user can see its own audit records. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2139 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-11-27 21:02:12 +01:00
"Deleted IP $ip_address from agent '$agent_name'");
// Need to change main address?
if (get_agent_address ($id_agent) == $ip_address) {
$new_ips = get_agent_addresses ($id_agent);
// Change main address in agent to first one in the list
$query = sprintf ("UPDATE tagente SET `direccion` = '%s' WHERE id_agente = %d", current ($new_ips), $id_agent);
process_sql ($query);
2007-04-18 Sancho Lerena <slerena@artica.es> * include/styles/pandora.css: Added frame and changed basic form input styles (fixed the old problem with radio and checkboxes). * include/functions_db.php: Finished function agent_add_address(). Added functions: agent_delete_address(), give_agent_address() and give_agent_address_from_list(). * include/languages/language_en.php: More strings ! * include/functions.php: Added numeric render for graph Y scale and for numeric data output in screen: format_for_graph(). * pandoradb.sql: Several small fixes and cleanup (deleted drop check). * operation/agentes/estado_alertas.php: Fixed old bug with visualization of alerts (min/max) vs (max/min). Now alert is a real value, not integer. * operation/agentes/datos_agente.php: Better render for numeric (float) data. * operation/agentes/estado_ultimopaquete.php: Better render for numeric (float) data and fixed a small costemic bug. * operation/agentes/estado_generalagente.php: Fixed a small costemic bug, list of ip's have some white space before and this have better visualization for user due to combo style stripping some space. * reporting/fgraph.php: Graph improvement: graphs now could show alerts associated to an agent and draw alert limits. Preprocessor function is now used to render axis label with (M,K) symbols and decimal commas. Title and subtitle has been improved. * reporting/stat_win.php: Graph menu improvement. Fully completed work. This should work for final version without more changes. * godmode/agentes/agent_template.php: Template/Wizard module assigment form for agent. * godmode/agentes/alert_manager.php: Several fixes (links) and alert max/min render. * godmode/agentes/configurar_agente.php: Fixed several navitation bugs. Added agent ip addition/deletion code. * godmode/agentes/agent_manager.php: Address list management code. * godmode/modules/module_list.php: Deleted link to "module type editor" and create button: This has no sense since there is no moduletype editor yet :-) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-18 11:58:26 +02:00
}
}
/**
* Get address of an agent.
*
* @param int Agent id
*
* @return string The address of the given agent
*/
function get_agent_address ($id_agent) {
return (string) get_db_value ('direccion', 'tagente', 'id_agente', (int) $id_agent);
2007-04-18 Sancho Lerena <slerena@artica.es> * include/styles/pandora.css: Added frame and changed basic form input styles (fixed the old problem with radio and checkboxes). * include/functions_db.php: Finished function agent_add_address(). Added functions: agent_delete_address(), give_agent_address() and give_agent_address_from_list(). * include/languages/language_en.php: More strings ! * include/functions.php: Added numeric render for graph Y scale and for numeric data output in screen: format_for_graph(). * pandoradb.sql: Several small fixes and cleanup (deleted drop check). * operation/agentes/estado_alertas.php: Fixed old bug with visualization of alerts (min/max) vs (max/min). Now alert is a real value, not integer. * operation/agentes/datos_agente.php: Better render for numeric (float) data. * operation/agentes/estado_ultimopaquete.php: Better render for numeric (float) data and fixed a small costemic bug. * operation/agentes/estado_generalagente.php: Fixed a small costemic bug, list of ip's have some white space before and this have better visualization for user due to combo style stripping some space. * reporting/fgraph.php: Graph improvement: graphs now could show alerts associated to an agent and draw alert limits. Preprocessor function is now used to render axis label with (M,K) symbols and decimal commas. Title and subtitle has been improved. * reporting/stat_win.php: Graph menu improvement. Fully completed work. This should work for final version without more changes. * godmode/agentes/agent_template.php: Template/Wizard module assigment form for agent. * godmode/agentes/alert_manager.php: Several fixes (links) and alert max/min render. * godmode/agentes/configurar_agente.php: Fixed several navitation bugs. Added agent ip addition/deletion code. * godmode/agentes/agent_manager.php: Address list management code. * godmode/modules/module_list.php: Deleted link to "module type editor" and create button: This has no sense since there is no moduletype editor yet :-) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-18 11:58:26 +02:00
}
/**
* Get the agent that matches an IP address
*
* @param string IP address to get the agents.
*
* @return mixed The agent that has the IP address given. False if none were found.
*/
function get_agent_with_ip ($ip_address) {
$sql = sprintf ('SELECT tagente.*
FROM tagente, taddress, taddress_agent
WHERE tagente.id_agente = taddress_agent.id_agent
AND taddress_agent.id_a = taddress.id_a
AND ip = "%s"', $ip_address);
return get_db_row_sql ($sql);
}
/**
* Get all IP addresses of an agent
*
* @param int Agent id
*
* @return array Array with the IP address of the given agent or an empty array.
*/
function get_agent_addresses ($id_agent) {
$sql = sprintf ("SELECT ip FROM taddress_agent, taddress
2007-04-18 Sancho Lerena <slerena@artica.es> * include/styles/pandora.css: Added frame and changed basic form input styles (fixed the old problem with radio and checkboxes). * include/functions_db.php: Finished function agent_add_address(). Added functions: agent_delete_address(), give_agent_address() and give_agent_address_from_list(). * include/languages/language_en.php: More strings ! * include/functions.php: Added numeric render for graph Y scale and for numeric data output in screen: format_for_graph(). * pandoradb.sql: Several small fixes and cleanup (deleted drop check). * operation/agentes/estado_alertas.php: Fixed old bug with visualization of alerts (min/max) vs (max/min). Now alert is a real value, not integer. * operation/agentes/datos_agente.php: Better render for numeric (float) data. * operation/agentes/estado_ultimopaquete.php: Better render for numeric (float) data and fixed a small costemic bug. * operation/agentes/estado_generalagente.php: Fixed a small costemic bug, list of ip's have some white space before and this have better visualization for user due to combo style stripping some space. * reporting/fgraph.php: Graph improvement: graphs now could show alerts associated to an agent and draw alert limits. Preprocessor function is now used to render axis label with (M,K) symbols and decimal commas. Title and subtitle has been improved. * reporting/stat_win.php: Graph menu improvement. Fully completed work. This should work for final version without more changes. * godmode/agentes/agent_template.php: Template/Wizard module assigment form for agent. * godmode/agentes/alert_manager.php: Several fixes (links) and alert max/min render. * godmode/agentes/configurar_agente.php: Fixed several navitation bugs. Added agent ip addition/deletion code. * godmode/agentes/agent_manager.php: Address list management code. * godmode/modules/module_list.php: Deleted link to "module type editor" and create button: This has no sense since there is no moduletype editor yet :-) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-18 11:58:26 +02:00
WHERE taddress_agent.id_a = taddress.id_a
AND id_agent = %d", $id_agent);
$ips = get_db_all_rows_sql ($sql);
if ($ips === false) {
$ips = array ();
}
$ret_arr = array ();
foreach ($ips as $row) {
$ret_arr[$row["ip"]] = $row["ip"];
}
return $ret_arr;
}
/**
* Get agent id from an agent module.
*
* @param int Id of the agent module.
*
* @return int The agent if of the given module.
*/
function give_agent_id_from_module_id ($id_agent_module) {
return (int) get_db_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
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
}
$sql_cache = array ('saved' => 0);
/**
* Get the first value of the first row of a table in the database.
*
* @param string Field name to get
* @param string Table to retrieve the data
* @param string Field to filter elements
* @param string Condition the field must have
*
* @return mixed Value of first column of the first row. False if there were no row.
*/
function get_db_value ($field, $table, $field_search = 1, $condition = 1, $search_history_db = false) {
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
if (is_int ($condition)) {
$sql = sprintf ("SELECT %s FROM %s WHERE %s = %d LIMIT 1",
$field, $table, $field_search, $condition);
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
} else if (is_float ($condition) || is_double ($condition)) {
$sql = sprintf ("SELECT %s FROM %s WHERE %s = %f LIMIT 1",
$field, $table, $field_search, $condition);
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
} else {
$sql = sprintf ("SELECT %s FROM %s WHERE %s = '%s' LIMIT 1",
$field, $table, $field_search, $condition);
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
$result = get_db_all_rows_sql ($sql, $search_history_db);
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
if ($result === false)
return false;
if ($field[0] == '`')
$field = str_replace ('`', '', $field);
return $result[0][$field];
2008-04-01 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: Alert type 0 is not 1. 1-3 are reserved. Removed prediction module (nosense since it uses normal modules). * include/functions_db.php: Added wrapper give_db_value to get_db_value because A LOT of code uses old syntax and this makes too many errors. * include/functions.php: Fixed pagination issues with blocksize config. * pandoradb.sql: Change alert command lenght and added some comments for future implementation of alert criticity and others. * operation/incidents/incident.php: Fixed some bugs calling to old funcions / variables. * operation/events/events.php: Fixed some bugs calling to old funcions / variables. Removed graph and simplified header. * operation/agentes/estado_alertas.php: Changed get_db_value call and removed (Raul) button to create alert from here. * operation/agentes/estado_grupo.php: Implemented support for optional view of down modules and fired alerts. * operation/agentes/ver_agente.php, operation/agentes/datos_agente.php: Uses of new get_db_value and new session id variable. * images/mod_async_string.png: Added image. * images/mod_async_inc.png: Added image. * images/mod_image_png.png: Added image. * images/mod_async_data.png: Added image. * images/mod_async_proc.png: Added image. * images/mod_image_jpg.png: Added image. * godmode/setup/setup.php: Several fixes. * godmode/agentes/alert_manager.php: Several changes for new alert manager. Not finished. Interim commit. * godmode/agentes/configurar_agente.php: More changes needed to alert editor. * godmode/agentes/alert_manager_editor.php: New file for alert management. * godmode/modules/module_list.php: Some updates, removed invalid column. * godmode/alerts/modify_alert.php: Alert types < 4 cannot be modified (this includes combined, internal audit and Pandora FMS log). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@783 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-01 15:53:11 +02:00
}
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
/**
* Get the first value of the first row of a table in the database from an
* array with filter conditions.
*
* Example:
<code>
get_db_value_filter ('name', 'talert_templates',
array ('value' => 2, 'type' => 'equal'));
// Equivalent to:
// SELECT name FROM talert_templates WHERE value = 2 AND type = 'equal' LIMIT 1
get_db_value_filter ('description', 'talert_templates',
array ('name' => 'My alert', 'type' => 'regex'), 'OR');
// Equivalent to:
// SELECT description FROM talert_templates WHERE name = 'My alert' OR type = 'equal' LIMIT 1
</code>
*
* @param string Field name to get
* @param string Table to retrieve the data
* @param array Conditions to filter the element. See format_array_to_where_clause_sql()
* for the format
* @param string Join operator for the elements in the filter.
*
* @return mixed Value of first column of the first row. False if there were no row.
*/
function get_db_value_filter ($field, $table, $filter, $where_join = 'AND') {
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
if (! is_array ($filter) || empty ($filter))
return false;
/* Avoid limit and offset if given */
unset ($filter['limit']);
unset ($filter['offset']);
$sql = sprintf ("SELECT %s FROM %s WHERE %s LIMIT 1",
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
$field, $table,
format_array_to_where_clause_sql ($filter, $where_join));
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
$result = get_db_all_rows_sql ($sql);
if ($result === false)
return false;
$fieldClean = str_replace('`', '', $field);
return $result[0][$fieldClean];
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
}
/**
* Get the first value of the first row of a table result from query.
*
* @param string SQL select statement to execute.
*
* @return the first value of the first row of a table result from query.
*
*/
function get_db_value_sql ($sql) {
$sql .= " LIMIT 1";
$result = get_db_all_rows_sql ($sql);
if($result === false)
return false;
foreach ($result[0] as $f)
return $f;
}
/**
* Get the first row of an SQL database query.
*
* @param string SQL select statement to execute.
*
* @return mixed The first row of the result or false
*/
function get_db_row_sql ($sql, $search_history_db = false) {
$sql .= " LIMIT 1";
$result = get_db_all_rows_sql ($sql, $search_history_db);
if($result === false)
return false;
return $result[0];
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
}
/**
* Get the first row of a database query into a table.
*
* The SQL statement executed would be something like:
* "SELECT (*||$fields) FROM $table WHERE $field_search = $condition"
*
* @param string Table to get the row
* @param string Field to filter elements
* @param string Condition the field must have.
* @param mixed Fields to select (array or string or false/empty for *)
*
* @return mixed The first row of a database query or false.
*/
function get_db_row ($table, $field_search, $condition, $fields = false) {
if (empty ($fields)) {
$fields = '*';
} else {
if (is_array ($fields))
$fields = implode (',', $fields);
else if (! is_string ($fields))
return false;
}
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
if (is_int ($condition)) {
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = %d LIMIT 1",
$fields, $table, $field_search, $condition);
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
} else if (is_float ($condition) || is_double ($condition)) {
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = %f LIMIT 1",
$fields, $table, $field_search, $condition);
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
} else {
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = '%s' LIMIT 1",
$fields, $table, $field_search, $condition);
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
$result = get_db_all_rows_sql ($sql);
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
if ($result === false)
return false;
return $result[0];
}
/**
* Get the row of a table in the database using a complex filter.
*
* @param string Table to retrieve the data (warning: not cleaned)
* @param mixed Filters elements. It can be an indexed array
* (keys would be the field name and value the expected value, and would be
* joined with an AND operator) or a string, including any SQL clause (without
* the WHERE keyword). Example:
<code>
Both are similars:
get_db_row_filter ('table', array ('disabled', 0));
get_db_row_filter ('table', 'disabled = 0');
Both are similars:
get_db_row_filter ('table', array ('disabled' => 0, 'history_data' => 0), 'name, description', 'OR');
get_db_row_filter ('table', 'disabled = 0 OR history_data = 0', 'name, description');
get_db_row_filter ('table', array ('disabled' => 0, 'history_data' => 0), array ('name', 'description'), 'OR');
</code>
* @param mixed Fields of the table to retrieve. Can be an array or a coma
* separated string. All fields are retrieved by default
* @param string Condition to join the filters (AND, OR).
*
* @return mixed Array of the row or false in case of error.
*/
function get_db_row_filter ($table, $filter, $fields = false, $where_join = 'AND') {
if (empty ($fields)) {
$fields = '*';
} else {
if (is_array ($fields))
$fields = implode (',', $fields);
else if (! is_string ($fields))
return false;
}
if (is_array ($filter))
$filter = format_array_to_where_clause_sql ($filter, $where_join, ' WHERE ');
else if (is_string ($filter))
$filter = 'WHERE '.$filter;
else
$filter = '';
$sql = sprintf ('SELECT %s FROM %s %s',
$fields, $table, $filter);
return get_db_row_sql ($sql);
}
/**
* Get a single field in the databse from a SQL query.
*
* @param string SQL statement to execute
* @param mixed Field number or row to get, beggining by 0. Default: 0
*
* @return mixed The selected field of the first row in a select statement.
*/
function get_db_sql ($sql, $field = 0, $search_history_db = false) {
$result = get_db_all_rows_sql ($sql, $search_history_db);
if($result === false)
return false;
$ax = 0;
foreach ($result[0] as $f){
if ($field == $ax)
return $f;
$ax++;
}
}
2007-05-20 Sancho Lerena <slerena@artica.es> * pandoradb_data.sql: Uptated network component data. * include/styles/pandora.css: Few updates for style. * include/functions_db.php: Added functions for visual console features. * include/languages/language_en.php: New strings. * include/javascript: Moved all javascript files here. * include/javascript/x_slide.js, include/javascript/x_event.js: Copied from branch / console from Azabel. * include/javascript/wz_jsgraphics.js: New functions to draw lines. * pandoradb.sql: Created new tlayout and tlayout_data tables. * index.php: Small changes. Added support to refresh any page via POST. * operation/visual_console: Added Visual Console feature. * operation/agentes/estado_alertas.php: Updated styles and fixes damm bug when no alert available. * operation/agentes/status_monitor.php: Updated styles. * operation/agentes/estado_generalagente.php: Update styles. * operation/agentes/estado_agente.php: Updated style. * operation/servers/view_server.php: Updated style. * operation/reporting/graph_builder.php: Fixed some minor bugs. Needs to fix more bugs :( * operation/menu.php: Updated menu. Visual Console has dynamic items!. * images/pandora_logo_head.png: New header logo ! * images/pandora_logo.png: New Pandora FMS 1.3 logo ! :-)) * images/console/background: More samples added. * images/console/icons: Icons to be used in visual console. * reporting/fgraph.php: New feature added to simple graph to show only average values. * reporting/stat_win.php: Added support to avg_only and show avg, max and min values from each graph. Zoom factor is more usable now. * general/logoff.php: New style. * general/footer.php: Fixed style. * general/logon_failed.php: Fixed style. * general/login_page.php: New style. * general/header.php: Fixed style. * godmode/agentes/configurar_agente.php: Fixed styles. * godmode/agentes/agent_manager.php: Fixed styles. * operation/active_console: Removed from trunk: not ready to be used. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@459 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-05-20 19:12:31 +02:00
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
/**
* Get all the result rows using an SQL statement.
*
* @param string SQL statement to execute.
* @param bool If want to search in history database also
* @param bool If want to use cache (true by default)
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
*
* @return mixed A matrix with all the values returned from the SQL statement or
* false in case of empty result
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
*/
function get_db_all_rows_sql ($sql, $search_history_db = false, $cache = true) {
global $config;
$history = array ();
// To disable globally SQL cache depending on global variable.
// Used in several critical places like Metaconsole trans-server queries
if (isset($config["dbcache"]))
$cache = $config["dbcache"];
// Read from the history DB if necessary
if ($search_history_db) {
$cache = false;
$history = false;
if (isset($config['history_db_connection']))
$history = process_sql ($sql, 'affected_rows', $config['history_db_connection'], false);
if ($history === false) {
$history = array ();
}
}
$return = process_sql ($sql, 'affected_rows', $config['dbconnection'], $cache);
if ($return === false) {
return false;
}
// Append result to the history DB data
if (! empty ($return)) {
foreach ($return as $row) {
array_push ($history, $row);
}
}
if (! empty ($history))
return $history;
//Return false, check with === or !==
return false;
}
/**
* Get all the rows of a table in the database that matches a filter.
*
* @param string Table to retrieve the data (warning: not cleaned)
* @param mixed Filters elements. It can be an indexed array
* (keys would be the field name and value the expected value, and would be
* joined with an AND operator) or a string, including any SQL clause (without
* the WHERE keyword). Example:
2009-08-24 Miguel de Dios <miguel.dedios@artica.es> * include/functions_menu.php, include/functions_html.php, include/functions_events.php, include/functions_messages.php, include/functions_modules.php, include/functions_exportserver.php, include/functions_reporting.php, include/functions_filemanager.php, include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php, include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php, include/functions_networkmap.php, include/functions_servers.php, include/FusionCharts/FusionCharts_Gen.php, include/FusionCharts/FusionCharts.php, include/functions_network_profiles.php, include/gettext.php, include/functions_network_components.php, include/functions_visual_map.php, include/fgraph2.php, include/Image/image_functions.php, include/functions_config.php, include/help/en/help_plugin_parameters.php, include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php, include/help/en/help_postprocess.php, include/help/en/help_prediction_source_module.php, include/help/en/help_date_format.php, include/help/en/help_recontask.php, include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php, include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php, include/help/en/help_agent_status.php, include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php, include/help/en/help_alert_type.php, include/help/en/help_network_component.php, include/help/en/help_time_stamp-comparation.php, include/help/en/help_eventview.php, include/help/en/help_timesource.php, include/help/en/help_alert_validation.php, include/help/en/help_map_builder.php, include/help/en/help_alert_recovery.php, include/help/en/help_module_type.php, include/help/en/help_planned_downtime.php, include/help/en/help_serverlag.php, include/help/en/help_alerts.php, include/help/en/help_snmpwalk.php, include/help/en/help_module_definition.php, include/help/en/help_plugin_definition.php, include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php include/help/en/help_manageconfig.php, include/help/es/help_alert_validation.php, include/help/es/help_plugin_parameters.php, include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php, include/help/es/help_map_builder.php, include/help/es/help_postprocess.php, include/help/es/help_date_format.php, include/help/es/help_alert_recovery.php, include/help/es/help_prediction_source_module.php, include/help/es/help_module_type.php, include/help/es/help_planned_downtime.php, include/help/es/help_alert-matches.php, include/help/es/help_recontask.php, include/help/es/help_alerts.php, include/help/es/help_serverlag.php, include/help/es/help_snmpwalk.php, include/help/es/help_module_definition.php, include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php, include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php, include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php, include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php, include/help/es/help_wminamespace.php, include/help/es/help_network_component.php, include/help/es/help_time_stamp-comparation.php, include/help/es/help_manageconfig.php, include/help/es/help_timesource.php, include/config_process.php, include/functions_ui.php, include/htmlawed.php, include/functions_custom_graphs.php, include/fgraph.php, include/functions_incidents.php, include/functions.php, include/functions_agents.php, include/functions_db.php, include/functions_themes.php, include/streams.php, include/functions_fsgraph.php, include/functions_alerts.php, include/functions_reports.php, include/functions_extensions.php, include/functions_ui_renders.php: change comments blocks for delete the warnings to construct phpDoc Files, give a struct and order in the phpDoc files. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
* <code>
* Both are similars:
* get_db_all_rows_filter ('table', array ('disabled', 0));
* get_db_all_rows_filter ('table', 'disabled = 0');
*
* Both are similars:
* get_db_all_rows_filter ('table', array ('disabled' => 0, 'history_data' => 0), 'name', 'OR');
* get_db_all_rows_filter ('table', 'disabled = 0 OR history_data = 0', 'name');
* </code>
* @param mixed Fields of the table to retrieve. Can be an array or a coma
* separated string. All fields are retrieved by default
* @param string Condition of the filter (AND, OR).
* @param bool $returnSQL Return a string with SQL instead the data, by default false.
*
* @return mixed Array of the row or false in case of error.
*/
function get_db_all_rows_filter ($table, $filter = array(), $fields = false, $where_join = 'AND', $search_history_db = false, $returnSQL = false) {
//TODO: Validate and clean fields
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
if (empty ($fields)) {
$fields = '*';
} elseif (is_array ($fields)) {
$fields = implode (',', $fields);
} elseif (! is_string ($fields)) {
return false;
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
}
//TODO: Validate and clean filter options
if (is_array ($filter)) {
$filter = format_array_to_where_clause_sql ($filter, $where_join, ' WHERE ');
} elseif (is_string ($filter)) {
$filter = 'WHERE '.$filter;
} else {
$filter = '';
}
$sql = sprintf ('SELECT %s FROM %s %s', $fields, $table, $filter);
if ($returnSQL)
return $sql;
else
return get_db_all_rows_sql ($sql, $search_history_db);
}
/**
* Get row by row the DB by SQL query. The first time pass the SQL query and
* rest of times pass none for iterate in table and extract row by row, and
* the end return false.
*
* @param bool $new Default true, if true start to query.
* @param resource $result The resource of mysql for access to query.
* @param string $sql
* @return mixed The row or false in error.
*/
function get_db_all_row_by_steps_sql($new = true, &$result, $sql = null) {
if ($new == true)
$result = mysql_query($sql);
return mysql_fetch_assoc($result);
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
}
/**
* Return the count of rows of query.
*
* @param $sql
* @return integer The count of rows of query.
*/
function get_db_num_rows ($sql) {
$result = mysql_query($sql);
return mysql_num_rows($result);
}
/**
* Error handler function when an SQL error is triggered.
*
* @param int Level of the error raised (not used, but required by set_error_handler()).
* @param string Contains the error message.
*
* @return bool True if error level is lower or equal than errno.
*/
function sql_error_handler ($errno, $errstr) {
global $config;
/* If debug is activated, this will also show the backtrace */
if (debug ($errstr))
return false;
if (error_reporting () <= $errno)
return false;
echo "<strong>SQL error</strong>: ".$errstr."<br />\n";
return true;
}
/**
* Add a database query to the debug trace.
*
* This functions does nothing if the config['debug'] flag is not set. If a
* sentence was repeated, then the 'saved' counter is incremented.
*
* @param string SQL sentence.
* @param mixed Query result. On error, error string should be given.
* @param int Affected rows after running the query.
* @param mixed Extra parameter for future values.
*/
function add_database_debug_trace ($sql, $result = false, $affected = false, $extra = false) {
global $config;
if (! isset ($config['debug']))
return false;
if (! isset ($config['db_debug']))
$config['db_debug'] = array ();
if (isset ($config['db_debug'][$sql])) {
$config['db_debug'][$sql]['saved']++;
return;
}
$var = array ();
$var['sql'] = $sql;
$var['result'] = $result;
$var['affected'] = $affected;
$var['saved'] = 0;
$var['extra'] = $extra;
$config['db_debug'][$sql] = $var;
}
/**
* Clean the cache for to have errors and ghost rows when you do "select <table>",
* "delete <table>" and "select <table>".
*
* @return None
*/
function clean_cache() {
global $sql_cache;
$sql_cache = array ('saved' => 0);
}
/**
* This function comes back with an array in case of SELECT
* in case of UPDATE, DELETE etc. with affected rows
* an empty array in case of SELECT without results
* Queries that return data will be cached so queries don't get repeated
*
* @param string SQL statement to execute
*
* @param string What type of info to return in case of INSERT/UPDATE.
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
* 'affected_rows' will return mysql_affected_rows (default value)
* 'insert_id' will return the ID of an autoincrement value
* 'info' will return the full (debug) information of a query
*
* @return mixed An array with the rows, columns and values in a multidimensional array or false in error
*/
function process_sql ($sql, $rettype = "affected_rows", $dbconnection = '', $cache = true) {
global $config;
global $sql_cache;
$retval = array();
if ($sql == '')
return false;
if ($cache && ! empty ($sql_cache[$sql])) {
$retval = $sql_cache[$sql];
$sql_cache['saved']++;
add_database_debug_trace ($sql);
}
else {
$start = microtime (true);
if ($dbconnection == '') {
$result = mysql_query ($sql);
}
else {
$result = mysql_query ($sql, $dbconnection);
}
$time = microtime (true) - $start;
if ($result === false) {
$backtrace = debug_backtrace ();
$error = sprintf ('%s (\'%s\') in <strong>%s</strong> on line %d',
mysql_error (), $sql, $backtrace[0]['file'], $backtrace[0]['line']);
add_database_debug_trace ($sql, mysql_error ());
set_error_handler ('sql_error_handler');
trigger_error ($error);
restore_error_handler ();
return false;
}
elseif ($result === true) {
if ($rettype == "insert_id") {
$result = mysql_insert_id ();
}
elseif ($rettype == "info") {
$result = mysql_info ();
}
else {
$result = mysql_affected_rows ();
}
add_database_debug_trace ($sql, $result, mysql_affected_rows (),
array ('time' => $time));
return $result;
}
else {
add_database_debug_trace ($sql, 0, mysql_affected_rows (),
array ('time' => $time));
while ($row = mysql_fetch_assoc ($result)) {
array_push ($retval, $row);
}
if ($cache === true)
$sql_cache[$sql] = $retval;
mysql_free_result ($result);
}
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
if (! empty ($retval))
return $retval;
//Return false, check with === or !==
return false;
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
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
/**
* Get all the rows in a table of the database.
*
* @param string Database table name.
* @param string Field to order by.
* @param string $order The type of order, by default 'ASC'.
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
*
* @return mixed A matrix with all the values in the table
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
*/
function get_db_all_rows_in_table ($table, $order_field = "", $order = 'ASC') {
if ($order_field != "") {
return get_db_all_rows_sql ("SELECT * FROM `".$table."` ORDER BY ".$order_field . " " . $order);
} else {
return get_db_all_rows_sql ("SELECT * FROM `".$table."`");
}
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
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
/**
* Get all the rows in a table of the databes filtering from a field.
*
* @param string Database table name.
* @param string Field of the table.
* @param string Condition the field must have to be selected.
* @param string Field to order by.
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
*
* @return mixed A matrix with all the values in the table that matches the condition in the field or 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
*/
function get_db_all_rows_field_filter ($table, $field, $condition, $order_field = "") {
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
if (is_int ($condition) || is_bool ($condition)) {
$sql = sprintf ("SELECT * FROM `%s` WHERE `%s` = %d", $table, $field, $condition);
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
} else if (is_float ($condition) || is_double ($condition)) {
$sql = sprintf ("SELECT * FROM `%s` WHERE `%s` = %f", $table, $field, $condition);
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
} else {
$sql = sprintf ("SELECT * FROM `%s` WHERE `%s` = '%s'", $table, $field, $condition);
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
if ($order_field != "")
$sql .= sprintf (" ORDER BY %s", $order_field);
2008-06-30 10:11:10 +02:00
return get_db_all_rows_sql ($sql);
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
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
/**
* Get all the rows in a table of the databes filtering from a field.
*
* @param string Database table name.
* @param string Field of the table.
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
*
* @return mixed A matrix with all the values in the table that matches the condition in the field
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
*/
2009-01-07 16:57:33 +01:00
function get_db_all_fields_in_table ($table, $field = '', $condition = '', $order_field = '') {
$sql = sprintf ("SELECT * FROM `%s`", $table);
if ($condition != '') {
$sql .= sprintf (" WHERE `%s` = '%s'", $field, $condition);
}
if ($order_field != "")
$sql .= sprintf (" ORDER BY %s", $order_field);
return get_db_all_rows_sql ($sql);
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
/**
* Formats an array of values into a SQL string.
*
* This function is useful to generate an UPDATE SQL sentence from a list of
* values. Example code:
*
* <code>
2009-08-24 Miguel de Dios <miguel.dedios@artica.es> * include/functions_menu.php, include/functions_html.php, include/functions_events.php, include/functions_messages.php, include/functions_modules.php, include/functions_exportserver.php, include/functions_reporting.php, include/functions_filemanager.php, include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php, include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php, include/functions_networkmap.php, include/functions_servers.php, include/FusionCharts/FusionCharts_Gen.php, include/FusionCharts/FusionCharts.php, include/functions_network_profiles.php, include/gettext.php, include/functions_network_components.php, include/functions_visual_map.php, include/fgraph2.php, include/Image/image_functions.php, include/functions_config.php, include/help/en/help_plugin_parameters.php, include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php, include/help/en/help_postprocess.php, include/help/en/help_prediction_source_module.php, include/help/en/help_date_format.php, include/help/en/help_recontask.php, include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php, include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php, include/help/en/help_agent_status.php, include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php, include/help/en/help_alert_type.php, include/help/en/help_network_component.php, include/help/en/help_time_stamp-comparation.php, include/help/en/help_eventview.php, include/help/en/help_timesource.php, include/help/en/help_alert_validation.php, include/help/en/help_map_builder.php, include/help/en/help_alert_recovery.php, include/help/en/help_module_type.php, include/help/en/help_planned_downtime.php, include/help/en/help_serverlag.php, include/help/en/help_alerts.php, include/help/en/help_snmpwalk.php, include/help/en/help_module_definition.php, include/help/en/help_plugin_definition.php, include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php include/help/en/help_manageconfig.php, include/help/es/help_alert_validation.php, include/help/es/help_plugin_parameters.php, include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php, include/help/es/help_map_builder.php, include/help/es/help_postprocess.php, include/help/es/help_date_format.php, include/help/es/help_alert_recovery.php, include/help/es/help_prediction_source_module.php, include/help/es/help_module_type.php, include/help/es/help_planned_downtime.php, include/help/es/help_alert-matches.php, include/help/es/help_recontask.php, include/help/es/help_alerts.php, include/help/es/help_serverlag.php, include/help/es/help_snmpwalk.php, include/help/es/help_module_definition.php, include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php, include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php, include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php, include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php, include/help/es/help_wminamespace.php, include/help/es/help_network_component.php, include/help/es/help_time_stamp-comparation.php, include/help/es/help_manageconfig.php, include/help/es/help_timesource.php, include/config_process.php, include/functions_ui.php, include/htmlawed.php, include/functions_custom_graphs.php, include/fgraph.php, include/functions_incidents.php, include/functions.php, include/functions_agents.php, include/functions_db.php, include/functions_themes.php, include/streams.php, include/functions_fsgraph.php, include/functions_alerts.php, include/functions_reports.php, include/functions_extensions.php, include/functions_ui_renders.php: change comments blocks for delete the warnings to construct phpDoc Files, give a struct and order in the phpDoc files. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
* $values = array ();
* $values['name'] = "Name";
* $values['description'] = "Long description";
* $sql = 'UPDATE table SET '.format_array_to_update_sql ($values).' WHERE id=1';
* echo $sql;
* </code>
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
* Will return:
* <code>
2009-08-24 Miguel de Dios <miguel.dedios@artica.es> * include/functions_menu.php, include/functions_html.php, include/functions_events.php, include/functions_messages.php, include/functions_modules.php, include/functions_exportserver.php, include/functions_reporting.php, include/functions_filemanager.php, include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php, include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php, include/functions_networkmap.php, include/functions_servers.php, include/FusionCharts/FusionCharts_Gen.php, include/FusionCharts/FusionCharts.php, include/functions_network_profiles.php, include/gettext.php, include/functions_network_components.php, include/functions_visual_map.php, include/fgraph2.php, include/Image/image_functions.php, include/functions_config.php, include/help/en/help_plugin_parameters.php, include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php, include/help/en/help_postprocess.php, include/help/en/help_prediction_source_module.php, include/help/en/help_date_format.php, include/help/en/help_recontask.php, include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php, include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php, include/help/en/help_agent_status.php, include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php, include/help/en/help_alert_type.php, include/help/en/help_network_component.php, include/help/en/help_time_stamp-comparation.php, include/help/en/help_eventview.php, include/help/en/help_timesource.php, include/help/en/help_alert_validation.php, include/help/en/help_map_builder.php, include/help/en/help_alert_recovery.php, include/help/en/help_module_type.php, include/help/en/help_planned_downtime.php, include/help/en/help_serverlag.php, include/help/en/help_alerts.php, include/help/en/help_snmpwalk.php, include/help/en/help_module_definition.php, include/help/en/help_plugin_definition.php, include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php include/help/en/help_manageconfig.php, include/help/es/help_alert_validation.php, include/help/es/help_plugin_parameters.php, include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php, include/help/es/help_map_builder.php, include/help/es/help_postprocess.php, include/help/es/help_date_format.php, include/help/es/help_alert_recovery.php, include/help/es/help_prediction_source_module.php, include/help/es/help_module_type.php, include/help/es/help_planned_downtime.php, include/help/es/help_alert-matches.php, include/help/es/help_recontask.php, include/help/es/help_alerts.php, include/help/es/help_serverlag.php, include/help/es/help_snmpwalk.php, include/help/es/help_module_definition.php, include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php, include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php, include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php, include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php, include/help/es/help_wminamespace.php, include/help/es/help_network_component.php, include/help/es/help_time_stamp-comparation.php, include/help/es/help_manageconfig.php, include/help/es/help_timesource.php, include/config_process.php, include/functions_ui.php, include/htmlawed.php, include/functions_custom_graphs.php, include/fgraph.php, include/functions_incidents.php, include/functions.php, include/functions_agents.php, include/functions_db.php, include/functions_themes.php, include/streams.php, include/functions_fsgraph.php, include/functions_alerts.php, include/functions_reports.php, include/functions_extensions.php, include/functions_ui_renders.php: change comments blocks for delete the warnings to construct phpDoc Files, give a struct and order in the phpDoc files. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
* UPDATE table SET `name` = "Name", `description` = "Long description" WHERE id=1
* </code>
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
*
* @param array Values to be formatted in an array indexed by the field name.
*
* @return string Values joined into an SQL string that can fits into an UPDATE
* sentence.
*/
function format_array_to_update_sql ($values) {
$fields = array ();
foreach ($values as $field => $value) {
if (is_numeric ($field)) {
array_push ($fields, $value);
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
continue;
}
else if ($field[0] == "`") {
$field = str_replace('`', '', $field);
}
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
if ($value === NULL) {
$sql = sprintf ("`%s` = NULL", $field);
} elseif (is_int ($value) || is_bool ($value)) {
$sql = sprintf ("`%s` = %d", $field, $value);
} elseif (is_float ($value) || is_double ($value)) {
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
$sql = sprintf ("`%s` = %f", $field, $value);
} else {
/* String */
if (isset ($value[0]) && $value[0] == '`')
/* Don't round with quotes if it references a field */
$sql = sprintf ("`%s` = %s", $field, $value);
else
$sql = sprintf ("`%s` = '%s'", $field, $value);
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
}
array_push ($fields, $sql);
}
return implode (", ", $fields);
}
/**
* Formats an array of values into a SQL where clause string.
*
* This function is useful to generate a WHERE clause for a SQL sentence from
* a list of values. Example code:
<code>
$values = array ();
$values['name'] = "Name";
$values['description'] = "Long description";
$values['limit'] = $config['block_size']; // Assume it's 20
$sql = 'SELECT * FROM table WHERE '.format_array_to_where_clause_sql ($values);
echo $sql;
</code>
* Will return:
* <code>
* SELECT * FROM table WHERE `name` = "Name" AND `description` = "Long description" LIMIT 20
* </code>
*
* @param array Values to be formatted in an array indexed by the field name.
2009-02-18 13:29:30 +01:00
* There are special parameters such as 'limit' and 'offset' that will be used
* as ORDER, LIMIT and OFFSET clauses respectively. Since LIMIT and OFFSET are
* numerics, ORDER can receive a field name or a SQL function and a the ASC or
* DESC clause. Examples:
<code>
$values = array ();
$values['value'] = 10;
$sql = 'SELECT * FROM table WHERE '.format_array_to_where_clause_sql ($values);
// SELECT * FROM table WHERE VALUE = 10
$values = array ();
$values['value'] = 10;
$values['order'] = 'name DESC';
$sql = 'SELECT * FROM table WHERE '.format_array_to_where_clause_sql ($values);
// SELECT * FROM table WHERE VALUE = 10 ORDER BY name DESC
</code>
* @param string Join operator. AND by default.
* @param string A prefix to be added to the string. It's useful when limit and
* offset could be given to avoid this cases:
<code>
$values = array ();
$values['limit'] = 10;
$values['offset'] = 20;
$sql = 'SELECT * FROM table WHERE '.format_array_to_where_clause_sql ($values);
// Wrong SQL: SELECT * FROM table WHERE LIMIT 10 OFFSET 20
$values = array ();
$values['limit'] = 10;
$values['offset'] = 20;
$sql = 'SELECT * FROM table WHERE '.format_array_to_where_clause_sql ($values, 'AND', 'WHERE');
// Good SQL: SELECT * FROM table LIMIT 10 OFFSET 20
$values = array ();
$values['value'] = 5;
$values['limit'] = 10;
$values['offset'] = 20;
$sql = 'SELECT * FROM table WHERE '.format_array_to_where_clause_sql ($values, 'AND', 'WHERE');
// Good SQL: SELECT * FROM table WHERE value = 5 LIMIT 10 OFFSET 20
</code>
*
* @return string Values joined into an SQL string that can fits into the WHERE
* clause of an SQL sentence.
*/
function format_array_to_where_clause_sql ($values, $join = 'AND', $prefix = false) {
$fields = array ();
if (! is_array ($values)) {
return '';
}
$query = '';
2009-02-18 13:29:30 +01:00
$limit = '';
$offset = '';
$order = '';
$group = '';
if (isset ($values['limit'])) {
$limit = sprintf (' LIMIT %d', $values['limit']);
unset ($values['limit']);
}
if (isset ($values['offset'])) {
$offset = sprintf (' OFFSET %d', $values['offset']);
unset ($values['offset']);
}
if (isset ($values['order'])) {
$order = sprintf (' ORDER BY %s', $values['order']);
unset ($values['order']);
}
if (isset ($values['group'])) {
$group = sprintf (' GROUP BY %s', $values['group']);
unset ($values['group']);
}
$i = 1;
$max = count ($values);
foreach ($values as $field => $value) {
if (is_numeric ($field)) {
2009-03-03 Esteban Sanchez <estebans@artica.es> * general/main_menu.php: Operation and godmode menus files includes now the dependant files. * godmode/agentes/modificar_agente.php: Removed unnecessary require() * godmode/alerts/alert_list.php: Avoid notice for undefined index when calling max(). Added option to delete the template. * godmode/alerts/configure_alert_template.php, godmode/alerts/alert_templates.php: Fixed field2_recovery and field3_recovery updating. * operation/menu.php, godmode/menu.php: Require functions_menu.php. * include/config_process.php: Updated build version. * include/functions.php: Keep time in a static variable on get_system_time(). * include/functions_db.php: Now a custom operation can be passed to format_array_to_where_clause_sql() if the field key is numeric. * include/functions_reporting.php: Return float value on get_agentmodule_sla(). Added required files. * include/functions_ui.php: Show template name on format_alert_row(). Style correction. * operation/agentes/export_csv.php: Style correction. * operation/events/export_csv.php: Use pandora functions to fetch results. Fixed auth part. Style correction. * operation/reporting/custom_reporting.php: Fixed enterprise include. * operation/reporting/reporting_xml.php: Fixed auth part. * index.php: process_page_head() may looked for uninitialized $config["refr"]. * include/styles/pandora_width.css: Fixed style for ol.steps git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1500 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-03 16:21:13 +01:00
/* User provide the exact operation to do */
$query .= $value;
if ($i < $max) {
$query .= ' '.$join.' ';
}
$i++;
continue;
2009-03-03 Esteban Sanchez <estebans@artica.es> * general/main_menu.php: Operation and godmode menus files includes now the dependant files. * godmode/agentes/modificar_agente.php: Removed unnecessary require() * godmode/alerts/alert_list.php: Avoid notice for undefined index when calling max(). Added option to delete the template. * godmode/alerts/configure_alert_template.php, godmode/alerts/alert_templates.php: Fixed field2_recovery and field3_recovery updating. * operation/menu.php, godmode/menu.php: Require functions_menu.php. * include/config_process.php: Updated build version. * include/functions.php: Keep time in a static variable on get_system_time(). * include/functions_db.php: Now a custom operation can be passed to format_array_to_where_clause_sql() if the field key is numeric. * include/functions_reporting.php: Return float value on get_agentmodule_sla(). Added required files. * include/functions_ui.php: Show template name on format_alert_row(). Style correction. * operation/agentes/export_csv.php: Style correction. * operation/events/export_csv.php: Use pandora functions to fetch results. Fixed auth part. Style correction. * operation/reporting/custom_reporting.php: Fixed enterprise include. * operation/reporting/reporting_xml.php: Fixed auth part. * index.php: process_page_head() may looked for uninitialized $config["refr"]. * include/styles/pandora_width.css: Fixed style for ol.steps git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1500 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-03 16:21:13 +01:00
}
if ($field[0] != "`") {
$field = "`".$field."`";
}
if (is_null ($value)) {
$query .= sprintf ("%s IS NULL", $field);
} elseif (is_int ($value) || is_bool ($value)) {
$query .= sprintf ("%s = %d", $field, $value);
} else if (is_float ($value) || is_double ($value)) {
$query .= sprintf ("%s = %f", $field, $value);
} elseif (is_array ($value)) {
$query .= sprintf ('%s IN ("%s")', $field, implode ('", "', $value));
} else {
if ($value[0] == ">"){
$value = substr($value,1,strlen($value)-1);
$query .= sprintf ("%s > '%s'", $field, $value);
}
else if ($value[0] == "<"){
$value = substr($value,1,strlen($value)-1);
$query .= sprintf ("%s < '%s'", $field, $value);
}
else {
$query .= sprintf ("%s = '%s'", $field, $value);
}
}
if ($i < $max) {
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
$query .= ' '.$join.' ';
}
$i++;
}
return (! empty ($query) ? $prefix: '').$query.$group.$order.$limit.$offset;
}
/**
* Get the status of an agent module.
*
* @param int Id agent module to check.
*
* @return int Module status. Value 4 means that some alerts assigned to the
* module were fired.
*/
function get_agentmodule_status ($id_agentmodule = 0) {
$current_timestamp = get_system_time ();
$times_fired = get_db_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule);
if ($times_fired > 0) {
return 4; // Alert
}
$status_row = get_db_row ("tagente_estado", "id_agente_modulo", $id_agentmodule);
// Not init or current_interval == 0: Return current status and avoid problems here !
if ($status_row["current_interval"] == 0)
return $status_row["estado"];
// Unknown status
if ( ($status_row["current_interval"] * 2) + $status_row["utimestamp"] < $current_timestamp){
$status = 3;
}
else {
$status = $status_row['estado'];
}
return $status;
}
/**
* Get the worst status of all modules of a given agent.
*
* @param int Id agent to check.
*
* @return int Worst status of an agent for all of its modules.
* The value -1 is returned in case the agent has exceed its interval.
*/
function get_agent_status ($id_agent = 0) {
$time = get_system_time ();
$status = get_db_value_filter ('COUNT(*)',
'tagente',
array ('id_agente' => (int) $id_agent,
'UNIX_TIMESTAMP(ultimo_contacto) + intervalo * 2 > '.$time,
'UNIX_TIMESTAMP(ultimo_contacto_remoto) + intervalo * 2 > '.$time));
if (! $status)
return -1;
$status = get_db_sql ("SELECT MAX(estado)
FROM tagente_estado, tagente_modulo
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND tagente_modulo.disabled = 0
AND tagente_modulo.delete_pending = 0
AND tagente_modulo.id_agente = $id_agent");
// TODO: Check any alert for that agent who has recept alerts fired
return $status;
}
/**
* Get the current value of an agent module.
*
* @param int Agent module id.
*
* @return int a numerically formatted value
*/
function get_agent_module_last_value ($id_agentmodule) {
return get_db_value ('datos', 'tagente_estado',
'id_agente_modulo', $id_agentmodule);
2007-05-20 Sancho Lerena <slerena@artica.es> * pandoradb_data.sql: Uptated network component data. * include/styles/pandora.css: Few updates for style. * include/functions_db.php: Added functions for visual console features. * include/languages/language_en.php: New strings. * include/javascript: Moved all javascript files here. * include/javascript/x_slide.js, include/javascript/x_event.js: Copied from branch / console from Azabel. * include/javascript/wz_jsgraphics.js: New functions to draw lines. * pandoradb.sql: Created new tlayout and tlayout_data tables. * index.php: Small changes. Added support to refresh any page via POST. * operation/visual_console: Added Visual Console feature. * operation/agentes/estado_alertas.php: Updated styles and fixes damm bug when no alert available. * operation/agentes/status_monitor.php: Updated styles. * operation/agentes/estado_generalagente.php: Update styles. * operation/agentes/estado_agente.php: Updated style. * operation/servers/view_server.php: Updated style. * operation/reporting/graph_builder.php: Fixed some minor bugs. Needs to fix more bugs :( * operation/menu.php: Updated menu. Visual Console has dynamic items!. * images/pandora_logo_head.png: New header logo ! * images/pandora_logo.png: New Pandora FMS 1.3 logo ! :-)) * images/console/background: More samples added. * images/console/icons: Icons to be used in visual console. * reporting/fgraph.php: New feature added to simple graph to show only average values. * reporting/stat_win.php: Added support to avg_only and show avg, max and min values from each graph. Zoom factor is more usable now. * general/logoff.php: New style. * general/footer.php: Fixed style. * general/logon_failed.php: Fixed style. * general/login_page.php: New style. * general/header.php: Fixed style. * godmode/agentes/configurar_agente.php: Fixed styles. * godmode/agentes/agent_manager.php: Fixed styles. * operation/active_console: Removed from trunk: not ready to be used. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@459 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-05-20 19:12:31 +02:00
}
/**
* Get the X axis coordinate of a layout item
*
* @param int Id of the layout to get.
*
* @return int The X axis coordinate value.
*/
2008-06-26 Esteban Sanchez <estebans@artica.es> * ajax.php: Sed id_user in config array. * godmode/menu.php, general/header.php, operation/menu.php: Replaced lang_label with lang_string(). * general/logon_ok.php: Reduced one indentation level. * godmode/agentes/agent_manager.php: Replaced lang_label with lang_string(). Use pandora functions. * include/functions_html.php, godmode/agentes/configurar_agente.php: Tab and blankspaces style correction. * godmode/reporting/map_builder.php: Complete rewritten to provide an intuitive way of build the maps. It's cool, useful and very simple. * godmode/reporting/reporting_builder.php: Deleted an output debug. * godmode/setup/setup.php: Rewritten to use pandora functions. Added a colorpicker for color settings. * include/config.php: Reset pandora password. We must solve things with this file... * include/functions.php: Check if input is an array on safe_input(). Use filename as id in array returned by list_files(). * include/functions_db.php: Renamed return_coordinate_* functions. Style correction. * include/javascript/jquery.js: Updated to 1.2.6. * include/javascript/jquery.ui.datepicker.js: Code minimized. * include/javascript/pandora.js: Style correction. * include/javascript/wz_jsgraphics.js: Added a class to the elements of a line, so it can be modified using javascript. * /include/styles/pandora.css: Added style to some tables dropdowns. Added new styles relative to visual map editor. * operation/reporting/reporting_viewer.php: Style correction. Added jQuery UI. * operation/visual_console/index.php: Use Pandora functions. * operation/visual_console/render_view.php: Drawing the map is now on functions_visual_map.php. Added a countdown if a refresh time is set. Use pandora functions. Style correction. * reporting/fgraph.php: Style correction. Use graphic_error() if there's no data on grafico_modulo_sparse(). * images/trash.png: Added to repository. Image used on trash area on visual map editor. * images/console/background/africa.jpg, images/console/background/asia.jpg, images/console/background/europe.jpg, images/console/background/north_america.jpg, images/console/background/oceania.jpg, images/console/background/shouth_america.jpg, images/console/background/world.jpg: Added to repository. Useful and cool map backgrounds. * include/functions_visual_map.php: Added to repository. Implements visual map functions like drawing the map. * include/javascript/jquery.colorpicker.js: Added to repository. Implements a color picker widget. * /include/javascript/jquery.countdown.js: Added to repository. Implements a countdown widget. * include/javascript/jquery.ui.core.js: Added to repository. jQuery UI core. * include/javascript/jquery.ui.draggable.js: Added to repository. jQuery draggable plugin. * include/javascript/jquery.ui.droppable.js: Added to repository. jQuery droppable plugin. * include/javascript/pandora_visual_console.js: Added to repository. Function useful to visual map interface. * include/languages/countdown_*.js: Added to repository. Countdown localization. * include/languages/date_es_la.js, include/languages/date_gl.js, include/languages/time_es_la.js, include/languages/time_gl.js: Added to repository. Missing localizations. * include/styles/color-picker.css: Added to repository. Colorpicker style sheet. * include/styles/countdown.css: Added to repository. Countdown style sheet. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@899 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-26 15:26:48 +02:00
function get_layoutdata_x ($id_layoutdata) {
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
return (float) get_db_value ('pos_x', 'tlayout_data', 'id', (int) $id_layoutdata);
2007-05-20 Sancho Lerena <slerena@artica.es> * pandoradb_data.sql: Uptated network component data. * include/styles/pandora.css: Few updates for style. * include/functions_db.php: Added functions for visual console features. * include/languages/language_en.php: New strings. * include/javascript: Moved all javascript files here. * include/javascript/x_slide.js, include/javascript/x_event.js: Copied from branch / console from Azabel. * include/javascript/wz_jsgraphics.js: New functions to draw lines. * pandoradb.sql: Created new tlayout and tlayout_data tables. * index.php: Small changes. Added support to refresh any page via POST. * operation/visual_console: Added Visual Console feature. * operation/agentes/estado_alertas.php: Updated styles and fixes damm bug when no alert available. * operation/agentes/status_monitor.php: Updated styles. * operation/agentes/estado_generalagente.php: Update styles. * operation/agentes/estado_agente.php: Updated style. * operation/servers/view_server.php: Updated style. * operation/reporting/graph_builder.php: Fixed some minor bugs. Needs to fix more bugs :( * operation/menu.php: Updated menu. Visual Console has dynamic items!. * images/pandora_logo_head.png: New header logo ! * images/pandora_logo.png: New Pandora FMS 1.3 logo ! :-)) * images/console/background: More samples added. * images/console/icons: Icons to be used in visual console. * reporting/fgraph.php: New feature added to simple graph to show only average values. * reporting/stat_win.php: Added support to avg_only and show avg, max and min values from each graph. Zoom factor is more usable now. * general/logoff.php: New style. * general/footer.php: Fixed style. * general/logon_failed.php: Fixed style. * general/login_page.php: New style. * general/header.php: Fixed style. * godmode/agentes/configurar_agente.php: Fixed styles. * godmode/agentes/agent_manager.php: Fixed styles. * operation/active_console: Removed from trunk: not ready to be used. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@459 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-05-20 19:12:31 +02:00
}
/**
* Get the Y axis coordinate of a layout item
*
* @param int Id of the layout to get.
*
* @return int The Y axis coordinate value.
*/
2008-06-26 Esteban Sanchez <estebans@artica.es> * ajax.php: Sed id_user in config array. * godmode/menu.php, general/header.php, operation/menu.php: Replaced lang_label with lang_string(). * general/logon_ok.php: Reduced one indentation level. * godmode/agentes/agent_manager.php: Replaced lang_label with lang_string(). Use pandora functions. * include/functions_html.php, godmode/agentes/configurar_agente.php: Tab and blankspaces style correction. * godmode/reporting/map_builder.php: Complete rewritten to provide an intuitive way of build the maps. It's cool, useful and very simple. * godmode/reporting/reporting_builder.php: Deleted an output debug. * godmode/setup/setup.php: Rewritten to use pandora functions. Added a colorpicker for color settings. * include/config.php: Reset pandora password. We must solve things with this file... * include/functions.php: Check if input is an array on safe_input(). Use filename as id in array returned by list_files(). * include/functions_db.php: Renamed return_coordinate_* functions. Style correction. * include/javascript/jquery.js: Updated to 1.2.6. * include/javascript/jquery.ui.datepicker.js: Code minimized. * include/javascript/pandora.js: Style correction. * include/javascript/wz_jsgraphics.js: Added a class to the elements of a line, so it can be modified using javascript. * /include/styles/pandora.css: Added style to some tables dropdowns. Added new styles relative to visual map editor. * operation/reporting/reporting_viewer.php: Style correction. Added jQuery UI. * operation/visual_console/index.php: Use Pandora functions. * operation/visual_console/render_view.php: Drawing the map is now on functions_visual_map.php. Added a countdown if a refresh time is set. Use pandora functions. Style correction. * reporting/fgraph.php: Style correction. Use graphic_error() if there's no data on grafico_modulo_sparse(). * images/trash.png: Added to repository. Image used on trash area on visual map editor. * images/console/background/africa.jpg, images/console/background/asia.jpg, images/console/background/europe.jpg, images/console/background/north_america.jpg, images/console/background/oceania.jpg, images/console/background/shouth_america.jpg, images/console/background/world.jpg: Added to repository. Useful and cool map backgrounds. * include/functions_visual_map.php: Added to repository. Implements visual map functions like drawing the map. * include/javascript/jquery.colorpicker.js: Added to repository. Implements a color picker widget. * /include/javascript/jquery.countdown.js: Added to repository. Implements a countdown widget. * include/javascript/jquery.ui.core.js: Added to repository. jQuery UI core. * include/javascript/jquery.ui.draggable.js: Added to repository. jQuery draggable plugin. * include/javascript/jquery.ui.droppable.js: Added to repository. jQuery droppable plugin. * include/javascript/pandora_visual_console.js: Added to repository. Function useful to visual map interface. * include/languages/countdown_*.js: Added to repository. Countdown localization. * include/languages/date_es_la.js, include/languages/date_gl.js, include/languages/time_es_la.js, include/languages/time_gl.js: Added to repository. Missing localizations. * include/styles/color-picker.css: Added to repository. Colorpicker style sheet. * include/styles/countdown.css: Added to repository. Countdown style sheet. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@899 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-26 15:26:48 +02:00
function get_layoutdata_y ($id_layoutdata){
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
return (float) get_db_value ('pos_y', 'tlayout_data', 'id', (int) $id_layoutdata);
2007-05-20 Sancho Lerena <slerena@artica.es> * pandoradb_data.sql: Uptated network component data. * include/styles/pandora.css: Few updates for style. * include/functions_db.php: Added functions for visual console features. * include/languages/language_en.php: New strings. * include/javascript: Moved all javascript files here. * include/javascript/x_slide.js, include/javascript/x_event.js: Copied from branch / console from Azabel. * include/javascript/wz_jsgraphics.js: New functions to draw lines. * pandoradb.sql: Created new tlayout and tlayout_data tables. * index.php: Small changes. Added support to refresh any page via POST. * operation/visual_console: Added Visual Console feature. * operation/agentes/estado_alertas.php: Updated styles and fixes damm bug when no alert available. * operation/agentes/status_monitor.php: Updated styles. * operation/agentes/estado_generalagente.php: Update styles. * operation/agentes/estado_agente.php: Updated style. * operation/servers/view_server.php: Updated style. * operation/reporting/graph_builder.php: Fixed some minor bugs. Needs to fix more bugs :( * operation/menu.php: Updated menu. Visual Console has dynamic items!. * images/pandora_logo_head.png: New header logo ! * images/pandora_logo.png: New Pandora FMS 1.3 logo ! :-)) * images/console/background: More samples added. * images/console/icons: Icons to be used in visual console. * reporting/fgraph.php: New feature added to simple graph to show only average values. * reporting/stat_win.php: Added support to avg_only and show avg, max and min values from each graph. Zoom factor is more usable now. * general/logoff.php: New style. * general/footer.php: Fixed style. * general/logon_failed.php: Fixed style. * general/login_page.php: New style. * general/header.php: Fixed style. * godmode/agentes/configurar_agente.php: Fixed styles. * godmode/agentes/agent_manager.php: Fixed styles. * operation/active_console: Removed from trunk: not ready to be used. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@459 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-05-20 19:12:31 +02:00
}
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
/**
* Get the previous data to the timestamp provided.
*
* It's useful to know the first value of a module in an interval,
* since it will be the last value in the table which has a timestamp
* before the beginning of the interval. All this calculation is due
* to the data compression algorithm.
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*
* @param int Agent module id
* @param int The timestamp to look backwards from and get the data.
* @param int 1 if the module has a string type.
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*
* @return mixed The row of tagente_datos of the last period. False if there were no data.
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
*/
function get_previous_data ($id_agent_module, $utimestamp = 0, $string = 0) {
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
if (empty ($utimestamp))
$utimestamp = time ();
if ($string == 1) {
$table = 'tagente_datos_string';
} else {
$table = 'tagente_datos';
}
// 172800 = 60×60×24*2 Search up to 2 days before utimestamp
$sql = sprintf ('SELECT * FROM ' . $table . ' WHERE id_agente_modulo = %d
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
AND utimestamp <= %d
AND utimestamp >= %d
ORDER BY utimestamp DESC',
$id_agent_module, $utimestamp, $utimestamp - 172800);
return get_db_row_sql ($sql, true);
}
/**
* Get the next data to the timestamp provided.
*
* @param int Agent module id
* @param int The timestamp to look backwards from and get the data.
* @param int 1 if the module has a string type.
*
* @return mixed The row of tagente_datos of the last period. False if there were no data.
*/
function get_next_data ($id_agent_module, $utimestamp = 0, $string = 0) {
if (empty ($utimestamp))
$utimestamp = time ();
if ($string == 1) {
$table = 'tagente_datos_string';
} else {
$table = 'tagente_datos';
}
$interval = get_module_interval ($id_agent_module);
$sql = sprintf ('SELECT * FROM tagente_datos
WHERE id_agente_modulo = %d
AND utimestamp <= %d
AND utimestamp >= %d
ORDER BY utimestamp ASC',
$id_agent_module, $utimestamp + $interval, $utimestamp);
return get_db_row_sql ($sql, true);
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
}
/**
* Get all the values of an agent module in a period of time.
*
* @param int Agent module id
* @param int Period of time to check (in seconds)
* @param int Top date to check the values. Default current time.
*
* @return array The module value and the timestamp
*/
function get_agentmodule_data ($id_agent_module, $period, $date = 0) {
if ($date < 1) {
$date = get_system_time ();
}
$datelimit = $date - $period;
$sql = sprintf ("SELECT datos AS data, utimestamp FROM tagente_datos WHERE id_agente_modulo = %d
AND utimestamp > %d AND utimestamp <= %d ORDER BY utimestamp ASC",
$id_agent_module, $datelimit, $date);
$values = get_db_all_rows_sql ($sql, true, false);
if ($values === false) {
return array ();
}
$module_name = get_agentmodule_name ($id_agent_module);
$agent_id = get_agentmodule_agent ($id_agent_module);
$agent_name = get_agentmodule_agent_name ($id_agent_module);
foreach ($values as $key => $data) {
$values[$key]["module_name"] = $module_name;
$values[$key]["agent_id"] = $agent_id;
$values[$key]["agent_name"] = $agent_name;
}
return $values;
}
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
/**
* Get a translated string
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
*
2009-03-17 Esteban Sanchez <estebans@artica.es> * godmode/agentes/massive_operations.php: Added to repository. New page to group massive operations in a single page. * godmode/agentes/massive_config.php: Renamed from manage_config.php. * godmode/agentes/massive_delete_agents.php: Renamed from manage_delete.php. * godmode/agentes/massive_delete_modules.php: Added to repository. Interface to delete modules. * godmode/agentes/massive_delete_alerts.php: Added to repository. Interface to delete alerts. * godmode/agentes/agent_manager.php: Fixed table width to make it variable. * godmode/agentes/module_manager.php: Rewritten to use Pandora functions. * include/javascript/jquery.pandora.controls.js: Added pandoraSelectAgentAlert. Renamed pandoraSelectAgent to pandoraSelectAgentModule. Get only needed fields to make it quicker and avoid showing disabled modules. * godmode/alerts/alert_list.php: Adapted to changes in jquery.pandora.controls.js. * godmode/menu.php: Group some pages into new "Massive operation" submenu. * images/copy.png: Replaced with a better icon. * images/delete_agents.png, images/delete_alerts.php, images/delete_modules.php: Added to repository. * include/styles/pandora.css: Set color on input.sub * include/styles/pandora_width.css: Make menu_tab_frame wider. * include/functions_db.php: Removed deprecated dame_nombre_grupomodulo(). Added support to __() to receive multiple parameters so translatable strings can handle now printf format characters. * include/functions_modules.php: Added delete_agent_module(). * operation/agentes/ver_agente.php: Allow fields to be passed to get_agent_modules_json AJAX operation. * reporting/fgraph.php: Replaced sprintf() with __(). Some casts added. Show a sparse chart even if it has no max/min value. * godmode/modules/manage_network_components_form_network.php, operation/agentes/estado_ultimopaquete.php, godmode/modules/manage_network_components_form_wmi.php: Use get_modulegroup_name(). * godmode/agentes/configurar_agente.php, godmode/modules/manage_network_components.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1544 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-17 16:15:55 +01:00
* @param string String to translate. It can have special format characters like
* a printf
* @param mixed Optional parameters to be replaced in string. Example:
<code>
echo __('Hello!');
echo __('Hello, %s!', $user);
</code>
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
*
* @return string The translated string. If not defined, the same string will be returned
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
*/
2009-04-20 Esteban Sanchez <estebans@artica.es> * godmode/agentes/module_manager_editor.php, godmode/agentes/module_manager_editor_common.php, godmode/agentes/module_manager_editor_data.php, godmode/agentes/module_manager_editor_network.php, godmode/agentes/module_manager_editor_plugin.php, godmode/agentes/module_manager_editor_prediction.php, godmode/agentes/module_manager_editor_wmi.php, godmode/agentes/module_manager.php: Some fixes to allow form reutilization. * include/javascript/jquery.pandora.controls.js: Fixed a typo. Added pandoraSelectGroup control. * include/javascript/jquery.pandora.js: Separate between auto executed code and document ready function. * include/javascript/pandora_modules.js: Added to repository. Functions to use on module editors. * include/functions_agents.php: Added get_agents(). * include/functions_db.php: Added get_user_first_group(). Changed user_access_to_agent() parameters order. * include/functions_reporting.php: Style corrections. * include/functions_ui.php: Added doc to print_status_image(). Added print_ui_agents_list() to print a list of agents with a search form and a lot of configuration options easily. * include/functions_ui_renders.php: Added to repository. New API for renders on UI components. * operation/agentes/estado_agente.php: Make table wider. * godmode/reporting/reporting_builder.php: Replaced exit with return. Use pandoraSelectGroup control. * godmode/servers/manage_recontask_form.php: Style corrections to fit Pandora styles. * godmode/servers/modificar_server.php: Removed a notice from a typo. * godmode/setup/setup.php: Fixed table data indexes. Removed javascript code from visual setup. * godmode/setup/setup_visuals.php: Some strings changed. Style correction. * godmode/menu.php: Added policies enterprise menu option. * images/policies.png: Added to repository. * godmode/agentes/modificar_agente.php: Style correction by using pandora functions. * godmode/agentes/massive_operations.php: Fixed tab styles that was showing wrong the . * godmode/agentes/manage_config_remote.php: Changes in user_access_to_agent() * general/ui/agents_list.php: Added to repository. Reusable render for an agent list. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1632 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-20 16:00:27 +02:00
function __ ($string /*, variable arguments */) {
global $l10n;
2009-03-17 Esteban Sanchez <estebans@artica.es> * godmode/agentes/massive_operations.php: Added to repository. New page to group massive operations in a single page. * godmode/agentes/massive_config.php: Renamed from manage_config.php. * godmode/agentes/massive_delete_agents.php: Renamed from manage_delete.php. * godmode/agentes/massive_delete_modules.php: Added to repository. Interface to delete modules. * godmode/agentes/massive_delete_alerts.php: Added to repository. Interface to delete alerts. * godmode/agentes/agent_manager.php: Fixed table width to make it variable. * godmode/agentes/module_manager.php: Rewritten to use Pandora functions. * include/javascript/jquery.pandora.controls.js: Added pandoraSelectAgentAlert. Renamed pandoraSelectAgent to pandoraSelectAgentModule. Get only needed fields to make it quicker and avoid showing disabled modules. * godmode/alerts/alert_list.php: Adapted to changes in jquery.pandora.controls.js. * godmode/menu.php: Group some pages into new "Massive operation" submenu. * images/copy.png: Replaced with a better icon. * images/delete_agents.png, images/delete_alerts.php, images/delete_modules.php: Added to repository. * include/styles/pandora.css: Set color on input.sub * include/styles/pandora_width.css: Make menu_tab_frame wider. * include/functions_db.php: Removed deprecated dame_nombre_grupomodulo(). Added support to __() to receive multiple parameters so translatable strings can handle now printf format characters. * include/functions_modules.php: Added delete_agent_module(). * operation/agentes/ver_agente.php: Allow fields to be passed to get_agent_modules_json AJAX operation. * reporting/fgraph.php: Replaced sprintf() with __(). Some casts added. Show a sparse chart even if it has no max/min value. * godmode/modules/manage_network_components_form_network.php, operation/agentes/estado_ultimopaquete.php, godmode/modules/manage_network_components_form_wmi.php: Use get_modulegroup_name(). * godmode/agentes/configurar_agente.php, godmode/modules/manage_network_components.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1544 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-17 16:15:55 +01:00
if (func_num_args () == 1) {
if (is_null ($l10n))
return $string;
return $l10n->translate ($string);
}
$args = func_get_args ();
$string = array_shift ($args);
if (is_null ($l10n))
2009-03-17 Esteban Sanchez <estebans@artica.es> * godmode/agentes/massive_operations.php: Added to repository. New page to group massive operations in a single page. * godmode/agentes/massive_config.php: Renamed from manage_config.php. * godmode/agentes/massive_delete_agents.php: Renamed from manage_delete.php. * godmode/agentes/massive_delete_modules.php: Added to repository. Interface to delete modules. * godmode/agentes/massive_delete_alerts.php: Added to repository. Interface to delete alerts. * godmode/agentes/agent_manager.php: Fixed table width to make it variable. * godmode/agentes/module_manager.php: Rewritten to use Pandora functions. * include/javascript/jquery.pandora.controls.js: Added pandoraSelectAgentAlert. Renamed pandoraSelectAgent to pandoraSelectAgentModule. Get only needed fields to make it quicker and avoid showing disabled modules. * godmode/alerts/alert_list.php: Adapted to changes in jquery.pandora.controls.js. * godmode/menu.php: Group some pages into new "Massive operation" submenu. * images/copy.png: Replaced with a better icon. * images/delete_agents.png, images/delete_alerts.php, images/delete_modules.php: Added to repository. * include/styles/pandora.css: Set color on input.sub * include/styles/pandora_width.css: Make menu_tab_frame wider. * include/functions_db.php: Removed deprecated dame_nombre_grupomodulo(). Added support to __() to receive multiple parameters so translatable strings can handle now printf format characters. * include/functions_modules.php: Added delete_agent_module(). * operation/agentes/ver_agente.php: Allow fields to be passed to get_agent_modules_json AJAX operation. * reporting/fgraph.php: Replaced sprintf() with __(). Some casts added. Show a sparse chart even if it has no max/min value. * godmode/modules/manage_network_components_form_network.php, operation/agentes/estado_ultimopaquete.php, godmode/modules/manage_network_components_form_wmi.php: Use get_modulegroup_name(). * godmode/agentes/configurar_agente.php, godmode/modules/manage_network_components.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1544 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-17 16:15:55 +01:00
return vsprintf ($string, $args);
return vsprintf ($l10n->translate ($string), $args);
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
}
/**
* Get the numbers of servers up.
*
* This check assumes that server_keepalive should be at least 15 minutes.
*
* @return int The number of servers alive.
*/
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
function check_server_status () {
$sql = "SELECT COUNT(id_server) FROM tserver WHERE status = 1 AND keepalive > NOW() - INTERVAL 15 MINUTE";
$status = (int) get_db_sql ($sql); //Cast as int will assure a number value
// This function should just ack of server down, not set it down.
return $status;
2008-04-03 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: IA to prediction in description. * pandoradb.sql: Added priority to alert and custom recovery fields. * include/styles/tip.css, include/styles/pandora.css: New styles for tooltip info (combined and alerts) and some changes in frames for agent management / view. * include/functions_db.php: Added check_server_status() function to check from console server status. If in 15 minutes there is no updated keepalive from any server, they will be marked as down. And function return down. This function is now called on each page. Added funtions to display alert status in a tooltip. * include/languages/language_en.php: More strings. * include/functions.php: Added several funtions to simplify alert report. * operation/agentes/estado_alertas.php: Updated. Shows also combined alerts and give a lot of information in different tooltips. * operation/agentes/estado_ultimopaquete.php: Clean blank spaces in URL. * operation/agentes/estado_monitores.php: now is possible to force a module refresh from main view. * operation/agentes/ver_agente.php: Tab has been upgraded. * images/mod_data.png, images/mod_data_inc.png images/mod_proc.png images/mod_keepalive.png images/mod_string.png: Added new type icons and updated old ones. * general/header.php: Global check for servers and autorefresh control. * godmode/agentes/alert_manager.php: New alert management for combined alerts, visualization, etc. * godmode/agentes/configurar_agente.php: Included new alert management. * godmode/agentes/alert_manager_editor.php: New alert management editor. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@791 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-03 17:43:34 +02:00
}
/**
* @deprecated Will show a small HTML table with some compound alert information
*/
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
function show_alert_row_mini ($id_combined_alert) {
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
$color=1;
$sql = sprintf ("SELECT talert_template_modules.*,tcompound_alert.operation
FROM talert_template_modules, tcompound_alert
WHERE tcompound_alert.id_aam = talert_template_modules.id
AND tcompound_alert.id = %d", $id_combined_alert);
$result = get_db_all_rows_sql ($sql);
if ($result === false)
return;
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
echo "<table width=400 cellpadding=2 cellspacing=2 class='databox'>";
echo "<th>".__('Name')."</th>";
echo "<th>".__('Oper')."</th>";
/* Translators: Abbrevation for Time threshold */
echo "<th>".__('Tt')."</th>";
echo "<th>".__('Firing')."</th>";
echo "<th>".__('Time')."</th>";
/* Translators: Abbrevation for Description */
echo "<th>".__('Desc')."</th>";
echo "<th>".__('Recovery')."</th>";
echo "<th>".__('MinMax.Al')."</th>";
echo "<th>".__('Days')."</th>";
echo "<th>".__('Fired')."</th>";
foreach ($result as $row2) {
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
if ($color == 1) {
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
$tdcolor = "datos";
$color = 0;
} else {
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
$tdcolor = "datos2";
$color = 1;
}
echo "<tr>";
if ($row2["disable"] == 1) {
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
$tdcolor = "datos3";
}
echo "<td class=$tdcolor>".get_db_sql ("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo =".$row2["id_agente_modulo"])."</td>";
echo "<td class=$tdcolor>".$row2["operation"]."</td>";
2008-04-03 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: IA to prediction in description. * pandoradb.sql: Added priority to alert and custom recovery fields. * include/styles/tip.css, include/styles/pandora.css: New styles for tooltip info (combined and alerts) and some changes in frames for agent management / view. * include/functions_db.php: Added check_server_status() function to check from console server status. If in 15 minutes there is no updated keepalive from any server, they will be marked as down. And function return down. This function is now called on each page. Added funtions to display alert status in a tooltip. * include/languages/language_en.php: More strings. * include/functions.php: Added several funtions to simplify alert report. * operation/agentes/estado_alertas.php: Updated. Shows also combined alerts and give a lot of information in different tooltips. * operation/agentes/estado_ultimopaquete.php: Clean blank spaces in URL. * operation/agentes/estado_monitores.php: now is possible to force a module refresh from main view. * operation/agentes/ver_agente.php: Tab has been upgraded. * images/mod_data.png, images/mod_data_inc.png images/mod_proc.png images/mod_keepalive.png images/mod_string.png: Added new type icons and updated old ones. * general/header.php: Global check for servers and autorefresh control. * godmode/agentes/alert_manager.php: New alert management for combined alerts, visualization, etc. * godmode/agentes/configurar_agente.php: Included new alert management. * godmode/agentes/alert_manager_editor.php: New alert management editor. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@791 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-03 17:43:34 +02:00
echo "<td class='$tdcolor'>".human_time_description ($row2["time_threshold"])."</td>";
2008-04-03 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: IA to prediction in description. * pandoradb.sql: Added priority to alert and custom recovery fields. * include/styles/tip.css, include/styles/pandora.css: New styles for tooltip info (combined and alerts) and some changes in frames for agent management / view. * include/functions_db.php: Added check_server_status() function to check from console server status. If in 15 minutes there is no updated keepalive from any server, they will be marked as down. And function return down. This function is now called on each page. Added funtions to display alert status in a tooltip. * include/languages/language_en.php: More strings. * include/functions.php: Added several funtions to simplify alert report. * operation/agentes/estado_alertas.php: Updated. Shows also combined alerts and give a lot of information in different tooltips. * operation/agentes/estado_ultimopaquete.php: Clean blank spaces in URL. * operation/agentes/estado_monitores.php: now is possible to force a module refresh from main view. * operation/agentes/ver_agente.php: Tab has been upgraded. * images/mod_data.png, images/mod_data_inc.png images/mod_proc.png images/mod_keepalive.png images/mod_string.png: Added new type icons and updated old ones. * general/header.php: Global check for servers and autorefresh control. * godmode/agentes/alert_manager.php: New alert management for combined alerts, visualization, etc. * godmode/agentes/configurar_agente.php: Included new alert management. * godmode/agentes/alert_manager_editor.php: New alert management editor. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@791 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-03 17:43:34 +02:00
if ($row2["dis_min"]!=0) {
$mytempdata = fmod ($row2["dis_min"], 1);
if ($mytempdata == 0) {
$mymin = intval ($row2["dis_min"]);
} else {
$mymin = format_for_graph ($row2["dis_min"]);
}
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
} else {
$mymin = 0;
}
if ($row2["dis_max"]!=0) {
$mytempdata = fmod ($row2["dis_max"], 1);
if ($mytempdata == 0) {
$mymax = intval ($row2["dis_max"]);
} else {
$mymax = format_for_graph ($row2["dis_max"]);
}
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
} else {
$mymax = 0;
}
if (($mymin == 0) && ($mymax == 0)) {
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
$mymin = __('N/A');
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
$mymax = $mymin;
}
// We have alert text ?
if ($row2["alert_text"]!= "") {
2008-08-12 Esteban Sanchez <estebans@artica.es> * pandoradb_data.sql: Added default languages. * include/streams.php, include/gettext.php: Added to repository. New files to add gettext support of mo files. * include/functions_db.php: Function lang_string() functionallity changed to use gettext library. * include/languages/language_es_es.php, include/languages/language_gl.php, include/languages/language_en.php, include/languages/language_pt_br.php, include/languages/language_it.php, include/languages/language_ast_es.php, include/languages/language_es_la.php, include/languages/language_de.php, include/languages/language_fr.php, include/languages/language_ca.php: Files deleted, they are deprecated since we have moved to gettext. * lude/languages/pt_br.mo, include/languages/es.mo, include/languages/fr.po, include/languages/it.po, include/languages/ca.po, include/languages/ast.po, include/languages/de.po, include/languages/gl.mo: Gettext translations of the previous languages we have in language_*.php files. * include/languages/Makefile: Added to repository to generate index.pot and mo files of each translation. * include/functions_reporting_pdf.php, include/functions_reporting.php, include/config_process.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/agentes/estado_alertas.php, operation/agentes/status_monitor.php, operation/agentes/estado_grupo.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/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, 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_refine.php, godmode/db/db_info.php, godmode/db/db_event.php, godmode/db/db_purge.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_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 string parameters of __() callings to plain english. Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1006 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-12 14:06:25 +02:00
echo "<td class='$tdcolor'>".__('Text')."</td>";
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
} else {
echo "<td class='$tdcolor'>".$mymin."/".$mymax."</td>";
}
// Alert times
echo "<td class='$tdcolor'>";
echo get_alert_times ($row2);
// Description
echo "</td><td class='$tdcolor'>".substr ($row2["descripcion"],0,20);
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
// Has recovery notify activated ?
if ($row2["recovery_notify"] > 0) {
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
$recovery_notify = __('Yes');
} else {
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
$recovery_notify = __('No');
}
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
echo "</td><td class='$tdcolor'>".$recovery_notify;
// calculare firing conditions
if ($row2["alert_text"] != ""){
2008-08-12 Esteban Sanchez <estebans@artica.es> * pandoradb_data.sql: Added default languages. * include/streams.php, include/gettext.php: Added to repository. New files to add gettext support of mo files. * include/functions_db.php: Function lang_string() functionallity changed to use gettext library. * include/languages/language_es_es.php, include/languages/language_gl.php, include/languages/language_en.php, include/languages/language_pt_br.php, include/languages/language_it.php, include/languages/language_ast_es.php, include/languages/language_es_la.php, include/languages/language_de.php, include/languages/language_fr.php, include/languages/language_ca.php: Files deleted, they are deprecated since we have moved to gettext. * lude/languages/pt_br.mo, include/languages/es.mo, include/languages/fr.po, include/languages/it.po, include/languages/ca.po, include/languages/ast.po, include/languages/de.po, include/languages/gl.mo: Gettext translations of the previous languages we have in language_*.php files. * include/languages/Makefile: Added to repository to generate index.pot and mo files of each translation. * include/functions_reporting_pdf.php, include/functions_reporting.php, include/config_process.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/agentes/estado_alertas.php, operation/agentes/status_monitor.php, operation/agentes/estado_grupo.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/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, 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_refine.php, godmode/db/db_info.php, godmode/db/db_event.php, godmode/db/db_purge.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_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 string parameters of __() callings to plain english. Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1006 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-12 14:06:25 +02:00
$firing_cond = __('Text')."(".substr ($row2["alert_text"],0,8).")";
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
} else {
$firing_cond = $row2["min_alerts"]." / ".$row2["max_alerts"];
}
echo "</td><td class='$tdcolor'>".$firing_cond;
// calculate days
$firing_days = get_alert_days ( $row2 );
echo "</td><td class='$tdcolor'>".$firing_days;
// Fired ?
if ($row2["times_fired"]>0) {
2008-08-12 Esteban Sanchez <estebans@artica.es> * pandoradb_data.sql: Added default languages. * include/streams.php, include/gettext.php: Added to repository. New files to add gettext support of mo files. * include/functions_db.php: Function lang_string() functionallity changed to use gettext library. * include/languages/language_es_es.php, include/languages/language_gl.php, include/languages/language_en.php, include/languages/language_pt_br.php, include/languages/language_it.php, include/languages/language_ast_es.php, include/languages/language_es_la.php, include/languages/language_de.php, include/languages/language_fr.php, include/languages/language_ca.php: Files deleted, they are deprecated since we have moved to gettext. * lude/languages/pt_br.mo, include/languages/es.mo, include/languages/fr.po, include/languages/it.po, include/languages/ca.po, include/languages/ast.po, include/languages/de.po, include/languages/gl.mo: Gettext translations of the previous languages we have in language_*.php files. * include/languages/Makefile: Added to repository to generate index.pot and mo files of each translation. * include/functions_reporting_pdf.php, include/functions_reporting.php, include/config_process.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/agentes/estado_alertas.php, operation/agentes/status_monitor.php, operation/agentes/estado_grupo.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/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, 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_refine.php, godmode/db/db_info.php, godmode/db/db_event.php, godmode/db/db_purge.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_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 string parameters of __() callings to plain english. Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1006 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-12 14:06:25 +02:00
echo "<td class='".$tdcolor."' align='center'><img width='20' height='9' src='images/pixel_red.png' title='".__('Alert fired')."'></td>";
} else {
2008-08-12 Esteban Sanchez <estebans@artica.es> * pandoradb_data.sql: Added default languages. * include/streams.php, include/gettext.php: Added to repository. New files to add gettext support of mo files. * include/functions_db.php: Function lang_string() functionallity changed to use gettext library. * include/languages/language_es_es.php, include/languages/language_gl.php, include/languages/language_en.php, include/languages/language_pt_br.php, include/languages/language_it.php, include/languages/language_ast_es.php, include/languages/language_es_la.php, include/languages/language_de.php, include/languages/language_fr.php, include/languages/language_ca.php: Files deleted, they are deprecated since we have moved to gettext. * lude/languages/pt_br.mo, include/languages/es.mo, include/languages/fr.po, include/languages/it.po, include/languages/ca.po, include/languages/ast.po, include/languages/de.po, include/languages/gl.mo: Gettext translations of the previous languages we have in language_*.php files. * include/languages/Makefile: Added to repository to generate index.pot and mo files of each translation. * include/functions_reporting_pdf.php, include/functions_reporting.php, include/config_process.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/agentes/estado_alertas.php, operation/agentes/status_monitor.php, operation/agentes/estado_grupo.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/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, 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_refine.php, godmode/db/db_info.php, godmode/db/db_event.php, godmode/db/db_purge.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_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 string parameters of __() callings to plain english. Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1006 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-12 14:06:25 +02:00
echo "<td class='".$tdcolor."' align='center'><img width='20' height='9' src='images/pixel_green.png' title='".__('Alert not fired')."'></td>";
}
2008-06-15 Esteban Sanchez <estebans@artica.es> * include/functions_html.php: Added to repository. Implements HTML functions. * reporting/fgraph.php: Many style correction fixes, including those regardings tabs and blank spaces, variable names and indentation levels for checkings. Improved dame_fecha(). Added date support to graphic_combined_module(), grafico_modulo_sparse(). The selection of the graphic to show based on parameters has been replaced by a switch. The parameters are parsed with get_parameter() * include/functions_db.php: Style correction of tabs and blanks spaces. Use Pandora database functions on simple querying functions such as dame_perfil(), give_disabled_group(), dame_grupo(), give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many more, there are a lot more to change. Function comprueba_admin() renamed to check_admin (wrap created for old function). Added some checks to get_db_value(), get_db_row() so the SQL is build based on the parameter types. Added get_db_all_rows_sqlfree(), get_db_all_rows_in_table(), get_db_all_rows_field_filter(), get_db_all_fields_in_table(). Added date support to return_moduledata_avg_value(), return_moduledata_max_value(), return_moduledata_min_value(). Added function return_moduledata_sum_value() to get the sum of the values in a module. * include/functions.php: If input is numeric on safe_input, do not clean it, since it's safe by itself. Use mysql_escape_string() on salida_sql(). Added get_report_types(), get_report_name(), get_report_type_data_source() relatives to reports. Added also is_module_data(), is_module_proc(), is_module_inc(), is_module_data_string() to know if a module is from a type. Replaced form_priority() with get_event_types() so the caller of this function will print the select (using print_select). * operation/events/events.php: Replaced form_priorit() with get_event_types(). * ChangeLog: Tab style correction with previous commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
echo "</table>";
2008-04-03 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: IA to prediction in description. * pandoradb.sql: Added priority to alert and custom recovery fields. * include/styles/tip.css, include/styles/pandora.css: New styles for tooltip info (combined and alerts) and some changes in frames for agent management / view. * include/functions_db.php: Added check_server_status() function to check from console server status. If in 15 minutes there is no updated keepalive from any server, they will be marked as down. And function return down. This function is now called on each page. Added funtions to display alert status in a tooltip. * include/languages/language_en.php: More strings. * include/functions.php: Added several funtions to simplify alert report. * operation/agentes/estado_alertas.php: Updated. Shows also combined alerts and give a lot of information in different tooltips. * operation/agentes/estado_ultimopaquete.php: Clean blank spaces in URL. * operation/agentes/estado_monitores.php: now is possible to force a module refresh from main view. * operation/agentes/ver_agente.php: Tab has been upgraded. * images/mod_data.png, images/mod_data_inc.png images/mod_proc.png images/mod_keepalive.png images/mod_string.png: Added new type icons and updated old ones. * general/header.php: Global check for servers and autorefresh control. * godmode/agentes/alert_manager.php: New alert management for combined alerts, visualization, etc. * godmode/agentes/configurar_agente.php: Included new alert management. * godmode/agentes/alert_manager_editor.php: New alert management editor. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@791 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-03 17:43:34 +02:00
}
2008-06-18 Esteban Sanchez <estebans@artica.es> * functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-19 11:01:12 +02:00
/**
* @deprecated use get_server_info instead
* Get statistical information for a given server
*
* @param int Server id to get status.
*
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
* @return array Server info array
*/
function server_status ($id_server) {
$serverinfo = get_server_info ($id_server);
return $serverinfo[$id_server];
}
/**
* Subfunciton for less typing
* @ignore
*/
function temp_sql_delete ($table, $row, $value) {
global $error; //Globalize the errors variable
$result = process_sql_delete ($table, $row.' = '.$value);
if ($result === false) {
$error = true;
}
}
/**
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
* Delete an agent from the database.
*
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
* @param mixed An array of agents ids or a single integer id to be erased
* @param bool Disable the ACL checking, for default false.
*
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
* @return bool False if error, true if success.
*/
function delete_agent ($id_agents, $disableACL = false) {
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
global $config;
$error = false;
//Convert single values to an array
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
if (! is_array ($id_agents))
$id_agents = (array) $id_agents;
//Start transaction
process_sql_begin ();
foreach ($id_agents as $id_agent) {
$id_agent = (int) $id_agent; //Cast as integer
if ($id_agent < 1)
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
continue;
2009-11-27 Sancho lerena <slerena@artica.es> * operation/menu.php: User section has no ACL check, always can be seen. * index.php: Added suppor for user-defined custom language (this code was on my disk for 3 months, pending to be commited!). * include/functions_db.php, * include/functions_agents.php, * godmode/alerts/alert_list.php, * godmode/agentes/modificar_agente.php, * godmode/agentes/configurar_agente.php: Added audit calls to several management operations who don't have or have insufficient audit info. * godmode/users/configure_user.php: Fixed several annoyings bugs. Added custom language support, and added more audit info on management operations. * godmode/users/user_list.php: More audit info. * include/config_process.php: Add new debug option to render error log to /pandora_console.log. Also set timezone if not defined (this makes warnings on several PHP 5.x setups). Added user custom language support. * include/functions_events.php: More audit info. Fixed problems with HTML encoding render. * functions_io.php: Some cleaning. * include/functions_messages.php: Fixed problems with HTML encoding render. * functions_ui.php: Fixed problems with HTML encoding render in print_string_substr() function. * auth/mysql.php: is_user_admin() functions seems to be broken ¿?¿!. Fixed. * styles/pandora.css: removed green colored left border in default style. * message.php, incident*: Fixed problems with HTML encoding render. * user.php: Better ACL check before let user to view/edit another user. * user_edit: Removed some un-used form fields, some arrangements in layout, and FIXED forever problems with password change (new code written). * users/user_statistics.php: Now user can see its own audit records. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2139 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-11-27 21:02:12 +01:00
$agent_name = get_agent_name($id_agent, "");
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
/* Check for deletion permissions */
$id_group = get_agent_group ($id_agent);
if ((! give_acl ($config['id_user'], $id_group, "AW")) && !$disableACL) {
process_sql_rollback ();
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
return false;
}
//A variable where we store that long subquery thing for
//modules
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
$where_modules = "ANY(SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = ".$id_agent.")";
//IP address
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
$sql = sprintf ("SELECT id_ag FROM taddress_agent, taddress
WHERE taddress_agent.id_a = taddress.id_a
AND id_agent = %d",
$id_agent);
$addresses = get_db_all_rows_sql ($sql);
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
if ($addresses === false)
$addresses = array ();
foreach ($addresses as $address) {
temp_sql_delete ("taddress_agent", "id_ag", $address["id_ag"]);
}
2009-01-12 Sancho Lerena <slerena@artica.es> * pandoradb.sql: Removed fields "timestamp" and "id_agente" (and altered some indexes) on tagente_datos, tagente_datos_string and tagente_datos_inc. tagente_estado table: removed cambio, added status_changes, last_status. tagente_modulo: added five new fields (warning,critical mgmt., flipflop detection, history module and delete_pending bit. * agent_manager.php: Group ALL not shown anymore. * configurar_agente.php: Support for new options. Delete a module now mark for deletion the module, not delete data (It's VERY slow!). * modificar_agente.php: Delete agent now uses the global function, minor fixes. * module_manager_editor.php: New fields initializacion. * module_manager_editor_network.php: At this time, the first module editor who implements the new fields and improve old ones (tcp data). * setup.php: Added support for new token: event_view_hr (Filter of max old (in hr) for the event viewer. Removed old tokens show_unknown and show_lastalert. * functions.php: format_for_graph() has an important BUG that makes all units rendered without the "K" !!!!. Fixed. * delete_agent.php: Delete remote config (if present). Also mark for deletion modules instead delete them (and let the data without being deleted, because it's a HUGE consuming time, and it's left for the daily db maintance process). * estado_agente.php: Updated code for view new status. * estado_generalagente.php: Total packets are removed from this view, this was a huge time consuming SQL operation that don't give important infomation. Groupname is now visualized. * estado_ultimopaquete.php, * estado_monitores.php, * estado_grupo.php: Rewritten much code to view new status and other minor changes. * ver_agente.php: Data view now works under the tabs and other minor changes. * events.php: Support for the new events and status. Added filter for username and for a max. hours old events. Some boxes are now hidden by default. * fgraph.php: Some graphs are now fixed and uses tagente_datos and tagent_access with utimestamp and without id_agent index. Works faster * images/*: Updated icons (module types) and two new bulb colors. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1326 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 04:53:33 +01:00
// We cannot delete tagente_datos and tagente_datos_string here
// because it's a huge ammount of time. tagente_module has a special
// field to mark for delete each module of agent deleted and in
// daily maintance process, all data for that modules are deleted
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
//Alert
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
temp_sql_delete ("talert_compound", "id_agent", $id_agent);
temp_sql_delete ("talert_template_modules", "id_agent_module", $where_modules);
//Events (up/down monitors)
// Dont delete here, could be very time-exausting, let the daily script
// delete them after XXX days
// temp_sql_delete ("tevento", "id_agente", $id_agent);
//Graphs, layouts & reports
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
temp_sql_delete ("tgraph_source", "id_agent_module", $where_modules);
temp_sql_delete ("tlayout_data", "id_agente_modulo", $where_modules);
temp_sql_delete ("treport_content", "id_agent_module", $where_modules);
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
//Planned Downtime
temp_sql_delete ("tplanned_downtime_agents", "id_agent", $id_agent);
//The status of the module
temp_sql_delete ("tagente_estado", "id_agente", $id_agent);
//The actual modules, don't put anything based on
// DONT Delete this, just mark for deletion
// temp_sql_delete ("tagente_modulo", "id_agente", $id_agent);
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
process_sql_update ('tagente_modulo',
array ('delete_pending' => 1, 'disabled' => 1),
'id_agente = '. $id_agent);
2009-01-12 Sancho Lerena <slerena@artica.es> * pandoradb.sql: Removed fields "timestamp" and "id_agente" (and altered some indexes) on tagente_datos, tagente_datos_string and tagente_datos_inc. tagente_estado table: removed cambio, added status_changes, last_status. tagente_modulo: added five new fields (warning,critical mgmt., flipflop detection, history module and delete_pending bit. * agent_manager.php: Group ALL not shown anymore. * configurar_agente.php: Support for new options. Delete a module now mark for deletion the module, not delete data (It's VERY slow!). * modificar_agente.php: Delete agent now uses the global function, minor fixes. * module_manager_editor.php: New fields initializacion. * module_manager_editor_network.php: At this time, the first module editor who implements the new fields and improve old ones (tcp data). * setup.php: Added support for new token: event_view_hr (Filter of max old (in hr) for the event viewer. Removed old tokens show_unknown and show_lastalert. * functions.php: format_for_graph() has an important BUG that makes all units rendered without the "K" !!!!. Fixed. * delete_agent.php: Delete remote config (if present). Also mark for deletion modules instead delete them (and let the data without being deleted, because it's a HUGE consuming time, and it's left for the daily db maintance process). * estado_agente.php: Updated code for view new status. * estado_generalagente.php: Total packets are removed from this view, this was a huge time consuming SQL operation that don't give important infomation. Groupname is now visualized. * estado_ultimopaquete.php, * estado_monitores.php, * estado_grupo.php: Rewritten much code to view new status and other minor changes. * ver_agente.php: Data view now works under the tabs and other minor changes. * events.php: Support for the new events and status. Added filter for username and for a max. hours old events. Some boxes are now hidden by default. * fgraph.php: Some graphs are now fixed and uses tagente_datos and tagent_access with utimestamp and without id_agent index. Works faster * images/*: Updated icons (module types) and two new bulb colors. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1326 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 04:53:33 +01:00
// Access entries
// Dont delete here, this records are deleted in daily script
// temp_sql_delete ("tagent_access", "id_agent", $id_agent);
// tagente_datos_inc
// Dont delete here, this records are deleted later, in database script
// temp_sql_delete ("tagente_datos_inc", "id_agente_modulo", $where_modules);
2009-01-12 Sancho Lerena <slerena@artica.es> * pandoradb.sql: Removed fields "timestamp" and "id_agente" (and altered some indexes) on tagente_datos, tagente_datos_string and tagente_datos_inc. tagente_estado table: removed cambio, added status_changes, last_status. tagente_modulo: added five new fields (warning,critical mgmt., flipflop detection, history module and delete_pending bit. * agent_manager.php: Group ALL not shown anymore. * configurar_agente.php: Support for new options. Delete a module now mark for deletion the module, not delete data (It's VERY slow!). * modificar_agente.php: Delete agent now uses the global function, minor fixes. * module_manager_editor.php: New fields initializacion. * module_manager_editor_network.php: At this time, the first module editor who implements the new fields and improve old ones (tcp data). * setup.php: Added support for new token: event_view_hr (Filter of max old (in hr) for the event viewer. Removed old tokens show_unknown and show_lastalert. * functions.php: format_for_graph() has an important BUG that makes all units rendered without the "K" !!!!. Fixed. * delete_agent.php: Delete remote config (if present). Also mark for deletion modules instead delete them (and let the data without being deleted, because it's a HUGE consuming time, and it's left for the daily db maintance process). * estado_agente.php: Updated code for view new status. * estado_generalagente.php: Total packets are removed from this view, this was a huge time consuming SQL operation that don't give important infomation. Groupname is now visualized. * estado_ultimopaquete.php, * estado_monitores.php, * estado_grupo.php: Rewritten much code to view new status and other minor changes. * ver_agente.php: Data view now works under the tabs and other minor changes. * events.php: Support for the new events and status. Added filter for username and for a max. hours old events. Some boxes are now hidden by default. * fgraph.php: Some graphs are now fixed and uses tagente_datos and tagent_access with utimestamp and without id_agent index. Works faster * images/*: Updated icons (module types) and two new bulb colors. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1326 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 04:53:33 +01:00
// Delete remote configuration
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
if (isset ($config["remote_config"])) {
2009-11-27 Sancho lerena <slerena@artica.es> * operation/menu.php: User section has no ACL check, always can be seen. * index.php: Added suppor for user-defined custom language (this code was on my disk for 3 months, pending to be commited!). * include/functions_db.php, * include/functions_agents.php, * godmode/alerts/alert_list.php, * godmode/agentes/modificar_agente.php, * godmode/agentes/configurar_agente.php: Added audit calls to several management operations who don't have or have insufficient audit info. * godmode/users/configure_user.php: Fixed several annoyings bugs. Added custom language support, and added more audit info on management operations. * godmode/users/user_list.php: More audit info. * include/config_process.php: Add new debug option to render error log to /pandora_console.log. Also set timezone if not defined (this makes warnings on several PHP 5.x setups). Added user custom language support. * include/functions_events.php: More audit info. Fixed problems with HTML encoding render. * functions_io.php: Some cleaning. * include/functions_messages.php: Fixed problems with HTML encoding render. * functions_ui.php: Fixed problems with HTML encoding render in print_string_substr() function. * auth/mysql.php: is_user_admin() functions seems to be broken ¿?¿!. Fixed. * styles/pandora.css: removed green colored left border in default style. * message.php, incident*: Fixed problems with HTML encoding render. * user.php: Better ACL check before let user to view/edit another user. * user_edit: Removed some un-used form fields, some arrangements in layout, and FIXED forever problems with password change (new code written). * users/user_statistics.php: Now user can see its own audit records. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2139 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-11-27 21:02:12 +01:00
$agent_md5 = md5 ($agent_name, FALSE);
if (file_exists ($config["remote_config"]."/md5/".$agent_md5.".md5")) {
// Agent remote configuration editor
$file_name = $config["remote_config"]."/conf/".$agent_md5.".conf";
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
@unlink ($file_name);
$file_name = $config["remote_config"]."/md5/".$agent_md5.".md5";
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
@unlink ($file_name);
}
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
}
//And at long last, the agent
temp_sql_delete ("tagente", "id_agente", $id_agent);
2009-11-27 Sancho lerena <slerena@artica.es> * operation/menu.php: User section has no ACL check, always can be seen. * index.php: Added suppor for user-defined custom language (this code was on my disk for 3 months, pending to be commited!). * include/functions_db.php, * include/functions_agents.php, * godmode/alerts/alert_list.php, * godmode/agentes/modificar_agente.php, * godmode/agentes/configurar_agente.php: Added audit calls to several management operations who don't have or have insufficient audit info. * godmode/users/configure_user.php: Fixed several annoyings bugs. Added custom language support, and added more audit info on management operations. * godmode/users/user_list.php: More audit info. * include/config_process.php: Add new debug option to render error log to /pandora_console.log. Also set timezone if not defined (this makes warnings on several PHP 5.x setups). Added user custom language support. * include/functions_events.php: More audit info. Fixed problems with HTML encoding render. * functions_io.php: Some cleaning. * include/functions_messages.php: Fixed problems with HTML encoding render. * functions_ui.php: Fixed problems with HTML encoding render in print_string_substr() function. * auth/mysql.php: is_user_admin() functions seems to be broken ¿?¿!. Fixed. * styles/pandora.css: removed green colored left border in default style. * message.php, incident*: Fixed problems with HTML encoding render. * user.php: Better ACL check before let user to view/edit another user. * user_edit: Removed some un-used form fields, some arrangements in layout, and FIXED forever problems with password change (new code written). * users/user_statistics.php: Now user can see its own audit records. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2139 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-11-27 21:02:12 +01:00
audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "Agent management",
2009-11-27 Sancho lerena <slerena@artica.es> * operation/menu.php: User section has no ACL check, always can be seen. * index.php: Added suppor for user-defined custom language (this code was on my disk for 3 months, pending to be commited!). * include/functions_db.php, * include/functions_agents.php, * godmode/alerts/alert_list.php, * godmode/agentes/modificar_agente.php, * godmode/agentes/configurar_agente.php: Added audit calls to several management operations who don't have or have insufficient audit info. * godmode/users/configure_user.php: Fixed several annoyings bugs. Added custom language support, and added more audit info on management operations. * godmode/users/user_list.php: More audit info. * include/config_process.php: Add new debug option to render error log to /pandora_console.log. Also set timezone if not defined (this makes warnings on several PHP 5.x setups). Added user custom language support. * include/functions_events.php: More audit info. Fixed problems with HTML encoding render. * functions_io.php: Some cleaning. * include/functions_messages.php: Fixed problems with HTML encoding render. * functions_ui.php: Fixed problems with HTML encoding render in print_string_substr() function. * auth/mysql.php: is_user_admin() functions seems to be broken ¿?¿!. Fixed. * styles/pandora.css: removed green colored left border in default style. * message.php, incident*: Fixed problems with HTML encoding render. * user.php: Better ACL check before let user to view/edit another user. * user_edit: Removed some un-used form fields, some arrangements in layout, and FIXED forever problems with password change (new code written). * users/user_statistics.php: Now user can see its own audit records. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2139 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-11-27 21:02:12 +01:00
"Deleted agent '$agent_name'");
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
/* Break the loop on error */
if ($error)
break;
}
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
if ($error) {
process_sql_rollback ();
return false;
} else {
process_sql_commit ();
return true;
}
}
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
/**
* This function gets the agent group for a given agent module
*
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
* @param int The agent module id
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
*
* @return int The group id
*/
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
function get_agentmodule_group ($id_module) {
$agent = (int) get_agentmodule_agent ((int) $id_module);
return (int) get_agent_group ($agent);
}
/**
* This function gets the group for a given agent
*
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
* @param int The agent id
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
*
* @return int The group id
*/
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
function get_agent_group ($id_agent) {
return (int) get_db_value ('id_grupo', 'tagente', 'id_agente', (int) $id_agent);
}
/**
* This function gets the group name for a given group id
*
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
* @param int The group id
* @param boolean $returnAllGroup Flag the return group, by default false.
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
*
* @return string The group name
*/
function get_group_name ($id_group, $returnAllGroup = false) {
if($id_group > 0)
return (string) get_db_value ('nombre', 'tgrupo', 'id_grupo', (int) $id_group);
elseif($returnAllGroup)
return "All";
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new functions and better security and validation * pandora_console/include/functions_db.php: Renamed some functions and created agentmodule functions for consistency with documentation and to avoid searching for and typing certain function names: get_agentmodules is now get_agent_modules; dame_grupo is now get_group_name; dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name; dame_nombre_modulo_agentemodulo is now get_agentmodule_name; dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type; dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is now get_group_name; get_agentmodule_count is get_agent_modules_count; get_agentmodule_group is new; get_agent_group is new; * pandora_console/include/functions_reporting.php, pandora_console/include/functions.php, pandora_console/operation/incidents/incident.php, pandora_console/operation/users/user.php, pandora_console/operation/users/user_edit.php, pandora_console/operation/events/events.php, pandora_console/operation/visual_console/index.php, pandora_console/operation/agentes/estado_grupo.php, pandora_console/operation/agentes/export_csv.php, pandora_console/operation/agentes/estado_agente.php, pandora_console/operation/agentes/estado_ultimopaquete.php, pandora_console/operation/agentes/estado_generalagente.php, pandora_console/operation/agentes/sla_view.php, pandora_console/operation/agentes/exportdata.php, pandora_console/operation/agentes/ver_agente.php, pandora_console/operation/agentes/tactical.php, pandora_console/operation/agentes/networkmap.php, pandora_console/operation/messages/message.php, pandora_console/operation/reporting/reporting_xml.php, pandora_console/operation/reporting/reporting_viewer.php, pandora_console/reporting/fgraph.php, pandora_console/godmode/groups/group_list.php, pandora_console/godmode/users/user_list.php, pandora_console/godmode/users/configure_user.php, pandora_console/godmode/db/db_refine.php, pandora_console/godmode/db/db_info.php, pandora_console/godmode/db/db_purge.php, pandora_console/godmode/agentes/manage_config.php, pandora_console/godmode/agentes/modificar_agente.php, pandora_console/godmode/agentes/configurar_agente.php, pandora_console/godmode/agentes/manage_config_remote.php, pandora_console/godmode/modules/manage_network_components_form_network.php, pandora_console/godmode/modules/manage_network_components_form_wmi.php, pandora_console/godmode/reporting/reporting_builder.php, pandora_console/godmode/reporting/map_builder.php, pandora_console/godmode/reporting/graph_builder.php: Renamed functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-12 22:54:40 +01:00
}
2009-01-07 16:57:33 +01:00
/**
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
* Gets all module groups. (General, Networking, System).
*
* Module groups are merely for sorting frontend
2009-01-07 16:57:33 +01:00
*
* @return array All module groups
*/
2009-01-07 16:57:33 +01:00
function get_modulegroups () {
$result = get_db_all_fields_in_table ("tmodule_group");
$return = array ();
if (empty ($result)) {
return $return;
}
foreach ($result as $modulegroup) {
$return[$modulegroup["id_mg"]] = $modulegroup["name"];
}
return $return;
}
/**
* Gets a modulegroup name based on the id
*
2009-01-12 Esteban Sanchez <estebans@artica.es> * godmode/agentes/alert_manager.php: Complete rewritten of the alert system when assigned alerts to an agent. * pandoradb.sql: New tables for alert system. These are: talert_commands, talert_actions, talert_templates, talert_template_modules, talert_template_module_actions. No migration tool is available yet. * godmode/alerts/configure_alert_template.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php: Added to repository. Administration interface to new alert system. * godmode/alerts/modify_alert.php: Deleted from repository. * godmode/setup/setup.php: Added an example of the date format. Main table has now percentage width. * godmode/menu.php, operation/menu.php: Added new alert options. Removed refr value when it's not neccesary. * include/styles/pandora.css: Added width to textarea elements. Style correction and cleanup. Tables doesn't have a odd-even pattern, but the hovered row now changes its colour. New styles for alert pages. * include/functions_custom_graphs.php: Added to repository. custom graphs functions moved here. * include/functions_incidents.php, include/functions_events.php: Moved to LGPL. Style comment corrections. * include/functions_html.php: Documentation style correction. Added print_input_file() and print_label(). * include/functions_ui.php: Doc style correction. * operation/reporting/graph_viewer.php: Include new function file with custom graphs. Use generic functions. * index.php: Unset pass from POST and REQUEST arrays. * include/functions_db.php: Some documentation updated to new format. Added format_array_to_update_sql() to generate SQL sentences for updates. Style correction. * godmode/agentes/configurar_agente.php: Variables renamed to have a meaning. * extensions/update_manager/main.php: Mark an string translatable. * extensions/update_manager/lib/libupdate_manager_client.php, godmode/alerts/configure_alert.php, include/functions.php, godmode/agentes/module_manager.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, godmode/agentes/manage_config.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
* @param int The id of the modulegroup
2009-01-07 16:57:33 +01:00
*
* @return string The modulegroup name
*/
2009-01-07 16:57:33 +01:00
function get_modulegroup_name ($modulegroup_id) {
return (string) get_db_value ('name', 'tmodule_group', 'id_mg', (int) $modulegroup_id);
}
/**
* Inserts strings into database
*
* The number of values should be the same or a positive integer multiple as the number of rows
* If you have an associate array (eg. array ("row1" => "value1")) you can use this function with ($table, array_keys ($array), $array) in it's options
* All arrays and values should have been cleaned before passing. It's not neccessary to add quotes.
*
* @param string Table to insert into
* @param mixed A single value or array of values to insert (can be a multiple amount of rows)
*
* @return mixed False in case of error or invalid values passed. Affected rows otherwise
*/
function process_sql_insert ($table, $values) {
//Empty rows or values not processed
if (empty ($values))
return false;
$values = (array) $values;
$query = sprintf ("INSERT INTO `%s` ", $table);
$fields = array ();
$values_str = '';
$i = 1;
$max = count ($values);
foreach ($values as $field => $value) { //Add the correct escaping to values
if ($field[0] != "`") {
$field = "`".$field."`";
}
array_push ($fields, $field);
if (is_null ($value)) {
$values_str .= "NULL";
} elseif (is_int ($value) || is_bool ($value)) {
$values_str .= sprintf ("%d", $value);
} else if (is_float ($value) || is_double ($value)) {
$values_str .= sprintf ("%f", $value);
} else {
$values_str .= sprintf ("'%s'", $value);
}
if ($i < $max) {
$values_str .= ",";
}
$i++;
}
$query .= '('.implode (', ', $fields).')';
$query .= ' VALUES ('.$values_str.')';
return process_sql ($query, 'insert_id');
}
/**
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
* Updates a database record.
*
* All values should be cleaned before passing. Quoting isn't necessary.
* Examples:
*
* <code>
2009-08-24 Miguel de Dios <miguel.dedios@artica.es> * include/functions_menu.php, include/functions_html.php, include/functions_events.php, include/functions_messages.php, include/functions_modules.php, include/functions_exportserver.php, include/functions_reporting.php, include/functions_filemanager.php, include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php, include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php, include/functions_networkmap.php, include/functions_servers.php, include/FusionCharts/FusionCharts_Gen.php, include/FusionCharts/FusionCharts.php, include/functions_network_profiles.php, include/gettext.php, include/functions_network_components.php, include/functions_visual_map.php, include/fgraph2.php, include/Image/image_functions.php, include/functions_config.php, include/help/en/help_plugin_parameters.php, include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php, include/help/en/help_postprocess.php, include/help/en/help_prediction_source_module.php, include/help/en/help_date_format.php, include/help/en/help_recontask.php, include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php, include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php, include/help/en/help_agent_status.php, include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php, include/help/en/help_alert_type.php, include/help/en/help_network_component.php, include/help/en/help_time_stamp-comparation.php, include/help/en/help_eventview.php, include/help/en/help_timesource.php, include/help/en/help_alert_validation.php, include/help/en/help_map_builder.php, include/help/en/help_alert_recovery.php, include/help/en/help_module_type.php, include/help/en/help_planned_downtime.php, include/help/en/help_serverlag.php, include/help/en/help_alerts.php, include/help/en/help_snmpwalk.php, include/help/en/help_module_definition.php, include/help/en/help_plugin_definition.php, include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php include/help/en/help_manageconfig.php, include/help/es/help_alert_validation.php, include/help/es/help_plugin_parameters.php, include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php, include/help/es/help_map_builder.php, include/help/es/help_postprocess.php, include/help/es/help_date_format.php, include/help/es/help_alert_recovery.php, include/help/es/help_prediction_source_module.php, include/help/es/help_module_type.php, include/help/es/help_planned_downtime.php, include/help/es/help_alert-matches.php, include/help/es/help_recontask.php, include/help/es/help_alerts.php, include/help/es/help_serverlag.php, include/help/es/help_snmpwalk.php, include/help/es/help_module_definition.php, include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php, include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php, include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php, include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php, include/help/es/help_wminamespace.php, include/help/es/help_network_component.php, include/help/es/help_time_stamp-comparation.php, include/help/es/help_manageconfig.php, include/help/es/help_timesource.php, include/config_process.php, include/functions_ui.php, include/htmlawed.php, include/functions_custom_graphs.php, include/fgraph.php, include/functions_incidents.php, include/functions.php, include/functions_agents.php, include/functions_db.php, include/functions_themes.php, include/streams.php, include/functions_fsgraph.php, include/functions_alerts.php, include/functions_reports.php, include/functions_extensions.php, include/functions_ui_renders.php: change comments blocks for delete the warnings to construct phpDoc Files, give a struct and order in the phpDoc files. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
* process_sql_update ('table', array ('field' => 1), array ('id' => $id));
* process_sql_update ('table', array ('field' => 1), array ('id' => $id, 'name' => $name));
* process_sql_update ('table', array ('field' => 1), array ('id' => $id, 'name' => $name), 'OR');
* process_sql_update ('table', array ('field' => 2), 'id in (1, 2, 3) OR id > 10');
* </code>
*
* @param string Table to insert into
* @param array An associative array of values to update
* @param mixed An associative array of field and value matches. Will be joined
* with operator specified by $where_join. A custom string can also be provided.
* If nothing is provided, the update will affect all rows.
* @param string When a $where parameter is given, this will work as the glue
* between the fields. "AND" operator will be use by default. Other values might
* be "OR", "AND NOT", "XOR"
*
* @return mixed False in case of error or invalid values passed. Affected rows otherwise
*/
function process_sql_update ($table, $values, $where = false, $where_join = 'AND') {
$query = sprintf ("UPDATE `%s` SET %s",
$table,
format_array_to_update_sql ($values));
if ($where) {
if (is_string ($where)) {
// No clean, the caller should make sure all input is clean, this is a raw function
$query .= " WHERE ".$where;
} else if (is_array ($where)) {
$query .= format_array_to_where_clause_sql ($where, $where_join, ' WHERE ');
}
}
return process_sql ($query);
}
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
/**
* Delete database records.
*
* All values should be cleaned before passing. Quoting isn't necessary.
* Examples:
*
2009-08-24 Miguel de Dios <miguel.dedios@artica.es> * include/functions_menu.php, include/functions_html.php, include/functions_events.php, include/functions_messages.php, include/functions_modules.php, include/functions_exportserver.php, include/functions_reporting.php, include/functions_filemanager.php, include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php, include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php, include/functions_networkmap.php, include/functions_servers.php, include/FusionCharts/FusionCharts_Gen.php, include/FusionCharts/FusionCharts.php, include/functions_network_profiles.php, include/gettext.php, include/functions_network_components.php, include/functions_visual_map.php, include/fgraph2.php, include/Image/image_functions.php, include/functions_config.php, include/help/en/help_plugin_parameters.php, include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php, include/help/en/help_postprocess.php, include/help/en/help_prediction_source_module.php, include/help/en/help_date_format.php, include/help/en/help_recontask.php, include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php, include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php, include/help/en/help_agent_status.php, include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php, include/help/en/help_alert_type.php, include/help/en/help_network_component.php, include/help/en/help_time_stamp-comparation.php, include/help/en/help_eventview.php, include/help/en/help_timesource.php, include/help/en/help_alert_validation.php, include/help/en/help_map_builder.php, include/help/en/help_alert_recovery.php, include/help/en/help_module_type.php, include/help/en/help_planned_downtime.php, include/help/en/help_serverlag.php, include/help/en/help_alerts.php, include/help/en/help_snmpwalk.php, include/help/en/help_module_definition.php, include/help/en/help_plugin_definition.php, include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php include/help/en/help_manageconfig.php, include/help/es/help_alert_validation.php, include/help/es/help_plugin_parameters.php, include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php, include/help/es/help_map_builder.php, include/help/es/help_postprocess.php, include/help/es/help_date_format.php, include/help/es/help_alert_recovery.php, include/help/es/help_prediction_source_module.php, include/help/es/help_module_type.php, include/help/es/help_planned_downtime.php, include/help/es/help_alert-matches.php, include/help/es/help_recontask.php, include/help/es/help_alerts.php, include/help/es/help_serverlag.php, include/help/es/help_snmpwalk.php, include/help/es/help_module_definition.php, include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php, include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php, include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php, include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php, include/help/es/help_wminamespace.php, include/help/es/help_network_component.php, include/help/es/help_time_stamp-comparation.php, include/help/es/help_manageconfig.php, include/help/es/help_timesource.php, include/config_process.php, include/functions_ui.php, include/htmlawed.php, include/functions_custom_graphs.php, include/fgraph.php, include/functions_incidents.php, include/functions.php, include/functions_agents.php, include/functions_db.php, include/functions_themes.php, include/streams.php, include/functions_fsgraph.php, include/functions_alerts.php, include/functions_reports.php, include/functions_extensions.php, include/functions_ui_renders.php: change comments blocks for delete the warnings to construct phpDoc Files, give a struct and order in the phpDoc files. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
* <code>
* process_sql_delete ('table', array ('id' => 1));
* // DELETE FROM table WHERE id = 1
* process_sql_delete ('table', array ('id' => 1, 'name' => 'example'));
* // DELETE FROM table WHERE id = 1 AND name = 'example'
* process_sql_delete ('table', array ('id' => 1, 'name' => 'example'), 'OR');
* // DELETE FROM table WHERE id = 1 OR name = 'example'
* process_sql_delete ('table', 'id in (1, 2, 3) OR id > 10');
* // DELETE FROM table WHERE id in (1, 2, 3) OR id > 10
* </code>
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
*
* @param string Table to insert into
* @param array An associative array of values to update
* @param mixed An associative array of field and value matches. Will be joined
* with operator specified by $where_join. A custom string can also be provided.
* If nothing is provided, the update will affect all rows.
* @param string When a $where parameter is given, this will work as the glue
* between the fields. "AND" operator will be use by default. Other values might
* be "OR", "AND NOT", "XOR"
*
* @return mixed False in case of error or invalid values passed. Affected rows otherwise
*/
function process_sql_delete ($table, $where, $where_join = 'AND') {
if (empty ($where))
/* Should avoid any mistake that lead to deleting all data */
return false;
$query = sprintf ("DELETE FROM `%s` WHERE ", $table);
if ($where) {
if (is_string ($where)) {
/* FIXME: Should we clean the string for sanity?
Who cares if this is deleting data... */
$query .= $where;
} else if (is_array ($where)) {
$query .= format_array_to_where_clause_sql ($where, $where_join);
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
}
}
return process_sql ($query);
}
2009-02-19 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandoradb_migrate_20_to_21.sql, pandora_db.sql: Altered tmensajes for unixtime * general/header.php: New messages function added flashing acknowledgment in case of new messages * general/logon_ok.php: Since messages are now in header, they don't need to be there per se * images/close.png, images/transparent.png: Background and close button for overlays. * include/javascript/jquery.pandora.js: Used for loop for flashing thing and added overlay function * include/javascript/jquery.overlay.js: You'll need this for overlay * include/functions_messages.php: Message functions are here. Messages are fully abstracted so they can be drop-in replaced with something else * include/functions_ui.php: Small fixes. Not necessary to load en language files for javascript since they're empty, it only adds to load/interpret * include/functions_db.php: Added get_group_users and get_db_array. Useful * include/functions_html.php: Small doc fixes and fixed table heads * include/styles/pandora.css: Added Overlay classes * ajax.php: We need to call safe_url_extraclean for cross scripting * operation/messages/message.php: Rebuilt to use new functions * operation/menu.php: New message link instead of group link * operation/visual_console/render_view.php: Fixed conflict with timer * index.php: Added div for overlay (not in pure mode) and fixed erroneous div in pure mode. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1469 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 22:34:27 +01:00
/**
* Starts a database transaction.
*/
function process_sql_begin () {
mysql_query ('SET AUTOCOMMIT = 0');
mysql_query ('START TRANSACTION');
}
/**
* Commits a database transaction.
*/
function process_sql_commit () {
mysql_query ('COMMIT');
mysql_query ('SET AUTOCOMMIT = 0');
}
/**
* Rollbacks a database transaction.
*/
function process_sql_rollback () {
mysql_query ('ROLLBACK');
mysql_query ('SET AUTOCOMMIT = 0');
}
2009-02-19 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandoradb_migrate_20_to_21.sql, pandora_db.sql: Altered tmensajes for unixtime * general/header.php: New messages function added flashing acknowledgment in case of new messages * general/logon_ok.php: Since messages are now in header, they don't need to be there per se * images/close.png, images/transparent.png: Background and close button for overlays. * include/javascript/jquery.pandora.js: Used for loop for flashing thing and added overlay function * include/javascript/jquery.overlay.js: You'll need this for overlay * include/functions_messages.php: Message functions are here. Messages are fully abstracted so they can be drop-in replaced with something else * include/functions_ui.php: Small fixes. Not necessary to load en language files for javascript since they're empty, it only adds to load/interpret * include/functions_db.php: Added get_group_users and get_db_array. Useful * include/functions_html.php: Small doc fixes and fixed table heads * include/styles/pandora.css: Added Overlay classes * ajax.php: We need to call safe_url_extraclean for cross scripting * operation/messages/message.php: Rebuilt to use new functions * operation/menu.php: New message link instead of group link * operation/visual_console/render_view.php: Fixed conflict with timer * index.php: Added div for overlay (not in pure mode) and fixed erroneous div in pure mode. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1469 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 22:34:27 +01:00
/**
* Get all the users belonging to a group.
*
* @param int $id_group The group id to look for
*
* @return array An array with all the users or an empty array
*/
function get_group_users ($id_group, $filter = false) {
if (! is_array ($filter))
$filter = array ();
$filter['id_grupo'] = (int) $id_group;
$resulta = array();
$resulta = get_db_all_rows_filter ("tusuario_perfil", $filter);
// The users of the group All (0) will be also returned
$filter['id_grupo'] = 0;
$resultb = array();
$resultb = get_db_all_rows_filter ("tusuario_perfil", $filter);
if($resulta == false && $resultb == false)
$result = false;
elseif($resulta == false)
$result = $resultb;
elseif($resultb == false)
$result = $resulta;
else
$result = array_merge($resulta,$resultb);
if ($result === false)
return array ();
2009-02-19 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandoradb_migrate_20_to_21.sql, pandora_db.sql: Altered tmensajes for unixtime * general/header.php: New messages function added flashing acknowledgment in case of new messages * general/logon_ok.php: Since messages are now in header, they don't need to be there per se * images/close.png, images/transparent.png: Background and close button for overlays. * include/javascript/jquery.pandora.js: Used for loop for flashing thing and added overlay function * include/javascript/jquery.overlay.js: You'll need this for overlay * include/functions_messages.php: Message functions are here. Messages are fully abstracted so they can be drop-in replaced with something else * include/functions_ui.php: Small fixes. Not necessary to load en language files for javascript since they're empty, it only adds to load/interpret * include/functions_db.php: Added get_group_users and get_db_array. Useful * include/functions_html.php: Small doc fixes and fixed table heads * include/styles/pandora.css: Added Overlay classes * ajax.php: We need to call safe_url_extraclean for cross scripting * operation/messages/message.php: Rebuilt to use new functions * operation/menu.php: New message link instead of group link * operation/visual_console/render_view.php: Fixed conflict with timer * index.php: Added div for overlay (not in pure mode) and fixed erroneous div in pure mode. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1469 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 22:34:27 +01:00
//This removes stale users from the list. This can happen if switched to another auth scheme
//(internal users still exist) or external auth has users removed/inactivated from the list (eg. LDAP)
$retval = array ();
2009-02-19 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandoradb_migrate_20_to_21.sql, pandora_db.sql: Altered tmensajes for unixtime * general/header.php: New messages function added flashing acknowledgment in case of new messages * general/logon_ok.php: Since messages are now in header, they don't need to be there per se * images/close.png, images/transparent.png: Background and close button for overlays. * include/javascript/jquery.pandora.js: Used for loop for flashing thing and added overlay function * include/javascript/jquery.overlay.js: You'll need this for overlay * include/functions_messages.php: Message functions are here. Messages are fully abstracted so they can be drop-in replaced with something else * include/functions_ui.php: Small fixes. Not necessary to load en language files for javascript since they're empty, it only adds to load/interpret * include/functions_db.php: Added get_group_users and get_db_array. Useful * include/functions_html.php: Small doc fixes and fixed table heads * include/styles/pandora.css: Added Overlay classes * ajax.php: We need to call safe_url_extraclean for cross scripting * operation/messages/message.php: Rebuilt to use new functions * operation/menu.php: New message link instead of group link * operation/visual_console/render_view.php: Fixed conflict with timer * index.php: Added div for overlay (not in pure mode) and fixed erroneous div in pure mode. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1469 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 22:34:27 +01:00
foreach ($result as $key => $user) {
if (!is_user ($user)) {
unset ($result[$key]);
} else {
array_push ($retval, get_user_info ($user));
2009-02-19 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandoradb_migrate_20_to_21.sql, pandora_db.sql: Altered tmensajes for unixtime * general/header.php: New messages function added flashing acknowledgment in case of new messages * general/logon_ok.php: Since messages are now in header, they don't need to be there per se * images/close.png, images/transparent.png: Background and close button for overlays. * include/javascript/jquery.pandora.js: Used for loop for flashing thing and added overlay function * include/javascript/jquery.overlay.js: You'll need this for overlay * include/functions_messages.php: Message functions are here. Messages are fully abstracted so they can be drop-in replaced with something else * include/functions_ui.php: Small fixes. Not necessary to load en language files for javascript since they're empty, it only adds to load/interpret * include/functions_db.php: Added get_group_users and get_db_array. Useful * include/functions_html.php: Small doc fixes and fixed table heads * include/styles/pandora.css: Added Overlay classes * ajax.php: We need to call safe_url_extraclean for cross scripting * operation/messages/message.php: Rebuilt to use new functions * operation/menu.php: New message link instead of group link * operation/visual_console/render_view.php: Fixed conflict with timer * index.php: Added div for overlay (not in pure mode) and fixed erroneous div in pure mode. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1469 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 22:34:27 +01:00
}
}
return $retval;
2009-02-19 Evi Vanoost <vanooste@rcbi.rochester.edu> * pandoradb_migrate_20_to_21.sql, pandora_db.sql: Altered tmensajes for unixtime * general/header.php: New messages function added flashing acknowledgment in case of new messages * general/logon_ok.php: Since messages are now in header, they don't need to be there per se * images/close.png, images/transparent.png: Background and close button for overlays. * include/javascript/jquery.pandora.js: Used for loop for flashing thing and added overlay function * include/javascript/jquery.overlay.js: You'll need this for overlay * include/functions_messages.php: Message functions are here. Messages are fully abstracted so they can be drop-in replaced with something else * include/functions_ui.php: Small fixes. Not necessary to load en language files for javascript since they're empty, it only adds to load/interpret * include/functions_db.php: Added get_group_users and get_db_array. Useful * include/functions_html.php: Small doc fixes and fixed table heads * include/styles/pandora.css: Added Overlay classes * ajax.php: We need to call safe_url_extraclean for cross scripting * operation/messages/message.php: Rebuilt to use new functions * operation/menu.php: New message link instead of group link * operation/visual_console/render_view.php: Fixed conflict with timer * index.php: Added div for overlay (not in pure mode) and fixed erroneous div in pure mode. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1469 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 22:34:27 +01:00
}
/**
* Prints a database debug table with all the queries done in the page loading.
*
* This functions does nothing if the config['debug'] flag is not set.
*/
function print_database_debug () {
global $config;
if (! isset ($config['debug']))
return '';
echo '<div class="database_debug_title">'.__('Database debug').'</div>';
$table->id = 'database_debug';
$table->cellpadding = '0';
$table->width = '95%';
$table->align = array ();
$table->align[1] = 'left';
$table->size = array ();
$table->size[0] = '40px';
$table->size[2] = '30%';
$table->size[3] = '40px';
$table->size[4] = '40px';
$table->size[5] = '40px';
$table->data = array ();
$table->head = array ();
$table->head[0] = '#';
$table->head[1] = __('SQL sentence');
$table->head[2] = __('Result');
$table->head[3] = __('Rows');
$table->head[4] = __('Saved');
$table->head[5] = __('Time (ms)');
if (! isset ($config['db_debug']))
$config['db_debug'] = array ();
$i = 1;
foreach ($config['db_debug'] as $debug) {
$data = array ();
$data[0] = $i++;
$data[1] = $debug['sql'];
$data[2] = (empty ($debug['result']) ? __('OK') : $debug['result']);
$data[3] = $debug['affected'];
$data[4] = $debug['saved'];
$data[5] = (isset ($debug['extra']['time']) ? format_numeric ($debug['extra']['time'] * 1000, 0) : '');
array_push ($table->data, $data);
if (($i % 100) == 0) {
print_table ($table);
$table->data = array ();
}
}
print_table ($table);
}
2009-04-02 Sancho Lerena <slerena@artica.es> * pandoradb.sql: Final DB changes proposed for closing this month the DB scheme. tagente-> new server_name field to assign server (old fields will be removed). talert_templates has two new types (warning, critical). tevento has "user_comment" new field. Tserver has three new fields, server_type (so some old fields will be deleted), threads and queued_modules this last two are for statistical options. Tusuario add language type to override global language. * update_manager/main.php: Minor changes for correct ACL usage. Non PM users could see in what revision it the system, but only that. * pandoradb_migrate_v2.x_to_v3.0.sql: Updated script for new DB changes. * general/noaccess.php: Added footer and ending div. Page was very ugly when showing noaccess errors, nobody see it ???. * godmode/menu.php: A LOT of ACL fixes on several options. * godmode/agentes/agent_manager.php: Fixed a crazy floating icon. * godmode/agentes/manage_config_remote.php: A LOT of changes, rewriting stuff, because was not working. This also adds a lot of ACL checks. * godmode/agentes/massive_config.php, massive*: ACL changes. * godmode/agentes/modificar_agente.php: Fixed ACL problems. * godmode/agentes/module_manager_editor.php: Fixed bad module categories for some types (data, plugin and prediction). * godmode/alerts/alert_list.php: Fixed ACL problem. * godmode/reporting/graph_builder.php: Added ACl restriction for non-viewable agents for current user. Seems to be a problem with data with more than 2 sources. * godmode/reporting/map_builder.php: ACL checks improved. * godmode/reporting/reporting_builder.php: ACL checks added (was missing), some code ported from 2.1, other is new. New fields shown in list. * include/functions.php: Fixed the annoying bug of "bad counters" in function human_time_description_raw(). Function used,format_numeric() should not be used never to calculate nothing, only to print formatted strings. * include/functions_db.php: Added function user_access_to_agent() to know if a given user has access to a given agent. * include/functioins_report.php: get_report() should let admin to watch any report. Fixed. * agentes/alerts_status.php: Fixed ACL problem for view alert. * operation/incidents/incident.php: Bad call for pagination() was giving problems to pagination call. Somebody changes pagination() interface and make this broken. Please if you change any interface, be sure that is compatible with old code or make a post in the list about this ! * godmode/users/user_edit.php: Additional ACL check to do not let anybody to watch non accesible users. Even for see the username or description. * reporting/pchart_graph.php:Progress bar shown text in white when > 60%. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1594 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-02 21:16:59 +02:00
/**
* Return access to a specific agent by a specific user
*
2009-04-20 Esteban Sanchez <estebans@artica.es> * godmode/agentes/module_manager_editor.php, godmode/agentes/module_manager_editor_common.php, godmode/agentes/module_manager_editor_data.php, godmode/agentes/module_manager_editor_network.php, godmode/agentes/module_manager_editor_plugin.php, godmode/agentes/module_manager_editor_prediction.php, godmode/agentes/module_manager_editor_wmi.php, godmode/agentes/module_manager.php: Some fixes to allow form reutilization. * include/javascript/jquery.pandora.controls.js: Fixed a typo. Added pandoraSelectGroup control. * include/javascript/jquery.pandora.js: Separate between auto executed code and document ready function. * include/javascript/pandora_modules.js: Added to repository. Functions to use on module editors. * include/functions_agents.php: Added get_agents(). * include/functions_db.php: Added get_user_first_group(). Changed user_access_to_agent() parameters order. * include/functions_reporting.php: Style corrections. * include/functions_ui.php: Added doc to print_status_image(). Added print_ui_agents_list() to print a list of agents with a search form and a lot of configuration options easily. * include/functions_ui_renders.php: Added to repository. New API for renders on UI components. * operation/agentes/estado_agente.php: Make table wider. * godmode/reporting/reporting_builder.php: Replaced exit with return. Use pandoraSelectGroup control. * godmode/servers/manage_recontask_form.php: Style corrections to fit Pandora styles. * godmode/servers/modificar_server.php: Removed a notice from a typo. * godmode/setup/setup.php: Fixed table data indexes. Removed javascript code from visual setup. * godmode/setup/setup_visuals.php: Some strings changed. Style correction. * godmode/menu.php: Added policies enterprise menu option. * images/policies.png: Added to repository. * godmode/agentes/modificar_agente.php: Style correction by using pandora functions. * godmode/agentes/massive_operations.php: Fixed tab styles that was showing wrong the . * godmode/agentes/manage_config_remote.php: Changes in user_access_to_agent() * general/ui/agents_list.php: Added to repository. Reusable render for an agent list. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1632 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-20 16:00:27 +02:00
* @param int Agent id.
* @param string Access mode to be checked. Default AR (Agent reading)
* @param string User id. Current user by default
2009-04-02 Sancho Lerena <slerena@artica.es> * pandoradb.sql: Final DB changes proposed for closing this month the DB scheme. tagente-> new server_name field to assign server (old fields will be removed). talert_templates has two new types (warning, critical). tevento has "user_comment" new field. Tserver has three new fields, server_type (so some old fields will be deleted), threads and queued_modules this last two are for statistical options. Tusuario add language type to override global language. * update_manager/main.php: Minor changes for correct ACL usage. Non PM users could see in what revision it the system, but only that. * pandoradb_migrate_v2.x_to_v3.0.sql: Updated script for new DB changes. * general/noaccess.php: Added footer and ending div. Page was very ugly when showing noaccess errors, nobody see it ???. * godmode/menu.php: A LOT of ACL fixes on several options. * godmode/agentes/agent_manager.php: Fixed a crazy floating icon. * godmode/agentes/manage_config_remote.php: A LOT of changes, rewriting stuff, because was not working. This also adds a lot of ACL checks. * godmode/agentes/massive_config.php, massive*: ACL changes. * godmode/agentes/modificar_agente.php: Fixed ACL problems. * godmode/agentes/module_manager_editor.php: Fixed bad module categories for some types (data, plugin and prediction). * godmode/alerts/alert_list.php: Fixed ACL problem. * godmode/reporting/graph_builder.php: Added ACl restriction for non-viewable agents for current user. Seems to be a problem with data with more than 2 sources. * godmode/reporting/map_builder.php: ACL checks improved. * godmode/reporting/reporting_builder.php: ACL checks added (was missing), some code ported from 2.1, other is new. New fields shown in list. * include/functions.php: Fixed the annoying bug of "bad counters" in function human_time_description_raw(). Function used,format_numeric() should not be used never to calculate nothing, only to print formatted strings. * include/functions_db.php: Added function user_access_to_agent() to know if a given user has access to a given agent. * include/functioins_report.php: get_report() should let admin to watch any report. Fixed. * agentes/alerts_status.php: Fixed ACL problem for view alert. * operation/incidents/incident.php: Bad call for pagination() was giving problems to pagination call. Somebody changes pagination() interface and make this broken. Please if you change any interface, be sure that is compatible with old code or make a post in the list about this ! * godmode/users/user_edit.php: Additional ACL check to do not let anybody to watch non accesible users. Even for see the username or description. * reporting/pchart_graph.php:Progress bar shown text in white when > 60%. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1594 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-02 21:16:59 +02:00
*
2009-04-20 Esteban Sanchez <estebans@artica.es> * godmode/agentes/module_manager_editor.php, godmode/agentes/module_manager_editor_common.php, godmode/agentes/module_manager_editor_data.php, godmode/agentes/module_manager_editor_network.php, godmode/agentes/module_manager_editor_plugin.php, godmode/agentes/module_manager_editor_prediction.php, godmode/agentes/module_manager_editor_wmi.php, godmode/agentes/module_manager.php: Some fixes to allow form reutilization. * include/javascript/jquery.pandora.controls.js: Fixed a typo. Added pandoraSelectGroup control. * include/javascript/jquery.pandora.js: Separate between auto executed code and document ready function. * include/javascript/pandora_modules.js: Added to repository. Functions to use on module editors. * include/functions_agents.php: Added get_agents(). * include/functions_db.php: Added get_user_first_group(). Changed user_access_to_agent() parameters order. * include/functions_reporting.php: Style corrections. * include/functions_ui.php: Added doc to print_status_image(). Added print_ui_agents_list() to print a list of agents with a search form and a lot of configuration options easily. * include/functions_ui_renders.php: Added to repository. New API for renders on UI components. * operation/agentes/estado_agente.php: Make table wider. * godmode/reporting/reporting_builder.php: Replaced exit with return. Use pandoraSelectGroup control. * godmode/servers/manage_recontask_form.php: Style corrections to fit Pandora styles. * godmode/servers/modificar_server.php: Removed a notice from a typo. * godmode/setup/setup.php: Fixed table data indexes. Removed javascript code from visual setup. * godmode/setup/setup_visuals.php: Some strings changed. Style correction. * godmode/menu.php: Added policies enterprise menu option. * images/policies.png: Added to repository. * godmode/agentes/modificar_agente.php: Style correction by using pandora functions. * godmode/agentes/massive_operations.php: Fixed tab styles that was showing wrong the . * godmode/agentes/manage_config_remote.php: Changes in user_access_to_agent() * general/ui/agents_list.php: Added to repository. Reusable render for an agent list. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1632 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-20 16:00:27 +02:00
* @return bool Access to that agent (false not, true yes)
2009-04-02 Sancho Lerena <slerena@artica.es> * pandoradb.sql: Final DB changes proposed for closing this month the DB scheme. tagente-> new server_name field to assign server (old fields will be removed). talert_templates has two new types (warning, critical). tevento has "user_comment" new field. Tserver has three new fields, server_type (so some old fields will be deleted), threads and queued_modules this last two are for statistical options. Tusuario add language type to override global language. * update_manager/main.php: Minor changes for correct ACL usage. Non PM users could see in what revision it the system, but only that. * pandoradb_migrate_v2.x_to_v3.0.sql: Updated script for new DB changes. * general/noaccess.php: Added footer and ending div. Page was very ugly when showing noaccess errors, nobody see it ???. * godmode/menu.php: A LOT of ACL fixes on several options. * godmode/agentes/agent_manager.php: Fixed a crazy floating icon. * godmode/agentes/manage_config_remote.php: A LOT of changes, rewriting stuff, because was not working. This also adds a lot of ACL checks. * godmode/agentes/massive_config.php, massive*: ACL changes. * godmode/agentes/modificar_agente.php: Fixed ACL problems. * godmode/agentes/module_manager_editor.php: Fixed bad module categories for some types (data, plugin and prediction). * godmode/alerts/alert_list.php: Fixed ACL problem. * godmode/reporting/graph_builder.php: Added ACl restriction for non-viewable agents for current user. Seems to be a problem with data with more than 2 sources. * godmode/reporting/map_builder.php: ACL checks improved. * godmode/reporting/reporting_builder.php: ACL checks added (was missing), some code ported from 2.1, other is new. New fields shown in list. * include/functions.php: Fixed the annoying bug of "bad counters" in function human_time_description_raw(). Function used,format_numeric() should not be used never to calculate nothing, only to print formatted strings. * include/functions_db.php: Added function user_access_to_agent() to know if a given user has access to a given agent. * include/functioins_report.php: get_report() should let admin to watch any report. Fixed. * agentes/alerts_status.php: Fixed ACL problem for view alert. * operation/incidents/incident.php: Bad call for pagination() was giving problems to pagination call. Somebody changes pagination() interface and make this broken. Please if you change any interface, be sure that is compatible with old code or make a post in the list about this ! * godmode/users/user_edit.php: Additional ACL check to do not let anybody to watch non accesible users. Even for see the username or description. * reporting/pchart_graph.php:Progress bar shown text in white when > 60%. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1594 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-02 21:16:59 +02:00
*/
2009-04-20 Esteban Sanchez <estebans@artica.es> * godmode/agentes/module_manager_editor.php, godmode/agentes/module_manager_editor_common.php, godmode/agentes/module_manager_editor_data.php, godmode/agentes/module_manager_editor_network.php, godmode/agentes/module_manager_editor_plugin.php, godmode/agentes/module_manager_editor_prediction.php, godmode/agentes/module_manager_editor_wmi.php, godmode/agentes/module_manager.php: Some fixes to allow form reutilization. * include/javascript/jquery.pandora.controls.js: Fixed a typo. Added pandoraSelectGroup control. * include/javascript/jquery.pandora.js: Separate between auto executed code and document ready function. * include/javascript/pandora_modules.js: Added to repository. Functions to use on module editors. * include/functions_agents.php: Added get_agents(). * include/functions_db.php: Added get_user_first_group(). Changed user_access_to_agent() parameters order. * include/functions_reporting.php: Style corrections. * include/functions_ui.php: Added doc to print_status_image(). Added print_ui_agents_list() to print a list of agents with a search form and a lot of configuration options easily. * include/functions_ui_renders.php: Added to repository. New API for renders on UI components. * operation/agentes/estado_agente.php: Make table wider. * godmode/reporting/reporting_builder.php: Replaced exit with return. Use pandoraSelectGroup control. * godmode/servers/manage_recontask_form.php: Style corrections to fit Pandora styles. * godmode/servers/modificar_server.php: Removed a notice from a typo. * godmode/setup/setup.php: Fixed table data indexes. Removed javascript code from visual setup. * godmode/setup/setup_visuals.php: Some strings changed. Style correction. * godmode/menu.php: Added policies enterprise menu option. * images/policies.png: Added to repository. * godmode/agentes/modificar_agente.php: Style correction by using pandora functions. * godmode/agentes/massive_operations.php: Fixed tab styles that was showing wrong the . * godmode/agentes/manage_config_remote.php: Changes in user_access_to_agent() * general/ui/agents_list.php: Added to repository. Reusable render for an agent list. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1632 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-20 16:00:27 +02:00
function user_access_to_agent ($id_agent, $mode = "AR", $id_user = false) {
if (empty ($id_agent))
return false;
if ($id_user == false) {
global $config;
$id_user = $config['id_user'];
}
2009-04-02 Sancho Lerena <slerena@artica.es> * pandoradb.sql: Final DB changes proposed for closing this month the DB scheme. tagente-> new server_name field to assign server (old fields will be removed). talert_templates has two new types (warning, critical). tevento has "user_comment" new field. Tserver has three new fields, server_type (so some old fields will be deleted), threads and queued_modules this last two are for statistical options. Tusuario add language type to override global language. * update_manager/main.php: Minor changes for correct ACL usage. Non PM users could see in what revision it the system, but only that. * pandoradb_migrate_v2.x_to_v3.0.sql: Updated script for new DB changes. * general/noaccess.php: Added footer and ending div. Page was very ugly when showing noaccess errors, nobody see it ???. * godmode/menu.php: A LOT of ACL fixes on several options. * godmode/agentes/agent_manager.php: Fixed a crazy floating icon. * godmode/agentes/manage_config_remote.php: A LOT of changes, rewriting stuff, because was not working. This also adds a lot of ACL checks. * godmode/agentes/massive_config.php, massive*: ACL changes. * godmode/agentes/modificar_agente.php: Fixed ACL problems. * godmode/agentes/module_manager_editor.php: Fixed bad module categories for some types (data, plugin and prediction). * godmode/alerts/alert_list.php: Fixed ACL problem. * godmode/reporting/graph_builder.php: Added ACl restriction for non-viewable agents for current user. Seems to be a problem with data with more than 2 sources. * godmode/reporting/map_builder.php: ACL checks improved. * godmode/reporting/reporting_builder.php: ACL checks added (was missing), some code ported from 2.1, other is new. New fields shown in list. * include/functions.php: Fixed the annoying bug of "bad counters" in function human_time_description_raw(). Function used,format_numeric() should not be used never to calculate nothing, only to print formatted strings. * include/functions_db.php: Added function user_access_to_agent() to know if a given user has access to a given agent. * include/functioins_report.php: get_report() should let admin to watch any report. Fixed. * agentes/alerts_status.php: Fixed ACL problem for view alert. * operation/incidents/incident.php: Bad call for pagination() was giving problems to pagination call. Somebody changes pagination() interface and make this broken. Please if you change any interface, be sure that is compatible with old code or make a post in the list about this ! * godmode/users/user_edit.php: Additional ACL check to do not let anybody to watch non accesible users. Even for see the username or description. * reporting/pchart_graph.php:Progress bar shown text in white when > 60%. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1594 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-02 21:16:59 +02:00
$id_group = (int) get_db_value ('id_grupo', 'tagente', 'id_agente', (int) $id_agent);
2009-04-20 Esteban Sanchez <estebans@artica.es> * godmode/agentes/module_manager_editor.php, godmode/agentes/module_manager_editor_common.php, godmode/agentes/module_manager_editor_data.php, godmode/agentes/module_manager_editor_network.php, godmode/agentes/module_manager_editor_plugin.php, godmode/agentes/module_manager_editor_prediction.php, godmode/agentes/module_manager_editor_wmi.php, godmode/agentes/module_manager.php: Some fixes to allow form reutilization. * include/javascript/jquery.pandora.controls.js: Fixed a typo. Added pandoraSelectGroup control. * include/javascript/jquery.pandora.js: Separate between auto executed code and document ready function. * include/javascript/pandora_modules.js: Added to repository. Functions to use on module editors. * include/functions_agents.php: Added get_agents(). * include/functions_db.php: Added get_user_first_group(). Changed user_access_to_agent() parameters order. * include/functions_reporting.php: Style corrections. * include/functions_ui.php: Added doc to print_status_image(). Added print_ui_agents_list() to print a list of agents with a search form and a lot of configuration options easily. * include/functions_ui_renders.php: Added to repository. New API for renders on UI components. * operation/agentes/estado_agente.php: Make table wider. * godmode/reporting/reporting_builder.php: Replaced exit with return. Use pandoraSelectGroup control. * godmode/servers/manage_recontask_form.php: Style corrections to fit Pandora styles. * godmode/servers/modificar_server.php: Removed a notice from a typo. * godmode/setup/setup.php: Fixed table data indexes. Removed javascript code from visual setup. * godmode/setup/setup_visuals.php: Some strings changed. Style correction. * godmode/menu.php: Added policies enterprise menu option. * images/policies.png: Added to repository. * godmode/agentes/modificar_agente.php: Style correction by using pandora functions. * godmode/agentes/massive_operations.php: Fixed tab styles that was showing wrong the . * godmode/agentes/manage_config_remote.php: Changes in user_access_to_agent() * general/ui/agents_list.php: Added to repository. Reusable render for an agent list. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1632 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-20 16:00:27 +02:00
return (bool) give_acl ($id_user, $id_group, $mode);
2009-04-02 Sancho Lerena <slerena@artica.es> * pandoradb.sql: Final DB changes proposed for closing this month the DB scheme. tagente-> new server_name field to assign server (old fields will be removed). talert_templates has two new types (warning, critical). tevento has "user_comment" new field. Tserver has three new fields, server_type (so some old fields will be deleted), threads and queued_modules this last two are for statistical options. Tusuario add language type to override global language. * update_manager/main.php: Minor changes for correct ACL usage. Non PM users could see in what revision it the system, but only that. * pandoradb_migrate_v2.x_to_v3.0.sql: Updated script for new DB changes. * general/noaccess.php: Added footer and ending div. Page was very ugly when showing noaccess errors, nobody see it ???. * godmode/menu.php: A LOT of ACL fixes on several options. * godmode/agentes/agent_manager.php: Fixed a crazy floating icon. * godmode/agentes/manage_config_remote.php: A LOT of changes, rewriting stuff, because was not working. This also adds a lot of ACL checks. * godmode/agentes/massive_config.php, massive*: ACL changes. * godmode/agentes/modificar_agente.php: Fixed ACL problems. * godmode/agentes/module_manager_editor.php: Fixed bad module categories for some types (data, plugin and prediction). * godmode/alerts/alert_list.php: Fixed ACL problem. * godmode/reporting/graph_builder.php: Added ACl restriction for non-viewable agents for current user. Seems to be a problem with data with more than 2 sources. * godmode/reporting/map_builder.php: ACL checks improved. * godmode/reporting/reporting_builder.php: ACL checks added (was missing), some code ported from 2.1, other is new. New fields shown in list. * include/functions.php: Fixed the annoying bug of "bad counters" in function human_time_description_raw(). Function used,format_numeric() should not be used never to calculate nothing, only to print formatted strings. * include/functions_db.php: Added function user_access_to_agent() to know if a given user has access to a given agent. * include/functioins_report.php: get_report() should let admin to watch any report. Fixed. * agentes/alerts_status.php: Fixed ACL problem for view alert. * operation/incidents/incident.php: Bad call for pagination() was giving problems to pagination call. Somebody changes pagination() interface and make this broken. Please if you change any interface, be sure that is compatible with old code or make a post in the list about this ! * godmode/users/user_edit.php: Additional ACL check to do not let anybody to watch non accesible users. Even for see the username or description. * reporting/pchart_graph.php:Progress bar shown text in white when > 60%. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1594 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-02 21:16:59 +02:00
}
2009-01-15 Esteban Sanchez <estebans@artica.es> * include/styles/menu.css: Changed the z-index property of the menu which was overlapped in some cases. * include/functions.php: format_alert_row() moved to functions_ui.php * include/functions_ui.php: Added format_alert_row() from function.php * include/functions_agents.php: Added to repository. * include/functions_alerts.php: Added new functions get_alerts_agent_module_disabled(), set_alerts_agent_module_force_execution(), get_alerts_agent_module_last_fired(). * include/functions_db.php, operation/agentes/estado_agente.php, operation/agentes/networkmap.php: Style correction. * include/functions_reporting.php: Use new functions_agent.php. Added a bit of documentation and style correction. * godmode/alerts/alert_templates.php: Improved a bit the template tooltip. * operation/agentes/alerts_status.php: Added to repository. New interface to list agent alerts. * operation/agentes/estado_alertas.php: Removed from repository. Replaced by alert_status.php. * operation/agentes/ver_agente.php: Removed flag_alert code snippet. Use new files added. Style correction. * operation/menu.php: Old files references replaced by new ones. * index.php: Removed build and pandora version references. * pandoradb.sql: Removed useless module_type field in talert_templates. * pandoradb_migrate_20_to_21.sql: Removed duplicate fields addition. Fixed some warnings. Added custom_id field to tagente. Style correction. * include/config_process.php: Updated build version. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1344 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-15 11:21:38 +01:00
?>