mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Merge branch 'ent-6885-11172-añadir-opcion-de-nor-en-monitor-detail' into 'develop'
add not option in monitor detail filter See merge request artica/pandorafms!4112
This commit is contained in:
commit
8397f778b3
@ -436,6 +436,7 @@ function html_print_select_style($fields, $name, $selected='', $style='', $scrip
|
|||||||
* @param string $size Style, size (width) of element.
|
* @param string $size Style, size (width) of element.
|
||||||
* @param boolean $simple_multiple_options Discovery simple multiple inputs.
|
* @param boolean $simple_multiple_options Discovery simple multiple inputs.
|
||||||
* @param boolean $required Required input.
|
* @param boolean $required Required input.
|
||||||
|
* @param string $inverse Change All to None with inverse condition.
|
||||||
*
|
*
|
||||||
* @return string HTML code if return parameter is true.
|
* @return string HTML code if return parameter is true.
|
||||||
*/
|
*/
|
||||||
@ -462,7 +463,8 @@ function html_print_select_groups(
|
|||||||
$include_groups=false,
|
$include_groups=false,
|
||||||
$size=false,
|
$size=false,
|
||||||
$simple_multiple_options=false,
|
$simple_multiple_options=false,
|
||||||
$required=false
|
$required=false,
|
||||||
|
$inverse=''
|
||||||
) {
|
) {
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
@ -522,8 +524,12 @@ function html_print_select_groups(
|
|||||||
if (empty($selected) === false) {
|
if (empty($selected) === false) {
|
||||||
$fields = [ $selected => groups_get_name($selected) ];
|
$fields = [ $selected => groups_get_name($selected) ];
|
||||||
} else if ($returnAllGroup === true && $multiple === false) {
|
} else if ($returnAllGroup === true && $multiple === false) {
|
||||||
|
if ($selected === 0 && $inverse !== '') {
|
||||||
|
$fields = [ $selected => 'None' ];
|
||||||
|
} else {
|
||||||
$fields = [ $selected => groups_get_name(null, true) ];
|
$fields = [ $selected => groups_get_name(null, true) ];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($selected as $k) {
|
foreach ($selected as $k) {
|
||||||
if ($k === null || $k === '') {
|
if ($k === null || $k === '') {
|
||||||
@ -595,7 +601,9 @@ function html_print_select_groups(
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('select[name="<?php echo $name; ?>"]').each(
|
$('select[name="<?php echo $name; ?>"]').each(
|
||||||
function() {
|
function() {
|
||||||
$(this).select2({
|
$(this).select2({
|
||||||
@ -625,6 +633,7 @@ function html_print_select_groups(
|
|||||||
inclusions: '<?php echo $json_inclusions; ?>',
|
inclusions: '<?php echo $json_inclusions; ?>',
|
||||||
step: params.page || 1,
|
step: params.page || 1,
|
||||||
strict: "<?php echo $strict_user; ?>",
|
strict: "<?php echo $strict_user; ?>",
|
||||||
|
not_condition: $('#not_condition_switch').prop('checked'),
|
||||||
returnAllGroup: <?php echo (int) $returnAllGroup; ?>
|
returnAllGroup: <?php echo (int) $returnAllGroup; ?>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -781,7 +790,7 @@ function html_print_select(
|
|||||||
$required = 'required';
|
$required = 'required';
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= '<select '.$required.' id="'.$id.'" name="'.$name.'"'.$attributes.' '.$styleText.'>';
|
$output .= '<select '.$required.' onclick="'.$script.'" id="'.$id.'" name="'.$name.'"'.$attributes.' '.$styleText.'>';
|
||||||
|
|
||||||
if ($nothing !== false) {
|
if ($nothing !== false) {
|
||||||
if ($nothing != '' || empty($fields)) {
|
if ($nothing != '' || empty($fields)) {
|
||||||
|
@ -12,7 +12,6 @@ function parse_alert_command(command, classs) {
|
|||||||
// Only render values different from ''
|
// Only render values different from ''
|
||||||
var field = "_field" + nfield + "_";
|
var field = "_field" + nfield + "_";
|
||||||
var regex = new RegExp(field, "gi");
|
var regex = new RegExp(field, "gi");
|
||||||
console.log($(this).val());
|
|
||||||
if ($(this).val() == "") {
|
if ($(this).val() == "") {
|
||||||
if (
|
if (
|
||||||
classs == "fields_recovery" &&
|
classs == "fields_recovery" &&
|
||||||
|
@ -386,6 +386,7 @@ class Group extends Entity
|
|||||||
$search = get_parameter('search', '');
|
$search = get_parameter('search', '');
|
||||||
$step = get_parameter('step', 1);
|
$step = get_parameter('step', 1);
|
||||||
$limit = get_parameter('limit', false);
|
$limit = get_parameter('limit', false);
|
||||||
|
$not_condition = get_parameter('not_condition', false);
|
||||||
$exclusions = get_parameter('exclusions', '[]');
|
$exclusions = get_parameter('exclusions', '[]');
|
||||||
$inclusions = get_parameter('inclusions', '[]');
|
$inclusions = get_parameter('inclusions', '[]');
|
||||||
|
|
||||||
@ -430,6 +431,11 @@ class Group extends Entity
|
|||||||
|
|
||||||
$return = self::prepareGroups($groups);
|
$return = self::prepareGroups($groups);
|
||||||
|
|
||||||
|
// When not_condition is select firts option text change All to None.
|
||||||
|
if ($not_condition === 'true') {
|
||||||
|
$return[0]['text'] = 'None';
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($return) === false) {
|
if (is_array($return) === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -141,9 +141,24 @@ $sort = get_parameter('sort', 'none');
|
|||||||
$id_module = (int) get_parameter('id_module', 0);
|
$id_module = (int) get_parameter('id_module', 0);
|
||||||
$ag_custom_fields = (array) get_parameter('ag_custom_fields', []);
|
$ag_custom_fields = (array) get_parameter('ag_custom_fields', []);
|
||||||
$module_option = (int) get_parameter('module_option', 1);
|
$module_option = (int) get_parameter('module_option', 1);
|
||||||
|
|
||||||
|
$not_condition = (string) get_parameter('not_condition', '');
|
||||||
|
|
||||||
|
$is_none = 'All';
|
||||||
|
if ($not_condition !== '') {
|
||||||
|
$is_none = 'None';
|
||||||
|
$not_condition = 'NOT';
|
||||||
|
}
|
||||||
|
|
||||||
|
// If option not_condition is enabled, the conditions of the queries are reversed.
|
||||||
|
$condition_query = '=';
|
||||||
|
if ($not_condition !== '') {
|
||||||
|
$condition_query = '!=';
|
||||||
|
}
|
||||||
|
|
||||||
$autosearch = false;
|
$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 !== ''
|
if ($ag_freestring !== '' || $moduletype !== '' || $datatype !== ''
|
||||||
|| $ag_modulename !== '' || $refr !== 0 || $offset !== 0 || $status !== 4
|
|| $ag_modulename !== '' || $refr !== 0 || $offset !== 0 || $status !== 4
|
||||||
|| $modulegroup !== -1 || $tag_filter !== 0 || $sortField !== ''
|
|| $modulegroup !== -1 || $tag_filter !== 0 || $sortField !== ''
|
||||||
@ -177,10 +192,10 @@ if ($id_module) {
|
|||||||
|
|
||||||
enterprise_hook('open_meta_frame');
|
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)));
|
$user_groups = implode(',', array_keys(users_get_groups(false, 'AR', false)));
|
||||||
|
|
||||||
// Begin Build SQL sentences
|
// Begin Build SQL sentences.
|
||||||
$sql_from = ' FROM tagente_modulo
|
$sql_from = ' FROM tagente_modulo
|
||||||
INNER JOIN tagente
|
INNER JOIN tagente
|
||||||
ON tagente_modulo.id_agente = tagente.id_agente
|
ON tagente_modulo.id_agente = tagente.id_agente
|
||||||
@ -203,7 +218,7 @@ if (is_numeric($ag_group)) {
|
|||||||
$id_ag_group = db_get_value('id_grupo', 'tgrupo', 'nombre', $ag_group);
|
$id_ag_group = db_get_value('id_grupo', 'tgrupo', 'nombre', $ag_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Agent group selector
|
// Agent group selector.
|
||||||
if (!is_metaconsole()) {
|
if (!is_metaconsole()) {
|
||||||
if ($ag_group > 0 && check_acl($config['id_user'], $ag_group, 'AR')) {
|
if ($ag_group > 0 && check_acl($config['id_user'], $ag_group, 'AR')) {
|
||||||
if ($recursion) {
|
if ($recursion) {
|
||||||
@ -217,7 +232,7 @@ if (!is_metaconsole()) {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$sql_conditions_group = sprintf(
|
$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,
|
||||||
$ag_group
|
$ag_group
|
||||||
);
|
);
|
||||||
@ -242,7 +257,7 @@ if (!is_metaconsole()) {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$sql_conditions_group = sprintf(
|
$sql_conditions_group = sprintf(
|
||||||
' AND (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))',
|
' AND (tagente.id_grupo '.$not_condition.' IN (%s) OR tasg.id_group '.$not_condition.' IN (%s))',
|
||||||
$ag_group,
|
$ag_group,
|
||||||
$ag_group
|
$ag_group
|
||||||
);
|
);
|
||||||
@ -256,18 +271,18 @@ if (!is_metaconsole()) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module group
|
// Module group.
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole()) {
|
||||||
if ($modulegroup != '-1') {
|
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) {
|
} 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 != '') {
|
if ($ag_modulename != '') {
|
||||||
$sql_conditions .= " AND tagente_modulo.nombre LIKE '%".$ag_modulename."%'";
|
$sql_conditions .= " AND tagente_modulo.nombre $not_condition LIKE '%".$ag_modulename."%'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id_module) {
|
if ($id_module) {
|
||||||
@ -276,96 +291,101 @@ if ($id_module) {
|
|||||||
|
|
||||||
if ($module_option !== 0) {
|
if ($module_option !== 0) {
|
||||||
if ($module_option == 1) {
|
if ($module_option == 1) {
|
||||||
// Only enabled
|
// Only enabled.
|
||||||
$sql_conditions .= sprintf(' AND tagente_modulo.disabled = 0');
|
$sql_conditions .= sprintf(' AND tagente_modulo.disabled '.$condition_query.' 0');
|
||||||
} else if ($module_option == 2) {
|
} else if ($module_option == 2) {
|
||||||
// Only disabled
|
// Only disabled.
|
||||||
$sql_conditions .= sprintf(' AND tagente_modulo.disabled = 1');
|
$sql_conditions .= sprintf(' AND tagente_modulo.disabled '.$condition_query.' 1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($datatype != '') {
|
if ($datatype != '') {
|
||||||
$sql_conditions .= sprintf(' AND ttipo_modulo.id_tipo ='.$datatype);
|
$sql_conditions .= sprintf(' AND ttipo_modulo.id_tipo '.$condition_query.' '.$datatype);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($moduletype != '') {
|
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 != '') {
|
if ($ag_freestring != '') {
|
||||||
$sql_conditions .= ' AND (tagente.nombre 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 LIKE \'%%'.$ag_freestring.'%%\'
|
OR tagente.alias COLLATE utf8_general_ci '.$not_condition.' LIKE \'%%'.$ag_freestring.'%%\'
|
||||||
OR tagente_modulo.nombre COLLATE utf8_general_ci LIKE \'%%'.$ag_freestring.'%%\'
|
OR tagente_modulo.nombre COLLATE utf8_general_ci '.$not_condition.' LIKE \'%%'.$ag_freestring.'%%\'
|
||||||
OR tagente_modulo.descripcion COLLATE utf8_general_ci 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) {
|
if ($status == AGENT_MODULE_STATUS_NORMAL) {
|
||||||
// Normal
|
// Normal.
|
||||||
$sql_conditions .= ' AND tagente_estado.estado = 0
|
$sql_conditions .= ' AND tagente_estado.estado '.$condition_query.' 0
|
||||||
AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,100))) ';
|
AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,100))) ';
|
||||||
} else if ($status == AGENT_MODULE_STATUS_CRITICAL_BAD) {
|
} else if ($status == AGENT_MODULE_STATUS_CRITICAL_BAD) {
|
||||||
// Critical
|
// Critical.
|
||||||
$sql_conditions .= ' AND tagente_estado.estado = 1 AND utimestamp > 0';
|
$sql_conditions .= ' AND tagente_estado.estado '.$condition_query.' 1 AND utimestamp > 0';
|
||||||
} else if ($status == AGENT_MODULE_STATUS_WARNING) {
|
} else if ($status == AGENT_MODULE_STATUS_WARNING) {
|
||||||
// Warning
|
// Warning.
|
||||||
$sql_conditions .= ' AND tagente_estado.estado = 2 AND utimestamp > 0';
|
$sql_conditions .= ' AND tagente_estado.estado '.$condition_query.' 2 AND utimestamp > 0';
|
||||||
} else if ($status == AGENT_MODULE_STATUS_NOT_NORMAL) {
|
} else if ($status == AGENT_MODULE_STATUS_NOT_NORMAL) {
|
||||||
// Not normal
|
// Not normal.
|
||||||
$sql_conditions .= ' AND tagente_estado.estado <> 0';
|
$sql_conditions .= ' AND tagente_estado.estado <> 0';
|
||||||
} else if ($status == AGENT_MODULE_STATUS_UNKNOWN) {
|
} else if ($status == AGENT_MODULE_STATUS_UNKNOWN) {
|
||||||
// Unknown
|
// Unknown.
|
||||||
$sql_conditions .= ' AND tagente_estado.estado = 3 AND tagente_estado.utimestamp <> 0';
|
$sql_conditions .= ' AND tagente_estado.estado '.$condition_query.' 3 AND tagente_estado.utimestamp <> 0';
|
||||||
} else if ($status == AGENT_MODULE_STATUS_NOT_INIT) {
|
} else if ($status == AGENT_MODULE_STATUS_NOT_INIT) {
|
||||||
// Not init
|
// Not init.
|
||||||
$sql_conditions .= ' AND tagente_estado.utimestamp = 0
|
$sql_conditions .= ' AND tagente_estado.utimestamp '.$condition_query.' 0
|
||||||
AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)';
|
AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$min_hours_condition = '<';
|
||||||
|
if ($not_condition !== '') {
|
||||||
|
$min_hours_condition = '>';
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($min_hours_status)) {
|
if (!empty($min_hours_status)) {
|
||||||
$date = new DateTime(null, new DateTimeZone($config['timezone']));
|
$date = new DateTime(null, new DateTimeZone($config['timezone']));
|
||||||
$current_timestamp = $date->getTimestamp();
|
$current_timestamp = $date->getTimestamp();
|
||||||
$max_time = ($current_timestamp - ((int) $min_hours_status * 3600));
|
$max_time = ($current_timestamp - ((int) $min_hours_status * 3600));
|
||||||
$sql_conditions .= sprintf(' AND tagente_estado.last_status_change < %d', $max_time);
|
$sql_conditions .= sprintf(' AND tagente_estado.last_status_change '.$min_hours_condition.' %d', $max_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by agent custom fields
|
// Filter by agent custom fields.
|
||||||
$sql_conditions_custom_fields = '';
|
$sql_conditions_custom_fields = '';
|
||||||
if (!empty($ag_custom_fields)) {
|
if (!empty($ag_custom_fields)) {
|
||||||
$cf_filter = [];
|
$cf_filter = [];
|
||||||
foreach ($ag_custom_fields as $field_id => $value) {
|
foreach ($ag_custom_fields as $field_id => $value) {
|
||||||
if (!empty($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.'%\')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($cf_filter)) {
|
if (!empty($cf_filter)) {
|
||||||
$sql_conditions_custom_fields = ' AND tagente.id_agente IN (
|
$sql_conditions_custom_fields = ' AND tagente.id_agente '.$not_condition.' IN (
|
||||||
SELECT tagent_custom_data.id_agent
|
SELECT tagent_custom_data.id_agent
|
||||||
FROM tagent_custom_data
|
FROM tagent_custom_data
|
||||||
WHERE '.implode(' AND ', $cf_filter).')';
|
WHERE '.implode(' AND ', $cf_filter).')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by tag
|
// Filter by tag.
|
||||||
if ($tag_filter !== 0) {
|
if ($tag_filter !== 0) {
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole()) {
|
||||||
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
|
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
|
||||||
SELECT ttag_module.id_agente_modulo
|
SELECT ttag_module.id_agente_modulo
|
||||||
FROM ttag_module
|
FROM ttag_module
|
||||||
WHERE ttag_module.id_tag IN ('.$tag_filter.'))';
|
WHERE ttag_module.id_tag '.$not_condition.' IN ('.$tag_filter.'))';
|
||||||
} else {
|
} else {
|
||||||
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
|
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
|
||||||
SELECT ttag_module.id_agente_modulo
|
SELECT ttag_module.id_agente_modulo
|
||||||
FROM ttag_module
|
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 = '';
|
$sql_conditions_tags = '';
|
||||||
|
|
||||||
if (!users_is_admin()) {
|
if (!users_is_admin()) {
|
||||||
@ -386,20 +406,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;
|
$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')) {
|
if (!defined('METACONSOLE')) {
|
||||||
$count = db_get_sql('SELECT COUNT(DISTINCT tagente_modulo.id_agente_modulo)'.$sql_from.$sql_conditions_all);
|
$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()) {
|
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;
|
$inferior_limit = $offset;
|
||||||
$superior_limit = ($config['block_size'] + $offset);
|
$superior_limit = ($config['block_size'] + $offset);
|
||||||
// Offset reset to get all elements
|
// Offset reset to get all elements.
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
if (!isset($config['meta_num_elements'])) {
|
if (!isset($config['meta_num_elements'])) {
|
||||||
$config['meta_num_elements'] = 100;
|
$config['meta_num_elements'] = 100;
|
||||||
@ -410,9 +430,9 @@ if (is_metaconsole()) {
|
|||||||
$limit_sql = $config['block_size'];
|
$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 = new StdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
@ -445,7 +465,13 @@ $table->data[0][1] .= html_print_select_groups(
|
|||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'id_grupo',
|
'id_grupo',
|
||||||
false
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$not_condition
|
||||||
);
|
);
|
||||||
$table->data[0][1] .= '</div><div>';
|
$table->data[0][1] .= '</div><div>';
|
||||||
$table->data[0][1] .= html_print_input(
|
$table->data[0][1] .= html_print_input(
|
||||||
@ -466,7 +492,7 @@ $fields[AGENT_MODULE_STATUS_WARNING] = __('Warning');
|
|||||||
$fields[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical');
|
$fields[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical');
|
||||||
$fields[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown');
|
$fields[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown');
|
||||||
$fields[AGENT_MODULE_STATUS_NOT_NORMAL] = __('Not normal');
|
$fields[AGENT_MODULE_STATUS_NOT_NORMAL] = __('Not normal');
|
||||||
// default
|
// Default.
|
||||||
$fields[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init');
|
$fields[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init');
|
||||||
|
|
||||||
$table->data[0][2] = __('Monitor status');
|
$table->data[0][2] = __('Monitor status');
|
||||||
@ -475,7 +501,7 @@ $table->data[0][3] = html_print_select(
|
|||||||
'status',
|
'status',
|
||||||
$status,
|
$status,
|
||||||
'',
|
'',
|
||||||
__('All'),
|
__($is_none),
|
||||||
-1,
|
-1,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
@ -503,7 +529,7 @@ if (!is_metaconsole()) {
|
|||||||
$rows_select = modules_get_modulegroups();
|
$rows_select = modules_get_modulegroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data[0][5] = html_print_select($rows_select, 'modulegroup', $modulegroup, '', __('All'), -1, true, false, true, '', false, 'width: 120px;');
|
$table->data[0][5] = html_print_select($rows_select, 'modulegroup', $modulegroup, '', __($is_none), -1, true, false, true, '', false, 'width: 120px;');
|
||||||
|
|
||||||
$table->rowspan[0][6] = 3;
|
$table->rowspan[0][6] = 3;
|
||||||
$table->data[0][6] = html_print_submit_button(
|
$table->data[0][6] = html_print_submit_button(
|
||||||
@ -540,7 +566,7 @@ if (empty($tags)) {
|
|||||||
'tag_filter',
|
'tag_filter',
|
||||||
$tag_filter,
|
$tag_filter,
|
||||||
'',
|
'',
|
||||||
__('All'),
|
__($is_none),
|
||||||
'',
|
'',
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
@ -558,32 +584,32 @@ $network_available = db_get_sql(
|
|||||||
FROM tserver
|
FROM tserver
|
||||||
WHERE server_type = 1'
|
WHERE server_type = 1'
|
||||||
);
|
);
|
||||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||||
$wmi_available = db_get_sql(
|
$wmi_available = db_get_sql(
|
||||||
'SELECT count(*)
|
'SELECT count(*)
|
||||||
FROM tserver
|
FROM tserver
|
||||||
WHERE server_type = 6'
|
WHERE server_type = 6'
|
||||||
);
|
);
|
||||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||||
$plugin_available = db_get_sql(
|
$plugin_available = db_get_sql(
|
||||||
'SELECT count(*)
|
'SELECT count(*)
|
||||||
FROM tserver
|
FROM tserver
|
||||||
WHERE server_type = 4'
|
WHERE server_type = 4'
|
||||||
);
|
);
|
||||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||||
$prediction_available = db_get_sql(
|
$prediction_available = db_get_sql(
|
||||||
'SELECT count(*)
|
'SELECT count(*)
|
||||||
FROM tserver
|
FROM tserver
|
||||||
WHERE server_type = 5'
|
WHERE server_type = 5'
|
||||||
);
|
);
|
||||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||||
$wux_available = db_get_sql(
|
$wux_available = db_get_sql(
|
||||||
'SELECT count(*)
|
'SELECT count(*)
|
||||||
FROM tserver
|
FROM tserver
|
||||||
WHERE server_type = 17'
|
WHERE server_type = 17'
|
||||||
);
|
);
|
||||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||||
// Development mode to use all servers
|
// Development mode to use all servers.
|
||||||
if ($develop_bypass) {
|
if ($develop_bypass) {
|
||||||
$network_available = 1;
|
$network_available = 1;
|
||||||
$wmi_available = 1;
|
$wmi_available = 1;
|
||||||
@ -619,7 +645,7 @@ if (enterprise_installed()) {
|
|||||||
|
|
||||||
$table->data[2][0] = '<span>'.__('Server type').'</span>';
|
$table->data[2][0] = '<span>'.__('Server type').'</span>';
|
||||||
|
|
||||||
$table->data[2][1] = html_print_select($typemodules, 'moduletype', $moduletype, '', __('All'), '', true, false, true, '', false, 'width: 150px;');
|
$table->data[2][1] = html_print_select($typemodules, 'moduletype', $moduletype, '', __($is_none), '', true, false, true, '', false, 'width: 150px;');
|
||||||
|
|
||||||
$monitor_options = [
|
$monitor_options = [
|
||||||
0 => __('All'),
|
0 => __('All'),
|
||||||
@ -649,7 +675,7 @@ switch ($moduletype) {
|
|||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT id_tipo, descripcion
|
'SELECT id_tipo, descripcion
|
||||||
FROM ttipo_modulo
|
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;
|
break;
|
||||||
|
|
||||||
@ -657,7 +683,7 @@ switch ($moduletype) {
|
|||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT id_tipo, descripcion
|
'SELECT id_tipo, descripcion
|
||||||
FROM ttipo_modulo
|
FROM ttipo_modulo
|
||||||
WHERE categoria between 3 and 5 '
|
WHERE categoria '.$not_condition.' between 3 and 5 '
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -665,7 +691,7 @@ switch ($moduletype) {
|
|||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT id_tipo, descripcion
|
'SELECT id_tipo, descripcion
|
||||||
FROM ttipo_modulo
|
FROM ttipo_modulo
|
||||||
WHERE categoria between 0 and 2 '
|
WHERE categoria '.$not_condition.' between 0 and 2 '
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -673,7 +699,7 @@ switch ($moduletype) {
|
|||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT id_tipo, descripcion
|
'SELECT id_tipo, descripcion
|
||||||
FROM ttipo_modulo
|
FROM ttipo_modulo
|
||||||
WHERE categoria between 0 and 2 '
|
WHERE categoria '.$not_condition.' between 0 and 2 '
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -681,7 +707,7 @@ switch ($moduletype) {
|
|||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT id_tipo, descripcion
|
'SELECT id_tipo, descripcion
|
||||||
FROM ttipo_modulo
|
FROM ttipo_modulo
|
||||||
WHERE categoria = 9'
|
WHERE categoria '.$condition_query.' 9'
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -689,7 +715,7 @@ switch ($moduletype) {
|
|||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT id_tipo, descripcion
|
'SELECT id_tipo, descripcion
|
||||||
FROM ttipo_modulo
|
FROM ttipo_modulo
|
||||||
WHERE categoria = 0'
|
WHERE categoria '.$condition_query.' 0'
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -697,7 +723,7 @@ switch ($moduletype) {
|
|||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT id_tipo, descripcion
|
'SELECT id_tipo, descripcion
|
||||||
FROM ttipo_modulo
|
FROM ttipo_modulo
|
||||||
WHERE nombre = \'web_analysis\''
|
WHERE nombre '.$condition_query.' \'web_analysis\''
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -707,6 +733,10 @@ switch ($moduletype) {
|
|||||||
FROM ttipo_modulo'
|
FROM ttipo_modulo'
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Nothing.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$a = db_get_all_rows_sql($sql);
|
$a = db_get_all_rows_sql($sql);
|
||||||
@ -714,7 +744,7 @@ $table->data[3][1] .= '<select id="datatype" name="datatype" ';
|
|||||||
|
|
||||||
$table->data[3][1] .= '>';
|
$table->data[3][1] .= '>';
|
||||||
|
|
||||||
$table->data[3][1] .= '<option name="datatype" value="">'.__('All').'</option>';
|
$table->data[3][1] .= '<option name="datatype" value="">'.__($is_none).'</option>';
|
||||||
|
|
||||||
|
|
||||||
foreach ($a as $valor) {
|
foreach ($a as $valor) {
|
||||||
@ -733,7 +763,27 @@ foreach ($a as $valor) {
|
|||||||
|
|
||||||
|
|
||||||
$table->data[3][1] .= '</div>';
|
$table->data[3][1] .= '</div>';
|
||||||
|
$check_not_condition = '';
|
||||||
|
|
||||||
|
if ($not_condition !== '') {
|
||||||
|
$check_not_condition = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->data[4][0] .= __('Not condition');
|
||||||
|
$table->data[4][1] .= '<div class="w120px mrgn_top_20px">';
|
||||||
|
$table->data[4][1] .= html_print_input(
|
||||||
|
[
|
||||||
|
'type' => 'switch',
|
||||||
|
'name' => 'not_condition',
|
||||||
|
'return' => false,
|
||||||
|
'checked' => $check_not_condition,
|
||||||
|
'value' => 'NOT',
|
||||||
|
'id' => 'not_condition_switch',
|
||||||
|
'onclick' => 'changeNotConditionStatus(this)',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$table->data[4][1] .= ui_print_help_tip(__('If you check this option, those elements that do NOT meet any of the requirements will be shown'), true);
|
||||||
|
$table->data[4][1] .= '</div>';
|
||||||
|
|
||||||
$table_custom_fields = new stdClass();
|
$table_custom_fields = new stdClass();
|
||||||
$table_custom_fields->class = 'filters';
|
$table_custom_fields->class = 'filters';
|
||||||
@ -778,10 +828,12 @@ foreach ($custom_fields as $custom_field) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$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.'">';
|
$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()) {
|
if (is_metaconsole()) {
|
||||||
$table->colspan[4][0] = 7;
|
$table->colspan[5][0] = 7;
|
||||||
$table->cellstyle[4][0] = 'padding: 10px;';
|
$table->cellstyle[5][0] = 'padding: 10px;';
|
||||||
$table->data[4][0] = ui_toggle(
|
$table->data[5][0] = ui_toggle(
|
||||||
html_print_table($table_custom_fields, true),
|
html_print_table($table_custom_fields, true),
|
||||||
__('Advanced Options'),
|
__('Advanced Options'),
|
||||||
'',
|
'',
|
||||||
@ -794,9 +846,9 @@ if (is_metaconsole()) {
|
|||||||
$filters .= '</form>';
|
$filters .= '</form>';
|
||||||
ui_toggle($filters, __('Show filters'), '', '', false);
|
ui_toggle($filters, __('Show filters'), '', '', false);
|
||||||
} else {
|
} else {
|
||||||
$table->colspan[4][0] = 7;
|
$table->colspan[5][0] = 7;
|
||||||
$table->cellstyle[4][0] = 'padding-left: 10px;';
|
$table->cellstyle[5][0] = 'padding-left: 10px;';
|
||||||
$table->data[4][0] = ui_toggle(
|
$table->data[5][0] = ui_toggle(
|
||||||
html_print_table(
|
html_print_table(
|
||||||
$table_custom_fields,
|
$table_custom_fields,
|
||||||
true
|
true
|
||||||
@ -817,9 +869,9 @@ if (is_metaconsole()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unset($table);
|
unset($table);
|
||||||
// End Build Search Form
|
// End Build Search Form.
|
||||||
//
|
//
|
||||||
// Sort functionality
|
// Sort functionality.
|
||||||
$selected = true;
|
$selected = true;
|
||||||
$selectAgentNameUp = false;
|
$selectAgentNameUp = false;
|
||||||
$selectAgentNameDown = false;
|
$selectAgentNameDown = false;
|
||||||
@ -1090,7 +1142,7 @@ $sql = 'SELECT
|
|||||||
LIMIT '.$offset.','.$limit_sql;
|
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 ($autosearch) {
|
||||||
if (! defined('METACONSOLE')) {
|
if (! defined('METACONSOLE')) {
|
||||||
$result = db_get_all_rows_sql($sql);
|
$result = db_get_all_rows_sql($sql);
|
||||||
@ -1101,7 +1153,7 @@ if ($autosearch) {
|
|||||||
ui_pagination($count, false, $offset, 0, false, 'offset', true);
|
ui_pagination($count, false, $offset, 0, false, 'offset', true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// For each server defined and not disabled:
|
// For each server defined and not disabled.
|
||||||
$servers = db_get_all_rows_sql(
|
$servers = db_get_all_rows_sql(
|
||||||
'SELECT *
|
'SELECT *
|
||||||
FROM tmetaconsole_setup
|
FROM tmetaconsole_setup
|
||||||
@ -1114,7 +1166,7 @@ if ($autosearch) {
|
|||||||
$result = [];
|
$result = [];
|
||||||
$count_modules = 0;
|
$count_modules = 0;
|
||||||
foreach ($servers as $server) {
|
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) {
|
if (metaconsole_connect($server) == NOERR) {
|
||||||
$connection = true;
|
$connection = true;
|
||||||
} else {
|
} else {
|
||||||
@ -1124,7 +1176,7 @@ if ($autosearch) {
|
|||||||
$result_server = db_get_all_rows_sql($sql);
|
$result_server = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
if (!empty($result_server)) {
|
if (!empty($result_server)) {
|
||||||
// Create HASH login info
|
// Create HASH login info.
|
||||||
$pwd = $server['auth_token'];
|
$pwd = $server['auth_token'];
|
||||||
$auth_serialized = json_decode($pwd, true);
|
$auth_serialized = json_decode($pwd, true);
|
||||||
|
|
||||||
@ -1165,7 +1217,7 @@ if ($autosearch) {
|
|||||||
ui_pagination($count_modules, false, $offset);
|
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);
|
$result = ui_meta_get_subset_array($result, $inferior_limit, $superior_limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1224,7 +1276,7 @@ $url_data .= '&sort_field=data&sort=';
|
|||||||
$url_timestamp_up .= '&sort_field=timestamp&sort=up';
|
$url_timestamp_up .= '&sort_field=timestamp&sort=up';
|
||||||
$url_timestamp_down .= '&sort_field=timestamp&sort=down';
|
$url_timestamp_down .= '&sort_field=timestamp&sort=down';
|
||||||
|
|
||||||
// Start Build List Result
|
// Start Build List Result.
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
$table->cellpadding = 0;
|
$table->cellpadding = 0;
|
||||||
@ -1316,7 +1368,7 @@ if (!empty($result)) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
foreach ($result as $row) {
|
foreach ($result as $row) {
|
||||||
// Avoid unset, null and false value
|
// Avoid unset, null and false value.
|
||||||
if (empty($row['server_name'])) {
|
if (empty($row['server_name'])) {
|
||||||
$row['server_name'] = '';
|
$row['server_name'] = '';
|
||||||
}
|
}
|
||||||
@ -1330,13 +1382,13 @@ if (!empty($result)) {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// Fixed the goliat sends the strings from web
|
// Fixed the goliat sends the strings from web.
|
||||||
// without HTML entities
|
// Without HTML entities.
|
||||||
if ($is_web_content_string) {
|
if ($is_web_content_string) {
|
||||||
$row['datos'] = io_safe_input($row['datos']);
|
$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'])) {
|
if ($row['datos'] != strip_tags($row['datos'])) {
|
||||||
$row['datos'] = io_safe_input($row['datos']);
|
$row['datos'] = io_safe_input($row['datos']);
|
||||||
}
|
}
|
||||||
@ -1455,6 +1507,29 @@ if (!empty($result)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (in_array('module_name', $show_fields) || is_metaconsole()) {
|
||||||
|
$data[3] = ui_print_truncate_text($row['module_name'], 'module_small', false, true, true);
|
||||||
|
if ($row['extended_info'] != '') {
|
||||||
|
$data[3] .= ui_print_help_tip($row['extended_info'], true, '/images/default_list.png');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($row['tags'] != '') {
|
||||||
|
$data[3] .= html_print_image(
|
||||||
|
'/images/tag_red.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => $row['tags'],
|
||||||
|
'class' => 'tag_row',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('server_type', $show_fields) || is_metaconsole()) {
|
||||||
|
$data[4] = servers_show_type($row['id_modulo']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (in_array('module_name', $show_fields) || is_metaconsole()) {
|
if (in_array('module_name', $show_fields) || is_metaconsole()) {
|
||||||
$data[3] = ui_print_truncate_text($row['module_name'], 'module_small', false, true, true);
|
$data[3] = ui_print_truncate_text($row['module_name'], 'module_small', false, true, true);
|
||||||
if ($row['extended_info'] != '') {
|
if ($row['extended_info'] != '') {
|
||||||
@ -1509,7 +1584,9 @@ if (!empty($result)) {
|
|||||||
if (is_numeric($row['datos'])) {
|
if (is_numeric($row['datos'])) {
|
||||||
$data[6] = ui_print_status_image(
|
$data[6] = ui_print_status_image(
|
||||||
STATUS_MODULE_CRITICAL,
|
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
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -1523,7 +1600,9 @@ if (!empty($result)) {
|
|||||||
if (is_numeric($row['datos'])) {
|
if (is_numeric($row['datos'])) {
|
||||||
$data[6] = ui_print_status_image(
|
$data[6] = ui_print_status_image(
|
||||||
STATUS_MODULE_WARNING,
|
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
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -1537,7 +1616,9 @@ if (!empty($result)) {
|
|||||||
if (is_numeric($row['datos'])) {
|
if (is_numeric($row['datos'])) {
|
||||||
$data[6] = ui_print_status_image(
|
$data[6] = ui_print_status_image(
|
||||||
STATUS_MODULE_UNKNOWN,
|
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
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -1551,7 +1632,9 @@ if (!empty($result)) {
|
|||||||
if (is_numeric($row['datos'])) {
|
if (is_numeric($row['datos'])) {
|
||||||
$data[6] = ui_print_status_image(
|
$data[6] = ui_print_status_image(
|
||||||
STATUS_MODULE_NO_DATA,
|
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
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -1626,7 +1709,7 @@ if (!empty($result)) {
|
|||||||
|
|
||||||
$acl_graphs = false;
|
$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()) {
|
if (!is_metaconsole()) {
|
||||||
$agent_groups = agents_get_all_groups_agent($row['id_agent'], $row['id_group']);
|
$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');
|
$acl_graphs = check_acl_one_of_groups($config['id_user'], $agent_groups, 'RR');
|
||||||
@ -1649,7 +1732,7 @@ if (!empty($result)) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (is_metaconsole() && isset($row['server_id'])) {
|
if (is_metaconsole() && isset($row['server_id'])) {
|
||||||
// Set the server id
|
// Set the server id.
|
||||||
$graph_params['server'] = $row['server_id'];
|
$graph_params['server'] = $row['server_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1740,7 +1823,7 @@ if (!empty($result)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show units ONLY in numeric data types
|
// Show units ONLY in numeric data types.
|
||||||
if (isset($row['unit'])) {
|
if (isset($row['unit'])) {
|
||||||
$data_macro = modules_get_unit_macro($row['datos'], $row['unit']);
|
$data_macro = modules_get_unit_macro($row['datos'], $row['unit']);
|
||||||
if ($data_macro) {
|
if ($data_macro) {
|
||||||
@ -1749,7 +1832,7 @@ if (!empty($result)) {
|
|||||||
$salida .= ' '.'<i>'.io_safe_output($row['unit']).'</i>';
|
$salida .= ' '.'<i>'.io_safe_output($row['unit']).'</i>';
|
||||||
if (strlen($salida) > $config['agent_size_text_small']) {
|
if (strlen($salida) > $config['agent_size_text_small']) {
|
||||||
$salida = ui_print_truncate_text($salida, 'agent_small', true, true, false, '[…]', 'font-size:7.5pt;');
|
$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);
|
$text_aux = explode('<a', $salida);
|
||||||
$match = preg_replace('/(<i>|<\/i>|<i|<\/i|i>|\/i>|<|>)/', '', $text_aux[0]);
|
$match = preg_replace('/(<i>|<\/i>|<i|<\/i|i>|\/i>|<|>)/', '', $text_aux[0]);
|
||||||
$salida = $match.'<a'.$text_aux[1];
|
$salida = $match.'<a'.$text_aux[1];
|
||||||
@ -1759,8 +1842,8 @@ if (!empty($result)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Fixed the goliat sends the strings from web
|
// Fixed the goliat sends the strings from web.
|
||||||
// without HTML entities
|
// Without HTML entities.
|
||||||
if ($is_web_content_string) {
|
if ($is_web_content_string) {
|
||||||
$module_value = $row['datos'];
|
$module_value = $row['datos'];
|
||||||
} else {
|
} else {
|
||||||
@ -1794,12 +1877,12 @@ if (!empty($result)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Fixed the goliat sends the strings from web
|
// Fixed the goliat sends the strings from web.
|
||||||
// without HTML entities
|
// Without HTML entities.
|
||||||
if ($is_web_content_string) {
|
if ($is_web_content_string) {
|
||||||
$sub_string = substr($row['datos'], 0, 12);
|
$sub_string = substr($row['datos'], 0, 12);
|
||||||
} else {
|
} else {
|
||||||
// Fixed the data from Selenium Plugin
|
// Fixed the data from Selenium Plugin.
|
||||||
if ($module_value != strip_tags($module_value)) {
|
if ($module_value != strip_tags($module_value)) {
|
||||||
$module_value = io_safe_input($module_value);
|
$module_value = io_safe_input($module_value);
|
||||||
$sub_string = substr($row['datos'], 0, 12);
|
$sub_string = substr($row['datos'], 0, 12);
|
||||||
@ -1848,6 +1931,7 @@ if (!empty($result)) {
|
|||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
|
|
||||||
if ($count_modules > $config['block_size']) {
|
if ($count_modules > $config['block_size']) {
|
||||||
ui_pagination($count_modules, false, $offset, 0, false, 'offset', true, 'pagination-bottom');
|
ui_pagination($count_modules, false, $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||||
}
|
}
|
||||||
@ -1859,6 +1943,7 @@ if (!empty($result)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// End Build List Result.
|
// End Build List Result.
|
||||||
echo "<div id='monitor_details_window'></div>";
|
echo "<div id='monitor_details_window'></div>";
|
||||||
|
|
||||||
@ -1869,6 +1954,11 @@ ui_require_javascript_file('pandora_modules');
|
|||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
if(!document.getElementById('not_condition_switch').checked){
|
||||||
|
document.getElementById("select2-ag_group-container").innerHTML = "None";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$('#moduletype').click(function() {
|
$('#moduletype').click(function() {
|
||||||
jQuery.get (
|
jQuery.get (
|
||||||
"ajax.php",
|
"ajax.php",
|
||||||
@ -1899,7 +1989,7 @@ function toggle_full_value(id) {
|
|||||||
$("#value_module_text_" + id).html(text);
|
$("#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) {
|
function show_module_detail_dialog(module_id, id_agent, server_name, offset, period, module_name) {
|
||||||
if (period == -1) {
|
if (period == -1) {
|
||||||
if ($("#period").length == 1) {
|
if ($("#period").length == 1) {
|
||||||
@ -1967,4 +2057,63 @@ function refresh_pagination_callback (module_id, id_agent, server_name,module_na
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function changeNotConditionStatus() {
|
||||||
|
|
||||||
|
let chkbox =document.getElementById('not_condition_switch');
|
||||||
|
if(chkbox.checked) {
|
||||||
|
|
||||||
|
$('select[name=datatypebox] > option:first-child').val('None');
|
||||||
|
$('#datatypebox option:first').text('None');
|
||||||
|
$('select[name=status] > option:first-child').text('None');
|
||||||
|
$('select[name=moduletype] > option:first-child').text('None');
|
||||||
|
$('select[name=modulegroup] > option:first-child').text('None');
|
||||||
|
$('select[name=tag_filter] > option:first-child').text('None');
|
||||||
|
|
||||||
|
$("#status").select2().val(["None"]).trigger("change");
|
||||||
|
$("#moduletype").select2().val(["None"]).trigger("change");
|
||||||
|
$("#modulegroup").select2().val(["None"]).trigger("change");
|
||||||
|
$("#tag_filter").select2().val(["None"]).trigger("change");
|
||||||
|
|
||||||
|
|
||||||
|
document.getElementById("select2-status-container").innerHTML = "None";
|
||||||
|
document.getElementById("select2-moduletype-container").innerHTML = "None";
|
||||||
|
document.getElementById("select2-ag_group-container").innerHTML = "None";
|
||||||
|
document.getElementById("select2-modulegroup-container").innerHTML = "None";
|
||||||
|
document.getElementById("select2-tag_filter-container").innerHTML = "None";
|
||||||
|
|
||||||
|
}else {
|
||||||
|
$('select[name=datatypebox] > option:first-child').val('All');
|
||||||
|
$('#datatypebox option:first').text('All');
|
||||||
|
$('select[name=status] > option:first-child').text('All');
|
||||||
|
$('select[name=moduletype] > option:first-child').text('All');
|
||||||
|
$('select[name=modulegroup] > option:first-child').text('All');
|
||||||
|
$('select[name=tag_filter] > option:first-child').text('All');
|
||||||
|
|
||||||
|
$('#datatypebox option:first').text('All');
|
||||||
|
|
||||||
|
$("#status").select2().val(["All"]).trigger("change");
|
||||||
|
$("#moduletype").select2().val(["All"]).trigger("change");
|
||||||
|
$("#modulegroup").select2().val(["All"]).trigger("change");
|
||||||
|
$("#tag_filter").select2().val(["All"]).trigger("change");
|
||||||
|
|
||||||
|
|
||||||
|
document.getElementById("select2-status-container").innerHTML = "All";
|
||||||
|
document.getElementById("select2-moduletype-container").innerHTML = "All";
|
||||||
|
document.getElementById("select2-ag_group-container").innerHTML = "All";
|
||||||
|
document.getElementById("select2-modulegroup-container").innerHTML = "All";
|
||||||
|
document.getElementById("select2-tag_filter-container").innerHTML = "All";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let chkbox =document.getElementById('not_condition_switch');
|
||||||
|
let value_swtich = "<?php echo $not_condition; ?>";
|
||||||
|
if( value_swtich != "") {
|
||||||
|
chkbox.checked = true;
|
||||||
|
}else {
|
||||||
|
chkbox.checked = false;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user