Synthetic Monitoring Advanced Notifications
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、
お気軽にご連絡ください。
Overview
You can customize Synthetic monitor messages using handlebars templating. The following examples cover advanced techniques such as comments, list access, conditions, and iterations.
Note: Always test your syntax directly in the monitor message editor, as template behavior may vary slightly across versions.
Use comments to explain what the template is doing. Comments are removed from the final rendered message.
{{! This is a comment }}
{{!
This is a
multi-line comment
}}
Raw strings
To display raw values without HTML escaping (for example, URLs, or HTTP responses in code blocks), use triple curly braces:
Accessing list data
You can loop over lists (like steps or variables) or access items directly:
{{list.2.name}} {{! third item }}
{{list.-1.status}} {{! last item }}
{{list[My Complex Name]url}} {{! use bracket notation for complex keys }}
{{list[My Complex Name]failure.code}}
{{list.abc-def-ghi}} {{! access via ID (case-insensitive) }}
Note: All durations are in milliseconds.
Durations:
{{eval "synthetics.attributes.result.duration/1000"}}
Data Sizes:
{{eval "humanize_bytes(bodySize)"}}
Conditions
Use #if
, #is_match
, and #is_exact_match
for logic-based rendering.
Boolean check:
{{#if synthetics.attributes.variable.config.CONFIG_VAR.secure}}
The CONFIG_VAR variable is obfuscated
{{else}}
The CONFIG_VAR variable isn't obfuscated
{{/if}}
Conditional alerting based on step ID
{{#is_exact_match synthetics.failed_step.id "svn-yrx-3xg"}}
A backend-related step failed!
@slack-backend-team
{{else}}
Another step failed, probably Frontend related
@slack-frontend-team
{{/is_exact_match}}
Use #if
over #is_exact_match
for checking if a variable is empty or unset.
Iteration
Use #each
to loop over dictionaries or lists. You can access:
this
→ the current item@key
→ the current key (for dictionaries)@index
, @first
, @last
→ loop metadata
Dictionary example:
{{#each users}}
# User `{{@key}}`
Name: {{name}}
Permissions: {{permissions}}
{{/each}}
Users: {{#each users}}`{{@key}}` ({{name}}){{#unless @last}}, {{/unless}}{{/each}}
Steps loop
{{#each synthetics.attributes.result.steps}}
* Step name: {{description}}
* Step status: {{status}}
* Step type: {{type}}
{{/each}}
Further Reading