Merge remote-tracking branch 'origin/develop' into ent-7786-agentes-asignados-a-politicas-en-metaconsola

This commit is contained in:
fbsanchez 2021-07-21 21:17:49 +02:00
commit 160ccd94e7
65 changed files with 303 additions and 161 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.755-210720
Version: 7.0NG.756
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.755-210720"
pandora_version="7.0NG.756"
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.755"
VERSION="7.0NG.756"
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.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[

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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.755';
use constant AGENT_BUILD => '210720';
use constant AGENT_VERSION => '7.0NG.756';
use constant AGENT_BUILD => '210721';
# 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.755
%define release 210720
%define version 7.0NG.756
%define release 1
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.755"
PI_BUILD="210720"
PI_VERSION="7.0NG.756"
PI_BUILD="210721"
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.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

View File

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

View File

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

View File

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

View File

@ -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,8 +25,6 @@ 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
@ -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;

View File

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

View File

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

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

View File

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

View File

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

View File

@ -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();
}

View File

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

View File

@ -1040,6 +1040,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 +1111,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">';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.755-210720
Version: 7.0NG.756
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.755-210720"
pandora_version="7.0NG.756"
package_cpan=0
package_pandora=1

View File

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

View File

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

View File

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

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.755";
my $pandora_build = "210720";
my $pandora_version = "7.0NG.756";
my $pandora_build = "210721";
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

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.755";
my $pandora_build = "210720";
my $pandora_version = "7.0NG.756";
my $pandora_build = "210721";
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.755
%define release 210720
%define version 7.0NG.756
%define release 1
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

@ -8,8 +8,8 @@
# This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.755"
PI_BUILD="210720"
PI_VERSION="7.0NG.756"
PI_BUILD="210721"
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

View File

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

View File

@ -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`;
}
}

View File

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