Merge branch 'develop' into 1505-acl-de-grupos-para-los-elementos-de-la-consola-visual-dev

Conflicts:
	pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
	pandora_console/godmode/reporting/visual_console_builder.editor.js
	pandora_console/include/ajax/visual_console_builder.ajax.php
	pandora_console/include/functions_visual_map_editor.php
	pandora_console/pandoradb.sql
This commit is contained in:
Arturo Gonzalez 2017-11-15 09:43:33 +01:00
commit 776aca90d6
79 changed files with 1137 additions and 934 deletions

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714, AIX version
# Version 7.0NG.715, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714, FreeBSD Version
# Version 7.0NG.715, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714, HP-UX Version
# Version 7.0NG.715, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714, GNU/Linux
# Version 7.0NG.715, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714, GNU/Linux
# Version 7.0NG.715, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714, Solaris Version
# Version 7.0NG.715, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.714
# Version 7.0NG.715
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.714, AIX version
# Version 7.0NG.715, AIX version
# General Parameters
# ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.714
# Version 7.0NG.715
# FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.714, HPUX Version
# Version 7.0NG.715, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714
# Version 7.0NG.715
# Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714
# Version 7.0NG.715
# Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714
# Version 7.0NG.715
# Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.714, Solaris version
# Version 7.0NG.715, Solaris version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714, AIX version
# Version 7.0NG.715, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.714-171108
Version: 7.0NG.715-171115
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.714-171108"
pandora_version="7.0NG.715-171115"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714, GNU/Linux
# Version 7.0NG.715, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714, FreeBSD Version
# Version 7.0NG.715, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714, HP-UX Version
# Version 7.0NG.715, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714, GNU/Linux
# Version 7.0NG.715, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714, GNU/Linux
# Version 7.0NG.715, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714, NetBSD Version
# Version 7.0NG.715, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.714, Solaris Version
# Version 7.0NG.715, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -40,8 +40,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.714';
use constant AGENT_BUILD => '171108';
use constant AGENT_VERSION => '7.0NG.715';
use constant AGENT_BUILD => '171115';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.714
%define release 171108
%define version 7.0NG.715
%define release 171115
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.714
%define release 171108
%define version 7.0NG.715
%define release 171115
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.714"
PI_BUILD="171108"
PI_VERSION="7.0NG.715"
PI_BUILD="171115"
OS_NAME=`uname -s`
FORCE=0

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2014 Artica Soluciones Tecnologicas
# Version 7.0NG.714
# Version 7.0NG.715
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v7.0NG.714}
{Pandora FMS Windows Agent v7.0NG.715}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{171108}
{171115}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.714(Build 171108)")
#define PANDORA_VERSION ("7.0NG.715(Build 171115)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.714(Build 171108))"
VALUE "ProductVersion", "(7.0NG.715(Build 171115))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.714-171108
Version: 7.0NG.715-171115
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.714-171108"
pandora_version="7.0NG.715-171115"
package_pear=0
package_pandora=1

View File

@ -0,0 +1,5 @@
START TRANSACTION;
ALTER TABLE tagente ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
COMMIT;

View File

