Permalink
Browse files

made time units case insensitive and removed monthlies

  • Loading branch information...
phreaker0 committed Dec 18, 2018
1 parent f1f3141 commit ac80a753157dc26005c976675336f1e3fe3e1ad9
Showing with 10 additions and 12 deletions.
  1. +6 −9 sanoid
  2. +4 −3 sanoid.defaults.conf
15 sanoid
@@ -1519,25 +1519,22 @@ sub convertTimePeriod {
my $value=shift;
my $period=shift;
if ($value =~ /^\d+Y$/) {
if ($value =~ /^\d+[yY]$/) {
$period = 60*60*24*31*365;
chop $value;
} elsif ($value =~ /^\d+M$/) {
$period = 60*60*24*31;
chop $value;
} elsif ($value =~ /^\d+W$/) {
} elsif ($value =~ /^\d+[wW]$/) {
$period = 60*60*24*7;
chop $value;
} elsif ($value =~ /^\d+D$/) {
} elsif ($value =~ /^\d+[dD]$/) {
$period = 60*60*24;
chop $value;
} elsif ($value =~ /^\d+h$/) {
} elsif ($value =~ /^\d+[hH]$/) {
$period = 60*60;
chop $value;
} elsif ($value =~ /^\d+m$/) {
} elsif ($value =~ /^\d+[mM]$/) {
$period = 60;
chop $value;
} elsif ($value =~ /^\d+s$/) {
} elsif ($value =~ /^\d+[sS]$/) {
$period = 1;
chop $value;
} elsif ($value =~ /^\d+$/) {
@@ -84,7 +84,8 @@ yearly_min = 0
# example hourly_warn = 90 means issue WARNING if most recent hourly snapshot is not less than 90 minutes old,
# daily_crit = 36 means issue CRITICAL if most recent daily snapshot is not less than 36 hours old,
# monthly_warn = 5 means issue WARNING if most recent monthly snapshot is not less than 5 weeks old... etc.
# the following time suffixes can also be used: Y = years, M = months, W = weeks, D = days, h = hours, m = minutes, s = seconds
# the following time case insensitive suffixes can also be used:
# y = years, w = weeks, d = days, h = hours, m = minutes, s = seconds
#
# monitor_dont_warn = yes will cause the monitoring service to report warnings as text, but with status OK.
# monitor_dont_crit = yes will cause the monitoring service to report criticals as text, but with status OK.
@@ -101,8 +102,8 @@ daily_warn = 28h
daily_crit = 32h
weekly_warn = 0
weekly_crit = 0
monthly_warn = 32D
monthly_crit = 40D
monthly_warn = 32d
monthly_crit = 40d
yearly_warn = 0
yearly_crit = 0

0 comments on commit ac80a75

Please sign in to comment.