Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Documentation/sp_Blitz_Checks_by_Priority.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Before adding a new check, make sure to add a Github issue for it first, and hav

If you want to change anything about a check - the priority, finding, URL, or ID - open a Github issue first. The relevant scripts have to be updated too.

CURRENT HIGH CHECKID: 267.
If you want to add a new one, start at 268.
CURRENT HIGH CHECKID: 268.
If you want to add a new one, start at 269.

| Priority | FindingsGroup | Finding | URL | CheckID |
|----------|-----------------------------|---------------------------------------------------------|------------------------------------------------------------------------|----------|
Expand All @@ -32,6 +32,7 @@ If you want to add a new one, start at 268.
| 1 | Security | Dangerous Service Account | https://vladdba.com/SQLServerSvcAccount | 259 |
| 1 | Security | Dangerous Service Account | https://vladdba.com/SQLServerSvcAccount | 260 |
| 1 | Security | Dangerous Service Account | https://vladdba.com/SQLServerSvcAccount | 261 |
| 5 | Availability | AG Replica Falling Behind | https://www.BrentOzar.com/go/ag | 268 |
| 5 | Monitoring | Disabled Internal Monitoring Features | https://msdn.microsoft.com/en-us/library/ms190737.aspx | 177 |
| 5 | Reliability | Dangerous Third Party Modules | https://support.microsoft.com/en-us/kb/2033238 | 179 |
| 5 | Reliability | Priority Boost Enabled | https://www.BrentOzar.com/go/priorityboost | 126 |
Expand Down
39 changes: 39 additions & 0 deletions sp_Blitz.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6706,6 +6706,45 @@ IF @ProductVersionMajor >= 10



IF NOT EXISTS ( SELECT 1
FROM #SkipChecks
WHERE DatabaseName IS NULL AND CheckID = 268 )
BEGIN

IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 268) WITH NOWAIT;

INSERT INTO #BlitzResults
( CheckID ,
Priority ,
DatabaseName ,
FindingsGroup ,
Finding ,
URL ,
Details
)
SELECT 268 AS CheckID,
5 AS Priority,
DB_NAME(ps.database_id),
'Availability' AS FindingsGroup,
'AG Replica Falling Behind' AS Finding,
'https://www.BrentOzar.com/go/ag' AS URL,
ag.name + N' AG replica server ' +
ar.replica_server_name + N' is ' +
CASE WHEN DATEDIFF(SECOND, drs.last_commit_time, ps.last_commit_time) < 200 THEN (CAST(DATEDIFF(SECOND, drs.last_commit_time, ps.last_commit_time) AS NVARCHAR(10)) + N' seconds ')
ELSE (CAST(DATEDIFF(MINUTE, drs.last_commit_time, ps.last_commit_time) AS NVARCHAR(10)) + N' minutes ') END
+ N' behind the primary.'
AS details
FROM sys.dm_hadr_database_replica_states AS drs
JOIN sys.availability_replicas AS ar ON drs.replica_id = ar.replica_id
JOIN sys.availability_groups AS ag ON ar.group_id = ag.group_id
JOIN sys.dm_hadr_database_replica_states AS ps
ON drs.group_id = ps.group_id
AND drs.database_id = ps.database_id
AND ps.is_local = 1 /* Primary */
WHERE drs.is_local = 0 /* Secondary */
AND DATEDIFF(SECOND, drs.last_commit_time, ps.last_commit_time) > 60;
END;


IF @CheckUserDatabaseObjects = 1
BEGIN
Expand Down
Loading