@ -1226,6 +1226,7 @@ ALTER TABLE tagente ADD `remote` tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD COLUMN `cascade_protection_module` int(10) unsigned NOT NULL default '0';
ALTER TABLE tagente ADD COLUMN (alias varchar(600) not null default '');
ALTER TABLE tagente ADD `alias_as_name` int(2) unsigned default '0';
ALTER TABLE tagente ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
UPDATE tagente SET tagente.alias = tagente.nombre;
-- ---------------------------------------------------------------------
@ -1240,6 +1241,7 @@ ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area';
ALTER TABLE tlayout_data ADD `label_position` varchar(50) NOT NULL default 'down';
ALTER TABLE tlayout_data ADD COLUMN `show_statistics` tinyint(2) NOT NULL default '0';
ALTER TABLE tlayout_data ADD COLUMN `element_group` int(10) NOT NULL default '0';
ALTER TABLE tlayout_data ADD COLUMN `id_layout_linked_weight` int(10) NOT NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tagent_custom_fields`

View File

@ -252,25 +252,6 @@ foreach ($modules as $m) {
$modules_values[$m['id_module']] = $m['name'];
}
$table->data[3][0] = __('Parent');
$params = array();
$params['return'] = true;
$params['show_helptip'] = true;
$params['input_name'] = 'id_parent';
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent_parent';
$params['hidden_input_idagent_value'] = $id_parent;
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
$params['selectbox_id'] = 'cascade_protection_module';
$params['javascript_is_function_select'] = true;
$params['cascade_protection'] = true;
$table->data[3][1] = ui_print_agent_autocomplete_input($params);
$table->data[3][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true);
$table->data[3][1] .= "  " . __('Module') . " " . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true);
$table->data[4][0] = __('Group');
$table->data[4][1] = html_print_select_groups(false, "AR", false, 'grupo', $grupo, '', '', 0, true);
$table->data[4][1] .= ' <span id="group_preview">';
@ -320,52 +301,87 @@ $table->class = "databox filters";
$table->head = array ();
$table->style = array ();
$table->style[0] = 'font-weight: bold; ';
$table->style[2] = 'font-weight: bold;';
$table->style[4] = 'font-weight: bold;';
$table->data = array ();
// Custom ID
$table->data[0][0] = __('Custom ID');
$table->data[0][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true);
$table->data[1][0] = __('Parent');
$params = array();
$params['return'] = true;
$params['show_helptip'] = true;
$params['input_name'] = 'id_parent';
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent_parent';
$params['hidden_input_idagent_value'] = $id_parent;
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
$params['selectbox_id'] = 'cascade_protection_module';
$params['javascript_is_function_select'] = true;
$params['cascade_protection'] = true;
$table->data[1][1] = ui_print_agent_autocomplete_input($params);
$table->data[1][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). "&nbsp;" . ui_print_help_icon("cascade_protection", true);
$table->data[1][1] .= "&nbsp;&nbsp;" . __('Module') . "&nbsp;" . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true);
//safe operation mode
if($id_agente){
$sql_modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = " . $id_agente);
$safe_mode_modules = array();
$safe_mode_modules[0] = __('Any');
foreach ($sql_modules as $m) {
$safe_mode_modules[$m['id_module']] = $m['name'];
}
$table->data[2][0] = __('Safe operation mode')
. ui_print_help_tip(__('This mode allow Pandora FMS to disable all modules
of this agent while the selected module is on CRITICAL status'), true);
$table->data[2][1] = html_print_checkbox('safe_mode', 1, $safe_mode, true);
$table->data[2][1] .= "&nbsp;&nbsp;" . __('Module') . "&nbsp;" . html_print_select ($safe_mode_modules, "safe_mode_module", $safe_mode_module, "", "", 0, true);
}
// Learn mode / Normal mode
$table->data[1][0] = __('Module definition') .
$table->data[3][0] = __('Module definition') .
ui_print_help_icon("module_definition", true);
$table->data[1][1] = __('Learning mode') . ' ' .
$table->data[3][1] = __('Learning mode') . ' ' .
html_print_radio_button_extended ("modo", 1, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
'style="margin-right: 40px;"', true);
$table->data[1][1] .= __('Normal mode') . ' ' .
$table->data[3][1] .= __('Normal mode') . ' ' .
html_print_radio_button_extended ("modo", 0, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
'style="margin-right: 40px;"', true);
$table->data[1][1] .= __('Autodisable mode') . ' ' .
$table->data[3][1] .= __('Autodisable mode') . ' ' .
html_print_radio_button_extended ("modo", 2, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
'style="margin-right: 40px;"', true);
// Status (Disabled / Enabled)
$table->data[2][0] = __('Status');
$table->data[2][1] = __('Disabled') . ' ' .
$table->data[4][0] = __('Status');
$table->data[4][1] = __('Disabled') . ' ' .
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
$table->data[2][1] .= __('Active') . ' ' .
$table->data[4][1] .= __('Active') . ' ' .
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
// Remote configuration
$table->data[3][0] = __('Remote configuration');
$table->data[5][0] = __('Remote configuration');
if (!$new_agent) {
$table->data[3][1] = '<em>' . __('Not available') . '</em>';
$table->data[5][1] = '<em>' . __('Not available') . '</em>';
if (isset($filename)) {
if (file_exists ($filename['md5'])) {
$table->data[3][1] = date ("F d Y H:i:s", fileatime ($filename['md5']));
$table->data[5][1] = date ("F d Y H:i:s", fileatime ($filename['md5']));
// Delete remote configuration
$table->data[3][1] .= '<a href="index.php?' .
$table->data[5][1] .= '<a href="index.php?' .
'sec=gagente&amp;' .
'sec2=godmode/agentes/configurar_agente&amp;' .
'tab=main&amp;' .
'disk_conf_delete=1&amp;' .
'id_agente=' . $id_agente . '">';
$table->data[3][1] .= html_print_image(
$table->data[5][1] .= html_print_image(
"images/cross.png", true,
array ('title' => __('Delete remote configuration file'), 'style' => 'vertical-align: middle;')).'</a>';
$table->data[3][1] .= '</a>' .
$table->data[5][1] .= '</a>' .
ui_print_help_tip(
__('Delete this conf file implies that for restore you must reactive remote config in the local agent.'),
true);
@ -373,7 +389,7 @@ if (!$new_agent) {
}
}
else
$table->data[3][1] = '<em>' . __('Not available') . '</em>';
$table->data[5][1] = '<em>' . __('Not available') . '</em>';
$listIcons = gis_get_array_list_icons();
@ -411,23 +427,23 @@ $table->data[0][3] = html_print_select($arraySelectIcon, "icon_path",
array("id" => "icon_warning", "style" => "display:".$display_icons.";"));
if ($config['activate_gis']) {
$table->data[1][2] = __('Ignore new GIS data:');
$table->data[1][3] = __('Yes') . ' ' .
$table->data[3][2] = __('Ignore new GIS data:');
$table->data[3][3] = __('Yes') . ' ' .
html_print_radio_button_extended ("update_gis_data", 0, '',
$update_gis_data, false, '', 'style="margin-right: 40px;"', true);
$table->data[1][3] .= __('No') . ' ' .
$table->data[3][3] .= __('No') . ' ' .
html_print_radio_button_extended ("update_gis_data", 1, '',
$update_gis_data, false, '', 'style="margin-right: 40px;"', true);
}
$table->data[2][2] = __('Url address');
$table->data[2][3] = html_print_input_text ('url_description',
$table->data[4][2] = __('Url address');
$table->data[4][3] = html_print_input_text ('url_description',
$url_description, '', 45, 255, true);
$table->data[3][2] = __('Quiet');
$table->data[3][3] = ui_print_help_tip(
$table->data[5][2] = __('Quiet');
$table->data[5][3] = ui_print_help_tip(
__('The agent still runs but the alerts and events will be stop'), true);
$table->data[3][3] .= html_print_checkbox('quiet', 1, $quiet, true);
$table->data[5][3] .= html_print_checkbox('quiet', 1, $quiet, true);
ui_toggle(html_print_table ($table, true), __('Advanced options'));
unset($table);
@ -582,6 +598,26 @@ ui_require_jquery_file('bgiframe');
$("#cascade_protection_module").attr("disabled", 'disabled');
}
});
var safe_mode_checked = $("#checkbox-safe_mode").is(":checked");
if (safe_mode_checked) {
$("#safe_mode_module").removeAttr("disabled");
}
else {
$("#safe_mode_module").attr("disabled", 'disabled');
}
$("#checkbox-safe_mode").change(function () {
var safe_mode_checked = $("#checkbox-safe_mode").is(":checked");
if (safe_mode_checked) {
$("#safe_mode_module").removeAttr("disabled");
}
else {
$("#safe_mode_module").val(0);
$("#safe_mode_module").attr("disabled", 'disabled');
}
});
paint_qrcode(
"<?php

View File

@ -135,6 +135,8 @@ $id_os = 9; // Windows
$custom_id = "";
$cascade_protection = 0;
$cascade_protection_modules = 0;
$safe_mode = 0;
$safe_mode_module = 0;
$icon_path = '';
$update_gis_data = 0;
$unit = "";
@ -166,6 +168,8 @@ if ($create_agent) {
$custom_id = (string) get_parameter_post ("custom_id",'');
$cascade_protection = (int) get_parameter_post ("cascade_protection", 0);
$cascade_protection_module = (int) get_parameter_post("cascade_protection_module", 0);
$safe_mode = (int) get_parameter_post ("safe_mode", 0);
$safe_mode_module = (int) get_parameter_post ("safe_mode_module", 0);
$icon_path = (string) get_parameter_post ("icon_path",'');
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
$url_description = (string) get_parameter("url_description");
@ -707,6 +711,7 @@ if ($update_agent) { // if modified some agent paramenter
$custom_id = (string) get_parameter_post ("custom_id", "");
$cascade_protection = (int) get_parameter_post ("cascade_protection", 0);
$cascade_protection_module = (int) get_parameter ("cascade_protection_module", 0);
$safe_mode_module = (int) get_parameter ("safe_mode_module", 0);
$icon_path = (string) get_parameter_post ("icon_path",'');
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
$url_description = (string) get_parameter("url_description");
@ -782,7 +787,8 @@ if ($update_agent) { // if modified some agent paramenter
'update_gis_data' => $update_gis_data,
'url_address' => $url_description,
'url_address' => $url_description,
'quiet' => $quiet);
'quiet' => $quiet,
'safe_mode_module' => $safe_mode_module);
if ($config['metaconsole_agent_cache'] == 1) {
$values['update_module_count'] = 1; // Force an update of the agent cache.
@ -900,6 +906,8 @@ if ($id_agente) {
$update_gis_data = $agent["update_gis_data"];
$url_description = $agent["url_address"];
$quiet = $agent["quiet"];
$safe_mode_module = $agent["safe_mode_module"];
$safe_mode = ($safe_mode_module) ? 1 : 0;
}
$update_module = (bool) get_parameter ('update_module');

View File

@ -66,8 +66,6 @@ if ($edit_graph) {
$height = $graphInTgraph['height'];
$check = false;
$percentil = $graphInTgraph['percentil'];
$summatory_series = $graphInTgraph['summatory_series'];
$average_series = $graphInTgraph['average_series'];
if ($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
$stacked = CUSTOM_GRAPH_BULLET_CHART;
@ -86,8 +84,6 @@ else {
$stacked = 4;
$check = false;
$percentil = 0;
$summatory_series = 0;
$average_series = 0;
}
@ -178,15 +174,6 @@ echo "</div>";
echo "</div></td>";
echo "<tr><td class='datos2'><b>".__('Add summatory series')."</b>" .
ui_print_help_tip (__("This will add a synthetic series to the graph,
using all series to give a SUM or an average of all present series values
in each interval. This feature could be used instead synthetic modules
if you only want to see a graph"), true)."</td>";
echo "<td class='datos2'>" . html_print_checkbox ("summatory_series", 1, $summatory_series, true) . "</td>
<td class='datos2'><b>".__('Add average series')."</b></td>";
echo "<td class='datos2'>" . html_print_checkbox ("average_series", 1, $average_series, true) . "</td></tr>";
echo "<tr><td class='datos2'><b>".__('Percentil')."</b></td>";
echo "<td class='datos2'>" . html_print_checkbox ("percentil", 1, $percentil, true) . "</td></tr>";

View File

@ -87,8 +87,6 @@ if ($add_graph) {
$period = get_parameter_post ("period");
$threshold = get_parameter('threshold');
$percentil = get_parameter ("percentil", 0);
$summatory_series = get_parameter ("summatory_series", 0);
$average_series = get_parameter ("average_series", 0);
if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
$stacked = $threshold;
@ -105,9 +103,7 @@ if ($add_graph) {
'private' => 0,
'id_group' => $idGroup,
'stacked' => $stacked,
'percentil' => $percentil,
'summatory_series' => $summatory_series,
'average_series' => $average_series
'percentil' => $percentil
);
if (trim($name) != "") {
@ -135,8 +131,6 @@ if ($update_graph) {
$period = get_parameter('period');
$stacked = get_parameter('stacked');
$percentil = get_parameter('percentil');
$summatory_series = get_parameter ("summatory_series");
$average_series = get_parameter ("average_series");
$alerts = get_parameter('alerts');
$threshold = get_parameter('threshold');
@ -147,9 +141,7 @@ if ($update_graph) {
if (trim($name) != "") {
$success = db_process_sql_update('tgraph',
array('name' => $name, 'id_group' => $id_group, 'description' => $description,
'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked,
'percentil' => $percentil, 'summatory_series' => $summatory_series, 'average_series' => $average_series),
array('name' => $name, 'id_group' => $id_group, 'description' => $description, 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, 'percentil' => $percentil ),
array('id_graph' => $id_graph));
if ($success !== false)
db_pandora_audit("Report management", "Update graph #$id_graph");

View File

@ -615,6 +615,11 @@ function update_button_palette_callback() {
alert('Undefined width');
return false;
}
if($('input[name=bars_graph_height]').val() == ''){
alert('Undefined height');
return false;
}
$("#text_" + idItem).html(values['label']);
$("#image_" + idItem).attr("src", "images/spinner.gif");
@ -800,6 +805,8 @@ function readFields() {
values['top'] = $("input[name=top]").val();
values['agent'] = $("input[name=agent]").val();
values['id_agent'] = $("input[name=id_agent]").val();
values['agent_string'] = $("input[name=agent_string]").val();
values['id_agent_string'] = $("input[name=id_agent_string]").val();
values['module'] = $("select[name=module]").val();
values['process_simple_value'] = $("select[name=process_value]").val();
values['background'] = $("#background_image").val();
@ -816,7 +823,9 @@ function readFields() {
values['parent'] = $("select[name=parent]").val();
values['map_linked'] = $("select[name=map_linked]").val();
values['element_group'] = $("select[name=element_group]").val();
values['map_linked_weight'] = $("select[name=map_linked_weight]").val();
values['width_percentile'] = $("input[name=width_percentile]").val();
values['bars_graph_height'] = $("input[name=bars_graph_height]").val();
values['max_percentile'] = parseInt($("input[name=max_percentile]").val());
values['width_module_graph'] = $("input[name=width_module_graph]").val();
values['height_module_graph'] = $("input[name=height_module_graph]").val();
@ -911,7 +920,7 @@ function create_button_palette_callback() {
}
break;
case 'donut_graph':
if ((values['agent'] == '')) {
if ((values['agent_string'] == '')) {
alert($("#message_alert_no_agent").html());
validate = false;
}
@ -984,7 +993,7 @@ function create_button_palette_callback() {
}
break;
case 'bars_graph':
if ((values['agent'] == '')) {
if ((values['agent_string'] == '')) {
alert($("#message_alert_no_agent").html());
validate = false;
}
@ -992,6 +1001,14 @@ function create_button_palette_callback() {
alert($("#message_alert_no_module").html());
validate = false;
}
if ((values['width_percentile'] == '')) {
alert($("#message_alert_no_width_percentile").html());
validate = false;
}
if ((values['bars_graph_height'] == '')) {
alert($("#message_alert_no_bars_graph_height").html());
validate = false;
}
break;
case 'simple_value':
if ((values['agent'] == '')) {
@ -1443,11 +1460,16 @@ function loadFieldsFromDB(item) {
if (key == 'pos_y') $("input[name=top]").val(val);
if (key == 'agent_name') {
$("input[name=agent]").val(val);
$("input[name=agent_string]").val(val);
//Reload no-sincrone the select of modules
}
if (key == 'id_agent') {
$("input[name=id_agent]").val(val);
}
if (key == 'id_agent_string') {
$("input[name=id_agent_string]").val(val);
}
if (key == 'modules_html') {
$("select[name=module]").empty().html(val);
$("select[name=module]").val(moduleId);
@ -1490,10 +1512,14 @@ function loadFieldsFromDB(item) {
$("select[name=parent]").val(val);
if (key == 'id_layout_linked')
$("select[name=map_linked]").val(val);
if (key == 'id_layout_linked_weight')
$("select[name=map_linked_weight]").val(val);
if (key == 'element_group')
$("select[name=element_group]").val(val);
if (key == 'width_percentile')
$("input[name=width_percentile]").val(val);
if (key == 'bars_graph_height')
$("input[name=bars_graph_height]").val(val);
if (key == 'max_percentile')
$("input[name=max_percentile]").val(val);
if (key == 'width_module_graph')
@ -1717,6 +1743,9 @@ function hiddenFields(item) {
$("#agent_row").css('display', 'none');
$("#agent_row." + item).css('display', '');
$("#agent_row_string").css('display', 'none');
$("#agent_row_string." + item).css('display', '');
$("#module_row").css('display', 'none');
$("#module_row." + item).css('display', '');
@ -1744,6 +1773,9 @@ function hiddenFields(item) {
$("#percentile_bar_row_1").css('display', 'none');
$("#percentile_bar_row_1." + item).css('display', '');
$("#height_bars_graph_row").css('display', 'none');
$("#height_bars_graph_row." + item).css('display', '');
$("#percentile_bar_row_2").css('display', 'none');
$("#percentile_bar_row_2." + item).css('display', '');
@ -1777,6 +1809,9 @@ function hiddenFields(item) {
$("#element_group_row").css('display', 'none');
$("#element_group_row." + item).css('display', '');
$("#map_linked_weight").css('display', 'none');
$("#map_linked_weight." + item).css('display', '');
$("#module_graph_size_row").css('display', 'none');
$("#module_graph_size_row." + item).css('display', '');
@ -1836,10 +1871,12 @@ function cleanFields(item) {
$("input[name=left]").val(0);
$("input[name=top]").val(0);
$("input[name=agent]").val('');
$("input[name=agent_string]").val('');
$("select[name=module]").val('');
$("select[name=process_value]").val(0);
$("select[name=background_image]").val('');
$("input[name=width_percentile]").val('');
$("input[name=bars_graph_height]").val('');
$("input[name=max_percentile]").val('');
$("select[name=period]").val('');
$("input[name=width]").val(0);
@ -1847,6 +1884,7 @@ function cleanFields(item) {
$("select[name=parent]").val('');
$("select[name=map_linked]").val('');
$("select[name=element_group]").val('');
$("select[name=map_linked_weight]").val('');
$("input[name=width_module_graph]").val(300);
$("input[name=height_module_graph]").val(180);
$("input[name='width_box']").val(300);
@ -2012,12 +2050,13 @@ function setBarsGraph(id_data, values) {
}
width_percentile = values['width_percentile'];
bars_graph_height = values['bars_graph_height'];
parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_module_type_string"});
parameter.push ({name: "id_agent", value: values['id_agent']});
parameter.push ({name: "id_agent", value: values['id_agent_string']});
parameter.push ({name: "module", value: values['module']});
parameter.push ({name: "id_element", value: id_data});
parameter.push ({name: "id_visual_console", value: id_visual_console});
@ -2027,28 +2066,16 @@ function setBarsGraph(id_data, values) {
type: "POST",
dataType: 'json',
success: function (data) {
if (data['no_data'] == true) {
if (values['width_percentile'] == "0") {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras-no.png');
}
else {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras-no.png');
$("#" + id_data + " img").css('width', width_percentile + 'px');
$("#" + id_data + " img").css('height', width_percentile + 'px');
}
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras.png');
if (values['width_percentile'] == "0" && values["bars_graph_height"] == "0") {
// Image size
}
else {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras.png');
if (values['width_percentile'] == "0") {
// Image size
}
else{
$("#" + id_data + " img").css('width', width_percentile+'px');
$("#" + id_data + " img").css('height', width_percentile+'px');
}
else{
$("#" + id_data + " img").css('width', width_percentile + 'px');
$("#" + id_data + " img").css('height', bars_graph_height + 'px');
}
if($('#'+id_data+' table').css('float') == 'right' || $('#'+id_data+ ' table').css('float') == 'left'){
$('#'+id_data+ ' img').css('margin-top', parseInt($('#'+id_data).css('height'))/2 - parseInt($('#'+id_data+ ' img').css('height'))/2);
}
@ -2451,7 +2478,7 @@ function setDonutsGraph (id_data, values) {
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_module_type_string"});
parameter.push ({name: "id_agent", value: values['id_agent']});
parameter.push ({name: "id_agent", value: values['id_agent_string']});
parameter.push ({name: "module", value: values['module']});
parameter.push ({name: "id_element", value: id_data});
parameter.push ({name: "id_visual_console", value: id_visual_console});
@ -2474,7 +2501,7 @@ function setDonutsGraph (id_data, values) {
else {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/donut-graph.png');
if($('#text-width').val() == 0 || $('#text-height').val() == 0){
if($('#text-width_percentile').val() == 0){
// Image size
}
else{

View File

@ -478,13 +478,10 @@ if ($get_extended_event) {
if ($get_events_details) {
$event_ids = explode(',',get_parameter ('event_ids'));
$events = db_get_all_rows_filter (
'tevento',
array ('id_evento' => $event_ids,'order' => 'utimestamp ASC'),
array ('evento', 'utimestamp', 'estado', 'criticity', 'id_usuario'),
'AND',
true
);
$events = db_get_all_rows_filter ('tevento',
array ('id_evento' => $event_ids,
'order' => 'utimestamp ASC'),
array ('evento', 'utimestamp', 'estado', 'criticity', 'id_usuario'));
$out = '<table class="eventtable" style="width:100%;height:100%;padding:0px 0px 0px 0px; border-spacing: 0px; margin: 0px 0px 0px 0px;">';
$out .= '<tr style="font-size:0px; heigth: 0px; background: #ccc;"><td></td><td></td></tr>';

View File

@ -100,8 +100,10 @@ $width = get_parameter('width', null);
$height = get_parameter('height', null);
$parent = get_parameter('parent', null);
$map_linked = get_parameter('map_linked', null);
$map_linked_weight = get_parameter('map_linked_weight', null);
$element_group = get_parameter('element_group', null);
$width_percentile = get_parameter('width_percentile', null);
$bars_graph_height = get_parameter('bars_graph_height', null);
$max_percentile = get_parameter('max_percentile', null);
$height_module_graph = get_parameter('height_module_graph', null);
$width_module_graph = get_parameter('width_module_graph', null);
@ -114,6 +116,7 @@ $metaconsole = get_parameter('metaconsole', 0);
$server_name = get_parameter('server_name', null);
$server_id = (int)get_parameter('server_id', 0);
$id_agent = get_parameter('id_agent', null);
$id_agent_string = get_parameter('id_agent_string', null);
$id_metaconsole = get_parameter('id_metaconsole', null);
$id_group = (int)get_parameter('id_group', 0);
$id_custom_graph = get_parameter('id_custom_graph', null);
@ -379,7 +382,7 @@ switch ($action) {
// Linked to other layout ?? - Only if not module defined
if ($layoutData['id_layout_linked'] != 0) {
$status = visual_map_get_layout_status ($layoutData['id_layout_linked']);
$status = visual_map_get_layout_status ($layoutData['id_layout_linked'], $layoutData['id_layout_linked_weight']);
// Single object
}
@ -553,8 +556,6 @@ switch ($action) {
break;
}
if (defined('METACONSOLE') && $metaconsole) {
if ($server_name !== null) {
$values['id_metaconsole'] = db_get_value('id',
@ -569,6 +570,9 @@ switch ($action) {
$values['id_agent'] = $id_agent;
}
}
else if ($id_agent == 0) {
$values['id_agent'] = 0;
}
else if (!empty($id_agent)) {
$values['id_agent'] = $id_agent;
}
@ -588,6 +592,9 @@ switch ($action) {
if ($element_group !== null) {
$values['element_group'] = $element_group;
}
if ($map_linked_weight !== null) {
$values['id_layout_linked_weight'] = $map_linked_weight;
}
switch ($type) {
// -- line_item ------------------------------------
case 'handler_start':
@ -615,7 +622,7 @@ switch ($action) {
}
$values['border_color'] = $resume_color;
$values['type'] = DONUT_GRAPH;
$values['id_agent'] = $id_agent_string;
break;
case 'box_item':
$values['border_width'] = $border_width;
@ -658,6 +665,9 @@ switch ($action) {
if ($width_percentile !== null) {
$values['width'] = $width_percentile;
}
if ($bars_graph_height !== null) {
$values['height'] = $bars_graph_height;
}
if ($bars_graph_type !== null) {
$values['type_graph'] = $bars_graph_type;
}
@ -667,6 +677,7 @@ switch ($action) {
if ($grid_color !== null) {
$values['border_color'] = $grid_color;
}
$values['id_agent'] = $id_agent_string;
break;
case 'percentile_item':
case 'percentile_bar':
@ -749,10 +760,14 @@ switch ($action) {
unset($values['image']);
unset($values['type_graph']);
unset($values['border_color']);
unset($values['width']);
unset($values['id_agent']);
unset($values['height']);
break;
case 'donut_graph':
unset($values['border_color']);
unset($values['width']);
unset($values['id_agent']);
break;
case 'box_item':
unset($values['border_width']);
@ -897,6 +912,20 @@ switch ($action) {
case 'donut_graph':
$elementFields['width_percentile'] = $elementFields['width'];
$elementFields['resume_color'] = $elementFields['border_color'];
$elementFields['id_agent_string'] = $elementFields['id_agent'];
if (($elementFields['id_agent_string'] != 0)
&& ($elementFields['id_layout_linked'] == 0)) {
$modules = agents_get_modules(
$elementFields['id_agent'], false,
array('disabled' => 0,
'id_agente' => $elementFields['id_agent'],
'tagente_modulo.id_tipo_modulo IN' => "(17,23,3,10,33)"));
$elementFields['modules_html'] = '<option value="0">--</option>';
foreach ($modules as $id => $name) {
$elementFields['modules_html'] .= '<option value="' . $id . '">' . io_safe_output($name) . '</option>';
}
}
break;
case 'module_graph':
@ -905,8 +934,23 @@ switch ($action) {
break;
case 'bars_graph':
$elementFields['width_percentile'] = $elementFields['width'];
$elementFields['bars_graph_height'] = $elementFields['height'];
$elementFields['bars_graph_type'] = $elementFields['type_graph'];
$elementFields['grid_color'] = $elementFields['border_color'];
$elementFields['id_agent_string'] = $elementFields['id_agent'];
if (($elementFields['id_agent_string'] != 0)
&& ($elementFields['id_layout_linked'] == 0)) {
$modules = agents_get_modules(
$elementFields['id_agent'], false,
array('disabled' => 0,
'id_agente' => $elementFields['id_agent'],
'tagente_modulo.id_tipo_modulo IN' => "(17,23,3,10,33)"));
$elementFields['modules_html'] = '<option value="0">--</option>';
foreach ($modules as $id => $name) {
$elementFields['modules_html'] .= '<option value="' . $id . '">' . io_safe_output($name) . '</option>';
}
}
break;
case 'box_item':
$elementFields['width_box'] = $elementFields['width'];
@ -987,6 +1031,7 @@ switch ($action) {
$values['id_agente_modulo'] = $id_module;
$values['id_layout_linked'] = $map_linked;
$values['element_group'] = $element_group;
$values['id_layout_linked_weight'] = $map_linked_weight;
$values['parent_item'] = $parent;
$values['enable_link'] = $enable_link;
$values['image'] = $background_color;
@ -1015,9 +1060,10 @@ switch ($action) {
break;
case 'donut_graph':
$values['type'] = DONUT_GRAPH;
$values['width'] = $width;
$values['height'] = $height;
$values['width'] = $width_percentile;
$values['height'] = $width_percentile;
$values['border_color'] = $resume_color;
$values['id_agent'] = $id_agent_string;
break;
case 'module_graph':
$values['type'] = MODULE_GRAPH;
@ -1053,15 +1099,12 @@ switch ($action) {
break;
case 'bars_graph':
$values['type'] = BARS_GRAPH;
if ($width_percentile == null) {
$values['width'] = 0;
}
else {
$values['width'] = $width_percentile;
}
$values['width'] = $width_percentile;
$values['height'] = $bars_graph_height;
$values['type_graph'] = $bars_graph_type;
$values['image'] = $background_color;
$values['border_color'] = $grid_color;
$values['id_agent'] = $id_agent_string;
break;
case 'auto_sla_graph':
$values['type'] = AUTO_SLA_GRAPH;

View File

@ -240,26 +240,19 @@ function process_user_login_remote ($login, $pass, $api = false) {
}
}
}
elseif (($config["auth"] === 'ldap') &&
(isset($config['ldap_advanced_config']) && $config['ldap_advanced_config'])) {
elseif ($config["auth"] === 'ldap') {
if ($config['ldap_save_password']) {
$update_credentials = change_local_user_pass_ldap ($login, $pass);
$return = enterprise_hook ('prepare_permissions_groups_of_user_ldap',
array ($login, $pass, false, true, defined('METACONSOLE')));
if ($return === "error_permissions") {
$config["auth_error"] =
__("Problems with configuration permissions. Please contact with Administrator");
return false;
}
else {
if ($return === "permissions_changed") {
if ($update_credentials) {
$config["auth_error"] =
__("Your permissions have changed. Please, login again.");
return false;
}
}
change_local_user_pass_ldap ($login, $pass);
else {
delete_user_pass_ldap ($login);
}
}
return $login;
@ -310,9 +303,7 @@ function process_user_login_remote ($login, $pass, $api = false) {
return false;
}
}
elseif ($config["auth"] === 'ldap' &&
(isset($config['ldap_advanced_config']) &&
$config['ldap_advanced_config'])) {
elseif ($config["auth"] === 'ldap') {
if ( defined('METACONSOLE') ) {
enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once ('meta/include/functions_groups_meta.php');
@ -693,10 +684,10 @@ function ldap_process_user_login ($login, $password) {
}
}
$dc = $config["ldap_base_dn"];
$dc = io_safe_output($config["ldap_base_dn"]);
#Search group of this user it belong.
$filter="(" . $config['ldap_login_attr'] . io_safe_output($login) . ")";
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($login) . ")";
$justthese = array("objectclass=group");
$sr = ldap_search($ds, $dc, $filter, $justthese);
@ -717,7 +708,7 @@ function ldap_process_user_login ($login, $password) {
$correct = false;
if(!empty($ldap_base_dn)) {
if (strlen($password) != 0 && @ldap_bind($ds, $memberof['dn'], $password) ) {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($memberof['dn']), $password) ) {
$correct = true;
}
}
@ -770,13 +761,23 @@ function is_user_blacklisted ($user) {
function change_local_user_pass_ldap ($id_user, $password) {
$local_user_pass = db_get_value_filter('password', 'tusuario', array('id_user' => $id_user));
$return = false;
if (md5($password) !== $local_user_pass) {
$values_update = array();
$values_update['password'] = md5($password);
db_process_sql_update('tusuario', $values_update, array('id_user' => $id_user));
$return = db_process_sql_update('tusuario', $values_update, array('id_user' => $id_user));
}
return $return;
}
function delete_user_pass_ldap ($id_user) {
$values_update = array();
$values_update['password'] = null;
$return = db_process_sql_update('tusuario', $values_update, array('id_user' => $id_user));
return;
}

View File

@ -22,8 +22,8 @@
/**
* Pandora build version and version
*/
$build_version = 'PC171108';
$pandora_version = 'v7.0NG.714';
$build_version = 'PC171115';
$pandora_version = 'v7.0NG.715';
// Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get();

View File

@ -738,7 +738,7 @@ function mysql_db_get_row_sql ($sql, $search_history_db = false) {
*
* @return mixed Array of the row or false in case of error.
*/
function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join = 'AND', $historydb = false) {
function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join = 'AND') {
if (empty ($fields)) {
$fields = '*';
}
@ -758,7 +758,7 @@ function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join
$sql = sprintf ('SELECT %s FROM %s %s', $fields, $table, $filter);
return db_get_row_sql ($sql, $historydb);
return db_get_row_sql ($sql);
}
/**

View File

@ -345,7 +345,15 @@ function config_update_config () {
$error_update[] = __('Login attribute');
if (!config_update_value ('fallback_local_auth', get_parameter ('fallback_local_auth')))
$error_update[] = __('Fallback to local authentication');
if (isset($config['fallback_local_auth']) && $config['fallback_local_auth'] == 0) {
if (!config_update_value ('ldap_save_password', get_parameter ('ldap_save_password')))
$error_update[] = __('Save Password');
}
else if (isset($config['fallback_local_auth']) && $config['fallback_local_auth'] == 1) {
config_update_value ('ldap_save_password', 1);
}
if (!config_update_value ('rpandora_server', get_parameter ('rpandora_server')))
$error_update[] = __('MySQL host');
if (!config_update_value ('rpandora_port', get_parameter ('rpandora_port')))

View File

@ -202,10 +202,6 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph',
$id_graph);
$series = db_get_all_rows_sql('SELECT summatory_series,average_series FROM tgraph WHERE id_graph = '.$id_graph);
$summatory = $series[0]['summatory_series'];
$average = $series[0]['average_series'];
$modules = array ();
$weights = array ();
$labels = array ();
@ -266,9 +262,7 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$percentil,
$from_interface,
$id_widget_dashboard,
$fullscale,
$summatory,
$average);
$fullscale);
if ($return)
return $output;

View File

@ -416,12 +416,12 @@ function db_get_row ($table, $field_search, $condition, $fields = false) {
*
* @return mixed Array of the row or false in case of error.
*/
function db_get_row_filter($table, $filter, $fields = false, $where_join = 'AND', $historydb = false) {
function db_get_row_filter($table, $filter, $fields = false, $where_join = 'AND') {
global $config;
switch ($config["dbtype"]) {
case "mysql":
return mysql_db_get_row_filter($table, $filter, $fields, $where_join, $historydb);
return mysql_db_get_row_filter($table, $filter, $fields, $where_join);
break;
case "postgresql":
return postgresql_db_get_row_filter($table, $filter, $fields, $where_join);
@ -493,7 +493,7 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d
* @param int $tend end of search
*
*/
function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false, $historydb = false) {
function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false) {
global $config;
if (!isset($id_agente_modulo)) {
@ -521,7 +521,7 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
$query .= " AND utimestamp >= $tstart AND utimestamp <= $tend ";
$query .= " ORDER BY utimestamp ASC";
$events = db_get_all_rows_sql($query, $historydb);
$events = db_get_all_rows_sql($query);
if (! is_array($events)){
return false;
@ -582,6 +582,17 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
return false;
}
if ((!isset($tstart)) || ($tstart === false)) {
// Return data from the begining
// Get first available utimestamp in active DB
$query_first_man_time = " SELECT utimestamp FROM tagente_datos ";
$query_first_man_time .= " WHERE id_agente_modulo = $id_agente_modulo";
$query_first_man_time .= " ORDER BY utimestamp ASC LIMIT 1";
$first_man_time = db_get_all_rows_sql( $query_first_man_time, false);
$tstart = $first_man_time[0]['utimestamp'];
}
if ((!isset($tend)) || ($tend === false)) {
// Return data until now
$tend = time();
@ -605,51 +616,53 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
$table = "tagente_datos_string";
}
$result = modules_get_first_date($id_agente_modulo,$tstart);
$first_utimestamp = $result["first_utimestamp"];
$search_historydb = $result["search_historydb"];
// Get first available utimestamp in active DB
$query = " SELECT utimestamp, datos FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp < $tstart";
$query .= " ORDER BY utimestamp DESC LIMIT 1";
if ($first_utimestamp === false) {
$first_data["utimestamp"] = $tstart;
$ret = db_get_all_rows_sql( $query , $search_historydb);
if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) {
// Value older than first retrieved from active DB
$search_historydb = true;
$ret = db_get_all_rows_sql( $query , $search_historydb);
if ($ret) {
$tstart = $ret[0]["utimestamp"];
}
}
else {
$first_data["utimestamp"] = $ret[0]["utimestamp"];
$first_data["datos"] = $ret[0]["datos"];
}
if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) {
// No previous data. -> not init
// Avoid false unknown status
$first_data["utimestamp"] = time();
$first_data["datos"] = false;
}
else {
$query = "SELECT datos,utimestamp FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agente_modulo ";
$query .= " AND utimestamp=" . $first_utimestamp;
$data = db_get_all_rows_sql($query,$search_historydb);
if ($data === false) {
// first utimestamp not found in active database
// SEARCH HISTORY DB
$search_historydb = true;
$data = db_get_all_rows_sql($query,$search_historydb);
}
if ($data === false) { // Not init
$first_data["utimestamp"] = $tstart;
$first_data["datos"] = false;
}
else {
$first_data["utimestamp"] = $data[0]["utimestamp"];
$first_data["datos"] = $data[0]["datos"];
}
$first_data["utimestamp"] = $ret[0]["utimestamp"];
$first_data["datos"] = $ret[0]["datos"];
}
$query = " SELECT utimestamp, datos FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp >= $tstart AND utimestamp <= $tend";
$query .= " ORDER BY utimestamp ASC";
// Retrieve all data from module in given range
$raw_data = db_get_all_rows_sql($query, $search_historydb);
if (($raw_data === false) && ($first_utimestamp === $tstart)) {
if (($raw_data === false) && ($ret === false)) {
// No data
return false;
}
// Retrieve going unknown events in range
$unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend, $search_historydb);
$unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend);
// Retrieve module_interval to build the template
$module_interval = modules_get_interval ($id_agente_modulo);
@ -672,115 +685,197 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
$current_timestamp = $tstart;
$last_inserted_value = $first_data["datos"];
$last_timestamp = $first_data["utimestamp"];
$last_value = $first_data["datos"];
$data_found = 0;
// Build template
$pool_id = 0;
$now = time();
$current_unknown = array_shift($unknown_events);
$current_raw_data = array_shift($raw_data);
$in_unknown_status = 0;
if (is_array($unknown_events)) {
$current_unknown = array_shift($unknown_events);
}
while ( $current_timestamp < $tend ) {
$expected_data_generated = 0;
$return[$pool_id]["data"] = array();
$tmp_data = array();
$current_timestamp_end = $current_timestamp + $slice_size;
$data_found = 0;
if ( ( $current_timestamp > $now) ||
( ($current_timestamp_end - $last_timestamp) >
(SECONDS_1DAY + 2*$module_interval) ) ) {
$tmp_data["utimestamp"] = $last_timestamp + SECONDS_1DAY + 2*$module_interval;
//check not init
$tmp_data["datos"] = $last_value === false ? false : null;
// debug purpose
//$tmp_data["obs"] = "unknown extra";
array_push($return[$pool_id]["data"], $tmp_data);
}
//insert first slice data
$tmp_data["utimestamp"] = $current_timestamp;
$tmp_data["datos"] = $last_inserted_value;
// debug purpose
//$tmp_data["obs"] = "virtual data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
//insert raw data
while ( ($current_raw_data != null) &&
( ($current_timestamp_end >= $current_raw_data['utimestamp']) &&
($current_timestamp < $current_raw_data['utimestamp']) ) ) {
// Add unknown state detected
$tmp_data["utimestamp"] = $current_raw_data["utimestamp"];
$tmp_data["datos"] = $current_raw_data["datos"];
// debug purpose
//$tmp_data["obs"] = "real data";
array_push($return[$pool_id]["data"], $tmp_data);
$last_value = $current_raw_data["datos"];
$last_timestamp = $current_raw_data["utimestamp"];
$current_raw_data = array_shift($raw_data);
}
//unknown
$data_slices = $return[$pool_id]["data"];
while ( ($current_unknown != null) &&
( ( ($current_unknown['time_from'] != null) &&
($current_timestamp_end >= $current_unknown['time_from']) ) ||
($current_timestamp_end >= $current_unknown['time_to']) ) ) {
if( ( $current_timestamp < $current_unknown['time_from']) &&
( $current_timestamp_end >= $current_unknown['time_from'] ) ){
// Add unknown state detected
$tmp_data["utimestamp"] = $current_unknown["time_from"];
$tmp_data["datos"] = null;
// debug purpose
//$tmp_data["obs"] = "event data unknown from";
array_push($return[$pool_id]["data"], $tmp_data);
$current_unknown["time_from"] = null;
}
if( ($current_timestamp < $current_unknown['time_to']) &&
($current_timestamp_end >= $current_unknown['time_to'] ) ){
$tmp_data["utimestamp"] = $current_unknown["time_to"];
$i = count($data_slices) - 1;
while ($i >= 0) {
if($data_slices[$i]['utimestamp'] <= $current_unknown["time_to"]){
$tmp_data["datos"] =
$data_slices[$i]['datos'] == null
? $last_value
: $data_slices[$i]['datos'];
break;
}
$i--;
if (is_array($unknown_events)) {
$i = 0;
while ($current_timestamp >= $unknown_events[$i]["time_to"] ) {
// Skip unknown events in past
array_splice($unknown_events, $i,1);
$i++;
if (!isset($unknown_events[$i])) {
break;
}
// debug purpose
//$tmp_data["obs"] = "event data unknown to";
array_push($return[$pool_id]["data"], $tmp_data);
$current_unknown = array_shift($unknown_events);
}
if (isset($current_unknown)) {
// check if recovered from unknown status
if(is_array($unknown_events) && isset($current_unknown)) {
if ( (($current_timestamp+$slice_size) > $current_unknown["time_to"])
&& ($current_timestamp < $current_unknown["time_to"])
&& ($in_unknown_status == 1) ) {
// Recovered from unknown
if ( ($current_unknown["time_to"] > $current_timestamp)
&& ($expected_data_generated == 0) ) {
// also add the "expected" data
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$expected_data_generated = 1;
}
$tmp_data["utimestamp"] = $current_unknown["time_to"];
$tmp_data["datos"] = $last_inserted_value;
// debug purpose
//$tmp_data["obs"] = "event recovery data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$data_found = 1;
$in_unknown_status = 0;
}
if ( (($current_timestamp+$slice_size) > $current_unknown["time_from"])
&& (($current_timestamp+$slice_size) < $current_unknown["time_to"])
&& ($in_unknown_status == 0) ) {
// Add unknown state detected
if ( $current_unknown["time_from"] < ($current_timestamp+$slice_size)) {
if ( ($current_unknown["time_from"] > $current_timestamp)
&& ($expected_data_generated == 0) ) {
// also add the "expected" data
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$expected_data_generated = 1;
}
$tmp_data["utimestamp"] = $current_unknown["time_from"];
$tmp_data["datos"] = null;
// debug purpose
//$tmp_data["obs"] = "event data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$data_found = 1;
}
$in_unknown_status = 1;
}
if ( ($in_unknown_status == 0) && ($current_timestamp >= $current_unknown["time_to"]) ) {
$current_unknown = array_shift($unknown_events);
}
}
} // unknown events handle
}
//sort current slice
usort(
$return[$pool_id]['data'],
function ($a, $b) {
if ($a['utimestamp'] == $b['utimestamp']) return 0;
return ($a['utimestamp'] < $b['utimestamp']) ? -1 : 1;
// Search for data
$i=0;
if (is_array($raw_data)) {
foreach ($raw_data as $data) {
if ( ($data["utimestamp"] >= $current_timestamp)
&& ($data["utimestamp"] < ($current_timestamp+$slice_size)) ) {
// Data in block, push in, and remove from $raw_data (processed)
if ( ($data["utimestamp"] > $current_timestamp)
&& ($expected_data_generated == 0) ) {
// also add the "expected" data
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
//$tmp_data["obs"] = "expected data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$expected_data_generated = 1;
}
$tmp_data["utimestamp"] = intval($data["utimestamp"]);
$tmp_data["datos"] = $data["datos"];
// debug purpose
//$tmp_data["obs"] = "real data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$last_inserted_value = $data["datos"];
$last_timestamp = intval($data["utimestamp"]);
unset($raw_data[$i]);
$data_found = 1;
$in_unknown_status = 0;
}
elseif ($data["utimestamp"] > ($current_timestamp+$slice_size)) {
// Data in future, stop searching new ones
break;
}
}
);
//put the last slice data like first element of next slice
$last_inserted_value = end($return[$pool_id]['data']);
$last_inserted_value = $last_inserted_value['datos'];
//increment
$i++;
}
if ($data_found == 0) {
// No data found, lug the last_value until SECONDS_1DAY + 2*modules_get_interval
// UNKNOWN!
if (($current_timestamp > $now) || (($current_timestamp - $last_timestamp) > (SECONDS_1DAY + 2*$module_interval))) {
if (isset($last_inserted_value)) {
// unhandled unknown status control
$unhandled_time_unknown = $current_timestamp - (SECONDS_1DAY + 2*$module_interval) - $last_timestamp;
if ($unhandled_time_unknown > 0) {
// unhandled unknown status detected. Add to previous pool
$tmp_data["utimestamp"] = intval($last_timestamp) + (SECONDS_1DAY + 2*$module_interval);
$tmp_data["datos"] = null;
// debug purpose
//$tmp_data["obs"] = "unknown extra";
// add to previous pool if needed
if (isset($return[$pool_id-1])) {
array_push($return[$pool_id-1]["data"], $tmp_data);
}
}
}
$last_inserted_value = null;
}
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
// debug purpose
//$tmp_data["obs"] = "virtual data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
}
$pool_id++;
$current_timestamp = $current_timestamp_end;
$current_timestamp += $slice_size;
}
return $return;
}

View File

@ -2080,7 +2080,7 @@ function events_page_details ($event, $server = "") {
}
else {
$module_group = db_get_value('name', 'tmodule_group', 'id_mg', $id_module_group);
$data[1] = '<a href="'.$serverstring . 'index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;status=-1&amp;modulegroup=' . $id_module_group . $hashstring.'">';
$data[1] = '<a href="'.$serverstring . 'index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;status=-1&amp;modulegroup=' . $id_module_group . $hashstring.'">';
$data[1] .= $module_group;
$data[1] .= '</a>';
}

View File

@ -550,6 +550,8 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$datelimit = $date - $period;
$search_in_history_db = db_search_in_history_db($datelimit);
if($force_interval){
$resolution = $period/$time_interval;
}
@ -580,29 +582,18 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
// Get event data (contains alert data too)
$events = array();
if ($show_unknown == 1 || $show_events == 1 || $show_alerts == 1) {
$events = db_get_all_rows_filter (
'tevento',
$events = db_get_all_rows_filter ('tevento',
array ('id_agentmodule' => $agent_module_id,
"utimestamp > $datelimit",
"utimestamp < $date",
'order' => 'utimestamp ASC'),
array ('id_evento', 'evento', 'utimestamp', 'event_type'),
'AND',
$search_in_history_db
);
array ('id_evento', 'evento', 'utimestamp', 'event_type'));
// Get the last event after inverval to know if graph start on unknown
$prev_event = db_get_row_filter (
'tevento',
$prev_event = db_get_row_filter ('tevento',
array ('id_agentmodule' => $agent_module_id,
"utimestamp <= $datelimit",
'order' => 'utimestamp DESC'
),
false,
'AND',
$search_in_history_db
);
'order' => 'utimestamp DESC'));
if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') {
$start_unknown = true;
}
@ -1123,7 +1114,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$name_list = array(), $unit_list = array(), $show_last = true, $show_max = true,
$show_min = true, $show_avg = true, $labels = array(), $dashboard = false,
$vconsole = false, $percentil = null, $from_interface = false,
$id_widget_dashboard=false, $fullscale = false, $summatory = 0, $average = 0) {
$id_widget_dashboard=false, $fullscale = false) {
global $config;
global $graphic_type;
@ -1213,8 +1204,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$weight_list[$i] = 1;
}
}
$aux_array = array();
// Set data containers
for ($i = 0; $i < $resolution; $i++) {
$timestamp = $datelimit + ($interval * $i);/*
@ -1266,12 +1256,12 @@ function graphic_combined_module ($module_list, $weight_list, $period,
// If its a projection graph,
// first module will be data and second will be the projection
if ($projection != false && $i != 0) {
if ($automatic_custom_graph_meta)
$agent_module_id = $module_list[0]['module'];
else
$agent_module_id = $module_list[0];
$id_module_type = modules_get_agentmodule_type ($agent_module_id);
$module_type = modules_get_moduletype_name ($id_module_type);
$uncompressed_module = is_module_uncompressed ($module_type);
@ -1282,6 +1272,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
else
$agent_module_id = $module_list[$i];
$id_module_type = modules_get_agentmodule_type ($agent_module_id);
$module_type = modules_get_moduletype_name ($id_module_type);
$uncompressed_module = is_module_uncompressed ($module_type);
@ -2116,37 +2107,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$threshold_data['red_inverse'] = (bool)$red_inverse;
}
}
//summatory and average series
if($stacked == CUSTOM_GRAPH_AREA || $stacked == CUSTOM_GRAPH_LINE) {
if($summatory && $average){
foreach ($graph_values as $key => $value) {
$cont = count($value);
$summ = array_sum($value);
array_push($value,$summ);
array_push($value,$summ/$cont);
$graph_values[$key] = $value;
}
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
} elseif($summatory) {
foreach ($graph_values as $key => $value) {
array_push($value,array_sum($value));
$graph_values[$key] = $value;
}
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
} elseif($average) {
foreach ($graph_values as $key => $value) {
$summ = array_sum($value) / count($value);
array_push($value,$summ);
$graph_values[$key] = $value;
}
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
}
}
switch ($stacked) {
case CUSTOM_GRAPH_AREA:
return area_graph($flash_charts, $graph_values, $width,
@ -3986,33 +3947,22 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
if ($uncompressed_module) {
$avg_only = 1;
}
$search_in_history_db = db_search_in_history_db($datelimit);
// Get event data (contains alert data too)
if ($show_unknown == 1 || $show_events == 1 || $show_alerts == 1) {
$events = db_get_all_rows_filter(
'tevento',
$events = db_get_all_rows_filter('tevento',
array ('id_agentmodule' => $agent_module_id,
"utimestamp > $datelimit",
"utimestamp < $date",
'order' => 'utimestamp ASC'
),
array ('evento', 'utimestamp', 'event_type', 'id_evento'),
'AND',
$search_in_history_db
);
'order' => 'utimestamp ASC'),
array ('evento', 'utimestamp', 'event_type', 'id_evento'));
// Get the last event after inverval to know if graph start on unknown
$prev_event = db_get_row_filter (
'tevento',
$prev_event = db_get_row_filter ('tevento',
array ('id_agentmodule' => $agent_module_id,
"utimestamp <= $datelimit",
'order' => 'utimestamp DESC'
),
false,
'AND',
$search_in_history_db
);
'order' => 'utimestamp DESC'));
if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') {
$start_unknown = true;
}
@ -4117,7 +4067,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$zero = 0;
$total = 0;
$count = 0;
$is_unknown = false;
// Read data that falls in the current interval
while (isset ($data[$j]) &&
$data[$j]['utimestamp'] >= $timestamp &&
@ -4150,7 +4100,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
// Is the first point of a unknown interval
$first_unknown = false;
$check_unknown = false;
$event_ids = array();
$alert_ids = array();
while (isset ($events[$k]) &&
@ -4169,15 +4119,10 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
if ($is_unknown == false) {
$first_unknown = true;
}
else{
$first_unknown = false;
}
$check_unknown = true;
$is_unknown = true;
}
else if (substr ($events[$k]['event_type'], 0, 5) == 'going') {
$is_unknown = false;
$first_unknown = false;
}
}
$k++;
@ -4260,12 +4205,6 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$chart[$timestamp]['unknown'.$series_suffix] = 0;
}
$chart[$timestamp]['unknown'.$series_suffix] = $unknown_value;
if($unknown_value == 0 && $check_unknown == true){
$chart[$timestamp]['unknown'.$series_suffix] = 1;
$check_unknown = false;
}
$series_type['unknown'.$series_suffix] = 'area';
}
@ -4396,138 +4335,165 @@ function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index,
global $min_value;
global $series_type;
global $chart_extra_data;
$ranges_unknown = db_get_module_ranges_unknown($agent_module_id, $datelimit, $date);
$first_data = 0;
$table = "tagente_datos";
$module_type_str = modules_get_type_name ($agent_module_id);
if (strstr ($module_type_str, 'string') !== false) {
$table = "tagente_datos_string";
}
$query = " SELECT utimestamp, datos FROM $table ";
$query .= " WHERE id_agente_modulo=$agent_module_id ";
$query .= " ORDER BY utimestamp ASC LIMIT 1";
$ret = db_get_all_rows_sql( $query , true);
$first_data = $ret[0]['utimestamp'];
$data_uncompress = db_uncompress_module_data($agent_module_id, $datelimit, $date);
$chart_data = array();
$min_value = PHP_INT_MAX-1;
$max_value = PHP_INT_MIN+1;
$previous_data = $first_data;
$previous_unknown = 0;
$i=0;
$current_event = $events[0];
$prueba = array();
foreach ($data_uncompress as $k) {
foreach ($k["data"] as $v) {
$real_date = date("Y M d H:i:s", $v['utimestamp']);
if(!$flash_chart){
$real_date = date("Y/M/d", $v['utimestamp']);
$real_date .= "\n";
$real_date .= date(" H:i:s", $v['utimestamp']);
}
$event_ids = array();
$alert_ids = array();
while (isset($current_event) && ($v['utimestamp'] >= $current_event["utimestamp"]) ) {
$event_date = date("Y M d H:i:s", $current_event['utimestamp']);
$i = 0;
$max_value = 0;
$min_value = 0;
$timestamp_second = 0;
if(is_array($data_uncompress)){
foreach ($data_uncompress as $v) {
foreach ($v['data'] as $key => $value) {
$real_date = date("Y M d H:i:s", $value['utimestamp']);
if(!$flash_chart){
$event_date = date("Y/M/d", $current_event['utimestamp']);
$event_date .= "\n";
$event_date .= date(" H:i:s", $current_event['utimestamp']);
$real_date = date("Y/M/d", $value['utimestamp']);
$real_date .= "\n";
$real_date .= date(" H:i:s", $value['utimestamp']);
}
if ($show_events && (strpos($current_event["event_type"], "going") !== false)) {
$event_ids[$event_date][] = $current_event["id_evento"];
$chart_data[$event_date]["event" . $series_suffix] = 1;
$chart_data[$event_date]["alert" . $series_suffix] = NULL;
$chart_extra_data[count($chart_data)-1]['events'] = implode (',', $event_ids[$event_date]);
// Read events and alerts that fall in the current interval
$event_value = 0;
$alert_value = 0;
$unknown_value = 0;
$event_i = 0;
// Is the first point of a unknown interval
$first_unknown = false;
$event_ids = array();
$alert_ids = array();
//
if($timestamp_second == 0){
$timestamp_second = $value['utimestamp'];
}
elseif ($show_alerts && (strpos($current_event["event_type"], "alert") !== false)) {
$alert_ids[$event_date][] = $current_event["id_evento"];
$chart_data[$event_date]["event" . $series_suffix] = NULL;
$chart_data[$event_date]["alert" . $series_suffix] = 1;
$chart_extra_data[count($chart_data)-1]['alerts'] = implode (',', $alert_ids[$event_date]);
$timestamp_first = $timestamp_second;
$timestamp_second = $value['utimestamp'];
foreach ($events as $key => $val) {
if( $val['utimestamp'] > $timestamp_first &&
$val['utimestamp'] <= $timestamp_second ){
if ($show_events == 1) {
$event_ids[] = $val['id_evento'];
$event_value++;
}
if ($show_alerts == 1 && substr ($val['event_type'], 0, 5) == 'alert') {
$alert_ids[] = $val['id_evento'];
$alert_value++;
}
if ($show_unknown) {
if ($val['event_type'] == 'going_unknown') {
if ($is_unknown == false) {
$first_unknown = true;
}
$is_unknown = true;
}
else if (substr ($val['event_type'], 0, 5) == 'going') {
$is_unknown = false;
}
}
}
}
if(empty($value['datos'])){
if($value['utimestamp'] < $first_data){
//$chart_data[$real_date]['unknown'.$series_suffix] = 0;
$is_unknown = false;
}
else{
//$chart_data[$real_date]['unknown'.$series_suffix] = 1;
$first_unknown = true;
}
}
$timestamp_short = date("Y M d H:i:s", $value['utimestamp']);
if(!$flash_chart){
$timestamp_short = date("Y/M/d", $value['utimestamp']);
$timestamp_short .= "\n";
$timestamp_short .= date(" H:i:s", $value['utimestamp']);
}
$long_index[$timestamp_short] = date(
html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $value['utimestamp']);
// In some cases, can be marked as known because a recovery event
// was found in same interval. For this cases first_unknown is
// checked too
if ($is_unknown || $first_unknown) {
$unknown_value++;
}
// Data
if ($show_events) {
if (!isset($chart_data[$real_date]['event'.$series_suffix])) {
$chart_data[$real_date]['event'.$series_suffix] = 0;
}
$chart_data[$real_date]['event'.$series_suffix] += $event_value;
$series_type['event'.$series_suffix] = 'points';
}
if ($show_alerts) {
if (!isset($chart_data[$real_date]['alert'.$series_suffix])) {
$chart_data[$real_date]['alert'.$series_suffix] = 0;
}
$chart_data[$real_date]['alert'.$series_suffix] += $alert_value;
$series_type['alert'.$series_suffix] = 'points';
}
$chart_data[$real_date]['sum'.$series_suffix] = $value['datos'];
if($value['datos'] > $max_value){
$max_value = $value['datos'];
}
if($value['datos'] < $min_value){
$min_value = $value['datos'];
}
$chart_data[$event_date]["sum" . $series_suffix] = $previous_data;
if($show_unknown) {
$chart_data[$event_date]["unknown" . $series_suffix] = $previous_unknown;
}
$current_event = $events[$i++];
}
if ($v["datos"] === NULL) {
// Unknown
if (!isset($chart_data[$real_date]["event" . $series_suffix])) {
if($show_events) {
$chart_data[$real_date]["event" . $series_suffix] = NULL;
}
if($show_alerts) {
$chart_data[$real_date]["alert" . $series_suffix] = NULL;
}
}
$chart_data[$real_date]["sum" . $series_suffix] = $previous_data;
if($show_unknown) {
$chart_data[$real_date]["unknown" . $series_suffix] = "1";
}
$previous_unknown = "1";
}
elseif($v["datos"] === false) {
// Not Init
$previous_data = $v["datos"];
if (!isset($chart_data[$real_date]["event" . $series_suffix])) {
if ($show_events) {
$chart_data[$real_date]["event" . $series_suffix] = NULL;
}
if ($show_alerts) {
$chart_data[$real_date]["alert" . $series_suffix] = NULL;
}
if ($show_unknown) {
if (!isset($chart_data[$real_date]['unknown'.$series_suffix])) {
$chart_data[$real_date]['unknown'.$series_suffix] = 0;
}
$chart_data[$real_date]['unknown'.$series_suffix] = $unknown_value;
$series_type['unknown'.$series_suffix] = 'area';
}
$chart_data[$real_date]["sum" . $series_suffix] = $v["datos"];
if($v['datos'] >= $max_value){
$max_value = $v['datos'];
if (!empty($event_ids)) {
$chart_extra_data[count($chart_data)-1]['events'] = implode(',',$event_ids);
}
if($v['datos'] <= $min_value){
$min_value = $v['datos'];
}
if($show_unknown) {
$chart_data[$real_date]["unknown" . $series_suffix] = NULL;
$previous_unknown = NULL;
if (!empty($alert_ids)) {
$chart_extra_data[count($chart_data)-1]['alerts'] = implode(',',$alert_ids);
}
}
else {
$previous_data = $v["datos"];
if (!isset($chart_data[$real_date]["event" . $series_suffix])) {
if ($show_events) {
$chart_data[$real_date]["event" . $series_suffix] = NULL;
}
if ($show_alerts) {
$chart_data[$real_date]["alert" . $series_suffix] = NULL;
}
}
$chart_data[$real_date]["sum" . $series_suffix] = $v["datos"];
if($v['datos'] >= $max_value){
$max_value = $v['datos'];
}
if($v['datos'] <= $min_value){
$min_value = $v['datos'];
}
if($show_unknown) {
$chart_data[$real_date]["unknown" . $series_suffix] = NULL;
$previous_unknown = NULL;
}
}
}
if (!is_null($percentil) && $percentil) {
$avg = array_map(function($item) { return $item['sum']; }, $chart_data);
$percentil_result = get_percentile($percentil, $avg);
//Fill the data of chart
array_walk($chart_data, function(&$item) use ($percentil_result, $series_suffix) {
$item['percentil' . $series_suffix] = $percentil_result; });
$series_type['percentil' . $series_suffix] = 'line';
}
}
$series_type['event'.$series_suffix] = 'points';
$series_type['alert'.$series_suffix] = 'points';
$series_type['unknown'.$series_suffix] = 'area';
}
function grafico_modulo_boolean ($agent_module_id, $period, $show_events,

View File

@ -2261,53 +2261,50 @@ function modules_change_relation_lock ($id_relation) {
return ($result !== false ? $new_value : $old_value);
}
/*
* @return utimestamp with the first contact of the module or first contact before datelimit, false if not-init
*/
function modules_get_first_date($id_agent_module, $datelimit = 0) {
function modules_get_count_datas($id_agent_module, $date_init, $date_end) {
$interval = modules_get_interval ($id_agent_module);
// TODO REMOVE THE TIME IN PLANNED DOWNTIME
if (!is_numeric($date_init)) {
$date_init = strtotime($date_init);
}
if (!is_numeric($date_end)) {
$date_end = strtotime($date_end);
}
$first_date = modules_get_first_contact_date($id_agent_module);
if ($date_init < $first_date) {
$date_init = $first_date;
}
$diff = $date_end - $date_init;
return ($diff / $interval);
}
function modules_get_first_contact_date($id_agent_module) {
global $config;
//check datatype string or normal
$table = "tagente_datos";
$module_type_str = modules_get_type_name ($id_agent_module);
if (strstr ($module_type_str, 'string') !== false) {
$table = "tagente_datos_string";
}
$search_historydb = false;
// tagente_estado.first_utimestamp is not valid or is not updated. Scan DBs for first utimestamp
if ($datelimit > 0) {
// get last data before datelimit
$query = " SELECT max(utimestamp) as utimestamp FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agent_module ";
$query .= " AND utimestamp < $datelimit ";
// TODO REMOVE THE TIME IN PLANNED DOWNTIME
}
else {
// get first utimestamp
$query = " SELECT min(utimestamp) as utimestamp FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agent_module ";
}
// TODO FOR OTHER KIND OF DATA
// SEARCH ACTIVE DB
$data = db_get_all_rows_sql($query,$search_historydb);
if (($data === false) || ($data[0]["utimestamp"] === NULL) || ($data[0]["utimestamp"] <= 0)) {
// first utimestamp not found in active database
// SEARCH HISTORY DB
$search_historydb = true;
$data = db_get_all_rows_sql($query,$search_historydb);
}
if (($data === false) || ($data[0]["utimestamp"] === NULL) || ($data[0]["utimestamp"] <= 0)) {
// Nor active DB nor history DB have the data, the module is not-init
return array ("first_utimestamp" => false, "search_historydb" => $search_historydb);
}
// The data has been found
return array ("first_utimestamp" => $data[0]["utimestamp"], "search_historydb" => $search_historydb);
$first_date = db_get_value('utimestamp', 'tagente_datos',
'id_agente_modulo', $id_agent_module,
$config['history_db_enabled']);
return $first_date;
}
/**

View File

@ -3848,6 +3848,9 @@ function reporting_value($report, $content, $type,$pdf) {
$return['agent_name'] = $agent_name;
$return['module_name'] = $module_name;
html_debug($pdf,true);
html_debug($only_image,true);
if($pdf){
$only_image = 1;
}
@ -7760,19 +7763,19 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
if ($links === false) {
$urls = array();
$urls['monitor_critical'] = "index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "&pure=" . $config['pure'];
$urls['monitor_warning'] = "index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_WARNING . "&pure=" . $config['pure'];
$urls['monitor_ok'] = "index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_NORMAL . "&pure=" . $config['pure'];
$urls['monitor_unknown'] = "index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_UNKNOWN . "&pure=" . $config['pure'];
$urls['monitor_not_init'] = "index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_NOT_INIT . "&pure=" . $config['pure'];
}
else {
@ -7872,7 +7875,7 @@ function reporting_get_stats_agents_monitors($data) {
else {
$urls = array();
$urls['total_agents'] = "index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60";
$urls['monitor_checks'] = "index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=-1";
$urls['monitor_checks'] = "index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=-1";
}
// Agents and modules table

View File

@ -2973,6 +2973,11 @@ function ui_print_agent_autocomplete_input($parameters) {
else
$metaconsole_enabled = false;
}
$get_only_string_modules = false;
if (isset($parameters['get_only_string_modules'])) {
$get_only_string_modules = true;
}
$spinner_image = html_print_image('images/spinner.gif', true, false, true);
if (isset($parameters['spinner_image'])) {
@ -3128,6 +3133,10 @@ function ui_print_agent_autocomplete_input($parameters) {
if (' . ((int) $get_order_json) . ') {
inputs.push ("get_order_json=1");
}
if (' . ((int) $get_only_string_modules) . ') {
inputs.push ("get_only_string_modules=1");
}
if (' . ((int)$metaconsole_enabled) . ') {
if ((' . ((int)$use_input_server) . ')

View File

@ -1140,224 +1140,180 @@ function visual_map_print_item($mode = "read", $layoutData,
if ( (get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap') ) {
if($width == 0){
if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) ||
($is_string == 10) || ($is_string == 33)) {
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="../../images/console/signes/barras.png" style="width:400px;height:400px;'.$imgpos.'">';
}
else{
$img = '<img src="images/console/signes/barras.png" style="width:400px;height:400px;'.$imgpos.'">';
}
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="../../images/console/signes/barras.png" style="width:400px;height:400px;'.$imgpos.'">';
}
else {
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="../../images/console/signes/barras-no.png" style="width:400px;height:400px;'.$imgpos.'">';
}
else{
$img = '<img src="images/console/signes/barras-no.png" style="width:400px;height:400px;'.$imgpos.'">';
}
else{
$img = '<img src="images/console/signes/barras.png" style="width:400px;height:400px;'.$imgpos.'">';
}
}
else{
if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) ||
($is_string == 10) || ($is_string == 33)) {
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="../../images/console/signes/barras.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
}
else{
$img = '<img src="images/console/signes/barras.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
}
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="../../images/console/signes/barras.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
}
else {
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="../../images/console/signes/barras-no.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
}
else{
$img = '<img src="images/console/signes/barras-no.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
}
else{
$img = '<img src="images/console/signes/barras.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
}
}
}
else {
if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) ||
($is_string == 10) || ($is_string == 33)) {
$color = array();
$color = array();
$color[0] = array('border' => '#000000',
'color' => $config['graph_color1'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[1] = array('border' => '#000000',
'color' => $config['graph_color2'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[2] = array('border' => '#000000',
'color' => $config['graph_color3'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[3] = array('border' => '#000000',
'color' => $config['graph_color4'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[4] = array('border' => '#000000',
'color' => $config['graph_color5'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[5] = array('border' => '#000000',
'color' => $config['graph_color6'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[6] = array('border' => '#000000',
'color' => $config['graph_color7'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[7] = array('border' => '#000000',
'color' => $config['graph_color8'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[8] = array('border' => '#000000',
'color' => $config['graph_color9'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[9] = array('border' => '#000000',
'color' => $config['graph_color10'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[11] = array('border' => '#000000',
'color' => COL_GRAPH9,
'alpha' => CHART_DEFAULT_ALPHA);
$color[12] = array('border' => '#000000',
'color' => COL_GRAPH10,
'alpha' => CHART_DEFAULT_ALPHA);
$color[13] = array('border' => '#000000',
'color' => COL_GRAPH11,
'alpha' => CHART_DEFAULT_ALPHA);
$color[14] = array('border' => '#000000',
'color' => COL_GRAPH12,
'alpha' => CHART_DEFAULT_ALPHA);
$color[15] = array('border' => '#000000',
'color' => COL_GRAPH13,
'alpha' => CHART_DEFAULT_ALPHA);
$color[0] = array('border' => '#000000',
'color' => $config['graph_color1'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[1] = array('border' => '#000000',
'color' => $config['graph_color2'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[2] = array('border' => '#000000',
'color' => $config['graph_color3'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[3] = array('border' => '#000000',
'color' => $config['graph_color4'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[4] = array('border' => '#000000',
'color' => $config['graph_color5'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[5] = array('border' => '#000000',
'color' => $config['graph_color6'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[6] = array('border' => '#000000',
'color' => $config['graph_color7'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[7] = array('border' => '#000000',
'color' => $config['graph_color8'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[8] = array('border' => '#000000',
'color' => $config['graph_color9'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[9] = array('border' => '#000000',
'color' => $config['graph_color10'],
'alpha' => CHART_DEFAULT_ALPHA);
$color[11] = array('border' => '#000000',
'color' => COL_GRAPH9,
'alpha' => CHART_DEFAULT_ALPHA);
$color[12] = array('border' => '#000000',
'color' => COL_GRAPH10,
'alpha' => CHART_DEFAULT_ALPHA);
$color[13] = array('border' => '#000000',
'color' => COL_GRAPH11,
'alpha' => CHART_DEFAULT_ALPHA);
$color[14] = array('border' => '#000000',
'color' => COL_GRAPH12,
'alpha' => CHART_DEFAULT_ALPHA);
$color[15] = array('border' => '#000000',
'color' => COL_GRAPH13,
'alpha' => CHART_DEFAULT_ALPHA);
$module_data = get_bars_module_data($id_module);
$water_mark = array('file' => '/var/www/html/pandora_console/images/logo_vertical_water.png',
'url' => 'http://localhost/pandora_console/images/logo_vertical_water.png');
if ($width == 0) {
if ($layoutData['label_position']=='left') {
if ($layoutData['type_graph'] == 'horizontal') {
$img = '<div style="float:right;height:'.$himg.'px;">'.
hbar_graph(true, $module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
}
else {
$img = '<div style="float:right;height:'.$himg.'px;">'.
vbar_graph(true, $module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
}
}
elseif($layoutData['label_position']=='right') {
if ($layoutData['type_graph'] == 'horizontal') {
$img = '<div style="float:left;height:'.$himg.'px;">'.
hbar_graph(true, $module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
}
else {
$img = '<div style="float:left;height:'.$himg.'px;">'.
vbar_graph(true, $module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
}
$module_data = get_bars_module_data($id_module);
$water_mark = array('file' => '/var/www/html/pandora_console/images/logo_vertical_water.png',
'url' => 'http://localhost/pandora_console/images/logo_vertical_water.png');
if ($width == 0 && $height == 0) {
if ($layoutData['label_position']=='left') {
if ($layoutData['type_graph'] == 'horizontal') {
$img = '<div style="float:right;height:'.$himg.'px;">'.
hbar_graph(true, $module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
}
else {
if ($layoutData['type_graph'] == 'horizontal') {
$img = hbar_graph(true, $module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
}
else {
$img = vbar_graph(true, $module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']);
}
$img = '<div style="float:right;height:'.$himg.'px;">'.
vbar_graph(true, $module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
}
}
else{
if ($layoutData['label_position']=='left') {
if ($layoutData['type_graph'] == 'horizontal') {
$img = '<div style="float:right;height:'.$himg.'px;">'.
hbar_graph(true, $module_data,
$width, $width, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
}
else {
$img = '<div style="float:right;height:'.$himg.'px;">'.
vbar_graph(true, $module_data,
$width, $width, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
}
}
elseif($layoutData['label_position']=='right') {
if ($layoutData['type_graph'] == 'horizontal') {
$img = '<div style="float:left;height:'.$himg.'px;">'.
hbar_graph(true, $module_data,
$width, $width, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
}
else {
$img = '<div style="float:left;height:'.$himg.'px;">'.
vbar_graph(true, $module_data,
$width, $width, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
}
elseif($layoutData['label_position']=='right') {
if ($layoutData['type_graph'] == 'horizontal') {
$img = '<div style="float:left;height:'.$himg.'px;">'.
hbar_graph(true, $module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
}
else {
if ($layoutData['type_graph'] == 'horizontal') {
$img = hbar_graph(true, $module_data,
$width, $width, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
}
else {
$img = vbar_graph(true, $module_data,
$width, $width, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']);
}
$img = '<div style="float:left;height:'.$himg.'px;">'.
vbar_graph(true, $module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
}
}
else {
if ($layoutData['type_graph'] == 'horizontal') {
$img = hbar_graph(true, $module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
}
else {
$img = vbar_graph(true, $module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']);
}
}
}
else {
if($width == 0){
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="../../images/console/signes/barras-no.png" style="width:400px;height:400px;'.$imgpos.'">';
else{
if ($layoutData['label_position']=='left') {
if ($layoutData['type_graph'] == 'horizontal') {
$img = '<div style="float:right;height:'.$himg.'px;">'.
hbar_graph(true, $module_data,
$width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
}
else{
$img = '<img src="images/console/signes/barras-no.png" style="width:400px;height:400px;'.$imgpos.'">';
else {
$img = '<div style="float:right;height:'.$himg.'px;">'.
vbar_graph(true, $module_data,
$width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
}
}
else{
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="../../images/console/signes/barras-no.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
elseif($layoutData['label_position']=='right') {
if ($layoutData['type_graph'] == 'horizontal') {
$img = '<div style="float:left;height:'.$himg.'px;">'.
hbar_graph(true, $module_data,
$width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
}
else{
$img = '<img src="images/console/signes/barras-no.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
else {
$img = '<div style="float:left;height:'.$himg.'px;">'.
vbar_graph(true, $module_data,
$width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
}
}
else {
if ($layoutData['type_graph'] == 'horizontal') {
$img = hbar_graph(true, $module_data,
$width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
}
else {
$img = vbar_graph(true, $module_data,
$width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']);
}
}
}
@ -1436,7 +1392,7 @@ function visual_map_print_item($mode = "read", $layoutData,
}
else {
if ($width == 0) {
$img = d3_donut_graph ($layoutData['id'], 400, 400, $donut_data, $layoutData['border_color']);
$img = d3_donut_graph ($layoutData['id'], 300, 300, $donut_data, $layoutData['border_color']);
}
else{
$img = d3_donut_graph ($layoutData['id'], $width, $width, $donut_data, $layoutData['border_color']);
@ -2182,7 +2138,7 @@ function get_bars_module_data ($id_module) {
$color_index = 0;
$total = 0;
foreach ($values as $val) {
$data = explode(":", $val);
$data = explode(",", $val);
$values_to_return[$data[0]] = array('g' =>$data[1]);
}
@ -2583,16 +2539,22 @@ function get_donut_module_data ($id_module) {
$total = 0;
foreach ($values as $val) {
if ($index < $max_elements) {
$data = explode(":", $val);
$values_to_return[$index]['tag_name'] = $data[0] . ", " . $data[1];
$data = explode(",", $val);
if ($data[1] == 0) {
$data[1] = __('No data');
}
$values_to_return[$index]['tag_name'] = $data[0] . ": " . $data[1];
$values_to_return[$index]['color'] = $colors[$index];
$values_to_return[$index]['value'] = (int)$data[1];
$total += (int)$data[1];
$index++;
}
else {
$data = explode(":", $val);
$values_to_return[$index]['tag_name'] = __('Others') . ", " . $data[1];
if ($data[1] == 0) {
$data[1] = __('No data');
}
$data = explode(",", $val);
$values_to_return[$index]['tag_name'] = __('Others') . ": " . $data[1];
$values_to_return[$index]['color'] = $colors[$index];
$values_to_return[$index]['value'] += (int)$data[1];
$total += (int)$data[1];
@ -2603,6 +2565,33 @@ function get_donut_module_data ($id_module) {
$values_to_return[$ind]['percent'] = ($donut_data['value'] * 100) / $total;
}
$new_values_to_return = array();
while (!empty($values_to_return)) {
$first = true;
$max_elem = 0;
$max_elem_array = array();
$index_to_del = 0;
foreach ($values_to_return as $i => $val) {
if ($first) {
$max_elem = $val['value'];
$max_elem_array = $val;
$index_to_del = $i;
$first = false;
}
else {
if ($val['value'] > $max_elem) {
$max_elem = $val['value'];
$max_elem_array = $val;
$index_to_del = $i;
}
}
}
$new_values_to_return[] = $max_elem_array;
unset($values_to_return[$index_to_del]);
}
$values_to_return = $new_values_to_return;
return $values_to_return;
}
@ -2923,7 +2912,26 @@ function visual_map_get_status_element($layoutData) {
//Linked to other layout ?? - Only if not module defined
if ($layoutData['id_layout_linked'] != 0) {
$status = visual_map_get_layout_status ($layoutData['id_layout_linked']);
if ($layoutData['id_layout_linked_weight'] != 0) {
$calculate_weight = true;
}
else {
$calculate_weight = false;
}
$status = visual_map_get_layout_status ($layoutData['id_layout_linked'], 0, 0, $calculate_weight);
if ($layoutData['id_layout_linked_weight'] > 0) {
$elements_to_compare = db_get_all_rows_sql("SELECT id FROM tlayout_data WHERE type = 0 AND id_layout = " . $layoutData['id_layout_linked']);
$aux_weight = ($status['elements_in_critical'] / count($elements_to_compare)) * 100;
if ($aux_weight >= $layoutData['id_layout_linked_weight']) {
$status = $status['temp_total'];
}
else {
$status = VISUAL_MAP_STATUS_NORMAL;
}
}
}
else {
switch ($layoutData["type"]) {
@ -3372,7 +3380,7 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
*
* @return bool The status of the given layout. True if it's OK, false if not.
*/
function visual_map_get_layout_status ($id_layout = 0, $depth = 0) {
function visual_map_get_layout_status ($id_layout = 0, $depth = 0, $elements_in_critical = 0, $calculate_weight = false) {
$temp_status = VISUAL_MAP_STATUS_NORMAL;
$temp_total = VISUAL_MAP_STATUS_NORMAL;
$depth++; // For recursion depth checking
@ -3392,7 +3400,10 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) {
'parent_item',
'id_layout_linked',
'id_agent',
'type'));
'type',
'id_layout_linked_weight',
'id',
'id_layout'));
if ($result === false)
return VISUAL_MAP_STATUS_NORMAL;
@ -3434,12 +3445,29 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) {
// Other Layout (Recursive!)
if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) {
$status = visual_map_get_layout_status($data["id_layout_linked"], $depth);
if ($data['id_layout_linked_weight'] > 0) {
$calculate_weight_c = true;
}
else {
$calculate_weight_c = false;
}
$status = visual_map_get_layout_status($data["id_layout_linked"], $depth, 0, $calculate_weight_c);
$elements_in_child = db_get_all_rows_sql("SELECT id FROM tlayout_data WHERE type = 0 AND id_layout = " . $data['id_layout_linked']);
if ($calculate_weight_c) {
$aux_weight = ($status['elements_in_critical'] / count($elements_in_child)) * 100;
if ($aux_weight >= $data['id_layout_linked_weight']) {
$status = $status['temp_total'];
}
else {
$status = VISUAL_MAP_STATUS_NORMAL;
}
}
}
// Module
elseif ($data["id_agente_modulo"] != 0) {
$status = modules_get_agentmodule_status($data["id_agente_modulo"]);
}
// Agent
else {
@ -3453,11 +3481,23 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) {
break;
}
if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD)
return VISUAL_MAP_STATUS_CRITICAL_BAD;
if ($calculate_weight) {
if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD || $status == VISUAL_MAP_STATUS_WARNING) {
$elements_in_critical++;
}
}
else {
if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) {
return VISUAL_MAP_STATUS_CRITICAL_BAD;
}
if ($status > $temp_total)
}
if ($status > $temp_total) {
$temp_total = $status;
}
}
if ($calculate_weight) {
return array('elements_in_critical' => $elements_in_critical, 'temp_total' => $temp_total);
}
return $temp_total;

View File

@ -290,7 +290,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['agent_row'] = array();
$form_items['agent_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'datos', 'auto_sla_graph', 'bars_graph', 'donut_graph');
'simple_value', 'datos', 'auto_sla_graph');
$form_items['agent_row']['html'] = '<td align="left">' .
__('Agent') . '</td>';
$params = array();
@ -320,6 +320,39 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['agent_row']['html'] .= '<td align="left">' .
ui_print_agent_autocomplete_input($params) .
'</td>';
$form_items['agent_row_string'] = array();
$form_items['agent_row_string']['items'] = array('donut_graph', 'bars_graph');
$form_items['agent_row_string']['html'] = '<td align="left">' .
__('Agent') . '</td>';
$params = array();
$params['return'] = true;
$params['show_helptip'] = true;
$params['input_name'] = 'agent_string';
$params['size'] = 30;
$params['selectbox_id'] = 'module';
$params['javascript_is_function_select'] = true;
$params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent_string';
$params['get_order_json'] = true;
$params['get_only_string_modules'] = true;
if (defined('METACONSOLE')) {
$params['javascript_ajax_page'] = '../../ajax.php';
$params['disabled_javascript_on_blur_function'] = true;
$params['print_input_server'] = true;
$params['print_input_id_server'] = true;
$params['input_server_id'] = 'id_server_name';
$params['input_id_server_name'] = 'id_server_metaconsole';
$params['input_server_value'] = '';
$params['use_input_id_server'] = true;
$params['metaconsole_enabled'] = true;
$params['print_hidden_input_idagent'] = true;
}
$form_items['agent_row_string']['html'] .= '<td align="left">' .
ui_print_agent_autocomplete_input($params) .
'</td>';
$form_items['module_row'] = array();
$form_items['module_row']['items'] = array('static_graph',
@ -426,7 +459,12 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['percentile_bar_row_1']['html'] = '<td align="left">' .
__('Width') . '</td>
<td align="left">' . html_print_input_text('width_percentile', 0, '', 3, 5, true) . '</td>';
$form_items['height_bars_graph_row'] = array();
$form_items['height_bars_graph_row']['items'] = array('bars_graph');
$form_items['height_bars_graph_row']['html'] = '<td align="left">' .
__('Height') . '</td>
<td align="left">' . html_print_input_text('bars_graph_height', 0, '', 3, 5, true) . '</td>';
$form_items['percentile_bar_row_2'] = array();
$form_items['percentile_bar_row_2']['items'] = array('percentile_bar', 'percentile_item', 'datos');
@ -621,6 +659,33 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
WHERE id != ' . $visualConsole_id, 'map_linked', '', '', 'None', '0', true) .
'</td>';
$form_items_advance['map_linked_weight'] = array();
$form_items_advance['map_linked_weight']['items'] = array('static_graph');
$form_items_advance['map_linked_weight']['html'] = '<td align="left">'.
__('Map linked weight') . '</td>' .
'<td align="left">' . html_print_select(array('10' => '10%',
'20' => '20%',
'30' => '30%',
'40' => '40%',
'50' => '50%',
'60' => '60%',
'70' => '70%',
'80' => '80%',
'90' => '90%',
'100' => '100%'),
'map_linked_weight', '', '', __('By default'), 0, true) .
ui_print_help_tip (
__("This percentage value specifies the number of items that must be present in the visual
console for it to transmit its status to the icon linked here. For example, if 20% is
specified and there are five elements in the console, it would be enough if you were in
WARNING or CRITICAL to pass that value to the icon. If it were 40%, you would need at
least two elements to be in CRITICAL or WARNING to go into that status. If it had one
element in critical and another in warning, it would not forward any status to the icon
associated with the visual console. If we had three in warning and one in critical,
it would only convey the warning status. If there were two in warning and two in critical,
it would show the CRITICAL because it is more serious. The same applies to unknown status."), true) .
'</td>';
$form_items_advance['line_case']['items'] = array('line_item');
$form_items_advance['line_case']['html'] = '
<td align="left">' . __('Lines haven\'t advanced options') . '</td>';
@ -741,7 +806,7 @@ function visual_map_editor_print_toolbox() {
visual_map_print_button_editor('static_graph', __('Static Graph'), 'left', false, 'camera_min', true);
visual_map_print_button_editor('percentile_item', __('Percentile Item'), 'left', false, 'percentile_item_min', true);
visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true);
visual_map_print_button_editor('donut_graph', __('Donut Graph'), 'left', false, 'donut_graph_min', true);
visual_map_print_button_editor('donut_graph', __('Serialized pie graph'), 'left', false, 'donut_graph_min', true);
visual_map_print_button_editor('bars_graph', __('Bars Graph'), 'left', false, 'bars_graph_min', true);
visual_map_print_button_editor('auto_sla_graph', __('Auto SLA Graph'), 'left', false, 'auto_sla_graph_min', true);
visual_map_print_button_editor('simple_value', __('Simple Value'), 'left', false, 'binary_min', true);
@ -804,6 +869,8 @@ function visual_map_editor_print_hack_translate_strings() {
__('No Max value defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_width_percentile">' .
__('No width defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_bars_graph_height">' .
__('No height defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_period">' .
__('No period defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_agent">' .
@ -816,4 +883,18 @@ function visual_map_editor_print_hack_translate_strings() {
echo '<span style="display: none" id="hack_translation_incorrect_save">' .
__('Could not be save') .'</span>';
}
?>
?>
<script type="text/javascript">
$(document).ready (function () {
$("#map_linked").change(function () {
$("#text-agent").val("");
$("input[name=id_agent]").val(0);
$("#module").empty();
$("#module")
.append($("<option>")
.attr("value", 0)
.html("<?php echo __('Any'); ?>"));
})
});
</script>

View File

@ -1767,11 +1767,9 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
if (timesize+timenewpos > canvaslimit) {
$('#timestamp_'+graph_id).css('left', timenewpos - timesize);
$('#timestamp_'+graph_id).css('top', 50);
}
else {
$('#timestamp_'+graph_id).css('left', timenewpos);
$('#timestamp_'+graph_id).css('top', 50);
}
}
else {
@ -1814,16 +1812,24 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
plot.unhighlight();
if (item && item.series.label != '' && (item.series.label == legend_events || item.series.label == legend_events+series_suffix_str || item.series.label == legend_alerts || item.series.label == legend_alerts+series_suffix_str)) {
plot.unhighlight();
var canvaslimit = parseInt(plot.offset().left + plot.width());
var dataset = plot.getData();
var timenewpos = parseInt(dataset[0].xaxis.p2c(pos.x)+plot.offset().left);
var extrasize = parseInt($('#extra_'+graph_id).css('width').split('px')[0]);
var left_pos;
if (extrasize+timenewpos > canvaslimit) {
left_pos = timenewpos - extrasize - 20;
}
else {
left_pos = timenewpos - (extrasize / 2);
}
var extra_info = '<i>No info to show</i>';
var extra_show = false;
var coord_x = (item.dataIndex/item.series.xaxis.datamax)* (event.target.clientWidth - event.target.offsetLeft + 1) + event.target.offsetLeft;
$('#extra_'+graph_id).css('left',coord_x);
$('#extra_'+graph_id).css('top', event.target.offsetTop + 55 );
$('#extra_'+graph_id).css('left',left_pos);
$('#extra_'+graph_id).css('top',plot.offset().top + 25);
switch(item.series.label) {
case legend_alerts+series_suffix_str:

View File

@ -185,6 +185,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
include_javascript_dependencies_flot_graph();
$menu = (int)$menu;
// Get a unique identifier to graph
$graph_id = uniqid('graph_');
@ -499,7 +500,6 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
$short_data = false;
}
// Javascript code
$return .= "<script type='text/javascript'>";
$return .= "$(document).ready( function () {";

View File

@ -1985,47 +1985,40 @@ function print_donut_graph (recipient, width, height, module_data, resume_color)
var radius = 120;
var increment_y = 60;
var increment_y_padding = 25;
var text_size = 15;
var decrement_x_padding = 150;
if (width >= 500) {
radius = 160;
radius = 180;
increment_y = 60;
text_size = 25;
increment_y_padding = 25;
decrement_x_padding = 75;
increment_y_padding = 20;
decrement_x_padding = 40;
}
else if (width >= 400) {
radius = 120;
increment_y = 60;
text_size = 22;
increment_y_padding = 25;
decrement_x_padding = 75;
radius = 140;
increment_y = 40;
increment_y_padding = 20;
decrement_x_padding = 40;
}
else if (width >= 300) {
radius = 80;
radius = 100;
increment_y = 40;
text_size = 14;
increment_y_padding = 20;
decrement_x_padding = 60;
increment_y_padding = 15;
decrement_x_padding = 40;
}
else if (width >= 200) {
radius = 50;
increment_y = 40;
text_size = 14;
increment_y_padding = 15;
decrement_x_padding = 45;
decrement_x_padding = 25;
}
else if (width >= 100) {
radius = 20;
increment_y = 20;
text_size = 10;
increment_y_padding = 8;
decrement_x_padding = 25;
}
else {
radius = 10;
increment_y = 10;
text_size = 4;
increment_y_padding = 3;
decrement_x_padding = 5;
}
@ -2041,15 +2034,24 @@ function print_donut_graph (recipient, width, height, module_data, resume_color)
.value(function(d) {
return parseFloat(d.percent);
});
console.log(resume_color);
jQuery.each(module_data, function (key, m_d) {
svg.append("g")
.append("rect")
.attr("transform", "translate(" + (((width / 2) - (radius + decrement_x_padding))) + "," + (((height / 2) - radius) - increment_y) + ")")
.attr('fill', m_d.color)
.attr('x', -20)
.attr('y', -10)
.attr('width', 20)
.attr('height', 10);
svg.append("g")
.append("text")
.attr('fill', resume_color)
.attr("transform", "translate(" + (((width / 2) - (radius + decrement_x_padding))) + "," + (((height / 2) - radius) - increment_y) + ")")
.attr("transform", "translate(" + (((width / 2) - (radius + decrement_x_padding)) + 10) + "," + (((height / 2) - radius) - increment_y) + ")")
.text(m_d.tag_name)
.style("font-family", "Verdana")
.style("font-size", text_size + "px");
.style("font-family", "smallfontFont")
.style("font-size", "7pt");
increment_y -= increment_y_padding;
});

View File

@ -70,8 +70,8 @@
<body>
<div style='height: 10px'>
<?php
$version = '7.0NG.714';
$build = '171108';
$version = '7.0NG.715';
$build = '171115';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -625,7 +625,7 @@ $data[0][0] .=
__('Events (24h)') .
'</th></tr>' .
'<tr><td style="text-align:center;padding-left:20px;padding-right:20px;"><br />' .
graph_graphic_agentevents ($id_agente, 450, 15, SECONDS_1DAY, '', true, true) .
graph_graphic_agentevents ($id_agente, 450, 40, SECONDS_1DAY, '', true, true) .
'<br /></td></tr>' .
'</table>';

View File

@ -111,6 +111,8 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
$id = (int) get_parameter ("id", 0);
// Agent id
$agent_id = (int) modules_get_agentmodule_agent($id);
// Kind module
$type_module = modules_get_agentmodule_kind($id);
if (empty($id) || empty($agent_id)) {
ui_print_error_message(__('There was a problem locating the source of the graph'));
@ -169,6 +171,7 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
$time_compare_overlapped = get_parameter ("time_compare_overlapped", 0);
$unknown_graph = get_parameter_checkbox ("unknown_graph", 1);
//$type_module == 'predictionserver';
$fullscale_sent = get_parameter ("fullscale_sent", 0);
if(!$fullscale_sent){
if(!isset($config['full_scale_option']) || $config['full_scale_option'] == 0){
@ -420,12 +423,14 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
break;
}
$data = array();
$data[0] = __('Show full scale graph (TIP)');
$data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale,
true, false);
$table->data[] = $data;
$table->rowclass[] = '';
if($type_module != 'predictionserver'){
$data = array();
$data[0] = __('Show full scale graph (TIP)');
$data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale,
true, false);
$table->data[] = $data;
$table->rowclass[] = '';
}
$form_table = html_print_table($table, true);

View File

@ -589,6 +589,11 @@ if (is_ajax ()) {
if (empty($filter))
$filter = false;
$get_only_string_modules = get_parameter('get_only_string_modules', false);
if ($get_only_string_modules) {
$filter['tagente_modulo.id_tipo_modulo IN'] = "(17,23,3,10,33)";
}
// Status selector
if ($status_modulo == AGENT_MODULE_STATUS_NORMAL) { //Normal
$sql_conditions .= ' estado = 0 AND utimestamp > 0 )

View File

@ -13,7 +13,6 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
@ -671,8 +670,6 @@ if ($event_w || $event_m) {
$data[0] .= '<a href="javascript:" onclick="show_load_filter_dialog();">' .
html_print_image("images/load.png", true, array("border" => '0', "title" => __('Load filter'), "alt" => __('Load filter'))) . '</a> &nbsp;';
$data[0] .= '<a id="events_graph_link" href="javascript: show_events_graph_dialog()">' .
html_print_image('images/chart_curve.png', true, array('title' => __('Show events graph'))) . '</a> <br />';
$data[0] .= '</div>';
@ -787,8 +784,6 @@ elseif ($group_rep == 2) {
$history);
}
// Active filter tag view call (only enterprise version)
// It is required to pass some references to enterprise function
// to translate the active filters
@ -803,87 +798,6 @@ enterprise_hook('print_event_tags_active_filters',
)
);
if (!empty($result)) {
if ($group_rep == 0) {
$sql = "SELECT COUNT(id_evento)
FROM $event_table
WHERE 1=1 " . $sql_post;
}
elseif ($group_rep == 1) {
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$sql = "SELECT COUNT(1)
FROM (SELECT 1
FROM $event_table
WHERE 1=1 " . $sql_post . "
GROUP BY evento, id_agentmodule) t";
break;
case "oracle":
$sql = "SELECT COUNT(1)
FROM (SELECT 1
FROM $event_table
WHERE 1=1 " . $sql_post . "
GROUP BY to_char(evento), id_agentmodule) t";
break;
}
}
elseif ($group_rep == 2) {
}
$limit = (int) db_get_sql ($sql);
if ($group_rep == 0) {
switch ($config["dbtype"]) {
case "mysql":
$sql = "SELECT *, 1 event_rep
FROM $event_table
WHERE 1=1 " . $sql_post . "
ORDER BY utimestamp DESC LIMIT 0,".$limit;
break;
case "postgresql":
$sql = "SELECT *, 1 event_rep
FROM $event_table
WHERE 1=1 " . $sql_post . "
ORDER BY utimestamp DESC LIMIT ".$limit." OFFSET 0";
break;
case "oracle":
$set = array();
$set['limit'] = $pagination;
$set['offset'] = $offset;
$sql = "SELECT $event_table.*, 1 event_rep
FROM $event_table
WHERE 1=1 " . $sql_post . "
ORDER BY utimestamp DESC";
$sql = oracle_recode_query ($sql, $set);
break;
}
//Extract the events by filter (or not) from db
$results_graph = db_get_all_rows_sql ($sql);
}
elseif ($group_rep == 1) {
$results_graph = events_get_events_grouped($sql_post,
0,
$limit,
$meta,
$history);
}
elseif ($group_rep == 2) {
}
if (($group_rep == 1) OR ($group_rep == 0)) {
$graph = '<div style="width: 350px; margin: 0 auto;">' .
grafico_eventos_agente(350, 185,
$results_graph, $meta, $history, $tags_acls_condition,$limit) .
'</div>';
html_print_div(array('id' => 'events_graph',
'hidden' => true, 'content' => $graph));
}
}
if (!empty($result)) {
//~ Checking the event tags exactly. The event query filters approximated tags to keep events
//~ with several tags
@ -986,11 +900,6 @@ $(document).ready( function() {
$("#text-date_from, #text-date_to").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
// If the events are not charged, dont show graphs link
if ($('#events_graph').val() == undefined) {
$('#events_graph_link').hide();
}
// Don't collapse filter if update button has been pushed
if ($("#hidden-open_filter").val() == 'true') {
$("#event_control").toggle();
@ -1658,23 +1567,6 @@ function reorder_tags_inputs() {
}
}
// Show the modal window of an module
function show_events_graph_dialog() {
$("#events_graph").hide ()
.dialog ({
resizable: true,
draggable: true,
title: '<?php echo __('Events generated -by agent-'); ?>',
modal: true,
overlay: {
opacity: 0.5,
background: "black"
},
width: 450,
height: 380
})
.show ();
}
/* ]]> */
//function datetime

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.714
%define release 171108
%define version 7.0NG.715
%define release 171115
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.714
%define release 171108
%define version 7.0NG.715
%define release 171115
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -9,7 +9,7 @@
# This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.714"
PI_VERSION="7.0NG.715"
FORCE=0
DESTDIR=""
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`

