Merge branch 'develop' into ent-10253-enforcement-de-opciones-de-configuracion-aviso-en-consola

This commit is contained in:
Daniel Cebrian 2023-02-27 14:58:25 +01:00
commit c8096d73b2
45 changed files with 235 additions and 254 deletions

View File

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

@ -1023,7 +1023,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.769';
use constant AGENT_BUILD => '230222';
use constant AGENT_BUILD => '230227';
# 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.769
%define release 230222
%define release 230227
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.769"
PI_BUILD="230222"
PI_BUILD="230227"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230222}
{230227}
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.769 Build 230222")
#define PANDORA_VERSION ("7.0NG.769 Build 230227")
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.769(Build 230222))"
VALUE "ProductVersion", "(7.0NG.769(Build 230227))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

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

View File

@ -227,7 +227,7 @@ function dbmgr_extension_main()
'dbport' => $node->dbport(),
'dbname' => $node->dbname(),
'dbuser' => $node->dbuser(),
'dbpass' => $node->dbpass(),
'dbpass' => io_output_password($node->dbpass()),
]
);
$error = '';

View File

@ -391,7 +391,7 @@ foreach ($actions as $action) {
$data = [];
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.$action['name'].'</a>';
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'&offset='.$offset.'">'.$action['name'].'</a>';
if ($action['id_group'] == 0 && $can_edit_all == false) {
$data[0] .= ui_print_help_tip(__('You cannot edit this action, You don\'t have the permission to edit All group.'), true);
}
@ -467,7 +467,7 @@ if (isset($data)) {
if (is_management_allowed() === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'&offset='.$offset.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
html_print_input_hidden('create_alert', 1);
echo '</form>';

View File

@ -795,15 +795,15 @@ foreach ($commands as $command) {
);
$data['action'] = '';
$table->cellclass[]['action'] = 'action_buttons';
$offset_delete = ($offset >= ($total_commands - 1)) ? ($offset - $limit) : $offset;
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.
if ($is_management_allowed === true && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
if (is_user_admin($config['id_user']) === true) {
$data['action'] = '<span class="inline_flex">';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'"
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'&offset='.$offset.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true, ['class' => 'invert_filter']).'</a>';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'"
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'&offset='.$offset_delete.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>';
$data['action'] .= '</span>';
}

View File

@ -352,7 +352,8 @@ if ($search_string) {
$filter[] = "(name LIKE '%".$search_string."%' OR description LIKE '%".$search_string."%' OR value LIKE '%".$search_string."%')";
}
$filter['offset'] = (int) get_parameter('offset');
$offset = (int) get_parameter('offset');
$filter['offset'] = $offset;
$filter['limit'] = (int) $config['block_size'];
if (!is_user_admin($config['id_user'])) {
$filter['id_group'] = array_keys(users_get_groups(false, 'LM'));
@ -420,7 +421,7 @@ foreach ($templates as $template) {
&& check_acl($config['id_user'], $template['id_group'], 'LM')
) {
$table->cellclass[][4] = 'action_buttons';
$data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'" class="float-left inline_line">';
$data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'&offset='.$offset.'" class="float-left inline_line">';
$data[4] .= html_print_input_hidden('duplicate_template', 1, true);
$data[4] .= html_print_input_hidden('source_id', $template['id'], true);
$data[4] .= html_print_input_image(

View File

@ -372,8 +372,9 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
);
}
$offset = (int) get_parameter('offset', 0);
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&pure='.$pure.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&pure='.$pure.'&offset='.$offset.'">';
$table_html = html_print_table($table, true);
echo $table_html;

View File

@ -1147,9 +1147,10 @@ if ($step == 2) {
echo ui_get_using_system_timezone_warning();
}
$offset = (int) get_parameter('offset');
// If it's the last step it will redirect to template lists.
if ($step >= LAST_STEP) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_templates&pure='.$pure.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_templates&pure='.$pure.'&offset='.$offset.'">';
} else {
echo '<form method="post">';
}

View File

@ -40,6 +40,7 @@ $custom_id = '';
$create_group = (bool) get_parameter('create_group');
$id_group = (int) get_parameter('id_group');
$offset = (int) get_parameter('offset', 0);
if ($id_group) {
$group = db_get_row('tmodule_group', 'id_mg', $id_group);
@ -70,9 +71,9 @@ $table->data[0][1] = html_print_input_text('name', $name, '', 35, 100, true);
echo '</span>';
if (is_metaconsole()) {
echo '<form name="grupo" method="post" action="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group">';
echo '<form name="grupo" method="post" action="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&offset='.$offset.'">';
} else {
echo '<form name="grupo" method="post" action="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list">';
echo '<form name="grupo" method="post" action="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&offset='.$offset.'">';
}
html_print_table($table);

View File

@ -262,18 +262,18 @@ if (empty($groups) === false) {
}
$table->data = [];
$offset_delete = ($offset >= $total_groups - 1) ? ($offset - $config['block_size']) : $offset;
foreach ($groups as $id_group) {
$data = [];
$data[0] = $id_group['id_mg'];
if ($is_management_allowed === true) {
$data[1] = '<strong><a href="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group&id_group='.$id_group['id_mg'].'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>';
$data[1] = '<strong><a href="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group&id_group='.$id_group['id_mg'].'&offset='.$offset.'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>';
if (is_metaconsole() === true) {
$data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
$data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1&offset='.$offset_delete.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
} else {
$table->cellclass[][2] = 'action_buttons';
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1&offset='.$offset_delete.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
}
} else {
$data[1] = '<strong>';

View File

@ -597,9 +597,10 @@ if ((bool) $id !== false || $new_component
$search_id_group = (int) get_parameter('search_id_group');
$search_string = (string) get_parameter('search_string');
$offset = (int) get_parameter('offset');
$url = ui_get_url_refresh(
[
'offset' => false,
'offset' => $offset,
'search_string' => $search_string,
'search_id_group' => $search_id_group,
'id' => $id,
@ -607,7 +608,7 @@ $url = ui_get_url_refresh(
true,
false
);
$name_url = 'index.php?sec=templates&sec2=godmode/modules/manage_network_components';
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
@ -712,8 +713,9 @@ $total_components = network_components_get_network_components(
'COUNT(*) AS total'
);
$total_components = $total_components[0]['total'];
ui_pagination($total_components, $url);
$filter['offset'] = (int) get_parameter('offset');
$offset_delete = ($offset >= ($total_components - 1)) ? ($offset - $config['block_size']) : $offset;
ui_pagination($total_components, $name_url);
$filter['offset'] = $offset;
$filter['limit'] = (int) $config['block_size'];
$components = network_components_get_network_components(
false,
@ -791,7 +793,7 @@ foreach ($components as $component) {
true
);
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&pure='.$pure.'">';
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&pure='.$pure.'&offset='.$offset.'">';
$data[0] .= io_safe_output($component['name']);
$data[0] .= '</a>';
} else {
@ -855,7 +857,7 @@ foreach ($components as $component) {
if ($is_management_allowed === true) {
$table->cellclass[][6] = 'action_buttons';
$data[6] = '<a class="inline_line float-left" href="'.$url.'&search_id_group='.$search_id_group.'search_string='.$search_string.'&duplicate_network_component=1&source_id='.$component['id_nc'].'">'.html_print_image(
$data[6] = '<a class="inline_line float-left" href="'.$url.'&search_id_group='.$search_id_group.'search_string='.$search_string.'&duplicate_network_component=1&source_id='.$component['id_nc'].'&offset='.$offset.'">'.html_print_image(
'images/copy.png',
true,
[
@ -864,7 +866,7 @@ foreach ($components as $component) {
'class' => 'invert_filter',
]
).'</a>';
$data[6] .= '<a href="'.$url.'&delete_component=1&id='.$component['id_nc'].'&search_id_group='.$search_id_group.'search_string='.$search_string.'" onclick="if (! confirm (\''.__('Are you sure?').'\')) return false" >'.html_print_image(
$data[6] .= '<a href="'.$url.'&delete_component=1&id='.$component['id_nc'].'&search_id_group='.$search_id_group.'search_string='.$search_string.'&offset='.$offset_delete.'" onclick="if (! confirm (\''.__('Are you sure?').'\')) return false" >'.html_print_image(
'images/cross.png',
true,
[
@ -887,7 +889,7 @@ if (isset($data) === true) {
html_print_table($table);
ui_pagination(
$total_components,
$url,
$name_url,
0,
0,
false,

View File

@ -153,6 +153,9 @@ if ($update_config == 1 && $config['history_db_enabled'] == 1) {
$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control']));
$total_agents = db_get_value('count(*)', 'tagente');
$disable_agentaccess = ($total_agents >= 200 && $config['agentaccess'] == 0) ? true : false;
$table_status = new StdClass();
$table_status->width = '100%';
$table_status->class = 'databox filters';
@ -574,6 +577,19 @@ $table_other->data[$i++][1] = html_print_input(
]
);
$table_other->data[$i][0] = __('Limit of events per query');
$table_other->data[$i++][1] = html_print_input(
[
'type' => 'number',
'size' => 5,
'max' => 10000,
'name' => 'events_per_query',
'value' => $config['events_per_query'],
'return' => true,
'style' => 'width:50px',
]
);
$table_other->data[$i][0] = __('Compact interpolation in hours (1 Fine-20 bad)');
$table_other->data[$i++][1] = html_print_input_text(
'step_compact',
@ -627,7 +643,7 @@ $table_other->data[$i++][1] = html_print_input_text(
);
$table_other->data[$i][0] = __('Use agent access graph');
$table_other->data[$i++][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true);
$table_other->data[$i++][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true, $disable_agentaccess);
$table_other->data[$i][0] = __('Max. recommended number of files in attachment directory');
$table_other->data[$i++][1] = html_print_input_text(

View File

@ -207,14 +207,14 @@ if (empty($tag_name) === false) {
// If the user has filtered the view.
$filter_performed = !empty($filter);
$filter['offset'] = (int) get_parameter('offset');
$offset = (int) get_parameter('offset');
$filter['offset'] = $offset;
$filter['limit'] = (int) $config['block_size'];
// Statements for pagination.
$url = ui_get_url_refresh();
$url = 'index.php?sec=gusuarios&sec2=godmode/tag/tag';
$total_tags = tags_get_tag_count($filter);
$offset_delete = ($offset >= ($total_tags - 1)) ? ($offset - $config['block_size']) : $offset;
$result = tags_search_tag(false, $filter);
// Filter form.
@ -392,7 +392,7 @@ if (empty($result) === false) {
]
);
$data[6] .= '</a>';
$data[6] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/tag/tag&delete_tag='.$tag['id_tag'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image(
$data[6] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/tag/tag&delete_tag='.$tag['id_tag'].'&offset='.$offset_delete.'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image(
'images/cross.png',
true,
[

View File

@ -816,7 +816,7 @@ foreach ($info as $user_id => $user_info) {
$toDoClass = 'filter_none';
}
$data[6] = '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'" class="inline">';
$data[6] = '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'&offset='.$offset.'" class="inline">';
$data[6] .= html_print_input_hidden(
'id',
$user_info['id_user'],
@ -874,7 +874,8 @@ foreach ($info as $user_id => $user_info) {
&& $user_info['id_user'] != $config['id_user']
&& isset($user_info['not_delete']) === false
) {
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'" class="inline">';
$offset_delete = ($offset >= count($info) - 1) ? ($offset - $config['block_size']) : $offset;
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'&offset='.$offset_delete.'" class="inline">';
$data[6] .= html_print_input_hidden(
'delete_user',
$user_info['id_user'],

View File

@ -263,14 +263,21 @@ class ConsoleSupervisor
$this->checkSyncQueueStatus();
}
/*
* Checkc agent missing libraries.
* NOTIF.AGENT.LIBRARY
*/
/*
* Check number of agents is equals and more than 200.
* NOTIF.ACCESSSTASTICS.PERFORMANCE
*/
$this->checkAccessStatisticsPerformance();
/*
* Checkc agent missing libraries.
* NOTIF.AGENT.LIBRARY
*/
if ((bool) enterprise_installed() === true) {
$this->checkLibaryError();
}
}
@ -537,13 +544,22 @@ class ConsoleSupervisor
$this->checkSyncQueueStatus();
}
/*
* Check number of agents is equals and more than 200.
* NOTIF.ACCESSSTASTICS.PERFORMANCE
*/
$this->checkAccessStatisticsPerformance();
/*
* Checkc agent missing libraries.
* NOTIF.AGENT.LIBRARY
*/
if ((bool) enterprise_installed() === true) {
$this->checkLibaryError();
}
}
@ -643,6 +659,34 @@ class ConsoleSupervisor
}
/**
* Check number of agents and disable agentaccess token if number
* is equals and more than 200.
*
* @return void
*/
public function checkAccessStatisticsPerformance()
{
$total_agents = db_get_value('count(*)', 'tagente');
if ($total_agents >= 200) {
db_process_sql_update('tconfig', ['value' => 0], ['token' => 'agentaccess']);
$this->notify(
[
'type' => 'NOTIF.ACCESSSTASTICS.PERFORMANCE',
'title' => __('Access statistics performance'),
'message' => __(
'Usage of agent access statistics IS NOT RECOMMENDED on systems with more than 200 agents due performance penalty'
),
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=perf',
]
);
} else {
$this->cleanNotifications('NOTIF.ACCESSSTASTICS.PERFORMANCE');
}
}
/**
* Update targets for given notification using object targets.
*

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC230222';
$build_version = 'PC230227';
$pandora_version = 'v7.0NG.769';
// Do not overwrite default timezone set if defined.

View File

@ -844,6 +844,10 @@ function config_update_config()
$error_update[] = __('Item limit for realtime reports)');
}
if (config_update_value('events_per_query', (int) get_parameter('events_per_query'), true) === false) {
$error_update[] = __('Limit of events per query');
}
if (config_update_value('step_compact', (int) get_parameter('step_compact'), true) === false) {
$error_update[] = __('Compact interpolation in hours (1 Fine-20 bad)');
}
@ -1982,6 +1986,10 @@ function config_process_config()
config_update_value('report_limit', 100);
}
if (!isset($config['events_per_query'])) {
config_update_value('events_per_query', 5000);
}
if (!isset($config['loginhash_pwd'])) {
config_update_value('loginhash_pwd', io_input_password((rand(0, 1000) * rand(0, 1000)).'pandorahash'));
}

View File

@ -2018,7 +2018,7 @@ function events_change_status(
// Update ack info if the new status is validated.
$ack_utimestamp = 0;
$ack_user = $config['id_user'];
if ((int) $new_status === EVENT_STATUS_VALIDATED) {
if ((int) $new_status === EVENT_STATUS_VALIDATED || (int) $new_status === EVENT_STATUS_INPROCESS) {
$ack_utimestamp = time();
}
@ -4814,7 +4814,7 @@ function events_page_general($event)
$data = [];
$data[0] = __('Acknowledged by');
if ($event['estado'] == 1) {
if ($event['estado'] == 1 || $event['estado'] == 2) {
if (empty($event['id_usuario']) === true) {
$user_ack = __('Autovalidated');
} else {
@ -4948,7 +4948,7 @@ function events_page_general_acknowledged($event_id)
global $config;
$Acknowledged = '';
$event = db_get_row('tevento', 'id_evento', $event_id);
if ($event !== false && $event['estado'] == 1) {
if ($event !== false && ($event['estado'] == 1 || $event['estado'] == 2)) {
$user_ack = db_get_value(
'fullname',
'tusuario',

View File

@ -159,6 +159,7 @@ function notifications_get_subtypes(?string $source=null)
'NOTIF.SERVER.STATUS',
'NOTIF.SERVER.QUEUE',
'NOTIF.SERVER.MASTER',
'NOTIF.ACCESSSTASTICS.PERFORMANCE',
'NOTIF.VARIABLES.PERFORMANCE',
],
];

View File

@ -696,6 +696,8 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=reporting&sec2=operation/cluster/cluster&op=update&id='.$cluster->id().'">';
$go_to_agent .= html_print_submit_button(__('Go to cluster edition'), 'upd_button', false, 'class="sub config"', true);
} else {
$go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.$ent.'&status_hierachy_mode_sent=1&moduletype=dataserver&edit_module=1&updbutton=Create&sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente=2">';
$go_to_agent .= html_print_submit_button(__('Go to module creation'), 'upd_button', false, 'class="sub config"', true);
$go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$ent.'">';
$go_to_agent .= html_print_submit_button(__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
}

View File

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

View File

@ -1469,6 +1469,12 @@ if (!empty($result)) {
$table->align[11] = 'left';
}
if (check_acl($config['id_user'], 0, 'AR')) {
$actions_list = true;
$table->head[12] = __('Actions');
$table->align[12] = 'left';
}
$id_type_web_content_string = db_get_value(
'id_tipo',
'ttipo_modulo',
@ -1589,31 +1595,6 @@ if (!empty($result)) {
if (in_array('data_type', $show_fields) || is_metaconsole()) {
$data[2] = html_print_image('images/'.modules_show_icon_type($row['module_type']), true, ['class' => 'invert_filter']);
$agent_groups = is_metaconsole() ? $row['groups_in_server'] : agents_get_all_groups_agent($row['id_agent'], $row['id_group']);
if (check_acl_one_of_groups($config['id_user'], $agent_groups, 'AW')) {
$show_edit_icon = true;
if (defined('METACONSOLE')) {
if (!can_user_access_node()) {
$show_edit_icon = false;
}
$url_edit_module = $row['server_url'].'index.php?'.'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'id_agente='.$row['id_agent'].'&'.'tab=module&'.'id_agent_module='.$row['id_agente_modulo'].'&'.'edit_module=1'.'&loginhash=auto&loginhash_data='.$row['hashdata'].'&loginhash_user='.str_rot13($row['user']);
} else {
$url_edit_module = 'index.php?'.'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'id_agente='.$row['id_agent'].'&'.'tab=module&'.'id_agent_module='.$row['id_agente_modulo'].'&'.'edit_module=1';
}
if ($show_edit_icon) {
$table->cellclass[][2] = 'action_buttons';
$data[2] .= '<a href="'.$url_edit_module.'">'.html_print_image(
'images/config.png',
true,
[
'alt' => '0',
'border' => '',
'title' => __('Edit'),
]
).'</a>';
}
}
}
if (in_array('module_name', $show_fields) || is_metaconsole()) {
@ -2089,6 +2070,39 @@ if (!empty($result)) {
$data[11] = ui_print_timestamp($row['utimestamp'], true, $option);
}
if (check_acl_one_of_groups($config['id_user'], $agent_groups, 'AW')) {
if (defined('METACONSOLE')) {
$url_edit_module = $row['server_url'].'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&';
$url_edit_module .= 'loginhash=auto&id_agente='.$row['id_agent'];
$url_edit_module .= '&tab=module&id_agent_module='.$row['id_agente_modulo'].'&edit_module=1&';
$url_edit_module .= 'loginhash_data='.$row['hashdata'].'&loginhash_user='.str_rot13($row['user']);
$url_delete_module = $row['server_url'].'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente';
$url_delete_module .= '&id_agente='.$row['id_agent'].'&delete_module='.$row['id_agente_modulo'];
$table->cellclass[][2] = 'action_buttons';
$data[12] .= '<a href="'.$url_edit_module.'">'.html_print_image(
'images/config.png',
true,
[
'alt' => '0',
'border' => '',
'title' => __('Edit'),
]
).'</a>';
$onclick = 'onclick="javascript: if (!confirm(\''.__('Are you sure to delete?').'\')) return false;';
$data[12] .= '<a href="'.$url_delete_module.'" '.$onclick.'" target="_blank">'.html_print_image(
'images/delete.png',
true,
[
'alt' => '0',
'border' => '',
'title' => __('Delete'),
]
).'</a>';
}
}
array_push($table->data, $data);
}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.769
%define release 230222
%define release 230227
# 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.769
%define release 230222
%define release 230227
# 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.769
%define release 230222
%define release 230227
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1,7 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import gspread
import argparse
import argparse,json,sys
from oauth2client.service_account import ServiceAccountCredentials
from pprint import pprint
from os import remove
import base64
__author__ = "Alejandro Sánchez Carrion"
__copyright__ = "Copyright 2022, PandoraFMS"
@ -15,33 +21,61 @@ Version = {__version__}
Manual execution
python3 pandora_googlesheets.py --cred <file credentials> --row <number-row> --column <number-column>
python3 pandora_googlesheets.py --creds_json/creds_base64 <file credentials> --name <name document> --sheet <name-sheet> --cell <Number cell> --row <number-row> --column <number-column>
"""
parser = argparse.ArgumentParser(description= info, formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('--cred', help='')
parser.add_argument('--name', help='')
parser.add_argument('--row', help='',type=int)
parser.add_argument('--column', help='',type=int)
parser.add_argument('--creds_json', help='To authenticate with a json file.')
parser.add_argument('--creds_base64', help='To authenticate with a file that includes the credentials for base64 authentication.')
parser.add_argument('--name', help='Name of the google sheets document.')
parser.add_argument('--cell', help='To collect the value of a cell.')
parser.add_argument('--row', help='To collect the value of a row.',type=int)
parser.add_argument('--column', help='To collect the value of a column.',type=int)
parser.add_argument('--sheet', help='To indicate the name of the document sheet, put it in quotation marks and count spaces and capital letters.',type=str)
args = parser.parse_args()
scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"]
creds = ServiceAccountCredentials.from_json_keyfile_name(args.cred, scope)
## authenticate with file json input
if args.creds_json is not None and args.creds_base64 == None:
creds = ServiceAccountCredentials.from_json_keyfile_name(args.creds_json, scope)
## authenticate with base64 input
elif args.creds_base64 is not None and args.creds_json== None:
## base64 to json
text=base64.b64decode(args.creds_base64).decode('utf-8')
with open("cred.json", "w") as outfile:
outfile.write(text)
creds = ServiceAccountCredentials.from_json_keyfile_name("cred.json", scope)
remove("cred.json")
else:
print("You need to use the --creds_json or creds_base 64 parameter to authenticate. You can only select one.")
sys.exit()
client = gspread.authorize(creds)
sheet = client.open(args.name).sheet1 # Open the spreadhseet
sheet = client.open(args.name) # Open the spreadhseet
worksheet = sheet.worksheet(args.sheet) # Open worksheet
data = sheet.get_all_records() # Get a list of all records
if args.cell is not None and args.row==None and args.column==None :
if args.row is not None and args.column==None:
row = sheet.row_values(args.row) # Get a specific row
print(row)
elif args.row ==None and args.column is not None:
col = sheet.col_values(args.column) # Get a specific column
print(col)
elif args.row is not None and args.column is not None:
cell = sheet.cell(args.row,args.column).value # Get the value of a specific cell
print(cell)
val = worksheet.acell(args.cell).value
elif args.row is not None and args.column==None and args.cell == None:
val = worksheet.row_values(args.row) # Get a specific row
elif args.column is not None and args.row== None and args.cell == None:
val = worksheet.col_values(args.column) # Get a specific column
else:
print("To search for data in a cell use the --cell parameter, for data in a column --column and in a row --row, only one of these parameters can be used at a time.")
sys.exit()
print(val)

View File

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

View File

@ -42,9 +42,6 @@ use PandoraFMS::PredictionServer;
use PandoraFMS::WebServer;
use PandoraFMS::InventoryServer;
# Constants for Win32 services.
use constant WIN32_SERVICE_STOPPED => 0x01;
use constant WIN32_SERVICE_RUNNING => 0x04;
# Global vars
my %Config :shared;
@ -255,7 +252,6 @@ sub pandora_crash () {
print_message (\%Config, " Error description:\n", 0);
print_message (\%Config, $full_error, 0);
callback_stop() if ($^O eq 'MSWin32' && defined($Config{'win32_service'}));
}
########################################################################################
@ -510,135 +506,6 @@ sub pandora_server_tasks ($) {
db_disconnect($dbh);
}
################################################################################
## Install the Windows service.
################################################################################
sub win32_install_service() {
# Load Win32::Daemon.
eval "use Win32::Daemon";
die($@) if ($@);
# Configure and install the service.
my $service_path = $0;
my $service_params = "-S run \"" . $Config{'pandora_path'} ."\"";
my %service_hash = (
machine => '',
name => 'PANDORAFMSSRV',
display => 'Pandora FMS Server',
path => $service_path,
user => '',
pwd => '',
description => 'Pandora FMS Server http://pandorafms.com/',
parameters => $service_params
);
if (Win32::Daemon::CreateService(\%service_hash)) {
print "Successfully added.\n";
exit 0;
} else {
print "Failed to add service: " . Win32::FormatMessage(Win32::Daemon::GetLastError()) . "\n";
exit 1;
}
}
################################################################################
## Install the Windows service.
################################################################################
sub win32_uninstall_service() {
# Load Win32::Daemon.
eval "use Win32::Daemon";
die($@) if ($@);
# Uninstall the service.
if (Win32::Daemon::DeleteService('', 'PANDORAFMSSRV')) {
print "Successfully deleted.\n";
exit 0;
} else {
print "Failed to delete service: " . Win32::FormatMessage(Win32::Daemon::GetLastError()) . "\n";
exit 1;
}
}
################################################################################
## Windows service callback function for the running event.
################################################################################
sub callback_running {
if (Win32::Daemon::State() == WIN32_SERVICE_RUNNING) {
}
}
################################################################################
## Windows service callback function for the start event.
################################################################################
sub callback_start {
no strict;
# Accept_connections ();
my $thr = threads->create(\&main);
if (!defined($thr)) {
Win32::Daemon::State(WIN32_SERVICE_STOPPED);
Win32::Daemon::StopService();
return;
}
$thr->detach();
Win32::Daemon::State(WIN32_SERVICE_RUNNING);
}
################################################################################
## Windows service callback function for the stop event.
################################################################################
sub callback_stop {
$RUN = 0;
Win32::Daemon::State(WIN32_SERVICE_STOPPED);
Win32::Daemon::StopService();
}
################################################################################
# Run as a Windows service.
################################################################################
sub win32_service_run() {
# Load Win32::Daemon.
eval "use Win32::Daemon";
die($@) if ($@);
# Run the Pandora FMS Server as a Windows service.
Win32::Daemon::RegisterCallbacks({
start => \&callback_start,
running => \&callback_running,
stop => \&callback_stop,
});
Win32::Daemon::StartService();
}
################################################################################
## Parse command line options.
################################################################################
sub parse_service_options ($) {
my $config = shift;
# Sanity checks.
return unless defined($config->{'win32_service'});
die ("[ERROR] Windows services are only available on Win32.\n\n") if ($^O ne 'MSWin32');
# Win32 service management.
eval "use Win32::Daemon";
die($@) if ($@);
if ($config->{'win32_service'} eq 'install') {
win32_install_service();
} elsif ($config->{'win32_service'} eq 'uninstall') {
win32_uninstall_service();
} elsif ($config->{'win32_service'} eq 'run') {
} else {
die("[ERROR] Unknown action: " . $config->{'win32_service'});
}
}
################################################################
################################################################
## Main.
@ -967,17 +834,9 @@ $SIG{'ALRM'} = 'IGNORE';
pandora_init(\%Config, pandora_get_initial_product_name() . ' Server');
pandora_load_config (\%Config);
# Parse command line options.
parse_service_options(\%Config);
# Run as a regular process.
if (!defined($Config{'win32_service'})) {
main();
}
# Run as a Windows service.
else {
win32_service_run();
}
main();
################################################################################
# Kill any scripts started by the Pandora FMS Server that are still running.

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.769";
my $pandora_build = "230222";
my $pandora_build = "230227";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@ -64,7 +64,6 @@ sub help_screen {
print " -d : Debug mode activated. Writes extensive information in the logfile \n";
print " -D : Daemon mode (runs in background)\n";
print " -P <file> : Store PID to file.\n";
print " -S <install|uninstall|run>: Manage the win32 service.\n";
print " -h : This screen. Shows a little help screen \n";
print " \n";
exit;
@ -111,9 +110,6 @@ sub pandora_init {
elsif ($parametro =~ m/-D\z/) {
$pa_config->{"daemon"}=1;
}
elsif ($parametro =~ m/^-S\z/i) {
$pa_config->{'win32_service'}= clean_blank($ARGV[$ax+1]);
}
else {
($pa_config->{"pandora_path"} = $parametro);
}

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.769";
my $pandora_build = "230222";
my $pandora_build = "230227";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_server
%define version 7.0NG.769
%define release 230222
%define release 230227
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.769
%define release 230222
%define release 230227
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.769"
PI_BUILD="230222"
PI_BUILD="230227"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.769 Build 230222";
my $version = "7.0NG.769 Build 230227";
# 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.769 Build 230222";
my $version = "7.0NG.769 Build 230227";
# save program name for logging
my $progname = basename($0);