Merge remote-tracking branch 'origin/develop' into ent-6158-mejoras-a-servicios-dinamicos-expresiones-regulares-y-varios-custom-field

This commit is contained in:
fbsanchez 2020-11-25 13:56:40 +01:00
commit 97d5376bcb
35 changed files with 1454 additions and 680 deletions

View File

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

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.750"
PI_BUILD="201124"
PI_BUILD="201125"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

@ -1,651 +1,95 @@
<?php
/**
* Agents/Alerts Monitoring view.
*
* @category Operations
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2020 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php';
// Begin.
global $config;
// Require needed class.
require_once $config['homedir'].'/include/class/AgentsAlerts.class.php';
// Get the parameter.
$sec2 = get_parameter_get('sec2');
// Add operation menu option.
extensions_add_operation_menu_option(
__('Agents/Alerts view'),
'estado',
null,
'v1r1',
'view'
);
// If sec2 parameter come with this page info.
if ($sec2 === 'extensions/agents_alerts') {
extensions_add_main_function('mainAgentsAlerts');
}
/**
* Function for load the controller.
*
* @return void
*/
function mainAgentsAlerts()
{
global $config;
// Load global vars
include_once 'include/config.php';
include_once 'include/functions_reporting.php';
check_login();
// ACL Check
if (! check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Agent view (Grouped)'
);
include 'general/noaccess.php';
exit;
}
// Update network modules for this group
// Check for Network FLAG change request
// Made it a subquery, much faster on both the database and server side
if (isset($_GET['update_netgroup'])) {
$group = get_parameter_get('update_netgroup', 0);
if (check_acl($config['id_user'], $group, 'AW')) {
$where = ['id_agente' => 'ANY(SELECT id_agente FROM tagente WHERE id_grupo = '.$group];
db_process_sql_update('tagente_modulo', ['flag' => 1], $where);
} else {
db_pandora_audit('ACL Violation', 'Trying to set flag for groups');
include 'general/noaccess.php';
global $ajaxPage;
// This page.
$thisOwnPage = 'index.php?sec=view&sec2=extensions/agents_alerts';
// Ajax variables.
$ajaxPage = 'extensions/agents_alerts';
$pageName = '[AgentsAlerts]';
// Control call flow.
try {
// User access and validation is being processed on class constructor.
$obj = new AgentsAlerts($ajaxPage);
} catch (Exception $e) {
if (is_ajax() === true) {
echo json_encode(['error' => $pageName.$e->getMessage() ]);
exit;
}
}
if ($config['realtimestats'] == 0) {
$updated_info = __('Last update').' : '.ui_print_timestamp(db_get_sql('SELECT min(utimestamp) FROM tgroup_stat'), true);
} else {
// $updated_info = __("Updated at realtime");
$updated_info = '';
}
$updated_time = $updated_info;
$create_alert = (int) get_parameter('create_alert', 0);
if ($create_alert) {
$template2 = get_parameter('template');
$module_action_threshold = get_parameter('module_action_threshold');
$id_alert = alerts_create_alert_agent_module($create_alert, $template2);
if ($id_alert !== false) {
$action_select = get_parameter('action_select', 0);
if ($action_select != 0) {
$values = [];
$values['fires_min'] = 0;
$values['fires_max'] = 0;
$values['module_action_threshold'] = (int) get_parameter('module_action_threshold');
alerts_add_alert_agent_module_action($id_alert, $action_select, $values);
}
}
}
$refr = (int) get_parameter('refr', 30);
// By default 30 seconds
$show_modules = (bool) get_parameter('show_modules', 0);
$group_id = get_parameter('group_id', 0);
$offset = get_parameter('offset', 0);
$hor_offset = get_parameter('hor_offset', 0);
$block = 20;
$groups = users_get_groups();
$filter_groups .= '<b>'.__('Group').'</b>';
$filter_groups .= '<div class="w250px inline margin-left-2">';
$filter_groups .= html_print_select_groups(false, 'AR', true, 'group_id', $group_id, false, '', '', true, false, true, '', false, 'margin-right: 10px; margin-top: 5px;');
$filter_groups .= '</div>';
$check = '<b>'.__('Show modules without alerts').'</b>';
$check .= html_print_checkbox('slides_ids[]', $d['id'], $show_modules, true, false, '', true);
$comborefr = '<form method="post" action="'.ui_get_url_refresh(['offset' => 0, 'hor_offset' => 0]).'">';
$comborefr .= '<b>'.__('Refresh').'</b>';
$comborefr .= html_print_select(
[
'30' => '30 '.__('seconds'),
(string) SECONDS_1MINUTE => __('1 minute'),
(string) SECONDS_2MINUTES => __('2 minutes'),
(string) SECONDS_5MINUTES => __('5 minutes'),
(string) SECONDS_10MINUTES => __('10 minutes'),
],
'refr',
(int) get_parameter('refr', 0),
$script = 'this.form.submit()',
'',
0,
true,
false,
false,
'',
false,
'width: 100px; margin-right: 10px; margin-top: 5px;'
);
$comborefr .= '</form>';
if ($config['pure'] == 0) {
$fullscreen['text'] = '<a href="'.ui_get_url_refresh(['pure' => 1]).'">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode')]).'</a>';
} else {
$fullscreen['text'] = '<a href="'.ui_get_url_refresh(['pure' => 0]).'">'.html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode')]).'</a>';
$config['refr'] = $refr;
}
$onheader = [
'updated_time' => $updated_time,
'fullscreen' => $fullscreen,
'combo_groups' => $filter_groups,
];
if ($config['pure'] == 1) {
$onheader['combo_refr'] = $comborefr;
}
// Header.
ui_print_page_header(
__('Agents/Alerts'),
'images/op_alerts.png',
false,
'',
false,
$updated_time
);
// Old style table, we need a lot of special formatting,don't use table function
// Prepare old-style table
echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">';
echo '<tr>';
echo '<td>'.$filter_groups.'</td>';
echo '<td>'.$check.'</td>';
if ($config['pure'] == 1) {
echo '<td>'.$comborefr.'</td>';
}
echo '<td> <strong>'.__('Full screen').'</strong>'.$fullscreen['text'].'</td>';
echo '</tr>';
echo '</table>';
if ($show_modules) {
if ($group_id > 0) {
$grupo = " AND tagente.id_grupo = $group_id";
} else {
$grupo = '';
echo $pageName.$e->getMessage();
}
$offset_modules = get_parameter('offset', 0);
$sql_count = "SELECT COUNT(tagente_modulo.nombre) FROM tagente_modulo
INNER JOIN tagente ON tagente.id_agente = tagente_modulo.id_agente
WHERE id_agente_modulo NOT IN (SELECT id_agent_module FROM talert_template_modules)
$grupo";
$count_agent_module = db_get_all_rows_sql($sql_count);
$sql = "SELECT tagente.alias, tagente_modulo.nombre,
tagente_modulo.id_agente_modulo FROM tagente_modulo
INNER JOIN tagente ON tagente.id_agente = tagente_modulo.id_agente
WHERE id_agente_modulo NOT IN (SELECT id_agent_module FROM talert_template_modules)
$grupo LIMIT 20 OFFSET $offset_modules";
$agent_modules = db_get_all_rows_sql($sql);
ui_pagination(
$count_agent_module[0]['COUNT(tagente_modulo.nombre)'],
ui_get_url_refresh(),
0,
0,
false,
'offset',
true,
'',
'',
false,
'alerts_modules'
);
$table->width = '100%';
$table->class = 'databox data';
$table->id = 'table_agent_module';
$table->data = [];
$table->head[0] = __('Agents');
$table->head[1] = __('Modules');
$table->head[2] = __('Actions');
$table->style[0] = 'width: 25%;';
$table->style[1] = 'width: 33%;';
$table->style[2] = 'width: 33%;';
foreach ($agent_modules as $agent_module) {
$data[0] = io_safe_output($agent_module['alias']);
$data[1] = io_safe_output($agent_module['nombre']);
$uniqid = $agent_module['id_agente_modulo'];
$data[2] = "<a title='".__('Create alert')."' href='javascript:show_add_alerts(\"$uniqid\")'>".html_print_image('images/add_mc.png', true).'</a>';
array_push($table->data, $data);
$table2->width = '100%';
$table2->id = 'table_add_alert';
$table2->class = 'databox filters';
$table2->data = [];
// $data[0] =
$table2->data[0][0] = __('Actions');
$groups_user = users_get_groups($config['id_user']);
if (!empty($groups_user)) {
$groups = implode(',', array_keys($groups_user));
$sql = "SELECT id, name FROM talert_actions WHERE id_group IN ($groups)";
$actions = db_get_all_rows_sql($sql);
}
$table2->data[0][1] = html_print_select(
index_array($actions, 'id', 'name'),
'action_select',
'',
'',
__('Default action'),
'0',
true,
'',
true,
'',
false,
'width: 250px;'
);
$table2->data[0][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>';
$table2->data[0][1] .= __('Number of alerts match from').' ';
$table2->data[0][1] .= html_print_input_text('fires_min', '', '', 4, 10, true);
$table2->data[0][1] .= ' '.__('to').' ';
$table2->data[0][1] .= html_print_input_text('fires_max', '', '', 4, 10, true);
$table2->data[0][1] .= ui_print_help_icon(
'alert-matches',
true,
ui_get_full_url(false, false, false, false)
);
$table2->data[0][1] .= '</span>';
if (check_acl($config['id_user'], 0, 'LM')) {
$table2->data[0][1] .= '<a style="margin-left:5px;" href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
$table2->data[0][1] .= html_print_image('images/add.png', true);
$table2->data[0][1] .= '<span style="margin-left:5px;vertical-align:middle;">'.__('Create Action').'</span>';
$table2->data[0][1] .= '</a>';
}
$table2->data[1][0] = __('Template');
$own_info = get_user_info($config['id_user']);
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
$templates = alerts_get_alert_templates(false, ['id', 'name']);
} else {
$usr_groups = users_get_groups($config['id_user'], 'LW', true);
$filter_groups = '';
$filter_groups = implode(',', array_keys($usr_groups));
$templates = alerts_get_alert_templates(['id_group IN ('.$filter_groups.')'], ['id', 'name']);
}
$table2->data[1][1] = html_print_select(
index_array($templates, 'id', 'name'),
'template',
'',
'',
__('Select'),
0,
true,
false,
true,
'',
false,
'width: 250px;'
);
$table2->data[1][1] .= ' <a class="template_details invisible" href="#">'.html_print_image('images/zoom.png', true, ['class' => 'img_help']).'</a>';
if (check_acl($config['id_user'], 0, 'LM')) {
$table2->data[1][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
$table2->data[1][1] .= html_print_image('images/add.png', true);
$table2->data[1][1] .= '<span style="margin-left:5px;vertical-align:middle;">'.__('Create Template').'</span>';
$table2->data[1][1] .= '</a>';
}
$table2->data[2][0] = __('Threshold');
$table2->data[2][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true);
$table2->data[2][1] .= ' '.__('seconds');
$content2 = '<form class="add_alert_form" method="post">';
$content2 .= html_print_table($table2, true);
$content2 .= '<div class="action-buttons" style="width: '.$table2->width.'">';
$content2 .= html_print_submit_button(__('Add alert'), 'add', false, 'class="sub wand"', true);
$content2 .= html_print_input_hidden('create_alert', $uniqid, true);
$content2 .= '</div></form>';
$module_name = ui_print_truncate_text(io_safe_output($agent_module['nombre']), 40, false, true, false, '&hellip;', false);
echo '<div id="add_alerts_dialog_'.$uniqid.'" title="'.__('Agent').': '.$agent_module['alias'].' / '.__('module').': '.$module_name.'" style="display:none">'.$content2.'</div>';
}
html_print_table($table);
} else {
$filter = [
'offset' => (int) $offset,
'limit' => (int) $config['block_size'],
];
$filter_count = [];
if ($group_id > 0) {
$filter['id_grupo'] = $group_id;
$filter_count['id_grupo'] = $group_id;
}
// Get the id of all agents with alerts
$sql = 'SELECT DISTINCT(id_agente)
FROM tagente_modulo
WHERE id_agente_modulo IN
(SELECT id_agent_module
FROM talert_template_modules)';
$agents_with_alerts_raw = db_get_all_rows_sql($sql);
if ($agents_with_alerts_raw === false) {
$agents_with_alerts_raw = [];
}
$agents_with_alerts = [];
foreach ($agents_with_alerts_raw as $awar) {
$agents_with_alerts[] = $awar['id_agente'];
}
$filter['id_agente'] = $agents_with_alerts;
$filter_count['id_agente'] = $agents_with_alerts;
$agents = agents_get_agents($filter);
$nagents = count(agents_get_agents($filter_count));
if ($agents == false) {
ui_print_info_message(['no_close' => true, 'message' => __('There are no agents with alerts') ]);
return;
}
$all_alerts = agents_get_alerts_simple();
if ($config['pure'] == 1) {
$block = count($all_alerts);
}
$templates = [];
$agent_alerts = [];
foreach ($all_alerts as $alert) {
$templates[$alert['id_alert_template']] = '';
$agent_alerts[$alert['agent_name']][$alert['id_alert_template']][] = $alert;
}
// Prepare pagination
ui_pagination(
$nagents,
false,
0,
0,
false,
'offset',
true,
'',
'',
[
'count' => '',
'offset' => 'offset_param',
],
'alerts_agents'
);
echo '<table class="info_table" cellpadding="0" cellspacing="0" border="0" width=100%>';
echo '<thead><tr>';
echo "<th width='140px' >".__('Agents').' / '.__('Alert templates').'</th>';
if ($hor_offset > 0) {
$new_hor_offset = ($hor_offset - $block);
echo "<th width='20px' style='' rowspan='".($nagents + 1)."'>
<a href='index.php?sec=extensions&sec2=extensions/agents_alerts&refr=0&hor_offset=".$new_hor_offset.'&offset='.$offset.'&group_id='.$group_id."'>".html_print_image('images/darrowleft.png', true, ['title' => __('Previous templates')]).'</a> </th>';
}
$templates_raw = [];
if (!empty($templates)) {
$sql = sprintf(
'SELECT id, name
FROM talert_templates
WHERE id IN (%s)',
implode(',', array_keys($templates))
);
$templates_raw = db_get_all_rows_sql($sql);
}
if (empty($templates_raw)) {
$templates_raw = [];
}
$alerts = [];
$ntemplates = 0;
foreach ($templates_raw as $temp) {
if (isset($templates[$temp['id']]) && $templates[$temp['id']] == '') {
$ntemplates++;
if ($ntemplates <= $hor_offset || $ntemplates > ($hor_offset + $block)) {
continue;
}
$templates[$temp['id']] = $temp['name'];
}
}
foreach ($templates as $tid => $tname) {
if ($tname == '') {
continue;
}
echo '<th width="20px" >'.io_safe_output($tname).'</th>';
}
echo '</tr></thead>';
if (($hor_offset + $block) < $ntemplates) {
$new_hor_offset = ($hor_offset + $block);
echo "<th width='20px' style='' rowspan='".($nagents + 1)."'>
<a href='index.php?sec=extensions&sec2=extensions/agents_alerts&hor_offset=".$new_hor_offset.'&offset='.$offset.'&group_id='.$group_id."'>".html_print_image('images/darrowright.png', true, ['title' => __('More templates')]).'</a> </th>';
}
foreach ($agents as $agent) {
$alias = db_get_row('tagente', 'id_agente', $agent['id_agente']);
echo '<tr>';
// Name of the agent
echo '<td style="font-weight:bold;">'.$alias['alias'].'</td>';
// Alerts of the agent
$anyfired = false;
foreach ($templates as $tid => $tname) {
if ($tname == '') {
continue;
}
if (isset($agent_alerts[$agent['nombre']][$tid])) {
foreach ($agent_alerts[$agent['nombre']][$tid] as $alert) {
if ($alert['times_fired'] > 0) {
$anyfired = true;
}
}
$cellstyle = '';
if ($anyfired) {
$cellstyle = 'background:'.COL_ALERTFIRED.';';
}
echo '<td style=";'.$cellstyle.'" class="action_buttons"> ';
$uniqid = uniqid();
echo '<div>';
echo count($agent_alerts[$agent['nombre']][$tid]).' '.__('Alerts').' ';
echo "<a href='javascript:show_alerts_details(\"$uniqid\")'>".html_print_image('images/zoom.png', true).'</a>';
echo '</div>';
print_alerts_summary_modal_window($uniqid, $agent_alerts[$agent['nombre']][$tid]);
} else {
echo '<td style="text-align:center"> ';
}
echo '</td>';
}
echo '</tr>';
}
echo '</table>';
ui_pagination(
$nagents,
false,
0,
0,
false,
'offset',
true,
'pagination-bottom',
'',
[
'count' => '',
'offset' => 'offset_param',
],
'alerts_agents'
);
// Stop this execution, but continue 'globally'.
return;
}
// AJAX controller.
if (is_ajax() === true) {
$method = get_parameter('method');
if (method_exists($obj, $method) === true) {
$obj->{$method}();
} else {
$obj->error('Method not found. ['.$method.']');
}
// Stop any execution.
exit;
} else {
// Run.
$obj->run();
}
}
// Print the modal window for the summary of each alerts group
function print_alerts_summary_modal_window($id, $alerts)
{
$table->width = '98%';
$table->class = 'info_table';
$table->data = [];
$table->head[0] = __('Module');
$table->head[1] = __('Action');
$table->head[2] = __('Last fired');
$table->head[3] = __('Status');
foreach ($alerts as $alert) {
$data[0] = modules_get_agentmodule_name($alert['id_agent_module']);
$actions = alerts_get_alert_agent_module_actions($alert['id']);
$actionDefault = db_get_value_sql(
'
SELECT id_alert_action
FROM talert_templates
WHERE id = '.$alert['id_alert_template']
);
$actionText = '';
if (!empty($actions)) {
$actionText = '<div style="margin-left: 10px;"><ul class="action_list">';
foreach ($actions as $action) {
$actionText .= '<div><span class="action_name"><li>'.$action['name'];
if ($action['fires_min'] != $action['fires_max']) {
$actionText .= ' ('.$action['fires_min'].' / '.$action['fires_max'].')';
}
$actionText .= '</li></span><br /></div>';
}
$actionText .= '</ul></div>';
} else {
if (!empty($actionDefault)) {
$actionText = db_get_sql(
"SELECT name
FROM talert_actions
WHERE id = $actionDefault"
).' <i>('.__('Default').')</i>';
}
}
$data[1] = $actionText;
$data[2] = ui_print_timestamp($alert['last_fired'], true);
$status = STATUS_ALERT_NOT_FIRED;
if ($alert['times_fired'] > 0) {
$status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)');
} else if ($alert['disabled'] > 0) {
$status = STATUS_ALERT_DISABLED;
$title = __('Alert disabled');
} else {
$status = STATUS_ALERT_NOT_FIRED;
$title = __('Alert not fired');
}
$data[3] = ui_print_status_image($status, $title, true);
array_push($table->data, $data);
}
$content = html_print_table($table, true);
$agent = modules_get_agentmodule_agent_alias($alerts[0]['id_agent_module']);
$template = alerts_get_alert_template_name($alerts[0]['id_alert_template']);
echo '<div id="alerts_details_'.$id.'" title="'.__('Agent').': '.$agent.' / '.__('Template').': '.$template.'" style="display:none">'.$content.'</div>';
}
extensions_add_operation_menu_option(__('Agents/Alerts view'), 'estado', null, 'v1r1', 'view');
extensions_add_main_function('mainAgentsAlerts');
ui_require_jquery_file('pandora');
?>
<script type="text/javascript">
function show_alerts_details(id) {
$("#alerts_details_"+id).dialog({
resizable: true,
draggable: true,
modal: true,
height: 280,
width: 800,
overlay: {
opacity: 0.5,
background: "black"
}
});
}
function show_add_alerts(id) {
$("#add_alerts_dialog_"+id).dialog({
resizable: true,
draggable: true,
modal: true,
height: 235,
width: 600,
overlay: {
opacity: 0.5,
background: "black"
}
});
}
// checkbox-slides_ids
$(document).ready(function () {
$('#checkbox-slides_ids').click(function(){
if ($('#checkbox-slides_ids').prop('checked')){
var url = location.href.replace("&show_modules=true", "");
location.href = url+"&show_modules=true";
} else {
var url = location.href.replace("&show_modules=true", "");
var re = /&offset=\d*/g;
location.href = url.replace(re, "");
}
});
$('#group_id').change(function(){
if(location.href.indexOf("extensions/agents_modules") == -1){
var regx = /&group_id=\d*/g;
var url = location.href.replace(regx, "");
location.href = url+"&group_id="+$("#group_id").val();
}
});
});
</script>

