LogoLogo
ReleasesHomepageBlogSlack
3.0
3.0
  • Welcome
  • Concept
  • SQLWATCH Database
    • Requirements
      • Permissions
      • Performance Overhead
      • Storage Utilisation
    • Installation
      • Install with dbatools
      • Install with SqlPackage
      • Install with SSMS
      • Deploy from source code
      • Optional Components
      • Upgrade
      • Removal
      • Downgrade
    • Configuration
    • Known Issues
      • Collation conflict
      • Database drift
      • Login failed error when running disk logger
      • Deadlock when creating database
    • Notifications
      • Checks
      • Actions
      • Reports
      • How To
        • Add or modify check
        • Add or modify action
        • Add or modify report
      • Process Flow
    • Large Environments
  • Central Repository
    • Requirements
      • Performance overhead on the remote instance
      • Permissions
    • Installation
      • Removal
      • Upgrade
    • Configuration
    • Known Issues
  • Power BI Dashboard
    • Requirements
      • Permissions
    • Installation
    • Configuration
    • Known Issues
      • Power BI Load Errors
    • Performance
  • Grafana Dashboard
    • Requirements
    • Installation
    • Configuration
  • Azure Log Analytics Dashboard
    • Concept
    • Requirements
    • Installation
    • Configuration
  • Design Decision
    • Relations
    • Trend Tables
    • Data Types
      • Real Type
    • Primary Keys
    • Data Compression
    • Configuration Items
    • Using Apply instead of Join
  • Reference
    • Data-Tier Application Package
  • Integrations
    • Send notifications to Slack and Teams
    • dbachecks
  • FAQ
    • How do I check if SQLWATCH is running OK?
    • I am not seeing any data in Power BI
    • Can I modify default checks?
    • The app_log is growing fast
Powered by GitBook
On this page
  • Add new action
  • Modify existing action
  • Delete Action

Was this helpful?

  1. SQLWATCH Database
  2. Notifications
  3. How To

Add or modify action

Add new action

To add new action we can execute a stored procedure:

exec [dbo].[usp_sqlwatch_user_add_action]
	,@action_description = 'Send Email to DBAs using sp_send_mail  (HTML)'
	,@action_exec_type = 'T-SQL'
	,@action_exec = 'exec msdb.dbo.sp_send_dbmail @recipients = ''dba@yourcompany.com'',
@subject = ''{SUBJECT}'',
@body = ''{BODY}'',
@profile_name=''DBA'',
@body_format = ''HTML'''
	,@action_enabled = 0

Or insert directly into the action table:

insert into [dbo].[sqlwatch_config_action]
values (...)

Modify existing action

To modify existing action, we can either re-run the procedure passing action_id:

exec [dbo].[usp_sqlwatch_user_add_action]
	 -- pass action id to replace / update:
	 @action_id = 1
	,@action_description = 'Send Email to DBAs using sp_send_mail  (HTML)'
	,@action_exec_type = 'T-SQL'
	,@action_exec = 'exec msdb.dbo.sp_send_dbmail @recipients = ''dba@yourcompany.com'',
@subject = ''{SUBJECT}'',
@body = ''{BODY}'',
@profile_name=''DBA'',
@body_format = ''HTML'''
	,@action_enabled = 0

Or we can update action table directly:

update [dbo].[sqlwatch_config_action]
    set ...
    where action_id = 1

Delete Action

To delete existing action simply delete it from the actions table and all associated logger records will also be deleted:

delete from [dbo].[sqlwatch_config_action]
    where action_id = 1

Note that you cannot delete an action if there are checks or reports using that action. Please first delete or disassociate checks and reports and then delete the action.

PreviousAdd or modify checkNextAdd or modify report

Last updated 5 years ago

Was this helpful?