FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 7563b636 authored by Dr Adam Thorn's avatar Dr Adam Thorn
Browse files

report which backup tasks are missing in the xymon report

parent 5fbb64c2
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,6 @@ Priority: optional
Section: otherosfs
Maintainer: Chemistry COs <support@ch.cam.ac.uk>
Architecture: all
Version: 0.9-ch101
Version: 0.9-ch102
Depends: zfs-dkms, postgresql-13 | postgresql-9.5 | postgresql-9.4 , liblockfile-simple-perl, libdbi-perl, libjson-perl, libzfs-perl-chem, libnet-openssh-perl, libdbd-pg-perl, mbuffer, rsync, nfs-kernel-server, pv, libwww-curl-perl, libformat-human-bytes-perl
Description: a backup system using ZFS (repository 'backup-scheduler')
......@@ -57,6 +57,11 @@ my $stj=$dbh->prepare($sqlc);
my $backuptask_count_query = "select count(backup_task_id) from backup_task natural join host where hostname=?";
my $backtask_count=$dbh->prepare($backuptask_count_query);
# if a task has never completed, it will be missing from hobbit_view. We identify this via a full join
# on the view and look for a null field.
my $missing_tasks_query = "select backup_task_id, backup_task.backup_task_name from backup_task natural join host full join hobbit_view using (backup_task_id) where host.hostname=? and hobbit_view.backup_task_name is null";
my $missing_tasks = $dbh->prepare($missing_tasks_query);
foreach my $hr (@{$all}) {
my $hostname=$hr->[0];
print "Considering $hostname\n";
......@@ -209,6 +214,11 @@ foreach my $hr (@{$all}) {
if($rows_for_this_host != $required_rows_for_this_host) {
my $msg = "$rows_for_this_host results logged for host but $required_rows_for_this_host backup tasks are configured. Check backup_log table: maybe there has not yet been a succesful backup?\n";
$bb->color_line('red', $msg);
$missing_tasks->execute($hostname);
while(my $missing_task = $missing_tasks->fetchrow_hashref) {
$bb->color_line('red', "missing backup for task id " . $missing_task->{'backup_task_id'} . " (" . $missing_task->{'backup_task_name'} . ")\n");
}
}
$bb->send;
}
......
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