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

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

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

問題を作成する

コンディショナル・ロジック

前のステップのデータに基づいて決定を下すには、switch ステートメントを使用します。

switch ステートメントで有効になるもの:

  • 条件に基づいて決定木を作成する
  • データ値に基づいてワークフロー実行をさまざまなステップにルーティングします
  • 複数の条件を順番に評価する
  • 条件が一致しない場合のデフォルトの動作を定義する

データを使った条件付きロジック

steps:
- name: checkCPU
type: action
action: newrelic.nerdgraph.execute
version: 1
# ... query configuration
- name: decideAction
type: switch
switch:
- condition: "${{ .steps.checkCPU.outputs.data.actor.account.nrql.results[0].average > 90 }}"
next: resizeInstance
- condition: "${{ .steps.checkCPU.outputs.data.actor.account.nrql.results[0].average > 70 }}"
next: sendWarning
next: normalOperation
- name: resizeInstance
type: action
action: aws.ec2.modifyInstanceAttribute
version: 1
# ... resize configuration
- name: sendWarning
type: action
action: slack.chat.postMessage
version: 1
# ... warning message
- name: normalOperation
type: action
action: newrelic.ingest.sendLogs
version: 1
# ... log normal status

次のステップ

Copyright © 2026 New Relic株式会社。

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