Skip to content
Snippets Groups Projects
Commit 71a282c0 authored by Sergey Ivanov's avatar Sergey Ivanov
Browse files

fixes in syntax of result: no space betwenn BAD and "("

git-svn-id: https://labs.omniti.com/resmon/trunk@348 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55
parent 08f74cc2
No related branches found
No related tags found
No related merge requests found
package Resmon::Module::ZFSYNCHECK;
use strict;
use POSIX;
use Resmon::ExtComm qw/cache_command/;
use vars qw/@ISA/;
use Time::Local;
......@@ -16,10 +17,10 @@ sub handler {
sleep(1);
}
else {
return "BAD ($ZFSQUERY hanged)";
return "BAD($ZFSQUERY hanged)";
}
}
my $recentsnap = cache_command("$ZFSQUERY| grep '^$zfs\@' | head -1", 300);
my $recentsnap = cache_command("$ZFSQUERY| grep '^$zfs\@' | head -1", 120);
return "BAD(no snapshot of $zfs)" if not $recentsnap;
$ZFSQUERY="/usr/sbin/zfs get -H -p -ovalue creation $recentsnap";
while (`pgrep -f "^$ZFSQUERY"`) {
......@@ -27,17 +28,17 @@ sub handler {
sleep(1);
}
else {
return "BAD ($ZFSQUERY hanged)";
return "BAD($ZFSQUERY hanged)";
}
}
my $snaptime = cache_command($ZFSQUERY, 300);
my $snaptime = cache_command($ZFSQUERY, 120);
my $snapage=time()-$snaptime;
if($snapage < $age) {
return "OK($snapage < $age)";
}elsif ($snapage >= $age){
return "BAD($snapage >= $age)";
}
return "BAD(for snapshot $recentsnap we have unexpected creation $snaptime)";
return "BAD($snaptime: for snapshot $recentsnap we have unexpected creation)";
};
1;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment