Debian Codegraph @

doc/user-guide/05-integration.adoc

raw
1 = Integration
2
3 == Monitoring your disk layout with Relax-and-Recover (ReaR)
4
5 A crucial part to properly recreate the system is the disk layout,
6 i.e. the disk partitioning with filesystems and mount points.
7
8 When you use "rear mkbackup" to create the ReaR rescue/recovery system
9 together with a backup of all files and directories of your system
10 at the same time, you have both parts (recovery system and backup) in sync
11 which is a prerequirement to properly recreate the system with "rear recover".
12
13 But when you use "rear mkrescue" to create the ReaR rescue/recovery system
14 and call "rear mkbackuponly" separately to create the backup
15 or you call a third party backup tool separately,
16 you may not have both parts (recovery system and backup) in sync
17 so "rear recover" may not properly recreate the system
18 or it may even completely fail to do it.
19
20 In particular when the disk layout had changed the ReaR rescue/recovery system
21 must be created anew.
22
23 Caution:
24 There are zillions of other ways how the latest created ReaR rescue/recovery system
25 could become outdated or even invalid/useless in general.
26 Each change of the basic system setup (like disk layout, network environment,...) and
27 each change of a software that is used by ReaR (like 'parted', 'mkfs', 'tar',...) and
28 of course also each ReaR version upgrade requires that the ReaR rescue/recovery system
29 gets created anew together with a matching up-to-date backup as prerequirement
30 so that "rear recover" is able to properly recreate the current system.
31 Furthermore after such changes you must carefully and completely re-validate
32 that "rear recover" still works in your particular case/environment.
33
34 The disk layout information is stored in var/lib/rear/layout/disklayout.conf
35
36 ReaR provides two specific workflows regarding the disk layout:
37
38 === Saving the current disk layout of the system
39
40 ReaR automatically saves the current disk layout of the system
41 when it creates a new ReaR rescue/recovery system.
42 However if you want to only save the current disk layout manually,
43 use "rear savelayout" (this does not update the recovery system).
44
45 === Checking if the disk layout has changed
46
47 When you want to know if the current disk layout of the system
48 has changed compared to the latest saved disk layout,
49 use "rear checklayout".
50 If the disk layout has changed, "rear checklayout" results a non-zero return code
51 so you could use something like
52 ----
53 # rear checklayout || rear mkrescue
54 ----
55 to create a new ReaR recovery system when the disk layout has changed.
56
57 == Integration with Nagios and Opsview
58
59 If having current DR rescue images is important to your organization, but they
60 cannot be automated (eg. a tape or USB device needs inserting), we provide a
61 Nagios plugin that can send out a notification whenever there is a critical
62 change to the system that requires updating your rescue environment.
63
64 Changes to the system requiring an update are:
65
66 - Changes to hardware RAID
67 - Changes to software RAID
68 - Changes to partitioning
69 - Changes to DRBD configuration
70 - Changes to LVM
71 - Changes to filesystems
72
73 The integration is done using our own _check_rear_ plugin for Nagios.
74
75 [source,bash]
76 ----
77 #!/bin/bash
78 #
79 # Purpose: Checks if disaster recovery usb stick is up to date
80
81 # Check if ReaR is installed
82 if [[ ! -x /usr/sbin/rear ]]; then
83 echo "REAR IS NOT INSTALLED"
84 exit 2
85 fi
86
87 # ReaR disk layout status can be identical or changed
88 # returncode: 0 = ok
89 if ! /usr/sbin/rear checklayout; then
90 echo "Disk layout has changed. Please insert Disaster Recovery USB stick into system !"
91 exit 2
92 fi
93 ----
94
95 We also monitor the _/var/log/rear/rear-system.log_ file for +ERROR:+ and +BUG+
96 strings, so that in case of problems the operator is notified immediately.
97
98 Note that error messages may not come from ReaR itself but from programs that are called by ReaR
99 because stdout and stderr are redirected into ReaR's log file (see the section
100 "What to do with stdin, stdout, and stderr" in https://github.com/rear/rear/wiki/Coding-Style)
101 so in case of error messages one must check if that is actually an error or only false alarm.