Event notification templates in Multicloud Observability Platform allow you to customize the content of alert notifications. This guide provides an overview of the available template variables, their types, descriptions, and examples of how to use them.
Template variables are placeholders that get replaced with actual event data when an alert is triggered. Here is a list of common template variables:
Template Variable | Type | Description |
---|---|---|
date, timestamp | Integer | Event generation time in seconds |
df_date_range | Integer | Event time range in seconds |
df_check_range_start | Integer | Check range start Unix timestamp in seconds |
df_check_range_end | Integer | Check range end Unix timestamp in seconds |
df_status | String (Enum) | Event status: critical, error, warning, ok, notanodata |
df_event_id | String | Event unique ID |
df_event_link | String | Event detail page link address |
df_dimension_tags | String | Event dimension tags, e.g., {host:"web-001"} |
df_monitor_id | String | Alarm policy ID |
df_monitor_name | String | Alarm policy name |
df_monitor_checker_id | String | Monitor ID |
df_monitor_checker_name | String | Monitor name |
df_monitor_checker_value | String | Value checked by the monitor |
df_monitor_checker_event_ref | String | Monitor-Event reference key |
df_fault_id | String | Fault ID, value of the first failure event's df_event_id |
df_fault_status | String (Enum) | Fault status: ok, fault |
df_fault_start_time | Integer | Fault start Unix timestamp in seconds |
df_fault_duration | Integer | Fault duration in seconds |
df_user_id | String | User ID of manual event recovery |
df_user_name | String | User name of manual event recovery |
df_user_email | String | User email of manual event recovery |
df_crontab_exec_mode | String (Enum) | Execution mode of the monitor: crontab, manual |
df_site_name | String | Multicloud Observability Platform site or node name |
df_workspace_name | String | Current workspace name |
df_workspace_uuid | String | Current workspace ID |
df_label | List | Label list of the monitor |
df_label[#] | String | Each label of the monitor |
df_check_condition | Dict | Check condition met |
df_check_condition.operator | String | Operator of the check condition met, e.g., >, >=, etc. |
df_check_condition.operands | List | Operand list of the check condition met |
df_check_condition.operands[#] | Integer, Float | Each operand of the check condition met |
Result | Integer, Float | Instrumented value detected when the event was generated |
{Key-values in df_dimension_tags} | String | Key-values in df_dimension_tags abstracted here |
df_event | Dict | Entire event data |
Suppose there is a monitor with by option configured with region and host, and the template is shown below:
Event name:
Monitor {{ df_monitor_checker_name }} found a fault with {{ df_dimension_tags }}
Event content:
- Region: {{ region }} - Host: {{ host }} - Status: {{ df_status }} - Result: {{ Result }} - Monitor: {{ df_monitor_checker_name }} (Alarm policy: {{ df_monitor_name }})
Then, once an error event occurs, the rendered output is shown below:
Output event name:
Monitor monitor001 found a fault with {"region":"southeastasia", "host":"web-001"}
Output event content:
- Region: southeastasia - Host: web-001 - Status: error - Result: 90.12345 - Monitor: monitor001 (Alarm policy: Team001)
In some cases, the dimension tag key may contain special characters such as -, @, etc., e.g., host-name, @level.
According to the template syntax, such field names can't be used as normal variable names, resulting in rendering failure.
In this case, {{ df_event['host-name'] }}, {{ df_event['@level'] }} can be used instead of {{ host-name }}, {{ @level }}.