Deadlocks event collector


Job details

Name: Deadlocks event collector
Platform: Sqlserver
Category: Availability
Description: Collects deadlocks event statistics from Microsoft SQL Server Extended Event Log files. If configured a warning or an alarm can be triggered when a deadlock is detected.
Long description: SQL Server Extended Events has a configurable architecture that allows to collect information to troubleshoot or identify a
Version: 2
Default schedule: 0 * * *
Requires engine install: Yes
Compatibility tag: .[type=‘instance’ & databasetype=‘sqlserver’]/.[maj_version > ‘2012′ & hasengine=‘YES’ & engine_edition = ‘Microsoft SQL Server’]

Parameters

Name Default value Description
history threshold 180 The number of days before the history record will be removed from the history table.
return status 0 Return status value (ALARM – 2, WARNING – 1, or OK – 0) when a deadlock is detected.
target c:\tmp Path value where the target file will be created.

Job Summary

SELECT * FROM sys.system_health WHERE event_type = 'error' AND state = 'locked'

Dependencies and Implementations

** Stored Procedures and Tables: This includes procedures to create an event session, to load deadlock events from the SQL Server Extended Events (XEL) files, and staging tables to store the data temporarily for processing.
** Cleanup settings: It ensures that any failed dependency operations trigger a cleanup, maintaining the hygiene of the system.

** The job uses SQL Event Sessions to capture deadlock events into XEL files.
** These events are then periodically polled by the specified stored procedures, parsed, and their data is stored in the reporting tables.

Monitoring and Reporting Features

Reporting Presentations and Data Insights

** A list of recent deadlock events along with detailed statistics about each involved process.
** Information about server sessions, including startup states and configurations.
** Status of the procedure execution, which has implications on event detection and collection latency.

Usage and Application

In conclusion, this dbWatch job is an essential tool in a DBA‘s arsenal to ensure that deadlock-related performance issues are promptly identified and resolved, thus maintaining optimal performance and stability of the SQL Server databases.