teqqy
(Christian)
October 15, 2024, 8:29am
1
Hello,
we had some database migrations in the last weeks and the Invoke-IcingaCheckMSSQLBackupStatus still shows the old databases as missing backups.
I’ve tried to clear the cache on the MSSQL Server, but that does not work.
Is this an icinga2 issue or does this information comes from the MSSQL server itself? Becase the dbs are not available anymore.
Thanks.
If it helps here is the current query of the check:
<#
.SYNOPSIS
Checks overall Backupstatus metrics inside the MSSQL database by fetching
metrics and compares them to input thresholds
.DESCRIPTION
Checks overall Backupstatus metrics inside the MSSQL database by fetching
metrics and compares them to input thresholds
More Information on https://github.com/Icinga/icinga-powershell-mssql
.FUNCTIONALITY
Checks overall Backupstatus metrics inside the MSSQL database by fetching
metrics and compares them to input thresholds
.EXAMPLE
PS> Get-IcingaMSSQLBackupOverallStatus -SqlUsername 'username' -SqlPassword (ConvertTo-IcingaSecureString 'password') -SqlHost 'example.com';
[OK] Check package "MSSQL Backup"
| 'status'=0;6;5 'size'=10110976b;; 'execution_time'=0s;; 'age'=144000s;; 'average_size'=3370325.333333b;; 'status'=0;6;5 'size'=12664832b;;
'execution_time'=0s;; 'age'=493200s;; 'average_size'=6332416b;; 'status'=0;6;5 'size'=33445888b;; 'execution_time'=0s;; 'age'=144000s;; 'average_size'=16722944b;;
.EXAMPLE
PS>Get-IcingaMSSQLBackupOverallStatus -IntegratedSecurity -SqlHost 'example.com' -IncludeDatabase 'ExampleDatabase','AnotherDatabase';
[OK] Check package "MSSQL Backup"
| 'status'=0;6;5 'size'=12664832b;; 'execution_time'=0s;; 'age'=493200s;; 'average_size'=6332416b;; 'status'=0;6;5 'size'=10110976b;;
This file has been truncated. show original
SELECT
msdb.dbo.backupset.database_name,
msdb.dbo.backupset.backup_start_date,
msdb.dbo.backupset.backup_finish_date,
msdb.dbo.backupset.is_damaged,
msdb.dbo.backupset.type,
msdb.dbo.backupset.backup_size,
msdb.dbo.backupset.backup_set_uuid,
msdb.dbo.backupmediafamily.physical_device_name,
msdb.dbo.backupmediafamily.device_type,
sys.databases.state,
sys.databases.recovery_model,
DATEDIFF(MI, msdb.dbo.backupset.backup_finish_date, GETDATE()) AS last_backup_minutes,
DATEDIFF(MI, msdb.dbo.backupset.backup_start_date, msdb.dbo.backupset.backup_finish_date) AS last_backup_duration_min
FROM msdb.dbo.backupmediafamily
INNER JOIN msdb.dbo.backupset ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id
LEFT JOIN sys.databases ON sys.databases.name = msdb.dbo.backupset.database_name
WHERE sys.databases.source_database_id IS NULL
teqqy
(Christian)
October 15, 2024, 11:35am
3
Thanks. Due to the quite big history i changed the “IncludeDays” Variable of the check to my needs. That solves the issue.