mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Merge remote-tracking branch 'origin/develop' into ent-3430-discovery
Former-commit-id: cd7b77b0fe8fa41f03024af752b8793ae877de2b
This commit is contained in:
commit
d8ee90c285
@ -1,5 +1,7 @@
|
|||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||||
|
|
||||||
ALTER TABLE `trecon_task` ADD COLUMN `wmi_enabled` tinyint(1) unsigned DEFAULT '0';
|
ALTER TABLE `trecon_task` ADD COLUMN `wmi_enabled` tinyint(1) unsigned DEFAULT '0';
|
||||||
ALTER TABLE `trecon_task` ADD COLUMN `auth_strings` text;
|
ALTER TABLE `trecon_task` ADD COLUMN `auth_strings` text;
|
||||||
ALTER TABLE `trecon_task` ADD COLUMN `autoconfiguration_enabled` tinyint(1) unsigned default '0';
|
ALTER TABLE `trecon_task` ADD COLUMN `autoconfiguration_enabled` tinyint(1) unsigned default '0';
|
||||||
|
@ -1206,6 +1206,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview',
|
|||||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '731');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '731');
|
||||||
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tconfig_os`
|
-- Table `tconfig_os`
|
||||||
|
272
pandora_console/godmode/agentes/status_monitor_custom_fields.php
Normal file
272
pandora_console/godmode/agentes/status_monitor_custom_fields.php
Normal file
@ -0,0 +1,272 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
check_login();
|
||||||
|
|
||||||
|
if (! check_acl($config['id_user'], 0, 'AR')
|
||||||
|
&& ! check_acl($config['id_user'], 0, 'AW')
|
||||||
|
&& ! check_acl($config['id_user'], 0, 'AM')
|
||||||
|
) {
|
||||||
|
db_pandora_audit(
|
||||||
|
'ACL Violation',
|
||||||
|
'Trying to access Agent Management'
|
||||||
|
);
|
||||||
|
include 'general/noaccess.php';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$update = get_parameter('upd_button', '');
|
||||||
|
$default = (int) get_parameter('default', 0);
|
||||||
|
|
||||||
|
|
||||||
|
if ($default != 0) {
|
||||||
|
$fields_selected = explode(',', $config['status_monitor_fields']);
|
||||||
|
} else if ($update != '') {
|
||||||
|
$fields_selected = (array) get_parameter('fields_selected');
|
||||||
|
|
||||||
|
if ($fields_selected[0] == '') {
|
||||||
|
$fields_selected = explode(',', $config['status_monitor_fields']);
|
||||||
|
} else {
|
||||||
|
$status_monitor_fields = implode(',', $fields_selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = [
|
||||||
|
'token' => 'status_monitor_fields',
|
||||||
|
'value' => $status_monitor_fields,
|
||||||
|
];
|
||||||
|
|
||||||
|
// update 'status_monitor_fields' in tconfig table to keep the value at update.
|
||||||
|
$result = db_process_sql_update(
|
||||||
|
'tconfig',
|
||||||
|
$values,
|
||||||
|
['token' => 'status_monitor_fields']
|
||||||
|
);
|
||||||
|
|
||||||
|
ui_print_result_message($result, __('Successfully updated'), __('Could not be updated'));
|
||||||
|
|
||||||
|
$config['status_monitor_fields'] = $status_monitor_fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fields_selected = [];
|
||||||
|
$status_monitor_fields = '';
|
||||||
|
$fields_selected = explode(',', $config['status_monitor_fields']);
|
||||||
|
|
||||||
|
$result_selected = [];
|
||||||
|
|
||||||
|
// show list of fields selected.
|
||||||
|
if ($fields_selected[0] != '') {
|
||||||
|
foreach ($fields_selected as $field_selected) {
|
||||||
|
switch ($field_selected) {
|
||||||
|
case 'policy':
|
||||||
|
$result = __('Policy');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'agent':
|
||||||
|
$result = __('Agent');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'data_type':
|
||||||
|
$result = __('Data type');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'module_name':
|
||||||
|
$result = __('Module name');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'server_type':
|
||||||
|
$result = __('Server type');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'interval':
|
||||||
|
$result = __('Interval');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'status':
|
||||||
|
$result = __('Status');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'graph':
|
||||||
|
$result = __('Graph');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'warn':
|
||||||
|
$result = __('Warn');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'data':
|
||||||
|
$result = __('Data');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'timestamp':
|
||||||
|
$result = __('Timestamp');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'to_critical':
|
||||||
|
$result = __('Last status change');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result_selected[$field_selected] = $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<h3>'.__('Show monitor detail fields').'</h3>';
|
||||||
|
|
||||||
|
$table = new stdClass();
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->class = 'databox filters';
|
||||||
|
|
||||||
|
$table->size = [];
|
||||||
|
// ~ $table->size[0] = '20%';
|
||||||
|
$table->size[1] = '10px';
|
||||||
|
// ~ $table->size[2] = '20%';
|
||||||
|
$table->style[0] = 'text-align:center;';
|
||||||
|
$table->style[2] = 'text-align:center;';
|
||||||
|
|
||||||
|
$table->data = [];
|
||||||
|
|
||||||
|
$fields_available = [];
|
||||||
|
|
||||||
|
$fields_available['policy'] = __('Policy');
|
||||||
|
$fields_available['agent'] = __('Agent');
|
||||||
|
$fields_available['data_type'] = __('Data type');
|
||||||
|
$fields_available['module_name'] = __('Module name');
|
||||||
|
$fields_available['server_type'] = __('Server type');
|
||||||
|
$fields_available['interval'] = __('Interval');
|
||||||
|
$fields_available['status'] = __('Status');
|
||||||
|
$fields_available['graph'] = __('Graph');
|
||||||
|
$fields_available['warn'] = __('Warn');
|
||||||
|
$fields_available['data'] = __('Data');
|
||||||
|
$fields_available['timestamp'] = __('Timestamp');
|
||||||
|
$fields_available['to_critical'] = __('Last status change');
|
||||||
|
|
||||||
|
// remove fields already selected
|
||||||
|
foreach ($fields_available as $key => $available) {
|
||||||
|
foreach ($result_selected as $selected) {
|
||||||
|
if ($selected == $available) {
|
||||||
|
unset($fields_available[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->data[0][0] = '<b>'.__('Fields available').'</b>';
|
||||||
|
$table->data[1][0] = html_print_select($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
|
||||||
|
$table->data[1][1] = '<a href="javascript:">'.html_print_image(
|
||||||
|
'images/darrowright.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'id' => 'right',
|
||||||
|
'title' => __('Add fields to select'),
|
||||||
|
]
|
||||||
|
).'</a>';
|
||||||
|
$table->data[1][1] .= '<br><br><br><br><a href="javascript:">'.html_print_image(
|
||||||
|
'images/darrowleft.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'id' => 'left',
|
||||||
|
'title' => __('Delete fields to select'),
|
||||||
|
]
|
||||||
|
).'</a>';
|
||||||
|
|
||||||
|
$table->data[0][1] = '';
|
||||||
|
$table->data[0][2] = '<b>'.__('Fields selected').'</b>';
|
||||||
|
$table->data[1][2] = html_print_select(
|
||||||
|
$result_selected,
|
||||||
|
'fields_selected[]',
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'width: 300px'
|
||||||
|
);
|
||||||
|
|
||||||
|
echo '<form id="custom_status_monitor" method="post" action="index.php?sec=view&sec2=operation/agentes/status_monitor§ion=fields&pure='.$config['pure'].'">';
|
||||||
|
html_print_table($table);
|
||||||
|
|
||||||
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
|
html_print_submit_button(__('Update'), 'upd_button', false, 'class="sub upd"');
|
||||||
|
echo '</form>';
|
||||||
|
echo '</div>';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* <![CDATA[ */
|
||||||
|
$(document).ready (function () {
|
||||||
|
|
||||||
|
$("#right").click (function () {
|
||||||
|
jQuery.each($("select[name='fields_available[]'] option:selected"), function (key, value) {
|
||||||
|
field_name = $(value).html();
|
||||||
|
if (field_name != <?php echo "'".__('None')."'"; ?>) {
|
||||||
|
id_field = $(value).attr('value');
|
||||||
|
$("select[name='fields_selected[]']").append($("<option></option>").html(field_name).attr("value", id_field));
|
||||||
|
$("#fields_available").find("option[value='" + id_field + "']").remove();
|
||||||
|
$("#fields_selected").find("option[value='0']").remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#left").click (function () {
|
||||||
|
var current_fields_size = ($('#fields_selected option').length);
|
||||||
|
var selected_fields = [];
|
||||||
|
var selected_fields_total = '';
|
||||||
|
|
||||||
|
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
|
||||||
|
field_name = $(value).html();
|
||||||
|
selected_fields.push(field_name);
|
||||||
|
selected_fields_total = selected_fields.length;
|
||||||
|
});
|
||||||
|
|
||||||
|
if(selected_fields_total === current_fields_size){
|
||||||
|
display_confirm_dialog(
|
||||||
|
"<?php echo '<span style=text-transform:none;font-size:9.5pt;>'.__('There must be at least one custom field. Timestamp will be set by default').'</span>'; ?>",
|
||||||
|
"<?php echo __('Confirm'); ?>",
|
||||||
|
"<?php echo __('Cancel'); ?>",
|
||||||
|
function () {
|
||||||
|
move_left();
|
||||||
|
$("#fields_available").find("option[value='timestamp']").remove();
|
||||||
|
$("select[name='fields_selected[]']").append($("<option></option>").val('timestamp').html('<i>' + 'Timestamp' + '</i>'));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
move_left();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#submit-upd_button").click(function () {
|
||||||
|
$("#fields_selected").find("option[value='0']").remove();
|
||||||
|
$('#fields_selected option').map(function() {
|
||||||
|
$(this).prop('selected', true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function move_left(){
|
||||||
|
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
|
||||||
|
field_name = $(value).html();
|
||||||
|
if (field_name != <?php echo "'".__('None')."'"; ?>) {
|
||||||
|
id_field = $(value).attr('value');
|
||||||
|
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
|
||||||
|
$("#fields_selected").find("option[value='" + id_field + "']").remove();
|
||||||
|
$("#fields_available").find("option[value='0']").remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
@ -37,12 +37,37 @@ enterprise_include_once('include/functions_metaconsole.php');
|
|||||||
$isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
|
$isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
|
||||||
|
|
||||||
if (! defined('METACONSOLE')) {
|
if (! defined('METACONSOLE')) {
|
||||||
// Header
|
$section = (string) get_parameter('section', 'view');
|
||||||
ui_print_page_header(
|
|
||||||
__('Monitor detail'),
|
$buttons['fields'] = [
|
||||||
'images/brick.png',
|
'active' => false,
|
||||||
false
|
'text' => '<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&section=fields">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
|
||||||
);
|
'operation' => true,
|
||||||
|
];
|
||||||
|
|
||||||
|
$buttons['view'] = [
|
||||||
|
'active' => false,
|
||||||
|
'text' => '<a href="index.php?sec=view&sec2=operation/agentes/status_monitor">'.html_print_image('images/list.png', true, ['title' => __('View')]).'</a>',
|
||||||
|
'operation' => true,
|
||||||
|
];
|
||||||
|
|
||||||
|
switch ($section) {
|
||||||
|
case 'fields':
|
||||||
|
$buttons['fields']['active'] = true;
|
||||||
|
$subpage = ' - '.__('Custom fields');
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$buttons['view']['active'] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_print_page_header(__('Monitor detail').$subpage, '', false, '', true, $buttons);
|
||||||
|
|
||||||
|
if ($section == 'fields') {
|
||||||
|
include_once $config['homedir'].'/godmode/agentes/status_monitor_custom_fields.php';
|
||||||
|
exit();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ui_meta_print_header(__('Monitor view'));
|
ui_meta_print_header(__('Monitor view'));
|
||||||
}
|
}
|
||||||
@ -1045,48 +1070,77 @@ if (!empty($result)) {
|
|||||||
$table->size = [];
|
$table->size = [];
|
||||||
$table->align = [];
|
$table->align = [];
|
||||||
|
|
||||||
|
$show_fields = explode(',', $config['status_monitor_fields']);
|
||||||
|
|
||||||
|
|
||||||
|
if (in_array('policy', $show_fields)) {
|
||||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||||
$table->head[0] = '<span title=\''.__('Policy').'\'>'.__('P.').'</span>';
|
$table->head[0] = '<span title=\''.__('Policy').'\'>'.__('P.').'</span>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('agent', $show_fields) || is_metaconsole()) {
|
||||||
$table->head[1] = __('Agent');
|
$table->head[1] = __('Agent');
|
||||||
$table->head[1] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&refr='.$refr.'&datatype='.$datatype.'&moduletype='.$moduletype.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=agent_alias&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectAgentNameUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&refr='.$refr.'&datatype='.$datatype.'&moduletype='.$moduletype.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=agent_alias&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectAgentNameDown, 'alt' => 'down']).'</a>';
|
$table->head[1] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&refr='.$refr.'&datatype='.$datatype.'&moduletype='.$moduletype.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=agent_alias&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectAgentNameUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&refr='.$refr.'&datatype='.$datatype.'&moduletype='.$moduletype.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=agent_alias&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectAgentNameDown, 'alt' => 'down']).'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('data_type', $show_fields) || is_metaconsole()) {
|
||||||
$table->head[2] = __('Data Type');
|
$table->head[2] = __('Data Type');
|
||||||
$table->head[2] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=type&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectTypeUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=type&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectTypeDown, 'alt' => 'down']).'</a>';
|
$table->head[2] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=type&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectTypeUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=type&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectTypeDown, 'alt' => 'down']).'</a>';
|
||||||
|
|
||||||
$table->align[2] = 'left';
|
$table->align[2] = 'left';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('module_name', $show_fields) || is_metaconsole()) {
|
||||||
$table->head[3] = __('Module name');
|
$table->head[3] = __('Module name');
|
||||||
$table->head[3] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=module_name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectModuleNameUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=module_name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectModuleNameDown, 'alt' => 'down']).'</a>';
|
$table->head[3] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=module_name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectModuleNameUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=module_name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectModuleNameDown, 'alt' => 'down']).'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('server_type', $show_fields) || is_metaconsole()) {
|
||||||
$table->head[4] = __('Server type');
|
$table->head[4] = __('Server type');
|
||||||
$table->head[4] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=moduletype&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectModuleNameUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=moduletype&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectModuleNameDown, 'alt' => 'down']).'</a>';
|
$table->head[4] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=moduletype&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectModuleNameUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=moduletype&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectModuleNameDown, 'alt' => 'down']).'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('interval', $show_fields) || is_metaconsole()) {
|
||||||
$table->head[5] = __('Interval');
|
$table->head[5] = __('Interval');
|
||||||
$table->head[5] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=interval&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectIntervalUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=interval&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectIntervalDown, 'alt' => 'down']).'</a>';
|
$table->head[5] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=interval&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectIntervalUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=interval&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectIntervalDown, 'alt' => 'down']).'</a>';
|
||||||
$table->align[5] = 'left';
|
$table->align[5] = 'left';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('status', $show_fields) || is_metaconsole()) {
|
||||||
$table->head[6] = __('Status');
|
$table->head[6] = __('Status');
|
||||||
$table->head[6] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=status&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectStatusUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=status&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectStatusDown, 'alt' => 'down']).'</a>';
|
$table->head[6] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=status&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectStatusUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=status&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectStatusDown, 'alt' => 'down']).'</a>';
|
||||||
|
|
||||||
$table->align[6] = 'left';
|
$table->align[6] = 'left';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('graph', $show_fields) || is_metaconsole()) {
|
||||||
$table->head[7] = __('Graph');
|
$table->head[7] = __('Graph');
|
||||||
$table->align[7] = 'left';
|
$table->align[7] = 'left';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('warn', $show_fields) || is_metaconsole()) {
|
||||||
$table->head[8] = __('Warn');
|
$table->head[8] = __('Warn');
|
||||||
$table->align[8] = 'left';
|
$table->align[8] = 'left';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('data', $show_fields) || is_metaconsole()) {
|
||||||
$table->head[9] = __('Data');
|
$table->head[9] = __('Data');
|
||||||
$table->align[9] = 'left';
|
$table->align[9] = 'left';
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole()) {
|
||||||
$table->head[9] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=data&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectStatusUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=data&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectStatusDown, 'alt' => 'down']).'</a>';
|
$table->head[9] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=data&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectStatusUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=data&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectStatusDown, 'alt' => 'down']).'</a>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('timestamp', $show_fields) || is_metaconsole()) {
|
||||||
$table->head[10] = __('Timestamp');
|
$table->head[10] = __('Timestamp');
|
||||||
$table->head[10] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=timestamp&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectTimestampUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=timestamp&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectTimestampDown, 'alt' => 'down']).'</a>';
|
$table->head[10] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=timestamp&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectTimestampUp, 'alt' => 'up']).'</a>'.'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params.'&sort_field=timestamp&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectTimestampDown, 'alt' => 'down']).'</a>';
|
||||||
$table->align[10] = 'left';
|
$table->align[10] = 'left';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('to_critical', $show_fields)) {
|
||||||
|
$table->head[11] = __('Last status change');
|
||||||
|
}
|
||||||
|
|
||||||
$id_type_web_content_string = db_get_value(
|
$id_type_web_content_string = db_get_value(
|
||||||
'id_tipo',
|
'id_tipo',
|
||||||
@ -1122,6 +1176,8 @@ if (!empty($result)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
|
if (in_array('policy', $show_fields) || is_metaconsole()) {
|
||||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole()) {
|
||||||
$node = metaconsole_get_connection_by_id($row['server_id']);
|
$node = metaconsole_get_connection_by_id($row['server_id']);
|
||||||
@ -1174,7 +1230,9 @@ if (!empty($result)) {
|
|||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('agent', $show_fields) || is_metaconsole()) {
|
||||||
$agent_alias = !empty($row['agent_alias']) ? $row['agent_alias'] : $row['agent_name'];
|
$agent_alias = !empty($row['agent_alias']) ? $row['agent_alias'] : $row['agent_name'];
|
||||||
|
|
||||||
// TODO: Calculate hash access before to use it more simply like other sections. I.E. Events view
|
// TODO: Calculate hash access before to use it more simply like other sections. I.E. Events view
|
||||||
@ -1199,8 +1257,9 @@ if (!empty($result)) {
|
|||||||
$data[1] .= ui_print_truncate_text($agent_alias, 'agent_medium', false, true, false, '[…]', 'font-size:7.5pt;');
|
$data[1] .= ui_print_truncate_text($agent_alias, 'agent_medium', false, true, false, '[…]', 'font-size:7.5pt;');
|
||||||
$data[1] .= '</a></strong>';
|
$data[1] .= '</a></strong>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('data_type', $show_fields) || is_metaconsole()) {
|
||||||
$data[2] = html_print_image('images/'.modules_show_icon_type($row['module_type']), true);
|
$data[2] = html_print_image('images/'.modules_show_icon_type($row['module_type']), true);
|
||||||
$agent_groups = is_metaconsole() ? $row['groups_in_server'] : agents_get_all_groups_agent($row['id_agent'], $row['id_group']);
|
$agent_groups = is_metaconsole() ? $row['groups_in_server'] : agents_get_all_groups_agent($row['id_agent'], $row['id_group']);
|
||||||
if (check_acl_one_of_groups($config['id_user'], $agent_groups, 'AW')) {
|
if (check_acl_one_of_groups($config['id_user'], $agent_groups, 'AW')) {
|
||||||
@ -1227,7 +1286,9 @@ if (!empty($result)) {
|
|||||||
).'</a>';
|
).'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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'], 'agent_small', false, true, true);
|
||||||
if ($row['extended_info'] != '') {
|
if ($row['extended_info'] != '') {
|
||||||
$data[3] .= ui_print_help_tip($row['extended_info'], true, '/images/default_list.png');
|
$data[3] .= ui_print_help_tip($row['extended_info'], true, '/images/default_list.png');
|
||||||
@ -1243,11 +1304,18 @@ if (!empty($result)) {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('server_type', $show_fields) || is_metaconsole()) {
|
||||||
$data[4] = servers_show_type($row['id_modulo']);
|
$data[4] = servers_show_type($row['id_modulo']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (in_array('interval', $show_fields) || is_metaconsole()) {
|
||||||
$data[5] = ($row['module_interval'] == 0) ? human_time_description_raw($row['agent_interval']) : human_time_description_raw($row['module_interval']);
|
$data[5] = ($row['module_interval'] == 0) ? human_time_description_raw($row['agent_interval']) : human_time_description_raw($row['module_interval']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('status', $show_fields) || is_metaconsole()) {
|
||||||
if ($row['utimestamp'] == 0 && (($row['module_type'] < 21
|
if ($row['utimestamp'] == 0 && (($row['module_type'] < 21
|
||||||
|| $row['module_type'] > 23) && $row['module_type'] != 100)
|
|| $row['module_type'] > 23) && $row['module_type'] != 100)
|
||||||
) {
|
) {
|
||||||
@ -1352,7 +1420,9 @@ if (!empty($result)) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('graph', $show_fields) || is_metaconsole()) {
|
||||||
$data[7] = '';
|
$data[7] = '';
|
||||||
|
|
||||||
$acl_graphs = false;
|
$acl_graphs = false;
|
||||||
@ -1406,7 +1476,9 @@ if (!empty($result)) {
|
|||||||
$data[7] .= '<span id=\'hidden_name_module_'.$row['id_agente_modulo'].'\'
|
$data[7] .= '<span id=\'hidden_name_module_'.$row['id_agente_modulo'].'\'
|
||||||
style=\'display: none;\'>'.$row['module_name'].'</span>';
|
style=\'display: none;\'>'.$row['module_name'].'</span>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('warn', $show_fields) || is_metaconsole()) {
|
||||||
$data[8] = ui_print_module_warn_value(
|
$data[8] = ui_print_module_warn_value(
|
||||||
$row['max_warning'],
|
$row['max_warning'],
|
||||||
$row['min_warning'],
|
$row['min_warning'],
|
||||||
@ -1544,9 +1616,13 @@ if (!empty($result)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('data', $show_fields) || is_metaconsole()) {
|
||||||
$data[9] = $salida;
|
$data[9] = $salida;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('timestamp', $show_fields) || is_metaconsole()) {
|
||||||
if ($row['module_interval'] > 0) {
|
if ($row['module_interval'] > 0) {
|
||||||
$interval = $row['module_interval'];
|
$interval = $row['module_interval'];
|
||||||
} else {
|
} else {
|
||||||
@ -1563,6 +1639,12 @@ if (!empty($result)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data[10] = ui_print_timestamp($row['utimestamp'], true, $option);
|
$data[10] = ui_print_timestamp($row['utimestamp'], true, $option);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('to_critical', $show_fields)) {
|
||||||
|
$change_status_timestamp = db_get_sql('SELECT utimestamp FROM tevento WHERE id_agentmodule='.$row['id_agente_modulo'].' ORDER BY utimestamp DESC');
|
||||||
|
$data[11] = ui_print_timestamp($change_status_timestamp, true, $option);
|
||||||
|
}
|
||||||
|
|
||||||
array_push($table->data, $data);
|
array_push($table->data, $data);
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||||||
('netflow_nfdump', '/usr/bin/nfdump'),
|
('netflow_nfdump', '/usr/bin/nfdump'),
|
||||||
('netflow_max_resolution', '50'),
|
('netflow_max_resolution', '50'),
|
||||||
('event_fields', 'evento,id_agente,estado,timestamp'),
|
('event_fields', 'evento,id_agente,estado,timestamp'),
|
||||||
|
('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'),
|
||||||
('list_ACL_IPs_for_API', '127.0.0.1'),
|
('list_ACL_IPs_for_API', '127.0.0.1'),
|
||||||
('enable_pass_policy', 0),
|
('enable_pass_policy', 0),
|
||||||
('pass_size', 4),
|
('pass_size', 4),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user