Orphan service modules + control require argument select from sql

This commit is contained in:
fbsanchez 2020-10-26 13:37:05 +01:00
parent 76324679ec
commit 5842235846
2 changed files with 25 additions and 5 deletions

View File

@ -1351,6 +1351,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
* @param mixed $size Max elements showed in select or default (size=10) * @param mixed $size Max elements showed in select or default (size=10)
* @param integer $truncante_size Truncate size of the element, by default is set to GENERIC_SIZE_TEXT constant * @param integer $truncante_size Truncate size of the element, by default is set to GENERIC_SIZE_TEXT constant
* @param integer $class Class to apply. * @param integer $class Class to apply.
* @param boolean $required Select is required or not.
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
@ -1368,7 +1369,8 @@ function html_print_select_from_sql(
$style=false, $style=false,
$size=false, $size=false,
$trucate_size=GENERIC_SIZE_TEXT, $trucate_size=GENERIC_SIZE_TEXT,
$class='' $class='',
$required=false
) { ) {
global $config; global $config;
@ -1404,7 +1406,17 @@ function html_print_select_from_sql(
$disabled, $disabled,
$style, $style,
'', '',
$size $size,
// Modal.
false,
// Message.
'',
// Select_all.
false,
// Simple_multiple_options.
false,
// Required.
$required
); );
} }
@ -4363,7 +4375,8 @@ function html_print_input($data, $wrapper='div', $input_only=false)
((isset($data['style']) === true) ? $data['style'] : false), ((isset($data['style']) === true) ? $data['style'] : false),
((isset($data['size']) === true) ? $data['size'] : false), ((isset($data['size']) === true) ? $data['size'] : false),
((isset($data['trucate_size']) === true) ? $data['trucate_size'] : GENERIC_SIZE_TEXT), ((isset($data['trucate_size']) === true) ? $data['trucate_size'] : GENERIC_SIZE_TEXT),
((isset($data['class']) === true) ? $data['class'] : '') ((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['required']) === true) ? $data['required'] : false)
); );
break; break;

View File

@ -108,13 +108,16 @@ sub data_producer ($) {
ORDER BY last_execution_try ASC ', safe_input($pa_config->{'servername'})); ORDER BY last_execution_try ASC ', safe_input($pa_config->{'servername'}));
} }
else { else {
# If is metaconsole server, will evaluate orphan modules also.
@rows = get_db_rows ($dbh, 'SELECT DISTINCT(tagente_modulo.id_agente_modulo), @rows = get_db_rows ($dbh, 'SELECT DISTINCT(tagente_modulo.id_agente_modulo),
tagente_modulo.flag, last_execution_try tagente_modulo.flag, last_execution_try
FROM tagente, tagente_modulo, tagente_estado FROM tagente, tagente_modulo, tagente_estado
WHERE ((server_name = ?) WHERE ((server_name = ?)
OR (server_name = ANY(SELECT name OR (server_name = ANY(SELECT name
FROM tserver FROM tserver
WHERE status = 0 AND server_type = ?))) WHERE status = 0 AND server_type = ?))
OR ((server_name = 0 OR server_name IS NULL) AND 1=?)
)
AND tagente_modulo.id_agente = tagente.id_agente AND tagente_modulo.id_agente = tagente.id_agente
AND tagente.disabled = 0 AND tagente.disabled = 0
AND tagente_modulo.disabled = 0 AND tagente_modulo.disabled = 0
@ -123,7 +126,11 @@ sub data_producer ($) {
AND tagente_modulo.id_modulo = 5 AND tagente_modulo.id_modulo = 5
AND (tagente_modulo.flag = 1 AND (tagente_modulo.flag = 1
OR (tagente_estado.last_execution_try + tagente_estado.current_interval) < UNIX_TIMESTAMP()) OR (tagente_estado.last_execution_try + tagente_estado.current_interval) < UNIX_TIMESTAMP())
ORDER BY last_execution_try ASC', safe_input($pa_config->{'servername'}), PREDICTIONSERVER); ORDER BY last_execution_try ASC',
safe_input($pa_config->{'servername'}),
PREDICTIONSERVER,
is_metaconsole($pa_config)
);
} }
foreach my $row (@rows) { foreach my $row (@rows) {