Actions
Actions module is responsible for sending notifications and performing different tasks.
Definition
Action definition is stored in table [dbo].[sqlwatch_config_action]
Action executable
Executable can either be a command action_exec
or a report action_report_id
but not both. The action_exec
expects optional parameters {SUBJECT}
and {BODY}
which are defined by the template.
If action triggers a report, the content of the report will be embedded in the {BODY}
and action associated with the given report called instead:
This way we can also call stand alone reports that are not triggered by checks, for example daily or weekly Server overview report or even business reports.
Actions are executed by a PowerShell step in the SQL Server agent job and there are currently two types supported T-SQL
and PowerShell
which are invoked by either by Invoke-SqlCmd
or Invoke-Expression
Templates
Actions support templates. For example, we may want a short description in the Pushover notification and more details in an email notification.
Templates are defined in [dbo].[sqlwatch_config_check_action_template]
. Each status (OK, WARNING and CRITICAL) has its own subject and body templates which generate {SUBJECT}
and {BODY}
content required by the action_exec
To make it easier to build custom templates, a number of variables have been exposed for the end user:
For example, if we have a simple check that does not call a report, the following plain text template:
Will result in the following content:
In addition, actions that trigger reports have these variables exposed:
For example, if we have a check that calls Disk Utilisation Report, the following action template (note the HTML
tags and the Report Content section):
Will generate the following report:
Attributes
Each action's attributes are defined for each in the association table [dbo].[sqlwatch_config_check_action]
and can differ for each combination of check and action
Last updated