Skip to content

Commit

Permalink
Merge pull request #48 from Icinga:feature/reduce_mssql_backup_interv…
Browse files Browse the repository at this point in the history
…al_age_from_hours_to_minutes

Feature: Improves MSSQL backup granularity

Improves MSSQL backup plugin by fetching backups more granular by minutes now instead of hours
  • Loading branch information
LordHepipud authored Aug 27, 2022
2 parents 69979ee + e40f9eb commit 3df0613
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions doc/31-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [42](https://github.com/Icinga/icinga-powershell-mssql/pull/42) Adds option for `IncludeDays` to reduce the amount of backup data generated [ronnybremer]
* [46](https://github.com/Icinga/icinga-powershell-mssql/pull/46) Updates configuration and dependencies for Icinga for Windows v1.10.0
* [47](https://github.com/Icinga/icinga-powershell-mssql/pull/47) Adds new performance data handling for Icinga for Windows v1.10.0 and provides basic Grafana dashboards and Icinga Web integration
* [48](https://github.com/Icinga/icinga-powershell-mssql/pull/48) Improves MSSQL backup plugin by fetching backups more granular by minutes now instead of hours

## 1.3.0 (2022-05-03)

Expand Down
10 changes: 5 additions & 5 deletions provider/mssql/Get-IcingaMSSQLBackupOverallStatus.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
.NOTES
#>

function Get-IcingaMSSQLBackupOverallStatus
function Get-IcingaMSSQLBackupOverallStatus
{
param (
$SqlConnection = $null,
Expand All @@ -78,12 +78,12 @@
msdb.dbo.backupset.is_damaged,
msdb.dbo.backupset.type,
msdb.dbo.backupset.backup_size,
msdb.dbo.backupset.backup_set_uuid,
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(HH, msdb.dbo.backupset.backup_finish_date, GETDATE()) AS last_backup_hours,
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
Expand Down Expand Up @@ -128,7 +128,7 @@
}

if ($Entry.type -eq 'L') {
$LastBackupLogAge = ($Entry.last_backup_hours * 60 * 60)
$LastBackupLogAge = ($Entry.last_backup_minutes * 60)
} else {
$LastBackupLogAge = 0;
}
Expand All @@ -144,7 +144,7 @@
'IsDamaged' = $Entry.is_damaged;
'Type' = $Entry.type;
'LastBackupLogAge' = [long]$LastBackupLogAge;
'LastBackupAge' = (([long]$Entry.last_backup_hours) * 60 * 60);
'LastBackupAge' = (([long]$Entry.last_backup_minutes) * 60);
'ExecutionTime' = (([long]$Entry.last_backup_duration_min) * 60);
'Location' = $Entry.physical_device_name;
'Drive' = $BackupDrive;
Expand Down

0 comments on commit 3df0613

Please sign in to comment.