Merge remote-tracking branch 'origin/develop' into ent-3178-integrar-terminal-web-en-la-consola-de-pandora-y-explorar-otras-utilidades-anyterm-replace

This commit is contained in:
fbsanchez 2019-10-28 12:59:02 +01:00
commit e12bcb2ac4
66 changed files with 3860 additions and 1740 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
# ==================

View File

@ -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

View File

@ -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
# ==================

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
# ==================

View File

@ -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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.739-191022
Version: 7.0NG.740
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

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

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.739
%define release 191022
%define version 7.0NG.740
%define release 1
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.739
%define release 191022
%define version 7.0NG.740
%define release 1
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas
# Version 7.0NG.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

View File

@ -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
{191022}
{191028}
ViewReadme
{Yes}
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
{No}
Windows,Executable
{<%AppName%>-<%Version%>-Setup<%Ext%>}
{<%AppName%>-Setup<%Ext%>}
Windows,FileDescription
{<%AppName%> <%Version%> Setup}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.739(Build 191022)")
#define PANDORA_VERSION ("7.0NG.740(Build 191028)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.739(Build 191022))"
VALUE "ProductVersion", "(7.0NG.740(Build 191028))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.739-191022
Version: 7.0NG.740
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -240,7 +240,7 @@ switch ($action) {
$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':

View File

@ -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'];
@ -522,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();
}

View File

@ -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,7 +58,13 @@ $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 = '';
@ -52,7 +75,7 @@ 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
// Don't change the format, it is parsed by applications.
if ($info == 'version') {
if (!$config['MR']) {
$config['MR'] = 0;
@ -73,6 +96,7 @@ if (isInACL($ipOrigin)) {
if (session_status() === PHP_SESSION_NONE) {
session_start();
$_SESSION = [];
}
$_SESSION['id_usuario'] = $user;
@ -86,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) {
@ -95,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;
}
@ -109,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;
@ -129,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;
@ -143,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);
@ -207,23 +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.
session_destroy();
header_remove('Set-Cookie');
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
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), '/');
}

View File

@ -1,16 +1,32 @@
<?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
/**
* 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 __DIR__.'/config.php';
@ -26,6 +42,29 @@ require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_tags.php';
/**
* 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;
@ -48,17 +87,7 @@ if (check_login(false) === false) {
</head>
<body>
<h1>Access is not granted</h1>
<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 echoPhantomCallback(); ?>
</body>
</html>
@ -76,11 +105,18 @@ if ($config['metaconsole'] && !empty($server_id)) {
$server = metaconsole_get_connection_by_id($server_id);
// 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;
}
}
@ -125,16 +161,18 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
<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) {
@ -253,20 +291,7 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
}
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>

View File

@ -20,8 +20,8 @@
/**
* Pandora build version and version
*/
$build_version = 'PC191022';
$pandora_version = 'v7.0NG.739';
$build_version = 'PC191028';
$pandora_version = 'v7.0NG.740';
// Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get();

File diff suppressed because it is too large Load Diff

View File

@ -3595,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 {
@ -3609,22 +3634,9 @@ function graph_custom_sql_graph(
$sql = io_safe_output($sql['sql']);
}
if (($config['metaconsole'] == 1) && defined('METACONSOLE') && $report_content['server_name'] != '' && $report_content['server_name'] != '0') {
$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') && $report_content['server_name'] != '' && $report_content['server_name'] != '0') {
if (is_metaconsole()) {
enterprise_hook('metaconsole_restore_db');
}

View File

@ -282,6 +282,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 +303,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']
);
@ -2824,13 +2825,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'];
@ -3488,7 +3488,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) {
@ -3505,7 +3505,8 @@ function reporting_network_interfaces_report($report, $content, $type='dinamic',
$content,
$report,
$fullscale,
$pdf
$pdf,
$id_meta
);
metaconsole_restore_db();
}

View File

@ -769,10 +769,20 @@ 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'),
@ -880,7 +890,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'),

View File