View File

@ -26,17 +26,6 @@ function agents_modules_load_js()
$ignored_params['refresh'] = '';
?>
<style type='text/css'>
.rotate_text_module {
-ms-transform: rotate(270deg);
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-o-transform: rotate(270deg);
writing-mode: lr-tb;
white-space: nowrap;
}
</style>
<script type='text/javascript'>
$(document).ready(function () {
//Get max width of name of modules

View File

@ -3754,7 +3754,6 @@ $(document).ready (function () {
$('#checkbox-recursion').removeAttr('disabled')
}
$("#id_agents").html('');
$("#id_agents2").html('');
$("#module").html('');
$("#inventory_modules").html('');

View File

@ -55,7 +55,11 @@ if (isset($_POST['create'])) {
'expire_timestamp' => $expire_timestamp,
];
$id_link = db_process_sql_insert('tnews', $values);
if ($subject === '') {
$id_link = false;
} else {
$id_link = db_process_sql_insert('tnews', $values);
}
ui_print_result_message(
$id_link,
@ -92,7 +96,11 @@ if (isset($_POST['update'])) {
'expire_timestamp' => $expire_timestamp,
];
$result = db_process_sql_update('tnews', $values, ['id_news' => $id_news]);
if ($subject === '') {
$result = false;
} else {
$result = db_process_sql_update('tnews', $values, ['id_news' => $id_news]);
}
ui_print_result_message(
$result,
@ -173,7 +181,7 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
$data = [];
$data[0] = __('Subject').'<br>';
$data[0] .= '<input type="text" name="subject" size="35" value="'.$subject.'">';
$data[0] .= '<input type="text" name="subject" size="35" value="'.$subject.'" >';
$data[1] = __('Group').'<br>';
$data[1] .= '<div class="w250px">';

File diff suppressed because it is too large Load Diff

View File

@ -549,6 +549,11 @@ class HTML
&& $input['arguments']['type'] != 'hidden_extended'
&& $input['arguments']['type'] != 'datalist'
) {
// Raw content for attach at the start of the input.
if (isset($input['surround_start']) === true) {
$output .= $input['surround_start'];
}
if (!$direct) {
$output .= '<li id="'.$input['id'].'" class="'.$class.'">';
}
@ -563,6 +568,11 @@ class HTML
if (!$direct) {
$output .= '</li>';
}
// Raw content for attach at the end of the input.
if (isset($input['surround_end']) === true) {
$output .= $input['surround_end'];
}
} else {
$output .= self::printInput($input['arguments']);
// Allow dynamic content.

View File

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

View File

@ -2168,6 +2168,55 @@ function html_print_div($options, $return=false)
}
/**
* Render an anchor html element.
*
* @param array $options Parameters
* - id: string
* - style: string
* - title: string
* - href: string.
* @param boolean $return Return or echo flag.
*
* @return string HTML code if return parameter is true.
*/
function html_print_anchor(
array $options,
bool $return=false
) {
$output = '<a ';
// Valid attributes (invalid attributes get skipped).
$attrs = [
'id',
'style',
'class',
'title',
];
$output .= (isset($options['href']) === true) ? 'href="'.io_safe_input_html($options['href']).'"' : ui_get_full_url();
foreach ($attrs as $attribute) {
if (isset($options[$attribute])) {
$output .= ' '.$attribute.'="'.io_safe_input_html($options[$attribute]).'"';
}
}
$output .= '>';
$output .= (isset($options['content']) === true) ? io_safe_input_html($options['content']) : '';
$output .= '</a>';
if ($return === true) {
return $output;
} else {
echo $output;
}
}
/**
* Render an input password element.
*
@ -4217,8 +4266,16 @@ function html_print_input($data, $wrapper='div', $input_only=false)
}
}
// If wrapper has attributes.
// TODO. There is possible improve this handle of attributes.
if (isset($data['wrapper_attributes'])) {
$wrapper_attributes = $data['wrapper_attributes'];
} else {
$wrapper_attributes = '';
}
if (isset($data['wrapper']) === true) {
$output = '<'.$data['wrapper'].' id="wr_'.$data['name'].'" ';
$output = '<'.$data['wrapper'].' '.$wrapper_attributes.' id="wr_'.$data['name'].'" ';
$output .= ' class="'.$data['input_class'].'">';
}

View File

@ -0,0 +1,71 @@
function updateSmartValue(event) {
var eventType = event.type;
var inputElement = $("#" + event.target.id);
var inputValue = inputElement.val();
var valueType = event.target.id.split("-");
if (eventType === "focus") {
inputElement.val(parseInt(inputValue));
} else if (eventType === "blur") {
change_mode();
} else {
var keyPressed = event.keyCode;
if (
(keyPressed <= 48 && keyPressed >= 57) ||
(inputElement.val() < 0 || inputElement.val() > 100)
) {
event.preventDefault();
} else {
$("#text-" + valueType[0]).val(inputElement.val());
}
}
}
function change_mode(alt) {
var modeStatus = $("#mode").val();
var serviceMode = $("#hidden-service_mode_smart").val();
if (modeStatus == serviceMode) {
$(".smart_thresholds").css("display", "inline-flex");
var crit = parseFloat($("#text-critical").val());
var warn = parseFloat($("#text-warning").val());
if (crit < warn) {
$("#text-critical").val($("#text-warning").val());
}
$("#critical-val-d").val($("#text-critical").val() + " %");
$("#warning-val-d").val($("#text-warning").val() + " %");
if (alt != 1) {
$("#text-critical")
.prop("type", "range")
.prop("step", "0.01")
.prop("min", "0")
.prop("max", "100")
.on("input", function() {
change_mode(1);
});
$("#text-warning")
.prop("type", "range")
.prop("step", "0.01")
.prop("min", "0")
.prop("max", "100")
.on("input", function() {
change_mode(1);
});
}
} else {
$(".smart_thresholds").css("display", "none");
$("#text-critical")
.prop("type", "number")
.on("input", function() {})
.show();
$("#text-warning")
.prop("type", "number")
.on("input", function() {})
.show();
}
}

View File

@ -0,0 +1,70 @@
/* Specific CSS for Agent/Alerts view */
.agents_modules_table .table {
width: 100%;
table-layout: fixed;
}
.agents_modules_table .next_previous_step {
width: 0.1%;
}
.agents_modules_table .header_table_principal_cell {
text-align: right !important;
padding-right: 13px;
width: 20%;
}
.agents_modules_table .header_table_caption_cell {
height: 200px;
}
.agents_modules_table .position_text_module {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
/* .agents_modules_table .position_text_module div {
padding-left: 10px;
margin-top: 90px;
} */
#full_screen_refresh_box,
#slc-refresh-rate,
#img-full-screen {
float: right;
}
#full_screen_refresh_box > li > label {
width: 100px;
margin-left: 20px;
}
.full_screen_button {
color: transparent;
width: 20%;
border: 0;
}
.agent_alerts_header_pure {
position: absolute;
}
.agents_alerts_header form > ul > li {
display: inline-flex;
}
.agents_alerts_header form ul {
clear: both;
width: 100%;
}
.agents_alerts_header form > ul > li:nth-child(1n + 1) {
margin-left: 2em;
}
.pagination-bottom {
margin-top: 15px;
}

View File

@ -688,7 +688,7 @@ select:-internal-list-box {
float: right;
}
.invisible {
display: none;
display: none !important;
}
div#page {
@ -1710,6 +1710,20 @@ input.remove-item-img {
background-position: center;
}
button.pure_full,
input.pure_full {
background-image: url(../../images/full_screen.png);
background-repeat: no-repeat;
background-size: 21px 21px;
}
button.pure_normal,
input.pure_normal {
background-image: url(../../images/normal_screen.png);
background-repeat: no-repeat;
background-size: 21px 21px;
}
/* end of classes for event priorities */
div#main_pure {
background-color: #fefefe;
@ -5798,6 +5812,13 @@ div#status_pie {
border-radius: 5px;
}
.status_rounded_rectangles.text_inside {
color: #ffffff;
text-align: center;
font-weight: bold;
padding-top: 0.4em;
}
.status_small_squares,
.status_balls {
width: 12px;
@ -6039,3 +6060,12 @@ div.graph div.legend div,
div.graph div.legend table {
top: 25px !important;
}
.rotate_text_module {
-ms-transform: rotate(270deg);
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-o-transform: rotate(270deg);
writing-mode: lr-tb;
white-space: nowrap;
}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.750-201124
Version: 7.0NG.750-201125
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.750-201124"
pandora_version="7.0NG.750-201125"
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.750";
my $pandora_build = "201124";
my $pandora_build = "201125";
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.750";
my $pandora_build = "201124";
my $pandora_build = "201125";
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.750
%define release 201124
%define release 201125
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.750"
PI_BUILD="201124"
PI_BUILD="201125"
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.750 PS201124";
my $version = "7.0NG.750 PS201125";
# 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.750 PS201124";
my $version = "7.0NG.750 PS201125";
# save program name for logging
my $progname = basename($0);