Merge branch 'fix/styles' into 'develop'

Fix/styles

See merge request artica/pandorafms!2461
This commit is contained in:
Alejandro Fraguas 2019-05-29 18:31:43 +02:00
commit bc279e99b0
43 changed files with 3642 additions and 1721 deletions

View File

@ -1,17 +1,32 @@
<?php
/**
* Extension to schedule tasks on Pandora FMS Console
*
* @category Agent editor/ builder.
* @package Pandora FMS
* @subpackage Classic agent management view.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
// Begin.
enterprise_include('godmode/agentes/agent_manager.php');
require_once 'include/functions_clippy.php';
@ -30,23 +45,19 @@ if (is_ajax()) {
$id_agent = (int) get_parameter('id_agent');
$string = (string) get_parameter('q');
// q is what autocomplete plugin gives
// Field q is what autocomplete plugin gives.
$filter = [];
switch ($config['dbtype']) {
case 'mysql':
case 'postgresql':
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%" OR alias LIKE "%'.$string.'%")';
break;
case 'oracle':
$filter[] = '(upper(nombre) LIKE upper(\'%'.$string.'%\') OR upper(direccion) LIKE upper(\'%'.$string.'%\') OR upper(comentarios) LIKE upper(\'%'.$string.'%\') OR upper(alias) LIKE upper(\'%'.$string.'%\'))';
break;
}
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%" OR alias LIKE "%'.$string.'%")';
$filter[] = 'id_agente != '.$id_agent;
$agents = agents_get_agents($filter, ['id_agente', 'nombre', 'direccion']);
$agents = agents_get_agents(
$filter,
[
'id_agente',
'nombre',
'direccion',
]
);
if ($agents === false) {
$agents = [];
}
@ -78,7 +89,7 @@ if (is_ajax()) {
$out = false;
foreach ($idSNMP as $id) {
foreach ($snmp[$id] as $key => $value) {
// Check if it has "ifXXXX" syntax and skip it
// Check if it has "ifXXXX" syntax and skip it.
if (! preg_match('/if/', $key)) {
continue;
}
@ -98,7 +109,7 @@ if (is_ajax()) {
echo io_json_mb_encode($out);
}
// And and remove groups use the same function
// And and remove groups use the same function.
$add_secondary_groups = get_parameter('add_secondary_groups');
$remove_secondary_groups = get_parameter('remove_secondary_groups');
if ($add_secondary_groups || $remove_secondary_groups) {
@ -114,12 +125,12 @@ if (is_ajax()) {
'agents_update_secondary_groups',
[
$id_agent,
$add_secondary_groups ? $groups_to_add : [],
$remove_secondary_groups ? $groups_to_add : [],
($add_secondary_groups) ? $groups_to_add : [],
($remove_secondary_groups) ? $groups_to_add : [],
]
);
// Echo 0 in case of error. 0 Otherwise.
echo $ret ? 1 : 0;
echo ($ret) ? 1 : 0;
}
}
@ -149,7 +160,7 @@ if ($new_agent) {
}
if (!$new_agent) {
// Agent remote configuration editor
// Agent remote configuration editor.
enterprise_include_once('include/functions_config_agents.php');
if (enterprise_installed()) {
$filename = config_agents_get_agent_config_filenames($id_agente);
@ -157,27 +168,41 @@ if (!$new_agent) {
}
$disk_conf_delete = (bool) get_parameter('disk_conf_delete');
// Agent remote configuration DELETE
// Agent remote configuration DELETE.
if ($disk_conf_delete) {
// TODO: Get this working on computers where the Pandora server(s) are not on the webserver
// TODO: Get a remote_config editor working in the open version
// TODO: Get a remote_config editor working in the open version.
@unlink($filename['md5']);
@unlink($filename['conf']);
}
echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">';
echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
// Custom ID.
$custom_id_div = '<div class="label_select">';
$custom_id_div .= '<p class="input_label">'.__('Custom ID').': </p>';
$custom_id_div .= html_print_input_text(
'custom_id',
$custom_id,
'',
16,
255,
true,
false,
false,
'',
'agent_custom_id'
).'</div>';
if (!$new_agent && $alias != '') {
$table_agent_name = '<div class="label_select"><p class="input_label">'.__('Agent name').': '.ui_print_help_tip(__("The agent's name must be the same as the one defined at the console"), true).'</p>';
$table_agent_name .= '<div class="label_select_parent">';
$table_agent_name .= '<div class="label_select_child_left">'.html_print_input_text('agente', $nombre_agente, '', 50, 100, true).'</div>';
$table_agent_name .= '<div class="label_select_child_right agent_options_agent_name">';
$table_qr_code = '<div class="agent_qr white_box"><p class="input_label">'.__('QR Code Agent view').': </p>';
$table_agent_name .= '<div class="label_select_child_left" style="width: 60%;">'.html_print_input_text('agente', $nombre_agente, '', 50, 100, true).'</div>';
$table_agent_name .= '<div class="label_select_child_right agent_options_agent_name" style="width: 40%;">';
if ($id_agente) {
$table_agent_name .= '<span>'.__('ID').' '.$id_agente.'</span>';
$table_agent_name .= '<a href="index.php?sec=gagente&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'">';
$table_agent_name .= '<label>'.__('ID').'</label><input style="width: 50%;" type="text" disabled="true" value="'.$id_agente.'" />';
$table_agent_name .= '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
$table_agent_name .= html_print_image(
'images/zoom.png',
true,
@ -192,7 +217,15 @@ if (!$new_agent && $alias != '') {
$agent_options_update = 'agent_options_update';
// Delete link from here.
$table_agent_name .= "<a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=$id_agente&search=&offset=0&sort_field=&sort=none'>".html_print_image('images/cross.png', true, ['title' => __('Delete agent')]).'</a>';
$table_agent_name .= "<a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=".$id_agente."&search=&offset=0&sort_field=&sort=none'>".html_print_image('images/cross.png', true, ['title' => __('Delete agent')]).'</a>';
// Help link.
$table_agent_name .= ui_print_help_icon(
$help_header,
true,
'',
'images/help_g.png'
);
// Remote configuration available.
if (isset($filename)) {
@ -201,7 +234,7 @@ if (!$new_agent && $alias != '') {
$agent_name = io_safe_output($agent_name);
$agent_md5 = md5($agent_name, false);
$table_agent_name .= '<a href="index.php?'.'sec=gagente&amp;'.'sec2=godmode/agentes/configurar_agente&amp;'.'tab=remote_configuration&amp;'.'id_agente='.$id_agente.'&amp;'.'disk_conf='.$agent_md5.'">';
$table_agent_name .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$id_agente.'&disk_conf='.$agent_md5.'">';
$table_agent_name .= html_print_image(
'images/application_edit.png',
true,
@ -218,6 +251,19 @@ if (!$new_agent && $alias != '') {
}
$table_agent_name .= '</div></div></div>';
// QR code div.
$table_qr_code = '<div class="agent_qr white_box">';
$table_qr_code .= '<p class="input_label">'.__('QR Code Agent view').': </p>';
$table_qr_code .= '<div id="qr_container_image"></div>';
if ($id_agente) {
$table_qr_code .= "<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"".ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente)."\" );'></a>";
}
// Add Custom id div.
$table_qr_code .= '<br />';
$table_qr_code .= $custom_id_div;
$table_qr_code .= '</div>';
}
if ($new_agent) {
@ -257,14 +303,6 @@ if ($id_agente) {
}
</style>
<?php
if (!$new_agent && $alias != '') {
if ($id_agente) {
$table_qr_code .= "<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"".ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente)."\" );'></a>";
}
$table_qr_code .= '</div>';
}
$groups = users_get_groups($config['id_user'], 'AR', false);
$modules = db_get_all_rows_sql(
@ -295,7 +333,21 @@ $table_primary_group .= '</span></div></div></div>';
$table_interval = '<div class="label_select"><p class="input_label">'.__('Interval').': </p>';
$table_interval .= '<div class="label_select_parent">';
$table_interval .= html_print_extended_select_for_time('intervalo', $intervalo, '', '', '0', 10, true);
$table_interval .= html_print_extended_select_for_time(
'intervalo',
$intervalo,
'',
'',
'0',
10,
true,
false,
true,
'w40p'
);
if ($intervalo < SECONDS_5MINUTES) {
$table_interval .= clippy_context_help('interval_agent_min');
}
@ -341,20 +393,21 @@ $table_server .= html_print_select(
__('None'),
0,
true
).'<div class="label_select_child_icons"></div></div></div>';
).'<div class="label_select_child_icons">'.ui_print_help_icon('agent_server', true).'</div></div></div>';
// Description.
$table_description = '<div class="label_select"><p class="input_label">'.__('Description').': </p>';
$table_description .= html_print_input_text(
$table_description .= html_print_textarea(
'comentarios',
3,
10,
$comentarios,
'',
45,
200,
true
true,
'agent_description'
).'</div>';
// QR code.
echo '<div class="first_row">
<div class="agent_options '.$agent_options_update.' white_box">
<div class="agent_options_column_left">'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'</div>
@ -368,46 +421,46 @@ echo '</div>';
if (enterprise_installed()) {
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
$table_adv_secondary_groups = '<div class="label_select"><p class="input_label">'.__('Secondary groups').':</p></div>';
$table_adv_secondary_groups = '<div class="label_select"><p class="input_label">'.__('Secondary groups').': '.ui_print_help_icon('secondary_groups', true).'</p></div>';
$table_adv_secondary_groups_left = html_print_select_groups(
false,
// Use the current user to select the groups
// Use the current user to select the groups.
'AR',
// ACL permission
// ACL permission.
false,
// Not all group
// Not all group.
'secondary_groups',
// HTML id
// HTML id.
'',
// No select any by default
// No select any by default.
'',
// Javascript onChange code
// Javascript onChange code.
'',
// Do not user no selected value
// Do not user no selected value.
0,
// Do not use no selected value
// Do not use no selected value.
true,
// Return HTML (not echo)
// Return HTML (not echo).
true,
// Multiple selection
// Multiple selection.
true,
// Sorting by default
// Sorting by default.
'',
// CSS classnames (default)
// CSS classnames (default).
false,
// Not disabled (default)
'width:50%; min-width:170px; text-align:center',
// Inline styles (default)
// Not disabled (default).
'width:50%; min-width:170px;',
// Inline styles (default).
false,
// Option style select (default)
// Option style select (default).
false,
// Do not truncate the users tree (default)
// Do not truncate the users tree (default).
'id_grupo',
// Key to get as value (default)
// Key to get as value (default).
false,
// Not strict user (default)
// Not strict user (default).
$secondary_groups_selected['plain']
// Do not show the primary group in this selection
// Do not show the primary group in this selection.
);
$table_adv_secondary_groups_arrows = html_print_input_image(
@ -436,32 +489,32 @@ if (enterprise_installed()) {
$table_adv_secondary_groups_right .= html_print_select(
$secondary_groups_selected['for_select'],
// Values
// Values.
'secondary_groups_selected',
// HTML id
// HTML id.
'',
// Selected
// Selected.
'',
// Javascript onChange code
// Javascript onChange code.
'',
// Nothing selected
// Nothing selected.
0,
// Nothing selected
// Nothing selected.
true,
// Return HTML (not echo)
// Return HTML (not echo).
true,
// Multiple selection
// Multiple selection.
true,
// Sort
// Sort.
'',
// Class
// Class.
false,
// Disabled
'width:50%; min-width:170px; text-align:center'
// Style
// Disabled.
'width:50%; min-width:170px;'
// Style.
);
// safe operation mode
// Safe operation mode.
if ($id_agente) {
$sql_modules = db_get_all_rows_sql(
'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
@ -485,13 +538,13 @@ if (enterprise_installed()) {
$table_adv_safe .= __('Module').'&nbsp;'.html_print_select($safe_mode_modules, 'safe_mode_module', $safe_mode_module, '', '', 0, true).'</div>';
}
// Remote configuration
// Remote configuration.
$table_adv_remote = '<div class="label_select"><p class="input_label">'.__('Remote configuration').': </p>';
if (!$new_agent && isset($filename) && file_exists($filename['md5'])) {
$table_adv_remote .= date('F d Y H:i:s', fileatime($filename['md5']));
// Delete remote configuration
$table_adv_remote .= '<a href="index.php?'.'sec=gagente&amp;'.'sec2=godmode/agentes/configurar_agente&amp;'.'tab=main&amp;'.'disk_conf_delete=1&amp;'.'id_agente='.$id_agente.'">';
// Delete remote configuration.
$table_adv_remote .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&disk_conf_delete=1&id_agente='.$id_agente.'">';
$table_adv_remote .= html_print_image(
'images/cross.png',
true,
@ -510,26 +563,29 @@ if (enterprise_installed()) {
$table_adv_remote .= '</div>';
$cps_array[-1] = __('Disabled');
if ($cps > 0) {
$cps_array[$cps] = __('Enabled');
} else {
$cps_inc = 0;
if ($id_agente) {
$cps_inc = service_agents_cps($id_agente);
}
$cps_array[$cps_inc] = __('Enabled');
// Calculate cps value - agents.
if ($id_agente) {
$cps_val = service_agents_cps($id_agente);
} else {
// No agent defined, use received cps as base value.
if ($cps >= 0) {
$cps_val = $cps;
}
}
$table_adv_cascade = '<div class="label_select"><p class="input_label">'.__('Cascade protection services').': ';
$table_adv_cascade .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true).'</p>';
$table_adv_cascade .= html_print_select($cps_array, 'cps', $cps, '', '', 0, true).'</div>';
$cps_html = '<div class="label_select"><div class="label_simple_items">';
$cps_html .= html_print_checkbox_switch('cps', $cps_val, ($cps >= 0), true);
$cps_html .= __('Cascade protection services').'&nbsp;'.ui_print_help_icon('cascade_protection', true);
$cps_html .= ui_print_help_tip(
__('Alerts and events will be managed by the service joined by this agent.'),
true
);
$cps_html .= '</div></div>';
$table_adv_cascade .= $cps_html;
}
// Custom ID
$table_adv_custom_id = '<div class="label_select"><p class="input_label">'.__('Custom ID').': </p>';
$table_adv_custom_id .= html_print_input_text('custom_id', $custom_id, '', 16, 255, true).'</div>';
$table_adv_parent = '<div class="label_select"><p class="input_label">'.__('Parent').': </p>';
$params = [];
@ -546,13 +602,26 @@ $params['cascade_protection'] = true;
$table_adv_parent .= '<div class="label_simple_items">';
$table_adv_parent .= ui_print_agent_autocomplete_input($params);
if (enterprise_installed()) {
$table_adv_parent .= html_print_checkbox_switch('cascade_protection', 1, $cascade_protection, true).__('Cascade protection').'&nbsp;';
$table_adv_parent .= html_print_checkbox_switch(
'cascade_protection',
1,
$cascade_protection,
true
).__('Cascade protection').'&nbsp;'.ui_print_help_icon('cascade_protection', true);
}
$table_adv_parent .= __('Module').'&nbsp;'.html_print_select($modules_values, 'cascade_protection_module', $cascade_protection_module, '', '', 0, true).'</div></div>';
$table_adv_parent .= __('Module').'&nbsp;'.html_print_select(
$modules_values,
'cascade_protection_module',
$cascade_protection_module,
'',
'',
0,
true
).'</div></div>';
// Learn mode / Normal mode
$table_adv_module_mode = '<div class="label_select"><p class="input_label">'.__('Module definition').':</p>';
// Learn mode / Normal mode.
$table_adv_module_mode = '<div class="label_select"><p class="input_label">'.__('Module definition').': '.ui_print_help_icon('module_definition', true).'</p>';
$table_adv_module_mode .= '<div class="switch_radio_button">';
$table_adv_module_mode .= html_print_radio_button_extended(
'modo',
@ -586,9 +655,14 @@ $table_adv_module_mode .= html_print_radio_button_extended(
);
$table_adv_module_mode .= '</div></div>';
// Status (Disabled / Enabled)
// Status (Disabled / Enabled).
$table_adv_status = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Disabled').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'</p>';
$table_adv_status .= html_print_checkbox_switch('disabled', 1, $disabled, true).'</div>';
$table_adv_status .= html_print_checkbox_switch(
'disabled',
1,
$disabled,
true
).'</div>';
// Url address.
if (enterprise_installed()) {
@ -625,11 +699,11 @@ foreach ($listIcons as $index => $value) {
}
$path = 'images/gis_map/icons/';
// TODO set better method the path
// TODO set better method the path.
$table_adv_agent_icon = '<div class="label_select"><p class="input_label">'.__('Agent icon').': '.ui_print_help_tip(__('Agent icon for GIS Maps.'), true).'</p>';
if ($icon_path == '') {
$display_icons = 'none';
// Hack to show no icon. Use any given image to fix not found image errors
// Hack to show no icon. Use any given image to fix not found image errors.
$path_without = 'images/spinner.png';
$path_default = 'images/spinner.png';
$path_ok = 'images/spinner.png';
@ -686,6 +760,7 @@ if ($config['activate_gis']) {
// General display distribution.
$table_adv_options = $table_adv_secondary_groups.'<div class="secondary_groups_select" style="margin-bottom:30px;">
<div class="secondary_groups_list_left">
'.$table_adv_secondary_groups_left.'
@ -698,7 +773,14 @@ $table_adv_options = $table_adv_secondary_groups.'<div class="secondary_groups_s
</div>
</div>
<div class="agent_options agent_options_adv">
<div class="agent_options_column_left" >'.$table_adv_parent.$table_adv_custom_id.$table_adv_module_mode.$table_adv_cascade.$table_adv_gis.'</div>
<div class="agent_options_column_left" >'.$table_adv_parent.$table_adv_module_mode.$table_adv_cascade;
if ($new_agent) {
// If agent is new, show custom id as old style format.
$table_adv_options .= $custom_id_div;
}
$table_adv_options .= $table_adv_gis.'</div>
<div class="agent_options_column_right" >'.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'</div>
</div>';
@ -711,10 +793,17 @@ $table = new stdClass();
$table->width = '100%';
$table->class = 'custom_fields_table';
$table->head = [];
$table->head = [
0 => __('Click to display').ui_print_help_tip(
__('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'),
true
),
];
$table->class = 'info_table';
$table->style = [];
$table->style[0] = 'font-weight: bold;';
$table->data = [];
$table->rowstyle = [];
$fields = db_get_all_fields_in_table('tagent_custom_fields');
@ -722,15 +811,12 @@ if ($fields === false) {
$fields = [];
}
$i = 0;
foreach ($fields as $field) {
$id_custom_field = $field['id_field'];
$data[0] = '<div class="field_title" onclick="show_custom_field_row('.$id_custom_field.')">';
$data[0] .= '<b>'.$field['name'].'</b>';
$data[0] .= ui_print_help_tip(
__('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'),
true
);
$data[0] .= '</div>';
$combo = [];
$combo = $field['combo_values'];
@ -753,6 +839,13 @@ foreach ($fields as $field) {
$custom_value = '';
}
$table->rowstyle[$i] = 'cursor: pointer;';
if (!empty($custom_value)) {
$table->rowstyle[($i + 1)] = 'display: table-row;';
} else {
$table->rowstyle[($i + 1)] = 'display: none;';
}
if ($field['is_password_type']) {
$data_field[1] = html_print_input_text_extended(
'customvalue_'.$field['id_field'],
@ -801,21 +894,28 @@ foreach ($fields as $field) {
};
$table->rowid[] = 'name_field-'.$id_custom_field;
array_push($table->data, $data);
$table->data[] = $data;
$table->rowid[] = 'field-'.$id_custom_field;
array_push($table->data, $data_field);
$table->data[] = $data_field;
$i += 2;
}
if (!empty($fields)) {
echo '<div class="ui_toggle">';
ui_toggle(html_print_table($table, true), __('Custom fields'), '', true, false, 'white_box white_box_opened');
ui_toggle(
html_print_table($table, true),
__('Custom fields'),
'',
true,
false,
'white_box white_box_opened'
);
echo '</div>';
}
echo '<div class="action-buttons" style="display: flex; justify-content: flex-end; align-items: center; width: '.$table->width.'">';
// The context help about the learning mode.
if ($modo == 0) {
echo "<span id='modules_not_learning_mode_context_help' style='padding-right:8px;'>";

View File

@ -1,17 +1,32 @@
<?php
/**
* Configure agents.
*
* @category Agents view - management.
* @package Pandora FMS
* @subpackage User interface.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars.
// Begin.
global $config;
enterprise_include('godmode/agentes/configurar_agente.php');
@ -20,6 +35,7 @@ enterprise_include_once('include/functions_modules.php');
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_cron.php';
ui_require_javascript_file('encode_decode_base64');
ui_require_css_file('agent_manager');
check_login();
@ -194,7 +210,7 @@ if ($create_agent) {
$update_gis_data = (int) get_parameter_post('update_gis_data', 0);
$url_description = (string) get_parameter('url_description');
$quiet = (int) get_parameter('quiet', 0);
$cps = (int) get_parameter('cps', 0);
$cps = (int) get_parameter_switch('cps', -1);
$secondary_groups = (string) get_parameter('secondary_hidden', '');
$fields = db_get_all_fields_in_table('tagent_custom_fields');
@ -325,7 +341,7 @@ if ($create_agent) {
$unsafe_alias = io_safe_output($alias);
db_pandora_audit(
'Agent management',
"Created agent $unsafe_alias",
'Created agent '.$unsafe_alias,
false,
true,
$info
@ -489,7 +505,7 @@ if ($id_agente) {
$agent_name = io_safe_output($agent_name);
$agent_md5 = md5($agent_name, false);
$remote_configuration_tab['text'] = '<a href="index.php?'.'sec=gagente&amp;'.'sec2=godmode/agentes/configurar_agente&amp;'.'tab=remote_configuration&amp;'.'id_agente='.$id_agente.'&amp;'.'disk_conf='.$agent_md5.'">'.html_print_image(
$remote_configuration_tab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=remote_configuration&amp;id_agente='.$id_agente.'&amp;disk_conf='.$agent_md5.'">'.html_print_image(
'images/remote_configuration.png',
true,
['title' => __('Remote configuration')]
@ -575,20 +591,24 @@ if ($id_agente) {
}
$help_header = '';
$tab_name = '';
// This add information to the header.
switch ($tab) {
case 'main':
$tab_description = '- '.__('Setup');
$help_header = 'main_tab';
$tab_name = 'Setup';
break;
case 'collection':
$tab_description = '- '.__('Collection');
$tab_name = 'Collection';
break;
case 'inventory':
$tab_description = '- '.__('Inventory');
$help_header = 'inventory_tab';
$tab_name = 'Inventory';
break;
case 'plugins':
@ -599,6 +619,7 @@ if ($id_agente) {
case 'module':
$type_module_t = get_parameter('moduletype', '');
$tab_description = '- '.__('Modules');
$tab_name = 'Modules';
if ($type_module_t == 'webux') {
$help_header = 'wux_console';
} else {
@ -609,10 +630,12 @@ if ($id_agente) {
case 'alert':
$tab_description = '- '.__('Alert');
$help_header = 'manage_alert_list';
$tab_name = 'Alerts';
break;
case 'template':
$tab_description = '- '.__('Templates');
$tab_name = 'Module templates';
break;
case 'gis':
@ -633,16 +656,19 @@ if ($id_agente) {
case 'snmp_explorer':
$tab_description = '- '.__('SNMP Wizard');
$help_header = 'agent_snmp_explorer_tab';
$tab_name = 'SNMP Wizard';
break;
case 'snmp_interfaces_explorer':
$tab_description = '- '.__('SNMP Interfaces wizard');
$help_header = 'agent_snmp_interfaces_explorer_tab';
$tab_name = 'SNMP Interfaces wizard';
break;
case 'wmi_explorer':
$tab_description = '- '.__('WMI Wizard');
$help_header = 'agent_snmp_wmi_explorer_tab';
$tab_name = 'WMI Wizard';
break;
default:
@ -674,12 +700,21 @@ if ($id_agente) {
agents_get_alias($id_agente),
'images/setup.png',
false,
$help_header,
// Previous: $help_header.
'',
true,
$onheader,
false,
'',
$config['item_title_size_text']
$config['item_title_size_text'],
'',
ui_print_breadcrums(
[
__('Resources'),
__('Manage agents'),
'<span class="breadcrumb_active">'.$tab_name.'</span>',
]
)
);
} else {
// Create agent.
@ -688,7 +723,19 @@ if ($id_agente) {
'images/bricks.png',
false,
'create_agent',
true
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
ui_print_breadcrums(
[
__('Resources'),
__('Manage agents'),
'<span class="breadcrumb_active">'.__('Create agent').'</span>',
]
)
);
}
@ -829,8 +876,7 @@ if ($update_agent) {
$update_gis_data = (int) get_parameter_post('update_gis_data', 0);
$url_description = (string) get_parameter('url_description');
$quiet = (int) get_parameter('quiet', 0);
$cps = (int) get_parameter('cps', 0);
$cps = get_parameter_switch('cps', -1);
$old_values = db_get_row('tagente', 'id_agente', $id_agente);
$fields = db_get_all_fields_in_table('tagent_custom_fields');
@ -978,7 +1024,7 @@ if ($update_agent) {
[
$id_agente,
'standby',
$disabled ? '1' : '0',
($disabled) ? '1' : '0',
]
);
// Validate alerts for disabled agents.
@ -1064,7 +1110,7 @@ if ($update_agent) {
ui_print_success_message(__('Successfully updated'));
db_pandora_audit(
'Agent management',
"Updated agent $alias",
'Updated agent '.$alias,
false,
false,
$info
@ -1206,7 +1252,7 @@ if ($update_module || $create_module) {
}
if ($id_module_type == 25) {
// web analysis, from MODULE_WUX.
// Web analysis, from MODULE_WUX.
$custom_string_1 = base64_encode((string) get_parameter('custom_string_1', $custom_string_1_default));
$custom_integer_1 = (int) get_parameter('custom_integer_1', $custom_integer_1_default);
} else {
@ -1252,12 +1298,11 @@ if ($update_module || $create_module) {
foreach ($conf_array as $line) {
if (preg_match('/^module_name\s*(.*)/', $line, $match)) {
$new_configuration_data .= 'module_name '.io_safe_output($name)."\n";
}
// We delete from conf all the module macros starting with _field.
else if (!preg_match('/^module_macro_field.*/', $line, $match)) {
$new_configuration_data .= "$line\n";
$new_configuration_data .= 'module_name ';
$new_configuration_data .= io_safe_output($name)."\n";
} else if (!preg_match('/^module_macro_field.*/', $line, $match)) {
// We delete from conf all the module macros starting with _field.
$new_configuration_data .= $line."\n";
}
}
@ -1419,9 +1464,13 @@ if ($update_module || $create_module) {
}
$active_snmp_v3 = get_parameter('active_snmp_v3');
if ($active_snmp_v3) {
// LOST CODE?
}
/*
* if ($active_snmp_v3) {
* // LOST CODE?.
*
* }
*/
$throw_unknown_events = (bool) get_parameter('throw_unknown_events', false);
// Set the event type that can show.
@ -1586,7 +1635,7 @@ if ($update_module) {
db_pandora_audit(
'Agent management',
"Fail to try update module '$name' for agent ".$agent['alias']
"Fail to try update module '".$name."' for agent ".$agent['alias']
);
} else {
if ($prediction_module == 3) {
@ -1610,7 +1659,7 @@ if ($update_module) {
db_pandora_audit(
'Agent management',
"Updated module '$name' for agent ".$agent['alias'],
"Updated module '".$name."' for agent ".$agent['alias'],
false,
false,
io_json_mb_encode($values)
@ -1764,7 +1813,7 @@ if ($create_module) {
$moduletype = $id_module;
db_pandora_audit(
'Agent management',
'Fail to try added module '.$name.' for agent '.$agent['alias']
"Fail to try added module '".$name."' for agent ".$agent['alias']
);
} else {
if ($prediction_module == 3) {
@ -1789,7 +1838,7 @@ if ($create_module) {
$agent = db_get_row('tagente', 'id_agente', $id_agente);
db_pandora_audit(
'Agent management',
"Added module '$name' for agent ".$agent['alias'],
"Added module '".$name."' for agent ".$agent['alias'],
false,
true,
io_json_mb_encode($values)

View File

@ -516,14 +516,22 @@ if ($tab == 'tree') {
$table = new StdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->headstyle = [];
$table->head = [];
$table->head[0] = __('ID');
$table->headstyle[0] = 'min-width: 100px;';
$table->head[1] = __('Name');
$table->headstyle[1] = 'min-width: 100px;';
$table->head[2] = __('Icon');
$table->headstyle[2] = 'min-width: 100px;';
$table->head[3] = __('Alerts');
$table->headstyle[3] = 'min-width: 100px;';
$table->head[4] = __('Parent');
$table->headstyle[4] = 'min-width: 100px;';
$table->head[5] = __('Description');
$table->headstyle[5] = 'min-width: 100px;';
$table->head[6] = __('Actions');
$table->headstyle[6] = 'min-width: 100px;';
$table->align = [];
$table->align[0] = 'left';
$table->align[2] = 'left';

View File

@ -760,6 +760,9 @@ switch ($action) {
$table->head = [];
$table->align = [];
$table->headstyle = [];
$table->style = [];
$table->align[2] = 'left';
$table->align[3] = 'left';
$table->align[4] = 'left';
@ -771,11 +774,21 @@ switch ($action) {
$table->size[0] = '20%';
$table->size[1] = '30%';
$table->size[2] = '2%';
$table->headstyle[2] = 'min-width: 35px;';
$table->size[3] = '2%';
$table->headstyle[3] = 'min-width: 35px;';
$table->size[4] = '2%';
$table->headstyle[4] = 'min-width: 35px;';
$table->size[5] = '2%';
$table->headstyle[5] = 'min-width: 35px;';
$table->size[6] = '2%';
$table->size['csv'] = '5%';
$table->headstyle[6] = 'min-width: 35px;';
$table->size[7] = '5%';
$table->headstyle['csv'] = 'min-width: 65px;';
$table->style[7] = 'text-align: center;';
$table->headstyle[9] = 'min-width: 100px;';
$table->style[9] = 'text-align: center;';
$next = 4;
// Calculate dinamically the number of the column.
@ -814,7 +827,6 @@ switch ($action) {
// $table->size = array ();
$table->size[$next] = '10%';
$table->align[$next] = 'left';
$table->headstyle[$next] = 'text-align:left;';
}
$columnview = false;
@ -996,7 +1008,6 @@ switch ($action) {
$table->head[$next] = '<span title="Operations">'.__('Op.').'</span>'.html_print_checkbox('all_delete', 0, false, true, false);
$table->size = [];
// $table->size[$next] = '80px';
$table->style[$next] = 'text-align:left;';
}
if ($edit) {

View File

@ -231,7 +231,12 @@ if ($tiny) {
}
if ($tiny) {
ui_toggle(html_print_table($table, true), __('Tactical server information'), false, $hidden_toggle);
ui_toggle(
html_print_table($table, true),
__('Tactical server information'),
false,
$hidden_toggle
);
} else {
html_print_table($table);
}

View File

@ -361,50 +361,61 @@ class DiscoveryTaskList extends Wizard
$recon_tasks = [];
}
$url_ajax = $config['homeurl'].'ajax.php';
$url_ajax = $config['homeurl'].'ajax.php';
$table = new StdClass();
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = '100%';
$table->class = 'info_table';
$table->head = [];
$table->data = [];
$table->align = [];
$table->headstyle = [];
$table = new StdClass();
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = '100%';
$table->class = 'info_table';
$table->head = [];
$table->data = [];
$table->align = [];
$table->headstyle = [];
for ($i = 0; $i < 9; $i++) {
$table->headstyle[$i] = 'text-align: left;';
}
$table->head[0] = __('Force');
$table->align[0] = 'left';
// Status.
$table->headstyle[5] .= 'min-width: 100px; width: 100px;';
// Task type.
$table->headstyle[6] .= 'min-width: 200px; width: 150px;';
// Progress.
$table->headstyle[7] .= 'min-width: 150px; width: 150px;';
// Updated at.
$table->headstyle[8] .= 'min-width: 150px; width: 150px;';
// Operations.
$table->headstyle[9] .= 'min-width: 150px; width: 150px;';
$table->head[1] = __('Task name');
$table->align[1] = 'left';
$table->head[0] = __('Force');
$table->align[0] = 'left';
$table->head[2] = __('Server name');
$table->align[2] = 'left';
$table->head[1] = __('Task name');
$table->align[1] = 'left';
$table->head[3] = __('Interval');
$table->align[3] = 'left';
$table->head[2] = __('Server name');
$table->align[2] = 'left';
$table->head[4] = __('Network');
$table->align[4] = 'left';
$table->head[3] = __('Interval');
$table->align[3] = 'left';
$table->head[5] = __('Status');
$table->align[5] = 'left';
$table->head[4] = __('Network');
$table->align[4] = 'left';
$table->head[6] = __('Task type');
$table->align[6] = 'left';
$table->head[5] = __('Status');
$table->align[5] = 'left';
$table->head[7] = __('Progress');
$table->align[7] = 'left';
$table->head[6] = __('Task type');
$table->align[6] = 'left';
$table->head[8] = __('Updated at');
$table->align[8] = 'left';
$table->head[7] = __('Progress');
$table->align[7] = 'left';
$table->head[9] = __('Operations');
$table->align[9] = 'left';
$table->head[8] = __('Updated at');
$table->align[8] = 'left';
$table->head[9] = __('Operations');
$table->align[9] = 'left';
foreach ($recon_tasks as $task) {
$data = [];
@ -553,13 +564,7 @@ class DiscoveryTaskList extends Wizard
if ($task['status'] <= 0 || $task['status'] > 100) {
$data[7] = '-';
} else {
$data[7] = progress_bar(
$task['status'],
100,
20,
__('Progress').':'.$task['status'].'%',
1
);
$data[7] = ui_progress($task['status'], '100%', 1.5);
}
if ($task['utimestamp'] > 0) {

View File

@ -783,20 +783,24 @@ class Wizard
/**
* Print a form.
*
* @param array $data Definition of target form to be printed.
* @param boolean $return Return as string or direct output.
* @param array $data Definition of target form to be printed.
* @param boolean $return Return as string or direct output.
* @param boolean $print_white_box Print a white box.
*
* @return string HTML code.
*/
public function printForm(array $data, bool $return=false, bool $print_white_box=false)
{
public function printForm(
array $data,
bool $return=false,
bool $print_white_box=false
) {
$form = $data['form'];
$inputs = $data['inputs'];
$js = $data['js'];
$cb_function = $data['cb_function'];
$cb_args = $data['cb_args'];
$output_head = '<form enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>';
if ($return === false) {
@ -868,7 +872,7 @@ class Wizard
$cb_function = $data['cb_function'];
$cb_args = $data['cb_args'];
$output_head = '<form enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>';
if ($return === false) {
@ -963,7 +967,7 @@ class Wizard
$cb_function = $data['cb_function'];
$cb_args = $data['cb_args'];
$output_head = '<form enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>';
if ($return === false) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

View File

@ -717,9 +717,15 @@ if ($table_events) {
'event_condition',
'AND'
);
echo '<div id="div_all_events_24h">';
echo '<label><b>'.__('Show all Events 24h').'</b></label>';
echo html_print_checkbox('all_events_24h', $all_events_24h, $all_events_24h, true, false, '', true);
echo '<div style="display: flex;" id="div_all_events_24h">';
echo '<label style="margin-right: 1em;"><b>'.__('Show all Events 24h').'</b></label>';
echo html_print_switch(
[
'name' => 'all_events_24h',
'value' => $all_events_24h,
'id' => 'checkbox-all_events_24h',
]
);
echo '</div>';
$date_subtract_day = (time() - (24 * 60 * 60));

View File

@ -1,17 +1,33 @@
<?php
/**
* Module management.
*
* @category Ajax library.
* @package Pandora FMS
* @subpackage Modules.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
if (check_login()) {
// Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 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 Lesser 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;
include_once $config['homedir'].'/include/functions_agents.php';
@ -76,7 +92,7 @@ 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);
// TODO TAGS agents_get_modules
// TODO TAGS agents_get_modules.
$modules = agents_get_modules(
$id_agents,
false,
@ -96,7 +112,7 @@ 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/');
@ -307,7 +323,7 @@ if (check_login()) {
if (empty($module_data)) {
$result = [];
} else {
// Paginate the result
// Paginate the result.
$result = array_slice($module_data, $offset, $block_size);
}
@ -366,10 +382,10 @@ if (check_login()) {
$data[] = html_print_result_div($row[$attr[0]]);
} else if ($is_web_content_string) {
// Fixed the goliat sends the strings from web
// without HTML entities
// without HTML entities.
$data[] = io_safe_input($row[$attr[0]]);
} else {
// Fixed the data from Selenium Plugin
// 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'])) {
@ -523,7 +539,8 @@ if (check_login()) {
$agent_w = check_acl($config['id_user'], 0, 'AW');
$access = ($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR');
$id_agente = $id_agent = (int) get_parameter('id_agente', 0);
$id_agent = (int) get_parameter('id_agente', 0);
$id_agente = $id_agent;
$show_notinit = (int) get_parameter('show_notinit', 0);
$cluster_list = (int) get_parameter('cluster_list', 0);
$url = 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent;
@ -549,6 +566,7 @@ if (check_login()) {
case 'type':
switch ($sort) {
case 'up':
default:
$selectTypeUp = $selected;
$order[] = [
'field' => 'tagente_modulo.id_modulo',
@ -583,6 +601,10 @@ if (check_login()) {
'order' => 'DESC',
];
break;
default:
// Ignore.
break;
}
break;
@ -603,6 +625,10 @@ if (check_login()) {
'order' => '',
];
break;
default:
// Ignore.
break;
}
break;
@ -623,6 +649,10 @@ if (check_login()) {
'order' => 'DESC',
];
break;
default:
// Ignore.
break;
}
break;
@ -645,7 +675,8 @@ if (check_login()) {
break;
}
// Fix: for tag functionality groups have to be all user_groups (propagate ACL funct!)
// Fix: for tag functionality groups have to be all user_groups
// (propagate ACL funct!).
$groups = users_get_groups($config['id_user'], $access);
$tags_join = '';
@ -669,7 +700,7 @@ if (check_login()) {
$status_filter_sql = '1 = 1';
if ($status_filter_monitor == AGENT_MODULE_STATUS_NOT_NORMAL) {
// Not normal
// Not normal.
$status_filter_sql = ' tagente_estado.estado <> 0';
} else if ($status_filter_monitor != -1) {
$status_filter_sql = 'tagente_estado.estado = '.$status_filter_monitor;
@ -693,7 +724,7 @@ if (check_login()) {
}
// Count monitors/modules
// Build the order sql
// Build the order sql.
$first = true;
foreach ($order as $ord) {
if ($first) {
@ -769,6 +800,7 @@ if (check_login()) {
$table = new stdClass();
$table->width = '100%';
$table->styleTable = 'border: 0;border-radius: 0;';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->class = 'info_table';
@ -791,7 +823,6 @@ if (check_login()) {
$table->head[6] = __('Thresholds');
$table->head[7] = __('Data');
$table->head[8] = __('Graph');
$table->headstyle[8] = 'min-width: 60px';
$table->head[9] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastContactUp, $selectLastContactDown);
$table->align = [
'left',
@ -805,6 +836,12 @@ if (check_login()) {
'left',
];
$table->headstyle[2] = 'min-width: 60px';
$table->headstyle[3] = 'min-width: 100px';
$table->headstyle[5] = 'min-width: 60px';
$table->headstyle[8] = 'min-width: 85px';
$table->headstyle[9] = 'min-width: 100px';
$last_modulegroup = 0;
$rowIndex = 0;
@ -936,12 +973,12 @@ if (check_login()) {
}
}
// Adds tag context information
// Adds tag context information.
if (tags_get_modules_tag_count($module['id_agente_modulo']) > 0) {
$data[3] .= ' <a class="tag_details" href="ajax.php?page=operation/agentes/estado_monitores&get_tag_tooltip=1&id_agente_modulo='.$module['id_agente_modulo'].'">'.html_print_image('images/tag_red.png', true, ['id' => 'tag-details-'.$module['id_agente_modulo'], 'class' => 'img_help']).'</a> ';
}
// Adds relations context information
// Adds relations context information.
if (modules_relation_exists($module['id_agente_modulo'])) {
$data[3] .= ' <a class="relations_details" href="ajax.php?page=operation/agentes/estado_monitores&get_relations_tooltip=1&id_agente_modulo='.$module['id_agente_modulo'].'">'.html_print_image('images/link2.png', true, ['id' => 'relations-details-'.$module['id_agente_modulo'], 'class' => 'img_help']).'</a> ';
}
@ -964,7 +1001,7 @@ if (check_login()) {
$title
);
$data[5] = ui_print_status_image($status, $title, true);
$data[5] = ui_print_module_status($module['estado'], $title, true, false, true);
if (!$show_context_help_first_time) {
$show_context_help_first_time = true;
@ -973,122 +1010,85 @@ if (check_login()) {
}
}
if ($module['id_tipo_modulo'] == 24) {
// log4x
switch ($module['datos']) {
case 10:
$salida = 'TRACE';
$style = 'font-weight:bold; color:darkgreen;';
break;
if (is_numeric($module['datos']) && !modules_is_string_type($module['id_tipo_modulo'])) {
if ($config['render_proc']) {
switch ($module['id_tipo_modulo']) {
case 2:
case 6:
case 9:
case 18:
case 21:
case 31:
if ($module['datos'] >= 1) {
$salida = $config['render_proc_ok'];
} else {
$salida = $config['render_proc_fail'];
}
break;
case 20:
$salida = 'DEBUG';
$style = 'font-weight:bold; color:darkgreen;';
break;
case 30:
$salida = 'INFO';
$style = 'font-weight:bold; color:darkgreen;';
break;
case 40:
$salida = 'WARN';
$style = 'font-weight:bold; color:darkorange;';
break;
case 50:
$salida = 'ERROR';
$style = 'font-weight:bold; color:red;';
break;
case 60:
$salida = 'FATAL';
$style = 'font-weight:bold; color:red;';
break;
}
$salida = "<span style='$style'>$salida</span>";
} else {
if (is_numeric($module['datos']) && !modules_is_string_type($module['id_tipo_modulo'])) {
if ($config['render_proc']) {
switch ($module['id_tipo_modulo']) {
case 2:
case 6:
case 9:
case 18:
case 21:
case 31:
if ($module['datos'] >= 1) {
$salida = $config['render_proc_ok'];
} else {
$salida = $config['render_proc_fail'];
}
break;
default:
switch ($module['id_tipo_modulo']) {
case 15:
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
if ($module['post_process'] > 0) {
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
} else {
$salida = human_milliseconds_to_string($module['datos']);
}
default:
switch ($module['id_tipo_modulo']) {
case 15:
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
if ($module['post_process'] > 0) {
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
} else {
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
$salida = human_milliseconds_to_string($module['datos']);
}
break;
default:
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
break;
}
break;
}
} else {
switch ($module['id_tipo_modulo']) {
case 15:
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
if ($module['post_process'] > 0) {
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
} else {
$salida = human_milliseconds_to_string($module['datos']);
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
}
} else {
break;
default:
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
}
break;
default:
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
break;
}
}
// Show units ONLY in numeric data types
if (isset($module['unit'])) {
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
if ($data_macro) {
$salida = $data_macro;
} else {
$salida .= '&nbsp;'.'<i>'.io_safe_output($module['unit']).'</i>';
}
break;
}
break;
}
} else {
switch ($module['id_tipo_modulo']) {
case 15:
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
if ($module['post_process'] > 0) {
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
} else {
$salida = human_milliseconds_to_string($module['datos']);
}
} else {
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
}
break;
default:
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
break;
}
}
// Show units ONLY in numeric data types
if (isset($module['unit'])) {
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
if ($data_macro) {
$salida = $data_macro;
} else {
$salida = ui_print_module_string_value(
$module['datos'],
$module['id_agente_modulo'],
$module['current_interval'],
$module['module_name']
);
$salida .= '&nbsp;'.'<i>'.io_safe_output($module['unit']).'</i>';
}
}
} else {
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
if ($data_macro) {
$salida = $data_macro;
} else {
$salida = ui_print_module_string_value(
$module['datos'],
$module['id_agente_modulo'],
$module['current_interval'],
$module['module_name']
);
}
}
if ($module['id_tipo_modulo'] != 25) {
@ -1230,5 +1230,3 @@ if (check_login()) {
return;
}
}

View File

@ -1519,43 +1519,8 @@ class NetworkMap
*/
public static function getColorByStatus($status)
{
if (isset($status) === false) {
return COL_UNKNOWN;
}
switch ($status) {
case AGENT_MODULE_STATUS_NORMAL:
case AGENT_STATUS_NORMAL:
return COL_NORMAL;
case AGENT_MODULE_STATUS_NOT_INIT:
case AGENT_STATUS_NOT_INIT:
return COL_NOTINIT;
case AGENT_MODULE_STATUS_CRITICAL_BAD:
case AGENT_STATUS_CRITICAL:
return COL_CRITICAL;
case AGENT_MODULE_STATUS_WARNING:
case AGENT_STATUS_WARNING:
return COL_WARNING;
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
case AGENT_MODULE_STATUS_WARNING_ALERT:
case AGENT_STATUS_ALERT_FIRED:
return COL_ALERTFIRED;
case AGENT_MODULE_STATUS_UNKNOWN:
case AGENT_STATUS_UNKNOWN:
return COL_UNKNOWN;
default:
// Ignored.
break;
}
return COL_IGNORED;
include_once __DIR__.'/../functions_modules.php';
return modules_get_color_status($status);
}

View File

@ -871,12 +871,13 @@ function get_parameter_switch($name, $default='')
$data = get_parameter($name, null);
if ($data === null) {
return 0;
return (isset($default) ? $default : 0);
} else if ($data == 'on') {
return 1;
}
return 0;
// Return value assigned to switch.
return $data;
}

View File

@ -296,7 +296,7 @@ function clippy_context_help($help=null)
$code = str_replace('{clippy}', '#'.$id, $code);
$code = str_replace('{clippy_obj}', 'intro_'.$id, $code);
$return = $code.'<div id="'.$id.'" style="display: inline;"><a onclick="show_'.$id.'();" href="javascript: void(0);" >'.html_print_image(
$return = $code.'<div id="'.$id.'" style="display: inline-block;"><a onclick="show_'.$id.'();" href="javascript: void(0);" >'.html_print_image(
'images/clippy_icon.png',
true
).'</a></div>

View File

@ -959,6 +959,8 @@ function events_print_event_table(
) {
global $config;
ui_require_css_file('events');
if ($agent_id == 0) {
$agent_condition = '';
} else {
@ -997,7 +999,7 @@ function events_print_event_table(
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = $width;
$table->class = 'databox data';
$table->class = 'info_table no-td-padding';
if (!$tactical_view) {
$table->title = __('Latest events');
}
@ -1010,36 +1012,38 @@ function events_print_event_table(
$table->cellclass = [];
$table->data = [];
$table->align = [];
$table->style[0] = 'width:25px;';
$table->style[1] = 'width:25px;';
$table->style[2] = 'width:25px;';
if ($agent_id == 0) {
$table->style[3] = 'word-break: break-all;';
}
$table->style = [];
$table->style[4] = 'width:120px; word-break: break-all;';
$i = 0;
$table->head[$i] = "<span title='".__('Severity')."'>".__('S.').'</span>';
$table->headstyle[$i] = 'width: 1%;text-align: center;';
$table->style[$i++] = 'text-align: center;';
$table->head[0] = "<span title='".__('Validated')."'>".__('V.').'</span>';
$table->align[0] = 'center';
$table->head[$i] = __('Type');
$table->headstyle[$i] = 'width: 3%;text-align: center;';
$table->style[$i++] = 'text-align: center;';
$table->head[1] = "<span title='".__('Severity')."'>".__('S.').'</span>';
$table->align[1] = 'center';
$table->head[2] = __('Type');
$table->headclass[2] = 'datos3 f9';
$table->align[2] = 'center';
$table->head[3] = __('Event name');
$table->head[$i] = __('Event name');
$table->headstyle[$i] = '';
$table->style[$i++] = 'word-break: break-word;';
if ($agent_id == 0) {
$table->head[4] = __('Agent name');
$table->size[4] = '15%';
$table->head[$i] = __('Agent name');
$table->headstyle[$i] = '';
$table->style[$i++] = 'word-break: break-all;';
}
$table->head[5] = __('Timestamp');
$table->headclass[5] = 'datos3 f9';
$table->align[5] = 'left';
$table->size[5] = '15%';
$table->head[$i] = __('Timestamp');
$table->headstyle[$i] = 'width: 120px;';
$table->style[$i++] = 'word-break: break-word;';
$table->head[$i] = __('Status');
$table->headstyle[$i] = 'width: 150px;text-align: center;';
$table->style[$i++] = 'text-align: center;';
$table->head[$i] = "<span title='".__('Validated')."'>".__('V.').'</span>';
$table->headstyle[$i] = 'width: 1%;text-align: center;';
$table->style[$i++] = 'text-align: center;';
$all_groups = [];
if ($agent_id != 0) {
@ -1078,53 +1082,15 @@ function events_print_event_table(
break;
}
$data[0] = html_print_image(
$img,
true,
[
'class' => 'image_status',
'title' => $title,
]
);
switch ($event['criticity']) {
default:
case EVENT_CRIT_MAINTENANCE:
$img = 'images/status_sets/default/severity_maintenance.png';
break;
case EVENT_CRIT_INFORMATIONAL:
$img = 'images/status_sets/default/severity_informational.png';
break;
case EVENT_CRIT_NORMAL:
$img = 'images/status_sets/default/severity_normal.png';
break;
case EVENT_CRIT_WARNING:
$img = 'images/status_sets/default/severity_warning.png';
break;
case EVENT_CRIT_CRITICAL:
$img = 'images/status_sets/default/severity_critical.png';
break;
}
$data[1] = html_print_image(
$img,
true,
[
'class' => 'image_status',
'width' => 12,
'height' => 12,
'title' => get_priority_name($event['criticity']),
]
);
$i = 0;
// Criticity.
$data[$i++] = ui_print_event_priority($event['criticity'], true, true);
// Event type.
$data[2] = events_print_type_img($event['event_type'], true);
$data[$i++] = events_print_type_img($event['event_type'], true);
// Event text.
$data[3] = ui_print_string_substr(
$data[$i++] = ui_print_string_substr(
strip_tags(io_safe_output($event['evento'])),
75,
true,
@ -1135,33 +1101,32 @@ function events_print_event_table(
if ($event['id_agente'] > 0) {
// Agent name.
// Get class name, for the link color, etc.
$myclass = get_priority_class($event['criticity']);
$data[4] = "<a class='".$myclass."' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event['id_agente']."'>".agents_get_alias($event['id_agente']).'</A>';
$data[$i] = "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event['id_agente']."'>".agents_get_alias($event['id_agente']).'</A>';
// For System or SNMP generated alerts.
} else if ($event['event_type'] == 'system') {
$data[4] = __('System');
$data[$i] = __('System');
} else {
$data[4] = __('Alert').'SNMP';
$data[$i] = __('Alert').'SNMP';
}
$i++;
}
// Timestamp.
$data[5] = ui_print_timestamp($event['timestamp'], true, ['style' => 'font-size: 7.5pt; letter-spacing: 0.3pt;']);
$data[$i++] = ui_print_timestamp($event['timestamp'], true, ['style' => 'font-size: 7.5pt; letter-spacing: 0.3pt;']);
$class = get_priority_class($event['criticity']);
$cell_classes[3] = $class;
$cell_classes[4] = $class;
$cell_classes[5] = $class;
// Status.
$data[$i++] = ui_print_event_type($event['event_type'], true);
array_push($table->cellclass, $cell_classes);
/*
Commented out (old).
// array_push ($table->rowclass, get_priority_class ($event["criticity"]));
*/
array_push($table->data, $data);
$data[$i++] = html_print_image(
$img,
true,
[
'class' => 'image_status',
'title' => $title,
]
);
$table->data[] = $data;
}
$events_table = html_print_table($table, true);

View File

@ -2479,7 +2479,7 @@ function truncate_negatives(&$element)
* @param bool return or echo flag
* @param bool show_not_init flag
*/
function graph_agent_status($id_agent=false, $width=300, $height=200, $return=false, $show_not_init=false, $data_agents=false)
function graph_agent_status($id_agent=false, $width=300, $height=200, $return=false, $show_not_init=false, $data_agents=false, $donut_narrow_graph=false)
{
global $config;
@ -2545,25 +2545,37 @@ function graph_agent_status($id_agent=false, $width=300, $height=200, $return=fa
$data = [];
}
$out = pie_graph(
$data,
$width,
$height,
__('other'),
ui_get_full_url(false, false, false, false),
'',
$config['fontpath'],
$config['font_size'],
1,
'hidden',
$colors,
0
);
if ($return) {
if ($donut_narrow_graph == true) {
$data_total = array_sum($data);
$out = print_donut_narrow_graph(
$colors,
$width,
$height,
$data,
$data_total
);
return $out;
} else {
echo $out;
$out = pie_graph(
$data,
$width,
$height,
__('other'),
ui_get_full_url(false, false, false, false),
'',
$config['fontpath'],
$config['font_size'],
1,
'hidden',
$colors,
0
);
if ($return) {
return $out;
} else {
echo $out;
}
}
}

View File

@ -1079,7 +1079,7 @@ function html_print_extended_select_for_time(
'class' => $uniq_name.'_toggler '.$class,
'alt' => __('Custom'),
'title' => __('Custom'),
'style' => 'width: 18px;'.$style_icon,
'style' => 'width: 18px; margin-bottom: -5px;'.$style_icon,
],
false,
false,
@ -1114,7 +1114,7 @@ function html_print_extended_select_for_time(
'class' => $uniq_name.'_toggler',
'alt' => __('List'),
'title' => __('List'),
'style' => 'width: 18px;'.$style_icon,
'style' => 'width: 18px;margin-bottom: -5px;'.$style_icon,
]
).'</a>';
echo '</div>';
@ -2989,6 +2989,7 @@ function html_print_switch($attributes=[])
'class',
'name',
'onclick',
'onchange',
];
foreach ($valid_attrs as $va) {
if (!isset($attributes[$va])) {
@ -2998,7 +2999,11 @@ function html_print_switch($attributes=[])
$html_expand .= ' '.$va.'="'.$attributes[$va].'"';
}
return "<label class='p-switch'>
if (!isset($attributes['style'])) {
$attributes['style'] = '';
}
return "<label class='p-switch' style='".$attributes['style']."'>
<input type='checkbox' $html_expand>
<span class='p-slider'></span>
</label>";

View File

@ -2294,6 +2294,54 @@ function modules_get_modulegroup_name($modulegroup_id)
}
/**
* Returns target color to be used based on the status received.
*
* @param integer $status Source information.
*
* @return string HTML tag for color.
*/
function modules_get_color_status($status)
{
if (isset($status) === false) {
return COL_UNKNOWN;
}
switch ($status) {
case AGENT_MODULE_STATUS_NORMAL:
case AGENT_STATUS_NORMAL:
return COL_NORMAL;
case AGENT_MODULE_STATUS_NOT_INIT:
case AGENT_STATUS_NOT_INIT:
return COL_NOTINIT;
case AGENT_MODULE_STATUS_CRITICAL_BAD:
case AGENT_STATUS_CRITICAL:
return COL_CRITICAL;
case AGENT_MODULE_STATUS_WARNING:
case AGENT_STATUS_WARNING:
return COL_WARNING;
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
case AGENT_MODULE_STATUS_WARNING_ALERT:
case AGENT_STATUS_ALERT_FIRED:
return COL_ALERTFIRED;
case AGENT_MODULE_STATUS_UNKNOWN:
case AGENT_STATUS_UNKNOWN:
return COL_UNKNOWN;
default:
// Ignored.
break;
}
return COL_IGNORED;
}
/**
* Gets a module status an modify the status and title reference variables
*
@ -2322,7 +2370,7 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
$status = STATUS_MODULE_OK;
$title = __('NORMAL');
} else if ($db_status == AGENT_MODULE_STATUS_UNKNOWN) {
$status = STATUS_AGENT_DOWN;
$status = STATUS_MODULE_UNKNOWN;
$last_status = modules_get_agentmodule_last_status($id_agent_module);
switch ($last_status) {
case AGENT_STATUS_NORMAL:

View File

@ -2844,6 +2844,7 @@ function reporting_event_report_agent(
if ($label != '') {
$label = reporting_label_macro($content, $label);
}
$return['label'] = $label;
if ($event_graph_by_user_validator) {
@ -9498,13 +9499,23 @@ function reporting_get_agent_module_info($id_agent)
/**
* Print tiny statistics of the status of one agent, group, etc.
*
* @param mixed Array with the counts of the total modules, normal modules, critical modules, warning modules, unknown modules and fired alerts
* @param bool return or echo flag
* @param mixed $counts_info Array with the counts of the total modules,
* normal modules, critical modules, warning modules, unknown modules and
* fired alerts.
* @param boolean $return Return or echo flag.
* @param string $type agent or modules or ??.
* @param string $separator Sepearator (classic view).
* @param boolean $modern Use modern interfaces or old one.
*
* @return string html formatted tiny stats of modules/alerts of an agent
* @return string HTML formatted tiny stats of modules/alerts of an agent.
*/
function reporting_tiny_stats($counts_info, $return=false, $type='agent', $separator=':', $strict_user=false)
{
function reporting_tiny_stats(
$counts_info,
$return=false,
$type='agent',
$separator=':',
$modern=false
) {
global $config;
$out = '';
@ -9621,37 +9632,74 @@ function reporting_tiny_stats($counts_info, $return=false, $type='agent', $separ
$out .= html_print_div($params, true);
}
// If total count is less than 0, is an error. Never show negative numbers
// If total count is less than 0, is an error. Never show negative numbers.
if ($total_count < 0) {
$total_count = 0;
}
$out .= '<b>'.'<span id="total_count_'.$uniq_id.'" class="forced_title" style="font-size: 7pt">'.$total_count.'</span>';
if (isset($fired_count) && $fired_count > 0) {
$out .= ' '.$separator.' <span class="orange forced_title" id="fired_count_'.$uniq_id.'" style="font-size: 7pt">'.$fired_count.'</span>';
}
if ($modern === true) {
$out .= '<div id="bullets_modules">';
// $out .='<span id="total_count_'.$uniq_id.'" class="forced_title" style="font-size: 13pt">'.$total_count.$separator.'</span>';
if (isset($fired_count) && $fired_count > 0) {
$out .= '<div><div id="fired_count_'.$uniq_id.'" class="forced_title bullet_modules orange_background"></div>';
$out .= '<span style="font-size: 12pt">'.$fired_count.'</span></div>';
}
if (isset($critical_count) && $critical_count > 0) {
$out .= ' '.$separator.' <span class="red forced_title" id="critical_count_'.$uniq_id.'" style="font-size: 7pt">'.$critical_count.'</span>';
}
if (isset($critical_count) && $critical_count > 0) {
$out .= '<div><div id="critical_count_'.$uniq_id.'" class="forced_title bullet_modules red_background"></div>';
$out .= '<span style="font-size: 12pt">'.$critical_count.'</span></div>';
}
if (isset($warning_count) && $warning_count > 0) {
$out .= ' '.$separator.' <span class="yellow forced_title" id="warning_count_'.$uniq_id.'" style="font-size: 7pt">'.$warning_count.'</span>';
}
if (isset($warning_count) && $warning_count > 0) {
$out .= '<div><div id="warning_count_'.$uniq_id.'" class="forced_title bullet_modules yellow_background"></div>';
$out .= '<span style="font-size: 12pt">'.$warning_count.'</span></div>';
}
if (isset($unknown_count) && $unknown_count > 0) {
$out .= ' '.$separator.' <span class="grey forced_title" id="unknown_count_'.$uniq_id.'" style="font-size: 7pt">'.$unknown_count.'</span>';
}
if (isset($unknown_count) && $unknown_count > 0) {
$out .= '<div><div id="unknown_count_'.$uniq_id.'" class="forced_title bullet_modules grey_background"></div>';
$out .= '<span style="font-size: 12pt">'.$unknown_count.'</span></div>';
}
if (isset($not_init_count) && $not_init_count > 0) {
$out .= ' '.$separator.' <span class="blue forced_title" id="not_init_count_'.$uniq_id.'" style="font-size: 7pt">'.$not_init_count.'</span>';
}
if (isset($not_init_count) && $not_init_count > 0) {
$out .= '<div><div id="not_init_count_'.$uniq_id.'" class="forced_title bullet_modules blue_background"></div>';
$out .= '<span style="font-size: 12pt">'.$not_init_count.'</span></div>';
}
if (isset($normal_count) && $normal_count > 0) {
$out .= ' '.$separator.' <span class="green forced_title" id="normal_count_'.$uniq_id.'" style="font-size: 7pt">'.$normal_count.'</span>';
}
if (isset($normal_count) && $normal_count > 0) {
$out .= '<div><div id="normal_count_'.$uniq_id.'" class="forced_title bullet_modules green_background"></div>';
$out .= '<span style="font-size: 12pt">'.$normal_count.'</span></div>';
}
$out .= '</b>';
$out .= '</div>';
} else {
// Classic ones.
$out .= '<b><span id="total_count_'.$uniq_id.'" class="forced_title" style="font-size: 7pt">'.$total_count.'</span>';
if (isset($fired_count) && $fired_count > 0) {
$out .= ' '.$separator.' <span class="orange forced_title" id="fired_count_'.$uniq_id.'" style="font-size: 7pt">'.$fired_count.'</span>';
}
if (isset($critical_count) && $critical_count > 0) {
$out .= ' '.$separator.' <span class="red forced_title" id="critical_count_'.$uniq_id.'" style="font-size: 7pt">'.$critical_count.'</span>';
}
if (isset($warning_count) && $warning_count > 0) {
$out .= ' '.$separator.' <span class="yellow forced_title" id="warning_count_'.$uniq_id.'" style="font-size: 7pt">'.$warning_count.'</span>';
}
if (isset($unknown_count) && $unknown_count > 0) {
$out .= ' '.$separator.' <span class="grey forced_title" id="unknown_count_'.$uniq_id.'" style="font-size: 7pt">'.$unknown_count.'</span>';
}
if (isset($not_init_count) && $not_init_count > 0) {
$out .= ' '.$separator.' <span class="blue forced_title" id="not_init_count_'.$uniq_id.'" style="font-size: 7pt">'.$not_init_count.'</span>';
}
if (isset($normal_count) && $normal_count > 0) {
$out .= ' '.$separator.' <span class="green forced_title" id="normal_count_'.$uniq_id.'" style="font-size: 7pt">'.$normal_count.'</span>';
}
$out .= '</b>';
}
if ($return) {
return $out;

File diff suppressed because it is too large Load Diff

View File

@ -720,3 +720,48 @@ function print_clock_digital_1($time_format, $timezone, $clock_animation, $width
return $output;
}
/**
* Print dougnhnut.
*
* @param array $colors Colors.
* @param integer $width Width.
* @param integer $height Height.
* @param array $data Data.
* @param mixed $data_total Data_total.
*
* @return string HTML.
*/
function print_donut_narrow_graph(
array $colors,
$width,
$height,
array $data,
$data_total
) {
if (empty($data)) {
return graph_nodata_image($width, $height, 'pie');
}
$series = count($data);
if (($series != count($colors)) || ($series == 0)) {
return '';
}
$data = json_encode($data);
$colors = json_encode($colors);
$graph_id = uniqid('graph_');
$out = "<div id='$graph_id'></div>";
$out .= include_javascript_d3(true);
$out .= "<script type='text/javascript'>
donutNarrowGraph($colors, $width, $height, $data_total)
.donutbody(d3.select($graph_id))
.data($data)
.render();
</script>";
return $out;
}

View File

@ -344,9 +344,9 @@ function drawRating($rating, $width, $height, $font, $out_of_lim_str, $mode, $fo
$image = imagecreate($width, $height);
// colors
$back = imagecolorallocate($image, 255, 255, 255);
$back = imagecolorallocate($image, 241, 241, 241);
$bordercolor = imagecolorallocate($image, 174, 174, 174);
$bordercolor = imagecolorallocate($image, 241, 241, 241);
$text = imagecolorallocate($image, 74, 74, 74);
$red = imagecolorallocate($image, 255, 60, 75);
$green = imagecolorallocate($image, 50, 205, 50);
@ -483,7 +483,7 @@ function gd_progress_bar($width, $height, $progress, $title, $font, $out_of_lim_
break;
case 1:
drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 6, $value_text, $color);
drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 9, $value_text, $color);
break;

View File

@ -2113,8 +2113,7 @@ function print_circular_progress_bar(
var progress = startPercent;
if (transition == 0)
updateProgress(endPercent);
if (transition == 0) updateProgress(endPercent);
else {
(function loops() {
updateProgress(progress);
@ -2762,3 +2761,224 @@ function valueToBytes(value) {
// This will actually do the rounding and the decimals.
return value.toFixed(2) + shorts[pos] + "B";
}
function donutNarrowGraph(colores, width, height, total) {
// Default settings
var donutbody = d3.select("body");
var data = {};
// var showTitle = true;
if (width == "") {
width = 180;
}
if (height == "") {
height = 180;
}
var radius = Math.min(width, height) / 2;
var currentVal;
//var color = d3.scale.category20();
var colores_index = [];
var colores_value = [];
$.each(colores, function(index, value) {
colores_index.push(index);
colores_value.push(value);
});
var color = d3.scale
.ordinal()
.domain(colores_index)
.range(colores_value);
var pie = d3.layout
.pie()
.sort(null)
.value(function(d) {
return d.value;
});
var svg, g, arc;
var object = {};
// Method for render/refresh graph
object.render = function() {
if (!svg) {
// Show normal status by default. This variable must be initialized here, before clearing data.
var normal_status = data.Normal;
// Don't draw 0 or invalid values. console.log(data);
var data_map = $.map(data, function(value, index) {
if (value == 0 || isNaN(value)) {
return index;
}
});
$.each(data_map, function(i, val) {
delete data[val];
});
//New data: console.log(data);
arc = d3.svg
.arc()
.outerRadius(radius)
.innerRadius(radius - radius / 2.5);
svg = donutbody
.append("svg")
.attr("width", width)
.attr("height", height)
.append("g")
.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
g = svg
.selectAll(".arc")
.data(pie(d3.entries(data)))
.enter()
.append("g")
.attr("class", "arc");
g.append("path")
// Attach current value to g so that we can use it for animation
.each(function(d) {
this._current = d;
})
.attr("d", arc)
.attr("stroke", "white")
.style("stroke-width", 2)
.style("fill", function(d) {
return color(d.data.key);
});
// This is to show labels on the graph
/* g.append("text")
.attr("transform", function(d) {
return "translate(" + arc.centroid(d) + ")";
})
.attr("dy", ".35em")
.style("text-anchor", "middle");
g.select("text").text(function(d) {
return d.data.key;
});*/
// Show normal status by default.
var percentage_normal;
svg
.append("text")
.datum(data)
.attr("x", 0)
.attr("y", 0 + radius / 10)
.attr("class", "text-tooltip")
.style("text-anchor", "middle")
.attr("font-weight", "bold")
.style("font-family", "Arial, Verdana")
//.attr("fill", "#82b92e")
.style("font-size", function(d) {
if (normal_status) {
percentage_normal = (normal_status * 100) / total;
if (Number.isInteger(percentage_normal)) {
percentage_normal = percentage_normal.toFixed(0);
return radius / 3 + "px";
} else {
percentage_normal = percentage_normal.toFixed(1);
return radius / 3.5 + "px";
}
}
})
.text(function(d) {
if (normal_status) {
return percentage_normal + "%";
} else {
return "0%";
}
});
g.on("mouseover", function(obj) {
//console.log(obj);
var percentage;
svg
.select("text.text-tooltip")
// This is to paint the text of the corresponding color.
/* .attr("fill", function(d) {
return color(obj.data.key);
})*/
.style("font-size", function(d) {
percentage = (d[obj.data.key] * 100) / total;
if (Number.isInteger(percentage)) {
percentage = percentage.toFixed(0);
return radius / 3 + "px";
} else {
percentage = percentage.toFixed(1);
return radius / 3.5 + "px";
}
})
.text(percentage + "%");
});
g.on("mouseout", function(obj) {
svg.select("text.text-tooltip").text(function(d) {
if (normal_status) {
return percentage_normal + "%";
} else {
return "0%";
}
});
// .attr("fill", "#82b92e");
});
} else {
g.data(pie(d3.entries(data)))
.exit()
.remove();
g.select("path")
.transition()
.duration(200)
.attrTween("d", function(a) {
var i = d3.interpolate(this._current, a);
this._current = i(0);
return function(t) {
return arc(i(t));
};
});
g.select("text").attr("transform", function(d) {
return "translate(" + arc.centroid(d) + ")";
});
svg.select("text.text-tooltip").datum(data);
}
return object;
};
// Getter and setter methods
object.data = function(value) {
if (!arguments.length) return data;
data = value;
return object;
};
object.donutbody = function(value) {
if (!arguments.length) return donutbody;
donutbody = value;
return object;
};
object.width = function(value) {
if (!arguments.length) return width;
width = value;
radius = Math.min(width, height) / 2;
return object;
};
object.height = function(value) {
if (!arguments.length) return height;
height = value;
radius = Math.min(width, height) / 2;
return object;
};
return object;
}

View File

@ -1226,7 +1226,7 @@ function paint_qrcode(text, where, width, height) {
text: text,
width: width,
height: height,
colorDark: "#3B6941",
colorDark: "#343434",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.M
});

View File

@ -0,0 +1,158 @@
/*
* ---------------------------------------------------------------------
* - Create/Update Agent - agent_manager.php
* ---------------------------------------------------------------------
*/
.agent_options {
width: 100%;
margin-right: 0px;
display: flex;
flex-flow: row wrap;
flex-direction: row;
justify-content: space-between;
box-sizing: border-box;
}
.agent_options_update {
width: 85%;
margin-right: 20px;
}
.agent_options_column_left,
.agent_options_column_right {
width: 50%;
box-sizing: border-box;
}
.agent_options_column_left {
padding-right: 50px;
}
.agent_qr {
width: 15%;
text-align: center;
box-sizing: border-box;
padding: 20px 0px;
display: flex;
justify-content: center;
flex-direction: column;
min-width: 150px;
}
a#qr_code_agent_view {
margin-top: 5px;
}
.first_row .agent_options_column_right select,
.first_row .agent_options_column_right input,
.first_row .agent_options_column_left select#grupo {
width: 95%;
box-sizing: border-box;
}
.first_row .agent_options_column_left .p-switch {
margin-right: 5px;
margin-left: 10px;
}
.agent_options_column_left input#text-direccion,
.agent_options_column_left select#address_list,
.agent_options_column_left input#text-agente,
.agent_options_column_left input#text-alias {
width: 100%;
box-sizing: border-box;
}
.agent_options_agent_name > * {
margin-left: 5px;
}
.custom_fields_table {
border-spacing: 0px;
}
.custom_fields_table tr.datos {
background-color: #f7f7f7;
display: none;
}
.custom_fields_table tr.datos2 {
cursor: pointer;
}
.custom_fields_table tr td {
border: 1px solid #e0e0e0;
}
.custom_fields_table tr.datos2 td div.field_title {
padding: 10px;
}
.custom_fields_table tr.datos2 td {
border-radius: 4px;
padding: 0px;
}
.custom_fields_table tr.datos td {
padding: 15px 10px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}
.custom_fields_table .custom_field_row_opened td {
border-bottom-left-radius: 0px !important;
border-bottom-right-radius: 0px !important;
}
.secondary_groups_select {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 15px;
}
.secondary_groups_select .secondary_groups_select_arrows input {
display: grid;
margin: 0 auto;
}
.secondary_groups_select .secondary_groups_list_left {
text-align: right;
width: 50%;
}
.secondary_groups_select .secondary_groups_list_right {
text-align: left;
width: 50%;
}
.secondary_groups_select .secondary_groups_select_arrows {
padding: 0 50px;
}
.secondary_groups_select_arrows a {
display: block;
}
.agent_options_adv .agent_options_column_right .label_select select,
.agent_options_adv .agent_options_column_right .label_select input[type="text"],
.agent_options_adv #text-custom_id,
.agent_options_adv #cps {
width: 100%;
box-sizing: border-box;
}
.agent_options_adv .label_select_simple.label_simple_one_item .p-switch {
margin-right: 5px;
}
.agent_description {
min-height: 4.8em !important;
}
.agent_custom_id {
padding-bottom: 0.7em;
padding-top: 0.5em;
display: inline-block;
border-radius: 5px !important;
border: 1px solid #ccc;
}

View File

@ -0,0 +1,19 @@
text.text-tooltip {
font-family: "lato-bolder", "Open Sans", sans-serif !important;
}
div#bullets_modules span {
font-family: "lato-bolder", "Open Sans", sans-serif !important;
}
table#agent_interface_info .noresizevc.graph {
width: 500px !important;
}
div.agent_details_agent_alias {
flex: 1;
}
div.agent_details_agent_alias * {
font-family: "lato-bolder", "Open Sans", sans-serif !important;
}

View File

@ -27,6 +27,11 @@ li.discovery > a label {
cursor: pointer;
}
div.data_container > label {
font-family: "lato-bolder", "Open Sans", sans-serif !important;
font-weight: lighter;
}
div.data_container {
width: 100%;
height: 100%;
@ -120,7 +125,6 @@ div.arrow_box:before {
border-top-right-radius: 7px;
border-top-left-radius: 7px;
box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1);
flex-direction: column;
}
#menu_tab_frame_view_bc .breadcrumbs_container {
@ -160,6 +164,10 @@ span.breadcrumb_link {
* Discovery forms structure
*/
form.discovery * {
font-size: 10pt;
}
.edit_discovery_info {
display: flex;
align-items: flex-start;
@ -196,7 +204,9 @@ li > input[type="password"],
background-color: transparent !important;
border: none;
border-radius: 0 !important;
border-bottom: 1px solid #343434;
border-bottom: 1px solid #ccc;
font-family: "lato-bolder", "Open Sans", sans-serif !important;
font-weight: lighter;
padding: 0px 0px 2px 0px;
box-sizing: border-box;
margin-bottom: 4px;
@ -215,7 +225,7 @@ li > input[type="password"],
}
.discovery_list_input option {
text-align: center;
text-align: left;
}
.discovery_list_input option:checked {

View File

@ -0,0 +1,20 @@
div.criticity {
width: 150px;
height: 2em;
color: #fff;
text-align: center;
border-radius: 5px;
font-size: 0.8em;
padding: 3px;
margin: 0;
display: table-cell;
vertical-align: middle;
}
div.mini-criticity {
width: 5px;
height: 4em;
padding: 0;
margin: 0;
display: inline-block;
}

View File

@ -13,7 +13,7 @@
width: 43px;
height: 11px;
position: absolute;
background-image: url(../../images/wait.gif);
background-image: url(../../../images/wait.gif);
}
.cluetip-arrows {
display: none;

View File

@ -278,13 +278,11 @@ select:-webkit-autofill:focus {
}
/* All select type multiple */
select[multiple] option:checked,
select[multiple] option:checked {
background: #82b92e linear-gradient(0deg, #82b92e 0%, #82b92e 100%);
color: #fff !important;
}
select option:checked,
select option:checked {
background-color: #82b92e;
color: #fff !important;
@ -305,7 +303,7 @@ select:-internal-list-box {
}
.DejaVuSerif-Bold {
font-family: DejaVuSerif-BoldFont;
font-family: DejaVuSerif-BoldFont, sans-serif;
}
@font-face {
@ -314,7 +312,7 @@ select:-internal-list-box {
}
.DejaVuSerif-BoldItalic {
font-family: DejaVuSerif-BoldItalicFont;
font-family: DejaVuSerif-BoldItalicFont, sans-serif;
}
@font-face {
@ -323,7 +321,7 @@ select:-internal-list-box {
}
.DejaVuSerif-Italic {
font-family: DejaVuSerif-ItalicFont;
font-family: DejaVuSerif-ItalicFont, sans-serif;
}
@font-face {
@ -332,7 +330,7 @@ select:-internal-list-box {
}
.DejaVuSerif {
font-family: DejaVuSerifFont;
font-family: DejaVuSerifFont, sans-serif;
}
@font-face {
@ -341,7 +339,7 @@ select:-internal-list-box {
}
.DejaVuSerifCondensed-Bold {
font-family: DejaVuSerifCondensed-BoldFont;
font-family: DejaVuSerifCondensed-BoldFont, sans-serif;
}
@font-face {
@ -350,7 +348,7 @@ select:-internal-list-box {
}
.DejaVuSerifCondensed-BoldItalic {
font-family: DejaVuSerifCondensed-BoldItalicFont;
font-family: DejaVuSerifCondensed-BoldItalicFont, sans-serif;
}
@font-face {
@ -359,7 +357,7 @@ select:-internal-list-box {
}
.DejaVuSerifCondensed-Italic {
font-family: DejaVuSerifCondensed-ItalicFont;
font-family: DejaVuSerifCondensed-ItalicFont, sans-serif;
}
@font-face {
@ -368,7 +366,7 @@ select:-internal-list-box {
}
.DejaVuSerifCondensed {
font-family: DejaVuSerifCondensedFont;
font-family: DejaVuSerifCondensedFont, sans-serif;
}
@font-face {
@ -377,7 +375,7 @@ select:-internal-list-box {
}
.FreeSans {
font-family: FreeSansFont;
font-family: FreeSansFont, sans-serif;
}
@font-face {
@ -386,7 +384,7 @@ select:-internal-list-box {
}
.FreeSansBold {
font-family: FreeSansBoldFont;
font-family: FreeSansBoldFont, sans-serif;
}
@font-face {
@ -395,7 +393,7 @@ select:-internal-list-box {
}
.smallfont {
font-family: smallfontFont;
font-family: smallfontFont, sans-serif;
}
@font-face {
@ -423,7 +421,7 @@ select:-internal-list-box {
src: url("../../fonts/leaguegothic.woff") format("woff");
}
.unicode {
font-family: unicodeFont;
font-family: unicodeFont, sans-serif;
}
/*
@ -431,6 +429,52 @@ select:-internal-list-box {
* - GLOBAL STYLES -
* ---------------------------------------------------------------------
*/
.w10p {
max-width: 10%;
}
.w20p {
max-width: 20%;
}
.w30p {
max-width: 30%;
}
.w40p {
max-width: 40%;
}
.w50p {
max-width: 50%;
}
.w100p {
max-width: 100%;
}
.no-padding {
padding: 0;
}
.no-padding-imp {
padding: 0 !important;
}
.no-margin {
margin: 0;
}
.box-shadow {
box-shadow: 0px 0px 15px -4px #dadada;
}
.align-top td {
vertical-align: top;
}
.no-td-borders td {
border: none !important;
}
.no-td-padding td {
padding: 0 !important;
}
div#page {
background: #fbfbfb;
background-image: none;
@ -523,14 +567,18 @@ input.sub {
font-weight: normal;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
height: auto !important;
border-radius: 2px;
font-size: 8pt;
background-color: #333 !important;
background-repeat: no-repeat !important;
background-position: 92% 3px !important;
color: white !important;
padding: 3px 3px 5px 12px;
border-color: #333;
font-size: 1.2em;
background-color: #fff;
background-repeat: no-repeat;
background-position: 92% 10px;
color: #000;
padding-bottom: 10px;
padding-top: 10px;
padding-left: 15px;
border-color: #888;
font-family: "lato", "Open Sans", sans-serif !important;
}
input.sub[disabled] {
@ -1278,12 +1326,12 @@ div.title_line {
* ---------------------------------------------------------------------
*/
#menu_tab_frame,
#menu_tab_frame_view {
#menu_tab_frame_view,
#menu_tab_frame_view_bc {
display: flex;
align-items: flex-end;
justify-content: space-between;
border-bottom: 2px solid #82b92e;
max-height: 50px;
min-height: 50px;
width: 100%;
padding-right: 0px;
@ -1297,8 +1345,43 @@ div.title_line {
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
}
/* Breadcrum */
#menu_tab_frame_view_bc {
min-height: 55px;
align-items: unset;
}
#menu_tab_frame_view_bc .breadcrumbs_container {
align-self: flex-start;
}
.menu_tab_left_bc {
flex-direction: column;
display: flex;
justify-content: space-between;
margin-right: 20px;
overflow: hidden;
}
.breadcrumbs_container {
padding-left: 10px;
padding-top: 4px;
text-indent: 0.25em;
color: #848484;
font-size: 10pt !important;
font-family: "lato-bolder", "Open Sans", sans-serif !important;
}
.breadcrumb_active {
color: #82b92e;
font-size: 10pt !important;
font-family: "lato-bolder", "Open Sans", sans-serif !important;
}
/* End - Breadcrum */
#menu_tab {
margin-right: 10px;
min-width: 510px;
}
#menu_tab .mn,
@ -1337,13 +1420,6 @@ div.title_line {
color: #fff;
}
#menu_tab li.nomn,
#menu_tab li.nomn_high {
min-width: 30px;
height: 29px;
margin-top: 0;
}
/* --- Tabs Submenu --- */
ul.subsubmenu {
border-bottom-right-radius: 5px;
@ -1423,9 +1499,9 @@ div#agent_wizard_subtabs {
#menu_tab_left li.view {
margin-left: 0px !important;
overflow-y: hidden;
padding-left: 10px;
padding-bottom: 4px;
white-space: nowrap;
}
#menu_tab_left li.view img.bottom {
@ -1436,8 +1512,9 @@ div#agent_wizard_subtabs {
#menu_tab_left li a,
#menu_tab_left li span {
color: #343434;
font-size: 16pt;
line-height: 16pt;
font-family: "lato-bolder", "Open Sans", sans-serif !important;
font-size: 18pt;
line-height: 18pt;
}
/*
@ -1742,12 +1819,14 @@ div#main_pure {
/* big_data is used in tactical and logon_ok */
.big_data {
text-decoration: none;
font: bold 2em Arial, Sans-serif;
font-family: "lato", "Open Sans", sans-serif;
font-size: 2em;
}
.med_data {
text-decoration: none;
font: bold 1.5em Arial, Sans-serif;
font-family: "lato", "Open Sans", sans-serif;
font-size: 1.5em;
}
.notify {
@ -2294,6 +2373,7 @@ td.cellBig {
tr.group_view_data,
.group_view_data {
color: #3f3f3f;
font-family: "lato", "Open Sans", sans-serif;
}
tr.group_view_crit,
@ -2422,6 +2502,8 @@ select {
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
font-family: "lato-bolder", "Open Sans", sans-serif;
font-size: 10pt;
}
/* plugins */
@ -2860,6 +2942,7 @@ a.tip {
a.tip > img {
margin-left: 2px;
margin-right: 2px;
margin-top: -3px;
}
.head_tip {
@ -3222,7 +3305,8 @@ table#policy_modules td * {
color: #fff;
margin: 2px;
padding: 10px 30px;
font-size: 15px;
font-size: 16px;
font-family: "lato-bolder", "Open Sans", sans-serif;
font-weight: bold;
border-radius: 2px;
}
@ -3293,13 +3377,18 @@ div.div_groups_status {
#menu_tab li.nomn_high {
padding-right: 8px;
padding-left: 8px;
padding-top: 6px;
font-weight: bold;
text-decoration: none;
font-size: 14px;
margin-top: 0;
min-width: 30px;
height: 40px;
min-height: 50px;
max-height: 53px;
}
#menu_tab_frame_view_bc #menu_tab li.nomn,
#menu_tab_frame_view_bc #menu_tab li.nomn_high {
min-height: 53px;
}
#menu_tab li:hover {
@ -3315,7 +3404,7 @@ div.div_groups_status {
#menu_tab li.nomn img,
#menu_tab li img {
margin-top: 3px;
margin-top: 10px;
margin-left: 3px;
}
@ -3673,7 +3762,7 @@ ul.events_tabs:after {
ul.events_tabs > li {
margin: 0 !important;
width: 20%;
width: 100%;
text-align: center;
float: none !important;
outline-width: 0;
@ -3682,7 +3771,7 @@ ul.events_tabs > li {
ul.events_tabs > li.ui-state-default {
background: #fff !important;
border: none !important;
border-bottom: 2px solid black !important;
border-bottom: 2px solid #cacaca !important;
}
ul.events_tabs > li a {
@ -4852,7 +4941,7 @@ input:checked + .p-slider:before {
/* New white rounded boxes */
.white_box {
background-color: #fff;
border: 1px solid #f3f3f3;
border: 1px solid #e1e1e1;
border-radius: 5px;
padding: 20px 50px;
}
@ -5043,7 +5132,7 @@ input:checked + .p-slider:before {
#autorefresh_list_out,
#autorefresh_list {
text-align: center;
text-align: left;
}
.autorefresh_select .autorefresh_select_list_out,
@ -5110,6 +5199,9 @@ table.info_table {
background-color: #fff;
margin-bottom: 10px;
border-spacing: 0;
border-collapse: collapse;
overflow: hidden;
border-radius: 5px;
}
table.info_table > tbody > tr:nth-child(even) {
@ -5118,7 +5210,6 @@ table.info_table > tbody > tr:nth-child(even) {
table.info_table tr:first-child > th {
background-color: #fff;
border-top: 1px solid #e2e2e2;
color: #000;
text-align: left;
vertical-align: middle;
@ -5131,25 +5222,25 @@ table.info_table th {
background-color: #fff;
}
table.info_table > thead > tr > th:first-child {
border-left: 1px solid #e2e2e2;
}
table.info_table > thead > tr > th:last-child {
border-right: 1px solid #e2e2e2;
}
table.info_table tr th {
border-bottom: 1px solid #e2e2e2;
}
/* Radius top */
table.info_table > thead > tr:first-child > th:first-child {
border-top-left-radius: 4px;
}
table.info_table > thead > tr:first-child > th:last-child {
border-top-right-radius: 4px;
}
table.info_table > thead > tr:first-child > th:first-child {
/* Radius bottom */
table.info_table > tbody > tr:last-child > td:first-child {
border-top-left-radius: 4px;
}
table.info_table > tbody > tr:last-child > td:last-child {
border-top-right-radius: 4px;
}
table.info_table > thead > tr > th,
table.info_table > tbody > tr > th,
@ -5163,6 +5254,10 @@ table.info_table > thead > tr > th a {
font-size: 8.6pt;
}
table.info_table > tbody > tr {
border-bottom: 1px solid #e2e2e2;
}
table.info_table > tbody > tr > td {
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
@ -5172,23 +5267,6 @@ table.info_table > tbody > tr > td {
padding-right: 9px;
padding-top: 7px;
padding-bottom: 7px;
border-bottom: 1px solid #e2e2e2;
}
table.info_table > tbody > tr:last-child > td:first-child {
border-bottom-left-radius: 4px;
}
table.info_table > tbody > tr > td:first-child {
border-left: 1px solid #e2e2e2;
}
table.info_table > tbody > tr:last-child > td:last-child {
border-bottom-right-radius: 4px;
}
table.info_table > tbody > tr > td:last-child {
border-right: 1px solid #e2e2e2;
}
table.info_table > tbody > tr > td > img,
@ -5448,6 +5526,9 @@ table.info_table.policy_sub_table {
.sort_arrow a {
padding: 0 0 0 5px !important;
}
.sort_arrow img {
width: 0.8em;
}
/*
* ---------------------------------------------------------------------
@ -5501,9 +5582,6 @@ table.info_table.policy_sub_table {
color: #fff;
}
.pagination .total_pages {
}
.pagination .total_number {
display: flex;
justify-content: flex-end;
@ -5591,7 +5669,9 @@ table.info_table.policy_sub_table {
background-color: transparent !important;
border: none;
border-radius: 0 !important;
border-bottom: 1px solid #343434;
border-bottom: 1px solid #ccc;
font-family: "lato-bolder", "Open Sans", sans-serif !important;
font-size: 10pt;
padding: 2px 5px;
box-sizing: border-box;
background-repeat: no-repeat;
@ -5599,154 +5679,6 @@ table.info_table.policy_sub_table {
margin-bottom: 4px;
}
/*
* ---------------------------------------------------------------------
* - Create/Update Agent - agent_manager.php
* ---------------------------------------------------------------------
*/
.agent_options {
width: 100%;
margin-right: 0px;
display: flex;
flex-flow: row wrap;
flex-direction: row;
justify-content: space-between;
box-sizing: border-box;
}
.agent_options_update {
width: 85%;
margin-right: 20px;
}
.agent_options_column_left,
.agent_options_column_right {
width: 50%;
box-sizing: border-box;
}
.agent_options_column_left {
padding-right: 50px;
}
.agent_qr {
width: 15%;
text-align: center;
box-sizing: border-box;
padding: 20px 0px;
display: flex;
justify-content: center;
flex-direction: column;
min-width: 150px;
}
a#qr_code_agent_view {
margin-top: 5px;
}
.first_row .agent_options_column_right select,
.first_row .agent_options_column_right input,
.first_row .agent_options_column_left select#grupo {
width: 95%;
box-sizing: border-box;
}
.first_row .agent_options_column_left .p-switch {
margin-right: 5px;
margin-left: 10px;
}
.agent_options_column_left input#text-direccion,
.agent_options_column_left select#address_list,
.agent_options_column_left input#text-agente,
.agent_options_column_left input#text-alias {
width: 100%;
box-sizing: border-box;
}
.agent_options_agent_name > * {
margin-left: 5px;
}
.custom_fields_table {
border-spacing: 0px;
}
.custom_fields_table tr.datos {
background-color: #f7f7f7;
display: none;
}
.custom_fields_table tr.datos2 {
cursor: pointer;
}
.custom_fields_table tr td {
border: 1px solid #e0e0e0;
}
.custom_fields_table tr.datos2 td div.field_title {
padding: 10px;
}
.custom_fields_table tr.datos2 td {
border-radius: 4px;
padding: 0px;
}
.custom_fields_table tr.datos td {
padding: 15px 10px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}
.custom_fields_table .custom_field_row_opened td {
border-bottom-left-radius: 0px !important;
border-bottom-right-radius: 0px !important;
}
.secondary_groups_select {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 15px;
}
.secondary_groups_select .secondary_groups_select_arrows input {
display: grid;
margin: 0 auto;
}
.secondary_groups_select .secondary_groups_list_left {
text-align: right;
width: 50%;
}
.secondary_groups_select .secondary_groups_list_right {
text-align: left;
width: 50%;
}
.secondary_groups_select .secondary_groups_select_arrows {
padding: 0 50px;
}
.secondary_groups_select_arrows a {
display: block;
}
.agent_options_adv .agent_options_column_right .label_select select,
.agent_options_adv .agent_options_column_right .label_select input[type="text"],
.agent_options_adv #text-custom_id,
.agent_options_adv #cps {
width: 100%;
box-sizing: border-box;
}
.agent_options_adv .label_select_simple.label_simple_one_item .p-switch {
margin-right: 5px;
}
/*
* ---------------------------------------------------------------------
* - CLASSES FOR THE NEW TOGGLES -
@ -5758,9 +5690,10 @@ a#qr_code_agent_view {
.ui_toggle > a:first-child {
background-color: #fff;
border: 1px solid #f3f3f3;
border: 1px solid #e1e1e1;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
margin-bottom: -1px;
padding: 5px;
display: block;
}
@ -5859,3 +5792,307 @@ a#qr_code_agent_view {
padding: 15px;
border-top: none;
}
/*
* ---------------------------------------------------------------------
* - AGENT VIEW
* ---------------------------------------------------------------------
*/
.bullet_modules {
width: 15px;
height: 15px;
border-radius: 50%;
margin-right: 5px;
margin-top: -2px;
}
div#bullets_modules {
display: flex;
margin-left: 2em;
}
div#bullets_modules div {
display: flex;
align-items: center;
margin: 0 5px;
}
.orange_background {
background: #ffa631;
}
.red_background {
background: #fc4444;
}
.yellow_background {
background: #fad403;
}
.grey_background {
background: #b2b2b2;
}
.blue_background {
background: #3ba0ff;
}
.green_background {
background: #80ba27;
}
/* First row in agent view */
#agent_details_first_row {
display: flex;
margin-bottom: 20px;
width: 100%;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
}
.agent_details_col {
display: table-cell;
background-color: #fff;
border: 1px solid #e2e2e2;
border-radius: 5px;
flex: 0 1 auto;
}
.agent_details_col_left {
width: 40%;
min-width: 300px;
}
.agent_details_col_right {
width: 59%;
min-width: 480px;
}
.agent_access_rate_events {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
}
.white_table_graph#table_access_rate {
flex: 1 1 auto;
min-width: 450px;
margin-right: 1%;
}
.white_table_graph#table_events {
flex: 1 1 auto;
min-width: 450px;
}
@media screen and (max-width: 1150px) {
.agent_details_col {
flex: 1 1 auto;
}
.white_table_graph#table_access_rate {
margin-right: 0;
}
}
.buttons_agent_view {
display: flex;
justify-content: flex-end;
}
.buttons_agent_view a img {
border: 1px solid #dcdcdc;
border-radius: 4px;
padding: 1px;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
max-width: 21px;
margin-left: 5px;
}
/* Agent details in agent view */
div#status_pie path {
stroke-width: 8px !important;
}
div#status_pie {
margin-bottom: 2em;
}
.agent_details_header {
display: flex;
justify-content: flex-end;
align-items: center;
border-bottom: 1px solid #e2e2e2;
padding: 6px 20px;
}
.agent_details_content {
display: flex;
align-items: center;
padding: 20px;
padding-bottom: 0;
}
.agent_details_agent_name {
display: flex;
align-items: center;
}
.agent_details_remote_cfg {
align-self: flex-start;
}
.agent_details_graph {
text-align: center;
margin: 0 auto;
}
.agent_details_info {
max-width: 45%;
overflow: hidden;
min-width: 220px;
}
.agent_details_info span {
text-overflow: ellipsis;
}
.agent_details_info p {
display: flex;
align-items: center;
}
.agent_details_info img {
padding-right: 5px;
}
.agent_details_bullets #bullets_modules {
display: flex;
justify-content: flex-start;
}
.agent_details_bullets #bullets_modules > div {
display: flex;
align-items: center;
padding-bottom: 20px;
}
#agent_contact_main tr td img {
max-width: 100%;
}
/* White tables to show graphs */
.white_table_graph {
margin-bottom: 20px;
}
.white_table_graph_header {
padding: 10px 20px;
background-color: #fff;
color: #000;
border: 1px solid #e2e2e2;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
font-weight: bold;
}
.white_table_graph_header div#bullets_modules {
float: right;
}
.white_table_graph_header img,
.white_table_graph_header span {
vertical-align: middle;
}
.white_table_graph_header span {
padding-left: 10px;
}
.white-box-content {
width: 100%;
height: 100%;
background-color: #fff;
display: flex;
align-items: center;
flex-wrap: wrap;
}
.white_table_graph_content {
border: 1px solid #e2e2e2;
border-top: none;
background-color: #fff;
padding: 20px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
align-items: center;
flex-wrap: wrap;
}
.white_table_graph_content.no-padding-imp .info_box {
margin: 0 !important;
}
.white_table_graph_content.min-height-100 {
min-height: 100px;
}
.white_table_graph_content.min-height-50 {
min-height: 50px;
}
.white_table_graph_content.min-height-200 {
min-height: 200px;
}
.white_table_graph_content div.pagination {
width: 100%;
padding: 0 1em;
}
.white_table_graph_content div.action-buttons {
padding: 10px;
}
/* White tables */
.white_table,
.white_table tr:first-child > th {
background-color: #fff;
color: #000;
}
.white_table {
border: 1px solid #e2e2e2;
border-radius: 4px;
margin-bottom: 20px;
padding-bottom: 10px;
}
.white_table thead tr:first-child > th {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom: 1px solid #e2e2e2;
}
.white_table tbody tr:first-child > td {
padding-top: 25px;
}
.white_table tr td:first-child,
.white_table tr th:first-child {
padding-left: 50px;
}
.white_table tr td:last-child,
.white_table tr th:last-child {
padding-right: 50px;
}
.white_table th,
.white_table td {
padding: 10px 20px;
}
.white_table_droppable > thead > tr > th > img {
vertical-align: middle;
}
.white_table_droppable tr th:first-child {
padding-left: 20px;
}
.white_table_no_border {
border: none !important;
}

View File

@ -0,0 +1,20 @@
span.progress_text {
position: absolute;
font-family: "lato-bolder", "Open Sans", sans-serif;
font-size: 2em;
margin-left: -0.5em;
}
div.progress_main {
display: inline-block;
text-align: center;
height: 2.5em;
border: 1px solid #80ba27;
}
div.progress {
width: 0%;
background: #80ba27;
height: 100%;
float: left;
}

View File

@ -140,8 +140,10 @@ if ($idAgent != 0) {
$tab = get_parameter('tab', 'main');
ob_start();
if ($tab == 'main') {
echo "<h4 style='padding-top:0px !important;'>".__('Full list of alerts').'</h4>';
$agent_view_page = true;
}
} else {
$agent_a = check_acl($config['id_user'], 0, 'AR');
@ -610,7 +612,12 @@ foreach ($alerts['alerts_simple'] as $alert) {
}
if (!empty($table->data)) {
echo '<form method="post" action="'.$url.'">';
$class = '';
if ($agent_view_page === true) {
$class = 'white_table_graph_content w100p no-padding-imp';
}
echo '<form class="'.$class.'" method="post" action="'.$url.'">';
ui_pagination(
$countAlertsSimple,
@ -643,10 +650,31 @@ if (!empty($table->data)) {
}
echo '</form>';
$alerts_defined = true;
} else {
ui_print_info_message(['no_close' => true, 'message' => __('No alerts found') ]);
$alerts_defined = false;
}
$html_content = ob_get_clean();
if ($agent_view_page === true) {
// Create controlled toggle content.
ui_toggle(
$html_content,
__('Full list of alerts'),
'status_monitor_agent',
!$alerts_defined,
false,
'',
'white_table_graph_content no-padding-imp'
);
} else {
// Dump entire content.
echo $html_content;
}
// strict user hidden
echo '<div id="strict_hidden" style="display:none;">';
html_print_input_text('strict_user_hidden', $strict_user);
@ -716,4 +744,4 @@ ui_require_jquery_file('cluetip');
}
}).change();
</script>
</script>

View File

@ -1,17 +1,32 @@
<?php
/**
* Agent status - general overview.
*
* @category Agent view status.
* @package Pandora FMS
* @subpackage Classic agent management view.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
// Begin.
global $config;
require_once 'include/functions_agents.php';
@ -27,7 +42,12 @@ require_once $config['homedir'].'/include/functions_clippy.php';
check_login();
$strict_user = (bool) db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
$strict_user = (bool) db_get_value(
'strict_acl',
'tusuario',
'id_user',
$config['id_user']
);
$id_agente = get_parameter_get('id_agente', -1);
@ -50,7 +70,10 @@ if ($is_extra === ENTERPRISE_NOT_HOOK) {
$is_extra = false;
}
if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AR') && ! check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') && !$is_extra) {
if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AR')
&& ! check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')
&& !$is_extra
) {
db_pandora_audit(
'ACL Violation',
'Trying to access Agent General Information'
@ -59,20 +82,18 @@ if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AR') && ! check_
return;
}
// START: TABLE AGENT BUILD
$table_agent = new stdClass();
$table_agent->id = 'agent_details_main';
$table_agent->width = '95%';
$table_agent->cellspacing = 0;
$table_agent->cellpadding = 0;
$table_agent->class = 'databox filters';
$table_agent->style[0] = 'width: 16px; text-align:center; padding: 0px;';
$table_agent->style[5] = 'width: 16px; text-align:center; padding: 0px;';
$table_agent->styleTable = 'padding:0px;';
$table_agent->data = [];
$data = [];
$agent_name = ui_print_agent_name($agent['id_agente'], true, 500, 'font-size: medium;font-weight:bold', true);
/*
* START: TABLE AGENT BUILD.
*/
$agent_name = ui_print_agent_name(
$agent['id_agente'],
true,
500,
'font-size: medium;font-weight:bold',
true
);
$in_planned_downtime = db_get_sql(
'SELECT executed FROM tplanned_downtime
INNER JOIN tplanned_downtime_agents
@ -80,7 +101,6 @@ $in_planned_downtime = db_get_sql(
WHERE tplanned_downtime_agents.id_agent = '.$agent['id_agente'].' AND tplanned_downtime.executed = 1'
);
if ($agent['disabled']) {
if ($in_planned_downtime) {
$agent_name = '<em>'.$agent_name.ui_print_help_tip(__('Disabled'), true);
@ -98,24 +118,35 @@ if ($agent['disabled']) {
}
if ($in_planned_downtime && !$agent['disabled'] && !$agent['quiet']) {
$agent_name .= '<em>'.'&nbsp;'.ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png').'</em>';
} else if (($in_planned_downtime && !$agent['disabled']) || ($in_planned_downtime && !$agent['quiet'])) {
$agent_name .= '&nbsp;'.ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png').'</em>';
$agent_name .= '<em>&nbsp;'.ui_print_help_tip(
__('Agent in planned downtime'),
true,
'images/minireloj-16.png'
).'</em>';
} else if (($in_planned_downtime && !$agent['disabled'])
|| ($in_planned_downtime && !$agent['quiet'])
) {
$agent_name .= '&nbsp;'.ui_print_help_tip(
__('Agent in planned downtime'),
true,
'images/minireloj-16.png'
).'</em>';
}
$table_agent_header = '<div class="agent_details_agent_alias">';
$table_agent_header .= $agent_name;
$table_agent_header .= '</div>';
$table_agent_header .= '<div class="agent_details_agent_name">';
if (!$config['show_group_name']) {
$data[0] = ui_print_group_icon($agent['id_grupo'], true);
} else {
$data[0] = '';
$table_agent_header .= ui_print_group_icon(
$agent['id_grupo'],
true,
'groups_small',
'padding-right: 6px;'
);
}
$table_agent->cellstyle[count($table_agent->data)][0] = 'width: 16px; text-align:center; padding: 0px;';
$data[2] = $agent_name;
$table_agent->colspan[count($table_agent->data)][2] = 3;
$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 100px; word-break: break-all;';
$table_agent_header .= '</div>';
$status_img = agents_detail_view_status_img(
$agent['critical_count'],
@ -124,39 +155,36 @@ $status_img = agents_detail_view_status_img(
$agent['total_count'],
$agent['notinit_count']
);
$data[2] .= '&nbsp;&nbsp;'.$status_img;
$table_agent->data[] = $data;
$table_agent->rowclass[] = '';
$table_agent_header .= '<div class="icono_right">'.$status_img.'</div>';
// Fixed width non interactive charts.
$status_chart_width = 180;
$graph_width = 180;
$data = [];
$table_agent_graph = '<div id="status_pie" style="width: '.$status_chart_width.'px;">';
$table_agent_graph .= graph_agent_status(
$id_agente,
$graph_width,
$graph_width,
true,
false,
false,
true
);
$table_agent_graph .= '</div>';
// $data[0] = reporting_tiny_stats ($agent, true, 'agent', '<div style="height: 5px;"></div>');
// $table_agent->rowspan[count($table_agent->data)][0] = 6;
// Fixed width non interactive charts
$status_chart_width = 150;
$graph_width = 150;
$data[0] = '<div style="margin: 0 auto 6px auto; width: 150px;">';
$data[0] .= '<div id="status_pie" style="margin: auto; width: '.$status_chart_width.'px;">';
$data[0] .= graph_agent_status($id_agente, $graph_width, 120, true);
$data[0] .= '</div>';
$data[0] .= '<br>'.reporting_tiny_stats($agent, true);
$data[0] .= ui_print_help_tip(__('Agent statuses are re-calculated by the server, they are not shown in real time.'), true);
$data[0] .= '</div>';
$table_agent->rowspan[count($table_agent->data)][0] = 6;
$table_agent->colspan[count($table_agent->data)][0] = 2;
$table_agent->cellstyle[count($table_agent->data)][0] = 'width: 150px; text-align:center; padding: 0px; vertical-align: top;';
$data[2] = ui_print_os_icon($agent['id_os'], false, true, true, false, false, false, ['title' => __('OS').': '.get_os_name($agent['id_os'])]);
$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align: right; padding: 0px;';
$data[3] = empty($agent['os_version']) ? get_os_name((int) $agent['id_os']) : $agent['os_version'];
$table_agent->colspan[count($table_agent->data)][3] = 2;
$table_agent->data[] = $data;
$table_agent->rowclass[] = '';
$table_agent_os = '<p>'.ui_print_os_icon(
$agent['id_os'],
false,
true,
true,
false,
false,
false,
['title' => __('OS').': '.get_os_name($agent['id_os'])]
);
$table_agent_os .= (empty($agent['os_version'])) ? get_os_name((int) $agent['id_os']) : $agent['os_version'].'</p>';
$addresses = agents_get_addresses($id_agente);
$address = agents_get_address($id_agente);
@ -168,55 +196,95 @@ foreach ($addresses as $k => $add) {
}
if (!empty($address)) {
$data = [];
$data[2] = html_print_image('images/world.png', true, ['title' => __('IP address')]);
$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align: right; padding: 0px;';
$data[3] = '<span style="vertical-align:top; display: inline-block;">';
$data[3] .= empty($address) ? '<em>'.__('N/A').'</em>' : $address;
$data[3] .= '</span>';
$table_agent->colspan[count($table_agent->data)][3] = 2;
$table_agent->data[] = $data;
$table_agent->rowclass[] = '';
$table_agent_ip = '<p>'.html_print_image('images/world.png', true, ['title' => __('IP address')]);
$table_agent_ip .= '<span style="vertical-align:top; display: inline-block;">';
$table_agent_ip .= empty($address) ? '<em>'.__('N/A').'</em>' : $address;
$table_agent_ip .= '</span></p>';
}
$data = [];
$data[2] = html_print_image('images/version.png', true, ['title' => __('Agent Version')]);
$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align: right; padding: 0px;';
$data[3] = '<span style="vertical-align:top; display: inline-block;">';
$data[3] .= empty($agent['agent_version']) ? '<i>'.__('N/A').'</i>' : $agent['agent_version'];
$data[3] .= '</span>';
$table_agent->colspan[count($table_agent->data)][3] = 2;
$table_agent->data[] = $data;
$table_agent->rowclass[] = '';
$table_agent_version = '<p>'.html_print_image('images/version.png', true, ['title' => __('Agent Version')]);
$table_agent_version .= '<span style="vertical-align:top; display: inline-block;">';
$table_agent_version .= empty($agent['agent_version']) ? '<i>'.__('N/A').'</i>' : $agent['agent_version'];
$table_agent_version .= '</span></p>';
$data = [];
$data[2] = html_print_image(
$table_agent_description = '<p>'.html_print_image(
'images/default_list.png',
true,
['title' => __('Description')]
);
$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align: right; padding: 0px;';
$data[3] = '<span style="vertical-align:top; display: inline-block;">';
$data[3] .= empty($agent['comentarios']) ? '<em>'.__('N/A').'</em>' : $agent['comentarios'];
$data[3] .= '</span>';
$table_agent->colspan[count($table_agent->data)][3] = 2;
$table_agent_description .= '<span style="vertical-align:top; display: inline-block;">';
$table_agent_description .= empty($agent['comentarios']) ? '<em>'.__('N/A').'</em>' : $agent['comentarios'];
$table_agent_description .= '</span></p>';
$table_agent->data[] = $data;
$table_agent->rowclass[] = '';
$table_agent_count_modules = reporting_tiny_stats(
$agent,
true,
'agent',
// Useless.
':',
true
);
$has_remote_conf = enterprise_hook(
'config_agents_has_remote_configuration',
[$agent['id_agente']]
);
if ($has_remote_conf) {
$remote_cfg = '<p>'.html_print_image('images/remote_configuration.png', true);
$remote_cfg .= __('Remote configuration enabled').'</p>';
} else {
$remote_cfg = '';
}
// $table_agent_count_modules .= ui_print_help_tip(__('Agent statuses are re-calculated by the server, they are not shown in real time.'), true);
$table_agent = '
<div class="agent_details_header">
'.$table_agent_header.'
</div>
<div class="agent_details_content">
<div class="agent_details_graph">
'.$table_agent_graph.'
<div class="agent_details_bullets">
'.$table_agent_count_modules.'
</div>
</div>
<div class="agent_details_info">
'.$table_agent_os.$table_agent_ip.$table_agent_version.$table_agent_description.$remote_cfg.'
</div>
</div>';
/*
* END: TABLE AGENT BUILD.
*/
/*
*START: TABLE CONTACT BUILD.
*/
// END: TABLE AGENT BUILD
// START: TABLE CONTACT BUILD
$table_contact = new stdClass();
$table_contact->id = 'agent_contact_main';
$table_contact->width = '100%';
$table_contact->cellspacing = 0;
$table_contact->cellpadding = 0;
$table_contact->class = 'databox data';
$table_contact->style[0] = 'width: 30%;height:30px;';
$table_contact->class = 'white_table white_table_no_border';
$table_contact->style[0] = 'width: 30%;';
$table_contact->style[1] = 'width: 70%;';
$table_contact->headstyle[1] = 'padding-top:6px; padding-bottom:6px;padding-right: 10px;';
$table_contact->head[0] = ' <span>'.__('Agent contact').'</span>';
$table_contact->head_colspan[0] = 2;
$buttons_refresh_agent_view = '<div class="buttons_agent_view">';
$buttons_refresh_agent_view .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'&amp;refr=60">'.html_print_image('images/refresh.png', true, ['title' => __('Refresh data'), 'alt' => '']).'</a><br>';
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
$buttons_refresh_agent_view .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;flag_agent=1&amp;id_agente='.$id_agente.'">'.html_print_image('images/target.png', true, ['title' => __('Force remote checks'), 'alt' => '']).'</a>';
}
$buttons_refresh_agent_view .= '</div>';
$table_contact->head[1] = $buttons_refresh_agent_view;
$data = [];
$data[0] = '<b>'.__('Interval').'</b>';
@ -236,140 +304,141 @@ if ($agent['ultimo_contacto_remoto'] == '01-01-1970 00:00:00') {
$table_contact->data[] = $data;
$data = [];
$data[0] = '<b>'.__('Next contact').'</b>';
$progress = agents_get_next_contact($id_agente);
$data[1] = progress_bar($progress, 200, 20, '', 1, false, '#666666');
$data[1] = ui_progress(
$progress,
'100%',
1.8,
'#BBB',
true,
($agent['intervalo'] * (100 - $progress) / 100).' s'
);
if ($progress > 100) {
$data[1] .= clippy_context_help('agent_out_of_limits');
$data[0] .= clippy_context_help('agent_out_of_limits');
}
$table_contact->data[] = $data;
// END: TABLE CONTACT BUILD
// START: TABLE DATA BUILD
$table_data = new stdClass();
$table_data->id = 'agent_data_main';
$table_data->width = '100%';
$table_data->styleTable = 'height:180px';
$table_data->cellspacing = 0;
$table_data->cellpadding = 0;
$table_data->class = 'databox data';
$table_data->style[0] = 'width: 30%;';
$table_data->style[1] = 'width: 40%;';
$table_data->head[0] = ' <span>'.__('Agent info').'</span>';
$table_data->head_colspan[0] = 3;
$data = [];
$data[0] = '<b>'.__('Group').'</b>';
$data[1] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$agent['id_grupo'].'">'.groups_get_name($agent['id_grupo']).'</a>';
// ACCESS RATE GRAPH
$access_agent = db_get_value_sql(
'SELECT COUNT(id_agent)
FROM tagent_access
WHERE id_agent = '.$id_agente
);
if ($config['agentaccess'] && $access_agent > 0) {
$data[2] = '<fieldset width=99% class="databox agente" style="">
<legend>'.__('Agent access rate (24h)').'</legend>'.graphic_agentaccess($id_agente, '95%', 100, SECONDS_1DAY, true).'</fieldset>';
$table_data->style[0] = 'width: 20%;';
$table_data->style[1] = 'width: 30%;';
$table_data->style[2] = 'width: 50%;';
$table_data->rowspan[0][2] = 5;
}
$table_data->data[] = $data;
if (!empty($addresses)) {
$data = [];
$data[0] = '<b>'.__('Other IP addresses').'</b>';
$data[1] = '<div style="max-height: 45px; overflow-y: scroll; height:45px;">'.implode('<br>', $addresses).'</div>';
$table_data->data[] = $data;
}
$table_contact->data[] = $data;
$data = [];
$data[0] = '<b>'.__('Parent').'</b>';
if ($agent['id_parent'] == 0) {
$data[0] = '<b>'.__('Secondary groups').'</b>';
$secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
if (!$secondary_groups) {
$data[1] = '<em>'.__('N/A').'</em>';
} else {
$data[1] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent['id_parent'].'">'.agents_get_alias($agent['id_parent']).'</a>';
$secondary_links = [];
foreach ($secondary_groups['for_select'] as $id => $name) {
$secondary_links[] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$id.'">'.$name.'</a>';
}
$data[1] = implode(', ', $secondary_links);
}
$table_data->data[] = $data;
$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']]);
$table_contact->data[] = $data;
if (enterprise_installed()) {
$data = [];
$data[0] = '<b>'.__('Remote configuration').'</b>';
if (!$has_remote_conf) {
$data[1] = __('Disabled');
} else {
$data[1] = __('Enabled');
}
$table_data->data[] = $data;
$data = [];
$data[0] = '<b>'.__('Secondary groups').'</b>';
$secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
if (!$secondary_groups) {
$data[0] = '<b>'.__('Parent').'</b>';
if ($agent['id_parent'] == 0) {
$data[1] = '<em>'.__('N/A').'</em>';
} else {
$secondary_links = [];
foreach ($secondary_groups['for_select'] as $id => $name) {
$secondary_links[] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$id.'">'.$name.'</a>';
}
$data[1] = implode(', ', $secondary_links);
$data[1] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent['id_parent'].'">'.agents_get_alias($agent['id_parent']).'</a>';
}
$table_data->data[] = $data;
$table_contact->data[] = $data;
}
if ($config['activate_gis'] || $agent['url_address'] != '') {
$data = [];
// Position Information
if ($config['activate_gis']) {
$dataPositionAgent = gis_get_data_last_position_agent($agent['id_agente']);
/*
* END: TABLE CONTACT BUILD
*/
$data[0] = '<b>'.__('Position (Long, Lat)').'</b>';
/*
* START: TABLE DATA BUILD
*/
if ($dataPositionAgent === false) {
$data[1] = __('There is no GIS data.');
$table_data = new stdClass();
$table_data->id = 'agent_data_main';
$table_data->width = '100%';
$table_data->cellspacing = 0;
$table_data->cellpadding = 0;
$table_data->class = 'box-shadow white_table white_table_droppable align-top';
$table_data->style = array_fill(0, 3, 'width: 25%;');
$table_data->head[0] = html_print_image(
'images/arrow_down_green.png',
true,
$options
);
$table_data->head[0] .= ' <span style="vertical-align: middle; font-weight:bold; padding-left:20px">'.__('Agent info').'</span>';
$table_data->head_colspan[0] = 4;
// Gis and url address.
$data_opcional = [];
// Position Information.
if ($config['activate_gis']) {
$data_opcional[] = '<b>'.__('Position (Long, Lat)').'</b>';
$dataPositionAgent = gis_get_data_last_position_agent(
$agent['id_agente']
);
if ($dataPositionAgent === false) {
$data_opcional[] = __('There is no GIS data.');
} else {
$data_opcional[] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=gis&amp;id_agente='.$id_agente.'">';
if ($dataPositionAgent['description'] != '') {
$data_opcional[] .= $dataPositionAgent['description'];
} else {
$data[1] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=gis&amp;id_agente='.$id_agente.'">';
if ($dataPositionAgent['description'] != '') {
$data[1] .= $dataPositionAgent['description'];
} else {
$data[1] .= $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude'];
}
$data[1] .= '</a>';
$data_opcional[] .= $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude'];
}
$table_data->data[] = $data;
$data_opcional[] .= '</a>';
}
// If the url description is setted
array_push($data_opcional);
}
// If the url description is set.
if ($agent['url_address'] != '') {
// $data_opcional = [];
$data_opcional[] = '<b>'.__('Url address').'</b>';
if ($agent['url_address'] != '') {
$data = [];
$data[0] = '<b>'.__('Url address').'</b>';
$data[1] = '<a href='.$agent['url_address'].'>'.$agent['url_address'].'</a>';
$table_data->data[] = $data;
$data_opcional[] = '<a href='.$agent['url_address'].'>'.$agent['url_address'].'</a>';
}
}
// Timezone Offset
if ($agent['timezone_offset'] != 0) {
$data = [];
$data[0] = '<b>'.__('Timezone Offset').'</b>';
$data[1] = $agent['timezone_offset'];
$table->data[] = $data;
// Other IP address and timezone offset.
if (!empty($addresses)) {
// $data_opcional = [];
$data_opcional[] = '<b>'.__('Other IP addresses').'</b>';
if (!empty($addresses)) {
$data_opcional[] = '<div style="overflow-y: scroll;">'.implode('<br>', $addresses).'</div>';
}
}
// Custom fields
// Timezone Offset.
if ($agent['timezone_offset'] != 0) {
$data_opcional[] = '<b>'.__('Timezone Offset').'</b>';
if ($agent['timezone_offset'] != 0) {
$data_opcional[] = $agent['timezone_offset'];
}
}
$data_opcional = array_chunk($data_opcional, 4);
foreach ($data_opcional as $key => $value) {
$table_data->data[] = $data_opcional[$key];
}
// Custom fields.
$fields = db_get_all_rows_filter(
'tagent_custom_fields',
['display_on_front' => 1]
@ -378,6 +447,7 @@ if ($fields === false) {
$fields = [];
}
$custom_fields = [];
foreach ($fields as $field) {
$data = [];
$data[0] = '<b>'.$field['name'].ui_print_help_tip(__('Custom field'), true).'</b>';
@ -398,17 +468,75 @@ foreach ($fields as $field) {
$data[1] = $custom_value[0]['description'];
}
$table_data->data[] = $data;
$custom_fields[] = $data;
}
// END: TABLE DATA BUILD
// START: TABLE INCIDENTS
$custom_fields_count = count($custom_fields);
for ($i = 0; $i < $custom_fields_count; $i++) {
$first_column = $custom_fields[$i];
$j = ($i + 1);
$second_column = $custom_fields[$j];
if (is_array($second_column)) {
$columns = array_merge($first_column, $second_column);
} else {
$columns = $first_column;
$filas = count($table_data->data);
$table_data->colspan[$filas][1] = 3;
}
$table_data->data[] = $columns;
$i++;
}
/*
* END: TABLE DATA BUILD
*/
/*
* START: ACCESS RATE GRAPH
*/
$access_agent = db_get_value_sql(
'SELECT COUNT(id_agent)
FROM tagent_access
WHERE id_agent = '.$id_agente
);
if ($config['agentaccess'] && $access_agent > 0) {
$table_access_rate = '<div class="box-shadow white_table_graph" id="table_access_rate">
<div class="white_table_graph_header">'.html_print_image(
'images/arrow_down_green.png',
true
).'<span>'.__('Agent access rate (24h)').'</span></div>
<div class="white_table_graph_content min-height-100">
'.graphic_agentaccess(
$id_agente,
'95%',
100,
SECONDS_1DAY,
true
).'</div>
</div>';
}
/*
* END: ACCESS RATE GRAPH
*/
/*
* START: TABLE INCIDENTS
*/
$last_incident = db_get_row_sql(
"
SELECT * FROM tincidencia
WHERE estado IN (0,1)
AND id_agent = $id_agente
ORDER BY actualizacion DESC"
sprintf(
'SELECT * FROM tincidencia
WHERE estado IN (0,1)
AND id_agent = %d
ORDER BY actualizacion DESC',
$id_agente
)
);
if ($last_incident != false) {
@ -416,36 +544,35 @@ if ($last_incident != false) {
$table_incident->width = '100%';
$table_incident->cellspacing = 0;
$table_incident->cellpadding = 0;
$table_incident->class = 'databox';
$table_incident->style[0] = 'width: 30%;';
$table_incident->style[1] = 'width: 70%;';
$table_incident->class = 'white_table';
$table_incident->style = array_fill(0, 3, 'width: 25%;');
$table_incident->head[0] = ' <span>'.'<a href="index.php?sec=incidencias&amp;sec2=operation/incidents/incident_detail&amp;id='.$last_incident['id_incidencia'].'">'.__('Active incident on this agent').'</a>'.'</span>';
$table_incident->head_colspan[0] = 2;
$table_incident->head[0] = ' <span><a href="index.php?sec=incidencias&amp;sec2=operation/incidents/incident_detail&amp;id='.$last_incident['id_incidencia'].'">'.__('Active incident on this agent').'</a></span>';
$table_incident->head_colspan[0] = 4;
$data = [];
$data[0] = '<b>'.__('Author').'</b>';
$data[1] = $last_incident['id_creator'];
$data[2] = '<b>'.__('Timestamp').'</b>';
$data[3] = $last_incident['inicio'];
$table_incident->data[] = $data;
$data = [];
$data[0] = '<b>'.__('Title').'</b>';
$data[1] = '<a href="index.php?sec=incidencias&amp;sec2=operation/incidents/incident_detail&amp;id='.$last_incident['id_incidencia'].'">'.$last_incident['titulo'].'</a>';
$table_incident->data[] = $data;
$data = [];
$data[0] = '<b>'.__('Timestamp').'</b>';
$data[1] = $last_incident['inicio'];
$table_incident->data[] = $data;
$data = [];
$data[0] = '<b>'.__('Priority').'</b>';
$data[1] = incidents_print_priority_img($last_incident['prioridad'], true);
$data[2] = '<b>'.__('Priority').'</b>';
$data[3] = incidents_print_priority_img($last_incident['prioridad'], true);
$table_incident->data[] = $data;
}
// END: TABLE INCIDENTS
// START: TABLE INTERFACES
/*
* END: TABLE INCIDENTS
*/
/*
* START: TABLE INTERFACES
*/
$network_interfaces_by_agents = agents_get_network_interfaces([$agent]);
$network_interfaces = [];
@ -456,8 +583,8 @@ if (!empty($network_interfaces_by_agents) && !empty($network_interfaces_by_agent
if (!empty($network_interfaces)) {
$table_interface = new stdClass();
$table_interface->id = 'agent_interface_info';
$table_interface->class = 'databox data';
$table_interface->width = '98%';
$table_interface->class = 'info_table';
$table_interface->width = '100%';
$table_interface->style = [];
$table_interface->style['interface_status'] = 'width: 30px;padding-top:0px;padding-bottom:0px;';
$table_interface->style['interface_graph'] = 'width: 20px;padding-top:0px;padding-bottom:0px;';
@ -476,12 +603,8 @@ if (!empty($network_interfaces)) {
$table_interface->head = [];
$options = [
'class' => 'closed',
'style' => 'vertical-align:righ; cursor:pointer;',
'style' => 'cursor:pointer;',
];
$table_interface->head[0] = html_print_image('images/graphmenu_arrow.png', true, $options).'&nbsp;&nbsp;';
$table_interface->head[0] .= '<span style="vertical-align: middle;">'.__('Interface information').' (SNMP)</span>';
$table_interface->head_colspan = [];
$table_interface->head_colspan[0] = 8;
$table_interface->data = [];
$event_text_cont = 0;
@ -499,7 +622,14 @@ if (!empty($network_interfaces)) {
$params_json = json_encode($params);
$params_encoded = base64_encode($params_json);
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
$graph_link = "<a href=\"javascript:winopeng_var('operation/agentes/interface_traffic_graph_win.php?params=$params_encoded','$win_handle', 1000, 650)\">".html_print_image('images/chart_curve.png', true, ['title' => __('Interface traffic')]).'</a>';
$graph_link = "<a href=\"javascript:winopeng_var('operation/agentes/interface_traffic_graph_win.php?params=";
$graph_link .= $params_encoded."','";
$graph_link .= $win_handle."', 1000, 650)\">";
$graph_link .= html_print_image(
'images/chart_curve.png',
true,
['title' => __('Interface traffic')]
).'</a>';
} else {
$graph_link = '';
}
@ -522,9 +652,9 @@ if (!empty($network_interfaces)) {
$status_condition = ' AND (estado = 0 OR estado = 1) ';
$unixtime = (get_system_time() - SECONDS_1DAY);
// last hour
// Last hour.
$time_condition = 'AND (utimestamp > '.$unixtime.')';
// Tags ACLS
// Tags ACLs.
if ($id_group > 0 && in_array(0, $user_groups_ids)) {
$group_array = (array) $id_group;
} else {
@ -547,18 +677,16 @@ if (!empty($network_interfaces)) {
$id_modules_array[] = $interface['status_module_id'];
$unixtime = (get_system_time() - SECONDS_1DAY);
// last hour
// Last hour.
$time_condition = 'WHERE (te.utimestamp > '.$unixtime.')';
$sqlEvents = sprintf(
'
SELECT *
'SELECT *
FROM tevento te
INNER JOIN tagente_estado tae
ON te.id_agentmodule = tae.id_agente_modulo
AND tae.id_agente_modulo IN (%s)
%s
',
%s',
implode(',', $id_modules_array),
$time_condition
);
@ -600,69 +728,112 @@ if (!empty($network_interfaces)) {
$table_interface->data[] = $data;
}
}
// This javascript piece of code is used to make expandible the body of the table
?>
/*
* END: TABLE INTERFACES
*/
// This javascript piece of code is used to make expandible
// the body of the table.
?>
<script type="text/javascript">
$(document).ready (function () {
$("#agent_interface_info").find("tbody").hide();
$("#agent_interface_info").find("thead").click (function () {
var arrow = $("#agent_interface_info").find("thead").find("img");
if (arrow.hasClass("closed")) {
arrow.removeClass("closed");
arrow.prop("src", "images/arrow-down-white.png");
$("#agent_interface_info").find("tbody").show();
} else {
arrow.addClass("closed");
arrow.prop("src", "images/graphmenu_arrow.png");
$("#agent_interface_info").find("tbody").hide();
}
})
.css('cursor', 'pointer');
$("#agent_data_main").find("thead").click (function () {
close_table('#agent_data_main');
})
.css('cursor', 'pointer');
$("#table_events").find(".white_table_graph_header").click (function () {
close_table_white('#table_events');
})
.css('cursor', 'pointer');
$("#table_access_rate").find(".white_table_graph_header").click (function () {
close_table_white('#table_access_rate');
})
.css('cursor', 'pointer');
function close_table(id){
var arrow = $(id).find("thead").find("img");
if (arrow.hasClass("closed")) {
arrow.removeClass("closed");
arrow.prop("src", "images/arrow_down_green.png");
$(id).find("tbody").show();
} else {
arrow.addClass("closed");
arrow.prop("src", "images/arrow_right_green.png");
$(id).find("tbody").hide();
}
}
function close_table_white(id){
var arrow = $(id).find(".white_table_graph_header").find("img");
if (arrow.hasClass("closed")) {
arrow.removeClass("closed");
arrow.prop("src", "images/arrow_down_green.png");
$(id).find(".white_table_graph_content").show();
} else {
arrow.addClass("closed");
arrow.prop("src", "images/arrow_right_green.png");
$(id).find(".white_table_graph_content").hide();
}
}
});
</script>
<?php
<?php
// EVENTS.
if ($config['agentaccess'] && $access_agent > 0) {
$extra_class = 'min-height-100';
} else {
$extra_class = '';
}
// END: TABLE INTERFACES
$table = new stdClass();
$table->id = 'agent_details';
$table->width = '100%';
$table->cellspacing = 0;
$table->cellpadding = 0;
$table->class = 'agents';
$table->style = array_fill(0, 3, 'vertical-align: top;');
$table_events = '<div class="box-shadow white_table_graph" id="table_events">
<div class="white_table_graph_header">'.html_print_image(
'images/arrow_down_green.png',
true
).'<span>'.__('Events (24h)').'</span></div>
<div class="white_table_graph_content '.$extra_class.'">
'.graph_graphic_agentevents(
$id_agente,
100,
45,
SECONDS_1DAY,
'',
true,
true
).'</div>
</div>';
$data = [];
$data[0][0] = html_print_table($table_agent, true);
$data[0][0] .= '<br /> <table width=95% class="databox agente" style="">
<tr><th>'.__('Events (24h)').'</th></tr>'.'<tr><td style="text-align:center;padding-left:20px;padding-right:20px;"><br />'.graph_graphic_agentevents($id_agente, 100, 45, SECONDS_1DAY, '', true, true).'<br /></td></tr>'.'</table>';
/*
* EVENTS TABLE END.
*/
$table->style[0] = 'width:40%; vertical-align:top;';
$data[0][1] = html_print_table($table_contact, true);
$data[0][1] .= empty($table_data->data) ? '' : '<br>'.html_print_table($table_data, true);
$data[0][1] .= !isset($table_incident) ? '' : '<br>'.html_print_table($table_incident, true);
$agent_contact = html_print_table($table_contact, true);
$table->rowspan[1][0] = 0;
$agent_info = empty($table_data->data) ? '' : html_print_table($table_data, true);
$data[0][2] = '<div style="width:100%; text-align:right">';
$data[0][2] .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'&amp;refr=60">'.html_print_image('images/refresh.png', true, ['border' => '0', 'title' => __('Refresh data'), 'alt' => '']).'</a><br>';
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
$data[0][2] .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;flag_agent=1&amp;id_agente='.$id_agente.'">'.html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force remote checks'), 'alt' => '']).'</a>';
$agent_incidents = !isset($table_incident) ? '' : html_print_table($table_incident, true);
echo '<div id="agent_details_first_row">
<div class="box-shadow agent_details_col agent_details_col_left">'.$table_agent.'</div>
<div class="box-shadow agent_details_col agent_details_col_right">'.$agent_contact.'</div>
</div>'.$agent_info;
// Show both graphs, events and access rate.
if ($table_access_rate) {
echo '<div class="agent_access_rate_events">'.$table_access_rate.$table_events.'</div>';
} else {
echo '<div style="width: 100%">'.$table_events.'</div>';
}
$data[0][2] .= '</div>';
$table->data = $data;
$table->rowclass[] = '';
$table->cellstyle[1][0] = 'text-align:center;';
html_print_table($table);
$data2[1][0] = !isset($table_interface) ? '' : html_print_table($table_interface, true);
$table->data = $data2;
$table->styleTable = '';
html_print_table($table);
unset($table);
echo $agent_incidents;
if (isset($table_interface)) {
ui_toggle(
html_print_table($table_interface, true),
'<b>'.__('Interface information (SNMP)').'</b>'
);
}

View File

@ -1,17 +1,32 @@
<?php
/**
* Monitors status - general overview.
*
* @category Agent view monitor statuses.
* @package Pandora FMS
* @subpackage Classic agent management view.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load globar vars
// Begin.
global $config;
// Ajax tooltip to deploy modules's tag info.
@ -102,7 +117,7 @@ if (is_ajax()) {
$data[1] = ui_print_agent_name($id_agent, true);
$data[2] = __('Module');
$data[3] = "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente
&id_agente=$id_agent&tab=module&edit_module=1&id_agent_module=$id_module'>".ui_print_truncate_text(modules_get_agentmodule_name($id_module), 'module_medium', true, true, true, '[&hellip;]').'</a>';
&id_agente=".$id_agent.'&tab=module&edit_module=1&id_agent_module='.$id_module."'>".ui_print_truncate_text(modules_get_agentmodule_name($id_module), 'module_medium', true, true, true, '[&hellip;]').'</a>';
$table_relations->data[] = $data;
}
@ -132,33 +147,46 @@ $sort_field = get_parameter('sort_field', 'name');
$sort = get_parameter('sort', 'up');
echo "<h4 style='padding-top:0px !important;'>";
echo ui_print_help_tip(__('To see the list of modules paginated, enable this option in the Styles Configuration.'), true).__('Full list of monitors').'&nbsp;'.reporting_tiny_stats($agent, true, 'modules');
$modules_not_init = agents_monitor_notinit($id_agente);
if (!empty($modules_not_init)) {
echo clippy_context_help('modules_not_init');
$help_not_init = clippy_context_help('modules_not_init');
} else {
$help_not_init = '';
}
echo '</h4>';
ob_start();
print_form_filter_monitors($id_agente, $status_filter_monitor, $status_text_monitor, $status_hierachy_mode);
print_form_filter_monitors(
$id_agente,
$status_filter_monitor,
$status_text_monitor,
$status_hierachy_mode
);
echo "<div id='module_list_loading'>".html_print_image('images/spinner.gif', true).'</div>';
echo "<div id='module_list'>".'</div>';
echo '<div id="module_list"></div>';
$html_toggle = ob_get_clean();
ui_toggle(
$html_toggle,
__('List of modules'),
__('List of modules').$help_not_init.ui_print_help_tip(
__('To see the list of modules paginated, enable this option in the Styles Configuration.'),
true
).reporting_tiny_stats(
$agent,
true,
'modules',
':',
true
),
'status_monitor_agent',
false
false,
false,
'',
'white_table_graph_content no-padding-imp'
);
?>
<script type="text/javascript">
var sort_field = '<?php echo $sort_field; ?>';
@ -202,6 +230,7 @@ ui_toggle(
$("#status_module_group").enable();
$("#status_filter_monitor").enable();
}
filter_modules();
}
function order_module_list(sort_field_param, sort_rows_param) {
@ -446,6 +475,17 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
/* ]]> */
</script>
<?php
/**
* Print form filter monitors.
*
* @param integer $id_agent Id_agent.
* @param integer $status_filter_monitor Status_filter_monitor.
* @param string $status_text_monitor Status_text_monitor.
* @param integer $status_module_group Status_module_group.
* @param integer $status_hierachy_mode Status_hierachy_mode.
*
* @return void
*/
function print_form_filter_monitors(
$id_agent,
$status_filter_monitor=-1,
@ -455,11 +495,14 @@ function print_form_filter_monitors(
) {
$form_text = '';
$table = new stdClass();
$table->class = 'databox filters';
$table->class = 'info_table';
$table->styleTable = 'border: 1px solid #ebebeb;border-radius: 0;padding: 0;margin: 0;margin-top: -1px;';
$table->width = '100%';
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold;';
$table->style[4] = 'font-weight: bold;';
$table->style[6] = 'font-weight: bold;';
$table->style[6] = 'min-width: 150px;';
$table->data[0][0] = html_print_input_hidden('filter_monitors', 1, true);
$table->data[0][0] .= html_print_input_hidden('monitors_change_filter', 1, true);
$table->data[0][0] .= __('Status:');
@ -488,9 +531,26 @@ function print_form_filter_monitors(
true
);
$table->data[0][3] = html_print_input_text('status_text_monitor', $status_text_monitor, '', 30, 100, true);
$table->data[0][3] = html_print_input_text(
'status_text_monitor',
$status_text_monitor,
'',
'',
100,
true
);
$table->data[0][4] = __('Module group');
$rows = db_get_all_rows_sql("SELECT * FROM tmodule_group where id_mg in (SELECT id_module_group from tagente_modulo where id_agente = $id_agent ) ORDER BY name");
$rows = db_get_all_rows_sql(
sprintf(
'SELECT *
FROM tmodule_group
WHERE id_mg IN (SELECT id_module_group
FROM tagente_modulo
WHERE id_agente = %d )
ORDER BY name',
$id_agent
)
);
$rows_select[-1] = __('All');
if (!empty($rows)) {
@ -499,11 +559,43 @@ function print_form_filter_monitors(
}
}
$table->data[0][5] = html_print_select($rows_select, 'status_module_group', $status_module_group, '', '', 0, true);
$table->data[0][6] = __('Show in hierachy mode');
$table->data[0][6] .= html_print_checkbox('status_hierachy_mode', '', false, true, false, 'onChange=change_module_filter();');
$table->data[0][7] = html_print_button(__('Filter'), 'filter', false, 'filter_modules();', 'class="sub search"', true);
$table->data[0][8] = '&nbsp;'.html_print_button(__('Reset'), 'filter', false, 'reset_filter_modules();', 'class="sub upd" style="margin-top:0px;"', true);
$table->data[0][5] = html_print_select(
$rows_select,
'status_module_group',
$status_module_group,
'',
'',
0,
true
);
$table->data[0][6] = '<div style="display: flex;align-content: center;">';
$table->data[0][6] .= __('Show in hierachy mode');
$table->data[0][6] .= html_print_switch(
[
'name' => 'status_hierachy_mode',
'value' => $all_events_24h,
'onchange' => 'change_module_filter()',
'id' => 'checkbox-status_hierachy_mode',
'style' => 'margin-left: 1em;',
]
);
$table->data[0][6] .= '</div>';
$table->data[0][7] = html_print_button(
__('Filter'),
'filter',
false,
'filter_modules();',
'class="sub search"',
true
);
$table->data[0][8] = html_print_button(
__('Reset'),
'filter',
false,
'reset_filter_modules();',
'class="sub upd" style="margin-top:0px;"',
true
);
$form_text .= html_print_table($table, true);
$filter_hidden = false;
@ -514,4 +606,3 @@ function print_form_filter_monitors(
echo $form_text;
}

View File

@ -20,12 +20,15 @@ if (!isset($id_agente)) {
}
require_once 'include/functions_events.php';
ui_require_css_file('events');
ui_toggle(
"<div id='event_list'>".html_print_image('images/spinner.gif', true).'</div>',
"<div style='width: 100%;' id='event_list'>".html_print_image('images/spinner.gif', true).'</div>',
__('Latest events for this agent'),
__('Latest events for this agent'),
false
false,
false,
'',
'white_table_graph_content no-padding-imp'
);
?>

View File

@ -122,7 +122,7 @@ echo '<td style="vertical-align: top; min-width: 180px; width:25%; padding-right
// ---------------------------------------------------------------------
$table = new stdClass();
$table->width = '100%';
$table->class = '';
$table->class = 'info_table no-td-borders';
$table->cellpadding = 2;
$table->cellspacing = 2;
$table->border = 0;
@ -130,7 +130,7 @@ $table->head = [];
$table->data = [];
$table->style = [];
$table->head[0] = '<span>'.__('Report of State').'</span>';
$table->head[0] = '<b><span>'.__('Report of State').'</span></b>';
$stats = reporting_get_stats_indicators($data, 120, 10, false);
$status = '<table class="status_tactical">';
foreach ($stats as $stat) {
@ -187,7 +187,12 @@ if (check_acl($config['id_user'], 0, 'ER')) {
}
$events = events_print_event_table($event_filter, 10, '100%', true, false, true);
ui_toggle($events, __('Latest events'), false, false);
ui_toggle(
$events,
__('Latest events'),
false,
false
);
}
// ---------------------------------------------------------------------

View File

@ -37,6 +37,7 @@ require_once $config['homedir'].'/include/functions_users.php';
enterprise_include_once('include/functions_metaconsole.php');
ui_require_javascript_file('openlayers.pandora');
ui_require_css_file('agent_view');
enterprise_include_once('operation/agentes/ver_agente.php');
@ -1340,6 +1341,7 @@ if (isset($ehorus_tab) && !empty($ehorus_tab)) {
}
// Tabs for extensions.
$tab_name_extensions = '';
foreach ($config['extensions'] as $extension) {
if (isset($extension['extension_ope_tab']) && !isset($extension['extension_god_tab'])) {
if (check_acl_one_of_groups($config['id_user'], $all_groups, $extension['extension_ope_tab']['acl'])) {
@ -1382,6 +1384,7 @@ 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;
$id_extension = get_parameter('id_extension', '');
@ -1404,15 +1407,82 @@ foreach ($config['extensions'] as $extension) {
}
switch ($tab) {
case 'wux_console_tab':
$help_header = 'wux_console_tab';
case 'custom_fields':
$tab_name = 'Custom fields';
break;
case 'gis':
$tab_name = 'GIS data';
break;
case 'manage':
$tab_name = 'Manage';
break;
case 'main':
$tab_name = 'Main';
$help_header = 'agent_'.$tab.'_tab';
break;
case 'data_view':
$tab_name = '';
break;
case 'alert':
$tab_name = 'Alerts';
break;
case 'inventory':
$tab_name = 'Inventory';
break;
case 'collection':
$tab_name = 'Collection';
break;
case 'policy':
$tab_name = 'Policies';
break;
case 'ux_console_tab':
$tab_name = 'UX Console';
break;
case 'wux_console_tab':
$tab_name = 'WUX Console';
$help_header = 'wux_console_tab';
break;
case 'url_route_analyzer_tab':
$tab_name = 'URL Route Analyzer';
break;
case 'graphs';
$tab_name = 'Graphs';
break;
case 'incident':
$tab_name = 'Incidents';
break;
case 'url_address':
$tab_name = 'Url address';
break;
case 'log_viewer':
$tab_name = 'Log viewer';
break;
case 'ehorus':
$tab_name = 'eHorus';
break;
case 'extension':
$tab_name = $tab_name_extensions;
break;
default:
$tab_name = '';
$help_header = '';
break;
}
@ -1426,7 +1496,15 @@ ui_print_page_header(
$onheader,
false,
'',
$config['item_title_size_text']
$config['item_title_size_text'],
'',
ui_print_breadcrums(
[
__('Monitoring'),
__('View'),
'<span class="breadcrumb_active">'.$tab_name.'</span>',
]
)
);
@ -1444,6 +1522,7 @@ switch ($tab) {
break;
case 'main':
default:
include 'estado_generalagente.php';
echo "<a name='monitors'></a>";
include 'estado_monitores.php';

View File

@ -99,10 +99,12 @@ if (is_metaconsole()) {
).'</a>',
],
];
$tab_name = 'User Management';
$helpers = '';
if ($_GET['sec2'] === 'operation/users/user_edit_notifications') {
$helpers = 'user_edit_notifications';
$tab_name = 'User Notifications';
}
ui_print_page_header(
@ -111,6 +113,11 @@ if (is_metaconsole()) {
false,
$helpers,
false,
$buttons
$buttons,
false,
'',
GENERIC_SIZE_TEXT,
'',
__('Workspace').ui_print_breadcrums($tab_name)
);
}