mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
oMerge branch 'develop' into ent-7273-Consola-Visual-nuevo-elemento-Gráfica-básica
This commit is contained in:
commit
f9c95e0145
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, AIX version
|
||||
# Version 7.0NG.756, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, FreeBSD Version
|
||||
# Version 7.0NG.756, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, HP-UX Version
|
||||
# Version 7.0NG.756, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, GNU/Linux
|
||||
# Version 7.0NG.756, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, GNU/Linux
|
||||
# Version 7.0NG.756, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, Solaris Version
|
||||
# Version 7.0NG.756, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.755
|
||||
# Version 7.0NG.756
|
||||
# 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.755, AIX version
|
||||
# Version 7.0NG.756, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.755
|
||||
# Version 7.0NG.756
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.755, HPUX Version
|
||||
# Version 7.0NG.756, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755
|
||||
# Version 7.0NG.756
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755
|
||||
# Version 7.0NG.756
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755
|
||||
# Version 7.0NG.756
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.755, Solaris version
|
||||
# Version 7.0NG.756, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, AIX version
|
||||
# Version 7.0NG.756, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.755-210716
|
||||
Version: 7.0NG.756-210804
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.755-210716"
|
||||
pandora_version="7.0NG.756-210804"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -31,7 +31,7 @@ fi
|
||||
if [ "$#" -ge 2 ]; then
|
||||
VERSION="$2"
|
||||
else
|
||||
VERSION="7.0NG.755"
|
||||
VERSION="7.0NG.756"
|
||||
fi
|
||||
|
||||
# Path for the generated DMG 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.755" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.756" 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.755" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.756" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<!-- <installation-check script="check()" />
|
||||
<script>
|
||||
<![CDATA[
|
||||
|
@ -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.755</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.755 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.755</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>NSPrincipalClass</key><string>NSApplication</string>
|
||||
<key>NSMainNibFile</key><string>MainMenu</string>
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, GNU/Linux
|
||||
# Version 7.0NG.756, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, FreeBSD Version
|
||||
# Version 7.0NG.756, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, HP-UX Version
|
||||
# Version 7.0NG.756, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, GNU/Linux
|
||||
# Version 7.0NG.756, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, GNU/Linux
|
||||
# Version 7.0NG.756, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, NetBSD Version
|
||||
# Version 7.0NG.756, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, Solaris Version
|
||||
# Version 7.0NG.756, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1014,8 +1014,8 @@ my $Sem = undef;
|
||||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.755';
|
||||
use constant AGENT_BUILD => '210716';
|
||||
use constant AGENT_VERSION => '7.0NG.756';
|
||||
use constant AGENT_BUILD => '210804';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.755
|
||||
%define release 210716
|
||||
%define version 7.0NG.756
|
||||
%define release 210804
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.755
|
||||
%define release 210716
|
||||
%define version 7.0NG.756
|
||||
%define release 210804
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -9,8 +9,8 @@
|
||||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.755"
|
||||
PI_BUILD="210716"
|
||||
PI_VERSION="7.0NG.756"
|
||||
PI_BUILD="210804"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.755
|
||||
# Version 7.0NG.756
|
||||
# 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
|
||||
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
||||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.755}
|
||||
{Pandora FMS Windows Agent v7.0NG.756}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{210716}
|
||||
{210804}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.755 Build 210716")
|
||||
#define PANDORA_VERSION ("7.0NG.756 Build 210804")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.755(Build 210716))"
|
||||
VALUE "ProductVersion", "(7.0NG.756(Build 210804))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.755-210716
|
||||
Version: 7.0NG.756-210804
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.755-210716"
|
||||
pandora_version="7.0NG.756-210804"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -33,10 +33,19 @@ function users_extension_main_god($god=true)
|
||||
$image = 'images/user.png';
|
||||
}
|
||||
|
||||
// Header
|
||||
// Header.
|
||||
ui_print_page_header(__('Users connected'), $image, false, '', $god);
|
||||
|
||||
// Get groups user has permission
|
||||
$check_profile = db_get_row('tusuario_perfil', 'id_usuario', $config['id_user'], 'id_up');
|
||||
if ($check_profile === false && !users_is_admin()) {
|
||||
return ui_print_error_message(
|
||||
__('This user does not have any associated profile'),
|
||||
'',
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
// Get groups user has permission.
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
// Is admin or has group permissions all.
|
||||
$groups = implode(',', array_keys($group_um, 1));
|
||||
@ -44,51 +53,85 @@ function users_extension_main_god($god=true)
|
||||
// Get user conected last 5 minutes.Show only those on which the user has permission.
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$sql = sprintf(
|
||||
'SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
if (users_is_admin()) {
|
||||
$sql = sprintf(
|
||||
'SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC'
|
||||
);
|
||||
} else {
|
||||
$sql = sprintf(
|
||||
'SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
if (users_is_admin()) {
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC'
|
||||
);
|
||||
} else {
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
if (users_is_admin()) {
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC'
|
||||
);
|
||||
} else {
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Nothing to do.
|
||||
break;
|
||||
}
|
||||
|
||||
$rows = db_get_all_rows_sql($sql);
|
||||
|
||||
if (empty($rows)) {
|
||||
$rows = [];
|
||||
echo "<div class='nf'>".__('No other users connected').'</div>';
|
||||
} else {
|
||||
$table = new StdClass();
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '100%';
|
||||
@ -105,7 +148,7 @@ function users_extension_main_god($god=true)
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
|
||||
// Get data
|
||||
// Get data.
|
||||
foreach ($rows as $row) {
|
||||
// Get data of user's last login.
|
||||
switch ($config['dbtype']) {
|
||||
@ -135,6 +178,10 @@ function users_extension_main_god($god=true)
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Nothing to do.
|
||||
break;
|
||||
}
|
||||
|
||||
if ($rowPair) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
START TRANSACTION;
|
||||
|
||||
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 '';
|
||||
|
||||
@ -24,11 +25,9 @@ CREATE TABLE IF NOT EXISTS `tsync_queue` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
SOURCE './procedures/updateSnmpAlerts.sql';
|
||||
|
||||
UPDATE `tlink` SET `link` = 'https://pandorafms.com/manual/' WHERE `id_link` = 0000000001;
|
||||
|
||||
UPDATE pandora.tuser_task
|
||||
UPDATE `tuser_task`
|
||||
SET parameters='a:7:{i:0;a:7:{s:11:"description";s:30:"Template pending to be created";s:5:"table";s:16:"treport_template";s:8:"field_id";s:9:"id_report";s:10:"field_name";s:4:"name";s:8:"required";b:1;s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_group";}i:1;a:7:{s:11:"description";s:6:"Agents";s:5:"table";s:7:"tagente";s:8:"field_id";s:9:"id_agente";s:10:"field_name";s:6:"nombre";s:8:"multiple";b:1;s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_grupo";}i:2;a:2:{s:11:"description";s:16:"Report per agent";s:10:"select_two";b:1;}i:3;a:2:{s:11:"description";s:11:"Report name";s:4:"type";s:6:"string";}i:4;a:2:{s:11:"description";s:47:"Send to e-mail addresses (separated by a comma)";s:4:"type";s:4:"text";}i:5;a:2:{s:11:"description";s:7:"Subject";s:8:"optional";i:1;}i:6;a:3:{s:11:"description";s:7:"Message";s:4:"type";s:4:"text";s:8:"optional";i:1;}}i:7;a:2:{s:11:"description";s:11:"Report Type";s:4:"type";s:11:"report_type";}}'
|
||||
WHERE id=2;
|
||||
|
||||
@ -37,7 +36,7 @@ UPDATE `tuser_task_scheduled` SET
|
||||
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:7;s:3:"PDF";s:15:"first_execution"')
|
||||
WHERE `id_user_task` = 2;
|
||||
|
||||
UPDATE `tconfig` SET `value` = 0 WHERE `token` = `centralized_management`;
|
||||
UPDATE `tconfig` SET `value` = 0 WHERE `token` = 'centralized_management';
|
||||
|
||||
DELETE ta FROM `tagente` ta LEFT JOIN `tgrupo` tg on ta.`id_grupo` = tg.`id_grupo` WHERE tg.`id_grupo` IS NULL;
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
DELIMITER //
|
||||
CREATE PROCEDURE updateSnmpAlerts()
|
||||
BEGIN
|
||||
DECLARE tokenId INT DEFAULT 0;
|
||||
@ -33,7 +32,4 @@ BEGIN
|
||||
UPDATE tconfig SET value = 1 WHERE token = 'update_snmp_alerts_procedure_already_run';
|
||||
END IF;
|
||||
END IF;
|
||||
END//
|
||||
DELIMITER ;
|
||||
CALL updateSnmpAlerts();
|
||||
DROP PROCEDURE updateSnmpAlerts;
|
||||
END
|
@ -418,6 +418,8 @@ ALTER TABLE `tmetaconsole_setup` MODIFY COLUMN `meta_dbuser` text NULL,
|
||||
|
||||
ALTER TABLE `tmetaconsole_setup` ADD COLUMN `server_uid` TEXT NOT NULL default '';
|
||||
|
||||
ALTER TABLE `tmetaconsole_setup` ADD COLUMN `unified` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tprofile_view`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -2565,7 +2567,7 @@ ALTER TABLE `tnetflow_filter` MODIFY COLUMN `router_ip` text NOT NULL;
|
||||
UPDATE tuser_task set parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report";
|
||||
INSERT IGNORE INTO tuser_task VALUES (8, 'cron_task_generate_csv_log', 'a:1:{i:0;a:2:{s:11:"description";s:14:"Send to e-mail";s:4:"type";s:4:"text";}}', 'Send csv log');
|
||||
UPDATE `tuser_task` SET `parameters`='a:4:{i:0;a:6:{s:11:"description";s:28:"Report pending to be created";s:5:"table";s:7:"treport";s:8:"field_id";s:9:"id_report";s:10:"field_name";s:4:"name";s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_group";}i:1;a:2:{s:11:"description";s:426:"Save to disk in path<a href="javascript:" class="tip" style="" ><img src="http://172.16.0.2/pandora_console/images/tip_help.png" data-title="The Apache user should have read-write access on this folder. E.g. /var/www/html/pandora_console/attachment" data-use_title_for_force_title="1" class="forced_title" alt="The Apache user should have read-write access on this folder. E.g. /var/www/html/pandora_console/attachment" /></a>";s:4:"type";s:6:"string";}i:2;a:2:{s:11:"description";s:16:"File nane prefix";s:4:"type";s:6:"string";}i:3;a:2:{s:11:"description";s:11:"Report Type";s:4:"type";s:11:"report_type";}}' WHERE `id`=3;
|
||||
UPDATE pandora.tuser_task
|
||||
UPDATE `tuser_task`
|
||||
SET parameters='a:7:{i:0;a:7:{s:11:"description";s:30:"Template pending to be created";s:5:"table";s:16:"treport_template";s:8:"field_id";s:9:"id_report";s:10:"field_name";s:4:"name";s:8:"required";b:1;s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_group";}i:1;a:7:{s:11:"description";s:6:"Agents";s:5:"table";s:7:"tagente";s:8:"field_id";s:9:"id_agente";s:10:"field_name";s:6:"nombre";s:8:"multiple";b:1;s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_grupo";}i:2;a:2:{s:11:"description";s:16:"Report per agent";s:10:"select_two";b:1;}i:3;a:2:{s:11:"description";s:11:"Report name";s:4:"type";s:6:"string";}i:4;a:2:{s:11:"description";s:47:"Send to e-mail addresses (separated by a comma)";s:4:"type";s:4:"text";}i:5;a:2:{s:11:"description";s:7:"Subject";s:8:"optional";i:1;}i:6;a:3:{s:11:"description";s:7:"Message";s:4:"type";s:4:"text";s:8:"optional";i:1;}}i:7;a:2:{s:11:"description";s:11:"Report Type";s:4:"type";s:11:"report_type";}}' WHERE id=2;
|
||||
DELETE FROM `tuser_task` WHERE id = 6;
|
||||
|
||||
|
@ -63,6 +63,7 @@ switch ($login_screen) {
|
||||
case 'error_perms':
|
||||
case 'homedir_bad_defined':
|
||||
case 'homeurl_bad_defined':
|
||||
case 'disabled_access_node':
|
||||
$logo_link = 'index.php';
|
||||
$logo_title = __('Go to Login');
|
||||
break;
|
||||
@ -208,6 +209,7 @@ if (is_metaconsole() === true) {
|
||||
switch ($login_screen) {
|
||||
case 'logout':
|
||||
case 'login':
|
||||
case 'disabled_access_node':
|
||||
if (!empty($page) && !empty($sec)) {
|
||||
foreach ($_POST as $key => $value) {
|
||||
html_print_input_hidden(io_safe_input($key), io_safe_input($value));
|
||||
@ -508,9 +510,29 @@ if ($login_screen == 'logout') {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if ($login_screen === 'disabled_access_node') {
|
||||
echo '<div id="disabled_access_node" title="'.__('User node access not enabled').'">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
echo html_print_image('images/icono_logo_pandora.png', true, ['alt' => __('Centralized user in metaconsole'), 'border' => 0]);
|
||||
echo '</div>';
|
||||
echo '<div class="content_message_alert">';
|
||||
echo '<div class="text_message_alert">';
|
||||
echo '<h1>'.__('Centralized user in metaconsole').'</h1>';
|
||||
echo '<p>'.__('This user does not have access on node, please enable node access on this user from metaconsole.').'</p>';
|
||||
echo '</div>';
|
||||
echo '<div class="button_message_alert">';
|
||||
html_print_submit_button('Ok', 'hide-login-logout', false);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
switch ($login_screen) {
|
||||
case 'error_dbconfig':
|
||||
case 'error_authconfig':
|
||||
case 'disabled_node_access':
|
||||
if (!isset($config['rb_product_name_alt'])) {
|
||||
$title = __('Problem with %s database', get_product_name());
|
||||
} else {
|
||||
@ -694,6 +716,29 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
||||
});
|
||||
break;
|
||||
|
||||
case 'disabled_access_node':
|
||||
$(document).ready (function () {
|
||||
$(function() {
|
||||
$("#disabled_access_node").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 220,
|
||||
width: 528,
|
||||
clickOutside: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#submit-hide-login-logout").click (function () {
|
||||
document.location = "<?php echo ui_get_full_url('index.php'); ?>";
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
$(document).ready (function () {
|
||||
// IE9- modal warning window
|
||||
|
79
pandora_console/general/node_deactivated.php
Normal file
79
pandora_console/general/node_deactivated.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* Static page to lock access to console
|
||||
*
|
||||
* @category Wizard
|
||||
* @package Pandora FMS
|
||||
* @subpackage Applications.VMware
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 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.
|
||||
ui_require_css_file('maintenance');
|
||||
?>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<div class="responsive center padding-6">
|
||||
<p><?php echo __('You cannot use this node until system is unified'); ?></p>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
html_print_image(
|
||||
'images/maintenance.png',
|
||||
false,
|
||||
[
|
||||
'class' => 'responsive',
|
||||
'width' => 800,
|
||||
]
|
||||
);
|
||||
?>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<p>
|
||||
<?php
|
||||
echo __(
|
||||
'Please navigate to %s to unify system',
|
||||
'<a href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=advanced/command_center'
|
||||
).'" target="_new">'.__('command center').'</a>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<br>
|
||||
<p><?php echo __('You will be automatically redirected when all tasks finish'); ?></p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
setTimeout(
|
||||
function() {
|
||||
location.reload();
|
||||
},
|
||||
10000
|
||||
);
|
||||
})
|
||||
</script>
|
||||
|
||||
</html>
|
@ -500,7 +500,10 @@ if (enterprise_installed()) {
|
||||
false,
|
||||
// Delete_groups.
|
||||
// Do not show the primary group in this selection.
|
||||
array_merge(($secondary_groups_selected['plain'] ?? []), [$agent['id_grupo']])
|
||||
array_merge(
|
||||
(empty($secondary_groups_selected['plain']) === false) ? $secondary_groups_selected['plain'] : [],
|
||||
[$agent['id_grupo']]
|
||||
)
|
||||
// Include_groups.
|
||||
// Size.
|
||||
// Simple_multiple_options.
|
||||
|
@ -105,6 +105,7 @@ if ($update_command) {
|
||||
$alert['command'] = $command;
|
||||
$alert['description'] = $description;
|
||||
$alert['id_group'] = $id_group;
|
||||
$alert['fields_hidden'] = io_json_mb_encode($fields_hidden);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,10 @@ if (empty($license) === true) {
|
||||
}
|
||||
|
||||
$mode_str = '';
|
||||
if (isset($mode) === false) {
|
||||
$mode = null;
|
||||
}
|
||||
|
||||
if ($mode === Manager::MODE_ONLINE) {
|
||||
$mode_str = 'online';
|
||||
} else if ($mode === Manager::MODE_OFFLINE) {
|
||||
|
@ -941,6 +941,15 @@ class Client
|
||||
$queries = preg_split("/(;\n)|(;\n\r)/", $sql);
|
||||
foreach ($queries as $query) {
|
||||
if (empty($query) !== true) {
|
||||
if (preg_match('/^\s*LOAD\s+(.*)$/i', $query, $matches) > 0) {
|
||||
$filepath = dirname($mr_file).'/'.$matches[1];
|
||||
if (file_exists($filepath) === true) {
|
||||
$query = file_get_contents($filepath);
|
||||
} else {
|
||||
throw new \Exception('Cannot load file: '.$filepath);
|
||||
}
|
||||
}
|
||||
|
||||
if ($dbh->query($query) === false) {
|
||||
// 1022: Duplicate key in table.
|
||||
// 1050: Table already defined.
|
||||
@ -1331,18 +1340,17 @@ class Client
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
set_error_handler(
|
||||
function ($errno, $errstr) {
|
||||
if (preg_match('/Undefined index/', $errstr) > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new \Exception($errstr, $errno);
|
||||
}
|
||||
},
|
||||
E_ERROR
|
||||
);
|
||||
|
||||
register_shutdown_function(
|
||||
function () {
|
||||
$error = error_get_last();
|
||||
if (null !== $error) {
|
||||
if (null !== $error
|
||||
&& $error['type'] === E_ERROR
|
||||
) {
|
||||
echo __('Failed to analyze package: %s', $error['message']);
|
||||
}
|
||||
}
|
||||
@ -1425,7 +1433,8 @@ class Client
|
||||
set_error_handler(
|
||||
function ($errno, $errstr) {
|
||||
throw new \Exception($errstr, $errno);
|
||||
}
|
||||
},
|
||||
E_ERROR
|
||||
);
|
||||
|
||||
if ($package === null) {
|
||||
|
@ -319,7 +319,7 @@ function process_user_login_remote($login, $pass, $api=false)
|
||||
defined('METACONSOLE')
|
||||
);
|
||||
|
||||
if ($return === 'error_permissions') {
|
||||
if ($result === 'error_permissions') {
|
||||
$config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator');
|
||||
return false;
|
||||
}
|
||||
@ -735,7 +735,14 @@ function ldap_process_user_login($login, $password)
|
||||
}
|
||||
|
||||
// Connect to the LDAP server
|
||||
$ds = @ldap_connect($config['ldap_server'], $config['ldap_port']);
|
||||
if (stripos($config['ldap_server'], 'ldap://') !== false
|
||||
|| stripos($config['ldap_server'], 'ldaps://') !== false
|
||||
|| stripos($config['ldap_server'], 'ldapi://') !== false
|
||||
) {
|
||||
$ds = @ldap_connect($config['ldap_server'].':'.$config['ldap_port']);
|
||||
} else {
|
||||
$ds = @ldap_connect($config['ldap_server'], $config['ldap_port']);
|
||||
}
|
||||
|
||||
if (!$ds) {
|
||||
$config['auth_error'] = 'Error connecting to LDAP server';
|
||||
@ -1393,7 +1400,7 @@ function local_ldap_search($ldap_host, $ldap_port=389, $ldap_version=3, $dn, $ac
|
||||
}
|
||||
|
||||
if (!empty($ldap_admin_pass)) {
|
||||
$ldap_admin_pass = ' -w '.$ldap_admin_pass;
|
||||
$ldap_admin_pass = ' -w '.escapeshellarg($ldap_admin_pass);
|
||||
}
|
||||
|
||||
$dn = " -b '".$dn."'";
|
||||
|
@ -1,38 +1,54 @@
|
||||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
//
|
||||
// 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.
|
||||
|
||||
/**
|
||||
* @package Include
|
||||
* @subpackage Config
|
||||
* Configuraton sample file.
|
||||
*
|
||||
* @category Config
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Default values
|
||||
// $config["dbname"]="pandora";
|
||||
// $config["dbuser"]="pandora";
|
||||
// $config["dbpass"]="pandora";
|
||||
// $config["dbhost"]="localhost";
|
||||
// This is used for reporting, please add "/" character at the end
|
||||
// $config["homedir"]="/var/www/pandora_console/";
|
||||
// $config["homeurl"]="/pandora_console/";
|
||||
// $config["auth"]["scheme"] = "mysql";
|
||||
|
||||
/**
|
||||
* Do not display any ERROR
|
||||
/*
|
||||
* Default values
|
||||
* $config["dbname"]="pandora";
|
||||
* $config["dbuser"]="pandora";
|
||||
* $config["dbpass"]="pandora";
|
||||
* $config["dbhost"]="localhost";
|
||||
*
|
||||
*
|
||||
* This is used for reporting, please add "/" character at the end
|
||||
* $config["homedir"]="/var/www/pandora_console/";
|
||||
* $config["homeurl"]="/pandora_console/";
|
||||
* $config["auth"]["scheme"] = "mysql";
|
||||
*/
|
||||
|
||||
// By default report any error but notices.
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
|
||||
/*
|
||||
* Uncomment to display only critical errors.
|
||||
* error_reporting(E_ERROR);
|
||||
* Uncomment to display none errors.
|
||||
* error_reporting(0);
|
||||
*/
|
||||
error_reporting(E_ALL);
|
||||
|
||||
// Display ALL errors
|
||||
// error_reporting(E_ERROR);
|
||||
$ownDir = dirname(__FILE__).DIRECTORY_SEPARATOR;
|
||||
require $ownDir.'config_process.php';
|
||||
|
@ -20,8 +20,8 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC210716';
|
||||
$pandora_version = 'v7.0NG.755';
|
||||
$build_version = 'PC210804';
|
||||
$pandora_version = 'v7.0NG.756';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
@ -1752,11 +1752,27 @@ function has_metaconsole()
|
||||
* @return boolean
|
||||
*/
|
||||
function is_management_allowed($hkey='')
|
||||
{
|
||||
return ( (is_metaconsole() && is_centrallised())
|
||||
|| (!is_metaconsole() && !is_centrallised())
|
||||
|| (!is_metaconsole() && is_centrallised()) && $hkey == generate_hash_to_api());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true if is a centrallised environment.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function is_centrallised()
|
||||
{
|
||||
global $config;
|
||||
return ( (is_metaconsole() && $config['centralized_management'])
|
||||
|| (!is_metaconsole() && !$config['centralized_management'])
|
||||
|| (!is_metaconsole() && $config['centralized_management']) && $hkey == generate_hash_to_api());
|
||||
|
||||
if (isset($config['centralized_management']) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool) $config['centralized_management'];
|
||||
}
|
||||
|
||||
|
||||
@ -1768,8 +1784,7 @@ function is_management_allowed($hkey='')
|
||||
*/
|
||||
function is_central_policies()
|
||||
{
|
||||
global $config;
|
||||
return is_metaconsole() && $config['centralized_management'];
|
||||
return is_metaconsole() && is_centrallised();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2825,8 +2825,9 @@ function alerts_ui_update_or_create_actions($update=true)
|
||||
$values['action_threshold'] = $action_threshold;
|
||||
$values['create_wu_integria'] = $create_wu_integria;
|
||||
|
||||
$name_check = db_get_value('name', 'talert_actions', 'name', $name);
|
||||
if ($name_check) {
|
||||
// If this alert has the same name, not valid.
|
||||
$name_check = db_get_row('talert_actions', 'name', $name);
|
||||
if (empty($name_check) === false && (int) $name_check['id'] !== (int) $id) {
|
||||
$result = '';
|
||||
} else {
|
||||
if ($update) {
|
||||
|
@ -4843,7 +4843,7 @@ function events_page_general($event)
|
||||
if (isset($event['id_agente']) && $event['id_agente'] > 0) {
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$event['id_agente'], is_metaconsole()]);
|
||||
if (!empty($secondary_groups_selected)) {
|
||||
if (empty($secondary_groups_selected['for_select']) === false) {
|
||||
$secondary_groups = implode(', ', $secondary_groups_selected['for_select']);
|
||||
}
|
||||
}
|
||||
|
@ -511,6 +511,11 @@ function tags_update_policy_module_tag($id_policy_module, $tags, $autocommit=fal
|
||||
}
|
||||
}
|
||||
|
||||
if ($errn > 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -962,7 +962,7 @@ var TreeController = {
|
||||
}
|
||||
// If exist the detail container, show the data
|
||||
if (
|
||||
typeof controller.detailRecipient !== "undefined" &&
|
||||
typeof controller.detailRecipient !== "undefined" ||
|
||||
disabled == false
|
||||
) {
|
||||
if (element.type == "agent" || element.type == "module") {
|
||||
@ -997,12 +997,10 @@ var TreeController = {
|
||||
$node.addClass("leaf-empty");
|
||||
|
||||
if (
|
||||
typeof element.children != "undefined" &&
|
||||
element.children.length > 0 &&
|
||||
(typeof element.children != "undefined" &&
|
||||
element.children.length > 0) ||
|
||||
element.disabled == false
|
||||
) {
|
||||
$node.removeClass("leaf-empty").addClass("leaf-closed");
|
||||
|
||||
// Add children
|
||||
var $children = _processGroup($node, element.children);
|
||||
$node.data("children", $children);
|
||||
@ -1032,13 +1030,13 @@ var TreeController = {
|
||||
}
|
||||
|
||||
if (
|
||||
typeof element.searchChildren != "undefined" &&
|
||||
element.searchChildren
|
||||
(typeof element.searchChildren != "undefined" &&
|
||||
element.searchChildren) ||
|
||||
element.disabled == true
|
||||
) {
|
||||
if (
|
||||
(element.rootType == "group_edition" &&
|
||||
typeof element.children == "undefined") ||
|
||||
element.disabled == true
|
||||
element.rootType == "group_edition" &&
|
||||
typeof element.children == "undefined"
|
||||
) {
|
||||
$node.addClass("leaf-empty");
|
||||
} else {
|
||||
|
@ -529,11 +529,11 @@ class EventsListWidget extends Widget
|
||||
if ($customFilter !== false) {
|
||||
$filter = $customFilter;
|
||||
$filter['tag_with'] = base64_encode(
|
||||
json_encode($filter['tag_with'])
|
||||
io_safe_output($filter['tag_with'])
|
||||
);
|
||||
|
||||
$filter['tag_without'] = base64_encode(
|
||||
json_encode($filter['tag_without'])
|
||||
io_safe_output($filter['tag_without'])
|
||||
);
|
||||
|
||||
if (!empty($filter['id_agent_module'])) {
|
||||
|
@ -22,8 +22,12 @@ h1 {
|
||||
color: #83b92f;
|
||||
}
|
||||
|
||||
p a {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 2rem;
|
||||
font-size: 1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
letter-spacing: 1.5px;
|
||||
font-weight: lighter;
|
||||
|
@ -7208,7 +7208,7 @@ div.graph div.legend table {
|
||||
}
|
||||
|
||||
.bg_82B92E {
|
||||
background-color: #82b92e;
|
||||
background-color: #82b92e !important;
|
||||
}
|
||||
|
||||
.bg_B2B2B2 {
|
||||
@ -7233,13 +7233,13 @@ div.graph div.legend table {
|
||||
background-color: #eee;
|
||||
}
|
||||
.bg_ffd {
|
||||
background-color: #ffd036;
|
||||
background-color: #ffd036 !important;
|
||||
}
|
||||
.bg_ff5 {
|
||||
background-color: #ff5653;
|
||||
background-color: #ff5653 !important;
|
||||
}
|
||||
.bg_ff9 {
|
||||
background-color: #ff9e39;
|
||||
background-color: #ff9e39 !important;
|
||||
}
|
||||
.bg_lightgray {
|
||||
background-color: lightgray;
|
||||
|
@ -996,6 +996,7 @@ if (! isset($config['id_user'])) {
|
||||
$iduser = $_SESSION['id_usuario'];
|
||||
unset($_SESSION['id_usuario']);
|
||||
unset($iduser);
|
||||
$login_screen = 'disabled_access_node';
|
||||
include_once 'general/login_page.php';
|
||||
while (ob_get_length() > 0) {
|
||||
ob_end_flush();
|
||||
@ -1040,6 +1041,30 @@ if (isset($_GET['bye'])) {
|
||||
|
||||
clear_pandora_error_for_header();
|
||||
|
||||
if ((bool) $config['node_deactivated'] === true) {
|
||||
// Prevent access node if not merged.
|
||||
include 'general/node_deactivated.php';
|
||||
|
||||
while (ob_get_length() > 0) {
|
||||
ob_end_flush();
|
||||
}
|
||||
|
||||
exit('</html>');
|
||||
}
|
||||
|
||||
if ((bool) $config['maintenance_mode'] === true
|
||||
&& (bool) users_is_admin() === false
|
||||
) {
|
||||
// Show maintenance web-page. For non-admin users only.
|
||||
include 'general/maintenance.php';
|
||||
|
||||
while (ob_get_length() > 0) {
|
||||
ob_end_flush();
|
||||
}
|
||||
|
||||
exit('</html>');
|
||||
}
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------
|
||||
* EXTENSIONS
|
||||
@ -1087,21 +1112,6 @@ if (get_parameter('login', 0) !== 0) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((bool) $config['maintenance_mode'] === true
|
||||
&& (bool) users_is_admin() === false
|
||||
) {
|
||||
// Show maintenance web-page. For non-admin users only.
|
||||
include 'general/maintenance.php';
|
||||
|
||||
while (ob_get_length() > 0) {
|
||||
ob_end_flush();
|
||||
}
|
||||
|
||||
exit('</html>');
|
||||
}
|
||||
|
||||
|
||||
// Header.
|
||||
if ($config['pure'] == 0) {
|
||||
echo '<div id="container"><div id="head">';
|
||||
|
@ -128,8 +128,8 @@
|
||||
</div>
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.755';
|
||||
$build = '210716';
|
||||
$version = '7.0NG.756';
|
||||
$build = '210804';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
@ -388,7 +388,7 @@ $table_contact->data[] = $data;
|
||||
$data = [];
|
||||
$data[0] = '<b>'.__('Secondary groups').'</b>';
|
||||
$secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
|
||||
if (!$secondary_groups) {
|
||||
if (empty($secondary_groups['for_select']) === true) {
|
||||
$data[1] = '<em>'.__('N/A').'</em>';
|
||||
} else {
|
||||
$secondary_links = [];
|
||||
|
@ -195,8 +195,10 @@ if ($searchAgents) {
|
||||
t1.comentarios COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR
|
||||
t1.id_agente = $aux";
|
||||
|
||||
if (count($id) >= 2) {
|
||||
for ($i = 1; $i < count($id); $i++) {
|
||||
$idCount = count($id);
|
||||
|
||||
if ($idCount >= 2) {
|
||||
for ($i = 1; $i < $idCount; $i++) {
|
||||
$aux = $id[$i]['id_agent'];
|
||||
$search_sql .= " OR t1.id_agente = $aux";
|
||||
}
|
||||
|
@ -1,24 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Data getter for policies searching
|
||||
*
|
||||
* @category Operation
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Get global data.
|
||||
global $config;
|
||||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
$searchpolicies = (bool) check_acl($config['id_user'], 0, 'AW');
|
||||
|
||||
$searchpolicies = check_acl($config['id_user'], 0, 'AW');
|
||||
|
||||
if (!$searchpolicies) {
|
||||
if ($searchpolicies === false) {
|
||||
$totalPolicies = 0;
|
||||
return;
|
||||
}
|
||||
@ -38,6 +53,7 @@ switch ($sortField) {
|
||||
case 'id':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
default:
|
||||
$selectpolicieIDUp = $selected;
|
||||
$order = [
|
||||
'field' => 'id',
|
||||
@ -58,6 +74,7 @@ switch ($sortField) {
|
||||
case 'name':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
default:
|
||||
$selectNameUp = $selected;
|
||||
$order = [
|
||||
'field' => 'name',
|
||||
@ -78,6 +95,7 @@ switch ($sortField) {
|
||||
case 'description':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
default:
|
||||
$selectId_groupUp = $selected;
|
||||
$order = [
|
||||
'field' => 'description',
|
||||
@ -98,6 +116,7 @@ switch ($sortField) {
|
||||
case 'last_contact':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
default:
|
||||
$selectId_groupUp = $selected;
|
||||
$order = [
|
||||
'field' => 'last_connect',
|
||||
@ -118,6 +137,7 @@ switch ($sortField) {
|
||||
case 'id_group':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
default:
|
||||
$selectId_groupUp = $selected;
|
||||
$order = [
|
||||
'field' => 'last_connect',
|
||||
@ -138,6 +158,7 @@ switch ($sortField) {
|
||||
case 'status':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
default:
|
||||
$selectStatusUp = $selected;
|
||||
$order = [
|
||||
'field' => 'is_admin',
|
||||
@ -174,31 +195,39 @@ switch ($sortField) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($searchpolicies) {
|
||||
if ($searchpolicies === true) {
|
||||
/*
|
||||
We take the user groups to get policies that meet the requirements of the search
|
||||
and which the user have permission on this groups
|
||||
*/
|
||||
|
||||
$user_groups = users_get_groups($config['id_user'], 'AR', false);
|
||||
$id_user_groups = array_keys($user_groups);
|
||||
$id_user_groups_str = implode(',', $id_user_groups);
|
||||
|
||||
$sql = "SELECT id, name, description, id_group, status
|
||||
FROM tpolicies
|
||||
WHERE name LIKE '$stringSearchSQL'
|
||||
AND id_group IN ($id_user_groups_str)";
|
||||
$sql = "SELECT id, name, description, id_group, status
|
||||
FROM tpolicies
|
||||
WHERE name LIKE '$stringSearchSQL'
|
||||
AND
|
||||
(id_group IN ($id_user_groups_str)
|
||||
OR 1 = (
|
||||
SELECT is_admin
|
||||
FROM tusuario
|
||||
WHERE id_user = 'admin'
|
||||
)
|
||||
)
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
$sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0);
|
||||
$sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0);
|
||||
|
||||
$policies = db_process_sql($sql);
|
||||
|
||||
|
||||
if ($policies !== false) {
|
||||
$totalPolicies = count($policies);
|
||||
|
||||
if ($only_count) {
|
||||
if ($only_count === true) {
|
||||
unset($policies);
|
||||
}
|
||||
} else {
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.755
|
||||
%define release 210716
|
||||
%define version 7.0NG.756
|
||||
%define release 210804
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.755
|
||||
%define release 210716
|
||||
%define version 7.0NG.756
|
||||
%define release 210804
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.755
|
||||
%define release 210716
|
||||
%define version 7.0NG.756
|
||||
%define release 210804
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -9,7 +9,7 @@
|
||||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.755"
|
||||
PI_VERSION="7.0NG.756"
|
||||
FORCE=0
|
||||
DESTDIR=""
|
||||
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
|
@ -2747,8 +2747,9 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
|
||||
`auth_token` text,
|
||||
`id_group` int(10) unsigned NOT NULL default 0,
|
||||
`api_password` text NOT NULL,
|
||||
`disabled` tinyint(1) unsigned NOT NULL default '0',
|
||||
`last_event_replication` bigint(20) default '0',
|
||||
`disabled` tinyint(1) unsigned NOT NULL default 0,
|
||||
`unified` tinyint(1) unsigned NOT NULL default 0,
|
||||
`last_event_replication` bigint(20) default 0,
|
||||
`server_uid` text NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB
|
||||
|
@ -102,6 +102,9 @@ def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterva
|
||||
if graph.text == "Id does not exist in database.":
|
||||
print (f"Error requested Pandora api url, status code: {graph.text}. skipping graph generation")
|
||||
return None
|
||||
if graph.text == "The user has not enough permissions for perform this action.":
|
||||
print (f"Error requested Pandora api url, status code: {graph.text} Skiping graph generation")
|
||||
return None
|
||||
except:
|
||||
print("Error requested api url. skipping graph generation")
|
||||
return None
|
||||
|
@ -106,6 +106,9 @@ def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterva
|
||||
if graph.text == "Id does not exist in database.":
|
||||
print (f"Error requested Pandora api url, status code: {graph.text}. skipping graph generation")
|
||||
return None
|
||||
if graph.text == "The user has not enough permissions for perform this action.":
|
||||
print (f"Error requested Pandora api url, status code: {graph.text} Skiping graph generation")
|
||||
return None
|
||||
|
||||
except:
|
||||
print("Error requested api url. skipping graph generation")
|
||||
|
@ -1,27 +1,169 @@
|
||||
import requests, argparse, json, sys, os
|
||||
from datetime import datetime
|
||||
from base64 import b64decode
|
||||
|
||||
__version__='080621'
|
||||
|
||||
### Variables and arg parser ###
|
||||
parser = argparse.ArgumentParser(description='Bot telegram cli')
|
||||
parser = argparse.ArgumentParser(description=f'Bot telegram cli, Version: {__version__}')
|
||||
parser.add_argument('-m', '--message', help='Message to be send', required=True)
|
||||
parser.add_argument('-t', '--token', help='Bot token', required=True)
|
||||
parser.add_argument('-c', '--chat_id', help='chat id to send messages', required=True)
|
||||
parser.add_argument('--api_conf', help='Api configuration parameters in coma separate keypairs. EX "user=admin,pass=pandora,api_pass=1234,api_url=http://test.artica.es/pandora_console/include/api.php"')
|
||||
parser.add_argument('--module_graph', help='Uses pandora API to generate a module graph and attach it to the alert needs module_id and interval parameters in coma separate keypairs. EX "module_id=55,interval=3600"')
|
||||
parser.add_argument('--tmp_dir', help='Temporary path to store graph images', default='/tmp')
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
def parse_dic(cValues):
|
||||
"""convert coma separate keypairs into a dic. EX "test=5,house=8,market=2" wil return "{'test': '5', 'casa': '8', 'mercado': '2'}" """
|
||||
data={}
|
||||
try :
|
||||
for kv in cValues.split(","):
|
||||
k,v = kv.strip().split("=")
|
||||
data[k.strip()]=v.strip()
|
||||
except Exception as e :
|
||||
print(f"Warning, error parsing keypairs values: {e}")
|
||||
return data
|
||||
|
||||
|
||||
def parse_api_conf(cConf):
|
||||
"""Check apiconfiguration parameters """
|
||||
if args.api_conf :
|
||||
# Parse Api config
|
||||
print ("Api config enable", file=sys.stderr)
|
||||
apid = parse_dic(cConf)
|
||||
|
||||
if apid.get("user") is None:
|
||||
print ("Warning. no user defined in api_conf keypairs, skiping graph generation.")
|
||||
return None
|
||||
|
||||
if apid.get("pass") is None:
|
||||
print ("Warning. no password defined in api_conf keypairs, skiping graph generation.")
|
||||
return None
|
||||
|
||||
if apid.get("api_pass") is None:
|
||||
print ("Warning. no api pass defined in api_conf keypairs, skiping graph generation.")
|
||||
return None
|
||||
|
||||
if apid.get("api_url") is None:
|
||||
apid['api_url'] = "http://127.0.0.1/pandora_console/include/api.php"
|
||||
#print(f"api_url: {apid['api_url']}")
|
||||
|
||||
return apid
|
||||
else:
|
||||
return None
|
||||
|
||||
def parse_graph_conf(cGraph):
|
||||
"""Check module graph parameters """
|
||||
if cGraph :
|
||||
# Parse Api config
|
||||
graphd = parse_dic(cGraph)
|
||||
if graphd.get("module_id") is None:
|
||||
print ("Warning. no module_id defined in module_graph keypairs, skiping graph generation.")
|
||||
return
|
||||
|
||||
if graphd.get("interval") is None:
|
||||
graphd["interval"] = 3600
|
||||
|
||||
return graphd
|
||||
else:
|
||||
print("Warning. no module_graph keypairs defined, skiping graph generation")
|
||||
return None
|
||||
|
||||
def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterval, sep="url_encode_separator_%7C") :
|
||||
"""Call Pandorafms api to get graph"""
|
||||
|
||||
try:
|
||||
url = f"{baseUrl}?op=get&op2=module_graph&id={moduleId}&other={graphInterval}%7C1&other_mode={sep}&apipass={apiPass}&api=1&user={pUser}&pass={pPass}"
|
||||
graph = requests.get(url)
|
||||
if graph.status_code != 200:
|
||||
print (f"Error requested api url, status code: {graph.status_code}. Skiping graph generation")
|
||||
return None
|
||||
if graph.text == "auth error":
|
||||
print (f"Error requested Pandora api url, status code: {graph.text}. Skiping graph generation")
|
||||
return None
|
||||
if graph.text == "Id does not exist in database.":
|
||||
print (f"Error requested Pandora api url, status code: {graph.text}. Skiping graph generation")
|
||||
return None
|
||||
if graph.text == "The user has not enough permissions for perform this action.":
|
||||
print (f"Error requested Pandora api url, status code: {graph.text} Skiping graph generation")
|
||||
return None
|
||||
|
||||
except:
|
||||
print("Error requested api url. Skiping graph generation")
|
||||
return None
|
||||
return graph
|
||||
|
||||
def send(mssg, chatId, token):
|
||||
url = f"https://api.telegram.org/bot{token}/sendMessage"
|
||||
headers = {'content-type': 'application/json'}
|
||||
|
||||
data = {
|
||||
"chat_id": chatId,
|
||||
"text": mssg
|
||||
}
|
||||
|
||||
response = requests.get(url, data=json.dumps(data), headers=headers)
|
||||
try:
|
||||
response = requests.get(url, data=json.dumps(data), headers=headers)
|
||||
r = response.json()
|
||||
print(r)
|
||||
except Exception as e :
|
||||
r = None
|
||||
exit(f"Error requesting telegram api: {e}")
|
||||
|
||||
r = response.json()
|
||||
print(r)
|
||||
|
||||
def sendMedia(mssg, chatId, token, filepath):
|
||||
url = f"https://api.telegram.org/bot{token}/sendPhoto"
|
||||
data = {
|
||||
"chat_id": chatId,
|
||||
"caption": mssg
|
||||
}
|
||||
try:
|
||||
with open(filepath, "rb") as photog:
|
||||
request = requests.post(url, data=data, files={'photo': (filepath, photog)})
|
||||
r = request.json()
|
||||
except Exception as e :
|
||||
r = None
|
||||
print(f"Error, cant add graph file: {e}")
|
||||
|
||||
if r is not None:
|
||||
r = request.json()
|
||||
print(r)
|
||||
|
||||
# Parse api config
|
||||
filecap=None
|
||||
|
||||
if args.api_conf :
|
||||
api = parse_api_conf(args.api_conf)
|
||||
# Parse graph config
|
||||
if api is not None:
|
||||
graph_cfg = parse_graph_conf(args.module_graph)
|
||||
|
||||
## Generate graph
|
||||
if graph_cfg is not None :
|
||||
graph = get_graph_by_moduleid (api["api_url"],api["user"], api["pass"], api["api_pass"], graph_cfg["module_id"], graph_cfg["interval"])
|
||||
if graph is not None:
|
||||
try:
|
||||
filename = f"{args.tmp_dir}/graph_{graph_cfg['module_id']}.{datetime.now().strftime('%s')}.png"
|
||||
with open(filename, "wb") as f:
|
||||
f.write(b64decode(graph.text))
|
||||
f.close
|
||||
print (f"Graph generated on temporary file {filename}", file=sys.stderr)
|
||||
except Exception as e :
|
||||
print(f"Error, cant generate graph file: {e}", file=sys.stderr)
|
||||
filename = None
|
||||
else: filename = None
|
||||
|
||||
if filename is not None:
|
||||
filecap=f"graph_{graph_cfg['module_id']}.{datetime.now().strftime('%s')}.png"
|
||||
|
||||
# Send message
|
||||
send(mssg=args.message, chatId=args.chat_id, token=args.token)
|
||||
|
||||
if filecap is not None:
|
||||
sendMedia(mssg='', chatId=args.chat_id, token=args.token, filepath=filename)
|
||||
try:
|
||||
os.remove(filename)
|
||||
except Exception as e:
|
||||
exit('Error: {e}')
|
@ -4,3 +4,6 @@ python3 pandora-telegram-cli.py -t 1412764845:AAG-OxOKISOXwhITLFFNm6oq5YD2KI72fT
|
||||
|
||||
# Pandora FMS command definition example
|
||||
python3 pandora-telegram-cli.py -t _field1_ -c _field2_ -m" _field3_"
|
||||
|
||||
# New
|
||||
python3 pandora-telegram-cli.py -m 'test message for telegram new bot script' -t 1874294647:AAHRBk4YDf1QZXh_WuZ8m7ONrAQoKbTW6eQ -c -261593656 --api_conf "user=admin,pass=pandora,api_pass=pandora,api_url=http://192.168.80.44:8080/pandora_console/include/api.php" --module_graph "module_id=402, interval=3600" --tmp_dir /tmp
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 7.0NG.755-210716
|
||||
Version: 7.0NG.756-210804
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.755-210716"
|
||||
pandora_version="7.0NG.756-210804"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# **********************************************************************
|
||||
# Pandora FMS Server Daemon launcher for FreeBSD
|
||||
# (c) 2010 Junichi Satoh <junichi@rworks.jp>
|
||||
# Pandora FMS Server Daemon launcher through pandora_ha for FreeBSD
|
||||
# (c) 2010-2021 Junichi Satoh <junichi@rworks.jp>
|
||||
# (c) 2014 Koichiro Kikuchi <koichiro@rworks.jp>
|
||||
#
|
||||
# **********************************************************************
|
||||
@ -13,63 +13,51 @@
|
||||
|
||||
# Add the following lines to /etc/rc.conf to enable pandora_server:
|
||||
# pandora_server_enable (bool): Set to "YES" to enable pandora_server (default: NO)
|
||||
# pandora_server_profiles (str): Define your profiles here (default: "")
|
||||
#
|
||||
|
||||
. "/etc/rc.subr"
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
|
||||
|
||||
name="pandora_server"
|
||||
name="pandora_ha"
|
||||
rcvar=pandora_server_enable
|
||||
|
||||
: ${pandora_server_enable:=NO}
|
||||
: ${pandora_server_configfile:=/usr/local/etc/pandora/pandora_server.conf}
|
||||
|
||||
command=/usr/local/bin/${name}
|
||||
command_args="-D"
|
||||
command=/usr/local/bin/pandora_ha
|
||||
command_pandora=/usr/local/bin/pandora_server
|
||||
command_interpreter=/usr/local/bin/perl
|
||||
_pidprefix=/var/run/$name
|
||||
_pidprefix=/var/run/pandora_ha
|
||||
_pidprefix_pandora=/var/run/pandora_server
|
||||
pidfile=${_pidprefix}.pid
|
||||
pidfile_pandora=${_pidprefix_pandora}.pid
|
||||
required_files="$pandora_server_configfile"
|
||||
extra_commands="status_server start_server stop_server restart_server"
|
||||
|
||||
stop_postcmd=stop_postcmd
|
||||
|
||||
status_server_cmd=control_pandora_server
|
||||
start_server_cmd=control_pandora_server
|
||||
stop_server_cmd=control_pandora_server
|
||||
restart_server_cmd=control_pandora_server
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
if [ "$2" ]; then
|
||||
profile="$2"
|
||||
if [ "$pandora_server_profiles" ]; then
|
||||
pidfile="${_pidprefix}.${profile}.pid"
|
||||
eval pandora_server_configfile="\${pandora_server_${profile}_configfile:-}"
|
||||
if [ -z "$pandora_server_configfile" ]; then
|
||||
echo "You must define a configuration file (pandora_server_${profile}_configfile)"
|
||||
exit 1
|
||||
fi
|
||||
required_files="$pandora_server_configfile"
|
||||
eval pandora_server_enable="\${pandora_server_${profile}_enable:-$pandora_server_enable}"
|
||||
eval pandora_server_flags="\${pandora_server_${profile}_flags:-$pandora_server_flags}"
|
||||
eval pidfile="\${pandora_server_${profile}_pidfile:-$pidfile}"
|
||||
else
|
||||
echo "$0: extra argument ignored"
|
||||
fi
|
||||
elif [ "${pandora_server_profiles}" ] && [ "$1" ]; then
|
||||
for profile in ${pandora_server_profiles}; do
|
||||
eval _enable="\${pandora_server_${profile}_enable}"
|
||||
case "${_enable:-${pandora_server_enable}}" in
|
||||
[Yy][Ee][Ss]);;
|
||||
*) continue;;
|
||||
esac
|
||||
echo "===> pandora_server profile: ${profile}"
|
||||
/usr/local/etc/rc.d/pandora_server $1 ${profile}
|
||||
retcode="$?"
|
||||
if [ "0${retcode}" -ne 0 ]; then
|
||||
failed="${profile} (${retcode}) ${failed:-}"
|
||||
else
|
||||
success="${profile} ${success:-}"
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
control_pandora_server() {
|
||||
local name command pidfile
|
||||
name="pandora_server"
|
||||
command=$command_pandora
|
||||
pidfile=$pidfile_pandora
|
||||
pandora_server_flags="-D $pandora_server_flags -P $pidfile_pandora $pandora_server_configfile"
|
||||
pandora_arg=`echo $rc_arg | sed 's/_server//g'`
|
||||
unset "${pandora_arg}_cmd" "${pandora_arg}_precmd" "${pandora_arg}_postcmd"
|
||||
run_rc_command $pandora_arg
|
||||
}
|
||||
|
||||
pandora_server_flags="$pandora_server_flags -P $pidfile $pandora_server_configfile"
|
||||
stop_postcmd()
|
||||
{
|
||||
rm -f $pidfile
|
||||
}
|
||||
|
||||
pandora_ha_flags="-d -p $pidfile $pandora_server_configfile"
|
||||
|
||||
run_rc_command "$1"
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# **********************************************************************
|
||||
# Tentacle Server Daemon launcher for FreeBSD
|
||||
# (c) 2010-2012 Junichi Satoh <junichi@rworks.jp>
|
||||
# (c) 2010-2021 Junichi Satoh <junichi@rworks.jp>
|
||||
#
|
||||
# **********************************************************************
|
||||
|
||||
@ -21,17 +21,23 @@ name="tentacle_server"
|
||||
rcvar=tentacle_server_enable
|
||||
|
||||
# read configuration and set defaults
|
||||
tentacle_server_enable=${tentacle_server_enable:-"NO"}
|
||||
tentacle_server_flags=${tentacle_server_flags:-'-a 0.0.0.0 -p 41121 -s /var/spool/pandora/data_in -i.*\.conf:conf\;.*\.md5:md5\;.*\.zip:collections -d'}
|
||||
tentacle_server_user=${tentacle_server_user:-"pandora"}
|
||||
load_rc_config $name
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
|
||||
: ${tentacle_server_enable="NO"}
|
||||
: ${tentacle_server_config="/usr/local/etc/tentacle/${name}.conf"}
|
||||
: ${tentacle_server_pidfile="/var/run/${name}.pid"}
|
||||
|
||||
command=/usr/local/bin/${name}
|
||||
command_interpreter=/usr/local/bin/perl
|
||||
tentacle_server_user=${tentacle_server_user:-"pandora"}
|
||||
#
|
||||
# Use tentacle_server.conf by default.
|
||||
tentacle_server_flags="-F ${tentacle_server_config}"
|
||||
#
|
||||
# Each parameters can also be specified as arguments like this:
|
||||
#tentacle_server_flags=${tentacle_server_flags:-'-a 0.0.0.0 -p 41121 -s /var/spool/pandora/data_in -i.*\.conf:conf\;.*\.md5:md5\;.*\.zip:collections -d'}
|
||||
#
|
||||
procname=$command
|
||||
pidfile=/var/run/$name.pid
|
||||
pidfile=${tentacle_server_pidfile}
|
||||
|
||||
start_postcmd=start_postcmd
|
||||
stop_postcmd=stop_postcmd
|
||||
|
@ -1,7 +1,7 @@
|
||||
#############################################################################
|
||||
# Pandora FMS Server Parameters
|
||||
# Pandora FMS, the Flexible Monitoring System.
|
||||
# Version 7.0NG.755
|
||||
# Version 7.0NG.756
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -45,8 +45,8 @@ our @EXPORT = qw(
|
||||
);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.755";
|
||||
my $pandora_build = "210716";
|
||||
my $pandora_version = "7.0NG.756";
|
||||
my $pandora_build = "210804";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
@ -338,6 +338,7 @@ sub pandora_load_config {
|
||||
$pa_config->{"mssql_driver"} = undef; # 745
|
||||
$pa_config->{"snmpconsole_lock"} = 0; # 755.
|
||||
$pa_config->{"snmpconsole_period"} = 0; # 755.
|
||||
$pa_config->{"snmpconsole_threshold"} = 0; # 755.
|
||||
|
||||
# Internal MTA for alerts, each server need its own config.
|
||||
$pa_config->{"mta_address"} = ''; # Introduced on 2.0
|
||||
|
@ -1651,7 +1651,7 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
||||
$field20 = subst_alert_macros ($field20, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
|
||||
# Field 1 (Integria IMS API path)
|
||||
my $api_path = $config_api_path . "/integria/include/api.php";
|
||||
my $api_path = $config_api_path . "/include/api.php";
|
||||
|
||||
# Field 2 (Integria IMS API pass)
|
||||
my $api_pass = $config_api_pass;
|
||||
@ -3983,13 +3983,66 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
|
||||
$alert_data .= " Custom: $trap_custom_oid";
|
||||
}
|
||||
|
||||
# Assign default values to the _snmp_fx_ macros from variable bindings
|
||||
# Parse variables data.
|
||||
my @custom_values = split("\t", $trap_custom_oid);
|
||||
|
||||
# Evaluate variable filters
|
||||
my $filter_match = 1;
|
||||
for (my $i = 1; $i <= 20; $i++) {
|
||||
my $order_field = $alert->{'order_'.$i} - 1;
|
||||
|
||||
# Only values greater than 0 allowed.
|
||||
next if $order_field < 0;
|
||||
|
||||
my $filter_name = '_snmp_f' . $i . '_';
|
||||
my $filter_regex = safe_output ($alert->{$filter_name});
|
||||
my $field_value = $custom_values[$order_field];
|
||||
|
||||
# No filter for the current binding var
|
||||
next if ($filter_regex eq '');
|
||||
|
||||
# The referenced binding var does not exist
|
||||
if (! defined ($field_value)) {
|
||||
$filter_match = 0;
|
||||
last;
|
||||
}
|
||||
|
||||
# Evaluate the filter
|
||||
eval {
|
||||
local $SIG{__DIE__};
|
||||
if ($field_value !~ m/$filter_regex/) {
|
||||
$filter_match = 0;
|
||||
}
|
||||
};
|
||||
|
||||
# Probably an invalid regexp
|
||||
if ($@) {
|
||||
# Filter is ignored.
|
||||
logger($pa_config, "Invalid regex in SNMP alert #".$alert->{'id_as'}.": [".$filter_regex."]", 3);
|
||||
# Invalid regex are ignored, test next variables.
|
||||
next;
|
||||
}
|
||||
|
||||
# The filter did not match
|
||||
last if ($filter_match == 0);
|
||||
}
|
||||
|
||||
# A filter did not match
|
||||
next if ($filter_match == 0);
|
||||
|
||||
# Assign values to _snmp_fx_ macros.
|
||||
my $count;
|
||||
my @custom_values = split ("\t", $trap_custom_oid);
|
||||
for ($count = 1; defined ($custom_values[$count-1]); $count++) {
|
||||
my $macro_name = '_snmp_f' . $count . '_';
|
||||
my $order_field = $alert->{'order_'.$count};
|
||||
if ($custom_values[$count] =~ m/= \S+: (.*)/) {
|
||||
for ($count = 0; defined ($custom_values[$count]); $count++) {
|
||||
my $macro_name = '_snmp_f' . ($count+1) . '_';
|
||||
my $target = $custom_values[$count];
|
||||
|
||||
if (!defined($target)) {
|
||||
# Ignore emtpy data.
|
||||
$macros{$macro_name} = '';
|
||||
next;
|
||||
}
|
||||
|
||||
if ($target =~ m/= \S+: (.*)/) {
|
||||
my $value = $1;
|
||||
|
||||
# Strip leading and trailing double quotes
|
||||
@ -4009,40 +4062,6 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
|
||||
|
||||
# All variables
|
||||
$macros{'_snmp_argv_'} = $trap_custom_oid;
|
||||
|
||||
# Evaluate _snmp_fx_ filters
|
||||
my $filter_match = 1;
|
||||
for (my $i = 1; $i <= 10; $i++) {
|
||||
my $filter_name = '_snmp_f' . $i . '_';
|
||||
my $filter_value = safe_output ($alert->{$filter_name});
|
||||
|
||||
# No filter for the current binding var
|
||||
next if ($filter_value eq '');
|
||||
|
||||
# The referenced binding var does not exist
|
||||
if (! defined ($macros{$filter_name})) {
|
||||
$filter_match = 0;
|
||||
last;
|
||||
}
|
||||
|
||||
# Evaluate the filter
|
||||
eval {
|
||||
if ($macros{$filter_name} !~ m/$filter_value/) {
|
||||
$filter_match = 0;
|
||||
}
|
||||
};
|
||||
|
||||
# Probably an invalid regexp
|
||||
if ($@) {
|
||||
last;
|
||||
}
|
||||
|
||||
# The filter did not match
|
||||
last if ($filter_match == 0);
|
||||
}
|
||||
|
||||
# A filter did not match
|
||||
next if ($filter_match == 0);
|
||||
|
||||
# Replace macros
|
||||
$alert->{'al_field1'} = subst_alert_macros ($alert->{'al_field1'}, \%macros);
|
||||
@ -4702,9 +4721,9 @@ sub get_module_status ($$$) {
|
||||
# (-inf, warning_min), [warning_max, +inf)
|
||||
else {
|
||||
if ($warning_min == 0) {
|
||||
return 1 if ($data > $warning_max);
|
||||
return 2 if ($data > $warning_max);
|
||||
}elsif ($warning_max == 0) {
|
||||
return 1 if ($data <= $warning_min);
|
||||
return 2 if ($data <= $warning_min);
|
||||
} else {
|
||||
return 2 if ($data < $warning_min || $data >= $warning_max);
|
||||
return 2 if ($data <= $warning_max && $warning_max < $warning_min);
|
||||
@ -6458,7 +6477,7 @@ sub pandora_sync_agents_integria ($) {
|
||||
my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', '');
|
||||
my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', '');
|
||||
|
||||
my $api_path = $config_api_path . "/integria/include/api.php";
|
||||
my $api_path = $config_api_path . "/include/api.php";
|
||||
|
||||
my @agents_string = '';
|
||||
my @agents = get_db_rows ($dbh, 'SELECT * FROM tagente');
|
||||
@ -6506,7 +6525,7 @@ sub pandora_get_integria_ticket_types($) {
|
||||
my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', '');
|
||||
my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', '');
|
||||
|
||||
my $api_path = $config_api_path . "/integria/include/api.php";
|
||||
my $api_path = $config_api_path . "/include/api.php";
|
||||
|
||||
my $call_api = $api_path . '?' .
|
||||
'user=' . $config_integria_user . '&' .
|
||||
|
@ -148,7 +148,7 @@ sub data_producer ($) {
|
||||
OR (status = -1 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()))', $server_id);
|
||||
} else {
|
||||
@rows = get_db_rows ($dbh, 'SELECT * FROM trecon_task
|
||||
WHERE (id_recon_server = ? OR id_recon_server = ANY(SELECT id_server FROM tserver WHERE status = 0 AND server_type = ?))
|
||||
WHERE (id_recon_server = ? OR id_recon_server = ANY(SELECT id_server FROM tserver WHERE status <> 1 AND server_type = ?))
|
||||
AND disabled = 0
|
||||
AND ((utimestamp = 0 AND interval_sweep != 0 OR status = 1)
|
||||
OR (status = -1 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()))', $server_id, DISCOVERYSERVER);
|
||||
|
@ -112,7 +112,7 @@ sub data_producer ($) {
|
||||
} else {
|
||||
@rows = get_db_rows ($dbh, 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag, tagente_estado.last_execution_try, tagente_estado.current_interval + tagente_estado.last_execution_try AS time_left, last_execution_try
|
||||
FROM tagente, tagente_modulo, tagente_estado
|
||||
WHERE ((server_name = ?) OR (server_name = ANY(SELECT name FROM tserver WHERE status = 0 AND server_type = ?)))
|
||||
WHERE ((server_name = ?) OR (server_name = ANY(SELECT name FROM tserver WHERE status <> 1 AND server_type = ?)))
|
||||
AND tagente_modulo.id_agente = tagente.id_agente
|
||||
AND tagente.disabled = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
|
@ -110,7 +110,7 @@ sub data_producer ($) {
|
||||
} else {
|
||||
@rows = get_db_rows ($dbh, 'SELECT DISTINCT(tagente_modulo.id_agente_modulo), tagente_modulo.flag, tagente_estado.current_interval + tagente_estado.last_execution_try AS time_left, last_execution_try
|
||||
FROM tagente, tagente_modulo, tagente_estado
|
||||
WHERE ((server_name = ?) OR (server_name = ANY(SELECT name FROM tserver WHERE status = 0 AND server_type = ?)))
|
||||
WHERE ((server_name = ?) OR (server_name = ANY(SELECT name FROM tserver WHERE status <> 1 AND server_type = ?)))
|
||||
AND tagente_modulo.id_agente = tagente.id_agente
|
||||
AND tagente.disabled = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
|
@ -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.755";
|
||||
my $pandora_build = "210716";
|
||||
my $pandora_version = "7.0NG.756";
|
||||
my $pandora_build = "210804";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -115,7 +115,7 @@ sub data_producer ($) {
|
||||
WHERE ((server_name = ?)
|
||||
OR (server_name = ANY(SELECT name
|
||||
FROM tserver
|
||||
WHERE status = 0 AND server_type = ?))
|
||||
WHERE status <> 1 AND server_type = ?))
|
||||
OR ((server_name = 0 OR server_name IS NULL) AND 1=?)
|
||||
)
|
||||
AND tagente_modulo.id_agente = tagente.id_agente
|
||||
|
@ -109,7 +109,7 @@ sub data_producer ($) {
|
||||
} else {
|
||||
@rows = get_db_rows ($dbh, 'SELECT DISTINCT(tagente_modulo.id_agente_modulo), tagente_modulo.flag, tagente_estado.current_interval + tagente_estado.last_execution_try AS time_left, last_execution_try
|
||||
FROM tagente, tagente_modulo, tagente_estado, tserver
|
||||
WHERE ((server_name = ?) OR (server_name = ANY(SELECT name FROM tserver WHERE status = 0 AND server_type = ?)))
|
||||
WHERE ((server_name = ?) OR (server_name = ANY(SELECT name FROM tserver WHERE status <> 1 AND server_type = ?)))
|
||||
AND tagente_modulo.id_agente = tagente.id_agente
|
||||
AND tagente.disabled = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
|
@ -135,7 +135,7 @@ sub data_producer ($) {
|
||||
} else {
|
||||
@rows = get_db_rows ($dbh, 'SELECT DISTINCT(tagente_modulo.id_agente_modulo), tagente_modulo.flag, tagente_estado.current_interval + tagente_estado.last_execution_try AS time_left, last_execution_try
|
||||
FROM tagente, tagente_modulo, tagente_estado, tserver
|
||||
WHERE ((server_name = ?) OR (server_name = ANY(SELECT server_name FROM tserver WHERE status = 0 AND server_type = ?)))
|
||||
WHERE ((server_name = ?) OR (server_name = ANY(SELECT server_name FROM tserver WHERE status <> 1 AND server_type = ?)))
|
||||
AND tagente_modulo.id_agente = tagente.id_agente
|
||||
AND tagente.disabled = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Pandora FMS Server
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.755
|
||||
%define release 210716
|
||||
%define version 7.0NG.756
|
||||
%define release 210804
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Pandora FMS Server
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.755
|
||||
%define release 210716
|
||||
%define version 7.0NG.756
|
||||
%define release 210804
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -8,8 +8,8 @@
|
||||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.755"
|
||||
PI_BUILD="210716"
|
||||
PI_VERSION="7.0NG.756"
|
||||
PI_BUILD="210804"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
@ -407,6 +407,11 @@ install () {
|
||||
mv ${sh_script}.new $sh_script
|
||||
chmod a+x $sh_script
|
||||
done
|
||||
# install pandora_ha
|
||||
INSTALL_DIR="$DESTDIR$PREFIX/bin/"
|
||||
echo ">Installing the pandora_ha binary to $INSTALL_DIR..."
|
||||
cp -f $DESTDIR$PANDORA_HOME/util/pandora_ha.pl "$INSTALL_DIR/pandora_ha"
|
||||
chmod +x "$INSTALL_DIR/pandora_ha"
|
||||
;;
|
||||
*)
|
||||
SYSTEMD_DIR=$DESTDIR/etc/systemd/system
|
||||
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
||||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.755 Build 210716";
|
||||
my $version = "7.0NG.756 Build 210804";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
@ -159,6 +159,8 @@ sub help_screen {
|
||||
##############################################################################
|
||||
sub ha_keep_pandora_running($$) {
|
||||
my ($conf, $dbh) = @_;
|
||||
my $OSNAME = $^O;
|
||||
my $control_command;
|
||||
|
||||
$conf->{'pandora_service_cmd'} = 'service pandora_server' unless defined($conf->{'pandora_service_cmd'});
|
||||
|
||||
@ -179,18 +181,30 @@ sub ha_keep_pandora_running($$) {
|
||||
$Pandora_Service = $conf->{'pandora_service_cmd'};
|
||||
|
||||
# Check if service is running
|
||||
my $pid = `$Pandora_Service status-server | awk '{print \$NF*1}' | tr -d '\.'`;
|
||||
$control_command = "status-server";
|
||||
if ($OSNAME eq "freebsd") {
|
||||
$control_command = "status_server";
|
||||
}
|
||||
my $pid = `$Pandora_Service $control_command | awk '{print \$NF*1}' | tr -d '\.'`;
|
||||
|
||||
if ( ($pid > 0) && ($component_last_contact > 0)) {
|
||||
# service running but not all components
|
||||
log_message($conf, 'LOG', 'Pandora service running but not all components.');
|
||||
print ">> service running but delayed...\n";
|
||||
`$Pandora_Service restart-server 2>/dev/null`;
|
||||
$control_command = "restart-server";
|
||||
if ($OSNAME eq "freebsd") {
|
||||
$control_command = "restart_server";
|
||||
}
|
||||
`$Pandora_Service $control_command 2>/dev/null`;
|
||||
} elsif ($pid == 0) {
|
||||
# service not running
|
||||
log_message($conf, 'LOG', 'Pandora service not running.');
|
||||
print ">> service not running...\n";
|
||||
`$Pandora_Service start-server 2>/dev/null`;
|
||||
$control_command = "start-server";
|
||||
if ($OSNAME eq "freebsd") {
|
||||
$control_command = "start_server";
|
||||
}
|
||||
`$Pandora_Service $control_command 2>/dev/null`;
|
||||
} elsif ($pid > 0
|
||||
&& $nservers == 0
|
||||
) {
|
||||
@ -202,7 +216,11 @@ sub ha_keep_pandora_running($$) {
|
||||
log_message($conf, 'LOG', 'Pandora service running without servers ['.$nservers.'].');
|
||||
if ($nservers >= 0) {
|
||||
log_message($conf, 'LOG', 'Restarting Pandora service...');
|
||||
`$Pandora_Service restart-serer 2>/dev/null`;
|
||||
$control_command = "restart-server";
|
||||
if ($OSNAME eq "freebsd") {
|
||||
$control_command = "restart_server";
|
||||
}
|
||||
`$Pandora_Service $control_command 2>/dev/null`;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -212,6 +230,7 @@ sub ha_keep_pandora_running($$) {
|
||||
###############################################################################
|
||||
sub ha_update_server($$) {
|
||||
my ($config, $dbh) = @_;
|
||||
my $OSNAME = $^O;
|
||||
|
||||
my $repoServer = pandora_get_tconfig_token(
|
||||
$dbh, 'remote_config', '/var/spool/pandora/data_in'
|
||||
@ -250,8 +269,11 @@ sub ha_update_server($$) {
|
||||
# Restart service
|
||||
$config->{'pandora_service_cmd'} = 'service pandora_server'
|
||||
unless defined($config->{'pandora_service_cmd'});
|
||||
|
||||
`$config->{'pandora_service_cmd'} restart-server 2>/dev/null`;
|
||||
my $control_command = "restart-server";
|
||||
if ($OSNAME eq "freebsd") {
|
||||
$control_command = "restart_server";
|
||||
}
|
||||
`$config->{'pandora_service_cmd'} $control_command 2>/dev/null`;
|
||||
`touch "$lockFile"`;
|
||||
|
||||
# After apply update, permission over files are changed, allow group to
|
||||
@ -359,11 +381,17 @@ sub ha_main($) {
|
||||
# Stop pandora server
|
||||
################################################################################
|
||||
sub stop {
|
||||
my $OSNAME = $^O;
|
||||
|
||||
if ($Running == 1) {
|
||||
$Running = 0;
|
||||
# cleanup and stop pandora_server
|
||||
print ">> stopping server...\n";
|
||||
`$Pandora_Service stop-server 2>/dev/null`;
|
||||
my $control_command = "stop-server";
|
||||
if ($OSNAME eq "freebsd") {
|
||||
$control_command = "stop_server";
|
||||
}
|
||||
`$Pandora_Service $control_command 2>/dev/null`;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
||||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.755 Build 210716";
|
||||
my $version = "7.0NG.756 Build 210804";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user