Configuring Alert Rule Actions

Overview

Alert rules can be configured with alert actions, which are a set of conditions that when transitioning from false to true will fire. What fire means is the 0-to-N configured alert actions are executed.

Most alert actions are enabled by default where security impact is not an issue, and therefore explicitly configuring those actions is not required. Alert actions that are disabled by default require appropriate user privileges and system properties to be enabled.

The next sections describe the available alert actions and configuration in detail.

Alert Action: Send Email

Overview

This action sends an email when the alert is triggered.

Configuration

This action requires that you supply one of the following minimum email parameters in your applicable LiveView client:

  • To

  • cc

  • Bcc

Note

Subject and Body are optional and recommended.

LiveView Server readiness

Configure email settings as a system property in your LiveView project's LiveView engine configuration file as required:

liveview.alert.email.from = Sender's Email ID
liveview.alert.email.replyto = Reply to Email ID
liveview.alert.email.smtpclient = null
liveview.alert.email.smtpServer = smtp server
liveview.alert.email.smtpPort = smtp port
liveview.alert.email.useAuthentication = true or false
liveview.alert.email.useSSL = true or false
liveview.alert.email.username = username
liveview.alert.email.password = password
liveview.alert.email.enableSMTPDebugging = true or false

For example:

systemProperties = {
  "liveview.alert.email.from" = "foo@example.com"
  "liveview.alert.email.replyto" = "foo@example.com"
  "liveview.alert.email.smtpclient" = "null"
  "liveview.alert.email.smtpServer" = "smtp.example.com"
  "liveview.alert.email.smtpPort" = "465"
  "liveview.alert.email.useAuthentication" = "true"
  "liveview.alert.email.useSSL" = "true"
  "liveview.alert.email.username" = "foo@example.com"
  "liveview.alert.email.password" = "foo password"
  "liveview.alert.email.enableSMTPDebugging" = "true"
}
...

Alert Action: Execute Java

Overview

The action is used to execute a Java program when the alert is triggered. Note that because this action can introduce security issues, it is disabled by default.

Configuration

Provide the following parameters in your applicable LiveView client:

  • Set of key-value parameters which can later be accessed in the Java class that you created and saved on the LiveView server.

  • The name of the Java class to execute as part of this action.

Enable this alert action by setting the following system property your LiveView project's LiveView engine configuration file:

systemProperties = {
  "liveview.alert.action.execjava.enabled" = "true"
  }
...

Your LiveView user role must contain the LiveViewAlertActionJava or higher level privilege. See the LiveView privileges page for more information.

LiveView Server readiness

Create the custom Java class that you want to execute as part of an alert action and place it in the LiveView project’s src/main/java folder. The Java class will implement the interface for ExecJavaAction. For an example, see the LiveView Alerting sample's README.

As of Release 10.5.0, you can optionally have the action's configured class validated against a configurable server-wide white list. Use the system property: liveview.alert.execjava.class.whitelist.glob which is set to a semicolon separated list of globs that represent acceptable classes to invoke. The system property has a default value of: com.tibco.ldm.sample.*.

Alert Action: Execute OS

Overview

This action executes the supplied command in a subprocess. Note that because this action can introduce security issues, it is disabled by default.

Configuration

Provide the command to execute and any applicable parameters in your applicable LiveView client.

Enable this alert action by setting the following system property in your LiveView project's LiveView engine configuration file:

systemProperties = {
  "liveview.alert.action.execos.enabled" = "true"
  }
...

Your LiveView user role must contain the LiveViewAlertActionOSCommand or higher level privilege. See the LiveView privileges page for more information.

You can define what is allowed to execute by using semicolon separated list of regex expressions as shown below:

liveview.alert.execos.command.whitelist.regex

It is recommended that each regex expression starts with ^<commandname> to restrict permissions to just the executable desired.

The default value is: ^python .*

Note

Any OS Exec commands that are configured in earlier versions and not matching ^python .* are required to update the whitelist system property.

LiveView Server readiness

The command must be an absolute path or on the PATH of the process running the LiveView server. See the LiveView Alerting Sample for an example.

Alert Action: Publish to LiveView Table

Overview

The action publishes a row to the configured LiveView URI. Note that you can use any field substitution values to set fields in the row to be published to the LiveView Table.

Configuration

Set the following parameters using your applicable LiveView client:

  • URL of the LiveView server.

  • Name of the LiveView table.

  • Field substitutions that must be done before publishing the row to the destination LiveView table.

LiveView Server readiness

The server is ready to perform this action by default.

Alert Action: Execute a Delete Query

OverView

This action is used to delete the rows of a LiveView table. LiveView’s analytics engine runs in memory — in order to keep the server streaming new data, it is a best practice deleting the data that is no longer useful, to free up heap memory. An example would be to run a cron-based alert nightly and configure your alert with this alert action to delete the data that is no longer needed.

For more information about table trimming through deletes, see Alert Rule: Delete Rows Action.

Configuration

Provide the following parameters using your applicable LiveView client (API or LiveView Web, for example):

  • The table name whose rows are to be deleted.

  • The delete predicate to be used.

For example:

Table: ItemsSales
Delete predicate: when transactionTime between BEGIN and now()-minutes(5)
LiveView Server readiness

The server is ready to perform this action by default.

Alert Action: Execute a REST Invocation

Overview

This action calls a REST endpoint using the HTTP protocol. The default number of redirections followed during invoke HTTP action is 5.

Configuration

Configure the following as needed:

  • URL (String): where the request is sent (required).

  • Method (String) (required): Supported request types:

    • GET

    • POST

    • PUT

    • PATCH

    • DELETE

    For example:

    URL: http://test@example.com/path
    Method: POST
    Headers: {empty}
    Query Parameters: {empty}
    Body: "Example Invoke HTTP body"
  • Headers (Map Object): Information that needs to be passed to the receiver.

  • Query Parameters (Map Object): Parameters that carry identifying information about the request.

  • Body (String): Content that should be sent to the receiver.

LiveView Server readiness

The server is ready to perform this action by default. You can change the maximum number of redirections by setting the following system property your LiveView project's LiveView engine configuration file:

systemProperties = {
  "liveview.alert.action.invokehttp.maxredirections" = "7"
  }
...

Alert Action: Send Tuple

Overview

The action will publish a tuple to the configured StreamBase URI.

Configuration

Set the following parameters using your applicable LiveView client:

  • URI of the StreamBase server.

  • Destination input stream for the tuple.

  • Field substitutions that must be done before publishing the tuple to the destination. Essentially, altering the source tuple before forwarding it to the destination.

LiveView Server readiness

The server is ready to perform this action by default.

Alert Action: Publish to LVAlerts

Overview

This action will publish a row to the LVAlerts table. By default it writes the alerting tuple to the Payload field in JSON format.

Configuration

Set the following parameters using your applicable LiveView client:

  • Alert key (String): Key to be used if the auto-generated one is to be overridden.

  • Message (String): Uses the message in alert rule by default but can be overridden with this field.

  • Recipient (String): The username of an intended recipient of the alert. The default is "*" to indicate "anyone".

  • Field Substitutions / (Map Object): Values that can be sent to the specified column in LVAlerts table.

All fields are optional and result in default values being used.

Example:

Alert key: {empty}
Message : "Message override; this will get published"
Recipient: *
Field Substitutions: {empty}
LiveView Server readiness

The server is ready to perform this action by default.