add not option in monitor detail filter
This commit is contained in:
parent
f0f7244d84
commit
f03364bf96
|
@ -11,7 +11,7 @@
|
|||
// 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
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
@ -115,9 +115,18 @@ $sort = get_parameter('sort', 'none');
|
|||
$id_module = (int) get_parameter('id_module', 0);
|
||||
$ag_custom_fields = (array) get_parameter('ag_custom_fields', []);
|
||||
$module_option = (int) get_parameter('module_option', 1);
|
||||
|
||||
$not_condition = (string) get_parameter('not_condition', '');
|
||||
|
||||
// If option not_condition is enabled, the conditions of the queries are reversed.
|
||||
$condition_query = '=';
|
||||
if ($not_condition !== '') {
|
||||
$condition_query = '!=';
|
||||
}
|
||||
|
||||
$autosearch = false;
|
||||
|
||||
// It is validated if it receives parameters different from those it has by default
|
||||
// It is validated if it receives parameters different from those it has by default.
|
||||
if ($ag_freestring !== '' || $moduletype !== '' || $datatype !== ''
|
||||
|| $ag_modulename !== '' || $refr !== 0 || $offset !== 0 || $status !== 4
|
||||
|| $modulegroup !== -1 || $tag_filter !== 0 || $sortField !== ''
|
||||
|
@ -151,10 +160,10 @@ if ($id_module) {
|
|||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
// Get Groups and profiles from user
|
||||
// Get Groups and profiles from user.
|
||||
$user_groups = implode(',', array_keys(users_get_groups(false, 'AR', false)));
|
||||
|
||||
// Begin Build SQL sentences
|
||||
// Begin Build SQL sentences.
|
||||
$sql_from = ' FROM tagente_modulo
|
||||
INNER JOIN tagente
|
||||
ON tagente_modulo.id_agente = tagente.id_agente
|
||||
|
@ -177,7 +186,7 @@ if (is_numeric($ag_group)) {
|
|||
$id_ag_group = db_get_value('id_grupo', 'tgrupo', 'nombre', $ag_group);
|
||||
}
|
||||
|
||||
// Agent group selector
|
||||
// Agent group selector.
|
||||
if (!is_metaconsole()) {
|
||||
if ($ag_group > 0 && check_acl($config['id_user'], $ag_group, 'AR')) {
|
||||
if ($recursion) {
|
||||
|
@ -191,7 +200,7 @@ if (!is_metaconsole()) {
|
|||
);
|
||||
} else {
|
||||
$sql_conditions_group = sprintf(
|
||||
' AND (tagente.id_grupo = %d OR tasg.id_group = %d)',
|
||||
' AND (tagente.id_grupo '.$condition_query.' %d OR tasg.id_group '.$condition_query.' %d)',
|
||||
$ag_group,
|
||||
$ag_group
|
||||
);
|
||||
|
@ -230,66 +239,66 @@ if (!is_metaconsole()) {
|
|||
}
|
||||
}
|
||||
|
||||
// Module group
|
||||
// Module group.
|
||||
if (is_metaconsole()) {
|
||||
if ($modulegroup != '-1') {
|
||||
$sql_conditions .= sprintf(' AND tagente_modulo.id_module_group IN (%s)', $modulegroup);
|
||||
$sql_conditions .= sprintf(' AND tagente_modulo.id_module_group '.$not_condition.' IN (%s)', $modulegroup);
|
||||
}
|
||||
} else if ($modulegroup > -1) {
|
||||
$sql_conditions .= sprintf(' AND tagente_modulo.id_module_group = \'%d\'', $modulegroup);
|
||||
$sql_conditions .= sprintf(' AND tagente_modulo.id_module_group '.$condition_query.' \'%d\'', $modulegroup);
|
||||
}
|
||||
|
||||
// Module name selector
|
||||
// Module name selector.
|
||||
if ($ag_modulename != '') {
|
||||
$sql_conditions .= " AND tagente_modulo.nombre LIKE '%".$ag_modulename."%'";
|
||||
$sql_conditions .= " AND tagente_modulo.nombre $not_condition LIKE '%".$ag_modulename."%'";
|
||||
}
|
||||
|
||||
if ($module_option !== 0) {
|
||||
if ($module_option == 1) {
|
||||
// Only enabled
|
||||
$sql_conditions .= sprintf(' AND tagente_modulo.disabled = 0');
|
||||
// Only enabled.
|
||||
$sql_conditions .= sprintf(' AND tagente_modulo.disabled '.$condition_query.' 0');
|
||||
} else if ($module_option == 2) {
|
||||
// Only disabled
|
||||
$sql_conditions .= sprintf(' AND tagente_modulo.disabled = 1');
|
||||
// Only disabled.
|
||||
$sql_conditions .= sprintf(' AND tagente_modulo.disabled '.$condition_query.' 1');
|
||||
}
|
||||
}
|
||||
|
||||
if ($datatype != '') {
|
||||
$sql_conditions .= sprintf(' AND ttipo_modulo.id_tipo ='.$datatype);
|
||||
$sql_conditions .= sprintf(' AND ttipo_modulo.id_tipo '.$condition_query.' '.$datatype);
|
||||
}
|
||||
|
||||
if ($moduletype != '') {
|
||||
$sql_conditions .= sprintf(' AND tagente_modulo.id_modulo ='.$moduletype);
|
||||
$sql_conditions .= sprintf(' AND tagente_modulo.id_modulo '.$condition_query.' '.$moduletype.'');
|
||||
}
|
||||
|
||||
// Freestring selector
|
||||
// Freestring selector.
|
||||
if ($ag_freestring != '') {
|
||||
$sql_conditions .= ' AND (tagente.nombre COLLATE utf8_general_ci LIKE \'%%'.$ag_freestring.'%%\'
|
||||
OR tagente.alias COLLATE utf8_general_ci LIKE \'%%'.$ag_freestring.'%%\'
|
||||
OR tagente_modulo.nombre COLLATE utf8_general_ci LIKE \'%%'.$ag_freestring.'%%\'
|
||||
OR tagente_modulo.descripcion COLLATE utf8_general_ci LIKE \'%%'.$ag_freestring.'%%\')';
|
||||
$sql_conditions .= ' AND (tagente.nombre COLLATE utf8_general_ci '.$not_condition.' LIKE \'%%'.$ag_freestring.'%%\'
|
||||
OR tagente.alias COLLATE utf8_general_ci '.$not_condition.' LIKE \'%%'.$ag_freestring.'%%\'
|
||||
OR tagente_modulo.nombre COLLATE utf8_general_ci '.$not_condition.' LIKE \'%%'.$ag_freestring.'%%\'
|
||||
OR tagente_modulo.descripcion COLLATE utf8_general_ci '.$not_condition.' LIKE \'%%'.$ag_freestring.'%%\')';
|
||||
}
|
||||
|
||||
// Status selector
|
||||
// Status selector.
|
||||
if ($status == AGENT_MODULE_STATUS_NORMAL) {
|
||||
// Normal
|
||||
$sql_conditions .= ' AND tagente_estado.estado = 0
|
||||
// Normal.
|
||||
$sql_conditions .= ' AND tagente_estado.estado '.$condition_query.' 0
|
||||
AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,100))) ';
|
||||
} else if ($status == AGENT_MODULE_STATUS_CRITICAL_BAD) {
|
||||
// Critical
|
||||
$sql_conditions .= ' AND tagente_estado.estado = 1 AND utimestamp > 0';
|
||||
// Critical.
|
||||
$sql_conditions .= ' AND tagente_estado.estado '.$condition_query.' 1 AND utimestamp > 0';
|
||||
} else if ($status == AGENT_MODULE_STATUS_WARNING) {
|
||||
// Warning
|
||||
$sql_conditions .= ' AND tagente_estado.estado = 2 AND utimestamp > 0';
|
||||
// Warning.
|
||||
$sql_conditions .= ' AND tagente_estado.estado '.$condition_query.' 2 AND utimestamp > 0';
|
||||
} else if ($status == AGENT_MODULE_STATUS_NOT_NORMAL) {
|
||||
// Not normal
|
||||
// Not normal.
|
||||
$sql_conditions .= ' AND tagente_estado.estado <> 0';
|
||||
} else if ($status == AGENT_MODULE_STATUS_UNKNOWN) {
|
||||
// Unknown
|
||||
$sql_conditions .= ' AND tagente_estado.estado = 3 AND tagente_estado.utimestamp <> 0';
|
||||
// Unknown.
|
||||
$sql_conditions .= ' AND tagente_estado.estado '.$condition_query.' 3 AND tagente_estado.utimestamp <> 0';
|
||||
} else if ($status == AGENT_MODULE_STATUS_NOT_INIT) {
|
||||
// Not init
|
||||
$sql_conditions .= ' AND tagente_estado.utimestamp = 0
|
||||
// Not init.
|
||||
$sql_conditions .= ' AND tagente_estado.utimestamp '.$condition_query.' 0
|
||||
AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)';
|
||||
}
|
||||
|
||||
|
@ -300,13 +309,13 @@ if (!empty($min_hours_status)) {
|
|||
$sql_conditions .= sprintf(' AND tagente_estado.last_status_change < %d', $max_time);
|
||||
}
|
||||
|
||||
// Filter by agent custom fields
|
||||
// Filter by agent custom fields.
|
||||
$sql_conditions_custom_fields = '';
|
||||
if (!empty($ag_custom_fields)) {
|
||||
$cf_filter = [];
|
||||
foreach ($ag_custom_fields as $field_id => $value) {
|
||||
if (!empty($value)) {
|
||||
$cf_filter[] = '(tagent_custom_data.id_field = '.$field_id.' AND tagent_custom_data.description LIKE \'%'.$value.'%\')';
|
||||
$cf_filter[] = '(tagent_custom_data.id_field '.$condition_query.' '.$field_id.' AND tagent_custom_data.description '.$not_condition.' LIKE \'%'.$value.'%\')';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,24 +327,24 @@ if (!empty($ag_custom_fields)) {
|
|||
}
|
||||
}
|
||||
|
||||
// Filter by tag
|
||||
// Filter by tag.
|
||||
if ($tag_filter !== 0) {
|
||||
if (is_metaconsole()) {
|
||||
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
|
||||
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo '.$not_condition.' IN (
|
||||
SELECT ttag_module.id_agente_modulo
|
||||
FROM ttag_module
|
||||
WHERE ttag_module.id_tag IN ('.$tag_filter.'))';
|
||||
WHERE ttag_module.id_tag '.$not_condition.' IN ('.$tag_filter.'))';
|
||||
} else {
|
||||
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
|
||||
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo '.$not_condition.' IN (
|
||||
SELECT ttag_module.id_agente_modulo
|
||||
FROM ttag_module
|
||||
WHERE ttag_module.id_tag = '.$tag_filter.')';
|
||||
WHERE ttag_module.id_tag '.$condition_query.' '.$tag_filter.')';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Apply the module ACL with tags
|
||||
// Apply the module ACL with tags.
|
||||
$sql_conditions_tags = '';
|
||||
|
||||
if (!users_is_admin()) {
|
||||
|
@ -356,20 +365,20 @@ if (!users_is_admin()) {
|
|||
}
|
||||
}
|
||||
|
||||
// Two modes of filter. All the filters and only ACLs filter
|
||||
// Two modes of filter. All the filters and only ACLs filter.
|
||||
$sql_conditions_all = $sql_conditions.$sql_conditions_group.$sql_conditions_tags.$sql_conditions_custom_fields;
|
||||
|
||||
// Get count to paginate
|
||||
// Get count to paginate.
|
||||
if (!defined('METACONSOLE')) {
|
||||
$count = db_get_sql('SELECT COUNT(DISTINCT tagente_modulo.id_agente_modulo)'.$sql_from.$sql_conditions_all);
|
||||
}
|
||||
|
||||
// Get limit_sql depend of the metaconsole or standard mode
|
||||
// Get limit_sql depend of the metaconsole or standard mode.
|
||||
if (is_metaconsole()) {
|
||||
// Offset will be used to get the subset of modules
|
||||
// Offset will be used to get the subset of modules.
|
||||
$inferior_limit = $offset;
|
||||
$superior_limit = ($config['block_size'] + $offset);
|
||||
// Offset reset to get all elements
|
||||
// Offset reset to get all elements.
|
||||
$offset = 0;
|
||||
if (!isset($config['meta_num_elements'])) {
|
||||
$config['meta_num_elements'] = 100;
|
||||
|
@ -380,9 +389,9 @@ if (is_metaconsole()) {
|
|||
$limit_sql = $config['block_size'];
|
||||
}
|
||||
|
||||
// End Build SQL sentences
|
||||
// End Build SQL sentences.
|
||||
//
|
||||
// Start Build Search Form
|
||||
// Start Build Search Form.
|
||||
//
|
||||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
|
@ -436,7 +445,7 @@ $fields[AGENT_MODULE_STATUS_WARNING] = __('Warning');
|
|||
$fields[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical');
|
||||
$fields[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown');
|
||||
$fields[AGENT_MODULE_STATUS_NOT_NORMAL] = __('Not normal');
|
||||
// default
|
||||
// Default.
|
||||
$fields[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init');
|
||||
|
||||
$table->data[0][2] = __('Monitor status');
|
||||
|
@ -528,32 +537,32 @@ $network_available = db_get_sql(
|
|||
FROM tserver
|
||||
WHERE server_type = 1'
|
||||
);
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||
$wmi_available = db_get_sql(
|
||||
'SELECT count(*)
|
||||
FROM tserver
|
||||
WHERE server_type = 6'
|
||||
);
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||
$plugin_available = db_get_sql(
|
||||
'SELECT count(*)
|
||||
FROM tserver
|
||||
WHERE server_type = 4'
|
||||
);
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||
$prediction_available = db_get_sql(
|
||||
'SELECT count(*)
|
||||
FROM tserver
|
||||
WHERE server_type = 5'
|
||||
);
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||
$wux_available = db_get_sql(
|
||||
'SELECT count(*)
|
||||
FROM tserver
|
||||
WHERE server_type = 17'
|
||||
);
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
||||
// Development mode to use all servers
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||
// Development mode to use all servers.
|
||||
if ($develop_bypass) {
|
||||
$network_available = 1;
|
||||
$wmi_available = 1;
|
||||
|
@ -619,7 +628,7 @@ switch ($moduletype) {
|
|||
$sql = sprintf(
|
||||
'SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (6,7,8,0,1,2,-1) order by descripcion '
|
||||
WHERE categoria '.$not_condition.' IN (6,7,8,0,1,2,-1) order by descripcion '
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -627,7 +636,7 @@ switch ($moduletype) {
|
|||
$sql = sprintf(
|
||||
'SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria between 3 and 5 '
|
||||
WHERE categoria '.$not_condition.' between 3 and 5 '
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -635,7 +644,7 @@ switch ($moduletype) {
|
|||
$sql = sprintf(
|
||||
'SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria between 0 and 2 '
|
||||
WHERE categoria '.$not_condition.' between 0 and 2 '
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -643,7 +652,7 @@ switch ($moduletype) {
|
|||
$sql = sprintf(
|
||||
'SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria between 0 and 2 '
|
||||
WHERE categoria '.$not_condition.' between 0 and 2 '
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -651,7 +660,7 @@ switch ($moduletype) {
|
|||
$sql = sprintf(
|
||||
'SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria = 9'
|
||||
WHERE categoria '.$condition_query.' 9'
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -659,7 +668,7 @@ switch ($moduletype) {
|
|||
$sql = sprintf(
|
||||
'SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria = 0'
|
||||
WHERE categoria '.$condition_query.' 0'
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -667,7 +676,7 @@ switch ($moduletype) {
|
|||
$sql = sprintf(
|
||||
'SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE nombre = \'web_analysis\''
|
||||
WHERE nombre '.$condition_query.' \'web_analysis\''
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -677,6 +686,10 @@ switch ($moduletype) {
|
|||
FROM ttipo_modulo'
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Nothing.
|
||||
break;
|
||||
}
|
||||
|
||||
$a = db_get_all_rows_sql($sql);
|
||||
|
@ -704,6 +717,18 @@ foreach ($a as $valor) {
|
|||
|
||||
$table->data[3][1] .= '</div>';
|
||||
|
||||
$table->data[3][1] .= '<div class="w120px mrgn_top_20px">';
|
||||
$table->data[3][1] .= html_print_input(
|
||||
[
|
||||
'type' => 'checkbox',
|
||||
'name' => 'not_condition',
|
||||
'return' => true,
|
||||
'checked' => $check_not_condition,
|
||||
'value' => 'NOT',
|
||||
]
|
||||
);
|
||||
$table->data[3][1] .= __('Not condition').ui_print_help_tip(__('If this option is enabled, the events that DO NOT comply with this condition will be displayed.'), true);
|
||||
$table->data[3][1] .= '</div>';
|
||||
|
||||
$table_custom_fields = new stdClass();
|
||||
$table_custom_fields->class = 'filters';
|
||||
|
@ -747,7 +772,16 @@ foreach ($custom_fields as $custom_field) {
|
|||
$table_custom_fields->data[] = $row;
|
||||
}
|
||||
|
||||
if ($not_condition !== '') {
|
||||
$check_not_condition = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$filters = '<form method="post" action="index.php?sec='.$section.'&sec2=operation/agentes/status_monitor&refr='.$refr.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&module_option='.$module_option.'&ag_modulename='.$ag_modulename.'&moduletype='.$moduletype.'&datatype='.$datatype.'&status='.$status.'&sort_field='.$sortField.'&sort='.$sort.'&pure='.$config['pure'].$ag_custom_fields_params.'">';
|
||||
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$table->colspan[4][0] = 7;
|
||||
$table->cellstyle[4][0] = 'padding: 10px;';
|
||||
|
@ -787,9 +821,9 @@ if (is_metaconsole()) {
|
|||
}
|
||||
|
||||
unset($table);
|
||||
// End Build Search Form
|
||||
// End Build Search Form.
|
||||
//
|
||||
// Sort functionality
|
||||
// Sort functionality.
|
||||
$selected = true;
|
||||
$selectAgentNameUp = false;
|
||||
$selectAgentNameDown = false;
|
||||
|
@ -1060,7 +1094,7 @@ $sql = 'SELECT
|
|||
LIMIT '.$offset.','.$limit_sql;
|
||||
|
||||
|
||||
// We do not show the modules until the user searches with the filter
|
||||
// We do not show the modules until the user searches with the filter.
|
||||
if ($autosearch) {
|
||||
if (! defined('METACONSOLE')) {
|
||||
$result = db_get_all_rows_sql($sql);
|
||||
|
@ -1071,7 +1105,7 @@ if ($autosearch) {
|
|||
ui_pagination($count, false, $offset, 0, false, 'offset', true);
|
||||
}
|
||||
} else {
|
||||
// For each server defined and not disabled:
|
||||
// For each server defined and not disabled.
|
||||
$servers = db_get_all_rows_sql(
|
||||
'SELECT *
|
||||
FROM tmetaconsole_setup
|
||||
|
@ -1084,7 +1118,7 @@ if ($autosearch) {
|
|||
$result = [];
|
||||
$count_modules = 0;
|
||||
foreach ($servers as $server) {
|
||||
// If connection was good then retrieve all data server
|
||||
// If connection was good then retrieve all data server.
|
||||
if (metaconsole_connect($server) == NOERR) {
|
||||
$connection = true;
|
||||
} else {
|
||||
|
@ -1094,7 +1128,7 @@ if ($autosearch) {
|
|||
$result_server = db_get_all_rows_sql($sql);
|
||||
|
||||
if (!empty($result_server)) {
|
||||
// Create HASH login info
|
||||
// Create HASH login info.
|
||||
$pwd = $server['auth_token'];
|
||||
$auth_serialized = json_decode($pwd, true);
|
||||
|
||||
|
@ -1135,7 +1169,7 @@ if ($autosearch) {
|
|||
ui_pagination($count_modules, false, $offset);
|
||||
}
|
||||
|
||||
// Get number of elements of the pagination
|
||||
// Get number of elements of the pagination.
|
||||
$result = ui_meta_get_subset_array($result, $inferior_limit, $superior_limit);
|
||||
}
|
||||
}
|
||||
|
@ -1194,7 +1228,7 @@ $url_data .= '&sort_field=data&sort=';
|
|||
$url_timestamp_up .= '&sort_field=timestamp&sort=up';
|
||||
$url_timestamp_down .= '&sort_field=timestamp&sort=down';
|
||||
|
||||
// Start Build List Result
|
||||
// Start Build List Result.
|
||||
if (!empty($result)) {
|
||||
$table = new StdClass();
|
||||
$table->cellpadding = 0;
|
||||
|
@ -1286,7 +1320,7 @@ if (!empty($result)) {
|
|||
);
|
||||
|
||||
foreach ($result as $row) {
|
||||
// Avoid unset, null and false value
|
||||
// Avoid unset, null and false value.
|
||||
if (empty($row['server_name'])) {
|
||||
$row['server_name'] = '';
|
||||
}
|
||||
|
@ -1300,13 +1334,13 @@ if (!empty($result)) {
|
|||
]
|
||||
);
|
||||
|
||||
// Fixed the goliat sends the strings from web
|
||||
// without HTML entities
|
||||
// Fixed the goliat sends the strings from web.
|
||||
// Without HTML entities.
|
||||
if ($is_web_content_string) {
|
||||
$row['datos'] = io_safe_input($row['datos']);
|
||||
}
|
||||
|
||||
// Fixed the data from Selenium Plugin
|
||||
// Fixed the data from Selenium Plugin.
|
||||
if ($row['datos'] != strip_tags($row['datos'])) {
|
||||
$row['datos'] = io_safe_input($row['datos']);
|
||||
}
|
||||
|
@ -1479,7 +1513,9 @@ if (!empty($result)) {
|
|||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(
|
||||
STATUS_MODULE_CRITICAL,
|
||||
__('CRITICAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'])),
|
||||
__('CRITICAL').': '.remove_right_zeros(
|
||||
number_format($row['datos'], $config['graph_precision'])
|
||||
),
|
||||
true
|
||||
);
|
||||
} else {
|
||||
|
@ -1493,7 +1529,9 @@ if (!empty($result)) {
|
|||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(
|
||||
STATUS_MODULE_WARNING,
|
||||
__('WARNING').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'])),
|
||||
__('WARNING').': '.remove_right_zeros(
|
||||
number_format($row['datos'], $config['graph_precision'])
|
||||
),
|
||||
true
|
||||
);
|
||||
} else {
|
||||
|
@ -1507,7 +1545,9 @@ if (!empty($result)) {
|
|||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(
|
||||
STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'])),
|
||||
__('UNKNOWN').': '.remove_right_zeros(
|
||||
number_format($row['datos'], $config['graph_precision'])
|
||||
),
|
||||
true
|
||||
);
|
||||
} else {
|
||||
|
@ -1521,7 +1561,9 @@ if (!empty($result)) {
|
|||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(
|
||||
STATUS_MODULE_NO_DATA,
|
||||
__('NO DATA').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'])),
|
||||
__('NO DATA').': '.remove_right_zeros(
|
||||
number_format($row['datos'], $config['graph_precision'])
|
||||
),
|
||||
true
|
||||
);
|
||||
} else {
|
||||
|
@ -1596,7 +1638,7 @@ if (!empty($result)) {
|
|||
|
||||
$acl_graphs = false;
|
||||
|
||||
// Avoid the check on the metaconsole. Too slow to show/hide an icon depending on the permissions
|
||||
// Avoid the check on the metaconsole. Too slow to show/hide an icon depending on the permissions.
|
||||
if (!is_metaconsole()) {
|
||||
$agent_groups = agents_get_all_groups_agent($row['id_agent'], $row['id_group']);
|
||||
$acl_graphs = check_acl_one_of_groups($config['id_user'], $agent_groups, 'RR');
|
||||
|
@ -1619,7 +1661,7 @@ if (!empty($result)) {
|
|||
];
|
||||
|
||||
if (is_metaconsole() && isset($row['server_id'])) {
|
||||
// Set the server id
|
||||
// Set the server id.
|
||||
$graph_params['server'] = $row['server_id'];
|
||||
}
|
||||
|
||||
|
@ -1710,7 +1752,7 @@ if (!empty($result)) {
|
|||
}
|
||||
}
|
||||
|
||||
// Show units ONLY in numeric data types
|
||||
// Show units ONLY in numeric data types.
|
||||
if (isset($row['unit'])) {
|
||||
$data_macro = modules_get_unit_macro($row['datos'], $row['unit']);
|
||||
if ($data_macro) {
|
||||
|
@ -1719,7 +1761,7 @@ if (!empty($result)) {
|
|||
$salida .= ' '.'<i>'.io_safe_output($row['unit']).'</i>';
|
||||
if (strlen($salida) > $config['agent_size_text_small']) {
|
||||
$salida = ui_print_truncate_text($salida, 'agent_small', true, true, false, '[…]', 'font-size:7.5pt;');
|
||||
// clean tag <i>
|
||||
// Clean tag <i>.
|
||||
$text_aux = explode('<a', $salida);
|
||||
$match = preg_replace('/(<i>|<\/i>|<i|<\/i|i>|\/i>|<|>)/', '', $text_aux[0]);
|
||||
$salida = $match.'<a'.$text_aux[1];
|
||||
|
@ -1729,8 +1771,8 @@ if (!empty($result)) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
// Fixed the goliat sends the strings from web
|
||||
// without HTML entities
|
||||
// Fixed the goliat sends the strings from web.
|
||||
// Without HTML entities.
|
||||
if ($is_web_content_string) {
|
||||
$module_value = $row['datos'];
|
||||
} else {
|
||||
|
@ -1764,12 +1806,12 @@ if (!empty($result)) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
// Fixed the goliat sends the strings from web
|
||||
// without HTML entities
|
||||
// Fixed the goliat sends the strings from web.
|
||||
// Without HTML entities.
|
||||
if ($is_web_content_string) {
|
||||
$sub_string = substr($row['datos'], 0, 12);
|
||||
} else {
|
||||
// Fixed the data from Selenium Plugin
|
||||
// Fixed the data from Selenium Plugin.
|
||||
if ($module_value != strip_tags($module_value)) {
|
||||
$module_value = io_safe_input($module_value);
|
||||
$sub_string = substr($row['datos'], 0, 12);
|
||||
|
@ -1869,7 +1911,7 @@ function toggle_full_value(id) {
|
|||
$("#value_module_text_" + id).html(text);
|
||||
}
|
||||
|
||||
// Show the modal window of an module
|
||||
// Show the modal window of an module.
|
||||
function show_module_detail_dialog(module_id, id_agent, server_name, offset, period, module_name) {
|
||||
if (period == -1) {
|
||||
if ($("#period").length == 1) {
|
||||
|
|
Loading…
Reference in New Issue