@ -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) {

View File

@ -87,9 +87,9 @@ function js_refreshParentLines(layerName) {
{
strokeWidth: 2,
fillOpacity: 0.2,
fillColor: "red",
fillColor: "black",
strokeDashstyle: "dash",
strokeColor: "red"
strokeColor: "black"
}
);

View File

@ -161,7 +161,7 @@ function pandora_session_gc($max_lifetime=300)
if (isset($config['session_timeout'])) {
$session_timeout = $config['session_timeout'];
} else {
// if $config doesn`t work ...
// If $config doesn`t work ...
$session_timeout = db_get_value(
'value',
'tconfig',
@ -170,9 +170,9 @@ function pandora_session_gc($max_lifetime=300)
);
}
if (!empty($session_timeout)) {
if (empty($session_timeout) === false) {
if ($session_timeout == -1) {
// The session expires in 10 years
// The session expires in 10 years.
$session_timeout = 315576000;
} else {
$session_timeout *= 60;
@ -191,15 +191,14 @@ function pandora_session_gc($max_lifetime=300)
);
// Deleting cron and empty sessions.
$sql = "DELETE FROM tsessions_php WHERE
data IS NULL OR id_session REGEXP '^cron-'";
$sql = 'DELETE FROM tsessions_php WHERE data IS NULL';
db_process_sql($sql);
return $retval;
}
// FIXME: SAML should work with pandora session handlers
// TODO: SAML should work with pandora session handlers.
if (db_get_value('value', 'tconfig', 'token', 'auth') != 'saml') {
$result_handler = session_set_save_handler(
'pandora_session_open',

View File

@ -50,6 +50,29 @@ if (type_graph_pdf == "combined") {
var page = require("webpage").create();
page.onResourceError = function(resourceError) {
console.log(
"Unable to load resource (#" +
resourceError.id +
"URL:" +
resourceError.url +
")"
);
console.log(
"Error code: " +
resourceError.errorCode +
". Description: " +
resourceError.errorString
);
phantom.exit(1);
};
// Not supposed to be prompted messages.
page.onPrompt = function() {
console.log("Prompt message detected.");
phantom.exit(1);
};
page.viewportSize = {
width: viewport_width,
height: viewport_height
@ -84,3 +107,21 @@ page.open(url, "POST", post_data, function(status) {
phantom.exit();
}
});
phantom.onError = function(msg, trace) {
var msgStack = ["PHANTOM ERROR: " + msg];
if (trace && trace.length) {
msgStack.push("TRACE:");
trace.forEach(function(t) {
msgStack.push(
" -> " +
(t.file || t.sourceURL) +
": " +
t.line +
(t.function ? " (in function " + t.function + ")" : "")
);
});
}
console.log(msgStack.join("\n"));
phantom.exit(1);
};

View File

@ -128,8 +128,8 @@
</div>
<div style='height: 10px'>
<?php
$version = '7.0NG.739';
$build = '191022';
$version = '7.0NG.740';
$build = '191028';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.739
%define release 191022
%define version 7.0NG.740
%define release 1
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.739
%define release 191022
%define version 7.0NG.740
%define release 1
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.739
%define release 191022
%define version 7.0NG.740
%define release 1
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

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

View File

@ -112,7 +112,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('MR', 32),
('identification_reminder', 1),
('identification_reminder_timestamp', 0),
('current_package_enterprise', '739'),
('current_package_enterprise', '740'),
('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.0009765625":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}'),
('custom_docs_logo', 'default_docs.png'),
('custom_support_logo', 'default_support.png'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.739-191022
Version: 7.0NG.740
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

@ -44,8 +44,8 @@ our @EXPORT = qw(
);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.739";
my $pandora_build = "191022";
my $pandora_version = "7.0NG.740";
my $pandora_build = "191028";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -3258,7 +3258,7 @@ sub pandora_create_agent ($$$$$$$$$$;$$$$$$$$$$) {
'custom_id' => $custom_id,
'url_address' => $url_address,
'timezone_offset' => $timezone_offset,
'alias' => $alias,
'alias' => safe_input($alias),
'update_module_count' => 1, # Force to replicate in metaconsole
});

View File

@ -57,6 +57,7 @@ our @EXPORT = qw(
get_addr_id
get_agent_addr_id
get_agent_id
get_agent_ids_from_alias
get_agent_address
get_agent_alias
get_agent_group
@ -232,6 +233,17 @@ sub get_agent_id ($$) {
return defined ($rc) ? $rc : -1;
}
########################################################################
## Return agent IDs given an agent alias.
########################################################################
sub get_agent_ids_from_alias ($$) {
my ($dbh, $agent_alias) = @_;
my @rc = get_db_rows ($dbh, "SELECT id_agente, nombre FROM tagente WHERE alias = ?", safe_input($agent_alias));
return @rc;
}
########################################################################
## Return server ID given the name of server.
########################################################################
@ -956,7 +968,7 @@ sub db_process_insert($$$$;@) {
}
}
my $columns_string = join(',', @columns_array);
my $res = db_insert ($dbh,
$index,
"INSERT INTO $table ($columns_string) VALUES " . $wildcards, @values_array);

View File

@ -31,8 +31,8 @@ use base 'Exporter';
our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.739";
my $pandora_build = "191022";
my $pandora_version = "7.0NG.740";
my $pandora_build = "191028";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -141,6 +141,7 @@ our @EXPORT = qw(
long_to_ip
ip_to_long
get_enabled_servers
dateTimeToTimestamp
);
# ID of the different servers

View File

@ -2,8 +2,8 @@
# Pandora FMS Server
#
%define name pandorafms_server
%define version 7.0NG.739
%define release 191022
%define version 7.0NG.740
%define release 1
Summary: Pandora FMS Server
Name: %{name}

View File

@ -2,8 +2,8 @@
# Pandora FMS Server
#
%define name pandorafms_server
%define version 7.0NG.739
%define release 191022
%define version 7.0NG.740
%define release 1
Summary: Pandora FMS Server
Name: %{name}

View File

@ -8,8 +8,8 @@
# This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.739"
PI_BUILD="191022"
PI_VERSION="7.0NG.740"
PI_BUILD="191028"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.739 PS191022";
my $version = "7.0NG.740 PS191028";
# Pandora server configuration
my %conf;

File diff suppressed because it is too large Load Diff