Merge remote-tracking branch 'origin/develop' into 2078-ue-cmdb-integration

This commit is contained in:
fbsanchez 2018-09-05 16:52:18 +02:00
commit d46240a200
131 changed files with 4325 additions and 4454 deletions

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.725, AIX version
# Version 7.0NG.726, 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.725, FreeBSD Version
# Version 7.0NG.726, 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.725, HP-UX Version
# Version 7.0NG.726, 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.725, GNU/Linux
# Version 7.0NG.726, 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.725, GNU/Linux
# Version 7.0NG.726, 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.725, Solaris Version
# Version 7.0NG.726, 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.725
# Version 7.0NG.726
# 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.725, AIX version
# Version 7.0NG.726, 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.725
# Version 7.0NG.726
# 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.725, HPUX Version
# Version 7.0NG.726, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.725
# Version 7.0NG.726
# 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.725
# Version 7.0NG.726
# 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.725
# Version 7.0NG.726
# 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.725, Solaris version
# Version 7.0NG.726, Solaris version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.725, AIX version
# Version 7.0NG.726, 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.725-180810
Version: 7.0NG.726-180905
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.725-180810"
pandora_version="7.0NG.726-180905"
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.725, GNU/Linux
# Version 7.0NG.726, 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.725, FreeBSD Version
# Version 7.0NG.726, 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.725, HP-UX Version
# Version 7.0NG.726, 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.725, GNU/Linux
# Version 7.0NG.726, 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.725, GNU/Linux
# Version 7.0NG.726, 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.725, NetBSD Version
# Version 7.0NG.726, 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.725, Solaris Version
# Version 7.0NG.726, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -41,8 +41,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.725';
use constant AGENT_BUILD => '180810';
use constant AGENT_VERSION => '7.0NG.726';
use constant AGENT_BUILD => '180905';
# 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.725
%define release 180810
%define version 7.0NG.726
%define release 180905
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.725
%define release 180810
%define version 7.0NG.726
%define release 180905
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.725"
PI_BUILD="180810"
PI_VERSION="7.0NG.726"
PI_BUILD="180905"
OS_NAME=`uname -s`
FORCE=0

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas
# Version 7.0NG.725
# Version 7.0NG.726
# 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.725}
{Pandora FMS Windows Agent v7.0NG.726}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{180810}
{180905}
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.725(Build 180810)")
#define PANDORA_VERSION ("7.0NG.726(Build 180905)")
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.725(Build 180810))"
VALUE "ProductVersion", "(7.0NG.726(Build 180905))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.725-180810
Version: 7.0NG.726-180905
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.725-180810"
pandora_version="7.0NG.726-180905"
package_pear=0
package_pandora=1

View File

