Merge remote-tracking branch 'origin/develop' into ent-13668-release-777

This commit is contained in:
daniel 2024-05-22 13:38:04 +02:00
commit 42d5bb39fc
34 changed files with 197 additions and 326 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.776-240521
Version: 7.0NG.776-240522
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.776-240521"
pandora_version="7.0NG.776-240522"
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

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.776';
use constant AGENT_BUILD => '240521';
use constant AGENT_BUILD => '240522';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.776
%define release 240521
%define release 240522
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.776
%define release 240521
%define release 240522
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.776
%define release 240521
%define release 240522
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.776
%define release 240521
%define release 240522
Summary: Pandora FMS Linux agent, binary version
Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.776
%define release 240521
%define release 240522
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.776"
PI_BUILD="240521"
PI_BUILD="240522"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{240521}
{240522}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.776 Build 240521")
#define PANDORA_VERSION ("7.0NG.776 Build 240522")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.776(Build 240521))"
VALUE "ProductVersion", "(7.0NG.776(Build 240522))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

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

View File

@ -771,12 +771,7 @@ if ($tab == 'tree') {
}
$search_group_string = get_parameter('search_group_string', '');
$search_agent_string = get_parameter('search_agent_string', '');
$agent_status = get_parameter('agent_status', '');
$show_not_init_agents = get_parameter('show_not_init_agents', 1);
$show_not_init_modules = get_parameter('show_not_init_modules', 1);
$show_full_hirearchy = get_parameter('show_full_hirearchy', 1);
$show_full_hirearchy = get_parameter('show_full_hirearchy', 0);
$table->data = [];
$table->head = [];
@ -800,42 +795,7 @@ if ($tab == 'tree') {
)
);
$agents_status_list = agents_status_list();
$table->data[0][1] = html_print_label_input_block(
__('Search by agent status').ui_print_help_tip(__('Shows the groups that contain an agent with the status that has been searched'), true),
html_print_select(
$agents_status_list,
'agent_status',
$agent_status,
'',
__('All'),
'',
true,
false,
false,
'w200p',
false,
'width: 100%;'
)
);
$table->data[1][0] = html_print_label_input_block(
__('Search by agent').ui_print_help_tip(__('Shows groups that contain an agent matching the search'), true),
html_print_input_text(
'search_agent_string',
$search_agent_string,
'',
25,
255,
true,
false,
false,
'',
)
);
$table->data[1][1] = html_print_label_input_block(
__('Show full hierarchy'),
html_print_checkbox_switch_extended(
'show_full_hirearchy',
@ -848,9 +808,8 @@ if ($tab == 'tree') {
)
);
$table->data[3][0] = ' ';
$table->data[3][1] = html_print_submit_button(
$table->data[0][2] .= ' ';
$table->data[0][2] .= html_print_submit_button(
__('Filter'),
'filter',
false,
@ -865,8 +824,6 @@ if ($tab == 'tree') {
$form .= html_print_table($table, true);
$form .= '</form>';
ui_toggle(
$form,
'<span class="subsection_header_title">'.__('Filters').'</span>',
@ -1207,8 +1164,7 @@ $tab = 'group_edition';
<script type="text/javascript">
let show_full_hirearchy = "<?php echo (isset($show_full_hirearchy) === true) ? $show_full_hirearchy : ''; ?>";
let show_not_init_agents = "<?php echo (isset($show_not_init_agents) === true) ? $show_not_init_agents : ''; ?>";
let show_not_init_modules = "<?php echo (isset($show_not_init_modules) === true) ? $show_not_init_modules : ''; ?>";
let search_group_string = "<?php echo (isset($search_group_string) === true) ? $search_group_string : ''; ?>";
$('#checkbox-show_full_hirearchy').on("change", function() {
if (show_full_hirearchy == 1) {
@ -1221,17 +1177,17 @@ $tab = 'group_edition';
$('#button-filter').on('click', function(event) {
event.preventDefault();
load_tree(show_full_hirearchy, show_not_init_agents, show_not_init_modules);
load_tree(show_full_hirearchy);
});
window.addEventListener('load', function() {
load_tree(show_full_hirearchy, show_not_init_agents, show_not_init_modules);
load_tree(show_full_hirearchy);
});
function load_tree(show_full_hirearchy, show_not_init_agents, show_not_init_modules) {
function load_tree(show_full_hirearchy) {
var treeController = TreeController.getController();
treeController.meta = <?php echo (is_metaconsole() === true) ? 1 : 0; ?>;
@ -1245,17 +1201,8 @@ $tab = 'group_edition';
parameters['getChildren'] = 1;
parameters['type'] = "<?php echo $tab; ?>";
parameters['filter'] = {};
parameters['filter']['searchHirearchy'] = show_full_hirearchy;
parameters['filter']['searchGroup'] = $('#text-search_group_string').val();
parameters['filter']['searchAgent'] = $('#text-search_agent_string').val();
parameters['filter']['statusAgent'] = $('#agent_status option:selected').val();
parameters['filter']['searchModule'] = '';
parameters['filter']['statusModule'] = '';
parameters['filter']['groupID'] = '';
parameters['filter']['tagID'] = '';
parameters['filter']['searchHirearchy'] = 1;
parameters['filter']['show_full_hirearchy'] = show_full_hirearchy;
parameters['filter']['show_not_init_agents'] = show_not_init_agents;
parameters['filter']['show_not_init_modules'] = show_not_init_modules;
$.ajax({
type: "POST",
@ -1273,44 +1220,7 @@ $tab = 'group_edition';
tree: data.tree,
baseURL: "<?php echo ui_get_full_url(false, false, false, is_metaconsole()); ?>",
ajaxURL: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
filter: parameters['filter'],
counterTitles: {
total: {
agents: "<?php echo __('Total agents'); ?>",
modules: "<?php echo __('Total modules'); ?>",
none: "<?php echo __('Total'); ?>"
},
alerts: {
agents: "<?php echo __('Fired alerts'); ?>",
modules: "<?php echo __('Fired alerts'); ?>",
none: "<?php echo __('Fired alerts'); ?>"
},
critical: {
agents: "<?php echo __('Critical agents'); ?>",
modules: "<?php echo __('Critical modules'); ?>",
none: "<?php echo __('Critical'); ?>"
},
warning: {
agents: "<?php echo __('Warning agents'); ?>",
modules: "<?php echo __('Warning modules'); ?>",
none: "<?php echo __('Warning'); ?>"
},
unknown: {
agents: "<?php echo __('Unknown agents'); ?>",
modules: "<?php echo __('Unknown modules'); ?>",
none: "<?php echo __('Unknown'); ?>"
},
not_init: {
agents: "<?php echo __('Not init agents'); ?>",
modules: "<?php echo __('Not init modules'); ?>",
none: "<?php echo __('Not init'); ?>"
},
ok: {
agents: "<?php echo __('Normal agents'); ?>",
modules: "<?php echo __('Normal modules'); ?>",
none: "<?php echo __('Normal'); ?>"
}
}
filter: parameters['filter']
});
}
},

View File

@ -160,37 +160,21 @@ class TreeGroup extends Tree
$processed_items = $this->getProcessedGroups();
if (empty($processed_items) === false) {
// Filter by group name. This should be done after rerieving
// the items cause we need the possible items descendants.
if (empty($this->filter['searchGroup']) === false) {
// Save the groups which intersect with the user groups.
$groups = db_get_all_rows_filter(
'tgrupo',
['nombre' => '%'.$this->filter['searchGroup'].'%']
);
if ($groups === false) {
$groups = [];
$parentGroup = [
'name' => '',
'children' => $processed_items,
];
if (isset($this->filter['searchHirearchy']) === true
&& (bool) $this->filter['searchHirearchy'] === true
) {
self::getFullHierarchyGroups($parentGroup, $this->filter['searchGroup']);
$result = $parentGroup['children'];
} else {
$result = self::pruneHierarchyGroups($parentGroup, $this->filter['searchGroup']);
}
$userGroupsACL = $this->userGroupsACL;
$ids_hash = array_reduce(
$groups,
function ($userGroups, $group) use ($userGroupsACL) {
$group_id = $group['id_grupo'];
if (isset($userGroupsACL[$group_id]) === true) {
$userGroups[$group_id] = $userGroupsACL[$group_id];
}
return $userGroups;
},
[]
);
$result = self::extractGroupsWithIDs(
$processed_items,
$ids_hash
);
$processed_items = ($result === false) ? [] : $result;
}
@ -200,7 +184,7 @@ class TreeGroup extends Tree
$processed_items,
$this->filter['groupID'],
'group',
$this->strictACL
false
);
$processed_items = ($result === false) ? [] : [$result];
@ -564,23 +548,61 @@ class TreeGroup extends Tree
}
private static function extractGroupsWithIDs($groups, $ids_hash)
/**
* Get all hierarchy groups.
*
* @param array $group Groups.
* @param string $search Serach.
*
* @return boolean
*/
protected static function getFullHierarchyGroups(&$group, $search): bool
{
$result_groups = [];
foreach ($groups as $group) {
if (isset($ids_hash[$group['id']])) {
$result_groups[] = $group;
} else if (!empty($group['children'])) {
$result = self::extractGroupsWithIDs($group['children'], $ids_hash);
if (stripos($group['name'], $search) !== false) {
return true;
}
// Item found on children
if (!empty($result)) {
$result_groups = array_merge($result_groups, $result);
}
if (empty($group['children'] ?? []) === true) {
return false;
}
$has_occurrences = false;
$count_children = count($group['children']);
for ($i = 0; $i < $count_children; $i++) {
if (self::getFullHierarchyGroups($group['children'][$i], $search) === false) {
unset($group['children'][$i]);
} else {
$has_occurrences = true;
}
}
return $result_groups;
return $has_occurrences;
}
/**
* Get prune groups.
*
* @param array $group Groups.
* @param string $search Serach.
*
* @return array
*/
protected static function pruneHierarchyGroups($group, $search): array
{
$matches = [];
foreach (($group['children'] ?? []) as $child) {
if (stripos($child['name'], $search) !== false) {
$matches[] = $child;
} else {
$matches = [
...$matches,
...self::pruneHierarchyGroups($child, $search),
];
}
}
return $matches;
}
@ -622,7 +644,7 @@ class TreeGroup extends Tree
protected function getDisplayHierarchy()
{
if (isset($this->filter['searchHirearchy']) === false) {
$this->filter['searchHirearchy'] = '';
$this->filter['searchHirearchy'] = false;
}
return $this->filter['searchHirearchy'] ||

View File

@ -91,39 +91,22 @@ class TreeGroupEdition extends TreeGroup
*/
protected function getProcessedGroups()
{
$processed_groups = [];
// Index and process the groups.
$groups = $this->getGroupCounters();
// If user have not permissions in parent, set parent node to 0 (all)
// Avoid to do foreach for admins.
if (users_can_manage_group_all('AR') === false) {
foreach ($groups as $id => $group) {
if (isset($this->userGroups[$groups[$id]['parent']]) === false) {
$groups[$id]['parent'] = 0;
$groups = $this->getGroups();
foreach ($groups as $id => $group) {
if (isset($groups[$id]['parent']) === true
&& ($groups[$id]['parent'] != 0)
) {
$parent = $groups[$id]['parent'];
// Parent exists.
if (isset($groups[$parent]['children']) === false) {
$groups[$parent]['children'] = [];
}
}
}
// Build the group hierarchy.
if (isset($this->filter['show_full_hirearchy']) === false
|| (isset($this->filter['show_full_hirearchy']) === true && (bool) $this->filter['show_full_hirearchy'] === true)
) {
foreach ($groups as $id => $group) {
if (isset($groups[$id]['parent']) === true
&& ($groups[$id]['parent'] != 0)
) {
$parent = $groups[$id]['parent'];
// Parent exists.
if (isset($groups[$parent]['children']) === false) {
$groups[$parent]['children'] = [];
}
// Store a reference to the group into the parent.
$groups[$parent]['children'][] = &$groups[$id];
// This group was introduced into a parent.
$groups[$id]['have_parent'] = true;
}
// Store a reference to the group into the parent.
$groups[$parent]['children'][] = &$groups[$id];
// This group was introduced into a parent.
$groups[$id]['have_parent'] = true;
}
}
@ -162,121 +145,28 @@ class TreeGroupEdition extends TreeGroup
*
* @return mixed
*/
protected function getGroupCounters()
protected function getGroups()
{
$messages = [
'confirm' => __('Confirm'),
'cancel' => __('Cancel'),
'messg' => __('Are you sure?'),
];
$group_acl = '';
$search_agent = '';
$status_agent = '';
$inner_agent = '';
if ((bool) is_metaconsole() === true) {
if (users_can_manage_group_all('AR') === false) {
$user_groups_str = implode(',', $this->userGroupsArray);
$group_acl = sprintf(
' AND tgrupo.id_grupo IN (%s) ',
$user_groups_str
);
}
if (isset($this->filter['searchAgent']) === true && empty($this->filter['searchAgent']) === false
|| isset($this->filter['statusAgent']) === true && strlen($this->filter['statusAgent']) > 0
) {
$inner_agent = 'INNER JOIN tmetaconsole_agent ON tgrupo.id_grupo = tmetaconsole_agent.id_grupo';
}
if (isset($this->filter['searchAgent']) === true && empty($this->filter['searchAgent']) === false) {
$search_agent = ' AND tmetaconsole_agent.alias LIKE "%'.$this->filter['searchAgent'].'%" ';
}
if (isset($this->filter['statusAgent']) === true && strlen($this->filter['statusAgent']) > 0) {
switch ($this->filter['statusAgent']) {
case AGENT_STATUS_NORMAL:
$status_agent = ' AND (
tmetaconsole_agent.critical_count = 0
AND tmetaconsole_agent.warning_count = 0
AND tmetaconsole_agent.unknown_count = 0
AND tmetaconsole_agent.normal_count > 0)';
break;
case AGENT_STATUS_WARNING:
$status_agent = ' AND (
tmetaconsole_agent.critical_count = 0
AND tmetaconsole_agent.warning_count > 0
AND tmetaconsole_agent.total_count > 0)';
break;
case AGENT_STATUS_CRITICAL:
$status_agent = ' AND tmetaconsole_agent.critical_count > 0';
break;
case AGENT_STATUS_UNKNOWN:
$status_agent = ' AND (
tmetaconsole_agent.critical_count = 0
AND tmetaconsole_agent.warning_count = 0
AND tmetaconsole_agent.unknown_count > 0)';
break;
case AGENT_STATUS_NOT_NORMAL:
$status_agent = ' AND (
tmetaconsole_agent.normal_count <> total_count
OR tmetaconsole_agent.total_count = notinit_count)';
break;
case AGENT_STATUS_NOT_INIT:
$status_agent = ' AND (
tmetaconsole_agent.total_count = 0
OR tmetaconsole_agent.total_count = notinit_count)';
break;
default:
// Nothing to do.
break;
}
}
$sql = sprintf(
'SELECT tgrupo.id_grupo AS gid,
tgrupo.nombre as name,
tgrupo.parent,
tgrupo.icon
FROM tgrupo
%s
WHERE 1=1
%s
%s
%s ',
$inner_agent,
$search_agent,
$status_agent,
$group_acl
);
} else {
if (users_can_manage_group_all('AR') === false) {
$user_groups_str = implode(',', $this->userGroupsArray);
$group_acl = sprintf(
'AND id_grupo IN (%s)',
$user_groups_str
);
}
$sql = sprintf(
'SELECT id_grupo AS gid,
nombre as name,
parent,
icon
FROM tgrupo
WHERE 1=1
%s ',
$group_acl
if (users_can_manage_group_all('AR') === false) {
$user_groups_str = implode(',', $this->userGroupsArray);
$group_acl = sprintf(
'AND id_grupo IN (%s)',
$user_groups_str
);
}
$sql = sprintf(
'SELECT id_grupo AS gid,
nombre as name,
parent,
icon
FROM tgrupo
WHERE 1=1
%s',
$group_acl
);
$stats = db_get_all_rows_sql($sql);
$group_stats = [];
foreach ($stats as $group) {
@ -290,6 +180,12 @@ class TreeGroupEdition extends TreeGroup
$group_stats[$group['gid']]
);
if (is_management_allowed() === true) {
$messages = [
'confirm' => __('Confirm'),
'cancel' => __('Cancel'),
'messg' => __('Are you sure?'),
];
$group_stats[$group['gid']]['delete']['messages'] = $messages;
$group_stats[$group['gid']]['edit'] = 1;
}

View File

@ -22,7 +22,7 @@ use DI\ContainerBuilder;
/*
* Pandora build version and version
*/
$build_version = 'PC240521';
$build_version = 'PC240522';
$pandora_version = 'v7.0NG.776';
// Do not overwrite default timezone set if defined.

View File

@ -197,7 +197,7 @@ function users_get_groups_for_select(
*
* @return array
*/
function get_group_ancestors($group_id, $groups)
function get_group_ancestors($group_id, $groups, $forceNotPropagate=false)
{
if ($group_id == 0) {
return 0;
@ -209,8 +209,10 @@ function get_group_ancestors($group_id, $groups)
$parent = $groups[$group_id]['parent'];
if ($groups[$group_id]['propagate'] == 0) {
return $group_id;
if ($forceNotPropagate === false) {
if ($groups[$group_id]['propagate'] == 0) {
return $group_id;
}
}
$r = get_group_ancestors($parent, $groups);

View File

@ -14351,3 +14351,39 @@ div.fixed-bottom-box.tree-view-bottom-modal {
#container_servicemap #service_map3 {
min-height: 174px;
}
/* HACK FOR FIREROX SNMP TRAPS VIEW */
td.snmp-td:has(a.datos_green),
td.snmp-td:has(div.datos_green) {
background-color: #82b92e;
}
td.snmp-td:has(a.datos_blue),
td.snmp-td:has(div.datos_blue) {
background-color: #4ca8e0;
}
td.snmp-td:has(a.datos_grey),
td.snmp-td:has(div.datos_grey) {
background-color: #999999;
}
td.snmp-td:has(a.datos_yellow),
td.snmp-td:has(div.datos_yellow) {
background-color: #f3b200;
}
td.snmp-td:has(a.datos_red),
td.snmp-td:has(div.datos_red) {
background-color: #e63c52;
}
td.snmp-td:has(a.datos_pink),
td.snmp-td:has(div.datos_pink) {
background-color: #fdc4ca;
}
td.snmp-td:has(a.datos_brown),
td.snmp-td:has(div.datos_brown) {
background-color: #a67c52;
}

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'>
<?php
$version = '7.0NG.776';
$build = '240521';
$build = '240522';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.776
%define release 240521
%define release 240522
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.776
%define release 240521
%define release 240522
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.776
%define release 240521
%define release 240522
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

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

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.776";
my $pandora_build = "240521";
my $pandora_build = "240522";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -48,7 +48,6 @@ Exported Functions:
use strict;
use warnings;
use Geo::IP;
# Default lib dir for RPM and DEB packages
BEGIN { push @INC, '/usr/lib/perl5'; }
@ -160,7 +159,7 @@ __END__
=head1 DEPENDENCIES
L<PandoraFMS::DB>, L<PandoraFMS::Tools>, L<Geo::IP>
L<PandoraFMS::DB>, L<PandoraFMS::Tools>
=head1 LICENSE

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.776";
my $pandora_build = "240521";
my $pandora_build = "240522";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -7,7 +7,7 @@
%define debug_package %{nil}
%define name pandorafms_server
%define version 7.0NG.776
%define release 240521
%define release 240522
Summary: Pandora FMS Server
Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_server
%define version 7.0NG.776
%define release 240521
%define release 240522
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.776"
PI_BUILD="240521"
PI_BUILD="240522"
MODE=$1
if [ $# -gt 1 ]; then
@ -146,12 +146,12 @@ install_startup_script () {
[ -d $DESTDIR$INITDIR ] || mkdir -p $DESTDIR$INITDIR
cp $SRC $DESTDIR$INITDIR
[ "$DESTDIR" ] && return
case $DISTRO in
UBUNTU|DEBIAN)
echo "Linking startup script to /etc/rc2.d"
update-rc.d $SCRIPT_NAME defaults
ln -s $DESTDIR$INITDIR/$SCRIPT_NAME /etc/init.d/$SCRIPT_NAME
systemctl daemon-reload 2> /dev/null
;;
SUSE)
echo "Creating startup daemons"
@ -167,7 +167,9 @@ install_startup_script () {
INITLV=`grep '[0-9]:initdefault' /etc/inittab | cut -f 2 -d ':'`
: ${INITLV:=2}
echo "Linking startup script to /etc/rc.d/rc$INITLV.d/S$SPRIO$SCRIPT_NAME"
ln -s $INITDIR/$SCRIPT_NAME /etc/rc.d/rc$INITLV.d/S$SPRIO$SCRIPT_NAME
ln -s $DESTDIR$INITDIR/$SCRIPT_NAME /etc/rc.d/rc$INITLV.d/S$SPRIO$SCRIPT_NAME
ln -s $DESTDIR$INITDIR/$SCRIPT_NAME /etc/init.d/$SCRIPT_NAME
systemctl daemon-reload 2> /dev/null
fi
;;
esac
@ -300,13 +302,15 @@ install () {
if [ $? -eq 0 ]; then
echo " "
echo "User pandora does exist, make sure the SSH directories are correct"
elif [ "$DESTDIR" ]
then
# chown can fail with fakeroot installation
echo "User 'pandora' does not exist. All chown operations may fail."
echo "You should manualy set proper ownership to $DESTDIR$PANDORA_SPOOL if needed."
echo
else
if [ "$DESTDIR" ]
then
# chown can fail with fakeroot installation
echo "User 'pandora' does not exist. All chown operations may fail."
echo "You should manualy set proper ownership to $DESTDIR$PANDORA_SPOOL if needed."
echo
fi
echo "Are you sure we can create a standard 'pandora' user locally? [y/N]"
read AREYOUSURE
if [ "$AREYOUSURE" = "y" ]; then
@ -495,7 +499,7 @@ install () {
chmod +x "$INSTALL_DIR/pandora_ha"
;;
*)
SYSTEMD_DIR=$DESTDIR/etc/systemd/system
SYSTEMD_DIR=/etc/systemd/system
PID_DIR=$DESTDIR/var/run
INSTALL_DIR="$DESTDIR$PREFIX/bin/"
@ -516,7 +520,7 @@ Type=forking
User=$USER
PIDFile=$PID_DIR/pandora_ha.pid
Restart=always
ExecStart=${INSTALL_DIR}pandora_ha -d -p $PID_DIR/pandora_ha.pid $PANDORA_CONF
ExecStart=${INSTALL_DIR}pandora_ha -d -p $PID_DIR/pandora_ha.pid $DESTDIR$PANDORA_CFG_FILE
[Install]
WantedBy=multi-user.target
@ -530,7 +534,7 @@ EOF
[ ! -d $DESTDIR/etc/cron.hourly ] && mkdir -p $DESTDIR/etc/cron.hourly
echo "Creating the Cron script to run Pandora DB tool each hour"
echo "#!/bin/bash" > $DESTDIR/etc/cron.hourly/pandora_db
echo "perl $PANDORA_HOME/util/pandora_db.pl /etc/pandora/pandora_server.conf" >> $DESTDIR/etc/cron.hourly/pandora_db
echo "perl $DESTDIR$PANDORA_HOME/util/pandora_db.pl $DESTDIR$PANDORA_CFG_FILE" >> $DESTDIR/etc/cron.hourly/pandora_db
chmod +x $DESTDIR/etc/cron.hourly/pandora_db
elif [ "$DISTRO" = "FreeBSD" ] || [ "$DISTRO" = "NetBSD" ]
then
@ -562,6 +566,8 @@ EOF
[ "$WITHOUT_TENTACLE" = 0 ] && \
echo "Define '$TENTACLE_RC_VAR=\"YES\"' in /etc/rc.conf to enable tentacle server daemon."
fi
systemctl daemon-reload 2> /dev/null
}
uninstall () {

View File

@ -38,7 +38,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.776 Build 240521";
my $version = "7.0NG.776 Build 240522";
# Pandora server configuration
my %conf;

View File

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