Diff for scripts/perl/syswatcher/syswatcher.pl between version 1.7 and 1.8
| version 1.7, 2004/01/05 11:34:21 |
version 1.8, 2005/02/07 22:07:59 |
|
|
| # 16/10/2003 - added automatic database reconnecting (nepto) |
# 16/10/2003 - added automatic database reconnecting (nepto) |
| # |
# |
| |
|
| # $Platon: scripts/syswatcher/syswatcher.pl,v 1.6 2003/12/11 13:04:56 rajo Exp $ |
# $Platon: scripts/perl/syswatcher/syswatcher.pl,v 1.7 2004/01/05 11:34:21 nepto Exp $ |
| |
|
| use strict; |
use strict; |
| |
|
|
|
| |
|
| Time::HiRes::sleep ($update_interval - (Time::HiRes::gettimeofday % $update_interval)); |
Time::HiRes::sleep ($update_interval - (Time::HiRes::gettimeofday % $update_interval)); |
| while ($dbh) { |
while ($dbh) { |
| |
|
| |
my $sleep = 1; |
| |
while (!defined($dbh) or ref($dbh) ne 'DBI::db' or !($dbh->ping())) { |
| |
print STDERR "CheckDB - db ping error\n"; |
| |
sleep $sleep; |
| |
$sleep += 10 if ($sleep < 120); |
| |
} |
| |
|
| |
$dbh->{mysql_auto_reconnect} = 1; |
| |
|
| |
# |
| |
# DB ping must be done twice (bug in DBI??), otherwise warning "DBD::mysql::st execute warning:" [rajo] |
| |
# |
| |
my $rv = $dbh->ping(); |
| |
$dbh->{mysql_auto_reconnect} = 1; |
| |
|
| last if (! loadavg()); |
last if (! loadavg()); |
| last if (! meminfo()); |
last if (! meminfo()); |
| |
|
Platon Group <platon@platon.org> http://platon.org/
|
|