summaryrefslogtreecommitdiffstats
path: root/web/attachments/81737-nagios-plugins--check-disk-smb--compare_levels_after_kMG_decoding
blob: 1611f41153a42cff0f5d8741cd198d9d931f7c68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- ./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) {