[Date Prev]   [Date Next] [Thread Prev]   [Thread Next] [Date Index]   [Thread Index]

 

     Re: [nocol-users] SQLMon

On Wed, 19 Jan 2000, Rick Beebe wrote:

> Date: Wed, 19 Jan 2000 12:47:47 -0500
> From: Rick Beebe <richard.beebe@yale.edu>
> To: nocol-users@navya.com
> Subject: Re: [nocol-users] SQLMon
> 
> "Nathan Clemons [Staff]" wrote:
> > 
> > I made some changes to the SQL monitor provided by Rick. Let me know how
> > this works for you all, seems to work beautifully for me.
> 
> There are a few problems with it.
> 
>    foreach $item (@items ) {
> #    ($host,$ipaddr) = split(/\t/,$item);
> 
>      $rc = 0;
>      $failconnect = 0;  <-- If you don't initialize this it retains its
> value for
>                             the next server

Caught that already, still working on this.

> 
>      print "(debug) dotest: connecting to database
> $data_source{$item}                              ($username{$item},
> $password{$item})\n" if $debug;
>      if ($dbh = DBI->connect($data_source{$item}, $username{$item},
> $password{$item})) {
>        print "(debug) dotest: running command $query_string{$item}\n" if
> $debug;
>        if (!($rc = $dbh->do($query_string{$item}))) {
>          print "(debug) $host : $dbh->errstr" if $debug; 
> 
> Because of the line commented out above, $host doesn't actually contain
> anything. Uncomment it or use $item. Also, I have trouble with $dbh->errstr

Caught that, too, and uncommented it.

> printing out within quotes. I'm sure there's some special syntax but I
> simply changed the print statement to
> 
>          print "(debug) $item : ".$dbh->errstr."\n" if $debug; 
> 

I'll change that locally here too. What about the $DBI::errstr?

>          $failconnect = -1;
>        }
>      } else {
>         print "(debug) $host : $DBI::errstr" if $debug;  <-- same deal here
>         $rc = $failconnect = -1;   <-- Change this to -2
>      }
> 
> Then down a bit further:
>   if ($failconnect > -1) { $dbh->disconnect; }
> 
> change that to
>   if ($failconnect > -2) { $dbh->disconnect; }
> 
> We need to differentiate between a failure of DBI->connect (which doesn't
> need a subsequent disconnect) and a failure of $dbh->do (which still needs
> the disconnect).

Good catch, I missed that one completely.

I'm still working on SIGHUP'ing this puppy. Shouldn't take much more.

--Nathan.

____________________________________________________________________
Nathan Clemons, Systems Engineer
WinStar Internet and Hosting Services

800 South Main St. Mansfield, MA  02048
____________________________________________________________________  
nclemons@winstar.com    www.winstar.com    (v) 800-234-0002 ext.1109
nathan@ici.net                             (f) 508-261-0430