changed mr

This commit is contained in:
alejandro.campos@artica.es 2022-11-23 12:22:19 +01:00
commit cdddc07b86
65 changed files with 597 additions and 634 deletions

View File

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

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.766"
PI_BUILD="221110"
PI_BUILD="221123"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

@ -1,6 +1,5 @@
START TRANSACTION;
DROP TABLE IF EXISTS `tphase`;
DROP TABLE IF EXISTS `ttransaction`;
ALTER TABLE `tevent_filter` MODIFY COLUMN `server_id` TEXT;
COMMIT;

View File

@ -0,0 +1,6 @@
START TRANSACTION;
DROP TABLE IF EXISTS `tphase`;
DROP TABLE IF EXISTS `ttransaction`;
COMMIT;

View File

@ -19,15 +19,15 @@
global $config;
if ($config['language'] == 'es') {
$url_help = 'https://pandorafms.com/manual/es/documentation/07_technical_annexes/14_php_7';
$url_help = 'https://pandorafms.com/manual/es/documentation/07_technical_annexes/18_php_8';
} else {
$url_help = 'https://pandorafms.com/manual/en/documentation/07_technical_annexes/14_php_7';
$url_help = 'https://pandorafms.com/manual/en/documentation/07_technical_annexes/18_php_8';
}
// Prints help dialog information
echo '<div id="login_help_dialog" title="PHP UPDATE REQUIRED" class="invisible">';
echo '<div class="login_help_dialog">';
echo "<p><b class='font_10'>".__('For a correct operation of PandoraFMS, PHP must be updated to version 7.0 or higher.').'</b></p>';
echo "<p><b class='font_10'>".__('For a correct operation of PandoraFMS, PHP must be updated to version 8.0 or higher.').'</b></p>';
echo "<p class='font_10'><b>".__('Otherwise, functionalities will be lost.').'</b></p>';
echo '<ul>';
echo "<li class='pdd_5px'>".__('Report download in PDF format').'</li>';

View File

@ -309,7 +309,7 @@ $table_ip .= '<div class="label_select_child_right">'.html_print_input(
'name' => 'fixed_ip',
'value' => $fixed_ip,
]
).__('Fix IP address').ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'</div>';
).__('Fix IP address').'<p style="margin-right: 15px">'.ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'</p></div>';
$table_ip .= '</div></div>';

View File

