Changeset f6a4c1a67edbefc69278d8532b1db0f19bdc6ac2

Show
Ignore:
Timestamp:
03/07/10 17:32:51 (4 years ago)
Author:
Sergey Ivanov <seriv@omniti.com>
git-committer:
Sergey Ivanov <seriv@omniti.com> 1267983171 +0000
git-parent:

[6978dd342cb76b06a08cee1ee35b17b743cb66f1]

git-author:
Sergey Ivanov <seriv@omniti.com> 1267983171 +0000
Message:

fixes for ZFSYNCHECK

git-svn-id: https://labs.omniti.com/resmon/trunk@251 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lib/Resmon/Module/ZFSYNCHECK.pm

    r6978dd3 rf6a4c1a  
    99  my $zfs=$arg->{'object'}; 
    1010  my $age=$arg->{'age'}; 
    11   my $recentsnap = cache_command("pgrep zfs 2>&1 >/dev/null || zfs list -tsnapshot -H -Screation -oname | grep '^$zfs\@' | head -1", 300); 
     11  my $recentsnap; 
     12  my $attempt=0; 
     13  my $MAXATTEMPTS=5; 
     14  my $ZFSQUERY="/usr/sbin/zfs list -tsnapshot -H -Screation -oname"; 
     15  while (`pgrep -f -l "^$ZFSQUERY"`) { 
     16    if ($attempt++ < $MAXATTEMPTS) { 
     17      sleep(1); 
     18    } 
     19    else { 
     20      return "BAD ($ZFSQUERY hanged)"; 
     21    } 
     22  } 
     23  my $recentsnap = cache_command("$ZFSQUERY| grep '^$zfs\@' | head -1", 300); 
    1224  return "BAD(no snapshot of $zfs)" if not $recentsnap; 
    13   my $snaptime = cache_command("zfs get -H -p -ovalue creation $recentsnap", 300); 
     25  $ZFSQUERY="/usr/sbin/zfs get -H -p -ovalue creation $recentsnap"; 
     26  while (`pgrep -f "^$ZFSQUERY"`) { 
     27    if ($attempt++ < $MAXATTEMPTS) { 
     28      sleep(1); 
     29    } 
     30    else { 
     31      return "BAD ($ZFSQUERY hanged)"; 
     32    } 
     33  } 
     34  my $snaptime = cache_command($ZFSQUERY, 300); 
    1435  my $snapage=time()-$snaptime; 
    1536  if($snapage < $age) {