├── .gitignore ├── .vscodeignore ├── LICENSE ├── README.md └── archive ├── Build.ps1 ├── Build ├── alwayson-insights-0.2.0.vsix ├── mssql-database-insights-0.1.0.vsix └── mssql-instance-insights-0.1.0.vsix ├── CHANGELOG.md ├── Install.ps1 ├── README.md ├── alwayson-insights ├── README.md ├── package.json └── sql │ ├── alwayson-ag-db-health-detail.sql │ ├── alwayson-ag-db-rpo-rto.sql │ ├── alwayson-ag-db-sync.sql │ ├── alwayson-ag-replica-health-detail.sql │ └── alwayson-ag-replica-health.sql ├── docs └── images │ ├── alwayson-insights │ ├── ag-db-rpo-rto-insight-details.png │ ├── ag-db-rpo-rto-insight.png │ ├── ag-db-sync-insight-details.png │ ├── ag-db-sync-insight.png │ ├── ag-replica-health-insight-details.png │ └── ag-replica-health-insight.png │ ├── database-dashboard.png │ ├── database-dashboard1.png │ ├── database-dashboard2.png │ ├── install-prompts.png │ ├── install-upgradeprompt.png │ ├── install-verbose.png │ ├── mssql-database-insights │ ├── mssql-db-spaceused-details.png │ ├── mssql-db-spaceused-filetype.png │ └── mssql-db-spaceused.png │ ├── mssql-instance-insights │ ├── mssql-instance-waits-details.png │ ├── mssql-instance-waits.png │ ├── mssql-instance-xelio-details.png │ ├── mssql-instance-xelio.png │ ├── mssql-instance-xelio2.png │ ├── mssql-instance-xelmemory-details.png │ ├── mssql-instance-xelmemory.png │ ├── mssql-instance-xelsystem-details.png │ └── mssql-instance-xelsystem.png │ ├── server-dashboard.png │ └── show-detail.png ├── mssql-database-insights ├── README.md ├── package.json └── sql │ ├── mssql-db-spaceused-detail.sql │ ├── mssql-db-spaceused-filetype.sql │ └── mssql-db-spaceused.sql └── mssql-instance-insights ├── README.md ├── package.json └── sql ├── mssql-instance-waits-detail.sql ├── mssql-instance-waits.sql ├── mssql-instance-xelio.sql ├── mssql-instance-xelmemory.sql └── mssql-instance-xelsystem.sql /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # MSTest test Results 33 | [Tt]est[Rr]esult*/ 34 | [Bb]uild[Ll]og.* 35 | 36 | # NUNIT 37 | *.VisualState.xml 38 | TestResult.xml 39 | 40 | # Build Results of an ATL Project 41 | [Dd]ebugPS/ 42 | [Rr]eleasePS/ 43 | dlldata.c 44 | 45 | # .NET Core 46 | project.lock.json 47 | project.fragment.lock.json 48 | artifacts/ 49 | **/Properties/launchSettings.json 50 | 51 | *_i.c 52 | *_p.c 53 | *_i.h 54 | *.ilk 55 | *.meta 56 | *.obj 57 | *.pch 58 | *.pdb 59 | *.pgc 60 | *.pgd 61 | *.rsp 62 | *.sbr 63 | *.tlb 64 | *.tli 65 | *.tlh 66 | *.tmp 67 | *.tmp_proj 68 | *.log 69 | *.vspscc 70 | *.vssscc 71 | .builds 72 | *.pidb 73 | *.svclog 74 | *.scc 75 | 76 | # Chutzpah Test files 77 | _Chutzpah* 78 | 79 | # Visual C++ cache files 80 | ipch/ 81 | *.aps 82 | *.ncb 83 | *.opendb 84 | *.opensdf 85 | *.sdf 86 | *.cachefile 87 | *.VC.db 88 | *.VC.VC.opendb 89 | 90 | # Visual Studio profiler 91 | *.psess 92 | *.vsp 93 | *.vspx 94 | *.sap 95 | 96 | # TFS 2012 Local Workspace 97 | $tf/ 98 | 99 | # Guidance Automation Toolkit 100 | *.gpState 101 | 102 | # ReSharper is a .NET coding add-in 103 | _ReSharper*/ 104 | *.[Rr]e[Ss]harper 105 | *.DotSettings.user 106 | 107 | # JustCode is a .NET coding add-in 108 | .JustCode 109 | 110 | # TeamCity is a build add-in 111 | _TeamCity* 112 | 113 | # DotCover is a Code Coverage Tool 114 | *.dotCover 115 | 116 | # Visual Studio code coverage results 117 | *.coverage 118 | *.coveragexml 119 | 120 | # NCrunch 121 | _NCrunch_* 122 | .*crunch*.local.xml 123 | nCrunchTemp_* 124 | 125 | # MightyMoose 126 | *.mm.* 127 | AutoTest.Net/ 128 | 129 | # Web workbench (sass) 130 | .sass-cache/ 131 | 132 | # Installshield output folder 133 | [Ee]xpress/ 134 | 135 | # DocProject is a documentation generator add-in 136 | DocProject/buildhelp/ 137 | DocProject/Help/*.HxT 138 | DocProject/Help/*.HxC 139 | DocProject/Help/*.hhc 140 | DocProject/Help/*.hhk 141 | DocProject/Help/*.hhp 142 | DocProject/Help/Html2 143 | DocProject/Help/html 144 | 145 | # Click-Once directory 146 | publish/ 147 | 148 | # Publish Web Output 149 | *.[Pp]ublish.xml 150 | *.azurePubxml 151 | # TODO: Comment the next line if you want to checkin your web deploy settings 152 | # but database connection strings (with potential passwords) will be unencrypted 153 | *.pubxml 154 | *.publishproj 155 | 156 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 157 | # checkin your Azure Web App publish settings, but sensitive information contained 158 | # in these scripts will be unencrypted 159 | PublishScripts/ 160 | 161 | # NuGet Packages 162 | *.nupkg 163 | # The packages folder can be ignored because of Package Restore 164 | **/packages/* 165 | # except build/, which is used as an MSBuild target. 166 | !**/packages/build/ 167 | # Uncomment if necessary however generally it will be regenerated when needed 168 | #!**/packages/repositories.config 169 | # NuGet v3's project.json files produces more ignorable files 170 | *.nuget.props 171 | *.nuget.targets 172 | 173 | # Microsoft Azure Build Output 174 | csx/ 175 | *.build.csdef 176 | 177 | # Microsoft Azure Emulator 178 | ecf/ 179 | rcf/ 180 | 181 | # Windows Store app package directories and files 182 | AppPackages/ 183 | BundleArtifacts/ 184 | Package.StoreAssociation.xml 185 | _pkginfo.txt 186 | 187 | # Visual Studio cache files 188 | # files ending in .cache can be ignored 189 | *.[Cc]ache 190 | # but keep track of directories ending in .cache 191 | !*.[Cc]ache/ 192 | 193 | # Others 194 | ClientBin/ 195 | ~$* 196 | *~ 197 | *.dbmdl 198 | *.dbproj.schemaview 199 | *.jfm 200 | *.pfx 201 | *.publishsettings 202 | orleans.codegen.cs 203 | 204 | # Since there are multiple workflows, uncomment next line to ignore bower_components 205 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 206 | #bower_components/ 207 | 208 | # RIA/Silverlight projects 209 | Generated_Code/ 210 | 211 | # Backup & report files from converting an old project file 212 | # to a newer Visual Studio version. Backup files are not needed, 213 | # because we have git ;-) 214 | _UpgradeReport_Files/ 215 | Backup*/ 216 | UpgradeLog*.XML 217 | UpgradeLog*.htm 218 | 219 | # SQL Server files 220 | *.mdf 221 | *.ldf 222 | *.ndf 223 | 224 | # Business Intelligence projects 225 | *.rdl.data 226 | *.bim.layout 227 | *.bim_*.settings 228 | 229 | # Microsoft Fakes 230 | FakesAssemblies/ 231 | 232 | # GhostDoc plugin setting file 233 | *.GhostDoc.xml 234 | 235 | # Node.js Tools for Visual Studio 236 | .ntvs_analysis.dat 237 | node_modules/ 238 | 239 | # Typescript v1 declaration files 240 | typings/ 241 | 242 | # Visual Studio 6 build log 243 | *.plg 244 | 245 | # Visual Studio 6 workspace options file 246 | *.opt 247 | 248 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 249 | *.vbw 250 | 251 | # Visual Studio LightSwitch build output 252 | **/*.HTMLClient/GeneratedArtifacts 253 | **/*.DesktopClient/GeneratedArtifacts 254 | **/*.DesktopClient/ModelManifest.xml 255 | **/*.Server/GeneratedArtifacts 256 | **/*.Server/ModelManifest.xml 257 | _Pvt_Extensions 258 | 259 | # Paket dependency manager 260 | .paket/paket.exe 261 | paket-files/ 262 | 263 | # FAKE - F# Make 264 | .fake/ 265 | 266 | # JetBrains Rider 267 | .idea/ 268 | *.sln.iml 269 | 270 | # CodeRush 271 | .cr/ 272 | 273 | # Python Tools for Visual Studio (PTVS) 274 | __pycache__/ 275 | *.pyc 276 | 277 | # Cake - Uncomment if you are using it 278 | # tools/** 279 | # !tools/packages.config 280 | 281 | # Telerik's JustMock configuration file 282 | *.jmconfig 283 | 284 | # BizTalk build output 285 | *.btp.cs 286 | *.btm.cs 287 | *.odx.cs 288 | *.xsd.cs 289 | -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | /docs 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Matt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sqlops-widgets 2 | 3 | This project has been split into the following projects now that SQL Ops Studio has support for an extension market place and it made sense to track these as separate projects. 4 | 5 | - [sqlops-alwayson-insights](https://github.com/Matticusau/sqlops-alwayson-insights) 6 | - [sqlops-mssql-instance-insights](https://github.com/Matticusau/sqlops-mssql-instance-insights) 7 | - [sqlops-mssql-db-insights](https://github.com/Matticusau/sqlops-mssql-db-insights) 8 | 9 | SQL Operations Studio (sqlopsstudio) is the new cross-platform, cross-database open source tool released by Microsoft. The tool provides the ability to customise the dashboard with different widgets that are either built-in or custom. This project focuses on building some custom widgets to extend the functionality to include important information for DBA's and Developers. 10 | 11 | Read more about SQL Operations Studio in the following resources: 12 | 13 | - [https://blogs.technet.microsoft.com/dataplatforminsider/2017/11/15/announcing-sql-operations-studio-for-preview/](https://blogs.technet.microsoft.com/dataplatforminsider/2017/11/15/announcing-sql-operations-studio-for-preview/) 14 | - [https://docs.microsoft.com/en-us/sql/sql-operations-studio/what-is](https://docs.microsoft.com/en-us/sql/sql-operations-studio/what-is) 15 | - [https://github.com/Microsoft/sqlopsstudio](https://github.com/Microsoft/sqlopsstudio) 16 | 17 | ## License 18 | 19 | This project is released under the [MIT License](https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE) 20 | 21 | ## Contributors 22 | 23 | - Matticusau [GitHub](https://github.com/Matticusau) | [twitter](https://twitter.com/matticusau) -------------------------------------------------------------------------------- /archive/Build.ps1: -------------------------------------------------------------------------------- 1 | [CmdLetBinding()] 2 | Param ( 3 | [Parameter()] 4 | [string]$BuildDir 5 | ) 6 | 7 | [string]$scriptPath = $PSScriptRoot; 8 | 9 | # set the location history 10 | Push-Location; 11 | 12 | # make sure the releases folder exists 13 | if ($null -eq $BuildDir -or $BuildDir.Length -eq 0) 14 | { 15 | $BuildDir = Join-Path -Path $scriptPath -ChildPath 'Build'; 16 | } 17 | if (-not(Test-Path -Path $BuildDir)) 18 | { 19 | New-Item -Path $BuildDir -ItemType Directory -Force | Out-Null; 20 | } 21 | 22 | # Get the packages to build in this repo 23 | $packageFiles = Get-ChildItem -Path $scriptPath -Recurse -Filter 'package.json' 24 | 25 | if ($packageFiles.Count -eq 0) 26 | { 27 | Write-Error -Message 'No Extensions found to package' 28 | Exit 29 | } 30 | 31 | # set our working location to the build folder 32 | Set-Location -Path $BuildDir; 33 | 34 | # process each package found 35 | foreach ($package in $packageFiles) 36 | { 37 | Write-Verbose -Message "Processing $($package.fullname)"; 38 | 39 | # try 40 | # { 41 | Set-Location -Path $package.DirectoryName; 42 | vsce.cmd package; 43 | Get-ChildItem -Path $package.DirectoryName -Filter '*.vsix' | Move-Item -Destination $BuildDir -Force; 44 | # } 45 | # catch 46 | # { 47 | 48 | # } 49 | 50 | Write-Verbose -Message ('Finished processing package {0}' -f $packageJson.name); 51 | 52 | } 53 | 54 | # return to the previous user location 55 | Pop-Location; 56 | 57 | Write-Verbose -Message 'Extension Packaging Complete'; -------------------------------------------------------------------------------- /archive/Build/alwayson-insights-0.2.0.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/Build/alwayson-insights-0.2.0.vsix -------------------------------------------------------------------------------- /archive/Build/mssql-database-insights-0.1.0.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/Build/mssql-database-insights-0.1.0.vsix -------------------------------------------------------------------------------- /archive/Build/mssql-instance-insights-0.1.0.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/Build/mssql-instance-insights-0.1.0.vsix -------------------------------------------------------------------------------- /archive/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change log for sqlops-widgets 2 | 3 | ## Unreleased 4 | 5 | ## 0.2.1.0 6 | 7 | - Code archived to /archive 8 | - Documentation updated 9 | 10 | ## 0.2.0.0 11 | 12 | - BREAKING CHANGE: alwayson-insights renamed with _alwayson_ prefix 13 | - Added Install wizard with Install.ps1 14 | - Added license link to query files 15 | - New mssql-database-insights 16 | - Added mssql-db-spaceused 17 | - Added mssql-db-spaceused-filetype 18 | - New mssql-instance-insights 19 | - Added mssql-instance-waits 20 | - Added mssql-instance-xelsystem (Preview) 21 | - Added mssql-instance-xelio (Preview) 22 | - Added mssql-instance-xelmemory (Preview) 23 | - Documentation updates 24 | - Updated supportability where tested 25 | 26 | ## 0.1.0.0 27 | 28 | - Changes to alwayson-insights 29 | - Added db_health_detail.sql 30 | - Added db_rpo_rto_health.sql 31 | - Added db_sync_health.sql 32 | - Added replica_health_detail.sql 33 | - Added replica_health.sql 34 | - Documentation 35 | -------------------------------------------------------------------------------- /archive/Install.ps1: -------------------------------------------------------------------------------- 1 | Param ( 2 | # skip the prompt and just install/upgrade any packages 3 | [switch]$Force 4 | , 5 | # in the case that the same version is already installed, still overwrite it. Useful in Development environments. 6 | [switch]$OverwriteExisting 7 | ) 8 | 9 | [string]$scriptPath = $PSScriptRoot; 10 | 11 | # set the SQL Operations Studio Extensions path 12 | $sqlopsExtDir = '~\.sqlops\extensions'; 13 | 14 | # set the array of any exlusions when copying to the installation path 15 | $excludeFromCopy = @('*.md') 16 | 17 | $packageFiles = Get-ChildItem -Path $scriptPath -Recurse -Filter 'package.json' 18 | 19 | if ($packageFiles.Count -eq 0) 20 | { 21 | Write-Error -Message 'No SQL Operations Studio packages found to install' 22 | Exit 23 | } 24 | 25 | # process each package found 26 | foreach ($package in $packageFiles) 27 | { 28 | Write-Verbose -Message "Processing $($package.fullname)"; 29 | 30 | # get the folder name 31 | $packageFolderName = Split-Path -Path $package.DirectoryName -Leaf; 32 | try 33 | { 34 | $packageJson = (Get-Content $package.FullName) | ConvertFrom-Json; 35 | } 36 | catch 37 | { 38 | # use a default json if required 39 | $packageJson = @{ 40 | name = $package.Directory; 41 | version = '0.0.1'; 42 | } 43 | } 44 | 45 | # check if we need to upgrade a preinstalled package 46 | [bool]$performUpgrade = $false; 47 | [string]$existingPackageFile = Join-Path -Path (Join-Path -Path $sqlopsExtDir -ChildPath $packageJson.name) -ChildPath 'package.json'; 48 | if (Test-Path -Path $existingPackageFile -PathType Leaf) 49 | { 50 | Write-Verbose -Message 'Existing package found, getting details' 51 | [pscustomobject]$existingPackageJson = (Get-Content $existingPackageFile) | ConvertFrom-Json; 52 | $performUpgrade = $true; 53 | } 54 | else { 55 | [pscustomobject]$existingPackageJson = $null; 56 | } 57 | 58 | 59 | [bool]$proceed = $false; 60 | 61 | # in the event that we will proceed without prompt 62 | $proceed = $Force 63 | 64 | # check if we need to prompt for authority 65 | if (!($Force)) 66 | { 67 | [string]$message = $null; 68 | if ($performUpgrade) 69 | { 70 | # check if we actually need to do anything 71 | if ($existingPackageJson.version -ne $packageJson.version) 72 | { 73 | [string]$message = 'Do you want to upgrade {0} from version {2} to version {1}? (Y/N)' -f $packageJson.name, $packageJson.version, $existingPackageJson.version; 74 | } 75 | else { 76 | # because we are doing an upgrade use the OverWriteExisting switch to determine if we proceed 77 | $proceed = $OverwriteExisting; 78 | } 79 | } 80 | else { 81 | [string]$message = 'Do you want to install {0} of version {1}? (Y/N)' -f $packageJson.name, $packageJson.version; 82 | } 83 | 84 | if ($null -ne $message -and $message.Length -gt 0 -and ((Read-Host -Prompt $message) -eq 'y')) 85 | { 86 | $proceed = $true 87 | } 88 | } 89 | 90 | # if we are allowed then proceed with install 91 | if ($proceed) 92 | { 93 | $packageDest = Join-Path -Path $sqlopsExtDir -ChildPath $packageJson.name; 94 | 95 | # are we upgrading 96 | if ($performUpgrade) 97 | { 98 | if ($existingPackageJson.version -ne $packageJson.version) 99 | { 100 | Write-Verbose -Message ('Upgrading package {0}' -f $packageJson.name); 101 | # to keep the install clean and in case we rename files remove the existing and copy new 102 | Remove-Item -Path $packageDest -Force -Recurse; 103 | Copy-Item -Path $package.DirectoryName -Destination $sqlopsExtDir -Container -Recurse -Exclude $excludeFromCopy; 104 | } 105 | elseif ($OverwriteExisting) { 106 | # the user chose to overwrite the existing 107 | Write-Verbose -Message ('Overwriting existing package {0}' -f $packageJson.name); 108 | # to keep the install clean and in case we rename files remove the existing and copy new 109 | Remove-Item -Path $packageDest -Force -Recurse; 110 | Copy-Item -Path $package.DirectoryName -Destination $sqlopsExtDir -Container -Recurse -Exclude $excludeFromCopy; 111 | } 112 | else { 113 | Write-Verbose -Message ('Nothing to do for existing package {0}' -f $packageJson.name); 114 | } 115 | } 116 | else { 117 | # fresh install 118 | Write-Verbose -Message ('Installing package {0}' -f $packageJson.name); 119 | Copy-Item -Path $package.DirectoryName -Destination $sqlopsExtDir -Container -Recurse -Exclude $excludeFromCopy; 120 | } 121 | } 122 | else { 123 | Write-Verbose -Message ('Package {0} already installed, use -OverwriteExisting to upgrade anyway' -f $packageJson.name); 124 | } 125 | 126 | Write-Verbose -Message ('Finished processing package {0}' -f $packageJson.name); 127 | 128 | } 129 | 130 | Write-Verbose -Message 'Install/Upgrade Complete'; -------------------------------------------------------------------------------- /archive/README.md: -------------------------------------------------------------------------------- 1 | # sqlops-widgets 2 | 3 | [![Build status](https://ci.appveyor.com/api/projects/status/gumh9h69ex4qjle3/branch/master?svg=true)](https://ci.appveyor.com/project/Matticusau/sqlops-widgets/branch/master) [![Build status](https://ci.appveyor.com/api/projects/status/gumh9h69ex4qjle3/branch/dev?svg=true)](https://ci.appveyor.com/project/Matticusau/sqlops-widgets/branch/dev) 4 | 5 | A collection of SQL Operations Studio Dashboard Widgets. 6 | 7 | SQL Operations Studio (sqlopsstudio) is the new cross-platform, cross-database open source tool released by Microsoft. The tool provides the ability to customise the dashboard with different widgets that are either built-in or custom. This project focuses on building some custom widgets to extend the functionality to include important information for DBA's and Developers. 8 | 9 | Read more about SQL Operations Studio in the following resources: 10 | 11 | - [https://blogs.technet.microsoft.com/dataplatforminsider/2017/11/15/announcing-sql-operations-studio-for-preview/](https://blogs.technet.microsoft.com/dataplatforminsider/2017/11/15/announcing-sql-operations-studio-for-preview/) 12 | - [https://docs.microsoft.com/en-us/sql/sql-operations-studio/what-is](https://docs.microsoft.com/en-us/sql/sql-operations-studio/what-is) 13 | - [https://github.com/Microsoft/sqlopsstudio](https://github.com/Microsoft/sqlopsstudio) 14 | 15 | The following example shows the Server Dashboard configured with some of our widgets. 16 | 17 | ![Server Dashboard](docs/images/server-dashboard.png) 18 | 19 | The following example shows the Database Dashboard configured with some built-in widgets and also our AlwaysOn Database RPO/RTO and Health Widget. 20 | 21 | ![Database Dashboard](docs/images/database-dashboard1.png) 22 | 23 | An alternative Database Dashboard with database size and alwayson widgets 24 | 25 | ![Database Dashboard2](docs/images/database-dashboard2.png) 26 | 27 | ## Insights Included 28 | 29 | The following insight packs are included in this project. For more info see the _README.md_ in each insight pack. 30 | 31 | - [AlwaysOn-Insights](alwayson-insights/README.md). 32 | - [MSSQL-Database-Insights](mssql-database-insights/README.md). 33 | - [MSSQL-Instance-Insights](mssql-instance-insights/README.md). 34 | 35 | ## Change log 36 | 37 | A full list of changes in each version can be found in the [change log](CHANGELOG.md). 38 | 39 | ## Install/Upgrade Wizard 40 | 41 | The best way to install these widgets is with the provided script. 42 | 43 | 1. Close SQL Operations Studio if it is already open 44 | 45 | 1. Download the latest version from the project [releases](https://github.com/Matticusau/sqlops-widgets/releases) 46 | 47 | 1. Extract the downloaded archive file to a temporary location (e.g. C:\install) 48 | 49 | 1. Open PowerShell and run `.\Install.ps1` 50 | 51 | The installer will prompt you to install each widget package. Use the `-force` parameter to avoid the prompt. 52 | 53 | ![install-prompts](docs/images/install-prompts.png) 54 | 55 | If you have any existing packages you will be prompted to upgrade them if a new version is provided. Use the `-force` parameter to avoid the prompt, or use `-OverwriteExisting` to re-install existing packages. 56 | 57 | ![install-upgradeprompt](docs/images/install-upgradeprompt.png) 58 | 59 | Use the `$VerbosePreference` to control the verbose information output during install 60 | 61 | ![install-verbose](docs/images/install-verbose.png) 62 | 63 | 1. Once the install wizard has completed, follow the instructions below for configuring/enabling the widget. 64 | 65 | ## Manual Install/Upgrade 66 | 67 | To manually install these widgets into your SQL Operations Studio extensions folder follow these steps. 68 | 69 | 1. Close SQL Operations Studio if it is already open 70 | 71 | 1. Download the latest version from the project [releases](https://github.com/Matticusau/sqlops-widgets/releases) 72 | 73 | 1. Extract the downloaded archive file to a temporary location 74 | 75 | 1. Copy the various insights packs to your SQL Operations Studio extensions folder. The following example uses PowerShell to copy the files, simply replace the path with the path to you extracted to. 76 | 77 | ```PowerShell 78 | Set-Location -Path .\PathToExtractedFiles 79 | Copy-Item -Path * -Destination ~/.sqlops/extensions -Force -Recurse 80 | ``` 81 | 82 | ## Configure/Enable Widgets in SQL Operations Studio 83 | 84 | Once you have installed the Widget files on your computer follow these steps to enable the widgets in your SQL Operations Studio. 85 | 86 | 1. Open SQL Operations Studio 87 | 88 | 1. Press F1 (or CTRL+SHIFT+P for those VSCode users) to open the command palette, type "settings" and select *Preferences: Open User Settings*. Alternatively use the File menu to access the settings. 89 | 90 | 1. The settings screen contains the default settings on the left and your user/workspace settings on the right. Use the Settings search box to locate either "dashboard.server.widgets" or "dashboard.database.widgets" depending on the widget you wish to add. 91 | 92 | 1. If you haven't modified the default dashboards yet then, hold your mouse cursor over the current configuration and select Pencil/edit icon. This will copy the current settings to your user/workspace settings to allow you to edit them and is the preferred method. 93 | 94 | > The configuration of your user/workspace settings will override the default settings, in the case of the widgets this means you can also remove the built-in widgets from the dashboard if you do not include them in your user/workspace settings. 95 | 96 | 1. Locate the appropriate section in your user/workspace settings and add the relevate json for the widget you are enabling. The README.md for each insight pack contains the json for enabling the relevant widget. For example the following snippet enables the AG replicate health widget for a server dashboard. 97 | 98 | ```json 99 | "dashboard.server.widgets": [ 100 | ... 101 | { 102 | "name": "AG Replica Health", 103 | "widget": { 104 | "ag-replica-health-insight": null 105 | } 106 | } 107 | ... 108 | ] 109 | ``` 110 | 111 | ## Bugs / New Features 112 | 113 | If you find a bug or have an idea to improve this collection please create a new issue in this project. 114 | 115 | ## Contributing 116 | 117 | You are more than welcoem to help contribute to this project if you wish, please create a new fork of the dev branch, then submit a pull request to the dev branch after making your changes. 118 | 119 | ## License 120 | 121 | This project is released under the [MIT License](https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE) 122 | 123 | ## Contributors 124 | 125 | * Matticusau [GitHub](https://github.com/Matticusau) | [twitter](https://twitter.com/matticusau) -------------------------------------------------------------------------------- /archive/alwayson-insights/README.md: -------------------------------------------------------------------------------- 1 | # AlwaysOn-Insights widget 2 | 3 | This collection of widgets are designed to provide insights into AlwaysOn Availability Group components to assist DBA's or similar in managing their environment. 4 | 5 | Where possible all of these widgets will include more detail when you click *_Show Details_* from the widget menu. 6 | 7 | ![Show details](../docs/images/show-detail.png) 8 | 9 | ## Supported SQL Server Versions 10 | 11 | These widgets have been tested against the following SQL Server versions: 12 | 13 | * SQL Server 2016 14 | * SQL Server 2017 (Windows & linux) 15 | 16 | If you find any issues using these widgets on these supported SQL Server versions, or any other versions please create an issue as we would like to make these available for as many releases as possible. 17 | 18 | ***We are looking for testers to confirm other environments.*** So if you find they do work on other releases let me know, and credit will be given. 19 | 20 | ## alwayson-ag-replica-health 21 | 22 | This Server Dashboard widget includes information on the health of the Availability Group replicas associated with this instance. Information will be shown in the form of a pie chart displaying the percentage of CONNECTED and DISCONNECTED replicas. 23 | 24 | ![Screen Shot](../docs/images/alwayson-insights/ag-replica-health-insight.png) 25 | 26 | > NOTE: in v0.1.0.0 this widget was called `ag-replica-health-insight` 27 | 28 | You can access more information about the replicas in the detailed fly-out displayed when you select "..." on the widget. 29 | 30 | ![Show details](../docs/images/show-detail.png) 31 | ![Screen Shot](../docs/images/alwayson-insights/ag-replica-health-insight-details.png) 32 | 33 | To install this widget add the following json to either your user or workspace settings in the *dashboard.server.widgets* section. 34 | 35 | ```json 36 | { 37 | "name": "AG Replica Health", 38 | "widget": { 39 | "alwayson-ag-replica-health": null 40 | } 41 | } 42 | ``` 43 | 44 | ## alwayson-ag-db-sync 45 | 46 | This Database Dashboard widget includes information on the health of the database replicas associated with the selected database. Information will be shown in the form of a pie chart displaying the percentage of HEALTHY and NOT_HEALTHY database replicas that the selected database is partnered with inside an Availability Group. 47 | 48 | ![Screen Shot](../docs/images/alwayson-insights/ag-db-sync-insight.png) 49 | 50 | > NOTE: in v0.1.0.0 this widget was called `ag-db-sync-insight` 51 | 52 | You can access more information about the database replicas in the detailed fly-out displayed when you select "..." on the widget. 53 | 54 | ![Screen Shot](../docs/images/alwayson-insights/ag-db-sync-insight-details.png) 55 | 56 | To install this widget add the following json to either your user or workspace settings in the *dashboard.database.widgets* section. 57 | 58 | ```json 59 | { 60 | "name": "AG DB Sync", 61 | "widget": { 62 | "alwayson-ag-db-sync": null 63 | } 64 | } 65 | ``` 66 | 67 | ## alwayson-ag-db-rpo-rto 68 | 69 | This Database Dashboard widget includes information on the synchronization state of the avaialbility group database to the partnered replicas. The information assists in estimating the current Recovery Time Objective (RTO) through the *estimated_recovery_time* column, and the Recovery Point Objective (RPO) through the *estimated_data_loss* column. Information will be shown in the form of a bar chart displaying both fields. 70 | 71 | ![Screen Shot](../docs/images/alwayson-insights/ag-db-rpo-rto-insight.png) 72 | 73 | > NOTE: in v0.1.0.0 this widget was called `ag-db-rpo-rto-insight` 74 | 75 | You can access more information about the synchronization state in the detailed fly-out displayed when you select "..." on the widget. 76 | 77 | ![Screen Shot](../docs/images/alwayson-insights/ag-db-rpo-rto-insight-details.png) 78 | 79 | To install this widget add the following json to either your user or workspace settings in the *dashboard.database.widgets* section. 80 | 81 | ```json 82 | { 83 | "name": "AG DB RPO/RTO", 84 | "widget": { 85 | "alwayson-ag-db-rpo-rto": null 86 | } 87 | } 88 | ``` -------------------------------------------------------------------------------- /archive/alwayson-insights/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "alwayson-insights", 3 | "version": "0.2.0", 4 | "publisher": "matticusau", 5 | "license": "MIT", 6 | "author": { 7 | "email": "matt.lavery@outlook.com", 8 | "name": "Matt Lavery", 9 | "url": "http://www.matticusau.net" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/matticusau/sqlops-widgets" 14 | }, 15 | "bugs": { 16 | "url": "https://github.com/matticusau/sqlops-widgets/issues", 17 | "email": "matt.lavery@outlook.com" 18 | }, 19 | "engines": { 20 | "vscode": "*" 21 | }, 22 | "categories": [ 23 | "Other" 24 | ], 25 | "keywords": [ 26 | "sqlops", 27 | "sql", 28 | "sqlops-studio", 29 | "studio" 30 | ], 31 | "homepage": "https://github.com/matticusau/sqlops-widgets", 32 | "contributes": { 33 | "insights": [ 34 | { 35 | "id": "alwayson-ag-replica-health", 36 | "contrib": { 37 | "name": "AG Replica Status", 38 | "provider": "MSSQL", 39 | "edition": [0,1,2,3,4], 40 | "gridItemConfig": { 41 | "x": 1, 42 | "y": 1 43 | }, 44 | "type": { 45 | "pie": { 46 | "dataDirection": "vertical", 47 | "dataType": "number", 48 | "legendPosition": "bottom", 49 | "labelFirstColumn": false, 50 | "columnsAsLabels": false 51 | } 52 | }, 53 | "queryFile": "./sql/alwayson-ag-replica-health.sql", 54 | "details": { 55 | "queryFile": "./sql/alwayson-ag-replica-health-detail.sql", 56 | "label": { 57 | "icon": "database", 58 | "column": "replica_server_name", 59 | "state": [ 60 | { 61 | "condition": { 62 | "if": "equals", 63 | "equals": "DISCONNECTED" 64 | }, 65 | "color": "red" 66 | }, 67 | { 68 | "condition": { 69 | "if": "equals", 70 | "equals": "CONNECTED" 71 | }, 72 | "color": "green" 73 | } 74 | ] 75 | }, 76 | "value": "connected_state_desc", 77 | "actions": null 78 | } 79 | } 80 | }, 81 | { 82 | "id": "alwayson-ag-db-sync", 83 | "contrib": { 84 | "name": "AG DB Sync Status", 85 | "provider": "MSSQL", 86 | "edition": [0,1,2,3,4], 87 | "gridItemConfig": { 88 | "x": 1, 89 | "y": 1 90 | }, 91 | "type": { 92 | "pie": { 93 | "dataDirection": "vertical", 94 | "dataType": "number", 95 | "legendPosition": "bottom", 96 | "labelFirstColumn": false, 97 | "columnsAsLabels": false 98 | } 99 | }, 100 | "queryFile": "./sql/alwayson-ag-db-sync.sql", 101 | "details": { 102 | "queryFile": "./sql/alwayson-ag-db-health-detail.sql", 103 | "label": { 104 | "icon": "database", 105 | "column": "replica_server_name", 106 | "state": [ 107 | { 108 | "condition": { 109 | "if": "equals", 110 | "equals": "NOT_HEALTHY" 111 | }, 112 | "color": "red" 113 | }, 114 | { 115 | "condition": { 116 | "if": "equals", 117 | "equals": "HEALTHY" 118 | }, 119 | "color": "green" 120 | } 121 | ] 122 | }, 123 | "value": "synchronization_health_desc", 124 | "actions": null 125 | } 126 | } 127 | }, 128 | { 129 | "id": "alwayson-ag-db-rpo-rto", 130 | "contrib": { 131 | "name": "AG DB Rto/Rpo", 132 | "provider": "MSSQL", 133 | "edition": [0,1,2,3,4], 134 | "gridItemConfig": { 135 | "sizex": 2, 136 | "sizey": 1 137 | }, 138 | "type": { 139 | "horizontalBar": { 140 | "dataDirection": "vertical", 141 | "dataType": "point", 142 | "legendPosition": "bottom", 143 | "labelFirstColumn": false, 144 | "columnsAsLabels": true 145 | } 146 | }, 147 | "queryFile": "./sql/alwayson-ag-db-rpo-rto.sql", 148 | "details": { 149 | "queryFile": "./sql/alwayson-ag-db-health-detail.sql", 150 | "label": { 151 | "icon": "database", 152 | "column": "replica_server_name", 153 | "state": [ 154 | { 155 | "condition": { 156 | "if": "greaterthan", 157 | "greaterthan": "0" 158 | }, 159 | "color": "red" 160 | }, 161 | { 162 | "condition": { 163 | "if": "equals", 164 | "equals": "0" 165 | }, 166 | "color": "green" 167 | }, 168 | { 169 | "condition": { 170 | "if": "equals", 171 | "equals": "NULL" 172 | }, 173 | "color": "green" 174 | } 175 | ] 176 | }, 177 | "value": "estimated_data_loss", 178 | "actions": null 179 | } 180 | } 181 | } 182 | ] 183 | } 184 | } -------------------------------------------------------------------------------- /archive/alwayson-insights/sql/alwayson-ag-db-health-detail.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: Matticusau 3 | -- Purpose: Provides detailed data for the AG Database Health Insights Widget 4 | -- License: https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE 5 | -- 6 | SELECT d.name [database_name] 7 | , ag.name [group_name] 8 | , ar.replica_server_name 9 | , drs.is_primary_replica 10 | , drs.synchronization_state_desc 11 | , drs.synchronization_health_desc 12 | , drs.database_state_desc 13 | , drs.suspend_reason_desc 14 | , ar.availability_mode_desc 15 | , ar.failover_mode_desc 16 | -- ADD latency info 17 | -- Estimated Failover Time = tDetection + tRedo + tOverhead 18 | , ag.health_check_timeout + (drs.redo_queue_size / NULLIF(drs.redo_rate,0)) [estimated_recovery_time] 19 | , (drs.log_send_queue_size / NULLIF(drs.log_send_rate,0)) [estimated_data_loss] 20 | -- , drs.redo_queue_size 21 | -- , drs.redo_rate 22 | -- , drs.log_send_queue_size 23 | -- , drs.log_send_rate 24 | from sys.databases d 25 | INNER JOIN sys.dm_hadr_database_replica_states drs ON drs.database_id = d.database_id 26 | INNER JOIN sys.availability_groups ag ON ag.group_id = drs.group_id 27 | INNER JOIN sys.availability_replicas ar ON ar.replica_id = drs.replica_id 28 | WHERE d.database_id = DB_ID() -------------------------------------------------------------------------------- /archive/alwayson-insights/sql/alwayson-ag-db-rpo-rto.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: Matticusau 3 | -- Purpose: Provides summary data for the AlwaysOn DB RPO RTO Insights Widget 4 | -- License: https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE 5 | -- 6 | SELECT ar.replica_server_name [replica_name] 7 | , ag.health_check_timeout + (drs.redo_queue_size / NULLIF(drs.redo_rate,0)) [estimated_recovery_time] 8 | , (drs.log_send_queue_size / NULLIF(drs.log_send_rate,0)) [estimated_data_loss] 9 | from sys.databases d 10 | INNER JOIN sys.dm_hadr_database_replica_states drs ON drs.database_id = d.database_id 11 | INNER JOIN sys.availability_groups ag ON ag.group_id = drs.group_id 12 | INNER JOIN sys.availability_replicas ar ON ar.replica_id = drs.replica_id 13 | WHERE d.database_id = DB_ID() 14 | -------------------------------------------------------------------------------- /archive/alwayson-insights/sql/alwayson-ag-db-sync.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: Matticusau 3 | -- Purpose: Provides summary data for the AlwaysOn DB Sync Insights Widget 4 | -- License: https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE 5 | -- 6 | DECLARE @totalReplicaCnt INT = ( 7 | SELECT COUNT(ar.replica_server_name) 8 | FROM sys.databases d 9 | INNER JOIN sys.dm_hadr_database_replica_states drs ON drs.database_id = d.database_id 10 | INNER JOIN sys.availability_groups ag ON ag.group_id = drs.group_id 11 | INNER JOIN sys.availability_replicas ar ON ar.replica_id = drs.replica_id 12 | WHERE d.database_id = DB_ID() 13 | ) 14 | --SELECT @totalReplicaCnt 15 | SELECT drs.synchronization_health_desc 16 | --, Count(connected_state_desc) [replica_count] 17 | , CONVERT( DECIMAL(5,2), ((Count(drs.synchronization_health_desc) * 1.0 / @totalReplicaCnt) * 100)) [replica_percent] 18 | FROM sys.databases d 19 | INNER JOIN sys.dm_hadr_database_replica_states drs ON drs.database_id = d.database_id 20 | INNER JOIN sys.availability_groups ag ON ag.group_id = drs.group_id 21 | INNER JOIN sys.availability_replicas ar ON ar.replica_id = drs.replica_id 22 | WHERE d.database_id = DB_ID() 23 | GROUP BY drs.synchronization_health_desc 24 | ORDER BY drs.synchronization_health_desc 25 | -------------------------------------------------------------------------------- /archive/alwayson-insights/sql/alwayson-ag-replica-health-detail.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: Matticusau 3 | -- Purpose: Provides detailed data for the Replica Health Insights Widget 4 | -- License: https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE 5 | -- 6 | SELECT ag.name [ag_name] 7 | , ar.replica_server_name 8 | , ars.role_desc 9 | , ars.operational_state 10 | , ars.connected_state_desc 11 | , ars.synchronization_health_desc 12 | FROM sys.availability_groups ag 13 | INNER JOIN sys.dm_hadr_availability_replica_states ars ON ars.group_id = ag.group_id 14 | INNER JOIN sys.availability_replicas ar ON ar.replica_id = ars.replica_id 15 | ORDER BY ag_name, replica_server_name -------------------------------------------------------------------------------- /archive/alwayson-insights/sql/alwayson-ag-replica-health.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: Matticusau 3 | -- Purpose: Provides summary data for the Replica Health Insights Widget 4 | -- License: https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE 5 | -- 6 | DECLARE @totalReplicaCnt INT = ( 7 | SELECT Count(connected_state_desc) 8 | FROM sys.availability_groups ag 9 | INNER JOIN sys.dm_hadr_availability_replica_states ars ON ars.group_id = ag.group_id 10 | INNER JOIN sys.availability_replicas ar ON ar.replica_id = ars.replica_id 11 | ) 12 | --SELECT @totalReplicaCnt 13 | SELECT ars.connected_state_desc 14 | --, Count(connected_state_desc) [replica_count] 15 | , CONVERT( DECIMAL(5,2), ((Count(connected_state_desc) * 1.0 / @totalReplicaCnt) * 100)) [replica_percent] 16 | FROM sys.availability_groups ag 17 | INNER JOIN sys.dm_hadr_availability_replica_states ars ON ars.group_id = ag.group_id 18 | INNER JOIN sys.availability_replicas ar ON ar.replica_id = ars.replica_id 19 | --WHERE ars.connected_state_desc = 'DISCONNECTED' 20 | GROUP BY ars.connected_state_desc 21 | ORDER BY ars.connected_state_desc -------------------------------------------------------------------------------- /archive/docs/images/alwayson-insights/ag-db-rpo-rto-insight-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/alwayson-insights/ag-db-rpo-rto-insight-details.png -------------------------------------------------------------------------------- /archive/docs/images/alwayson-insights/ag-db-rpo-rto-insight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/alwayson-insights/ag-db-rpo-rto-insight.png -------------------------------------------------------------------------------- /archive/docs/images/alwayson-insights/ag-db-sync-insight-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/alwayson-insights/ag-db-sync-insight-details.png -------------------------------------------------------------------------------- /archive/docs/images/alwayson-insights/ag-db-sync-insight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/alwayson-insights/ag-db-sync-insight.png -------------------------------------------------------------------------------- /archive/docs/images/alwayson-insights/ag-replica-health-insight-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/alwayson-insights/ag-replica-health-insight-details.png -------------------------------------------------------------------------------- /archive/docs/images/alwayson-insights/ag-replica-health-insight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/alwayson-insights/ag-replica-health-insight.png -------------------------------------------------------------------------------- /archive/docs/images/database-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/database-dashboard.png -------------------------------------------------------------------------------- /archive/docs/images/database-dashboard1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/database-dashboard1.png -------------------------------------------------------------------------------- /archive/docs/images/database-dashboard2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/database-dashboard2.png -------------------------------------------------------------------------------- /archive/docs/images/install-prompts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/install-prompts.png -------------------------------------------------------------------------------- /archive/docs/images/install-upgradeprompt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/install-upgradeprompt.png -------------------------------------------------------------------------------- /archive/docs/images/install-verbose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/install-verbose.png -------------------------------------------------------------------------------- /archive/docs/images/mssql-database-insights/mssql-db-spaceused-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/mssql-database-insights/mssql-db-spaceused-details.png -------------------------------------------------------------------------------- /archive/docs/images/mssql-database-insights/mssql-db-spaceused-filetype.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/mssql-database-insights/mssql-db-spaceused-filetype.png -------------------------------------------------------------------------------- /archive/docs/images/mssql-database-insights/mssql-db-spaceused.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/mssql-database-insights/mssql-db-spaceused.png -------------------------------------------------------------------------------- /archive/docs/images/mssql-instance-insights/mssql-instance-waits-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/mssql-instance-insights/mssql-instance-waits-details.png -------------------------------------------------------------------------------- /archive/docs/images/mssql-instance-insights/mssql-instance-waits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/mssql-instance-insights/mssql-instance-waits.png -------------------------------------------------------------------------------- /archive/docs/images/mssql-instance-insights/mssql-instance-xelio-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/mssql-instance-insights/mssql-instance-xelio-details.png -------------------------------------------------------------------------------- /archive/docs/images/mssql-instance-insights/mssql-instance-xelio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/mssql-instance-insights/mssql-instance-xelio.png -------------------------------------------------------------------------------- /archive/docs/images/mssql-instance-insights/mssql-instance-xelio2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/mssql-instance-insights/mssql-instance-xelio2.png -------------------------------------------------------------------------------- /archive/docs/images/mssql-instance-insights/mssql-instance-xelmemory-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/mssql-instance-insights/mssql-instance-xelmemory-details.png -------------------------------------------------------------------------------- /archive/docs/images/mssql-instance-insights/mssql-instance-xelmemory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/mssql-instance-insights/mssql-instance-xelmemory.png -------------------------------------------------------------------------------- /archive/docs/images/mssql-instance-insights/mssql-instance-xelsystem-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/mssql-instance-insights/mssql-instance-xelsystem-details.png -------------------------------------------------------------------------------- /archive/docs/images/mssql-instance-insights/mssql-instance-xelsystem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/mssql-instance-insights/mssql-instance-xelsystem.png -------------------------------------------------------------------------------- /archive/docs/images/server-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/server-dashboard.png -------------------------------------------------------------------------------- /archive/docs/images/show-detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matticusau/sqlops-widgets/530c5a90aae45db8feab9f09d157863601b447ee/archive/docs/images/show-detail.png -------------------------------------------------------------------------------- /archive/mssql-database-insights/README.md: -------------------------------------------------------------------------------- 1 | # MSSQL-Database-Insights widget 2 | 3 | This collection of widgets are designed to provide insights into MSSQL Database to further extend the built-in default widgets. 4 | 5 | Where possible all of these widgets will include more detail when you click *_Show Details_* from the widget menu. 6 | 7 | ![Show details](../docs/images/show-detail.png) 8 | 9 | ## Supported SQL Server Versions 10 | 11 | These widgets have been tested against the following SQL Server versions: 12 | 13 | * SQL Server 2016 14 | * SQL Server 2017 (Windows & linux) 15 | 16 | If you find any issues using these widgets on these supported SQL Server versions, or any other versions please create an issue as we would like to make these available for as many releases as possible. 17 | 18 | ***We are looking for testers to confirm other environments.*** So if you find they do work on other releases let me know, and credit will be given. 19 | 20 | ## mssql-db-spaceused 21 | 22 | This Database Dashboard widget includes information on the current used space within a Database. Information will be shown in the form of a pie chart displaying the percentage of used space verses free space. 23 | 24 | ![mssql-db-spaceused.png](../docs/images/mssql-database-insights/mssql-db-spaceused.png) 25 | 26 | You can access more information about the space usaged in the detailed fly-out displayed when you select "..." on the widget. 27 | 28 | ![mssql-db-spaceused-details.png](../docs/images/mssql-database-insights/mssql-db-spaceused-details.png) 29 | 30 | To enable this widget add the following json to either your user or workspace settings in the *dashboard.database.widgets* section. 31 | 32 | ```json 33 | { 34 | "name": "DB Space Used", 35 | "widget": { 36 | "mssql-db-spaceused": null 37 | } 38 | } 39 | ``` 40 | 41 | ## mssql-db-spaceused-filetype 42 | 43 | This Database Dashboard widget includes information on the current used space within a Database broken down by the various file types (ROWS, LOG). Information will be shown in the form of a bar chart displaying the percentage of used space verses free space for each file type. 44 | 45 | ![mssql-db-spaceused-filetype.png](../docs/images/mssql-database-insights/mssql-db-spaceused-filetype.png) 46 | 47 | You can access more information about the space usaged in the detailed fly-out displayed when you select "..." on the widget. 48 | 49 | ![mssql-db-spaceused-details.png](../docs/images/mssql-database-insights/mssql-db-spaceused-details.png) 50 | 51 | To enable this widget add the following json to either your user or workspace settings in the *dashboard.database.widgets* section. 52 | 53 | ```json 54 | { 55 | "name": "DB Space Used (by filetype)", 56 | "widget": { 57 | "mssql-db-spaceused-filetype": null 58 | } 59 | } 60 | ``` -------------------------------------------------------------------------------- /archive/mssql-database-insights/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mssql-database-insights", 3 | "version": "0.1.0", 4 | "publisher": "matticusau", 5 | "license": "MIT", 6 | "author": { 7 | "email": "matt.lavery@outlook.com", 8 | "name": "Matt Lavery", 9 | "url": "http://www.matticusau.net" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/matticusau/sqlops-widgets" 14 | }, 15 | "bugs": { 16 | "url": "https://github.com/matticusau/sqlops-widgets/issues", 17 | "email": "matt.lavery@outlook.com" 18 | }, 19 | "engines": { 20 | "vscode": "*" 21 | }, 22 | "categories": [ 23 | "Other" 24 | ], 25 | "keywords": [ 26 | "sqlops", 27 | "sql", 28 | "sqlops-studio", 29 | "studio" 30 | ], 31 | "homepage": "https://github.com/matticusau/sqlops-widgets", 32 | "contributes": { 33 | "insights": [ 34 | { 35 | "id": "mssql-db-spaceused", 36 | "contrib": { 37 | "name": "Database Space Used", 38 | "provider": "MSSQL", 39 | "edition": [0,1,2,3,4], 40 | "gridItemConfig": { 41 | "x": 1, 42 | "y": 1 43 | }, 44 | "type": { 45 | "pie": { 46 | "dataDirection": "horizontal", 47 | "dataType": "number", 48 | "legendPosition": "bottom", 49 | "labelFirstColumn": false, 50 | "columnsAsLabels": false 51 | } 52 | }, 53 | "queryFile": "./sql/mssql-db-spaceused.sql", 54 | "details": { 55 | "queryFile": "./sql/mssql-db-spaceused-detail.sql", 56 | "label": { 57 | "icon": "database", 58 | "column": "file_name", 59 | "state": [ 60 | { 61 | "condition": { 62 | "if": "greaterthan", 63 | "greaterthan": "95" 64 | }, 65 | "color": "red" 66 | }, 67 | { 68 | "condition": { 69 | "if": "greaterthan", 70 | "greaterthan": "85" 71 | }, 72 | "color": "orange" 73 | }, 74 | { 75 | "condition": { 76 | "if": "lessthan", 77 | "lessthan": "86" 78 | }, 79 | "color": "green" 80 | } 81 | ] 82 | }, 83 | "value": "used_space_percent", 84 | "actions": null 85 | } 86 | } 87 | }, 88 | { 89 | "id": "mssql-db-spaceused-filetype", 90 | "contrib": { 91 | "name": "Database Space Used (File Type)", 92 | "provider": "MSSQL", 93 | "edition": [0,1,2,3,4], 94 | "gridItemConfig": { 95 | "x": 1, 96 | "y": 1 97 | }, 98 | "type": { 99 | "horizontalBar": { 100 | "dataDirection": "vertical", 101 | "dataType": "number", 102 | "legendPosition": "bottom", 103 | "labelFirstColumn": true, 104 | "columnsAsLabels": true 105 | } 106 | }, 107 | "queryFile": "./sql/mssql-db-spaceused-filetype.sql", 108 | "details": { 109 | "queryFile": "./sql/mssql-db-spaceused-detail.sql", 110 | "label": { 111 | "icon": "database", 112 | "column": "file_name", 113 | "state": [ 114 | { 115 | "condition": { 116 | "if": "greaterthan", 117 | "greaterthan": "95" 118 | }, 119 | "color": "red" 120 | }, 121 | { 122 | "condition": { 123 | "if": "greaterthan", 124 | "greaterthan": "85" 125 | }, 126 | "color": "orange" 127 | }, 128 | { 129 | "condition": { 130 | "if": "lessthan", 131 | "lessthan": "86" 132 | }, 133 | "color": "green" 134 | } 135 | ] 136 | }, 137 | "value": "used_space_percent", 138 | "actions": null 139 | } 140 | } 141 | } 142 | ] 143 | } 144 | } -------------------------------------------------------------------------------- /archive/mssql-database-insights/sql/mssql-db-spaceused-detail.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: Matticusau 3 | -- Purpose: Provides detailed data for the DB Space Used Insights Widget 4 | -- License: https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE 5 | -- 6 | SELECT file_id 7 | , name [file_name] 8 | , type_desc 9 | , physical_name 10 | , CONVERT(decimal(18,2), size/128.0) [file_size_mb] 11 | , CONVERT(decimal(18,2), max_size/128.0) [max_growth_size_mb] 12 | , CONVERT(decimal(18,2), FILEPROPERTY(name, 'SpaceUsed')/128.0) [used_space_mb] 13 | , CONVERT(decimal(18,2), size/128.0) - CONVERT(decimal(18,2), FILEPROPERTY(name,'SpaceUsed')/128.0) AS [free_space_mb] 14 | , CONVERT(decimal(18,2), (FILEPROPERTY(name, 'SpaceUsed')/128.0) / (size/128.0) * 100) [used_space_percent] 15 | , 100 - CONVERT(decimal(18,2), (FILEPROPERTY(name, 'SpaceUsed')/128.0) / (size/128.0) * 100) AS [free_space_percent] 16 | FROM sys.database_files 17 | ORDER BY type_desc 18 | , file_id -------------------------------------------------------------------------------- /archive/mssql-database-insights/sql/mssql-db-spaceused-filetype.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: Matticusau 3 | -- Purpose: Provides summary data for the DB Space Used Insights Widget 4 | -- License: https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE 5 | -- 6 | SELECT type_desc 7 | -- , CONVERT(decimal(18,2), SUM(size)/128.0) [file_size_mb] 8 | -- , CONVERT(decimal(18,2), SUM(max_size)/128.0) [max_growth_size_mb] 9 | -- , CONVERT(decimal(18,2), SUM(FILEPROPERTY(name, 'SpaceUsed'))/128.0) [used_space_mb] 10 | -- , CONVERT(decimal(18,2), SUM(size)/128.0) - CONVERT(decimal(18,2), SUM(FILEPROPERTY(name,'SpaceUsed'))/128.0) AS [free_space_mb] 11 | , CONVERT(decimal(18,2), (SUM(FILEPROPERTY(name, 'SpaceUsed'))/128.0) / (SUM(size)/128.0) * 100) [used_space_percent] 12 | , 100 - CONVERT(decimal(18,2), (SUM(FILEPROPERTY(name, 'SpaceUsed'))/128.0) / (SUM(size)/128.0) * 100) AS [free_space_percent] 13 | FROM sys.database_files 14 | WHERE type_desc IN ('ROWS','LOG') 15 | GROUP BY type_desc 16 | ORDER BY type_desc -------------------------------------------------------------------------------- /archive/mssql-database-insights/sql/mssql-db-spaceused.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: Matticusau 3 | -- Purpose: Provides summary data for the DB Space Used Insights Widget 4 | -- License: https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE 5 | -- 6 | SELECT 7 | -- CONVERT(decimal(18,2), SUM(size)/128.0) [file_size_mb] , 8 | -- CONVERT(decimal(18,2), SUM(max_size)/128.0) [max_growth_size_mb] , 9 | -- CONVERT(decimal(18,2), SUM(FILEPROPERTY(name, 'SpaceUsed'))/128.0) [used_space_mb] , 10 | -- CONVERT(decimal(18,2), SUM(size)/128.0) - CONVERT(decimal(18,2), SUM(FILEPROPERTY(name,'SpaceUsed'))/128.0) AS [free_space_mb] , 11 | CONVERT(decimal(18,2), (SUM(FILEPROPERTY(name, 'SpaceUsed'))/128.0) / (SUM(size)/128.0) * 100) [used_space_percent], 12 | 100 - CONVERT(decimal(18,2), (SUM(FILEPROPERTY(name, 'SpaceUsed'))/128.0) / (SUM(size)/128.0) * 100) AS [free_space_percent] 13 | FROM sys.database_files 14 | WHERE type_desc IN ('ROWS','LOG') -------------------------------------------------------------------------------- /archive/mssql-instance-insights/README.md: -------------------------------------------------------------------------------- 1 | # MSSQL-Instance-Insights widget 2 | 3 | This collection of widgets are designed to provide insights into MSSQL Instance to further extend the built-in default widgets. 4 | 5 | Where possible all of these widgets will include more detail when you click *_Show Details_* from the widget menu. 6 | 7 | ![Show details](../docs/images/show-detail.png) 8 | 9 | ## Supported SQL Server Versions 10 | 11 | These widgets have been tested against the following SQL Server versions: 12 | 13 | * SQL Server 2016 14 | * SQL Server 2017 (Windows & linux) 15 | 16 | If you find any issues using these widgets on these supported SQL Server versions, or any other versions please create an issue as we would like to make these available for as many releases as possible. 17 | 18 | ***We are looking for testers to confirm other environments.*** So if you find they do work on other releases let me know, and credit will be given. 19 | 20 | ## mssql-instance-waits 21 | 22 | This Server Dashboard widget includes information on the top 10 waits for the SQL Instance. Information will be shown in the form of a bar chart. 23 | 24 | ![mssql-instance-waits.png](../docs/images/mssql-instance-insights/mssql-instance-waits.png) 25 | 26 | You can access more information about the waits in the detailed fly-out displayed when you select "..." on the widget. 27 | 28 | ![mssql-instance-waits-details.png](../docs/images/mssql-instance-insights/mssql-instance-waits-details.png) 29 | 30 | Credit for the query this widget is based on goes to [Paul Randal - Tell me where it hurts](https://www.sqlskills.com/blogs/paul/wait-statistics-or-please-tell-me-where-it-hurts/) 31 | 32 | To enable this widget add the following json to either your user or workspace settings in the *dashboard.server.widgets* section. 33 | 34 | ```json 35 | { 36 | "name": "Top 10 Waits", 37 | "widget": { 38 | "mssql-instance-waits": null 39 | } 40 | } 41 | ``` 42 | 43 | ## mssql-instance-xelsystem (PREVIEW) 44 | 45 | This Server Dashboard widget includes information on the general system performance captured by the Extended Events System Health Session for the SQL Instance. Information will be shown in the form of a line chart. If the System Health Session is stopped or the instance has been restarted will affect the amount of data available for this widget. 46 | 47 | ![mssql-instance-xelsystem.png](../docs/images/mssql-instance-insights/mssql-instance-xelsystem.png) 48 | 49 | You can access more information in the detailed fly-out displayed when you select "..." on the widget. 50 | 51 | ![mssql-instance-xelsystem-details.png](../docs/images/mssql-instance-insights/mssql-instance-xelsystem-details.png) 52 | 53 | Credit for the query this widget is based on goes to [troubleshootingsql.com](https://troubleshootingsql.com/2013/08/02/powerview-and-system-health-session-system/) 54 | 55 | > This widget is not currently supported on *_Azure SQL DB_* due to lack of support for Extended Events. 56 | 57 | To enable this widget add the following json to either your user or workspace settings in the *dashboard.server.widgets* section. 58 | 59 | ```json 60 | { 61 | "name": "XEL System Stats", 62 | "widget": { 63 | "mssql-instance-xelsystem": null 64 | } 65 | } 66 | ``` 67 | 68 | ## mssql-instance-xelio (PREVIEW) 69 | 70 | This Server Dashboard widget includes information on the IO performance captured by the Extended Events System Health Session for the SQL Instance. Information will be shown in the form of a line chart. If the System Health Session is stopped or the instance has been restarted will affect the amount of data available for this widget. 71 | 72 | ![mssql-instance-xelio.png](../docs/images/mssql-instance-insights/mssql-instance-xelio2.png) 73 | 74 | You can access more information in the detailed fly-out displayed when you select "..." on the widget. 75 | 76 | ![mssql-instance-xelio-details.png](../docs/images/mssql-instance-insights/mssql-instance-xelio-details.png) 77 | 78 | Credit for the query this widget is based on goes to [troubleshootingsql.com](https://troubleshootingsql.com/2013/07/25/powerview-and-system-health-session-io-health/) 79 | 80 | > This widget is not currently supported on *_Azure SQL DB_* due to lack of support for Extended Events. 81 | 82 | To enable this widget add the following json to either your user or workspace settings in the *dashboard.server.widgets* section. 83 | 84 | ```json 85 | { 86 | "name": "XEL IO Stats", 87 | "widget": { 88 | "mssql-instance-xelio": null 89 | } 90 | } 91 | ``` 92 | 93 | ## mssql-instance-xelmemory (PREVIEW) 94 | 95 | This Server Dashboard widget includes information on the Memory performance captured by the Extended Events System Health Session for the SQL Instance. Information will be shown in the form of a line chart. If the System Health Session is stopped or the instance has been restarted will affect the amount of data available for this widget. 96 | 97 | ![mssql-instance-xelmemory.png](../docs/images/mssql-instance-insights/mssql-instance-xelmemory.png) 98 | 99 | You can access more information in the detailed fly-out displayed when you select "..." on the widget. 100 | 101 | ![mssql-instance-xelmemory-details.png](../docs/images/mssql-instance-insights/mssql-instance-xelmemory-details.png) 102 | 103 | Credit for the query this widget is based on goes to [troubleshootingsql.com](https://troubleshootingsql.com/2013/07/19/powerview-and-system-health-sessionsql-memory-health/) 104 | 105 | > This widget is not currently supported on *_Azure SQL DB_* due to lack of support for Extended Events. 106 | 107 | To enable this widget add the following json to either your user or workspace settings in the *dashboard.server.widgets* section. 108 | 109 | ```json 110 | { 111 | "name": "XEL Memory Stats", 112 | "widget": { 113 | "mssql-instance-xelmemory": null 114 | } 115 | } 116 | ``` -------------------------------------------------------------------------------- /archive/mssql-instance-insights/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mssql-instance-insights", 3 | "version": "0.1.0", 4 | "publisher": "matticusau", 5 | "license": "MIT", 6 | "author": { 7 | "email": "matt.lavery@outlook.com", 8 | "name": "Matt Lavery", 9 | "url": "http://www.matticusau.net" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/matticusau/sqlops-widgets" 14 | }, 15 | "bugs": { 16 | "url": "https://github.com/matticusau/sqlops-widgets/issues", 17 | "email": "matt.lavery@outlook.com" 18 | }, 19 | "engines": { 20 | "vscode": "*" 21 | }, 22 | "categories": [ 23 | "Other" 24 | ], 25 | "keywords": [ 26 | "sqlops", 27 | "sql", 28 | "sqlops-studio", 29 | "studio" 30 | ], 31 | "homepage": "https://github.com/matticusau/sqlops-widgets", 32 | "contributes": { 33 | "insights": [ 34 | { 35 | "id": "mssql-instance-waits", 36 | "contrib": { 37 | "name": "Top 10 Waits", 38 | "provider": "MSSQL", 39 | "edition": [0,1,2,3,4], 40 | "gridItemConfig": { 41 | "x": 2, 42 | "y": 1 43 | }, 44 | "type": { 45 | "horizontalBar": { 46 | "dataDirection": "vertical", 47 | "dataType": "number", 48 | "legendPosition": "none", 49 | "labelFirstColumn": false, 50 | "columnsAsLabels": false 51 | } 52 | }, 53 | "queryFile": "./sql/mssql-instance-waits.sql", 54 | "details": { 55 | "queryFile": "./sql/mssql-instance-waits-detail.sql", 56 | "label": { 57 | "icon": "database", 58 | "column": "WaitType", 59 | "state": [ 60 | { 61 | "condition": { 62 | "if": "greaterthan", 63 | "greaterthan": "80" 64 | }, 65 | "color": "red" 66 | }, 67 | { 68 | "condition": { 69 | "if": "greaterthan", 70 | "greaterthan": "40" 71 | }, 72 | "color": "orange" 73 | }, 74 | { 75 | "condition": { 76 | "if": "lessthan", 77 | "lessthan": "41" 78 | }, 79 | "color": "green" 80 | } 81 | ] 82 | }, 83 | "value": "Percentage", 84 | "actions": null 85 | } 86 | } 87 | }, 88 | { 89 | "id": "mssql-instance-xelsystem", 90 | "contrib": { 91 | "name": "XEL System Stats", 92 | "provider": "MSSQL", 93 | "edition": [0,1,2,3,4], 94 | "gridItemConfig": { 95 | "x": 2, 96 | "y": 2 97 | }, 98 | "type": { 99 | "line": { 100 | "dataDirection": "vertical", 101 | "dataType": "number", 102 | "legendPosition": "bottom", 103 | "labelFirstColumn": false, 104 | "columnsAsLabels": true 105 | } 106 | }, 107 | "queryFile": "./sql/mssql-instance-xelsystem.sql", 108 | "details": { 109 | "queryFile": "./sql/mssql-instance-xelsystem.sql", 110 | "label": { 111 | "icon": "database", 112 | "column": "Event Time", 113 | "state": [ 114 | { 115 | "condition": { 116 | "if": "greaterthan", 117 | "greaterthan": "0" 118 | }, 119 | "color": "red" 120 | }, 121 | { 122 | "condition": { 123 | "if": "equals", 124 | "equals": "0" 125 | }, 126 | "color": "green" 127 | } 128 | ] 129 | }, 130 | "value": "Non Yields Reported", 131 | "actions": null 132 | } 133 | } 134 | }, 135 | { 136 | "id": "mssql-instance-xelio", 137 | "contrib": { 138 | "name": "XEL IO Stats", 139 | "provider": "MSSQL", 140 | "edition": [0,1,2,3,4], 141 | "gridItemConfig": { 142 | "x": 2, 143 | "y": 2 144 | }, 145 | "type": { 146 | "line": { 147 | "dataDirection": "vertical", 148 | "dataType": "number", 149 | "legendPosition": "bottom", 150 | "labelFirstColumn": false, 151 | "columnsAsLabels": true 152 | } 153 | }, 154 | "queryFile": "./sql/mssql-instance-xelio.sql", 155 | "details": { 156 | "queryFile": "./sql/mssql-instance-xelio.sql", 157 | "label": { 158 | "icon": "database", 159 | "column": "Event Time", 160 | "state": [ 161 | { 162 | "condition": { 163 | "if": "greaterthan", 164 | "greaterthan": "0" 165 | }, 166 | "color": "red" 167 | }, 168 | { 169 | "condition": { 170 | "if": "equals", 171 | "equals": "0" 172 | }, 173 | "color": "green" 174 | } 175 | ] 176 | }, 177 | "value": "Total Long IOs", 178 | "actions": null 179 | } 180 | } 181 | }, 182 | { 183 | "id": "mssql-instance-xelmemory", 184 | "contrib": { 185 | "name": "XEL Memory Stats", 186 | "provider": "MSSQL", 187 | "edition": [0,1,2,3,4], 188 | "gridItemConfig": { 189 | "x": 2, 190 | "y": 2 191 | }, 192 | "type": { 193 | "line": { 194 | "dataDirection": "vertical", 195 | "dataType": "number", 196 | "legendPosition": "bottom", 197 | "labelFirstColumn": false, 198 | "columnsAsLabels": true 199 | } 200 | }, 201 | "queryFile": "./sql/mssql-instance-xelmemory.sql", 202 | "details": { 203 | "queryFile": "./sql/mssql-instance-xelmemory.sql", 204 | "label": { 205 | "icon": "database", 206 | "column": "Event Time", 207 | "state": [ 208 | { 209 | "condition": { 210 | "if": "lessthan", 211 | "lessthan": "4" 212 | }, 213 | "color": "orange" 214 | }, 215 | { 216 | "condition": { 217 | "if": "greaterthan", 218 | "greaterthan": "4" 219 | }, 220 | "color": "green" 221 | } 222 | ] 223 | }, 224 | "value": "Available Physical Memory (GB)", 225 | "actions": null 226 | } 227 | } 228 | } 229 | ] 230 | } 231 | } -------------------------------------------------------------------------------- /archive/mssql-instance-insights/sql/mssql-instance-waits-detail.sql: -------------------------------------------------------------------------------- 1 | -- Reference: https://www.sqlskills.com/blogs/paul/wait-statistics-or-please-tell-me-where-it-hurts/ 2 | 3 | WITH [Waits] AS 4 | (SELECT 5 | [wait_type], 6 | [wait_time_ms] / 1000.0 AS [WaitS], 7 | ([wait_time_ms] - [signal_wait_time_ms]) / 1000.0 AS [ResourceS], 8 | [signal_wait_time_ms] / 1000.0 AS [SignalS], 9 | [waiting_tasks_count] AS [WaitCount], 10 | 100.0 * [wait_time_ms] / SUM ([wait_time_ms]) OVER() AS [Percentage], 11 | ROW_NUMBER() OVER(ORDER BY [wait_time_ms] DESC) AS [RowNum] 12 | FROM sys.dm_os_wait_stats 13 | WHERE [wait_type] NOT IN ( 14 | N'BROKER_EVENTHANDLER', N'BROKER_RECEIVE_WAITFOR', 15 | N'BROKER_TASK_STOP', N'BROKER_TO_FLUSH', 16 | N'BROKER_TRANSMITTER', N'CHECKPOINT_QUEUE', 17 | N'CHKPT', N'CLR_AUTO_EVENT', 18 | N'CLR_MANUAL_EVENT', N'CLR_SEMAPHORE', 19 | 20 | -- Maybe comment these four out if you have mirroring issues 21 | N'DBMIRROR_DBM_EVENT', N'DBMIRROR_EVENTS_QUEUE', 22 | N'DBMIRROR_WORKER_QUEUE', N'DBMIRRORING_CMD', 23 | 24 | N'DIRTY_PAGE_POLL', N'DISPATCHER_QUEUE_SEMAPHORE', 25 | N'EXECSYNC', N'FSAGENT', 26 | N'FT_IFTS_SCHEDULER_IDLE_WAIT', N'FT_IFTSHC_MUTEX', 27 | 28 | -- Maybe comment these six out if you have AG issues 29 | N'HADR_CLUSAPI_CALL', N'HADR_FILESTREAM_IOMGR_IOCOMPLETION', 30 | N'HADR_LOGCAPTURE_WAIT', N'HADR_NOTIFICATION_DEQUEUE', 31 | N'HADR_TIMER_TASK', N'HADR_WORK_QUEUE', 32 | 33 | N'KSOURCE_WAKEUP', N'LAZYWRITER_SLEEP', 34 | N'LOGMGR_QUEUE', N'MEMORY_ALLOCATION_EXT', 35 | N'ONDEMAND_TASK_QUEUE', 36 | N'PREEMPTIVE_XE_GETTARGETSTATE', 37 | N'PWAIT_ALL_COMPONENTS_INITIALIZED', 38 | N'PWAIT_DIRECTLOGCONSUMER_GETNEXT', 39 | N'QDS_PERSIST_TASK_MAIN_LOOP_SLEEP', N'QDS_ASYNC_QUEUE', 40 | N'QDS_CLEANUP_STALE_QUERIES_TASK_MAIN_LOOP_SLEEP', 41 | N'QDS_SHUTDOWN_QUEUE', N'REDO_THREAD_PENDING_WORK', 42 | N'REQUEST_FOR_DEADLOCK_SEARCH', N'RESOURCE_QUEUE', 43 | N'SERVER_IDLE_CHECK', N'SLEEP_BPOOL_FLUSH', 44 | N'SLEEP_DBSTARTUP', N'SLEEP_DCOMSTARTUP', 45 | N'SLEEP_MASTERDBREADY', N'SLEEP_MASTERMDREADY', 46 | N'SLEEP_MASTERUPGRADED', N'SLEEP_MSDBSTARTUP', 47 | N'SLEEP_SYSTEMTASK', N'SLEEP_TASK', 48 | N'SLEEP_TEMPDBSTARTUP', N'SNI_HTTP_ACCEPT', 49 | N'SP_SERVER_DIAGNOSTICS_SLEEP', N'SQLTRACE_BUFFER_FLUSH', 50 | N'SQLTRACE_INCREMENTAL_FLUSH_SLEEP', 51 | N'SQLTRACE_WAIT_ENTRIES', N'WAIT_FOR_RESULTS', 52 | N'WAITFOR', N'WAITFOR_TASKSHUTDOWN', 53 | N'WAIT_XTP_RECOVERY', 54 | N'WAIT_XTP_HOST_WAIT', N'WAIT_XTP_OFFLINE_CKPT_NEW_LOG', 55 | N'WAIT_XTP_CKPT_CLOSE', N'XE_DISPATCHER_JOIN', 56 | N'XE_DISPATCHER_WAIT', N'XE_TIMER_EVENT') 57 | AND [waiting_tasks_count] > 0 58 | ) 59 | SELECT 60 | MAX ([W1].[wait_type]) AS [WaitType], 61 | CAST (MAX ([W1].[WaitS]) AS DECIMAL (16,2)) AS [Wait_S], 62 | CAST (MAX ([W1].[ResourceS]) AS DECIMAL (16,2)) AS [Resource_S], 63 | CAST (MAX ([W1].[SignalS]) AS DECIMAL (16,2)) AS [Signal_S], 64 | MAX ([W1].[WaitCount]) AS [WaitCount], 65 | CAST (MAX ([W1].[Percentage]) AS DECIMAL (5,2)) AS [Percentage], 66 | CAST ((MAX ([W1].[WaitS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgWait_S], 67 | CAST ((MAX ([W1].[ResourceS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgRes_S], 68 | CAST ((MAX ([W1].[SignalS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgSig_S] 69 | --, 70 | --CAST ('https://www.sqlskills.com/help/waits/' + MAX ([W1].[wait_type]) as XML) AS [Help/Info URL] 71 | FROM [Waits] AS [W1] 72 | INNER JOIN [Waits] AS [W2] 73 | ON [W2].[RowNum] <= [W1].[RowNum] 74 | GROUP BY [W1].[RowNum] 75 | HAVING SUM ([W2].[Percentage]) - MAX( [W1].[Percentage] ) < 95; -- percentage threshold 76 | GO -------------------------------------------------------------------------------- /archive/mssql-instance-insights/sql/mssql-instance-waits.sql: -------------------------------------------------------------------------------- 1 | -- Reference: https://www.sqlskills.com/blogs/paul/wait-statistics-or-please-tell-me-where-it-hurts/ 2 | 3 | WITH [Waits] AS 4 | (SELECT 5 | [wait_type], 6 | [wait_time_ms] / 1000.0 AS [WaitS], 7 | ([wait_time_ms] - [signal_wait_time_ms]) / 1000.0 AS [ResourceS], 8 | [signal_wait_time_ms] / 1000.0 AS [SignalS], 9 | [waiting_tasks_count] AS [WaitCount], 10 | 100.0 * [wait_time_ms] / SUM ([wait_time_ms]) OVER() AS [Percentage], 11 | ROW_NUMBER() OVER(ORDER BY [wait_time_ms] DESC) AS [RowNum] 12 | FROM sys.dm_os_wait_stats 13 | WHERE [wait_type] NOT IN ( 14 | N'BROKER_EVENTHANDLER', N'BROKER_RECEIVE_WAITFOR', 15 | N'BROKER_TASK_STOP', N'BROKER_TO_FLUSH', 16 | N'BROKER_TRANSMITTER', N'CHECKPOINT_QUEUE', 17 | N'CHKPT', N'CLR_AUTO_EVENT', 18 | N'CLR_MANUAL_EVENT', N'CLR_SEMAPHORE', 19 | 20 | -- Maybe comment these four out if you have mirroring issues 21 | N'DBMIRROR_DBM_EVENT', N'DBMIRROR_EVENTS_QUEUE', 22 | N'DBMIRROR_WORKER_QUEUE', N'DBMIRRORING_CMD', 23 | 24 | N'DIRTY_PAGE_POLL', N'DISPATCHER_QUEUE_SEMAPHORE', 25 | N'EXECSYNC', N'FSAGENT', 26 | N'FT_IFTS_SCHEDULER_IDLE_WAIT', N'FT_IFTSHC_MUTEX', 27 | 28 | -- Maybe comment these six out if you have AG issues 29 | N'HADR_CLUSAPI_CALL', N'HADR_FILESTREAM_IOMGR_IOCOMPLETION', 30 | N'HADR_LOGCAPTURE_WAIT', N'HADR_NOTIFICATION_DEQUEUE', 31 | N'HADR_TIMER_TASK', N'HADR_WORK_QUEUE', 32 | 33 | N'KSOURCE_WAKEUP', N'LAZYWRITER_SLEEP', 34 | N'LOGMGR_QUEUE', N'MEMORY_ALLOCATION_EXT', 35 | N'ONDEMAND_TASK_QUEUE', 36 | N'PREEMPTIVE_XE_GETTARGETSTATE', 37 | N'PWAIT_ALL_COMPONENTS_INITIALIZED', 38 | N'PWAIT_DIRECTLOGCONSUMER_GETNEXT', 39 | N'QDS_PERSIST_TASK_MAIN_LOOP_SLEEP', N'QDS_ASYNC_QUEUE', 40 | N'QDS_CLEANUP_STALE_QUERIES_TASK_MAIN_LOOP_SLEEP', 41 | N'QDS_SHUTDOWN_QUEUE', N'REDO_THREAD_PENDING_WORK', 42 | N'REQUEST_FOR_DEADLOCK_SEARCH', N'RESOURCE_QUEUE', 43 | N'SERVER_IDLE_CHECK', N'SLEEP_BPOOL_FLUSH', 44 | N'SLEEP_DBSTARTUP', N'SLEEP_DCOMSTARTUP', 45 | N'SLEEP_MASTERDBREADY', N'SLEEP_MASTERMDREADY', 46 | N'SLEEP_MASTERUPGRADED', N'SLEEP_MSDBSTARTUP', 47 | N'SLEEP_SYSTEMTASK', N'SLEEP_TASK', 48 | N'SLEEP_TEMPDBSTARTUP', N'SNI_HTTP_ACCEPT', 49 | N'SP_SERVER_DIAGNOSTICS_SLEEP', N'SQLTRACE_BUFFER_FLUSH', 50 | N'SQLTRACE_INCREMENTAL_FLUSH_SLEEP', 51 | N'SQLTRACE_WAIT_ENTRIES', N'WAIT_FOR_RESULTS', 52 | N'WAITFOR', N'WAITFOR_TASKSHUTDOWN', 53 | N'WAIT_XTP_RECOVERY', 54 | N'WAIT_XTP_HOST_WAIT', N'WAIT_XTP_OFFLINE_CKPT_NEW_LOG', 55 | N'WAIT_XTP_CKPT_CLOSE', N'XE_DISPATCHER_JOIN', 56 | N'XE_DISPATCHER_WAIT', N'XE_TIMER_EVENT') 57 | AND [waiting_tasks_count] > 0 58 | ) 59 | SELECT TOP 10 60 | MAX ([W1].[wait_type]) AS [WaitType], 61 | --CAST (MAX ([W1].[WaitS]) AS DECIMAL (16,2)) AS [Wait_S], 62 | CAST (MAX ([W1].[ResourceS]) AS DECIMAL (16,2)) AS [Resource_S] 63 | --, 64 | -- CAST (MAX ([W1].[SignalS]) AS DECIMAL (16,2)) AS [Signal_S], 65 | -- MAX ([W1].[WaitCount]) AS [WaitCount], 66 | -- CAST (MAX ([W1].[Percentage]) AS DECIMAL (5,2)) AS [Percentage], 67 | -- CAST ((MAX ([W1].[WaitS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgWait_S], 68 | -- CAST ((MAX ([W1].[ResourceS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgRes_S], 69 | -- CAST ((MAX ([W1].[SignalS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgSig_S], 70 | -- CAST ('https://www.sqlskills.com/help/waits/' + MAX ([W1].[wait_type]) as XML) AS [Help/Info URL] 71 | FROM [Waits] AS [W1] 72 | INNER JOIN [Waits] AS [W2] 73 | ON [W2].[RowNum] <= [W1].[RowNum] 74 | GROUP BY [W1].[RowNum] 75 | HAVING SUM ([W2].[Percentage]) - MAX( [W1].[Percentage] ) < 95; -- percentage threshold 76 | GO -------------------------------------------------------------------------------- /archive/mssql-instance-insights/sql/mssql-instance-xelio.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: Matticusau 3 | -- Purpose: Provides IO performance data from Extended Events System Health Session 4 | -- License: https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE 5 | -- Credit to: https://troubleshootingsql.com/2013/07/25/powerview-and-system-health-session-io-health/ 6 | -- 7 | SET NOCOUNT ON 8 | -- Fetch data only if SQL 2012 or higher (Extended Events schema changed between 2008 R2 and 2012) 9 | IF (SUBSTRING(CAST(SERVERPROPERTY ('ProductVersion') AS varchar(50)),1,CHARINDEX('.',CAST(SERVERPROPERTY ('ProductVersion') AS varchar(50)))-1) >= 11) 10 | BEGIN 11 | -- Get UTC time difference for reporting event times local to server time 12 | DECLARE @UTCDateDiff int = DATEDIFF(mi,GETUTCDATE(),GETDATE()); 13 | 14 | -- Store XML data retrieved in temp table 15 | SELECT TOP 1 CAST(xet.target_data AS XML) AS XMLDATA 16 | INTO #SystemHealthSessionData 17 | FROM sys.dm_xe_session_targets xet 18 | JOIN sys.dm_xe_sessions xe ON (xe.address = xet.event_session_address) 19 | WHERE xe.name = 'system_health' 20 | AND xet.target_name = 'ring_buffer'; 21 | 22 | -- Parse XML data and provide required values in the form of a table 23 | ;WITH CTE_HealthSession (EventXML) AS 24 | ( 25 | SELECT C.query('.') EventXML 26 | FROM #SystemHealthSessionData a 27 | CROSS APPLY a.XMLDATA.nodes('/RingBufferTarget/event') as T(C) 28 | ) 29 | SELECT 30 | DATEADD(mi,@UTCDateDiff,EventXML.value('(/event/@timestamp)[1]','datetime')) as [Event Time], 31 | EventXML.value('(/event/data/text)[1]','varchar(255)') as Component, 32 | EventXML.value('(/event/data/value/ioSubsystem/@ioLatchTimeouts)[1]','bigint') as [IO Latch Timeouts], 33 | EventXML.value('(/event/data/value/ioSubsystem/@totalLongIos)[1]','bigint') as [Total Long IOs], 34 | ISNULL(EventXML.value('(/event/data/value/ioSubsystem/longestPendingRequests/pendingRequest/@filePath)[1]','varchar(8000)'),'') as [Longest Pending Request File], 35 | ISNULL(EventXML.value('(/event/data/value/ioSubsystem/longestPendingRequests/pendingRequest/@duration)[1]','bigint'),0) as [Longest Pending IO Duration] 36 | FROM CTE_HealthSession 37 | WHERE EventXML.value('(/event/@name)[1]', 'varchar(255)') = 'sp_server_diagnostics_component_result' 38 | AND EventXML.value('(/event/data/text)[1]','varchar(255)') = 'IO_SUBSYSTEM' 39 | AND DATEADD(mi,@UTCDateDiff,EventXML.value('(/event/@timestamp)[1]','datetime')) >= DATEADD(mi, -240, GETUTCDATE()) 40 | ORDER BY [Event Time]; 41 | 42 | -- Clean up 43 | DROP TABLE #SystemHealthSessionData 44 | 45 | END -------------------------------------------------------------------------------- /archive/mssql-instance-insights/sql/mssql-instance-xelmemory.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: Matticusau 3 | -- Purpose: Provides Memory performance data from Extended Events System Health Session 4 | -- License: https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE 5 | -- Credit to: https://troubleshootingsql.com/2013/07/19/powerview-and-system-health-sessionsql-memory-health/ 6 | -- 7 | SET NOCOUNT ON 8 | -- Fetch data only if SQL 2012 or higher (Extended Events schema changed between 2008 R2 and 2012) 9 | IF (SUBSTRING(CAST(SERVERPROPERTY ('ProductVersion') AS varchar(50)),1,CHARINDEX('.',CAST(SERVERPROPERTY ('ProductVersion') AS varchar(50)))-1) >= 11) 10 | BEGIN 11 | -- Get UTC time difference for reporting event times local to server time 12 | DECLARE @UTCDateDiff int = DATEDIFF(mi,GETUTCDATE(),GETDATE()); 13 | 14 | -- Store XML data retrieved in temp table 15 | SELECT TOP 1 CAST(xet.target_data AS XML) AS XMLDATA 16 | INTO #SystemHealthSessionData 17 | FROM sys.dm_xe_session_targets xet 18 | JOIN sys.dm_xe_sessions xe ON (xe.address = xet.event_session_address) 19 | WHERE xe.name = 'system_health' 20 | AND xet.target_name = 'ring_buffer'; 21 | 22 | -- Parse XML data and provide required values in the form of a table 23 | ;WITH CTE_HealthSession (EventXML) AS 24 | ( 25 | SELECT C.query('.') EventXML 26 | FROM #SystemHealthSessionData a 27 | CROSS APPLY a.XMLDATA.nodes('/RingBufferTarget/event') as T(C) 28 | ) 29 | SELECT 30 | DATEADD(mi,@UTCDateDiff,EventXML.value('(/event/@timestamp)[1]','datetime')) as [Event Time], 31 | EventXML.value('(/event/data/text)[1]','varchar(255)') as Component, 32 | EventXML.value('(/event/data/value/resource/@outOfMemoryExceptions)[1]','bigint') as [OOM Exceptions], 33 | EventXML.value('(/event/data/value/resource/memoryReport/entry/@value)[1]','bigint')/(1024*1024*1024) as [Available Physical Memory (GB)], 34 | EventXML.value('(/event/data/value/resource/memoryReport/entry/@value)[3]','bigint')/(1024*1024*1024) as [Available Paging File (GB)], 35 | EventXML.value('(/event/data/value/resource/memoryReport/entry/@value)[5]','int') as [Percent of Committed Memory in WS], 36 | EventXML.value('(/event/data/value/resource/memoryReport/entry/@value)[6]','bigint') as [Page Faults], 37 | EventXML.value('(/event/data/value/resource/memoryReport/entry/@value)[12]','bigint')/1024 as [VM Committed (MB)], 38 | EventXML.value('(/event/data/value/resource/memoryReport/entry/@value)[13]','bigint')/(1024*1024) as [Locked Pages Allocated (GB)], 39 | EventXML.value('(/event/data/value/resource/memoryReport/entry/@value)[14]','bigint')/(1024*1024) as [Large Pages Allocated (GB)], 40 | EventXML.value('(/event/data/value/resource/memoryReport/entry/@value)[17]','bigint')/(1024*1024) as [Target Committed (GB)], 41 | EventXML.value('(/event/data/value/resource/memoryReport/entry/@value)[18]','bigint')/(1024*1024) as [Current Committed (GB)] 42 | FROM CTE_HealthSession 43 | WHERE EventXML.value('(/event/@name)[1]', 'varchar(255)') = 'sp_server_diagnostics_component_result' 44 | AND EventXML.value('(/event/data/text)[1]','varchar(255)') = 'RESOURCE' 45 | AND DATEADD(mi,@UTCDateDiff,EventXML.value('(/event/@timestamp)[1]','datetime')) >= DATEADD(mi, -240, GETUTCDATE()) 46 | ORDER BY [Event Time] desc; 47 | 48 | -- Clean Up 49 | DROP TABLE #SystemHealthSessionData 50 | 51 | END -------------------------------------------------------------------------------- /archive/mssql-instance-insights/sql/mssql-instance-xelsystem.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: Matticusau 3 | -- Purpose: Provides general System performance data from Extended Events System Health Session 4 | -- License: https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE 5 | -- Credit to: https://troubleshootingsql.com/2013/08/02/powerview-and-system-health-session-system/ 6 | -- 7 | SET NOCOUNT ON 8 | -- Fetch data only if SQL 2012 or higher (Extended Events schema changed between 2008 R2 and 2012) 9 | IF (SUBSTRING(CAST(SERVERPROPERTY ('ProductVersion') AS varchar(50)),1,CHARINDEX('.',CAST(SERVERPROPERTY ('ProductVersion') AS varchar(50)))-1) >= 11) 10 | BEGIN 11 | -- Get UTC time difference for reporting event times local to server time 12 | DECLARE @UTCDateDiff int = DATEDIFF(mi,GETUTCDATE(),GETDATE()); 13 | 14 | -- Store XML data retrieved in temp table 15 | SELECT TOP 1 CAST(xet.target_data AS XML) AS XMLDATA 16 | INTO #SystemHealthSessionData 17 | FROM sys.dm_xe_session_targets xet 18 | JOIN sys.dm_xe_sessions xe ON (xe.address = xet.event_session_address) 19 | WHERE xe.name = 'system_health' 20 | AND xet.target_name = 'ring_buffer'; 21 | 22 | -- Parse XML data and provide required values in the form of a table 23 | ;WITH CTE_HealthSession (EventXML) AS 24 | ( 25 | SELECT C.query('.') EventXML 26 | FROM #SystemHealthSessionData a 27 | CROSS APPLY a.XMLDATA.nodes('/RingBufferTarget/event') as T(C) 28 | ) 29 | SELECT 30 | DATEADD(mi,@UTCDateDiff,EventXML.value('(/event/@timestamp)[1]','datetime')) as [Event Time], 31 | EventXML.value('(/event/data/text)[1]','varchar(255)') as Component, 32 | EventXML.value('(/event/data/value/system/@latchWarnings)[1]','bigint') as [Latch Warnings], 33 | EventXML.value('(/event/data/value/system/@isAccessViolationOccurred)[1]','bigint') as [Access Violations], 34 | EventXML.value('(/event/data/value/system/@nonYieldingTasksReported)[1]','bigint') as [Non Yields Reported], 35 | EventXML.value('(/event/data/value/system/@BadPagesDetected)[1]','bigint') as [Bad Pages Detected], 36 | EventXML.value('(/event/data/value/system/@BadPagesFixed)[1]','bigint') as [Bad Pages Fixed] 37 | FROM CTE_HealthSession 38 | WHERE EventXML.value('(/event/@name)[1]', 'varchar(255)') = 'sp_server_diagnostics_component_result' 39 | AND EventXML.value('(/event/data/text)[1]','varchar(255)') = 'SYSTEM' 40 | AND DATEADD(mi,@UTCDateDiff,EventXML.value('(/event/@timestamp)[1]','datetime')) >= DATEADD(mi, -240, GETUTCDATE()) 41 | ORDER BY [Event Time]; 42 | 43 | -- Clean Up 44 | DROP TABLE #SystemHealthSessionData 45 | 46 | END --------------------------------------------------------------------------------