diff --git a/site-modules/profile/manifests/dar/client.pp b/site-modules/profile/manifests/dar/client.pp index 49ba129e..faccd9c9 100644 --- a/site-modules/profile/manifests/dar/client.pp +++ b/site-modules/profile/manifests/dar/client.pp @@ -1,29 +1,47 @@ class profile::dar::client { include ::dar $dar_remote_hostname = $::swh_hostname['short'] $dar_backup_name = $::hostname $backup_cron = profile::cron_rand(lookup('dar::cron', Hash), 'backup') dar::backup { $dar_backup_name: backup_storage => lookup('dar::backup::storage'), keep_backups => lookup('dar::backup::num_backups'), backup_base => lookup('dar::backup::base'), backup_selection => lookup('dar::backup::select'), backup_exclusion => lookup('dar::backup::exclude', Array, 'unique'), backup_options => lookup('dar::backup::options'), * => $backup_cron, } $server_cron = profile::cron_rand(lookup('dar_server::cron', Hash), 'backup_server') + $dir_for_fetched_backups = lookup('dar_server::backup::storage') # Export a remote backup to the backup server @@dar::remote_backup { "${dar_remote_hostname}.${dar_backup_name}": remote_backup_storage => lookup('dar::backup::storage'), remote_backup_host => $dar_remote_hostname, remote_backup_name => $dar_backup_name, - local_backup_storage => lookup('dar_server::backup::storage'), + local_backup_storage => $dir_for_fetched_backups, * => $server_cron, } + + # Export an icinga check to verify backup freshness + $icinga_checks_file = '/etc/icinga2/conf.d/exported-checks.conf' + $checked_directory = "${dir_for_fetched_backups}/${dar_remote_hostname}" + + @@::icinga2::object::service {"backup freshness for ${dar_remote_hostname}": + service_name => 'backup freshness', + import => ['generic-service'], + host_name => $::fqdn, + command_endpoint => 'louvre.softwareheritage.org', + check_command => 'check_newest_file_age', + vars => { + check_directory => $checked_directory, + }, + target => $icinga_checks_file, + tag => 'icinga2::exported', + } }