Advanced Detectors

アラートメッセージとアラートルールの更新

2 min

目的

以下の方法で、複合条件の検出ロジックを正確に反映するようにアラートメッセージをカスタマイズします


ステップ 1 – Detector の保存

右上の をクリックします。


ステップ 2 – アラートメッセージの編集

Detector の Alert Rules タブに移動します。

既存の Alert Rule の をクリックします。

Alert message タブを選択し、Customize をクリックします。

確認

以前ウィザードで生成されたメッセージ本文が表示されなくなっていることに注目してください。

SignalFlow で Detector を編集した後、なぜデフォルトのメッセージが消えたのでしょうか?

メッセージが削除された理由

SignalFlow で Detector を編集した時点で、ウィザードが管理するヘルパー関数の範囲を超えました。

検出ロジックがカスタムストリームと手動で構成された detect() ステートメントを使用するようになったため、プラットフォームは以下を安全に推測できなくなりました

  • どの条件がアラートをトリガーしたか
  • どのしきい値が権威あるものか
  • 検出ロジックをどのように説明するか

検出ロジックの所有権を持つ場合、アラートメッセージの所有権も持つ必要があります。

メッセージ本文を以下に置き換えます

handlebars
{{#if anomalous}}
 Rule "{{{ruleName}}}" in detector "{{{detectorName}}}" triggered at {{timestamp}}.
{{else}}
 Rule "{{{ruleName}}}" in detector "{{{detectorName}}}" cleared at {{timestamp}}.
{{/if}}

{{#if anomalous}}
Triggering condition: {{{readableRule}}}
{{/if}}

Mean value of signal in the last {{event_annotations.current_window}}: {{inputs.CPU.value}}

{{#if anomalous}}
Historical anomaly threshold: {{inputs.CPU_top_threshold.value}}
Static guardrail threshold: {{inputs.CPU_static_threshold.value}}
{{else}}
Clear threshold: {{inputs.clear_top.value}}
{{/if}}

{{#notEmpty dimensions}}
Signal details:
{{{dimensions}}}
{{/notEmpty}}

{{#if anomalous}}
{{#if runbookUrl}}Runbook: {{{runbookUrl}}}{{/if}}
{{#if tip}}Tip: {{{tip}}}{{/if}}
{{/if}}

{{#if detectorTags}}Tags: {{detectorTags}}{{/if}}

{{#if detectorTeams}}
Teams:{{#each detectorTeams}} {{name}}{{#unless @last}},{{/unless}}{{/each}}.
{{/if}}

これにより、以下を明示的に参照しています

これらの変数は、両方のストリームが SignalFlow でパブリッシュされているため使用可能です。


をクリックしてカスタムメッセージを保存します。

をクリックします。


ステップ 3 – アラートルールの説明の更新

Activate… ステップで、Description を以下に更新します

text
The 10m moving average of system.cpu.utilization (assumed to be cyclical over 1d periods) is more than 2.5 standard deviation(s) above its historical norm and has exceeded 90% for 15 minutes.

をクリックして変更を保存します。


まとめ

ここまでで以下を完了しました

Last Modified ·