allow both to contain periods and make mem work on bsd

This commit is contained in:
Zane C. B-H 2019-08-21 05:04:39 -05:00
parent febec57776
commit 7a94577b9d
2 changed files with 13 additions and 11 deletions

View File

@ -133,26 +133,26 @@ sub match{
while (defined( $self->{pctcpus}[$pctcpu_int] )){
my $pctcpu=$self->{pctcpus}[$pctcpu_int];
if (
( $pctcpu =~ /^[0-9]+$/ ) &&
( $pctcpu =~ /^[0-9.]+$/ ) &&
( $pctcpu eq $proc_pctcpu )
){
return 1;
}elsif( $pctcpu =~ /^\<\=[0-9]+$/ ){
}elsif( $pctcpu =~ /^\<\=[0-9.]+$/ ){
$pctcpu=~s/^\<\=//;
if ( $proc_pctcpu <= $pctcpu ){
return 1;
}
}elsif( $pctcpu =~ /^\<[0-9]+$/ ){
}elsif( $pctcpu =~ /^\<[0-9.]+$/ ){
$pctcpu=~s/^\<//;
if ( $proc_pctcpu < $pctcpu ){
return 1;
}
}elsif( $pctcpu =~ /^\>\=[0-9]+$/ ){
}elsif( $pctcpu =~ /^\>\=[0-9.]+$/ ){
$pctcpu=~s/^\>\=//;
if ( $proc_pctcpu >= $pctcpu ){
return 1;
}
}elsif( $pctcpu =~ /^\>[0-9]+$/ ){
}elsif( $pctcpu =~ /^\>[0-9.]+$/ ){
$pctcpu=~s/^\>//;
if ( $proc_pctcpu > $pctcpu ){
return 1;

View File

@ -126,7 +126,9 @@ sub match{
my $proc_pctmem;
if ($^O =~ /bsd/){
$proc_pctmem=$self->{physmem};
eval{
$proc_pctmem=(($object->{rssize} * 1024 * 4 ) / $self->{physmem}) * 100;
}
}else{
eval{
$proc_pctmem=$object->pctmem;
@ -144,26 +146,26 @@ sub match{
while (defined( $self->{pctmems}[$pctmem_int] )){
my $pctmem=$self->{pctmems}[$pctmem_int];
if (
( $pctmem =~ /^[0-9]+$/ ) &&
( $pctmem =~ /^[0-9.]+$/ ) &&
( $pctmem eq $proc_pctmem )
){
return 1;
}elsif( $pctmem =~ /^\<\=[0-9]+$/ ){
}elsif( $pctmem =~ /^\<\=[0-9.]+$/ ){
$pctmem=~s/^\<\=//;
if ( $proc_pctmem <= $pctmem ){
return 1;
}
}elsif( $pctmem =~ /^\<[0-9]+$/ ){
}elsif( $pctmem =~ /^\<[0-9.]+$/ ){
$pctmem=~s/^\<//;
if ( $proc_pctmem < $pctmem ){
return 1;
}
}elsif( $pctmem =~ /^\>\=[0-9]+$/ ){
}elsif( $pctmem =~ /^\>\=[0-9.]+$/ ){
$pctmem=~s/^\>\=//;
if ( $proc_pctmem >= $pctmem ){
return 1;
}
}elsif( $pctmem =~ /^\>[0-9]+$/ ){
}elsif( $pctmem =~ /^\>[0-9.]+$/ ){
$pctmem=~s/^\>//;
if ( $proc_pctmem > $pctmem ){
return 1;