The logic of the databases collection for remote backups is as follows.
Find out if the other instance is monitored1). The agent determines
- if the instance is mirrored (databases/is_mirrored=1) or has log shipping (databases/is_log_shipping=1) configured
- and the current databases/last_backup_time is NULL
2) If these are both true,
- then the agent confirms that an agent is monitoring the instance specified on databases/hadr_location.
3). If #1 or #2 is false,
- last_backup_time should be "Unknown" and a tooltip will indicate that "Database has a mirror configured for log shipping but there is no Foglight agent that monitors the partner instance. Click on the hadr_location instance to add the agent"
Collect the backup information from the other instance and display it on the screen4). If the database is mirrored or has log_shipping then,
- check the topology of the hadr_location for the last_backup_date and provide this in "Remote Last Backup Date" column.
- If there is no backup, display "no backup found"
5). If the database is always_on (
databases\is_always_on=1) and the
last_backup_date is null and
is_preferred_replica_for_backup = 0 then
- specify the backup date as "No preferred replica"
- when the database is_always_on, the location should be the hadr_location which is the availability group name.