Merge remote-tracking branch 'origin/develop' into ent-7074-Command-Center

This commit is contained in:
Daniel Barbero Martin 2021-03-17 08:47:45 +01:00
commit 6ec4b0cf98
49 changed files with 589 additions and 523 deletions

View File

@ -1,15 +1,15 @@
FROM centos:centos8
MAINTAINER Pandora FMS Team <info@pandorafms.com>
FROM centos:7
LABEL maintainer="Pandora FMS Team <info@pandorafms.com>"
# Add Pandora FMS agent installer
ADD unix /opt/pandora/pandora_agent/unix
RUN export LC_ALL=C
RUN dnf install -y dnf-plugins-core; dnf config-manager --set-enabled PowerTools
RUN yum -y update
# Install dependencies
RUN dnf -y install \
RUN yum -y install \
epel-release \
unzip \
perl \
@ -17,7 +17,7 @@ RUN dnf -y install \
sed \
perl-YAML-Tiny \
"perl(Sys::Syslog)" \
&& dnf clean all
&& yum clean all
# Install Pandora FMS agent

View File

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

@ -1016,7 +1016,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.752';
use constant AGENT_BUILD => '210315';
use constant AGENT_BUILD => '210317';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -4143,7 +4143,7 @@ while (1) {
@address_list = `ip addr show 2>$DevNull | sed -e '/127.0.0/d' -e '/\\([0-9][0-9]*\\.\\)\\{3\\}[0-9][0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/\\/.*//'`;
}
else {
@address_list = `ifconfig -a 2>$DevNull | sed -e '/127.0.0/d' -e '/\\([0-9][0-9]*\\.\\)\\{3\\}[0-9][0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/.*://'`;
@address_list = `ifconfig -a 2>$DevNull | grep -i inet | grep -v 'inet6' | grep -v '0.0.0.0' | grep -v '::/0' | awk '{print \$2}' | grep -v '127.0.0.1'`;
}
for (my $i = 0; $i <= $#address_list; $i++) {

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.752
%define release 210315
%define release 210317
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.752
%define release 210315
%define release 210317
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.752"
PI_BUILD="210315"
PI_BUILD="210317"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

@ -367,7 +367,7 @@ $img_style = [
if ($id_agente) {
// View tab.
$viewtab['text'] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/operation.png',
'images/eye.png',
true,
[
'title' => __('View'),
@ -563,6 +563,27 @@ if ($id_agente) {
$agent_wizard['active'] = false;
}
$total_incidents = agents_get_count_incidents($id_agente);
// Incident tab.
if ($total_incidents > 0) {
$incidenttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=incident&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/book_edit.png',
true,
[
'title' => __('Incidents'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab == 'incident') {
$incidenttab['active'] = true;
} else {
$incidenttab['active'] = false;
}
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
if ($has_remote_conf) {
$agent_name = agents_get_name($id_agente);
@ -616,6 +637,11 @@ if ($id_agente) {
];
}
// Only if the agent has incidents associated show incidents tab.
if ($total_incidents) {
$onheader['incident'] = $incidenttab;
}
} else {
$onheader = [
'view' => $viewtab,

View File

@ -754,7 +754,7 @@ if ($agents !== false) {
echo '</em>';
}
echo '</span><div class="left actions clear_left">';
echo '</span><div class="left actions clear_left" style=" visibility: hidden">';
if ($check_aw) {
if ($agent['id_os'] == CLUSTER_OS_ID) {
if (enterprise_installed()) {

View File

@ -75,6 +75,7 @@ ui_print_page_header(
// Recursion group filter.
$recursion = get_parameter('recursion', $_POST['recursion']);
// Initialize data.
$id_group = (int) get_parameter('id_group');
$name = (string) get_parameter('name');
@ -147,144 +148,9 @@ $user_groups_ad = array_keys(
users_get_groups($config['id_user'], $access)
);
// Check AD permission on downtime.
$downtime_group = db_get_value(
'id_group',
'tplanned_downtime',
'id',
$id_downtime
);
if ($id_downtime > 0) {
if (!check_acl_restricted_all($config['id_user'], $downtime_group, 'AW')
&& !check_acl_restricted_all($config['id_user'], $downtime_group, 'AD')
) {
db_pandora_audit(
'ACL Violation',
'Trying to access downtime scheduler'
);
include 'general/noaccess.php';
return;
}
}
// INSERT A NEW DOWNTIME_AGENT ASSOCIATION.
if ($insert_downtime_agent === 1) {
if ($downtime_group === false
|| !in_array($downtime_group, $user_groups_ad)
) {
db_pandora_audit(
'ACL Violation',
'Trying to access downtime scheduler'
);
include 'general/noaccess.php';
return;
}
$agents = (array) get_parameter('id_agents');
$module_names = (array) get_parameter('module');
$all_modules = ($modules_selection_mode === 'all' && (empty($module_names) || (int) $modules[0] === 0));
$all_common_modules = ($modules_selection_mode === 'common' && (empty($module_names) || (int) $modules[0] === 0));
if ($all_common_modules === true) {
$module_names = explode(',', get_parameter('all_common_modules'));
}
// 'Is running' check.
$is_running = (bool) db_get_value(
'executed',
'tplanned_downtime',
'id',
$id_downtime
);
if ($is_running) {
ui_print_error_message(
__('This elements cannot be modified while the downtime is being executed')
);
} else {
// If is selected 'Any', get all the agents.
if (count($agents) === 1 && (int) $agents[0] === -2) {
$all_agents = get_parameter('all_agents');
$agents = explode(',', $all_agents);
}
foreach ($agents as $agent_id) {
// Check module belongs to the agent.
if ($modules_selection_mode == 'all' && $all_modules === false) {
$check = false;
foreach ($module_names as $module_name) {
$check_module = modules_get_agentmodule_id(
$module_name,
$agent_id
);
if (!empty($check_module)) {
$check = true;
}
}
if (!$check) {
continue;
}
}
// Check AD permission on agent.
$agent_group = db_get_value(
'id_grupo',
'tagente',
'id_agente',
$agent_id
);
if ($agent_group === false
|| !in_array($agent_group, $user_groups_ad)
) {
continue;
}
$values = [
'id_downtime' => $id_downtime,
'id_agent' => $agent_id,
'all_modules' => $all_modules,
];
$result = db_process_sql_insert(
'tplanned_downtime_agents',
$values
);
if ($result && !$all_modules) {
foreach ($module_names as $module_name) {
$module = modules_get_agentmodule_id(
$module_name,
$agent_id
);
if (empty($module)) {
continue;
}
$values = [
'id_downtime' => $id_downtime,
'id_agent' => $agent_id,
'id_agent_module' => $module['id_agente_modulo'],
];
$result = db_process_sql_insert(
'tplanned_downtime_modules',
$values
);
if ($result) {
$values = ['id_user' => $config['id_user']];
$result = db_process_sql_update(
'tplanned_downtime',
$values,
['id' => $id_downtime]
);
}
}
}
}
}
insert_downtime_agent($id_downtime, $user_groups_ad);
}
// DELETE A DOWNTIME_AGENT ASSOCIATION.
@ -490,10 +356,6 @@ if ($create_downtime || $update_downtime) {
'date_to' => $datetime_to,
'id_user' => $config['id_user'],
];
} else if ($is_running) {
ui_print_error_message(
__('Cannot be modified while the downtime is being executed')
);
} else {
$values = [
'name' => $name,
@ -524,6 +386,9 @@ if ($create_downtime || $update_downtime) {
}
}
if ($is_running) {
$result = false;
} else {
if (!empty($values)) {
$result = db_process_sql_update(
'tplanned_downtime',
@ -532,6 +397,7 @@ if ($create_downtime || $update_downtime) {
);
}
}
}
if ($result === false) {
if ($create_downtime) {
@ -542,6 +408,9 @@ if ($create_downtime || $update_downtime) {
} else {
if ($create_downtime && $name && !$check) {
$id_downtime = $result;
insert_downtime_agent($id_downtime, $user_groups_ad);
ui_print_success_message(__('Successfully created'));
} else if ($update_downtime && $name) {
ui_print_success_message(__('Successfully updated'));
@ -672,20 +541,11 @@ $table->data[0][1] = html_print_input_text(
true,
$disabled_in_execution
);
$return_all_group = false;
if (users_can_manage_group_all('AW') === true
|| users_can_manage_group_all('AD') === true
) {
$return_all_group = true;
}
$table->data[1][0] = __('Group');
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
false,
$access,
$return_all_group,
true,
'id_group',
$id_group,
'',
@ -750,7 +610,7 @@ $days = array_combine(range(1, 31), range(1, 31));
$table->data[5][0] = __('Configure the time').'&nbsp;';
;
$table->data[5][1] = "
<div id='once_time' class='invisible'>
<div id='once_time' style='display: none;'>
<table>
<tr>
<td>".__('From:').'</td>
@ -762,7 +622,7 @@ $table->data[5][1] = "
</tr>
</table>
</div>
<div id='periodically_time' class='invisible'>
<div id='periodically_time' style='display: none;'>
<table>
<tr><td>".ui_get_using_system_timezone_warning().'</td></tr>
<tr>
@ -785,7 +645,7 @@ $table->data[5][1] = "
</tr>
<tr>
<td colspan='2'>
<table id='weekly_item' class='invisible'>
<table id='weekly_item' style='display: none;'>
<tr>
<td>".__('Mon').html_print_checkbox('monday', 1, $monday, true, $disabled_in_execution).'</td>
<td>'.__('Tue').html_print_checkbox('tuesday', 1, $tuesday, true, $disabled_in_execution).'</td>
@ -796,7 +656,7 @@ $table->data[5][1] = "
<td>'.__('Sun').html_print_checkbox('sunday', 1, $sunday, true, $disabled_in_execution)."</td>
</tr>
</table>
<table id='monthly_item' class='invisible'>
<table id='monthly_item' style='display: none;'>
<tr>
<td>".__('From day:').'</td>
<td>'.html_print_select(
@ -864,16 +724,128 @@ $table->data[5][1] = "
</table>
</div>';
echo '<form method="POST" action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor">';
if ($id_downtime > 0) {
echo '<table width=100% border=0 cellpadding=4 >';
echo "<tr><td width=75% valign='top'>";
echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
} else {
echo '<form method="POST" action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor">';
}
// Editor form.
html_print_table($table);
echo "<td valign=top style='width:300px;padding-left:20px;'>";
$filter_group = (int) get_parameter('filter_group', 0);
// User AD groups to str for the filter.
$id_groups_str = implode(',', $user_groups_ad);
if (empty($id_groups_str)) {
// Restrictive filter on error. This will filter all the downtimes.
$id_groups_str = '-1';
}
$filter_cond = '';
if ($filter_group > 0) {
if ($recursion) {
$rg = groups_get_children_ids($filter_group, true);
$filter_cond .= ' AND id_grupo IN (';
$i = 0;
$len = count($rg);
foreach ($rg as $key) {
if ($i == ($len - 1)) {
$filter_cond .= $key.')';
} else {
$i++;
$filter_cond .= $key.',';
}
}
} else {
$filter_cond = " AND id_grupo = $filter_group ";
}
}
$agents = get_planned_downtime_agents_list($id_downtime, $filter_cond, $id_groups_str);
$disabled_add_button = false;
if (empty($agents) || $disabled_in_execution) {
$disabled_add_button = true;
}
// Show available agents to include into downtime
$table = new StdClass();
$table->class = 'databox filters';
$table->width = '100%';
$table->data = [];
$table->data[0][0] = __('Group filter');
$table->data[0][1] = html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', true, false, true, '', false, 'min-width:180px;margin-right:15px;');
$table->data[0][2] = __('Recursion').'&nbsp&nbsp'.html_print_checkbox('recursion', 1, $recursion, true, false, '');
$table->data[1][0] = __('Available agents');
$table->data[1][1] = html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, true, true, true, '', false, 'width: 180px;');
if ($type_downtime != 'quiet') {
echo '<div id="available_modules_selection_mode" style="padding-top:20px;display: none;">';
} else {
echo '<div id="available_modules_selection_mode" style="padding-top:20px">';
}
$table->data[2][1] = html_print_select(
[
'common' => __('Show common modules'),
'all' => __('Show all modules'),
],
'modules_selection_mode',
'common',
false,
'',
'',
true,
false,
true,
'',
false,
'min-width:180px;'
);
echo '</div>';
$table->data[3][0] = __('Available modules:').ui_print_help_tip(
__('Only for type Quiet for downtimes.'),
true
);
if ($type_downtime != 'quiet') {
echo '<div id="available_modules" style="display: none;">';
} else {
echo '<div id="available_modules" style="">';
}
$table->data[3][1] = html_print_select(
[],
'module[]',
'',
'',
'',
0,
true,
true,
true,
'',
false,
'width: 180px;'
);
echo '</div>';
// Print agent table.
html_print_table($table);
echo '<br /><br /><br />';
html_print_input_hidden('id_agent', $id_agent);
echo '<div class="action-buttons w100p" >';
if ($id_downtime > 0) {
@ -896,132 +868,15 @@ if ($id_downtime > 0) {
}
echo '</div>';
html_print_input_hidden('all_agents', implode(',', array_keys($agents)));
html_print_input_hidden('all_common_modules', '');
echo '</form>';
if ($id_downtime > 0) {
echo "<td valign=top class='w300px pdd_l_20px'>";
// Start Overview of existing planned downtime.
echo '<h4>'.__('Agents planned for this downtime').':</h4>';
$filter_group = (int) get_parameter('filter_group', 0);
// User AD groups to str for the filter.
$id_groups_str = implode(',', $user_groups_ad);
if (empty($id_groups_str)) {
// Restrictive filter on error. This will filter all the downtimes.
$id_groups_str = '-1';
}
$filter_cond = '';
if ($filter_group > 0) {
if ($recursion) {
$rg = groups_get_children_ids($filter_group, true);
$filter_cond .= ' AND id_grupo IN (';
$i = 0;
$len = count($rg);
foreach ($rg as $key) {
if ($i == ($len - 1)) {
$filter_cond .= $key.')';
} else {
$i++;
$filter_cond .= $key.',';
}
}
} else {
$filter_cond = " AND id_grupo = $filter_group ";
}
}
$agents = get_planned_downtime_agents_list($id_downtime, $filter_cond, $id_groups_str);
$disabled_add_button = false;
if (empty($agents) || $disabled_in_execution) {
$disabled_add_button = true;
}
echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;margin-right:15px;');
html_print_checkbox('recursion', 1, $recursion, false, false, '');
echo __('Recursion').'&nbsp;';
echo '<br /><br />';
html_print_submit_button(__('Filter by group'), '', false, 'class="sub next"', false);
echo '</form>';
// Show available agents to include into downtime
echo '<h4>'.__('Available agents').':</h4>';
echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
html_print_input_hidden('all_agents', implode(',', array_keys($agents)));
echo html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, false, true, true, '', false, 'width: 180px;');
if ($type_downtime != 'quiet') {
echo '<div id="available_modules_selection_mode" class="invisible pdd_l_20px">';
} else {
echo '<div id="available_modules_selection_mode" class="pdd_l_20px">';
}
html_print_input_hidden('all_common_modules', '');
echo html_print_select(
[
'common' => __('Show common modules'),
'all' => __('Show all modules'),
],
'modules_selection_mode',
'common',
false,
'',
'',
true,
false,
true,
'',
false,
'min-width:180px;'
);
echo '</div>';
echo '<h4>'.__('Available modules:').ui_print_help_tip(
__('Only for type Quiet for downtimes.'),
true
).'</h4>';
if ($type_downtime != 'quiet') {
echo '<div id="available_modules" class="invisible">';
} else {
echo '<div id="available_modules" >';
}
echo html_print_select(
[],
'module[]',
'',
'',
'',
0,
false,
true,
true,
'',
false,
'width: 180px;'
);
echo '</div>';
echo '<br /><br /><br />';
html_print_submit_button(
__('Add'),
'add_item',
$disabled_add_button,
'class="sub next"',
false
);
echo '</form>';
echo '</table>';
// Start Overview of existing planned downtime.
echo '<h4>'.__('Agents planned for this downtime').':</h4>';
// User the $id_groups_str built before.
$sql = sprintf(
// User the $id_groups_str built before.
$sql = sprintf(
'SELECT ta.nombre, tpda.id,
ta.id_os, ta.id_agente, ta.id_grupo,
ta.ultimo_contacto, tpda.all_modules
@ -1032,12 +887,12 @@ if ($id_downtime > 0) {
WHERE ta.id_grupo IN (%s)',
$id_downtime,
$id_groups_str
);
$downtimes_agents = db_get_all_rows_sql($sql);
);
$downtimes_agents = db_get_all_rows_sql($sql);
if (empty($downtimes_agents)) {
if (empty($downtimes_agents)) {
echo '<div class="nf">'.__('There are no agents').'</div>';
} else {
} else {
$table = new stdClass();
$table->id = 'list';
$table->class = 'databox data';
@ -1094,32 +949,16 @@ if ($id_downtime > 0) {
if ($type_downtime != 'disable_agents_alerts'
&& $type_downtime != 'disable_agents'
) {
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image(
'images/config.png',
true,
[
'border' => '0',
'alt' => __('Delete'),
]
).'</a>';
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).'</a>';
}
$data[5] .= '<a href="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image(
'images/cross.png',
true,
[
'border' => '0',
'alt' => __('Delete'),
'class' => 'invert_filter',
]
).'</a>';
$data[5] .= '<a href="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).'</a>';
}
$table->data['agent_'.$downtime_agent['id_agente']] = $data;
}
html_print_table($table);
}
}
$table = new stdClass();
@ -1154,9 +993,9 @@ $table->data['module'][1] = "
</tr>
</thead>
<tbody>
<tr class='datos' id='template' class='invisible'>
<td class='name_module'></td>
<td class='cell_delete_button right w10p' id=''>".'<a class="link_delete"
<tr class='datos' id='template' style='display: none;'>
<td class='name_module' style=''></td>
<td class='cell_delete_button' style='text-align: right; width:10%;' id=''>".'<a class="link_delete"
onclick="if(!confirm(\''.__('Are you sure?').'\')) return false;"
href="">'.html_print_image(
'images/cross.png',
@ -1169,7 +1008,7 @@ $table->data['module'][1] = "
).'</a>'."</td>
</tr>
<tr class='datos2' id='add_modules_row'>
<td class='datos2'id=''>".__('Add Module:').'&nbsp;'.html_print_select(
<td class='datos2' style='' id=''>".__('Add Module:').'&nbsp;'.html_print_select(
[],
'modules',
'',
@ -1178,7 +1017,7 @@ $table->data['module'][1] = "
0,
true
)."</td>
<td class='datos2 button_cell right w10p' id=''>".'<div id="add_button_div">'.'<a class="add_button" href="">'.html_print_image(
<td class='datos2 button_cell' style='text-align: right; width:10%;' id=''>".'<div id="add_button_div">'.'<a class="add_button" href="">'.html_print_image(
'images/add.png',
true,
[
@ -1186,10 +1025,7 @@ $table->data['module'][1] = "
'alt' => __('Add'),
'class' => 'invert_filter',
]
).'</a>'.'</div>'."<div id='spinner_add' class='invisible'>".html_print_image(
'images/spinner.gif',
true
).'</div>'.'</td>
).'</a></div>'."<div id='spinner_add' style='display: none;'>".html_print_image('images/spinner.gif', true).'</div></td>
</tr>
</tbody></table>';
@ -1218,10 +1054,141 @@ echo '</div>';
ui_include_time_picker();
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
// Auxiliary function for downtime agent creation.
function insert_downtime_agent($id_downtime, $user_groups_ad)
{
// Check AD permission on downtime.
$downtime_group = db_get_value(
'id_group',
'tplanned_downtime',
'id',
$id_downtime
);
if ($downtime_group === false
|| !in_array($downtime_group, $user_groups_ad)
) {
db_pandora_audit(
'ACL Violation',
'Trying to access downtime scheduler'
);
include 'general/noaccess.php';
return;
}
$agents = (array) get_parameter('id_agents');
$module_names = (array) get_parameter('module');
$modules_selection_mode = (string) get_parameter('modules_selection_mode');
$all_modules = ($modules_selection_mode === 'all' && (empty($module_names) || (string) $module_names[0] === '0'));
$all_common_modules = ($modules_selection_mode === 'common' && (empty($module_names) || (string) $module_names[0] === '0'));
if ($all_common_modules === true) {
$module_names = explode(',', get_parameter('all_common_modules'));
}
// 'Is running' check.
$is_running = (bool) db_get_value(
'executed',
'tplanned_downtime',
'id',
$id_downtime
);
if ($is_running) {
ui_print_error_message(
__('This elements cannot be modified while the downtime is being executed')
);
} else {
// If is selected 'Any', get all the agents.
if (count($agents) === 1 && (int) $agents[0] === -2) {
$all_agents = get_parameter('all_agents');
$agents = explode(',', $all_agents);
}
foreach ($agents as $agent_id) {
// Check module belongs to the agent.
if ($modules_selection_mode == 'all' && $all_modules === false) {
$check = false;
foreach ($module_names as $module_name) {
$check_module = modules_get_agentmodule_id(
$module_name,
$agent_id
);
if (!empty($check_module)) {
$check = true;
}
}
if (!$check) {
continue;
}
}
// Check AD permission on agent.
$agent_group = db_get_value(
'id_grupo',
'tagente',
'id_agente',
$agent_id
);
if ($agent_group === false
|| !in_array($agent_group, $user_groups_ad)
) {
continue;
}
$values = [
'id_downtime' => $id_downtime,
'id_agent' => $agent_id,
'all_modules' => $all_modules,
];
$result = db_process_sql_insert(
'tplanned_downtime_agents',
$values
);
if ($result && !$all_modules) {
foreach ($module_names as $module_name) {
$module = modules_get_agentmodule_id(
$module_name,
$agent_id
);
if (empty($module)) {
continue;
}
$values = [
'id_downtime' => $id_downtime,
'id_agent' => $agent_id,
'id_agent_module' => $module['id_agente_modulo'],
];
$result = db_process_sql_insert(
'tplanned_downtime_modules',
$values
);
if ($result) {
$values = ['id_user' => $config['id_user']];
$result = db_process_sql_update(
'tplanned_downtime',
$values,
['id' => $id_downtime]
);
}
}
}
}
}
}
?>
<script language="javascript" type="text/javascript">
var id_downtime = <?php echo $id_downtime; ?>;
var action_in_progress = false;
var recursion = false;
function change_type_downtime() {
switch ($("#type_downtime").val()) {
@ -1482,6 +1449,8 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
}
$(document).ready (function () {
populate_agents_selector();
$("#id_agents").change(agent_changed_by_multiple_agents);
$("#modules_selection_mode").change(agent_changed_by_multiple_agents);
@ -1534,5 +1503,47 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
}
// Disable datepickers when it has readonly attribute
$('input.hasDatepicker[readonly]').disable();
$("#checkbox-recursion").click(function() {
recursion = this.checked;
$("#filter_group").trigger("change");
});
// Change agent selector based on group.
$("#filter_group").change(function() {
populate_agents_selector();
});
function populate_agents_selector() {
jQuery.post ("ajax.php",
{"page": "operation/agentes/ver_agente",
"get_agents_group_json": 1,
"id_group": $("#filter_group").val(),
"privilege": "AW",
"keys_prefix": "_",
"recursion": recursion,
},
function (data, status) {
$("#id_agents").empty();
$("#module").html('');
option_any = $("<option></option>")
.attr ("value", -2)
.html ("Any");
$("#id_agents").append (option_any);
jQuery.each (data, function (id, value) {
// Remove keys_prefix from the index
id = id.substring(1);
option = $("<option></option>")
.attr ("value", value["id_agente"])
.html (value["alias"]);
$("#id_agents").append (option);
});
},
"json"
);
}
});
</script>

View File

@ -551,7 +551,7 @@ for ($month = 1; $month <= 12; $month++) {
$cal_table->data[$cal_line][$week] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_special_days&create_special_day=1&date='.$date.'" title=';
$cal_table->data[$cal_line][$week] .= __('Create');
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
'images/add.png',
'images/add_mc.png',
true,
['class' => 'invert_filter']
).'</a>';

View File

@ -803,11 +803,11 @@ $table->data['edit1'][1] = '<table width="100%">';
true
);
$table->data['edit36'][2] = __('Auth password').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
$table->data['edit36'][3] = html_print_input_text('plugin_pass_snmp', '', '', 15, 60, true);
$table->data['edit36'][3] = html_print_input_password('plugin_pass_snmp', '', '', 15, 60, true);
$table->data['edit37'][0] = __('Privacy method');
$table->data['edit37'][1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'custom_string_1', '', '', __('No change'), '', true);
$table->data['edit37'][1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', '', '', __('No change'), '', true);
$table->data['edit37'][2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
$table->data['edit37'][3] = html_print_input_text('custom_string_2', '', '', 15, 60, true);
$table->data['edit37'][3] = html_print_input_password('snmp3_privacy_pass', '', '', 15, 60, true);
$table->data['edit38'][0] = __('Auth method');
$table->data['edit38'][1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'plugin_parameter', '', '', __('No change'), '', true);
$table->data['edit38'][2] = __('Security level');
@ -1670,7 +1670,7 @@ $(document).ready (function () {
}
});
$('#tcp_send').change(function() {
$('#snmp_version').change(function() {
if($(this).val() == 3) {
$("tr#delete_table-edit36, tr#delete_table-edit37, tr#delete_table-edit38").show();
}
@ -2096,7 +2096,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
}
// Specific snmp reused fields
if (get_parameter('tcp_send', '') == 3) {
if (get_parameter('snmp_version', '') == 3) {
$plugin_user_snmp = get_parameter('plugin_user_snmp', '');
if ($plugin_user_snmp != '') {
$values['plugin_user'] = $plugin_user_snmp;
@ -2107,7 +2107,12 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
$values['plugin_pass'] = io_input_password($plugin_pass_snmp);
}
$snmp3_privacy_pass = get_parameter('custom_string_2', '');
$snmp3_privacy_method = get_parameter('snmp3_privacy_method', '');
if ($snmp3_privacy_method != '') {
$values['custom_string_1'] = io_input_password($snmp3_privacy_method);
}
$snmp3_privacy_pass = get_parameter('snmp3_privacy_pass', '');
if ($snmp3_privacy_pass != '') {
$values['custom_string_2'] = io_input_password($snmp3_privacy_pass);
}
@ -2209,7 +2214,11 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
}
// Set tcp_send value according to module type since the purpose of this field in database varies in case of SNMP modules.
if ($module['id_tipo_modulo'] >= 15 && $module['id_tipo_modulo'] <= 18) {
if ($module['id_tipo_modulo'] == MODULE_TYPE_REMOTE_SNMP
|| $module['id_tipo_modulo'] == MODULE_TYPE_REMOTE_SNMP_INC
|| $module['id_tipo_modulo'] == MODULE_TYPE_REMOTE_SNMP_STRING
|| $module['id_tipo_modulo'] <= MODULE_TYPE_REMOTE_SNMP_PROC
) {
if ($snmp_version != '') {
$values['tcp_send'] = $snmp_version;
} else {

View File

@ -918,7 +918,7 @@ if (isset($data)) {
);
}
echo '<form method="post" action="'.$url.'">';
echo '<form method="post" action="'.$url.'" class="float-right">';
echo '<div class="right">';
html_print_input_hidden('new_component', 1);
html_print_select(

View File

@ -285,11 +285,11 @@ $output .= '</table>';
if ($edit_graph) {
$output .= "<div class='w100p'>";
$output .= "<input class='right' type=submit name='store' class='sub upd' value='".__('Update')."'>";
$output .= "<input type=submit name='store' class='sub upd right' value='".__('Update')."'>";
$output .= '</div>';
} else {
$output .= "<div class='w100p'>";
$output .= "<input class='right' type=submit name='store' class='sub next' value='".__('Create')."'>";
$output .= "<input type=submit name='store' class='sub next right' value='".__('Create')."'>";
$output .= '</div>';
}

View File

@ -349,7 +349,6 @@ $table_aux = new stdClass();
ui_pagination(count($graphs), false, 0, 0, false, 'offset', true, 'pagination-bottom');
echo "<div class='right'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>';
echo '</form>';
}
@ -362,6 +361,8 @@ $table_aux = new stdClass();
}
echo '</div>';
echo '</div>';
} else {
include_once $config['homedir'].'/general/first_task/custom_graphs.php';
}

View File

@ -2763,17 +2763,13 @@ $class = 'databox filters';
</td>
</tr>
<<<<<<< HEAD
<tr id="row_filter_search" class="datos">
<td class="bolder"><?php echo __('Free search'); ?></td>
=======
<tr id="row_summary" style="" class="datos">
<td style="font-weight:bold;">
<tr id="row_summary"class="datos">
<td class="bolder">
<?php
echo __('Summary');
?>
</td>
<td style="">
<td>
<?php
html_print_checkbox_switch(
'summary',
@ -2788,9 +2784,8 @@ $class = 'databox filters';
</td>
</tr>
<tr id="row_filter_search" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Include filter'); ?></td>
>>>>>>> origin/develop
<tr id="row_filter_search" class="datos">
<td class="bolder"><?php echo __('Include filter'); ?></td>
<td>
<?php
html_print_input_text('filter_search', $filter_search);

View File

@ -664,7 +664,7 @@ if (defined('METACONSOLE')) {
if (check_acl($config['id_user'], 0, 'RM')) {
html_print_input_hidden('ids_items_to_delete', '');
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete right"');
}
echo '</div>';
@ -687,7 +687,7 @@ if (defined('METACONSOLE')) {
echo "<div class='pdd_b_20px right; w100p'>";
html_print_input_hidden('ids_items_to_delete', '');
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete right mrgn_btn_15px"');
echo '</div>';
echo '</form>';
}

View File

@ -218,7 +218,7 @@ $buttons['websocket_engine'] = [
$buttons['external_tools'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=external_tools').'">'.html_print_image('images/nettool.png', true, ['title' => __('External Tools')]).'</a>',
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=external_tools').'">'.html_print_image('images/nettool.png', true, ['title' => __('External Tools'), 'class' => 'invert_filter']).'</a>',
];
if ($config['activate_gis']) {

View File

@ -131,6 +131,20 @@ $table_styles->style[0] = 'font-weight: bold;';
$table_styles->size[0] = '50%';
$table_styles->data = [];
$table_styles->data[$row][0] = __('Style template');
$table_styles->data[$row][1] = html_print_select(
themes_get_css(),
'style',
$config['style'].'.css',
'',
'',
'',
true
);
$row++;
$table_styles->data[$row][0] = __('Status icon set');
$iconsets['default'] = __('Colors');
$iconsets['faces'] = __('Faces');

View File

@ -246,7 +246,7 @@ class ConfigPEN extends HTML
$tmp->options .= $tmp->pen;
$tmp->options .= '\')" >';
$tmp->options .= html_print_image(
'images/eye.png',
'images/operation.png',
true,
[
'title' => __('Show'),

View File

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

View File

@ -1948,6 +1948,10 @@ function config_process_config()
config_update_value('collection_max_size', 1000000);
}
if (!isset($config['policy_add_max_agents'])) {
config_update_value('policy_add_max_agents', 200);
}
if (!isset($config['event_replication'])) {
config_update_value('event_replication', 0);
}

View File

@ -4037,7 +4037,7 @@ function html_print_autocomplete_modules(
ob_start();
$module_icon = 'images/module.png';
$module_icon = 'images/search_module.png';
if ($config['style'] === 'pandora_black') {
$module_icon = 'images/brick.menu.png';
}

View File

@ -144,7 +144,7 @@ function snmp_browser_get_html_tree(
// Branch or leave with branches!
if (isset($sub_level['__OID__'])) {
$output .= "<a onfocus='javascript: this.blur();' href='javascript: snmpGet(\"".addslashes($sub_level['__OID__'])."\");'>";
$output .= '<img src="'.$url.'/../../images/eye.png" class="vertical_middle">';
$output .= '<img src="'.$url.'/../../images/operation.png" class="vertical_middle">';
$output .= '</a>';
}
@ -1024,7 +1024,7 @@ function snmp_browser_print_container(
if ($snmp_version == 3) {
$output .= '<div id="snmp3_browser_options">';
} else {
$output .= '<div id="snmp3_browser_options" class="invisible">';
$output .= '<div id="snmp3_browser_options" style="display: none;">';
}
$output .= ui_toggle(

View File

@ -43,7 +43,11 @@ function themes_get_css($path=false)
$retval = [];
foreach ($files as $file) {
// Skip '..' and '.' entries and files not ended in '.css'
if ($file === 'pandora_green_old.css') {
continue;
}
// Skip '..' and '.' entries and files not ended in '.css'.
if ($path && ($file == '.' || $file == '..' || strtolower(substr($file, (strlen($file) - 4))) !== '.css')) {
continue;
}

View File

@ -4689,7 +4689,7 @@ function ui_print_agent_autocomplete_input($parameters)
}
// Default value.
$icon_agent = 'images/agent.png';
$icon_agent = 'images/search_agent.png';
if ($config['style'] === 'pandora_black') {
$icon_agent = 'images/agent_mc.menu.png';

View File

@ -452,7 +452,7 @@ function initialiceLayout(data) {
$(".add-widget").show();
$(".new-widget-message").hide();
$("#container-layout").addClass("container-layout");
$("#add-widget").show();
$("#add-widget").removeClass("invisible");
} else {
grid.movable(".grid-stack-item", false);
grid.resizable(".grid-stack-item", false);
@ -461,7 +461,7 @@ function initialiceLayout(data) {
$(".add-widget").hide();
$(".new-widget-message").show();
$("#container-layout").removeClass("container-layout");
$("#add-widget").hide();
$("#add-widget").addClass("invisible");
}
});

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.752';
$build = '210315';
$build = '210317';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -709,7 +709,7 @@ $table->class = 'info_table';
$table->head = [];
$table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown);
$table->size[0] = '10%';
$table->size[0] = '12%';
$table->head[1] = __('Description').ui_get_sorting_arrows($url_up_description, $url_down_description, $selectDescriptionUp, $selectDescriptionDown);
$table->size[1] = '16%';

View File

@ -265,7 +265,7 @@ $table_files_section->data[1][0] .= html_print_textarea(
$table_files_section->data[2][0] .= '<div class="w100p right">'.html_print_submit_button(__('Upload'), 'accion', false, 'class="sub wand"', true).'</div>';
$upload_file_form = '<div>';
$upload_file_form = '<div class="w100p">';
if (check_acl($config['id_user'], 0, 'IW')) {
$upload_file_form .= '<form method="post" id="file_control" enctype="multipart/form-data">'.'<h4>'.__('Add attachment').'</h4>'.html_print_table($table_files_section, true).html_print_input_hidden('upload_file', 1, true);
@ -359,7 +359,7 @@ if (!empty($comments)) {
$comment_table = __('No comments found');
}
$upload_comment_form = '<div>';
$upload_comment_form = '<div class="w100p">';
if (check_acl($config['id_user'], 0, 'IW')) {
$upload_comment_form .= '<form method="post" id="comment_form" enctype="multipart/form-data"><h4>'.__('Add comment').'</h4>'.html_print_table($table_comments_section, true).html_print_input_hidden('upload_comment', 1, true).'</form>';

View File

@ -82,10 +82,10 @@ ui_print_page_header(
// SNMP tree container.
snmp_browser_print_container(false, '100%', '60%', '', true);
// Div for modal
echo '<div id="modal" class="invisible"></div>';
// Div for modal.
echo '<div id="modal" style="display:none"></div>';
// Div for loading modal.
echo '<div id="loading_modal" class="invisible"></div>';
echo '<div id="loading_modal" style="display:none"></div>';
?>

View File

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

View File

@ -43,10 +43,10 @@
$output = '';
// Div for modal update dashboard.
$output .= '<div id="modal-update-dashboard" class=""></div>';
$output .= '<div id="modal-add-widget" class=""></div>';
$output .= '<div id="modal-config-widget" class=""></div>';
$output .= '<div id="modal-slides-dialog" class=""></div>';
$output .= '<div id="modal-update-dashboard" style="display:none;"></div>';
$output .= '<div id="modal-add-widget" style="display:none;"></div>';
$output .= '<div id="modal-config-widget" style="display:none;"></div>';
$output .= '<div id="modal-slides-dialog" style="display:none;"></div>';
// Layout.
$output .= '<div class="container-fluid">';

View File

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

View File

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

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.752
%define release 210315
%define release 210317
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.752
%define release 210315
%define release 210317
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.752"
PI_BUILD="210315"
PI_BUILD="210317"
MODE=$1
if [ $# -gt 1 ]; then
@ -313,7 +313,7 @@ install () {
mkdir $DESTDIR$PANDORA_SPOOL/data_in/commands 2> /dev/null
chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/commands
mkdir -p $DESTDIR$PANDORA_LOG 2> /dev/null
chown -R pandora $DESTDIR$PANDORA_LOG 2> /dev/null
chown -R pandora:apache $DESTDIR$PANDORA_LOG 2> /dev/null
chmod 2774 $DESTDIR$PANDORA_LOG 2> /dev/null
echo "Giving proper permission to /var/spool/pandora"

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.752 PS210315";
my $version = "7.0NG.752 PS210317";
# Pandora server configuration
my %conf;
@ -404,8 +404,10 @@ sub pandora_purgedb ($$) {
}
# Delete old tgraph_source data
log_message ('PURGE', 'Deleting old tgraph_source data.');
db_do ($dbh,"DELETE FROM tgraph_source WHERE id_graph NOT IN (SELECT id_graph FROM tgraph)");
# Delete network traffic old data.
log_message ('PURGE', 'Deleting old network matrix data.');
if ($conf->{'_delete_old_network_matrix'} > 0) {

View File

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