Merge remote-tracking branch 'origin/master' into ent-7938-bug-visual-en-item-odometro-cv

This commit is contained in:
marcos 2021-10-04 11:56:08 +02:00
commit 30bf0ee163
80 changed files with 27045 additions and 23056 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.756
# Version 7.0NG.757
# 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
# Foundation; either version 2 of the Licence or any later version

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.756, AIX version
# Version 7.0NG.757, 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.756
# Version 7.0NG.757
# 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.756, HPUX Version
# Version 7.0NG.757, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756
# Version 7.0NG.757
# Licensed under GPL license v2,
# (c) 2003-2021 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.756
# Version 7.0NG.757
# Licensed under GPL license v2,
# (c) 2003-2021 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.756
# Version 7.0NG.757
# 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.756, Solaris version
# Version 7.0NG.757, Solaris version
# General Parameters
# ==================

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.756-210902
Version: 7.0NG.757-210915
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.756-210902"
pandora_version="7.0NG.757-210915"
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

@ -31,7 +31,7 @@ fi
if [ "$#" -ge 2 ]; then
VERSION="$2"
else
VERSION="7.0NG.756"
VERSION="7.0NG.757"
fi
# Path for the generated DMG file

View File

@ -19,11 +19,11 @@
<choice id="com.pandorafms.pandorafms_src" visible="false">
<pkg-ref id="com.pandorafms.pandorafms_src"/>
</choice>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.756" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.757" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
</choice>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.756" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.757" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<!-- <installation-check script="check()" />
<script>
<![CDATA[

View File

@ -5,9 +5,9 @@
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
<key>CFBundleVersion</key> <string>7.0NG.756</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.756 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.756</string>
<key>CFBundleVersion</key> <string>7.0NG.757</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.757 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.757</string>
<key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.756
# Version 7.0NG.757
# 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
# Foundation; either version 2 of the Licence or any later version

View File

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

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.756 Build 210902")
#define PANDORA_VERSION ("7.0NG.757 Build 210915")
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.756(Build 210902))"
VALUE "ProductVersion", "(7.0NG.757(Build 210915))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.756-210902
Version: 7.0NG.757-210915
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.756-210902"
pandora_version="7.0NG.757-210915"
package_pear=0
package_pandora=1

View File

@ -1,7 +1,5 @@
START TRANSACTION;
ALTER TABLE `tevento` MODIFY `data` TINYTEXT default NULL;
ALTER TABLE `tmetaconsole_event` MODIFY `data` TINYTEXT default NULL;
ALTER TABLE `tmetaconsole_setup` ADD COLUMN `unified` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `tlayout` ADD COLUMN `auto_adjust` INTEGER UNSIGNED NOT NULL default 0;
ALTER TABLE `tlayout_data` ADD COLUMN `title` TEXT default '';

View File

@ -1,5 +1,7 @@
START TRANSACTION;
ALTER TABLE `tevento` MODIFY `data` TINYTEXT default NULL;
ALTER TABLE `tmetaconsole_event` MODIFY `data` TINYTEXT default NULL;
UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'custom_report_front_font';
UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'fontpath';
UPDATE `tlanguage` SET `name` = 'Deutsch' WHERE `id_language` = 'de';

View File

@ -1441,13 +1441,13 @@ ALTER TABLE `ttag` MODIFY COLUMN `name` text NOT NULL default '';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 48);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 49);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 756);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 757);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';

View File

@ -2095,7 +2095,7 @@ if ($delete_module) {
exit;
}
// Also call base function to delete modules madafakas de los cojones.
// Also call base function to delete modules.
modules_delete_agent_module($id_borrar_modulo);
// Check for errors.

View File

@ -443,6 +443,13 @@ $data[1] = html_print_input_text_extended(
$largeClassDisabledBecauseInPolicy,
true
);
$data[1] .= ui_print_help_tip(
__(
'Please use single quotation marks when necessary. '."\n".'
If double quotation marks are needed, please escape them with a backslash (\&quot;)'
),
true
);
$table_simple->colspan['row-cmd-row-1'][1] = 3;
push_table_simple($data, 'row-cmd-row-1');

View File

