Dec 3, 2015

Customising Your Email Alerts (Pulse v5.5.1 or earlier version)

Pulse now enables you to customise the email that is generated based on alert criteria. This is useful if you want to integrate the Pulse alerts into an existing help desk/ticketing system that accepts email as a ticket input source.

Customising the Subject Line

A custom prefix can be added to the subject line for alerts. To do this you need to:

  1. Open the Pulse.cfg file located by default at C:Program FilesPulse for TM1confPulse.cfg
  2. Find the setting SubjectPrefix, the default value is [Alert].
  3. Change this value to whatever you like.
  4. Save the file.
  5. Restart the two Pulse services.

Customising the Body of the Email

The body of the email can also be customised, here you have the ability to fully customise the email to your needs. Pulse uses a templating system called the Spark View Engine to render the email content. It uses html like tags to create logic, if/else and loops, and ${variableName} syntax for displaying content.

The template directory is located in the serverViews folder in the Pulse install directory. The default location is: C:Program FilesPulse for TM1serverViews

The default template that is shipped with Pulse and is used for all alerts is called Default.spark. You should use this as a basis for your custom alerts, don’t edit this file directly as it will be overwritten each time Pulse starts.

When an alert is generated Pulse searches the template directory for a template using the following hierarchy:

  1. A template the has the same name as the Alert Type, the possible values are:
    • Shutdown.spark (Offline),
    • Memory.spark,
    • CPU.spark,
    • Threads.spark (Concurrent Users),
    • Error Log.spark,
    • Disk Free.spark,
    • Run Time.spark,
    • Waiting.spark,
    • Wait Time.spark,
    • Rollback Event.spark,
    • Cancel Thread.spark,
    • Server Log.spark,
    • Process Run Time.spark,
    • Chore Run Time.spark 
  2. If Pulse cannot find one of the templates above it will look for a file called Custom.spark.
  3. If the Custom.spark file cannot be found Pulse will revert to the default template, Default.spark.

 

Creating a New Template

Instead of creating a template from scratch you should first copy the Default.spark template naming it either Custom.spark or the name of the particular alert you want to customise. 

You can use any text editor to customise the file but we recommend using Notepad++ as it is very easy to use. You can also colour the html syntax by selecting HTML from the Notepad++ Language menu.

The HTML syntax for most email clients is a cut down version or what is available in the browser so try to limit the use of css styles and instead use inline styles (i.e. style=”text-align:left;”).

The viewdata section at the top of the template notifies the template of the variables that are available to use and their types. There are 6 variables that you can use in the template:

  • state (Pickup.Monitor.ServerState): The full details of the state of the server when the alert was generated. More details are below.
  • message (string): The message for the alert that has been generated by Pulse.
  • serveraddress (string): The server address for the Pulse server.
  • alert (true/false): Whether the email is an alert.
  • operatingsystem (string): The name of the operating system that is installed on the server.
  • tm1version (string): The installed version of TM1, i.e. 10.2.200

The syntax for the template is described on the Spark website, you should familiarise yourself with this syntax before attempting to change the template. To edit the template:

  1. Open the template in Notepad++ (or your favourite text editor).
  2. Edit the template.
  3. Save the file.
  4. Test using an existing alert (see below).
  5. Check the server.log file for any errors (located by default at C:Program FilesPulse for TM1logsserver.logs).

 

Testing

To test the alert template you are going to have to create an alert that gets generated frequently. The easiest way to do this is to create a memory alert with a low threshold (5%) and set the Repeat Interval to 1 minute.

 

Server State Object

The state object contains most of the information that you will want to display in the email. The best way to pick up what to display is by looking at the existing Default.spark template. A full description of the content of the object is below:

  • ServerState is the root object.
    • ServiceStates is a list of ServiceState objects.
      • TM1Top contains TM1TopState.
        • Items contains a list of TM1TopItem objects.

ServerState

ServiceState

TM1TopState

TM1TopItem

Related content

Loading related content