made time units case insensitive and removed monthlies

This commit is contained in:
Christoph Klaffl 2018-12-19 00:36:10 +01:00
parent f1f31412af
commit ac80a75315
No known key found for this signature in database
GPG Key ID: FC1C525C2A47CC28
2 changed files with 10 additions and 12 deletions

15
sanoid
View File

@ -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+$/) {

View File

@ -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