Skip to main content
Dave Mason - Mastodon Dave Mason - LinkedIn Dave Mason - GitHub Dave Mason - Counter Social

SQL Server Extended Event Handling via GUI

Dave Mason - SQL Server Event Handling: Extended Events

In some previous posts, I looked at handling Extended Events by accessing the event stream programatically. One example was a C# console app, the other was a PowerShell script. While I like both options, sometimes you just want a GUI. So I decided to create one. I made the code available on GitHub. There's also a compiled exe available for download.


Getting Started

Here's what you see when you first open the app:

Dave Mason SQL Server Extended Event Handling Via GUI

Click File | Connect to SQL : this opens a dialog window that lets you specify the SQL instance you want to connect to. After entering connectivity info, click OK to return to the main form where you'll now see the SQL connectivity info displayed on the tool strip at the bottom of the form.

Dave Mason SQL Server Extended Event Handling Via GUI
Dave Mason SQL Server Extended Event Handling Via GUI

Click the Session button: this opens a dialog window that shows existing XEvent sessions on the SQL instance. (Sessions that are not started are highlighted.)

Dave Mason SQL Server Extended Event Handling Via GUI

Select Session Events: the events selected for capture by the session will be listed in the "Events Handled" section. Select the ones you want to handle (you must pick at least one).

Dave Mason SQL Server Extended Event Handling Via GUI

Event Responses: when an event is handled, specify how you want to respond to it. In the "Event Responses" section, there are two options: play a system sound or send email (you must choose at least one option). Pick the system sound desired and/or enter an email address.

Dave Mason SQL Server Extended Event Handling Via GUI

Lastly, click the Start button. Here's a video that demonstrates. I'll pick an XEvent session that is configured to capture error_reported and page_split events. I'll deselect the error_reported event--I don't want to respond to that one. For event responses, both "Play a System Sound" and "Send Email" will be configured. I'll click Start, then run some SQL statements to generate some page_split events. Take it away, YouTube...




Bugs and Deficiencies

Software development is hard. You have to think of everything. I'm quite certain I did not. It's inevitable others will find numerous ways to use the software that I never thought of. With that in mind, there's a few shortcomings I'm aware of:

  • SQL Permissions: this app might work with a login having something less than [sysadmin] role membership. If you use a login without it, you may have some issues. I only tested as [sysadmin]. But you know what? This is an app for DBAs. And you have to provide login credentials every time you use the app. I'm ok with this.
  • The "Send Email" event response option uses msdb.dbo.sp_send_dbmail. I have blindly assumed the instance you connect to has database mail configured.
  • The code for the app uses the event_stream target for XEvents, which is always "one event behind".
  • Comments

    Post comment