@ -219,34 +219,15 @@ if ($filemanager) {
$id_plugin = (int) get_parameter('id_plugin', 0);
// Add custom directories here
// Add custom directories here.
$fallback_directory = 'attachment/plugin';
$directory = (string) get_parameter('directory', $fallback_directory);
$directory = str_replace('\\', '/', $directory);
// A miminal security check to avoid directory traversal
if (preg_match('/\.\./', $directory)) {
$directory = $fallback_directory;
}
if (preg_match('/^\//', $directory)) {
$directory = $fallback_directory;
}
if (preg_match('/^manager/', $directory)) {
$directory = $fallback_directory;
}
$banned_directories['include'] = true;
$banned_directories['godmode'] = true;
$banned_directories['operation'] = true;
$banned_directories['reporting'] = true;
$banned_directories['general'] = true;
$banned_directories[ENTERPRISE_DIR] = true;
if (isset($banned_directories[$directory])) {
// Get directory.
$directory = (string) get_parameter('directory');
if (empty($directory) === true) {
$directory = $fallback_directory;
} else {
$directory = str_replace('\\', '/', $directory);
$directory = filemanager_safe_directory($directory, $fallback_directory);
}
$real_directory = realpath($config['homedir'].'/'.$directory);
@ -263,12 +244,12 @@ if ($filemanager) {
$default_real_directory = realpath($config['homedir'].'/'.$fallback_directory);
if ($upload_file_or_zip) {
upload_file($upload_file_or_zip, $default_real_directory);
if ($upload_file_or_zip === true) {
upload_file($upload_file_or_zip, $default_real_directory, $real_directory);
}
if ($create_text_file) {
create_text_file($default_real_directory);
if ($create_text_file === true) {
create_text_file($default_real_directory, $real_directory);
}
filemanager_file_explorer(

View File

@ -58,18 +58,6 @@ if (empty($directory) === true) {
$directory = filemanager_safe_directory($directory, $fallback_directory);
}
// Banned directories.
$banned_directories['include'] = true;
$banned_directories['godmode'] = true;
$banned_directories['operation'] = true;
$banned_directories['reporting'] = true;
$banned_directories['general'] = true;
$banned_directories[ENTERPRISE_DIR] = true;
if (isset($banned_directories[$directory]) === true) {
$directory = $fallback_directory;
}
$real_directory = realpath($config['homedir'].'/'.$directory);
echo '<h4>'.__('Index of %s', $directory).'</h4>';
@ -80,11 +68,11 @@ $create_text_file = (bool) get_parameter('create_text_file');
$default_real_directory = realpath($config['homedir'].'/');
if ($upload_file_or_zip === true) {
upload_file($upload_file_or_zip, $default_real_directory);
upload_file($upload_file_or_zip, $default_real_directory, $real_directory);
}
if ($create_text_file === true) {
create_text_file($default_real_directory);
create_text_file($default_real_directory, $real_directory);
}
filemanager_file_explorer(

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

View File

@ -105,19 +105,19 @@ if ($info == 'version') {
if (empty($apiPassword) === true
|| (empty($apiPassword) === false && $api_password === $apiPassword)
&& (enterprise_hook('metaconsole_validate_origin', [get_parameter('server_auth')]) === true
|| enterprise_hook('console_validate_origin', [get_parameter('server_auth')]) === true)
) {
// Allow internal direct node -> metaconsole connection
// or node -> own console connection.
$config['__internal_call'] = true;
$config['id_usuario'] = 'admin';
// Compat.
$config['id_user'] = 'admin';
$correctLogin = true;
} else if ((bool) isInACL($ipOrigin) === true) {
// External access.
if (empty($apiPassword) === true || (empty($apiPassword) === false && $api_password === $apiPassword)) {
if (enterprise_hook('metaconsole_validate_origin', [get_parameter('server_auth')]) === true
|| enterprise_hook('console_validate_origin', [get_parameter('server_auth')]) === true
) {
// Allow internal direct node -> metaconsole connection
// or node -> own console connection.
$config['__internal_call'] = true;
$config['id_usuario'] = 'admin';
// Compat.
$config['id_user'] = 'admin';
$correctLogin = true;
} else if ((bool) isInACL($ipOrigin) === true) {
// External access.
$user_in_db = process_user_login($user, $password, true);
if ($user_in_db !== false) {
$config['id_usuario'] = $user_in_db;
@ -138,10 +138,10 @@ if (empty($apiPassword) === true
$no_login_msg = 'Incorrect user credentials';
}
} else {
$no_login_msg = 'Incorrect given API password';
$no_login_msg = 'IP '.$ipOrigin.' is not in ACL list';
}
} else {
$no_login_msg = 'IP '.$ipOrigin.' is not in ACL list';
$no_login_msg = 'Incorrect given API password';
}
if ($correctLogin) {

View File

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

View File

@ -128,15 +128,16 @@ require_once $config['homedir'].'/vendor/autoload.php';
*
* @param boolean $upload_file_or_zip Upload file or zip.
* @param string $default_real_directory String with default directory.
* @param string $destination_directory String with destination directory.
*
* @return void
*/
function upload_file($upload_file_or_zip, $default_real_directory)
function upload_file($upload_file_or_zip, $default_real_directory, $destination_directory)
{
global $config;
$config['filemanager'] = [];
$config['filemanager']['correct_upload_file'] = 0;
$config['filemanager']['message'] = null;
$config['filemanager']['message'] = '';
check_login();
@ -164,7 +165,7 @@ function upload_file($upload_file_or_zip, $default_real_directory)
if ($upload_file === true) {
if (isset($_FILES['file']) === true && empty($_FILES['file']['name']) === false) {
$filename = $_FILES['file']['name'];
$real_directory = filemanager_safe_directory((string) get_parameter('real_directory'));
$real_directory = filemanager_safe_directory($destination_directory);
$umask = io_safe_output((string) get_parameter('umask'));
if (strpos($real_directory, $default_real_directory) !== 0) {
@ -173,23 +174,34 @@ function upload_file($upload_file_or_zip, $default_real_directory)
// user is not trying to access an external path (avoid
// execution of PHP files in directories that are not explicitly
// controlled by corresponding .htaccess).
ui_print_error_message(__('Security error'));
$config['filemanager']['message'] = ui_print_error_message(__('Security error'));
} else {
// Copy file to directory and change name.
$nombre_archivo = $real_directory.'/'.$filename;
$nombre_archivo = sprintf('%s/%s', $real_directory, $filename);
if (! @copy($_FILES['file']['tmp_name'], $nombre_archivo)) {
$config['filemanager']['message'] = ui_print_error_message(__('Upload error'));
} else {
try {
$result = copy($_FILES['file']['tmp_name'], $nombre_archivo);
} catch (Exception $ex) {
$result = false;
}
if ($result === true) {
// If umask is provided, set.
if (empty($umask) === false) {
chmod($nombre_archivo, $umask);
try {
chmod($nombre_archivo, $umask);
} catch (Exception $ex) {
$config['filemanager']['message'] = ui_print_error_message(__('Issue setting umask: %s', $ex->getMessage()));
}
}
// Upload performed properly.
$config['filemanager']['message'] .= ui_print_success_message(__('Upload correct'));
$config['filemanager']['correct_upload_file'] = 1;
ui_print_success_message(__('Upload correct'));
// Delete temporal file.
unlink($_FILES['file']['tmp_name']);
} else {
$config['filemanager']['message'] = ui_print_error_message(__('Upload error'));
}
}
}
@ -202,7 +214,7 @@ function upload_file($upload_file_or_zip, $default_real_directory)
) {
$filename = $_FILES['file']['name'];
$filepath = $_FILES['file']['tmp_name'];
$real_directory = filemanager_safe_directory((string) get_parameter('real_directory'));
$real_directory = filemanager_safe_directory($destination_directory);
if (strpos($real_directory, $default_real_directory) !== 0) {
// Perform security check to determine whether received upload
@ -213,10 +225,10 @@ function upload_file($upload_file_or_zip, $default_real_directory)
ui_print_error_message(__('Security error'));
} else {
if (PandoraFMS\Tools\Files::unzip($filepath, $real_directory) === false) {
ui_print_error_message(__('It was impossible to uncompress your file'));
$config['filemanager']['message'] = ui_print_error_message(__('It was impossible to uncompress your file'));
} else {
unlink($_FILES['file']['tmp_name']);
ui_print_success_message(__('Upload correct'));
$config['filemanager']['message'] = ui_print_success_message(__('Upload correct'));
$config['filemanager']['correct_upload_file'] = 1;
}
}
@ -234,7 +246,7 @@ if (isset($_SERVER['CONTENT_LENGTH']) === true) {
}
function create_text_file($default_real_directory)
function create_text_file($default_real_directory, $destination_directory)
{
global $config;
@ -253,7 +265,7 @@ function create_text_file($default_real_directory)
$filename = filemanager_safe_directory((string) get_parameter('name_file'));
if (empty($filename) === false) {
$real_directory = filemanager_safe_directory((string) get_parameter('real_directory'));
$real_directory = filemanager_safe_directory($destination_directory);
$umask = (string) get_parameter('umask');
if (strpos($real_directory, $default_real_directory) !== 0) {
@ -980,6 +992,15 @@ function filemanager_safe_directory(
// Safe output.
$directory = io_safe_output($directory);
$forbiddenAttempting = false;
// Banned directories.
$bannedDirectory = [
'include',
'godmode',
'operation',
'reporting',
'general',
ENTERPRISE_DIR,
];
if ((bool) preg_match('/(\.){2}/', $directory) !== false) {
$directory = preg_replace('/(\.){2}/', '', (empty($safedDirectory) === true) ? $directory : $safedDirectory);
@ -991,6 +1012,12 @@ function filemanager_safe_directory(
$forbiddenAttempting = true;
}
if (in_array($directory, $bannedDirectory) === true) {
// Setted images for default (usually in file manager).
$directory = (empty($safedDirectory) === false) ? $safedDirectory : 'images';
$forbiddenAttempting = true;
}
if ($forbiddenAttempting === true) {
db_pandora_audit('File manager', 'Attempting to use a forbidden file or directory name');
}

View File

@ -4334,14 +4334,6 @@ function reporting_html_general($table, $item, $pdf=0)
$table1->style[2] = 'text-align: center';
$table1->style[3] = 'text-align: center';
// Begin - Order by agent.
foreach ($item['data'] as $key => $row) {
$aux[$key] = $row['agent'];
}
array_multisort($aux, SORT_ASC, $item['data']);
// End - Order by agent.
foreach ($item['data'] as $row) {
if ($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) {
$row['formated_value'] = round($row['formated_value'], 0, PHP_ROUND_HALF_DOWN);

View File

@ -1041,7 +1041,7 @@ function ui_format_alert_row(
$styleDisabled = '';
}
if (empty($alert)) {
if (empty($alert) === true) {
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
return [
'',
@ -1066,7 +1066,7 @@ function ui_format_alert_row(
}
}
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$server = db_get_row('tmetaconsole_setup', 'id', $alert['server_data']['id']);
if (metaconsole_connect($server) == NOERR) {
@ -1087,7 +1087,7 @@ function ui_format_alert_row(
$data = [];
// Validate checkbox.
if (!defined('METACONSOLE')) {
if (is_metaconsole() === false) {
if (check_acl($config['id_user'], $id_group, 'LW')
|| check_acl($config['id_user'], $id_group, 'LM')
) {
@ -1106,7 +1106,7 @@ function ui_format_alert_row(
}
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if (is_metaconsole()) {
if (is_metaconsole() === true && (int) $alert['server_data']['id'] !== 0) {
$node = metaconsole_get_connection_by_id($alert['server_data']['id']);
if (metaconsole_load_external_db($node) !== NOERR) {
// Restore the default connection.
@ -1121,14 +1121,14 @@ function ui_format_alert_row(
$data[$index['policy']] = '';
} else {
$img = 'images/policies_mc.png';
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
$data[$index['policy']] = '<a href="?sec=gmodules&amp;sec2=enterprise/godmode/policies/policies&amp;id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
} else {
$data[$index['policy']] = '<a href="?sec=gmodules&amp;sec2=advanced/policymanager&amp;id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
}
}
if (is_metaconsole()) {
if (is_metaconsole() === true) {
metaconsole_restore_db();
}
}
@ -1139,7 +1139,7 @@ function ui_format_alert_row(
$data[$index['standby']] = html_print_image('images/bell_pause.png', true, ['title' => __('Standby on')]);
}
if (!defined('METACONSOLE')) {
if (is_metaconsole() === false) {
// Force alert execution.
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
if ($alert['force_execution'] == 0) {
@ -1154,7 +1154,7 @@ function ui_format_alert_row(
if ($agent == 0) {
$data[$index['module_name']] .= ui_print_truncate_text(isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name($alert['id_agent_module']), 'module_small', false, true, true, '[&hellip;]', '');
} else {
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$agent_name = $alert['agent_name'];
$id_agent = $alert['id_agent'];
} else {
@ -1162,7 +1162,7 @@ function ui_format_alert_row(
$id_agent = modules_get_agentmodule_agent($alert['id_agent_module']);
}
if (defined('METACONSOLE') || !can_user_access_node()) {
if (is_metaconsole() === true || !can_user_access_node()) {
$data[$index['agent_name']] = ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[&hellip;]', '');
} else {
if ($agent_style !== false) {
@ -1179,7 +1179,7 @@ function ui_format_alert_row(
$data[$index['description']] = '';
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$data[$index['template']] .= '<a class="template_details" href="'.ui_get_full_url('/', false, false, false).'/ajax.php?page=enterprise/meta/include/ajax/tree_view.ajax&action=get_template_tooltip&id_template='.$template['id'].'&server_name='.$alert['server_data']['server_name'].'">';
} else {
$data[$index['template']] .= '<a class="template_details" href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$template['id'].'">';
@ -1196,7 +1196,7 @@ function ui_format_alert_row(
$actions = alerts_get_alert_agent_module_actions($alert['id'], false, $alert['server_data']['id']);
if (!empty($actions)) {
if (empty($actions) === false) {
$actionText = '<div><ul class="action_list">';
foreach ($actions as $action) {
$actionText .= '<div class="mrgn_btn_5px" ><span class="action_name"><li>'.$action['name'];

View File

@ -66,16 +66,26 @@ function snmpBrowse() {
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$("#spinner").css("display", "none");
$("#snmp_browser").html(
"<p>Status: " +
var htmlError = "";
if (XMLHttpRequest.responseText) {
htmlError =
"<p><b>Status:</b> " +
textStatus +
"</p><p>" +
"Error: " +
errorThrown +
"</p><p>" +
XMLHttpRequest.responseText +
"</p>"
);
"</p>";
} else {
htmlError =
"<p><b>Status:</b> " +
textStatus +
"</p><p>" +
"<b>Error:</b> " +
errorThrown +
"</p>";
}
$("#snmp_browser").html(htmlError);
}
});
}

File diff suppressed because it is too large Load Diff

View File

@ -613,6 +613,8 @@ class EventsListWidget extends Widget
'tg.nombre as group_name',
];
$home_url = $config['homeurl'];
if ((bool) \is_metaconsole() === false
|| $this->nodeId > 0
) {
@ -676,6 +678,14 @@ class EventsListWidget extends Widget
$table->size = [];
$table->rowclass = [];
// If its node, get direccion value and construct rute.
if ($this->nodeId !== null && $this->nodeId > 0) {
metaconsole_restore_db();
$result = db_get_all_rows_sql('SELECT server_url FROM tmetaconsole_setup WHERE id = '.$this->nodeId.'');
$home_url = $result[0]['server_url'];
metaconsole_connect(null, $this->nodeId);
}
foreach ($events as $event) {
$data = [];
$event['evento'] = \io_safe_output($event['evento']);
@ -684,8 +694,8 @@ class EventsListWidget extends Widget
$agent_alias = \agents_get_alias($event['id_agente']);
if ($agent_alias !== '') {
$data[1] = '<a href="'.$config['homeurl'];
$data[1] .= 'index.php?sec=estado';
$data[1] = '<a href="'.$home_url;
$data[1] .= '/index.php?sec=estado';
$data[1] .= '&sec2=operation/agentes/ver_agente';
$data[1] .= '&id_agente='.$event['id_agente'];
$data[1] .= '" title="'.$event['evento'].'">';

View File

@ -170,11 +170,12 @@ div#rules::after {
position: relative;
display: block;
margin: 2em auto;
font-size: 3em;
font-size: 2.5em;
color: #aaa;
overflow: hidden;
background: #fff;
text-align: center;
height: 100px;
}
div#rules.cleanup::after {
content: none;

View File

@ -1,5 +1,6 @@
/**
*
* Name: Default theme
* Pandora Stylesheet
*
* @category Stylesheet
@ -950,7 +951,7 @@ input.sub {
border-radius: 5px;
background-color: #fff;
background-repeat: no-repeat;
background-position: 92% 10px;
background-position: 92% 13px;
color: #000;
padding-bottom: 10px;
padding-top: 10px;
@ -7855,9 +7856,10 @@ div.graph div.legend table {
}
.model_log_viewer {
position: absolute;
bottom: 5px;
right: 0;
margin-top: 5px;
float: right;
margin-bottom: 0px;
margin-right: 0px;
}
.container_left_class {

View File

@ -63,6 +63,27 @@ table.agent_info_table tr {
color: #fff !important;
}
#um-next:hover,
#um-last:hover {
border: 1px solid #888 !important;
}
#um-next,
#um-last {
background-color: #111 !important;
color: #fff !important;
font-weight: 500;
border-radius: 5px;
background-repeat: no-repeat;
background-position: 92% 10px;
padding-bottom: 10px;
padding-top: 10px;
padding-left: 15px;
border: 1px solid #333 !important;
cursor: pointer;
font-family: inherit;
font-size: 10pt;
}
input[readonly] {
background-color: #444 !important;
color: #a2a2a2 !important;
@ -465,7 +486,7 @@ pre,
/* update_manager.css */
div#box_online * {
color: #000;
color: #fff;
}
/* discovery.css */
@ -1161,7 +1182,18 @@ a.pandora_pagination,
padding-right: 35px;
background-color: #222;
}
#box_online {
background-image: url("../../images/update_pandora_black.jpg") !important;
background-position: left, left !important;
background-repeat: no-repeat;
background-color: #000 !important;
padding: 40px 50px;
border: 1px solid #111 !important;
border-radius: 5px;
min-height: 600px;
background-size: contain;
box-shadow: 1px 1px 4px rgba(160, 160, 160, 0.514);
}
.legend_background {
background-color: #222;
color: #fff !important;

View File

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

View File

@ -416,7 +416,7 @@ if ($filter_standby == 'standby_on') {
$filter_alert['disabled'] = $filter;
}
if (is_metaconsole()) {
if (is_metaconsole() === true) {
include_once $config['homedir'].'/enterprise/meta/include/functions_alerts_meta.php';
if ($idAgent != 0) {
$alerts['alerts_simple'] = alerts_meta_get_alerts($agents, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user);

View File

@ -78,17 +78,6 @@ if (empty($directory) === true) {
$directory = filemanager_safe_directory($directory, $fallback_directory);
}
$banned_directories['include'] = true;
$banned_directories['godmode'] = true;
$banned_directories['operation'] = true;
$banned_directories['reporting'] = true;
$banned_directories['general'] = true;
$banned_directories[ENTERPRISE_DIR] = true;
if (isset($banned_directories[$directory]) === true) {
$directory = $fallback_directory;
}
$real_directory = realpath($config['homedir'].'/'.$directory);
ui_print_info_message(__('MIB files will be installed on the system. Please note that a MIB may depend on other MIB. To customize trap definitions use the SNMP trap editor.'));
@ -99,11 +88,11 @@ $create_text_file = (bool) get_parameter('create_text_file');
$default_real_directory = realpath($config['homedir'].'/'.$fallback_directory);
if ($upload_file_or_zip === true) {
upload_file($upload_file_or_zip, $default_real_directory);
upload_file($upload_file_or_zip, $default_real_directory, $real_directory);
}
if ($create_text_file === true) {
create_text_file($default_real_directory);
create_text_file($default_real_directory, $real_directory);
}
filemanager_file_explorer(

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.756
%define release 210902
%define version 7.0NG.757
%define release 210915
# 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.756
%define release 210902
%define version 7.0NG.757
%define release 210915
# 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.756
%define release 210902
%define version 7.0NG.757
%define release 210915
%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.756"
PI_VERSION="7.0NG.757"
FORCE=0
DESTDIR=""
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`

View File

@ -109,10 +109,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''),
('custom_report_front_footer', ''),
('MR', 48),
('MR', 49),
('identification_reminder', 1),
('identification_reminder_timestamp', 0),
('current_package', 756),
('current_package', 757),
('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.00097656250000":"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'),

1
pandora_plugins/openstack/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
venv

View File

@ -0,0 +1,4 @@
Docu:
EN: https://pandorafms.com/guides/public/books/plugin-openstack-d61
ES: https://pandorafms.com/guides/public/books/plugin-openstack

View File

@ -0,0 +1,475 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Alejandro Sánchez Carrion"
__copyright__ = "Copyright 2021, PandoraFMS"
__maintainer__ = "Projects department"
__status__ = "Production"
__version__ = "200721"
import json, requests, argparse, sys
from datetime import datetime
##Help
info = f"""
Pandora FMS Openstack monitoring plugin
Version = {__version__}
Description = Connects with digital ocean cloud service an retreave agent data for the instances running.
Execution: { str(sys.argv[0]) } -u <url> -t <token> [ -g <group> ] [ --data_dir <data dir> ]
"""
### Variables and arg parser ###
parser = argparse.ArgumentParser(description= info, formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('-u', '--url', help='openstack api keystone url', required=True)
parser.add_argument('-t', '--token', help='openstack api token', required=True)
parser.add_argument('-g', '--group', help='PandoraFMS destination group', default='openstack')
parser.add_argument('--data_dir', help='PandoraFMS data dir (default: /var/spool/pandora/data_in/)', default='/var/spool/pandora/data_in/')
# parser.add_argument('--prefix', help='Agent prefix, by default openstack_', default='openstack_')
args = parser.parse_args()
### Pandora Tools ###
modules = []
config = {
"data_in": args.data_dir,
"group" : args.group
}
def print_agent(agent, modules, prt=1):
"""Prints agent XML. Requires Agent object as argument."""
header = "<?xml version='1.0' encoding='UTF-8'?>\n"
header += "<agent_data"
for dato in agent:
agent_name = agent["agent_name"]
header += " " + str(dato) + "='" + str(agent[dato]) + "'"
header += ">\n"
xml = header
for module in modules:
modules_xml = print_module(module, 1)
xml += str(modules_xml)
xml += "</agent_data>"
if prt == 2 :
print (xml)
else :
write_xml(xml, agent_name)
def print_module(module, not_print_flag = None):
"""Returns module in XML format. Accepts only {dict}.\n
+ Only works with one module at a time: otherwise iteration is needed.
+ Module "value" field accepts str type or [list] for datalists.
+ Use not_print_flag to avoid printing the XML (only populates variables).
"""
data = dict(module)
module_xml = ("<module>\n"
"\t<name><![CDATA[" + str(data["name"]) + "]]></name>\n"
"\t<type>" + str(data["type"]) + "</type>\n"
)
if type(data["type"]) is not str and "string" not in data["type"]: #### Limpia espacios si el módulo no es tipo string
data["value"] = data["value"].strip()
if isinstance(data["value"], list): # Checks if value is a list
module_xml += "\t<datalist>\n"
for value in data["value"]:
if type(value) is dict and "value" in value:
module_xml += "\t<data>\n"
module_xml += "\t\t<value><![CDATA[" + str(value["value"]) + "]]></value>\n"
if "timestamp" in value:
module_xml += "\t\t<timestamp><![CDATA[" + str(value["timestamp"]) + "]]></timestamp>\n"
module_xml += "\t</data>\n"
else:
module_xml += "\t<data><![CDATA[" + str(data["value"]) + "]]></data>\n"
if "desc" in data:
module_xml += "\t<description><![CDATA[" + str(data["desc"]) + "]]></description>\n"
if "unit" in data:
module_xml += "\t<unit><![CDATA[" + str(data["unit"]) + "]]></unit>\n"
if "interval" in data:
module_xml += "\t<module_interval><![CDATA[" + str(data["interval"]) + "]]></module_interval>\n"
if "tags" in data:
module_xml += "\t<tags>" + str(data["tags"]) + "</tags>\n"
if "module_group" in data:
module_xml += "\t<module_group>" + str(data["module_group"]) + "</module_group>\n"
if "module_parent" in data:
module_xml += "\t<module_parent>" + str(data["module_parent"]) + "</module_parent>\n"
if "min_warning" in data:
module_xml += "\t<min_warning><![CDATA[" + str(data["min_warning"]) + "]]></min_warning>\n"
if "max_warning" in data:
module_xml += "\t<max_warning><![CDATA[" + str(data["max_warning"]) + "]]></max_warning>\n"
if "min_critical" in data:
module_xml += "\t<min_critical><![CDATA[" + str(data["min_critical"]) + "]]></min_critical>\n"
if "max_critical" in data:
module_xml += "\t<max_critical><![CDATA[" + str(data["max_critical"]) + "]]></max_critical>\n"
if "str_warning" in data:
module_xml += "\t<str_warning><![CDATA[" + str(data["str_warning"]) + "]]></str_warning>\n"
if "str_critical" in data:
module_xml += "\t<str_critical><![CDATA[" + str(data["str_critical"]) + "]]></str_critical>\n"
if "critical_inverse" in data:
module_xml += "\t<critical_inverse><![CDATA[" + str(data["critical_inverse"]) + "]]></critical_inverse>\n"
if "warning_inverse" in data:
module_xml += "\t<warning_inverse><![CDATA[" + str(data["warning_inverse"]) + "]]></warning_inverse>\n"
if "max" in data:
module_xml += "\t<max><![CDATA[" + str(data["max"]) + "]]></max>\n"
if "min" in data:
module_xml += "\t<min><![CDATA[" + str(data["min"]) + "]]></min>\n"
if "post_process" in data:
module_xml += "\t<post_process><![CDATA[" + str(data["post_process"]) + "]]></post_process>\n"
if "disabled" in data:
module_xml += "\t<disabled><![CDATA[" + str(data["disabled"]) + "]]></disabled>\n"
if "min_ff_event" in data:
module_xml += "\t<min_ff_event><![CDATA[" + str(data["min_ff_event"]) + "]]></min_ff_event>\n"
if "status" in data:
module_xml += "\t<status><![CDATA[" + str(data["status"]) + "]]></status>\n"
if "timestamp" in data:
module_xml += "\t<timestamp><![CDATA[" + str(data["timestamp"]) + "]]></timestamp>\n"
if "custom_id" in data:
module_xml += "\t<custom_id><![CDATA[" + str(data["custom_id"]) + "]]></custom_id>\n"
if "critical_instructions" in data:
module_xml += "\t<critical_instructions><![CDATA[" + str(data["critical_instructions"]) + "]]></critical_instructions>\n"
if "warning_instructions" in data:
module_xml += "\t<warning_instructions><![CDATA[" + str(data["warning_instructions"]) + "]]></warning_instructions>\n"
if "unknown_instructions" in data:
module_xml += "\t<unknown_instructions><![CDATA[" + str(data["unknown_instructions"]) + "]]></unknown_instructions>\n"
if "quiet" in data:
module_xml += "\t<quiet><![CDATA[" + str(data["quiet"]) + "]]></quiet>\n"
if "module_ff_interval" in data:
module_xml += "\t<module_ff_interval><![CDATA[" + str(data["module_ff_interval"]) + "]]></module_ff_interval>\n"
if "crontab" in data:
module_xml += "\t<crontab><![CDATA[" + str(data["crontab"]) + "]]></crontab>\n"
if "min_ff_event_normal" in data:
module_xml += "\t<min_ff_event_normal><![CDATA[" + str(data["min_ff_event_normal"]) + "]]></min_ff_event_normal>\n"
if "min_ff_event_warning" in data:
module_xml += "\t<min_ff_event_warning><![CDATA[" + str(data["min_ff_event_warning"]) + "]]></min_ff_event_warning>\n"
if "min_ff_event_critical" in data:
module_xml += "\t<min_ff_event_critical><![CDATA[" + str(data["min_ff_event_critical"]) + "]]></min_ff_event_critical>\n"
if "ff_type" in data:
module_xml += "\t<ff_type><![CDATA[" + str(data["ff_type"]) + "]]></ff_type>\n"
if "ff_timeout" in data:
module_xml += "\t<ff_timeout><![CDATA[" + str(data["ff_timeout"]) + "]]></ff_timeout>\n"
if "each_ff" in data:
module_xml += "\t<each_ff><![CDATA[" + str(data["each_ff"]) + "]]></each_ff>\n"
if "module_parent_unlink" in data:
module_xml += "\t<module_parent_unlink><![CDATA[" + str(data["parent_unlink"]) + "]]></module_parent_unlink>\n"
if "global_alerts" in data:
for alert in data["alert"]:
module_xml += "\t<alert_template><![CDATA[" + alert + "]]></alert_template>\n"
module_xml += "</module>\n"
if not not_print_flag:
print (module_xml)
return (module_xml)
def write_xml(xml, agent_name):
Utime = datetime.now().strftime('%s')
data_file = "%s/%s.%s.data" %(str(config["data_in"]),agent_name,str(Utime))
#print (data_file)
try :
with open(data_file, 'x') as data:
data.write(xml)
data.close()
except OSError as e :
pass
return 0
# # default agent
def clean_agent() :
global agent
agent = {
"agent_name" : "",
"agent_alias" : "",
"parent_agent_name" : "",
"description" : "",
"version" : "",
"os_name" : "",
"os_version" : "",
"timestamp" : datetime.today().strftime('%Y/%m/%d %H:%M:%S'),
#"utimestamp" : int(datetime.timestamp(datetime.today())),
"address" : "127.0.0.1",
"group" : config["group"],
"interval" : "",
}
return agent
# default module
def clean_module() :
global modulo
modulo = {
"name" : "",
"type" : "generic_data_string",
"desc" : "",
"value" : "",
}
return modulo
### MAIN
#url and token
user_url = args.url
user_token = args.token
headers = {
'Content-Type': 'application/json',
'X-Auth-Token': user_token
}
# request url
req = {
"server": user_url + "/servers",
"hypervisors": user_url + "/os-hypervisors/detail"
}
try:
result = requests.get(req["hypervisors"], headers=headers)
result_data = json.loads(result.content)
except Exception as e :
print('0')
sys.exit("\nError requesting %s, please check conectivity" %(req["hypervisors"],))
for dato in result_data["hypervisors"] :
clean_agent()
agent.update(
agent_name = "Openstack Hypervisor_%s" %(dato['id']),
agent_alias = "Openstack Hypervisor_%s" %(dato['id']),
description = "Openstack Hypervisor_detailed stats"
)
clean_module()
modulo.update(
name = "free_disk_gb",
desc = "avalaible disk space",
value = str(dato['free_disk_gb'])
)
modules.append(modulo)
clean_module()
modulo.update(
name = "free_ram_mb",
desc = "available ram ",
value = str(dato['free_ram_mb'])
)
modules.append(modulo)
clean_module()
modulo.update(
name = "disk_available_least",
desc = "this value is dependent on over committed value of disk, disk_available_least = disk_free_gb - disk_over_committed" ,
value = str(dato['disk_available_least'])
)
modules.append(modulo)
clean_module()
modulo.update(
name = "local_gb",
desc = "the total available disk for the node's virtual machine, local_gb = local_gb_used + free_disk_gb " ,
value = str(dato['local_gb'])
)
modules.append(modulo)
clean_module()
modulo.update(
name = "local_gb_used",
desc = "the sum of the node's virtual machine disk ",
value = str(dato['local_gb_used'])
)
modules.append(modulo)
clean_module()
modulo.update(
name = "memory_mb",
desc = "the total ram of the node, memory_mb_used + free_ram_mb " ,
value = str(dato['memory_mb'])
)
modules.append(modulo)
clean_module()
modulo.update(
name = "memory_mb_used",
desc = "the sum of the rams of the node's virtual machine " ,
value = str(dato['memory_mb_used'])
)
modules.append(modulo)
clean_module()
modulo.update(
name = "vcpus",
desc = "node physical cpu total threads ",
value = str(dato['vcpus'])
)
modules.append(modulo)
clean_module()
modulo.update(
name = "vcpus_used",
desc = "the sum of the vcpus of the node virtual machine ",
value = str(dato['vcpus_used'])
)
modules.append(modulo)
clean_module()
modulo.update(
name = "current_workload",
desc = "hypervisor current workload " ,
value = str(dato['current_workload'])
)
modules.append(modulo)
clean_module()
modulo.update(
name = "host_ip",
desc = "hypervisor host ip ",
value = str(dato['host_ip'])
)
modules.append(modulo)
clean_module()
modulo.update(
name = "hypervisor_type",
desc = "hypervisor type ",
value = str(dato['hypervisor_type'])
)
modules.append(modulo)
clean_module()
modulo.update(
name = "hypervisor_version",
desc = "hypervisor version ",
value = str(dato['hypervisor_version'])
)
modules.append(modulo)
clean_module()
modulo.update(
name = "running_vms",
desc = "number of virtual machines running " ,
value = str(dato['running_vms'])
)
modules.append(modulo)
print_agent(agent, modules)
modules = []
try:
result = requests.get(req["server"], headers=headers)
result_data = json.loads(result.content)
except Exception as e :
print('0')
sys.exit("\nError requesting %s, please check conectivity" %(req["server"],))
id_instancia=[]
for dato in result_data["servers"] :
id_instancia.append(dato['id'])
for dato in id_instancia:
req = {
"servers": user_url + "/servers/" + dato + "/diagnostics",
"instancia": user_url + "/servers/detail"
}
# get account data
try:
result = requests.get(req["servers"], headers=headers)
result_data = json.loads(result.content)
except Exception as e :
print('0')
sys.exit("\nError requesting %s, please check conectivity" %(req["servers"],))
if 'errors' in result_data :
print('0')
sys.exit(F'Error token, please check token: {result_data}')
clean_agent()
agent.update(
agent_name = "Openstack instance id: " + dato ,
agent_alias ="Openstack instance id: " + dato,
description ="Instance metrics"
)
clean_module()
modulo.update(
name = "memory",
type = "generic_data",
desc = "memory used by the machine",
value = float(result_data['memory']),
unit = ""
)
modules.append(modulo)
clean_module()
modulo.update(
name = "memory-actual",
type = "generic_data",
desc = "memory actual used by the machine",
value = float(result_data['memory-actual']),
unit = ""
)
modules.append(modulo)
clean_module()
modulo.update(
name = "memory-rss",
type = "generic_data",
desc = "Resident Set Size and is used to show how much memory is allocated",
value = float(result_data['memory-rss']),
unit = ""
)
modules.append(modulo)
clean_module()
modulo.update(
name = "vda_errors",
type = "generic_data",
desc = "diagnostics for a libvirt based instance, vda receibed errors",
value = float(result_data['vda_errors']),
unit = ""
)
modules.append(modulo)
clean_module()
modulo.update(
name = "vda_read",
type = "generic_data",
desc = "diagnostics for a libvirt based instance, vda dates read",
value = float(result_data['vda_read']),
unit = ""
)
modules.append(modulo)
clean_module()
modulo.update(
name = "vda_read_req",
type = "generic_data",
desc = "diagnostics for a libvirt based instance, vda dates requests read",
value = float(result_data['vda_read_req']),
unit = ""
)
modules.append(modulo)
clean_module()
modulo.update(
name = "vda_write",
type = "generic_data",
desc = "diagnostics for a libvirt based instance, vda dates write",
value = float(result_data['vda_write']),
unit = ""
)
modules.append(modulo)
clean_module()
modulo.update(
name = "vda_write_req",
type = "generic_data",
desc = "diagnostics for a libvirt based instance, vda write requests dates",
value = float(result_data['vda_write_req']),
unit = ""
)
modules.append(modulo)
print_agent(agent, modules)
modules = []
print('1')

View File

@ -0,0 +1,5 @@
certifi==2021.5.30
charset-normalizer==2.0.4
idna==3.2
requests==2.26.0
urllib3==1.26.6

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.756-210902
Version: 7.0NG.757-210915
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.756-210902"
pandora_version="7.0NG.757-210915"
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.756
# Version 7.0NG.757
# Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -45,8 +45,8 @@ our @EXPORT = qw(
);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.756";
my $pandora_build = "210902";
my $pandora_version = "7.0NG.757";
my $pandora_build = "210915";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

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

View File

@ -2,8 +2,8 @@
# Pandora FMS Server
#
%define name pandorafms_server
%define version 7.0NG.756
%define release 210902
%define version 7.0NG.757
%define release 210915
Summary: Pandora FMS Server
Name: %{name}

View File

@ -2,8 +2,8 @@
# Pandora FMS Server
#
%define name pandorafms_server
%define version 7.0NG.756
%define release 210902
%define version 7.0NG.757
%define release 210915
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.756"
PI_BUILD="210902"
PI_VERSION="7.0NG.757"
PI_BUILD="210915"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.756 Build 210902";
my $version = "7.0NG.757 Build 210915";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.756 Build 210902";
my $version = "7.0NG.757 Build 210915";
# save program name for logging
my $progname = basename($0);