@ -451,7 +451,7 @@ $simple_alerts = agents_get_alerts_simple(
if (!$id_agente) {
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=list&pure='.$pure.'&offset='.$offset.$form_params;
} else {
$url = 'index.php?sec='.$sec.'&sec2=godmode/agentes/configurar_agente&pure='.$pure.'&tab=alert&id_agente='.$id_agente.'&offset='.$offset.$form_params;
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&pure='.$pure.'&tab=alert&id_agente='.$id_agente.'&offset='.$offset.$form_params;
}
// Urls to sort the table.

View File

@ -370,7 +370,7 @@ $table->data[5][1] = html_print_select(
$table->data[6][0] = '<b>'.__('Free search').'</b>';
$table->data[6][1] = html_print_input_text(
'search',
io_safe_output($search),
$search,
'',
15,
255,

View File

@ -229,6 +229,11 @@ if ($add_module === true) {
// Safe output remove all entities.
io_safe_output_array($id_modules, '');
$id_modules = array_map(function ($mod) {
return io_safe_input($mod);
},
$id_modules
);
$id_agent_modules = db_get_all_rows_sql(
'SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN ('.implode(',', $id_agents).") AND nombre IN ('".implode("','", $id_modules)."')"

View File

@ -886,6 +886,7 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
}
function submit_delete_multiple_items() {
event.preventDefault();
delete_items = [];
jQuery.each($("input[name='multiple_delete_items']:checked"),
function(i, item) {
@ -893,7 +894,22 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
}
);
$("input[name='id_item_json']").val(JSON.stringify(delete_items));
$("#form_multiple_delete").submit();
$.ajax({
type: "POST",
url: "ajax.php",
data: {
page: "godmode/reporting/visual_console_builder",
action: "multiple_delete",
tab: "list_elements",
id_item_json: JSON.stringify(delete_items),
id_visual_console: "<?php echo (is_metaconsole() === true) ? $idVisualConsole : $visualConsole['id']; ?>",
},
dataType: "json",
complete: function (data) {
location.reload();
}
});
return false;
}
</script>

View File

@ -45,7 +45,7 @@ require_once $config['homedir'].'/vendor/autoload.php';
$php_version = phpversion();
$php_version_array = explode('.', $php_version);
if ($php_version_array[0] < 7) {
include_once 'general/php7_message.php';
include_once 'general/php_message.php';
}
$tab = get_parameter('tab', 'online');

View File

@ -130,6 +130,8 @@ if (! check_acl($config['id_user'], 0, 'UM')) {
if (is_ajax()) {
$delete_profile = (bool) get_parameter('delete_profile');
$get_user_profile = (bool) get_parameter('get_user_profile');
if ($delete_profile) {
$id2 = (string) get_parameter('id_user');
$id_up = (int) get_parameter('id_user_profile');
@ -211,6 +213,61 @@ if (is_ajax()) {
return;
}
if ($get_user_profile === true) {
$profile_id = (int) get_parameter('profile_id');
$group_id = (int) get_parameter('group_id', -1);
$user_id = (string) get_parameter('user_id', '');
$no_hierarchy = (int) get_parameter('no_hierarchy', -1);
$assigned_by = (string) get_parameter('assigned_by', '');
$id_policy = (int) get_parameter('id_policy', -1);
$tags = (string) get_parameter('id_policy', '');
$filter = [];
if ($group_id > -1) {
$filter['id_perfil'] = $profile_id;
}
if ($group_id > -1) {
$filter['id_grupo'] = $group_id;
}
if ($user_id !== '') {
$filter['id_usuario'] = $user_id;
}
if ($no_hierarchy > -1) {
$filter['no_hierarchy'] = $no_hierarchy;
}
if ($assigned_by !== '') {
$filter['assigned_by'] = $assigned_by;
}
if ($id_policy > -1) {
$filter['id_policy'] = $id_policy;
}
if ($tags !== '') {
$filter['tags'] = $tags;
}
$profile = db_get_all_rows_filter(
'tusuario_perfil',
$filter
);
if ($profile !== false && count($profile) > 0) {
echo json_encode($profile);
return;
} else {
echo json_encode('');
}
return;
}
}
@ -442,7 +499,7 @@ if ($create_user) {
$password_new = '';
$password_confirm = '';
$new_user = true;
} else if (excludedPassword($password_new) === true) {
} else if (enterprise_hook('excludedPassword', [$password_new]) === true) {
$is_err = true;
ui_print_error_message(__('The password provided is not valid. Please set another one.'));
$user_info = $values;
@ -1717,13 +1774,14 @@ $(document).ready (function () {
var is_err = '<?php echo $is_err; ?>';
var data = [];
var aux = 0;
if(json_profile.val() != '') {
var data = JSON.parse(json_profile.val());
}
$('input:image[name="add"]').click(function (e) {
e.preventDefault();
function addProfile(form) {
try {
var data = JSON.parse(json_profile.val());
} catch {
var data = [];
}
var profile = $('#assign_profile').val();
var profile_text = $('#assign_profile option:selected').text();
var group = $('#assign_group').val();
@ -1739,14 +1797,26 @@ $(document).ready (function () {
}
if (profile === '0' || group === '-1') {
alert('<?php echo __('please select profile and group'); ?>');
alert('<?php echo __('Please select profile and group'); ?>');
return;
}
if (id_user == '' || is_err == 1) {
let new_json = `{"profile":${profile},"group":${group},"tags":[${tags}],"hierarchy":${hierarchy}}`;
data.push(new_json);
var profile_is_added = Object.entries(data).find(function(_data) {
return _data[1] === new_json;
});
if (typeof profile_is_added === 'undefined') {
data.push(new_json);
} else {
alert('<?php echo __('This profile is already defined'); ?>');
return;
}
json_profile.val(JSON.stringify(data));
profile_text = `<a href="index.php?sec2=godmode/users/configure_profile&id=${profile}">${profile_text}</a>`;
group_img = `<img id="img_group_${aux}" src="" data-title="${group_text}" data-use_title_for_force_title="1" class="bot forced_title" alt="${group_text}"/>`;
group_text = `<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id=${group}">${group_img}${group_text}</a>`;
@ -1765,8 +1835,39 @@ $(document).ready (function () {
aux++;
} else {
this.form.submit();
form.submit();
}
}
$('input:image[name="add"]').click(function (e) {
e.preventDefault();
if (id_user.length === 0) {
addProfile(this.form);
return;
}
var params = [];
params.push("get_user_profile=1");
params.push("profile_id=" + $('#assign_profile').val())
params.push("group_id=" + $('#assign_group').val());
params.push("user_id=" + id_user);
params.push("page=godmode/users/configure_user");
jQuery.ajax ({
data: params.join("&"),
type: 'POST',
dataType: "json",
async: false,
form: this.form,
url: action="<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
success: function (data) {
if (data.length > 0) {
alert('<?php echo __('This profile is already defined'); ?>');
} else {
addProfile(this.form);
}
}
});
});
$('input:image[name="del"]').click(function (e) {
@ -1841,9 +1942,8 @@ function delete_profile(event, btn) {
var json = json_profile.val();
var test = JSON.parse(json);
delete test[position-1];
test.splice(position-1, 1);
json_profile.val(JSON.stringify(test));
}
function show_data_section () {

View File

@ -553,7 +553,7 @@ if ($load_filter_modal) {
);
echo '<div id="load-filter-select" class="load-filter-modal">';
echo '<form method="post" id="form_load_filter">';
echo '<form method="post" id="form_load_filter" action="index.php?sec=eventos&sec2=operation/events/events&pure=">';
$table = new StdClass;
$table->id = 'load_filter_form';
@ -1580,7 +1580,7 @@ if ($get_extended_event) {
$filter = get_parameter('filter', []);
$similar_ids = get_parameter('similar_ids', $event_id);
$group_rep = $filter['group_rep'];
$event_rep = $group_rep;
$event_rep = (empty($group_rep) === true) ? EVENT_GROUP_REP_EVENTS : $group_rep;
$timestamp_first = $event['timestamp_first'];
$timestamp_last = $event['timestamp_last'];
$server_id = $event['server_id'];

View File

@ -759,7 +759,7 @@ function update_user_password(string $user, string $password_new)
{
global $config;
if (excludedPassword($password_new) === true) {
if (enterprise_hook('excludedPassword', [$password_new]) === true) {
$config['auth_error'] = __('The password provided is not valid. Please, set another one.');
return false;
}

View File

@ -1594,17 +1594,21 @@ class ConsoleSupervisor
$this->cleanNotifications('NOTIF.PHP.PHANTOMJS');
}
if ($php_version_array[0] < 7) {
$url = 'https://pandorafms.com/manual/en/documentation/07_technical_annexes/14_php_7';
if ($php_version_array[0] < 8) {
$url = 'https://pandorafms.com/manual/en/documentation/07_technical_annexes/18_php_8';
if ($config['language'] == 'es') {
$url = 'https://pandorafms.com/manual/es/documentation/07_technical_annexes/14_php_7';
$url = 'https://pandorafms.com/manual/es/documentation/07_technical_annexes/18_php_8';
}
if ($config['language'] == 'ja') {
$url = 'https://pandorafms.com/manual/ja/documentation/07_technical_annexes/18_php_8';
}
$this->notify(
[
'type' => 'NOTIF.PHP.VERSION',
'title' => __('PHP UPDATE REQUIRED'),
'message' => __('For a correct operation of PandoraFMS, PHP must be updated to version 7.0 or higher.').'<br>'.__('Otherwise, functionalities will be lost.').'<br>'."<ol><li class='color_67'>".__('Report download in PDF format').'</li>'."<li class='color_67'>".__('Emails Sending').'</li><li class="color_67">'.__('Metaconsole Collections').'</li><li class="color_67">...</li></ol>',
'message' => __('For a correct operation of PandoraFMS, PHP must be updated to version 8.0 or higher.').'<br>'.__('Otherwise, functionalities will be lost.').'<br>'."<ol><li class='color_67'>".__('Report download in PDF format').'</li>'."<li class='color_67'>".__('Emails Sending').'</li><li class="color_67">'.__('Metaconsole Collections').'</li><li class="color_67">...</li></ol>',
'url' => $url,
]
);

View File

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

View File

@ -1046,7 +1046,7 @@ function mysql_db_get_row_filter($table, $filter, $fields=false, $where_join='AN
*
* @return mixed Array of the row or false in case of error.
*/
function mysql_db_get_all_rows_filter($table, $filter=[], $fields=false, $where_join='AND', $search_history_db=false, $returnSQL=false)
function mysql_db_get_all_rows_filter($table, $filter=[], $fields=false, $where_join='AND', $search_history_db=false, $returnSQL=false, $cache=true)
{
// TODO: Validate and clean fields
if (empty($fields)) {
@ -1077,7 +1077,7 @@ function mysql_db_get_all_rows_filter($table, $filter=[], $fields=false, $where_
if ($returnSQL) {
return $sql;
} else {
return db_get_all_rows_sql($sql, $search_history_db);
return db_get_all_rows_sql($sql, $search_history_db, $cache);
}
}

View File

@ -4325,7 +4325,7 @@ function agents_get_starmap(int $id_agent, float $width=0, float $height=0)
{
ui_require_css_file('heatmap');
$all_modules = agents_get_modules($id_agent);
$all_modules = agents_get_modules($id_agent, 'id_agente_modulo', ['disabled' => 0]);
if (empty($all_modules)) {
return null;
}

View File

@ -64,6 +64,7 @@ use PandoraFMS\Agent;
use PandoraFMS\Module;
use PandoraFMS\Enterprise\Cluster;
use PandoraFMS\Enterprise\Metaconsole\Node;
use PandoraFMS\Event;
use PandoraFMS\SpecialDay;
@ -11228,366 +11229,6 @@ function api_set_gis_agent($id_agent, $trash1, $other, $return_type, $user_in_db
}
function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db)
{
global $config;
$table_events = 'tevento';
// By default.
$status = 3;
$search = '';
$event_type = '';
$severity = -1;
$id_agent = -1;
$id_agentmodule = -1;
$id_alert_am = -1;
$id_event = -1;
$id_user_ack = 0;
$event_view_hr = 0;
$tag = '';
$group_rep = EVENT_GROUP_REP_ALL;
$utimestamp_upper = 0;
$utimestamp_bottom = 0;
$id_alert_template = -1;
$use_agent_name = ($other['data'][16] === '1') ? true : false;
$filter = otherParameter2Filter($other, true, $use_agent_name);
if (isset($filter['criticity'])) {
$severity = $filter['criticity'];
}
if (isset($filter['id_agente'])) {
$id_agent = $filter['id_agente'];
}
if (isset($filter['id_agentmodule'])) {
$id_agentmodule = $filter['id_agentmodule'][0];
}
if (isset($filter['id_alert_am'])) {
$id_alert_am = $filter['id_alert_am'];
}
if (isset($filter['id_usuario'])) {
$id_user_ack = $filter['id_usuario'];
}
if (isset($filter['estado'])) {
$status = $filter['estado'];
}
if (isset($filter['evento'])) {
$search = $filter['evento'];
}
if (isset($filter['id_alert_template'])) {
$id_alert_template = $filter['id_alert_template'];
}
$id_group = (int) $filter['id_group'];
$user_groups = users_get_groups($user_in_db, 'ER');
$user_id_groups = [];
if (!empty($user_groups)) {
$user_id_groups = array_keys($user_groups);
}
$is_admin = (bool) db_get_value(
'is_admin',
'tusuario',
'id_user',
$user_in_db
);
if (isset($filter['id_group'])) {
// The admin can see all groups
if ($is_admin) {
if (($id_group !== -1) && ($id_group !== 0)) {
$id_groups = [$id_group];
}
} else {
if (empty($id_group)) {
$id_groups = $user_id_groups;
} else {
if (in_array($id_group, $user_id_groups)) {
$id_groups = [$id_group];
} else {
$id_groups = [];
}
}
}
} else {
if (!$is_admin) {
$id_groups = $user_id_groups;
}
}
if (isset($filter['tag'])) {
$tag = $filter['tag'];
}
if (isset($filter['event_type'])) {
$event_type = $filter['event_type'];
}
if ($filter['utimestamp']) {
if (isset($filter['utimestamp']['>'])) {
$utimestamp_upper = $filter['utimestamp']['>'];
}
if (isset($filter['utimestamp']['<'])) {
$utimestamp_bottom = $filter['utimestamp']['<'];
}
}
// TODO MOVE THIS CODE AND THE CODE IN pandora_console/operation/events/events_list.php
// to a function.
$sql_post = '';
if (!empty($id_groups)) {
$sql_post = ' AND id_grupo IN ('.implode(',', $id_groups).')';
} else {
// The admin can see all groups
if (!$is_admin) {
$sql_post = ' AND 1=0';
}
}
// Skip system messages if user is not PM
if (!check_acl($user_in_db, 0, 'PM')) {
$sql_post .= ' AND id_grupo != 0';
}
switch ($status) {
case 0:
case 1:
case 2:
$sql_post .= ' AND estado = '.$status;
break;
case 3:
$sql_post .= ' AND (estado = 0 OR estado = 2)';
break;
}
if ($search != '') {
$sql_post .= " AND evento LIKE '%".io_safe_input($search)."%'";
}
if ($event_type != '') {
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
// for the user so for him is presented only "warning, critical and normal"
if ($event_type == 'warning' || $event_type == 'critical' || $event_type == 'normal') {
$sql_post .= " AND event_type LIKE '%$event_type%' ";
} else if ($event_type == 'not_normal') {
$sql_post .= " AND ( event_type LIKE '%warning%'
OR event_type LIKE '%critical%' OR event_type LIKE '%unknown%' ) ";
} else {
$sql_post .= " AND event_type = '".$event_type."'";
}
}
if ($severity != -1) {
$sql_post .= ' AND criticity = '.$severity;
}
if ($id_agent != -1) {
$sql_post .= ' AND id_agente = '.$id_agent;
}
if ($id_agentmodule != -1) {
$sql_post .= ' AND id_agentmodule = '.$id_agentmodule;
}
if ($id_event != -1) {
$sql_post .= ' AND id_evento = '.$id_event;
}
if ($id_user_ack != '0') {
$sql_post .= " AND id_usuario = '".$id_user_ack."'";
}
if ($utimestamp_upper != 0) {
$sql_post .= ' AND utimestamp >= '.$utimestamp_upper;
}
if ($utimestamp_bottom != 0) {
$sql_post .= ' AND utimestamp <= '.$utimestamp_bottom;
}
if ($event_view_hr > 0) {
// Put hours in seconds
$unixtime = (get_system_time() - ($event_view_hr * SECONDS_1HOUR));
$sql_post .= ' AND (utimestamp > '.$unixtime.' OR estado = 2)';
}
// Search by tag
if ($tag != '') {
$sql_post .= " AND tags LIKE '".io_safe_input($tag)."'";
}
// Inject the raw sql
if (isset($filter['sql'])) {
$sql_post .= ' AND ('.$filter['sql'].') ';
}
// Inject agent ID filter (it is set as the first numeric key in filter array).
if (isset($filter[0]) === true) {
$sql_post .= ' AND '.$filter[0];
}
if ($id_alert_template !== -1) {
$sql_post .= ' AND talert_template_modules.id_alert_template = '.$id_alert_template;
}
$alert_join = '';
if ($id_alert_template !== -1) {
$alert_join = ' INNER JOIN talert_template_modules ON '.$table_events.'.id_alert_am=talert_template_modules.id';
}
if ($group_rep == EVENT_GROUP_REP_ALL) {
if ($filter['total']) {
$sql = 'SELECT COUNT(*)
FROM '.$table_events.'
WHERE 1=1 '.$sql_post;
} else if ($filter['more_criticity']) {
$sql = 'SELECT criticity
FROM '.$table_events.'
WHERE 1=1 '.$sql_post.'
ORDER BY criticity DESC
LIMIT 1';
} else {
if (is_metaconsole() === true) {
$sql = 'SELECT *,
(SELECT t2.nombre
FROM tgrupo t2
WHERE t2.id_grupo = '.$table_events.'.id_grupo) AS group_name,
(SELECT t2.icon
FROM tgrupo t2
WHERE t2.id_grupo = '.$table_events.'.id_grupo) AS group_icon
FROM '.$table_events.$alert_join.'
WHERE 1=1 '.$sql_post.'
ORDER BY utimestamp DESC';
} else {
$sql = 'SELECT *,
(SELECT t1.alias
FROM tagente t1
WHERE t1.id_agente = tevento.id_agente) AS agent_name,
(SELECT t2.nombre
FROM tgrupo t2
WHERE t2.id_grupo = tevento.id_grupo) AS group_name,
(SELECT t2.icon
FROM tgrupo t2
WHERE t2.id_grupo = tevento.id_grupo) AS group_icon,
(SELECT tmodule.name
FROM tmodule
WHERE id_module IN (
SELECT tagente_modulo.id_modulo
FROM tagente_modulo
WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name
FROM '.$table_events.$alert_join.'
WHERE 1=1 '.$sql_post.'
ORDER BY utimestamp DESC';
}
}
} else {
db_process_sql('SET group_concat_max_len = 9999999');
$sql = "SELECT *, MAX(id_evento) AS id_evento,
GROUP_CONCAT(DISTINCT user_comment SEPARATOR '') AS user_comment,
MIN(estado) AS min_estado, MAX(estado) AS max_estado,
COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_last
FROM ".$table_events.'
WHERE 1=1 '.$sql_post.'
GROUP BY evento, id_agentmodule
ORDER BY timestamp_last DESC';
}
if ($other['type'] == 'string') {
if ($other['data'] != '') {
returnError('Parameter error.');
return;
} else {
// Default values
$separator = ';';
}
} else if ($other['type'] == 'array') {
$separator = $other['data'][0];
}
$result = db_get_all_rows_sql($sql);
if (($result !== false)
&& (!$filter['total'])
&& (!$filter['more_criticity'])
) {
$urlImage = ui_get_full_url(false);
// Add the description and image
foreach ($result as $key => $row) {
if (defined('METACONSOLE')) {
$row['agent_name'] = agents_meta_get_name(
$row['id_agente'],
'none',
$row['server_id']
);
$row['module_name'] = meta_modules_get_name(
$row['id_agentmodule'],
$row['server_id']
);
}
// FOR THE TEST THE API IN THE ANDROID
// $row['evento'] = $row['id_evento'];
$row['description_event'] = events_print_type_description($row['event_type'], true);
$row['img_description'] = events_print_type_img($row['event_type'], true, true);
$row['criticity_name'] = get_priority_name($row['criticity']);
switch ($row['criticity']) {
default:
case EVENT_CRIT_MAINTENANCE:
$img_sev = $urlImage.'/images/status_sets/default/severity_maintenance.png';
break;
case EVENT_CRIT_INFORMATIONAL:
$img_sev = $urlImage.'/images/status_sets/default/severity_informational.png';
break;
case EVENT_CRIT_NORMAL:
$img_sev = $urlImage.'/images/status_sets/default/severity_normal.png';
break;
case EVENT_CRIT_WARNING:
$img_sev = $urlImage.'/images/status_sets/default/severity_warning.png';
break;
case EVENT_CRIT_CRITICAL:
$img_sev = $urlImage.'/images/status_sets/default/severity_critical.png';
break;
}
$row['img_criticy'] = $img_sev;
$result[$key] = $row;
}
}
$data['type'] = 'array';
$data['data'] = $result;
returnData($returnType, $data, $separator);
if (empty($result)) {
return false;
}
return true;
}
/**
* Update an event
*
@ -11657,71 +11298,162 @@ function api_set_event($id_event, $unused1, $params, $unused2, $unused3)
/**
* Get events.
*
* @param $trash1
* @param $trah2
* @param $other
* @param $returnType
* @param $user_in_db
*/
function api_get_events($node_id, $trash2, $other, $returnType, $user_in_db=null)
function api_get_events($node_id, $trash2, $other, $returnType)
{
if ($user_in_db !== null) {
$correct = get_events_with_user(
$trash1,
$trash2,
$other,
$returnType,
$user_in_db
);
$separator = (isset($other['data'][0]) === true && empty($other['data'][0]) === false) ? $other['data'][0] : ';';
$last_error = error_get_last();
if (!$correct && !empty($last_error)) {
$errors = [
E_ERROR,
E_WARNING,
E_USER_ERROR,
E_USER_WARNING,
];
if (in_array($last_error['type'], $errors)) {
returnError('ERROR_API_PANDORAFMS', $returnType);
}
}
return;
}
if ($other['type'] == 'string') {
if ($other['data'] != '') {
returnError('Parameter error.');
return;
if (is_metaconsole() === true) {
if (empty($node_id) === true && $node_id != 0) {
$node_id = array_keys(metaconsole_get_names(['disabled' => 0]));
$node_id[] = 0;
} else {
// Default values
$separator = ';';
$node_id = [(int) $node_id];
}
} else if ($other['type'] == 'array') {
$separator = $other['data'][0];
// By default it uses agent alias.
$use_agent_name = ($other['data'][16] === '1') ? true : false;
$filterString = otherParameter2Filter($other, false, $use_agent_name);
} else {
$node_id = 0;
}
$dataRows = db_get_all_rows_filter('tevento', $filterString);
$filters = [
'group_rep' => EVENT_GROUP_REP_ALL,
'severity' => (isset($other['data'][1]) === true) ? $other['data'][1] : null,
'agent_alias' => (isset($other['data'][2]) === true) ? $other['data'][2] : null,
'module_search' => (isset($other['data'][3]) === true) ? $other['data'][3] : null,
'filter_only_alert' => (isset($other['data'][4]) === true) ? $other['data'][4] : null,
'id_user_ack' => (isset($other['data'][5]) === true) ? $other['data'][5] : null,
'date_from' => (isset($other['data'][6]) === true && empty($other['data'][6]) === false) ? date('y-m-d', $other['data'][6]) : null,
'date_to' => (isset($other['data'][7]) === true && empty($other['data'][7]) === false) ? date('y-m-d', $other['data'][7]) : null,
'time_from' => (isset($other['data'][6]) === true && empty($other['data'][6]) === false) ? date('h:i:s', $other['data'][6]) : null,
'time_to' => (isset($other['data'][7]) === true && empty($other['data'][7]) === false) ? date('h:i:s', $other['data'][7]) : null,
'status' => (isset($other['data'][8]) === true) ? $other['data'][8] : null,
'search' => (isset($other['data'][9]) === true) ? $other['data'][9] : null,
'id_group_filter' => (isset($other['data'][13]) === true) ? $other['data'][13] : null,
'tag_with' => (isset($other['data'][14]) === true) ? base64_encode(io_safe_output($other['data'][14])) : null,
'event_type' => (isset($other['data'][15]) === true) ? $other['data'][15] : null,
'id_server' => $node_id,
];
$last_error = error_get_last();
if (empty($dataRows)) {
if (!empty($last_error)) {
returnError('ERROR_API_PANDORAFMS', $returnType);
return;
$limit = null;
if (isset($other['data'][10]) === true) {
if (empty($other['data'][10]) === true) {
$limit = 0;
} else {
$limit = $other['data'][10];
}
}
$data['type'] = 'array';
$data['data'] = $dataRows;
$offset = null;
if (isset($other['data'][11]) === true) {
if (empty($other['data'][11]) === true) {
$offset = 0;
} else {
$offset = $other['data'][11];
}
} else {
if (isset($other['data'][10]) === true) {
$offset = 0;
}
}
$fields = ['te.*'];
$order_direction = 'desc';
$order_field = 'te.utimestamp';
$filter_total = false;
if (isset($other['data'][12]) === true
&& empty($other['data'][12]) === false
) {
$filter_total = true;
if ($other['data'][12] === 'total') {
$fields = ['count'];
$limit = null;
$offset = null;
} else if ($other['data'][12] === 'more_criticity') {
$fields = ['te.criticity'];
$order_direction = 'desc';
$order_field = 'te.criticity';
$limit = 1;
$offset = 0;
}
}
$events = Event::search(
$fields,
$filters,
$offset,
$limit,
$order_direction,
$order_field
);
$result = $events;
if (is_metaconsole() === true && empty($limit) === false) {
$result = $events['data'];
}
if (is_array($result) === true && $filter_total === false) {
$urlImage = ui_get_full_url(false);
// Add the description and image.
foreach ($result as $key => $row) {
if (is_metaconsole() === true) {
if (empty($row['id_agente']) === false) {
$row['agent_name'] = agents_meta_get_name(
$row['id_agente'],
'none',
$row['server_id']
);
}
if (empty($row['id_agentmodule']) === false) {
$row['module_name'] = meta_modules_get_name(
$row['id_agentmodule'],
$row['server_id']
);
}
}
// FOR THE TEST THE API IN THE ANDROID.
$row['description_event'] = events_print_type_description($row['event_type'], true);
$row['img_description'] = events_print_type_img($row['event_type'], true, true);
$row['criticity_name'] = get_priority_name($row['criticity']);
switch ($row['criticity']) {
default:
case EVENT_CRIT_MAINTENANCE:
$img_sev = $urlImage.'/images/status_sets/default/severity_maintenance.png';
break;
case EVENT_CRIT_INFORMATIONAL:
$img_sev = $urlImage.'/images/status_sets/default/severity_informational.png';
break;
case EVENT_CRIT_NORMAL:
$img_sev = $urlImage.'/images/status_sets/default/severity_normal.png';
break;
case EVENT_CRIT_WARNING:
$img_sev = $urlImage.'/images/status_sets/default/severity_warning.png';
break;
case EVENT_CRIT_CRITICAL:
$img_sev = $urlImage.'/images/status_sets/default/severity_critical.png';
break;
}
$row['img_criticy'] = $img_sev;
$result[$key] = $row;
}
}
$data['type'] = $returnType;
$data['data'] = $result;
returnData($returnType, $data, $separator);
return;
}

View File

@ -89,23 +89,34 @@ function cron_next_execution($cron, $module_interval, $module_id)
'id_agente_modulo',
$module_id
);
$cron_elems = explode(' ', $cron);
if (isset($cron_elems[4]) === true) {
$cron_elems[4] = '*';
}
$cron = implode(' ', $cron_elems);
$cur_time = ($last_execution !== false) ? $last_execution : time();
$nex_time = cron_next_execution_date($cron, $cur_time, $module_interval);
$nex_wday = (int) date('w', $nex_time);
// Check the wday values to avoid infinite loop.
$wday_int = cron_get_interval($wday);
if ($wday_int['down'] !== '*' && ($wday_int['down'] > 6 || ($wday_int['up'] !== false && $wday_int['up'] > 6))) {
$wday = '*';
}
// Check day of the way.
// Check week day.
while (!cron_check_interval($nex_wday, $wday)) {
// If it does not acomplish the day of the week, go to the next day.
$nex_time += SECONDS_1DAY;
$nex_time = cron_next_execution_date($cron, $nex_time, 0);
$nex_wday = (int) date('w', $nex_time);
}
$nex_time = cron_next_execution_date($cron, $nex_time, 0);
return ($nex_time - $cur_time);
}

View File

@ -795,6 +795,10 @@ function db_uncompress_module_data(
$flag_async = true;
}
if (strstr($module_type_str, 'async_string') !== false) {
$flag_async = true;
}
if (strstr($module_type_str, 'async_proc') !== false) {
$flag_async = true;
}

View File

@ -800,7 +800,7 @@ function events_get_all(
}
}
if (isset($filter['severity']) === true && $filter['severity'] > 0) {
if (isset($filter['severity']) === true && $filter['severity'] !== '' && (int) $filter['severity'] > -1) {
if (is_array($filter['severity']) === true) {
if (in_array(-1, $filter['severity']) === false) {
$not_normal = array_search(EVENT_CRIT_NOT_NORMAL, $filter['severity']);
@ -1033,14 +1033,13 @@ function events_get_all(
// Prepare agent join sql filters.
$table = 'tevento';
$tevento = 'tevento te';
$agent_join_filters = [];
$tagente_table = 'tagente';
$tagente_field = 'id_agente';
$conditionMetaconsole = '';
// Agent alias.
if (empty($filter['agent_alias']) === false) {
$agent_join_filters[] = sprintf(
$sql_filters[] = sprintf(
' AND ta.alias = "%s" ',
$filter['agent_alias']
);
@ -1124,27 +1123,27 @@ function events_get_all(
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1
AND (JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) ',
io_safe_output($filter['custom_data'])
io_safe_output_html($filter['custom_data'])
);
} else {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1
AND (JSON_SEARCH(JSON_KEYS(custom_data), "all", lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) IS NOT NULL) ',
io_safe_output($filter['custom_data'])
io_safe_output_html($filter['custom_data'])
);
}
} else {
if ($filter['custom_data_filter_type'] === '1') {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1 AND JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") ',
$filter['custom_data'],
$filter['custom_data']
' AND JSON_VALID(custom_data) = 1
AND cast(JSON_EXTRACT(custom_data, "$.*") as CHAR) LIKE lower("%%%s%%") ',
io_safe_output($filter['custom_data'])
);
} else {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1 AND JSON_KEYS(custom_data) REGEXP "%s" ',
$filter['custom_data'],
$filter['custom_data']
' AND JSON_VALID(custom_data) = 1
AND cast(JSON_KEYS(custom_data) as CHAR) REGEXP "%s" ',
io_safe_output($filter['custom_data'])
);
}
}
@ -1311,7 +1310,7 @@ function events_get_all(
'te.',
// Alt table tag for id_grupo.
$user_admin_group_all,
(bool) $filter['search_secondary_groups']
(bool) (isset($filter['search_secondary_groups']) === true) ? $filter['search_secondary_groups'] : false
);
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
} else if (check_acl($config['id_user'], 0, 'EW')) {
@ -1338,7 +1337,7 @@ function events_get_all(
'te.',
// Alt table tag for id_grupo.
$user_admin_group_all,
(bool) $filter['search_secondary_groups']
(bool) (isset($filter['search_secondary_groups']) === true) ? $filter['search_secondary_groups'] : false
);
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
} else if (check_acl($config['id_user'], 0, 'EM')) {
@ -1365,7 +1364,7 @@ function events_get_all(
'te.',
// Alt table tag for id_grupo.
$user_admin_group_all,
(bool) $filter['search_secondary_groups']
(bool) (isset($filter['search_secondary_groups']) === true) ? $filter['search_secondary_groups'] : false
);
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
}
@ -1561,7 +1560,6 @@ function events_get_all(
%s JOIN %s ta
ON ta.%s = te.id_agente
%s
%s
%s JOIN tgrupo tg
ON %s
WHERE 1=1
@ -1577,7 +1575,6 @@ function events_get_all(
%s JOIN %s ta
ON ta.%s = te.id_agente
%s
%s
%s JOIN tgrupo tg
ON %s
%s
@ -1593,7 +1590,6 @@ function events_get_all(
$tagente_table,
$tagente_field,
$conditionMetaconsole,
join(' ', $agent_join_filters),
$tgrupo_join,
join(' ', $tgrupo_join_filters),
join(' ', $sql_filters),
@ -1607,7 +1603,6 @@ function events_get_all(
$tagente_table,
$tagente_field,
$conditionMetaconsole,
join(' ', $agent_join_filters),
$tgrupo_join,
join(' ', $tgrupo_join_filters),
join(' ', $sql_filters),
@ -1623,7 +1618,6 @@ function events_get_all(
%s JOIN %s ta
ON ta.%s = te.id_agente
%s
%s
%s JOIN tgrupo tg
ON %s
WHERE 1=1
@ -1642,7 +1636,6 @@ function events_get_all(
$tagente_table,
$tagente_field,
$conditionMetaconsole,
join(' ', $agent_join_filters),
$tgrupo_join,
join(' ', $tgrupo_join_filters),
join(' ', $sql_filters),
@ -1869,7 +1862,7 @@ function events_get_all(
return $return;
} else {
return $data;
return ['count' => count($data)];
}
}
@ -4700,22 +4693,30 @@ function events_page_general($event)
$data = [];
$data[0] = __('Timestamp');
if ($group_rep == 1 && $event['event_rep'] > 1) {
$data[1] = __('First event').': '.date($config['date_format'], $event['timestamp_first']).'<br>'.__('Last event').': '.date($config['date_format'], $event['timestamp_last']);
if ($event['event_rep'] > 1) {
$data[1] = __('First event').': ';
$data[1] .= date($config['date_format'], $event['timestamp_first']);
$data[1] .= '<br>';
$data[1] .= __('Last event').': ';
$data[1] .= date($config['date_format'], $event['timestamp_last']);
} else {
$data[1] = date($config['date_format'], $event['utimestamp']);
}
$table_general->data[] = $data;
// $event['owner_user'] = $event['id_usuario'];
$data = [];
$data[0] = __('Owner');
if (empty($event['owner_user'])) {
if (empty($event['owner_user']) === true) {
$data[1] = '<i>'.__('N/A').'</i>';
} else {
$user_owner = db_get_value('fullname', 'tusuario', 'id_user', $event['owner_user']);
if (empty($user_owner)) {
$user_owner = db_get_value(
'fullname',
'tusuario',
'id_user',
$event['owner_user']
);
if (empty($user_owner) === true) {
$user_owner = $event['owner_user'];
}

View File

@ -1416,7 +1416,7 @@ function graphic_combined_module(
}
}
if (isset($sources) && is_array($sources)) {
if (isset($sources) === true && is_array($sources) === true) {
$weights = [];
$labels = [];
$modules = [];
@ -1498,6 +1498,10 @@ function graphic_combined_module(
}
}
if ((bool) $params_combined['from_interface'] === true) {
$labels = [];
}
if ($module_list) {
$params_combined['modules_id'] = $module_list;
} else {

View File

@ -8682,8 +8682,8 @@ function reporting_availability($report, $content, $date=false, $time=false)
$item['id_agent_module']
);
if (isset($item['compare']) === true
&& empty($item['compare']) === true
if (isset($item['compare']) === false
|| empty($item['compare']) === true
) {
$row['data']['compare'] = false;
} else {

View File

@ -4007,7 +4007,7 @@ function reporting_html_text(&$table, $item)
*/
function reporting_html_availability($table, $item, $pdf=0)
{
$retun_pdf = '';
$return_pdf = '';
$style = db_get_value(
'style',
@ -4234,7 +4234,7 @@ function reporting_html_availability($table, $item, $pdf=0)
} else {
$table_row[] = $row['agent'];
$item_name = $row['availability_item'];
if ((bool) $row['compare'] === false) {
if ((bool) $row['compare'] === true) {
$item_name .= ' ('.__('24 x 7').')';
}
@ -4422,6 +4422,7 @@ function reporting_html_availability($table, $item, $pdf=0)
$table2->data[] = $table_row2;
}
} else {
$table = new stdClass();
$table->colspan['error']['cell'] = 3;
$table->data['error']['cell'] = __(
'There are no Agent/Modules defined'
@ -5980,11 +5981,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
include_once '../../include/graphs/functions_gd.php';
}
$max_value = count($events);
if (is_metaconsole()) {
$max_value = SECONDS_1HOUR;
}
$period = SECONDS_1DAY;
if (!$text_header_event) {
$text_header_event = __('Events info (1hr.)');
@ -6057,7 +6054,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
} else {
$graph_data[] = [
'data' => $color,
'utimestamp' => 1,
'utimestamp' => SECONDS_1DAY,
];
}
}
@ -6076,9 +6073,9 @@ function reporting_get_event_histogram($events, $text_header_event=false)
$slicebar = flot_slicesbar_graph(
$graph_data,
$max_value,
'450px;border:0',
25,
$period,
'400px;border:0',
40,
$full_legend,
$colors,
$config['fontpath'],
@ -6091,7 +6088,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
[],
true,
1,
false,
450,
true
);

View File

@ -4001,11 +4001,12 @@ function ui_toggle(
);
// Options.
$style = 'overflow:hidden;';
if ($hidden_default) {
$style = 'display:none';
$style .= 'height:0;';
$original = $img_b;
} else {
$style = '';
$style .= 'height:auto;';
$original = $img_a;
}
@ -4111,24 +4112,24 @@ function ui_toggle(
$output .= ' if (is_metaconsole == 0) {';
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " $('#tgl_div_".$uniqid."').css('height', 'auto');\n";
$output .= " }\n";
$output .= " else {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " $('#tgl_div_".$uniqid."').css('height', 0);\n";
$output .= " }\n";
$output .= " }\n";
$output .= " });\n";
$output .= " $('#tgl_ctrl_".$uniqid."').click(function() {\n";
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " $('#tgl_div_".$uniqid."').css('height', 'auto');\n";
$output .= " $('#image_".$uniqid."').attr({src: '".$image_a."'});\n";
$output .= " $('#checkbox-".$switch_name."').prop('checked', true);\n";
$output .= " }\n";
$output .= " else {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " $('#tgl_div_".$uniqid."').css('height', 0);\n";
$output .= " $('#image_".$uniqid."').attr({src: '".$image_b."'});\n";
$output .= " $('#checkbox-".$switch_name."').prop('checked', false);\n";
$output .= " }\n";

View File

@ -2461,14 +2461,14 @@ function pandoraFlotArea(
);
} else {
$.each(update_legend, function(index, value) {
if (typeof value[x] !== "undefined") {
if (typeof value[x - 1] !== "undefined") {
data_legend[index] =
" Min: " +
number_format(value[x].min, 0, unit, short_data, divisor) +
number_format(value[x - 1].min, 0, unit, short_data, divisor) +
" Max: " +
number_format(value[x].max, 0, unit, short_data, divisor) +
number_format(value[x - 1].max, 0, unit, short_data, divisor) +
" Avg: " +
number_format(value[x].avg, 0, unit, short_data, divisor);
number_format(value[x - 1].avg, 0, unit, short_data, divisor);
} else {
data_legend[index] = " Min: " + 0 + " Max: " + 0 + " Avg: " + 0;
}

View File

@ -170,7 +170,7 @@ class AlertsFiredWidget extends Widget
$this->configurationRequired = false;
if (isset($this->values['groupId']) === false) {
$this->configurationRequired = true;
} else {
} else if ($this->values['groupId'] !== '0') {
$check_exist = \db_get_value(
'id_grupo',
'tgrupo',

View File

@ -181,7 +181,7 @@ final class Container extends Model
null
);
return ($backgroundImage === 'None.png') ? null : $backgroundImage;
return ($backgroundImage === 'None.png') ? null : str_replace(' ', '%20', $backgroundImage);
}

View File

@ -6,10 +6,6 @@ div#bullets_modules span {
font-weight: 700;
}
table#agent_interface_info .noresizevc.graph {
margin-bottom: 10px;
}
div.agent_details_agent_alias {
flex: 1;
}

View File

@ -457,8 +457,11 @@ button.ui-button::-moz-focus-inner {
outline: 0;
}
.ui-dialog .ui-dialog-titlebar {
padding: 0.4em 1em;
position: relative;
height: 38px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
.ui-dialog .ui-dialog-title {
float: left;
@ -471,7 +474,6 @@ button.ui-button::-moz-focus-inner {
.ui-dialog .ui-dialog-titlebar-close {
position: absolute;
right: 0.3em;
top: 50%;
width: 20px;
margin: -10px 0 0 0;
padding: 1px;
@ -847,11 +849,7 @@ body .ui-tooltip {
.ui-widget textarea,
.ui-widget button {
}
.ui-widget.ui-widget-content {
border: 1px solid #c5c5c5;
}
.ui-widget-content {
border: 1px solid #ddd;
background: #fff;
color: #333;
}
@ -859,7 +857,6 @@ body .ui-tooltip {
color: #333;
}
.ui-widget-header {
border: 1px solid #ddd;
background: #e9e9e9;
color: #333;
font-weight: bold;
@ -867,6 +864,9 @@ body .ui-tooltip {
.ui-widget-header a {
color: #333;
}
.ui-dialog .ui-widget-header {
margin: -3px -3px 0px -3px;
}
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default,
@ -998,34 +998,6 @@ a.ui-button:active,
width: 16px;
height: 16px;
}
.ui-icon,
.ui-widget-content .ui-icon {
background-image: url("jQueryUI-1.12.1/themes/base/images/ui-icons_444444_256x240.png");
}
.ui-widget-header .ui-icon {
background-image: url("jQueryUI-1.12.1/themes/base/images/ui-icons_444444_256x240.png");
}
.ui-state-hover .ui-icon,
.ui-state-focus .ui-icon,
.ui-button:hover .ui-icon,
.ui-button:focus .ui-icon {
background-image: url("jQueryUI-1.12.1/themes/base/images/ui-icons_555555_256x240.png");
}
.ui-state-active .ui-icon,
.ui-button:active .ui-icon {
background-image: url("jQueryUI-1.12.1/themes/base/images/ui-icons_ffffff_256x240.png");
}
.ui-state-highlight .ui-icon,
.ui-button .ui-state-highlight.ui-icon {
background-image: url("jQueryUI-1.12.1/themes/base/images/ui-icons_777620_256x240.png");
}
.ui-state-error .ui-icon,
.ui-state-error-text .ui-icon {
background-image: url("jQueryUI-1.12.1/themes/base/images/ui-icons_cc0000_256x240.png");
}
.ui-button .ui-icon {
background-image: url("jQueryUI-1.12.1/themes/base/images/ui-icons_777777_256x240.png");
}
.ui-icon-blank {
background-position: 16px 16px;
}

View File

@ -97,7 +97,7 @@
}
#tabs-sound-modal button.upd,
input.upd {
#button-melody_sound {
background-image: url(../../images/sound_wave.png);
background-position: 90px 8px;
}

View File

@ -1132,7 +1132,7 @@ if (get_parameter('login', 0) !== 0) {
$php_version = phpversion();
$php_version_array = explode('.', $php_version);
if ($php_version_array[0] < 7) {
include_once 'general/php7_message.php';
include_once 'general/php_message.php';
}
}

View File

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

View File

@ -681,9 +681,8 @@ if (!empty($network_interfaces)) {
$table_interface->style['interface_graph'] = 'width: 20px;padding-top:0px;padding-bottom:0px;';
$table_interface->style['interface_event_graph'] = 'width: 35%;padding-top:0px;padding-bottom:0px;';
$table_interface->align['interface_event_graph'] = 'right';
// $table_interface->style['interface_event_graph'] = 'width: 5%;padding-top:0px;padding-bottom:0px;';
$table_interface->align['interface_event_graph_text'] = 'left';
$table_interface->style['interface_name'] = 'width: 10%;padding-top:0px;padding-bottom:0px;';
$table_interface->style['interface_event_graph'] = 'width: 3%;padding-top:0px;padding-bottom:0px;';
$table_interface->style['interface_name'] = 'width: 30%;padding-top:0px;padding-bottom:0px;';
$table_interface->align['interface_name'] = 'left';
$table_interface->align['interface_ip'] = 'left';
$table_interface->align['last_contact'] = 'left';
@ -819,12 +818,6 @@ if (!empty($network_interfaces)) {
$data['interface_mac'] = $interface['mac'];
$data['last_contact'] = __('Last contact: ').$last_contact;
$data['interface_event_graph'] = $e_graph;
if ($event_text_cont == 0) {
$data['interface_event_graph_text'] = ui_print_help_tip('Module events graph', true);
$event_text_cont++;
} else {
$data['interface_event_graph_text'] = '';
}
$table_interface->data[] = $data;
}
@ -939,7 +932,7 @@ if ($table_access_rate) {
echo $agent_incidents;
if (isset($table_interface)) {
if (isset($table_interface) === true) {
ui_toggle(
html_print_table($table_interface, true),
'<b>'.__('Interface information (SNMP)').'</b>',

View File

@ -95,10 +95,12 @@ if ($refresh > 0) {
<title><?php echo __('%s Interface Graph', get_product_name()).' ('.agents_get_alias($agent_id).' - '.$interface_name; ?>)</title>
<link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" />
<link rel="stylesheet" href="../../include/styles/js/jquery-ui.min.css" type="text/css" />
<link rel="stylesheet" href="../../include/styles/select2.min.css" type="text/css" />
<script type='text/javascript' src='../../include/javascript/pandora.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery.current.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery-ui.min.js'></script>
<script type='text/javascript' src='../../include/javascript/select2.min.js'></script>
<?php
require_once $config['homedir'].'/include/graphs/functions_flot.php';
echo include_javascript_dependencies_flot_graph(true, '../');

View File

@ -222,7 +222,7 @@ $id_source_event = get_parameter(
$server_id = get_parameter(
'filter[server_id]',
($filter['id_server_meta'] ?? '')
($filter['server_id'] ?? '')
);
if (is_metaconsole() === true) {
@ -241,13 +241,19 @@ if (is_metaconsole() === true) {
$servers[0] = __('Metaconsola');
if ($server_id === '') {
if (empty($server_id) === true) {
$server_id = array_keys($servers);
} else if (is_array($server_id) === false) {
if ((int) $server_id !== 0) {
$server_id = [$server_id];
} else {
$server_id = array_keys($servers);
} else {
if (is_array($server_id) === false) {
if (is_numeric($server_id) === true) {
if ($server_id !== 0) {
$server_id = [$filter['server_id']];
} else {
$server_id = array_keys($servers);
}
} else {
$server_id = explode(',', $filter['server_id']);
}
}
}
}
@ -1108,7 +1114,21 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false
$id_extra = $filter['id_extra'];
$user_comment = $filter['user_comment'];
$id_source_event = ($filter['id_source_event'] ?? '');
$server_id = $filter['server_id'];
$server_id = '';
if (empty($filter['server_id']) === false) {
if (is_array($server_id) === false) {
if (is_numeric($server_id) === true) {
if ($server_id !== 0) {
$server_id = [$filter['server_id']];
} else {
$server_id = array_keys($servers);
}
} else {
$server_id = explode(',', $filter['server_id']);
}
}
}
$custom_data = $filter['custom_data'];
$custom_data_filter_type = $filter['custom_data_filter_type'];
}
@ -2849,7 +2869,11 @@ $(document).ready( function() {
inputs = $("#<?php echo $form_id; ?> :input");
values = {};
inputs.each(function() {
values[this.name] = $(this).val();
if (this.name === 'server_id') {
values[this.name] = $(this).val().join();
} else {
values[this.name] = $(this).val();
}
})
values['history'] = "<?php echo (int) $history; ?>";
@ -2880,11 +2904,11 @@ $(document).ready( function() {
$("#text-event_view_hr").on("keyup",function(){
hours = $('#text-event_view_hr').val();
if (hours == '' || hours == 0 ) {
$('#summary_hours').html('<?php echo __('Any'); ?>');
$('#summary_hours').text('<?php echo __('Any'); ?>');
} else if (hours == 1) {
$('#summary_hours').html('<?php echo __('Last hour.'); ?>');
$('#summary_hours').text('<?php echo __('Last hour.'); ?>');
} else {
$('#summary_hours').html(hours + '<?php echo ' '.__('hours.'); ?>');
$('#summary_hours').text(hours + '<?php echo ' '.__('hours.'); ?>');
}
});
@ -3030,7 +3054,11 @@ $(document).ready( function() {
inputs = $("#events_form :input");
values = {};
inputs.each(function() {
values[this.name] = $(this).val();
if (this.name === 'server_id') {
values[this.name] = $(this).val().join();
} else {
values[this.name] = $(this).val();
}
})
var newValue = btoa(JSON.stringify(values));

View File

@ -269,7 +269,7 @@ if ($searchAgents) {
if ($agents !== false) {
$totalAgents = db_get_value_sql(
'SELECT COUNT(id_agente) AS agent_count '.$sql
'SELECT COUNT(DISTINCT id_agente) AS agent_count '.$sql
);
}
}

View File

@ -501,7 +501,8 @@ if (!isset($autorefresh_list)) {
$autorefresh_list = $aux;
}
} else {
if (($autorefresh_list[0] === '') || ($autorefresh_list[0] === '0')) {
if (is_array($autorefresh_list) === false || empty($autorefresh_list[0]) === true || $autorefresh_list[0] === '0') {
$autorefresh_list = [];
$autorefresh_list[0] = __('None');
} else {
$aux = [];

View File

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

View File

@ -1256,7 +1256,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`id_extra` TINYTEXT,
`user_comment` TEXT,
`id_source_event` INT NULL DEFAULT 0,
`server_id` INT NOT NULL DEFAULT 0,
`server_id` TEXT,
`time_from` TIME NULL,
`time_to` TIME NULL,
`custom_data` VARCHAR(500) DEFAULT '',

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.766-221110
Version: 7.0NG.766-221123
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.766-221110"
pandora_version="7.0NG.766-221123"
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.766";
my $pandora_build = "221110";
my $pandora_build = "221123";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -7252,9 +7252,12 @@ sub pandora_snmptrapd_still_working ($$) {
my $snmptrapdFile = $pa_config->{'snmp_logfile'};
tie my @snmptrapdFileComplete, 'Tie::File', $snmptrapdFile;
my $lastTimestampLogFile = $snmptrapdFileComplete[-1];
$lastTimestampLogFile = '' unless defined ($lastTimestampLogFile);
my ($protocol, $date, $time) = split(/\[\*\*\]/, $lastTimestampLogFile, 4);
# If time or date not filled in, probably havent caught any snmptraps yet.
if ($time ne '' && $date ne '') {
if (defined $date && defined $time && $time ne '' && $date ne '') {
my ($hour, $min, $sec) = split(/:/, $time, 3);
my ($year, $month, $day) = split(/-/, $date, 3);
my $lastTimestampLogFile = timelocal($sec,$min,$hour,$day,$month-1,$year);

View File

@ -19,6 +19,9 @@ package PandoraFMS::DB;
use strict;
use warnings;
use threads;
use DBI;
use Carp qw/croak/;
@ -72,8 +75,11 @@ our @EXPORT = qw(
get_alert_template_name
get_command_id
get_console_api_url
get_db_nodes
get_db_rows
get_db_rows_limit
get_db_rows_node
get_db_rows_parallel
get_db_single_row
get_db_value
get_db_value_limit
@ -947,6 +953,37 @@ sub get_db_single_row ($$;@) {
return undef;
}
##########################################################################
## Get DB information for all known Pandora FMS nodes.
##########################################################################
sub get_db_nodes ($$) {
my ($dbh, $pa_config) = @_;
my $dbh_nodes = [];
# Insert the current node first.
push(@{$dbh_nodes},
{'dbengine' => $pa_config->{'dbengine'},
'dbname' => $pa_config->{'dbname'},
'dbhost' => $pa_config->{'dbhost'},
'dbport' => $pa_config->{'dbport'},
'dbuser' => $pa_config->{'dbuser'},
'dbpass' => $pa_config->{'dbpass'}});
# Look for additional nodes.
my @nodes = get_db_rows($dbh, 'SELECT * FROM tmetaconsole_setup WHERE disabled = 0');
foreach my $node (@nodes) {
push(@{$dbh_nodes},
{'dbengine' => $pa_config->{'dbengine'},
'dbname' => $node->{'dbname'},
'dbhost' => $node->{'dbhost'},
'dbport' => $node->{'dbport'},
'dbuser' => $node->{'dbuser'},
'dbpass' => $node->{'dbpass'}});
}
return $dbh_nodes;
}
##########################################################################
## Get all rows returned by an SQL query as a hash reference array.
##########################################################################
@ -961,18 +998,67 @@ sub get_db_rows ($$;@) {
# Save returned rows
while (my $row = $sth->fetchrow_hashref()) {
if ($RDBMS eq 'oracle') {
push (@rows, {map { lc ($_) => $row->{$_} } keys (%{$row})});
}
else {
push (@rows, $row);
}
push (@rows, $row);
}
$sth->finish();
return @rows;
}
##########################################################################
## Connect to the given node and run get_db_rows.
##########################################################################
sub get_db_rows_node ($$;@) {
my ($node, $query, @values) = @_;
my $dbh;
my @rows;
eval {
$dbh = db_connect($node->{'dbengine'},
$node->{'dbname'},
$node->{'dbhost'},
$node->{'dbport'},
$node->{'dbuser'},
$node->{'dbpass'});
@rows = get_db_rows($dbh, $query, @values);
};
db_disconnect($dbh) if defined($dbh);
return \@rows;
}
##########################################################################
## Run get_db_rows on all known Pandora FMS nodes in parallel.
##########################################################################
sub get_db_rows_parallel ($$;@) {
my ($nodes, $query, @values) = @_;
# Launch the queries.
my @threads;
{
# Calling DESTROY would make the server restart.
no warnings 'redefine';
local *PandoraFMS::ProducerConsumerServer::DESTROY = sub {};
local *PandoraFMS::BlockProducerConsumerServer::DESTROY = sub {};
# Query the nodes.
foreach my $node (@{$nodes}) {
my $thr = threads->create(\&get_db_rows_node, $node, $query, @values);
push(@threads, $thr) if defined($thr);
}
}
# Retrieve the results.
my @combined_res;
foreach my $thr (@threads) {
my $res = $thr->join();
push(@combined_res, @{$res}) if defined($res);
}
return @combined_res;
}
########################################################################
## Get all rows (with a limit clause) returned by an SQL query
## as a hash reference array.

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

View File

@ -147,7 +147,9 @@ sub data_producer ($) {
# Reset storm protection counters
my $curr_time = time ();
if ($pa_config->{"__storm_ref__"} + $pa_config->{"snmp_storm_timeout"} < $curr_time) {
if ($pa_config->{"__storm_ref__"} + $pa_config->{"snmp_storm_timeout"} < $curr_time
|| $pa_config->{'snmpconsole_lock'} == 1
) {
$pa_config->{"__storm_ref__"} = $curr_time;
%AGENTS = ();
}

View File

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

View File

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

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.766"
PI_BUILD="221110"
PI_BUILD="221123"
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.766 Build 221110";
my $version = "7.0NG.766 Build 221123";
# 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.766 Build 221110";
my $version = "7.0NG.766 Build 221123";
# save program name for logging
my $progname = basename($0);