--- ./check_disk_smb.compare_levels_after_kMG_decoding 2004-03-29 13:30:31.000000000 +0100 +++ ./check_disk_smb 2004-03-29 13:38:37.000000000 +0100 @@ -92,16 +92,6 @@ usage("Both warning and critical should be same type- warning: $opt_w critical: $opt_c \n"); } -# verify warning is less than critical -if ( $opt_w =~ /[kMG]/) { - unless ( $warn > $crit) { - usage("Disk size: warning ($opt_w) should be greater than critical ($opt_c) \n"); - } -}else{ - unless ( $warn < $crit) { - usage("Percentage: warning ($opt_w) should be less than critical ($opt_c) \n"); - } -} my $workgroup = $1 if (defined($opt_W) && $opt_W =~ /(.*)/); @@ -177,6 +167,18 @@ $crit = $1 * 1048576; } + # try to verify warning is less than critical + # should this require that warn_type and $crit_type are the same ? + if ( $warn_type eq "K" and $crit_type eq "K" ) { + unless ( $warn > $crit) { + usage("Disk size: warning ($opt_w) should be greater than critical ($opt_c) \n"); + } + } elsif ( $warn_type eq "P" and $crit_type eq "P" ) { + unless ( $warn < $crit) { + usage("Percentage: warning ($opt_w) should be less than critical ($opt_c) \n"); + } + } + if (int($avail / 1024) > 0) { $avail = int($avail / 1024); if (int($avail /1024) > 0) {