• /
  • EnglishEspañolFrançais日本語한국어Português
  • ログイン今すぐ開始

この機械翻訳は、参考として提供されています。

英語版と翻訳版に矛盾がある場合は、英語版が優先されます。詳細については、このページを参照してください。

問題を作成する

複雑なNRQLアラート

時間枠全体で NRQL 結果を比較し、標準のアラートでは検出できない異常を検出します。

要件:

キーアクション: newrelic.nrdb.querynewrelic.notification.sendEmail

使用例: 次のような標準アラートが要件を満たせない場合にこのパターンを使用します。

  • 複数の時間枠にわたるメトリクスの比較
  • クエリ結果にカスタム数学演算を適用する
  • 特定の閾値またはパターンが検出された場合にのみトリガーする
  • 条件付きロジックを使用して複数のクエリからのデータを結合する
name: Complex_Alert_Workflow
description: 'Compares NRQL results across time windows and sends alerts when new events are detected'
workflowInputs:
destinationId:
type: String
query:
type: String
defaultValue: 'FROM Span SELECT count(*)'
steps:
- name: query1
type: action
action: newrelic.nrdb.query
version: 1
inputs:
query: "${{ .workflowInputs.query }} SINCE 10 minutes ago UNTIL 5 minutes ago"
accountIds:
- 7401815
selectors:
- name: length
expression: '[ .results[] | length ]'
- name: count
expression: '[ .results[0].count ]'
- name: query2
type: action
action: newrelic.nrdb.query
version: 1
inputs:
query: "${{ .workflowInputs.query }} SINCE 5 minutes ago"
accountIds:
- 7401815
selectors:
- name: length
expression: '[ .results[] | length ]'
- name: count
expression: '[ .results[0].count ]'
- name: CheckForNewEvents
type: switch
switch:
- condition: >-
${{ (.steps.query2.outputs.count - .steps.query1.outputs.count) > 0 }}
next: sendEmail
next: end
- name: sendEmail
type: action
action: newrelic.notification.sendEmail
version: 1
inputs:
destinationId: ${{ .workflowInputs.destinationId }}
subject: Hello there!
message: >-
More spans incoming!!!
There are --- ${{ (.steps.query2.outputs.count - .steps.query1.outputs.count) }} ---
new Spans that were ingested in the last 5 minutes
attachments:
- type: QUERY
query: ${{ .workflowInputs.query }} SINCE 5 minutes ago
format: CSV
filename: span_count.csv
next: end

スケジュールするには、cron 式*/10 * * * * (10 分ごと) でCreateSchedule APIを使用します。最小間隔は10分です。詳細については、ワークフローの制限を参照してください。

次のステップ

Copyright © 2026 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.