Merge branch 'develop' into 'ent-4664-Bug-Automatically-combined-graph'
Conflicts: pandora_console/godmode/reporting/graphs.php
This commit is contained in:
commit
90d567a064
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, AIX version
|
||||
# Version 7.0NG.740, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, FreeBSD Version
|
||||
# Version 7.0NG.740, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, HP-UX Version
|
||||
# Version 7.0NG.740, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, GNU/Linux
|
||||
# Version 7.0NG.740, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, GNU/Linux
|
||||
# Version 7.0NG.740, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, Solaris Version
|
||||
# Version 7.0NG.740, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.739
|
||||
# Version 7.0NG.740
|
||||
|
||||
# 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.739, AIX version
|
||||
# Version 7.0NG.740, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.739
|
||||
# Version 7.0NG.740
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.739, HPUX Version
|
||||
# Version 7.0NG.740, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739
|
||||
# Version 7.0NG.740
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739
|
||||
# Version 7.0NG.740
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739
|
||||
# Version 7.0NG.740
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.739, Solaris version
|
||||
# Version 7.0NG.740, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, AIX version
|
||||
# Version 7.0NG.740, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.739-191002
|
||||
Version: 7.0NG.740-191029
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.739-191002"
|
||||
pandora_version="7.0NG.740-191029"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, GNU/Linux
|
||||
# Version 7.0NG.740, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, FreeBSD Version
|
||||
# Version 7.0NG.740, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, HP-UX Version
|
||||
# Version 7.0NG.740, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, GNU/Linux
|
||||
# Version 7.0NG.740, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, GNU/Linux
|
||||
# Version 7.0NG.740, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, NetBSD Version
|
||||
# Version 7.0NG.740, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, Solaris Version
|
||||
# Version 7.0NG.740, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -41,8 +41,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.739';
|
||||
use constant AGENT_BUILD => '191002';
|
||||
use constant AGENT_VERSION => '7.0NG.740';
|
||||
use constant AGENT_BUILD => '191029';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.739
|
||||
%define release 191002
|
||||
%define version 7.0NG.740
|
||||
%define release 191029
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.739
|
||||
%define release 191002
|
||||
%define version 7.0NG.740
|
||||
%define release 191029
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.739"
|
||||
PI_BUILD="191002"
|
||||
PI_VERSION="7.0NG.740"
|
||||
PI_BUILD="191029"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.739
|
||||
# Version 7.0NG.740
|
||||
|
||||
# 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
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.739}
|
||||
{Pandora FMS Windows Agent v7.0NG.740}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{191002}
|
||||
{191029}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.739(Build 191002)")
|
||||
#define PANDORA_VERSION ("7.0NG.740(Build 191029)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.739(Build 191002))"
|
||||
VALUE "ProductVersion", "(7.0NG.740(Build 191029))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.739-191002
|
||||
Version: 7.0NG.740-191029
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.739-191002"
|
||||
pandora_version="7.0NG.740-191029"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -238,18 +238,6 @@ function output_xml_report($id)
|
|||
echo '<line_separator><![CDATA['.io_safe_output($item['line_separator']).']]></line_separator>';
|
||||
echo '<column_separator><![CDATA['.io_safe_output($item['header_definition']).']]></column_separator>';
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
break;
|
||||
}
|
||||
|
||||
echo "</item>\n";
|
||||
|
|
|
@ -375,18 +375,6 @@ function process_upload_xml_report($xml, $group_filter=0)
|
|||
$values['line_separator'] = io_safe_input($item['line_separator']);
|
||||
$values['column_separator'] = io_safe_input($item['column_separator']);
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
break;
|
||||
}
|
||||
|
||||
if (empty($agents_item)) {
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2019 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 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.
|
||||
require_once __DIR__.'/../include/config.php';
|
||||
require_once __DIR__.'/../include/auth/mysql.php';
|
||||
require_once __DIR__.'/../include/functions.php';
|
||||
require_once __DIR__.'/../include/functions_db.php';
|
||||
/*
|
||||
* Review if sample agent is active and deploys configuration for
|
||||
* visual consoles if necessary
|
||||
*/
|
||||
global $config;
|
||||
|
||||
// Deployment of sample agent for visual consoles.
|
||||
if ($config['sample_agent'] == 1 && !isset($config['sample_agent_deployed'])) {
|
||||
$id_agente = db_get_sql('SELECT id_agente FROM tagente WHERE nombre = "Sample_Agent";');
|
||||
$modules = db_get_all_rows_filter('tagente_modulo', ['id_agente' => $id_agente], 'id_agente_modulo');
|
||||
$count_modules = count($modules);
|
||||
|
||||
// Update of layout 1 (Rack sample).
|
||||
$images_rack_server = [
|
||||
'rack_server_rack',
|
||||
'rack_server',
|
||||
'rack_switch',
|
||||
'rack_firewall',
|
||||
'rack_double_server',
|
||||
'rack_frame',
|
||||
'rack_pdu',
|
||||
];
|
||||
$query = 'UPDATE `tlayout_data` SET `id_agent` = '.$id_agente.', `id_agente_modulo` = CASE ';
|
||||
for ($i = 0; $i < $count_modules; $i++) {
|
||||
$query .= 'WHEN `image` = "'.$images_rack_server[$i].'" THEN '.$modules[$i]['id_agente_modulo'].' ';
|
||||
}
|
||||
|
||||
$query .= 'END WHERE `id_layout` = 1 AND `image` IN ("'.implode('","', $images_rack_server).'");';
|
||||
|
||||
db_process_sql($query);
|
||||
// Update of layout 2 (Dashboard).
|
||||
$query = 'UPDATE `tlayout_data` SET `id_agent`= '.$id_agente.', `id_agente_modulo` = CASE ';
|
||||
$query .= 'WHEN `id` = 107 THEN '.$modules[0]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 108 THEN '.$modules[1]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 109 THEN '.$modules[2]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 110 THEN '.$modules[2]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 111 THEN '.$modules[3]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 112 THEN '.$modules[4]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 113 THEN '.$modules[5]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 114 THEN '.$modules[6]['id_agente_modulo'].' ';
|
||||
$query .= 'END WHERE `id_layout` = 2 AND `id` IN (107,108,109,110,111,112,113,114);';
|
||||
|
||||
db_process_sql($query);
|
||||
|
||||
// This setting will avoid regenerate all the times the visual consoles.
|
||||
config_update_value('sample_agent_deployed', 1);
|
||||
}
|
||||
|
||||
extensions_add_main_function('sample_agent_deployment');
|
|
@ -0,0 +1,5 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tlayout_template_data` ADD COLUMN `cache_expiration` INTEGER UNSIGNED NOT NULL DEFAULT 0;
|
||||
|
||||
COMMIT;
|
|
@ -1907,6 +1907,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
|||
`linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0,
|
||||
`linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0,
|
||||
`linked_layout_node_id` INT(10) NOT NULL default 0,
|
||||
`cache_expiration` INTEGER UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
|
@ -33,7 +33,7 @@ ui_require_css_file('firts_task');
|
|||
);
|
||||
?>
|
||||
</p>
|
||||
<form action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor" method="post">
|
||||
<form action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor" method="post">
|
||||
<input type="submit" class="button_task" value="<?php echo __('Create Planned Downtime'); ?>" />
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -331,19 +331,19 @@ if ($config['menu_type'] == 'classic') {
|
|||
|
||||
// Support.
|
||||
if (defined('PANDORA_ENTERPRISE')) {
|
||||
$header_support_link = 'https://support.artica.es/';
|
||||
$header_support_link = $config['custom_support_url'];
|
||||
} else {
|
||||
$header_support_link = 'https://pandorafms.com/forums/';
|
||||
}
|
||||
|
||||
$header_support = '<div id="header_support">';
|
||||
$header_support .= '<a href="'.$header_support_link.'" target="_blank">';
|
||||
$header_support .= '<a href="'.ui_get_full_external_url($header_support_link).'" target="_blank">';
|
||||
$header_support .= html_print_image('/images/header_support.png', true, ['title' => __('Go to support'), 'class' => 'bot', 'alt' => 'user']);
|
||||
$header_support .= '</a></div>';
|
||||
|
||||
// Documentation.
|
||||
$header_docu = '<div id="header_docu">';
|
||||
$header_docu .= '<a href="https://wiki.pandorafms.com/index.php?title=Main_Page" target="_blank">';
|
||||
$header_docu .= '<a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">';
|
||||
$header_docu .= html_print_image('/images/header_docu.png', true, ['title' => __('Go to documentation'), 'class' => 'bot', 'alt' => 'user']);
|
||||
$header_docu .= '</a></div>';
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ echo '<div id="login_help_dialog" title="'.__('Welcome to %s', get_product_name(
|
|||
echo '</td>';
|
||||
|
||||
echo '<td style="border:1px solid #FFF; text-align:center;">';
|
||||
echo '<a href="'.$config['custom_docs_url'].'" target="_blank" style="text-decoration:none;">'.html_print_image(
|
||||
echo '<a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank" style="text-decoration:none;">'.html_print_image(
|
||||
'images/documentation.png',
|
||||
true,
|
||||
[
|
||||
|
@ -96,7 +96,7 @@ echo '<div id="login_help_dialog" title="'.__('Welcome to %s', get_product_name(
|
|||
]
|
||||
).'</a>';
|
||||
echo '<br style="margin-bottom: 40px;" />';
|
||||
echo '<a style="font-size: 9pt;" href="'.$config['custom_docs_url'].'" target="_blank">'.__('Documentation').'</span></a>';
|
||||
echo '<a style="font-size: 9pt;"href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">'.__('Documentation').'</span></a>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
|
|
|
@ -96,16 +96,16 @@ echo '<div id="header_login">';
|
|||
|
||||
echo '<div id="list_icon_docs_support"><ul>';
|
||||
if ($docs_logo !== false) {
|
||||
echo '<li><a href="'.$config['custom_docs_url'].'" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
|
||||
echo '<li><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
|
||||
}
|
||||
|
||||
echo '<li><a href="'.$config['custom_docs_url'].'" target="_blank">'.__('Docs').'</li>';
|
||||
echo '<li><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">'.__('Docs').'</li>';
|
||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||
if ($support_logo !== false) {
|
||||
echo '<li id="li_margin_left"><a href="'.$config['custom_support_url'].'" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
||||
echo '<li id="li_margin_left"><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
||||
}
|
||||
|
||||
echo '<li><a href="'.$config['custom_support_url'].'" target="_blank">'.__('Support').'</li>';
|
||||
echo '<li><a href="'.ui_get_full_external_url($config['custom_support_url']).'" target="_blank">'.__('Support').'</li>';
|
||||
} else {
|
||||
echo '<li id="li_margin_left"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
||||
echo '<li>'.__('Support').'</li>';
|
||||
|
|
|
@ -765,7 +765,7 @@ $table_adv_agent_icon .= html_print_select(
|
|||
).'</div>';
|
||||
|
||||
if ($config['activate_gis']) {
|
||||
$table_adv_gis = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Ignore new GIS data:').'</p>';
|
||||
$table_adv_gis = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Update new GIS data:').'</p>';
|
||||
if ($new_agent) {
|
||||
$update_gis_data = true;
|
||||
}
|
||||
|
|
|
@ -1382,8 +1382,8 @@ if ($update_module || $create_module) {
|
|||
$ff_event_normal = (int) get_parameter('ff_event_normal');
|
||||
$ff_event_warning = (int) get_parameter('ff_event_warning');
|
||||
$ff_event_critical = (int) get_parameter('ff_event_critical');
|
||||
$ff_type = (int) get_parameter('ff_type');
|
||||
$each_ff = (int) get_parameter('each_ff');
|
||||
$ff_type = (int) get_parameter('ff_type', $module['ff_type']);
|
||||
$each_ff = (int) get_parameter('each_ff', $module['each_ff']);
|
||||
$ff_timeout = (int) get_parameter('ff_timeout');
|
||||
$unit = (string) get_parameter('unit');
|
||||
$id_tag = (array) get_parameter('id_tag_selected');
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// Load global vars
|
||||
check_login();
|
||||
|
||||
// Take some parameters (GET)
|
||||
// Take some parameters (GET).
|
||||
$offset = (int) get_parameter('offset');
|
||||
$group_id = (int) get_parameter('group_id');
|
||||
$ag_group = get_parameter('ag_group_refresh', -1);
|
||||
|
@ -47,10 +47,10 @@ require_once 'include/functions_users.php';
|
|||
|
||||
$search = get_parameter('search', '');
|
||||
|
||||
// Prepare the tab system to the future
|
||||
// Prepare the tab system to the future.
|
||||
$tab = 'view';
|
||||
|
||||
// Setup tab
|
||||
// Setup tab.
|
||||
$viewtab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente">'.html_print_image('images/operation.png', true, ['title' => __('View')]).'</a>';
|
||||
|
||||
$viewtab['operation'] = true;
|
||||
|
@ -59,10 +59,10 @@ $viewtab['active'] = false;
|
|||
|
||||
$onheader = ['view' => $viewtab];
|
||||
|
||||
// Header
|
||||
// Header.
|
||||
ui_print_page_header(__('Agents defined in %s', get_product_name()), 'images/agent_mc.png', false, '', true, $onheader);
|
||||
|
||||
// Perform actions
|
||||
// Perform actions.
|
||||
$agent_to_delete = (int) get_parameter('borrar_agente');
|
||||
$enable_agent = (int) get_parameter('enable_agent');
|
||||
$disable_agent = (int) get_parameter('disable_agent');
|
||||
|
@ -99,7 +99,7 @@ if ($agent_to_delete) {
|
|||
ui_print_result_message($result, __('Success deleted agent.'), __('Could not be deleted.'));
|
||||
|
||||
if (enterprise_installed()) {
|
||||
// Check if the remote config file still exist
|
||||
// Check if the remote config file still exist.
|
||||
if (isset($config['remote_config'])) {
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
if (enterprise_hook('config_agents_has_remote_configuration', [$id_agente])) {
|
||||
|
@ -114,7 +114,7 @@ if ($enable_agent) {
|
|||
$alias = agents_get_alias($enable_agent);
|
||||
|
||||
if ($result) {
|
||||
// Update the agent from the metaconsole cache
|
||||
// Update the agent from the metaconsole cache.
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
$values = ['disabled' => 0];
|
||||
enterprise_hook('agent_update_from_cache', [$enable_agent, $values, $server_name]);
|
||||
|
@ -136,7 +136,7 @@ if ($disable_agent) {
|
|||
$alias = agents_get_alias($disable_agent);
|
||||
|
||||
if ($result) {
|
||||
// Update the agent from the metaconsole cache
|
||||
// Update the agent from the metaconsole cache.
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
$values = ['disabled' => 1];
|
||||
enterprise_hook('agent_update_from_cache', [$disable_agent, $values, $server_name]);
|
||||
|
@ -223,6 +223,10 @@ switch ($config['dbtype']) {
|
|||
case 'oracle':
|
||||
$order_collation = '';
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
$selected = true;
|
||||
|
@ -252,6 +256,10 @@ switch ($sortField) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -274,6 +282,10 @@ switch ($sortField) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -296,6 +308,10 @@ switch ($sortField) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -318,6 +334,10 @@ switch ($sortField) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -378,7 +398,7 @@ if ($os != 0) {
|
|||
}
|
||||
|
||||
$user_groups_to_sql = '';
|
||||
// Show only selected groups
|
||||
// Show only selected groups.
|
||||
if ($ag_group > 0) {
|
||||
$ag_groups = [];
|
||||
$ag_groups = (array) $ag_group;
|
||||
|
@ -388,7 +408,7 @@ if ($ag_group > 0) {
|
|||
|
||||
$user_groups_to_sql = implode(',', $ag_groups);
|
||||
} else {
|
||||
// Concatenate AW and AD permisions to get all the possible groups where the user can manage
|
||||
// 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');
|
||||
|
||||
|
@ -431,24 +451,25 @@ $sql = sprintf(
|
|||
|
||||
$agents = db_get_all_rows_sql($sql);
|
||||
|
||||
// Delete rnum row generated by oracle_recode_query() function
|
||||
// Delete rnum row generated by oracle_recode_query() function.
|
||||
if (($config['dbtype'] == 'oracle') && ($agents !== false)) {
|
||||
for ($i = 0; $i < count($agents); $i++) {
|
||||
unset($agents[$i]['rnum']);
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare pagination
|
||||
// Prepare pagination.
|
||||
ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
|
||||
|
||||
if ($agents !== false) {
|
||||
// Urls to sort the table.
|
||||
// Agent name size and description for Chinese and Japanese languages are adjusted
|
||||
$agent_font_size = '7';
|
||||
$description_font_size = '6.5';
|
||||
if ($config['language'] == 'ja' || $config['language'] == 'zh_CN' || $own_info['language'] == 'ja' || $own_info['language'] == 'zh_CN') {
|
||||
$agent_font_size = '15';
|
||||
$description_font_size = '11';
|
||||
if ($config['language'] == 'ja'
|
||||
|| $config['language'] == 'zh_CN'
|
||||
|| $own_info['language'] == 'ja'
|
||||
|| $own_info['language'] == 'zh_CN'
|
||||
) {
|
||||
// Adds a custom font size for Japanese and Chinese language.
|
||||
$custom_font_size = 'custom_font_size';
|
||||
}
|
||||
|
||||
$url_up_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled';
|
||||
|
@ -476,21 +497,21 @@ if ($agents !== false) {
|
|||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
foreach ($agents as $agent) {
|
||||
// Begin Update tagente.remote 0/1 with remote agent function return
|
||||
// Begin Update tagente.remote 0/1 with remote agent function return.
|
||||
if (enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']])) {
|
||||
db_process_sql_update('tagente', ['remote' => 1], 'id_agente = '.$agent['id_agente'].'');
|
||||
} else {
|
||||
db_process_sql_update('tagente', ['remote' => 0], 'id_agente = '.$agent['id_agente'].'');
|
||||
}
|
||||
|
||||
// End Update tagente.remote 0/1 with remote agent function return
|
||||
// End Update tagente.remote 0/1 with remote agent function return.
|
||||
$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']);
|
||||
|
||||
// Do not show the agent if there is not enough permissions
|
||||
// Do not show the agent if there is not enough permissions.
|
||||
if (!$check_aw && !$check_ad) {
|
||||
continue;
|
||||
}
|
||||
|
@ -512,7 +533,7 @@ if ($agents !== false) {
|
|||
|
||||
$rowPair = !$rowPair;
|
||||
$iterator++;
|
||||
// Agent name
|
||||
// Agent name.
|
||||
echo "<tr class='$rowclass'><td class='$tdcolor' width='40%'>";
|
||||
if ($agent['disabled']) {
|
||||
echo '<em>';
|
||||
|
@ -537,7 +558,7 @@ if ($agents !== false) {
|
|||
} else {
|
||||
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
|
||||
id_agente=".$agent['id_agente']."'>".'<span style="font-size: '.$agent_font_size.'pt" title="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
|
||||
id_agente=".$agent['id_agente']."'>".'<span class="'.$custom_font_size.' title ="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
|
||||
}
|
||||
|
||||
echo '</strong>';
|
||||
|
@ -617,12 +638,12 @@ if ($agents !== false) {
|
|||
|
||||
echo '</td>';
|
||||
|
||||
// Operating System icon
|
||||
// Operating System icon.
|
||||
echo "<td class='$tdcolor' align='left' valign='middle'>";
|
||||
ui_print_os_icon($agent['id_os'], false);
|
||||
echo '</td>';
|
||||
|
||||
// Type agent (Networt, Software or Satellite)
|
||||
// Type agent (Networt, Software or Satellite).
|
||||
echo "<td class='$tdcolor' align='left' valign='middle'>";
|
||||
echo ui_print_type_agent_icon(
|
||||
$agent['id_os'],
|
||||
|
@ -634,10 +655,12 @@ if ($agents !== false) {
|
|||
echo '</td>';
|
||||
|
||||
|
||||
// Group icon and name
|
||||
// Group icon and name.
|
||||
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, '[…]', 'font-size: '.$description_font_size.'pt;').'</td>';
|
||||
|
||||
// Description.
|
||||
echo "<td class='".$tdcolor."f9'><span class='".$custom_font_size."'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[…]').'</span></td>';
|
||||
|
||||
// Action
|
||||
// When there is only one element in page it's necesary go back page.
|
||||
if ((count($agents) == 1) && ($offset >= $config['block_size'])) {
|
||||
|
@ -695,7 +718,7 @@ if ($agents !== false) {
|
|||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
// Create agent button
|
||||
// Create agent button.
|
||||
echo '<div style="text-align: right;">';
|
||||
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||
html_print_input_hidden('new_agent', 1);
|
||||
|
|
|
@ -842,7 +842,9 @@ foreach ($modules as $module) {
|
|||
$module['str_warning'],
|
||||
$module['max_critical'],
|
||||
$module['min_critical'],
|
||||
$module['str_critical']
|
||||
$module['str_critical'],
|
||||
$module['warning_inverse'],
|
||||
$module['critical_inverse']
|
||||
);
|
||||
} else {
|
||||
$data[7] = '';
|
||||
|
|
|
@ -1191,49 +1191,54 @@ $table_relations->data[-1][3] .= html_print_image('images/lock.png', true).'</a>
|
|||
$table_relations->data[-1][4] = '<a id="delete_relation_button" href="">';
|
||||
$table_relations->data[-1][4] .= html_print_image('images/cross.png', true).'</a>';
|
||||
|
||||
$module_relations = modules_get_relations(['id_module' => $id_agent_module]);
|
||||
if (!$module_relations) {
|
||||
$module_relations = [];
|
||||
}
|
||||
|
||||
$relations_count = 0;
|
||||
foreach ($module_relations as $key => $module_relation) {
|
||||
if ($module_relation['module_a'] == $id_agent_module) {
|
||||
$module_id = $module_relation['module_b'];
|
||||
$agent_id = modules_give_agent_id_from_module_id(
|
||||
$module_relation['module_b']
|
||||
);
|
||||
} else {
|
||||
$module_id = $module_relation['module_a'];
|
||||
$agent_id = modules_give_agent_id_from_module_id(
|
||||
$module_relation['module_a']
|
||||
);
|
||||
if ($id_agent_module) {
|
||||
$module_relations = modules_get_relations(['id_module' => $id_agent_module]);
|
||||
|
||||
if (!$module_relations) {
|
||||
$module_relations = [];
|
||||
}
|
||||
|
||||
$agent_name = ui_print_agent_name($agent_id, true);
|
||||
$relations_count = 0;
|
||||
foreach ($module_relations as $key => $module_relation) {
|
||||
if ($module_relation['module_a'] == $id_agent_module) {
|
||||
$module_id = $module_relation['module_b'];
|
||||
$agent_id = modules_give_agent_id_from_module_id(
|
||||
$module_relation['module_b']
|
||||
);
|
||||
} else {
|
||||
$module_id = $module_relation['module_a'];
|
||||
$agent_id = modules_give_agent_id_from_module_id(
|
||||
$module_relation['module_a']
|
||||
);
|
||||
}
|
||||
|
||||
$module_name = modules_get_agentmodule_name($module_id);
|
||||
if (empty($module_name) || $module_name == 'false') {
|
||||
$module_name = $module_id;
|
||||
$agent_name = ui_print_agent_name($agent_id, true);
|
||||
|
||||
$module_name = modules_get_agentmodule_name($module_id);
|
||||
if (empty($module_name) || $module_name == 'false') {
|
||||
$module_name = $module_id;
|
||||
}
|
||||
|
||||
if ($module_relation['disable_update']) {
|
||||
$disabled_update_class = '';
|
||||
} else {
|
||||
$disabled_update_class = 'alpha50';
|
||||
}
|
||||
|
||||
// Agent name.
|
||||
$table_relations->data[$relations_count][0] = $agent_name;
|
||||
// Module name.
|
||||
$table_relations->data[$relations_count][1] = "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$agent_id.'&tab=module&edit_module=1&id_agent_module='.$module_id."'>".ui_print_truncate_text($module_name, 'module_medium', true, true, true, '[…]').'</a>';
|
||||
// Type.
|
||||
$table_relations->data[$relations_count][2] = ($module_relation['type'] === 'direct') ? __('Direct') : __('Failover');
|
||||
// Lock relationship updates.
|
||||
$table_relations->data[$relations_count][3] = '<a id="disable_updates_button" class="'.$disabled_update_class.'"href="javascript: change_lock_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/lock.png', true).'</a>';
|
||||
// Delete relationship.
|
||||
$table_relations->data[$relations_count][4] = '<a id="delete_relation_button" href="javascript: delete_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/cross.png', true).'</a>';
|
||||
$relations_count++;
|
||||
}
|
||||
|
||||
if ($module_relation['disable_update']) {
|
||||
$disabled_update_class = '';
|
||||
} else {
|
||||
$disabled_update_class = 'alpha50';
|
||||
}
|
||||
|
||||
// Agent name.
|
||||
$table_relations->data[$relations_count][0] = $agent_name;
|
||||
// Module name.
|
||||
$table_relations->data[$relations_count][1] = "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$agent_id.'&tab=module&edit_module=1&id_agent_module='.$module_id."'>".ui_print_truncate_text($module_name, 'module_medium', true, true, true, '[…]').'</a>';
|
||||
// Type.
|
||||
$table_relations->data[$relations_count][2] = ($module_relation['type'] === 'direct') ? __('Direct') : __('Failover');
|
||||
// Lock relationship updates.
|
||||
$table_relations->data[$relations_count][3] = '<a id="disable_updates_button" class="'.$disabled_update_class.'"href="javascript: change_lock_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/lock.png', true).'</a>';
|
||||
// Delete relationship.
|
||||
$table_relations->data[$relations_count][4] = '<a id="delete_relation_button" href="javascript: delete_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/cross.png', true).'</a>';
|
||||
$relations_count++;
|
||||
}
|
||||
|
||||
html_print_input_hidden('module_relations_count', $relations_count);
|
||||
|
|
|
@ -827,7 +827,7 @@ $table->data[5][1] = "
|
|||
</table>
|
||||
</div>';
|
||||
|
||||
echo '<form method="POST" action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor">';
|
||||
echo '<form method="POST" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor">';
|
||||
|
||||
if ($id_downtime > 0) {
|
||||
echo '<table width=100% border=0 cellpadding=4 >';
|
||||
|
@ -929,7 +929,7 @@ if ($id_downtime > 0) {
|
|||
$disabled_add_button = true;
|
||||
}
|
||||
|
||||
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
|
||||
echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
|
||||
html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;margin-right:15px;');
|
||||
|
||||
html_print_checkbox('recursion', 1, $recursion, false, false, '');
|
||||
|
@ -939,7 +939,7 @@ if ($id_downtime > 0) {
|
|||
echo '</form>';
|
||||
// Show available agents to include into downtime
|
||||
echo '<h4>'.__('Available agents').':</h4>';
|
||||
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
|
||||
echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
|
||||
|
||||
echo html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, false, true, true, '', false, 'width: 180px;');
|
||||
|
||||
|
@ -1085,7 +1085,7 @@ if ($id_downtime > 0) {
|
|||
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
|
||||
}
|
||||
|
||||
$data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
|
||||
$data[5] .= '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
|
||||
}
|
||||
|
||||
$table->data['agent_'.$downtime_agent['id_agente']] = $data;
|
||||
|
|
|
@ -357,7 +357,7 @@ if (!$downtimes && !$filter_performed) {
|
|||
// No downtimes cause the user performed a search.
|
||||
else if (!$downtimes) {
|
||||
// Filter form.
|
||||
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
echo "<form method='post' action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
html_print_table($table_form);
|
||||
echo '</form>';
|
||||
|
||||
|
@ -369,7 +369,7 @@ else if (!$downtimes) {
|
|||
// Create button.
|
||||
if ($write_permisson) {
|
||||
echo ' ';
|
||||
echo '<form method="post" action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
||||
echo '<form method="post" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
}
|
||||
|
@ -378,11 +378,11 @@ else if (!$downtimes) {
|
|||
}
|
||||
// Has downtimes.
|
||||
else {
|
||||
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
echo "<form method='post' action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
html_print_table($table_form);
|
||||
echo '</form>';
|
||||
|
||||
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset);
|
||||
ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset);
|
||||
|
||||
// User groups with AR, AD or AW permission.
|
||||
$groupsAD = users_get_groups($config['id_user'], $access);
|
||||
|
@ -476,7 +476,7 @@ else {
|
|||
if (in_array($downtime['id_group'], $groupsAD)) {
|
||||
// Stop button
|
||||
if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) {
|
||||
$data['stop'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
|
||||
$data['stop'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
|
||||
} else {
|
||||
$data['stop'] = '';
|
||||
}
|
||||
|
@ -484,12 +484,12 @@ else {
|
|||
// Edit & delete buttons.
|
||||
if ($downtime['executed'] == 0) {
|
||||
// Edit.
|
||||
$data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
||||
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
||||
// Delete.
|
||||
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]);
|
||||
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]);
|
||||
} else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') {
|
||||
// Edit.
|
||||
$data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
||||
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
||||
// Delete.
|
||||
$data['delete'] = __('N/A');
|
||||
} else {
|
||||
|
@ -515,7 +515,7 @@ else {
|
|||
}
|
||||
|
||||
html_print_table($table);
|
||||
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||
ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
||||
// CSV export button.
|
||||
|
@ -532,7 +532,7 @@ else {
|
|||
// Create button.
|
||||
if ($write_permisson) {
|
||||
echo ' ';
|
||||
echo '<form method="post" action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
||||
echo '<form method="post" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ $(document).ready (function () {
|
|||
|
||||
if (<?php echo json_encode($malformed_downtimes_exist); ?> && <?php echo json_encode($migrate_malformed == false); ?>) {
|
||||
if (confirm("<?php echo __('WARNING: There are malformed planned downtimes').'.\n'.__('Do you want to migrate automatically the malformed items?'); ?>")) {
|
||||
window.location.href = "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1";
|
||||
window.location.href = "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -59,8 +59,10 @@ if ($update_agents) {
|
|||
$values['id_grupo'] = get_parameter('group');
|
||||
}
|
||||
|
||||
if (get_parameter('interval', 0) != 0) {
|
||||
$values['intervalo'] = get_parameter('interval');
|
||||
if (!(get_parameter('interval_select') == -1 && empty(get_parameter('interval_text')))) {
|
||||
if (get_parameter('interval', 0) != 0) {
|
||||
$values['intervalo'] = get_parameter('interval');
|
||||
}
|
||||
}
|
||||
|
||||
if (get_parameter('id_os', '') != -1) {
|
||||
|
@ -199,7 +201,7 @@ if ($update_agents) {
|
|||
}
|
||||
|
||||
// Update the configuration files.
|
||||
if ($result && ($old_interval_value != $values['intervalo'])) {
|
||||
if ($result && ($old_interval_value != $values['intervalo']) && !empty($values['intervalo'])) {
|
||||
enterprise_hook(
|
||||
'config_agents_update_config_token',
|
||||
[
|
||||
|
@ -523,7 +525,7 @@ $table->data[1][1] = html_print_select_groups(false, 'AR', false, 'group', $grou
|
|||
|
||||
$table->data[2][0] = __('Interval');
|
||||
|
||||
$table->data[2][1] = html_print_extended_select_for_time('interval', 0, '', __('No change'), '0', 10, true, 'width: 150px');
|
||||
$table->data[2][1] = html_print_extended_select_for_time('interval', 0, '', __('No change'), '0', 10, true, 'width: 150px', false);
|
||||
|
||||
$table->data[3][0] = __('OS');
|
||||
$table->data[3][1] = html_print_select_from_sql(
|
||||
|
|
|
@ -21,27 +21,42 @@ require_once 'include/functions_menu.php';
|
|||
$menu_godmode = [];
|
||||
$menu_godmode['class'] = 'godmode';
|
||||
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (check_acl($config['id_user'], 0, 'AR')
|
||||
|| check_acl($config['id_user'], 0, 'AW')
|
||||
|| check_acl($config['id_user'], 0, 'RR')
|
||||
|| check_acl($config['id_user'], 0, 'RW')
|
||||
|| check_acl($config['id_user'], 0, 'PM')
|
||||
) {
|
||||
$sub = [];
|
||||
$sub['godmode/servers/discovery&wiz=main']['text'] = __('Main');
|
||||
$sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery';
|
||||
|
||||
$sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list');
|
||||
$sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist';
|
||||
|
||||
$sub2 = [];
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=netscan']['text'] = __('Network scan');
|
||||
enterprise_hook('hostdevices_submenu');
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=customnetscan']['text'] = __('Custom network scan');
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=managenetscanscripts']['text'] = __('Manage scan scripts');
|
||||
$sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
|
||||
$sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
|
||||
$sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
|
||||
if (check_acl($config['id_user'], 0, 'AW')
|
||||
|| check_acl($config['id_user'], 0, 'PM')
|
||||
) {
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
$sub2 = [];
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=netscan']['text'] = __('Network scan');
|
||||
enterprise_hook('hostdevices_submenu');
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=customnetscan']['text'] = __('Custom network scan');
|
||||
}
|
||||
|
||||
enterprise_hook('applications_menu');
|
||||
enterprise_hook('cloud_menu');
|
||||
enterprise_hook('console_task_menu');
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=managenetscanscripts']['text'] = __('Manage scan scripts');
|
||||
}
|
||||
|
||||
$sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
|
||||
$sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
|
||||
$sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
enterprise_hook('applications_menu');
|
||||
enterprise_hook('cloud_menu');
|
||||
enterprise_hook('console_task_menu');
|
||||
}
|
||||
|
||||
// Add to menu.
|
||||
$menu_godmode['discovery']['text'] = __('Discovery');
|
||||
|
@ -92,7 +107,7 @@ if (!empty($sub)) {
|
|||
}
|
||||
|
||||
$sub = [];
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$sub['godmode/groups/group_list']['text'] = __('Manage agents groups');
|
||||
$sub['godmode/groups/group_list']['id'] = 'Manage agents groups';
|
||||
}
|
||||
|
@ -384,9 +399,6 @@ if (is_array($config['extensions'])) {
|
|||
if (strlen($extmenu['fatherId']) > 0) {
|
||||
if (array_key_exists('subfatherId', $extmenu)) {
|
||||
if (strlen($extmenu['subfatherId']) > 0) {
|
||||
if ($extmenu['name'] = 'DB schema check') {
|
||||
}
|
||||
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['text'] = __($extmenu['name']);
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['id'] = $extmenu['name'];
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['refr'] = 0;
|
||||
|
|
|
@ -16,10 +16,10 @@ global $config;
|
|||
// Check user credentials
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'RR')) {
|
||||
if (! check_acl($config['id_user'], 0, 'RR') || enterprise_installed() === false) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Inventory Module Management'
|
||||
'Trying to access Graph container'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
|
|
|
@ -71,10 +71,12 @@ switch ($activeTab) {
|
|||
break;
|
||||
}
|
||||
|
||||
$buttons['graph_container'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">'.html_print_image('images/graph-container.png', true, ['title' => __('Graphs containers')]).'</a>',
|
||||
];
|
||||
if ($enterpriseEnable) {
|
||||
$buttons['graph_container'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">'.html_print_image('images/graph-container.png', true, ['title' => __('Graphs containers')]).'</a>',
|
||||
];
|
||||
}
|
||||
|
||||
$delete_graph = (bool) get_parameter('delete_graph');
|
||||
$view_graph = (bool) get_parameter('view_graph');
|
||||
|
@ -257,11 +259,6 @@ $table_aux = new stdClass();
|
|||
$table->cellspacing = 0;
|
||||
$table->align = [];
|
||||
$table->head = [];
|
||||
if ($report_w || $report_m) {
|
||||
$table->align[5] = 'left';
|
||||
$table->head[5] = html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->size[5] = '20px';
|
||||
}
|
||||
|
||||
$table->head[0] = __('Graph name');
|
||||
$table->head[1] = __('Description');
|
||||
|
@ -280,6 +277,12 @@ $table_aux = new stdClass();
|
|||
$table->size[4] = '90px';
|
||||
}
|
||||
|
||||
if ($report_w || $report_m) {
|
||||
$table->align[5] = 'left';
|
||||
$table->head[5] = html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->size[5] = '20px';
|
||||
}
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$result_graphs = array_slice($graphs, $offset, $config['block_size']);
|
||||
|
@ -287,10 +290,6 @@ $table_aux = new stdClass();
|
|||
foreach ($result_graphs as $graph) {
|
||||
$data = [];
|
||||
|
||||
if ($report_m) {
|
||||
$data[5] .= html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
|
||||
}
|
||||
|
||||
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text(io_safe_output($graph['name']), 70).'</a>';
|
||||
|
||||
$data[1] = ui_print_truncate_text($graph['description'], 70);
|
||||
|
@ -309,6 +308,10 @@ $table_aux = new stdClass();
|
|||
return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).'</a>';
|
||||
}
|
||||
|
||||
if ($report_m) {
|
||||
$data[5] .= html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
|
|
|
@ -233,12 +233,14 @@ switch ($action) {
|
|||
|
||||
$style = json_decode(io_safe_output($item['style']), true);
|
||||
|
||||
$name_from_template = $style['name_label'];
|
||||
|
||||
$show_in_same_row = $style['show_in_same_row'];
|
||||
$show_in_landscape = $style['show_in_landscape'];
|
||||
$hide_notinit_agents = $style['hide_notinit_agents'];
|
||||
$dyn_height = $style['dyn_height'];
|
||||
$type = $item['type'];
|
||||
$name = $item['name'];
|
||||
$name = $style['name_label'];
|
||||
|
||||
switch ($type) {
|
||||
case 'event_report_log':
|
||||
|
@ -480,50 +482,6 @@ switch ($action) {
|
|||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'alert_report_module':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
|
@ -788,10 +746,6 @@ switch ($action) {
|
|||
case 'avg_value':
|
||||
case 'projection_graph':
|
||||
case 'prediction_date':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'simple_baseline_graph':
|
||||
case 'event_report_log':
|
||||
case 'increment':
|
||||
|
@ -869,18 +823,33 @@ $class = 'databox filters';
|
|||
</td>
|
||||
<td style="">
|
||||
<?php
|
||||
html_print_input_text(
|
||||
'name',
|
||||
$name,
|
||||
'',
|
||||
80,
|
||||
100,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'fullwidth'
|
||||
);
|
||||
if ($name_from_template != '') {
|
||||
html_print_input_text(
|
||||
'name',
|
||||
$name_from_template,
|
||||
'',
|
||||
80,
|
||||
100,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'fullwidth'
|
||||
);
|
||||
} else {
|
||||
html_print_input_text(
|
||||
'name',
|
||||
$name,
|
||||
'',
|
||||
80,
|
||||
100,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'fullwidth'
|
||||
);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -3738,10 +3707,6 @@ $(document).ready (function () {
|
|||
case 'event_report_module':
|
||||
case 'simple_graph':
|
||||
case 'simple_baseline_graph':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'prediction_date':
|
||||
case 'projection_graph':
|
||||
case 'avg_value':
|
||||
|
@ -3779,10 +3744,6 @@ $(document).ready (function () {
|
|||
case 'event_report_module':
|
||||
case 'simple_graph':
|
||||
case 'simple_baseline_graph':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'prediction_date':
|
||||
case 'projection_graph':
|
||||
case 'avg_value':
|
||||
|
@ -3816,11 +3777,14 @@ $(document).ready (function () {
|
|||
});
|
||||
|
||||
$("#checkbox-checkbox_show_resume").change(function(){
|
||||
if($(this).is(":checked")){
|
||||
type = $("#type").val();
|
||||
if($(this).is(":checked") && type !== 'general'){
|
||||
$("#row_select_fields2").show();
|
||||
$("#row_select_fields3").show();
|
||||
}
|
||||
else{
|
||||
$("#row_select_fields2").hide();
|
||||
$("#row_select_fields3").hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -4815,38 +4779,6 @@ function chooseType() {
|
|||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'alert_report_module':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
|
@ -5199,10 +5131,6 @@ function chooseType() {
|
|||
case 'min_value':
|
||||
case 'max_value':
|
||||
case 'avg_value':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'simple_baseline_graph':
|
||||
$("#row_label").show();
|
||||
break;
|
||||
|
|
|
@ -1,18 +1,34 @@
|
|||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 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 General Public License
|
||||
// as published by the Free Software Foundation for 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.
|
||||
/**
|
||||
* Report item list.
|
||||
*
|
||||
* @category Reporting
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 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 General Public License
|
||||
* as published by the Free Software Foundation for 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;
|
||||
|
||||
// Login check
|
||||
// Login check.
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'RW')) {
|
||||
|
@ -39,12 +55,16 @@ switch ($config['dbtype']) {
|
|||
'type'
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
$report_w = check_acl($config['id_user'], 0, 'RW');
|
||||
$report_m = check_acl($config['id_user'], 0, 'RM');
|
||||
|
||||
if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
||||
if (is_metaconsole()) {
|
||||
$agents = [];
|
||||
$agents = metaconsole_get_report_agents($idReport);
|
||||
$modules = [];
|
||||
|
@ -52,7 +72,7 @@ if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
|||
$types = [];
|
||||
$types = metaconsole_get_report_types($idReport);
|
||||
} else {
|
||||
// FORM FILTER
|
||||
// FORM FILTER.
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
|
@ -87,7 +107,10 @@ if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
|||
ON (t4.id_agent = t5.id_agente OR t4.id_agente = t5.id_agente)
|
||||
WHERE t4.id_report = '.$idReport
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -124,6 +147,10 @@ if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
|||
WHERE t1.id_report = '.$idReport
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
if ($rows === false) {
|
||||
|
@ -135,8 +162,8 @@ if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
|||
$modules[$row['id_agent_module']] = $row['nombre'];
|
||||
}
|
||||
|
||||
// Filter report items created from metaconsole in normal console list and the opposite
|
||||
if (defined('METACONSOLE') and $config['metaconsole'] == 1) {
|
||||
// Filter report items created from metaconsole in normal console list and the opposite.
|
||||
if (is_metaconsole()) {
|
||||
$where_types = ' AND ((server_name IS NOT NULL AND length(server_name) != 0) OR '.$type_escaped.' IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
|
||||
} else {
|
||||
$where_types = ' AND ((server_name IS NULL OR length(server_name) = 0) OR '.$type_escaped.' IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
|
||||
|
@ -184,7 +211,6 @@ if (!defined('METACONSOLE')) {
|
|||
$table->data[0][1] .= html_print_select($modules, 'module_filter', $moduleFilter, '', __('All'), 0, true);
|
||||
$table->data[0][2] = __('Type');
|
||||
$table->data[0][2] .= html_print_select($types, 'type_filter', $typeFilter, '', __('All'), 0, true);
|
||||
// $table->data[1][2] = $table->data[1][3] = '';
|
||||
$form = '<form method="post" action ="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=filter&id_report='.$idReport.'">';
|
||||
$form .= html_print_table($table, true);
|
||||
$form .= '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
@ -265,13 +291,6 @@ if ($moduleFilter != 0) {
|
|||
$where .= ' AND id_agent_module = '.$moduleFilter;
|
||||
}
|
||||
|
||||
// Filter report items created from metaconsole in normal console list and the opposite
|
||||
if (defined('METACONSOLE') and $config['metaconsole'] == 1) {
|
||||
$where .= ' AND ((server_name IS NOT NULL AND length(server_name) != 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'availability_graph\', \'top_n\',\'SLA_monthly\',\'SLA_weekly\',\'SLA_hourly\',\'text\'))';
|
||||
} else {
|
||||
$where .= ' AND ((server_name IS NULL OR length(server_name) = 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'top_n\'))';
|
||||
}
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$items = db_get_all_rows_sql(
|
||||
|
@ -306,13 +325,17 @@ switch ($config['dbtype']) {
|
|||
'AND',
|
||||
false
|
||||
);
|
||||
// Delete rnum row generated by oracle_recode_query() function
|
||||
// Delete rnum row generated by oracle_recode_query() function.
|
||||
if ($items !== false) {
|
||||
for ($i = 0; $i < count($items); $i++) {
|
||||
unset($items[$i]['rnum']);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
$countItems = db_get_sql(
|
||||
|
@ -421,29 +444,30 @@ foreach ($items as $item) {
|
|||
|
||||
$row[1] = get_report_name($item['type']);
|
||||
|
||||
if ($item['type'] == 'custom_graph') {
|
||||
$custom_graph_name = db_get_row_sql('select name from tgraph where id_graph = '.$item['id_gs']);
|
||||
$row[1] = get_report_name($item['type']).' ('.$custom_graph_name['name'].')';
|
||||
}
|
||||
|
||||
$server_name = $item['server_name'];
|
||||
|
||||
if (($config['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) {
|
||||
if (is_metaconsole()) {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
||||
// ui_print_error_message ("Error connecting to ".$server_name);
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['type'] == 'custom_graph') {
|
||||
$custom_graph_name = db_get_row_sql('SELECT name FROM tgraph WHERE id_graph = '.$item['id_gs']);
|
||||
$row[1] = get_report_name($item['type']).' ('.$custom_graph_name['name'].')';
|
||||
}
|
||||
|
||||
|
||||
if ($item['id_agent'] == 0) {
|
||||
$is_inventory_item = $item['type'] == 'inventory' || $item['type'] == 'inventory_changes';
|
||||
|
||||
// Due to SLA or top N or general report items
|
||||
// Due to SLA or top N or general report items.
|
||||
if (!$is_inventory_item && ($item['id_agent_module'] == '' || $item['id_agent_module'] == 0)) {
|
||||
$row[2] = '';
|
||||
$row[3] = '';
|
||||
} else {
|
||||
// The inventory items have the agents and modules in json format in the field external_source
|
||||
// The inventory items have the agents and modules in json format in the field external_source.
|
||||
if ($is_inventory_item) {
|
||||
$external_source = json_decode($item['external_source'], true);
|
||||
$agents = $external_source['id_agents'];
|
||||
|
@ -489,11 +513,18 @@ foreach ($items as $item) {
|
|||
$row[4] = '-';
|
||||
}
|
||||
|
||||
if ($item['name'] == '' && $item['description'] == '') {
|
||||
$row[5] = '-';
|
||||
} else {
|
||||
$text = empty($item['name']) ? $item['description'] : $item['name'];
|
||||
$style = json_decode(io_safe_output($item['style']), true);
|
||||
|
||||
if ($style['name_label'] != '') {
|
||||
$text = empty($style['name_label']) ? $item['description'] : $style['name_label'];
|
||||
$row[5] = ui_print_truncate_text($text, 'description', true, true);
|
||||
} else {
|
||||
if ($item['name'] == '' && $item['description'] == '') {
|
||||
$row[5] = '-';
|
||||
} else {
|
||||
$text = empty($item['name']) ? $item['description'] : $item['name'];
|
||||
$row[5] = ui_print_truncate_text($text, 'description', true, true);
|
||||
}
|
||||
}
|
||||
|
||||
$row[6] = '';
|
||||
|
@ -515,7 +546,7 @@ foreach ($items as $item) {
|
|||
|
||||
$table->data[] = $row;
|
||||
$count++;
|
||||
// Restore db connection
|
||||
// Restore db connection.
|
||||
if (($config['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
|
|
@ -2006,10 +2006,6 @@ switch ($action) {
|
|||
case 'avg_value':
|
||||
case 'projection_graph':
|
||||
case 'prediction_date':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'simple_baseline_graph':
|
||||
case 'nt_top_n':
|
||||
if ($label != '') {
|
||||
|
@ -2612,10 +2608,6 @@ switch ($action) {
|
|||
case 'avg_value':
|
||||
case 'projection_graph':
|
||||
case 'prediction_date':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'simple_baseline_graph':
|
||||
case 'nt_top_n':
|
||||
if ($label != '') {
|
||||
|
@ -3142,17 +3134,19 @@ if ($enterpriseEnable && defined('METACONSOLE')) {
|
|||
break;
|
||||
}
|
||||
|
||||
ui_print_page_header(
|
||||
$textReportName,
|
||||
'images/op_reporting.png',
|
||||
false,
|
||||
$helpers,
|
||||
false,
|
||||
$buttons,
|
||||
false,
|
||||
'',
|
||||
60
|
||||
);
|
||||
if ($action !== 'update' && !is_metaconsole()) {
|
||||
ui_print_page_header(
|
||||
$textReportName,
|
||||
'images/op_reporting.png',
|
||||
false,
|
||||
$helpers,
|
||||
false,
|
||||
$buttons,
|
||||
false,
|
||||
'',
|
||||
60
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($resultOperationDB !== null) {
|
||||
|
@ -3174,6 +3168,26 @@ if ($resultOperationDB !== null) {
|
|||
__('Successfull action'),
|
||||
__('Unsuccessful action<br><br>'.$err)
|
||||
);
|
||||
|
||||
if ($action == 'update') {
|
||||
$buttons[$activeTab]['active'] = false;
|
||||
$activeTab = 'list_items';
|
||||
$buttons[$activeTab]['active'] = true;
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
ui_print_page_header(
|
||||
$textReportName,
|
||||
'images/op_reporting.png',
|
||||
false,
|
||||
$helpers,
|
||||
false,
|
||||
$buttons,
|
||||
false,
|
||||
'',
|
||||
60
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ($activeTab) {
|
||||
|
|
|
@ -4,7 +4,14 @@ global $config;
|
|||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
if (! check_acl($config['id_user'], 0, 'AR')
|
||||
&& ! check_acl($config['id_user'], 0, 'AW')
|
||||
&& ! check_acl($config['id_user'], 0, 'AM')
|
||||
&& ! check_acl($config['id_user'], 0, 'RR')
|
||||
&& ! check_acl($config['id_user'], 0, 'RW')
|
||||
&& ! check_acl($config['id_user'], 0, 'RM')
|
||||
&& ! check_acl($config['id_user'], 0, 'PM')
|
||||
) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Server Management'
|
||||
|
@ -134,11 +141,18 @@ if ($classname_selected === null) {
|
|||
$classname = basename($classpath, '.class.php');
|
||||
$obj = new $classname();
|
||||
|
||||
$button = $obj->load();
|
||||
|
||||
if ($button === false) {
|
||||
// No acess, skip.
|
||||
continue;
|
||||
}
|
||||
|
||||
// DiscoveryTaskList must be first button.
|
||||
if ($classname == 'DiscoveryTaskList') {
|
||||
array_unshift($wiz_data, $obj->load());
|
||||
array_unshift($wiz_data, $button);
|
||||
} else {
|
||||
$wiz_data[] = $obj->load();
|
||||
$wiz_data[] = $button;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -928,10 +928,10 @@ if (($create != '') || ($view != '')) {
|
|||
$other['plugin_type'] = $plugin_meta['plugin_type'];
|
||||
$other['macros'] = urlencode($plugin_meta['macros']);
|
||||
$other['parameters'] = urlencode($plugin_meta['parameters']);
|
||||
$other = implode('%7C', $other);
|
||||
$other = implode('%7E', $other);
|
||||
|
||||
$auth_token = json_decode($value['auth_token']);
|
||||
$url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7C&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password";
|
||||
$url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7E&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password";
|
||||
$file_path = realpath($plugin_meta['execute']);
|
||||
$post = '';
|
||||
if (file_exists($file_path)) {
|
||||
|
|
|
@ -18,7 +18,7 @@ check_login();
|
|||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'UM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Profile Management'
|
||||
|
@ -320,24 +320,29 @@ if ($id_profile || $new_profile) {
|
|||
$table->data['IM'] = $row;
|
||||
$table->data[] = '<hr>';
|
||||
|
||||
$disable_option = 'javascript: return false;';
|
||||
if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) {
|
||||
$disable_option = '';
|
||||
}
|
||||
|
||||
// Users
|
||||
$row = [];
|
||||
$row['name'] = __('Manage users');
|
||||
$row['input'] = html_print_checkbox('user_management', 1, $user_management, true);
|
||||
$row['input'] = html_print_checkbox('user_management', 1, $user_management, true, false, $disable_option);
|
||||
$table->data['UM'] = $row;
|
||||
$table->data[] = '<hr>';
|
||||
|
||||
// DB
|
||||
$row = [];
|
||||
$row['name'] = __('Manage database');
|
||||
$row['input'] = html_print_checkbox('db_management', 1, $db_management, true);
|
||||
$row['input'] = html_print_checkbox('db_management', 1, $db_management, true, false, $disable_option);
|
||||
$table->data['DM'] = $row;
|
||||
$table->data[] = '<hr>';
|
||||
|
||||
// Pandora
|
||||
$row = [];
|
||||
$row['name'] = __('%s management', get_product_name());
|
||||
$row['input'] = html_print_checkbox('pandora_management', 1, $pandora_management, true);
|
||||
$row['input'] = html_print_checkbox('pandora_management', 1, $pandora_management, true, false, $disable_option);
|
||||
$table->data['PM'] = $row;
|
||||
$table->data[] = '<hr>';
|
||||
|
||||
|
@ -359,3 +364,18 @@ if ($id_profile || $new_profile) {
|
|||
}
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
$(document).ready (function () {
|
||||
var disable_option = '<?php echo $disable_option; ?>';
|
||||
|
||||
if (disable_option != '') {
|
||||
var ids = ['#checkbox-db_management', '#checkbox-user_management', '#checkbox-pandora_management'];
|
||||
ids.forEach(id => {
|
||||
$(id).css({'cursor':'not-allowed', 'opacity':'0.5'});
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -828,7 +828,7 @@ $values = [
|
|||
0 => __('No'),
|
||||
];
|
||||
|
||||
$table->data[12][0] = __('Home screen').ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type sec=estado&sec2=operation/agentes/estado_agente to show agent detail view'), true);
|
||||
$table->data[12][0] = __('Home screen').ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 to show agent detail view'), true);
|
||||
$values = [
|
||||
'Default' => __('Default'),
|
||||
'Visual console' => __('Visual console'),
|
||||
|
|
|
@ -362,7 +362,10 @@ foreach ($profiles as $profile) {
|
|||
$data['PM'] = ($profile['pandora_management'] ? $img : '');
|
||||
$table->cellclass[]['operations'] = 'action_buttons';
|
||||
$data['operations'] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a>';
|
||||
$data['operations'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/users/profile_list&delete_profile=1&id='.$profile['id_perfil'].'&pure='.$pure.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true).'</a>';
|
||||
if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) {
|
||||
$data['operations'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/users/profile_list&delete_profile=1&id='.$profile['id_perfil'].'&pure='.$pure.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true).'</a>';
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
|
|
|
@ -418,9 +418,11 @@ if ($own_info['is_admin']) {
|
|||
else {
|
||||
foreach ($info1 as $key => $usr) {
|
||||
$u = get_user_info($key);
|
||||
$g = users_get_groups($key, 'AR', $u['is_admin']);
|
||||
$g = users_get_groups($key, false, $u['is_admin']);
|
||||
$result = array_intersect($g, $own_groups);
|
||||
if (!$usr['is_admin'] && !empty($result)) {
|
||||
|
||||
// Show users without profile too.
|
||||
if (!$usr['is_admin'] && !empty($result) || (!$usr['is_admin'] && db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $usr['id_user']) === false)) {
|
||||
$info[$key] = $usr;
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ class DiscoveryTaskList extends Wizard
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access recon task viewer'
|
||||
|
@ -241,7 +241,7 @@ class DiscoveryTaskList extends Wizard
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (!$this->aclMulticheck('RR|RW|RM|PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access recon task viewer'
|
||||
|
@ -270,7 +270,7 @@ class DiscoveryTaskList extends Wizard
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'RM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access recon task viewer'
|
||||
|
@ -313,13 +313,9 @@ class DiscoveryTaskList extends Wizard
|
|||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access recon task viewer'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return false;
|
||||
if (!$this->aclMulticheck('AR|AW|AM')) {
|
||||
// Tasklist are allowed only of agent managers.
|
||||
return '';
|
||||
}
|
||||
|
||||
// Get all discovery servers.
|
||||
|
@ -341,7 +337,7 @@ class DiscoveryTaskList extends Wizard
|
|||
// --------------------------------
|
||||
// FORCE A RECON TASK
|
||||
// --------------------------------
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
if (isset($_GET['force'])) {
|
||||
$id = (int) get_parameter_get('force', 0);
|
||||
servers_force_recon_task($id);
|
||||
|
@ -387,8 +383,10 @@ class DiscoveryTaskList extends Wizard
|
|||
// Operations.
|
||||
$table->headstyle[9] .= 'min-width: 150px; width: 150px;';
|
||||
|
||||
$table->head[0] = __('Force');
|
||||
$table->align[0] = 'left';
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
$table->head[0] = __('Force');
|
||||
$table->align[0] = 'left';
|
||||
}
|
||||
|
||||
$table->head[1] = __('Task name');
|
||||
$table->align[1] = 'left';
|
||||
|
@ -455,11 +453,13 @@ class DiscoveryTaskList extends Wizard
|
|||
}
|
||||
|
||||
if ($task['disabled'] == 0 && $server_name !== '') {
|
||||
$data[0] = '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_server.'&force='.$task['id_rt']
|
||||
).'">';
|
||||
$data[0] .= html_print_image('images/target.png', true, ['title' => __('Force')]);
|
||||
$data[0] .= '</a>';
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
$data[0] = '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_server.'&force='.$task['id_rt']
|
||||
).'">';
|
||||
$data[0] .= html_print_image('images/target.png', true, ['title' => __('Force')]);
|
||||
$data[0] .= '</a>';
|
||||
}
|
||||
} else if ($task['disabled'] == 2) {
|
||||
$data[0] = ui_print_help_tip(
|
||||
__('This task has not been completely defined, please edit it'),
|
||||
|
@ -622,18 +622,20 @@ class DiscoveryTaskList extends Wizard
|
|||
&& $task['type'] != DISCOVERY_APP_ORACLE
|
||||
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS
|
||||
) {
|
||||
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||
$data[9] .= html_print_image(
|
||||
'images/dynamic_network_icon.png',
|
||||
true
|
||||
);
|
||||
$data[9] .= '</a>';
|
||||
if (check_acl($config['id_user'], 0, 'MR')) {
|
||||
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||
$data[9] .= html_print_image(
|
||||
'images/dynamic_network_icon.png',
|
||||
true
|
||||
);
|
||||
$data[9] .= '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if (check_acl(
|
||||
$config['id_user'],
|
||||
$task['id_group'],
|
||||
'PM'
|
||||
'AW'
|
||||
)
|
||||
) {
|
||||
if ($ipam === true) {
|
||||
|
@ -733,6 +735,16 @@ class DiscoveryTaskList extends Wizard
|
|||
{
|
||||
if ($script !== false) {
|
||||
switch ($script['type']) {
|
||||
case DISCOVERY_SCRIPT_APP_VMWARE:
|
||||
return 'wiz=app&mode=vmware&page=0';
|
||||
|
||||
case DISCOVERY_SCRIPT_IPAM_RECON:
|
||||
return '';
|
||||
|
||||
case DISCOVERY_SCRIPT_IPMI_RECON:
|
||||
default:
|
||||
return 'wiz=hd&mode=customnetscan';
|
||||
|
||||
case DISCOVERY_SCRIPT_CLOUD_AWS:
|
||||
switch ($task['type']) {
|
||||
case DISCOVERY_CLOUD_AWS_EC2:
|
||||
|
@ -744,16 +756,6 @@ class DiscoveryTaskList extends Wizard
|
|||
default:
|
||||
return 'wiz=cloud';
|
||||
}
|
||||
|
||||
case DISCOVERY_SCRIPT_APP_VMWARE:
|
||||
return 'wiz=app&mode=vmware&page=0';
|
||||
|
||||
case DISCOVERY_SCRIPT_IPAM_RECON:
|
||||
return '';
|
||||
|
||||
case DISCOVERY_SCRIPT_IPMI_RECON:
|
||||
default:
|
||||
return 'wiz=hd&mode=customnetscan';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ class HostDevices extends Wizard
|
|||
) {
|
||||
$this->setBreadcrum([]);
|
||||
|
||||
$this->access = 'AW';
|
||||
$this->task = [];
|
||||
$this->msg = $msg;
|
||||
$this->icon = $icon;
|
||||
|
@ -100,6 +101,32 @@ class HostDevices extends Wizard
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if environment is ready,
|
||||
* returns array
|
||||
* icon: icon to be displayed
|
||||
* label: label to be displayed
|
||||
*
|
||||
* @return array With data.
|
||||
**/
|
||||
public function load()
|
||||
{
|
||||
global $config;
|
||||
// Check access.
|
||||
check_login();
|
||||
|
||||
if (! $this->aclMulticheck('AW|PM')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return [
|
||||
'icon' => $this->icon,
|
||||
'label' => $this->label,
|
||||
'url' => $this->url,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run wizard manager.
|
||||
*
|
||||
|
@ -116,37 +143,42 @@ class HostDevices extends Wizard
|
|||
|
||||
if ($mode === null) {
|
||||
$buttons = [];
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=netscan',
|
||||
'icon' => 'images/wizard/netscan.png',
|
||||
'label' => __('Net Scan'),
|
||||
];
|
||||
|
||||
if (enterprise_installed()) {
|
||||
if (check_acl($config['id_user'], 0, $this->access)) {
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=importcsv',
|
||||
'icon' => ENTERPRISE_DIR.'/images/wizard/csv.png',
|
||||
'label' => __('Import CSV'),
|
||||
'url' => $this->url.'&mode=netscan',
|
||||
'icon' => 'images/wizard/netscan.png',
|
||||
'label' => __('Net Scan'),
|
||||
];
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=importcsv',
|
||||
'icon' => ENTERPRISE_DIR.'/images/wizard/csv.png',
|
||||
'label' => __('Import CSV'),
|
||||
];
|
||||
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=deploy',
|
||||
'icon' => ENTERPRISE_DIR.'/images/wizard/deployment.png',
|
||||
'label' => __('Agent deployment'),
|
||||
];
|
||||
}
|
||||
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=deploy',
|
||||
'icon' => ENTERPRISE_DIR.'/images/wizard/deployment.png',
|
||||
'label' => __('Agent deployment'),
|
||||
'url' => $this->url.'&mode=customnetscan',
|
||||
'icon' => '/images/wizard/customnetscan.png',
|
||||
'label' => __('Custom NetScan'),
|
||||
];
|
||||
}
|
||||
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=customnetscan',
|
||||
'icon' => '/images/wizard/customnetscan.png',
|
||||
'label' => __('Custom NetScan'),
|
||||
];
|
||||
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=managenetscanscripts',
|
||||
'icon' => '/images/wizard/managenetscanscripts.png',
|
||||
'label' => __('Manage NetScan scripts'),
|
||||
];
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=managenetscanscripts',
|
||||
'icon' => '/images/wizard/managenetscanscripts.png',
|
||||
'label' => __('Manage NetScan scripts'),
|
||||
];
|
||||
}
|
||||
|
||||
$this->prepareBreadcrum(
|
||||
[
|
||||
|
@ -311,11 +343,11 @@ class HostDevices extends Wizard
|
|||
) {
|
||||
// Default values, no data received.
|
||||
// User is accesing directly to this page.
|
||||
if (users_is_admin() !== true && check_acl(
|
||||
if (check_acl(
|
||||
$config['id_usuario'],
|
||||
$this->task['id_group'],
|
||||
'PM'
|
||||
) !== true
|
||||
$this->access
|
||||
) != true
|
||||
) {
|
||||
$this->msg = __('You have no access to edit this task.');
|
||||
return false;
|
||||
|
@ -487,7 +519,7 @@ class HostDevices extends Wizard
|
|||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, $this->access)) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Agent Management'
|
||||
|
@ -529,11 +561,11 @@ class HostDevices extends Wizard
|
|||
|
||||
// Check ACL. If user is not able to manage target task,
|
||||
// redirect him to main page.
|
||||
if (users_is_admin() !== true && check_acl(
|
||||
if (check_acl(
|
||||
$config['id_usuario'],
|
||||
$this->task['id_group'],
|
||||
'PM'
|
||||
) !== true
|
||||
$this->access
|
||||
) != true
|
||||
) {
|
||||
$form['form']['action'] = $this->url.'&mode=netscan&page='.($this->page - 1);
|
||||
}
|
||||
|
@ -750,7 +782,7 @@ class HostDevices extends Wizard
|
|||
[
|
||||
'name' => 'id_group',
|
||||
'returnAllGroup' => false,
|
||||
'privilege' => 'PM',
|
||||
'privilege' => $this->access,
|
||||
'type' => 'select_groups',
|
||||
'selected' => $this->task['id_group'],
|
||||
'return' => true,
|
||||
|
|
|
@ -87,6 +87,13 @@ class Wizard
|
|||
*/
|
||||
public $msg;
|
||||
|
||||
/**
|
||||
* Defines access level to use this util.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $access = 'AR';
|
||||
|
||||
|
||||
/**
|
||||
* Setter for breadcrum
|
||||
|
@ -234,6 +241,42 @@ class Wizard
|
|||
public function run()
|
||||
{
|
||||
ui_require_css_file('wizard');
|
||||
// Check access.
|
||||
check_login();
|
||||
|
||||
if (! $this->aclMulticheck()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check multiple acl perms.
|
||||
*
|
||||
* @param string $access Access in PM|AR|RR format. Optional.
|
||||
*
|
||||
* @return boolean Alowed or not.
|
||||
*/
|
||||
public function aclMulticheck($access=null)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($access)) {
|
||||
$perms = explode('|', $access);
|
||||
} else {
|
||||
$perms = explode('|', $this->access);
|
||||
}
|
||||
|
||||
$allowed = false;
|
||||
foreach ($perms as $perm) {
|
||||
$allowed = $allowed || (bool) check_acl(
|
||||
$config['id_user'],
|
||||
0,
|
||||
$perm
|
||||
);
|
||||
}
|
||||
|
||||
return $allowed;
|
||||
}
|
||||
|
||||
|
||||
|
@ -247,6 +290,14 @@ class Wizard
|
|||
**/
|
||||
public function load()
|
||||
{
|
||||
global $config;
|
||||
// Check access.
|
||||
check_login();
|
||||
|
||||
if (! $this->aclMulticheck()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return [
|
||||
'icon' => $this->icon,
|
||||
'label' => $this->label,
|
||||
|
|
|
@ -1113,7 +1113,7 @@ if (check_login()) {
|
|||
}
|
||||
|
||||
if ($module['id_tipo_modulo'] != 25) {
|
||||
$data[6] = ui_print_module_warn_value($module['max_warning'], $module['min_warning'], $module['str_warning'], $module['max_critical'], $module['min_critical'], $module['str_critical']);
|
||||
$data[6] = ui_print_module_warn_value($module['max_warning'], $module['min_warning'], $module['str_warning'], $module['max_critical'], $module['min_critical'], $module['str_critical'], $module['warning_inverse'], $module['critical_inverse']);
|
||||
} else {
|
||||
$data[6] = '';
|
||||
}
|
||||
|
|
|
@ -1,15 +1,32 @@
|
|||
<?php
|
||||
// Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 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.
|
||||
/**
|
||||
* Pandora FMS integration API.
|
||||
*
|
||||
* @category API
|
||||
* @package Pandora FMS
|
||||
* @subpackage Console
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 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 General Public License
|
||||
* as published by the Free Software Foundation for 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
require_once 'config.php';
|
||||
require_once 'functions_api.php';
|
||||
|
||||
|
@ -18,7 +35,7 @@ global $config;
|
|||
define('DEBUG', 0);
|
||||
define('VERBOSE', 0);
|
||||
|
||||
// TESTING THE UPDATE MANAGER
|
||||
// TESTING THE UPDATE MANAGER.
|
||||
enterprise_include_once('include/functions_enterprise_api.php');
|
||||
|
||||
$ipOrigin = $_SERVER['REMOTE_ADDR'];
|
||||
|
@ -41,26 +58,30 @@ $info = get_parameter('info', '');
|
|||
$other = parseOtherParameter($otherSerialize, $otherMode);
|
||||
|
||||
$other = parseOtherParameter($otherSerialize, $otherMode);
|
||||
$apiPassword = io_output_password(db_get_value_filter('value', 'tconfig', ['token' => 'api_password']));
|
||||
$apiPassword = io_output_password(
|
||||
db_get_value_filter(
|
||||
'value',
|
||||
'tconfig',
|
||||
['token' => 'api_password']
|
||||
)
|
||||
);
|
||||
|
||||
$correctLogin = false;
|
||||
$no_login_msg = '';
|
||||
|
||||
// Clean unwanted output
|
||||
// Clean unwanted output.
|
||||
ob_clean();
|
||||
|
||||
// READ THIS:
|
||||
// Special call without checks to retrieve version and build of the Pandora FMS
|
||||
// This info is avalable from the web console without login
|
||||
// Don't change the format, it is parsed by applications
|
||||
switch ($info) {
|
||||
case 'version':
|
||||
if (!$config['MR']) {
|
||||
$config['MR'] = 0;
|
||||
}
|
||||
|
||||
echo 'Pandora FMS '.$pandora_version.' - '.$build_version.' MR'.$config['MR'];
|
||||
// Don't change the format, it is parsed by applications.
|
||||
if ($info == 'version') {
|
||||
if (!$config['MR']) {
|
||||
$config['MR'] = 0;
|
||||
}
|
||||
|
||||
echo 'Pandora FMS '.$pandora_version.' - '.$build_version.' MR'.$config['MR'];
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -68,14 +89,19 @@ if (isInACL($ipOrigin)) {
|
|||
if (empty($apiPassword) || (!empty($apiPassword) && $api_password === $apiPassword)) {
|
||||
$user_in_db = process_user_login($user, $password, true);
|
||||
if ($user_in_db !== false) {
|
||||
$config['id_usuario'] = $user_in_db;
|
||||
// Compat.
|
||||
$config['id_user'] = $user_in_db;
|
||||
$correctLogin = true;
|
||||
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
$_SESSION = [];
|
||||
}
|
||||
|
||||
$_SESSION['id_usuario'] = $user;
|
||||
|
||||
config_prepare_session();
|
||||
session_write_close();
|
||||
} else {
|
||||
$no_login_msg = 'Incorrect user credentials';
|
||||
|
@ -84,7 +110,7 @@ if (isInACL($ipOrigin)) {
|
|||
$no_login_msg = 'Incorrect given API password';
|
||||
}
|
||||
} else {
|
||||
$no_login_msg = "IP $ipOrigin is not in ACL list";
|
||||
$no_login_msg = 'IP '.$ipOrigin.' is not in ACL list';
|
||||
}
|
||||
|
||||
if ($correctLogin) {
|
||||
|
@ -93,11 +119,14 @@ if ($correctLogin) {
|
|||
} else {
|
||||
$function_name = '';
|
||||
|
||||
// Check if is an extension function and get the function name
|
||||
// Check if is an extension function and get the function name.
|
||||
if ($op2 == 'extension') {
|
||||
$extension_api_url = $config['homedir'].'/'.EXTENSIONS_DIR."/$ext_name/$ext_name.api.php";
|
||||
// The extension API file must exist and the extension must be enabled
|
||||
if (file_exists($extension_api_url) && !in_array($ext_name, extensions_get_disabled_extensions())) {
|
||||
$extension_api_url = $config['homedir'].'/'.EXTENSIONS_DIR.'/'.$ext_name.'/'.$ext_name.'.api.php';
|
||||
// The extension API file must exist and the extension must be
|
||||
// enabled.
|
||||
if (file_exists($extension_api_url)
|
||||
&& !in_array($ext_name, extensions_get_disabled_extensions())
|
||||
) {
|
||||
include_once $extension_api_url;
|
||||
$function_name = 'apiextension_'.$op.'_'.$ext_function;
|
||||
}
|
||||
|
@ -107,16 +136,19 @@ if ($correctLogin) {
|
|||
if ($op == 'set' && $id) {
|
||||
switch ($op2) {
|
||||
case 'update_agent':
|
||||
|
||||
case 'add_module_in_conf':
|
||||
case 'update_module_in_conf':
|
||||
case 'delete_module_in_conf':
|
||||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where id_agente = '.$id);
|
||||
|
||||
if ($id_os == 100) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
$agent = agents_locate_agent($id);
|
||||
if ($agent !== false) {
|
||||
$id_os = $agent['id_os'];
|
||||
if ($id_os == 100) {
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -127,12 +159,16 @@ if ($correctLogin) {
|
|||
case 'create_snmp_module':
|
||||
case 'delete_module':
|
||||
case 'delete_agent':
|
||||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where nombre = "'.$id.'"');
|
||||
|
||||
if ($id_os == 100) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
$agent = agents_locate_agent($id);
|
||||
if ($agent !== false) {
|
||||
$id_os = $agent['id_os'];
|
||||
if ($id_os == 100) {
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -141,60 +177,98 @@ if ($correctLogin) {
|
|||
case 'update_data_module':
|
||||
case 'update_snmp_module':
|
||||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where id_agente = (select id_agente from tagente_modulo where id_agente_modulo ='.$id.')');
|
||||
$id_os = db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT id_os
|
||||
FROM tagente
|
||||
WHERE id_agente = (
|
||||
SELECT id_agente
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente_modulo = %d
|
||||
)',
|
||||
$id
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
if ($id_os == 100) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete_user_permission':
|
||||
|
||||
if ($user_db === '') {
|
||||
returnError(__('User or group not specified'), __('User, group not specified'));
|
||||
returnError(
|
||||
__('User or group not specified'),
|
||||
__('User, group not specified')
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$id_os = api_set_delete_user_profiles($thrash1, $thrash2, $other, $returnType);
|
||||
$id_os = api_set_delete_user_profiles(
|
||||
$thrash1,
|
||||
$thrash2,
|
||||
$other,
|
||||
$returnType
|
||||
);
|
||||
|
||||
if ($id_os != 100) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id_os == false) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add_permission_user_to_group':
|
||||
|
||||
if ($user_db == null || $group_db == null || $id_up == null) {
|
||||
returnError(__('User, group or profile not specified'), __('User, group or profile status not specified'));
|
||||
if ($user_db == null
|
||||
|| $group_db == null
|
||||
|| $id_up == null
|
||||
) {
|
||||
returnError(
|
||||
__('User, group or profile not specified'),
|
||||
__('User, group or profile status not specified')
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$id_os = api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $returnType);
|
||||
$id_os = api_set_add_permission_user_to_group(
|
||||
$thrash1,
|
||||
$thrash2,
|
||||
$other,
|
||||
$returnType
|
||||
);
|
||||
|
||||
if ($id_os != 100) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id_os == false) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
// break;
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the function exists
|
||||
// Check if the function exists.
|
||||
if (function_exists($function_name)) {
|
||||
if (!DEBUG) {
|
||||
error_reporting(0);
|
||||
|
@ -205,18 +279,37 @@ if ($correctLogin) {
|
|||
ini_set('display_errors', 1);
|
||||
}
|
||||
|
||||
call_user_func($function_name, $id, $id2, $other, $returnType, $user_in_db);
|
||||
call_user_func(
|
||||
$function_name,
|
||||
$id,
|
||||
$id2,
|
||||
$other,
|
||||
$returnType,
|
||||
$user_in_db
|
||||
);
|
||||
} else {
|
||||
returnError('no_exist_operation', $returnType);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// TODO: Implement a new switch in config to enable / disable
|
||||
// ACL auth failure: if enabled and have lots of traffic can produce millions
|
||||
// of records and a considerable OVERHEAD in the system :(
|
||||
// db_pandora_audit("API access Failed", $no_login_msg, $user, $ipOrigin);
|
||||
/*
|
||||
* //TODO: Implement a new switch in config to enable / disable
|
||||
* ACL auth failure: if enabled and have lots of traffic can produce
|
||||
* millions of records and a considerable OVERHEAD in the system :(
|
||||
* db_pandora_audit("API access Failed", $no_login_msg, $user, $ipOrigin);
|
||||
*/
|
||||
|
||||
sleep(15);
|
||||
|
||||
// Protection on DoS attacks
|
||||
// Protection on DoS attacks.
|
||||
echo 'auth error';
|
||||
}
|
||||
|
||||
// Logout.
|
||||
if (session_status() === PHP_SESSION_ACTIVE) {
|
||||
$_SESSION = [];
|
||||
// Could give a warning if no session file is created. Ignore.
|
||||
@session_destroy();
|
||||
header_remove('Set-Cookie');
|
||||
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
||||
}
|
||||
|
|
|
@ -1,22 +1,39 @@
|
|||
<?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 General Public License
|
||||
// as published by the Free Software Foundation for 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 & session manageme
|
||||
session_id($_REQUEST['session_id']);
|
||||
/**
|
||||
* Generate charts with given parameters.
|
||||
*
|
||||
* @category ChartGenerator.
|
||||
* @package Pandora FMS
|
||||
* @subpackage Opensource.
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 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 General Public License
|
||||
* as published by the Free Software Foundation for 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
require_once 'config.php';
|
||||
require_once $config['homedir'].'/include/auth/mysql.php';
|
||||
require_once $config['homedir'].'/include/functions.php';
|
||||
require_once $config['homedir'].'/include/functions_db.php';
|
||||
|
||||
require_once __DIR__.'/config.php';
|
||||
require_once __DIR__.'/functions.php';
|
||||
require_once __DIR__.'/functions_db.php';
|
||||
require_once __DIR__.'/auth/mysql.php';
|
||||
require_once $config['homedir'].'/include/lib/User.php';
|
||||
require_once $config['homedir'].'/include/functions_reporting.php';
|
||||
require_once $config['homedir'].'/include/functions_graph.php';
|
||||
require_once $config['homedir'].'/include/functions_custom_graphs.php';
|
||||
|
@ -24,32 +41,91 @@ require_once $config['homedir'].'/include/functions_modules.php';
|
|||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_tags.php';
|
||||
|
||||
check_login();
|
||||
|
||||
/**
|
||||
* Echo to stdout a PhantomJS callback call.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function echoPhantomCallback()
|
||||
{
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('document').ready(function () {
|
||||
setTimeout(function () {
|
||||
try {
|
||||
var status = window.callPhantom({ status: "loaded" });
|
||||
} catch (error) {
|
||||
console.log("CALLBACK ERROR", error.message)
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
// Initialize session.
|
||||
global $config;
|
||||
// get_parameter(array)('data', '');
|
||||
|
||||
// Try to initialize session using existing php session id.
|
||||
$user = new PandoraFMS\User(['phpsessionid' => $_REQUEST['session_id']]);
|
||||
if (check_login(false) === false) {
|
||||
// Error handler.
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Access denied</title>
|
||||
<link rel="stylesheet" href="styles/pandora.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" />
|
||||
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/jquery-3.3.1.min.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Access is not granted</h1>
|
||||
<?php echoPhantomCallback(); ?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
|
||||
// Access granted.
|
||||
$params = json_decode($_REQUEST['data'], true);
|
||||
|
||||
// Metaconsole connection to the node
|
||||
// Metaconsole connection to the node.
|
||||
$server_id = $params['server_id'];
|
||||
|
||||
if ($config['metaconsole'] && !empty($server_id)) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
// Error connecting
|
||||
// Error connecting.
|
||||
if (metaconsole_connect($server) !== NOERR) {
|
||||
echo '<html>';
|
||||
echo '<body>';
|
||||
ui_print_error_message(__('There was a problem connecting with the node'));
|
||||
echo '</body>';
|
||||
echo '</html>';
|
||||
?>
|
||||
<html>
|
||||
<body>
|
||||
<?php
|
||||
ui_print_error_message(
|
||||
__('There was a problem connecting with the node')
|
||||
);
|
||||
echoPhantomCallback();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$user_language = get_user_language($config['id_user']);
|
||||
if (file_exists('languages/'.$user_language.'.mo')) {
|
||||
$l10n = new gettext_reader(new CachedFileReader('languages/'.$user_language.'.mo'));
|
||||
if (file_exists('languages/'.$user_language.'.mo') === true) {
|
||||
$cfr = new CachedFileReader('languages/'.$user_language.'.mo');
|
||||
$l10n = new gettext_reader($cfr);
|
||||
$l10n->load_tables();
|
||||
}
|
||||
|
||||
|
@ -85,16 +161,18 @@ if (file_exists('languages/'.$user_language.'.mo')) {
|
|||
<body bgcolor="#ffffff" style='background:#ffffff;'>
|
||||
<?php
|
||||
$params['only_image'] = false;
|
||||
$params['width'] = (int) $_REQUEST['viewport_width'];
|
||||
$params['menu'] = false;
|
||||
$params['width'] = (int) $_REQUEST['viewport_width'];
|
||||
$params['menu'] = false;
|
||||
|
||||
if ((!isset($params['width']) || ($params['width'] <= 0))) {
|
||||
if ((isset($params['width']) === false
|
||||
|| ($params['width'] <= 0))
|
||||
) {
|
||||
$params['width'] = 650;
|
||||
}
|
||||
|
||||
$params_combined = json_decode($_REQUEST['data_combined'], true);
|
||||
$module_list = json_decode($_REQUEST['data_module_list'], true);
|
||||
$type_graph_pdf = $_REQUEST['type_graph_pdf'];
|
||||
$module_list = json_decode($_REQUEST['data_module_list'], true);
|
||||
$type_graph_pdf = $_REQUEST['type_graph_pdf'];
|
||||
|
||||
echo '<div>';
|
||||
switch ($type_graph_pdf) {
|
||||
|
@ -208,25 +286,12 @@ if (file_exists('languages/'.$user_language.'.mo')) {
|
|||
break;
|
||||
|
||||
default:
|
||||
// code...
|
||||
// Code...
|
||||
break;
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echoPhantomCallback();
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('document').ready(function () {
|
||||
setTimeout(function () {
|
||||
try {
|
||||
var status = window.callPhantom({ status: "loaded" });
|
||||
} catch (error) {
|
||||
console.log("CALLBACK ERROR", error.message)
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -209,6 +209,12 @@ class ConsoleSupervisor
|
|||
|
||||
$this->getUMMessages();
|
||||
|
||||
/*
|
||||
* Check if the Server and Console has
|
||||
* the same versions.
|
||||
*/
|
||||
$this->checkConsoleServerVersions();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -435,6 +441,12 @@ class ConsoleSupervisor
|
|||
|
||||
$this->getUMMessages();
|
||||
|
||||
/*
|
||||
* Check if the Server and Console has
|
||||
* the same versions.
|
||||
*/
|
||||
$this->checkConsoleServerVersions();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -2334,4 +2346,35 @@ class ConsoleSupervisor
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if all servers and console versions are the same
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkConsoleServerVersions()
|
||||
{
|
||||
global $config;
|
||||
// List all servers except satellite server
|
||||
$server_version_list = db_get_all_rows_sql(
|
||||
'SELECT name, version FROM tserver WHERE server_type != '.SERVER_TYPE_ENTERPRISE_SATELLITE
|
||||
);
|
||||
|
||||
foreach ($server_version_list as $server) {
|
||||
if (strpos($server['version'], $config['current_package_enterprise']) === false) {
|
||||
$title_ver_misaligned = $server['name'].' version misaligned with Console';
|
||||
$message_ver_misaligned = 'Server '.$server['name'].' and this console have different versions. This might cause several malfunctions. Please, update this server.';
|
||||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.SERVER.MISALIGNED',
|
||||
'title' => __($title_ver_misaligned),
|
||||
'message' => __($message_ver_misaligned),
|
||||
'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -65,6 +65,8 @@ class CustomNetScan extends Wizard
|
|||
$this->url = ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
|
||||
);
|
||||
|
||||
$this->access = 'AW';
|
||||
$this->page = $page;
|
||||
$this->breadcrum = $breadcrum;
|
||||
}
|
||||
|
@ -77,6 +79,8 @@ class CustomNetScan extends Wizard
|
|||
*/
|
||||
public function parseNetScan()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($this->page) === true && $this->page === 0) {
|
||||
// Check if we're updating a task.
|
||||
$task_id = get_parameter('task', null);
|
||||
|
@ -145,11 +149,11 @@ class CustomNetScan extends Wizard
|
|||
) {
|
||||
// Default values, no data received.
|
||||
// User is accesing directly to this page.
|
||||
if (users_is_admin() !== true && check_acl(
|
||||
$config['id_usuario'],
|
||||
if (check_acl(
|
||||
$config['id_user'],
|
||||
$this->task['id_group'],
|
||||
'PM'
|
||||
) !== true
|
||||
$this->access
|
||||
) != true
|
||||
) {
|
||||
$this->msg = __('You have no access to edit this task.');
|
||||
return false;
|
||||
|
@ -275,7 +279,7 @@ class CustomNetScan extends Wizard
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (!check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (!check_acl($config['id_user'], 0, $this->access)) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Custom Net Scan.'
|
||||
|
@ -317,11 +321,11 @@ class CustomNetScan extends Wizard
|
|||
|
||||
// Check ACL. If user is not able to manage target task,
|
||||
// redirect him to main page.
|
||||
if (users_is_admin() !== true && check_acl(
|
||||
$config['id_usuario'],
|
||||
if (check_acl(
|
||||
$config['id_user'],
|
||||
$this->task['id_group'],
|
||||
'PM'
|
||||
) !== true
|
||||
$this->access
|
||||
) != true
|
||||
) {
|
||||
$form['form']['action'] = $this->url.'&mode=customnetscan&page='.($this->page - 1);
|
||||
}
|
||||
|
@ -496,7 +500,7 @@ class CustomNetScan extends Wizard
|
|||
'arguments' => [
|
||||
'name' => 'id_group',
|
||||
'returnAllGroup' => false,
|
||||
'privilege' => 'PM',
|
||||
'privilege' => $this->access,
|
||||
'type' => 'select_groups',
|
||||
'selected' => $this->task['id_group'],
|
||||
'return' => true,
|
||||
|
|
|
@ -65,6 +65,8 @@ class ManageNetScanScripts extends Wizard
|
|||
$this->url = ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
|
||||
);
|
||||
|
||||
$this->access = 'PM';
|
||||
$this->page = $page;
|
||||
$this->breadcrum = $breadcrum;
|
||||
}
|
||||
|
@ -81,7 +83,7 @@ class ManageNetScanScripts extends Wizard
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'AW') === 0) {
|
||||
if (check_acl($config['id_user'], 0, $this->access) === 0) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Net Scan Script.'
|
||||
|
|
|
@ -2642,8 +2642,17 @@ class NetworkMap
|
|||
*/
|
||||
public function loadMapData()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$networkmap = $this->map;
|
||||
|
||||
// ACL.
|
||||
$networkmap_write = check_acl(
|
||||
$config['id_user'],
|
||||
$networkmap['id_group'],
|
||||
'MW'
|
||||
);
|
||||
|
||||
$simulate = false;
|
||||
if (isset($networkmap['__simulated']) === false) {
|
||||
$networkmap['filter'] = json_decode(
|
||||
|
@ -2711,6 +2720,7 @@ class NetworkMap
|
|||
$output .= 'var networkmap_center = [ '.$networkmap['center_x'].', '.$networkmap['center_y']."];\n";
|
||||
$output .= 'var networkmap_dimensions = [ '.$networkmap['width'].', '.$networkmap['height']."];\n";
|
||||
$output .= 'var enterprise_installed = '.((int) enterprise_installed()).";\n";
|
||||
$output .= 'var networkmap_write = '.$networkmap_write.";\n";
|
||||
$output .= 'var node_radius = '.$networkmap['filter']['node_radius'].";\n";
|
||||
$output .= 'var networkmap_holding_area_dimensions = '.json_encode($networkmap['filter']['holding_area']).";\n";
|
||||
$output .= "var networkmap = {'nodes': [], 'links': []};\n";
|
||||
|
|
|
@ -1075,6 +1075,8 @@ class Tree
|
|||
ON ta.id_agente = tasg.id_agent
|
||||
LEFT JOIN talert_template_modules tatm
|
||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||
AND tatm.id_alert_template = 1
|
||||
OR tatm.id_alert_template = NULL
|
||||
$inner
|
||||
WHERE tam.disabled = 0 AND ta.disabled = 0
|
||||
$condition
|
||||
|
|
|
@ -104,7 +104,7 @@ class TreeService extends Tree
|
|||
break;
|
||||
|
||||
case SERVICE_STATUS_WARNING:
|
||||
$processed_items[$row['id']][$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_warning_ball.png" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
|
||||
$processed_items[$row['id']]['statusImageHTML'] = '<img src="images/status_sets/default/agent_warning_ball.png" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
|
||||
break;
|
||||
|
||||
case SERVICE_STATUS_UNKNOWN:
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC191002';
|
||||
$pandora_version = 'v7.0NG.739';
|
||||
$build_version = 'PC191029';
|
||||
$pandora_version = 'v7.0NG.740';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -147,7 +147,7 @@ define('COL_UNKNOWN', '#B2B2B2');
|
|||
define('COL_DOWNTIME', '#976DB1');
|
||||
define('COL_IGNORED', '#DDD');
|
||||
define('COL_ALERTFIRED', '#F36201');
|
||||
define('COL_MINOR', '#B2B2B2');
|
||||
define('COL_MINOR', '#F099A2');
|
||||
define('COL_MAJOR', '#C97A4A');
|
||||
define('COL_INFORMATIONAL', '#E4E4E4');
|
||||
define('COL_MAINTENANCE', '#4a83f3');
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -124,8 +124,26 @@ function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=t
|
|||
}
|
||||
|
||||
$groups = users_get_groups($id_user, $privileges, $returnAllGroup);
|
||||
$all_graphs = [];
|
||||
if (is_metaconsole()) {
|
||||
$servers = metaconsole_get_connection_names();
|
||||
foreach ($servers as $key => $server) {
|
||||
$connection = metaconsole_get_connection($server);
|
||||
if (metaconsole_connect($connection) != NOERR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$all_graph = db_get_all_rows_in_table('tgraph', 'name');
|
||||
if ($all_graph !== false) {
|
||||
$all_graphs = array_merge($all_graphs, $all_graph);
|
||||
}
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
} else {
|
||||
$all_graphs = db_get_all_rows_in_table('tgraph', 'name');
|
||||
}
|
||||
|
||||
$all_graphs = db_get_all_rows_in_table('tgraph', 'name');
|
||||
if ($all_graphs === false) {
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -4382,7 +4382,7 @@ function events_page_general($event)
|
|||
|
||||
$data = [];
|
||||
$data[0] = __('Event name');
|
||||
$data[1] = events_display_name($event['evento']);
|
||||
$data[1] = '<span style="word-break: break-word;">'.events_display_name($event['evento']).'</span>';
|
||||
$table_general->data[] = $data;
|
||||
|
||||
$data = [];
|
||||
|
@ -4615,7 +4615,7 @@ function events_page_comments($event, $ajax=false)
|
|||
foreach ($comm as $c) {
|
||||
$data[0] = '<b>'.$c['action'].' by '.$c['id_user'].'</b>';
|
||||
$data[0] .= '<br><br><i>'.date($config['date_format'], $c['utimestamp']).'</i>';
|
||||
$data[1] = $c['comment'];
|
||||
$data[1] = '<p style="word-break: break-word;">'.$c['comment'].'</p>';
|
||||
$table_comments->data[] = $data;
|
||||
}
|
||||
}
|
||||
|
@ -6879,3 +6879,56 @@ function events_get_field_value_by_event_id(
|
|||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function events_get_instructions($event)
|
||||
{
|
||||
if (!is_array($event)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
switch ($event['event_type']) {
|
||||
case 'going_unknown':
|
||||
if ($event['unknown_instructions'] != '') {
|
||||
$value = str_replace("\n", '<br>', io_safe_output($event['unknown_instructions']));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'going_up_warning':
|
||||
case 'going_down_warning':
|
||||
if ($event['warning_instructions'] != '') {
|
||||
$value = str_replace("\n", '<br>', io_safe_output($event['warning_instructions']));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'going_up_critical':
|
||||
case 'going_down_critical':
|
||||
if ($event['critical_instructions'] != '') {
|
||||
$value = str_replace("\n", '<br>', io_safe_output($event['critical_instructions']));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isset($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$max_text_length = 300;
|
||||
$over_text = io_safe_output($value);
|
||||
if (strlen($over_text) > ($max_text_length + 3)) {
|
||||
$over_text = substr($over_text, 0, $max_text_length).'...';
|
||||
}
|
||||
|
||||
$output = '<div id="hidden_event_instructions_'.$event['id_evento'].'"';
|
||||
$output .= ' style="display: none; width: 100%; height: 100%; overflow: auto; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left">';
|
||||
$output .= $value;
|
||||
$output .= '</div>';
|
||||
$output .= '<center>';
|
||||
$output .= '<span id="value_event_'.$event['id_evento'].'" style="white-space: nowrap;">';
|
||||
$output .= '<span id="value_event_text_'.$event['id_evento'].'"></span>';
|
||||
$output .= '<a href="javascript:show_instructions('.$event['id_evento'].')">';
|
||||
$output .= html_print_image('images/default_list.png', true, ['title' => $over_text]).'</a></span>';
|
||||
$output .= '</center>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -295,20 +295,40 @@ function grafico_modulo_sparse_data(
|
|||
return false;
|
||||
}
|
||||
|
||||
$array_data['sum'.$series_suffix]['agent_module_id'] = $agent_module_id;
|
||||
$array_data['sum'.$series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
|
||||
$array_data['sum'.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
|
||||
$array_data['sum'.$series_suffix]['module_name'] = $data_module_graph['module_name'];
|
||||
$array_data['sum'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
|
||||
$array_data['sum'.$series_suffix]['unit'] = $data_module_graph['unit'];
|
||||
$array_data = series_suffix_leyend(
|
||||
'sum',
|
||||
$series_suffix,
|
||||
$agent_module_id,
|
||||
$data_module_graph,
|
||||
$array_data
|
||||
);
|
||||
|
||||
if ($params['percentil']) {
|
||||
$array_data['percentil'.$series_suffix]['agent_module_id'] = $agent_module_id;
|
||||
$array_data['percentil'.$series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
|
||||
$array_data['percentil'.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
|
||||
$array_data['percentil'.$series_suffix]['module_name'] = $data_module_graph['module_name'];
|
||||
$array_data['percentil'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
|
||||
$array_data['percentil'.$series_suffix]['unit'] = $data_module_graph['unit'];
|
||||
$array_data = series_suffix_leyend(
|
||||
'percentil',
|
||||
$series_suffix,
|
||||
$agent_module_id,
|
||||
$data_module_graph,
|
||||
$array_data
|
||||
);
|
||||
}
|
||||
|
||||
if ($params['type_mode_graph']) {
|
||||
$array_data = series_suffix_leyend(
|
||||
'min',
|
||||
$series_suffix,
|
||||
$agent_module_id,
|
||||
$data_module_graph,
|
||||
$array_data
|
||||
);
|
||||
|
||||
$array_data = series_suffix_leyend(
|
||||
'max',
|
||||
$series_suffix,
|
||||
$agent_module_id,
|
||||
$data_module_graph,
|
||||
$array_data
|
||||
);
|
||||
}
|
||||
|
||||
// This is for a specific type of report that consists in passing
|
||||
|
@ -1522,7 +1542,8 @@ function graphic_combined_module(
|
|||
$array_data,
|
||||
$params_combined['average'],
|
||||
$params_combined['summatory'],
|
||||
$params_combined['modules_series']
|
||||
$params_combined['modules_series'],
|
||||
$date_array
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2223,7 +2244,7 @@ function graphic_combined_module(
|
|||
* @param boolean $average Average.
|
||||
* @param boolean $summatory Summatory.
|
||||
* @param boolean $modules_series Series module.
|
||||
* @param boolean $baseline Baseline data.
|
||||
* @param array $date_array Date data.
|
||||
*
|
||||
* @return array Data.
|
||||
*/
|
||||
|
@ -2232,106 +2253,82 @@ function combined_graph_summatory_average(
|
|||
$average=false,
|
||||
$summatory=false,
|
||||
$modules_series=false,
|
||||
$baseline=false
|
||||
$date_array=[]
|
||||
) {
|
||||
if (isset($array_data) && is_array($array_data)) {
|
||||
$reduce_array = [];
|
||||
foreach ($array_data as $key => $value) {
|
||||
if (strpos($key, 'sum') !== false) {
|
||||
$data_array_reverse[$key] = array_reverse($value['data']);
|
||||
if (!$modules_series) {
|
||||
unset($array_data[$key]);
|
||||
}
|
||||
$last = $date_array['start_date'];
|
||||
$reduce_array = array_reduce(
|
||||
$value['data'],
|
||||
function ($carry, $item) use ($date_array, $last, $reduce_array) {
|
||||
$slice_start = $date_array['start_date'];
|
||||
$iterator = $last;
|
||||
|
||||
// JS to PHP timestamp format.
|
||||
$item[0] /= 1000;
|
||||
while ($iterator <= $date_array['final_date']) {
|
||||
if ($item[0] >= $slice_start && $item[0] < $iterator) {
|
||||
$array = [];
|
||||
$val = 0;
|
||||
$n = 0;
|
||||
|
||||
if (is_array($reduce_array[$slice_start])) {
|
||||
$val = $reduce_array[$slice_start]['value'];
|
||||
$n = ($reduce_array[$slice_start]['n'] + 1);
|
||||
}
|
||||
|
||||
$array['value'] = ($item[1] + $val);
|
||||
$array['n'] = $n;
|
||||
$array['t'] = ($slice_start * 1000);
|
||||
|
||||
$carry[$slice_start] = $array;
|
||||
$last = $iterator;
|
||||
break;
|
||||
} else {
|
||||
$slice_start = $iterator;
|
||||
$iterator += 300;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
return $carry;
|
||||
},
|
||||
$reduce_array
|
||||
);
|
||||
}
|
||||
|
||||
if (!$modules_series) {
|
||||
unset($array_data[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data_array_reverse) && is_array($data_array_reverse)) {
|
||||
$array_sum_reverse = [];
|
||||
$array_avg_reverse = [];
|
||||
$data_array_prev = false;
|
||||
$data_array_pop = [];
|
||||
$count = 0;
|
||||
$reduce_array_summatory = [];
|
||||
$reduce_array_average = [];
|
||||
$i = 0;
|
||||
foreach ($reduce_array as $item) {
|
||||
$reduce_array_summatory[$i][0] = $item['t'];
|
||||
$reduce_array_summatory[$i][1] = $item['value'];
|
||||
|
||||
$count_data_array_reverse = count($data_array_reverse['sum0']);
|
||||
while ($count_data_array_reverse > 0) {
|
||||
foreach ($data_array_reverse as $key_reverse => $value_reverse) {
|
||||
if (is_array($value_reverse) && count($value_reverse) > 0) {
|
||||
$data_array_pop[$key_reverse] = array_pop(
|
||||
$data_array_reverse[$key_reverse]
|
||||
);
|
||||
}
|
||||
}
|
||||
$reduce_array_average[$i][0] = $item['t'];
|
||||
$reduce_array_average[$i][1] = ($item['value'] / ($item['n'] + 1));
|
||||
|
||||
if (isset($data_array_pop) && is_array($data_array_pop)) {
|
||||
$acum_data = 0;
|
||||
$acum_array = [];
|
||||
$sum_data = 0;
|
||||
$count_pop = 0;
|
||||
foreach ($data_array_pop as $key_pop => $value_pop) {
|
||||
if ($value_pop[0] > $acum_data) {
|
||||
if ($acum_data != 0) {
|
||||
$sum_data = ($sum_data + $data_array_prev[$key_pop][1]);
|
||||
$data_array_reverse[$key_pop][] = $value_pop;
|
||||
$data_array_prev[$acum_key] = $acum_array;
|
||||
} else {
|
||||
if ($data_array_prev[$key_pop] == false) {
|
||||
$data_array_prev[$key_pop] = $value_pop;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$acum_key = $key_pop;
|
||||
$acum_data = $value_pop[0];
|
||||
$acum_array = $value_pop;
|
||||
$sum_data = $value_pop[1];
|
||||
}
|
||||
} else if ($value_pop[0] < $acum_data) {
|
||||
$sum_data = ($sum_data + $data_array_prev[$key_pop][1]);
|
||||
$data_array_reverse[$acum_key][] = $acum_array;
|
||||
$data_array_prev[$key_pop] = $value_pop;
|
||||
$acum_key = $key_pop;
|
||||
$acum_data = $value_pop[0];
|
||||
$acum_array = $value_pop;
|
||||
} else if ($value_pop[0] == $acum_data) {
|
||||
$data_array_prev[$key_pop] = $value_pop;
|
||||
$sum_data += $value_pop[1];
|
||||
}
|
||||
if ($summatory && isset($reduce_array_summatory)
|
||||
&& is_array($reduce_array_summatory)
|
||||
&& count($reduce_array_summatory) > 0
|
||||
) {
|
||||
$array_data['summatory']['data'] = $reduce_array_summatory;
|
||||
}
|
||||
|
||||
$count_pop++;
|
||||
}
|
||||
|
||||
if ($summatory) {
|
||||
$array_sum_reverse[$count][0] = $acum_data;
|
||||
$array_sum_reverse[$count][1] = $sum_data;
|
||||
}
|
||||
|
||||
if ($average) {
|
||||
$array_avg_reverse[$count][0] = $acum_data;
|
||||
$array_avg_reverse[$count][1] = ($sum_data / $count_pop);
|
||||
}
|
||||
}
|
||||
|
||||
$count++;
|
||||
$count_data_array_reverse--;
|
||||
}
|
||||
|
||||
if ($summatory && isset($array_sum_reverse)
|
||||
&& is_array($array_sum_reverse)
|
||||
&& count($array_sum_reverse) > 0
|
||||
) {
|
||||
$array_data['summatory']['data'] = $array_sum_reverse;
|
||||
$array_data['summatory']['color'] = 'purple';
|
||||
}
|
||||
|
||||
if ($average && isset($array_avg_reverse)
|
||||
&& is_array($array_avg_reverse)
|
||||
&& count($array_avg_reverse) > 0
|
||||
) {
|
||||
if ($baseline) {
|
||||
$array_data['baseline']['data'] = $array_avg_reverse;
|
||||
$array_data['baseline']['color'] = 'green';
|
||||
} else {
|
||||
$array_data['average']['data'] = $array_avg_reverse;
|
||||
$array_data['average']['color'] = 'orange';
|
||||
}
|
||||
}
|
||||
if ($average && isset($reduce_array_average)
|
||||
&& is_array($reduce_array_average)
|
||||
&& count($reduce_array_average) > 0
|
||||
) {
|
||||
$array_data['average']['data'] = $reduce_array_average;
|
||||
}
|
||||
|
||||
return $array_data;
|
||||
|
@ -3192,6 +3189,21 @@ function graphic_incident_source($width=320, $height=200)
|
|||
}
|
||||
|
||||
|
||||
function series_suffix_leyend($series_name, $series_suffix, $id_agent, $data_module_graph, $array_data)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$array_data[$series_name.$series_suffix]['agent_module_id'] = $id_agent;
|
||||
$array_data[$series_name.$series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
|
||||
$array_data[$series_name.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
|
||||
$array_data[$series_name.$series_suffix]['module_name'] = $data_module_graph['module_name'];
|
||||
$array_data[$series_name.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
|
||||
$array_data[$series_name.$series_suffix]['unit'] = $data_module_graph['unit'];
|
||||
|
||||
return $array_data;
|
||||
}
|
||||
|
||||
|
||||
function graph_events_validated($width=300, $height=200, $extra_filters=[], $meta=false, $history=false)
|
||||
{
|
||||
global $config;
|
||||
|
@ -3583,7 +3595,32 @@ function graph_custom_sql_graph(
|
|||
|
||||
$SQL_GRAPH_MAX_LABEL_SIZE = 20;
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$server = metaconsole_get_connection_names();
|
||||
$connection = metaconsole_get_connection($server);
|
||||
metaconsole_connect($connection);
|
||||
}
|
||||
|
||||
$report_content = db_get_row('treport_content', 'id_rc', $id);
|
||||
|
||||
if ($report_content == false || $report_content == '') {
|
||||
$report_content = db_get_row('treport_content_template', 'id_rc', $id);
|
||||
}
|
||||
|
||||
if ($report_content == false || $report_content == '') {
|
||||
enterprise_hook('metaconsole_restore_db');
|
||||
$report_content = db_get_row('treport_content', 'id_rc', $id);
|
||||
if ($report_content == false || $report_content == '') {
|
||||
$report_content = db_get_row('treport_content_template', 'id_rc', $id);
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$server = metaconsole_get_connection_names();
|
||||
$connection = metaconsole_get_connection($server);
|
||||
metaconsole_connect($connection);
|
||||
}
|
||||
}
|
||||
|
||||
if ($id != null) {
|
||||
$historical_db = db_get_value_sql('SELECT historical_db from treport_content where id_rc ='.$id);
|
||||
} else {
|
||||
|
@ -3597,22 +3634,9 @@ function graph_custom_sql_graph(
|
|||
$sql = io_safe_output($sql['sql']);
|
||||
}
|
||||
|
||||
if (($config['metaconsole'] == 1) && defined('METACONSOLE')) {
|
||||
$metaconsole_connection = enterprise_hook('metaconsole_get_connection', [$report_content['server_name']]);
|
||||
|
||||
if ($metaconsole_connection === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (enterprise_hook('metaconsole_load_external_db', [$metaconsole_connection]) != NOERR) {
|
||||
// ui_print_error_message ("Error connecting to ".$server_name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$data_result = db_get_all_rows_sql($sql, $historical_db);
|
||||
|
||||
if (($config['metaconsole'] == 1) && defined('METACONSOLE')) {
|
||||
if (is_metaconsole()) {
|
||||
enterprise_hook('metaconsole_restore_db');
|
||||
}
|
||||
|
||||
|
|
|
@ -2654,21 +2654,18 @@ function modules_get_relations($params=[])
|
|||
}
|
||||
|
||||
$modules_type = '';
|
||||
$modules_type_filter = '';
|
||||
if (isset($params['modules_type'])) {
|
||||
$modules_type = $params['modules_type'];
|
||||
$module_type = 'INNER JOIN ttipo_modulo ttm ON tam.id_tipo_modulo = ttm.id_tipo';
|
||||
$modules_type_filter = sprintf(
|
||||
"AND ttm.nombre = '%s'",
|
||||
$params['modules_type']
|
||||
);
|
||||
}
|
||||
|
||||
$sql = 'SELECT DISTINCT tmr.id, tmr.module_a, tmr.module_b,
|
||||
tmr.disable_update, tmr.type
|
||||
FROM tmodule_relationship tmr,
|
||||
tagente_modulo tam,
|
||||
tagente ta,
|
||||
ttipo_modulo ttm
|
||||
WHERE ';
|
||||
|
||||
$agent_filter = '';
|
||||
if ($id_agent > 0) {
|
||||
$agent_filter = sprintf('AND ta.id_agente = %d', $id_agent);
|
||||
$distinct = '';
|
||||
if (empty($params)) {
|
||||
$distinct = 'DISTINCT';
|
||||
}
|
||||
|
||||
$module_a_filter = '';
|
||||
|
@ -2678,6 +2675,11 @@ function modules_get_relations($params=[])
|
|||
$module_b_filter = sprintf('AND tmr.module_b = %d', $id_module);
|
||||
}
|
||||
|
||||
$agent_filter = '';
|
||||
if ($id_agent > 0) {
|
||||
$agent_filter = sprintf('AND ta.id_agente = %d', $id_agent);
|
||||
}
|
||||
|
||||
$disabled_update_filter = '';
|
||||
if ($disabled_update >= 0) {
|
||||
$disabled_update_filter = sprintf(
|
||||
|
@ -2686,22 +2688,25 @@ function modules_get_relations($params=[])
|
|||
);
|
||||
}
|
||||
|
||||
$modules_type_filter = '';
|
||||
if ($modules_type != '') {
|
||||
$modules_type_filter = sprintf(
|
||||
"AND (tam.id_tipo_modulo = ttm.id_tipo AND ttm.nombre = '%s')",
|
||||
$modules_type
|
||||
);
|
||||
}
|
||||
|
||||
$sql .= "( (tmr.module_a = tam.id_agente_modulo
|
||||
$module_a_filter)
|
||||
OR (tmr.module_b = tam.id_agente_modulo
|
||||
$module_b_filter) )
|
||||
AND tam.id_agente = ta.id_agente
|
||||
$agent_filter
|
||||
$disabled_update_filter
|
||||
$modules_type_filter";
|
||||
$sql = sprintf(
|
||||
'SELECT %s tmr.id, tmr.module_a, tmr.module_b,
|
||||
tmr.disable_update, tmr.type
|
||||
FROM tmodule_relationship tmr
|
||||
INNER JOIN tagente_modulo tam
|
||||
ON (tmr.module_a = tam.id_agente_modulo %s)
|
||||
OR (tmr.module_b = tam.id_agente_modulo %s)
|
||||
INNER JOIN tagente ta
|
||||
ON tam.id_agente = ta.id_agente
|
||||
%s
|
||||
WHERE 1=1 %s %s %s',
|
||||
$distinct,
|
||||
$module_a_filter,
|
||||
$module_b_filter,
|
||||
$module_type,
|
||||
$agent_filter,
|
||||
$disabled_update_filter,
|
||||
$modules_type_filter
|
||||
);
|
||||
|
||||
return db_get_all_rows_sql($sql);
|
||||
}
|
||||
|
|
|
@ -2327,7 +2327,13 @@ function migrate_older_open_maps($id)
|
|||
$new_map_filter = [];
|
||||
$new_map_filter['dont_show_subgroups'] = $old_networkmap['dont_show_subgroups'];
|
||||
$new_map_filter['node_radius'] = 40;
|
||||
$new_map_filter['id_migrate_map'] = $id;
|
||||
$new_map_filter['x_offs'] = 0;
|
||||
$new_map_filter['y_offs'] = 0;
|
||||
$new_map_filter['z_dash'] = '0.5';
|
||||
$new_map_filter['node_sep'] = '0.1';
|
||||
$new_map_filter['rank_sep'] = 1;
|
||||
$new_map_filter['mindist'] = 1;
|
||||
$new_map_filter['kval'] = '0.1';
|
||||
$map_values['filter'] = json_encode($new_map_filter);
|
||||
|
||||
$map_values['description'] = 'Mapa open migrado';
|
||||
|
@ -2340,11 +2346,7 @@ function migrate_older_open_maps($id)
|
|||
$map_values['source_period'] = 60;
|
||||
$map_values['source'] = 0;
|
||||
$map_values['source_data'] = $old_networkmap['id_group'];
|
||||
if ($old_networkmap['type'] == 'radial_dinamic') {
|
||||
$map_values['generation_method'] = 6;
|
||||
} else {
|
||||
$map_values['generation_method'] = 4;
|
||||
}
|
||||
$map_values['generation_method'] = 3;
|
||||
|
||||
$map_values['generated'] = 0;
|
||||
|
||||
|
|
|
@ -748,7 +748,9 @@ function planned_downtimes_created($values)
|
|||
'return' => false,
|
||||
'message' => __('Not created. Error inserting data').'. '.__('The end date must be higher than the current time'),
|
||||
];
|
||||
} else if ($values['type_execution'] == 'once' && $values['date_from'] >= $values['date_to']) {
|
||||
} else if ($values['type_execution'] == 'once' && ($values['date_from'] > $values['date_to'])
|
||||
|| (($values['date_from'] == $values['date_to']) && ($values['periodically_time_from'] >= $values['periodically_time_to']))
|
||||
) {
|
||||
return [
|
||||
'return' => false,
|
||||
'message' => __('Not created. Error inserting data').'. '.__('The end date must be higher than the start date'),
|
||||
|
@ -794,6 +796,11 @@ function planned_downtimes_created($values)
|
|||
'return' => false,
|
||||
'message' => __('Not created. Error inserting data').'. '.__('There is no group with such id'),
|
||||
];
|
||||
} else if (!$values['date_from'] || !$values['date_to']) {
|
||||
return [
|
||||
'return' => false,
|
||||
'message' => __('Not created. Error inserting data').'. '.__('Date is wrong formatted'),
|
||||
];
|
||||
} else {
|
||||
if (trim(io_safe_output($values['name'])) != '') {
|
||||
if (!$check) {
|
||||
|
|
|
@ -179,6 +179,10 @@ function reporting_make_reporting_data(
|
|||
$report['group_name'] = groups_get_name($report['id_group']);
|
||||
$report['contents'] = [];
|
||||
|
||||
if (empty($report['period']) && $pdf === false) {
|
||||
$report['period'] = $period;
|
||||
}
|
||||
|
||||
if (empty($contents)) {
|
||||
return reporting_check_structure_report($report);
|
||||
}
|
||||
|
@ -224,7 +228,12 @@ function reporting_make_reporting_data(
|
|||
|
||||
// General reports with 0 period means last value
|
||||
// Avoid to overwrite it by template value.
|
||||
if (!empty($period) && ($content['type'] !== 'general' && $content['period'] != 0)) {
|
||||
$general_last_value = false;
|
||||
if ($content['type'] === 'general' && $content['period'] == 0) {
|
||||
$general_last_value = true;
|
||||
}
|
||||
|
||||
if (!empty($period) && $general_last_value === false) {
|
||||
$content['period'] = $period;
|
||||
}
|
||||
|
||||
|
@ -282,6 +291,15 @@ function reporting_make_reporting_data(
|
|||
$agents_to_macro = $content['id_agent'];
|
||||
}
|
||||
|
||||
// Metaconsole connection.
|
||||
if (is_metaconsole()) {
|
||||
$server = metaconsole_get_connection_names();
|
||||
$connection = metaconsole_get_connection($server);
|
||||
if (metaconsole_connect($connection) != NOERR) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($content['style']['name_label'])) {
|
||||
// Add macros name.
|
||||
$items_label = [];
|
||||
|
@ -294,14 +312,6 @@ function reporting_make_reporting_data(
|
|||
$metaconsole_on = is_metaconsole();
|
||||
$server_name = $content['server_name'];
|
||||
|
||||
// Metaconsole connection.
|
||||
if ($metaconsole_on && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$items_label['agent_description'] = agents_get_description(
|
||||
$content['id_agent']
|
||||
);
|
||||
|
@ -505,42 +515,6 @@ function reporting_make_reporting_data(
|
|||
);
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'MTTR',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'MTBF',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'TTO',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'TTRT',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
|
||||
case 'agent_configuration':
|
||||
$report['contents'][] = io_safe_output(
|
||||
reporting_agent_configuration(
|
||||
|
@ -2823,13 +2797,12 @@ function reporting_group_report($report, $content)
|
|||
$content['name'] = __('Group Report');
|
||||
}
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
$id_meta = metaconsole_get_id_server($content['server_name']);
|
||||
|
||||
$server = metaconsole_get_connection_by_id($id_meta);
|
||||
metaconsole_connect($server);
|
||||
if (is_metaconsole()) {
|
||||
$server = metaconsole_get_connection_names();
|
||||
$connection = metaconsole_get_connection($server);
|
||||
}
|
||||
|
||||
$return['server_name'] = $server[0];
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = groups_get_name($content['id_group'], true);
|
||||
$return['description'] = $content['description'];
|
||||
|
@ -3105,6 +3078,13 @@ function reporting_historical_data($report, $content)
|
|||
$content['name'] = __('Historical data');
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$id_meta = metaconsole_get_id_server($content['server_name']);
|
||||
|
||||
$server = metaconsole_get_connection_by_id($id_meta);
|
||||
$connection = metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$id_agent = agents_get_module_id(
|
||||
$content['id_agent_module']
|
||||
);
|
||||
|
@ -3196,6 +3176,10 @@ function reporting_historical_data($report, $content)
|
|||
|
||||
$return['data'] = $data;
|
||||
|
||||
if (is_metaconsole() && $connection > 0) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return reporting_check_structure_content($return);
|
||||
}
|
||||
|
||||
|
@ -3264,6 +3248,7 @@ function reporting_database_serialized($report, $content)
|
|||
}
|
||||
|
||||
$return['keys'] = $keys;
|
||||
$return['agent_name_db'] = agents_get_name($id_agent);
|
||||
$return['agent_name'] = $agent_alias;
|
||||
$return['module_name'] = $module_name;
|
||||
|
||||
|
@ -3476,7 +3461,7 @@ function reporting_network_interfaces_report($report, $content, $type='dinamic',
|
|||
$return['failed'] = null;
|
||||
$return['data'] = [];
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
if (is_metaconsole()) {
|
||||
$server_names = metaconsole_get_connection_names();
|
||||
if (isset($server_names) && is_array($server_names)) {
|
||||
foreach ($server_names as $key => $value) {
|
||||
|
@ -3493,7 +3478,8 @@ function reporting_network_interfaces_report($report, $content, $type='dinamic',
|
|||
$content,
|
||||
$report,
|
||||
$fullscale,
|
||||
$pdf
|
||||
$pdf,
|
||||
$id_meta
|
||||
);
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
@ -4178,6 +4164,19 @@ function reporting_sql_graph(
|
|||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text();
|
||||
|
||||
$module_source = db_get_all_rows_sql(
|
||||
'SELECT id_agent_module
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = '.$content['id_gs']
|
||||
);
|
||||
|
||||
if (isset($module_source) && is_array($module_source)) {
|
||||
$modules = [];
|
||||
foreach ($module_source as $key => $value) {
|
||||
$modules[$key] = $value['id_agent_module'];
|
||||
}
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'dinamic':
|
||||
case 'static':
|
||||
|
@ -4194,6 +4193,16 @@ function reporting_sql_graph(
|
|||
break;
|
||||
|
||||
case 'data':
|
||||
$data = [];
|
||||
foreach ($modules as $key => $value) {
|
||||
$data[$value] = modules_get_agentmodule_data(
|
||||
$value,
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
}
|
||||
|
||||
$return['chart'] = $data;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4267,6 +4276,7 @@ function reporting_monitor_report($report, $content)
|
|||
);
|
||||
}
|
||||
|
||||
$return['agent_name_db'] = agents_get_name($id_agent);
|
||||
$return['agent_name'] = $agent_alias;
|
||||
$return['module_name'] = $module_name;
|
||||
|
||||
|
@ -4394,6 +4404,7 @@ function reporting_netflow(
|
|||
switch ($type) {
|
||||
case 'dinamic':
|
||||
case 'static':
|
||||
case 'data':
|
||||
$return['chart'] = netflow_draw_item(
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime'],
|
||||
|
@ -4438,6 +4449,7 @@ function reporting_prediction_date($report, $content)
|
|||
$agent_name = io_safe_output(
|
||||
modules_get_agentmodule_agent_alias($content['id_agent_module'])
|
||||
);
|
||||
$agent_name_db = io_safe_output(modules_get_agentmodule_agent_name($content['id_agent_module']));
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = $agent_name.' - '.$module_name;
|
||||
|
@ -4445,6 +4457,7 @@ function reporting_prediction_date($report, $content)
|
|||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
|
||||
$return['agent_name_db'] = $agent_name_db;
|
||||
$return['agent_name'] = $agent_name;
|
||||
$return['module_name'] = $module_name;
|
||||
|
||||
|
@ -4489,12 +4502,14 @@ function reporting_projection_graph(
|
|||
|
||||
$module_name = io_safe_output(modules_get_agentmodule_name($content['id_agent_module']));
|
||||
$agent_name = io_safe_output(modules_get_agentmodule_agent_alias($content['id_agent_module']));
|
||||
$agent_name_db = io_safe_output(modules_get_agentmodule_agent_name($content['id_agent_module']));
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = $agent_name.' - '.$module_name;
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
$return['agent_name_db'] = $agent_name_db;
|
||||
$return['agent_name'] = $agent_name;
|
||||
$return['module_name'] = $module_name;
|
||||
|
||||
|
@ -4690,22 +4705,6 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
case 'sum':
|
||||
$return['type'] = 'sumatory';
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
$return['type'] = 'MTTR';
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
$return['type'] = 'MTBF';
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
$return['type'] = 'TTO';
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
$return['type'] = 'TTRT';
|
||||
break;
|
||||
}
|
||||
|
||||
if (empty($content['name'])) {
|
||||
|
@ -4725,22 +4724,6 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
case 'sum':
|
||||
$content['name'] = __('Summatory');
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
$content['name'] = __('MTTR');
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
$content['name'] = __('MTBF');
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
$content['name'] = __('TTO');
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
$content['name'] = __('TTRT');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4757,6 +4740,9 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
$agent_name = io_safe_output(
|
||||
modules_get_agentmodule_agent_alias($content['id_agent_module'])
|
||||
);
|
||||
$agent_name_db = io_safe_output(
|
||||
modules_get_agentmodule_agent_name($content['id_agent_module'])
|
||||
);
|
||||
$unit = db_get_value(
|
||||
'unit',
|
||||
'tagente_modulo',
|
||||
|
@ -4773,6 +4759,7 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
$return['id_agent'] = $content['id_agent'];
|
||||
$return['id_agent_module'] = $content['id_agent_module'];
|
||||
|
||||
$return['agent_name_db'] = $agent_name_db;
|
||||
$return['agent_name'] = $agent_name;
|
||||
$return['module_name'] = $module_name;
|
||||
|
||||
|
@ -4865,22 +4852,23 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
|
||||
if ($content['visual_format'] != 2) {
|
||||
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module'], true);
|
||||
for ($i = $report['datetime']; $i > ($report['datetime'] - $content['period']); $i -= $content['lapse']) {
|
||||
|
||||
for ($i = ($report['datetime'] - $content['period']); $i < $report['datetime']; $i += $content['lapse']) {
|
||||
$row = [];
|
||||
$row[__('Lapse')] = date('Y-m-d H:i:s', ($i - $content['lapse'] + 1)).' to '.date('Y-m-d H:i:s', $i);
|
||||
$row[__('Lapse')] = date('Y-m-d H:i:s', ($i + 1)).' to '.date('Y-m-d H:i:s', (($i + $content['lapse']) ));
|
||||
|
||||
if ($i > $time_begin['utimestamp']) {
|
||||
switch ($type) {
|
||||
case 'max':
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['lapse'], $i), $config['graph_precision']).' '.$unit;
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
|
||||
break;
|
||||
|
||||
case 'min':
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['lapse'], $i), $config['graph_precision']).' '.$unit;
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
|
||||
break;
|
||||
|
||||
case 'avg':
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['lapse'], $i), $config['graph_precision']).' '.$unit;
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -4912,50 +4900,6 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
$formated_value = format_for_graph($value, $config['graph_precision']).' '.$unit;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
$value = reporting_get_agentmodule_mttr(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
$formated_value = null;
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
$value = reporting_get_agentmodule_mtbf(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
$formated_value = null;
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
$value = reporting_get_agentmodule_tto(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
if ($value == 0) {
|
||||
$formated_value = null;
|
||||
} else {
|
||||
$formated_value = human_time_description_raw($value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
$value = reporting_get_agentmodule_ttr(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
if ($value == 0) {
|
||||
$formated_value = null;
|
||||
} else {
|
||||
$formated_value = human_time_description_raw($value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$return['data'] = [
|
||||
|
@ -7488,10 +7432,12 @@ function reporting_custom_graph(
|
|||
|
||||
if ($type_report == 'custom_graph') {
|
||||
if (is_metaconsole()) {
|
||||
$id_meta = metaconsole_get_id_server($content['server_name']);
|
||||
$server = metaconsole_get_connection_by_id($id_meta);
|
||||
if (metaconsole_connect($server) != NOERR) {
|
||||
return false;
|
||||
$servers = metaconsole_get_connection_names();
|
||||
foreach ($servers as $server) {
|
||||
$connection = metaconsole_get_connection($server);
|
||||
if (metaconsole_connect($connection) != NOERR) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7543,8 +7489,35 @@ function reporting_custom_graph(
|
|||
$content['name'] = __('Simple graph');
|
||||
}
|
||||
|
||||
$module_source = db_get_all_rows_sql(
|
||||
'SELECT id_agent_module
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = '.$content['id_gs']
|
||||
);
|
||||
|
||||
if (isset($module_source) && is_array($module_source)) {
|
||||
$modules = [];
|
||||
foreach ($module_source as $key => $value) {
|
||||
$modules[$key] = $value['id_agent_module'];
|
||||
}
|
||||
}
|
||||
|
||||
$agent_description = agents_get_description($id_agent);
|
||||
$agent_group = agents_get_agent_group($id_agent);
|
||||
$agent_address = agents_get_address($id_agent);
|
||||
$agent_alias = agents_get_alias($id_agent);
|
||||
$module_name = modules_get_agentmodule_name(
|
||||
$id_agent_module
|
||||
);
|
||||
|
||||
$module_description = modules_get_agentmodule_descripcion(
|
||||
$id_agent_module
|
||||
);
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = io_safe_output($graph['name']);
|
||||
$return['agent_name'] = $agent_alias;
|
||||
$return['module_name'] = $module_name;
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text(
|
||||
$report,
|
||||
|
@ -7588,6 +7561,19 @@ function reporting_custom_graph(
|
|||
);
|
||||
|
||||
break;
|
||||
|
||||
case 'data':
|
||||
$data = [];
|
||||
foreach ($modules as $key => $value) {
|
||||
$data[$value] = modules_get_agentmodule_data(
|
||||
$value,
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
}
|
||||
|
||||
$return['chart'] = $data;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($type_report == 'custom_graph') {
|
||||
|
@ -7672,6 +7658,7 @@ function reporting_simple_graph(
|
|||
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = $agent_alias.' - '.$module_name;
|
||||
$return['agent_name_db'] = agents_get_name($id_agent);
|
||||
$return['agent_name'] = $agent_alias;
|
||||
$return['module_name'] = $module_name;
|
||||
$return['description'] = $content['description'];
|
||||
|
|
|
@ -121,12 +121,9 @@ function html_do_report_info($report)
|
|||
</tr>
|
||||
<tr>
|
||||
<td><b>'.__('Report date').': </b></td>';
|
||||
if (isset($report['period'])) {
|
||||
if (is_numeric($report['datetime']) && is_numeric($report['period'])) {
|
||||
$html .= '<td>'.date($config['date_format'], ($report['datetime'] - $report['period'])).'</td>';
|
||||
}
|
||||
|
||||
$html .= '<td></td>';
|
||||
if (is_numeric($report['datetime']) && is_numeric($report['period']) && ($report['period'] != 0)) {
|
||||
$html .= '<td>'.__('From').' <b>'.date($config['date_format'], ($report['datetime'] - $report['period'])).'</b></td>';
|
||||
$html .= '<td>'.__('to').' <b>'.date($config['date_format'], $report['datetime']).'</b></td>';
|
||||
} else {
|
||||
$html .= '<td>'.__('Items period before').' <b>'.date($config['date_format'], $report['datetime']).'</b></td>';
|
||||
}
|
||||
|
@ -251,6 +248,7 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||
reporting_html_sql($table, $item);
|
||||
break;
|
||||
|
||||
case 'simple_baseline_graph':
|
||||
case 'simple_graph':
|
||||
reporting_html_graph($table, $item);
|
||||
break;
|
||||
|
@ -287,22 +285,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||
reporting_html_sum_value($table, $item, $mini);
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
reporting_html_MTTR_value($table, $item, $mini, true, true);
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
reporting_html_MTBF_value($table, $item, $mini, true, true);
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
reporting_html_TTO_value($table, $item, $mini, false, true);
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
reporting_html_TTRT_value($table, $item, $mini, false, true);
|
||||
break;
|
||||
|
||||
case 'agent_configuration':
|
||||
reporting_html_agent_configuration($table, $item);
|
||||
break;
|
||||
|
@ -315,10 +297,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||
reporting_html_prediction_date($table, $item, $mini);
|
||||
break;
|
||||
|
||||
case 'simple_baseline_graph':
|
||||
reporting_html_graph($table, $item);
|
||||
break;
|
||||
|
||||
case 'netflow_area':
|
||||
case 'netflow_data':
|
||||
case 'netflow_summary':
|
||||
|
@ -2207,12 +2185,15 @@ function reporting_html_database_serialized($table, $item, $pdf=0)
|
|||
{
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '100%';
|
||||
$table1->head = [__('Date')];
|
||||
$table1->head = [
|
||||
__('Date'),
|
||||
__('Data'),
|
||||
];
|
||||
if (!empty($item['keys'])) {
|
||||
$table1->head = array_merge($table1->head, $item['keys']);
|
||||
}
|
||||
|
||||
$table1->style[0] = 'text-align: left';
|
||||
$table1->style[0] = 'text-align: center';
|
||||
|
||||
$table1->data = [];
|
||||
foreach ($item['data'] as $data) {
|
||||
|
@ -2728,30 +2709,6 @@ function reporting_html_agent_configuration(
|
|||
}
|
||||
|
||||
|
||||
function reporting_html_TTRT_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
|
||||
}
|
||||
|
||||
|
||||
function reporting_html_TTO_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
|
||||
}
|
||||
|
||||
|
||||
function reporting_html_MTBF_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
|
||||
}
|
||||
|
||||
|
||||
function reporting_html_MTTR_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
|
||||
}
|
||||
|
||||
|
||||
function reporting_html_sum_value(&$table, $item, $mini)
|
||||
{
|
||||
reporting_html_value($table, $item, $mini);
|
||||
|
@ -3623,10 +3580,10 @@ function reporting_html_general($table, $item, $pdf=0)
|
|||
}
|
||||
|
||||
$table1->head[3] = __('Value');
|
||||
$table1->style[0] = 'text-align: left';
|
||||
$table1->style[1] = 'text-align: left';
|
||||
$table1->style[2] = 'text-align: left';
|
||||
$table1->style[3] = 'text-align: left';
|
||||
$table1->style[0] = 'text-align: center';
|
||||
$table1->style[1] = 'text-align: center';
|
||||
$table1->style[2] = 'text-align: center';
|
||||
$table1->style[3] = 'text-align: center';
|
||||
|
||||
// Begin - Order by agent.
|
||||
foreach ($item['data'] as $key => $row) {
|
||||
|
@ -3757,12 +3714,16 @@ function reporting_html_general($table, $item, $pdf=0)
|
|||
$table_summary->head = [];
|
||||
$table_summary->head_colspan = [];
|
||||
$table_summary->align = [];
|
||||
$table_summary->headstyle = [];
|
||||
$table_summary->headstyle[0] = 'text-align: center;';
|
||||
$table_summary->headstyle[1] = 'text-align: center;';
|
||||
$table_summary->headstyle[2] = 'text-align: center;';
|
||||
|
||||
$table_summary->align[0] = 'left';
|
||||
$table_summary->align[1] = 'right';
|
||||
$table_summary->align[2] = 'right';
|
||||
$table_summary->align[3] = 'left';
|
||||
$table_summary->align[4] = 'right';
|
||||
$table_summary->align[0] = 'center';
|
||||
$table_summary->align[1] = 'center';
|
||||
$table_summary->align[2] = 'center';
|
||||
$table_summary->align[3] = 'center';
|
||||
$table_summary->align[4] = 'center';
|
||||
|
||||
$table_summary->head_colspan[0] = 2;
|
||||
$table_summary->head[0] = __('Min Value');
|
||||
|
@ -3770,11 +3731,11 @@ function reporting_html_general($table, $item, $pdf=0)
|
|||
$table_summary->head_colspan[2] = 2;
|
||||
$table_summary->head[2] = __('Max Value');
|
||||
|
||||
$table_summary->data[0][0] = $item['min']['agent'].' - '.$item['min']['module'];
|
||||
$table_summary->data[0][1] = $item['min']['formated_value'];
|
||||
$table_summary->data[0][0] = $item['min']['agent'].' - '.$item['min']['module'].str_repeat(' ', 20).$item['min']['formated_value'];
|
||||
$table_summary->data[0][1] = '';
|
||||
$table_summary->data[0][2] = format_for_graph($item['avg_value'], 2);
|
||||
$table_summary->data[0][3] = $item['max']['agent'].' - '.$item['max']['module'];
|
||||
$table_summary->data[0][4] = $item['max']['formated_value'];
|
||||
$table_summary->data[0][3] = $item['max']['agent'].' - '.$item['max']['module'].str_repeat(' ', 20).$item['max']['formated_value'];
|
||||
$table_summary->data[0][4] = '';
|
||||
|
||||
if ($pdf !== 0) {
|
||||
$return_pdf .= html_print_table($table_summary, true);
|
||||
|
|
|
@ -679,23 +679,6 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
'name' => __('Module Histogram graph'),
|
||||
];
|
||||
|
||||
$types['TTRT'] = [
|
||||
'optgroup' => __('ITIL'),
|
||||
'name' => __('TTRT'),
|
||||
];
|
||||
$types['TTO'] = [
|
||||
'optgroup' => __('ITIL'),
|
||||
'name' => __('TTO'),
|
||||
];
|
||||
$types['MTBF'] = [
|
||||
'optgroup' => __('ITIL'),
|
||||
'name' => __('MTBF'),
|
||||
];
|
||||
$types['MTTR'] = [
|
||||
'optgroup' => __('ITIL'),
|
||||
'name' => __('MTTR'),
|
||||
];
|
||||
|
||||
$types['SLA'] = [
|
||||
'optgroup' => __('SLA'),
|
||||
'name' => __('S.L.A.'),
|
||||
|
@ -768,22 +751,34 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
'optgroup' => __('Grouped'),
|
||||
'name' => __('General'),
|
||||
];
|
||||
$types['group_report'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Group report'),
|
||||
];
|
||||
if (is_metaconsole()) {
|
||||
if ($template === false) {
|
||||
$types['group_report'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Group report'),
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$types['group_report'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Group report'),
|
||||
];
|
||||
}
|
||||
|
||||
$types['exception'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Exception'),
|
||||
];
|
||||
if ($config['metaconsole'] != 1) {
|
||||
$types['agent_module'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Agents/Modules'),
|
||||
];
|
||||
if (!$template) {
|
||||
$types['agent_module'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Agents/Modules'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Only pandora managers have access to the whole database
|
||||
// Only pandora managers have access to the whole database.
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$types['sql'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
|
@ -877,7 +872,7 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
];
|
||||
}
|
||||
|
||||
if ($config['enterprise_installed']) {
|
||||
if ($config['enterprise_installed'] && $template === false) {
|
||||
$types['event_report_log'] = [
|
||||
'optgroup' => __('Log'),
|
||||
'name' => __('Log report'),
|
||||
|
|
|
@ -39,7 +39,7 @@ if (isset($config['homedir'])) {
|
|||
|
||||
|
||||
/**
|
||||
* Transform bbcode to HTML.
|
||||
* Transform bbcode to HTML and truncate log.
|
||||
*
|
||||
* @param string $text Text.
|
||||
* @param array $allowed_tags Allowed_tags.
|
||||
|
@ -48,16 +48,22 @@ if (isset($config['homedir'])) {
|
|||
*/
|
||||
function ui_bbcode_to_html($text, $allowed_tags=['[url]'])
|
||||
{
|
||||
if (array_search('[url]', $allowed_tags) !== false) {
|
||||
// If link hasn't http, add it.
|
||||
if (preg_match('/https?:\/\//', $text)) {
|
||||
$html_bbcode = '<a target="_blank" rel="noopener noreferrer" href="$1">$2</a>';
|
||||
} else {
|
||||
$html_bbcode = '<a target="_blank" rel="noopener noreferrer" href="http://$1">$2</a>';
|
||||
}
|
||||
|
||||
if (array_search('[url]', $allowed_tags) !== false || a) {
|
||||
// Replace bbcode format [url=www.example.org] String [/url] with or without http and slashes
|
||||
$return = preg_replace('/\[url(?|](((?:https?:\/\/)?[^[]+))|(?:=[\'"]?((?:https?:\/\/)?[^]]+?)[\'"]?)](.+?))\[\/url]/', $html_bbcode, $text);
|
||||
preg_match('/\[url(?|](((?:https?:\/\/)?[^[]+))|(?:=[\'"]?((?:https?:\/\/)?[^]]+?)[\'"]?)](.+?))\[\/url]/', $text, $matches);
|
||||
if ($matches) {
|
||||
$url = $matches[1];
|
||||
// Truncate text
|
||||
$t_text = ui_print_truncate_text($matches[2]);
|
||||
// If link hasn't http, add it.
|
||||
if (preg_match('/https?:\/\//', $text)) {
|
||||
$return = '<a target="_blank" rel="noopener noreferrer" href="'.$matches[1].'">'.$t_text.'</a>';
|
||||
} else {
|
||||
$return = '<a target="_blank" rel="noopener noreferrer" href="http://'.$matches[1].'">'.$t_text.'</a>';
|
||||
}
|
||||
} else {
|
||||
$return = ui_print_truncate_text($text);
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
@ -162,6 +168,10 @@ function ui_print_truncate_text($text, $numChars=GENERIC_SIZE_TEXT, $showTextInA
|
|||
}
|
||||
|
||||
if ($showTextInAToopTip) {
|
||||
if (is_string($showTextInAToopTip)) {
|
||||
$text = ui_print_truncate_text($showTextInAToopTip, ($numChars * 2), false, true, false);
|
||||
}
|
||||
|
||||
$truncateText = $truncateText.ui_print_help_tip(htmlspecialchars($text), true);
|
||||
} else {
|
||||
if ($style !== false) {
|
||||
|
@ -2517,9 +2527,22 @@ function ui_print_module_warn_value(
|
|||
$str_warning,
|
||||
$max_critical,
|
||||
$min_critical,
|
||||
$str_critical
|
||||
$str_critical,
|
||||
$warning_inverse=0,
|
||||
$critical_inverse=0
|
||||
) {
|
||||
$data = "<span title='".__('Warning').': '.__('Max').$max_warning.'/'.__('Min').$min_warning.' - '.__('Critical').': '.__('Max').$max_critical.'/'.__('Min').$min_critical."'>";
|
||||
$war_inv = '';
|
||||
$crit_inv = '';
|
||||
|
||||
if ($warning_inverse == 1) {
|
||||
$war_inv = ' (inv)';
|
||||
}
|
||||
|
||||
if ($critical_inverse == 1) {
|
||||
$crit_inv = ' (inv)';
|
||||
}
|
||||
|
||||
$data = "<span title='".__('Warning').': '.__('Max').$max_warning.'/'.__('Min').$min_warning.$war_inv.' - '.__('Critical').': '.__('Max').$max_critical.'/'.__('Min').$min_critical.$crit_inv."'>";
|
||||
|
||||
if ($max_warning != $min_warning) {
|
||||
$data .= format_for_graph($max_warning).'/'.format_for_graph($min_warning);
|
||||
|
@ -3187,14 +3210,18 @@ function ui_print_datatable(array $parameters)
|
|||
$.fn.dataTable.ext.errMode = "none";
|
||||
$.fn.dataTable.ext.classes.sPageButton = "'.$pagination_class.'";
|
||||
dt_'.$table_id.' = $("#'.$table_id.'").DataTable({
|
||||
';
|
||||
drawCallback: function(settings) {';
|
||||
if (isset($parameters['drawCallback'])) {
|
||||
$js .= 'drawCallback: function(settings) {
|
||||
'.$parameters['drawCallback'].'
|
||||
},';
|
||||
$js .= $parameters['drawCallback'];
|
||||
}
|
||||
|
||||
$js .= '
|
||||
if (dt_'.$table_id.'.page.info().pages > 1) {
|
||||
$("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").show()
|
||||
} else {
|
||||
$("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").hide()
|
||||
}
|
||||
},
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
paging: true,
|
||||
|
@ -3206,6 +3233,8 @@ function ui_print_datatable(array $parameters)
|
|||
{
|
||||
extend: "csv",
|
||||
text : "'.__('Export current page to CSV').'",
|
||||
title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'",
|
||||
fieldSeparator: "'.$config['csv_divider'].'",
|
||||
exportOptions : {
|
||||
modifier : {
|
||||
// DataTables core
|
||||
|
@ -3299,6 +3328,7 @@ function ui_print_datatable(array $parameters)
|
|||
dt_'.$table_id.'.draw().page(0)
|
||||
});
|
||||
});
|
||||
|
||||
</script>';
|
||||
|
||||
// Order.
|
||||
|
@ -5646,3 +5676,82 @@ function ui_print_breadcrums($tab_name)
|
|||
|
||||
return $section;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show last comment
|
||||
*
|
||||
* @param array $comments array with comments
|
||||
*
|
||||
* @return string HTML string with the last comment of the events.
|
||||
*/
|
||||
function ui_print_comments($comments)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$comments = explode('<br>', $comments);
|
||||
$comments = str_replace(["\n", '
'], '<br>', $comments);
|
||||
if (is_array($comments)) {
|
||||
foreach ($comments as $comm) {
|
||||
if (empty($comm)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$comments_array[] = json_decode(io_safe_output($comm), true);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($comments_array as $comm) {
|
||||
// Show the comments more recent first.
|
||||
if (is_array($comm)) {
|
||||
$last_comment[] = array_reverse($comm);
|
||||
}
|
||||
}
|
||||
|
||||
// Only show the last comment. If commment its too long,the comment will short with ...
|
||||
// If $config['prominent_time'] is timestamp the date show Month, day, hour and minutes.
|
||||
// Else show comments hours ago
|
||||
if ($last_comment[0][0]['action'] != 'Added comment') {
|
||||
$last_comment[0][0]['comment'] = $last_comment[0][0]['action'];
|
||||
}
|
||||
|
||||
$short_comment = substr($last_comment[0][0]['comment'], 0, '80px');
|
||||
if ($config['prominent_time'] == 'timestamp') {
|
||||
$comentario = '<i>'.date($config['date_format'], $last_comment[0][0]['utimestamp']).' ('.$last_comment[0][0]['id_user'].'): '.$last_comment[0][0]['comment'].'';
|
||||
|
||||
if (strlen($comentario) > '200px') {
|
||||
$comentario = '<i>'.date($config['date_format'], $last_comment[0][0]['utimestamp']).' ('.$last_comment[0][0]['id_user'].'): '.$short_comment.'...';
|
||||
}
|
||||
} else {
|
||||
$rest_time = (time() - $last_comment[0][0]['utimestamp']);
|
||||
$time_last = (($rest_time / 60) / 60);
|
||||
$comentario = '<i>'.number_format($time_last, 0).' Hours ('.$last_comment[0][0]['id_user'].'): '.$last_comment[0][0]['comment'].'';
|
||||
|
||||
if (strlen($comentario) > '200px') {
|
||||
$comentario = '<i>'.number_format($time_last, 0).' Hours ('.$last_comment[0][0]['id_user'].'): '.$short_comment.'...';
|
||||
}
|
||||
}
|
||||
|
||||
return io_safe_output($comentario);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get complete external pandora url.
|
||||
*
|
||||
* @param string $url Url to be parsed.
|
||||
*
|
||||
* @return string Full url.
|
||||
*/
|
||||
function ui_get_full_external_url(string $url)
|
||||
{
|
||||
$url_parsed = parse_url($url);
|
||||
if ($url_parsed) {
|
||||
if (!isset($url_parsed['scheme'])) {
|
||||
$url = 'http://'.$url;
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
|
|
@ -170,17 +170,7 @@ function vbar_graph(
|
|||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
if (empty($chart_data)) {
|
||||
return html_print_image(
|
||||
$no_data_image,
|
||||
true,
|
||||
[
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'title' => __('No data to show'),
|
||||
],
|
||||
false,
|
||||
true
|
||||
);
|
||||
return graph_nodata_image($width, $height, 'vbar');
|
||||
}
|
||||
|
||||
if ($ttl == 2) {
|
||||
|
@ -357,17 +347,7 @@ function hbar_graph(
|
|||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
if (empty($chart_data)) {
|
||||
return html_print_image(
|
||||
$no_data_image,
|
||||
true,
|
||||
[
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'title' => __('No data to show'),
|
||||
],
|
||||
false,
|
||||
true
|
||||
);
|
||||
return graph_nodata_image($width, $height, 'hbar');
|
||||
}
|
||||
|
||||
if ($ttl == 2) {
|
||||
|
|
|
@ -159,10 +159,9 @@
|
|||
|
||||
if (custom_graph) {
|
||||
dataObject = retrieveDataOject(dataObjects,0);
|
||||
//dataObjects.forEach(function (element) {
|
||||
//elements.push(processDataObject(element));
|
||||
//});
|
||||
elements.push(processDataObject(dataObject));
|
||||
dataObjects.forEach(function (element) {
|
||||
elements.push(processDataObject(element));
|
||||
});
|
||||
graphData = elements;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -172,7 +172,6 @@ function pandoraFlotPieCustom(
|
|||
show: true,
|
||||
radius: 5 / 8,
|
||||
formatter: function(label, series) {
|
||||
console.log(series);
|
||||
return (
|
||||
'<div style="font-size:' +
|
||||
font_size +
|
||||
|
@ -783,9 +782,7 @@ function pandoraFlotSlicebar(
|
|||
graph_id,
|
||||
values,
|
||||
datacolor,
|
||||
labels,
|
||||
legend,
|
||||
acumulate_data,
|
||||
intervaltick,
|
||||
font,
|
||||
font_size,
|
||||
|
@ -794,12 +791,11 @@ function pandoraFlotSlicebar(
|
|||
id_agent,
|
||||
full_legend,
|
||||
not_interactive,
|
||||
show_date
|
||||
show_date,
|
||||
datelimit
|
||||
) {
|
||||
values = values.split(separator2);
|
||||
labels = labels.split(separator);
|
||||
legend = legend.split(separator);
|
||||
acumulate_data = acumulate_data.split(separator);
|
||||
datacolor = datacolor.split(separator);
|
||||
|
||||
if (full_legend != false) {
|
||||
|
@ -822,9 +818,7 @@ function pandoraFlotSlicebar(
|
|||
var serie = values[i].split(separator);
|
||||
|
||||
var aux = new Array();
|
||||
$.each(serie, function(i, v) {
|
||||
aux.push([v, i]);
|
||||
});
|
||||
aux.push([parseInt(serie[0]), 0]);
|
||||
|
||||
datas.push({
|
||||
data: aux,
|
||||
|
@ -902,18 +896,16 @@ function pandoraFlotSlicebar(
|
|||
}
|
||||
|
||||
$("#extra_" + graph_id).text(from + "-" + to);
|
||||
var extra_height = parseInt(
|
||||
$("#extra_" + graph_id)
|
||||
.css("height")
|
||||
.split("px")[0]
|
||||
);
|
||||
var extra_width = parseInt(
|
||||
$("#extra_" + graph_id)
|
||||
.css("width")
|
||||
.split("px")[0]
|
||||
);
|
||||
$("#extra_" + graph_id).css("left", pos.pageX - extra_width / 4 + "px");
|
||||
//$('#extra_'+graph_id).css('top',plot.offset().top-extra_height-5+'px');
|
||||
|
||||
$("#extra_" + graph_id).css(
|
||||
"left",
|
||||
parseInt(pos.pageX - extra_width - 200) + "px"
|
||||
);
|
||||
$("#extra_" + graph_id).show();
|
||||
}
|
||||
});
|
||||
|
@ -992,13 +984,33 @@ function pandoraFlotSlicebar(
|
|||
|
||||
// Format functions
|
||||
function xFormatter(v, axis) {
|
||||
v = new Date(1000 * v);
|
||||
date_format =
|
||||
(v.getHours() < 10 ? "0" : "") +
|
||||
v.getHours() +
|
||||
d = new Date(1000 * (v + datelimit));
|
||||
var monthNames = [
|
||||
"Jan",
|
||||
"Feb",
|
||||
"Mar",
|
||||
"Apr",
|
||||
"May",
|
||||
"Jun",
|
||||
"Jul",
|
||||
"Aug",
|
||||
"Sep",
|
||||
"Oct",
|
||||
"Nov",
|
||||
"Dec"
|
||||
];
|
||||
|
||||
var date_format =
|
||||
(d.getDate() < 10 ? "0" : "") +
|
||||
d.getDate() +
|
||||
" " +
|
||||
monthNames[d.getMonth()] +
|
||||
"<br>" +
|
||||
(d.getHours() < 10 ? "0" : "") +
|
||||
d.getHours() +
|
||||
":" +
|
||||
(v.getMinutes() < 10 ? "0" : "") +
|
||||
v.getMinutes();
|
||||
(d.getMinutes() < 10 ? "0" : "") +
|
||||
d.getMinutes();
|
||||
return date_format;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -786,6 +786,8 @@ function flot_slicesbar_graph(
|
|||
// Get a unique identifier to graph
|
||||
$graph_id = uniqid('graph_');
|
||||
|
||||
$height = ((int) $height + 15);
|
||||
|
||||
// Set some containers to legend, graph, timestamp tooltip, etc.
|
||||
if ($stat_win) {
|
||||
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width.'%; height: '.$height."px; display: inline-block;'></div>";
|
||||
|
@ -804,8 +806,6 @@ function flot_slicesbar_graph(
|
|||
$separator2 = ':,:,,,:,:';
|
||||
|
||||
// Transform data from our format to library format
|
||||
$labels = [];
|
||||
$a = [];
|
||||
$vars = [];
|
||||
|
||||
$datacolor = [];
|
||||
|
@ -819,12 +819,12 @@ function flot_slicesbar_graph(
|
|||
$fontsize = $config['font_size'];
|
||||
$fontpath = $config['fontpath'];
|
||||
|
||||
$extra_height = 15;
|
||||
$extra_height = 40;
|
||||
if (defined('METACONSOLE')) {
|
||||
$extra_height = 20;
|
||||
$extra_height = 50;
|
||||
}
|
||||
|
||||
$return .= "<div id='extra_$graph_id' style='font-size: ".$fontsize.'pt; display:none; position:absolute; overflow: auto; height: '.$extra_height."px; background:#fff; padding: 2px 2px 2px 2px; border: solid #000 1px;'></div>";
|
||||
$return .= '<div id="extra_'.$graph_id.'" class="slicebar-box-hover-styles" style="display:none; font-size:'.$fontsize.'"></div>';
|
||||
|
||||
$maxticks = (int) 20;
|
||||
|
||||
|
@ -842,11 +842,7 @@ function flot_slicesbar_graph(
|
|||
|
||||
$intervaltick = (int) $intervaltick;
|
||||
|
||||
$acumulate = 0;
|
||||
$c = 0;
|
||||
$acumulate_data = [];
|
||||
foreach ($graph_data as $label => $values) {
|
||||
$labels[] = $label;
|
||||
$i--;
|
||||
|
||||
foreach ($values as $key => $value) {
|
||||
|
@ -857,19 +853,10 @@ function flot_slicesbar_graph(
|
|||
}
|
||||
|
||||
$data[$jsvar][] = $value;
|
||||
|
||||
$acumulate_data[$c] = $acumulate;
|
||||
$acumulate += $value;
|
||||
$c++;
|
||||
|
||||
if ($value > $max) {
|
||||
$max = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store serialized data to use it from javascript
|
||||
$labels = implode($separator, $labels);
|
||||
// Store serialized data to use it from javascript.
|
||||
$datacolor = implode($separator, $datacolor);
|
||||
if (is_array($legend)) {
|
||||
$legend = io_safe_output(implode($separator, $legend));
|
||||
|
@ -881,19 +868,11 @@ function flot_slicesbar_graph(
|
|||
$full_legend_date = false;
|
||||
}
|
||||
|
||||
$acumulate_data = io_safe_output(implode($separator, $acumulate_data));
|
||||
|
||||
// Store data series in javascript format
|
||||
$jsvars = '';
|
||||
$jsseries = [];
|
||||
|
||||
$date = get_system_time();
|
||||
$datelimit = (($date - $period) * 1000);
|
||||
$datelimit = (($date - $period));
|
||||
|
||||
$i = 0;
|
||||
|
||||
$values2 = [];
|
||||
|
||||
foreach ($data as $jsvar => $values) {
|
||||
$values2[] = implode($separator, $values);
|
||||
$i ++;
|
||||
|
@ -901,10 +880,10 @@ function flot_slicesbar_graph(
|
|||
|
||||
$values = implode($separator2, $values2);
|
||||
|
||||
// Javascript code
|
||||
// Javascript code.
|
||||
$return .= "<script type='text/javascript'>";
|
||||
$return .= "//<![CDATA[\n";
|
||||
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$labels','$legend','$acumulate_data',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive, '$show')";
|
||||
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$legend',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive, '$show', $datelimit)";
|
||||
$return .= "\n//]]>";
|
||||
$return .= '</script>';
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ Besides the defined module macros, the following macros are available:
|
|||
<li>_policy_: Name of the policy that the module belongs to (if applies).</li>
|
||||
<li>_prevdata_: Module previous data before the alert has been triggered.</li>
|
||||
<li>_rca_: Root cause analysis chain (only for services).</li>
|
||||
<li>_secondarygroups_: List of all secondary groups of the agent.</li>
|
||||
<li>_server_ip_: Ip of server assigned to agent. </li>
|
||||
<li>_server_name_: Name of server assigned to agent. </li>
|
||||
<li>_target_ip_: IP address for the module’s target.</li>
|
||||
|
|
|
@ -77,6 +77,7 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
|
|||
<li>_policy_: Nombre de la política a la que pertenece el módulo (si aplica).</li>
|
||||
<li>_prevdata_: Dato previo antes de disparase la alerta.</li>
|
||||
<li>_rca_: Cadena de análasis de causa raíz (sólo para servicios).</li>
|
||||
<li>_secondarygroups_: Lista de todos los grupos secundarios del agente.</li>
|
||||
<li>_server_ip_: Ip del servidor al que el agente está asignado. </li>
|
||||
<li>_server_name_: Nombre del servidor al que el agente está asignado. </li>
|
||||
<li>_target_ip_: Dirección IP del objetivo del módulo.</li>
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
<li>_policy_ : モジュールが属するポリシー名 (存在する場合)</li>
|
||||
<li>_prevdata_ : アラートを発報する前のモジュールデータ</li>
|
||||
<li>_rca_: Root cause analysis chain (only for services).</li>
|
||||
<li>_secondarygroups_: エージェントのすべてのセカンダリグループのリスト</li>
|
||||
<li>_server_ip_ : エージェントが割り当てられているサーバ IP。</li>
|
||||
<li>_server_name_ : エージェントが割り当てられているサーバ名。 </li>
|
||||
<li>_target_ip_ : モジュールの対象IPアドレス</li>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
/* global holding_area_dimensions */
|
||||
/* global networkmap_id */
|
||||
/* global enterprise_installed */
|
||||
/* global networkmap_write */
|
||||
/* global force */
|
||||
/* global layer_graph_nodes */
|
||||
/* global layer_graph_links */
|
||||
|
@ -2087,7 +2088,12 @@ function show_menu(item, data) {
|
|||
icon: "add_node",
|
||||
disabled: function() {
|
||||
if (enterprise_installed) {
|
||||
return false;
|
||||
// Check if user can write network maps.
|
||||
if (networkmap_write) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
@ -2099,6 +2105,14 @@ function show_menu(item, data) {
|
|||
items_list["center"] = {
|
||||
name: set_center_menu,
|
||||
icon: "center",
|
||||
disabled: function() {
|
||||
// Check if user can write network maps.
|
||||
if (networkmap_write) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
callback: function(key, options) {
|
||||
set_center(networkmap_id);
|
||||
}
|
||||
|
@ -2136,7 +2150,12 @@ function show_menu(item, data) {
|
|||
icon: "restart_map",
|
||||
disabled: function() {
|
||||
if (enterprise_installed) {
|
||||
return false;
|
||||
// Check if user can write network maps.
|
||||
if (networkmap_write) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -87,9 +87,9 @@ function js_refreshParentLines(layerName) {
|
|||
{
|
||||
strokeWidth: 2,
|
||||
fillOpacity: 0.2,
|
||||
fillColor: "red",
|
||||
fillColor: "black",
|
||||
strokeDashstyle: "dash",
|
||||
strokeColor: "red"
|
||||
strokeColor: "black"
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -63,6 +63,20 @@ function show_event_dialog(event, dialog_page, result) {
|
|||
height: 600
|
||||
})
|
||||
.show();
|
||||
$.post({
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: "include/ajax/events",
|
||||
get_comments: 1,
|
||||
event: event,
|
||||
filter: values
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#extended_event_comments_page").empty();
|
||||
$("#extended_event_comments_page").html(data);
|
||||
}
|
||||
});
|
||||
|
||||
$("#refrcounter").countdown("pause");
|
||||
$("div.vc-countdown").countdown("pause");
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP script to manage Pandora FMS websockets.
|
||||
*
|
||||
* @category Websocket
|
||||
* @package Pandora FMS
|
||||
* @subpackage Console
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 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 General Public License
|
||||
* as published by the Free Software Foundation for 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
namespace PandoraFMS;
|
||||
|
||||
/**
|
||||
* Object user.
|
||||
*/
|
||||
class User
|
||||
{
|
||||
|
||||
/**
|
||||
* Current 'id_usuario'.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $idUser;
|
||||
|
||||
/**
|
||||
* Current PHP session ids.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $sessions = [];
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a user object.
|
||||
*
|
||||
* @param array $data User information
|
||||
* - Username
|
||||
* - PHP session ID.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Unset user.
|
||||
unset($config['id_usuario']);
|
||||
unset($_SESSION['id_usuario']);
|
||||
|
||||
if (is_array($data) === true) {
|
||||
if (isset($data['phpsessionid']) === true) {
|
||||
$this->sessions[$data['phpsessionid']] = 1;
|
||||
$info = \db_get_row_filter(
|
||||
'tsessions_php',
|
||||
['id_session' => $data['phpsessionid']]
|
||||
);
|
||||
|
||||
if ($info !== false) {
|
||||
// Process.
|
||||
$session_data = session_decode($info['data']);
|
||||
$this->idUser = $_SESSION['id_usuario'];
|
||||
|
||||
// Valid session.
|
||||
return $this;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isset($data['id_usuario']) === true
|
||||
&& isset($data['password']) === true
|
||||
) {
|
||||
$user_in_db = process_user_login($user, $password, true);
|
||||
if ($user_in_db !== false) {
|
||||
$config['id_usuario'] = $user_in_db;
|
||||
$correctLogin = true;
|
||||
|
||||
// Originally at api.php.
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
$_SESSION['id_usuario'] = $user;
|
||||
session_write_close();
|
||||
|
||||
$this->idUser = $data['id_usuario'];
|
||||
// Valid session.
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue