[check_postgres] problem in the verify version subroutine

Jeff Frost jeff at frostconsultingllc.com
Wed Dec 17 18:15:03 UTC 2008


One of the admins (Lee Jensen) at a customer site, noted that the
verify_version subroutine had problems on some versions of PostgreSQL. 
So he patched the $val check to fix the problem.  Here's what he had to say:

On the third to last line $val was something like " on\n\n" on some
versions of psql even though the database had no whitespace in the
field. So I changed the comparison line to $val !~ 'on' instead of $val
ne 'on' which is what it was previously. Other places in the code used
regex comparisons for the settings field so I figured it was just
missing here.

*** check_postgres.pl    Wed Dec 17 10:04:24 2008
--- check_postgres.pl.new    Wed Dec 17 10:06:55 2008
***************
*** 1222,1228 ****
              die "Could not fetch setting '$setting'\n";
          }
          my $val = $info->{db}[0]{slurp};
!         if ($val ne 'on') {
              die qq{Cannot run "$action": $setting is not set to on\n};
          }
      }
--- 1222,1228 ----
              die "Could not fetch setting '$setting'\n";
          }
          my $val = $info->{db}[0]{slurp};
!         if ($val !~ 'on') {
              die qq{Cannot run "$action": $setting is not set to on\n};
          }
      }

-- 
Jeff Frost, Owner 	<jeff at frostconsultingllc.com>
Frost Consulting, LLC 	http://www.frostconsultingllc.com/
Phone: 916-647-6411	FAX: 916-405-4032

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mail.endcrypt.com/pipermail/check_postgres/attachments/20081217/fcd24f8d/attachment.html 


More information about the Check_postgres mailing list