Alert scripting

A raised alert typically indicates a network, application, or performance problem that requires issuing an incident ticket into the tracking system or adding an entry to a system log. To automate this process, the report server can run a custom script when an alert is triggered.

Alert system concept
Alert system concept

The following examples present Microsoft PowerShell v.4 scripts to deliver the notification:

Before you start

Which scripting languages can I use?

You can use any scripting language as long as its interpreter is installed on the report server. Our examples all use the Windows PowerShell scripting included in standard Windows Server deployments.

Windows user rights

Make sure that the user running the CAS service has sufficient permissions to execute your scripts.

Delivering alert notification as ServiceNow incident

In this example, we create a PowerShell script which, when it is triggered, generates a message that automatically creates an incident item in the ServiceNow system.

Using the available parameters, we modify the alert notification to automatically generate a URL pointing to the CAS report containing detailed information about the reported problem. Though this URL will be passed to the ServiceNow in the script as part of the notification message, we also pass this URL as a separate script parameter which is inserted in the custom clickable form field in the ServiceNow Incident form.

You can use the REST API or SOAP API to pass the message to the ServiceNow system. Both methods require preparation of the ServiceNow system. For more information, see Configuring ServiceNow Web Services Security Profile and Configuring ServiceNow User and assigning roles.

Before configuring the script recipient, make sure you have the following information:

  • ServiceNow username and password.

  • ServiceNow URL

https://my-instance.service-now.com/imp_notification.do?SOAP

If you plan to deliver the notification using SOAP and report it in ServiceNow as an incident.

https://my-instance.service-now.com/api/now/table/em_event

If you plan to deliver the notification using REST and report it in ServiceNow as an event.

https://my-instance.service-now.com/api/now/table/incident

If you plan to deliver the notification using REST and report it in ServiceNow as an incident.