2009-03-31 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/module_manager_editor_plugin.php: Added plugin components select. Fixes #2707900. * godmode/alerts/alert_list.php: Fixed an error when showing agents list. * include/functions_events.php: Added get_similar_events_ids() to get events which are similars (same description and agent module). Renamed process_event_delete() and process_event_validate(). Added similars flag to both delete_event() an validate_event(). * include/functions_reporting.php: Added timestamp parameter to select statements to fix #2707841. * include/functions_ui.php: Added a class to pagination divs. * operation/agentes/estado_generalagente.php: Style correction. Removed period on agent access graph. * operation/agentes/exportdata.php: Fixed many notices by including config.php instead of using global. Style corrections. * operation/events/events.php: When the events were grouped and deleted or validated, only one was being updated. Added AJAX support to validate and delete single operations. Style corrections. Fixed #2707872 * reporting/fgraph.php: Many fixes on agent access graph. Fixes #2707856 * reporting/pandora_graph.php: Added a couple of properties to the class. * reporting/pchart_graph.php: Do not add the grid or axis labels on charts if asked. Show no progress bar if value is 0 and a title is shown. Style corrections. * include/styles/pandora_width.css: Renamed to panoramic theme. Added style for event_control element. * include/styles/pandora.css: Added style for event_control element. * godmode/modules/manage_network_components.php: Fixed table width for panoramic theme. * ajax.php: Added remote_addr to config array. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1582 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
ca463b4868
commit
4e90c86b1e
|
@ -1,3 +1,52 @@
|
|||
2009-03-31 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* godmode/agentes/module_manager_editor_plugin.php: Added plugin
|
||||
components select. Fixes #2707900.
|
||||
|
||||
* godmode/alerts/alert_list.php: Fixed an error when showing agents
|
||||
list.
|
||||
|
||||
* include/functions_events.php: Added get_similar_events_ids() to get
|
||||
events which are similars (same description and agent module). Renamed
|
||||
process_event_delete() and process_event_validate(). Added
|
||||
similars flag to both delete_event() an validate_event().
|
||||
|
||||
* include/functions_reporting.php: Added timestamp parameter to select
|
||||
statements to fix #2707841.
|
||||
|
||||
* include/functions_ui.php: Added a class to pagination divs.
|
||||
|
||||
* operation/agentes/estado_generalagente.php: Style correction.
|
||||
Removed period on agent access graph.
|
||||
|
||||
* operation/agentes/exportdata.php: Fixed many notices by including
|
||||
config.php instead of using global. Style corrections.
|
||||
|
||||
* operation/events/events.php: When the events were grouped and
|
||||
deleted or validated, only one was being updated. Added AJAX support
|
||||
to validate and delete single operations. Style corrections. Fixed
|
||||
#2707872
|
||||
|
||||
* reporting/fgraph.php: Many fixes on agent access graph. Fixes
|
||||
#2707856
|
||||
|
||||
* reporting/pandora_graph.php: Added a couple of properties to the
|
||||
class.
|
||||
|
||||
* reporting/pchart_graph.php: Do not add the grid or axis labels on
|
||||
charts if asked. Show no progress bar if value is 0 and a title is
|
||||
shown. Style corrections.
|
||||
|
||||
* include/styles/pandora_width.css: Renamed to panoramic theme. Added
|
||||
style for event_control element.
|
||||
|
||||
* include/styles/pandora.css: Added style for event_control element.
|
||||
|
||||
* godmode/modules/manage_network_components.php: Fixed table width for
|
||||
panoramic theme.
|
||||
|
||||
* ajax.php: Added remote_addr to config array.
|
||||
|
||||
2009-03-31 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* include/functions_visual_map.php,
|
||||
|
@ -44,15 +93,34 @@
|
|||
* godmode/setup/setup_visuals.php: New setup section for visual options.
|
||||
|
||||
* images/mod_web_proc.png,
|
||||
images/screenshot_not_found.jpg
|
||||
images/mod_web_data.png
|
||||
images/server_web.png: New icons added for enterprise options.
|
||||
|
||||
images/screenshot_not_found.jpg,
|
||||
images/mod_web_data.png,
|
||||
images/server_web.png: New icons added for enterprise options.
|
||||
|
||||
2009-03-31 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* operation/events/events.php: Fixed and allow to everybody to see
|
||||
events coming from group 0 (Old server code put events here).
|
||||
|
||||
2009-03-30 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* include/functions_ui.php: Added print_message(),
|
||||
print_error_message() and print_success_message().
|
||||
|
||||
* godmode/users/configure_user.php,
|
||||
operation/users/user_edit.php,
|
||||
godmode/reporting/map_builder_wizard.php: Use print_error_message() or
|
||||
print_success_message() when there was no other option.
|
||||
|
||||
* godmode/modules/manage_network_templates.php: Fixed CSV export
|
||||
notice errors. Style corrections.
|
||||
|
||||
* godmode/modules/manage_network_templates_form.php: Style
|
||||
corrections.
|
||||
|
||||
* include/functions_network_profiles.php: Added to repository. Network
|
||||
profiles function API.
|
||||
|
||||
2009-03-27 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||
|
||||
* include/functions_db.php: Fixed group functions that would return
|
||||
|
|
|
@ -38,6 +38,8 @@ check_login ();
|
|||
|
||||
define ('AJAX', true);
|
||||
|
||||
$config["remote_addr"] = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
$page = (string) get_parameter ('page');
|
||||
$page = safe_url_extraclean ($page);
|
||||
$page .= '.php';
|
||||
|
|
|
@ -25,6 +25,15 @@ if (!isset ($id_agente)) {
|
|||
|
||||
$extra_title = __('Plugin server module');
|
||||
|
||||
define ('ID_NETWORK_COMPONENT_TYPE', 4);
|
||||
|
||||
if (empty ($update_module_id)) {
|
||||
/* Function in module_manager_editor_common.php */
|
||||
add_component_selection (ID_NETWORK_COMPONENT_TYPE);
|
||||
} else {
|
||||
/* TODO: Print network component if available */
|
||||
}
|
||||
|
||||
$data = array ();
|
||||
$data[0] = __('Plugin');
|
||||
$data[1] = print_select_from_sql ('SELECT id, name FROM tplugin ORDER BY name',
|
||||
|
|
|
@ -332,7 +332,7 @@ if (! $id_agente) {
|
|||
false, '', '', true);
|
||||
|
||||
$table->data['agent'][0] = __('Agent');
|
||||
$table->data['agent'][1] = print_select (get_group_agents ($groups, false, "none"),
|
||||
$table->data['agent'][1] = print_select (array_keys (get_group_agents ($groups, false, "none")),
|
||||
'id_agent', 0, false, __('Select'), 0, true);
|
||||
$table->data['agent'][1] .= ' <span id="agent_loading" class="invisible">';
|
||||
$table->data['agent'][1] .= '<img src="images/spinner.gif" />';
|
||||
|
|
|
@ -177,7 +177,7 @@ if ($ncgroup != 0) {
|
|||
|
||||
$result = mysql_query ($sql1);
|
||||
if ( $row = mysql_num_rows ($result)){
|
||||
echo '<table width="750" cellpadding="4" cellspacing="4" class="databox">';
|
||||
echo '<table width="90%" cellpadding="4" cellspacing="4" class="databox">';
|
||||
echo '<tr>';
|
||||
echo "<th>".__('Module name')."</th>";
|
||||
echo "<th>".__('Type')."</th>";
|
||||
|
|
|
@ -26,25 +26,67 @@ function get_event ($id, $fields = false) {
|
|||
return false;
|
||||
global $config;
|
||||
|
||||
if (is_array ($fields)) {
|
||||
if (! in_array ('id_grupo', $fields))
|
||||
$fields[] = 'id_grupo';
|
||||
}
|
||||
|
||||
$event = get_db_row ('tevento', 'id_evento', $id, $fields);
|
||||
if (! give_acl ($config['id_user'], $event['id_grupo'], 'IR'))
|
||||
return false;
|
||||
return $event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the events ids similar to a given event id.
|
||||
*
|
||||
* An event is similar then the event text (evento) and the id_agentmodule are
|
||||
* the same.
|
||||
*
|
||||
* @param int Event id to get similar events.
|
||||
*
|
||||
* @return array A list of events ids.
|
||||
*/
|
||||
function get_similar_events_ids ($id) {
|
||||
$ids = array ();
|
||||
$event = get_event ($id, array ('evento', 'id_agentmodule'));
|
||||
if ($event === false)
|
||||
return $ids;
|
||||
|
||||
$events = get_db_all_rows_filter ('tevento',
|
||||
array ('evento' => $event['evento'],
|
||||
'id_agentmodule' => $event['id_agentmodule']),
|
||||
array ('id_evento'));
|
||||
if ($events === false)
|
||||
return $ids;
|
||||
|
||||
foreach ($events as $event)
|
||||
$ids[] = $event['id_evento'];
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete events in a transaction
|
||||
*
|
||||
* @param mixed $id_event Event ID or array of events
|
||||
* @param mixed Event ID or array of events
|
||||
* @param bool Whether to delete similar events too.
|
||||
*
|
||||
* @return bool Whether or not it was successful
|
||||
*/
|
||||
function delete_event ($id_event) {
|
||||
function delete_event ($id_event, $similar = true) {
|
||||
global $config;
|
||||
|
||||
//Cleans up the selection for all unwanted values also casts any single values as an array
|
||||
$id_event = (array) safe_int ($id_event, 1);
|
||||
|
||||
/* We must delete all events like the selected */
|
||||
if ($similar) {
|
||||
foreach ($id_event as $id) {
|
||||
$id_event = array_merge ($id_event, get_similar_events_ids ($id));
|
||||
}
|
||||
}
|
||||
|
||||
process_sql ("SET AUTOCOMMIT = 0;");
|
||||
process_sql ("START TRANSACTION;");
|
||||
$errors = 0;
|
||||
|
@ -81,16 +123,24 @@ function delete_event ($id_event) {
|
|||
/**
|
||||
* Validate events in a transaction
|
||||
*
|
||||
* @param mixed $id_event Event ID or array of events
|
||||
* @param mixed Event ID or array of events
|
||||
* @param bool Whether to validate similar events or not.
|
||||
*
|
||||
* @return bool Whether or not it was successful
|
||||
*/
|
||||
function process_event_validate ($id_event) {
|
||||
function validate_event ($id_event, $similars = true) {
|
||||
global $config;
|
||||
|
||||
//Cleans up the selection for all unwanted values also casts any single values as an array
|
||||
$id_event = (array) safe_int ($id_event, 1);
|
||||
|
||||
/* We must validate all events like the selected */
|
||||
if ($similars) {
|
||||
foreach ($id_event as $id) {
|
||||
$id_event = array_merge ($id_event, get_similar_events_ids ($id));
|
||||
}
|
||||
}
|
||||
|
||||
process_sql ("SET AUTOCOMMIT = 0;");
|
||||
process_sql ("START TRANSACTION;");
|
||||
$errors = 0;
|
||||
|
|
|
@ -129,16 +129,16 @@ function get_group_stats ($id_group = 0) {
|
|||
|
||||
$data["monitor_checks"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter);
|
||||
$data["monitor_not_init"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND utimestamp = 0");
|
||||
$data["monitor_unknown"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND UNIX_TIMESTAMP() - utimestamp >= current_interval * 2");
|
||||
$data["monitor_critical"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND estado = 1 AND UNIX_TIMESTAMP() - utimestamp < current_interval * 2");
|
||||
$data["monitor_warning"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND estado = 2 AND UNIX_TIMESTAMP() - utimestamp < current_interval * 2");
|
||||
$data["monitor_unknown"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND utimestamp > 0 AND UNIX_TIMESTAMP() - utimestamp >= current_interval * 2");
|
||||
$data["monitor_critical"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND utimestamp > 0 AND estado = 1 AND UNIX_TIMESTAMP() - utimestamp < current_interval * 2");
|
||||
$data["monitor_warning"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND utimestamp > 0 AND estado = 2 AND UNIX_TIMESTAMP() - utimestamp < current_interval * 2");
|
||||
$data["monitor_ok"] = $data["monitor_checks"] - $data["monitor_not_init"] - $data["monitor_unknown"] - $data["monitor_critical"] - $data["monitor_warning"];
|
||||
|
||||
$sql = sprintf ("SELECT times_fired FROM talert_template_modules WHERE id_agent_module IN (%s)", implode (",", array_keys ($agents)));
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
|
||||
$result = get_db_all_rows_filter ('talert_template_modules',
|
||||
array ('id_agent_module' => array_keys ($agents)),
|
||||
array ('times_fired'));
|
||||
if (empty ($result)) {
|
||||
$result = array (); //It's possible there are no alerts so we don't return
|
||||
$result = array ();
|
||||
}
|
||||
|
||||
foreach ($result as $row) {
|
||||
|
|
|
@ -812,7 +812,7 @@ function pagination ($count, $url, $offset = 0, $pagination = 0, $return = false
|
|||
else
|
||||
$inicio_pag = 0;
|
||||
|
||||
$output = '<div>';
|
||||
$output = '<div class="pagination">';
|
||||
// Show GOTO FIRST button
|
||||
$output .= '<a class="pagination go_first" href="'.$url.'&offset=0">'.print_image ("images/control_start_blue.png", true, array ("class" => "bot")).'</a> ';
|
||||
// Show PREVIOUS button
|
||||
|
|
|
@ -913,3 +913,6 @@ a.add_action {
|
|||
div#steps_clean {
|
||||
clear:both;
|
||||
}
|
||||
div#event_control {
|
||||
clear:right;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
|
||||
Author: The Pandora FMS team
|
||||
Name: Variable width
|
||||
Name: Panoramic theme
|
||||
Description: A theme with a variable width layout
|
||||
|
||||
// Pandora FMS - the Free monitoring system
|
||||
|
@ -60,3 +60,7 @@ div#steps_clean {
|
|||
div#menu_tab_frame {
|
||||
width: 100%;
|
||||
}
|
||||
div#events_list {
|
||||
float: left;
|
||||
width: 100%;
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
|
||||
// Load global vars
|
||||
require_once ("include/config.php");
|
||||
check_login ();
|
||||
|
@ -31,11 +29,11 @@ if ($agent === false) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (give_acl ($config["id_user"], $agent["id_grupo"], "AR") == 0) {
|
||||
if (! give_acl ($config["id_user"], $agent["id_grupo"], "AR")) {
|
||||
audit_db ($config["id_user"], $REMOTE_ADDR, "ACL Violation",
|
||||
"Trying to access Agent General Information");
|
||||
require_once ("general/noaccess.php");
|
||||
exit;
|
||||
return;
|
||||
}
|
||||
|
||||
echo "<h2>".__('Pandora Agents')." > ".__('Agent general information')."</h2>";
|
||||
|
@ -46,7 +44,7 @@ echo '<div style="height: 10px"> </div>';
|
|||
//Floating div
|
||||
echo '<div style="float:right; width:320px; padding-top:11px;">';
|
||||
echo '<b>'.__('Agent access rate (24h)').'</b><br />';
|
||||
echo '<img border="1" src="reporting/fgraph.php?id='.$id_agente.'&tipo=agentaccess&periodo=1440&height=90&width=290" />';
|
||||
echo '<img border="1" src="reporting/fgraph.php?id='.$id_agente.'&tipo=agentaccess&height=90&width=290" />';
|
||||
echo '<div style="height:25px"> </div>';
|
||||
echo '<b>'.__('Events generated -by module-').'</b><br />';
|
||||
echo '<img border="1" src="reporting/fgraph.php?tipo=event_module&width=290&height=180&id_agent='.$id_agente.'" />';
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// For code belongs to average_per_hourday matrix report code
|
||||
|
||||
// Load global vars
|
||||
require("include/config.php");
|
||||
require_once ("include/config.php");
|
||||
|
||||
check_login();
|
||||
|
||||
|
@ -30,9 +30,9 @@ if (! give_acl ($config['id_user'], 0, "AR") && ! give_acl ($config['id_user'],
|
|||
}
|
||||
|
||||
function give_average_from_module ($id_agente, $id_agente_modulo, $hour, $day, $start_date, $end_date){
|
||||
// Return average value from an agentmodule, for a specific hour of specific day of week,
|
||||
// Only valid for non-string kind of data.
|
||||
require ("include/config.php");
|
||||
// Return average value from an agentmodule, for a specific hour of specific day of week,
|
||||
// Only valid for non-string kind of data.
|
||||
global $config;
|
||||
|
||||
// Convert to unix date
|
||||
$start_date = date("U", $start_date);
|
||||
|
@ -54,20 +54,20 @@ function give_average_from_module ($id_agente, $id_agente_modulo, $hour, $day, $
|
|||
|
||||
function generate_average_table ($id_de_mi_agente, $id_agente_modulo, $fecha_inicio, $fecha_fin){
|
||||
// Genera una tabla con los promedios de los datos de un módulo no-string
|
||||
require ("include/config.php");
|
||||
global $config;
|
||||
|
||||
$dias_de_la_semana = array (__('Sunday'),__('Monday'), __('Tuesday'), __('Wednesday'), __('Thurdsday'), __('Friday'), __('Saturday'));
|
||||
$nombre_modulo = get_agentmodule_name ($id_agente_modulo);
|
||||
|
||||
// Table header
|
||||
echo "<table border=0 cellpadding=4 cellspacing=4 width=600 class='databox'>";
|
||||
echo "<table border=0 cellpadding=4 cellspacing=4 width='90%' class='databox'>";
|
||||
echo "<tr>
|
||||
<th rowspan='2'>".__('One hour')."</th>";
|
||||
<th style='width: 5%' rowspan='2'></th>";
|
||||
echo "<th colspan='7'>".__('day')."</th>
|
||||
</tr>";
|
||||
echo "<tr>";
|
||||
for ($dia=0;$dia<7;++$dia)
|
||||
echo "<th>".$dias_de_la_semana[$dia]."</th>";
|
||||
echo "<th style='width: 14%'>".$dias_de_la_semana[$dia]."</th>";
|
||||
echo "</tr>";
|
||||
$color = 0;
|
||||
for ($hora=0;$hora<24;++$hora){
|
||||
|
@ -196,6 +196,8 @@ if ((isset($_POST["export"])) AND (! isset($_POST["update_agent"]))){
|
|||
else
|
||||
$sql1 = 'SELECT * FROM tagente_datos WHERE utimestamp > '.$from_date.' AND utimestamp < '.$to_date.' AND id_agente_modulo ='.$id_modulo.' ORDER BY utimestamp DESC';
|
||||
$result1 = get_db_all_rows_sql ($sql1);
|
||||
if ($result1 === false)
|
||||
$result1 = array ();
|
||||
$color=1;
|
||||
foreach ($result1 as $row){
|
||||
if ($color == 1){
|
||||
|
|
|
@ -31,6 +31,8 @@ if (! give_acl ($config["id_user"], 0, "IR")) {
|
|||
|
||||
if (is_ajax ()) {
|
||||
$get_event_tooltip = (bool) get_parameter ('get_event_tooltip');
|
||||
$validate_event = (bool) get_parameter ('validate_event');
|
||||
$delete_event = (bool) get_parameter ('delete_event');
|
||||
|
||||
if ($get_event_tooltip) {
|
||||
$id = (int) get_parameter ('id');
|
||||
|
@ -62,15 +64,57 @@ if (is_ajax ()) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($validate_event) {
|
||||
$id = (int) get_parameter ("id");
|
||||
$similars = (bool) get_parameter ('similars');
|
||||
|
||||
$return = validate_event ($id, $similars);
|
||||
if ($return)
|
||||
echo 'ok';
|
||||
else
|
||||
echo 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
if ($delete_event) {
|
||||
$id = (array) get_parameter ("id");
|
||||
$similars = (bool) get_parameter ('similars');
|
||||
|
||||
$return = delete_event ($id, $similars);
|
||||
if ($return)
|
||||
echo 'ok';
|
||||
else
|
||||
echo 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$offset = (int) get_parameter ("offset", 0);
|
||||
$ev_group = (int) get_parameter ("ev_group", 1); //1 = all
|
||||
$search = preg_replace ("/&([A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "%", rawurldecode (get_parameter ("search")));
|
||||
$event_type = get_parameter ("event_type", ''); // 0 all
|
||||
$severity = (int) get_parameter ("severity", -1); // -1 all
|
||||
$status = (int) get_parameter ("status", 0); // -1 all, 0 only red, 1 only green
|
||||
$id_agent = (int) get_parameter ("id_agent", -1); //-1 all, 0 system
|
||||
$id_event = (int) get_parameter ("id_event", -1);
|
||||
$pagination = (int) get_parameter ("pagination", $config["block_size"]);
|
||||
$groups = get_user_groups ($config["id_user"], "AR");
|
||||
$event_view_hr = (int) get_parameter ("event_view_hr", $config["event_view_hr"]);
|
||||
$id_user_ack = get_parameter ("id_user_ack", 0);
|
||||
$group_rep = (int) get_parameter ("group_rep", 1);
|
||||
/* Show always the system events */
|
||||
$groups[0] = __('System');
|
||||
|
||||
$delete = (bool) get_parameter ("delete");
|
||||
$validate = (bool) get_parameter ("validate");
|
||||
|
||||
//Process deletion (pass array or single value)
|
||||
if ($delete) {
|
||||
$eventid = (array) get_parameter ("eventid", -1);
|
||||
$return = delete_event ($eventid); //This function handles both single values as well arrays and cleans up before deleting
|
||||
$ids = (array) get_parameter ("eventid", -1);
|
||||
|
||||
$return = delete_event ($ids, ($group_rep == 1));
|
||||
print_result_message ($return,
|
||||
__('Successfully deleted'),
|
||||
__('Could not be deleted'));
|
||||
|
@ -78,41 +122,14 @@ if ($delete) {
|
|||
|
||||
//Process validation (pass array or single value)
|
||||
if ($validate) {
|
||||
$eventid = (array) get_parameter ("eventid", -1);
|
||||
$return = process_event_validate ($eventid);
|
||||
$ids = (array) get_parameter ("eventid", -1);
|
||||
|
||||
$return = validate_event ($ids, ($group_rep == 1));
|
||||
print_result_message ($return,
|
||||
__('Successfully validated'),
|
||||
__('Could not be validated'));
|
||||
}
|
||||
|
||||
|
||||
// ***********************************************************************
|
||||
// Main code form / page
|
||||
// ***********************************************************************
|
||||
|
||||
$offset = (int) get_parameter ("offset", 0);
|
||||
$ev_group = (int) get_parameter ("ev_group", 1); //1 = all
|
||||
$search = preg_replace ("/&([A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "%", rawurldecode (get_parameter ("search"))); //Replace all types of &# HTML with % so that it doesn't fail on quotes
|
||||
|
||||
$event_type = get_parameter ("event_type", ''); // 0 all
|
||||
$severity = (int) get_parameter ("severity", -1); // -1 all
|
||||
$status = (int) get_parameter ("status", 0); // -1 all, 0 only red, 1 only green
|
||||
$id_agent = (int) get_parameter ("id_agent", -1); //-1 all, 0 system
|
||||
$id_event = (int) get_parameter ("id_event", -1);
|
||||
$pagination = (int) get_parameter ("pagination", $config["block_size"]);
|
||||
|
||||
// Access rights are about agent data, not incidents !
|
||||
$groups = get_user_groups ($config["id_user"], "AR");
|
||||
|
||||
// Add group "0".
|
||||
$groups[0]="System";
|
||||
|
||||
$groups[0]="System";
|
||||
|
||||
$event_view_hr = (int) get_parameter ("event_view_hr", $config["event_view_hr"]);
|
||||
$id_user_ack = get_parameter ("id_user_ack", 0);
|
||||
$group_rep = (int) get_parameter ("group_rep", 1);
|
||||
|
||||
//Group selection
|
||||
if ($ev_group > 1 && in_array ($ev_group, array_keys ($groups))) {
|
||||
//If a group is selected and it's in the groups allowed
|
||||
|
@ -150,9 +167,10 @@ if ($event_view_hr > 0) {
|
|||
$sql_post .= " AND utimestamp > ".$unixtime;
|
||||
}
|
||||
|
||||
|
||||
$url = "index.php?sec=eventos&sec2=operation/events/events&search=".rawurlencode($search)."&event_type=".$event_type."&severity=".$severity."&status=".$status."&ev_group=".$ev_group."&refr=".$config["refr"]."&id_agent=".$id_agent."&id_event=".$id_event."&pagination=".$pagination."&group_rep=".$group_rep."&event_view_hr=".$event_view_hr."&id_user_ack=".$id_user_ack;
|
||||
|
||||
echo '<h3 id="result" style="display:none"> </h3>';
|
||||
|
||||
echo "<h2>".__('Events')." > ".__('Main event view'). " ";
|
||||
|
||||
if ($config["pure"] == 1) {
|
||||
|
@ -292,7 +310,9 @@ echo '</a>';
|
|||
echo "</td></tr></table></form>"; //This is the filter div
|
||||
echo '<div style="width:220px; float:left;">';
|
||||
print_image ("reporting/fgraph.php?tipo=group_events&width=220&height=180&url=".rawurlencode ($sql_post), false, array ("border" => 0));
|
||||
echo '</div><div style="clear:both"> </div></div>';
|
||||
echo '</div>';
|
||||
echo '<div id="steps_clean"> </div>';
|
||||
echo '</div>';
|
||||
|
||||
if ($group_rep == 0) {
|
||||
$sql = "SELECT * FROM tevento WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination;
|
||||
|
@ -314,17 +334,7 @@ if (empty ($result)) {
|
|||
$result = array ();
|
||||
}
|
||||
|
||||
// Show pagination header
|
||||
$offset = get_parameter ("offset", 0);
|
||||
pagination ($total_events, $url."&pure=".$config["pure"], $offset, $pagination);
|
||||
|
||||
// If pure, table width takes more space
|
||||
if ($config["pure"] != 0) {
|
||||
$table->width = 765;
|
||||
} else {
|
||||
$table->width = 750;
|
||||
}
|
||||
|
||||
$table->width = '99%';
|
||||
$table->id = "eventtable";
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
|
@ -374,11 +384,17 @@ foreach ($result as $event) {
|
|||
$table->rowclass[] = get_priority_class ($event["criticity"]);
|
||||
|
||||
// Colored box
|
||||
|
||||
if ($event["estado"] == 0) {
|
||||
$data[0] = print_image ("images/pixel_red.png", true, array ("width" => 20, "height" => 20, "title" => get_priority_name ($event["criticity"])));
|
||||
$img = "images/pixel_red.png";
|
||||
} else {
|
||||
$data[0] = print_image ("images/pixel_green.png", true, array ("width" => 20, "height" => 20, "title" => get_priority_name ($event["criticity"])));
|
||||
$img = "images/pixel_green.png";
|
||||
}
|
||||
$data[0] = print_image ($img, true,
|
||||
array ("class" => "image_status",
|
||||
"width" => 20,
|
||||
"height" => 20,
|
||||
"title" => get_priority_name ($event["criticity"])));
|
||||
|
||||
$data[1] = print_event_type_img ($event["event_type"], true);
|
||||
|
||||
|
@ -404,12 +420,14 @@ foreach ($result as $event) {
|
|||
$data[4] = '';
|
||||
if ($event["id_agentmodule"] != 0) {
|
||||
$data[4] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event["id_agente"].'&tab=data">';
|
||||
$data[4] .= print_image ("images/bricks.png", true, array ("border" => 0, "title" => __('Go to data overview')));
|
||||
$data[4] .= print_image ("images/bricks.png", true,
|
||||
array ("title" => __('Go to data overview')));
|
||||
$data[4] .= '</a> ';
|
||||
}
|
||||
if ($event["id_alert_am"] != 0) {
|
||||
$data[4] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event["id_agente"].'&tab=alert">';
|
||||
$data[4] .= print_image ("images/bell.png", true, array ("border" => 0, "title" => __('Go to alert overview')));
|
||||
$data[4] .= print_image ("images/bell.png", true,
|
||||
array ("title" => __('Go to alert overview')));
|
||||
$data[4] .= '</a>';
|
||||
}
|
||||
|
||||
|
@ -429,8 +447,7 @@ foreach ($result as $event) {
|
|||
}
|
||||
}
|
||||
|
||||
//Time
|
||||
|
||||
//Time
|
||||
if ($group_rep == 1) {
|
||||
$data[7] = print_timestamp ($event['timestamp_rep'], true);
|
||||
} else {
|
||||
|
@ -441,20 +458,23 @@ foreach ($result as $event) {
|
|||
$data[8] = '';
|
||||
// Validate event
|
||||
if (($event["estado"] == 0) and (give_acl ($config["id_user"], $event["id_grupo"], "IW") == 1)) {
|
||||
$data[8] .= '<a href="'.$url.'&validate=1&eventid='.$event["id_evento"].'&pure='.$config["pure"].'">';
|
||||
$data[8] .= print_image ("images/ok.png", true, array ("border" => 0, "title" => __('Validate event')));
|
||||
$data[8] .= '<a class="validate_event" href="#" onclick="return false" id="delete-'.$event["id_evento"].'">';
|
||||
$data[8] .= print_image ("images/ok.png", true,
|
||||
array ("title" => __('Validate event')));
|
||||
$data[8] .= '</a>';
|
||||
}
|
||||
// Delete event
|
||||
if (give_acl ($config["id_user"], $event["id_grupo"], "IM") == 1) {
|
||||
$data[8] .= '<a href="'.$url.'&delete=1&eventid='.$event["id_evento"].'&pure='.$config["pure"].'">';
|
||||
$data[8] .= print_image ("images/cross.png", true, array ("border" => 0, "title" => __('Delete event')));
|
||||
$data[8] .= '<a class="delete_event" href="#" onclick="return false" id="validate-'.$event['id_evento'].'">';
|
||||
$data[8] .= print_image ("images/cross.png", true,
|
||||
array ("title" => __('Delete event')));
|
||||
$data[8] .= '</a>';
|
||||
}
|
||||
// Create incident from this event
|
||||
// Create incident from this event
|
||||
if (give_acl ($config["id_user"], $event["id_grupo"], "IW") == 1) {
|
||||
$data[8] .= '<a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&insert_form&from_event='.$event["id_evento"].'">';
|
||||
$data[8] .= print_image ("images/page_lightning.png", true, array ("border" => 0, "title" => __('Create incident from event')));
|
||||
$data[8] .= print_image ("images/page_lightning.png", true,
|
||||
array ("title" => __('Create incident from event')));
|
||||
$data[8] .= '</a>';
|
||||
}
|
||||
|
||||
|
@ -464,12 +484,14 @@ foreach ($result as $event) {
|
|||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
echo '<div id="events_list">';
|
||||
if (!empty ($table->data)) {
|
||||
pagination ($total_events, $url."&pure=".$config["pure"], $offset, $pagination);
|
||||
echo '<form method="post" action="'.$url.'&pure='.$config["pure"].'">';
|
||||
|
||||
print_table ($table);
|
||||
|
||||
echo '<div style="width:750px; text-align:right">';
|
||||
echo '<div style="width:'.$table->width.';" class="action-buttons">';
|
||||
if (give_acl ($config["id_user"], 0, "IW") == 1) {
|
||||
print_submit_button (__('Validate'), 'validate', false, 'class="sub ok"');
|
||||
}
|
||||
|
@ -477,47 +499,104 @@ if (!empty ($table->data)) {
|
|||
print_submit_button (__('Delete'), 'delete', false, 'class="sub delete"');
|
||||
}
|
||||
echo '</div></form>';
|
||||
|
||||
if ($config["pure"]== 0) {
|
||||
//Print legend
|
||||
echo '<div style="padding-left:30px; width:150px; float:left; line-height:17px;">';
|
||||
echo '<h3>'.__('Status').'</h3>';
|
||||
print_image ("images/pixel_green.png", false, array ("width" => 10, "height" => 10, "title" => __('Validated event')));
|
||||
print_image ("images/pixel_green.png", false,
|
||||
array ("width" => 10,
|
||||
"height" => 10,
|
||||
"title" => __('Validated event')));
|
||||
echo ' - '.__('Validated event');
|
||||
echo '<br />';
|
||||
print_image ("images/pixel_red.png", false, array ("width" => 10, "height" => 10, "title" => __('Event not validated')));
|
||||
print_image ("images/pixel_red.png", false,
|
||||
array ("width" => 10,
|
||||
"height" => 10,
|
||||
"title" => __('Event not validated')));
|
||||
echo ' - '.__('Event not validated');
|
||||
echo '</div><div style="padding-left:30px; width:150px; float:left; line-height:17px;">';
|
||||
echo '<h3>'.__('Actions').'</h3>';
|
||||
print_image ("images/ok.png", false, array ("title" => __('Validate event')));
|
||||
print_image ("images/ok.png", false,
|
||||
array ("title" => __('Validate event')));
|
||||
echo ' - '.__('Validate event');
|
||||
echo '<br />';
|
||||
print_image ("images/cross.png", false, array ("title" => __('Delete event')));
|
||||
print_image ("images/cross.png", false,
|
||||
array ("title" => __('Delete event')));
|
||||
echo ' - '.__('Delete event');
|
||||
echo '<br />';
|
||||
print_image ("images/page_lightning.png", false, array ("title" => __('Create incident from event')));
|
||||
print_image ("images/page_lightning.png", false,
|
||||
array ("title" => __('Create incident from event')));
|
||||
echo ' - '.__('Create incident from event');
|
||||
echo '</div><div style="clear:both;"> </div>';
|
||||
}
|
||||
} else {
|
||||
echo '<div class="nf">'.__('No events').'</div>';
|
||||
echo '<div class="nf">'.__('No events').'</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
unset ($table);
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready( function() {
|
||||
$("INPUT[name='allbox']").click( function() {
|
||||
$("INPUT[name='eventid[]']").each( function() {
|
||||
$(this).attr('checked', !$(this).attr('checked'));
|
||||
});
|
||||
return !(this).attr('checked');
|
||||
});
|
||||
|
||||
$("#tgl_event_control").click( function () {
|
||||
$("#event_control").toggle ();
|
||||
return false;
|
||||
});
|
||||
/* <![CDATA[ */
|
||||
$(document).ready( function() {
|
||||
$("input[name=allbox]").change (function() {
|
||||
$("input[name='eventid[]']").attr('checked', $(this).attr('checked'));
|
||||
});
|
||||
/* ]]> */
|
||||
|
||||
$("#tgl_event_control").click (function () {
|
||||
$("#event_control").toggle ();
|
||||
return false;
|
||||
});
|
||||
|
||||
$("a.validate_event").click (function () {
|
||||
$tr = $(this).parents ("tr");
|
||||
id = this.id.split ("-").pop ();
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/events/events",
|
||||
"validate_event" : 1,
|
||||
"id" : id,
|
||||
"similar" : <?php echo ($group_rep ? 1 : 0) ?>
|
||||
},
|
||||
function (data, status) {
|
||||
if (data == "ok") {
|
||||
<?php if ($status == 0) : ?>
|
||||
$tr.remove ();
|
||||
<?php else: ?>
|
||||
$("img.image_status", $tr).attr ("src", "images/pixel_green.png");
|
||||
<?php endif; ?>
|
||||
} else {
|
||||
$("#result")
|
||||
.showMessage ("<?php echo __('Could not be validated')?>")
|
||||
.addClass ("error");
|
||||
}
|
||||
},
|
||||
"html"
|
||||
);
|
||||
return false;
|
||||
});
|
||||
|
||||
$("a.delete_event").click (function () {
|
||||
$tr = $(this).parents ("tr");
|
||||
id = this.id.split ("-").pop ();
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/events/events",
|
||||
"delete_event" : 1,
|
||||
"id" : id,
|
||||
"similar" : <?php echo ($group_rep ? 1 : 0) ?>
|
||||
},
|
||||
function (data, status) {
|
||||
if (data == "ok")
|
||||
$tr.remove ();
|
||||
else
|
||||
$("#result")
|
||||
.showMessage ("<?php echo __('Could not be deleted')?>")
|
||||
.addClass ("error");
|
||||
},
|
||||
"html"
|
||||
);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -428,19 +428,20 @@ function graphic_agentmodules ($id_agent, $width, $height) {
|
|||
generic_pie_graph ($width, $height, $data);
|
||||
}
|
||||
|
||||
function graphic_agentaccess ($id_agent, $width, $height) {
|
||||
function graphic_agentaccess ($id_agent, $width, $height, $period = 0) {
|
||||
global $config;
|
||||
|
||||
$interval = 24;
|
||||
$date = get_system_time ();
|
||||
$period = 1440;
|
||||
$datelimit = $date - $period;
|
||||
$resolution = $config["graph_res"] * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||
|
||||
$interval = (int) ($period / $resolution);
|
||||
$date = get_system_time ();
|
||||
$datelimit = $date - $period;
|
||||
$periodtime = floor ($period / $interval);
|
||||
$time = array ();
|
||||
$data = array ();
|
||||
for ($i = 0; $i < $interval; $i++) {
|
||||
$time[$i]['timestamp_bottom'] = $datelimit + ($interval * $i);
|
||||
$time[$i]['timestamp_top'] = $datelimit + ($interval * ($i + 1));
|
||||
$time[$i]['timestamp_bottom'] = $datelimit + ($periodtime * $i);
|
||||
$time[$i]['timestamp_top'] = $datelimit + ($periodtime * ($i + 1));
|
||||
$data[$time[$i]['timestamp_bottom']] = 0;
|
||||
}
|
||||
|
||||
|
@ -453,19 +454,15 @@ function graphic_agentaccess ($id_agent, $width, $height) {
|
|||
if ($result === false)
|
||||
$result = array ();
|
||||
|
||||
$start = 0;
|
||||
$max_value = 0;
|
||||
|
||||
foreach ($result as $access) {
|
||||
$utimestamp = $access['utimestamp'];
|
||||
for ($i = $start; $i < $interval; $i++) {
|
||||
for ($i = 0; $i < $interval; $i++) {
|
||||
if ($utimestamp <= $time[$i]['timestamp_top'] && $utimestamp >= $time[$i]['timestamp_bottom']) {
|
||||
$data[$time[$i]['timestamp_bottom']] = 1;
|
||||
$start = $i;
|
||||
$max_value = 1;
|
||||
break;
|
||||
$data[$time[$i]['timestamp_bottom']]++;
|
||||
$max_value = max ($max_value, $data[$time[$i]['timestamp_bottom']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$engine = get_graph_engine ($period);
|
||||
|
@ -476,9 +473,11 @@ function graphic_agentaccess ($id_agent, $width, $height) {
|
|||
$engine->max_value = $max_value;
|
||||
$engine->show_title = false;
|
||||
$engine->fontpath = $config['fontpath'];
|
||||
$engine->xaxis_interval = 4;
|
||||
$engine->yaxis_interval = 1;
|
||||
$engine->xaxis_interval = floor ($width / 72);
|
||||
$engine->yaxis_interval = $max_value;
|
||||
$engine->xaxis_format = 'date';
|
||||
$engine->watermark = false;
|
||||
$engine->show_grid = false;
|
||||
|
||||
$engine->single_graph ();
|
||||
}
|
||||
|
@ -487,10 +486,10 @@ function graph_incidents_status () {
|
|||
$data = array (0, 0, 0, 0);
|
||||
|
||||
$data = array ();
|
||||
$data[__("Open Incident")] = 0;
|
||||
$data[__("Closed Incident")] = 0;
|
||||
$data[__("Outdated")] = 0;
|
||||
$data[__("Invalid")] = 0;
|
||||
$data[__('Open Incident')] = 0;
|
||||
$data[__('Closed Incident')] = 0;
|
||||
$data[__('Outdated')] = 0;
|
||||
$data[__('Invalid')] = 0;
|
||||
|
||||
$incidents = get_db_all_rows_filter ('tincidencia',
|
||||
array ('estado' => array (0, 2, 3, 13)),
|
||||
|
@ -812,12 +811,11 @@ function grafico_db_agentes_paquetes ($width = 380, $height = 300) {
|
|||
$data = array ();
|
||||
$legend = array ();
|
||||
|
||||
$agents = get_group_agents (1, false, "none");
|
||||
|
||||
$agents = get_group_agents (array_keys (get_user_groups ()), false, "none");
|
||||
$count = get_agent_modules_data_count (array_keys ($agents));
|
||||
unset ($count["total"]);
|
||||
arsort ($count, SORT_NUMERIC);
|
||||
$count = array_slice ($count, 0, 10, true);
|
||||
$count = array_slice ($count, 0, 8, true);
|
||||
|
||||
foreach ($count as $agent_id => $value) {
|
||||
$data[$agents[$agent_id]] = $value;
|
||||
|
@ -1165,7 +1163,7 @@ if ($graphic_type) {
|
|||
|
||||
break;
|
||||
case "agentaccess":
|
||||
graphic_agentaccess ($id, $width, $height);
|
||||
graphic_agentaccess ($id, $width, $height, $period);
|
||||
|
||||
break;
|
||||
case "agentmodules":
|
||||
|
|
|
@ -44,6 +44,9 @@ abstract class PandoraGraphAbstract {
|
|||
public $min_value = 0;
|
||||
public $background_color = '#FFFFFF';
|
||||
public $border = true;
|
||||
public $watermark = true;
|
||||
public $show_axis = true;
|
||||
public $show_grid = true;
|
||||
|
||||
abstract protected function pie_graph ();
|
||||
abstract protected function horizontal_bar_graph ();
|
||||
|
|
|
@ -89,7 +89,8 @@ class PchartGraph extends PandoraGraphAbstract {
|
|||
$this->graph->setFontProperties ($this->fontpath, 8);
|
||||
$this->add_background ();
|
||||
$this->graph->drawGraphArea (255, 255, 255, true);
|
||||
$this->graph->drawGrid (4, true, 230, 230, 230, 50);
|
||||
if ($this->show_grid)
|
||||
$this->graph->drawGrid (4, true, 230, 230, 230, 50);
|
||||
|
||||
// Draw the bar graph
|
||||
$this->graph->setFontProperties ($this->fontpath, 8);
|
||||
|
@ -114,13 +115,12 @@ class PchartGraph extends PandoraGraphAbstract {
|
|||
$color = $this->get_rgb_values ($this->graph_color[2]);
|
||||
$this->graph->setColorPalette (0, $color['r'], $color['g'], $color['b']);
|
||||
$this->dataset->AddAllSeries ();
|
||||
if ($this->legend !== false) {
|
||||
if ($this->legend !== false)
|
||||
$this->dataset->SetSerieName ($this->legend[0], "Serie1");
|
||||
}
|
||||
|
||||
if ($this->palette_path) {
|
||||
if ($this->palette_path)
|
||||
$this->graph->loadColorPalette ($this->palette_path);
|
||||
}
|
||||
|
||||
$this->graph->setFontProperties ($this->fontpath, 8);
|
||||
$this->add_background ();
|
||||
$this->dataset->SetXAxisFormat ($this->xaxis_format);
|
||||
|
@ -132,11 +132,12 @@ class PchartGraph extends PandoraGraphAbstract {
|
|||
|
||||
$this->graph->drawScale ($this->dataset->GetData (),
|
||||
$this->dataset->GetDataDescription (),
|
||||
SCALE_START0, 80, 80, 80, true,
|
||||
SCALE_START0, 80, 80, 80, $this->show_axis,
|
||||
0, 0, false,
|
||||
$this->xaxis_interval);
|
||||
|
||||
$this->graph->drawGrid (4, false, 0, 0, 0);
|
||||
if ($this->show_grid)
|
||||
$this->graph->drawGrid (4, false, 0, 0, 0);
|
||||
if ($this->max_value > 0) {
|
||||
// Draw the graph
|
||||
$this->graph->drawFilledLineGraph ($this->dataset->GetData (),
|
||||
|
@ -196,10 +197,11 @@ class PchartGraph extends PandoraGraphAbstract {
|
|||
$this->xaxis_interval = ($this->xaxis_interval / 7 >= 1) ? ($this->xaxis_interval / 7) : 10;
|
||||
$this->graph->drawScale ($this->dataset->GetData (),
|
||||
$this->dataset->GetDataDescription (), SCALE_START0,
|
||||
80, 80, 80, true, 0, 0, false,
|
||||
80, 80, 80, $this->show_axis, 0, 0, false,
|
||||
$this->xaxis_interval);
|
||||
/* NOTICE: The final "false" is a Pandora modificaton of pChart to avoid showing vertical lines. */
|
||||
$this->graph->drawGrid (1, true, 225, 225, 225, 100, false);
|
||||
if ($this->show_grid)
|
||||
$this->graph->drawGrid (1, true, 225, 225, 225, 100, false);
|
||||
// Draw the graph
|
||||
$this->graph->drawFilledLineGraph ($this->dataset->GetData(), $this->dataset->GetDataDescription(), 50, true);
|
||||
|
||||
|
@ -229,14 +231,15 @@ class PchartGraph extends PandoraGraphAbstract {
|
|||
$this->graph->setFontProperties ($this->fontpath, 8);
|
||||
$this->add_background ();
|
||||
$this->graph->drawGraphArea (255, 255, 255, true);
|
||||
$this->graph->drawGrid (4, true, 230, 230, 230, 50);
|
||||
if ($this->show_grid)
|
||||
$this->graph->drawGrid (4, true, 230, 230, 230, 50);
|
||||
|
||||
// Draw the bar graph
|
||||
$this->graph->setFontProperties ($this->fontpath, 8);
|
||||
$this->graph->drawScale ($this->dataset->GetData (),
|
||||
$this->dataset->GetDataDescription (),
|
||||
SCALE_START0, 80, 80, 80,
|
||||
true, 0, 0, false,
|
||||
$this->show_axis, 0, 0, false,
|
||||
$this->xaxis_interval);
|
||||
$this->graph->drawOverlayBarGraph ($this->dataset->GetData (),
|
||||
$this->dataset->GetDataDescription (),
|
||||
|
@ -276,7 +279,7 @@ class PchartGraph extends PandoraGraphAbstract {
|
|||
if ($stacked == 1) {
|
||||
$this->graph->drawScale ($this->dataset->GetData (),
|
||||
$this->dataset->GetDataDescription (),
|
||||
SCALE_ADDALL, 80, 80, 80, true,
|
||||
SCALE_ADDALL, 80, 80, 80, $this->show_axis,
|
||||
0, 0, false,
|
||||
$this->xaxis_interval);
|
||||
/* Stacked mode are only supported in bar charts */
|
||||
|
@ -287,14 +290,14 @@ class PchartGraph extends PandoraGraphAbstract {
|
|||
} else if ($stacked == 2) {
|
||||
$this->graph->drawScale ($this->dataset->GetData (),
|
||||
$this->dataset->GetDataDescription (),
|
||||
SCALE_START0, 80, 80, 80, true, 0, 0, false,
|
||||
SCALE_START0, 80, 80, 80, $this->show_axis, 0, 0, false,
|
||||
$this->xaxis_interval);
|
||||
$this->graph->drawLineGraph ($this->dataset->GetData (),
|
||||
$this->dataset->GetDataDescription ());
|
||||
} else {
|
||||
$this->graph->drawScale ($this->dataset->GetData (),
|
||||
$this->dataset->GetDataDescription (),
|
||||
SCALE_START0, 80, 80, 80, true, 0, 0, false,
|
||||
SCALE_START0, 80, 80, 80, $this->show_axis, 0, 0, false,
|
||||
$this->xaxis_interval);
|
||||
$this->graph->drawFilledCubicCurve ($this->dataset->GetData(),
|
||||
$this->dataset->GetDataDescription(), 0.1, 50, true);
|
||||
|
@ -316,7 +319,7 @@ class PchartGraph extends PandoraGraphAbstract {
|
|||
// Round corners defined in global setup
|
||||
|
||||
global $config;
|
||||
if ($config["round_corner"] != 0)
|
||||
if ($config["round_corner"] != 0)
|
||||
$radius = ($this->height > 18) ? 8 : 0;
|
||||
else
|
||||
$radius = 0;
|
||||
|
@ -330,16 +333,13 @@ class PchartGraph extends PandoraGraphAbstract {
|
|||
$b = hexdec (substr ($this->background_color, 5, 2));
|
||||
|
||||
/* Actual percentage */
|
||||
$this->graph->drawFilledRectangle (0, 0, $this->width,
|
||||
$this->height, 255, 255, 255, false, 0);
|
||||
$this->graph->drawFilledRoundedRectangle (0, 0, $this->width,
|
||||
$this->height, $radius, $bgcolor['r'], $bgcolor['g'], $bgcolor['b']);
|
||||
if (! $this->show_title || $value > 0) {
|
||||
$color = $this->get_rgb_values ($color);
|
||||
$this->graph->drawFilledRoundedRectangle (0, 0, $ratio,
|
||||
$this->height, $radius, $color['r'], $color['g'], $color['b']);
|
||||
}
|
||||
|
||||
$color = $this->get_rgb_values ($color);
|
||||
$this->graph->drawFilledRoundedRectangle (0, 0, $ratio,
|
||||
$this->height, $radius, $color['r'], $color['g'], $color['b']);
|
||||
|
||||
if ($config["round_corner"] != 0){
|
||||
if ($config["round_corner"]) {
|
||||
/* Under this value, the rounded rectangle is painted great */
|
||||
if ($ratio <= 16) {
|
||||
/* Clean a bit of pixels */
|
||||
|
@ -357,10 +357,11 @@ class PchartGraph extends PandoraGraphAbstract {
|
|||
if ($this->show_title) {
|
||||
$this->graph->drawTextBox (0, 0, $this->width, $this->height,
|
||||
$this->title, 0, 0, 0, 0, ALIGN_CENTER, false);
|
||||
// Removed shadow in bars, was difficult to read, do not enable again please
|
||||
}
|
||||
|
||||
if ($this->border) {
|
||||
$this->graph->drawRoundedRectangle (0, 0, $this->width - 1 , $this->height - 1,
|
||||
$this->graph->drawRoundedRectangle (0, 0, $this->width - 1,
|
||||
$this->height - 1,
|
||||
$radius, 157, 157, 157);
|
||||
}
|
||||
|
||||
|
@ -382,13 +383,13 @@ class PchartGraph extends PandoraGraphAbstract {
|
|||
private function add_alert_levels () {
|
||||
if ($this->alert_top !== false) {
|
||||
$this->graph->drawTreshold ($this->alert_top, 57,
|
||||
96, 255, true, true, 4,
|
||||
"Alert top");
|
||||
96, 255, true, true, 4,
|
||||
"Alert top");
|
||||
}
|
||||
if ($this->alert_bottom !== false) {
|
||||
$this->graph->drawTreshold ($this->alert_bottom, 7,
|
||||
96, 255, true, true, 4,
|
||||
"Alert bottom");
|
||||
96, 255, true, true, 4,
|
||||
"Alert bottom");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,7 +435,7 @@ class PchartGraph extends PandoraGraphAbstract {
|
|||
$this->x2 = ($this->width > 300) ? $this->width - 30 : $this->width - 15;
|
||||
$this->y2 = ($this->height > 200) ? $this->height - 25 : $this->height - 25;
|
||||
|
||||
if ($this->max_value > 10000)
|
||||
if ($this->max_value > 10000 && $this->show_axis)
|
||||
$this->x1 += 20;
|
||||
|
||||
if ($this->background_gradient)
|
||||
|
@ -451,10 +452,8 @@ class PchartGraph extends PandoraGraphAbstract {
|
|||
if (is_array ($size)) {
|
||||
while ($size[1] > $this->y1)
|
||||
$this->y1 += (int) $size[1] / 2;
|
||||
if ($this->y1 > $this->y2) {
|
||||
|
||||
if ($this->y1 > $this->y2)
|
||||
$this->y1 = $this->y2;
|
||||
}
|
||||
}
|
||||
|
||||
$this->graph->setGraphArea ($this->x1, $this->y1, $this->x2, $this->y2);
|
||||
|
@ -471,14 +470,16 @@ class PchartGraph extends PandoraGraphAbstract {
|
|||
}
|
||||
|
||||
/* This is a tiny watermark. Remove safely */
|
||||
$this->graph->setFontProperties ($this->fontpath, 7);
|
||||
$this->graph->drawTextBox ($this->width - 5, $this->height - 0,
|
||||
$this->width - 240, $this->height - 0, 'Pandora FMS', 90,
|
||||
154, 154, 154, ALIGN_BOTTOM_LEFT, false);
|
||||
if ($this->watermark) {
|
||||
$this->graph->setFontProperties ($this->fontpath, 7);
|
||||
$this->graph->drawTextBox ($this->width - 5, $this->height - 0,
|
||||
$this->width - 240, $this->height - 0, 'Pandora FMS', 90,
|
||||
154, 154, 154, ALIGN_BOTTOM_LEFT, false);
|
||||
}
|
||||
}
|
||||
|
||||
private function add_legend () {
|
||||
if (! $this->show_title || $this->legend === false) {
|
||||
if (! $this->show_title || $this->legend === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue