For the number of days since the last backup of a single database:
Step 1
Create a new stored procedure using the following code
CREATE PROCEDURE [dbo].[spLastBackup]
@DatabaseName nvarchar(50)
AS
BEGIN
SELECT DATEDIFF(d, MAX(b.backup_finish_date), getdate())
FROM sys.sysdatabases s
LEFT OUTER JOIN msdb.dbo.backupset b
ON b.database_name = s.name
WHERE s.Name = @DatabaseName
END
Step 2
Add a new MSQL sensor
On your PRTG server, add a new MSQL sensor. Fill in the required fields and in the "SQL Expression" field enter
exec dbo.spLastBackup YOUR_DATABASE_NAME
In the channels tab select the value channel and enter Day as unit.
For the number of days since the last backup of all your databases:
Step 1
Create a new stored procedure using the following code
CREATE PROCEDURE [dbo].[spLastBackups]
AS
BEGIN
SELECT
s.name AS Channel
,DATEDIFF(d, MAX(b.backup_finish_date), getdate()) as Value
,1 as IsInt
,'Days' as Unit
FROM sys.sysdatabases s
LEFT OUTER JOIN msdb.dbo.backupset b
ON b.database_name = s.name
GROUP BT s.name
END
Step 2
Add a new Custom XML sensor
On your PRTG server, add the Custom XML sensor SQLspXML to be downloaded from the Google Code Project
Fill in the required parameters in the parameter section of the sensor.
This sensor will produce multiple channels, one for every database on your server
Add comment