View File

@ -85,6 +85,7 @@ CREATE TABLE IF NOT EXISTS `tagente` (
`alias` varchar(600) BINARY NOT NULL default '',
`transactional_agent` tinyint(1) NOT NULL default '0',
`alias_as_name` tinyint(2) NOT NULL default '0',
`safe_mode_module` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id_agente`),
KEY `nombre` (`nombre`(255)),
KEY `direccion` (`direccion`),
@ -1362,6 +1363,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` (
`border_color` varchar(200) DEFAULT "",
`fill_color` varchar(200) DEFAULT "",
`show_statistics` tinyint(2) NOT NULL default '0',
`id_layout_linked_weight` int(10) NOT NULL default '0',
`element_group` int(10) NOT NULL default '0',
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -109,10 +109,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''),
('custom_report_front_footer', ''),
('MR', 7),
('MR', 8),
('identification_reminder', 1),
('identification_reminder_timestamp', 0),
('current_package_enterprise', '714'),
('current_package_enterprise', '715'),
('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.0009765625":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}');
UNLOCK TABLES;

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.714-171108
Version: 7.0NG.715-171115
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.714-171108"
pandora_version="7.0NG.715-171115"
package_cpan=0
package_pandora=1

View File

@ -1,7 +1,7 @@
#############################################################################
# Pandora FMS Server Parameters
# Pandora FMS, the Flexible Monitoring System.
# Version 7.0NG.714
# Version 7.0NG.715
# Licensed under GPL license v2,
# (c) 2003-2017 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -42,8 +42,8 @@ our @EXPORT = qw(
);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.714";
my $pandora_build = "171108";
my $pandora_version = "7.0NG.715";
my $pandora_build = "171115";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -2,8 +2,8 @@
# Pandora FMS Server
#
%define name pandorafms_server
%define version 7.0NG.714
%define release 171108
%define version 7.0NG.715
%define release 171115
Summary: Pandora FMS Server
Name: %{name}

View File

@ -2,8 +2,8 @@
# Pandora FMS Server
#
%define name pandorafms_server
%define version 7.0NG.714
%define release 171108
%define version 7.0NG.715
%define release 171115
Summary: Pandora FMS Server
Name: %{name}

View File

@ -8,8 +8,8 @@
# This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.714"
PI_BUILD="171108"
PI_VERSION="7.0NG.715"
PI_BUILD="171115"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.714 PS171108";
my $version = "7.0NG.715 PS171115";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.714 PS171108";
my $version = "7.0NG.715 PS171115";
# save program name for logging
my $progname = basename($0);

View File

@ -45,7 +45,7 @@ ln -s $PWR_FIREFOX_INSTALLDIR/firefox/firefox /usr/bin/firefox
# Generate logrotate configuration
echo <<EO_LROTATE > /etc/logrotate.d/pwrd
cat > /etc/logrotate.d/pwrd <<EO_LROTATE
/var/log/pwr/pwr_std.log
/var/log/pwr/pwr_error.log {
weekly