pandorafms/pandora_console/include/functions_db.php

2095 lines
59 KiB
PHP
Raw Normal View History

<?php
2008-07-25 Sancho Lerena <slerena@gmail.com> * pandoradb.sql: Added new tables for planned downtimes. * godmode/menu.php: Added entry for manage downtimes. * group_list.php: Stetic changes in table. * modificar_server.php: Fixed timestamp render for start/update timestamp of each server. * functions.php: Minimal estetic changes in help function. * functions_db.php: Change header (Flexible <- Free) * functions_html.php: Now select admits multiselect option. Default class for table render is now databox not databox_color. * AUTHORS: Update list of authors and make a reference to contributors. * function_reporting.php: Header change, updated datetime string format. * language_en.php, language_es_es.php: Changed FREE for Flexible. * pandora.css: Minimal changes. Update color of Monitor count in tactical. * menu.php: Added some new event options: CSV Export, RSS and new marquee event visualizer. * estado_ultimopaquete.php: Header update. * tactical.php: Added link to data module alerts. * ver_agente.php: Fixed a problem in ajax code that was rending bad count of down monitors. Using boolean comparation on result of function get_db_sql(). This kind problem could be in more lines of code. * events.php: New quicklinks to RSS, CSV and Marquee in event viewer. * export_csv.php, events_rss.php: Fixed duped call to function includes. * graph_viewer.php: I hope this fix FINALLY the annoying bug of graph type selector. * visual_console/index.php: Updated header. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@973 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-07-25 20:37:32 +02:00
// Pandora FMS - the Flexible monitoring system
// ============================================
// Copyright (c) 2004-2008 Sancho Lerena, <slerena@gmail.com>
// Copyright (c) 2005-2008 Artica Soluciones Tecnologicas
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 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
// GNU General Public License for more details.
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 0 on success
*/
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"] != "")) {
$id = get_db_value("id_usuario","tusuario","id_usuario",$_SESSION["id_usuario"]);
if ( $_SESSION["id_usuario"] == $id) {
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
}
/**
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 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 id_user User id
* @param id_group Agents group id
* @param access Access privilege
*
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 1 if the user has privileges, 0 if not.
**/
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 give_acl ($id_user, $id_group, $access) {
// IF user is level = 1 then always return 1
global $config;
$nivel = get_db_value("nivel","tusuario","id_usuario",$id_user);
if ($nivel == 1) {
return 1;
//Apparently nivel is 1 if user has full admin access
}
//Joined multiple queries into one. That saves on the query overhead and query cache.
if ($id_group == 0) {
$query1=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, access doesnt matter (use with caution!) - Any user gets access to group 0
} else {
$query1=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 = %d OR tusuario_perfil.id_grupo= 1)",$id_user,$id_group);
}
$rowdup = get_db_all_rows_sql($query1);
$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"];
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
break;
case "IW":
$result += $row["incident_edit"];
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
break;
case "IM":
$result += $row["incident_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
break;
case "AR":
$result += $row["agent_view"];
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
break;
case "AW":
$result += $row["agent_edit"];
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
break;
case "LW":
$result += $row["alert_edit"];
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
break;
case "LM":
$result += $row["alert_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
break;
case "PM":
$result += $row["pandora_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
break;
case "DM":
$result += $row["db_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
break;
case "UM":
$result += $row["user_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
break;
}
}
if ($result > 1)
$result = 1;
return $result;
}
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
/**
* Adds an audit log entry.
*
* @param id User id
* @param ip Client IP
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 accion Action description
* @param descripcion Long action description
*/
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);
}
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 id_user User id
* @param ip Client user IP address.
*/
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?
$sql = sprintf ("UPDATE tusuario SET fecha_registro = NOW() WHERE id_usuario = '%s'", $id_user);
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 out a user into Pandora.
*
* @param id_user User id
* @param ip Client user IP address.
*/
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 id_profile Id profile in tperfil
*
* @return Profile name of the given id
*/
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 dame_perfil ($id_profile) {
return (string) get_db_value ('name', 'tperfil', 'id_perfil', (int) $id_profile);
}
/**
* Get disabled field of a group
*
* @param id_group Group id
*
* @return 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);
}
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 in a group.
*
* @param id_group Group id
* @param disabled Add disabled agents to agents. Default: 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
*
* @return An array with all agents in the group.
*/
function get_agents_in_group ($id_group, $disabled = false) {
/* 'All' group must return all agents */
if ($id_group == 1) {
if ($disabled) {
return get_db_all_rows_in_table ('tagente', 'nombre');
} else {
return get_db_all_rows_field_filter ('tagente', 'disabled', 0, 'nombre');
}
} elseif ($disabled && $id_group != 1) {
2008-07-10 Sancho Lerena <slerena@gmail.com> * include/styles/pandora_red.css: Updated. * include/styles/pandora_black.css: New style with BLACK blackground. * include/styles/pandora.css: Updated. * include/functions_db.php: Added auto order combos and queries. * include/functions_visual_map.php: Added overlap on down elements if there are more than one in the same position (This could allow to cluster elements to shown the down status first). Removed unused code. * operation/events/events.php: Added tooltip for group name. * operation/visual_console/render_view.php: Adjusted controls position. * operation/agentes/status_monitor.php: Added status for unknown monitors. Added some database search improvement. * operation/agentes/sla_view.php: Sorted list of items. * operation/agentes/ver_agente.php: Updated AJAX code for network map detail view of an agent. Added alert data. * operation/agentes/tactical.php: Removed 'fixed' styles, now using CSS. * operation/agentes/networkmap.php: Added ransep and font selectors. Added alert under yellow color. Minor improvements. * operation/reporting/graph_viewer.php: Style update. * operation/menu.php: Visual console maps sort by name * images/background-li.gif: This sould replace <li> image. * general/login_page.php: Added build version on develop mode. * godmode/reporting/map_builder.php: Sorted lists, and shown module name instead description. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@949 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-07-10 13:58:40 +02:00
return get_db_all_rows_field_filter ('tagente', 'id_grupo', (int) $id_group, 'nombre');
} else {
$sql = sprintf ("SELECT * FROM tagente WHERE id_grupo = %d AND disabled = 0 ORDER BY nombre",$id_group);
return get_db_all_rows_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
}
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.
*
* @param $id_agent Agent id
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 An array with all modules in the agent.
*/
function get_modules_in_agent ($id_agent) {
return get_db_all_rows_field_filter ('tagente_modulo', 'id_agente', (int) $id_agent);
}
/**
* Get all the simple alerts of an agent.
*
* @param $id_agent Agent id
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 An array with all simple alerts defined for an agent.
*/
function get_simple_alerts_in_agent ($id_agent) {
$sql = sprintf ("SELECT talerta_agente_modulo.* FROM talerta_agente_modulo, tagente_modulo WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente = %d", $id_agent);
$alerts = get_db_all_rows_sql ($sql);
if ($alerts === false)
return array ();
return $alerts;
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 combined alerts of an agent.
*
* @param $id_agent Agent id
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 An array with all combined alerts defined for an agent.
*/
function get_combined_alerts_in_agent ($id_agent) {
$alerts = get_db_all_rows_field_filter ('talerta_agente_modulo', 'id_agent', (int) $id_agent);
if ($alerts === false)
return array ();
return $alerts;
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 alerts of an agent, simple and combined.
*
* @param $id_agent Agent id
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 An array with all alerts defined for an agent.
*/
function get_alerts_in_agent ($id_agent) {
$simple_alerts = get_simple_alerts_in_agent ($id_agent);
$combined_alerts = get_combined_alerts_in_agent ($id_agent);
return array_merge ($simple_alerts, $combined_alerts);
}
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 a list of the reports the user can view.
*
* A user can view a report by two ways:
* - The user created the report (id_user field in treport)
* - The report is not private and the user has reading privileges on
* the group associated to the report
*
* @param $id_user User 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 An array with all the reports the user can view.
*/
function get_reports ($id_user) {
$user_reports = array ();
$all_reports = get_db_all_rows_in_table ('treport', 'name');
if ($all_reports === false) {
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 $user_reports;
}
foreach ($all_reports as $report) {
/* The report is private and it does not belong to the user */
if ($report['private'] && $report['id_user'] != $id_user)
continue;
/* Check ACL privileges on report group */
if (! give_acl ($id_user, $report['id_group'], 'AR'))
continue;
array_push ($user_reports, $report);
}
return $user_reports;
}
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 name from group.
*
* @param id_group Id group to get the name.
*
* @return The name of the 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 dame_grupo ($id_group) {
return (string) get_db_value ('nombre', 'tgrupo', 'id_grupo', (int) $id_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
/**
* Get group icon from group.
*
* @param id_group Id group to get the icon
*
* @return Icon path of the 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 dame_grupo_icono ($id_group) {
return (string) get_db_value ('icon', 'tgrupo', 'id_grupo', (int) $id_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
/**
* Get agent id from an agent name.
*
* @param agent_name Agent name to get its id.
*
* @return Id from the agent of the given 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
function dame_agente_id ($agent_name) {
return (int) get_db_value ('id_agente', 'tagente', 'nombre', $agent_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
/**
* Get user id of a note.
*
* @param id_note Note id.
*
* @return User id of the given note.
*/
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_note_author ($id_note) {
return (int) get_db_value ('id_usuario', 'tnota', 'id_nota', (int) $id_note);
}
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 description of an event.
*
* @param id_event Event id.
*
* @return Description of the given event.
*/
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 return_event_description ($id_event) {
return (string) get_db_value ('evento', 'tevento', 'id_evento', (int) $id_event);
}
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 id of an event.
*
* @param id_event Event id
*
* @return Group id of the given event.
*/
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 gime_idgroup_from_idevent ($id_event) {
return (int) get_db_value ('id_grupo', 'tevento', 'id_evento', (int) $id_event);
}
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 name of an agent.
*
* @param id_agent Agent 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 Name of the given agent.
*/
function dame_nombre_agente ($id_agent) {
return (string) get_db_value ('nombre', 'tagente', 'id_agente', (int) $id_agent);
}
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 password of an user.
*
* @param id_usuario User id.
*
* @return Password of an user.
*/
function get_user_password ($id_usuario) {
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 ('password', 'tusuario', 'id_usuario', (int) $id_usuario);
}
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 name of an alert
*
* @param id_alert Alert id.
*
* @return Name of the alert.
*/
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_alerta ($id_alert) {
return (string) get_db_value ('nombre', 'talerta', 'id_alerta', (int) $id_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
/**
* Get name of a module group.
*
* @param id_module_group Module group id.
*
* @return Name of the given module group.
*/
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_grupomodulo ($id_module_group) {
return (string) get_db_value ('name', 'tmodule_group', 'id_mg', (int) $id_module_group);
}
/**
* Get the name of an exporting server
*
* @param id_server Server id
*
* @return 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 id_plugin Plugin id.
*
* @return 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 id_type Type id
*
* @return The name of the given 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
function giveme_module_type ($id_type) {
return (string) get_db_value ('nombre', 'ttipo_modulo', 'id_tipo', (int) $id_type);
}
/**
* Get agent name of an agent module.
*
* @param id_agente_modulo Agent module id.
*
* @return The name of the given agent module.
*/
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 dame_nombre_agente_agentemodulo ($id_agente_modulo) {
$id_agent = get_db_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', (int) $id_agente_modulo);
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 ($id_agent)
return dame_nombre_agente ($id_agent);
return '';
}
/**
* Get the module name of an agent module.
*
* @param id_agente_modulo Agent module id.
*
* @return Name of the given agent module.
*/
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 dame_nombre_modulo_agentemodulo ($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 id_agente_modulo Agent module id.
*
* @return Module type of the given agent module.
*/
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_id_tipo_modulo_agentemodulo ($id_agente_modulo) {
return (int) get_db_value ('id_tipo_modulo', 'tagente_modulo', 'id_agente_modulo', (int) $id_agente_modulo);
}
/**
* Get the real name of an user.
*
* @param id_user User id
*
* @return Real name of given 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
function dame_nombre_real ($id_user) {
return (string) get_db_value ('nombre_real', 'tusuario', 'id_usuario', (int) $id_user);
}
/**
* Get all the times a monitor went down during a period.
*
* @param $id_agent_module Agent module of the monitor.
* @param $period Period timed to check from date
* @param $date Date to check (now by default)
*
* @return The number of times a monitor went down.
*/
function get_monitor_downs_in_period ($id_agent_module, $period, $date = 0) {
if ($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
$date = 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 $id_agent_module Agent module of the monitor.
* @param $period Period timed to check from date
* @param $date Date to check (now by default)
*
* @return The last time a monitor went down.
*/
function get_monitor_last_down_timestamp_in_period ($id_agent_module, $period, $date = 0) {
if ($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
$date = 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 id_group Group id to get all the monitors.
*
* @return An array with all the monitors defined in the group (tagente_modulo).
*/
function get_monitors_in_group ($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` = %d", $id_group);
return get_db_all_rows_sql ($sql);
}
/**
* Get all the monitors defined in an agent.
*
* @param id_agent Agent id to get all the monitors.
*
* @return 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 monitors An array with all the monitors to check. Each
* element of the array must be a dictionary.
* @param period Period of time to check the monitors.
* @param date Beginning date to check the monitors.
*
* @return 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 ();
foreach ($monitors as $monitor) {
$down = get_monitor_downs_in_period ($monitor['id_agente_modulo'], $period, $date);
if ($down)
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 $id_agent_module Agent module of the alert.
* @param $period Period timed to check from date
* @param $date Date to check (now by default)
*
* @return The number of times an alert fired.
*/
function get_alert_fires_in_period ($id_agent_module, $period, $date = 0) {
if (!$date)
$date = time ();
$datelimit = $date - $period;
$sql = sprintf ("SELECT COUNT(`id_agentmodule`) FROM `tevento` WHERE
`event_type` = 'alert_fired'
AND `id_agentmodule` = %d
AND `utimestamp` > %d
AND `utimestamp` <= %d",
$id_agent_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 id_group Group id to check.
*
* @return An array with alerts dictionaries defined in a group.
*/
function get_alerts_in_group ($id_group) {
$alerts = array ();
$agents = get_agents_in_group ($id_group);
foreach ($agents as $agent) {
$agent_alerts = get_alerts_in_agent ($agent["id_agente"]);
$alerts = array_merge ($alerts, $agent_alerts);
}
return $alerts;
}
/**
* Get all the alerts fired during a period, given a list of alerts.
*
* @param alerts A list of alerts to check. See get_alerts_in_group()
* @param period Period of time to check fired alerts.
* @param date Beginning date to check fired alerts in UNIX format (current date by default)
*
* @return 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 = time ();
$datelimit = $date - $period;
$alerts_fired = array ();
$agents = array ();
foreach ($alerts as $alert) {
$fires = get_alert_fires_in_period ($alert['id_agente_modulo'], $period, $date);
if (! $fires) {
continue;
}
$alerts_fired[$alert['id_aam']] = $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 $id_agent_module Agent module of the monitor.
* @param $period Period timed to check from date
* @param $date Date to check (now by default)
*
* @return The last time an alert fired.
*/
function get_alert_last_fire_timestamp_in_period ($id_agent_module, $period, $date = 0) {
if ($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
$date = 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` = 'alert_fired'
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 author of an incident.
*
* @param id_incident Incident id.
*
* @return The author of an incident
*/
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 give_incident_author ($id_incident) {
return (string) get_db_value ('id_usuario', 'tincidencia', 'id_incidencia', (int) $id_incident);
}
/**
* Get the server name.
*
* @param id_server Server id.
*
* @return Name of the given server
*/
function give_server_name ($id_server) {
return (string) get_db_value ('name', 'tserver', 'id_server', $id_server);
}
/**
* Get the module type name.
*
* @param id_type Type id
*
* @return Name of the given type.
*/
function dame_nombre_tipo_modulo ($id_type) {
return (string) get_db_value ('nombre', 'ttipo_modulo', 'id_tipo', $id_type);
}
/**
* Get group name from the id
*
* @param id_group Group id
*
* @return The name of the given group
*/
function dame_nombre_grupo ($id_group) {
return (string) get_db_value ('nombre', 'tgrupo', 'id_grupo', $id_group);
}
/**
* Get group id of an agent.
*
* @param id_agent Agent id
*
* @return Group of the given agent
*/
function dame_id_grupo ($id_agent) {
return (int) get_db_value ('id_grupo', 'tagente', 'id_agente', $id_agent);
}
/**
* Get the number of notes in a incident.
*
* @param id_incident Incident id
*
* @return The number of notes in given incident.
*/
function dame_numero_notas ($id_incident) {
return (int) get_db_value ('COUNT(*)', 'tnota_inc', 'id_incidencia', $id_incident);
}
/**
* Get the number of pandora data in the database.
*
* @return
*/
function dame_numero_datos () {
return (int) get_db_sql ("SELECT COUNT(*) FROM `tagente_datos`");
}
/**
* Get the data value of a agent module of string type.
*
* @param id Agent module string id
*
* @return Data value of the agent module.
*/
function dame_generic_string_data ($id) {
return (string) get_db_value ('datos', 'tagente_datos_string', 'id_tagente_datos_string', $id);
}
/**
* Delete an incident of the database.
*
* @param id_inc Incident id
*/
function borrar_incidencia ($id_inc) {
2008-07-02 Esteban Sanchez <estebans@artica.es> * general/logon_ok.php: Style correction. * include/languages/language_en.php: Added a couple of strings. * include/styles/pandora.css: Container div has now variable width, so Pandora console is wider now. * include/config.php: Replaced default values from last commit. Change homeurl variable, which now points to base url directory. * include/config_process.php: Style correction. Use pandora functions and indent the code properly. * reporting/fgraph.php, include/functions.php, ajax.php: Use require_once instead of require which speeds up the code parsing. * index.php: Use require_once instead of require which speeds up the code parsing. Add all GET and POST variables when refreshing a page. Style corrections. Use $_SERVER instead getenv. * include/functions_db.php: Avoid including config.php and use global instead. Replaced some id_user with the respective variable holds in config array. Replaced SQL syntax, removed an undeclared variable and renamed to english in event_insert(). Renamed return_moduledata_*_value() to get_agent_module_value_*(). Fixed an error in the sumatory when the module is incremental. * include/functions_reporting.php: Renamed return_module_SLA() to get_agent_module_sla(). * include/functions_reporting_pdf.php: Tabs and blankspaces correction. Style correction. Added new reports rendering, and fixed images references. Removed old and deprecated functions. * operation/agentes/networkmap.php: Style correction. * operation/agentes/sla_view.php, reporting/stat_win.php: Use renamed functions. * operation/reporting/reporting_viewer.php: Table reports width are now wider. Fixed some colspan problems. Generate custom graph ids better. Added agent and module name to SLAs. Style correction in the use of rowclass structure since now each content has its own table. * operation/reporting/custom_reporting.php: Removed unused variable for PDF reporting generation link. * operation/reporting/reporting_viewer_pdf.php: Rewrite the code to make style corrections and use pandora functions. * operation/menu.php: Tabs and blankspaces correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@916 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-07-02 14:30:56 +02:00
global $config;
$sql = sprintf ("DELETE FROM `tincidencia` WHERE `id_incidencia` = %d",$id_inc);
process_sql ($sql);
$sql = sprintf ("SELECT `id_nota` FROM `tnota_inc` WHERE `id_incidencia` = %d".$id_inc);
$rows = get_db_all_rows_sql ($sql);
foreach ($rows as $row) {
$sql = sprintf ("DELETE FROM `tnota` WHERE `id_nota` = %d",$row["id_nota"]);
process_sql ($sql);
}
$sql = "DELETE FROM `tnota_inc` WHERE `id_incidencia` = ".$id_inc;
process_sql ($sql);
// Delete attachments
$sql = sprintf ("SELECT `id_attachment`,`filename` FROM `tattachment` WHERE `id_incidencia` = %d",$id_inc);
$rows = get_db_all_rows_sql ($sql);
foreach ($rows as $row) {
// Unlink all attached files for this incident
unlink ($attachment_store."attachment/pand".$row["id_attachment"]."_".$row["filename"]);
}
$sql = sprintf ("DELETE FROM `tattachment` WHERE `id_incidencia` = %d",$id_inc);
process_sql ($sql);
}
/**
* Get the operating system name.
*
* @param id_os Operating system id.
*
* @return Name of the given operating system.
*/
function dame_so_name ($id_os) {
return (string) get_db_value ('name', 'tconfig_os', 'id_os', $id_os);
}
/**
* Update user last login timestamp.
*
* @param id_user User id
*/
function update_user_contact ($id_user) {
global $config;
$sql = sprintf ("UPDATE `tusuario` set `fecha_registro` = NOW() WHERE 'id_usuario' = %d",$id_user);
process_sql ($sql);
}
/**
* Get the icon of an operating system.
*
* The path of the icons is 'images/' which must be append by the
* caller (including slash and filename extension .png)
*
* @param id_os Operating system id
*
* @return Icon filename of the operating system
*/
function dame_so_icon ($id_os) {
return (string) get_db_value ('icon_name', 'tconfig_os', 'id_os', $id_os);
}
/**
* Get the user email
*
* @param id_user User id.
*
* @return Get the email address of an user
*/
function dame_email ($id_user) {
return (string) get_db_value ('direccion', 'tusuario', 'id_usuario', $id_user);
}
/**
* Checks if a user is administrator.
*
* @param id_user User id.
*
* @return True is the user is admin
*/
function dame_admin ($id_user) {
$level = get_db_value ('nivel', 'tusuario', 'id_usuario', $id_user);
if ($level == 1) {
return true;
} else {
return false;
}
}
/**
* WARNING: This is a deprectad function and must not be used
*/
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 id_agent Agent id.
*
* @return True if the agent has fired alerts.
*/
function check_alert_fired ($id_agent) {
$sql = "SELECT COUNT(*) FROM talerta_agente_modulo, tagente_modulo
WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo
AND times_fired > 0 AND id_agente = ".$id_agent;
$value = get_db_sql ($sql);
if ($value > 0)
return true;
return false;
}
/**
* Check is a user exists in the system
*
* @param id_user User id.
*
* @return True if the user exists.
*/
function existe ($id_user) {
$user = get_db_row ('tusuario', 'id_usuario', $id_user);
if (! $user)
return false;
return true;
}
/**
* Insert a event in the event log system.
*
2008-07-02 Esteban Sanchez <estebans@artica.es> * general/logon_ok.php: Style correction. * include/languages/language_en.php: Added a couple of strings. * include/styles/pandora.css: Container div has now variable width, so Pandora console is wider now. * include/config.php: Replaced default values from last commit. Change homeurl variable, which now points to base url directory. * include/config_process.php: Style correction. Use pandora functions and indent the code properly. * reporting/fgraph.php, include/functions.php, ajax.php: Use require_once instead of require which speeds up the code parsing. * index.php: Use require_once instead of require which speeds up the code parsing. Add all GET and POST variables when refreshing a page. Style corrections. Use $_SERVER instead getenv. * include/functions_db.php: Avoid including config.php and use global instead. Replaced some id_user with the respective variable holds in config array. Replaced SQL syntax, removed an undeclared variable and renamed to english in event_insert(). Renamed return_moduledata_*_value() to get_agent_module_value_*(). Fixed an error in the sumatory when the module is incremental. * include/functions_reporting.php: Renamed return_module_SLA() to get_agent_module_sla(). * include/functions_reporting_pdf.php: Tabs and blankspaces correction. Style correction. Added new reports rendering, and fixed images references. Removed old and deprecated functions. * operation/agentes/networkmap.php: Style correction. * operation/agentes/sla_view.php, reporting/stat_win.php: Use renamed functions. * operation/reporting/reporting_viewer.php: Table reports width are now wider. Fixed some colspan problems. Generate custom graph ids better. Added agent and module name to SLAs. Style correction in the use of rowclass structure since now each content has its own table. * operation/reporting/custom_reporting.php: Removed unused variable for PDF reporting generation link. * operation/reporting/reporting_viewer_pdf.php: Rewrite the code to make style corrections and use pandora functions. * operation/menu.php: Tabs and blankspaces correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@916 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-07-02 14:30:56 +02:00
* @param event
* @param id_group
* @param id_agent
* @param status
2008-07-02 Esteban Sanchez <estebans@artica.es> * general/logon_ok.php: Style correction. * include/languages/language_en.php: Added a couple of strings. * include/styles/pandora.css: Container div has now variable width, so Pandora console is wider now. * include/config.php: Replaced default values from last commit. Change homeurl variable, which now points to base url directory. * include/config_process.php: Style correction. Use pandora functions and indent the code properly. * reporting/fgraph.php, include/functions.php, ajax.php: Use require_once instead of require which speeds up the code parsing. * index.php: Use require_once instead of require which speeds up the code parsing. Add all GET and POST variables when refreshing a page. Style corrections. Use $_SERVER instead getenv. * include/functions_db.php: Avoid including config.php and use global instead. Replaced some id_user with the respective variable holds in config array. Replaced SQL syntax, removed an undeclared variable and renamed to english in event_insert(). Renamed return_moduledata_*_value() to get_agent_module_value_*(). Fixed an error in the sumatory when the module is incremental. * include/functions_reporting.php: Renamed return_module_SLA() to get_agent_module_sla(). * include/functions_reporting_pdf.php: Tabs and blankspaces correction. Style correction. Added new reports rendering, and fixed images references. Removed old and deprecated functions. * operation/agentes/networkmap.php: Style correction. * operation/agentes/sla_view.php, reporting/stat_win.php: Use renamed functions. * operation/reporting/reporting_viewer.php: Table reports width are now wider. Fixed some colspan problems. Generate custom graph ids better. Added agent and module name to SLAs. Style correction in the use of rowclass structure since now each content has its own table. * operation/reporting/custom_reporting.php: Removed unused variable for PDF reporting generation link. * operation/reporting/reporting_viewer_pdf.php: Rewrite the code to make style corrections and use pandora functions. * operation/menu.php: Tabs and blankspaces correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@916 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-07-02 14:30:56 +02:00
* @param id_user
* @param event_type
* @param priority
* @param id_agent_module
* @param id_aam
*/
2008-07-02 Esteban Sanchez <estebans@artica.es> * general/logon_ok.php: Style correction. * include/languages/language_en.php: Added a couple of strings. * include/styles/pandora.css: Container div has now variable width, so Pandora console is wider now. * include/config.php: Replaced default values from last commit. Change homeurl variable, which now points to base url directory. * include/config_process.php: Style correction. Use pandora functions and indent the code properly. * reporting/fgraph.php, include/functions.php, ajax.php: Use require_once instead of require which speeds up the code parsing. * index.php: Use require_once instead of require which speeds up the code parsing. Add all GET and POST variables when refreshing a page. Style corrections. Use $_SERVER instead getenv. * include/functions_db.php: Avoid including config.php and use global instead. Replaced some id_user with the respective variable holds in config array. Replaced SQL syntax, removed an undeclared variable and renamed to english in event_insert(). Renamed return_moduledata_*_value() to get_agent_module_value_*(). Fixed an error in the sumatory when the module is incremental. * include/functions_reporting.php: Renamed return_module_SLA() to get_agent_module_sla(). * include/functions_reporting_pdf.php: Tabs and blankspaces correction. Style correction. Added new reports rendering, and fixed images references. Removed old and deprecated functions. * operation/agentes/networkmap.php: Style correction. * operation/agentes/sla_view.php, reporting/stat_win.php: Use renamed functions. * operation/reporting/reporting_viewer.php: Table reports width are now wider. Fixed some colspan problems. Generate custom graph ids better. Added agent and module name to SLAs. Style correction in the use of rowclass structure since now each content has its own table. * operation/reporting/custom_reporting.php: Removed unused variable for PDF reporting generation link. * operation/reporting/reporting_viewer_pdf.php: Rewrite the code to make style corrections and use pandora functions. * operation/menu.php: Tabs and blankspaces correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@916 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-07-02 14:30:56 +02:00
function event_insert ($event, $id_group, $id_agent, $status = 0,
$id_user = '', $event_type = "unknown", $priority = 0,
$id_agent_module = 0, $id_aam = 0) {
$sql = sprintf ('INSERT INTO tevento (id_agente, id_grupo, evento, timestamp,
2008-07-02 Esteban Sanchez <estebans@artica.es> * general/logon_ok.php: Style correction. * include/languages/language_en.php: Added a couple of strings. * include/styles/pandora.css: Container div has now variable width, so Pandora console is wider now. * include/config.php: Replaced default values from last commit. Change homeurl variable, which now points to base url directory. * include/config_process.php: Style correction. Use pandora functions and indent the code properly. * reporting/fgraph.php, include/functions.php, ajax.php: Use require_once instead of require which speeds up the code parsing. * index.php: Use require_once instead of require which speeds up the code parsing. Add all GET and POST variables when refreshing a page. Style corrections. Use $_SERVER instead getenv. * include/functions_db.php: Avoid including config.php and use global instead. Replaced some id_user with the respective variable holds in config array. Replaced SQL syntax, removed an undeclared variable and renamed to english in event_insert(). Renamed return_moduledata_*_value() to get_agent_module_value_*(). Fixed an error in the sumatory when the module is incremental. * include/functions_reporting.php: Renamed return_module_SLA() to get_agent_module_sla(). * include/functions_reporting_pdf.php: Tabs and blankspaces correction. Style correction. Added new reports rendering, and fixed images references. Removed old and deprecated functions. * operation/agentes/networkmap.php: Style correction. * operation/agentes/sla_view.php, reporting/stat_win.php: Use renamed functions. * operation/reporting/reporting_viewer.php: Table reports width are now wider. Fixed some colspan problems. Generate custom graph ids better. Added agent and module name to SLAs. Style correction in the use of rowclass structure since now each content has its own table. * operation/reporting/custom_reporting.php: Removed unused variable for PDF reporting generation link. * operation/reporting/reporting_viewer_pdf.php: Rewrite the code to make style corrections and use pandora functions. * operation/menu.php: Tabs and blankspaces correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@916 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-07-02 14:30:56 +02:00
estado, utimestamp, id_usuario, event_type, criticity,
id_agentmodule, id_alert_am)
VALUES (%d, %d, "%s", NOW(), %d, NOW(), "%s", "%s", %d, %d, %d)',
$id_agent, $id_group, $event, $status, $id_user, $event_type,
$priority, $id_agent_module, $id_aam);
process_sql ($sql);
}
/**
* Get the interval value of an agent module.
*
* If the module interval is not set, the agent interval is returned
*
* @param id_agent_module Id agent module to get the interval value.
*
* @return
*/
function get_module_interval ($id_agent_module) {
$interval = (int) get_db_value ('module_interval', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
if ($interval)
return $interval;
$id_agent = get_db_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', (int) $id_agent_module);
return (int) give_agentinterval ($id_agent);
}
/**
* Get the interval of an agent.
*
* @param id_agent Agent id.
*
* @return The interval value of a given agent
*/
function give_agentinterval ($id_agent) {
return (int) get_db_value ('intervalo', 'tagente', 'id_agente', $id_agent);
}
/**
* Get the flag value of an agent module.
*
* @param id_agent_module Agent module id.
*
* @return 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);
}
/**
* Prints a list of <options> HTML tags with the groups the user has
* reading privileges.
*
* @param id_user User id
* @param show_all Flag to show all the groups or not. True by default.
*
* @return An array with all the groups
*/
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
function list_group ($id_user, $show_all = 1){
$mis_grupos = array (); // Define array mis_grupos to put here all groups with Agent Read permission
$sql = 'SELECT id_grupo, nombre FROM tgrupo';
$result = get_db_all_rows_sql ($sql);
foreach ($result as $row) {
if (($row["id_grupo"] != 1 || $show_all == 1) && $row["id_grupo"] != 0 && give_acl($id_user,$row["id_grupo"], "AR") == 1) {
//Put in an array all the groups the user belongs to
array_push ($mis_grupos, $row["id_grupo"]);
echo '<option value="'.$row["id_grupo"].'">'.$row["nombre"].'</option>';
}
}
return ($mis_grupos);
}
/**
* Get a list of the groups a user has reading privileges.
*
* DEPRECATED: Use get_user_groups () instead
*
* @param id_user User id
*
* @return A list of the groups the user has reading privileges.
*/
function list_group2 ($id_user) {
$mis_grupos = array (); // Define array mis_grupos to put here all groups with Agent Read permission
$result = get_db_all_fields_in_table ("tgrupo","id_grupo");
foreach ($result as $row) {
if (give_acl ($id_user, $row["id_grupo"], "AR") == 1) {
array_push ($mis_grupos, $row["id_grupo"]); //Put in array all the groups the user belongs to
}
}
return ($mis_grupos);
}
/**
* Get all the groups a user has reading privileges.
*
* @param id_user User id
*
* @return A list of the groups the user has reading privileges.
*/
function get_user_groups ($id_user) {
$user_groups = array ();
$groups = get_db_all_rows_in_table ('tgrupo', 'nombre');
foreach ($groups as $group) {
if (! give_acl ($id_user, $group["id_grupo"], "AR"))
continue;
$user_groups[$group['id_grupo']] = $group['nombre'];
}
return $user_groups;
}
/**
* Get group icon
*
* The path of the icons is 'images/' or 'images/group_small/', which
* must be append by the caller (including slash and filename
* extension .png)
*
* @param id_group Group id
*
* @return Icon filename of the given group
*/
function show_icon_group ($id_group) {
return (string) get_db_value ('icon', 'tgrupo', 'id_grupo', $id_group);
}
/**
* Get module type icon.
*
* The path of the icons is 'images/', which must be append by the
* caller (including final slash).
*
* @param id_tipo Module type id
*
* @return 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)
*
* @param int Server type id
* @return string Fully formatted IMG HTML tag with icon
*/
function show_server_type ($id){
global $config;
switch ($id) {
case 1:
return '<img src="images/data.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;
default: return "--";
}
}
/**
* Get a module category name
*
* @param id_category Id category
*
* @return Name of the given category
*/
function give_modulecategory_name ($id_category) {
switch ($id_category) {
case 0:
return lang_string ("cat_0");
break;
case 1:
return lang_string ("cat_1");
break;
case 2:
return lang_string ("cat_2");
break;
case 3:
return lang_string ("cat_3");
break;
}
return lang_string ("unknown");
}
/**
* Get a network component group name
*
* @param id_network_component_group Id network component group.
*
* @return Name of the given network component group
*/
function give_network_component_group_name ($id_network_component_group) {
return (string) get_db_value ('name', 'tnetwork_component_group', 'id_sg', $id_network_component_group);
}
/**
* Get a network profile name.
*
* @param id_network_profile Id network profile
*
* @return Name of the given network profile.
*/
function give_network_profile_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 id_agent Agent id
* @param ip_address 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 id_agent Agent id
* @param ip_address 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) {
$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);
}
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
// Need to change main address ?
if (give_agent_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
$new_ip = give_agent_address_from_list ($id_agent);
// Change main address in agent to whis one
$query = sprintf ("UPDATE tagente SET `direccion` = '%s' WHERE id_agente = %d",$new_ip,$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 id_agent Agent id
*
* @return The address of the given agent
*/
function give_agent_address ($id_agent) {
return (string) get_db_value ('direccion', 'tagente', 'id_agente', $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 IP address of an agent from address list
*
* @param id_agent Agent id
*
* @return The IP address of the given 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
function give_agent_address_from_list ($id_agent){
$sql = "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 = $id_agent";
return (string) get_db_sql ($sql);
}
/**
* Get agent id from an agent module.
*
* @param id_agent_module Id of the agent module.
*
* @return 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 field Field name to get
* @param table Table to retrieve the data
* @param field_search Field to filter elements
* @param condition Condition the field must have
*
* @return 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) {
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);
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;
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
}
/**
* Get the first row of an SQL database query.
*
* @param sql SQL select statement to execute.
*
* @return The first row of the result or something empty.
*/
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_db_row_sql ($sql) {
$sql .= " LIMIT 1";
$result = get_db_all_rows_sql ($sql);
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 * FROM $table WHERE $field_search = $condition"
*
* @param table Table to get the row
* @param field_search Field to filter elementes
* @param condition Condition the field must have.
*
* @return The first row of a database query.
*/
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 get_db_row ($table, $field_search, $condition) {
if (is_int ($condition)) {
$sql = sprintf ("SELECT * FROM `%s` WHERE `%s` = %d LIMIT 1", $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 * FROM `%s` WHERE `%s` = %f LIMIT 1", $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 * FROM `%s` WHERE `%s` = '%s' LIMIT 1", $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);
if($result === false)
return false;
return $result[0];
}
/**
* Get a single field in the databse from a SQL query.
*
* @param sql SQL statement to execute
* @param field Field number to get, beggining by 0. Default: 0
* @param cache Cache the query while generating this page. Default: 1
* @return The selected field of the first row in a select statement.
*/
function get_db_sql ($sql, $field = 0) {
$result = get_db_all_rows_sql ($sql);
if($result === false)
return false;
return $result[0][$field];
}
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 $sql SQL statement to execute.
*
* @return 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
*/
2008-06-30 10:11:10 +02:00
function get_db_all_rows_sql ($sql) {
2008-07-25 Sancho Lerena <slerena@gmail.com> * pandoradb.sql: Added new tables for planned downtimes. * godmode/menu.php: Added entry for manage downtimes. * group_list.php: Stetic changes in table. * modificar_server.php: Fixed timestamp render for start/update timestamp of each server. * functions.php: Minimal estetic changes in help function. * functions_db.php: Change header (Flexible <- Free) * functions_html.php: Now select admits multiselect option. Default class for table render is now databox not databox_color. * AUTHORS: Update list of authors and make a reference to contributors. * function_reporting.php: Header change, updated datetime string format. * language_en.php, language_es_es.php: Changed FREE for Flexible. * pandora.css: Minimal changes. Update color of Monitor count in tactical. * menu.php: Added some new event options: CSV Export, RSS and new marquee event visualizer. * estado_ultimopaquete.php: Header update. * tactical.php: Added link to data module alerts. * ver_agente.php: Fixed a problem in ajax code that was rending bad count of down monitors. Using boolean comparation on result of function get_db_sql(). This kind problem could be in more lines of code. * events.php: New quicklinks to RSS, CSV and Marquee in event viewer. * export_csv.php, events_rss.php: Fixed duped call to function includes. * graph_viewer.php: I hope this fix FINALLY the annoying bug of graph type selector. * visual_console/index.php: Updated header. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@973 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-07-25 20:37:32 +02:00
$return = process_sql ($sql);
if (! empty ($return))
return $return;
//Return false, check with === or !==
return false;
}
/**
* 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 $sql SQL statement to execute
*
* @param $rettype (optional) What type of info to return in case of INSERT/UPDATE.
* insert_id will return the ID of an autoincrement value
* info will return the full (debug) information of a query
* default will return mysql_affected_rows
*
* @return An array with the rows, columns and values in a multidimensional array
*/
function process_sql ($sql,$rettype = "affected_rows") {
global $config;
global $sql_cache;
$retval = array();
if (! empty ($sql_cache[$sql])) {
$retval = $sql_cache[$sql];
$sql_cache['saved']++;
} else {
$result = mysql_query ($sql);
if ($result === false) {
echo '<strong>Error:</strong> get_db_all_rows_sql ("'.$sql.'") :'. mysql_error ().'<br />';
return false;
} elseif ($result === true) {
if ($rettype == "insert_id") {
return mysql_insert_id ();
} elseif ($rettype == "info") {
return mysql_info ();
}
return mysql_affected_rows (); //This happens in case the statement was executed but didn't need a resource
} else {
while ($row = mysql_fetch_array ($result)) {
array_push ($retval, $row);
}
$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 $table Database table name.
*
* @return A matrix with all the values in the table
*/
function get_db_all_rows_in_table ($table, $order_field = "") {
if ($order_field != "") {
return get_db_all_rows_sql ("SELECT * FROM `".$table."` ORDER BY `".$order_field."` ");
} 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 $table Database table name.
* @param $field Field of the table.
* @param $condition Condition the field must have to be selected.
*
* @return A matrix with all the values in the table that matches the condition in the field
*/
function get_db_all_rows_field_filter ($table, $field, $condition, $order_field = "") {
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 * 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 $table Database table name.
* @param $field Field of the table.
* @param $condition Condition the field must have to be selected.
*
* @return A matrix with all the values in the table that matches the condition in the field
*/
function get_db_all_fields_in_table ($table, $field, $condition='') {
$sql = sprintf ("SELECT * FROM `%s`", $table);
if($condition != '') {
$sql .= sprintf (" WHERE `%s` = '%s'", $field, $condition);
}
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
}
/**
* Get the status of an alert assigned to an agent module.
*
* @param id_agentmodule Id agent module to check.
*
* @return True if there were alerts fired.
*/
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
function return_status_agent_module ($id_agentmodule = 0){
$sql = sprintf ('SELECT `estado` FROM `tagente_estado` WHERE `id_agente_modulo` = %d', $id_agentmodule);
$estado = get_db_sql($sql);
if ($estado == 100) {
// We need to check if there are any alert on this item
$sql = sprintf ('SELECT SUM(times_fired) FROM `talerta_agente_modulo` WHERE `id_agente_modulo` = %d', $id_agentmodule);
$times_fired = get_db_sql($sql);
if ($times_fired > 0){
return 0;
}
// No alerts fired for this agent module
return 1;
} elseif ($estado == 0) { // 0 is ok for estado field
return 1;
} else {
2008-07-10 Sancho Lerena <slerena@gmail.com> * include/styles/pandora_red.css: Updated. * include/styles/pandora_black.css: New style with BLACK blackground. * include/styles/pandora.css: Updated. * include/functions_db.php: Added auto order combos and queries. * include/functions_visual_map.php: Added overlap on down elements if there are more than one in the same position (This could allow to cluster elements to shown the down status first). Removed unused code. * operation/events/events.php: Added tooltip for group name. * operation/visual_console/render_view.php: Adjusted controls position. * operation/agentes/status_monitor.php: Added status for unknown monitors. Added some database search improvement. * operation/agentes/sla_view.php: Sorted list of items. * operation/agentes/ver_agente.php: Updated AJAX code for network map detail view of an agent. Added alert data. * operation/agentes/tactical.php: Removed 'fixed' styles, now using CSS. * operation/agentes/networkmap.php: Added ransep and font selectors. Added alert under yellow color. Minor improvements. * operation/reporting/graph_viewer.php: Style update. * operation/menu.php: Visual console maps sort by name * images/background-li.gif: This sould replace <li> image. * general/login_page.php: Added build version on develop mode. * godmode/reporting/map_builder.php: Sorted lists, and shown module name instead description. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@949 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-07-10 13:58:40 +02:00
return 0;
}
}
/**
* Get the status of a layout.
*
* It gets all the data of the contained elements (including nested
* layouts), and makes an AND operation to be sure that all the items
* are OK. If any of them is down, then result is down (0)
*
* @param id_layout Id of the layout
*
* @return The status of the given layout.
*/
function return_status_layout ($id_layout = 0) {
$temp_status = 0;
$temp_total = 0;
$sql = sprintf ('SELECT id_agente_modulo, parent_item, id_layout_linked FROM `tlayout_data` WHERE `id_layout` = %d', $id_layout);
$result = get_db_all_rows_sql ($sql);
if ($result === false)
return 0;
foreach ($result as $rownum => $data) {
if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) {
$temp_status += return_status_layout ($data["id_layout_linked"]);
$temp_total++;
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
} else {
$temp_status += return_status_agent_module ($data["id_agente_modulo"]);
$temp_total++;
}
}
if ($temp_status == $temp_total) {
return 1;
}
return 0;
}
/**
* Get the current value of an agent module.
*
* @param id_agentmodule
*
* @return
*/
function return_value_agent_module ($id_agentmodule) {
return format_numeric (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 id_layoutdata Id of the layout to get.
*
* @return 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) {
return (float) get_db_value ('pos_x', 'tlayout_data', 'id', $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 X axis coordinate of a layout item
*
* @param id_layoutdata Id of the layout to get.
*
* @return 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_y ($id_layoutdata){
return (float) get_db_value ('pos_y', 'tlayout_data', 'id', $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 $id_agent_module Agent module 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
* @param $utimestamp The timestamp to look backwards from and get the data.
*
* @return The row of tagente_datos of the last period. NULL if there were no data.
*/
function get_previous_data ($id_agent_module, $utimestamp) {
$interval = get_module_interval ($id_agent_module);
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
$sql = sprintf ('SELECT * FROM tagente_datos
WHERE id_agente_modulo = %d
AND utimestamp <= %d
AND utimestamp > %d
ORDER BY utimestamp DESC',
$id_agent_module, $utimestamp, $utimestamp - $interval);
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 get_db_row_sql ($sql);
}
/**
* Get the average value of an agent module in a period of time.
*
* @param id_agent_module Agent module id
* @param period Period of time to check (in seconds)
* @param date Top date to check the values. Default current time.
*
* @return The average module value in the interval.
*/
2008-07-02 Esteban Sanchez <estebans@artica.es> * general/logon_ok.php: Style correction. * include/languages/language_en.php: Added a couple of strings. * include/styles/pandora.css: Container div has now variable width, so Pandora console is wider now. * include/config.php: Replaced default values from last commit. Change homeurl variable, which now points to base url directory. * include/config_process.php: Style correction. Use pandora functions and indent the code properly. * reporting/fgraph.php, include/functions.php, ajax.php: Use require_once instead of require which speeds up the code parsing. * index.php: Use require_once instead of require which speeds up the code parsing. Add all GET and POST variables when refreshing a page. Style corrections. Use $_SERVER instead getenv. * include/functions_db.php: Avoid including config.php and use global instead. Replaced some id_user with the respective variable holds in config array. Replaced SQL syntax, removed an undeclared variable and renamed to english in event_insert(). Renamed return_moduledata_*_value() to get_agent_module_value_*(). Fixed an error in the sumatory when the module is incremental. * include/functions_reporting.php: Renamed return_module_SLA() to get_agent_module_sla(). * include/functions_reporting_pdf.php: Tabs and blankspaces correction. Style correction. Added new reports rendering, and fixed images references. Removed old and deprecated functions. * operation/agentes/networkmap.php: Style correction. * operation/agentes/sla_view.php, reporting/stat_win.php: Use renamed functions. * operation/reporting/reporting_viewer.php: Table reports width are now wider. Fixed some colspan problems. Generate custom graph ids better. Added agent and module name to SLAs. Style correction in the use of rowclass structure since now each content has its own table. * operation/reporting/custom_reporting.php: Removed unused variable for PDF reporting generation link. * operation/reporting/reporting_viewer_pdf.php: Rewrite the code to make style corrections and use pandora functions. * operation/menu.php: Tabs and blankspaces correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@916 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-07-02 14:30:56 +02:00
function get_agent_module_value_average ($id_agent_module, $period, $date = 0) {
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 (! $date)
$date = time ();
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
$datelimit = $date - $period;
$sql = sprintf ("SELECT SUM(datos), COUNT(*) 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_row_sql ($sql);
$sum = (float) $values[0];
$total = (int) $values[1];
/* Get also the previous data before the selected interval. */
$previous_data = get_previous_data ($id_agent_module, $datelimit);
if ($previous_data)
return ($previous_data['datos'] + $sum) / ($total + 1);
if ($total > 0)
return $sum / $total;
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
return 0;
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 maximum value of an agent module in a period of time.
*
* @param id_agent_module Agent module id to get the maximum value.
* @param period Period of time to check (in seconds)
* @param date Top date to check the values. Default current time.
*
* @return The maximum module value in the interval.
*/
2008-07-02 Esteban Sanchez <estebans@artica.es> * general/logon_ok.php: Style correction. * include/languages/language_en.php: Added a couple of strings. * include/styles/pandora.css: Container div has now variable width, so Pandora console is wider now. * include/config.php: Replaced default values from last commit. Change homeurl variable, which now points to base url directory. * include/config_process.php: Style correction. Use pandora functions and indent the code properly. * reporting/fgraph.php, include/functions.php, ajax.php: Use require_once instead of require which speeds up the code parsing. * index.php: Use require_once instead of require which speeds up the code parsing. Add all GET and POST variables when refreshing a page. Style corrections. Use $_SERVER instead getenv. * include/functions_db.php: Avoid including config.php and use global instead. Replaced some id_user with the respective variable holds in config array. Replaced SQL syntax, removed an undeclared variable and renamed to english in event_insert(). Renamed return_moduledata_*_value() to get_agent_module_value_*(). Fixed an error in the sumatory when the module is incremental. * include/functions_reporting.php: Renamed return_module_SLA() to get_agent_module_sla(). * include/functions_reporting_pdf.php: Tabs and blankspaces correction. Style correction. Added new reports rendering, and fixed images references. Removed old and deprecated functions. * operation/agentes/networkmap.php: Style correction. * operation/agentes/sla_view.php, reporting/stat_win.php: Use renamed functions. * operation/reporting/reporting_viewer.php: Table reports width are now wider. Fixed some colspan problems. Generate custom graph ids better. Added agent and module name to SLAs. Style correction in the use of rowclass structure since now each content has its own table. * operation/reporting/custom_reporting.php: Removed unused variable for PDF reporting generation link. * operation/reporting/reporting_viewer_pdf.php: Rewrite the code to make style corrections and use pandora functions. * operation/menu.php: Tabs and blankspaces correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@916 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-07-02 14:30:56 +02:00
function get_agent_module_value_max ($id_agent_module, $period, $date = 0) {
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 (! $date)
$date = time ();
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
$datelimit = $date - $period;
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
$sql = sprintf ("SELECT MAX(datos) FROM tagente_datos
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
WHERE id_agente_modulo = %d
AND utimestamp > %d AND utimestamp <= %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
$id_agent_module, $datelimit, $date);
$max = (float) get_db_sql ($sql);
/* Get also the previous report before the selected interval. */
$previous_data = get_previous_data ($id_agent_module, $datelimit);
if ($previous_data)
return max ($previous_data['datos'], $max);
return max ($previous_data, $max);
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 minimum value of an agent module in a period of time.
*
* @param id_agent_module Agent module id to get the minimum value.
* @param period Period of time to check (in seconds)
* @param date Top date to check the values. Default current time.
*
* @return The minimum module value of the module
*/
2008-07-02 Esteban Sanchez <estebans@artica.es> * general/logon_ok.php: Style correction. * include/languages/language_en.php: Added a couple of strings. * include/styles/pandora.css: Container div has now variable width, so Pandora console is wider now. * include/config.php: Replaced default values from last commit. Change homeurl variable, which now points to base url directory. * include/config_process.php: Style correction. Use pandora functions and indent the code properly. * reporting/fgraph.php, include/functions.php, ajax.php: Use require_once instead of require which speeds up the code parsing. * index.php: Use require_once instead of require which speeds up the code parsing. Add all GET and POST variables when refreshing a page. Style corrections. Use $_SERVER instead getenv. * include/functions_db.php: Avoid including config.php and use global instead. Replaced some id_user with the respective variable holds in config array. Replaced SQL syntax, removed an undeclared variable and renamed to english in event_insert(). Renamed return_moduledata_*_value() to get_agent_module_value_*(). Fixed an error in the sumatory when the module is incremental. * include/functions_reporting.php: Renamed return_module_SLA() to get_agent_module_sla(). * include/functions_reporting_pdf.php: Tabs and blankspaces correction. Style correction. Added new reports rendering, and fixed images references. Removed old and deprecated functions. * operation/agentes/networkmap.php: Style correction. * operation/agentes/sla_view.php, reporting/stat_win.php: Use renamed functions. * operation/reporting/reporting_viewer.php: Table reports width are now wider. Fixed some colspan problems. Generate custom graph ids better. Added agent and module name to SLAs. Style correction in the use of rowclass structure since now each content has its own table. * operation/reporting/custom_reporting.php: Removed unused variable for PDF reporting generation link. * operation/reporting/reporting_viewer_pdf.php: Rewrite the code to make style corrections and use pandora functions. * operation/menu.php: Tabs and blankspaces correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@916 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-07-02 14:30:56 +02:00
function get_agent_module_value_min ($id_agent_module, $period, $date = 0) {
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 (! $date)
$date = time ();
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
$datelimit = $date - $period;
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
$sql = sprintf ("SELECT MIN(datos) FROM tagente_datos
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
WHERE id_agente_modulo = %d
AND utimestamp > %d AND utimestamp <= %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
$id_agent_module, $datelimit, $date);
$min = (float) get_db_sql ($sql);
/* Get also the previous data before the selected interval. */
$previous_data = get_previous_data ($id_agent_module, $datelimit);
if ($previous_data)
return min ($previous_data['datos'], $min);
return $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
}
/**
* Get the sumatory of values of an agent module in a period of time.
*
* @param id_agent_module Agent module id to get the sumatory.
* @param period Period of time to check (in seconds)
* @param date Top date to check the values. Default current time.
*
* @return The sumatory of the module values in the interval.
*/
2008-07-02 Esteban Sanchez <estebans@artica.es> * general/logon_ok.php: Style correction. * include/languages/language_en.php: Added a couple of strings. * include/styles/pandora.css: Container div has now variable width, so Pandora console is wider now. * include/config.php: Replaced default values from last commit. Change homeurl variable, which now points to base url directory. * include/config_process.php: Style correction. Use pandora functions and indent the code properly. * reporting/fgraph.php, include/functions.php, ajax.php: Use require_once instead of require which speeds up the code parsing. * index.php: Use require_once instead of require which speeds up the code parsing. Add all GET and POST variables when refreshing a page. Style corrections. Use $_SERVER instead getenv. * include/functions_db.php: Avoid including config.php and use global instead. Replaced some id_user with the respective variable holds in config array. Replaced SQL syntax, removed an undeclared variable and renamed to english in event_insert(). Renamed return_moduledata_*_value() to get_agent_module_value_*(). Fixed an error in the sumatory when the module is incremental. * include/functions_reporting.php: Renamed return_module_SLA() to get_agent_module_sla(). * include/functions_reporting_pdf.php: Tabs and blankspaces correction. Style correction. Added new reports rendering, and fixed images references. Removed old and deprecated functions. * operation/agentes/networkmap.php: Style correction. * operation/agentes/sla_view.php, reporting/stat_win.php: Use renamed functions. * operation/reporting/reporting_viewer.php: Table reports width are now wider. Fixed some colspan problems. Generate custom graph ids better. Added agent and module name to SLAs. Style correction in the use of rowclass structure since now each content has its own table. * operation/reporting/custom_reporting.php: Removed unused variable for PDF reporting generation link. * operation/reporting/reporting_viewer_pdf.php: Rewrite the code to make style corrections and use pandora functions. * operation/menu.php: Tabs and blankspaces correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@916 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-07-02 14:30:56 +02:00
function get_agent_module_value_sumatory ($id_agent_module, $period, $date = 0) {
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 (! $date)
$date = time ();
$datelimit = $date - $period; // limit date
$id_module_type = get_db_value ('id_tipo_modulo', 'tagente_modulo','id_agente_modulo', $id_agent_module);
$module_name = get_db_value ('nombre', 'ttipo_modulo', 'id_tipo', $id_module_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
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_module_data_string ($module_name)) {
return lang_string ('wrong_module_type');
}
// Get the whole interval of data
$sql = sprintf ('SELECT utimestamp, datos FROM tagente_datos
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
WHERE id_agente_modulo = %d
AND utimestamp > %d AND utimestamp <= %d
ORDER BY utimestamp ASC',
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
$id_agent_module, $datelimit, $date);
2008-06-30 10:11:10 +02:00
$datas = get_db_all_rows_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
/* Get also the previous data before the selected interval. */
$previous_data = get_previous_data ($id_agent_module, $datelimit);
if ($previous_data) {
/* Add data to the beginning */
array_unshift ($datas, $previous_data);
}
if ($datas === 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
return 0;
}
$last_data = "";
$total_badtime = 0;
$module_interval = get_module_interval ($id_agent_module);
$timestamp_begin = $datelimit + $module_interval;
$timestamp_end = 0;
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
$sum = 0;
$data_value = 0;
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
foreach ($datas as $data) {
$timestamp_end = $data["utimestamp"];
$elapsed = $timestamp_end - $timestamp_begin;
$times = intval ($elapsed / $module_interval);
if (is_module_inc ($module_name)) {
$data_value = $data['datos'] * $module_interval;
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 {
$data_value = $data['datos'];
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
}
$sum += $times * $data_value;
$timestamp_begin = $data["utimestamp"];
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
}
/* The last value must be get from tagente_estado, but
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
it will count only if it's not older than date demanded
*/
$timestamp_end = get_db_value ('utimestamp', 'tagente_estado', 'id_agente_modulo', $id_agent_module);
if ($timestamp_end <= $datelimit) {
$elapsed = $timestamp_end - $timestamp_begin;
$times = intval ($elapsed / $module_interval);
2008-07-02 Esteban Sanchez <estebans@artica.es> * general/logon_ok.php: Style correction. * include/languages/language_en.php: Added a couple of strings. * include/styles/pandora.css: Container div has now variable width, so Pandora console is wider now. * include/config.php: Replaced default values from last commit. Change homeurl variable, which now points to base url directory. * include/config_process.php: Style correction. Use pandora functions and indent the code properly. * reporting/fgraph.php, include/functions.php, ajax.php: Use require_once instead of require which speeds up the code parsing. * index.php: Use require_once instead of require which speeds up the code parsing. Add all GET and POST variables when refreshing a page. Style corrections. Use $_SERVER instead getenv. * include/functions_db.php: Avoid including config.php and use global instead. Replaced some id_user with the respective variable holds in config array. Replaced SQL syntax, removed an undeclared variable and renamed to english in event_insert(). Renamed return_moduledata_*_value() to get_agent_module_value_*(). Fixed an error in the sumatory when the module is incremental. * include/functions_reporting.php: Renamed return_module_SLA() to get_agent_module_sla(). * include/functions_reporting_pdf.php: Tabs and blankspaces correction. Style correction. Added new reports rendering, and fixed images references. Removed old and deprecated functions. * operation/agentes/networkmap.php: Style correction. * operation/agentes/sla_view.php, reporting/stat_win.php: Use renamed functions. * operation/reporting/reporting_viewer.php: Table reports width are now wider. Fixed some colspan problems. Generate custom graph ids better. Added agent and module name to SLAs. Style correction in the use of rowclass structure since now each content has its own table. * operation/reporting/custom_reporting.php: Removed unused variable for PDF reporting generation link. * operation/reporting/reporting_viewer_pdf.php: Rewrite the code to make style corrections and use pandora functions. * operation/menu.php: Tabs and blankspaces correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@916 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-07-02 14:30:56 +02:00
if (is_module_inc ($module_name)) {
$data_value = $data['datos'] * $module_interval;
} else {
$data_value = $data['datos'];
}
$sum += $times * $data_value;
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 (float) $sum;
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
}
/**
* Loads a language file.
*
* Check existance of file.
*
* @param file Filename of language definitions to load.
*/
function load_lang_file ($file) {
if (file_exists ($file))
require_once ($config["homedir"]."/include/languages/language_".$config["language"].".php");
}
/**
* Get a translated string.
*
* @param string String to translate
*
* @return The translated string. If not defined, the same string will be returned
*/
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 lang_string ($string) {
global $config;
global $lang_label;
if (!is_array ($lang_label)) {
/* Only includes the file once (the first function call)
and since $lang_label is global, it will propagate */
load_lang_file ($config["homedir"]."/include/languages/language_".$config["language"].".php");
}
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 (isset ($lang_label[$string]))
return $lang_label[$string];
return $string;
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
}
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
/**
* Get the numbers of servers up.
*
* This check assumes that server_keepalive should be at least 15 minutes.
*
* @return The number of agents 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 = get_db_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
// Set servers to down
if ($status == 0){
process_sql ("UPDATE tserver SET status = 0");
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 $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
}
/**
*
*
* @param id_combined_alert
*
* @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
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 talerta_agente_modulo.*, tcompound_alert.operation FROM talerta_agente_modulo, tcompound_alert
WHERE tcompound_alert.id_aam = talerta_agente_modulo.id_aam AND tcompound_alert.id = %d",$id_combined_alert);
$result = 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
echo "<table width=400 cellpadding=2 cellspacing=2 class='databox'>";
echo "<th>".lang_string("Name");
echo "<th>".lang_string("Oper");
echo "<th>".lang_string("Tt");
echo "<th>".lang_string("Firing");
echo "<th>".lang_string("Time");
echo "<th>".lang_string("Desc");
echo "<th>".lang_string("Recovery");
echo "<th>".lang_string("MinMax.Al");
echo "<th>".lang_string("Days");
echo "<th>".lang_string("Fired");
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"]);
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 class=$tdcolor>".$row2["operation"];
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"]);
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-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
$mymin = lang_string ("N/A");
$mymax = $mymin;
}
// We have alert text ?
if ($row2["alert_text"]!= "") {
echo "<td class='$tdcolor'>".lang_string ('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) {
$recovery_notify = lang_string ("Yes");
} else {
$recovery_notify = lang_string ("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"] != ""){
$firing_cond = lang_string ("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) {
echo "<td class='".$tdcolor."' align='center'><img width='20' height='9' src='images/pixel_red.png' title='".lang_string ("fired")."'></td>";
} else {
echo "<td class='".$tdcolor."' align='center'><img width='20' height='9' src='images/pixel_green.png' title='".lang_string ("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
/**
*
*
* @param filter
* @param limit
* @param width
*
* @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
function smal_event_table ($filter = "", $limit = 10, $width = 440) {
global $config;
$sql = sprintf ("SELECT * FROM tevento %s ORDER BY timestamp DESC LIMIT %d",$filter,$limit);
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
echo "<table cellpadding='4' cellspacing='4' width='$width' border=0 class='databox'>";
echo "<tr>";
echo "<th colspan=6>".lang_string ("Latest events");
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
echo "<tr>";
echo "<th class='datos3 f9'>".lang_string ("St")."</th>";
echo "<th class='datos3 f9'>".lang_string ("Type")."</th>";
echo "<th class='datos3 f9'>".lang_string ('event_name')."</th>";
echo "<th class='datos3 f9'>".lang_string ('agent_name')."</th>";
echo "<th class='datos3 f9'>".lang_string ('id_user')."</th>";
echo "<th class='datos3 f9'>".lang_string ('timestamp')."</th>";
$result = get_db_all_rows_sql ($sql);
if($result === false)
$result = array();
foreach ($result as $event) {
$id_grupo = $event["id_grupo"];
if (! give_acl ($config["id_user"], $id_grupo, "AR")) {
continue;
}
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
/* Only incident read access to view data ! */
switch ($event["criticity"]) {
case 0:
$tdclass = "datos_blue";
break;
case 1:
$tdclass = "datos_grey";
break;
case 2:
$tdclass = "datos_green";
break;
case 3:
$tdclass = "datos_yellow";
break;
case 4:
$tdclass = "datos_red";
break;
default:
$tdclass = "datos_grey";
}
$criticity_label = return_priority ($event["criticity"]);
/* Colored box */
echo "<tr><td class='$tdclass' title='$criticity_label' align='center'>";
if ($event["estado"] == 0) {
echo "<img src='images/pixel_red.png' width=20 height=20>";
} else {
echo "<img src='images/pixel_green.png' width=20 height=20>";
}
/* Event type */
echo "<td class='".$tdclass."' title='".$event["event_type"]."'>";
switch ($event["event_type"]) {
case "unknown":
echo "<img src='images/err.png'>";
break;
case "alert_recovered":
echo "<img src='images/error.png'>";
break;
case "alert_manual_validation":
echo "<img src='images/eye.png'>";
break;
case "monitor_up":
echo "<img src='images/lightbulb.png'>";
break;
case "monitor_down":
echo "<img src='images/lightbulb_off.png'>";
break;
case "alert_fired":
echo "<img src='images/bell.png'>";
break;
case "system";
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
echo "<img src='images/cog.png'>";
break;
case "recon_host_detected";
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
echo "<img src='images/network.png'>";
break;
}
// Event description
echo "<td class='".$tdclass."f9' title='".$event["evento"]."'>";
echo substr ($event["evento"],0,45);
if (strlen ($event["evento"]) > 45) {
echo "..";
}
if ($event["id_agente"] > 0) {
// Agent name
$agent_name = dame_nombre_agente ($event["id_agente"]);
echo "<td class='".$tdclass."f9' title='$agent_name'><a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event["id_agente"]."'><b>";
echo substr ($agent_name, 0, 14);
if (strlen ($agent_name) > 14)
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
echo "..";
echo "</b></a>";
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 System or SNMP generated alerts
} else {
if ($event["event_type"] == "system") {
echo "<td class='$tdclass'>".lang_string ("System");
} else {
echo "<td class='$tdclass'>".lang_string ("alert")."SNMP";
}
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
}
// User who validated event
echo "<td class='$tdclass'>";
if ($event["estado"] != 0) {
echo "<a href='index.php?sec=usuario&sec2=operation/users/user_edit&ver=".$event["id_usuario"]."'>".substr ($event["id_usuario"],0,8)."<a href='#' class='tip'> <span>".dame_nombre_real ($event["id_usuario"])."</span></a></a>";
}
// Timestamp
echo "<td class='".$tdclass."f9' title='".$event["timestamp"]."'>";
echo human_time_comparation ($event["timestamp"]);
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
}
echo "</table>";
2008-06-13 Sancho Lerena <slerena@gmail.com> * index.php: Added pure (Fullscreen). HTML code cleanup and user session. * pandoradb.sql: talert_snmp: Added priority field. * pandoradb_data.sql: Changes default values in talerta. tconfig_os, tgrupo and some links. * header.php: Fixed some user session management. * logon_ok.php: New design for welcome screen, odometer is over. * menu.php, godmode/menu.php: Some ACL improvements. * agent_disk_conf_editor.php: Minor fix in view link. * configurar_agente.php, agent_manager.php: Added parent combo and better ACL checks. New remote configuration control for get timestamp info of config file. * modify_alert.php: Changes to use new internal Mail alert. * config.php: Some items moved to config_process. (font, attachment and default style). * functions.php: Added form_agent_combo(), form_event_type_combo(), form_priority() and return_priority() functions. * functions_db.php: Added smal_event_table() to render a variable table with latest events (filtered). * pandora.css. Added pure and priority colors. * estado_alertas.php: Fixed ACL problems. * stado_generalagente.php: Graph of modules now represents modules that has generated events. Old graph is not used anymore. Also display parent. * estado_grupo.php: Border of boxes is now thicker. * tactical.php: New screen, almost all code changed. Odometer is not used anymore, added some new items, like module LAG meter, module sanity, and other general metrics. * ver_agente.php: Now renders also event for each agent view. Alert manual validation generate a new event. * events.php: New event system. 90% new code. A LOT of new features, including full screen, coloured (by priority) and filters by six fields. * snmp_alert.php: Added support for alert priority. * operation/users/user.php: No longer a user with UM privileges could see any other user. * render_view.php: Added fullscreen support for visual maps. * fgraph.php: Added support for session checking in graphs (at least!). New graphics for events (some changed it's function like events by group), and feature added to progress GD implementation. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@860 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-13 18:59:54 +02:00
}
/**
* Get statistical information for a given server
*
* @param id_server
*
* @return : Serverifo array with following keys:
type - Type of server (descriptive)
modules - Modules running on this server
module_lag - Number of modules of time
lag - Lag time in sec
*/
function server_status ($id_server) {
$server = get_db_row_sql ( "SELECT * FROM tserver WHERE id_server = $id_server" );
$serverinfo = array();
if ($server["network_server"] == 1)
$serverinfo["type"] = "network";
elseif ($server["data_server"] == 1)
$serverinfo["type"] = "data";
elseif ($server["plugin_server"] == 1)
$serverinfo["type"] = "plugin";
elseif ($server["wmi_server"] == 1)
$serverinfo["type"] = "wmi";
elseif ($server["recon_server"] == 1)
$serverinfo["type"] = "recon";
elseif ($server["snmp_server"] == 1)
$serverinfo["type"] = "snmp";
elseif ($server["prediction_server"] == 1)
$serverinfo["type"] = "prediction";
// Get type of modules that runs this server
$sql = sprintf ("SELECT DISTINCT(id_modulo)
FROM tagente_estado, tagente_modulo
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente_modulo.disabled = 0
AND tagente_estado.running_by = %d
ORDER BY tagente_modulo.id_agente_modulo",
$id_server);
$moduletype = get_db_all_rows_sql ($sql);
if ($moduletype) {
$serverinfo["modules"] = get_db_sql ("SELECT COUNT(*)
FROM tagente_estado, tagente_modulo
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente_modulo.disabled = 0
AND tagente_estado.running_by = $id_server");
$serverinfo["module_lag"] = get_db_sql ("SELECT COUNT(*)
FROM tagente_estado, tagente_modulo, tagente
WHERE tagente_estado.last_execution_try > 0
AND tagente_estado.running_by = $id_server
AND tagente_modulo.id_agente = tagente.id_agente
AND tagente.disabled = 0
AND tagente_modulo.disabled = 0
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND (UNIX_TIMESTAMP() - tagente_estado.last_execution_try - tagente_estado.current_interval < 1200)");
// Lag over 1200 seconds is not lag, is module without contacting data in several time.or with a
// 1200 sec is 20 min
$serverinfo["lag"] = get_db_sql ("SELECT MAX(tagente_estado.last_execution_try - tagente_estado.current_interval)
FROM tagente_estado, tagente_modulo, tagente
WHERE tagente_estado.last_execution_try > 0
AND tagente_estado.running_by = $id_server
AND tagente_modulo.id_agente = tagente.id_agente
AND tagente.disabled = 0
AND tagente_modulo.disabled = 0
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND (UNIX_TIMESTAMP() - tagente_estado.last_execution_try - tagente_estado.current_interval < 1200)");
if ($serverinfo["lag"] == "")
$serverinfo["lag"] = 0;
else
$serverinfo["lag"] = $serverinfo["lag"] ;
} else {
$serverinfo["modules_total"] = 0;
$serverinfo["modules"] = 0;
$serverinfo["module_lag"] = 0;
$serverinfo["lag"] = 0;
}
$nowtime = time();
if ($serverinfo["lag"] != 0){
$serverinfo["lag"] = $nowtime - $serverinfo["lag"];
}
return $serverinfo;
}
?>