I have a script that I am trying to use with soalrwinds, this is not the first time I have used a linux script monitor, however this time around it is telling me
Get Output Failed:
Can't identify dynamic column definitions from script output.
the output is as follows from the command line :
statistic.message: SQLException not found
statistic.status: 0
The script itself does a scrape on a log file, $ARGV[0], for a specific string, $ARGV[1], and outputs its findings as a message STRING not found with a statistic of 0 as a happy condition or the line of the logfile with a statistic of 1 as a fail condition. Like I said, it works at the command line but not when run through SAM
any help would be greatly appreciated as this is holding up production monitoring.
#####################CODE####################
use strict;
use warnings;
#declare variables
my $filename = $ARGV[0];
my $search = $ARGV[1];
my $status = 0;
my $errmsg = "$search not found";
#open file
open (FILE,$filename) or die $!;
open (OUT,">log.txt");
while(<FILE>){
if($_ =~ m/$search/){
$status=1;
$errmsg="$_\n";
print OUT "$_\n";
last
}
}#close while
print "Message.log: $errmsg\n";
print "Statistic.log: $status\n";
#close files
close(FILE);
close(OUT);
exit;
#############END CODE################