cause the --reverse flag to invert string comparisons in custom queries
authorNathaniel Waisbrot <[email protected]>
Mon, 1 Apr 2013 15:33:18 +0000 (11:33 -0400)
committerNathaniel Waisbrot <[email protected]>
Mon, 1 Apr 2013 15:33:18 +0000 (11:33 -0400)
check_postgres.pl

index 576bfca8056f59a10a26878e2a2d8fa3ff36ea3f..7885b58aa9f9c257f32c049f3eda98f5e595ee4b 100755 (executable)
@@ -4084,7 +4084,7 @@ sub check_custom_query {
                 return;
             }
             if (length $critical) {
-                if (($valtype eq 'string' and $result eq $critical)
+                if (($valtype eq 'string' and $reverse ? $result ne $critical : $result eq $critical)
                     or
                     ($valtype ne 'string' and $reverse ? $result <= $critical : $result >= $critical)) { ## covers integer, time, size
                     add_critical "$result";
@@ -4093,7 +4093,7 @@ sub check_custom_query {
             }
 
             if (length $warning and ! $gotmatch) {
-                if (($valtype eq 'string' and $result eq $warning)
+                if (($valtype eq 'string' and $reverse ? $result ne $warning : $result eq $warning)
                     or
                     ($valtype ne 'string' and length $result and $reverse ? $result <= $warning : $result >= $warning)) {
                     add_warning "$result";