This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >= 8760 then [day] //if window >= 1 year, aggregate over 1 day | |
| >= 168 then [1_hour] //if window >= 1 week, aggregate over 1 hour | |
| > 24 then [15_minutes] //if window > 24 hours, aggregate over 15 minutes | |
| > 1 then [5_minutes] //if window > 1 hour, aggregate over 5 minutes | |
| > 0 then [time] //if window > 0 hours, no aggregation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select @output=min(free_space_percentage) | |
| from dbo.vw_sqlwatch_report_dim_os_volume | |
| where sql_instance = @@SERVERNAME | |
| and free_space_percentage is not null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exec msdb.dbo.sp_send_dbmail | |
| @recipients = 'dba@yourcompany.com', | |
| @subject = '{SUBJECT}', | |
| @body = '{BODY}', | |
| @profile_name='SQLWATCH', | |
| @body_format = 'HTML' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Send-MailMessage ` | |
| -From 'DBA <dba@yourcompany.com>' ` | |
| -To 'dba@yourcompany.com' ` | |
| -Subject "{SUBJECT}" ` | |
| -Body "{BODY}" ` | |
| -SmtpServer "smtp.yourcompany.com" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $uri = "https://api.pushover.net/1/messages.json" | |
| $parameters = @{ | |
| token = "YOUR_TOKEN" | |
| user = "USER_TOKEN" | |
| message = "{SUBJECT} {BODY}" | |
| } | |
| $parameters | Invoke-RestMethod -Uri $uri -Method Post |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "{BODY}" | Out-File -FilePath \\yourshare\Folder\trigger.dat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Invoke-Sqlcmd ` | |
| -ServerInstance localhost ` | |
| -Database SQLWATCH ` | |
| -Query "{BODY}" ` | |
| | C:SQLWATCHPSUpload-AzMonitorLog.ps1 ` | |
| -WorkspaceId YOURWORKSPACEID ` | |
| -WorkspaceKey YOURWORKSPACEKEY ` | |
| -LogTypeName "{SUBJECT}" ` | |
| -AddComputerName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Install-DbaSqlWatch -SqlInstance SQLSERVER1,SQLSERVER2,SQLSERVER3 -Database SQLWATCH |