diff options
author | Antoine Beaupré <anarcat@koumbit.org> | 2015-04-17 17:31:19 -0400 |
---|---|---|
committer | Antoine Beaupré <anarcat@koumbit.org> | 2015-04-17 17:31:19 -0400 |
commit | 795769c39b21be36235b1cc86a17b104ce4afdff (patch) | |
tree | 60ce685a2da540cd33dfde8e05654d00eeffb968 | |
parent | b1ad64a1bc8bd867f327f9f6563665d855f6bb89 (diff) | |
download | puppet-backupninja-795769c39b21be36235b1cc86a17b104ce4afdff.tar.gz puppet-backupninja-795769c39b21be36235b1cc86a17b104ce4afdff.tar.bz2 |
show time delay in hours
-rwxr-xr-x | files/checkbackups.pl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/files/checkbackups.pl b/files/checkbackups.pl index 82387ea..f617297 100755 --- a/files/checkbackups.pl +++ b/files/checkbackups.pl @@ -82,7 +82,7 @@ sub check_rdiff { else { $service = 'backups'; } - print_status($host, $state, "$delta seconds old$extra_msg", $service); + print_status($host, $state, "$delta hours old$extra_msg", $service); foreach my $vserver_dir (@vserver_dirs) { $vsdir = "$dir/$vserver_dir"; if (opendir(DIR, $vsdir)) { @@ -96,7 +96,7 @@ sub check_rdiff { my @dom_sufx = split(/\./, $host); my $dom_sufx = join('.', @dom_sufx[1,-1]); foreach my $vserver (@vservers) { - print_status("$vserver.$dom_sufx", $state, "$delta seconds old$extra_msg, same as parent: $host"); + print_status("$vserver.$dom_sufx", $state, "$delta hours old$extra_msg, same as parent: $host"); } } @@ -111,6 +111,7 @@ sub check_age { } elsif ($delta >= 0) { $state = $STATE_OK; } + $delta = sprintf '%.2f', $delta/3600.0; return ($state, $delta); } @@ -130,7 +131,7 @@ sub check_flag { } else { ($state, $delta) = check_age($stats[9]); - print_status($host, $state, "$delta seconds old"); + print_status($host, $state, "$delta hours old"); } } |