2007-04-19 20:50:07 +02:00
< ? PHP
// Pandora FMS - the Free monitoring system
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development and project architecture and management
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
//
// 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
// 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.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Login check
$id_usuario = $_SESSION [ " id_usuario " ];
global $REMOTE_ADDR ;
if ( comprueba_login () != 0 ) {
audit_db ( $id_usuario , $REMOTE_ADDR , " ACL Violation " , " Trying to access graph builder " );
include ( " general/noaccess.php " );
exit ;
}
2007-06-12 13:57:03 +02:00
// Delete module SQL code
if ( isset ( $_GET [ " delete " ])){
2007-06-12 20:24:59 +02:00
if (( give_acl ( $id_usuario , 0 , " AW " ) == 1 ) OR ( dame_admin ( $id_user ) == 1 )) {
$id = $_GET [ " delete " ];
$sql = " DELETE FROM tgraph_source WHERE id_graph = $id " ;
if ( $res = mysql_query ( $sql ))
$result = " <h3 class=suc> " . $lang_label [ " delete_ok " ] . " </h3> " ;
else
$result = " <h3 class=error> " . $lang_label [ " delete_no " ] . " </h3> " ;
$sql = " DELETE FROM tgraph WHERE id_graph = $id " ;
if ( $res = mysql_query ( $sql ))
$result = " <h3 class=suc> " . $lang_label [ " delete_ok " ] . " </h3> " ;
else
$result = " <h3 class=error> " . $lang_label [ " delete_no " ] . " </h3> " ;
echo $result ;
} else {
audit_db ( $id_usuario , $REMOTE_ADDR , " ACL Violation " , " Trying to delete a graph from access graph builder " );
include ( " general/noaccess.php " );
exit ;
}
2007-06-12 13:57:03 +02:00
}
2007-04-19 20:50:07 +02:00
if ( isset ( $_GET [ " view_graph " ])){
$id_graph = $_GET [ " view_graph " ];
$sql = " SELECT * FROM tgraph WHERE id_graph = $id_graph " ;
$res = mysql_query ( $sql );
if ( $row = mysql_fetch_array ( $res )){
$id_user = $row [ " id_user " ];
$private = $row [ " private " ];
$width = $row [ " width " ];
$height = $row [ " height " ];
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
$period = ( int ) get_parameter ( 'period' );
if ( ! $period )
$period = $row [ " period " ];
else
$period = 3600 * $period ;
2007-04-19 20:50:07 +02:00
$events = $row [ " events " ];
$description = $row [ " description " ];
$name = $row [ " name " ];
if (( $row [ " private " ] == 1 ) && ( $row [ " id_user " ] != $id_user )){
audit_db ( $id_usuario , $REMOTE_ADDR , " ACL Violation " , " Trying to access to a custom graph not allowed " );
include ( " general/noaccess.php " );
exit ;
}
$sql2 = " SELECT * FROM tgraph_source WHERE id_graph = $id_graph " ;
$res2 = mysql_query ( $sql2 );
while ( $row2 = mysql_fetch_array ( $res2 )){
$weight = $row2 [ " weight " ];
$id_agent_module = $row2 [ " id_agent_module " ];
2008-06-23 16:36:22 +02:00
$id_grupo = get_db_sql ( " SELECT id_grupo FROM tagente, tagente_modulo WHERE tagente_modulo.id_agente_modulo = $id_agent_module AND tagente.id_agente = tagente_modulo.id_agente " );
if ( give_acl ( $config [ " id_user " ], $id_grupo , " AR " ) == 1 ){
if ( ! isset ( $modules )){
$modules = $id_agent_module ;
$weights = $weight ;
} else {
$modules = $modules . " , " . $id_agent_module ;
$weights = $weights . " , " . $weight ;
}
2007-04-19 20:50:07 +02:00
}
}
2007-05-27 04:55:55 +02:00
echo " <h2> " . $lang_label [ " reporting " ] . " > " ;
echo $lang_label [ " combined_image " ] . " </h2> " ;
2007-04-19 20:50:07 +02:00
echo " <table class='databox_frame'> " ;
echo " <tr><td> " ;
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
echo " <img src='reporting/fgraph.php?tipo=combined&height= $height &width= $width &id= $modules &period= $period &weight_l= $weights ' border=1 alt=''> " ;
2007-04-19 20:50:07 +02:00
echo " </td></tr></table> " ;
2008-06-17 Esteban Sanchez <estebans@artica.es>
* ajax.php: Added to repository. AJAX interface for Pandora. A new
time is coming...
* pandoradb.sql: Added id_group to treport. A report is now assigned
to a group of agents. Changes in treport_content to add an order
field, drop sla fields and use an enum for the type. NOTE: This will
break all your current defined reports, update under your
responsabillity. Added table treport_content_sla_combined to define
SLAs in the SLA types reports.
* godmode/reporting/graph_builder.php: Use Pandora functions. Adde
javascript code to display the module icon when changing from the
dropdown menu.
* godmode/reporting/reporting_builder.php: Almost complet rewritten to
use Pandora HTML functions. Style correction.
* include/functions.php: Added new report types. Style correction.
* include/functions_db.php: Use Pandora database functions to get
simple values. Added functions get_agents_in_group(),
get_modules_in_agent(), get_simple_alerts_in_agent(),
get_combined_alerts_in_agent(), get_alerts_in_agent(),
get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(),
get_alert_fires_in_period(),
get_alert_last_fire_timestamp_in_period(). Deleted debug output and
fixed calling to an inexistent function in
return_moduledata_sum_value().
* include/functions_html.php: Tab style correction. Thanks to Ramon
for the advice. Fixed some errors on print_table that was causing not
to work fine if rowclass or colspan was defined.
* include/functions_reporting.php: Adde date support to
return_module_SLA(), event_reporting(). Added alert_reporting(),
monitor_health_reporting(), general_group_reporting() and
agents_detailed_reporting() to implement new report types. Style
correction.
* include/javascript/pandora.js: Added html_entity_decode() function
to decode some AJAX results.
* javascript/jquery.js: Added to repository. jQuery version 1.2.4a
* include/javascript/jquery.timeentry.js: jQuery plugin to manage time
inputs.
* include/javascript/jquery.ui.datepicker.js: jQuery plugin to manage
date inputs in a dropdown calendar.
* include/languages/date_*.js, include/languages/time_*.js: Added to
repository. Translation of date and time strings for the new calendar
javascript support.
* include/languages/language_en.php: Added new strings relatives to
reports.
* include/languages/language_de.php,
include/languages/language_fr.php, include/languages/language_gl.php,
include/languages/language_pt_br.php: Fixed a variable name.
* godmode/groups/group_list.php: Avoid the use of an extra indentation
by returning if no success on comprueba_login().
* include/styles/pandora.css: Add some classes. Tab style correction.
* operation/agentes/ver_agente.php: Added AJAX support to agent
operations.
* operation/reporting/graph_viewer.php: Period dropdown selection
improved and printed with Pandora functions.
* operation/reporting/reporting_viewer.php: Massive rewritten.
Implemented date and time support, added new report types, use Pandora
functions...
* reporting/fgraph.php: Documentation fix. Added a new graphic to show
monitors health.
* godmode/agentes/agent_manager.php,
operation/reporting/custom_reporting.php: Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@869 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-17 16:30:44 +02:00
$period_label = human_time_description ( $period );
2007-04-19 20:50:07 +02:00
echo " <form method='POST' action='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph= $id_graph '> " ;
echo " <table class='databox_frame'> " ;
echo " <tr><td class='datos'> " ;
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
echo " <b> " . lang_string ( 'period' ) . " </b> " ;
2007-04-19 20:50:07 +02:00
echo " <td class='datos'> " ;
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
$periods = array ();
$periods [ 1 ] = lang_string ( 'hour' );
$periods [ 2 ] = '2 ' . lang_string ( 'hours' );
$periods [ 3 ] = '3 ' . lang_string ( 'hours' );
$periods [ 6 ] = '6 ' . lang_string ( 'hours' );
$periods [ 12 ] = '12 ' . lang_string ( 'hours' );
$periods [ 24 ] = lang_string ( 'last_day' );
$periods [ 48 ] = lang_string ( 'two_days' );
$periods [ 360 ] = lang_string ( 'last_week' );
$periods [ 720 ] = lang_string ( 'last_month' );
$periods [ 4320 ] = lang_string ( 'six_months' );
print_select ( $periods , 'period' , intval ( $period / 3600 ), '' , '' , 0 );
2007-04-19 20:50:07 +02:00
echo " <td class='datos'> " ;
echo " <input type=submit value=' " . $lang_label [ " update " ] . " ' class='sub upd'> " ;
echo " </table> " ;
echo " </form> " ;
}
}
2007-05-27 04:55:55 +02:00
echo " <h2> " . $lang_label [ " reporting " ] . " > " ;
echo $lang_label [ " custom_graph_viewer " ] . " </h2> " ;
2007-06-12 20:22:12 +02:00
2007-04-19 20:50:07 +02:00
$color = 1 ;
$sql = " SELECT * FROM tgraph " ;
$res = mysql_query ( $sql );
2007-06-22 10:10:56 +02:00
if ( mysql_num_rows ( $res )) {
echo " <table width='500' cellpadding=4 cellpadding=4 class='databox_frame'> " ;
echo " <tr>
< th > " . $lang_label["graph_name"] . " </ th >
< th > " . $lang_label["description"] . " </ th >
< th > " . $lang_label["view"] . " </ th > " ;
if (( give_acl ( $id_usuario , 0 , " AW " ) == 1 ) OR ( dame_admin ( $id_usuario ) == 1 ))
echo " <th> " . $lang_label [ " delete " ] . " </th> " ;
echo " </tr> " ;
while ( $row = mysql_fetch_array ( $res )){
if (( $row [ " private " ] == 0 ) || ( $row [ " id_user " ] == $id_user )){
// Calculate table line color
if ( $color == 1 ){
$tdcolor = " datos " ;
$color = 0 ;
}
else {
$tdcolor = " datos2 " ;
$color = 1 ;
}
echo " <tr> " ;
echo " <td valign='top' class=' $tdcolor '> " . $row [ " name " ] . " </td> " ;
echo " <td class=' $tdcolor '> " . $row [ " description " ] . " </td> " ;
$id_graph = $row [ " id_graph " ];
echo " <td valign='middle' class=' $tdcolor ' align='center'><a href='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph= $id_graph '><img src='images/images.png'></a> " ;
if (( give_acl ( $id_usuario , 0 , " AW " ) == 1 ) OR ( dame_admin ( $id_usuario ) == 1 )) {
echo " <td class=' $tdcolor ' align='center'><a href='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&delete= $id_graph ' " . 'onClick="if (!confirm(\' ' . $lang_label [ " are_you_sure " ] . '\')) return false;">' ;
echo " <img src='images/cross.png'></a></td> " ;
}
2007-06-12 20:22:12 +02:00
}
2007-04-19 20:50:07 +02:00
}
2007-06-22 10:10:56 +02:00
echo " </table> " ;
} else {
echo " <div class='nf'> " . $lang_label [ " no_reporting_def " ] . " </div> " ;
2007-04-19 20:50:07 +02:00
}
?>