Go to main content

Oracle® ZFS Storage Appliance 管理ガイド、Release OS8.8.x

印刷ビューの終了

更新: 2021 年 8 月
 
 

カスタムアラート関数の使用

createalert 関数はカスタムアラートを作成し、postalert 関数はアラートを送信します。createalert 関数は、スクリプトまたはワークフローから呼び出すことができます。postalert 関数は、ワークフローから呼び出す必要があります。ワークフロー内からのカスタムアラートの作成および送信を参照してください。

  1. 次の関数呼び出しは、最小限度のカスタムアラートを作成します。
    createalert([{'handler': 'syslog', 'args': {}}], {description: 'Writes to syslog'});
  2. 次のスクリプトは、追加パラメータを指定して戻り値を取得します。

    戻り値は、アラートを送信するために必要です。postalert 呼び出しがこのスクリプトに表示されていますが、postalert はワークフローで発生するイベントに対する応答として、ワークフロー内から呼び出される必要があります。

    script
    ("." to run)> var actions = [{
    ("." to run)>     handler: 'email',
    ("." to run)>     args: {
    ("." to run)>         address: 'admin@example.com',
    ("." to run)>         subject: 'Custom Alert Response'
    ("." to run)>     }
    ("." to run)> }];
    ("." to run)> var params = {
    ("." to run)>     severity: 'Minor',
    ("." to run)>     description: 'Custom alert description',
    ("." to run)>     response: 'What the alert action does',
    ("." to run)>     impact: 'What happened to the appliance',
    ("." to run)>     recommended_action: 'What the administrator should do'
    ("." to run)> };
    ("." to run)> var cuuid = createalert(actions, params);
    ("." to run)> print(cuuid);
    ("." to run)> var puuid = postalert(cuuid);
    ("." to run)> .
    54c24732-b9c5-4b57-9aee-aeaf195afdae