I'm pretty sure I read in some release notes, that there is a new sensor for monitoring windows backups. Searching the KB, I see some posts regarding various methods, but most of these are late 2011.
What's the current best way to do this? Note I'm looking for monitoring and email alerts of the NATIVE Windows Backup system - not a 3rd party tool.
Thanks! :-D
Article Comments
Thanks Dirk - so this is basically no good for Windows Backup, as it doesn't have any native email reporting?
Unless there's a way to convert an event log entry into an email?
Sorry I am new to PRTG :)
Thanks again,
Matt
Jun, 2012 - Permalink
The new sensor can only work with emails, sorry. You could use the Event Log sensor to watch for "failed" events of Windows Backup, I assume.
Jun, 2012 - Permalink
Hi There
I have written a PowerShell script which you can use for the extended script sensor. You only need to specify the '%host' variable in the sensor settings. The sensor extracts the backup events and the time since last backup has run. The script is tested on a Windows Server 2012R2 using the built-in backup tool.
param([string]$hostname = "N/A") Invoke-Command -ComputerName $hostname{ $today=(Get-Date) $dateshift=(Get-Date).AddHours(-24) $EventError=Get-WinEvent -LogName Microsoft-Windows-Backup| Where-Object {$_.TimeCreated -gt $dateshift} | Where-Object {$_.LevelDisplayName -eq "Error"} $EventWarning=Get-WinEvent -LogName Microsoft-Windows-Backup| Where-Object {$_.TimeCreated -gt $dateshift} | Where-Object {$_.LevelDisplayName -eq "Warning"} $EventOK=Get-WinEvent -LogName Microsoft-Windows-Backup| Where-Object {$_.TimeCreated -gt $dateshift} | Where-Object {$_.LevelDisplayName -eq "Information"} $backupsets=Get-WBBackupSet $lastbackup=(Get-Date)-($backupsets.BackupTime |Measure-Object -Maximum |Select-Object -ExpandProperty Maximum) $lastbkround=[math]::Floor($lastbackup.TotalHours) Write-Host '<?xml version="1.0" encoding="Windows-1252" ?>' Write-Host '<prtg>' Write-Host '<result>' Write-Host '<channel>Error Events</channel>' Write-Host '<value>'$EventError.Count'</value>' Write-Host '</result>' Write-Host '<result>' Write-Host '<channel>Warning Events</channel>' Write-Host '<value>'$EventWarning.Count'</value>' Write-Host '</result>' Write-Host '<result>' Write-Host '<channel>Information Events</channel>' Write-Host '<value>'$EventOK.Count'</value>' Write-Host '</result>' Write-Host '<result>' Write-Host '<channel>Hours Since Last Backup</channel>' Write-Host '<value>'$lastbkround'</value>' Write-Host '</result>' Write-Host '</prtg>'
Jun, 2016 - Permalink
Hello Liceo, thank you for sharing your script!
Best Regards,
Luciano Lingnau [Paessler Support]
Jun, 2016 - Permalink
Hi Liceo, is your script missing a "}" somewhere? I'm getting an error executing it manually.
Also, do you run it in the default security context?
Aug, 2016 - Permalink
You could also try Heath Trengove's powershell sensor from GitHub: https://github.com/htrengove/PRTGwindowsbackup/
Thanks, Heath!
Nov, 2016 - Permalink
Hi Liceo,
I am trying your powershell script and i have an issue with it.
If i run the script in an 64 powershell box the "Get-WBBackupSet" works fine
But if i run the script in an 32 bit powershell box the "Get-WBBackupSet" CMDlet is not recognized.
PRTG is calling a 32bit version of powershell and thus the "Get-WBBackupSet" CMDlet is not working.
How can i fix this?
Jul, 2020 - Permalink
Hi there,
I cannot help you by fix the custom script, however, you can try the tool "PSx64" from the PRTG Tools Family to execute your script in 64bit mode: http://prtgtoolsfamily.com/downloads/sensors
Jul, 2020 - Permalink
This is done via the newly implemented "Process Email Content" option of the IMAP sensor.
Please have a look at IMAP sensor manual page.
Jun, 2012 - Permalink