@ -77,15 +77,6 @@ $isFunctionSkins = enterprise_include_once ('include/functions_skins.php');
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK)
$config["relative_path"] = enterprise_hook('skins_set_image_skin_path',array($config['id_user']));
// Load user language
$user_language = get_user_language ($config['id_user']);
$l10n = NULL;
if (file_exists ('./include/languages/'.$user_language.'.mo')) {
$l10n = new gettext_reader (new CachedFileReader ('./include/languages/'.$user_language.'.mo'));
$l10n->load_tables();
}
if (isset($config['metaconsole'])) {
// Not cool way of know if we are executing from metaconsole or normal console
if ($config['metaconsole'])

View File

@ -128,43 +128,20 @@ function mainModuleGroups() {
require_once($config['homedir'] . "/include/functions_users.php");
//The big query
switch ($config["dbtype"]) {
case "mysql":
$sql = "SELECT COUNT(id_agente) AS count, case utimestamp when 0 then 5 else estado end as estado
FROM tagente_estado
WHERE id_agente IN
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND disabled IS FALSE)
AND id_agente_modulo IN
(SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_module_group = %d AND disabled IS FALSE AND delete_pending IS FALSE)
GROUP BY estado";
break;
case "postgresql":
$sql = "SELECT COUNT(id_agente) AS count,
case utimestamp when 0 then 5 else estado end as estado
FROM tagente_estado
WHERE id_agente IN
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND disabled = 0)
AND id_agente_modulo IN
(SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_module_group = %d AND disabled = 0 AND delete_pending = 0)
GROUP BY estado, utimestamp";
break;
case "oracle":
$sql = "SELECT COUNT(id_agente) AS count, (case when utimestamp = 0 then 5 else estado end) AS estado
FROM tagente_estado
WHERE id_agente IN
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND (disabled IS NOT NULL AND disabled <> 0))
AND id_agente_modulo IN
(SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_module_group = %d AND (disabled IS NOT NULL AND disabled <> 0) AND (delete_pending IS NOT NULL AND delete_pending <> 0))
GROUP BY (case when utimestamp = 0 then 5 else estado end)";
break;
}
$sql = "SELECT COUNT(id_agente) AS count, case utimestamp when 0 then 5 else estado end as estado
FROM tagente_estado
WHERE id_agente IN
(SELECT id_agente
FROM tagente ta LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent
WHERE (ta.id_grupo = %d OR tasg.id_group = %d) AND disabled IS FALSE
)
AND id_agente_modulo IN
(SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_module_group = %d AND disabled IS FALSE AND delete_pending IS FALSE)
GROUP BY estado";
ui_print_page_header (__("Combined table of agent group and module group"), "images/module_group.png", false, "", false, '');
ui_print_info_message ( array('no_close'=>true, 'message'=>
@ -207,7 +184,7 @@ function mainModuleGroups() {
foreach ($modelGroups as $idModelGroup => $modelGroup) {
$fired = false;
$query = sprintf($sql, $idAgentGroup, $idModelGroup);
$query = sprintf($sql, $idAgentGroup, $idAgentGroup, $idModelGroup);
$rowsDB = db_get_all_rows_sql ($query);

View File

@ -61,6 +61,16 @@
var timestamp = serie.data[0][0];
var data = plot.getData();
if (incremental) {
var currentVal = serie.data[0][1];
// Try to avoid the first value, cause we need at least two values to get the increment
serie.data[0][1] = lastIncVal == null ? 0 : currentVal - lastIncVal;
// Incremental is always positive
if (serie.data[0][1] < 0) serie.data[0][1] = 0;
// Store the current value to use it into the next request
lastIncVal = currentVal;
}
if (data.length === 0) {
for (i = 0; i < numberOfPoints; i++) {
var step = i * (refresh / 1000);
@ -77,16 +87,6 @@
data[0].data.shift();
}
if (incremental) {
var currentVal = serie.data[0][1];
// Try to avoid the first value, cause we need at least two values to get the increment
serie.data[0][1] = lastIncVal == null ? 0 : currentVal - lastIncVal;
// Incremental is always positive
if (serie.data[0][1] < 0) serie.data[0][1] = 0;
// Store the current value to use it into the next request
lastIncVal = currentVal;
}
data[0].data.push(serie.data[0]);
updatePlot(data);
}

View File

@ -53,4 +53,26 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Rename column is_secondary to no_hierarchy in `tusuario _perfil`
-- ---------------------------------------------------------------------
ALTER TABLE `tusuario_perfil` ADD COLUMN `no_hierarchy` tinyint(1) NOT NULL DEFAULT 0;
UPDATE `tusuario_perfil` SET `no_hierarchy` = `is_secondary`;
ALTER TABLE `tusuario_perfil` DROP COLUMN `is_secondary`;
UPDATE `talert_commands` SET name='Monitoring&#x20;Event' WHERE name='Pandora&#x20;FMS&#x20;Event';
-- -----------------------------------------------------
-- Table `tgis_map_layer_groups`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tgis_map_layer_groups` (
`layer_id` INT NOT NULL,
`group_id` MEDIUMINT(4) UNSIGNED NOT NULL,
`agent_id` INT(10) UNSIGNED NOT NULL COMMENT 'Used to link the position to the group',
PRIMARY KEY (`layer_id`, `group_id`),
FOREIGN KEY (`layer_id`) REFERENCES `tgis_map_layer` (`id_tmap_layer`) ON DELETE CASCADE,
FOREIGN KEY (`group_id`) REFERENCES `tgrupo` (`id_grupo`) ON DELETE CASCADE,
FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT;

View File

@ -0,0 +1,19 @@
START TRANSACTION;
ALTER TABLE treport_content ADD COLUMN `recursion` TINYINT(1) default NULL;
ALTER TABLE tevent_filter ADD COLUMN `user_comment` text NOT NULL;
ALTER TABLE tevent_filter ADD COLUMN `source` tinytext NOT NULL;
ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL;
ALTER TABLE tagente_modulo ALTER COLUMN `parent_module_id` SET default 0;
-- Changes for the 'service like status' feature (Carrefour)
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default';
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0;
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0;
ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default';
ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0;
ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0;
COMMIT;

View File

@ -94,32 +94,6 @@ function render_row ($data, $label) {
echo "</tr>";
}
}
function render_row_2 ($dataMin, $labelMin, $data, $label) {
global $console_mode;
if ($console_mode == 1) {
echo $labelMin;
echo "|";
echo $dataMin;
echo "|";
echo $label;
echo "|";
echo $data;
echo "\n";
}
else {
echo "<tr>";
echo "<td style='padding:2px;border:0px;' width='60%'><div style='padding:5px;background-color:#f2f2f2;border-radius:2px;text-align:left;border:0px;'>" . $labelMin .
"</div></td><td style='font-weight:bold;padding:2px;border:0px;' width='40%'><div style='padding:5px;background-color:#f2f2f2;border-radius:2px;text-align:left;border:0px;'>" . $dataMin .
"</div></td>";
echo "</tr>";
echo "<tr>";
echo "<td style='padding:2px;border:0px;' width='60%'><div style='padding:5px;background-color:#f2f2f2;border-radius:2px;text-align:left;border:0px;'>" . $label .
"</div><td style='font-weight:bold;padding:2px;border:0px;' width='40%'><div style='padding:5px;background-color:#f2f2f2;border-radius:2px;text-align:left;border:0px;'>" . $data .
"</div></td>";
echo "</tr>";
}
}
function get_value_sum($arr){
foreach($arr as $clave){
@ -135,9 +109,10 @@ function execution_time(){
if($times[0]['datos'] > $times[1]['datos'] * 1.2)
return "<a class= 'content' style= 'color: red;'>Warning Status</a><a>&nbsp&nbsp The execution time could be degrading. For a more extensive information of this data consult the Execution Time graph</a>";
else
return "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The execution time is correct. For a more extensive information of this data consult the Execution Time graph</a>";
return "<a style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The execution time is correct. For a more extensive information of this data consult the Execution Time graph</a>";
}
function get_logs_size($file){
$file_name = '/var'. $file .'';
$size_server_log = filesize($file_name);
@ -149,9 +124,9 @@ function get_status_logs($path){
$status_server_log = "";
$size_server_log = get_logs_size($path);
if ($size_server_log <= 10240){
$status_server_log = "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp You have less than 10 MB of logs</a>";
$status_server_log = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp You have less than 10 MB of logs</a>";
}else{
$status_server_log = "<a class= 'content' style= 'color: red;'>Warning Status</a><a>&nbsp&nbsp You have more than 10 MB of logs</a>";
$status_server_log = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp You have more than 10 MB of logs</a>";
}
return $status_server_log;
}
@ -161,9 +136,9 @@ function percentage_modules_per_agent(){
$total_modules = db_get_value_sql ('SELECT count(*) FROM tagente_modulo');
$average_modules_per_agent = $total_modules / $total_agents;
if($average_modules_per_agent <= 40){
$status_average_modules = "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The average of modules per agent is less than 40 percent</a>";
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The average of modules per agent is less than 40 percent</a>";
}else{
$status_average_modules = "<a class= 'content' style= 'color: red;'>Warning Status</a><a>&nbsp&nbspThe average of modules per agent is more than 40 percent. You can have performance problems</a>";
$status_average_modules = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbspThe average of modules per agent is more than 40 percent. You can have performance problems</a>";
}
return $status_average_modules;
}
@ -174,9 +149,9 @@ function license_capacity(){
$status_license_capacity = "";
$current_count = db_get_value_sql ('SELECT count(*) FROM tagente');
if ($current_count > $license_limit * 90 /100){
$status_license_capacity = "<a class= 'content' style= 'color: red;'>Warning Status</a><a>&nbsp&nbsp The license capacity is more than 90 percent</a>";
$status_license_capacity = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The license capacity is more than 90 percent</a>";
}else{
$status_license_capacity = "<a class= 'content' style= 'color: green;'>Normal Status</a><a>&nbsp&nbsp The license capacity is less than 90 percent</a>";
$status_license_capacity = "<a style= 'color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The license capacity is less than 90 percent</a>";
}
return $status_license_capacity;
}
@ -195,12 +170,12 @@ function interval_average_of_network_modules(){
$average_time= (int) $total_module_interval_time / $total_network_modules;
if($average_time < 180 ){
$status_average_modules = "<a class= 'content' style= 'color: red;'>Warning Status</a><a>&nbsp&nbsp The system has a lot of load and a very fine configuration is required</a>";
$status_average_modules = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The system has a lot of load and a very fine configuration is required</a>";
}else{
$status_average_modules = "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The system has an acceptable charge</a>";
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The system has an acceptable charge</a>";
}
if ($average_time == 0)
$status_average_modules = "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The system has no load</a>";
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The system has no load</a>";
return $status_average_modules;
}
@ -208,9 +183,9 @@ $attachment_total_files = count(glob($config['homedir']."/attachment/{*.*}",GLOB
function files_attachment_folder($total_files){
if($total_files <= 700){
$status_total_files = "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The attachment folder has less than 700 files.</a>";
$status_total_files = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The attachment folder has less than 700 files.</a>";
}else{
$status_total_files = "<a class= 'content' style= 'color: red;'>Warning Status</a><a>&nbsp&nbsp The attachment folder has more than 700 files.</a>";
$status_total_files = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The attachment folder has more than 700 files.</a>";
}
return $status_total_files;
}
@ -218,14 +193,21 @@ function files_attachment_folder($total_files){
$tagente_datos_size = db_get_value_sql('SELECT COUNT(*) FROM tagente_datos');
function status_tagente_datos($tagente_datos_size){
if ($tagente_datos_size <=3000){
$tagente_datos_size = "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The tagente_datos table has less than 3000 data.</a>";
if ($tagente_datos_size <=3000000){
$tagente_datos_size = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The tagente_datos table has an acceptable amount of data.</a>";
}else{
$tagente_datos_size = "<a class= 'content' style ='color: red;'>Warning Status</a><a>&nbsp&nbsp The tagente_datos table has more than 3000 data. A historical database is recommended.</a>";
$tagente_datos_size = "<a class= 'content' style ='color: red;text-decoration: none;'>Warning Status</a><a>&nbsp&nbsp The tagente_datos table has too much data. A historical database is recommended.</a>";
}
return $tagente_datos_size;
}
function status_values($val_rec, $val){
if ($val_rec <= $val)
return $val . "<a style='text-decoration: none;'> (Min. Recommended Value </a>" . $val_rec. "<a>)</a>";
else
return $val . "<a style='text-decoration: none;'> (Min. Recommended Value </a>" . $val_rec. "<a>)</a><a class= 'content' style ='color: red;text-decoration: none;'> Warning Status</a>";
}
$tables_fragmentation=db_get_sql ("SELECT (data_free/(index_length+data_length))
as frag_ratio from information_schema.tables where DATA_FREE > 0 and table_name='tagente_datos' and table_schema='pandora'");
$db_size=db_get_all_rows_sql("SELECT table_schema,
@ -245,28 +227,30 @@ $path_console_logs ="/www/html/pandora_console/pandora_console.log";
$innodb_log_file_size_min_rec_value = "64M";
$innodb_log_buffer_size_min_rec_value = "16M";
$innodb_flush_log_at_trx_commit_min_rec_value = 0;
$query_cache_limit_min_rec_value = "2M";
$max_allowed_packet_min_rec_value = "32M";
$sort_buffer_size_min_rec_value = "32K";
$join_buffer_size_min_rec_value = "265K";
$query_cache_limit_min_rec_value = 2;
$max_allowed_packet_min_rec_value = 32;
$innodb_buffer_pool_size_min_rec_value = shell_exec("cat /proc/meminfo | grep -i total | head -1 | awk '{print $(NF-1)*0.4/1024}'");
$sort_buffer_size_min_rec_value = 32;
$join_buffer_size_min_rec_value = 265;
$query_cache_type_min_rec_value = "ON";
$query_cache_size_min_rec_value = "24M";
$innodb_lock_wait_timeout_max_rec_value = "120 seconds";
$query_cache_size_min_rec_value = 24;
$innodb_lock_wait_timeout_max_rec_value = 120;
$tables_fragmentation_max_rec_value = 10;
$thread_cache_size_max_rec_value = "8M";
$thread_stack_min_rec_value = "256K";
$max_connections_max_rec_value = "150";
$key_buffer_size_min_rec_value = "256K";
$read_buffer_size_min_rec_value = "32K";
$read_rnd_buffer_size_min_rec_value = "32K";
$query_cache_min_res_unit_min_rec_value = "2K";
$thread_cache_size_max_rec_value = 8;
$thread_stack_min_rec_value = 256;
$max_connections_max_rec_value = 150;
$key_buffer_size_min_rec_value = 256;
$read_buffer_size_min_rec_value = 32;
$read_rnd_buffer_size_min_rec_value = 32;
$query_cache_min_res_unit_min_rec_value = 2;
$innodb_file_per_table_min_rec_value = 0;
function status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation){
$status_tables_frag = "";
if($tables_fragmentation > $tables_fragmentation_max_rec_value)
$status_tables_frag = "<a class= 'content' style ='color: red;'>Warning Status</a><a>&nbsp&nbsp The fragmentation tables is higher than recommended. You should defragment them.</a>";
$status_tables_frag = "<a class= 'content' style ='color: red; text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The fragmentation tables is higher than recommended. You should defragment them.</a>";
else
$status_tables_frag = "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The fragmentation tables is correct.</a>";
$status_tables_frag = "<a style ='color: green; text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The fragmentation tables is correct.</a>";
return $status_tables_frag;
}
@ -536,29 +520,46 @@ switch ($config["dbtype"]) {
WHERE \"key\" = 'current_update'", "Current Update #");
break;
}
$innodb_log_file_size =db_get_value_sql ("SELECT @@innodb_log_file_size")/1048576;
$innodb_log_buffer_size =db_get_value_sql("SELECT @@innodb_log_buffer_size")/1048576;
$innodb_flush_log_at_trx_commit =db_get_value_sql("SELECT @@innodb_flush_log_at_trx_commit");
$max_allowed_packet =db_get_value_sql("SELECT @@max_allowed_packet")/1048576;
$innodb_buffer_pool_size = db_get_value_sql("SELECT @@innodb_buffer_pool_size")/1024;
$sort_buffer_size =number_format(db_get_value_sql("SELECT @@sort_buffer_size")/1024, 2);
$join_buffer_size =db_get_value_sql("SELECT @@join_buffer_size")/1024;
$query_cache_type =db_get_value_sql("SELECT @@query_cache_type");
$query_cache_size =db_get_value_sql("SELECT @@query_cache_size")/1048576;
$query_cache_limit =db_get_value_sql("SELECT @@query_cache_limit")/1048576;
$innodb_lock_wait_timeout =db_get_value_sql("SELECT @@innodb_lock_wait_timeout");
$thread_cache_size =db_get_value_sql("SELECT @@thread_cache_size");
$thread_stack =db_get_value_sql("SELECT @@thread_stack")/1024;
$max_connections =db_get_value_sql("SELECT @@max_connections");
$key_buffer_size =db_get_value_sql("SELECT @@key_buffer_size")/1024;
$read_buffer_size =db_get_value_sql("SELECT @@read_buffer_size")/1024;
$read_rnd_buffer_size =db_get_value_sql("SELECT @@read_rnd_buffer_size")/1024;
$query_cache_min_res_unit =db_get_value_sql("SELECT @@query_cache_min_res_unit")/1024;
$innodb_file_per_table = db_get_value_sql("SELECT @@innodb_file_per_table");
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__("MySQL Performance metrics")."</th></tr>";
render_row_2($innodb_log_file_size_min_rec_value,'InnoDB log file size (minimum recommended value)',db_get_value_sql ("SELECT @@innodb_log_file_size")/1048576 . 'M', 'InnoDB log file size (current value)');
render_row_2($innodb_log_buffer_size_min_rec_value,'InnoDB log buffer size (minimum recommended value)',db_get_value_sql("SELECT @@innodb_log_buffer_size")/1048576 . 'M', 'InnoDB log buffer size (current value)');
render_row_2($innodb_flush_log_at_trx_commit_min_rec_value,'InnoDB flush log at trx-commit (minimum recommended value)',db_get_value_sql("SELECT @@innodb_flush_log_at_trx_commit"), 'InnoDB flush log at trx-commit (current value)');
render_row_2($max_allowed_packet_min_rec_value,'Maximun allowed packet',db_get_value_sql("SELECT @@max_allowed_packet")/1048576 . 'M', 'Maximun allowed packet (current value)');
render_row_2($innodb_buffer_pool_size_min_rec_value . 'M','InnoDB buffer pool size (minimum recommended value)',db_get_value_sql("SELECT @@innodb_buffer_pool_size")/1024 . 'M', 'InnoDB buffer pool size (current value)');
render_row_2($sort_buffer_size_min_rec_value,'Sort buffer size (minimum recommended value)',number_format(db_get_value_sql("SELECT @@sort_buffer_size")/1024, 2) . 'K', 'Sort buffer size (current value)');
render_row_2($join_buffer_size_min_rec_value,'Join buffer size (minimum recommended value)',db_get_value_sql("SELECT @@join_buffer_size")/1024 . 'K', 'Join buffer size (current value)');
render_row_2($query_cache_type_min_rec_value,'Query cache type (recommended value)',db_get_value_sql("SELECT @@query_cache_type"), 'Query cache type (current value)');
render_row_2($query_cache_size_min_rec_value,'Query cache size (minimum recommended value)',db_get_value_sql("SELECT @@query_cache_size")/1048576 . 'M', 'Query cache size (current value)');
render_row_2($query_cache_limit_min_rec_value,'Query cache limit (minimum recommended value)',db_get_value_sql("SELECT @@query_cache_limit")/1048576 . 'M', 'Query cache limit (current value)');
render_row_2($innodb_lock_wait_timeout_max_rec_value ,'InnoDB lock wait timeout (maximum recommended value)',db_get_value_sql("SELECT @@innodb_lock_wait_timeout") . ' seconds', 'InnoDB lock wait timeout (current value)');
render_row_2($thread_cache_size_max_rec_value ,'Thread cache size (maximum recommended value)',db_get_value_sql("SELECT @@thread_cache_size") . 'M', 'Thread cache size (current value)');
render_row_2($thread_stack_min_rec_value ,'Thread stack (minimum recommended value)',db_get_value_sql("SELECT @@thread_stack")/1024 . 'K', 'Thread stack (current value)');
render_row_2($max_connections_max_rec_value ,'Maximun connections (maximum recommended value)',db_get_value_sql("SELECT @@max_connections"), 'Maximum connections (current value)');
render_row_2($key_buffer_size_min_rec_value ,'Key buffer size (minimum recommended value)',db_get_value_sql("SELECT @@key_buffer_size")/1024 . 'K', 'Key buffer size (current value)');
render_row_2($read_buffer_size_min_rec_value ,'Read buffer size (minimum recommended value)',db_get_value_sql("SELECT @@read_buffer_size")/1024 . 'K', 'Read buffer size (current value)');
render_row_2($read_rnd_buffer_size_min_rec_value ,'Read rnd-buffer size (minimum recommended value)',db_get_value_sql("SELECT @@read_rnd_buffer_size")/1024 . 'K', 'Read rnd-buffer size (current value)');
render_row_2($query_cache_min_res_unit_min_rec_value ,'Query cache min-res-unit (minimum recommended value)',db_get_value_sql("SELECT @@query_cache_min_res_unit")/1024 . 'K', 'Query cache min-res-unit (current value)');
render_row(db_get_value_sql("SELECT @@innodb_file_per_table"), 'InnoDB file per table');
render_row(status_values($innodb_log_file_size_min_rec_value,$innodb_log_file_size),'InnoDB log file size ', 'InnoDB log file size ');
render_row(status_values($innodb_log_buffer_size_min_rec_value,$innodb_log_buffer_size),'InnoDB log buffer size ', 'InnoDB log buffer size ');
render_row(status_values($innodb_flush_log_at_trx_commit_min_rec_value,$innodb_flush_log_at_trx_commit), 'InnoDB flush log at trx-commit ','InnoDB flush log at trx-commit ');
render_row(status_values($max_allowed_packet_min_rec_value,$max_allowed_packet), 'Maximun allowed packet ','Maximun allowed packet ');
render_row(status_values($innodb_buffer_pool_size_min_rec_value,$innodb_buffer_pool_size), 'InnoDB buffer pool size ','InnoDB buffer pool size ');
render_row(status_values($sort_buffer_size_min_rec_value,$sort_buffer_size), 'Sort buffer size ','Sort buffer size ');
render_row(status_values($join_buffer_size_min_rec_value,$join_buffer_size), 'Join buffer size ','Join buffer size ');
render_row(status_values($query_cache_type_min_rec_value,$query_cache_type), 'Query cache type ', 'Query cache type ');
render_row(status_values($query_cache_size_min_rec_value,$query_cache_size), 'Query cache size ','Query cache size ');
render_row(status_values($query_cache_limit_min_rec_value,$query_cache_limit), 'Query cache limit ','Query cache limit ');
render_row(status_values($innodb_lock_wait_timeout_max_rec_value,$innodb_lock_wait_timeout), 'InnoDB lock wait timeout ','InnoDB lock wait timeout ');
render_row(status_values($thread_cache_size_max_rec_value,$thread_cache_size), 'Thread cache size ','Thread cache size ');
render_row(status_values($thread_stack_min_rec_value,$thread_stack), 'Thread stack ','Thread stack ');
render_row(status_values($max_connections_max_rec_value,$max_connections), 'Maximum connections ','Maximun connections ');
render_row(status_values($key_buffer_size_min_rec_value,$key_buffer_size), 'Key buffer size ','Key buffer size ');
render_row(status_values($read_buffer_size_min_rec_value,$read_buffer_size), 'Read buffer size ','Read buffer size ');
render_row(status_values($read_rnd_buffer_size_min_rec_value,$read_rnd_buffer_size), 'Read rnd-buffer size ','Read rnd-buffer size ');
render_row(status_values($query_cache_min_res_unit_min_rec_value,$query_cache_min_res_unit), 'Query cache min-res-unit ','Query cache min-res-unit ');
render_row(status_values($innodb_file_per_table_min_rec_value,$innodb_file_per_table), 'InnoDB file per table ','InnoDB file per table ');
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__("Tables fragmentation in the PandoraFMS database")."</th></tr>";
@ -569,8 +570,10 @@ render_row (status_fragmentation_tables($tables_fragmentation_max_rec_value, $ta
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(" PandoraFMS logs dates")."</th></tr>";
render_row_2(number_format(get_logs_size($path_server_logs)/1024, 2) . "M", 'Size server logs (current value)',get_status_logs($path_server_logs),'Status server logs');
render_row_2(number_format(get_logs_size($path_console_logs)/1024, 2) . "M", 'Size console logs (current value)',get_status_logs($path_console_logs),'Status console logs');
render_row(number_format(get_logs_size($path_server_logs)/1024, 2) . "M", 'Size server logs (current value)');
render_row(get_status_logs($path_server_logs),'Status server logs');
render_row(number_format(get_logs_size($path_console_logs)/1024, 2) . "M", 'Size console logs (current value)');
render_row(get_status_logs($path_console_logs),'Status console logs');
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(" PandoraFMS Licence Information")."</th></tr>";
@ -628,7 +631,7 @@ $agent_id= db_get_value_sql ("SELECT id_agente FROM tagente WHERE nombre = '$ser
'agent_module_id' => $id_module['id_agente_modulo'],
'period' => SECONDS_1MONTH,
'date' => time() ,
'height' => '200'
'height' => '150'
);
render_row(grafico_modulo_sparse ($params),"Graph of the " . $id_module['nombre']." module.");
}

View File

@ -1213,6 +1213,9 @@ UPDATE `tlink` SET `link` = 'https://github.com/pandorafms/pandorafms/issues' WH
-- ---------------------------------------------------------------------
ALTER TABLE tevent_filter ADD COLUMN `date_from` date DEFAULT NULL;
ALTER TABLE tevent_filter ADD COLUMN `date_to` date DEFAULT NULL;
ALTER TABLE tevent_filter ADD COLUMN `user_comment` text NOT NULL;
ALTER TABLE tevent_filter ADD COLUMN `source` tinytext NOT NULL;
ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL;
-- ---------------------------------------------------------------------
-- Table `tusuario`
-- ---------------------------------------------------------------------
@ -1228,7 +1231,7 @@ ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL defa
-- ---------------------------------------------------------------------
ALTER TABLE tagente_modulo ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE tagente_modulo ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL;
ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL default 0;
ALTER TABLE `tagente_modulo` ADD COLUMN `cps` int NOT NULL default 0;
-- ---------------------------------------------------------------------
@ -1337,6 +1340,7 @@ ALTER TABLE treport_content ADD COLUMN `lapse_calc` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300';
ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL;
-- ---------------------------------------------------------------------
-- Table `tmodule_relationship`
@ -1668,7 +1672,7 @@ create table IF NOT EXISTS `tmetaconsole_agent_secondary_group`(
ALTER TABLE tagente ADD COLUMN `update_secondary_groups` tinyint(1) NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `update_secondary_groups` tinyint(1) NOT NULL default '0';
ALTER TABLE tusuario_perfil ADD COLUMN `is_secondary` tinyint(1) NOT NULL default '0';
ALTER TABLE tusuario_perfil ADD COLUMN `no_hierarchy` tinyint(1) NOT NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tautoconfig`

View File

@ -258,10 +258,7 @@ if(!$new_agent){
}
}
$groups = users_get_groups ($config["id_user"], "AR",false);
$agents = agents_get_group_agents (array_keys ($groups));
$modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = " . $id_parent);
@ -279,6 +276,7 @@ if (isset($groups[$grupo]) || $new_agent) {
$table->data[4][1] = html_print_select_groups(false, "AR", false, 'grupo', $grupo, '', '', 0, true);
} else {
$table->data[4][1] = groups_get_name($grupo);
$table->data[4][1] .= html_print_input_hidden('grupo', $grupo, true);
}
$table->data[4][1] .= ' <span id="group_preview">';
$table->data[4][1] .= ui_print_group_icon ($grupo, true);
@ -332,7 +330,8 @@ $table->data = array ();
if (enterprise_installed()) {
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', array($id_agente));
$table->data['secondary_groups'][0] = __('Secondary groups');
$table->data['secondary_groups'][0] = __('Secondary groups') .
ui_print_help_icon("secondary_groups", true);
$table->data['secondary_groups'][1] = html_print_select_groups(
false, // Use the current user to select the groups
"AR", // ACL permission
@ -376,28 +375,6 @@ if (enterprise_installed()) {
true, // Return HTML (not echo)
true // Multiple selection
);
}
// 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){
@ -416,27 +393,6 @@ if($id_agente){
$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[3][0] = __('Module definition') .
ui_print_help_icon("module_definition", true);
$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[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[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[4][0] = __('Status');
$table->data[4][1] = __('Disabled') . ' ' .
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
$table->data[4][1] .= __('Active') . ' ' .
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
// Remote configuration
$table->data[5][0] = __('Remote configuration');
@ -465,6 +421,80 @@ if (!$new_agent) {
else
$table->data[5][1] = '<em>' . __('Not available') . '</em>';
$cps_array[-1] = __('Disabled');
if($cps > 0){
$cps_array[$cps] = __('Enabled');
}
else{
$cps_inc = 0;
if($id_agente){
$cps_inc = service_agents_cps($id_agente);
}
$cps_array[$cps_inc] = __('Enabled');
}
$table->data[6][0] = __('Cascade protection services');
$table->data[6][0] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
$table->data[6][1] = html_print_select($cps_array, 'cps', $cps, '', '', 0, true);
}
// 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);
if (enterprise_installed()) {
$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);
// Learn mode / Normal mode
$table->data[3][0] = __('Module definition') .
ui_print_help_icon("module_definition", true);
$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[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[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[4][0] = __('Status');
$table->data[4][1] = __('Disabled') . ' ' .
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
$table->data[4][1] .= __('Enabled') . ' ' .
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
if (enterprise_installed()) {
$table->data[4][2] = __('Url address');
$table->data[4][3] = html_print_input_text ('url_description',
$url_description, '', 45, 255, true);
}else{
$table->data[5][0] = __('Url address');
$table->data[5][1] = html_print_input_text ('url_description',
$url_description, '', 45, 255, true);
}
$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[5][3] = html_print_checkbox('quiet', 1, $quiet, true);
$listIcons = gis_get_array_list_icons();
$arraySelectIcon = array();
@ -510,30 +540,6 @@ if ($config['activate_gis']) {
$update_gis_data, false, '', 'style="margin-right: 40px;"', true);
}
$table->data[4][2] = __('Url address');
$table->data[4][3] = html_print_input_text ('url_description',
$url_description, '', 45, 255, true);
$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[5][3] = html_print_checkbox('quiet', 1, $quiet, true);
$cps_array[-1] = __('Disabled');
if($cps > 0){
$cps_array[$cps] = __('Enabled');
}
else{
$cps_inc = 0;
if($id_agente){
$cps_inc = service_agents_cps($id_agente);
}
$cps_array[$cps_inc] = __('Enabled');
}
$table->data[6][0] = __('Cascade protection services');
$table->data[6][0] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
$table->data[6][1] = html_print_select($cps_array, 'cps', $cps, '', '', 0, true);
ui_toggle(html_print_table ($table, true), __('Advanced options'));
unset($table);
@ -599,8 +605,8 @@ echo clippy_context_help("modules_not_learning_mode");
echo "</span>";
if ($id_agente) {
echo '<div class="action-buttons" style="width: ' . $table->width . '">';
html_print_submit_button (__('Update'), 'updbutton', false,
'class="sub upd"');
html_print_input_hidden ('update_agent', 1);

View File

@ -800,10 +800,9 @@ if ($update_agent) { // if modified some agent paramenter
ui_print_error_message(__('No agent alias specified'));
//If there is an agent with the same name, but a different ID
}
/*elseif (agents_get_agent_id ($nombre_agente) > 0 &&
agents_get_agent_id ($nombre_agente) != $id_agente) {
ui_print_error_message(__('There is already an agent in the database with this name'));
}*/
if ($grupo <= 0) {
ui_print_error_message(__('The group id %d is incorrect.', $grupo));
}
else {
//If different IP is specified than previous, add the IP
if ($direccion_agente != '' &&
@ -987,16 +986,16 @@ $edit_module = (bool) get_parameter ('edit_module');
// GET DATA for MODULE UPDATE OR MODULE INSERT
if ($update_module || $create_module) {
$id_grupo = agents_get_agent_group ($id_agente);
$all_groups = agents_get_all_groups_agent ($id_agente, $id_grupo);
$id_agent_module = (int) get_parameter ('id_agent_module');
if (!check_acl ($config["id_user"], $id_grupo, "AW")) {
if (! check_acl_one_of_groups ($config["id_user"], $all_groups, "AW")) {
db_pandora_audit("ACL Violation",
"Trying to create a module without admin rights");
require ("general/noaccess.php");
exit;
}
$id_agent_module = (int) get_parameter ('id_agent_module');
$id_module_type = (int) get_parameter ('id_module_type');
$name = (string) get_parameter ('name');
$description = (string) get_parameter ('description');

View File

@ -343,6 +343,7 @@ if($os != 0){
$search_sql .= " AND id_os = " . $os;
}
$user_groups_to_sql = "";
// Show only selected groups
if ($ag_group > 0) {
$ag_groups = array();
@ -350,100 +351,39 @@ if ($ag_group > 0) {
if ($recursion) {
$ag_groups = groups_get_id_recursive($ag_group, true);
}
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ('SELECT *
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s, %s %s
LIMIT %d, %d',
implode (",", $ag_groups), $search_sql, $order['field'],$order['order'], $order['field2'], $order['order'], $offset, $config["block_size"]);
break;
case "postgresql":
$sql = sprintf ('SELECT *
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s, %s %s
LIMIT %d OFFSET %d',
implode (",", $ag_groups), $search_sql, $order['field'],$order['order'], $order['field2'], $order['order'], $config["block_size"], $offset);
break;
case "oracle":
$set = array ();
$set['limit'] = $config["block_size"];
$set['offset'] = $offset;
$sql = sprintf ('SELECT *
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s, %s %s',
implode (",", $ag_groups), $search_sql, $order['field'],$order['order'], $order['field2'], $order['order']);
$sql = oracle_recode_query ($sql, $set);
break;
}
$sql_total = sprintf ('SELECT COUNT(*)
FROM tagente
WHERE id_grupo IN (%s)
%s',
implode (",", $ag_groups), $search_sql);
$total_agents = db_get_sql ($sql_total);
}
else {
$user_groups_to_sql = implode (",", $ag_groups);
} else {
// Concatenate AW and AD permisions to get all the possible groups where the user can manage
$user_groupsAW = users_get_groups ($config['id_user'], 'AW');
$user_groupsAD = users_get_groups ($config['id_user'], 'AD');
$user_groups = $user_groupsAW + $user_groupsAD;
$sql = sprintf ('SELECT COUNT(*)
FROM tagente
WHERE id_grupo IN (%s)
%s',
implode (',', array_keys ($user_groups)),
$search_sql);
$total_agents = db_get_sql ($sql);
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ('SELECT *
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s, %s %s
LIMIT %d, %d',
implode (',', array_keys ($user_groups)),
$search_sql, $order['field'],$order['order'], $order['field2'], $order['order'], $offset, $config["block_size"]);
break;
case "postgresql":
$sql = sprintf ('SELECT *
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s, %s %s
LIMIT %d OFFSET %d',
implode (',', array_keys ($user_groups)),
$search_sql, $order['field'],$order['order'], $order['field2'], $order['order'], $config["block_size"], $offset);
break;
case "oracle":
$set = array ();
$set['limit'] = $config["block_size"];
$set['offset'] = $offset;
$sql = sprintf ('SELECT *
FROM tagente
WHERE id_grupo IN (%s)
%s
ORDER BY %s %s, %s %s',
implode (',', array_keys ($user_groups)),
$search_sql, $order['field'],$order['order'], $order['field2'], $order['order']);
$sql = oracle_recode_query ($sql, $set);
break;
}
$user_groups_to_sql = implode (',', array_keys ($user_groups));
}
$sql = sprintf ('SELECT COUNT(DISTINCT(tagente.id_agente))
FROM tagente LEFT JOIN tagent_secondary_group tasg
ON tagente.id_agente = tasg.id_agent
WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))
%s',
$user_groups_to_sql, $user_groups_to_sql,
$search_sql);
$total_agents = db_get_sql ($sql);
$sql = sprintf ('SELECT *
FROM tagente LEFT JOIN tagent_secondary_group tasg
ON tagente.id_agente = tasg.id_agent
WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))
%s
GROUP BY tagente.id_agente
ORDER BY %s %s, %s %s
LIMIT %d, %d',
$user_groups_to_sql, $user_groups_to_sql,
$search_sql,
$order['field'], $order['order'], $order['field2'], $order['order'],
$offset, $config["block_size"]);
$agents = db_get_all_rows_sql ($sql);
// Delete rnum row generated by oracle_recode_query() function
@ -494,13 +434,15 @@ if ($agents !== false) {
}
/* End Update tagente.remote 0/1 with remote agent function return */
$id_grupo = $agent["id_grupo"];
$all_groups = agents_get_all_groups_agent($agent["id_agente"], $agent["id_grupo"]);
$check_aw = check_acl_one_of_groups ($config["id_user"], $all_groups, "AW");
$check_ad = check_acl_one_of_groups ($config["id_user"], $all_groups, "AD");
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
if (! check_acl ($config["id_user"], $id_grupo, "AW", $agent['id_agente']) && ! check_acl ($config["id_user"], $id_grupo, "AD", $agent['id_agente']))
continue;
// Do not show the agent if there is not enough permissions
if (!$check_aw && !$check_ad) continue;
if ($color == 1) {
$tdcolor = "datos";
@ -526,7 +468,7 @@ if ($agents !== false) {
echo '<span class="left">';
echo "<strong>";
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
if ($check_aw) {
$main_tab = 'main';
}
else {
@ -574,7 +516,7 @@ if ($agents !== false) {
}
echo '</span><div class="left actions" style="visibility: hidden; clear: left">';
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
if ($check_aw) {
if($agent["id_os"] == 100){
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.__('Edit').'</a>';
@ -640,7 +582,7 @@ if ($agents !== false) {
// Group icon and name
echo "<td class='$tdcolor' align='left' valign='middle'>" . ui_print_group_icon ($id_grupo, true)."</td>";
echo "<td class='$tdcolor' align='left' valign='middle'>" . ui_print_group_icon ($agent["id_grupo"], true)."</td>";
// Description
echo "<td class='".$tdcolor."f9'>" .
ui_print_truncate_text($agent["comentarios"], 'description', true, true, true, '[&hellip;]', 'font-size: 6.5pt;')."</td>";
@ -679,7 +621,7 @@ if ($agents !== false) {
echo html_print_image('images/lightbulb.png', true, array('alt' => __('Disable agent'), 'title' => __('Disable agent'))) ."</a>";
}
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
if ($check_aw) {
echo "&nbsp;&nbsp;<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
borrar_agente=".$agent["id_agente"]."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";

View File

@ -656,7 +656,7 @@ foreach ($modules as $module) {
"alt" => "")) . "&nbsp;";
}
if (check_acl ($config['id_user'], $agent['id_grupo'], "AW")) {
if (check_acl_one_of_groups ($config["id_user"], $all_groups, "AW")) {
$data[0] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=' . $id_agente . '&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].'">';
}
@ -668,7 +668,7 @@ foreach ($modules as $module) {
$data[0] .= ui_print_truncate_text($module['nombre'], 'module_medium', false, true, true, '[&hellip;]', 'font-size: 7.2pt');
}
if (check_acl ($config['id_user'], $agent['id_grupo'], "AW")) {
if (check_acl_one_of_groups ($config["id_user"], $all_groups, "AW")) {
$data[0] .= '</a>';
}

View File

@ -586,7 +586,8 @@ if($cps_module > 0){
else{
$cps_inc = 0;
if($id_agent_module){
$cps_inc = service_modules_cps($id_agent_module);
$cps_inc = enterprise_hook('service_modules_cps', array($id_agent_module));
if ($cps_inc === ENTERPRISE_NOT_HOOK) $cps_inc = 0;
}
$cps_array[$cps_inc] = __('Enabled');
}

View File

@ -326,13 +326,8 @@ foreach ($templates as $template) {
$data[1] = ui_print_group_icon ($template["id_group"], true);
$data[3] = alerts_get_alert_templates_type_name ($template['type']);
$hack_id_group_all = $template["id_group"];
if ($hack_id_group_all == 0) {
//To avoid check all groups instead the pseudo-group all
$hack_id_group_all = -1;
}
if (check_acl($config['id_user'], $hack_id_group_all, "LM")) {
if (check_acl($config['id_user'], $template["id_group"], "LM")) {
$data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'" style="display: inline; float: left">';
$data[4] .= html_print_input_hidden ('duplicate_template', 1, true);
$data[4] .= html_print_input_hidden ('source_id', $template['id'], true);

View File

@ -65,6 +65,9 @@ if ($id) {
$group_rep = $filter['group_rep'];
$date_from = str_replace("-","/",$filter['date_from']);
$date_to = str_replace("-","/",$filter['date_to']);
$source = $filter['source'];
$id_extra = $filter['id_extra'];
$user_comment = $filter['user_comment'];
$tag_with_json = $filter['tag_with'];
$tag_with_json_clean = io_safe_output($tag_with_json);
@ -130,6 +133,9 @@ if ($update || $create) {
$group_rep = get_parameter('group_rep', '');
$date_from = get_parameter('date_from', '');
$date_to = get_parameter('date_to', '');
$source = get_parameter('source');
$id_extra = get_parameter('id_extra');
$user_comment = get_parameter('user_comment');
$tag_with_base64 = get_parameter('tag_with', json_encode(array()));
$tag_with_json = io_safe_input(base64_decode($tag_with_base64));
@ -158,6 +164,9 @@ if ($update || $create) {
'tag_without' => $tag_without_json,
'date_from' => $date_from,
'date_to' => $date_to,
'source' => $source,
'id_extra' => $id_extra,
'user_comment' => $user_comment,
'filter_only_alert' => $filter_only_alert);
}
@ -390,6 +399,16 @@ if (!is_metaconsole()) {
$text_module, false, true, '', array(), true, $id_agent_module);
}
$sources = events_get_all_source();
$table ->data[22][0] = '<b>' . __('Source') . '</b>';
$table ->data[22][1] = html_print_select ($sources, 'source', $source, '', '', '', true);
$table ->data[23][0] = '<b>' . __('Extra ID') . '</b>';
$table ->data[23][1] = html_print_input_text ('id_extra', $id_extra, '', 11, 255, true);
$table ->data[24][0] = '<b>' . __('Comment') . '</b>';
$table ->data[24][1] = html_print_input_text ('user_comment', $user_comment, '', 35, 255, true);
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&pure='.$config['pure'].'">';
html_print_table ($table);

File diff suppressed because it is too large Load Diff

View File

@ -62,7 +62,7 @@ $buttons['visual_console_favorite'] = array(
html_print_image ("images/list.png", true, array ("title" => __('Visual Favourite Console'))) .'</a>'
);
if($is_enterprise){
if($is_enterprise && $vconsoles_manage){
$buttons['visual_console_template'] = array(
'active' => false,
'text' => '<a href="'.$url_visual_console_template.'">' .

View File

@ -426,9 +426,12 @@ switch ($action) {
$description = $item['description'];
$period = $item['period'];
$group = $item['id_group'];
$recursion = $item['recursion'];
break;
case 'event_report_agent':
case 'event_report_group':
$recursion = $item['recursion'];
break;
case 'event_report_module':
$description = $item['description'];
$period = $item['period'];
@ -477,12 +480,14 @@ switch ($action) {
case 'group_report':
$description = $item['description'];
$group = $item['id_group'];
$recursion = $item['recursion'];
break;
case 'network_interfaces_report':
$description = $item['description'];
$group = $item['id_group'];
$period = $item['period'];
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
$recursion = $item['recursion'];
break;
case 'top_n':
$description = $item['description'];
@ -521,6 +526,7 @@ switch ($action) {
$es = json_decode($item['external_source'], true);
$id_agents = $es['id_agents'];
$selection_a_m = get_parameter('selection');
$recursion = $item['recursion'];
if ((count($es['module']) == 1) && ($es['module'][0] == 0)) {
$module = "";
@ -538,6 +544,7 @@ switch ($action) {
$date = $es['date'];
$inventory_modules = $es['inventory_modules'];
$id_agents = $es['id_agents'];
$recursion = $item['recursion'];
$idAgent = $es['id_agents'];
$idAgentModule = $inventory_modules;
@ -549,6 +556,7 @@ switch ($action) {
$es = json_decode($item['external_source'], true);
$inventory_modules = $es['inventory_modules'];
$id_agents = $es['id_agents'];
$recursion = $item['recursion'];
break;
case 'agent_configuration':
@ -557,6 +565,7 @@ switch ($action) {
case 'group_configuration':
$group = $item['id_group'];
$recursion = $item['recursion'];
break;
case 'netflow_area':
@ -609,6 +618,7 @@ switch ($action) {
break;
}
$urlForm = $config['homeurl'] .
'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=' . $actionParameter . '&id_report=' . $idReport;
@ -914,7 +924,7 @@ You can of course remove the warnings, that's why we include the source and do n
html_print_select_groups($config['id_user'],
"RM", true, 'combo_group', $group, '');
echo "&nbsp;&nbsp;&nbsp;".__('Recursion').html_print_checkbox('recursion', 1, 0, true);
echo "&nbsp;&nbsp;&nbsp;".__('Recursion').html_print_checkbox('recursion', 1, $recursion, true);
?>
</td>
@ -1760,6 +1770,9 @@ function print_SLA_list($width, $action, $idItem = null) {
$itemsSLA = db_get_all_rows_filter(
'treport_content_sla_combined',
array('id_report_content' => $idItem));
if ($itemsSLA === false) {
$itemsSLA = array();
}
@ -1971,6 +1984,9 @@ function print_General_list($width, $action, $idItem = null, $type = 'general')
$itemsGeneral = db_get_all_rows_filter(
'treport_content_item',
array('id_report_content' => $idItem));
if ($itemsGeneral === false) {
$itemsGeneral = array();
}

View File

@ -940,17 +940,22 @@ switch ($action) {
$report = db_get_row_filter('treport',
array('id_report' => $idReport));
$reportName = $report['name'];
$idGroupReport = $report['id_group'];
$description = $report['description'];
$good_format = false;
switch ($action) {
case 'update':
$values = array();
$values['id_report'] = $idReport;
$values['id_report'] = $idReport; //---------------------------------------------------
//$values['name'] = (string) get_parameter('name');
$values['description'] = get_parameter('description');
$values['type'] = get_parameter('type', null);
$values['recursion'] = get_parameter('recursion', null);
$label = get_parameter('label', '');
//Add macros name
@ -1290,6 +1295,7 @@ switch ($action) {
}
break;
case 'save':
$values = array();
$values['id_report'] = $idReport;
$values['type'] = get_parameter('type', null);
@ -1303,6 +1309,7 @@ switch ($action) {
$items_label['id_agent'] = get_parameter('id_agent');
$items_label['id_agent_module'] = get_parameter('id_agent_module');
$name_it = (string) get_parameter('name');
$values['recursion'] = get_parameter('recursion', null);
$values['name'] = reporting_label_macro($items_label, $name_it);
// Support for projection graph, prediction date and SLA reports

View File

@ -829,8 +829,11 @@ function readFields() {
values['bars_graph_type'] = $("select[name=bars_graph_type]").val();
values['parent'] = $("select[name=parent]").val();
values['map_linked'] = $("select[name=map_linked]").val();
values['linked_map_status_calculation_type'] = $("select[name=linked_map_status_calculation_type]").val();
values['map_linked_weight'] = $("input[name=map_linked_weight]").val();
values['linked_map_status_service_critical'] = $("input[name=linked_map_status_service_critical]").val();
values['linked_map_status_service_warning'] = $("input[name=linked_map_status_service_warning]").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());
@ -1537,10 +1540,16 @@ function loadFieldsFromDB(item) {
$("input[name=height]").val(val);
if (key == 'parent_item')
$("select[name=parent]").val(val);
if (key == 'linked_layout_status_type')
$("select[name=linked_map_status_calculation_type]").val(val).change();
if (key == 'id_layout_linked')
$("select[name=map_linked]").val(val);
$("select[name=map_linked]").val(val).change();
if (key == 'id_layout_linked_weight')
$("select[name=map_linked_weight]").val(val);
$("input[name=map_linked_weight]").val(val);
if (key == 'linked_layout_status_as_service_critical')
$("input[name=linked_map_status_service_critical]").val(val);
if (key == 'linked_layout_status_as_service_warning')
$("input[name=linked_map_status_service_warning]").val(val);
if (key == 'element_group')
$("select[name=element_group]").val(val);
if (key == 'width_percentile')
@ -1574,8 +1583,28 @@ function loadFieldsFromDB(item) {
$("select[name=clock_animation]").val(val);
if (key == 'time_format')
$("select[name=time_format]").val(val);
if (key == 'timezone')
$("select[name=timezone]").val(val);
if (key == 'timezone') {
var zone = val.split("/");
$("select[name=zone]").val(zone[0]);
$.ajax({
type: "POST",
url: "ajax.php",
data: "page=godmode/setup/setup&select_timezone=1&zone=" + zone[0],
dataType: "json",
success: function(data) {
$("#timezone").empty();
jQuery.each (data, function (id, value) {
timezone = value;
var timezone_country = timezone.replace (/^.*\//g, "");
$("select[name='timezone']").append($("<option>").val(timezone).html(timezone_country));
if (timezone == val) {
$("select[name='timezone']").val(timezone);
}
});
}
});
}
if (key == 'value_show') {
$("select[name=value_show]").val(val);
@ -1838,14 +1867,16 @@ function hiddenFields(item) {
$("#parent_row." + item).css('display', '');
$("#map_linked_row").css('display', 'none');
$("#linked_map_status_calculation_row").css('display', 'none');
$("#map_linked_weight").css('display', 'none');
$("#linked_map_status_service_critical_row").css('display', 'none');
$("#linked_map_status_service_warning_row").css('display', 'none');
$("#map_linked_row." + item).css('display', '');
$("#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', '');
@ -1925,9 +1956,12 @@ function cleanFields(item) {
$("input[name=width]").val(0);
$("input[name=height]").val(0);
$("select[name=parent]").val('');
$("select[name=map_linked]").val('');
$("select[name=linked_map_status_calculation_type]").val('default').change();
$("select[name=map_linked]").val('').change();
$("input[name=map_linked_weight]").val('');
$("input[name=linked_map_status_service_critical]").val('');
$("input[name=linked_map_status_service_warning]").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);
@ -5141,4 +5175,81 @@ function multiDragMouse(eventDrag){
}
});
});
}
}
function linkedMapStatusCalculationTypeChanged ($linkedMapStatusCalcRow, value) {
if ($linkedMapStatusCalcRow.length === 0 || !validRowOnSelectedItem($linkedMapStatusCalcRow)) return;
switch (value) {
case "weight":
// Show weight input
$linkedMapStatusCalcRow
.siblings("#map_linked_weight")
.show()
.siblings("#linked_map_status_service_critical_row")
.hide()
.siblings("#linked_map_status_service_warning_row")
.hide();
break;
case "service":
// Show critical and warning values
$linkedMapStatusCalcRow
.siblings("#map_linked_weight")
.hide()
.siblings("#linked_map_status_service_critical_row")
.show()
.siblings("#linked_map_status_service_warning_row")
.show();
break;
default:
// Hide inputs
$linkedMapStatusCalcRow
.siblings("#map_linked_weight")
.hide()
.siblings("#linked_map_status_service_critical_row")
.hide()
.siblings("#linked_map_status_service_warning_row")
.hide();
break;
}
}
function linkedMapChanged ($linkedMapRow, value) {
if ($linkedMapRow.length === 0 || !validRowOnSelectedItem($linkedMapRow)) return;
if (value === 0) {
$linkedMapRow
.siblings("#linked_map_status_calculation_row")
.hide()
.siblings("#map_linked_weight")
.hide()
.siblings("#linked_map_status_service_critical_row")
.hide()
.siblings("#linked_map_status_service_warning_row")
.hide();
} else {
var $linkedMapStatusCalcRow = $linkedMapRow.siblings("#linked_map_status_calculation_row");
if (!validRowOnSelectedItem($linkedMapStatusCalcRow)) return;
var calcType = $linkedMapStatusCalcRow.find("select").val();
$linkedMapStatusCalcRow.show();
linkedMapStatusCalculationTypeChanged($linkedMapStatusCalcRow, calcType);
}
}
function onLinkedMapChange (event) {
var $linkedMapRow = $(event.target).parent().parent();
var value = Number.parseInt(event.target.value);
linkedMapChanged($linkedMapRow, value);
}
function onLinkedMapStatusCalculationTypeChange (event) {
var $linkedMapStatusCalcRow = $(event.target).parent().parent();
var value = event.target.value || "default";
linkedMapStatusCalculationTypeChanged($linkedMapStatusCalcRow, value);
}
function validRowOnSelectedItem ($element) {
return $element.hasClass(selectedItem);
}

View File

@ -56,7 +56,7 @@ $buttons['visual_console_favorite'] = array(
html_print_image ("images/list.png", true, array ("title" => __('Visual Favourite Console'))) .'</a>'
);
if($is_enterprise){
if($is_enterprise && $vconsoles_manage){
$buttons['visual_console_template'] = array(
'active' => false,
'text' => '<a href="'.$url_visual_console_template.'">' .
@ -142,7 +142,7 @@ $favorite_array = visual_map_get_user_layouts ($config['id_user'],false,$filters
echo "<div id='is_favourite'>";
if($favorite_array == false){
ui_print_error_message(__('No data to show'));
ui_print_info_message(__('No favourite consoles defined'));
}
else{
echo "<ul class='container'>";
@ -168,4 +168,4 @@ echo "<div id='is_favourite'>";
echo "</ul>";
}
echo "</div>";
?>
?>

View File

@ -686,8 +686,8 @@ $table_chars->data[$row][1] = html_print_select($options_full_escale, 'full_scal
$row++;
$table_chars->data[$row][0] = __('Soft graphs:');
$table_chars->data[$row][0] .= ui_print_help_tip(__('This option may cause performance issues'), true);
$table_chars->data[$row][0] = __('Show only average');
$table_chars->data[$row][0] .= ui_print_help_tip(__('If enabled, the module graphs will only show the average value, otherwise it will show three sets of data showing maximums, averages and minimums.'), true);
$options_soft_graphs = array();
$options_soft_graphs[0] = __('Standard mode');

View File

@ -449,30 +449,22 @@ if ($add_profile) {
$group2 = (int) get_parameter ('assign_group');
$profile2 = (int) get_parameter ('assign_profile');
$tags = (array) get_parameter ('assign_tags');
$is_secondary = (bool)get_parameter ('is_secondary', 0);
$no_hierarchy = (int)get_parameter ('no_hierarchy', 0);
foreach ($tags as $k => $tag) {
if(empty($tag)) {
unset($tags[$k]);
}
}
$tags = $is_secondary ? '' : implode(',', $tags);
$tags = implode(',', $tags);
db_pandora_audit("User management",
"Added profile for user ".io_safe_input($id2), false, false, 'Profile: ' . $profile2 . ' Group: ' . $group2 . ' Tags: ' . $tags);
if (profile_check_group_mode($id2, $group2, $is_secondary)) {
$return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $is_secondary);
ui_print_result_message ($return,
__('Profile added successfully'),
__('Profile cannot be added'));
} else {
if ($is_secondary) {
ui_print_error_message ("A group assigned like primary cannot be assigned like secondary.");
} else {
ui_print_error_message ("A group assigned like secondary cannot be assigned like primary.");
}
}
$return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $no_hierarchy);
ui_print_result_message ($return,
__('Profile added successfully'),
__('Profile cannot be added'));
}
if ($delete_profile) {
@ -669,6 +661,7 @@ $table->data[15][0] .= ui_print_help_tip(__('This is defined in minutes, If you
$table->data[15][1] = html_print_input_text ('session_time', $user_info["session_time"], '', 5, 5, true);
$event_filter_data = db_get_all_rows_sql('SELECT id_name, id_filter FROM tevent_filter');
if ($event_filter_data === false) $event_filter_data = array();
$event_filter = array();
$event_filter[0] = __('None');
foreach ($event_filter_data as $filter) {
@ -730,8 +723,7 @@ echo '<br />';
/* Don't show anything else if we're creating an user */
if (!empty ($id) && !$new_user) {
profile_print_profile_table($id, __('Profiles/Groups assigned to this user'));
enterprise_hook('profile_print_profile_secondary_table', array($id));
profile_print_profile_table($id);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -295,19 +295,8 @@ if ($get_module_detail) {
elseif (($config['command_snapshot'] == '0') && (preg_match ("/[\n]+/i", $row[$attr[0]]))) {
// Its a single-data, multiline data (data snapshot) ?
// Detect string data with \n and convert to <br>'s
$datos = $row[$attr[0]];
$datos = preg_replace ('/</', '&lt;', $datos);
$datos = preg_replace ('/>/', '&gt;', $datos);
$datos = preg_replace ('/\n/i','<br>',$datos);
$datos = preg_replace ('/\s/i','&nbsp;',$datos);
$datos_format = "<div id='result_div' style='width: 100%; height: 100%; overflow: scroll; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
$datos_format .= $datos;
$datos_format .= "</div>";
// I dont why, but using index (value) method, data is automatically converted to html entities ¿?
$data[] = $datos_format;
$data[] = html_print_result_div($row[$attr[0]]);
}
elseif ($is_web_content_string) {
//Fixed the goliat sends the strings from web
@ -315,11 +304,9 @@ if ($get_module_detail) {
$data[] = io_safe_input($row[$attr[0]]);
}
else {
// Just a string of alphanumerical data... just do print
//Fixed the data from Selenium Plugin
if ($row[$attr[0]] != strip_tags($row[$attr[0]])) {
$data[] = io_safe_input($row[$attr[0]]);
$data[] = html_print_result_div($row[$attr[0]]);
}
else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type']) ) {
switch($row['module_type']) {
@ -334,7 +321,6 @@ if ($get_module_detail) {
}else{
$data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
}
break;
default:
$data_macro = modules_get_unit_macro($row[$attr[0]],$unit);
@ -355,15 +341,7 @@ if ($get_module_detail) {
if($data_macro){
$data[] = $data_macro;
} else {
$datos = $row[$attr[0]];
$datos = preg_replace ('/</', '&lt;', $datos);
$datos = preg_replace ('/>/', '&gt;', $datos);
$datos = preg_replace ('/\n/i','<br>',$datos);
$datos = preg_replace ('/\s/i','&nbsp;',$datos);
$datos_format = "<div id='result_div' style='width: 100%; height: 100%; overflow: scroll; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
$datos_format .= $datos;
$datos_format .= "</div>";
$data[] = $datos_format;
$data[] = html_print_result_div($row[$attr[0]]);
}
}
}

View File

@ -38,7 +38,13 @@ if (is_ajax ()) {
}
require_once($config['homedir'] . "/include/class/Tree.class.php");
enterprise_include_once("include/class/Tree.class.php");
require_once($config['homedir'] . "/include/class/TreeOS.class.php");
require_once($config['homedir'] . "/include/class/TreeModuleGroup.class.php");
require_once($config['homedir'] . "/include/class/TreeModule.class.php");
require_once($config['homedir'] . "/include/class/TreeTag.class.php");
require_once($config['homedir'] . "/include/class/TreeGroup.class.php");
enterprise_include_once("include/class/TreePolicies.class.php");
enterprise_include_once("include/class/TreeGroupMeta.class.php");
require_once($config['homedir'] . "/include/functions_reporting.php");
require_once($config['homedir'] . "/include/functions_os.php");
@ -67,17 +73,42 @@ if (is_ajax ()) {
'tagID' => 0,
);
$filter = get_parameter('filter', $default_filters);
$agent_a = check_acl ($config['id_user'], 0, "AR");
$agent_w = check_acl ($config['id_user'], 0, "AW");
$access = ($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR');
if (class_exists('TreeEnterprise')) {
$tree = new TreeEnterprise($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
$switch_type = !empty($rootType) ? $rootType : $type;
switch ($switch_type) {
case 'os':
$tree = new TreeOS($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
break;
case 'module_group':
$tree = new TreeModuleGroup($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
break;
case 'module':
$tree = new TreeModule($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
break;
case 'tag':
$tree = new TreeTag($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
break;
case 'group':
if(is_metaconsole()){
if (!class_exists('TreeGroupMeta')) break;
$tree = new TreeGroupMeta($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
}
else{
$tree = new TreeGroup($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
}
break;
case 'policies':
if (!class_exists('TreePolicies')) break;
$tree = new TreePolicies($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
break;
default:
// FIXME. No error handler
return;
}
else {
$tree = new Tree($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
}
$tree->setFilter($filter);
ob_clean();
echo json_encode(array('success' => 1, 'tree' => $tree->getArray()));

View File

@ -100,7 +100,21 @@ $width = get_parameter('width', null);
$height = get_parameter('height', null);
$parent = get_parameter('parent', null);
$map_linked = get_parameter('map_linked', null);
$linked_map_status_calculation_type = get_parameter('linked_map_status_calculation_type', 'default');
$map_linked_weight = get_parameter('map_linked_weight', null);
if ($map_linked_weight !== null) {
$map_linked_weight = (int) $map_linked_weight;
}
$linked_map_status_service_critical = get_parameter('linked_map_status_service_critical', null);
if ($linked_map_status_service_critical !== null) {
$linked_map_status_service_critical = (float) $linked_map_status_service_critical;
}
$linked_map_status_service_warning = get_parameter('linked_map_status_service_warning', null);
if ($linked_map_status_service_warning !== null) {
$linked_map_status_service_warning = (float) $linked_map_status_service_warning;
}
$element_group = get_parameter('element_group', null);
$width_percentile = get_parameter('width_percentile', 0);
$bars_graph_height = get_parameter('bars_graph_height', null);
@ -408,7 +422,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'], $layoutData['id_layout_linked_weight']);
$status = visual_map_get_layout_status($layoutData['id_layout_linked'], $layoutData);
// Single object
}
@ -619,12 +633,27 @@ switch ($action) {
if ($map_linked !== null) {
$values['id_layout_linked'] = $map_linked;
}
if ($element_group !== null) {
$values['element_group'] = $element_group;
if ($linked_map_status_calculation_type !== null) {
$values['linked_layout_status_type'] = $linked_map_status_calculation_type;
}
if ($map_linked_weight !== null) {
if ($map_linked_weight > 100) $map_linked_weight = 100;
if ($map_linked_weight < 0) $map_linked_weight = 0;
$values['id_layout_linked_weight'] = $map_linked_weight;
}
if ($linked_map_status_service_critical !== null) {
if ($linked_map_status_service_critical > 100) $linked_map_status_service_critical = 100;
if ($linked_map_status_service_critical < 0) $linked_map_status_service_critical = 0;
$values['linked_layout_status_as_service_critical'] = $linked_map_status_service_critical;
}
if ($linked_map_status_service_warning !== null) {
if ($linked_map_status_service_warning > 100) $linked_map_status_service_warning = 100;
if ($linked_map_status_service_warning < 0) $linked_map_status_service_warning = 0;
$values['linked_layout_status_as_service_warning'] = $linked_map_status_service_warning;
}
if ($element_group !== null) {
$values['element_group'] = $element_group;
}
switch ($type) {
// -- line_item ------------------------------------
case 'handler_start':
@ -944,6 +973,16 @@ switch ($action) {
if ($elementFields['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
if (isset($elementFields["id_layout_linked_weight"])) {
$elementFields["id_layout_linked_weight"] = (int) $elementFields["id_layout_linked_weight"];
}
if (isset($elementFields["linked_layout_status_as_service_critical"])) {
$elementFields["linked_layout_status_as_service_critical"] = (float) $elementFields["linked_layout_status_as_service_critical"];
}
if (isset($elementFields["linked_layout_status_as_service_warning"])) {
$elementFields["linked_layout_status_as_service_warning"] = (float) $elementFields["linked_layout_status_as_service_warning"];
}
switch ($type) {
case 'auto_sla_graph':
@ -1096,8 +1135,27 @@ switch ($action) {
}
$values['id_agente_modulo'] = $id_module;
$values['id_layout_linked'] = $map_linked;
$values['linked_layout_status_type'] = $linked_map_status_calculation_type;
if ($map_linked_weight !== null) {
if ($map_linked_weight > 100) $map_linked_weight = 100;
if ($map_linked_weight < 0) $map_linked_weight = 0;
$values['id_layout_linked_weight'] = $map_linked_weight;
}
if ($linked_map_status_service_critical !== null) {
if ($linked_map_status_service_critical > 100) $linked_map_status_service_critical = 100;
if ($linked_map_status_service_critical < 0) $linked_map_status_service_critical = 0;
$values['linked_layout_status_as_service_critical'] = $linked_map_status_service_critical;
}
if ($linked_map_status_service_warning !== null) {
if ($linked_map_status_service_warning > 100) $linked_map_status_service_warning = 100;
if ($linked_map_status_service_warning < 0) $linked_map_status_service_warning = 0;
$values['linked_layout_status_as_service_warning'] = $linked_map_status_service_warning;
}
$values['element_group'] = $element_group;
$values['id_layout_linked_weight'] = $map_linked_weight;
$values['parent_item'] = $parent;
$values['enable_link'] = $enable_link;
$values['show_on_top'] = $show_on_top;
@ -1361,7 +1419,7 @@ if ($get_element_status) {
array('id' => $id_element));
$res = visual_map_get_status_element($layoutData);
html_debug($res, true);
echo $res;
return;

View File

@ -349,15 +349,15 @@ function process_user_login_remote ($login, $pass, $api = false) {
foreach ($attributes as $attr) {
$attr = explode('=', $attr, 2);
if(preg_match('/' . $attr[1] . '/', $sr[$attr[0]][0])){
$permissions[$i]["profile"] = $ldap_adv_perm['profile'];
$permissions[$i]["groups"] = $ldap_adv_perm['group'];
$permissions[$i]["tags"] = implode(",",$ldap_adv_perm['tags']);
$i++;
break;
foreach ($sr[$attr[0]] as $s_attr) {
if(preg_match('/' . $attr[1] . '/', $s_attr)){
$permissions[$i]["profile"] = $ldap_adv_perm['profile'];
$permissions[$i]["groups"] = $ldap_adv_perm['group'];
$permissions[$i]["tags"] = implode(",",$ldap_adv_perm['tags']);
$i++;
}
}
}
}
} else {
$permissions[0]["profile"] = $config['default_remote_profile'];

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,429 @@
<?php
//Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
require_once($config['homedir']."/include/class/Tree.class.php");
class TreeGroup extends Tree {
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
global $config;
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
$this->L1fieldName = "id_group";
$this->L1extraFields = array(
"tg.nombre AS `name`",
$this->getDisplayHierarchy() ? 'tg.parent' : '0 as parent',
"tg.icon",
"tg.id_grupo AS gid"
);
$this->L2conditionInside = "AND (
ta.id_grupo = " . $this->id . "
OR tasg.id_group = " . $this->id . "
)";
}
protected function getData() {
if ($this->id == -1) {
$this->getFirstLevel();
} elseif ($this->type == 'group') {
$this->getSecondLevel();
} elseif ($this->type == 'agent') {
$this->getThirdLevel();
}
}
protected function getGroupSearchFilter() {
return "";
}
protected function getFirstLevel() {
$processed_items = $this->getProcessedGroups();
if (!empty($processed_items)) {
// Filter by group name. This should be done after rerieving the items cause we need the possible items descendants
if (!empty($this->filter['searchGroup'])) {
// Save the groups which intersect with the user groups
$groups = db_get_all_rows_filter('tgrupo', array('nombre' => '%' . $this->filter['searchGroup'] . '%'));
if ($groups == false) $groups = array();
$userGroupsACL = $this->userGroupsACL;
$ids_hash = array_reduce($groups, function ($userGroups, $group) use ($userGroupsACL) {
$group_id = $group['id_grupo'];
if (isset($userGroupsACL[$group_id])) {
$userGroups[$group_id] = $userGroupsACL[$group_id];
}
return $userGroups;
}, array());
$result = self::extractGroupsWithIDs($processed_items, $ids_hash);
$processed_items = ($result === false) ? array() : $result;
}
// groupID filter. To access the view from tactical views f.e.
if (!empty($this->filter['groupID'])) {
$result = self::extractItemWithID($processed_items, $this->filter['groupID'], "group", $this->strictACL);
$processed_items = ($result === false) ? array() : array($result);
}
}
$this->tree = $processed_items;
}
protected function getProcessedGroups () {
$processed_groups = array();
// Index and process the groups
$groups = $this->getGroupCounters(0);
// If user have not permissions in parent, set parent node to 0 (all)
// Avoid to do foreach for admins
if (!users_can_manage_group_all("AR")) {
foreach ($groups as $id => $group) {
if (!isset($this->userGroups[$groups[$id]['parent']])) {
$groups[$id]['parent'] = 0;
}
}
}
// Build the group hierarchy
foreach ($groups as $id => $group) {
if (isset($groups[$id]['parent']) && ($groups[$id]['parent'] != 0)) {
$parent = $groups[$id]['parent'];
// Parent exists
if (!isset($groups[$parent]['children'])) {
$groups[$parent]['children'] = array();
}
// Store a reference to the group into the parent
$groups[$parent]['children'][] = &$groups[$id];
// This group was introduced into a parent
$groups[$id]['have_parent'] = true;
}
}
// Sort the children groups
foreach ($groups as $id => $group) {
if (isset($groups[$id]['children'])) {
usort($groups[$id]['children'], array("Tree", "cmpSortNames"));
}
}
//Filter groups and eliminates the reference to children groups out of her parent
$groups = array_filter($groups, function ($group) {
return !$group['have_parent'];
});
// Propagate child counters to her parents
TreeGroup::processCounters($groups);
// Filter groups and eliminates the reference to empty groups
$groups = TreeGroup::deleteEmptyGroups($groups);
usort($groups, array("Tree", "cmpSortNames"));
return $groups;
}
protected function getGroupCounters() {
//FIXME PLEASE
if (true) {
$fields = $this->getFirstLevelFields();
$inside_fields = $this->getFirstLevelFieldsInside();
$group_acl = "";
$secondary_group_acl = "";
if (!users_can_manage_group_all("AR")) {
$user_groups_str = implode(",", $this->userGroupsArray);
$group_acl = " AND ta.id_grupo IN ($user_groups_str)";
$secondary_group_acl = " AND tasg.id_group IN ($user_groups_str)";
}
$agent_search_filter = $this->getAgentSearchFilter();
$agent_search_filter = preg_replace("/%/", "%%", $agent_search_filter);
$agent_status_filter = $this->getAgentStatusFilter();
$module_status_filter = $this->getModuleStatusFilter();
$module_search_inner = "";
$module_search_filter = "";
if (!empty($this->filter['searchModule'])) {
$module_search_inner = "
INNER JOIN tagente_modulo tam
ON ta.id_agente = tam.id_agente
INNER JOIN tagente_estado tae
ON tae.id_agente_modulo = tam.id_agente_modulo";
$module_search_filter = "AND tam.disabled = 0
AND tam.nombre LIKE '%%" . $this->filter['searchModule'] . "%%' " .
$this->getModuleStatusFilterFromTestado()
;
}
$table = is_metaconsole() ? "tmetaconsole_agent" : "tagente";
$table_sec = is_metaconsole() ? "tmetaconsole_agent_secondary_group" : "tagent_secondary_group";
$sql_model = "SELECT %s FROM
(
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, id_grupo AS g
FROM $table ta
$module_search_inner
WHERE ta.disabled = 0
%s
$agent_search_filter
$agent_status_filter
$module_status_filter
$module_search_filter
$group_acl
GROUP BY id_grupo
UNION ALL
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, id_group AS g
FROM $table ta INNER JOIN $table_sec tasg
ON ta.id_agente = tasg.id_agent
$module_search_inner
WHERE ta.disabled = 0
%s
$agent_search_filter
$agent_status_filter
$module_status_filter
$module_search_filter
$secondary_group_acl
GROUP BY id_group
) x GROUP BY g";
$sql_array = array();
foreach ($inside_fields as $inside_field) {
$sql_array[] = sprintf(
$sql_model,
$inside_field['header'],
$inside_field['condition'],
$inside_field['condition']
);
}
$sql = "SELECT $fields FROM (" . implode(" UNION ALL ", $sql_array) . ") x2
RIGHT JOIN tgrupo tg
ON x2.g = tg.id_grupo
GROUP BY tg.id_grupo";
$stats = db_get_all_rows_sql($sql);
}
else{
$stats = db_get_all_rows_sql(
'SELECT tgs.agents AS total_count, tgs.critical AS total_critical_count,
tgs.unknown AS total_unknown_count, tgs.warning AS total_warning_count,
`non-init` AS total_not_init_count, tgs.normal AS total_normal_count,
tgs.alerts_fired AS total_alerts_count,
tg.nombre AS name, tg.parent, tg.icon, tg.id_grupo AS gid
FROM tgroup_stat tgs
INNER JOIN tgrupo tg
ON tg.id_grupo = tgs.id_group
');
}
# Update the group cache (from db or calculated).
$group_stats = array();
foreach ($stats as $group) {
$group_stats[$group['gid']]['total_count'] = (int)$group['total_count'];
$group_stats[$group['gid']]['total_critical_count'] = (int)$group['total_critical_count'];
$group_stats[$group['gid']]['total_unknown_count'] = (int)$group['total_unknown_count'];
$group_stats[$group['gid']]['total_warning_count'] = (int)$group['total_warning_count'];
$group_stats[$group['gid']]['total_not_init_count'] = (int)$group['total_not_init_count'];
$group_stats[$group['gid']]['total_normal_count'] = (int)$group['total_normal_count'];
$group_stats[$group['gid']]['total_fired_count'] = (int)$group['total_alerts_count'];
$group_stats[$group['gid']]['name'] = $group['name'];
$group_stats[$group['gid']]['parent'] = $group['parent'];
$group_stats[$group['gid']]['icon'] = $group['icon'];
$group_stats[$group['gid']]['id'] = $group['gid'];
$group_stats[$group['gid']] = $this->getProcessedItem($group_stats[$group['gid']]);
}
if (isset($group_stats[$group_id])) {
return $group_stats[$group_id];
}
return $group_stats;
}
protected function getProcessedModules($modules_tree) {
$groups = array();
foreach ($modules_tree as $group) {
$groups[$group["id"]] = $group;
}
// Build the module hierarchy
foreach ($groups as $id => $group) {
if (isset($groups[$id]['parent']) && ($groups[$id]['parent'] != 0)) {
$parent = $groups[$id]['parent'];
// Parent exists
if (!isset($groups[$parent]['children'])) {
$groups[$parent]['children'] = array();
}
// Store a reference to the group into the parent
$groups[$parent]['children'][] = &$groups[$id];
// This group was introduced into a parent
$groups[$id]['have_parent'] = true;
}
}
// Sort the children groups
foreach ($groups as $id => $group) {
if (isset($groups[$id]['children'])) {
usort($groups[$id]['children'], array("Tree", "cmpSortNames"));
}
}
//Filter groups and eliminates the reference to children groups out of her parent
$groups = array_filter($groups, function ($group) {
return !$group['have_parent'];
});
return array_values($groups);
}
// FIXME: Hierarchy lops is broken
protected function getProcessedModules_old($modules_tree) {
$tree_modules = array();
$new_modules_root = array_filter($modules_tree, function ($module) {
return (isset($module['parent']) && ($module['parent'] == 0));
});
$new_modules_child = array_filter($modules_tree, function ($module) {
return (isset($module['parent']) && ($module['parent'] != 0));
});
$i = 0;
while (!empty($new_modules_child)) {
foreach ($new_modules_child as $i => $child) {
TreeGroup::recursive_modules_tree_view($new_modules_root, $new_modules_child, $i, $child);
}
}
foreach ($new_modules_root as $m) {
$tree_modules[] = $m;
}
return $tree_modules;
}
// FIXME with getProcessedModules_old
static function recursive_modules_tree_view (&$new_modules, &$new_modules_child, $i, $child) {
foreach ($new_modules as $index => $module) {
if ($module['id'] == $child['parent']) {
$new_modules[$index]['children'][] = $child;
unset($new_modules_child[$i]);
break;
}
else if (isset($new_modules[$index]['children'])) {
TreeGroup::recursive_modules_tree_view ($new_modules[$index]['children'], $new_modules_child, $i, $child);
}
}
}
static function processCounters(&$groups) {
$all_counters = array();
foreach ($groups as $id => $group) {
$child_counters = array();
if (!empty($groups[$id]['children'])) {
$child_counters = TreeGroup::processCounters($groups[$id]['children']);
}
if (!empty($child_counters)) {
foreach($child_counters as $type => $value) {
$groups[$id]['counters'][$type] += $value;
}
}
foreach($groups[$id]['counters'] as $type => $value) {
$all_counters[$type] += $value;
}
}
return $all_counters;
}
/**
* @brief Recursive function to remove the empty groups
*
* @param groups All groups structure
*
* @return new_groups A new groups structure without empty groups
*/
protected static function deleteEmptyGroups ($groups) {
$new_groups = array();
foreach ($groups as $group) {
// If a group is empty, do not add to new_groups.
if (!isset($group['counters']['total']) || $group['counters']['total'] == 0) {
continue;
}
// Tray to remove the children groups
if (!empty($group['children'])) {
$children = TreeGroup::deleteEmptyGroups ($group['children']);
if (empty($children)) unset($group['children']);
else $group['children'] = $children;
}
$new_groups[] = $group;
}
return $new_groups;
}
private static function extractGroupsWithIDs ($groups, $ids_hash) {
$result_groups = array();
foreach ($groups as $group) {
if (isset($ids_hash[$group['id']])) {
$result_groups[] = $group;
}
else if (!empty($group['children'])) {
$result = self::extractGroupsWithIDs($group['children'], $ids_hash);
// Item found on children
if (!empty($result)) {
$result_groups = array_merge($result_groups, $result);
}
}
}
return $result_groups;
}
private static function extractItemWithID ($items, $item_id, $item_type = "group", $strictACL = false) {
foreach ($items as $item) {
if ($item["type"] != $item_type)
continue;
// Item found
if ($strictACL && is_metaconsole()) {
foreach ($item["id"] as $server_id => $id) {
if ($id == $item_id)
return $item;
}
}
else {
if ($item["id"] == $item_id)
return $item;
}
if ($item["type"] == "group" && !empty($item["children"])) {
$result = self::extractItemWithID($item["children"], $item_id, $item_type, $strictACL);
// Item found on children
if ($result !== false)
return $result;
}
}
// Item not found
return false;
}
protected function getDisplayHierarchy() {
return $this->filter['searchHirearchy'] ||
(empty($this->filter['searchAgent']) && empty($this->filter['searchModule']));
}
}
?>

View File

@ -0,0 +1,60 @@
<?php
//Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
require_once($config['homedir']."/include/class/Tree.class.php");
class TreeModule extends Tree {
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
global $config;
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
$this->L1fieldName = 'name';
$this->L1fieldNameSql = 'tam.nombre';
$this->L1inner = '';
$this->L1orderByFinal = 'name';
$this->L2condition = "AND tam.nombre = '" . $this->symbol2name($this->rootID) . "'";
}
protected function getData() {
if ($this->id == -1) {
$this->getFirstLevel();
} elseif ($this->type == 'module') {
$this->getSecondLevel();
} elseif ($this->type == 'agent') {
$this->getThirdLevel();
}
}
protected function getProcessedItemsFirstLevel($items){
$processed_items = array();
foreach ($items as $key => $item) {
$name = $this->name2symbol($item['name']);
$processed_item = $this->getProcessedItem($item);
$processed_item['id'] = $name;
$processed_item['rootID'] = $name;
$processed_items[] = $processed_item;
}
return $processed_items;
}
}
?>

View File

@ -0,0 +1,49 @@
<?php
//Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
require_once($config['homedir']."/include/class/Tree.class.php");
class TreeModuleGroup extends Tree {
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
global $config;
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
$this->L1fieldName = 'id_module_group';
$this->L1fieldNameSql = 'tam.id_module_group';
$this->L1extraFields = array('tmg.name', 'tmg.id_mg AS id');
$this->L1inner = 'INNER JOIN tmodule_group tmg ON tmg.id_mg = x2.g';
$this->L1orderByFinal = 'tmg.name';
$this->L2condition = "AND tam.id_module_group = " . $this->rootID;
}
protected function getData() {
if ($this->id == -1) {
$this->getFirstLevel();
} elseif ($this->type == 'module_group') {
$this->getSecondLevel();
} elseif ($this->type == 'agent') {
$this->getThirdLevel();
}
}
}
?>

View File

@ -0,0 +1,49 @@
<?php
//Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
require_once($config['homedir']."/include/class/Tree.class.php");
class TreeOS extends Tree {
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
global $config;
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
$this->L1fieldName = 'id_os';
$this->L1fieldNameSql = 'ta.id_os';
$this->L1extraFields = array('tco.name', 'tco.id_os AS id', 'tco.icon_name AS iconHTML');
$this->L1inner = 'INNER JOIN tconfig_os tco ON tco.id_os = x2.g';
$this->L1orderByFinal = 'tco.name';
$this->L2condition = "AND ta.id_os = " . $this->rootID;
}
protected function getData() {
if ($this->id == -1) {
$this->getFirstLevel();
} elseif ($this->type == 'os') {
$this->getSecondLevel();
} elseif ($this->type == 'agent') {
$this->getThirdLevel();
}
}
}
?>

View File

@ -0,0 +1,54 @@
<?php
//Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
require_once($config['homedir']."/include/class/Tree.class.php");
class TreeTag extends Tree {
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
global $config;
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
$this->L1fieldName = 'id_tag';
$this->L1fieldNameSql = 'ttm.id_tag';
$this->L1innerInside = '
INNER JOIN ttag_module ttm
ON ttm.id_agente_modulo = tam.id_agente_modulo
';
$this->L1extraFields = array('tt.name', 'tt.id_tag AS id');
$this->L1inner = 'INNER JOIN ttag tt ON tt.id_tag = x2.g';
$this->L1orderByFinal = 'tt.name';
$this->L2condition = "AND ttm.id_tag = " . $this->rootID;
$this->L2inner = $this->L1innerInside;
}
protected function getData() {
if ($this->id == -1) {
$this->getFirstLevel();
} elseif ($this->type == 'tag') {
$this->getSecondLevel();
} elseif ($this->type == 'agent') {
$this->getThirdLevel();
}
}
}
?>

View File

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

View File

@ -2547,15 +2547,9 @@ function set_when_empty (&$var, $default) {
}
}
function sort_by_column (&$array_ref, $column_parameter) {
global $column;
$column = $column_parameter;
function sort_by_column (&$array_ref, $column) {
if (!empty($column)) {
usort($array_ref, function ($a, $b) {
global $column;
usort($array_ref, function ($a, $b) use ($column) {
return strcmp($a[$column], $b[$column]);
});
}

View File

@ -842,11 +842,18 @@ function agents_get_group_agents (
users_get_groups(false, "AR", true, false, (array)$id_group));
}
}
// Search for primary and secondary groups
if (!empty($id_group)) {
$filter['id_grupo'] = $id_group;
$filter[] = '(' . db_format_array_where_clause_sql(
array(
'id_group' => $id_group,
'id_grupo' => $id_group
),
'OR'
) . ')';
}
if ($search === true) {
//No added search. Show both disabled and non-disabled
}
@ -959,8 +966,8 @@ function agents_get_group_agents (
$filter['order'] = 'alias';
if (is_metaconsole()) {
$table_name = 'tmetaconsole_agent';
$table_name = 'tmetaconsole_agent LEFT JOIN tmetaconsole_agent_secondary_group ON ta.id_agente = tasg.id_agent';
$fields = array(
'id_tagente AS id_agente',
'alias',
@ -968,16 +975,16 @@ function agents_get_group_agents (
);
}
else {
$table_name = 'tagente';
$table_name = 'tagente LEFT JOIN tagent_secondary_group ON id_agente=id_agent';
$fields = array(
'id_agente',
'alias'
);
}
$result = db_get_all_rows_filter($table_name, $filter, $fields);
if ($result === false)
return array (); //Return an empty array
@ -985,7 +992,6 @@ function agents_get_group_agents (
foreach ($result as $row) {
if (!isset($row["id_agente"]) || !isset($row["alias"]))
continue;
if ($serialized && isset($row["id_server"])) {
$key = $row["id_server"] . $separator . $row["id_agente"];
} elseif ($force_serialized) {
@ -2023,8 +2029,7 @@ function agents_get_agentmodule_group ($id_module) {
* @return int The group id
*/
function agents_get_agent_group ($id_agent) {
$table = is_metaconsole() ? "tmetaconsole_agent" : "tagente";
return (int) db_get_value ('id_grupo', $table, 'id_agente', (int) $id_agent);
return (int) db_get_value ('id_grupo', "tagente", 'id_agente', (int) $id_agent);
}
/**
@ -2679,6 +2684,9 @@ function agents_generate_name ($alias, $address = '') {
* @return Array with the main and secondary groups
*/
function agents_get_all_groups_agent ($id_agent, $group = false) {
// Cache the agent id groups
static $cache = array();
if (isset($cache[$id_agent])) return $cache[$id_agent];
// Get the group if is not defined
if ($group === false) $group = agents_get_agent_group($id_agent);
@ -2692,6 +2700,7 @@ function agents_get_all_groups_agent ($id_agent, $group = false) {
// Add a list of groups
$secondary_groups['plain'][] = $group;
$cache[$id_agent] = $secondary_groups['plain'];
return $secondary_groups['plain'];
}

View File

@ -91,7 +91,8 @@ function alerts_get_alerts($id_group = 0, $free_search = "", $status = "all", $s
}
else {
$sql = 'SELECT *, t2.nombre AS module_name,
t3.nombre AS agent_name, t1.name AS template_name,
t3.nombre AS agent_name, t3.alias AS agent_alias,
t1.name AS template_name,
t0.disabled AS alert_disabled ';
}
$sql .= '

View File

@ -2294,19 +2294,4 @@ function config_prepare_session() {
ini_set("post_max_size", $config["max_file_size"]);
ini_set("upload_max_filesize", $config["max_file_size"]);
}
function config_update_value_in_db ($token, $value) {
$inserted_value = db_get_value('value', 'tconfig', '`token`', $token);
if ($inserted_value === false) {
return db_process_sql_insert(
'tconfig',
array('value' => $value, 'token' => $token)
) !== false;
}
else {
return db_process_sql_update(
'tconfig', array('value' => $value), array('token' => $token)
) !== false;
}
}
?>

View File

@ -145,9 +145,10 @@ function events_get_events_grouped($sql_post, $offset = 0,
switch ($config["dbtype"]) {
case "mysql":
db_process_sql ('SET group_concat_max_len = 9999999');
$event_lj = events_get_secondary_groups_left_join($table);
if ($total) {
$sql = "SELECT COUNT(*) FROM (SELECT *
FROM $table te LEFT JOIN tagent_secondary_group tasg ON te.id_agente = tasg.id_agent
FROM $table te $event_lj
WHERE 1=1 " . $sql_post . "
GROUP BY estado, evento, id_agente, id_agentmodule" . $groupby_extra . ") AS t";
}
@ -163,139 +164,10 @@ function events_get_events_grouped($sql_post, $offset = 0,
(SELECT criticity FROM $table WHERE id_evento = MAX(te.id_evento)) AS criticity,
(SELECT ack_utimestamp FROM $table WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp,
(SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = te.id_agentmodule) AS module_name
FROM $table te LEFT JOIN tagent_secondary_group tasg ON te.id_agente = tasg.id_agent
FROM $table te $event_lj
WHERE 1=1 " . $sql_post . "
GROUP BY estado, evento, id_agente, id_agentmodule" . $groupby_extra . "
ORDER BY ";
if (!empty($sort_field)) {
switch ($sort_field) {
case 'event_id':
if ($order=='up')
$sql .= "id_evento" . " ASC";
if ($order=='down')
$sql .= "id_evento" . " DESC";
break;
case 'event_name':
if ($order=='up')
$sql .= "evento" . " ASC";
if ($order=='down')
$sql .= "evento" . " DESC";
break;
case 'event_id':
if ($order=='up')
$sql .= "id_evento" . " ASC";
if ($order=='down')
$sql .= "id_evento" . " DESC";
break;
case 'status':
if ($order=='up')
$sql .= "estado" . " ASC";
if ($order=='down')
$sql .= "estado" . " DESC";
break;
case 'agent_id':
if ($order=='up')
$sql .= "id_agente" . " ASC";
if ($order=='down')
$sql .= "id_agente" . " DESC";
break;
case 'timestamp':
if ($order=='up')
$sql .= "timestamp_rep" . " ASC";
if ($order=='down')
$sql .= "timestamp_rep" . " DESC";
break;
case 'user_id':
if ($order=='up')
$sql .= "id_usuario" . " ASC";
if ($order=='down')
$sql .= "id_usuario" . " DESC";
break;
case 'owner':
if ($order=='up')
$sql .= "owner_user" . " ASC";
if ($order=='down')
$sql .= "owner_user" . " DESC";
break;
case 'group_id':
if ($order=='up')
$sql .= "id_grupo" . " ASC";
if ($order=='down')
$sql .= "id_grupo" . " DESC";
break;
case 'module_name':
if ($order=='up')
$sql .= "module_name" . " ASC";
if ($order=='down')
$sql .= "module_name" . " DESC";
break;
case 'event_type':
if ($order=='up')
$sql .= "event_type" . " ASC";
if ($order=='down')
$sql .= "event_type" . " DESC";
break;
case 'alert_id':
if ($order=='up')
$sql .= "id_alert_am" . " ASC";
if ($order=='down')
$sql .= "id_alert_am" . " DESC";
break;
case 'criticity':
if ($order=='up')
$sql .= "criticity" . " ASC";
if ($order=='down')
$sql .= "criticity" . " DESC";
break;
case 'comment':
if ($order=='up')
$sql .= "user_comment" . " ASC";
if ($order=='down')
$sql .= "user_comment" . " DESC";
break;
case 'tags':
if ($order=='up')
$sql .= "tags" . " ASC";
if ($order=='down')
$sql .= "tags" . " DESC";
break;
case 'source':
if ($order=='up')
$sql .= "source" . " ASC";
if ($order=='down')
$sql .= "source" . " DESC";
break;
case 'extra_id':
if ($order=='up')
$sql .= "id_extra" . " ASC";
if ($order=='down')
$sql .= "id_extra" . " DESC";
break;
case 'ack_timestamp':
if ($order=='up')
$sql .= "ack_utimestamp" . " ASC";
if ($order=='down')
$sql .= "ack_utimestamp" . " DESC";
break;
case 'data':
if ($order=='up')
$sql .= "data" . " ASC";
if ($order=='down')
$sql .= "data" . " DESC";
break;
case 'module_status':
if ($order=='up')
$sql .= "module_status" . " ASC";
if ($order=='down')
$sql .= "module_status" . " DESC";
break;
default:
$sql .= "timestamp_rep" . " DESC";
}
}
GROUP BY estado, evento, id_agente, id_agentmodule" . $groupby_extra;
$sql .= " " . events_get_sql_order($sort_field, $order, 2);
$sql .= " LIMIT " . $offset . "," . $pagination;
}
@ -1657,7 +1529,31 @@ function events_get_all_status ($report = false) {
}
return $fields;
}
}
/**
* Return all event source.
*
* @return array event source array.
*/
function events_get_all_source () {
$event_table = events_get_events_table(is_metaconsole(),false);
$fields = array ();
$fields[''] = __('All');
if (users_is_admin()) {
$sources = db_get_all_rows_sql("SELECT DISTINCT(source) FROM ". $event_table);
} else {
$groups_user = users_get_groups ($config['id_user'], "ER", true);
$sources = db_get_all_rows_sql("SELECT DISTINCT(source) FROM ". $event_table. " WHERE id_grupo IN (" .implode(",",array_keys($groups_user)) .")");
}
foreach ($sources as $key => $source) {
$fields[$source['source']] = $source['source'];
}
return $fields;
}
/**
* Decode a numeric status into status description.
@ -3452,13 +3348,13 @@ function events_get_events_grouped_by_agent($sql_post, $offset = 0,
$fields_extra = '';
}
$event_lj = events_get_secondary_groups_left_join($table);
if ($total) {
$sql = "SELECT COUNT(*) FROM (select id_agente from $table WHERE 1=1
$sql = "SELECT COUNT(*) FROM (select id_agente from $table $event_lj WHERE 1=1
$sql_post GROUP BY id_agente, event_type$groupby_extra ORDER BY id_agente ) AS t";
}
else {
$sql = "select id_agente, count(*) as total$fields_extra from $table te LEFT JOIN tagent_secondary_group tasg
ON te.id_agente = tasg.id_agent
$sql = "select id_agente, count(*) as total$fields_extra from $table te $event_lj
WHERE id_agente > 0 $sql_post GROUP BY id_agente$groupby_extra ORDER BY id_agente LIMIT $offset,$pagination";
}
@ -3472,7 +3368,7 @@ function events_get_events_grouped_by_agent($sql_post, $offset = 0,
foreach ($events as $event) {
if ($meta) {
$sql = "select event_type from $table
$sql = "select event_type from $table te $event_lj
WHERE agent_name = '".$event['agent_name']."' $sql_post ORDER BY utimestamp DESC ";
$resultado = db_get_row_sql($sql);
@ -3483,9 +3379,7 @@ function events_get_events_grouped_by_agent($sql_post, $offset = 0,
'event_type' => $resultado['event_type']);
}
else {
$sql = "SELECT event_type FROM $table te
LEFT JOIN tagent_secondary_group tasg
ON te.id_agente = tasg.id_agent
$sql = "SELECT event_type FROM $table te $event_lj
WHERE id_agente = ".$event['id_agente']." $sql_post ORDER BY utimestamp DESC ";
$resultado = db_get_row_sql($sql);
@ -4328,7 +4222,62 @@ function events_list_events_grouped_agents($sql) {
return html_print_table($table,true);
}
function events_get_sql_order($sort_field = "timestamp", $sort = "DESC", $group_rep = 0) {
$sort_field_translated = $sort_field;
switch ($sort_field) {
case 'event_id':
$sort_field_translated = "id_evento";
break;
case 'event_name':
$sort_field_translated = "evento";
break;
case 'status':
$sort_field_translated = "estado";
break;
case 'agent_id':
$sort_field_translated = "id_agente";
break;
case 'timestamp':
$sort_field_translated = ($group_rep == 0) ? "timestamp" : "timestamp_rep";
break;
case 'user_id':
$sort_field_translated = "id_usuario";
break;
case 'owner':
$sort_field_translated = "owner_user";
break;
case 'group_id':
$sort_field_translated = "id_grupo";
break;
case 'alert_id':
$sort_field_translated = "id_alert_am";
break;
case 'comment':
$sort_field_translated = "user_comment";
break;
case 'extra_id':
$sort_field_translated = "id_extra";
break;
}
$dir = ($sort == "up") ? "ASC" : "DESC";
return "ORDER BY $sort_field_translated $dir";
}
/**
* SQL left join of event queries to handle secondary groups
*
* @param string Table to see if is metaconsole or not
*
* @return string With the query.
*/
function events_get_secondary_groups_left_join($table) {
if ($table == 'tevento') {
return "LEFT JOIN tagent_secondary_group tasg ON te.id_agente = tasg.id_agent";
}
return "LEFT JOIN tmetaconsole_agent_secondary_group tasg
ON te.id_agente = tasg.id_tagente AND te.server_id = tasg.id_tmetaconsole_setup";
}
?>

View File

@ -172,6 +172,10 @@ function gis_make_layer($name, $visible = true, $dot = null, $idLayer = null, $p
}
$visible = (bool)$visible;
$ajax_url = $public_console
? ui_get_full_url('operation/gis_maps/ajax.php', false, false, false, false)
: ui_get_full_url('ajax.php', false, false, false, false);
?>
<script type="text/javascript">
$(document).ready (
@ -210,7 +214,9 @@ function gis_make_layer($name, $visible = true, $dot = null, $idLayer = null, $p
.css("text-align", "center")
.html('<img src="' + img_src + '" />')
.dialog({
title: "<?php echo __('Agent'); ?> #" + featureData.id,
title: featureData.type == "point_group_info"
? "<?php echo __('Group'); ?> #" + featureData.id_parent
: "<?php echo __('Agent'); ?> #" + featureData.id,
resizable: true,
draggable: true,
modal: true,
@ -224,11 +230,12 @@ function gis_make_layer($name, $visible = true, $dot = null, $idLayer = null, $p
});
jQuery.ajax ({
url: "<?php echo ui_get_full_url('ajax.php', false, false, false, false); ?>",
url: "<?php echo $ajax_url; ?>",
data: {
page: "operation/gis_maps/ajax",
opt: featureData.type,
id: featureData.id,
id_parent: featureData.id_parent,
hash: "<?php echo $hash; ?>",
id_user: "<?php echo $config['id_user']; ?>",
map_id: <?php echo (int)$id_map; ?>
@ -469,6 +476,38 @@ function gis_get_agents_layer($idLayer) {
return $returned_agents;
}
/**
* Get the groups into the layer by agent Id.
*
* @param integer $idLayer Layer Id.
*
* @return array.
*/
function gis_get_groups_layer_by_agent_id ($idLayer) {
$sql = sprintf(
"SELECT
tg.id_grupo AS id,
tg.nombre AS name,
ta.id_agente AS agent_id,
ta.alias AS agent_alias,
ta.nombre AS agent_name
FROM tgis_map_layer_groups tgmlg
INNER JOIN tgrupo tg
ON tgmlg.group_id = tg.id_grupo
INNER JOIN tagente ta
ON tgmlg.agent_id = ta.id_agente
WHERE tgmlg.layer_id = %d",
$idLayer
);
$groups = db_get_all_rows_sql($sql);
if ($groups === false) $groups = array();
return array_reduce($groups, function ($all, $item) {
$all[$item["agent_id"]] = $item;
return $all;
}, array());
}
function gis_add_point_path($layerName, $lat, $lon, $color, $manual = 1, $id) {
?>
<script type="text/javascript">
@ -823,12 +862,25 @@ function gis_save_map($map_name, $map_initial_longitude, $map_initial_latitude,
'tgrupo_id_grupo' => $layer['layer_group']
)
);
// Angent
if ((isset($layer['layer_agent_list'])) AND (count($layer['layer_agent_list']) > 0)) {
foreach ($layer['layer_agent_list'] as $agent_name) {
foreach ($layer['layer_agent_list'] as $agent) {
db_process_sql_insert('tgis_map_layer_has_tagente',
array(
'tgis_map_layer_id_tmap_layer' => $idLayer,
'tagente_id_agente' => agents_get_agent_id(io_safe_input($agent_name))
'tagente_id_agente' => $agent["id"]
)
);
}
}
// Group
if ((isset($layer['layer_group_list'])) AND (count($layer['layer_group_list']) > 0)) {
foreach ($layer['layer_group_list'] as $group) {
db_process_sql_insert('tgis_map_layer_groups',
array(
"layer_id" => $idLayer,
"group_id" => $group["id"],
"agent_id" => $group["agent_id"]
)
);
}
@ -880,11 +932,12 @@ function gis_update_map($idMap, $map_name, $map_initial_longitude, $map_initial_
foreach ($listOldIdLayers as $idLayer) {
db_process_sql_delete('tgis_map_layer_has_tagente',
array('tgis_map_layer_id_tmap_layer' => $idLayer['id_tmap_layer']));
db_process_sql_delete('tgis_map_layer_groups',
array('layer_id' => $idLayer['id_tmap_layer']));
$list_onlyIDsLayers[$idLayer['id_tmap_layer']] = 0;
}
foreach ($arrayLayers as $index => $layer) {
if ($layer['id'] != 0) {
@ -915,18 +968,28 @@ function gis_update_map($idMap, $map_name, $map_initial_longitude, $map_initial_
if (array_key_exists('layer_agent_list', $layer)) {
if (count($layer['layer_agent_list']) > 0) {
foreach ($layer['layer_agent_list'] as $agent_name) {
db_process_sql_insert('tgis_map_layer_has_tagente',
foreach ($layer['layer_agent_list'] as $agent) {
$id = db_process_sql_insert('tgis_map_layer_has_tagente',
array(
'tgis_map_layer_id_tmap_layer' => $idLayer,
'tagente_id_agente' => agents_get_agent_id(
io_safe_input($agent_name))
'tagente_id_agente' => $agent["id"]
)
);
}
}
}
if (array_key_exists('layer_group_list', $layer)) {
if (count($layer['layer_group_list']) > 0) {
foreach ($layer['layer_group_list'] as $group) {
$id = db_process_sql_insert('tgis_map_layer_groups', array(
"layer_id" => $idLayer,
"group_id" => $group["id"],
"agent_id" => $group["agent_id"]
));
}
}
}
}
//Delete layers that not carry the $arrayLayers
@ -1244,7 +1307,8 @@ function gis_get_map_data($idMap) {
break;
}
$sql = "SELECT id_tmap_layer, layer_name,
$sql = "SELECT id_tmap_layer AS id,
layer_name,
tgrupo_id_grupo AS layer_group,
view_layer AS layer_visible
FROM tgis_map_layer
@ -1254,12 +1318,12 @@ function gis_get_map_data($idMap) {
if ($layers === false) $layers = array();
foreach ($layers as $index => $layer) {
if (!isset($layer['id_tmap_layer']))
continue;
if (!isset($layer['id'])) continue;
$id_tmap_layer = (int) $layer['id_tmap_layer'];
$id_tmap_layer = (int) $layer['id'];
$sql = "SELECT nombre
// Agent list
$sql = "SELECT id_agente AS id, alias
FROM tagente
WHERE id_agente IN (
SELECT tagente_id_agente
@ -1269,6 +1333,26 @@ function gis_get_map_data($idMap) {
if ($agents === false) $agents = array();
$layers[$index]['layer_agent_list'] = $agents;
// Group list
$sql = sprintf(
"SELECT
tg.id_grupo AS id,
tg.nombre AS name,
ta.id_agente AS agent_id,
ta.alias AS agent_alias
FROM tgis_map_layer_groups tgmlg
INNER JOIN tgrupo tg
ON tgmlg.group_id = tg.id_grupo
INNER JOIN tagente ta
ON tgmlg.agent_id = ta.id_agente
WHERE tgmlg.layer_id = %d",
$id_tmap_layer
);
$groups = db_get_all_rows_sql($sql);
if ($groups === false) $groups = array();
$layers[$index]['layer_group_list'] = $groups;
}
$returnVar['map'] = $map;
@ -1331,63 +1415,6 @@ function gis_get_num_zoom_levels_connection_default($map_connection_list) {
}
}
/**
* This function use in form the "pandora_console/godmode/gis_maps/configure_gis_map.php"
* in the case of edit a map or when there are any error in save new map. Because this function
* return a html code that it has the rows of layers of map.
*
* @param Array $layer_list The list of layers for convert a html.
*
* @return String The html source code.
*/
function gis_add_layer_list($layer_list) {
$returnVar = '';
$count = 0;
foreach ($layer_list as $layer) {
//Create the layer temp form as it was in the form
$layerTempForm = array();
$layerTempForm['id'] = $layer['id'];
$layerTempForm['layer_name'] = $layer['layer_name'];
$layerTempForm['layer_group'] = $layer['layer_group'];
$layerTempForm['layer_visible'] = $layer['layer_visible'];
if (array_key_exists('layer_agent_list', $layer)) {
foreach ($layer['layer_agent_list'] as $agent) {
$layerTempForm['layer_agent_list'][] = $agent;
}
}
$layerDataJSON = json_encode($layerTempForm);
$returnVar .= '
<tbody id="layer_item_' . $count . '">
<tr>
<td class="col1">' .
$layer['layer_name'] .
'</td>
<td class="up_arrow"><a id="up_arrow" href="javascript: upLayer(' . $count . ');">' . html_print_image("images/up.png", true, array("alt" => "")) . '</a></td>
<td class="down_arrow"><a id="down_arrow" href="javascript: downLayer(' . $count . ');">' . html_print_image("images/down.png", true, array("alt" => "")) . '</a></td>
<td class="col3">
<a id="edit_layer" href="javascript: editLayer(' . $count . ');">' . html_print_image("images/config.png", true, array("alt" => "")) . '</a>
</td>
<td class="col4">
<input type="hidden" name="layer_values_' . $count . '" value=\'' . $layerDataJSON . '\' id="layer_values_' . $count . '" />
<a id="delete_row" href="javascript: deleteLayer(' . $count . ')">' . html_print_image("images/cross.png", true, array("alt" => "")) . '</a>
</td>
</tr>
</tbody>
<script type="text/javascript">
layerList.push(countLayer);
countLayer++;
updateArrowLayers();
</script>';
$count ++;
}
return $returnVar;
}
function gis_calculate_distance($lat_start, $lon_start, $lat_end, $lon_end) {
//Use 3958.9=miles, 6371.0=Km;
$earthRadius = 6371;

View File

@ -1206,19 +1206,7 @@ function groups_get_agents_counter ($group, $agent_filter = array(), $module_fil
$groups_clause = "AND ta.id_grupo IN ($group_str)";
$tags_clause = "";
if ($strict_user && !empty($groups_and_tags)) {
foreach ($groups as $group_id) {
if (isset($groups_and_tags[$group_id]) && !empty($groups_and_tags[$group_id])) {
$tags_str = $groups_and_tags[$group_id];
$tags_clause .= " AND (ta.grupo <> $group_id
OR (ta.grupo = $group_id
AND tam.id_agente_modulo NOT IN (SELECT id_agente_modulo
FROM ttag_module
WHERE id_tag NOT IN ($tags_str) )))";
}
}
}
$agent_name_filter = "";
$agent_status = AGENT_STATUS_ALL;
if (!empty($agent_filter)) {
@ -1662,22 +1650,10 @@ function groups_get_monitors_counter ($group, $agent_filter = array(), $module_f
}
$group_str = implode (",", $groups);
$groups_clause = "AND ta.id_grupo IN ($group_str)";
$groups_clause = "AND (ta.id_grupo IN ($group_str) OR tasg.id_group IN ($group_str))";
$tags_clause = "";
if ($strict_user && !empty($groups_and_tags)) {
foreach ($groups as $group_id) {
if (isset($groups_and_tags[$group_id]) && !empty($groups_and_tags[$group_id])) {
$tags_str = $groups_and_tags[$group_id];
$tags_clause .= " AND (ta.grupo <> $group_id
OR (ta.grupo = $group_id
AND tam.id_agente_modulo NOT IN (SELECT id_agente_modulo
FROM ttag_module
WHERE id_tag NOT IN ($tags_str) )))";
}
}
}
$agent_name_filter = "";
$agents_clause = "";
if (!empty($agent_filter)) {
@ -1775,36 +1751,38 @@ function groups_get_monitors_counter ($group, $agent_filter = array(), $module_f
$modules_clause
INNER JOIN tagente ta
ON tam.id_agente = ta.id_agente
LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent
AND ta.disabled = 0
$agent_name_filter
$agents_clause
$groups_clause
WHERE tam.disabled = 0
$module_name_filter
$groups_clause
$tags_clause";
}
else {
$status_columns_array = array();
foreach ($module_status_array as $status) {
foreach ($status_array as $status) {
switch ($status) {
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
case AGENT_MODULE_STATUS_CRITICAL_BAD:
$status_columns_array[] = 'ta.critical_count';
$status_columns_array['critical'] = 'critical_count';
break;
case AGENT_MODULE_STATUS_WARNING_ALERT:
case AGENT_MODULE_STATUS_WARNING:
$status_columns_array[] = 'ta.warning_count';
$status_columns_array['warn'] = 'warning_count';
break;
case AGENT_MODULE_STATUS_UNKNOWN:
$status_columns_array[] = 'ta.unknown_count';
$status_columns_array['unk'] = 'unknown_count';
break;
case AGENT_MODULE_STATUS_NO_DATA:
case AGENT_MODULE_STATUS_NOT_INIT:
$status_columns_array[] = 'ta.notinit_count';
$status_columns_array['notinit'] = 'notinit_count';
break;
case AGENT_MODULE_STATUS_NORMAL_ALERT:
case AGENT_MODULE_STATUS_NORMAL:
$status_columns_array[] = 'ta.normal_count';
$status_columns_array['normal'] = 'normal_count';
break;
default:
// The type doesn't exist
@ -1816,13 +1794,16 @@ function groups_get_monitors_counter ($group, $agent_filter = array(), $module_f
$status_columns_str = implode(",", $status_columns_array);
$sql = "SELECT SUM($status_columns_str)
FROM tagente ta
$sql = "SELECT SUM($status_columns_str) FROM
(SELECT DISTINCT(ta.id_agente), $status_columns_str
FROM tagente ta LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent
WHERE ta.disabled = 0
$agent_name_filter
$agents_clause
$groups_clause
$tags_clause";
$tags_clause
) AS t1";
}
$count = (int) db_get_sql ($sql);
@ -2352,70 +2333,42 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
if ($id_user == false) {
$id_user = $config['id_user'];
}
$user_groups = array();
$user_tags = array();
$groups_without_tags = array();
foreach ($acltags as $group => $tags) {
if ($user_strict) { //Remove groups with tags
if ($tags == '') {
$groups_without_tags[$group] = $group;
}
}
$user_groups[$group] = groups_get_name($group);
if ($tags != '') {
$tags_group = explode(',', $tags);
foreach ($tags_group as $tag) {
$user_tags[$tag] = tags_get_name($tag);
}
}
}
if ($user_strict) {
$user_groups_ids = implode(',', array_keys($groups_without_tags));
}
else {
$user_groups_ids = implode(',', array_keys($acltags));
}
$user_groups_ids = implode(',', array_keys($acltags));
if (!empty($user_groups_ids)) {
switch ($config["dbtype"]) {
case "mysql":
$list_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ")
ORDER BY nombre COLLATE utf8_general_ci ASC");
break;
case "postgresql":
$list_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ")
ORDER BY nombre ASC");
break;
case "oracle":
$list_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ")
ORDER BY nombre ASC");
break;
}
$list_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ")
ORDER BY nombre COLLATE utf8_general_ci ASC"
);
}
$list = array();
if ($list_groups == false) {
$list_groups = array();
}
if ($returnAllGroup) {
$i = 1;
$list[0]['_id_'] = 0;
$list[0]['_name_'] = __('All');
$list[0]['_agents_unknown_'] = 0;
$list[0]['_monitors_alerts_fired_'] = 0;
$list[0]['_total_agents_'] = 0;
@ -2425,7 +2378,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
$list[0]['_monitors_unknown_'] = 0;
$list[0]['_monitors_not_init_'] = 0;
$list[0]['_agents_not_init_'] = 0;
if ($mode == 'tactical') {
$list[0]['_agents_ok_'] = 0;
$list[0]['_agents_warning_'] = 0;
@ -2436,81 +2389,93 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
else {
$i = 0;
}
/*
/*
* Agent cache for metaconsole.
* Retrieve the statistic data from the cache table.
*/
if (!$user_strict && is_metaconsole() && !empty($list_groups)) {
if (is_metaconsole() && !empty($list_groups)) {
$cache_table = 'tmetaconsole_agent';
$sql_stats = "SELECT id_grupo, COUNT(id_agente) AS agents_total,
SUM(total_count) AS monitors_total,
SUM(normal_count) AS monitors_ok,
SUM(warning_count) AS monitors_warning,
SUM(critical_count) AS monitors_critical,
SUM(unknown_count) AS monitors_unknown,
SUM(notinit_count) AS monitors_not_init,
SUM(fired_count) AS alerts_fired
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
GROUP BY id_grupo";
$sql_stats =
"SELECT id_grupo, COUNT(id_agente) AS agents_total,
SUM(total_count) AS monitors_total,
SUM(normal_count) AS monitors_ok,
SUM(warning_count) AS monitors_warning,
SUM(critical_count) AS monitors_critical,
SUM(unknown_count) AS monitors_unknown,
SUM(notinit_count) AS monitors_not_init,
SUM(fired_count) AS alerts_fired
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
GROUP BY id_grupo"
;
$data_stats = db_get_all_rows_sql($sql_stats);
$sql_stats_unknown = "SELECT id_grupo, COUNT(id_agente) AS agents_unknown
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND critical_count = 0
AND warning_count = 0
AND unknown_count > 0
GROUP BY id_grupo";
$sql_stats_unknown =
"SELECT id_grupo, COUNT(id_agente) AS agents_unknown
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND critical_count = 0
AND warning_count = 0
AND unknown_count > 0
GROUP BY id_grupo"
;
$data_stats_unknown = db_get_all_rows_sql($sql_stats_unknown);
$sql_stats_not_init = "SELECT id_grupo, COUNT(id_agente) AS agents_not_init
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND (total_count = 0 OR total_count = notinit_count)
GROUP BY id_grupo";
$sql_stats_not_init =
"SELECT id_grupo, COUNT(id_agente) AS agents_not_init
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND (total_count = 0 OR total_count = notinit_count)
GROUP BY id_grupo"
;
$data_stats_not_init = db_get_all_rows_sql($sql_stats_not_init);
if ($mode == 'tactical' || $mode == 'tree') {
$sql_stats_ok = "SELECT id_grupo, COUNT(id_agente) AS agents_ok
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND critical_count = 0
AND warning_count = 0
AND unknown_count = 0
AND normal_count > 0
GROUP BY id_grupo";
$sql_stats_ok =
"SELECT id_grupo, COUNT(id_agente) AS agents_ok
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND critical_count = 0
AND warning_count = 0
AND unknown_count = 0
AND normal_count > 0
GROUP BY id_grupo"
;
$data_stats_ok = db_get_all_rows_sql($sql_stats_ok);
$sql_stats_warning = "SELECT id_grupo, COUNT(id_agente) AS agents_warning
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND critical_count = 0
AND warning_count > 0
GROUP BY id_grupo";
$sql_stats_warning =
"SELECT id_grupo, COUNT(id_agente) AS agents_warning
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND critical_count = 0
AND warning_count > 0
GROUP BY id_grupo"
;
$data_stats_warning = db_get_all_rows_sql($sql_stats_warning);
$sql_stats_critical = "SELECT id_grupo, COUNT(id_agente) AS agents_critical
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND critical_count > 0
GROUP BY id_grupo";
$sql_stats_critical =
"SELECT id_grupo, COUNT(id_agente) AS agents_critical
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND critical_count > 0
GROUP BY id_grupo"
;
$data_stats_critical = db_get_all_rows_sql($sql_stats_critical);
}
$stats_by_group = array();
if (!empty($data_stats)) {
foreach ($data_stats as $value) {
$group_id = (int) $value['id_grupo'];
$stats = array();
$stats['agents_total'] = (int) $value['agents_total'];
$stats['monitors_total'] = (int) $value['monitors_total'];
@ -2522,7 +2487,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
$stats['alerts_fired'] = (int) $value['alerts_fired'];
$stats_by_group[$group_id] = $stats;
}
if (!empty($stats_by_group)) {
if (!empty($data_stats_unknown)) {
foreach ($data_stats_unknown as $value) {
@ -2567,26 +2532,26 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
}
}
}
foreach ($list_groups as $key => $item) {
$id = $item['id_grupo'];
if (!$user_strict && is_metaconsole()) { // Agent cache
if (is_metaconsole()) { // Agent cache
$group_stat = array();
if (isset($stats_by_group[$id]))
$group_stat = $stats_by_group[$id];
$list[$i]['_id_'] = $id;
$list[$i]['_name_'] = $item['nombre'];
$list[$i]['_iconImg_'] = html_print_image ("images/groups_small/" . groups_get_icon($item['id_grupo']).".png", true, array ("style" => 'vertical-align: middle;'));
if ($mode == 'tree' && !empty($item['parent']))
$list[$i]['_parent_id_'] = $item['parent'];
$list[$i]['_agents_unknown_'] = isset($group_stat['agents_unknown']) ? $group_stat['agents_unknown'] : 0;
$list[$i]['_monitors_alerts_fired_'] = isset($group_stat['alerts_fired']) ? $group_stat['alerts_fired'] : 0;
$list[$i]['_total_agents_'] = isset($group_stat['agents_total']) ? $group_stat['agents_total'] : 0;
// This fields are not in database
$list[$i]['_monitors_ok_'] = isset($group_stat['monitors_ok']) ? $group_stat['monitors_ok'] : 0;
$list[$i]['_monitors_critical_'] = isset($group_stat['monitors_critical']) ? $group_stat['monitors_critical'] : 0;
@ -2594,38 +2559,38 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
$list[$i]['_monitors_unknown_'] = isset($group_stat['monitors_unknown']) ? $group_stat['monitors_unknown'] : 0;
$list[$i]['_monitors_not_init_'] = isset($group_stat['monitors_not_init']) ? $group_stat['monitors_not_init'] : 0;
$list[$i]['_agents_not_init_'] = isset($group_stat['agents_not_init']) ? $group_stat['agents_not_init'] : 0;
if ($mode == 'tactical' || $mode == 'tree') {
$list[$i]['_agents_ok_'] = isset($group_stat['agents_ok']) ? $group_stat['agents_ok'] : 0;
$list[$i]['_agents_warning_'] = isset($group_stat['agents_warning']) ? $group_stat['agents_warning'] : 0;
$list[$i]['_agents_critical_'] = isset($group_stat['agents_critical']) ? $group_stat['agents_critical'] : 0;
$list[$i]['_monitors_alerts_'] = isset($group_stat['alerts']) ? $group_stat['alerts'] : 0;;
$list[$i]["_monitor_alerts_fire_count_"] = $group_stat[0]["alerts_fired"];
$list[$i]["_total_checks_"] = $group_stat[0]["modules"];
$list[$i]["_total_alerts_"] = $group_stat[0]["alerts"];
}
if ($mode == 'tactical') {
// Get total count of monitors for this group, except disabled.
// Get total count of monitors for this group, except disabled.
$list[$i]["_monitor_checks_"] = $list[$i]["_monitors_not_init_"] + $list[$i]["_monitors_unknown_"] + $list[$i]["_monitors_warning_"] + $list[$i]["_monitors_critical_"] + $list[$i]["_monitors_ok_"];
// Calculate not_normal monitors
$list[$i]["_monitor_not_normal_"] = $list[$i]["_monitor_checks_"] - $list[$i]["_monitors_ok_"];
if ($list[$i]["_monitor_not_normal_"] > 0 && $list[$i]["_monitor_checks_"] > 0) {
$list[$i]["_monitor_health_"] = format_numeric (100 - ($list[$i]["_monitor_not_normal_"] / ($list[$i]["_monitor_checks_"] / 100)), 1);
}
else {
$list[$i]["_monitor_health_"] = 100;
}
if ($list[$i]["_monitors_not_init_"] > 0 && $list[$i]["_monitor_checks_"] > 0) {
$list[$i]["_module_sanity_"] = format_numeric (100 - ($list[$i]["_monitors_not_init_"] / ($list[$i]["_monitor_checks_"] / 100)), 1);
}
else {
$list[$i]["_module_sanity_"] = 100;
}
if (isset($list[$i]["_alerts_"])) {
if ($list[$i]["_monitors_alerts_fired_"] > 0 && $list[$i]["_alerts_"] > 0) {
$list[$i]["_alert_level_"] = format_numeric (100 - ($list[$i]["_monitors_alerts_fired_"] / ($list[$i]["_alerts_"] / 100)), 1);
@ -2638,19 +2603,19 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
$list[$i]["_alert_level_"] = 100;
$list[$i]["_alerts_"] = 0;
}
$list[$i]["_monitor_bad_"] = $list[$i]["_monitors_critical_"] + $list[$i]["_monitors_warning_"];
if ($list[$i]["_monitor_bad_"] > 0 && $list[$i]["_monitor_checks_"] > 0) {
$list[$i]["_global_health_"] = format_numeric (100 - ($list[$i]["_monitor_bad_"] / ($list[$i]["_monitor_checks_"] / 100)), 1);
}
else {
$list[$i]["_global_health_"] = 100;
}
$list[$i]["_server_sanity_"] = format_numeric (100 - $list[$i]["_module_sanity_"], 1);
}
if ($returnAllGroup) {
$list[0]['_agents_unknown_'] += $list[$i]['_agents_unknown_'];
$list[0]['_monitors_alerts_fired_'] += $list[$i]['_monitors_alerts_fired_'];
@ -2661,7 +2626,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
$list[0]['_monitors_unknown_'] += $list[$i]['_monitors_unknown_'];
$list[0]['_monitors_not_init_'] += $list[$i]['_monitors_not_init_'];
$list[0]['_agents_not_init_'] += $list[$i]['_agents_not_init_'];
if ($mode == 'tactical' || $mode == 'tree') {
$list[0]['_agents_ok_'] += $list[$i]['_agents_ok_'];
$list[0]['_agents_warning_'] += $list[$i]['_agents_warning_'];
@ -2669,7 +2634,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
$list[0]['_monitors_alerts_'] += $list[$i]['_monitors_alerts_'];
}
}
if ($mode == 'group') {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0)
&& ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0)
@ -2677,26 +2642,26 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
unset($list[$i]);
}
}
}
else if (($config["realtimestats"] == 0) && !$user_strict) {
else if (($config["realtimestats"] == 0)) {
$group_stat = db_get_all_rows_sql ("SELECT *
FROM tgroup_stat, tgrupo
WHERE tgrupo.id_grupo = tgroup_stat.id_group
AND tgroup_stat.id_group = $id
ORDER BY nombre");
$list[$i]['_id_'] = $id;
$list[$i]['_name_'] = $item['nombre'];
$list[$i]['_iconImg_'] = html_print_image ("images/groups_small/" . groups_get_icon($item['id_grupo']).".png", true, array ("style" => 'vertical-align: middle;'));
if ($mode == 'tree' && !empty($item['parent']))
$list[$i]['_parent_id_'] = $item['parent'];
$list[$i]['_agents_unknown_'] = $group_stat[0]["unknown"];
$list[$i]['_monitors_alerts_fired_'] = $group_stat[0]["alerts_fired"];
$list[$i]['_total_agents_'] = $group_stat[0]["agents"];
// This fields are not in database
$list[$i]['_monitors_ok_'] = (int) groups_get_normal_monitors($id);
$list[$i]['_monitors_critical_'] = (int) groups_get_critical_monitors($id);
@ -2704,38 +2669,38 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
$list[$i]['_monitors_unknown_'] = (int) groups_get_unknown_monitors($id);
$list[$i]['_monitors_not_init_'] = (int) groups_get_not_init_monitors($id);
$list[$i]['_agents_not_init_'] = (int) groups_get_not_init_agents($id);
if ($mode == 'tactical' || $mode == 'tree') {
$list[$i]['_agents_ok_'] = $group_stat[0]["normal"];
$list[$i]['_agents_warning_'] = $group_stat[0]["warning"];
$list[$i]['_agents_critical_'] = $group_stat[0]["critical"];
$list[$i]['_monitors_alerts_'] = $group_stat[0]["alerts"];
$list[$i]["_monitor_alerts_fire_count_"] = $group_stat[0]["alerts_fired"];
$list[$i]["_total_checks_"] = $group_stat[0]["modules"];
$list[$i]["_total_alerts_"] = $group_stat[0]["alerts"];
}
if ($mode == 'tactical') {
// Get total count of monitors for this group, except disabled.
// Get total count of monitors for this group, except disabled.
$list[$i]["_monitor_checks_"] = $list[$i]["_monitors_not_init_"] + $list[$i]["_monitors_unknown_"] + $list[$i]["_monitors_warning_"] + $list[$i]["_monitors_critical_"] + $list[$i]["_monitors_ok_"];
// Calculate not_normal monitors
$list[$i]["_monitor_not_normal_"] = $list[$i]["_monitor_checks_"] - $list[$i]["_monitors_ok_"];
if ($list[$i]["_monitor_not_normal_"] > 0 && $list[$i]["_monitor_checks_"] > 0) {
$list[$i]["_monitor_health_"] = format_numeric (100 - ($list[$i]["_monitor_not_normal_"] / ($list[$i]["_monitor_checks_"] / 100)), 1);
}
else {
$list[$i]["_monitor_health_"] = 100;
}
if ($list[$i]["_monitors_not_init_"] > 0 && $list[$i]["_monitor_checks_"] > 0) {
$list[$i]["_module_sanity_"] = format_numeric (100 - ($list[$i]["_monitors_not_init_"] / ($list[$i]["_monitor_checks_"] / 100)), 1);
}
else {
$list[$i]["_module_sanity_"] = 100;
}
if (isset($list[$i]["_alerts_"])) {
if ($list[$i]["_monitors_alerts_fired_"] > 0 && $list[$i]["_alerts_"] > 0) {
$list[$i]["_alert_level_"] = format_numeric (100 - ($list[$i]["_monitors_alerts_fired_"] / ($list[$i]["_alerts_"] / 100)), 1);
@ -2743,24 +2708,24 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
else {
$list[$i]["_alert_level_"] = 100;
}
}
}
else {
$list[$i]["_alert_level_"] = 100;
$list[$i]["_alerts_"] = 0;
}
$list[$i]["_monitor_bad_"] = $list[$i]["_monitors_critical_"] + $list[$i]["_monitors_warning_"];
if ($list[$i]["_monitor_bad_"] > 0 && $list[$i]["_monitor_checks_"] > 0) {
$list[$i]["_global_health_"] = format_numeric (100 - ($list[$i]["_monitor_bad_"] / ($list[$i]["_monitor_checks_"] / 100)), 1);
}
else {
$list[$i]["_global_health_"] = 100;
}
$list[$i]["_server_sanity_"] = format_numeric (100 - $list[$i]["_module_sanity_"], 1);
}
if ($returnAllGroup) {
$list[0]['_agents_unknown_'] += $group_stat[0]["unknown"];
$list[0]['_monitors_alerts_fired_'] += $group_stat[0]["alerts_fired"];
@ -2771,7 +2736,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
$list[0]['_monitors_unknown_'] += $list[$i]['_monitors_unknown_'];
$list[0]['_monitors_not_init_'] += $list[$i]['_monitors_not_init_'];
$list[0]['_agents_not_init_'] += $list[$i]['_agents_not_init_'];
if ($mode == 'tactical' || $mode == 'tree') {
$list[0]['_agents_ok_'] += $group_stat[0]["normal"];
$list[0]['_agents_warning_'] += $group_stat[0]["warning"];
@ -2779,7 +2744,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
$list[0]['_monitors_alerts_'] += $group_stat[0]["alerts"];
}
}
if ($mode == 'group') {
if (! defined ('METACONSOLE')) {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) {
@ -2792,16 +2757,15 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
}
}
}
}
else {
$list[$i]['_id_'] = $id;
$list[$i]['_name_'] = $item['nombre'];
$list[$i]['_iconImg_'] = html_print_image ("images/groups_small/" . groups_get_icon($item['id_grupo']).".png", true, array ("style" => 'vertical-align: middle;'));
if ($mode == 'tree' && !empty($item['parent']))
$list[$i]['_parent_id_'] = $item['parent'];
$list[$i]['_monitors_ok_'] = (int) groups_get_normal_monitors ($id, $agent_filter, $module_filter, $user_strict, $acltags, $config["realtimestats"]);
$list[$i]['_monitors_critical_'] = (int) groups_get_critical_monitors ($id, $agent_filter, $module_filter, $user_strict, $acltags, $config["realtimestats"]);
$list[$i]['_monitors_warning_'] = (int) groups_get_warning_monitors ($id, $agent_filter, $module_filter, $user_strict, $acltags, $config["realtimestats"]);
@ -2811,37 +2775,37 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
$list[$i]['_total_agents_'] = (int) groups_get_total_agents ($id, $agent_filter, $module_filter, $user_strict, $acltags, $config["realtimestats"]);
$list[$i]['_agents_unknown_'] = (int) groups_get_unknown_agents ($id, $agent_filter, $module_filter, $user_strict, $acltags, $config["realtimestats"]);
$list[$i]['_agents_not_init_'] = (int) groups_get_not_init_agents ($id, $agent_filter, $module_filter, $user_strict, $acltags, $config["realtimestats"]);
if ($mode == 'tactical' || $mode == 'tree') {
$list[$i]['_agents_ok_'] = (int) groups_get_normal_agents ($id, $agent_filter, $module_filter, $user_strict, $acltags, $config["realtimestats"]);
$list[$i]['_agents_warning_'] = (int) groups_get_warning_agents ($id, $agent_filter, $module_filter, $user_strict, $acltags, $config["realtimestats"]);
$list[$i]['_agents_critical_'] = (int) groups_get_critical_agents ($id, $agent_filter, $module_filter, $user_strict, $acltags, $config["realtimestats"]);
$list[$i]['_monitors_alerts_'] = groups_monitor_alerts ($id, $user_strict, $id);
// TODO
//~ $list[$i]["_total_checks_"]
//~ $list[$i]["_total_checks_"]
//~ $list[$i]["_total_alerts_"]
// Get total count of monitors for this group, except disabled.
// Get total count of monitors for this group, except disabled.
$list[$i]["_monitor_checks_"] = $list[$i]["_monitors_not_init_"] + $list[$i]["_monitors_unknown_"] + $list[$i]["_monitors_warning_"] + $list[$i]["_monitors_critical_"] + $list[$i]["_monitors_ok_"];
// Calculate not_normal monitors
$list[$i]["_monitor_not_normal_"] = $list[$i]["_monitor_checks_"] - $list[$i]["_monitors_ok_"];
if ($list[$i]["_monitor_not_normal_"] > 0 && $list[$i]["_monitor_checks_"] > 0) {
$list[$i]["_monitor_health_"] = format_numeric (100 - ($list[$i]["_monitor_not_normal_"] / ($list[$i]["_monitor_checks_"] / 100)), 1);
}
else {
$list[$i]["_monitor_health_"] = 100;
}
if ($list[$i]["_monitors_not_init_"] > 0 && $list[$i]["_monitor_checks_"] > 0) {
$list[$i]["_module_sanity_"] = format_numeric (100 - ($list[$i]["_monitors_not_init_"] / ($list[$i]["_monitor_checks_"] / 100)), 1);
}
else {
$list[$i]["_module_sanity_"] = 100;
}
if (isset($list[$i]["_alerts_"])) {
if ($list[$i]["_monitors_alerts_fired_"] > 0 && $list[$i]["_alerts_"] > 0) {
$list[$i]["_alert_level_"] = format_numeric (100 - ($list[$i]["_monitors_alerts_fired_"] / ($list[$i]["_alerts_"] / 100)), 1);
@ -2854,19 +2818,19 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
$list[$i]["_alert_level_"] = 100;
$list[$i]["_alerts_"] = 0;
}
$list[$i]["_monitor_bad_"] = $list[$i]["_monitors_critical_"] + $list[$i]["_monitors_warning_"];
if ($list[$i]["_monitor_bad_"] > 0 && $list[$i]["_monitor_checks_"] > 0) {
$list[$i]["_global_health_"] = format_numeric (100 - ($list[$i]["_monitor_bad_"] / ($list[$i]["_monitor_checks_"] / 100)), 1);
}
else {
$list[$i]["_global_health_"] = 100;
}
$list[$i]["_server_sanity_"] = format_numeric (100 - $list[$i]["_module_sanity_"], 1);
}
if ($returnAllGroup) {
$list[0]['_agents_unknown_'] += $list[$i]['_agents_unknown_'];
$list[0]['_monitors_alerts_fired_'] += $list[$i]['_monitors_alerts_fired_'];
@ -2877,7 +2841,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
$list[0]['_monitors_unknown_'] += $list[$i]['_monitors_unknown_'];
$list[0]['_monitors_not_init_'] = $list[$i]['_monitors_not_init_'];
$list[0]['_agents_not_init_'] += $list[$i]['_agents_not_init_'];
if ($mode == 'tactical' || $mode == 'tree') {
$list[0]['_agents_ok_'] += $list[$i]['_agents_ok_'];
$list[0]['_agents_warning_'] += $list[$i]['_agents_warning_'];
@ -2885,7 +2849,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
$list[0]['_monitors_alerts_'] += $list[$i]['_monitors_alerts_'];
}
}
if ($mode == 'group') {
if (! defined ('METACONSOLE')) {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) {
@ -2900,113 +2864,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
}
$i++;
}
if ($user_strict) {
foreach ($user_tags as $group_id => $tag_name) {
$id = db_get_value('id_tag', 'ttag', 'name', $tag_name);
$list[$i]['_id_'] = $id;
$list[$i]['_name_'] = $tag_name;
$list[$i]['_iconImg_'] = html_print_image ("images/tag_red.png", true, array ("style" => 'vertical-align: middle;'));
$list[$i]['_is_tag_'] = 1;
$list[$i]['_total_agents_'] = (int) tags_get_total_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_agents_unknown_'] = (int) tags_get_unknown_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_agents_not_init_'] = (int) tags_get_not_init_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_monitors_ok_'] = (int) tags_get_normal_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_critical_'] = (int) tags_get_critical_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_warning_'] = (int) tags_get_warning_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_not_init_'] = (int) tags_get_not_init_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_unknown_'] = (int) tags_get_unknown_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_alerts_fired_'] = tags_monitors_fired_alerts($id, $acltags);
if ($mode == 'tactical' || $mode == 'tree') {
$list[$i]['_agents_ok_'] = (int) tags_get_normal_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_agents_warning_'] = (int) tags_get_warning_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_agents_critical_'] = (int) tags_get_critical_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_monitors_alerts_'] = tags_get_monitors_alerts ($id, $acltags);
}
if ($mode == 'tactical') {
// Get total count of monitors for this group, except disabled.
$list[$i]["_monitor_checks_"] = $list[$i]["_monitors_not_init_"] + $list[$i]["_monitors_unknown_"] + $list[$i]["_monitors_warning_"] + $list[$i]["_monitors_critical_"] + $list[$i]["_monitors_ok_"];
// Calculate not_normal monitors
$list[$i]["_monitor_not_normal_"] = $list[$i]["_monitor_checks_"] - $list[$i]["_monitors_ok_"];
if ($list[$i]["_monitor_not_normal_"] > 0 && $list[$i]["_monitor_checks_"] > 0) {
$list[$i]["_monitor_health_"] = format_numeric (100 - ($list[$i]["_monitor_not_normal_"] / ($list[$i]["_monitor_checks_"] / 100)), 1);
}
else {
$list[$i]["_monitor_health_"] = 100;
}
if ($list[$i]["_monitors_not_init_"] > 0 && $list[$i]["_monitor_checks_"] > 0) {
$list[$i]["_module_sanity_"] = format_numeric (100 - ($list[$i]["_monitors_not_init_"] / ($list[$i]["_monitor_checks_"] / 100)), 1);
}
else {
$list[$i]["_module_sanity_"] = 100;
}
if (isset($list[$i]["_monitors_alerts_"])) {
if ($list[$i]["_monitors_alerts_fired_"] > 0 && $list[$i]["_monitors_alerts_"] > 0) {
$list[$i]["_alert_level_"] = format_numeric (100 - ($list[$i]["_monitors_alerts_fired_"] / ($list[$i]["_monitors_alerts_"] / 100)), 1);
}
else {
$list[$i]["_alert_level_"] = 100;
}
}
else {
$list[$i]["_alert_level_"] = 100;
$list[$i]["_monitors_alerts_"] = 0;
}
$list[$i]["_monitor_bad_"] = $list[$i]["_monitors_critical_"] + $list[$i]["_monitors_warning_"];
if ($list[$i]["_monitor_bad_"] > 0 && $list[$i]["_monitor_checks_"] > 0) {
$list[$i]["_global_health_"] = format_numeric (100 - ($list[$i]["_monitor_bad_"] / ($list[$i]["_monitor_checks_"] / 100)), 1);
}
else {
$list[$i]["_global_health_"] = 100;
}
$list[$i]["_server_sanity_"] = format_numeric (100 - $list[$i]["_module_sanity_"], 1);
}
if ($returnAllGroup) {
$list[0]['_agents_unknown_'] += $list[$i]['_agents_unknown_'];
$list[0]['_monitors_alerts_fired_'] += $list[$i]['_monitors_alerts_fired_'];
$list[0]['_total_agents_'] += $list[$i]['_total_agents_'];
$list[0]['_monitors_ok_'] += $list[$i]['_monitors_ok_'];
$list[0]['_monitors_critical_'] += $list[$i]['_monitors_critical_'];
$list[0]['_monitors_warning_'] += $list[$i]['_monitors_warning_'];
$list[0]['_monitors_unknown_'] += $list[$i]['_monitors_unknown_'];
$list[0]['_agents_not_init_'] += $list[$i]['_agents_not_init_'];
$list[0]['_monitors_not_init_'] += $list[$i]['_monitors_not_init_'];
if ($mode == 'tactical' || $mode == 'tree') {
$list[0]['_agents_ok_'] += $list[$i]['_agents_ok_'];
$list[0]['_agents_warning_'] += $list[$i]['_agents_warning_'];
$list[0]['_agents_critical_'] += $list[$i]['_agents_critical_'];
$list[0]['_monitors_alerts_'] += $list[$i]['_monitors_alerts_'];
}
}
if ($mode == 'group') {
if (! defined ('METACONSOLE')) {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) {
unset($list[$i]);
}
}
else {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0)) {
unset($list[$i]);
}
}
}
$i++;
}
}
return $list;
}

View File

@ -2458,4 +2458,50 @@ function html_print_timezone_select ($name, $selected = "") {
return html_print_select($timezones, $name, $selected, "", __("None"), "", true, false, false);
}
/**
* Enclose a text into a result_div
*
* @param string Text to enclose
*
* @return string Text inside the result_div
*/
function html_print_result_div ($text) {
$text = preg_replace ('/</', '&lt;', $text);
$text = preg_replace ('/>/', '&gt;', $text);
$text = preg_replace ('/\n/i','<br>',$text);
$text = preg_replace ('/\s/i','&nbsp;',$text);
$enclose = "<div id='result_div' style='width: 100%; height: 100%; overflow: scroll; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
$enclose .= $text;
$enclose .= "</div>";
return $enclose;
}
/**
* Print order arrows links
*
* @param array Base tags to build url
* @param string Order key to add to URL
* @param string Value to sort ascendent
* @param string Value to sort descendent
*
* @return string HTML code to display both arrows.
*/
function html_print_sort_arrows ($params, $order_tag, $up = 'up', $down = 'down') {
// Build the queries
$params[$order_tag] = $up;
$url_up = "index.php?" . http_build_query($params, '', '&amp;');
$params[$order_tag] = $down;
$url_down = "index.php?" . http_build_query($params, '', '&amp;');
// Build the links
return '&nbsp;' .
'<a href="' . $url_up . '">' .
html_print_image("images/sort_up.png", true) .
'</a>' .
'<a href="' . $url_down . '">' .
html_print_image("images/sort_down.png", true) .
'</a>'
;
}
?>

View File

@ -780,14 +780,14 @@ function modules_get_raw_data($id_agent_module, $date_init, $date_end) {
return $data;
}
function modules_get_agent_group($id_agent_module) {
function modules_get_agent_groups($id_agent_module) {
$return = false;
$id_agent = modules_get_agentmodule_agent(
$id_agent_module);
if (!empty($id_agent)) {
$return = agents_get_agent_group($id_agent);
$return = agents_get_all_groups_agent($id_agent);
}
return $return;
@ -2750,5 +2750,29 @@ function modules_get_modules_status ($mod_status_id) {
}
return $mod_status_desc;
}
}
function modules_get_counter_by_states($state) {
switch ($state) {
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
case AGENT_MODULE_STATUS_CRITICAL_BAD:
return "critical_count";
case AGENT_MODULE_STATUS_WARNING_ALERT:
case AGENT_MODULE_STATUS_WARNING:
return "warning_count";
break;
case AGENT_MODULE_STATUS_UNKNOWN:
return "unknown_count";
case AGENT_MODULE_STATUS_NO_DATA:
case AGENT_MODULE_STATUS_NOT_INIT:
return "notinit_count";
case AGENT_MODULE_STATUS_NORMAL_ALERT:
case AGENT_MODULE_STATUS_NORMAL:
return "normal_count";
}
// If the state is not an expected state, return condition
// to not show any data
return false;
}
?>

View File

@ -68,7 +68,7 @@ function profile_get_profiles ($filter = false) {
* @param int Group ID (default 1 => All)
* @param string Assign User who assign the profile to user.
* @param string tags where the view of the user in this group will be restricted
* @param bool Profile is secondary or not
* @param bool Profile is marked to not provide hierarchy
*
* @return mixed Number id if succesful, false if not
*/
@ -77,7 +77,7 @@ function profile_create_user_profile ($id_user,
$id_group = 0,
$assignUser = false,
$tags = '',
$is_secondary = false
$no_hierarchy = false
) {
global $config;
@ -86,7 +86,7 @@ function profile_create_user_profile ($id_user,
return false;
// Secondary server is an enterprise function
if (!enterprise_installed() && $is_secondary) return false;
if (!enterprise_installed() && $no_hierarchy) return false;
// Checks if the user exists
$result_user = users_get_user_by_id($id_user);
@ -95,9 +95,6 @@ function profile_create_user_profile ($id_user,
return false;
}
// Cannot mix secondary and primary profiles
if (!profile_check_group_mode($id_user, $id_group, $is_secondary)) return false;
if (isset ($config["id_user"])) {
//Usually this is set unless we call it while logging in (user known by auth scheme but not by pandora)
$assign = $config["id_user"];
@ -114,7 +111,7 @@ function profile_create_user_profile ($id_user,
"id_grupo" => $id_group,
"tags" => $tags,
"assigned_by" => $assign,
"is_secondary" => $is_secondary ? 1 : 0
"no_hierarchy" => $no_hierarchy ? 1 : 0
);
return db_process_sql_insert ("tusuario_perfil", $insert);
@ -147,35 +144,16 @@ function profile_delete_profile ($id_profile) {
return (bool)db_process_sql_delete('tperfil', array('id_perfil' => $id_profile));
}
/**
* Check if a group can be added being secondary or normal
*
* @param int User ID you want to check
* @param int Group ID you want to check
* @param bool Mode of profile will be inserted
*
* @return bool False if there is a group with the mode already added
*/
function profile_check_group_mode($user_id, $group_id, $is_secondary) {
$inserted_type = (int)db_get_value_sql(sprintf(
'SELECT COUNT(*) FROM tusuario_perfil WHERE
id_grupo=%d AND is_secondary=%d AND id_usuario="%s"',
$group_id, !$is_secondary ? 1 : 0, $user_id)
);
return $inserted_type === 0;
}
/**
* Print the table to display, create and delete profiles
*
* @param int User id
* @param string Title of the table view
* @param bool Show the tags select or not
*/
function profile_print_profile_table ($id, $title, $is_secondary = false) {
function profile_print_profile_table ($id) {
global $config;
$is_secondary = enterprise_installed() ? $is_secondary : false;
$title = __('Profiles/Groups assigned to this user');
$table = new stdClass();
$table->width = '100%';
@ -196,17 +174,15 @@ function profile_print_profile_table ($id, $title, $is_secondary = false) {
$table->style[0] = 'font-weight: bold';
$table->style[1] = 'font-weight: bold';
}
$table->head[0] = __('Profile name');
$table->head[1] = __('Group');
if (!$is_secondary) {
$table->head[2] = __('Tags');
}
$table->head[3] = __('Action');
$table->align[3] = 'center';
$table->head["name"] = __('Profile name');
$table->head["group"] = __('Group');
$table->head["tags"] = __('Tags');
$table->head["hierarchy"] = __('No hierarchy');
$table->head["actions"] = __('Action');
$table->align["actions"] = 'center';
$result = db_get_all_rows_filter ("tusuario_perfil", array (
"id_usuario" => $id,
"is_secondary" => $is_secondary ? 1 : 0
"id_usuario" => $id
));
if ($result === false) {
@ -220,67 +196,64 @@ function profile_print_profile_table ($id, $title, $is_secondary = false) {
$data = array ();
$data[0] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.profile_get_name ($profile['id_perfil']).'</a>';
$data[1] = ui_print_group_icon($profile["id_grupo"], true);
$data["name"] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.profile_get_name ($profile['id_perfil']).'</a>';
$data["group"] = ui_print_group_icon($profile["id_grupo"], true);
if (!defined('METACONSOLE')) {
$data[1] .= '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$profile['id_grupo'].'&pure='.$pure.'">';
$data["group"] .= '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$profile['id_grupo'].'&pure='.$pure.'">';
}
$data[1] .= '&nbsp;' . ui_print_truncate_text(groups_get_name ($profile['id_grupo'], True), GENERIC_SIZE_TEXT);
if (!defined('METACONSOLE'))
$data[1] .= '</a>';
$data["group"] .= '&nbsp;' . ui_print_truncate_text(groups_get_name ($profile['id_grupo'], True), GENERIC_SIZE_TEXT);
if (!defined('METACONSOLE')) $data["group"] .= '</a>';
if (!$is_secondary) {
if(empty($profile["tags"])) {
$data[2] = '';
}
else {
$tags_ids = explode(',',$profile["tags"]);
$tags = tags_get_tags($tags_ids);
$data[2] = tags_get_tags_formatted($tags);
}
if(empty($profile["tags"])) {
$data["tags"] = '';
}
else {
$tags_ids = explode(',',$profile["tags"]);
$tags = tags_get_tags($tags_ids);
$data["tags"] = tags_get_tags_formatted($tags);
}
$data[3] = '<form method="post" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
$data[3] .= html_print_input_hidden ('delete_profile', 1, true);
$data[3] .= html_print_input_hidden ('id_user_profile', $profile['id_up'], true);
$data[3] .= html_print_input_hidden ('id_user', $id, true);
$data[3] .= html_print_input_image ('del', 'images/cross.png', 1, '', true);
$data[3] .= '</form>';
$data["hierarchy"] = $profile['no_hierarchy'] ? __("Yes") : __("No");
$data["actions"] = '<form method="post" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
$data["actions"] .= html_print_input_hidden ('delete_profile', 1, true);
$data["actions"] .= html_print_input_hidden ('id_user_profile', $profile['id_up'], true);
$data["actions"] .= html_print_input_hidden ('id_user', $id, true);
$data["actions"] .= html_print_input_image ('del', 'images/cross.png', 1, '', true);
$data["actions"] .= '</form>';
array_push ($table->data, $data);
}
$data = array ();
$data[0] = '<form method="post">';
$data["name"] = '<form method="post">';
if (check_acl ($config['id_user'], 0, "PM")) {
$data[0] .= html_print_select (profile_get_profiles (), 'assign_profile', 0, '',
$data["name"] .= html_print_select (profile_get_profiles (), 'assign_profile', 0, '',
__('None'), 0, true, false, false);
}
else {
$data[0] .= html_print_select (profile_get_profiles (array ('pandora_management' => '<> 1',
$data["name"] .= html_print_select (profile_get_profiles (array ('pandora_management' => '<> 1',
'db_management' => '<> 1')), 'assign_profile', 0, '', __('None'), 0,
true, false, false);
}
$data[1] = html_print_select_groups($config['id_user'], "UM",
$data["group"] = html_print_select_groups($config['id_user'], "UM",
users_is_admin($config['id_user']), 'assign_group', -1, '', __('None'), -1, true,
false, false);
if (!$is_secondary) {
$tags = tags_get_all_tags();
$data[2] = html_print_select($tags, 'assign_tags[]', '', '', __('Any'), '', true, true);
}
$tags = tags_get_all_tags();
$data["tags"] = html_print_select($tags, 'assign_tags[]', '', '', __('Any'), '', true, true);
$data[3] = html_print_input_image ('add', 'images/add.png', 1, '', true);
$data[3] .= html_print_input_hidden ('id', $id, true);
$data[3] .= html_print_input_hidden ('add_profile', 1, true);
if ($is_secondary) {
$data[3] .= html_print_input_hidden('is_secondary', 1, true);
}
$data[3] .= '</form>';
$data["hierarchy"] = html_print_checkbox ('no_hierarchy', 1, false, true) .
ui_print_help_icon("no_hierarchy", true);
$data["actions"] = html_print_input_image ('add', 'images/add.png', 1, '', true);
$data["actions"] .= html_print_input_hidden ('id', $id, true);
$data["actions"] .= html_print_input_hidden ('add_profile', 1, true);
$data["actions"] .= '</form>';
array_push ($table->data, $data);

View File

@ -2869,7 +2869,7 @@ function reporting_alert_get_fired($id_agent_module, $id_alert_template_module,
if (empty($firedTimes)) {
$firedTimes = array();
$firedTimes[0]['timestamp'] = '----------------------------';
$firedTimes[0]['timestamp'] = null;
}
foreach ($firedTimes as $fireTime) {
@ -3010,7 +3010,10 @@ function reporting_alert_report_group($report, $content) {
(int) $report["datetime"]);
$module_actions["actions"] = $data_action;
if ($module_actions["template_fired"][0] !== null)
$data_row['alerts'][$ntemplates] = $module_actions;
else
$data_row = null;
$ntemplates++;
}
@ -3127,7 +3130,10 @@ function reporting_alert_report_agent($report, $content) {
(int) $report["datetime"]);
$module_actions["actions"] = $data_action;
if ($module_actions["template_fired"][0] !== null)
$data_row['alerts'][$ntemplates] = $module_actions;
else
$data_row = null;
$ntemplates++;
}
@ -3248,7 +3254,10 @@ function reporting_alert_report_module($report, $content) {
(int) $report["datetime"]);
$module_actions["actions"] = $data_action;
if ($module_actions["template_fired"][0] !== null)
$data_row['alerts'][$ntemplates] = $module_actions;
else
$data_row = null;
$ntemplates++;
}
@ -6278,6 +6287,8 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
global $config;
$modules = array();
require_once ($config["homedir"] . '/include/functions_graph.php');
if ($config['metaconsole']) {
@ -6289,10 +6300,33 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
$graph = db_get_row ("tgraph", "id_graph", $content['id_gs']);
$return = array();
$return['type'] = 'custom_graph';
if (empty($content['name'])) {
if ($type_report == "custom_graph") {
$content['name'] = __('Custom graph');
$graphs = db_get_all_rows_field_filter ("tgraph", "id_graph", $content['id_gs']);
$id_graph = $content['id_gs'];
}
else if($type_report == "automatic_graph"){
$content['name'] = __('Automatic combined graph');
$graphs[0]["stacked"] = '';
$graphs[0]["summatory_series"] = '';
$graphs[0]["average_series"] = '';
$graphs[0]["modules_series"] = '';
$graphs[0]["fullscale"] = $content['style']['fullscale'];
if(is_array($content['id_agent_module'])){
foreach ($content['id_agent_module'] as $key => $value) {
if($content['each_agent']){
$modules[] = $value;
}
else{
$modules[] = $value['module'];
}
}
}
else{
$modules[] = $content['id_agent_module'];
}
$id_graph = 0;
}
else {
$content['name'] = __('Simple graph');
@ -6304,9 +6338,8 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
$return["description"] = $content["description"];
$return["date"] = reporting_get_date_text(
$report,
$content);
$graphs = db_get_all_rows_field_filter ("tgraph", "id_graph", $content['id_gs']);
$content
);
$return['chart'] = '';
@ -6329,13 +6362,12 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
'fullscale' => $graphs[0]["fullscale"],
'server_id' => $id_meta
);
$params_combined = array(
'stacked' => $graphs[0]["stacked"],
'summatory' => $graphs[0]["summatory_series"],
'average' => $graphs[0]["average_series"],
'modules_series' => $graphs[0]["modules_series"],
'id_graph' => $content['id_gs']
'id_graph' => $id_graph
);
$return['chart'] = graphic_combined_module(
@ -6970,89 +7002,57 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
}
if (!empty($group_array)) {
// FOR THE FUTURE: Split the groups into groups with tags restrictions and groups without it
// To calculate in the light way the non tag restricted and in the heavy way the others
/*
$group_restricted_data = tags_get_acl_tags($config['id_user'], $group_array, $access, 'data');
$tags_restricted_groups = array_keys($group_restricted_data);
// Get monitor NOT INIT, except disabled AND async modules
$data["monitor_not_init"] += (int) groups_get_not_init_monitors ($group_array, array(), array(), false, false, true);
$no_tags_restricted_groups = $group_array;
foreach ($no_tags_restricted_groups as $k => $v) {
if (in_array($v, $tags_restricted_groups)) {
unset($no_tags_restricted_groups[$k]);
}
}
*/
// Get monitor OK, except disabled and non-init
$data["monitor_ok"] += (int) groups_get_normal_monitors ($group_array, array(), array(), false, false, true);
if (!empty($group_array)) {
// Get monitor NOT INIT, except disabled AND async modules
$data["monitor_not_init"] += (int) groups_get_not_init_monitors ($group_array, array(), array(), false, false, true);
// Get monitor OK, except disabled and non-init
$data["monitor_ok"] += (int) groups_get_normal_monitors ($group_array, array(), array(), false, false, true);
// Get monitor CRITICAL, except disabled and non-init
$data["monitor_critical"] += (int) groups_get_critical_monitors ($group_array, array(), array(), false, false, true);
// Get monitor WARNING, except disabled and non-init
$data["monitor_warning"] += (int) groups_get_warning_monitors ($group_array, array(), array(), false, false, true);
// Get monitor UNKNOWN, except disabled and non-init
$data["monitor_unknown"] += (int) groups_get_unknown_monitors ($group_array, array(), array(), false, false, true);
// Get alerts configured, except disabled
$data["monitor_alerts"] += groups_monitor_alerts ($group_array) ;
// Get alert configured currently FIRED, except disabled
$data["monitor_alerts_fired"] += groups_monitor_fired_alerts ($group_array);
// Calculate totals using partial counts from above
// Get TOTAL non-init modules, except disabled ones and async modules
$data["total_not_init"] += $data["monitor_not_init"];
// Get monitor CRITICAL, except disabled and non-init
$data["monitor_critical"] += (int) groups_get_critical_monitors ($group_array, array(), array(), false, false, true);
// Get TOTAL agents in a group
$data["total_agents"] += (int) groups_get_total_agents ($group_array, array(), array(), false, false, true);
// Get Agents OK
$data["agent_ok"] += (int) groups_get_normal_agents ($group_array, array(), array(), false, false, true);
// Get Agents Warning
$data["agent_warning"] += (int) groups_get_warning_agents ($group_array, array(), array(), false, false, true);
// Get Agents Critical
$data["agent_critical"] += (int) groups_get_critical_agents ($group_array, array(), array(), false, false, true);
// Get Agents Unknown
$data["agent_unknown"] += (int) groups_get_unknown_agents ($group_array, array(), array(), false, false, true);
// Get Agents Not init
$data["agent_not_init"] += (int) groups_get_not_init_agents ($group_array, array(), array(), false, false, true);
}
// Get monitor WARNING, except disabled and non-init
$data["monitor_warning"] += (int) groups_get_warning_monitors ($group_array, array(), array(), false, false, true);
// Get monitor UNKNOWN, except disabled and non-init
$data["monitor_unknown"] += (int) groups_get_unknown_monitors ($group_array, array(), array(), false, false, true);
// Get alerts configured, except disabled
$data["monitor_alerts"] += groups_monitor_alerts ($group_array) ;
// Get alert configured currently FIRED, except disabled
$data["monitor_alerts_fired"] += groups_monitor_fired_alerts ($group_array);
// Calculate totals using partial counts from above
// Get TOTAL non-init modules, except disabled ones and async modules
$data["total_not_init"] += $data["monitor_not_init"];
// Get TOTAL agents in a group
$data["total_agents"] += (int) groups_get_total_agents ($group_array, array(), array(), false, false, true);
// Get Agents OK
$data["agent_ok"] += (int) groups_get_normal_agents ($group_array, array(), array(), false, false, true);
// Get Agents Warning
$data["agent_warning"] += (int) groups_get_warning_agents ($group_array, array(), array(), false, false, true);
// Get Agents Critical
$data["agent_critical"] += (int) groups_get_critical_agents ($group_array, array(), array(), false, false, true);
// Get Agents Unknown
$data["agent_unknown"] += (int) groups_get_unknown_agents ($group_array, array(), array(), false, false, true);
// Get Agents Not init
$data["agent_not_init"] += (int) groups_get_not_init_agents ($group_array, array(), array(), false, false, true);
// Get total count of monitors for this group, except disabled.
$data["monitor_checks"] = $data["monitor_not_init"] + $data["monitor_unknown"] + $data["monitor_warning"] + $data["monitor_critical"] + $data["monitor_ok"];
// Calculate not_normal monitors
$data["monitor_not_normal"] += $data["monitor_checks"] - $data["monitor_ok"];
$data["monitor_checks"] += $data["monitor_not_init"] + $data["monitor_unknown"] + $data["monitor_warning"] + $data["monitor_critical"] + $data["monitor_ok"];
}
// Get total count of monitors for this group, except disabled.
$data["monitor_checks"] = $data["monitor_not_init"] + $data["monitor_unknown"] + $data["monitor_warning"] + $data["monitor_critical"] + $data["monitor_ok"];
/*
Monitor health (percentage)
Data health (percentage)
Global health (percentage)
Module sanity (percentage)
Alert level (percentage)
Server Sanity 0% Uninitialized modules
*/
}
// Calculate not_normal monitors
$data["monitor_not_normal"] += $data["monitor_checks"] - $data["monitor_ok"];
if ($data["monitor_unknown"] > 0 && $data["monitor_checks"] > 0) {
$data["monitor_health"] = format_numeric (100 - ($data["monitor_not_normal"] / ($data["monitor_checks"] / 100)), 1);
}

View File

@ -1184,23 +1184,25 @@ function tags_get_tags_for_module_search($id_user = false, $access = 'AR') {
function tags_check_acl_by_module($id_module = 0, $id_user = false,
$access = 'AW') {
global $config;
$return = false;
if (!empty($id_module)) {
$tags = tags_get_module_tags($id_module);
$group = modules_get_agent_group($id_module);
$groups = modules_get_agent_groups($id_module);
if ($id_user === false) {
$id_user = $config["id_user"];
}
$return = tags_check_acl($id_user, $group, $access, $tags, true);
foreach ($groups as $group) {
if (tags_check_acl($id_user, $group, $access, $tags, true)) {
return true;
}
}
}
return $return;
}
@ -2480,17 +2482,10 @@ function tags_get_all_user_agents ($id_tag = false, $id_user = false,
}
$select_fields = implode(',',$fields);
$groups_clause = "";
if ($strict_user) {
if (!empty($groups_and_tags)) {
$groups_clause = " AND ".tags_get_acl_tags_module_condition($groups_and_tags, "tagente_modulo");
}
}
else {
$groups_clause = " AND tagente.id_grupo IN (".implode(',', array_keys($groups_and_tags)).")";
}
$groups_clause = " AND tagente.id_grupo IN (".implode(',', array_keys($groups_and_tags)).")";
if (!empty($filter['id_group'])) {
if (is_array($filter['id_group']))
$groups_str = implode(",", $filter['id_group']);

View File

@ -3316,6 +3316,13 @@ function ui_print_agent_autocomplete_input($parameters) {
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
' . $javascript_change_ajax_params_text . '
var groupId = data_params.id_group();
// Index cache by group Id
if (cache_' . $input_name . '[groupId] == null) {
cache_' . $input_name . '[groupId] = {};
}
//Set loading
$("#' . $input_id . '")
@ -3329,8 +3336,8 @@ function ui_print_agent_autocomplete_input($parameters) {
//==== CACHE CODE ==================================
//Check the cache
var found = false;
if (term in cache_' . $input_name . ') {
response(cache_' . $input_name . '[term]);
if (term in cache_' . $input_name . '[groupId]) {
response(cache_' . $input_name . '[groupId][term]);
//Set icon
$("#' . $input_id . '")
@ -3345,11 +3352,11 @@ function ui_print_agent_autocomplete_input($parameters) {
for (i = 1; i < term.length; i++) {
var term_match = term.substr(0, term.length - i);
$.each(cache_' . $input_name . ', function (oldterm, olddata) {
$.each(cache_' . $input_name . '[groupId], function (oldterm, olddata) {
var pattern = new RegExp("^" + term_match + ".*","gi");
if (oldterm.match(pattern)) {
response(cache_' . $input_name . '[oldterm]);
response(cache_' . $input_name . '[groupId][oldterm]);
found = true;
@ -3376,15 +3383,13 @@ function ui_print_agent_autocomplete_input($parameters) {
return;
}
' . $javascript_change_ajax_params_text . '
jQuery.ajax ({
data: data_params,
type: "POST",
url: action="' . $javascript_ajax_page . '",
dataType: "json",
success: function (data) {
cache_' . $input_name . '[term] = data; //Save the cache
cache_' . $input_name . '[groupId][term] = data; //Save the cache
response(data);

View File

@ -277,11 +277,12 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup
$query = "SELECT * FROM tgrupo ORDER BY parent,id_grupo DESC";
$raw_groups = db_get_all_rows_sql($query);
$query = sprintf("SELECT tgrupo.*, tperfil.*, tusuario_perfil.tags FROM tgrupo, tusuario_perfil, tperfil
$query = sprintf("SELECT tgrupo.*, tperfil.*, tusuario_perfil.tags, tusuario_perfil.no_hierarchy FROM tgrupo, tusuario_perfil, tperfil
WHERE (tgrupo.id_grupo = tusuario_perfil.id_grupo OR tusuario_perfil.id_grupo = 0)
AND tusuario_perfil.id_perfil = tperfil.id_perfil
AND tusuario_perfil.id_usuario = '%s' ORDER BY nombre", $id_user);
$raw_forest = db_get_all_rows_sql ($query);
if ($raw_forest === false) $raw_forest = array();
foreach ($raw_forest as $g) {
// XXX, following code must be remade (TAG)
@ -291,7 +292,6 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup
else {
$forest_acl[$g["id_grupo"]] = groups_combine_acl($forest_acl[$g["id_grupo"]], $g);
}
}
$groups = array();
@ -303,7 +303,11 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup
$parents = get_group_ancestors($group["parent"],$groups);
if (is_array($parents)) {
foreach ($parents as $parent) {
if ( (isset($forest_acl[$parent])) && ($groups[$parent]["propagate"] == 1)) {
if (
(isset($forest_acl[$parent])) &&
($groups[$parent]["propagate"] == 1) &&
($forest_acl[$parent]["no_hierarchy"] == 0)
) {
if (isset($forest_acl[$group["id_grupo"]])) {
// update ACL propagation
$tmp = groups_combine_acl($forest_acl[$parent], $forest_acl[$group["id_grupo"]]);
@ -319,10 +323,8 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup
}
}
}
else {
// no parents, direct assignment already done
}
}
// No parents, direct assignment already done
}
}
// Update the group cache.
$group_cache[$id_user] = $forest_acl;

View File

@ -32,6 +32,7 @@ require_once ($config['homedir'].'/include/functions_modules.php');
require_once ($config['homedir'].'/include/functions_users.php');
require_once ($config['homedir'].'/include/functions.php');
require_once ($config['homedir'].'/include/graphs/functions_d3.php');
enterprise_include_once('include/functions_visual_map.php');
function visual_map_print_item_toolbox($idDiv, $text, $float) {
if ($float == 'left') {
@ -3143,7 +3144,7 @@ function visual_map_get_status_element($layoutData) {
else {
$calculate_weight = false;
}
$status = visual_map_get_layout_status ($layoutData['id_layout_linked'], 0, 0, $calculate_weight);
$status = visual_map_get_layout_status($layoutData['id_layout_linked'], $layoutData);
if ($layoutData['id_layout_linked_weight'] > 0) {
$elements_to_compare = db_get_all_rows_sql("SELECT id, element_group FROM tlayout_data WHERE type = 0 AND id_layout = " . $layoutData['id_layout_linked']);
@ -3164,8 +3165,8 @@ function visual_map_get_status_element($layoutData) {
else {
$status = VISUAL_MAP_STATUS_NORMAL;
if (count($elements_to_compare) == 0) {
$status = VISUAL_MAP_STATUS_UNKNOWN;
}
$status = VISUAL_MAP_STATUS_UNKNOWN;
}
}
}
}
@ -3656,6 +3657,45 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
return $retval;
}
function visual_map_translate_agent_status ($agent_status) {
switch ($agent_status) {
case AGENT_STATUS_NORMAL:
default:
return VISUAL_MAP_STATUS_NORMAL;
case AGENT_STATUS_CRITICAL:
return VISUAL_MAP_STATUS_CRITICAL_BAD;
case AGENT_STATUS_WARNING:
return VISUAL_MAP_STATUS_WARNING;
case AGENT_STATUS_NOT_INIT:
case AGENT_STATUS_UNKNOWN:
case -1:
return VISUAL_MAP_STATUS_UNKNOWN;
case AGENT_STATUS_ALERT_FIRED:
return VISUAL_MAP_STATUS_CRITICAL_ALERT;
}
}
function visual_map_translate_module_status ($module_status) {
switch ($agent_status) {
case AGENT_MODULE_STATUS_NORMAL:
case AGENT_MODULE_STATUS_NORMAL_ALERT:
default:
return VISUAL_MAP_STATUS_NORMAL;
case AGENT_MODULE_STATUS_CRITICAL_BAD:
return VISUAL_MAP_STATUS_CRITICAL_BAD;
case AGENT_MODULE_STATUS_WARNING:
return VISUAL_MAP_STATUS_WARNING;
case AGENT_MODULE_STATUS_UNKNOWN:
case AGENT_MODULE_STATUS_NOT_INIT:
case AGENT_MODULE_STATUS_NO_DATA:
case -1:
return VISUAL_MAP_STATUS_UNKNOWN;
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
return VISUAL_MAP_STATUS_CRITICAL_ALERT;
case AGENT_MODULE_STATUS_WARNING_ALERT:
return VISUAL_MAP_STATUS_WARNING_ALERT;
}
}
/**
* Get the status of a layout.
@ -3665,205 +3705,232 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
* are OK. If any of them is down, then result is down (0)
*
* @param int Id of the layout
* @param array Information about the status calculation of the item
* @param int Depth (for recursion control)
*
* @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, $elements_in_critical = 0, $calculate_weight = false) {
function visual_map_get_layout_status ($layout_id, $status_data = array(), $depth = 0) {
global $config;
$temp_status = VISUAL_MAP_STATUS_NORMAL;
$temp_total = VISUAL_MAP_STATUS_NORMAL;
$depth++; // For recursion depth checking
// TODO: Implement this limit into the setup
if ($depth > 10) return VISUAL_MAP_STATUS_UNKNOWN;
// TODO: Implement this limit as a configurable item in setup
if ($depth > 10) {
return VISUAL_MAP_STATUS_UNKNOWN; // No status data if we need to exit by a excesive recursion
}
$layout_items = db_get_all_rows_filter("tlayout_data", array("id_layout" => $layout_id));
if ($layout_items === false) return VISUAL_MAP_STATUS_UNKNOWN;
$id_layout = (int) $id_layout;
$result = db_get_all_rows_filter ('tlayout_data',
array ('id_layout' => $id_layout),
array (
'id_agente_modulo',
'id_group',
'parent_item',
'id_layout_linked',
'id_agent',
'type',
'id_layout_linked_weight',
'id',
'id_layout',
'element_group',
'id_metaconsole'));
if ($result === false)
return VISUAL_MAP_STATUS_NORMAL;
$stcount = 0;
$stcount_u = 0;
foreach ($result as $data) {
if ($data['type'] == 0) {
$stcount++;
if ($data["id_layout_linked"] == 0 && $data["id_agente_modulo"] == 0 && $data["id_agent"] == 0) {
$stcount_u++;
}
// Check for valid items to retrieve the status for
$valid_layout_items = array();
foreach ($layout_items as $layout_item_data) {
if (
// Group items
(
$layout_item_data['type'] == GROUP_ITEM &&
!empty($layout_item_data["id_group"]) &&
// ACL check
check_acl($config["id_user"], $layout_item_data["id_group"], "VR") &&
check_acl($config["id_user"], $layout_item_data["element_group"], "VR")
) ||
// Rest of items
(
(
// At least one of this ids is required
!empty($layout_item_data["id_layout_linked"]) ||
!empty($layout_item_data["id_agente_modulo"]) ||
!empty($layout_item_data["id_agent"])
) && (
// Weight and service types for status calculation require STATIC_GRAPH items
(
$status_data["linked_layout_status_type"] !== "weight" &&
$status_data["linked_layout_status_type"] !== "service"
) || (
$layout_item_data['type'] == STATIC_GRAPH && (
$status_data["linked_layout_status_type"] === "weight" ||
$status_data["linked_layout_status_type"] === "service"
)
)
) &&
// ACL check
check_acl($config["id_user"], $layout_item_data["element_group"], "VR")
)
) {
$valid_layout_items[] = $layout_item_data;
}
}
if ($stcount == 0 || $stcount_u == $stcount) {
return VISUAL_MAP_STATUS_UNKNOWN;
if (empty($valid_layout_items)) return VISUAL_MAP_STATUS_UNKNOWN;
// Sort by node id to reduce the number of connections
if (is_metaconsole()) {
sort_by_column($valid_layout_items, "id_metaconsole");
}
foreach ($result as $data) {
$layout_group = $data['element_group'];
if (!check_acl ($config['id_user'], $layout_group, "VR")) {
continue;
$num_elements_by_status = array();
$meta_connected_to = null;
foreach ($valid_layout_items as $layout_item_data) {
if (is_metaconsole()) {
if (empty($layout_item_data["id_metaconsole"]) && $meta_connected_to) {
metaconsole_restore_db(); // Restore db connection
$meta_connected_to = null;
}
else if (
!empty($layout_item_data["id_metaconsole"]) && (
empty($meta_connected_to) ||
$meta_connected_to != $layout_item_data["id_metaconsole"]
)
) {
if (!empty($meta_connected_to)) metaconsole_restore_db(); // Restore db connection
$connection = metaconsole_get_connection_by_id($layout_item_data["id_metaconsole"]);
if (metaconsole_load_external_db($connection) != NOERR) continue;
$meta_connected_to = $layout_item_data["id_metaconsole"];
}
}
switch ($data['type']) {
case GROUP_ITEM:
if ($data["id_layout_linked"] == 0) {
$group_status = groups_get_status($data['id_group']);
switch ($group_status) {
case AGENT_STATUS_ALERT_FIRED:
$status = VISUAL_MAP_STATUS_CRITICAL_ALERT;
break;
case AGENT_STATUS_CRITICAL:
$status = VISUAL_MAP_STATUS_CRITICAL_BAD;
break;
case AGENT_STATUS_WARNING:
$status = VISUAL_MAP_STATUS_WARNING;
break;
case AGENT_STATUS_UNKNOWN:
$status = VISUAL_MAP_STATUS_UNKNOWN;
break;
case AGENT_STATUS_NORMAL:
default:
$status = VISUAL_MAP_STATUS_NORMAL;
break;
$status = VISUAL_MAP_STATUS_NORMAL;
$ent_element_status = enterprise_hook("enterprise_visual_map_get_status_element", array($layoutData));
if ($ent_element_status === ENTERPRISE_NOT_HOOK) {
$ent_element_status = false;
}
// Enterprise element
if ($ent_element_status !== false) {
$status = $ent_element_status;
}
// Other
else {
switch ($layout_item_data["type"]) {
case STATIC_GRAPH:
case PERCENTILE_BAR:
case PERCENTILE_BUBBLE:
case CIRCULAR_PROGRESS_BAR:
case CIRCULAR_INTERIOR_PROGRESS_BAR:
// Linked layout
if (!empty($layout_item_data["id_layout_linked"])) {
$status = visual_map_get_layout_status($layout_item_data["id_layout_linked"], $layout_item_data, $depth + 1);
}
}
else {
$status = visual_map_get_layout_status(
$data["id_layout_linked"], $depth);
}
break;
default:
if (($data["id_layout_linked"] == 0 &&
$data["id_agente_modulo"] == 0 &&
$data["id_agent"] == 0) ||
$data['type'] != 0){
continue;
// Module
else if (!empty($layout_item_data["id_agente_modulo"])) {
$module_status = modules_get_agentmodule_status($layout_item_data["id_agente_modulo"]);
$status = visual_map_translate_module_status($module_status);
}
// Other Layout (Recursive!)
if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) {
if ($data['id_layout_linked_weight'] > 0) {
$calculate_weight_c = true;
// Agent
else if (!empty($layout_item_data["id_agent"])) {
$agent_status = agents_get_status($layout_item_data["id_agent"], true);
$status = visual_map_translate_agent_status($agent_status);
}
// Unknown
else {
$calculate_weight_c = false;
$status = VISUAL_MAP_STATUS_UNKNOWN;
}
$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, element_group FROM tlayout_data WHERE type = 0 AND id_layout = " . $data['id_layout_linked']);
$layout_group = $data['element_group'];
$childs_group_acl = array();
foreach ($elements_in_child as $c) {
if (check_acl ($config['id_user'], $c['element_group'], "VR")) {
$childs_group_acl[] = $c['id'];
}
}
$elements_in_child = $childs_group_acl;
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;
if (count($elements_in_child) == 0) {
$status = VISUAL_MAP_STATUS_UNKNOWN;
}
}
}
}
// Module
elseif ($data["id_agente_modulo"] != 0) {
//Metaconsole db connection
if ($data['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $data['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
continue;
}
}
$status = modules_get_agentmodule_status($data["id_agente_modulo"]);
if ($status == 4){
$status = 3;
}
//Restore db connection
if ($data['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
}
// Agent
else {
//--------------------------------------------------
// ADDED NO CHECK ACL FOR AVOID CHECK TAGS THAT
// MAKE VERY SLOW THE VISUALMAPS WITH ACL TAGS
//--------------------------------------------------
//Metaconsole db connection
if ($data['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $data['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
continue;
}
}
$status = agents_get_status($data["id_agent"], true);
//Restore db connection
if ($data['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
}
break;
}
if ($calculate_weight) {
if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD || $status == VISUAL_MAP_STATUS_WARNING) {
$elements_in_critical++;
break;
case GROUP_ITEM:
$group_status = groups_get_status($layout_item_data['id_group']);
$status = visual_map_translate_agent_status($group_status);
break;
default:
// If it's a graph, a progress bar or a data tag, ALWAYS report status OK
// (=0) to avoid confussions here.
$status = VISUAL_MAP_STATUS_NORMAL;
break;
}
}
// When the status calculation type is 'default', only one critical element is required to
// set the layout status as critical, so we can return the critical status right now.
if (
$status_data["linked_layout_status_type"] === "default" && (
$status == VISUAL_MAP_STATUS_CRITICAL_BAD ||
$status == VISUAL_MAP_STATUS_CRITICAL_ALERT
)
) {
if (is_metaconsole() && $meta_connected_to) {
metaconsole_restore_db(); // Restore db connection
}
return $status;
}
else {
if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) {
if (!isset($num_elements_by_status[$status])) $num_elements_by_status[$status] = 0;
$num_elements_by_status[$status]++;
}
}
if (is_metaconsole() && $meta_connected_to) {
metaconsole_restore_db(); // Restore db connection
}
// Status calculation
switch ($status_data["linked_layout_status_type"]) {
default:
case "default":
$num_items_critical_alert = $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_ALERT];
$num_items_critical = $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_BAD];
$num_items_warning = $num_elements_by_status[VISUAL_MAP_STATUS_WARNING];
$num_items_unknown = $num_elements_by_status[VISUAL_MAP_STATUS_UNKNOWN];
if ($num_items_critical_alert > 0) {
return VISUAL_MAP_STATUS_CRITICAL_ALERT;
}
else if ($num_items_critical > 0) {
return VISUAL_MAP_STATUS_CRITICAL_BAD;
}
}
if ($calculate_weight) {
if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) {
$temp_total = VISUAL_MAP_STATUS_CRITICAL_BAD;
else if ($num_items_warning > 0) {
return VISUAL_MAP_STATUS_WARNING;
}
else if ($status == VISUAL_MAP_STATUS_WARNING && $temp_total != VISUAL_MAP_STATUS_CRITICAL_BAD) {
$temp_total = VISUAL_MAP_STATUS_WARNING;
else if ($num_items_unknown > 0) {
return VISUAL_MAP_STATUS_UNKNOWN;
}
}
else if ($status > $temp_total) {
$temp_total = $status;
}
else {
return VISUAL_MAP_STATUS_NORMAL;
}
break;
case "weight":
$weight = $status_data["id_layout_linked_weight"];
$num_items = count($valid_layout_items);
$num_items_critical_alert = $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_ALERT];
$num_items_critical = $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_BAD];
$num_items_warning = $num_elements_by_status[VISUAL_MAP_STATUS_WARNING];
$num_items_unknown = $num_elements_by_status[VISUAL_MAP_STATUS_UNKNOWN];
if (
$num_items_critical > 0 &&
((($num_items_critical_alert + $num_items_critical) * 100) / $num_items) >= $weight
) {
return $num_items_critical_alert > 0 ? VISUAL_MAP_STATUS_CRITICAL_ALERT : VISUAL_MAP_STATUS_CRITICAL_BAD;
}
else if (
$num_items_warning > 0 &&
(($num_items_warning * 100) / $num_items) >= $weight
) {
return VISUAL_MAP_STATUS_WARNING;
}
else if (
$num_items_unknown > 0 &&
(($num_items_unknown * 100) / $num_items) >= $weight
) {
return VISUAL_MAP_STATUS_UNKNOWN;
}
else {
return VISUAL_MAP_STATUS_NORMAL;
}
break;
case "service":
$num_items_critical = $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_BAD]
+ $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_ALERT];
$critical_percentage = ($num_items_critical * 100) / count($valid_layout_items);
if ($critical_percentage >= $status_data["linked_layout_status_as_service_critical"]) {
return VISUAL_MAP_STATUS_CRITICAL_BAD;
}
else if ($critical_percentage >= $status_data["linked_layout_status_as_service_warning"]) {
return VISUAL_MAP_STATUS_WARNING;
}
else {
return VISUAL_MAP_STATUS_NORMAL;
}
break;
}
if ($calculate_weight) {
return array('elements_in_critical' => $elements_in_critical, 'temp_total' => $temp_total);
}
return $temp_total;
}
/**

View File

@ -166,7 +166,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
'bars_graph',
'clock');
$form_items['label_row']['html'] =
'<td align="left" valign="top" style="">' . __('Label') . '
'<td align="left" valign="top" style="">' . __('Label') . ui_print_help_icon ('macros_visual_maps', true) . '
<div id="label_box_arrow" style="text-align:center;width:120px;height:110px;margin-top:50px;">
<span>Label position</span>
@ -702,26 +702,64 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
'<td align="left">' . html_print_select_from_sql (
'SELECT id, name
FROM tlayout
WHERE id != ' . $visualConsole_id, 'map_linked', '', '', 'None', '0', true) .
WHERE id != ' . (int) $visualConsole_id, 'map_linked', 0, 'onLinkedMapChange(event)', __('None'), 0, true) .
'</td>';
$status_type_select_items = array(
"weight" => __("By status weight"),
"service" => __("By critical elements")
);
$form_items_advance['linked_map_status_calculation_row'] = array();
$form_items_advance['linked_map_status_calculation_row']['items'] = array('static_graph');
$form_items_advance['linked_map_status_calculation_row']['html'] = '<td align="left">'.
__('Type of the status calculation of the linked map') . '</td>'
. '<td align="left">'
. html_print_select(
$status_type_select_items,
'linked_map_status_calculation_type',
'default',
'onLinkedMapStatusCalculationTypeChange(event)',
__('By default'),
'default',
true,
false,
false
)
. '</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_icon ("linked_map_weight", true) .
'</td>';
$form_items_advance['map_linked_weight']['html'] = '<td align="left">'
. __('Map linked weight') . '</td>'
. '<td align="left">'
. html_print_input_text(
'map_linked_weight', 80, '', 3, 3, true, false, false, "", "type_number percentage"
)
. '<span>%</span>'
. ui_print_help_icon("linked_map_weight", true)
. '</td>';
$form_items_advance['linked_map_status_service_critical_row'] = array();
$form_items_advance['linked_map_status_service_critical_row']['items'] = array('static_graph');
$form_items_advance['linked_map_status_service_critical_row']['html'] = '<td align="left">'
. __('Critical weight') . '</td>'
. '<td align="left">'
. html_print_input_text(
'linked_map_status_service_critical', 80, '', 3, 3, true, false, false, "", "type_number percentage"
)
. '<span>%</span>'
. '</td>';
$form_items_advance['linked_map_status_service_warning_row'] = array();
$form_items_advance['linked_map_status_service_warning_row']['items'] = array('static_graph');
$form_items_advance['linked_map_status_service_warning_row']['html'] = '<td align="left">'
. __('Warning weight') . '</td>'
. '<td align="left">'
. html_print_input_text(
'linked_map_status_service_warning', 50, '', 3, 3, true, false, false, "", "type_number percentage"
)
. '<span>%</span>'
. '</td>';
$form_items_advance['line_case']['items'] = array('line_item');
$form_items_advance['line_case']['html'] = '
@ -788,6 +826,9 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
?>
<script type="text/javascript">
$(document).ready (function () {
$("input.type_number[type=text]").prop("type", "number");
$("input.percentage").prop("max", 100).prop("min", 0);
$(".border_color").attachColorPicker();
$(".fill_color").attachColorPicker();
$(".line_color").attachColorPicker();

View File

@ -142,10 +142,10 @@ d3.bullet = function() {
tickUpdate.select("line")
.attr("y1", height)
.attr("y2", height * 7 / 6);
.attr("y2", height + 7);
tickUpdate.select("text")
.attr("y", height * 7 / 6);
.attr("y", height + 7);
// Transition the exiting ticks to the new scale, x1.
tick.exit().transition()

View File

@ -1636,7 +1636,7 @@ function pandoraFlotArea( graph_id, values, legend,
mode: "time",
timezone: "browser",
localTimezone: true,
tickSize: [maxticks, 'hour']
//tickSize: [maxticks, 'hour']
}],
yaxis: {
font: {
@ -1743,7 +1743,7 @@ function pandoraFlotArea( graph_id, values, legend,
mode: "time",
timezone: "browser",
localTimezone: true,
tickSize: [maxticks, 'hour']
//tickSize: [maxticks, 'hour']
}],
yaxis: {
font: {

View File

@ -137,7 +137,7 @@ function flot_area_graph (
$return = "<div class='parent_graph' style='width: " . ($params['width']) . ";" . $background_style . "'>";
// Set some containers to legend, graph, timestamp tooltip, etc.
if($params['show_legend']){
$return .= "<p id='legend_$graph_id'></p>";
$return .= "<p id='legend_$graph_id' style='text-align:left;'></p>";
}
if(isset($params['graph_combined']) && $params['graph_combined'] &&
(!isset($params['from_interface']) || !$params['from_interface']) ){

View File

@ -0,0 +1,19 @@
<?php
/**
* @package Include/help/en
*/
?>
<h1>Visual console's macros</h1>
It is possible to enter a macro in the text box when editing an element of the visual console.
<br /><br />
List of visual console's macros:
<ul>
<li>_date_: Displays the date using the local PHP format. </li>
<li>_time_: Displays the time using the local PHP format. </li>
<li>_agent_: Displays the alias of the selected agent. </li>
<li>_module_: Displays the name of the selected module. </li>
<li>_agentdescription_: Displays the description of the selected agent. </li>
<li>_address_: Displays the ip address of the selected agent. </li>
<li>_moduledescription_: Displays the description of the selected module. </li>
</ul>

View File

@ -0,0 +1,42 @@
<?php
/**
* @package Include/help/en
*/
?>
<h1>Hierarchy</h1>
<p>
We explained that the permissions of a group can be extended to the children by means of the configuration option <b>Propagate ACL</b>. However, from the user configuration, you can limit this functionality and prevent the ACL from propagating by checking No hierarchy.
</p>
<p>
As a reference for the examples, we propose a configuration with two parent groups "Applications" and "Databases" with two children each, "Development_Apps" and "Management_Apps" for the former and "Databases_America" and "Databases_Asia" for the latter. Both parent groups are marked for ACL to spread.
</p>
<?php html_print_image("images/help/Acl_hierarchy_groups.png", false, array(
"style" => "max-width:100%"
)); ?>
<p>
In the user edit view, if the following profiles are added:
</p>
<?php html_print_image("images/help/Acl_hierarchy_1.png", false, array(
"style" => "max-width:100%"
)); ?>
<p>
The user will have access to the groups named "Applications", "Development_Apps", "Management_Apps" and "Databases".
</p>
<p>
However, if a child of "Databases" is added:
</p>
<?php html_print_image("images/help/Acl_hierarchy_2.png", false, array(
"style" => "max-width:100%"
)); ?>
<p>
Now the user will have access to the groups named "Applications", "Development_Apps", "Management_Apps", "Databases" and "Databases_Asia", but not to "Databases_America".
</p>

View File

@ -0,0 +1,22 @@
<?php
/**
* @package Include/help/en
*/
?>
<h1>Secondary groups</h1>
<p>
Unlike the main group, these secondary groups are optional.
</p>
<p>
The fact that an agent belongs to a secondary group means that, in fact, it belongs to several groups at the same time. With this functionality, two users who have very different permissions will be able to access the same agent just by adding the appropriate secondary groups to it.
</p>
<p>
For example, if an agent named "Portal" has "Infrastructures" as its main group and "Hosting" as its secondary group, any user who has access to "Infrastructures" and/or "Hosting" can access it.
</p>
<p>
Some views, such as the Tree View, can show repeated agents. When using secondary groups, this is the normal behavior.
</p>

View File

@ -0,0 +1,19 @@
<?php
/**
* @package Include/help/es
*/
?>
<h1>Macros de consolas visuales</h1>
Es posible introducir una macro en el cuadro de texto al editar un elemento de la consola visual.
<br /><br />
Lista de macros de consolas visuales:
<ul>
<li>_date_ : Muestra la fecha usando el formato local del PHP.</li>
<li>_time_ : Muestra la hora usando el formato local del PHP.</li>
<li>_agent_ : Muestra el alias del agente seleccionado.</li>
<li>_module_ : Muestra el nombre del módulo seleccionado.</li>
<li>_agentdescription_ : Muestra la descripción del agente seleccionado.</li>
<li>_address_ : Muestra la dirección ip del agente seleccionado.</li>
<li>_moduledescription_ : Muestra la descripción del módulo seleccionado.</li>
</ul>

View File

@ -0,0 +1,42 @@
<?php
/**
* @package Include/help/en
*/
?>
<h1>Jerarquía</h1>
<p>
Los permisos de un grupo se pueden extender a los hijos mediante la opción de configuración <b>Propagate ACL</b>. Sin embargo, desde la configuración de usuarios, se puede limitar esta funcionalidad y evitar que el ACL se propague marcando No hierarchy.
</p>
<p>
Como referencia para los ejemplos, se plantea una configuración con dos grupos padre "Applications" y "Databases" con dos hijos cada uno, "Development_Apps" y "Management_Apps" para el primero y "Databases_America" y "Databases_Asia" para el segundo. Ambos grupos padre están marcados para que se propague el ACL.
</p>
<?php html_print_image("images/help/Acl_hierarchy_groups.png", false, array(
"style" => "max-width:100%"
)); ?>
<p>
En la vista de edición de usuario, si se añaden los siguientes perfiles:
</p>
<?php html_print_image("images/help/Acl_hierarchy_1.png", false, array(
"style" => "max-width:100%"
)); ?>
<p>
El usuario tendrá acceso a los grupos "Applications", "Development_Apps", "Management_Apps" y "Databases".
</p>
<p>
En cambio, si se añade un hijo de "Databases":
</p>
<?php html_print_image("images/help/Acl_hierarchy_2.png", false, array(
"style" => "max-width:100%"
)); ?>
<p>
Ahora el usuario podrá acceder a los grupos "Applications", "Development_Apps", "Management_Apps", "Databases" y "Databases_Asia", pero no a "Databases_America".
</p>

View File

@ -0,0 +1,22 @@
<?php
/**
* @package Include/help/en
*/
?>
<h1>Secondary groups</h1>
<p>
Al contrario que el grupo principal, estos grupos secundarios son opcionales.
</p>
<p>
El hecho de que un agente pertenezca a un grupo secundario, significa que, en realidad, pertenece a varios grupos a la vez. Con esta funcionalidad, dos usuarios que tengan permisos muy diferentes podrán tener acceso al mismo agente con solo añadirle los grupos secundarios adecuados.
</p>
<p>
Por ejemplo, si un agente llamado "Portal" tiene como grupo principal "Infraestructuras" y como grupo secundario "Hosting", cualquier usuario que tenga acceso a "Infraestructuras" y/o a "Hosting" podrá acceder a él.
</p>
<p>
Algunas vistas, como es el caso del Tree View, pueden mostrar agentes repetidos. Al usar grupos secundarios es el comportamiento normal.
</p>

View File

@ -0,0 +1,43 @@
<?php
/**
* @package Include/help/en
*/
?>
<h1>Hierarchy</h1>
<p>
We explained that the permissions of a group can be extended to the children by means of the configuration option <b>Propagate ACL</b>. However, from the user configuration, you can limit this functionality and prevent the ACL from propagating by checking No hierarchy.
</p>
<p>
As a reference for the examples, we propose a configuration with two parent groups "Applications" and "Databases" with two children each, "Development_Apps" and "Management_Apps" for the former and "Databases_America" and "Databases_Asia" for the latter. Both parent groups are marked for ACL to spread.
</p>
<?php html_print_image("images/help/Acl_hierarchy_groups.png", false, array(
"style" => "max-width:100%"
)); ?>
<p>
In the user edit view, if the following profiles are added:
</p>
<?php html_print_image("images/help/Acl_hierarchy_1.png", false, array(
"style" => "max-width:100%"
)); ?>
<p>
The user will have access to the groups named "Applications", "Development_Apps", "Management_Apps" and "Databases".
</p>
<p>
However, if a child of "Databases" is added:
</p>
<?php html_print_image("images/help/Acl_hierarchy_2.png", false, array(
"style" => "max-width:100%"
)); ?>
<p>
Now the user will have access to the groups named "Applications", "Development_Apps", "Management_Apps", "Databases" and "Databases_Asia", but not to "Databases_America".
</p>

View File

@ -0,0 +1,22 @@
<?php
/**
* @package Include/help/en
*/
?>
<h1>Secondary groups</h1>
<p>
Unlike the main group, these secondary groups are optional.
</p>
<p>
The fact that an agent belongs to a secondary group means that, in fact, it belongs to several groups at the same time. With this functionality, two users who have very different permissions will be able to access the same agent just by adding the appropriate secondary groups to it.
</p>
<p>
For example, if an agent named "Portal" has "Infrastructures" as its main group and "Hosting" as its secondary group, any user who has access to "Infrastructures" and/or "Hosting" can access it.
</p>
<p>
Some views, such as the Tree View, can show repeated agents. When using secondary groups, this is the normal behavior.
</p>

View File

@ -33958,7 +33958,7 @@ msgid "Cluster type"
msgstr ""
#: ../../enterprise/godmode/reporting/cluster_builder.main.php:258
msgid "Ative - Active"
msgid "Active - Active"
msgstr ""
#: ../../enterprise/godmode/reporting/cluster_builder.main.php:259

View File

@ -34245,7 +34245,7 @@ msgid "Cluster type"
msgstr ""
#: ../../enterprise/godmode/reporting/cluster_builder.main.php:258
msgid "Ative - Active"
msgid "Active - Active"
msgstr ""
#: ../../enterprise/godmode/reporting/cluster_builder.main.php:259

View File

@ -33343,7 +33343,7 @@ msgid "Cluster type"
msgstr "クラスタタイプ"
#: ../../enterprise/godmode/reporting/cluster_builder.main.php:258
msgid "Ative - Active"
msgid "Active - Active"
msgstr "アクティブ - アクティブ"
#: ../../enterprise/godmode/reporting/cluster_builder.main.php:259

Some files were not shown because too many files have changed in this diff Show More