WMI column now refer to query order WMIServer

This commit is contained in:
Luis 2020-08-07 09:56:58 +02:00 committed by Alejandro Fraguas
parent 386ab5ef91
commit 3176065ce2
1 changed files with 24 additions and 5 deletions

View File

@ -203,10 +203,29 @@ sub data_consumer ($$) {
my @row = split(/\|/, $output[2]); my @row = split(/\|/, $output[2]);
# Get the specified column # Get the specified column
$module_data = $row[$module->{'tcp_port'}] if (defined ($module->{'tcp_port'}) && defined ($row[$module->{'tcp_port'}])); if (defined ($module->{'tcp_port'})) {
if ($module_data =~ m/^ERROR/) { $wmi_query =~ m/SELECT\s(.+)\sFROM/ig;
pandora_update_module_on_error ($pa_config, $module, $dbh); my @wmi_columns = split /\s*,\s*/, $1;
return; my $selected_col = $wmi_columns[$module->{'tcp_port'}];
# Get result col number
my @output_col = split(/\|/, $output[1]);
# Find column number
my $col_number;
for(my $i = 0; $i < @output_col; $i++ ) {
if( $output_col[$i] =~ /$selected_col/ ) {
$col_number = $i;
last;
}
}
$module_data = $row[$col_number] if (defined ($col_number) && defined ($row[$col_number]));
if ($module_data =~ m/^ERROR/) {
pandora_update_module_on_error ($pa_config, $module, $dbh);
return;
}
} }
# Regexp # Regexp