added monitor-version back in

This commit is contained in:
Jim Salter 2015-02-27 17:08:24 -05:00
parent fb7e68e686
commit ebc1602402
1 changed files with 15 additions and 0 deletions

15
sanoid
View File

@ -43,6 +43,9 @@ if ($ARGV[0] eq '--verbose') {
} elsif ($ARGV[0] eq '--version') {
print "Sanoid version: $version\n";
exit 0;
} elsif ($ARGV[0] eq '--monitor-version') {
monitor_version();
exit 0;
} elsif ($ARGV[0] eq '--cron' || 1) {
take_snapshots (@params);
prune_snapshots (@params);
@ -55,6 +58,18 @@ exit 0;
####################################################################################
####################################################################################
sub monitor_version() {
my $trunkversion = get("https://raw.githubusercontent.com/jimsalterjrs/sanoid/master/VERSION");
chomp $trunkversion;
if ($version eq $trunkversion) {
print "OK: local version $version matches trunk version $trunkversion\n";
exit 0;
} else {
print "WARN: local version $version does not match trunk version $trunkversion\n";
exit 1;
}
}
sub monitor_health() {
my ($config, $snaps, $snapsbytype, $snapsbypath) = @_;
my %pools;