added the ability to differentiate between counters and gauges #115

This commit is contained in:
Jordi Sanfeliu 2022-12-01 09:12:28 +01:00
parent 7d161a72ae
commit 64eda7706e
1 changed files with 7 additions and 5 deletions

View File

@ -243,12 +243,14 @@ sub serv_update {
} }
foreach my $se (@sa) { foreach my $se (@sa) {
@sc = split(',', $se); @sc = split(',', $se);
my $logfile = trim($sc[0]); my $valtype = trim(uc($sc[0]));
$sc[1] = trim($sc[1]); $val[$n] = 0 unless $valtype eq "C"; # zero it if is not a counter
$sc[1] =~ s/^\"//; $sc[1] =~ s/\"$//; # remove leading and trailing quotes my $logfile = trim($sc[1]);
my $date = strftime($sc[1], localtime); $sc[2] = trim($sc[2]);
$sc[2] =~ s/^\"//; $sc[2] =~ s/\"$//; # remove leading and trailing quotes
my $date = strftime($sc[2], localtime);
$date = qr($date) unless !$date; $date = qr($date) unless !$date;
my @regex = split('\+', trim($sc[2])); my @regex = split('\+', trim($sc[3]));
my $IN; my $IN;
my $seek_pos = $config->{serv_hist}->{$seek_str} || 0; my $seek_pos = $config->{serv_hist}->{$seek_str} || 0;
if($logfile =~ m/^file:.+/) { if($logfile =~ m/^file:.+/) {