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

This commit is contained in:
Daniel Barbero Martin 2021-03-02 08:33:20 +01:00
commit 12b63b8a7a
77 changed files with 1125 additions and 375 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.752-210226
Version: 7.0NG.752-210302
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-210226"
pandora_version="7.0NG.752-210302"
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 => '210226';
use constant AGENT_BUILD => '210302';
# 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.752
%define release 210226
%define release 210302
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 210226
%define release 210302
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,8 @@
START TRANSACTION;
ALTER TABLE `tinventory_alert` ADD COLUMN `alert_groups` TEXT NOT NULL;
UPDATE `tinventory_alert` t1 INNER JOIN `tinventory_alert` t2 ON t1.id = t2.id SET t1.alert_groups = t2.id_group;
ALTER TABLE `tnotification_source` ADD COLUMN `subtype_blacklist` TEXT;
COMMIT;

View File

@ -363,6 +363,7 @@ CREATE TABLE IF NOT EXISTS `tinventory_alert`(
`last_fired` text NOT NULL default '',
`disable_event` tinyint(1) UNSIGNED default 0,
`enabled` tinyint(1) UNSIGNED default 1,
`alert_groups` text NOT NULL default '',
PRIMARY KEY (`id`),
FOREIGN KEY (`id_module_inventory`) REFERENCES tmodule_inventory(`id_module_inventory`)
ON DELETE CASCADE ON UPDATE CASCADE
@ -2392,6 +2393,7 @@ CREATE TABLE `tnotification_source` (
`enabled` int(1) DEFAULT NULL,
`user_editable` int(1) DEFAULT NULL,
`also_mail` int(1) DEFAULT NULL,
`subtype_blacklist` TEXT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1404,6 +1404,10 @@ if ($update_module || $create_module) {
$each_ff = (int) get_parameter('each_ff', $module['each_ff']);
$ff_timeout = (int) get_parameter('ff_timeout');
$unit = (string) get_parameter('unit');
if ($unit === '0') {
$unit = '';
}
$id_tag = (array) get_parameter('id_tag_selected');
$serialize_ops = (string) get_parameter('serialize_ops');
$critical_instructions = (string) get_parameter('critical_instructions');
@ -1570,24 +1574,43 @@ if ($update_module) {
'module_macros' => $module_macros,
];
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) {
$plugin_parameter_split = explode('
', $values['plugin_parameter']);
if (preg_match('/http_auth_user/m', $values['plugin_parameter'])) {
$http_user_conf = true;
}
$values['plugin_parameter'] = '';
if (preg_match('/http_auth_pass/m', $values['plugin_parameter'])) {
$http_pass_conf = true;
}
foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) {
if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
';
if (!$http_user_conf || !$http_pass_conf) {
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) {
$plugin_parameter_split = explode('
', $values['plugin_parameter']);
$values['plugin_parameter'] = '';
foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) {
if ($http_user) {
if ($http_user_conf) {
continue;
}
$values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
';
}
if ($http_pass) {
if ($http_user_pass) {
continue;
}
$values['plugin_parameter'] .= 'http_auth_pass '.$http_pass.'
';
}
$values['plugin_parameter'] .= $value.'
';
} else {
$values['plugin_parameter'] .= $value.'
';
}
if ($http_pass) {
$values['plugin_parameter'] .= 'http_auth_pass '.$http_pass.'
';
}
$values['plugin_parameter'] .= $value.'
';
} else {
$values['plugin_parameter'] .= $value.'
';
}
}
}

View File

@ -567,12 +567,12 @@ if ($agents !== false) {
$url = ui_get_full_url(
$url.'&op=update&id='.$cluster->id()
);
echo '<a href="'.$url.'">'.$agent['alias'].'</a>';
echo '<a href="'.$url.'">'.ui_print_truncate_text($agent['alias'], 'agent_medium').'</a>';
}
} else {
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
id_agente=".$agent['id_agente']."'>".'<span class="'.$custom_font_size.' title ="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
id_agente=".$agent['id_agente']."'>".'<span class="'.$custom_font_size.' title ="'.$agent['nombre'].'">'.ui_print_truncate_text($agent['alias'], 'agent_medium').'</span>'.'</a>';
}
echo '</strong>';

View File

@ -548,17 +548,17 @@ $table_advanced->data[0][4] = html_print_input_text(
$classdisabledBecauseInPolicy
);
// $table_advanced->colspan[1][4] = 3;
// $table_advanced->data[0][4] = html_print_extended_select_for_unit(
// 'unit',
// $unit,
// '',
// '',
// '0',
// false,
// true,
// false,
// false
// );
$table_advanced->data[0][4] = html_print_extended_select_for_unit(
'unit',
$unit,
'',
'none',
'0',
false,
true,
false,
false
);
$table_advanced->colspan[0][4] = 3;
$module_id_policy_module = 0;

View File

@ -70,7 +70,6 @@ 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');
@ -180,7 +179,12 @@ if ($insert_downtime_agent === 1) {
$agents = (array) get_parameter('id_agents');
$module_names = (array) get_parameter('module');
$all_modules = (empty($module_names) || ($module_names[0] === '0'));
$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(
@ -194,9 +198,15 @@ if ($insert_downtime_agent === 1) {
__('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') {
if ($modules_selection_mode == 'all' && $all_modules === false) {
$check = false;
foreach ($module_names as $module_name) {
$check_module = modules_get_agentmodule_id(
@ -918,33 +928,7 @@ if ($id_downtime > 0) {
}
}
$sql = sprintf(
'SELECT tagente.id_agente, tagente.alias
FROM tagente
WHERE tagente.id_agente NOT IN (
SELECT tagente.id_agente
FROM tagente, tplanned_downtime_agents
WHERE tplanned_downtime_agents.id_agent = tagente.id_agente
AND tplanned_downtime_agents.id_downtime = %d
) AND disabled = 0 %s
AND tagente.id_grupo IN (%s)
ORDER BY tagente.nombre',
$id_downtime,
$filter_cond,
$id_groups_str
);
$agents = db_get_all_rows_sql($sql);
if (empty($agents)) {
$agents = [];
}
$agent_ids = extract_column($agents, 'id_agente');
$agent_names = extract_column($agents, 'alias');
$agents = array_combine($agent_ids, $agent_names);
if ($agents === false) {
$agents = [];
}
$agents = get_planned_downtime_agents_list($id_downtime, $filter_cond, $id_groups_str);
$disabled_add_button = false;
if (empty($agents) || $disabled_in_execution) {
@ -962,7 +946,7 @@ if ($id_downtime > 0) {
// 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') {
@ -971,6 +955,7 @@ if ($id_downtime > 0) {
echo '<div id="available_modules_selection_mode" style="padding-top:20px">';
}
html_print_input_hidden('all_common_modules', '');
echo html_print_select(
[
'common' => __('Show common modules'),

View File

@ -123,11 +123,15 @@ $form_filter .= "</td style='font-weight: bold;'>";
$form_filter .= '</tr>';
$form_filter .= '<tr>';
$form_filter .= "<td style='font-weight: bold;'>".__('Enabled / Disabled').'</td><td>';
$form_filter .= "<td style='font-weight: bold;'>".__('Status').'</td><td>';
$ed_list = [];
$ed_list[0] = __('Enabled');
$ed_list[1] = __('Disabled');
$form_filter .= html_print_select($ed_list, 'enabledisable', $enabledisable, '', __('All'), -1, true);
$alert_status_filter = [];
$alert_status_filter['all_enabled'] = __('All (Enabled)');
$alert_status_filter['all'] = __('All');
$alert_status_filter['fired'] = __('Fired');
$alert_status_filter['notfired'] = __('Not fired');
$alert_status_filter['disabled'] = __('Disabled');
$form_filter .= html_print_select($alert_status_filter, 'status_alert', $status_alert, '', '', '', true);
$form_filter .= "</td><td style='font-weight: bold;'>".__('Standby').'</td><td>';
$sb_list = [];
$sb_list[1] = __('Standby on');
@ -144,6 +148,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_
$form_filter .= html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false);
$form_filter .= '</td></tr>';
if (defined('METACONSOLE')) {
$form_filter .= '<tr>';
$form_filter .= "<td colspan='6' align='right'>";
@ -174,8 +179,15 @@ $simple_alerts = [];
$total = 0;
$where = '';
if ($searchFlag) {
if ($status_alert === 'fired') {
$where .= ' AND talert_template_modules.times_fired > 0';
}
if ($status_alert === 'notfired') {
$where .= ' AND talert_template_modules.times_fired = 0';
}
if ($priority != -1 && $priority != '') {
$where .= ' AND id_alert_template IN (SELECT id FROM talert_templates WHERE priority = '.$priority.')';
}
@ -206,8 +218,12 @@ if ($searchFlag) {
$where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.'))';
}
if ($enabledisable != -1 && $enabledisable != '') {
$where .= ' AND talert_template_modules.disabled ='.$enabledisable;
if ($status_alert === 'disabled') {
$where .= ' AND talert_template_modules.disabled = 1';
}
if ($status_alert === 'all_enabled') {
$where .= ' AND talert_template_modules.disabled = 0';
}
if ($standby != -1 && $standby != '') {
@ -385,7 +401,7 @@ switch ($sortField) {
break;
}
$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group;
$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group.'&status_alert='.$status_alert;
$sort_params = '&sort_field='.$sortField.'&sort='.$sort;
if ($id_agente) {

View File

@ -65,6 +65,7 @@ $searchType = get_parameter('search_type', '');
$priority = get_parameter('priority', '');
$searchFlag = get_parameter('search', 0);
$enabledisable = get_parameter('enabledisable', '');
$status_alert = get_parameter('status_alert', '');
$standby = get_parameter('standby', '');
$pure = get_parameter('pure', 0);
$ag_group = get_parameter('ag_group', 0);

View File

@ -469,7 +469,29 @@ if (users_can_manage_group_all('MM') === true) {
}
$table->data[2][0] = __('Group');
$table->data[2][1] = html_print_select_groups(false, 'IW', $return_all_group, 'map_group_id', $map_group_id, '', '', '', true);
$table->data[2][1] = html_print_select_groups(
false,
'IW',
$return_all_group,
'map_group_id',
$map_group_id,
'',
'',
'',
true,
false,
true,
'',
false,
false,
false,
false,
'id_grupo',
false,
false,
false,
'250px'
);
$table->data[3][0] = __('Default zoom');
$table->data[3][1] = html_print_input_text('map_zoom_level', $map_zoom_level, '', 2, 4, true).html_print_input_hidden('map_levels_zoom', $map_levels_zoom, true);

View File

@ -64,19 +64,6 @@ if (defined('METACONSOLE')) {
$help_header = 'network_component_tab';
}
ui_print_page_header(
__('Remote components'),
'',
false,
$help_header,
true,
'',
false,
'modulemodal',
GENERIC_SIZE_TEXT,
'',
__('Configuration').'&nbsp;/&nbsp;'.__('Templates').'&nbsp;/&nbsp;'.__('Remote components')
);
$sec = 'gmodules';
}

View File

@ -48,7 +48,9 @@ if (enterprise_installed()) {
'basic' => __('Basic'),
'advanced' => __('Advanced'),
];
$table->data[0][3] = html_print_select($wizard_levels, 'wizard_level', $wizard_level, '', '', -1, true, false, false).' '.ui_print_help_icon('meta_access', true);
// TODO review help tips on meta.
$table->data[0][3] = html_print_select($wizard_levels, 'wizard_level', $wizard_level, '', '', -1, true, false, false).' ';
// .ui_print_help_icon('meta_access', true)
} else {
$table->data[0][2] = '';
$table->data[0][3] = html_print_input_hidden('wizard_level', $wizard_level, true);

View File

@ -212,7 +212,17 @@ $table->data[1][1] = html_print_select_groups(
-1,
true,
false,
false
false,
'',
false,
false,
false,
false,
'id_grupo',
false,
false,
false,
'250px'
);
if ($advanced_filter != '') {

View File

@ -235,7 +235,7 @@ if ($count_module_array > 0) {
echo '<table><tr>';
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&tab=graph_editor&change_label=1&id=".$id_graph.'&graph='.$idgs_array[$a]."'>";
html_print_input_text('label', $label_array[$a], '', 20, 30, false, false);
html_print_input_text('label', $label_array[$a], '', 30, 80, false, false);
html_print_submit_button('Ok', 'btn', false, '', false);
echo '</form>';

View File

@ -140,6 +140,8 @@ $visual_format = 0;
// Others.
$filter_search = '';
$filter_exclude = '';
// Added for select fields.
$total_time = true;
@ -556,6 +558,8 @@ switch ($action) {
$include_extended_events = $item['show_extended_events'];
$filter_search = $style['event_filter_search'];
$filter_exclude = $style['event_filter_exclude'];
break;
case 'event_report_group':
@ -570,6 +574,7 @@ switch ($action) {
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
$filter_search = $style['event_filter_search'];
$filter_exclude = $style['event_filter_exclude'];
$filter_event_severity = json_decode($style['filter_event_severity'], true);
$filter_event_status = json_decode($style['filter_event_status'], true);
@ -607,6 +612,8 @@ switch ($action) {
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
$filter_search = $style['event_filter_search'];
$filter_exclude = $style['event_filter_exclude'];
$include_extended_events = $item['show_extended_events'];
break;
@ -2744,10 +2751,20 @@ $class = 'databox filters';
</tr>
<tr id="row_filter_search" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Free search'); ?></td>
<td style="font-weight:bold;"><?php echo __('Include filter'); ?></td>
<td>
<?php
html_print_input_text('filter_search', $filter_search);
ui_print_help_tip(__('Free text string search on event description'));
?>
</td>
</tr>
<tr id="row_filter_exclude" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Exclude filter'); ?></td>
<td>
<?php
html_print_input_text('filter_exclude', $filter_exclude);
ui_print_help_tip(__('Free text string search on event description'));
?>
</td>
</tr>
@ -5141,6 +5158,7 @@ function chooseType() {
$("#row_resolution").hide();
$("#row_last_value").hide();
$("#row_filter_search").hide();
$("#row_filter_exclude").hide();
$("#row_percentil").hide();
$("#log_help_tip").css("visibility", "hidden");
$("#agents_row").hide();
@ -5191,6 +5209,8 @@ function chooseType() {
$("#row_extended_events").show();
$("#row_filter_search").show();
$("#row_filter_exclude").show();
$("#row_event_severity").show();
$("#row_event_status").show();
@ -5403,11 +5423,9 @@ function chooseType() {
case 'sql':
$("#row_description").show();
$("#row_query").show();
$("#row_max_items").show();
$("#row_header").show();
$("#row_custom").show();
$("#row_custom_example").show();
$("#row_dyn_height").show();
$("#row_servers").show();
$("#row_historical_db_check").show();
break;
@ -5486,6 +5504,8 @@ function chooseType() {
$("#row_extended_events").show();
$("#row_filter_search").show();
$("#row_filter_exclude").show();
$("#row_historical_db_check").hide();
break;
@ -5509,6 +5529,8 @@ function chooseType() {
$('#agent_autocomplete').hide();
$('#agent_autocomplete_events').show();
$("#row_filter_search").show();
$("#row_filter_exclude").show();
$("#row_historical_db_check").hide();
break;
@ -5531,6 +5553,8 @@ function chooseType() {
$('#agent_autocomplete').hide();
$('#agent_autocomplete_events').show();
$("#row_filter_search").show();
$("#row_filter_exclude").show();
$("#row_historical_db_check").hide();
break;

View File

@ -515,18 +515,68 @@ foreach ($items as $item) {
$style = json_decode(io_safe_output($item['style']), true);
// Macros
$items_macro = [];
if (!empty($item['id_agent'])) {
$id_agent = $item['id_agent'];
// Add macros name.
$agent_description = agents_get_description($id_agent);
$agent_group = agents_get_agent_group($id_agent);
$agent_address = agents_get_address($id_agent);
$agent_alias = agents_get_alias($id_agent);
$items_macro_agent = [
'id_agent' => $id_agent,
'agent_description' => $agent_description,
'agent_group' => $agent_group,
'agent_address' => $agent_address,
'agent_alias' => $agent_alias,
];
$items_macro = array_merge($items_macro, $items_macro_agent);
}
if (!empty($item['id_agent_module'])) {
$id_agent_module = $item['id_agent_module'];
$module_name = modules_get_agentmodule_name(
$id_agent_module
);
$module_description = modules_get_agentmodule_descripcion(
$id_agent_module
);
$items_macro_module = [
'id_agent_module' => $id_agent_module,
'module_name' => $module_name,
'module_description' => $module_description,
];
$items_macro = array_merge($items_macro, $items_macro_module);
}
if ($style['name_label'] != '') {
$text = empty($style['name_label']) ? $item['description'] : $style['name_label'];
$row[5] = ui_print_truncate_text($text, 'description', true, true);
} else {
if ($item['name'] == '' && $item['description'] == '') {
$row[5] = '-';
$text = '-';
} else {
$text = empty($item['name']) ? $item['description'] : $item['name'];
$row[5] = ui_print_truncate_text($text, 'description', true, true);
}
}
// Apply macros
$items_macro['type'] = $item['type'];
$text = reporting_label_macro(
$items_macro,
$text
);
$row[5] = ui_print_truncate_text($text, 'description', true, true);
$row[6] = '';
if (check_acl($config['id_user'], $item['id_group'], 'RM')) {

View File

@ -1881,6 +1881,11 @@ switch ($action) {
''
);
$event_filter_exclude = get_parameter(
'filter_exclude',
''
);
// If metaconsole is activated.
if (is_metaconsole() === true) {
if (($values['type'] == 'custom_graph')
@ -2018,6 +2023,8 @@ switch ($action) {
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
$style['event_filter_search'] = $event_filter_search;
$style['event_filter_exclude'] = $event_filter_exclude;
if ($label != '') {
$style['label'] = $label;
@ -2622,6 +2629,12 @@ switch ($action) {
''
);
$event_filter_exclude = get_parameter(
'filter_exclude',
''
);
// Added for events items.
$style['show_summary_group'] = $show_summary_group;
$style['filter_event_severity'] = json_encode(
@ -2639,6 +2652,8 @@ switch ($action) {
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
$style['event_filter_search'] = $event_filter_search;
$style['event_filter_exclude'] = $event_filter_exclude;
if ($label != '') {
$style['label'] = $label;
} else {

View File

@ -759,7 +759,7 @@ echo '<legend>'.__('Mail configuration').'</legend>';
'',
'class="sub next"',
true
).'&nbsp&nbsp<span id="email_test_sent_message" style="display:none;">Email sent</span><span id="email_test_failure_message" style="display:none;">Email could not been sent</span>';
).'&nbsp&nbsp<span id="email_test_sent_message" style="display:none;">Email sent</span><span id="email_test_failure_message" style="display:none;">Email could not be sent</span>';
echo '<div id="email_test_'.$id.'" title="'.__('Check mail configuration').'" style="display:none">'.html_print_table($table_mail_test, true).'</div>';
}

View File

@ -65,6 +65,7 @@ if (get_parameter('remove_source_on_database', 0)) {
if (get_parameter('update_config', 0)) {
$element = (string) get_parameter('element', '');
$value = (int) get_parameter('value', 0);
$source = (string) get_parameter('source');
// Update the label value.
ob_clean();
@ -75,6 +76,37 @@ if (get_parameter('update_config', 0)) {
$res = ($value) ? notifications_add_group_to_source($source, [0]) : notifications_remove_group_from_source($source, [0]);
break;
case 'subtype':
$data = explode('.', $source, 2);
$source_id = $data[0];
$subtype = $data[1];
$source = notifications_get_all_sources(
[ 'id' => $source_id ]
);
if ($source !== false && is_array($source[0]) === true) {
$source = $source[0];
$blacklist = json_decode($source['subtype_blacklist'], 1);
if (json_last_error() !== JSON_ERROR_NONE) {
$blacklist = [];
}
if ((bool) $value === true) {
unset($blacklist[$subtype]);
} else {
$blacklist[$subtype] = 1;
}
$source['subtype_blacklist'] = json_encode($blacklist, 1);
$res = (bool) db_process_sql_update(
'tnotification_source',
['subtype_blacklist' => $source['subtype_blacklist']],
['id' => $source['id']]
);
}
break;
default:
$res = (bool) db_process_sql_update(
'tnotification_source',
@ -337,7 +369,7 @@ function remove_source_elements(id, source_id) {
function notifications_handle_change_element(event) {
event.preventDefault();
var match = /nt-([0-9]+)-(.*)/.exec(event.target.id);
var match = /nt-(.+)-(.*)/.exec(event.target.id);
if (!match) {
console.error(
"Cannot handle change element. Id not valid: ", event.target.id
@ -356,6 +388,7 @@ function notifications_handle_change_element(event) {
var value;
switch (action.bit) {
case 'enabled':
case 'subtype':
case 'also_mail':
case 'user_editable':
case 'all_users':
@ -383,6 +416,7 @@ function notifications_handle_change_element(event) {
} else {
switch (action.bit) {
case 'enabled':
case 'subtype':
case 'also_mail':
case 'user_editable':
case 'all_users':

View File

@ -803,7 +803,7 @@ if (defined('METACONSOLE')) {
}
if (!$new_user) {
$user_id = '<div class="label_select_simple"><p class="edit_user_labels">'.__('User ID').'</p>';
$user_id = '<div class="label_select_simple"><p class="edit_user_labels">'.__('User ID').': </p>';
$user_id .= '<span>'.$id.'</span>';
$user_id .= html_print_input_hidden('id_user', $id, true);
$user_id .= '</div>';
@ -1102,7 +1102,8 @@ if (enterprise_installed() && defined('METACONSOLE')) {
$user_info_metaconsole_access = $user_info['metaconsole_access'];
}
$meta_access = '<div class="label_select"><p class="edit_user_labels">'.__('Metaconsole access').' '.ui_print_help_icon('meta_access', true).'</p>';
// TODO review help tips on meta.
$meta_access = '<div class="label_select"><p class="edit_user_labels">'.__('Metaconsole access').' './* ui_print_help_icon('meta_access', true). */'</p>';
$metaconsole_accesses = [
'basic' => __('Basic'),
'advanced' => __('Advanced'),

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -54,6 +54,16 @@ if (check_login()) {
$update_filter_cf = (bool) get_parameter('update_filter_cf', 0);
$delete_filter_cf = (bool) get_parameter('delete_filter_cf', 0);
$change_name_filter = (bool) get_parameter('change_name_filter', 0);
$check_csv_button = (bool) get_parameter('check_csv_button', 0);
if ($check_csv_button) {
if (check_acl($config['id_user'], 0, 'PM')) {
echo json_encode($permission);
return;
} else {
exit;
}
}
if ($get_custom_fields_data) {
$name_custom_fields = get_parameter('name_custom_fields', 0);

View File

@ -38,23 +38,36 @@ if (check_login()) {
$get_plugin_macros = get_parameter('get_plugin_macros');
$search_modules = get_parameter('search_modules');
$get_module_detail = get_parameter('get_module_detail', 0);
$get_module_autocomplete_input = (bool) get_parameter('get_module_autocomplete_input');
$get_module_autocomplete_input = (bool) get_parameter(
'get_module_autocomplete_input'
);
$add_module_relation = (bool) get_parameter('add_module_relation');
$remove_module_relation = (bool) get_parameter('remove_module_relation');
$change_module_relation_updates = (bool) get_parameter('change_module_relation_updates');
$change_module_relation_updates = (bool) get_parameter(
'change_module_relation_updates'
);
$get_id_tag = (bool) get_parameter('get_id_tag', 0);
$get_type = (bool) get_parameter('get_type', 0);
$list_modules = (bool) get_parameter('list_modules', 0);
$get_agent_modules_json_by_name = (bool) get_parameter('get_agent_modules_json_by_name', 0);
$get_agent_modules_json_by_name = (bool) get_parameter(
'get_agent_modules_json_by_name',
0
);
$get_graph_module = (bool) get_parameter('get_graph_module', 0);
$get_graph_module_interfaces = (bool) get_parameter(
'get_graph_module_interfaces',
0
);
if ($get_agent_modules_json_by_name) {
if ($get_agent_modules_json_by_name === true) {
$agent_name = get_parameter('agent_name');
$agent_id = agents_get_agent_id($agent_name);
$agent_modules = db_get_all_rows_sql(
'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = '.$agent_id
'SELECT id_agente_modulo as id_module,
nombre as name FROM tagente_modulo
WHERE id_agente = '.$agent_id
);
echo json_encode($agent_modules);
@ -91,7 +104,10 @@ if (check_login()) {
$id_agents = json_decode(io_safe_output(get_parameter('id_agents')));
$filter = '%'.get_parameter('q', '').'%';
$other_filter = json_decode(io_safe_output(get_parameter('other_filter')), true);
$other_filter = json_decode(
io_safe_output(get_parameter('other_filter')),
true
);
// TODO TAGS agents_get_modules.
$modules = agents_get_modules(
$id_agents,
@ -112,9 +128,13 @@ if (check_login()) {
}
if ($get_module_detail) {
// This script is included manually to be included after jquery and avoid error.
// This script is included manually to be
// included after jquery and avoid error.
ui_include_time_picker();
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
ui_require_jquery_file(
'ui.datepicker-'.get_user_language(),
'include/javascript/i18n/'
);
$module_id = (int) get_parameter('id_module');
$period = get_parameter('period', SECONDS_1DAY);
@ -145,10 +165,22 @@ if (check_login()) {
$free_checkbox = (bool) get_parameter('free_checkbox', false);
$selection_mode = get_parameter('selection_mode', 'fromnow');
$utimestamp = get_system_time();
$date_from = (string) get_parameter('date_from', date(DATE_FORMAT, ($utimestamp - SECONDS_1DAY)));
$time_from = (string) get_parameter('time_from', date(TIME_FORMAT, ($utimestamp - SECONDS_1DAY)));
$date_to = (string) get_parameter('date_to', date(DATE_FORMAT, $utimestamp));
$time_to = (string) get_parameter('time_to', date(TIME_FORMAT, $utimestamp));
$date_from = (string) get_parameter(
'date_from',
date(DATE_FORMAT, ($utimestamp - SECONDS_1DAY))
);
$time_from = (string) get_parameter(
'time_from',
date(TIME_FORMAT, ($utimestamp - SECONDS_1DAY))
);
$date_to = (string) get_parameter(
'date_to',
date(DATE_FORMAT, $utimestamp)
);
$time_to = (string) get_parameter(
'time_to',
date(TIME_FORMAT, $utimestamp)
);
// Definition of new table.
$formtable = new stdClass();
@ -189,7 +221,17 @@ if (check_login()) {
'style="margin-right: 15px;"',
true
).__('Choose a time from now');
$formtable->data[0][1] = html_print_select($periods, 'period', $period, '', '', 0, true, false, false);
$formtable->data[0][1] = html_print_select(
$periods,
'period',
$period,
'',
'',
0,
true,
false,
false
);
$formtable->data[0][2] = '';
$formtable->data[0][3] = "<a href='javascript: show_module_detail_dialog(".$module_id.', '.$agentId.', "'.$server_name.'", 0, -1,"'.modules_get_agentmodule_name($module_id)."\")'>".html_print_image('images/refresh.png', true, ['style' => 'vertical-align: middle;', 'border' => '0' ]).'</a>';
$formtable->rowspan[0][3] = 2;
@ -248,8 +290,20 @@ if (check_login()) {
$freesearch_object = '';
if (preg_match('/_string/', $moduletype_name)) {
$formtable->data[2][0] = __('Free search').' ';
$formtable->data[2][1] = html_print_input_text('freesearch', $freesearch, '', 20, null, true);
$formtable->data[2][2] = html_print_checkbox('free_checkbox', 1, $free_checkbox, true);
$formtable->data[2][1] = html_print_input_text(
'freesearch',
$freesearch,
'',
20,
null,
true
);
$formtable->data[2][2] = html_print_checkbox(
'free_checkbox',
1,
$free_checkbox,
true
);
$formtable->data[2][2] .= ' '.__('Exact phrase');
$freesearch_object = json_encode(
[
@ -359,8 +413,16 @@ if (check_login()) {
'web_content_string'
);
$post_process = db_get_value_filter('post_process', 'tagente_modulo', ['id_agente_modulo' => $module_id]);
$unit = db_get_value_filter('unit', 'tagente_modulo', ['id_agente_modulo' => $module_id]);
$post_process = db_get_value_filter(
'post_process',
'tagente_modulo',
['id_agente_modulo' => $module_id]
);
$unit = db_get_value_filter(
'unit',
'tagente_modulo',
['id_agente_modulo' => $module_id]
);
foreach ($result as $row) {
$data = [];
@ -400,32 +462,65 @@ if (check_login()) {
// Fixed the data from Selenium Plugin.
if ($row[$attr[0]] != strip_tags($row[$attr[0]])) {
$data[] = html_print_result_div($row[$attr[0]]);
} else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type'])) {
} else if (is_numeric($row[$attr[0]])
&& !modules_is_string_type($row['module_type'])
) {
switch ($row['module_type']) {
case 15:
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module_id);
$value = db_get_value(
'snmp_oid',
'tagente_modulo',
'id_agente_modulo',
$module_id
);
// System Uptime:
// In case of System Uptime module, shows data in format "Days hours minutes seconds" if and only if
// In case of System Uptime module,
// shows data in format
// "Days hours minutes seconds" if and only if
// selected module unit is "_timeticks_"
// Take notice that selected unit may not be postrocess unit
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
$data_macro = modules_get_unit_macro($row[$attr[0]], $unit);
// Take notice that selected unit
// may not be postrocess unit.
if ($value == '.1.3.6.1.2.1.1.3.0'
|| $value == '.1.3.6.1.2.1.25.1.1.0'
) {
$data_macro = modules_get_unit_macro(
$row[$attr[0]],
$unit
);
if ($data_macro) {
$data[] = $data_macro;
} else {
$data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
$data[] = remove_right_zeros(
number_format(
$row[$attr[0]],
$config['graph_precision']
)
);
}
} else {
$data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
$data[] = remove_right_zeros(
number_format(
$row[$attr[0]],
$config['graph_precision']
)
);
}
break;
default:
$data_macro = modules_get_unit_macro($row[$attr[0]], $unit);
$data_macro = modules_get_unit_macro(
$row[$attr[0]],
$unit
);
if ($data_macro) {
$data[] = $data_macro;
} else {
$data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
$data[] = remove_right_zeros(
number_format(
$row[$attr[0]],
$config['graph_precision']
)
);
}
break;
}
@ -433,11 +528,16 @@ if (check_login()) {
if ($row[$attr[0]] == '') {
$data[] = 'No data';
} else {
$data_macro = modules_get_unit_macro($row[$attr[0]], $unit);
$data_macro = modules_get_unit_macro(
$row[$attr[0]],
$unit
);
if ($data_macro) {
$data[] = $data_macro;
} else {
$data[] = html_print_result_div($row[$attr[0]]);
$data[] = html_print_result_div(
$row[$attr[0]]
);
}
}
}
@ -453,7 +553,16 @@ if (check_login()) {
if (empty($table->data)) {
ui_print_error_message(__('No available data to show'));
} else {
ui_pagination(count($count), false, $offset, 0, false, 'offset', true, 'binary_dialog');
ui_pagination(
count($count),
false,
$offset,
0,
false,
'offset',
true,
'binary_dialog'
);
html_print_table($table);
}
@ -727,11 +836,17 @@ if (check_login()) {
}
}
$status_filter_monitor = (int) get_parameter('status_filter_monitor', -1);
$status_filter_monitor = (int) get_parameter(
'status_filter_monitor',
-1
);
$status_text_monitor = get_parameter('status_text_monitor', '');
$filter_monitors = (bool) get_parameter('filter_monitors', false);
$status_module_group = get_parameter('status_module_group', -1);
$monitors_change_filter = (bool) get_parameter('monitors_change_filter', false);
$monitors_change_filter = (bool) get_parameter(
'monitors_change_filter',
false
);
$status_filter_sql = '1 = 1';
if ($status_filter_monitor == AGENT_MODULE_STATUS_NOT_NORMAL) {
@ -787,7 +902,9 @@ if (check_login()) {
AND tagente_estado.estado != $monitor_filter
";
$count_modules = db_get_all_rows_sql('SELECT COUNT(DISTINCT tagente_modulo.id_agente_modulo)'.$sql_condition);
$count_modules = db_get_all_rows_sql(
'SELECT COUNT(DISTINCT tagente_modulo.id_agente_modulo)'.$sql_condition
);
if (isset($count_modules[0])) {
$count_modules = reset($count_modules[0]);
@ -796,7 +913,7 @@ if (check_login()) {
}
// Get monitors/modules
// Get all module from agent
// Get all module from agent.
$sql_modules_info = "SELECT tagente_estado.*, tagente_modulo.*, tmodule_group.*
$sql_condition
GROUP BY tagente_modulo.id_agente_modulo ORDER BY $order_sql";
@ -1195,4 +1312,55 @@ if (check_login()) {
echo $graph_type;
return;
}
if ($get_graph_module === true) {
global $config;
$output = '';
$graph_data = get_parameter('graph_data', '');
$params = json_decode(base64_decode($graph_data), true);
$server_id = (int) get_parameter('server_id', 0);
include_once $config['homedir'].'/include/functions_graph.php';
// Metaconsole connection to the node.
if (is_metaconsole() === true && empty($server_id) === false) {
$server = metaconsole_get_connection_by_id($server_id);
metaconsole_connect($server);
}
$output .= grafico_modulo_sparse($params);
echo $output;
if (is_metaconsole() === true && empty($server_id) === false) {
metaconsole_restore_db();
}
return;
}
if ($get_graph_module_interfaces === true) {
global $config;
include_once $config['homedir'].'/include/functions_graph.php';
$output = '';
$graph_data = get_parameter('graph_data', '');
$params = json_decode(base64_decode($graph_data), true);
$modules = get_parameter('modules', '');
$modules = json_decode(base64_decode($modules), true);
$graph_data_combined = get_parameter('graph_data_combined', '');
$params_combined = json_decode(
base64_decode($graph_data_combined),
true
);
$output .= graphic_combined_module(
$modules,
$params,
$params_combined
);
echo $output;
return;
}
}

View File

@ -115,12 +115,6 @@ class ConsoleSupervisor
} else {
$this->enabled = (bool) $source['enabled'];
$this->sourceId = $source['id'];
// Assign targets.
$targets = get_notification_source_targets($this->sourceId);
$this->targetGroups = $targets['groups'];
$this->targetUsers = $targets['users'];
$this->targetUpdated = true;
}
return $this;
@ -620,20 +614,28 @@ class ConsoleSupervisor
return;
}
if ($this->targetUpdated === false) {
$targets = get_notification_source_targets($this->sourceId);
$this->targetGroups = $targets['groups'];
$this->targetUsers = $targets['users'];
$this->targetUpdated = false;
}
if ($source_id === 0) {
$source_id = $this->sourceId;
// Assign targets.
$targets = get_notification_source_targets($source_id);
}
static $_cache_targets;
$key = $source_id.'|'.$data['type'];
if ($_cache_targets === null) {
$_cache_targets = [];
}
if ($_cache_targets[$key] !== null) {
$targets = $_cache_targets[$key];
} else {
$targets = get_notification_source_targets(
$source_id,
$data['type']
);
$this->targetGroups = $targets['groups'];
$this->targetUsers = $targets['users'];
$this->targetUpdated = false;
$_cache_targets[$key] = $targets;
}
switch ($data['type']) {

View File

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

View File

@ -424,16 +424,6 @@ function get_user_language($id_user=null)
if ($quick_language) {
$language = get_parameter('language', 0);
if (defined('METACONSOLE')) {
if ($id_user == null) {
$id_user = $config['id_user'];
}
if ($language !== 0) {
update_user($id_user, ['language' => $language]);
}
}
if ($language === 'default') {
return $config['language'];
}

View File

@ -21,6 +21,8 @@ require_once $config['homedir'].'/include/functions.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php';
use PandoraFMS\Enterprise\RCMDFile as RCMDFile;
/**
* Return the agent if exists in the DB.
@ -2410,10 +2412,31 @@ function agents_delete_agent($id_agents, $disableACL=false)
enterprise_include_once('include/functions_policies.php');
enterprise_hook('policies_delete_agent', [$id_agent]);
// Delete agent in networkmap enterprise
if (enterprise_installed()) {
// Delete agent in networkmap.
enterprise_include_once('include/functions_networkmap.php');
networkmap_delete_nodes_by_agent([$id_agent]);
// Delete command targets with agent.
enterprise_include_once('include/lib/RCMDFile.class.php');
$target_filter = ['id_agent' => $id_agent];
// Retrieve all commands that have targets with specific agent id.
$commands = RCMDFile::getAll(
['rct.rcmd_id'],
$target_filter
);
foreach ($commands as $command) {
$rcmd_id = $command['rcmd_id'];
$rcmd = new RCMDFile($rcmd_id);
$command_targets = [];
$command_targets = $rcmd->getTargets(false, $target_filter);
$rcmd->deleteTargets(array_keys($command_targets));
}
}
// tagente_datos_inc
@ -3800,3 +3823,51 @@ function agents_get_last_status_change($id_agent)
return $row['last_status_change'];
}
/**
* Return the list of agents for a planned downtime
*
* @param integer $id_downtime Id of planned downtime.
* @param string $filter_cond String-based filters.
* @param string $id_groups_str String-based list of id group, separated with commas.
*
* @return array
*/
function get_planned_downtime_agents_list($id_downtime, $filter_cond, $id_groups_str)
{
$agents = [];
$sql = sprintf(
'SELECT tagente.id_agente, tagente.alias
FROM tagente
WHERE tagente.id_agente NOT IN (
SELECT tagente.id_agente
FROM tagente, tplanned_downtime_agents
WHERE tplanned_downtime_agents.id_agent = tagente.id_agente
AND tplanned_downtime_agents.id_downtime = %d
) AND disabled = 0 %s
AND tagente.id_grupo IN (%s)
ORDER BY tagente.nombre',
$id_downtime,
$filter_cond,
$id_groups_str
);
$agents = db_get_all_rows_sql($sql);
if (empty($agents)) {
$agents = [];
}
$agent_ids = extract_column($agents, 'id_agente');
$agent_names = extract_column($agents, 'alias');
$agents = array_combine($agent_ids, $agent_names);
if ($agents === false) {
$agents = [];
}
return $agents;
}

View File

@ -6480,6 +6480,14 @@ function api_set_stop_downtime($id, $thrash1, $other, $thrash3)
$date_time_stop = get_system_time();
$sql = sprintf('SELECT date_to, type_execution, executed FROM tplanned_downtime WHERE id=%d', $id);
$data = db_get_row_sql($sql);
if ($data['type_execution'] == 'periodically' && $data['executed'] == 1) {
returnError('error_stop_downtime', __('Error stopping downtime. Periodical and running planned downtime cannot be stopped.'));
return;
}
$values = [];
$values['date_to'] = $date_time_stop;

View File

@ -2878,20 +2878,21 @@ function events_get_group_events_steps(
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param integer $id_agent Agent id to get events.
* @param integer $period Period in seconds to get events.
* @param integer $date Beginning date to get events.
* @param boolean $history History.
* @param boolean $show_summary_group Show_summary_group.
* @param boolean $filter_event_severity Filter_event_severity.
* @param boolean $filter_event_type Filter_event_type.
* @param boolean $filter_event_status Filter_event_status.
* @param boolean $filter_event_filter_search Filter_event_filter_search.
* @param boolean $id_group Id_group.
* @param boolean $events_group Events_group.
* @param boolean $id_agent_module Id_agent_module.
* @param boolean $events_module Events_module.
* @param boolean $id_server Id_server.
* @param integer $id_agent Agent id to get events.
* @param integer $period Period in seconds to get events.
* @param integer $date Beginning date to get events.
* @param boolean $history History.
* @param boolean $show_summary_group Show_summary_group.
* @param boolean $filter_event_severity Filter_event_severity.
* @param boolean $filter_event_type Filter_event_type.
* @param boolean $filter_event_status Filter_event_status.
* @param boolean $filter_event_filter_search Filter_event_filter_search.
* @param boolean $id_group Id_group.
* @param boolean $events_group Events_group.
* @param boolean $id_agent_module Id_agent_module.
* @param boolean $events_module Events_module.
* @param boolean $id_server Id_server.
* @param boolean $filter_event_filter_exclude Filter_event_filter_exclude.
*
* @return array An array with all the events happened.
*/
@ -2909,7 +2910,8 @@ function events_get_agent(
$events_group=false,
$id_agent_module=false,
$events_module=false,
$id_server=false
$id_server=false,
$filter_event_filter_exclude=false
) {
global $config;
@ -3017,6 +3019,10 @@ function events_get_agent(
$sql_where .= ' AND (evento LIKE "%'.io_safe_input($filter_event_filter_search).'%" OR id_evento LIKE "%'.io_safe_input($filter_event_filter_search).'%")';
}
if (!empty($filter_event_filter_exclude)) {
$sql_where .= ' AND (evento NOT LIKE "%'.io_safe_input($filter_event_filter_exclude).'%" AND id_evento NOT LIKE "%'.io_safe_input($filter_event_filter_exclude).'%")';
}
if ($events_group) {
$secondary_groups = sprintf(
' INNER JOIN tgrupo tg
@ -5114,14 +5120,15 @@ function events_clean_tags($tags)
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param mixed $id_group Group id to get events for.
* @param integer $period Period in seconds to get events.
* @param integer $date Beginning date to get events.
* @param boolean $filter_event_severity Filter_event_severity.
* @param boolean $filter_event_type Filter_event_type.
* @param boolean $filter_event_status Filter_event_status.
* @param boolean $filter_event_filter_search Filter_event_filter_search.
* @param boolean $dbmeta Dbmeta.
* @param mixed $id_group Group id to get events for.
* @param integer $period Period in seconds to get events.
* @param integer $date Beginning date to get events.
* @param boolean $filter_event_severity Filter_event_severity.
* @param boolean $filter_event_type Filter_event_type.
* @param boolean $filter_event_status Filter_event_status.
* @param boolean $filter_event_filter_search Filter_event_filter_search.
* @param boolean $dbmeta Dbmeta.
* @param boolean $filter_event_filter_exclude Filter_event_filter_exclude.
*
* @return array An array with all the events happened.
*/
@ -5133,7 +5140,8 @@ function events_get_count_events_by_agent(
$filter_event_type=false,
$filter_event_status=false,
$filter_event_filter_search=false,
$dbmeta=false
$dbmeta=false,
$filter_event_filter_exclude=false
) {
global $config;
@ -5233,6 +5241,10 @@ function events_get_count_events_by_agent(
$sql_where .= ' AND (evento LIKE "%'.io_safe_input($filter_event_filter_search).'%" OR id_evento LIKE "%'.io_safe_input($filter_event_filter_search).'%")';
}
if (!empty($filter_event_filter_exclude)) {
$sql_where .= ' AND (evento NOT LIKE "%'.io_safe_input($filter_event_filter_exclude).'%" AND id_evento NOT LIKE "%'.io_safe_input($filter_event_filter_exclude).'%")';
}
$tagente = 'tagente';
$tevento = 'tevento';
@ -5285,14 +5297,15 @@ function events_get_count_events_by_agent(
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param array $filter Use target filter.
* @param integer $period Period in seconds to get events.
* @param integer $date Beginning date to get events.
* @param boolean $filter_event_severity Filter_event_severity.
* @param boolean $filter_event_type Filter_event_type.
* @param boolean $filter_event_status Filter_event_status.
* @param boolean $filter_event_filter_search Filter_event_filter_search.
* @param boolean $dbmeta Dbmeta.
* @param array $filter Use target filter.
* @param integer $period Period in seconds to get events.
* @param integer $date Beginning date to get events.
* @param boolean $filter_event_severity Filter_event_severity.
* @param boolean $filter_event_type Filter_event_type.
* @param boolean $filter_event_status Filter_event_status.
* @param boolean $filter_event_filter_search Filter_event_filter_search.
* @param boolean $dbmeta Dbmeta.
* @param boolean $filter_event_filter_exclude Filter_event_filter_exclude.
*
* @return array An array with all the events happened.
*/
@ -5304,7 +5317,8 @@ function events_get_count_events_validated_by_user(
$filter_event_type=false,
$filter_event_status=false,
$filter_event_filter_search=false,
$dbmeta=false
$dbmeta=false,
$filter_event_filter_exclude=false
) {
global $config;
$tevento = 'tevento';
@ -5426,6 +5440,10 @@ function events_get_count_events_validated_by_user(
$sql_where .= ' AND (evento LIKE "%'.io_safe_input($filter_event_filter_search).'%" OR id_evento LIKE "%'.io_safe_input($filter_event_filter_search).'%")';
}
if (!empty($filter_event_filter_exclude)) {
$sql_where .= ' AND (evento NOT LIKE "%'.io_safe_input($filter_event_filter_exclude).'%" AND id_evento NOT LIKE "%'.io_safe_input($filter_event_filter_exclude).'%")';
}
$sql = sprintf(
'SELECT
te.id_usuario,
@ -5474,14 +5492,15 @@ function events_get_count_events_validated_by_user(
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param mixed $filter Target filter.
* @param integer $period Period in seconds to get events.
* @param integer $date Beginning date to get events.
* @param boolean $filter_event_severity Filter_event_severity.
* @param boolean $filter_event_type Filter_event_type.
* @param boolean $filter_event_status Filter_event_status.
* @param boolean $filter_event_filter_search Filter_event_filter_search.
* @param boolean $dbmeta Dbmeta.
* @param mixed $filter Target filter.
* @param integer $period Period in seconds to get events.
* @param integer $date Beginning date to get events.
* @param boolean $filter_event_severity Filter_event_severity.
* @param boolean $filter_event_type Filter_event_type.
* @param boolean $filter_event_status Filter_event_status.
* @param boolean $filter_event_filter_search Filter_event_filter_search.
* @param boolean $dbmeta Dbmeta.
* @param boolean $filter_event_filter_exclude Filter_event_filter_exclude.
*
* @return array An array with all the events happened.
*/
@ -5493,7 +5512,8 @@ function events_get_count_events_by_criticity(
$filter_event_type=false,
$filter_event_status=false,
$filter_event_filter_search=false,
$dbmeta=false
$dbmeta=false,
$filter_event_filter_exclude=false
) {
global $config;
@ -5617,6 +5637,10 @@ function events_get_count_events_by_criticity(
$sql_where .= ' AND (evento LIKE "%'.io_safe_input($filter_event_filter_search).'%" OR id_evento LIKE "%'.io_safe_input($filter_event_filter_search).'%")';
}
if (!empty($filter_event_filter_exclude)) {
$sql_where .= ' AND (evento NOT LIKE "%'.io_safe_input($filter_event_filter_exclude).'%" AND id_evento NOT LIKE "%'.io_safe_input($filter_event_filter_exclude).'%")';
}
$sql = sprintf(
'SELECT
te.criticity,
@ -5656,14 +5680,15 @@ function events_get_count_events_by_criticity(
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param mixed $filter Target filter.
* @param integer $period Period in seconds to get events.
* @param integer $date Beginning date to get events.
* @param boolean $filter_event_severity Filter_event_severity.
* @param boolean $filter_event_type Filter_event_type.
* @param boolean $filter_event_status Filter_event_status.
* @param boolean $filter_event_filter_search Filter_event_filter_search.
* @param boolean $dbmeta Dbmeta.
* @param mixed $filter Target filter.
* @param integer $period Period in seconds to get events.
* @param integer $date Beginning date to get events.
* @param boolean $filter_event_severity Filter_event_severity.
* @param boolean $filter_event_type Filter_event_type.
* @param boolean $filter_event_status Filter_event_status.
* @param boolean $filter_event_filter_search Filter_event_filter_search.
* @param boolean $dbmeta Dbmeta.
* @param boolean $filter_event_filter_exclude Filter_event_filter_exclude.
*
* @return array An array with all the events happened.
*/
@ -5675,7 +5700,8 @@ function events_get_count_events_validated(
$filter_event_type=false,
$filter_event_status=false,
$filter_event_filter_search=false,
$dbmeta=false
$dbmeta=false,
$filter_event_filter_exclude=false
) {
global $config;
$tevento = 'tevento';
@ -5828,6 +5854,10 @@ function events_get_count_events_validated(
$sql_where .= ' AND (evento LIKE "%'.io_safe_input($filter_event_filter_search).'%" OR id_evento LIKE "%'.io_safe_input($filter_event_filter_search).'%")';
}
if (!empty($filter_event_filter_exclude)) {
$sql_where .= ' AND (evento NOT LIKE "%'.io_safe_input($filter_event_filter_exclude).'%" AND id_evento NOT LIKE "%'.io_safe_input($filter_event_filter_exclude).'%")';
}
$sql = sprintf(
'SELECT
te.estado,

View File

@ -1505,7 +1505,6 @@ function html_print_extended_select_for_unit(
// $fields = post_process_get_custom_values();
$fields['_timeticks_'] = 'Timeticks';
$fields['none'] = __('none');
$default_module_custom_units = get_custom_module_units();

View File

@ -116,6 +116,68 @@ function get_notification_targets(int $id_message)
}
/**
* Return subtypes.
*
* @param string|null $source Source filter or all.
*
* @return array
*/
function notifications_get_subtypes(?string $source=null)
{
$subtypes = [
'System status' => [
'NOTIF.LICENSE.LIMITED',
'NOTIF.LICENSE.EXPIRATION',
'NOTIF.FILES.ATTACHMENT',
'NOTIF.FILES.DATAIN',
'NOTIF.FILES.DATAIN.BADXML',
'NOTIF.PHP.SAFE_MODE',
'NOTIF.PHP.INPUT_TIME',
'NOTIF.PHP.EXECUTION_TIME',
'NOTIF.PHP.UPLOAD_MAX_FILESIZE',
'NOTIF.PHP.MEMORY_LIMIT',
'NOTIF.PHP.DISABLE_FUNCTIONS',
'NOTIF.PHP.PHANTOMJS',
'NOTIF.PHP.VERSION',
'NOTIF.HISTORYDB',
'NOTIF.PANDORADB',
'NOTIF.PANDORADB.HISTORICAL',
'NOTIF.HISTORYDB.MR',
'NOTIF.EXT.ELASTICSEARCH',
'NOTIF.EXT.LOGSTASH',
'NOTIF.METACONSOLE.DB_CONNECTION',
'NOTIF.DOWNTIME',
'NOTIF.UPDATEMANAGER.REGISTRATION',
'NOTIF.MISC.EVENTSTORMPROTECTION',
'NOTIF.MISC.DEVELOPBYPASS',
'NOTIF.MISC.FONTPATH',
'NOTIF.SECURITY.DEFAULT_PASSWORD',
'NOTIF.UPDATEMANAGER.OPENSETUP',
'NOTIF.UPDATEMANAGER.UPDATE',
'NOTIF.UPDATEMANAGER.MINOR',
'NOTIF.UPDATEMANAGER.MESSAGES',
'NOTIF.CRON.CONFIGURED',
'NOTIF.ALLOWOVERRIDE.MESSAGE',
'NOTIF.HAMASTER.MESSAGE',
'NOTIF.SERVER.STATUS',
'NOTIF.SERVER.QUEUE',
'NOTIF.SERVER.MASTER',
],
];
if ($source === null) {
return $subtypes;
}
if (isset($subtypes[$source]) === true) {
return $subtypes[$source];
}
return [];
}
/**
* Check if current user has grants to read this notification
*
@ -160,14 +222,28 @@ function check_notification_readable(int $id_message)
* Returns the target users and groups assigned to be notified on
* desired source.
*
* @param integer $id_source Source identificator.
* @param integer $id_source Source identificator.
* @param string|null $subtype Subtype identification.
*
* @return array [users] and [groups] with the targets.
*/
function get_notification_source_targets(int $id_source)
function get_notification_source_targets(int $id_source, ?string $subtype=null)
{
$ret = [];
$filter = '';
if ($subtype !== null) {
$matches = [];
if (preg_match('/(.*)\.\d+$/', $subtype, $matches) > 0) {
$subtype = $matches[1];
}
$filter = sprintf(
' AND ns.`subtype_blacklist` NOT LIKE "%%%s%%"',
$subtype
);
}
$users = db_get_all_rows_sql(
sprintf(
'SELECT
@ -176,9 +252,11 @@ function get_notification_source_targets(int $id_source)
FROM tnotification_source_user nsu
INNER JOIN tnotification_source ns
ON ns.id=nsu.id_source
%s
WHERE ns.id = %d
AND ((ns.enabled is NULL OR ns.enabled != 0)
OR (nsu.enabled is NULL OR nsu.enabled != 0))',
$filter,
$id_source
)
);
@ -197,8 +275,10 @@ function get_notification_source_targets(int $id_source)
FROM tnotification_source_group nsg
INNER JOIN tnotification_source ns
ON ns.id=nsg.id_source
%s
WHERE ns.id = %d
AND (ns.enabled is NULL OR ns.enabled != 0)',
$filter,
$id_source
)
);
@ -700,8 +780,47 @@ function notifications_print_global_source_configuration($source)
);
$html_selectors .= '</div>';
$html_checkboxes = '';
$blacklist = json_decode($source['subtype_blacklist'], 1);
if (json_last_error() !== JSON_ERROR_NONE) {
$blacklist = [];
}
if ($source['description'] === io_safe_input('System status')) {
$system_subtypes = notifications_get_subtypes('System status');
foreach ($system_subtypes as $type) {
$html_checkboxes .= html_print_input(
[
'input_class' => 'flex flex-row w290px margin-soft',
'label' => $type,
'name' => 'check-'.$type,
'type' => 'switch',
'id' => 'nt-'.$source['id'].'.'.$type.'-subtype',
'class' => 'elem-clickable',
'value' => (isset($blacklist[$type]) === false),
'return' => true,
]
);
}
$html_checkboxes = ui_print_toggle(
[
'content' => $html_checkboxes,
'name' => __('Subtype customization'),
'hidden_default' => false,
'return' => true,
'toggle_class' => '',
'container_class' => 'flex flex-row flex-start w100p',
'main_class' => '',
'clean' => true,
]
);
}
// Return all html.
return $html_title.$html_selectors.$html_checkboxes.$html_select_pospone;
return $html_title.$html_selectors.$html_checkboxes;
}

View File

@ -1868,6 +1868,10 @@ function reporting_event_report_group(
$return['subtitle'] .= ' ('.$content['style']['event_filter_search'].')';
}
if (!empty($content['style']['event_filter_exclude'])) {
$return['subtitle'] .= ' ('.__('Exclude ').$content['style']['event_filter_exclude'].')';
}
$return['description'] = $content['description'];
$return['show_extended_events'] = $content['show_extended_events'];
$return['date'] = reporting_get_date_text($report, $content);
@ -1880,6 +1884,7 @@ function reporting_event_report_group(
$filter_event_type = json_decode($event_filter['filter_event_type'], true);
$filter_event_status = json_decode($event_filter['filter_event_status'], true);
$filter_event_filter_search = $event_filter['event_filter_search'];
$filter_event_filter_exclude = $event_filter['event_filter_exclude'];
// Graphs.
$event_graph_by_agent = $event_filter['event_graph_by_agent'];
@ -1919,7 +1924,11 @@ function reporting_event_report_group(
$filter_event_status,
$filter_event_filter_search,
$content['id_group'],
true
true,
false,
false,
false,
$filter_event_filter_exclude
);
if (empty($data)) {
@ -1965,7 +1974,8 @@ function reporting_event_report_group(
$filter_event_type,
$filter_event_status,
$filter_event_filter_search,
$metaconsole_dbtable
$metaconsole_dbtable,
$filter_event_filter_exclude
);
$return['chart']['by_agent'] = pie_graph(
@ -1990,7 +2000,8 @@ function reporting_event_report_group(
$filter_event_type,
$filter_event_status,
$filter_event_filter_search,
$metaconsole_dbtable
$metaconsole_dbtable,
$filter_event_filter_exclude
);
$return['chart']['by_user_validator'] = pie_graph(
@ -2044,7 +2055,8 @@ function reporting_event_report_group(
$filter_event_type,
$filter_event_status,
$filter_event_filter_search,
$metaconsole_dbtable
$metaconsole_dbtable,
$filter_event_filter_exclude
);
$return['chart']['validated_vs_unvalidated'] = pie_graph(
@ -2189,6 +2201,7 @@ function reporting_event_report_module(
true
);
$filter_event_filter_search = $event_filter['event_filter_search'];
$filter_event_filter_exclude = $event_filter['event_filter_exclude'];
// Graphs.
$event_graph_by_user_validator = $event_filter['event_graph_by_user_validator'];
@ -2218,7 +2231,8 @@ function reporting_event_report_module(
$event_graph_validated_vs_unvalidated,
$ttl,
$id_server,
$metaconsole_dbtable
$metaconsole_dbtable,
$filter_event_filter_exclude
);
if (empty($data)) {
@ -3259,6 +3273,7 @@ function reporting_event_report_agent(
$filter_event_type = json_decode($style['filter_event_type'], true);
$filter_event_status = json_decode($style['filter_event_status'], true);
$filter_event_filter_search = $style['event_filter_search'];
$filter_event_filter_exclude = $style['event_filter_exclude'];
// Graph.
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
@ -3276,7 +3291,8 @@ function reporting_event_report_agent(
$filter_event_severity,
$filter_event_type,
$filter_event_status,
$filter_event_filter_search
$filter_event_filter_search,
$filter_event_filter_exclude
);
reporting_set_conf_charts(
@ -3316,7 +3332,8 @@ function reporting_event_report_agent(
$filter_event_type,
$filter_event_status,
$filter_event_filter_search,
$metaconsole_dbtable
$metaconsole_dbtable,
$filter_event_filter_exclude
);
$return['chart']['by_user_validator'] = pie_graph(
@ -3341,7 +3358,8 @@ function reporting_event_report_agent(
$filter_event_type,
$filter_event_status,
$filter_event_filter_search,
$metaconsole_dbtable
$metaconsole_dbtable,
$filter_event_filter_exclude
);
$colors = get_criticity_pie_colors($data_graph);
@ -3370,7 +3388,8 @@ function reporting_event_report_agent(
$filter_event_type,
$filter_event_status,
$filter_event_filter_search,
$metaconsole_dbtable
$metaconsole_dbtable,
$filter_event_filter_exclude
);
$return['chart']['validated_vs_unvalidated'] = pie_graph(
@ -9406,7 +9425,8 @@ function reporting_get_module_detailed_event(
$event_graph_validated_vs_unvalidated=false,
$ttl=1,
$id_server=false,
$metaconsole_dbtable=false
$metaconsole_dbtable=false,
$filter_event_filter_exclude=false
) {
global $config;
@ -9442,7 +9462,8 @@ function reporting_get_module_detailed_event(
false,
$id_module,
true,
$id_server
$id_server,
$filter_event_filter_exclude
);
// total_events
@ -9470,7 +9491,8 @@ function reporting_get_module_detailed_event(
$filter_event_type,
$filter_event_status,
$filter_event_filter_search,
$metaconsole_dbtable
$metaconsole_dbtable,
$filter_event_filter_exclude
);
$event['chart']['by_user_validator'] = pie_graph(
@ -9495,7 +9517,8 @@ function reporting_get_module_detailed_event(
$filter_event_type,
$filter_event_status,
$filter_event_filter_search,
$metaconsole_dbtable
$metaconsole_dbtable,
$filter_event_filter_exclude
);
$colors = get_criticity_pie_colors($data_graph);
@ -9524,7 +9547,8 @@ function reporting_get_module_detailed_event(
$filter_event_type,
$filter_event_status,
$filter_event_filter_search,
$metaconsole_dbtable
$metaconsole_dbtable,
$filter_event_filter_exclude
);
$event['chart']['validated_vs_unvalidated'] = pie_graph(
@ -9573,7 +9597,8 @@ function reporting_get_agents_detailed_event(
$filter_event_severity=false,
$filter_event_type=false,
$filter_event_status=false,
$filter_event_filter_search=false
$filter_event_filter_search=false,
$filter_event_filter_exclude=false
) {
global $config;
@ -9605,7 +9630,11 @@ function reporting_get_agents_detailed_event(
$filter_event_status,
$filter_event_filter_search,
false,
false
false,
false,
false,
false,
$filter_event_filter_exclude
);
if (empty($event)) {

View File

@ -1492,9 +1492,9 @@ function snmp_browser_print_create_module_massive($target='agent', $snmp_conf, $
true
);
$table->data[2][0] = __($target_item.' available').html_print_input_image('select_all_left', 'images/tick.png', 1, '', true, ['title' => __('Select all')]);
$table->data[2][0] = '<b>'.__($target_item.' available').'</b><br> '.__('Select all').html_print_checkbox_switch('select_all_left', 1, false, true);
$table->data[2][1] = '';
$table->data[2][2] = __($target_item.' to apply').html_print_input_image('select_all_right', 'images/tick.png', 1, '', true, ['title' => __('Select all')]);
$table->data[2][2] = '<b>'.__($target_item.' to apply').'</b><br> '.__('Select all').html_print_checkbox_switch('select_all_right', 1, false, true);
$table->data[3][0] = html_print_select(
[],

View File

@ -92,6 +92,7 @@ function tactical_get_data($id_user=false, $user_strict=false, $acltags, $return
$list['_monitors_unknown_'] = 0;
$list['_monitors_not_init_'] = 0;
$list['_monitors_ok_'] = 0;
$list['_monitors_alerts_fired_'] = 0;
if (empty($list_groups)) {
$list_groups = [];

View File

@ -3821,7 +3821,9 @@ function ui_toggle(
$main_class = '';
}
$container_class = 'white-box-content-clean';
if (empty($container_class) === true) {
$container_class = 'white-box-content-clean';
}
}
// Link to toggle.
@ -3943,7 +3945,24 @@ function ui_toggle(
/**
* Simplified way of ui_toggle ussage.
*
* @param array $data Arguments.
* @param array $data Arguments:
* 'content'
* 'name'
* 'title'
* 'id'
* 'hidden_default'
* 'return'
* 'toggle_class'
* 'container_class'
* 'main_class'
* 'img_a'
* 'img_b'
* 'clean'
* 'reverseImg'
* 'switch'
* 'attributes_switch'
* 'toggl_attr'
* 'switch_on'.
*
* @return string HTML code with toggle content.
*/

View File

@ -960,7 +960,6 @@ function pandoraFlotArea(
legend,
series_type,
color,
water_mark,
date_array,
data_module_graph,
params,
@ -977,7 +976,6 @@ function pandoraFlotArea(
.shift();
var width = params.width;
var vconsole = params.vconsole;
var dashboard = params.dashboard;
var menu = params.menu;
var min_x = date_array["start_date"] * 1000;
var max_x = date_array["final_date"] * 1000;
@ -2799,17 +2797,6 @@ function pandoraFlotArea(
);
adjust_menu(graph_id, plot, parent_height, width, show_legend);
}
if (!dashboard) {
if (water_mark) {
set_watermark(
graph_id,
plot,
$("#watermark_image_" + graph_id).attr("src")
);
}
//adjust_menu(graph_id, plot, parent_height, width, show_legend);
}
}
function format_unit_yaxes(y) {

View File

@ -262,15 +262,17 @@ function flot_area_graph(
$params['height'] = 1;
}
if (!$vconsole) {
$return .= "<div id='overview_$graph_id' class='overview_graph'
style='margin:0px; margin-top:30px; margin-bottom:50px; width: ".$params['width']."px; height: 200px;'></div>";
if ((bool) $params['vconsole'] === false) {
$return .= '<div id="overview_'.$graph_id.'" class="overview_graph" style="margin:0px; margin-top:30px; margin-bottom:50px; width:'.$params['width'].'px; height: 200px;"></div>';
$legend_top = 10;
if (empty($params['show_legend']) === false) {
$legend_top = (20 + (count($legend) * 18));
}
if ($water_mark != '') {
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='".$water_mark['url']."'></div>";
$watermark = 'true';
} else {
$watermark = 'false';
if ($water_mark != '' && (bool) $params['dashboard'] === false) {
$return .= '<div id="watermark_'.$graph_id.'" style="position:absolute; top: '.$legend_top.'px; left: calc(100% - 100px);">';
$return .= '<img id="watermark_image_'.$graph_id.'" src="'.$water_mark['url'].'">';
$return .= '</div>';
}
}
@ -314,7 +316,6 @@ function flot_area_graph(
$return .= $legend.", \n";
$return .= $series_type.", \n";
$return .= $color.", \n";
$return .= $watermark.", \n";
$return .= $date_array.", \n";
$return .= $data_module_graph.", \n";
$return .= $params.", \n";

View File

@ -35,11 +35,23 @@
$("option[value!=0]", $select).remove ();
if (! config.callbackBefore (this))
return;
if (typeof config.recursion === "function") {
// Perform this for those cases where recursion parameter is obtained through a function that returns a variable that is set in the lexical environment where this constructor is called.
var recursion_value = config.recursion();
if (typeof recursion_value === "boolean") {
recursion_value = recursion_value ? 1 : 0;
}
} else {
var recursion_value = config.recursion;
}
var opts = {
"page" : "godmode/groups/group_list",
"get_group_agents" : 1,
"id_group" : this.value,
"recursion" : config.recursion,
"recursion" : recursion_value,
"filter_agents_json" : config.filter_agents_json,
"disabled" : (typeof config.disabled === "function")
? (config.disabled())

View File

@ -275,7 +275,10 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) {
);
}
}
jQuery.each(data, function(i, val) {
var all_common_modules = [];
$.each(data, function(i, val) {
var s = js_html_entity_decode(val);
$("#module").append(
@ -285,8 +288,12 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) {
.attr("title", s)
);
all_common_modules.push(i);
$("#module").fadeIn("normal");
});
$("#hidden-all_common_modules").val(all_common_modules.toString());
if (typeof selected !== "undefined") $("#module").attr("value", selected);
$("#module")
@ -724,12 +731,14 @@ function post_process_select_init_unit(name, selected) {
);
$("#text-" + name + "_text").val("");
} else {
$("#" + name + "_select option[value=none]").attr("selected", true);
$("#" + name + "_select option[value=0]").attr("selected", true);
$("#" + name + "_default").hide();
$("#" + name + "_manual").show();
}
} else {
$("#" + name + "_select option[value=none]").attr("selected", true);
$("#" + name + "_select option[value=0]").attr("selected", true);
$("#" + name + "_default").hide();
$("#" + name + "_manual").show();
}
$("#" + name + "_select").change(function() {

View File

@ -366,11 +366,10 @@ class CustomGraphWidget extends Widget
);
$hackLegendHight = (30 * count($sources));
if ($hackLegendHight < ($size['height'] - 10 - $hackLegendHight)) {
$height = ($size['height'] - 10 - $hackLegendHight);
if ($hackLegendHight > ($size['height'] - 10 - $hackLegendHight)) {
$height = ($size['height'] - $hackLegendHight);
} else {
$height = ($size['height'] - 10);
$this->values['showLegend'] = 0;
}
} else {
$height = ($size['height'] - 10);
@ -407,6 +406,7 @@ class CustomGraphWidget extends Widget
'menu' => false,
'show_legend' => $this->values['showLegend'],
'vconsole' => true,
'dashboard' => true,
];
$params_combined = [

View File

@ -373,6 +373,7 @@ class SingleGraphWidget extends Widget
'show_legend' => $this->values['showLegend'],
'show_title' => $module_name,
'menu' => false,
'dashboard' => true,
];
$output = '<div class="container-center">';

View File

@ -136,8 +136,20 @@ div.target.flex {
.blocks {
cursor: move;
}
#drop_mssg {
position: relative;
top: 25%;
display: block;
left: 37%;
font-size: 3em;
color: #aaa;
overflow: hidden;
width: 6em;
background: #fff;
text-align: center;
z-index: 2;
}
div#rules.show::after {
content: "Drop here";
position: relative;
top: 25%;
display: block;

View File

@ -478,6 +478,10 @@ select:-internal-list-box {
width: 290px;
max-width: 290px;
}
.w500px {
width: 500px;
max-width: 500px;
}
.mw120px {
min-width: 120px;
}
@ -626,6 +630,13 @@ select:-internal-list-box {
align-items: flex-start;
}
.flex-row-reverse {
display: flex;
flex-direction: row-reverse;
flex-wrap: wrap;
align-items: flex-start;
}
.flex-space-around {
justify-content: space-around;
}
@ -652,6 +663,9 @@ select:-internal-list-box {
.padding-right-2-imp {
padding-right: 2em !important;
}
.margin-soft {
margin: 0.3em 1em;
}
.margin-right-1 {
margin-right: 1em;
}
@ -6099,3 +6113,17 @@ div.graph div.legend table {
writing-mode: lr-tb;
white-space: nowrap;
}
div.stat-win-spinner {
width: 100%;
height: 300px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
div.stat-win-spinner img {
width: 100px;
height: 100px;
}

View File

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

View File

@ -121,7 +121,7 @@ class Events
$status_icon = html_print_image($img_st, true, false, false, false, false, true);
$row = [];
$row[] = '<b class="ui-table-cell-label">'.__('Event Name').'</b><a href="javascript: openDetails('.$event['id_evento'].')"><div class="event_name">'.io_safe_output(str_replace(['&nbsp;', '&#20;'], ' ', $event['evento'])).'</div></a>';
$row[] = '<b class="ui-table-cell-label">'.__('Event Name').'</b><a href="#" onclick="openDetails('.$event['id_evento'].')"><div class="event_name">'.io_safe_output(str_replace(['&nbsp;', '&#20;'], ' ', $event['evento'])).'</div></a>';
if ($event['id_agente'] == 0) {
$agent_name = __('System');

View File

@ -784,7 +784,7 @@ foreach ($agents as $agent) {
$data[0] = '<div class="left_'.$agent['id_agente'].'">';
$data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'"><b><span class="'.$custom_font_size.' title ="'.$agent['nombre'].'">'.$agent['alias'].'</span></b></a>';
$data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'"><b><span class="'.$custom_font_size.' title ="'.$agent['nombre'].'">'.ui_print_truncate_text($agent['alias'], 'agent_medium', false, true, true).'</span></b></a>';
if ($agent['quiet']) {
$data[0] .= '&nbsp;';

View File

@ -92,7 +92,7 @@ $alive_animation = agents_get_status_animation(
$agent_name = ui_print_agent_name(
$agent['id_agente'],
true,
500,
'agent_medium',
'font-size: medium;font-weight:bold',
true
);

View File

@ -31,8 +31,6 @@ require_once $config['homedir'].'/include/auth/mysql.php';
require_once $config['homedir'].'/include/functions.php';
require_once $config['homedir'].'/include/functions_db.php';
require_once $config['homedir'].'/include/functions_reporting.php';
require_once $config['homedir'].'/include/functions_graph.php';
require_once $config['homedir'].'/include/functions_custom_graphs.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_tags.php';
@ -45,7 +43,7 @@ $params = json_decode($params_json, true);
// Metaconsole connection to the node.
$server_id = (int) (isset($params['server']) ? $params['server'] : 0);
if ($config['metaconsole'] && empty($server_id) === false) {
if (is_metaconsole() === true && empty($server_id) === false) {
$server = metaconsole_get_connection_by_id($server_id);
// Error connecting.
@ -268,13 +266,15 @@ $table->data[] = $data;
$table->rowclass[] = '';
$form_table = html_print_table($table, true);
$form_table .= '<div style="width:100%; text-align:right;">'.html_print_submit_button(
$form_table .= '<div style="width:100%; text-align:right;">';
$form_table .= html_print_submit_button(
__('Reload'),
'submit',
false,
'class="sub upd"',
true
).'</div>';
);
$form_table .= '</div>';
// Menu.
@ -303,7 +303,7 @@ html_print_div(
);
// Graph.
echo '<div id="stat-win-interface-graph">';
$output = '<div id="stat-win-interface-graph">';
$height = 280;
$width = '90%';
@ -320,8 +320,8 @@ $params = [
'zoom' => $zoom,
];
if (is_metaconsole()) {
$params['id_server'] = $server_id;
if (is_metaconsole() === true) {
$params['server_id'] = $server_id;
}
if ($config['type_interface_charts'] == 'line') {
@ -340,13 +340,13 @@ $params_combined = [
'stacked' => $stacked,
];
graphic_combined_module(
array_values($interface_traffic_modules),
$params,
$params_combined
);
$modules = array_values($interface_traffic_modules);
$output .= '<div id="stat-win-spinner" class="stat-win-spinner">';
$output .= html_print_image('images/spinner_charts.gif', true);
$output .= '</div>';
echo '</div>';
$output .= '</div>';
echo $output;
?>
</body>
@ -362,6 +362,10 @@ ui_require_jquery_file(
true
);
ui_include_time_picker(true);
if (is_metaconsole() === true && empty($server_id) === false) {
metaconsole_restore_db();
}
?>
<script>
var show_overview = false;
@ -370,6 +374,19 @@ ui_include_time_picker(true);
$(document).ready(function() {
height_window = $(window).height();
width_window = $(window).width();
var graph_data = "<?php echo base64_encode(json_encode($params)); ?>";
var modules = "<?php echo base64_encode(json_encode($modules)); ?>";
var graph_data_combined = "<?php echo base64_encode(json_encode($params_combined)); ?>";
var url = "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>";
var serverId = "<?php echo $server_id; ?>";
get_ajax_modules_interfaces(
url,
graph_data,
serverId,
graph_data_combined,
modules
);
});
$("*").filter(function() {
@ -423,4 +440,26 @@ ui_include_time_picker(true);
}
});
function get_ajax_modules_interfaces(url, graph_data, serverId, graph_data_combined, modules) {
$.ajax({
type: "POST",
url: url,
dataType: "html",
data: {
page: "include/ajax/module",
get_graph_module_interfaces: true,
graph_data: graph_data,
server_id: serverId,
graph_data_combined: graph_data_combined,
modules: modules
},
success: function (data) {
$("#stat-win-spinner").hide();
$("#stat-win-interface-graph").append(data);
},
error: function (error) {
console.error(error);
}
});
}
</script>

View File

@ -31,7 +31,6 @@ require_once $config['homedir'].'/include/auth/mysql.php';
require_once $config['homedir'].'/include/functions.php';
require_once $config['homedir'].'/include/functions_db.php';
require_once $config['homedir'].'/include/functions_reporting.php';
require_once $config['homedir'].'/include/functions_graph.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_tags.php';
@ -41,7 +40,7 @@ enterprise_include_once('include/functions_agents.php');
check_login();
// Metaconsole connection to the node.
$server_id = (int) get_parameter('server');
$server_id = (int) get_parameter('server', 0);
if (is_metaconsole() === true && empty($server_id) === false) {
$server = metaconsole_get_connection_by_id($server_id);
// Error connecting.
@ -445,59 +444,39 @@ ui_print_message_dialog(
]
);
$params = [
'agent_module_id' => $id,
'period' => $period,
'show_events' => $draw_events,
'title' => $label,
'unit_name' => $unit,
'show_alerts' => $draw_alerts,
'date' => $date,
'unit' => $unit,
'baseline' => $baseline,
'homeurl' => $urlImage,
'adapt_key' => 'adapter_'.$graph_type,
'compare' => $time_compare,
'show_unknown' => $unknown_graph,
'percentil' => (($show_percentil) ? $config['percentil'] : null),
'type_graph' => $config['type_module_charts'],
'fullscale' => $fullscale,
'zoom' => $zoom,
'height' => 300,
'type_mode_graph' => $type_mode_graph,
];
// Graph.
$output = '<div id="stat-win-module-graph">';
switch ($graph_type) {
case 'boolean':
case 'sparse':
case 'string':
$params = [
'agent_module_id' => $id,
'period' => $period,
'show_events' => $draw_events,
'title' => $label,
'unit_name' => $unit,
'show_alerts' => $draw_alerts,
'date' => $date,
'unit' => $unit,
'baseline' => $baseline,
'homeurl' => $urlImage,
'adapt_key' => 'adapter_'.$graph_type,
'compare' => $time_compare,
'show_unknown' => $unknown_graph,
'percentil' => (($show_percentil) ? $config['percentil'] : null),
'type_graph' => $config['type_module_charts'],
'fullscale' => $fullscale,
'zoom' => $zoom,
'height' => 300,
'type_mode_graph' => $type_mode_graph,
];
$output .= grafico_modulo_sparse($params);
$output .= '<br>';
if ($show_events_graph) {
$width = '500';
$height = '450';
$output .= graphic_module_events(
$id,
$width,
$height,
$period,
$config['homeurl'],
$zoom,
'adapted_'.$graph_type,
$date,
true
);
}
break;
default:
$output .= fs_error_image('../images');
break;
}
$output .= '<div id="stat-win-spinner" class="stat-win-spinner">';
$output .= html_print_image('images/spinner_charts.gif', true);
$output .= '</div>';
$output .= '</div>';
echo $output;
if (is_metaconsole() === true && empty($server_id) === false) {
metaconsole_restore_db();
}
?>
</body>
@ -580,5 +559,32 @@ ui_include_time_picker(true);
arrow.attr('src',arrow.attr('src').replace(arrow_up, arrow_down));
}
});
var graph_data = "<?php echo base64_encode(json_encode($params)); ?>";
var url = "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>";
var serverId = "<?php echo $server_id; ?>";
get_ajax_module(url, graph_data, serverId);
});
function get_ajax_module(url, graph_data, serverId) {
$.ajax({
type: "POST",
url: url,
dataType: "html",
data: {
page: "include/ajax/module",
get_graph_module: true,
graph_data: graph_data,
server_id: serverId
},
success: function (data) {
$("#stat-win-spinner").hide();
$("#stat-win-module-graph").append(data);
},
error: function (error) {
console.error(error);
}
});
}
</script>

View File

@ -1412,7 +1412,7 @@ if (!empty($result)) {
}
if (in_array('module_name', $show_fields) || is_metaconsole()) {
$data[3] = ui_print_truncate_text($row['module_name'], 'agent_small', false, true, true);
$data[3] = ui_print_truncate_text($row['module_name'], 'module_small', false, true, true);
if ($row['extended_info'] != '') {
$data[3] .= ui_print_help_tip($row['extended_info'], true, '/images/default_list.png');
}

View File

@ -1389,6 +1389,7 @@ if (isset($ehorus_tab) && !empty($ehorus_tab)) {
$onheader['ehorus'] = $ehorus_tab;
}
$id_extension = get_parameter('id_extension', '');
// Tabs for extensions.
$tab_name_extensions = '';
foreach ($config['extensions'] as $extension) {
@ -1431,13 +1432,11 @@ foreach ($config['extensions'] as $extension) {
}
$image = $extension['extension_ope_tab']['icon'];
$name = $extension['extension_ope_tab']['name'];
$id = $extension['extension_ope_tab']['id'];
$tab_name_extensions = $name;
$name = $extension['extension_ope_tab']['name'];
$id = $extension['extension_ope_tab']['id'];
$id_extension = get_parameter('id_extension', '');
if ($id_extension == $id) {
if ($id_extension === $id) {
$tab_name_extensions = $name;
$active = true;
} else {
$active = false;

View File

@ -321,21 +321,48 @@ function add_module_massive_controller(target = 'agent')
});
// Select all Items.
$("input[name='select_all_left']").click(function () {
$('#id_item option').map(function() {
$(this).prop('selected', true);
});
$("#checkbox-select_all_left").change(function () {
if ($("#checkbox-select_all_left").prop('checked') == true) {
$('#id_item option').map(function() {
$(this).prop('selected', true);
});
} else {
$('#id_item option').map(function() {
$(this).prop('selected', false);
});
}
return false;
});
$("input[name='select_all_right']").click(function () {
$('#id_item2 option').map(function() {
$(this).prop('selected', true);
});
$("#checkbox-select_all_right").change(function () {
if ($("#checkbox-select_all_right").prop('checked') == true) {
$('#id_item2 option').map(function() {
$(this).prop('selected', true);
});
} else {
$('#id_item2 option').map(function() {
$(this).prop('selected', false);
});
}
return false;
});
$("#id_item").click(function(e) {
if ($("#checkbox-select_all_left").prop('checked') == true) {
$("#checkbox-select_all_left").prop('checked', false);
}
});
$("#id_item2").click(function(e) {
if ($("#checkbox-select_all_right").prop('checked') == true) {
$("#checkbox-select_all_right").prop('checked', false);
}
});
$(".p-switch").css('display', 'table');
// Select items.
$("#right").click (function () {
jQuery.each($("select[name='id_item[]'] option:selected"), function (key, value) {

View File

@ -619,7 +619,7 @@ $table->data[4][1] = html_print_input(
);
// Type filter (ColdStart, WarmStart, LinkDown, LinkUp, authenticationFailure, Other).
$table->data[6][1] = '<strong>'.__('Trap type').'</strong>'.ui_print_help_tip(__('Search by trap type'), true);
$table->data[4][3] = '<strong>'.__('Trap type').'</strong>'.ui_print_help_tip(__('Search by trap type'), true);
$trap_types = [
-1 => __('None'),
0 => __('Cold start (0)'),
@ -629,7 +629,7 @@ $trap_types = [
4 => __('Authentication failure (4)'),
5 => __('Other'),
];
$table->data[6][2] = html_print_select(
$table->data[4][4] = html_print_select(
$trap_types,
'trap_type',
$trap_type,

View File

@ -89,8 +89,9 @@ foreach ($sources as $source) {
echo '</div>';
}
if ($disabled_flag) {
echo '<span style="font-weight: bold; color: #ff0000;">Disabled controls have been set by the system administrator</span>';
if ((bool) $disabled_flag === true) {
$s = __('Controls have been disabled by the system administrator');
echo '<span style="font-weight: bold; color: #ff0000;">'.$s.'</span>';
}
echo '</div>';

View File

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

View File

@ -1317,6 +1317,7 @@ CREATE TABLE `tnotification_source` (
`enabled` int(1) DEFAULT NULL,
`user_editable` int(1) DEFAULT NULL,
`also_mail` int(1) DEFAULT NULL,
`subtype_blacklist` TEXT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -2652,6 +2653,7 @@ CREATE TABLE IF NOT EXISTS `tinventory_alert`(
`last_fired` text NOT NULL default '',
`disable_event` tinyint(1) UNSIGNED default 0,
`enabled` tinyint(1) UNSIGNED default 1,
`alert_groups` text NOT NULL default '',
PRIMARY KEY (`id`),
FOREIGN KEY (`id_module_inventory`) REFERENCES tmodule_inventory(`id_module_inventory`)
ON DELETE CASCADE ON UPDATE CASCADE

View File

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

View File

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

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.752"
PI_BUILD="210226"
PI_BUILD="210302"
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.752 PS210226";
my $version = "7.0NG.752 PS210302";
# 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.752 PS210226";
my $version = "7.0NG.752 PS210302";
# save program name for logging
my $progname = basename($0);